Styles & Formatting: added SFXSTYLEBIT_ALL_VISIBLE and show hidden styles

Change-Id: Ie74ec3c15ba270afd0a6864bd5824a5bc0e3ea8b
This commit is contained in:
Cédric Bosdonnat
2012-11-30 11:51:46 +01:00
parent 2fd9c2bf9a
commit 715d79bcc5
7 changed files with 40 additions and 27 deletions

View File

@@ -37,7 +37,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
StyleFamily = SFX_STYLE_FAMILY_PARA ; StyleFamily = SFX_STYLE_FAMILY_PARA ;
FilterList [ en-US ] = FilterList [ en-US ] =
{ {
< "All Styles" ; SFXSTYLEBIT_ALL ; > ; < "All Styles" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
< "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
< "Applied Styles" ; SFXSTYLEBIT_USED ; > ; < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
< "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
}; };
@@ -50,6 +51,7 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
FilterList [ en-US ] = FilterList [ en-US ] =
{ {
< "All Styles" ; SFXSTYLEBIT_ALL ; > ; < "All Styles" ; SFXSTYLEBIT_ALL ; > ;
< "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
< "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
}; };
Text [ en-US ] = "Page Styles" ; Text [ en-US ] = "Page Styles" ;

View File

@@ -267,7 +267,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
StyleFamily = SFX_STYLE_FAMILY_PARA ; StyleFamily = SFX_STYLE_FAMILY_PARA ;
FilterList [ en-US ] = FilterList [ en-US ] =
{ {
< "All Styles" ; SFXSTYLEBIT_ALL ; > ; < "All Styles" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
< "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
< "Applied Styles" ; SFXSTYLEBIT_USED ; > ; < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
< "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
}; };
@@ -278,7 +279,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
StyleFamily = SFX_STYLE_FAMILY_PSEUDO ; StyleFamily = SFX_STYLE_FAMILY_PSEUDO ;
FilterList [ en-US ] = FilterList [ en-US ] =
{ {
< "All Styles" ; SFXSTYLEBIT_ALL ; > ; < "All Styles" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
< "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
}; };
}; };
}; };

View File

@@ -1064,7 +1064,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const String &rStr)
if ( !pItem ) if ( !pItem )
return; return;
const SfxStyleFamily eFam = pItem->GetFamily(); const SfxStyleFamily eFam = pItem->GetFamily();
SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( rStr, eFam, SFXSTYLEBIT_ALL | SFXSTYLEBIT_HIDDEN ); SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( rStr, eFam, SFXSTYLEBIT_ALL );
if( pStyle ) if( pStyle )
{ {
bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY); bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY);
@@ -1170,7 +1170,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
if(pStyleSheetPool && nActFamily != 0xffff) if(pStyleSheetPool && nActFamily != 0xffff)
{ {
const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl(); const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
pStyleSheetPool->SetSearchMask(pItem->GetFamily(), SFXSTYLEBIT_ALL); pStyleSheetPool->SetSearchMask(pItem->GetFamily(), SFXSTYLEBIT_ALL_VISIBLE);
StyleTreeArr_Impl aArr; StyleTreeArr_Impl aArr;
SfxStyleSheetBase *pStyle = pStyleSheetPool->First(); SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
if(pStyle && pStyle->HasParentSupport() && bTreeDrag ) if(pStyle && pStyle->HasParentSupport() && bTreeDrag )
@@ -1589,7 +1589,7 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint
const SfxStyleFamily eFam = pItem->GetFamily(); const SfxStyleFamily eFam = pItem->GetFamily();
SfxStyleSheetBase *pStyle = SfxStyleSheetBase *pStyle =
pStyleSheetPool->Find( pStyleSheetPool->Find(
aStr, eFam, SFXSTYLEBIT_ALL | SFXSTYLEBIT_HIDDEN ); aStr, eFam, SFXSTYLEBIT_ALL );
if( pStyle ) if( pStyle )
{ {
bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY); bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY);
@@ -2090,7 +2090,7 @@ void SfxCommonTemplateDialog_Impl::EnableDelete()
if(!nFilter) // automatic if(!nFilter) // automatic
nFilter = nAppFilter; nFilter = nAppFilter;
const SfxStyleSheetBase *pStyle = const SfxStyleSheetBase *pStyle =
pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SFXSTYLEBIT_ALL | SFXSTYLEBIT_HIDDEN : nFilter); pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SFXSTYLEBIT_ALL : nFilter);
OSL_ENSURE(pStyle, "Style ot found"); OSL_ENSURE(pStyle, "Style ot found");
if(pStyle && pStyle->IsUserDefined()) if(pStyle && pStyle->IsUserDefined())

View File

@@ -19,11 +19,12 @@
#ifndef _SFX_STYLE_HRC #ifndef _SFX_STYLE_HRC
#define _SFX_STYLE_HRC #define _SFX_STYLE_HRC
#define SFXSTYLEBIT_AUTO 0x0000 // automatisch; Flags kommen von der Applikation #define SFXSTYLEBIT_AUTO 0x0000 // automatisch; Flags kommen von der Applikation
#define SFXSTYLEBIT_HIDDEN 0x0200 // benutzte Vorlage (als Suchmaske) #define SFXSTYLEBIT_HIDDEN 0x0200 // benutzte Vorlage (als Suchmaske)
#define SFXSTYLEBIT_READONLY 0x2000 // benutzte Vorlage (als Suchmaske) #define SFXSTYLEBIT_READONLY 0x2000 // benutzte Vorlage (als Suchmaske)
#define SFXSTYLEBIT_USED 0x4000 // benutzte Vorlage (als Suchmaske) #define SFXSTYLEBIT_USED 0x4000 // benutzte Vorlage (als Suchmaske)
#define SFXSTYLEBIT_USERDEF 0x8000 // benutzerdefinierte Vorlage #define SFXSTYLEBIT_USERDEF 0x8000 // benutzerdefinierte Vorlage
#define SFXSTYLEBIT_ALL 0xFDFF // alle Vorlagen #define SFXSTYLEBIT_ALL_VISIBLE 0xFDFF // alle Vorlagen
#define SFXSTYLEBIT_ALL 0xFFFF // alle Vorlagen
#endif #endif

View File

