[Libreoffice-commits] core.git: include/sfx2 sfx2/source sfx2/uiconfig

Heena Gupta heena.h.gupta at ericsson.com
Fri Feb 6 15:57:40 PST 2015


 include/sfx2/mgetempl.hxx           |    5 +++
 sfx2/source/dialog/mgetempl.cxx     |   53 +++++++++++++++++++++++++++++++++++-
 sfx2/uiconfig/ui/managestylepage.ui |   15 ++++++++++
 3 files changed, 72 insertions(+), 1 deletion(-)

New commits:
commit de896f74c805e77706cce10f4d79117af1811ee9
Author: Heena Gupta <heena.h.gupta at ericsson.com>
Date:   Wed Dec 24 15:55:37 2014 +0530

    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 <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx
index 06deead..12fafb4 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 c7a70ca..c9c8370 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -34,10 +34,14 @@
 #include <sfx2/sfxresid.hxx>
 #include <sfx2/module.hxx>
 
+#include <sfx2/templdlg.hxx>
+#include "templdgi.hxx"
 #include <sfx2/sfx.hrc>
 #include "dialog.hrc"
 
 #include <svl/style.hrc>
+#include <svl/stritem.hxx>
+#include <sfx2/dispatch.hxx>
 
 /*  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 99815f2..396fd39 100644
--- a/sfx2/uiconfig/ui/managestylepage.ui
+++ b/sfx2/uiconfig/ui/managestylepage.ui
@@ -99,6 +99,21 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkButton" id="editstyle">
+                    <property name="label" translatable="yes">Edit Style</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="has_default">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="top_attach">2</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkComboBoxText" id="linkedwith">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>


More information about the Libreoffice-commits mailing list