diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-30 14:27:56 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-30 18:07:12 +0100 |
commit | 1d6b6298199c2809de49f68714834aa94fb0143e (patch) | |
tree | 50906e391b1740adbb9d0735b3cde9496e9dea08 | |
parent | 715d79bcc59d68c77dc84a1038998dd873df92e9 (diff) |
Fixed style iterators filters to show only hidden styles when required
Change-Id: I60d4dff4fc6eabc3882361457e19ae66f148d114
-rw-r--r-- | svl/source/items/style.cxx | 16 | ||||
-rw-r--r-- | sw/source/ui/app/docstyle.cxx | 17 |
2 files changed, 25 insertions, 8 deletions
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 153edb84240b..6df5bfa71b6e 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -375,15 +375,19 @@ inline bool SfxStyleSheetIterator::IsTrivialSearch() bool SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle) { + bool bMatchFamily = ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) || + ( pStyle->GetFamily() == GetSearchFamily() )); + + bool bUsed = bSearchUsed ? pStyle->IsUsed( ) : false; + bool bSearchHidden = ( GetSearchMask() & SFXSTYLEBIT_HIDDEN ); - bool bMatchVisibility = bSearchHidden || !pStyle->IsHidden(); + bool bMatchVisibility = !( !bSearchHidden && pStyle->IsHidden() && !bUsed ); + bool bOnlyHidden = GetSearchMask( ) == SFXSTYLEBIT_HIDDEN && pStyle->IsHidden( ); - bool bMatches = ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) || - ( pStyle->GetFamily() == GetSearchFamily() )) + bool bMatches = bMatchFamily && bMatchVisibility && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) || - ( bSearchUsed ? pStyle->IsUsed() : false ) || - ( GetSearchMask() & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE ) - && bMatchVisibility; + bUsed || bOnlyHidden || + ( GetSearchMask() & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE ); return bMatches; } diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index f6f96f879be2..cae4c506b10f 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -2532,6 +2532,9 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() if( ( !bSearchHidden && pFmt->IsHidden() && !bUsed ) || ( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() ) ) continue; + if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !pFmt->IsHidden( ) ) + continue; + if( !bUsed ) { // Standard is no User template @@ -2609,6 +2612,9 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() ) continue; + if ( nSMask == SFXSTYLEBIT_HIDDEN && !pColl->IsHidden( ) ) + continue; + if( !(bIsSearchUsed && bUsed )) { const sal_uInt16 nId = pColl->GetPoolFmtId(); @@ -2750,9 +2756,10 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFmt)); if( ( !bSearchHidden && pFmt->IsHidden( ) && !bUsed ) || pFmt->IsDefault() || pFmt->IsAuto() ) - { continue; - } + + if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !pFmt->IsHidden( ) ) + continue; const sal_uInt16 nId = pFmt->GetPoolFmtId(); if( !bUsed ) @@ -2795,6 +2802,9 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() continue; } + if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !rDesc.IsHidden( ) ) + continue; + aLst.Append( cPAGE, rDesc.GetName() ); } if ( bAll ) @@ -2811,6 +2821,9 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() const SwNumRule& rRule = *rNumTbl[ i ]; if( !rRule.IsAutoRule() ) { + if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !rRule.IsHidden( ) ) + continue; + bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rRule) ); if( !bUsed ) { |