From de896f74c805e77706cce10f4d79117af1811ee9 Mon Sep 17 00:00:00 2001 From: Heena Gupta Date: Wed, 24 Dec 2014 15:55:37 +0530 Subject: fdo#87675-"Edit" Button for next style in edit paragraph style Change-Id: I1a4888b869df7f242244bed2fef36996450eec23 Reviewed-on: https://gerrit.libreoffice.org/13639 Reviewed-by: Michael Stahl Tested-by: Michael Stahl --- include/sfx2/mgetempl.hxx | 5 ++++ sfx2/source/dialog/mgetempl.cxx | 53 ++++++++++++++++++++++++++++++++++++- sfx2/uiconfig/ui/managestylepage.ui | 15 +++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx index 06deead04eae..12fafb48b187 100644 --- a/include/sfx2/mgetempl.hxx +++ b/include/sfx2/mgetempl.hxx @@ -43,6 +43,7 @@ class SfxManageStyleSheetPage : public SfxTabPage FixedText* m_pFollowFt; ListBox* m_pFollowLb; + PushButton* m_pEditStyleBtn; FixedText* m_pBaseFt; ListBox* m_pBaseLb; @@ -69,6 +70,7 @@ friend class SfxStyleDialog; DECL_LINK( GetFocusHdl, Edit * ); DECL_LINK( LoseFocusHdl, Edit * ); + DECL_LINK( EditStyleHdl_Impl, void * ); void UpdateName_Impl(ListBox *, const OUString &rNew); void SetDescriptionText_Impl(); @@ -82,6 +84,9 @@ protected: virtual bool FillItemSet(SfxItemSet *) SAL_OVERRIDE; virtual void Reset(const SfxItemSet *) SAL_OVERRIDE; + bool Execute_Impl( sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr, + sal_uInt16 nFamily, sal_uInt16 nMask = 0, + const sal_uInt16* pModifier = NULL ); using TabPage::ActivatePage; virtual void ActivatePage(const SfxItemSet &) SAL_OVERRIDE; using TabPage::DeactivatePage; diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index c7a70ca630d9..c9c83704073e 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -34,10 +34,14 @@ #include #include +#include +#include "templdgi.hxx" #include #include "dialog.hrc" #include +#include +#include /* SfxManageStyleSheetPage Constructor * @@ -62,6 +66,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx m_pFollowLb->SetStyle(m_pFollowLb->GetStyle() | WB_SORT); const sal_Int32 nMaxWidth(62); m_pFollowLb->setMaxWidthChars(nMaxWidth); + get(m_pEditStyleBtn, "editstyle"); get(m_pBaseFt, "linkedwithft"); get(m_pBaseLb, "linkedwith"); m_pBaseLb->SetStyle(m_pBaseLb->GetStyle() | WB_SORT); @@ -223,6 +228,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx // It is a style with auto update? (SW only) if(SfxItemState::SET == rAttrSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE)) m_pAutoCB->Show(); + m_pEditStyleBtn->SetClickHdl( LINK( this, SfxManageStyleSheetPage, EditStyleHdl_Impl ) ); } @@ -309,7 +315,53 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() m_pDescFt->SetText( pStyle->GetDescription( eUnit ) ); } +IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditStyleHdl_Impl ) +{ + + OUString aTemplName(m_pFollowLb->GetSelectEntry()); + if (Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),(sal_uInt16)pStyle->GetFamily(), 0 )) + { + } + return 0; + +} + +// Internal: Perform functions through the Dispatcher +bool SfxManageStyleSheetPage::Execute_Impl( + sal_uInt16 nId, const OUString &rStr, const OUString& rRefStr, sal_uInt16 nFamily, + sal_uInt16 nMask, const sal_uInt16* pModifier) +{ + + SfxDispatcher &rDispatcher = *SfxGetpApp()->GetDispatcher_Impl(); + 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_INLINE_START( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit ) @@ -325,7 +377,6 @@ IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit ) IMPL_LINK_INLINE_END( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit ) - IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, LoseFocusHdl, Edit *, pEdit ) /* [Description] diff --git a/sfx2/uiconfig/ui/managestylepage.ui b/sfx2/uiconfig/ui/managestylepage.ui index 99815f2d00c0..396fd3966951 100644 --- a/sfx2/uiconfig/ui/managestylepage.ui +++ b/sfx2/uiconfig/ui/managestylepage.ui @@ -98,6 +98,21 @@ 2 + + + Edit Style + True + True + True + True + True + True + + + 2 + 2 + + True -- cgit v1.2.3