@@ -369,7 +369,8 @@ SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const
inline bool SfxStyleSheetIterator::IsTrivialSearch() inline bool SfxStyleSheetIterator::IsTrivialSearch()
{ {
return nMask == SFXSTYLEBIT_ALL && GetSearchFamily() == SFX_STYLE_FAMILY_ALL; return ( nMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE
&& GetSearchFamily() == SFX_STYLE_FAMILY_ALL;
} }
bool SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle) bool SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle)
@@ -381,7 +382,7 @@ bool SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle)
( pStyle->GetFamily() == GetSearchFamily() )) ( pStyle->GetFamily() == GetSearchFamily() ))
&& (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) || && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) ||
( bSearchUsed ? pStyle->IsUsed() : false ) || ( bSearchUsed ? pStyle->IsUsed() : false ) ||
GetSearchMask() == SFXSTYLEBIT_ALL ) ( GetSearchMask() & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE )
&& bMatchVisibility; && bMatchVisibility;
return bMatches; return bMatches;
} }
@@ -393,7 +394,8 @@ SfxStyleSheetIterator::SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase,
pBasePool=pBase; pBasePool=pBase;
nSearchFamily=eFam; nSearchFamily=eFam;
bSearchUsed=sal_False; bSearchUsed=sal_False;
if((n != SFXSTYLEBIT_ALL ) && ((n & SFXSTYLEBIT_USED) == SFXSTYLEBIT_USED)) if( (( n & SFXSTYLEBIT_ALL_VISIBLE ) != SFXSTYLEBIT_ALL_VISIBLE )
&& ((n & SFXSTYLEBIT_USED) == SFXSTYLEBIT_USED))
{ {
bSearchUsed = sal_True; bSearchUsed = sal_True;
n &= ~SFXSTYLEBIT_USED; n &= ~SFXSTYLEBIT_USED;

View File

@@ -92,7 +92,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
StyleFamily = SFX_STYLE_FAMILY_PARA ; StyleFamily = SFX_STYLE_FAMILY_PARA ;
FilterList [ en-US ] = FilterList [ en-US ] =
{ {
< "All Styles" ; SFXSTYLEBIT_ALL ; > ; < "All Styles" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
< "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
< "Applied Styles" ; SFXSTYLEBIT_USED ; > ; < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
< "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
< "Automatic" ; SFXSTYLEBIT_AUTO ; > ; < "Automatic" ; SFXSTYLEBIT_AUTO ; > ;
@@ -111,7 +112,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
StyleFamily = SFX_STYLE_FAMILY_CHAR ; StyleFamily = SFX_STYLE_FAMILY_CHAR ;
FilterList [ en-US ] = FilterList [ en-US ] =
{ {
< "All" ; SFXSTYLEBIT_ALL ; > ; < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
< "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
< "Applied Styles" ; SFXSTYLEBIT_USED ; > ; < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
< "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
}; };
@@ -122,7 +124,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
StyleFamily = SFX_STYLE_FAMILY_FRAME ; StyleFamily = SFX_STYLE_FAMILY_FRAME ;
FilterList [ en-US ] = FilterList [ en-US ] =
{ {
< "All" ; SFXSTYLEBIT_ALL ; > ; < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
< "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
< "Applied Styles" ; SFXSTYLEBIT_USED ; > ; < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
< "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
}; };
@@ -133,7 +136,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
StyleFamily = SFX_STYLE_FAMILY_PAGE ; StyleFamily = SFX_STYLE_FAMILY_PAGE ;
FilterList [ en-US ] = FilterList [ en-US ] =
{ {
< "All" ; SFXSTYLEBIT_ALL ; > ; < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
< "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
< "Applied Styles" ; SFXSTYLEBIT_USED ; > ; < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
< "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
}; };
@@ -143,7 +147,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
StyleFamily = SFX_STYLE_FAMILY_PSEUDO ; StyleFamily = SFX_STYLE_FAMILY_PSEUDO ;
FilterList [ en-US ] = FilterList [ en-US ] =
{ {
< "All" ; SFXSTYLEBIT_ALL ; > ; < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
< "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
< "Applied Styles" ; SFXSTYLEBIT_USED ; > ; < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
< "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
}; };

View File

@@ -2518,6 +2518,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
bool bSearchHidden = ( nMask & SFXSTYLEBIT_HIDDEN ); bool bSearchHidden = ( nMask & SFXSTYLEBIT_HIDDEN );
const sal_Bool bOrganizer = ((SwDocStyleSheetPool*)pBasePool)->IsOrganizerMode(); const sal_Bool bOrganizer = ((SwDocStyleSheetPool*)pBasePool)->IsOrganizerMode();
bool bAll = ( nSrchMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE;
if( nSearchFamily == SFX_STYLE_FAMILY_CHAR if( nSearchFamily == SFX_STYLE_FAMILY_CHAR
|| nSearchFamily == SFX_STYLE_FAMILY_ALL ) || nSearchFamily == SFX_STYLE_FAMILY_ALL )
@@ -2561,7 +2562,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
// PoolFormate // PoolFormate
// //
if( nSrchMask == SFXSTYLEBIT_ALL ) if( bAll )
{ {
if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) ) if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) )
AppendStyleList(SwStyleNameMapper::GetChrFmtUINameArray(), AppendStyleList(SwStyleNameMapper::GetChrFmtUINameArray(),
@@ -2589,7 +2590,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
if( rDoc.get(IDocumentSettingAccess::HTML_MODE) ) if( rDoc.get(IDocumentSettingAccess::HTML_MODE) )
{ {
// then only HTML-Template are of interest // then only HTML-Template are of interest
if( SFXSTYLEBIT_ALL == nSMask ) if( SFXSTYLEBIT_ALL_VISIBLE == ( nSMask & SFXSTYLEBIT_ALL_VISIBLE ) )
nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF | nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF |
SFXSTYLEBIT_USED; SFXSTYLEBIT_USED;
else else
@@ -2675,7 +2676,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
aLst.Append( cPARA, pColl->GetName() ); aLst.Append( cPARA, pColl->GetName() );
} }
const sal_Bool bAll = nSMask == SFXSTYLEBIT_ALL; bAll = ( nSMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE;
if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_TEXT ) if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_TEXT )
AppendStyleList(SwStyleNameMapper::GetTextUINameArray(), AppendStyleList(SwStyleNameMapper::GetTextUINameArray(),
bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ); bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA );
@@ -2770,7 +2771,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
// PoolFormate // PoolFormate
// //
if ( nSrchMask == SFXSTYLEBIT_ALL ) if ( bAll )
AppendStyleList(SwStyleNameMapper::GetFrmFmtUINameArray(), AppendStyleList(SwStyleNameMapper::GetFrmFmtUINameArray(),
bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME); bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME);
} }
@@ -2796,7 +2797,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
aLst.Append( cPAGE, rDesc.GetName() ); aLst.Append( cPAGE, rDesc.GetName() );
} }
if ( nSrchMask == SFXSTYLEBIT_ALL ) if ( bAll )
AppendStyleList(SwStyleNameMapper::GetPageDescUINameArray(), AppendStyleList(SwStyleNameMapper::GetPageDescUINameArray(),
bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE); bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE);
} }
@@ -2824,7 +2825,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
aLst.Append( cNUMRULE, rRule.GetName() ); aLst.Append( cNUMRULE, rRule.GetName() );
} }
} }
if ( nSrchMask == SFXSTYLEBIT_ALL ) if ( bAll )
AppendStyleList(SwStyleNameMapper::GetNumRuleUINameArray(), AppendStyleList(SwStyleNameMapper::GetNumRuleUINameArray(),
bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE); bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
} }