[Libreoffice-commits] .: 2 commits - sfx2/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Mar 7 07:01:41 PST 2011


 sfx2/source/dialog/templdlg.cxx |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 722586f023c63a4f0f208add61e56a1e5f441ce6
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date:   Mon Mar 7 15:55:49 2011 +0100

    fdo#30917: make the code easier to understand by using constants

diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index db41cb6..34e5418 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -100,6 +100,13 @@ static USHORT nLastItemId = USHRT_MAX;
 // filter box has maximum 12 entries visible
 #define MAX_FILTER_ENTRIES          12
 
+// Special constant to save hierarchical mode
+// We've to use this hack since this is not the
+// index in the filter listbox that is saved but the
+// index in the filters list and hierarchical is not
+// in it
+#define HIERARCHICAL_FILTER_INDEX   0xfffe  // 0xffff is reserved
+
 //=========================================================================
 
 TYPEINIT0(SfxCommonTemplateDialog_Impl);
@@ -1781,7 +1788,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox )
             SfxViewFrame *pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame();
             SfxObjectShell *pDocShell = pViewFrame->GetObjectShell();
             if (pDocShell)
-                SaveFactoryStyleFilter( pDocShell, -2 );
+                SaveFactoryStyleFilter( pDocShell, HIERARCHICAL_FILTER_INDEX );
             FillTreeBox();
             SelectStyle(aSelectEntry);
             pTreeBox->Show();
@@ -2290,9 +2297,9 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(
     aFont.SetWeight( WEIGHT_NORMAL );
     aFilterLb.SetFont( aFont );
     m_aActionTbL.SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT );
-    if( nSavedFilter == 0xfffe  )
+    if( nSavedFilter == HIERARCHICAL_FILTER_INDEX )
     {
-        bHierarchical = FALSE;
+        bHierarchical = FALSE; // Force content refresh
         aFilterLb.SelectEntry(String(SfxResId(STR_STYLE_FILTER_HIERARCHICAL)));
         FilterSelectHdl(&aFilterLb);
     }
commit 2be280399613be646ae1e0add4dddd51b85acbe2
Author: Gert Faller <gertfaller at aliceadsl.fr>
Date:   Mon Mar 7 15:50:09 2011 +0100

    fdo#30917: Storing the hierarchical view of style browser

diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index b96d876..db41cb6 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1778,7 +1778,10 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox )
             ((StyleTreeListBox_Impl*)pTreeBox)->
                 SetDropHdl(LINK(this, SfxCommonTemplateDialog_Impl,  DropHdl));
             pTreeBox->SetIndent(10);
-
+            SfxViewFrame *pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame();
+            SfxObjectShell *pDocShell = pViewFrame->GetObjectShell();
+            if (pDocShell)
+                SaveFactoryStyleFilter( pDocShell, -2 );
             FillTreeBox();
             SelectStyle(aSelectEntry);
             pTreeBox->Show();
@@ -2273,6 +2276,9 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(
 
 {
     pDlgWindow->FreeResource();
+    SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame();
+    pCurObjShell = pViewFrame->GetObjectShell();
+    USHORT nSavedFilter = static_cast< USHORT >( LoadFactoryStyleFilter( pCurObjShell ) );
     Initialize();
 
     m_aActionTbL.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect));
@@ -2284,6 +2290,12 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(
     aFont.SetWeight( WEIGHT_NORMAL );
     aFilterLb.SetFont( aFont );
     m_aActionTbL.SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT );
+    if( nSavedFilter == 0xfffe  )
+    {
+        bHierarchical = FALSE;
+        aFilterLb.SelectEntry(String(SfxResId(STR_STYLE_FILTER_HIERARCHICAL)));
+        FilterSelectHdl(&aFilterLb);
+    }
 }
 
 // ------------------------------------------------------------------------


More information about the Libreoffice-commits mailing list