sfx2/source/dialog/templdlg.cxx | 41 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
New commits: commit 6bd50778ae8427dce7bd87f404cbaa9b6634ef1f Author: Joren De Cuyper <joren.libreoff...@telenet.be> Date: Fri Sep 13 16:35:08 2013 +0200 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 <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 0c0869c..9a71b55 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 ); } } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits