summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-11-25 15:24:42 +0100
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-11-30 18:07:12 +0100
commit2fd9c2bf9af0c50dae3af3dbe5e22965ccdb4ae7 (patch)
tree2a0438c371fbb51a3d2e919793802d6827e07fbd /sw
parent36b7794d832dbc87c250ef02eee643c4ce68f87a (diff)
Allow to hide styles in the "Styles & Formating" dialog
In its current state, the feature only hides the styles. Things to sort out are: + Add some automatic filter to show hidden styles + Make the visibility persist in the file format Change-Id: I5904f41bb567add7b6bf501c6c5297f9f149a915
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/docsh.hxx1
-rw-r--r--sw/inc/docstyle.hxx8
-rw-r--r--sw/inc/format.hxx4
-rw-r--r--sw/inc/numrule.hxx4
-rw-r--r--sw/inc/pagedesc.hxx4
-rw-r--r--sw/sdi/_docsh.sdi6
-rw-r--r--sw/sdi/annotsh.sdi5
-rw-r--r--sw/source/core/attr/format.cxx4
-rw-r--r--sw/source/core/doc/number.cxx3
-rw-r--r--sw/source/core/layout/pagedesc.cxx2
-rw-r--r--sw/source/core/unocore/unostyle.cxx4
-rw-r--r--sw/source/ui/app/docst.cxx24
-rw-r--r--sw/source/ui/app/docstyle.cxx240
13 files changed, 252 insertions, 57 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 6016890098fc..4d660e5c75e7 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -107,6 +107,7 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
SwWrtShell* pActShell = 0,
sal_Bool bBasic = sal_False );
SW_DLLPRIVATE sal_uInt16 Delete(const String &rName, sal_uInt16 nFamily);
+ SW_DLLPRIVATE sal_uInt16 Hide(const String &rName, sal_uInt16 nFamily, bool bHidden);
SW_DLLPRIVATE sal_uInt16 ApplyStyles(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0,
sal_uInt16 nMode = 0 );
SW_DLLPRIVATE sal_uInt16 DoWaterCan( const String &rName, sal_uInt16 nFamily);
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index 3385650a6e71..9c05f541b34d 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -97,6 +97,9 @@ public:
sal_Bool IsPhysical() const { return bPhysical; }
void SetPhysical(sal_Bool bPhys);
+ virtual void SetHidden( sal_Bool bHidden );
+ virtual sal_Bool IsHidden( ) const;
+
/** add optional parameter <bResetIndentAttrsAtParagraphStyle>, default value sal_False,
which indicates that the indent attributes at a paragraph style should
be reset in case that a list style is applied to the paragraph style and
@@ -155,12 +158,13 @@ class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener
void AppendStyleList(const boost::ptr_vector<String>& rLst,
sal_Bool bUsed,
+ sal_Bool bTestHidden,
sal_uInt16 nSection,
char cType);
public:
SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
- SfxStyleFamily eFam, sal_uInt16 n=0xFFFF );
+ SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
virtual ~SwStyleSheetIterator();
virtual sal_uInt16 Count();
@@ -193,7 +197,7 @@ public:
virtual SfxStyleSheetBase& Make(const String&, SfxStyleFamily, sal_uInt16 nMask, sal_uInt16 nPos = 0xffff);
virtual SfxStyleSheetBase* Find( const String&, SfxStyleFamily eFam,
- sal_uInt16 n=0xFFFF );
+ sal_uInt16 n=SFXSTYLEBIT_ALL );
virtual bool SetParent( SfxStyleFamily eFam, const String &rStyle,
const String &rParent );
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 3fd0a355fa18..1f178cb713f5 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -52,6 +52,7 @@ class SW_DLLPUBLIC SwFmt : public SwModify
to recognize this in FmtChg-message!! */
sal_Bool bAutoUpdateFmt : 1;/**< TRUE: Set attributes of a whole paragraph
at format (UI-side!). */
+ bool bHidden : 1;
protected:
SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
@@ -155,6 +156,9 @@ public:
bool IsAuto() const { return bAutoFmt; }
void SetAuto( bool bNew = false ) { bAutoFmt = bNew; }
+ bool IsHidden() const { return bHidden; }
+ void SetHidden( bool bValue = false ) { bHidden = bValue; }
+
/// Query / set bAutoUpdateFmt-flag.
sal_Bool IsAutoUpdateFmt() const { return bAutoUpdateFmt; }
void SetAutoUpdateFmt( sal_Bool bNew = sal_True ) { bAutoUpdateFmt = bNew; }
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index 03f281d6a596..1fe43ba6eece 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -132,6 +132,7 @@ private:
sal_Bool bInvalidRuleFlag : 1;
sal_Bool bContinusNum : 1; ///< Continuous numbering without levels.
sal_Bool bAbsSpaces : 1; ///< Levels represent absolute indents.
+ sal_Bool bHidden : 1; ///< Is the numering rule to be hidden in the UI?
bool mbCountPhantoms;
const SvxNumberFormat::SvxNumPositionAndSpaceMode meDefaultNumberFormatPositionAndSpaceMode;
@@ -154,6 +155,9 @@ public:
const SwNumFmt* GetNumFmt( sal_uInt16 i ) const;
const SwNumFmt& Get( sal_uInt16 i ) const;
+ sal_Bool IsHidden( ) const { return bHidden; }
+ void SetHidden( sal_Bool bValue ) { bHidden = bValue; }
+
void Set( sal_uInt16 i, const SwNumFmt* );
void Set( sal_uInt16 i, const SwNumFmt& );
String MakeNumString( const SwNodeNum&, sal_Bool bInclStrings = sal_True,
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 76a68097f6b2..b6c40a8873eb 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -144,6 +144,7 @@ class SW_DLLPUBLIC SwPageDesc : public SwModify
sal_uInt16 nRegAscent; ///< For grid alignment (Registerhaltigkeit).
UseOnPage eUse;
sal_Bool bLandscape;
+ sal_Bool bHidden;
/// Footnote information.
SwPageFtnInfo aFtnInfo;
@@ -180,6 +181,9 @@ public:
sal_Bool IsFirstShared() const;
void ChgFirstShare( sal_Bool bNew );
+ sal_Bool IsHidden( ) const { return bHidden; }
+ void SetHidden( sal_Bool bValue ) { bHidden = bValue; }
+
inline void SetUseOn( UseOnPage eNew );
inline UseOnPage GetUseOn() const;
diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi
index e1f0ae9a60e6..cfc333719ca3 100644
--- a/sw/sdi/_docsh.sdi
+++ b/sw/sdi/_docsh.sdi
@@ -50,6 +50,12 @@ interface BaseTextDocument
StateMethod = NoState ;
]
+ SID_STYLE_HIDE
+ [
+ ExecMethod = ExecStyleSheet ;
+ StateMethod = NoState ;
+ ]
+
SID_TEMPLATE_LOAD
[
ExecMethod = Execute ;
diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi
index ed99f70a35b7..9e566b2b6287 100644
--- a/sw/sdi/annotsh.sdi
+++ b/sw/sdi/annotsh.sdi
@@ -346,6 +346,11 @@ interface Annotation : _Annotation
[
StateMethod = StateDisableItems ;
]
+
+ SID_STYLE_HIDE
+ [
+ StateMethod = StateDisableItems ;
+ ]
FN_STAT_SELMODE
[
StateMethod = StateStatusLine ;
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 78d3c36ac1e0..4524937d020c 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -43,6 +43,7 @@ SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
aFmtName.AssignAscii( pFmtNm );
bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
bAutoFmt = sal_True;
+ bHidden = false;
if( pDrvdFrm )
aSet.SetParent( &pDrvdFrm->aSet );
@@ -62,6 +63,7 @@ SwFmt::SwFmt( SwAttrPool& rPool, const String& rFmtNm,
{
bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
bAutoFmt = sal_True;
+ bHidden = false;
if( pDrvdFrm )
aSet.SetParent( &pDrvdFrm->aSet );
@@ -79,6 +81,7 @@ SwFmt::SwFmt( const SwFmt& rFmt )
{
bWritten = bFmtInDTOR = sal_False; // LAYER_IMPL
bAutoFmt = rFmt.bAutoFmt;
+ bHidden = rFmt.bHidden;
bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
if( rFmt.DerivedFrom() )
@@ -133,6 +136,7 @@ SwFmt &SwFmt::operator=(const SwFmt& rFmt)
}
}
bAutoFmt = rFmt.bAutoFmt;
+ bHidden = rFmt.bHidden;
bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
return *this;
}
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 97061d551012..91b822b3de15 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -398,6 +398,7 @@ SwNumRule::SwNumRule( const String& rNm,
bInvalidRuleFlag( sal_True ),
bContinusNum( sal_False ),
bAbsSpaces( sal_False ),
+ bHidden( sal_False ),
mbCountPhantoms( true ),
meDefaultNumberFormatPositionAndSpaceMode( eDefaultNumberFormatPositionAndSpaceMode ),
msDefaultListId()
@@ -496,6 +497,7 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule )
bInvalidRuleFlag( sal_True ),
bContinusNum( rNumRule.bContinusNum ),
bAbsSpaces( rNumRule.bAbsSpaces ),
+ bHidden( rNumRule.bHidden ),
mbCountPhantoms( true ),
meDefaultNumberFormatPositionAndSpaceMode( rNumRule.meDefaultNumberFormatPositionAndSpaceMode ),
msDefaultListId( rNumRule.msDefaultListId )
@@ -569,6 +571,7 @@ SwNumRule& SwNumRule::operator=( const SwNumRule& rNumRule )
bInvalidRuleFlag = sal_True;
bContinusNum = rNumRule.bContinusNum;
bAbsSpaces = rNumRule.bAbsSpaces;
+ bHidden = rNumRule.bHidden;
nPoolFmtId = rNumRule.GetPoolFmtId();
nPoolHelpId = rNumRule.GetPoolHelpId();
nPoolHlpFileId = rNumRule.GetPoolHlpFileId();
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index 73141302906f..37a8d9b9168d 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -56,6 +56,7 @@ SwPageDesc::SwPageDesc( const String& rName, SwFrmFmt *pFmt, SwDoc *pDc ) :
nRegAscent( 0 ),
eUse( (UseOnPage)(nsUseOnPage::PD_ALL | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE | nsUseOnPage::PD_FIRSTSHARE ) ),
bLandscape( sal_False ),
+ bHidden( sal_False ),
aFtnInfo()
{
}
@@ -73,6 +74,7 @@ SwPageDesc::SwPageDesc( const SwPageDesc &rCpy ) :
nRegAscent( rCpy.GetRegAscent() ),
eUse( rCpy.ReadUseOn() ),
bLandscape( rCpy.GetLandscape() ),
+ bHidden( rCpy.IsHidden() ),
aFtnInfo( rCpy.GetFtnInfo() )
{
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index d04a95f3db9d..5e6f87fa81cf 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -785,7 +785,7 @@ uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::Runt
uno::Sequence< OUString > aRet;
if(pBasePool)
{
- SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
+ SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL);
sal_uInt16 nCount = pIterator->Count();
aRet.realloc(nCount);
OUString* pArray = aRet.getArray();
@@ -867,7 +867,7 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen
throw lang::IllegalArgumentException();
if(pNewStyle)
{
- sal_uInt16 nMask = 0xffff;
+ sal_uInt16 nMask = SFXSTYLEBIT_ALL;
if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
nMask &= ~SWSTYLEBIT_CONDCOLL;
#if OSL_DEBUG_LEVEL > 1
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 8923077e4746..14144c2b250a 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -258,7 +258,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
{
sal_uInt16 nSlot = rReq.GetSlot();
- sal_uInt16 nRet = 0xffff;
+ sal_uInt16 nRet = SFXSTYLEBIT_ALL;
const SfxItemSet* pArgs = rReq.GetArgs();
const SfxPoolItem* pItem;
@@ -325,6 +325,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
case SID_STYLE_EDIT:
case SID_STYLE_DELETE:
+ case SID_STYLE_HIDE:
case SID_STYLE_WATERCAN:
case SID_STYLE_FAMILY:
case SID_STYLE_UPDATE_BY_EXAMPLE:
@@ -450,6 +451,9 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
case SID_STYLE_DELETE:
nRet = Delete(aParam, nFamily);
break;
+ case SID_STYLE_HIDE:
+ nRet = Hide(aParam, nFamily, true);
+ break;
case SID_STYLE_APPLY:
// Shell-switch in ApplyStyles
nRet = ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() );
@@ -820,6 +824,24 @@ sal_uInt16 SwDocShell::Delete(const String &rName, sal_uInt16 nFamily)
return sal_False;
}
+sal_uInt16 SwDocShell::Hide(const String &rName, sal_uInt16 nFamily, bool bHidden)
+{
+ SfxStyleSheetBase *pStyle = mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+ if(pStyle)
+ {
+ OSL_ENSURE(GetWrtShell(), "No Shell, no Styles");
+
+ GetWrtShell()->StartAllAction();
+ rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *(SwDocStyleSheet*)pStyle ) );
+ xTmp->SetHidden( bHidden );
+ GetWrtShell()->EndAllAction();
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
/*--------------------------------------------------------------------
Description: apply template
--------------------------------------------------------------------*/
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index fa38da7c538a..e881cb1f4ac8 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -450,6 +450,116 @@ void SwDocStyleSheet::Reset()
Description: virtual methods
--------------------------------------------------------------------*/
+void SwDocStyleSheet::SetHidden( sal_Bool bValue )
+{
+ bool bChg = false;
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+
+ SwFmt* pFmt = 0;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pFmt = rDoc.FindCharFmtByName( aName );
+ if ( pFmt )
+ {
+ pFmt->SetHidden( bValue );
+ bChg = true;
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ pFmt = rDoc.FindTxtFmtCollByName( aName );
+ if ( pFmt )
+ {
+ pFmt->SetHidden( bValue );
+ bChg = true;
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pFmt = rDoc.FindFrmFmtByName( aName );
+ if ( pFmt )
+ {
+ pFmt->SetHidden( bValue );
+ bChg = true;
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName );
+ if ( pPgDesc )
+ {
+ pPgDesc->SetHidden( bValue );
+ bChg = true;
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ SwNumRule* pRule = rDoc.FindNumRulePtr( aName );
+ if ( pRule )
+ {
+ pRule->SetHidden( bValue );
+ bChg = true;
+ }
+ }
+ default:;
+ }
+
+ if( bChg )
+ {
+ pPool->First(); // internal list has to be updated
+ pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
+ SwEditShell* pSh = rDoc.GetEditShell();
+ if( pSh )
+ pSh->CallChgLnk();
+ }
+}
+
+sal_Bool SwDocStyleSheet::IsHidden( ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if(!bPhysical)
+ {
+ SwFmt* pFmt = 0;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pFmt = rDoc.FindCharFmtByName( aName );
+ bRet = pFmt && pFmt->IsHidden( );
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ pFmt = rDoc.FindTxtFmtCollByName( aName );
+ bRet = pFmt && pFmt->IsHidden( );
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pFmt = rDoc.FindFrmFmtByName( aName );
+ bRet = pFmt && pFmt->IsHidden( );
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName );
+ bRet = pPgDesc && pPgDesc->IsHidden( );
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ SwNumRule* pRule = rDoc.FindNumRulePtr( aName );
+ bRet = pRule && pRule->IsHidden( );
+ }
+ default:;
+ }
+ }
+
+ return bRet;
+}
const String& SwDocStyleSheet::GetParent() const
{
@@ -2325,7 +2435,7 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const String& rName,
{
const SwNumRule* pRule = mxStyleSheet->GetNumRule();
if( pRule &&
- !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pRule)) ) &&
+ !bSearchUsed &&
(( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
? !(pRule->GetPoolFmtId() & USER_FMT)
// searched for used and found none
@@ -2340,7 +2450,7 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const String& rName,
}
// then evaluate the mask:
- if( pMod && !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pMod)) ) )
+ if( pMod && !bSearchUsed )
{
const sal_uInt16 nId = SFX_STYLE_FAMILY_PAGE == eFam
? ((SwPageDesc*)pMod)->GetPoolFmtId()
@@ -2366,7 +2476,7 @@ SwStyleSheetIterator::SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
StartListening( *pBase );
}
- SwStyleSheetIterator::~SwStyleSheetIterator()
+SwStyleSheetIterator::~SwStyleSheetIterator()
{
EndListening( mxIterSheet->GetPool() );
}
@@ -2405,6 +2515,8 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
const sal_uInt16 nSrchMask = nMask;
const sal_Bool bIsSearchUsed = SearchUsed();
+ bool bSearchHidden = ( nMask & SFXSTYLEBIT_HIDDEN );
+
const sal_Bool bOrganizer = ((SwDocStyleSheetPool*)pBasePool)->IsOrganizerMode();
if( nSearchFamily == SFX_STYLE_FAMILY_CHAR
@@ -2414,10 +2526,11 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
for( sal_uInt16 i = 0; i < nArrLen; i++ )
{
SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
- if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
- continue;
const bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(*pFmt));
+ if( ( !bSearchHidden && pFmt->IsHidden() && !bUsed ) || ( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() ) )
+ continue;
+
if( !bUsed )
{
// Standard is no User template
@@ -2452,7 +2565,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
{
if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) )
AppendStyleList(SwStyleNameMapper::GetChrFmtUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
else
{
aLst.Append( cCHAR, SwStyleNameMapper::GetChrFmtUINameArray()[
@@ -2465,7 +2578,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
RES_POOLCHR_FOOTNOTE - RES_POOLCHR_BEGIN ] );
}
AppendStyleList(SwStyleNameMapper::GetHTMLChrFmtUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
}
}
@@ -2476,7 +2589,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
if( rDoc.get(IDocumentSettingAccess::HTML_MODE) )
{
// then only HTML-Template are of interest
- if( USHRT_MAX == nSMask )
+ if( SFXSTYLEBIT_ALL == nSMask )
nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF |
SFXSTYLEBIT_USED;
else
@@ -2491,10 +2604,10 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
{
SwTxtFmtColl* pColl = (*rDoc.GetTxtFmtColls())[ i ];
- if(pColl->IsDefault())
+ const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
+ if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() )
continue;
- const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
if( !(bIsSearchUsed && bUsed ))
{
const sal_uInt16 nId = pColl->GetPoolFmtId();
@@ -2565,19 +2678,19 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
const sal_Bool bAll = nSMask == SFXSTYLEBIT_ALL;
if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_TEXT )
AppendStyleList(SwStyleNameMapper::GetTextUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA );
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA );
if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CHAPTER )
AppendStyleList(SwStyleNameMapper::GetDocUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_LIST )
AppendStyleList(SwStyleNameMapper::GetListsUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_IDX )
AppendStyleList(SwStyleNameMapper::GetRegisterUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_EXTRA )
AppendStyleList(SwStyleNameMapper::GetExtraUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CONDCOLL )
{
if( !bIsSearchUsed ||
@@ -2591,7 +2704,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
(SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF) )
{
AppendStyleList(SwStyleNameMapper::GetHTMLUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
if( !bAll )
{
// then also the ones, that we are mapping:
@@ -2634,13 +2747,13 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
{
SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
- if(pFmt->IsDefault() || pFmt->IsAuto())
+ bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFmt));
+ if( ( !bSearchHidden && pFmt->IsHidden( ) && !bUsed ) || pFmt->IsDefault() || pFmt->IsAuto() )
{
continue;
}
const sal_uInt16 nId = pFmt->GetPoolFmtId();
- bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFmt));
if( !bUsed )
{
if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
@@ -2659,7 +2772,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
//
if ( nSrchMask == SFXSTYLEBIT_ALL )
AppendStyleList(SwStyleNameMapper::GetFrmFmtUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME);
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME);
}
if( nSearchFamily == SFX_STYLE_FAMILY_PAGE ||
@@ -2673,10 +2786,11 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
if( !bUsed )
{
- if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ if ( ( !bSearchHidden && rDesc.IsHidden() ) ||
+ ( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
? !(nId & USER_FMT)
// searched for used and found none
- : bIsSearchUsed )
+ : bIsSearchUsed ) )
continue;
}
@@ -2684,7 +2798,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
}
if ( nSrchMask == SFXSTYLEBIT_ALL )
AppendStyleList(SwStyleNameMapper::GetPageDescUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE);
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE);
}
if( nSearchFamily == SFX_STYLE_FAMILY_PSEUDO ||
@@ -2699,10 +2813,11 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rRule) );
if( !bUsed )
{
- if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ if( ( !bSearchHidden && rRule.IsHidden() ) ||
+ ( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
? !(rRule.GetPoolFmtId() & USER_FMT)
// searched for used and found none
- : bIsSearchUsed )
+ : bIsSearchUsed ) )
continue;
}
@@ -2711,7 +2826,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
}
if ( nSrchMask == SFXSTYLEBIT_ALL )
AppendStyleList(SwStyleNameMapper::GetNumRuleUINameArray(),
- bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
+ bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
}
if(!aLst.empty())
@@ -2762,39 +2877,60 @@ SfxStyleSheetBase* SwStyleSheetIterator::Find(const rtl::OUString& rName)
}
void SwStyleSheetIterator::AppendStyleList(const boost::ptr_vector<String>& rList,
- sal_Bool bTestUsed,
+ sal_Bool bTestUsed, sal_Bool bTestHidden,
sal_uInt16 nSection, char cType )
{
- if( bTestUsed )
+ SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
+ sal_Bool bUsed = sal_False;
+ for ( sal_uInt16 i=0; i < rList.size(); ++i )
{
- SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
- for ( sal_uInt16 i=0; i < rList.size(); ++i )
+ sal_Bool bHidden = sal_False;
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rList[i], (SwGetPoolIdFromName)nSection);
+ switch ( nSection )
{
- sal_Bool bUsed = sal_False;
- sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rList[i], (SwGetPoolIdFromName)nSection);
- switch ( nSection )
- {
- case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
- bUsed = rDoc.IsPoolTxtCollUsed( nId );
- break;
- case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
- bUsed = rDoc.IsPoolFmtUsed( nId );
- break;
- case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
- bUsed = rDoc.IsPoolFmtUsed( nId );
- case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
- bUsed = rDoc.IsPoolPageDescUsed( nId );
- break;
- default:
- OSL_ENSURE( !this, "unknown PoolFmt-Id" );
- }
- if ( bUsed )
- aLst.Append( cType, rList[i] );
+ case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
+ {
+ bUsed = rDoc.IsPoolTxtCollUsed( nId );
+ SwFmt* pFmt = rDoc.FindTxtFmtCollByName( rList[i] );
+ bHidden = pFmt && pFmt->IsHidden( );
+ }
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
+ {
+ bUsed = rDoc.IsPoolFmtUsed( nId );
+ SwFmt* pFmt = rDoc.FindCharFmtByName( rList[i] );
+ bHidden = pFmt && pFmt->IsHidden( );
+ }
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
+ {
+ bUsed = rDoc.IsPoolFmtUsed( nId );
+ SwFmt* pFmt = rDoc.FindFrmFmtByName( rList[i] );
+ bHidden = pFmt && pFmt->IsHidden( );
+ }
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
+ {
+ bUsed = rDoc.IsPoolPageDescUsed( nId );
+ SwPageDesc* pPgDesc = rDoc.FindPageDescByName( rList[i] );
+ bHidden = pPgDesc && pPgDesc->IsHidden( );
+ }
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_NUMRULE:
+ {
+ SwNumRule* pRule = rDoc.FindNumRulePtr( rList[i] );
+ bUsed = pRule && rDoc.IsUsed( *pRule );
+ bHidden = pRule && pRule->IsHidden( );
+ }
+ break;
+ default:
+ OSL_ENSURE( !this, "unknown PoolFmt-Id" );
}
- }
- else
- for ( sal_uInt16 i=0; i < rList.size(); ++i )
+
+ bool bMatchHidden = ( bTestHidden && bHidden ) || ( !bTestHidden && ( !bHidden || bUsed ) );
+ if ( ( !bTestUsed && bMatchHidden ) || ( bTestUsed && bUsed ) )
aLst.Append( cType, rList[i] );
+ }
}
void SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint )