[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sfx2/source

Michael Stahl mstahl at redhat.com
Wed Jul 3 01:07:59 PDT 2013


 sfx2/source/dialog/templdlg.cxx |   44 ++++++++++++++++++++++------------------
 sfx2/source/inc/templdgi.hxx    |    1 
 2 files changed, 26 insertions(+), 19 deletions(-)

New commits:
commit 8c51ceb7166e63950cd7284fd59e8971c43605ee
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 2 20:46:33 2013 +0200

    fdo#61429: Stylist: try a little harder to restore "hierarchical"
    
    Change-Id: I30972224c5a9aa12c4ef4c2b5ca80e7aece0baad
    (cherry picked from commit 8f04b172c5c78fa80c3692a729f0191425195869)
    Reviewed-on: https://gerrit.libreoffice.org/4687
    Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat at free.fr>
    Tested-by: Bosdonnat Cedric <cedric.bosdonnat at free.fr>

diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index c551bac..4ef3cdf 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -958,14 +958,17 @@ void SfxCommonTemplateDialog_Impl::Initialize()
     ReadResource();
     pBindings->Invalidate( SID_STYLE_FAMILY );
     pBindings->Update( SID_STYLE_FAMILY );
+
     Update_Impl();
 
     aFilterLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FilterSelectHdl ) );
     aFmtLb.SetDoubleClickHdl( LINK( this, SfxCommonTemplateDialog_Impl, ApplyHdl ) );
     aFmtLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FmtSelectHdl ) );
 
+
     aFilterLb.Show();
-    aFmtLb.Show();
+    if (!bHierarchical)
+        aFmtLb.Show();
 }
 
 //-------------------------------------------------------------------------
@@ -1282,6 +1285,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
             if (pTreeBox || m_bWantHierarchical)
             {
                 aFilterLb.SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString());
+                EnableHierarchical(true);
             }
 
             // show maximum 14 entries
@@ -1290,21 +1294,12 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
         }
         else
         {
-            if (m_bWantHierarchical)
-            {
-                nActFilter = 0;
-                aFilterLb.SelectEntry(SfxResId(
-                            STR_STYLE_FILTER_HIERARCHICAL).toString());
-            }
+            if (nActFilter < aFilterLb.GetEntryCount() - 1)
+                aFilterLb.SelectEntryPos(nActFilter + 1);
             else
             {
-                if (nActFilter < aFilterLb.GetEntryCount() - 1)
-                    aFilterLb.SelectEntryPos(nActFilter + 1);
-                else
-                {
-                    nActFilter = 0;
-                    aFilterLb.SelectEntryPos(1);
-                }
+                nActFilter = 0;
+                aFilterLb.SelectEntryPos(1);
             }
         }
 
@@ -1740,11 +1735,11 @@ sal_Bool SfxCommonTemplateDialog_Impl::Execute_Impl(
 //-------------------------------------------------------------------------
 
 // Handler der Listbox der Filter
-IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox )
+void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable)
 {
-    if ( SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString().equals(pBox->GetSelectEntry()) )
+    if (bEnable)
     {
-        if ( !bHierarchical )
+        if (!bHierarchical)
         {
             // Turn on treeView
             bHierarchical=sal_True;
@@ -1775,7 +1770,6 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox )
             pTreeBox->Show();
         }
     }
-
     else
     {
         DELETEZ(pTreeBox);
@@ -1783,9 +1777,21 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox )
         // If bHierarchical, then the family can have changed
         // minus one since hierarchical is inserted at the start
         m_bWantHierarchical = sal_False; // before FilterSelect
-        FilterSelect(pBox->GetSelectEntryPos() - 1, bHierarchical );
+        FilterSelect(aFilterLb.GetSelectEntryPos() - 1, bHierarchical );
         bHierarchical=sal_False;
     }
+}
+
+IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox )
+{
+    if (SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString().equals(pBox->GetSelectEntry()))
+    {
+        EnableHierarchical(true);
+    }
+    else
+    {
+        EnableHierarchical(false);
+    }
 
     return 0;
 }
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index c78ad47..ebefb76 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -202,6 +202,7 @@ protected:
     void                        ResetFocus();
     void                        EnableDelete();
     void                        Initialize();
+    void                        EnableHierarchical(bool);
 
     void                FilterSelect( sal_uInt16 nFilterIdx, sal_Bool bForce = sal_False );
     void                SetFamilyState( sal_uInt16 nSlotId, const SfxTemplateItem* );


More information about the Libreoffice-commits mailing list