diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/chrdlg/numpara.cxx | 53 | ||||
-rw-r--r-- | sw/source/uibase/inc/numpara.hxx | 5 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/numparapage.ui | 12 |
3 files changed, 69 insertions, 1 deletions
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 <numpara.hxx> #include <app.hrc> +#include <svl/stritem.hxx> +#include <sfx2/app.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sfxhelp.hxx> +#include <sfx2/viewsh.hxx> 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 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkButton" id="editnumstyle"> + <property name="label" translatable="yes">Edit Style</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> |