diff options
Diffstat (limited to 'svl')
-rw-r--r-- | svl/inc/svl/style.hrc | 3 | ||||
-rw-r--r-- | svl/inc/svl/style.hxx | 12 | ||||
-rw-r--r-- | svl/source/items/style.cxx | 28 |
3 files changed, 30 insertions, 13 deletions
diff --git a/svl/inc/svl/style.hrc b/svl/inc/svl/style.hrc index a4fea6d042c8..ae08df4c2c76 100644 --- a/svl/inc/svl/style.hrc +++ b/svl/inc/svl/style.hrc @@ -20,9 +20,10 @@ #define _SFX_STYLE_HRC #define SFXSTYLEBIT_AUTO 0x0000 // automatisch; Flags kommen von der Applikation +#define SFXSTYLEBIT_HIDDEN 0x0200 // benutzte Vorlage (als Suchmaske) #define SFXSTYLEBIT_READONLY 0x2000 // benutzte Vorlage (als Suchmaske) #define SFXSTYLEBIT_USED 0x4000 // benutzte Vorlage (als Suchmaske) #define SFXSTYLEBIT_USERDEF 0x8000 // benutzerdefinierte Vorlage -#define SFXSTYLEBIT_ALL 0xFFFF // alle Vorlagen +#define SFXSTYLEBIT_ALL 0xFDFF // alle Vorlagen #endif diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx index f0878c46967a..48557c5457d8 100644 --- a/svl/inc/svl/style.hxx +++ b/svl/inc/svl/style.hxx @@ -90,6 +90,7 @@ protected: sal_uLong nHelpId; // Hilfe-ID bool bMySet; // sal_True: Set loeschen im dtor + bool bHidden; SfxStyleSheetBase( const UniString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, sal_uInt16 mask ); SfxStyleSheetBase( const SfxStyleSheetBase& ); @@ -133,6 +134,9 @@ public: bool IsUserDefined() const { return ( nMask & SFXSTYLEBIT_USERDEF) != 0; } + virtual sal_Bool IsHidden() const { return bHidden; } + virtual void SetHidden( sal_Bool bValue ); + virtual sal_uLong GetHelpId( String& rFile ); virtual void SetHelpId( const String& r, sal_uLong nId ); @@ -157,7 +161,7 @@ class SVL_DLLPUBLIC SfxStyleSheetIterator { public: SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase, - SfxStyleFamily eFam, sal_uInt16 n=0xFFFF ); + SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL ); virtual sal_uInt16 GetSearchMask() const; virtual SfxStyleFamily GetSearchFamily() const; virtual sal_uInt16 Count(); @@ -229,7 +233,7 @@ public: virtual SfxStyleSheetBase& Make(const UniString&, SfxStyleFamily eFam, - sal_uInt16 nMask = 0xffff , + sal_uInt16 nMask = SFXSTYLEBIT_ALL , sal_uInt16 nPos = 0xffff); virtual void Replace( @@ -246,7 +250,7 @@ public: const SfxStyles& GetStyles(); virtual SfxStyleSheetBase* First(); virtual SfxStyleSheetBase* Next(); - virtual SfxStyleSheetBase* Find( const UniString&, SfxStyleFamily eFam, sal_uInt16 n=0xFFFF ); + virtual SfxStyleSheetBase* Find( const UniString&, SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL ); virtual bool SetParent(SfxStyleFamily eFam, const UniString &rStyle, @@ -255,7 +259,7 @@ public: SfxStyleSheetBase* Find(const UniString& rStr) { return Find(rStr, nSearchFamily, nMask); } - void SetSearchMask(SfxStyleFamily eFam, sal_uInt16 n=0xFFFF ); + void SetSearchMask(SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL ); sal_uInt16 GetSearchMask() const; SfxStyleFamily GetSearchFamily() const { return nSearchFamily; } }; diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 3c1f9b78cdbb..15deda60bdc8 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -89,7 +89,6 @@ SfxStyleSheetHint::SfxStyleSheetHint class SfxStyleSheetBasePool_Impl { public: - SfxStyles aStyles; SfxStyleSheetIterator *pIter; SfxStyleSheetBasePool_Impl() : pIter(0){} ~SfxStyleSheetBasePool_Impl(){delete pIter;} @@ -110,6 +109,7 @@ SfxStyleSheetBase::SfxStyleSheetBase( const XubString& rName, SfxStyleSheetBaseP , nMask(mask) , nHelpId( 0 ) , bMySet( sal_False ) + , bHidden( sal_False ) { #ifdef DBG_UTIL aDbgStyleSheetReferences.mnStyles++; @@ -127,6 +127,7 @@ SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r ) , nMask( r.nMask ) , nHelpId( r.nHelpId ) , bMySet( r.bMySet ) + , bHidden( r.bHidden ) { #ifdef DBG_UTIL aDbgStyleSheetReferences.mnStyles++; @@ -241,6 +242,12 @@ bool SfxStyleSheetBase::SetParent( const XubString& rName ) return true; } +void SfxStyleSheetBase::SetHidden( sal_Bool hidden ) +{ + bHidden = hidden; + pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) ); +} + // Follow aendern const XubString& SfxStyleSheetBase::GetFollow() const @@ -362,16 +369,21 @@ SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const inline bool SfxStyleSheetIterator::IsTrivialSearch() { - return nMask == 0xFFFF && GetSearchFamily() == SFX_STYLE_FAMILY_ALL; + return nMask == SFXSTYLEBIT_ALL && GetSearchFamily() == SFX_STYLE_FAMILY_ALL; } bool SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle) { - return ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) || + bool bSearchHidden = ( GetSearchMask() & SFXSTYLEBIT_HIDDEN ); + bool bMatchVisibility = bSearchHidden || !pStyle->IsHidden(); + + bool bMatches = ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) || ( pStyle->GetFamily() == GetSearchFamily() )) && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) || ( bSearchUsed ? pStyle->IsUsed() : false ) || - GetSearchMask() == SFXSTYLEBIT_ALL ); + GetSearchMask() == SFXSTYLEBIT_ALL ) + && bMatchVisibility; + return bMatches; } @@ -544,7 +556,7 @@ SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r ) : aAppName(r.GetName()) , rPool(r) , nSearchFamily(SFX_STYLE_FAMILY_PARA) - , nMask(0xFFFF) + , nMask(SFXSTYLEBIT_ALL) { #ifdef DBG_UTIL aDbgStyleSheetReferences.mnPools++; @@ -808,7 +820,7 @@ void SfxStyleSheetBasePool::ChangeParent(const XubString& rOld, bool bVirtual) { const sal_uInt16 nTmpMask = GetSearchMask(); - SetSearchMask(GetSearchFamily(), 0xffff); + SetSearchMask(GetSearchFamily(), SFXSTYLEBIT_ALL); for( SfxStyleSheetBase* p = First(); p; p = Next() ) { if( p->GetParent().Equals( rOld ) ) @@ -872,14 +884,14 @@ bool SfxStyleSheet::SetParent( const XubString& rName ) // aus der Benachrichtigungskette des alten // Parents gfs. austragen if(aOldParent.Len()) { - SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aOldParent, nFamily, 0xffff); + SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aOldParent, nFamily, SFXSTYLEBIT_ALL); if(pParent) EndListening(*pParent); } // in die Benachrichtigungskette des neuen // Parents eintragen if(aParent.Len()) { - SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aParent, nFamily, 0xffff); + SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aParent, nFamily, SFXSTYLEBIT_ALL); if(pParent) StartListening(*pParent); } |