diff options
author | Anshu <anshukhare50@gmail.com> | 2021-08-02 04:52:42 -0700 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-17 09:02:32 +0200 |
commit | 39e969ac53b7e0b2c4889a3f910d97521ec4251f (patch) | |
tree | e48df834941f831ca2d9afbc93ffe25ea99c5f7a /sfx2/source/dialog/templdlg.cxx | |
parent | eeca6567cde1e0f6a7a6827118479d996adc1286 (diff) |
Refactoring
Change-Id: I0863c4afb5dfce549dbcbdae4b8a63068e5d7331
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119878
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2/source/dialog/templdlg.cxx')
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index a3f3cfd8b66d..cd2ab4840310 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -172,11 +172,6 @@ void SfxCommonTemplateDialog_Impl::connect_stylelist_enable_tree_drag(const Link m_aStyleListEnableTreeDrag = rLink; } -void SfxCommonTemplateDialog_Impl::connect_stylelist_filter_select(Link<sal_uInt16, void> rLink) -{ - m_aStyleListFilterSelect = rLink; -} - void SfxCommonTemplateDialog_Impl::connect_stylelist_enable_delete(const Link<void*, void> rLink) { m_aStyleListEnableDelete = rLink; @@ -188,11 +183,6 @@ void SfxCommonTemplateDialog_Impl::connect_stylelist_set_water_can_state( m_aStyleListSetWaterCanState = rLink; } -void SfxCommonTemplateDialog_Impl::connect_family_select(const Link<sal_uInt16, void> rLink) -{ - m_aStyleListFamilySelect = rLink; -} - // Constructor SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl(SfxBindings* pB, weld::Container* pC, weld::Builder* pBuilder) @@ -206,7 +196,6 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl(SfxBindings* pB, weld , mxFilterLb(pBuilder->weld_combo_box("filter")) , nActFamily(0xffff) , nActFilter(0) - , nAppFilter(SfxStyleSearchBits::Auto) , bIsWater(false) , bUpdate(false) , bUpdateFamily(false) @@ -229,6 +218,18 @@ void SfxTemplateDialog_Impl::EnableEdit(bool bEnable) IMPL_LINK(SfxCommonTemplateDialog_Impl, ReadResource_Hdl, StyleList&, rStyleList, void) { + nActFilter = 0xffff; + + SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); + SfxObjectShell* pCurObjShell = pViewFrame->GetObjectShell(); + if (pCurObjShell) + { + nActFilter = static_cast<sal_uInt16>(LoadFactoryStyleFilter_Hdl(pCurObjShell)); + if (0xffff == nActFilter) + { + nActFilter = pCurObjShell->GetAutoStyleFilterIndex(); + } + } size_t nCount = m_aStyleListReadResource.Call(nullptr); @@ -307,7 +308,7 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, UpdateStyles_Hdl, StyleFlags, nFlags, vo else { nActFilter = 0; - m_aStyleList.SetFilterIdx(nActFilter); + m_aStyleList.FilterSelect(nActFilter, false); mxFilterLb->set_active(1); } @@ -325,7 +326,7 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, UpdateStyles_Hdl, StyleFlags, nFlags, vo else { nActFilter = 0; - m_aStyleList.SetFilterIdx(nActFilter); + m_aStyleList.FilterSelect(nActFilter, false); mxFilterLb->set_active(1); } } @@ -532,7 +533,7 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable, StyleL { // Turn on treeView m_bWantHierarchical = true; - SaveSelection_Hdl(nullptr); // fdo#61429 store "hierarchical" + SaveSelection_Hdl(rStyleList); // fdo#61429 store "hierarchical" m_aStyleList.SetHierarchical(); } } @@ -556,9 +557,21 @@ void SfxCommonTemplateDialog_Impl::FilterSelect( return; nActFilter = nEntry; - m_aStyleListFilterSelect.Call(nActFilter); + m_aStyleList.FilterSelect(nActFilter, true); +} - m_aStyleListUpdateStyles.Call(StyleFlags::UpdateFamilyList); +void SfxCommonTemplateDialog_Impl::IsUpdate(bool bDoUpdate, StyleList&) +{ + SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); + SfxObjectShell* pDocShell = pViewFrame->GetObjectShell(); + if (bDoUpdate) + { + nActFilter = static_cast<sal_uInt16>(LoadFactoryStyleFilter_Hdl(pDocShell)); + if (0xffff == nActFilter) + { + nActFilter = pDocShell->GetAutoStyleFilterIndex(); + } + } } IMPL_LINK(SfxCommonTemplateDialog_Impl, FilterSelectHdl, weld::ComboBox&, rBox, void) @@ -574,14 +587,14 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, FilterSelectHdl, weld::ComboBox&, rBox, } // Select-Handler for the Toolbox -void SfxCommonTemplateDialog_Impl::FamilySelect(sal_uInt16 nEntry, bool bPreviewRefresh) +void SfxCommonTemplateDialog_Impl::FamilySelect(sal_uInt16 nEntry, StyleList&, bool bPreviewRefresh) { assert((0 < nEntry && nEntry <= MAX_FAMILIES) || 0xffff == nEntry); if( nEntry != nActFamily || bPreviewRefresh ) { CheckItem(OString::number(nActFamily), false); nActFamily = nEntry; - m_aStyleListFamilySelect.Call(nEntry); + m_aStyleList.FamilySelect(nEntry); } } @@ -671,7 +684,7 @@ void SfxCommonTemplateDialog_Impl::SaveFactoryStyleFilter( SfxObjectShell const xModuleManager->replaceByName( getModuleIdentifier( xModuleManager, i_pObjSh ), makeAny( lProps ) ); } -IMPL_LINK_NOARG(SfxCommonTemplateDialog_Impl, SaveSelection_Hdl, void*, SfxObjectShell*) +IMPL_LINK_NOARG(SfxCommonTemplateDialog_Impl, SaveSelection_Hdl, StyleList&, SfxObjectShell*) { SfxViewFrame *const pViewFrame(pBindings->GetDispatcher_Impl()->GetFrame()); SfxObjectShell *const pDocShell(pViewFrame->GetObjectShell()); @@ -692,7 +705,7 @@ IMPL_LINK_NOARG(SfxCommonTemplateDialog_Impl, PreviewHdl, weld::Toggleable&, voi m_aStyleList.EnablePreview(bCustomPreview); - FamilySelect(nActFamily, true); + FamilySelect(nActFamily, m_aStyleList, true); } IMPL_LINK_NOARG(SfxCommonTemplateDialog_Impl, UpdateStyleDependents_Hdl, void*, void) @@ -848,7 +861,7 @@ bool SfxTemplateDialog_Impl::IsCheckedItem(const OString& rMesId) IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxLSelect, const OString&, rEntry, void) { - FamilySelect(rEntry.toUInt32()); + FamilySelect(rEntry.toUInt32(), m_aStyleList); } IMPL_LINK(SfxTemplateDialog_Impl, ToolBoxRSelect, const OString&, rEntry, void) @@ -904,8 +917,6 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, UpdateFamily_Hdl, StyleList&, rStyleList bTreeDrag = true; bUpdateByExampleDisabled = false; - m_aStyleListUpdateFamily.Call(nullptr); - if (IsCheckedItem("watercan") && // only if that area is allowed rStyleList.CurrentFamilyHasState()) |