diff options
author | Joren De Cuyper <joren.libreoffice@telenet.be> | 2013-09-13 16:35:08 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-29 13:44:01 +0000 |
commit | 6bd50778ae8427dce7bd87f404cbaa9b6634ef1f (patch) | |
tree | 81952563996abd222b8a2515274cacffe4d27f31 /sfx2 | |
parent | 637033d67c11582abaef43b1d16d3ba4e5653a0d (diff) |
fdo#67461 add multiple selection support to hide/show multiple styles
With commit 439ac45925039aa7a537feedab3e731e8a60a8e5 I only add support
to delete multiple styles.
Hereby I add the possibility to hide and show multiple styles too.
Change-Id: I46a8400c281c87b2881367f89ee92db2ba77bfb2
Reviewed-on: https://gerrit.libreoffice.org/5935
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 0c0869c1105b..9a71b5557723 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -2135,8 +2135,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) { if ( IsInitialized() && HasSelectedStyle() ) { - bool bUsedStyle = 0; // one of the selected styles are used in the document? - OUString aRet; + bool bUsedStyle = false; // one of the selected styles are used in the document? std::vector<SvTreeListEntry*> aList; SvTreeListEntry* pEntry = aFmtLb.FirstSelected(); @@ -2148,13 +2147,10 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) while (pEntry) { aList.push_back( pEntry ); + // check the style is used or not - if (pTreeBox) - aRet = pTreeBox->GetEntryText( pEntry ); - else - aRet = aFmtLb.GetEntryText( pEntry ); - const OUString aTemplName( aRet ); + OUString aTemplName = aFmtLb.GetEntryText( pEntry ); SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( aTemplName, pItem->GetFamily(), SFXSTYLEBIT_ALL ); @@ -2163,13 +2159,13 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) if (bUsedStyle) // add a separator for the second and later styles aMsg += ", "; aMsg += aTemplName; - bUsedStyle = 1; + bUsedStyle = true; } pEntry = aFmtLb.NextSelected( pEntry ); } - bool aApproved = 0; + bool aApproved = false; // we only want to show the dialog once and if we want to delete a style in use (UX-advice) if ( bUsedStyle ) @@ -2189,12 +2185,8 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) for (; it != itEnd; ++it) { - if (pTreeBox) - aRet = pTreeBox->GetEntryText( *it ); - else - aRet = aFmtLb.GetEntryText( *it ); + OUString aTemplName = aFmtLb.GetEntryText( *it ); - const OUString aTemplName( aRet ); PrepareDeleteAction(); bDontUpdate = sal_True; // To prevent the Treelistbox to shut down while deleting Execute_Impl( SID_STYLE_DELETE, aTemplName, @@ -2216,26 +2208,35 @@ void SfxCommonTemplateDialog_Impl::HideHdl(void *) { if ( IsInitialized() && HasSelectedStyle() ) { - const OUString aTemplName( GetSelectedEntry() ); - SfxStyleSheetBase* pStyle = GetSelectedStyle(); - if ( pStyle ) + SvTreeListEntry* pEntry = aFmtLb.FirstSelected(); + + while (pEntry) { + OUString aTemplName = aFmtLb.GetEntryText( pEntry ); + Execute_Impl( SID_STYLE_HIDE, aTemplName, OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() ); + + pEntry = aFmtLb.NextSelected( pEntry ); } } } void SfxCommonTemplateDialog_Impl::ShowHdl(void *) { + if ( IsInitialized() && HasSelectedStyle() ) { - const OUString aTemplName( GetSelectedEntry() ); - SfxStyleSheetBase* pStyle = GetSelectedStyle(); - if ( pStyle ) + SvTreeListEntry* pEntry = aFmtLb.FirstSelected(); + + while (pEntry) { + OUString aTemplName = aFmtLb.GetEntryText( pEntry ); + Execute_Impl( SID_STYLE_SHOW, aTemplName, OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() ); + + pEntry = aFmtLb.NextSelected( pEntry ); } } } |