From e38f63d861715fb56f41af82b897c2128ea20b38 Mon Sep 17 00:00:00 2001 From: Heena Gupta Date: Mon, 5 Jan 2015 16:42:06 +0530 Subject: fdo#88045-Edit Button for Numbering Style in Edit Paragraph Style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7356eb2074520884ff24d89c68bf1214664f4af3 Reviewed-on: https://gerrit.libreoffice.org/13740 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/ui/chrdlg/numpara.cxx | 53 ++++++++++++++++++++++++++++++++++- sw/source/uibase/inc/numpara.hxx | 5 ++++ sw/uiconfig/swriter/ui/numparapage.ui | 12 ++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index 6c77ccaeba1b..4156186396a3 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -32,6 +32,11 @@ #include #include +#include +#include +#include +#include +#include const sal_uInt16 SwParagraphNumTabPage::aPageRg[] = { FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT, @@ -50,7 +55,7 @@ SwParagraphNumTabPage::SwParagraphNumTabPage(vcl::Window* pParent, const SfxItem get(m_pNumberStyleBX, "boxNUMBER_STYLE"); get(m_pNumberStyleLB, "comboLB_NUMBER_STYLE"); - + get(m_pEditNumStyleBtn, "editnumstyle"); get(m_pNewStartBX, "boxNEW_START"); get(m_pNewStartCB, "checkCB_NEW_START"); m_pNewStartCB->SetState(TRISTATE_FALSE); @@ -84,6 +89,7 @@ SwParagraphNumTabPage::SwParagraphNumTabPage(vcl::Window* pParent, const SfxItem m_pNumberStyleLB->SetSelectHdl(LINK(this, SwParagraphNumTabPage, StyleHdl_Impl)); m_pCountParaCB->SetClickHdl(LINK(this, SwParagraphNumTabPage, LineCountHdl_Impl)); m_pRestartParaCountCB->SetClickHdl( LINK(this, SwParagraphNumTabPage, LineCountHdl_Impl)); + m_pEditNumStyleBtn->SetClickHdl( LINK(this, SwParagraphNumTabPage, EditNumStyleHdl_Impl)); } SwParagraphNumTabPage::~SwParagraphNumTabPage() @@ -276,6 +282,7 @@ IMPL_LINK_NOARG(SwParagraphNumTabPage, NewStartHdl_Impl) return 0; } + IMPL_LINK_NOARG(SwParagraphNumTabPage, LineCountHdl_Impl) { m_pRestartParaCountCB->Enable(m_pCountParaCB->IsChecked()); @@ -287,6 +294,50 @@ IMPL_LINK_NOARG(SwParagraphNumTabPage, LineCountHdl_Impl) return 0; } +IMPL_LINK_NOARG(SwParagraphNumTabPage, EditNumStyleHdl_Impl) +{ + OUString aTemplName(m_pNumberStyleLB->GetSelectEntry()); + if (aTemplName != "None") + ExecuteEditNumStyle_Impl( SID_STYLE_EDIT, aTemplName, OUString(),SFX_STYLE_FAMILY_PARA, 0 ); + return 0; +} + +// Internal: Perform functions through the Dispatcher +bool SwParagraphNumTabPage::ExecuteEditNumStyle_Impl( + sal_uInt16 nId, const OUString &rStr, const OUString& rRefStr, sal_uInt16 nFamily, + sal_uInt16 nMask, const sal_uInt16* pModifier) +{ + + SfxDispatcher &rDispatcher = *SfxViewShell::Current()->GetDispatcher(); + SfxStringItem aItem(nId, rStr); + SfxUInt16Item aFamily(SID_STYLE_FAMILY, nFamily); + SfxUInt16Item aMask( SID_STYLE_MASK, nMask ); + SfxStringItem aUpdName(SID_STYLE_UPD_BY_EX_NAME, rStr); + SfxStringItem aRefName( SID_STYLE_REFERENCE, rRefStr ); + const SfxPoolItem* pItems[ 6 ]; + sal_uInt16 nCount = 0; + if( !rStr.isEmpty() ) + pItems[ nCount++ ] = &aItem; + pItems[ nCount++ ] = &aFamily; + if( nMask ) + pItems[ nCount++ ] = &aMask; + if( !rRefStr.isEmpty() ) + pItems[ nCount++ ] = &aRefName; + + pItems[ nCount++ ] = 0; + + sal_uInt16 nModi = pModifier ? *pModifier : 0; + const SfxPoolItem* mpItem = rDispatcher.Execute( + nId, SfxCallMode::SYNCHRON | SfxCallMode::RECORD | SfxCallMode::MODAL, + pItems, nModi ); + + if ( !mpItem ) + return false; + + return true; + +} + IMPL_LINK( SwParagraphNumTabPage, StyleHdl_Impl, ListBox*, pBox ) { bool bEnable = bCurNumrule || pBox->GetSelectEntryPos() > 0; diff --git a/sw/source/uibase/inc/numpara.hxx b/sw/source/uibase/inc/numpara.hxx index 20283db6d5ca..8ddd0fc945d1 100644 --- a/sw/source/uibase/inc/numpara.hxx +++ b/sw/source/uibase/inc/numpara.hxx @@ -33,6 +33,7 @@ class SwParagraphNumTabPage : public SfxTabPage ListBox* m_pOutlineLvLB; VclHBox* m_pNumberStyleBX; ListBox* m_pNumberStyleLB; + PushButton* m_pEditNumStyleBtn; TriStateBox* m_pNewStartCB; VclHBox* m_pNewStartBX; @@ -55,12 +56,16 @@ class SwParagraphNumTabPage : public SfxTabPage DECL_LINK(NewStartHdl_Impl, void *); DECL_LINK( StyleHdl_Impl, ListBox* ); DECL_LINK(LineCountHdl_Impl, void *); + DECL_LINK(EditNumStyleHdl_Impl, void *); static const sal_uInt16 aPageRg[]; protected: SwParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rSet ); void aCountParaFL(); + bool ExecuteEditNumStyle_Impl( sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr, + sal_uInt16 nFamily, sal_uInt16 nMask = 0, + const sal_uInt16* pModifier = NULL ); public: virtual ~SwParagraphNumTabPage(); diff --git a/sw/uiconfig/swriter/ui/numparapage.ui b/sw/uiconfig/swriter/ui/numparapage.ui index c3efa62d82b4..ca0f0951dc4f 100644 --- a/sw/uiconfig/swriter/ui/numparapage.ui +++ b/sw/uiconfig/swriter/ui/numparapage.ui @@ -165,6 +165,18 @@ 1 + + + Edit Style + True + False + + + False + True + 2 + + False -- cgit v1.2.3