diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-07-02 20:46:33 +0200 |
---|---|---|
committer | Bosdonnat Cedric <cedric.bosdonnat@free.fr> | 2013-07-03 08:07:35 +0000 |
commit | 8c51ceb7166e63950cd7284fd59e8971c43605ee (patch) | |
tree | c809a597de3570a146d15436a3d856ff9c9b87f3 | |
parent | c6c5636a69fa9261e02ac357dec0e8987a5ad829 (diff) |
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@free.fr>
Tested-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 44 | ||||
-rw-r--r-- | sfx2/source/inc/templdgi.hxx | 1 |
2 files changed, 26 insertions, 19 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index c551bac9d027..4ef3cdf994b6 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 c78ad47be16e..ebefb765e741 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* ); |