summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/tabpages/paragrph.cxx7
-rw-r--r--editeng/source/editeng/editdbg.cxx6
-rw-r--r--include/svl/style.hxx6
-rw-r--r--sc/source/filter/html/htmlexp.cxx14
-rw-r--r--sc/source/ui/docshell/docsh6.cxx7
-rw-r--r--sd/source/core/drawdoc3.cxx7
-rw-r--r--sd/source/ui/func/fuhhconv.cxx6
-rw-r--r--sfx2/source/dialog/mgetempl.cxx13
-rw-r--r--sfx2/source/dialog/newstyle.cxx6
-rw-r--r--sfx2/source/dialog/templdlg.cxx18
-rw-r--r--sfx2/source/doc/objcont.cxx34
-rw-r--r--svl/source/items/style.cxx39
-rw-r--r--svx/source/dialog/srchdlg.cxx13
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx27
-rw-r--r--sw/inc/docstyle.hxx4
-rw-r--r--sw/source/core/unocore/unostyle.cxx7
-rw-r--r--sw/source/ui/app/docstyle.cxx18
-rw-r--r--sw/source/ui/chrdlg/pardlg.cxx7
-rw-r--r--sw/source/ui/chrdlg/swuiccoll.cxx12
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx7
-rw-r--r--sw/source/ui/fmtui/tmpdlg.cxx14
-rw-r--r--sw/source/ui/misc/docfnote.cxx9
-rw-r--r--sw/source/ui/utlui/tmplctrl.cxx11
-rw-r--r--sw/source/ui/utlui/uitool.cxx6
24 files changed, 168 insertions, 130 deletions
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index c336b52be3f2..f9ab85f59ba9 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -1942,9 +1942,8 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSe
if ( pSh )
{
SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
- SfxStyleSheetIterator iter(pPool,
- SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
- SfxStyleSheetBase* pStyle = iter.First();
+ pPool->SetSearchMask( SFX_STYLE_FAMILY_PAGE );
+ SfxStyleSheetBase* pStyle = pPool->First();
String aStdName;
while( pStyle )
@@ -1953,7 +1952,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSe
// first style == standard style
aStdName = pStyle->GetName();
m_pApplyCollBox->InsertEntry( pStyle->GetName() );
- pStyle = iter.Next();
+ pStyle = pPool->Next();
}
nStdPos = m_pApplyCollBox->GetEntryPos( aStdName );
}
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index 785dedad0936..4006918917f7 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -419,12 +419,12 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox )
if ( pEE->pImpEditEngine->GetStyleSheetPool() )
{
- SfxStyleSheetIterator aIter( pEE->pImpEditEngine->GetStyleSheetPool(), SFX_STYLE_FAMILY_ALL );
- sal_uLong nStyles = pEE->pImpEditEngine->GetStyleSheetPool() ? aIter.Count() : 0;
+ sal_uLong nStyles = pEE->pImpEditEngine->GetStyleSheetPool() ? pEE->pImpEditEngine->GetStyleSheetPool()->Count() : 0;
fprintf( fp, "\n\n================================================================================" );
fprintf( fp, "\n================== Stylesheets =============================================" );
fprintf( fp, "\n================================================================================" );
- fprintf( fp, "\n#Styles: %lu\n", nStyles );
+ fprintf( fp, "\n#Template: %lu\n", nStyles );
+ SfxStyleSheetIterator aIter( pEE->pImpEditEngine->GetStyleSheetPool(), SFX_STYLE_FAMILY_ALL );
SfxStyleSheetBase* pStyle = aIter.First();
while ( pStyle )
{
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 464a9c86f673..9d4b3be2596e 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -204,6 +204,8 @@ friend class SfxStyleSheetBase;
SfxStyleSheetBasePool_Impl *pImp;
protected:
+ SfxStyleSheetIterator& GetIterator_Impl();
+
OUString aAppName;
SfxItemPool& rPool;
SfxStyles aStyles;
@@ -227,6 +229,8 @@ public:
const SfxItemPool& GetPool() const;
virtual SfxStyleSheetIteratorPtr CreateIterator(SfxStyleFamily, sal_uInt16 nMask);
+ virtual sal_uInt16 Count();
+ virtual SfxStyleSheetBase* operator[](sal_uInt16 nIdx);
virtual SfxStyleSheetBase& Make(const OUString&,
SfxStyleFamily eFam,
@@ -244,6 +248,8 @@ public:
SfxStyleSheetBasePool& operator+=( const SfxStyleSheetBasePool& );
const SfxStyles& GetStyles();
+ virtual SfxStyleSheetBase* First();
+ virtual SfxStyleSheetBase* Next();
virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
virtual bool SetParent(SfxStyleFamily eFam,
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 05c3e9d4053c..5cbf833ca3b3 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -447,16 +447,13 @@ const SfxItemSet& ScHTMLExport::PageDefaults( SCTAB nTab )
// remember defaults for compare in WriteCell
if ( !aHTMLStyle.bInitialized )
{
+ pStylePool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
pStyleSheet = pStylePool->Find(
ScGlobal::GetRscString(STR_STYLENAME_STANDARD),
SFX_STYLE_FAMILY_PARA );
OSL_ENSURE( pStyleSheet, "ParaStyle not found! :-(" );
if (!pStyleSheet)
- {
- SfxStyleSheetIterator iter(pStylePool,
- SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
- pStyleSheet = iter.First();
- }
+ pStyleSheet = pStylePool->First();
const SfxItemSet& rSetPara = pStyleSheet->GetItemSet();
aHTMLStyle.nDefaultScriptType = ScGlobal::GetDefaultScriptType();
@@ -473,14 +470,11 @@ const SfxItemSet& ScHTMLExport::PageDefaults( SCTAB nTab )
// Page style sheet printer settings, e.g. for background graphics.
// There's only one background graphic in HTML!
+ pStylePool->SetSearchMask( SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL );
pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE );
OSL_ENSURE( pStyleSheet, "PageStyle not found! :-(" );
if (!pStyleSheet)
- {
- SfxStyleSheetIterator iter(pStylePool,
- SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
- pStyleSheet = iter.First();
- }
+ pStyleSheet = pStylePool->First();
const SfxItemSet& rSet = pStyleSheet->GetItemSet();
if ( !aHTMLStyle.bInitialized )
{
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index a1b29853eefc..3256980caf29 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -231,9 +231,8 @@ SfxStyleSheetBasePool* ScDocShell::GetStyleSheetPool()
static void lcl_AdjustPool( SfxStyleSheetBasePool* pStylePool )
{
- SfxStyleSheetIterator iter(pStylePool,
- SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
- SfxStyleSheetBase *pStyle = iter.First();
+ pStylePool->SetSearchMask(SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
+ SfxStyleSheetBase *pStyle = pStylePool->First();
while ( pStyle )
{
SfxItemSet& rStyleSet = pStyle->GetItemSet();
@@ -254,7 +253,7 @@ static void lcl_AdjustPool( SfxStyleSheetBasePool* pStylePool )
rStyleSet.Put(SvxSetItem(ATTR_PAGE_FOOTERSET,pDestSet));
}
- pStyle = iter.Next();
+ pStyle = pStylePool->Next();
}
}
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 35ef3199ee8f..3881a9ff04f6 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1494,12 +1494,11 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
// only worry about presentation templates
String aName;
SdStyleSheetPool* pSourceStyleSheetPool = (SdStyleSheetPool*) pSourceDoc->GetStyleSheetPool();
- SfxStyleSheetIterator iter(pSourceStyleSheetPool,
- SD_STYLE_FAMILY_MASTERPAGE, SFXSTYLEBIT_ALL);
+ pSourceStyleSheetPool->SetSearchMask(SD_STYLE_FAMILY_MASTERPAGE);
static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->SetSearchMask(SD_STYLE_FAMILY_MASTERPAGE);
SdStyleSheetVector aCreatedStyles; // List of created stylesheets
- SfxStyleSheetBase* pHisSheet = iter.First();
+ SfxStyleSheetBase* pHisSheet = pSourceStyleSheetPool->First();
while (pHisSheet)
{
@@ -1562,7 +1561,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
aReplList.push_back(aReplData);
}
- pHisSheet = iter.Next();
+ pHisSheet = (SfxStyleSheet*) pSourceStyleSheetPool->Next();
}
// If new styles were created: re-create parent chaining of the item
diff --git a/sd/source/ui/func/fuhhconv.cxx b/sd/source/ui/func/fuhhconv.cxx
index acc59294e815..bc73ef62ad0a 100644
--- a/sd/source/ui/func/fuhhconv.cxx
+++ b/sd/source/ui/func/fuhhconv.cxx
@@ -163,9 +163,7 @@ void FuHangulHanjaConversion::ConvertStyles( sal_Int16 nTargetLanguage, const Fo
if( !pStyleSheetPool )
return;
- SfxStyleSheetIterator iter(pStyleSheetPool,
- pStyleSheetPool->GetSearchFamily(), pStyleSheetPool->GetSearchMask());
- SfxStyleSheetBase* pStyle = iter.First();
+ SfxStyleSheetBase* pStyle = pStyleSheetPool->First();
while( pStyle )
{
SfxItemSet& rSet = pStyle->GetItemSet();
@@ -188,7 +186,7 @@ void FuHangulHanjaConversion::ConvertStyles( sal_Int16 nTargetLanguage, const Fo
rSet.Put( aFontItem );
}
- pStyle = iter.Next();
+ pStyle = pStyleSheetPool->Next();
}
mpDoc->SetLanguage( EE_CHAR_LANGUAGE_CJK, nTargetLanguage );
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index b26c08cd5f53..698baafabb32 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -83,6 +83,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
if ( pPool )
{
pPool->SetSearchMask( pStyle->GetFamily() );
+ pPool->First(); // for SW - update internal list
}
if ( pStyle->GetName().isEmpty() && pPool )
@@ -118,14 +119,12 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
if ( pStyle->HasFollowSupport() && pPool )
{
- SfxStyleSheetIterator iter(pPool, pStyle->GetFamily(), SFXSTYLEBIT_ALL);
-
- SfxStyleSheetBase* pPoolStyle = iter.First();
+ SfxStyleSheetBase* pPoolStyle = pPool->First();
while ( pPoolStyle )
{
m_pFollowLb->InsertEntry( pPoolStyle->GetName() );
- pPoolStyle = iter.Next();
+ pPoolStyle = pPool->Next();
}
// A new Template is not yet in the Pool
@@ -144,9 +143,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
// the base template can be set to NULL
m_pBaseLb->InsertEntry( SfxResId(STR_NONE).toString() );
- SfxStyleSheetIterator iter(pPool, pStyle->GetFamily(), SFXSTYLEBIT_ALL);
-
- SfxStyleSheetBase* pPoolStyle = iter.First();
+ SfxStyleSheetBase* pPoolStyle = pPool->First();
while ( pPoolStyle )
{
@@ -154,7 +151,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
// own name as base template
if ( aStr != aName )
m_pBaseLb->InsertEntry( aStr );
- pPoolStyle = iter.Next();
+ pPoolStyle = pPool->Next();
}
}
else
diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx
index 18780f20c3b3..a81cd6d2a38e 100644
--- a/sfx2/source/dialog/newstyle.cxx
+++ b/sfx2/source/dialog/newstyle.cxx
@@ -81,13 +81,11 @@ SfxNewStyleDlg::SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& rInPool
aColBox.SetDoubleClickHdl(LINK(this, SfxNewStyleDlg, OKHdl));
// aColBox.SetAccessibleName(SfxResId(FL_COL).toString());
- SfxStyleSheetIterator iter(&rPool,
- rPool.GetSearchFamily(), rPool.GetSearchMask());
- SfxStyleSheetBase *pStyle = iter.First();
+ SfxStyleSheetBase *pStyle = rPool.First();
while ( pStyle )
{
aColBox.InsertEntry(pStyle->GetName());
- pStyle = iter.Next();
+ pStyle = rPool.Next();
}
}
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 9bf8063c4568..73c9f8705b5e 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1227,10 +1227,7 @@ void SfxCommonTemplateDialog_Impl::EnableTreeDrag( sal_Bool bEnable )
{
if ( pStyleSheetPool )
{
- SfxStyleSheetIterator iter(pStyleSheetPool,
- pStyleSheetPool->GetSearchFamily(),
- pStyleSheetPool->GetSearchMask());
- SfxStyleSheetBase* pStyle = iter.First();
+ SfxStyleSheetBase* pStyle = pStyleSheetPool->First();
if ( pTreeBox )
{
if ( pStyle && pStyle->HasParentSupport() && bEnable )
@@ -1251,10 +1248,8 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
{
const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
pStyleSheetPool->SetSearchMask(pItem->GetFamily(), SFXSTYLEBIT_ALL_VISIBLE);
- SfxStyleSheetIterator iter(pStyleSheetPool,
- pItem->GetFamily(), SFXSTYLEBIT_ALL_VISIBLE);
StyleTreeArr_Impl aArr;
- SfxStyleSheetBase *pStyle = iter.First();
+ SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
if(pStyle && pStyle->HasParentSupport() && bTreeDrag )
pTreeBox->SetDragDropMode(SV_DRAGDROP_CTRL_MOVE);
else
@@ -1264,7 +1259,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
StyleTree_Impl* pNew =
new StyleTree_Impl(pStyle->GetName(), pStyle->GetParent());
aArr.push_back(pNew);
- pStyle = iter.Next();
+ pStyle = pStyleSheetPool->Next();
}
MakeTree_Impl(aArr);
ExpandedEntries_t aEntries;
@@ -1397,10 +1392,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
{
EnableItem(SID_STYLE_WATERCAN,sal_False);
- SfxStyleSheetIterator iter(pStyleSheetPool,
- pStyleSheetPool->GetSearchFamily(),
- pStyleSheetPool->GetSearchMask());
- SfxStyleSheetBase *pStyle = iter.First();
+ SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
SvTreeListEntry* pEntry = aFmtLb.First();
std::vector<OUString> aStrings;
@@ -1415,7 +1407,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
for(nPos = aStrings.size(); nPos && aSorter.compare(aStrings[nPos-1], pStyle->GetName()) > 0; --nPos)
{};
aStrings.insert(aStrings.begin() + nPos, pStyle->GetName());
- pStyle = iter.Next();
+ pStyle = pStyleSheetPool->Next();
}
size_t nCount = aStrings.size();
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index da71fafe3133..49f9745f4f96 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -319,15 +319,21 @@ void SfxObjectShell::LoadStyles
*/
{
+ struct Styles_Impl
+ {
+ SfxStyleSheetBase *pSource;
+ SfxStyleSheetBase *pDest;
+ };
+
SfxStyleSheetBasePool *pSourcePool = rSource.GetStyleSheetPool();
DBG_ASSERT(pSourcePool, "Source-DocumentShell ohne StyleSheetPool");
SfxStyleSheetBasePool *pMyPool = GetStyleSheetPool();
DBG_ASSERT(pMyPool, "Dest-DocumentShell ohne StyleSheetPool");
- SfxStyleSheetIterator iter(pSourcePool,
- SFX_STYLE_FAMILY_ALL, SFXSTYLEBIT_ALL);
- std::vector<std::pair<SfxStyleSheetBase*, SfxStyleSheetBase*> > found;
+ pSourcePool->SetSearchMask(SFX_STYLE_FAMILY_ALL, SFXSTYLEBIT_ALL);
+ Styles_Impl *pFound = new Styles_Impl[pSourcePool->Count()];
+ sal_uInt16 nFound = 0;
- SfxStyleSheetBase *pSource = iter.First();
+ SfxStyleSheetBase *pSource = pSourcePool->First();
while ( pSource )
{
SfxStyleSheetBase *pDest =
@@ -338,19 +344,21 @@ void SfxObjectShell::LoadStyles
pSource->GetFamily(), pSource->GetMask());
// Setting of Parents, the next style
}
- found.push_back(std::make_pair(pSource, pDest));
- pSource = iter.Next();
+ pFound[nFound].pSource = pSource;
+ pFound[nFound].pDest = pDest;
+ ++nFound;
+ pSource = pSourcePool->Next();
}
- for (size_t i = 0; i < found.size(); ++i)
+ for ( sal_uInt16 i = 0; i < nFound; ++i )
{
- found[i].second->GetItemSet().PutExtended(found[i].first->GetItemSet(),
- SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT);
- if (found[i].first->HasParentSupport())
- found[i].second->SetParent(found[i].first->GetParent());
- if (found[i].first->HasFollowSupport())
- found[i].second->SetFollow(found[i].first->GetParent());
+ pFound[i].pDest->GetItemSet().PutExtended(pFound[i].pSource->GetItemSet(), SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT);
+ if(pFound[i].pSource->HasParentSupport())
+ pFound[i].pDest->SetParent(pFound[i].pSource->GetParent());
+ if(pFound[i].pSource->HasFollowSupport())
+ pFound[i].pDest->SetFollow(pFound[i].pSource->GetParent());
}
+ delete [] pFound;
}
//--------------------------------------------------------------------
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 57f202466bc1..1c0465581b5a 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -83,7 +83,8 @@ SfxStyleSheetHint::SfxStyleSheetHint
class SfxStyleSheetBasePool_Impl
{
- // TODO: move members here
+public:
+ SfxStyleSheetIteratorPtr pIter;
};
@@ -530,6 +531,16 @@ void SfxStyleSheetBasePool::Replace( SfxStyleSheetBase& rSource, SfxStyleSheetBa
rTargetSet.Put( rSourceSet );
}
+SfxStyleSheetIterator& SfxStyleSheetBasePool::GetIterator_Impl()
+{
+ if( !pImp->pIter || (pImp->pIter->GetSearchMask() != nMask) || (pImp->pIter->GetSearchFamily() != nSearchFamily) )
+ {
+ pImp->pIter = CreateIterator( nSearchFamily, nMask );
+ }
+
+ return *pImp->pIter;
+}
+
SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r )
: aAppName(r.GetName())
, rPool(r)
@@ -671,6 +682,16 @@ SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator+=( const SfxStyleSheetBas
return *this;
}
+sal_uInt16 SfxStyleSheetBasePool::Count()
+{
+ return GetIterator_Impl().Count();
+}
+
+SfxStyleSheetBase *SfxStyleSheetBasePool::operator[](sal_uInt16 nIdx)
+{
+ return GetIterator_Impl()[nIdx];
+}
+
SfxStyleSheetBase* SfxStyleSheetBasePool::Find(const OUString& rName,
SfxStyleFamily eFam,
sal_uInt16 mask)
@@ -684,6 +705,16 @@ const SfxStyles& SfxStyleSheetBasePool::GetStyles()
return aStyles;
}
+SfxStyleSheetBase* SfxStyleSheetBasePool::First()
+{
+ return GetIterator_Impl().First();
+}
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::Next()
+{
+ return GetIterator_Impl().Next();
+}
+
void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p )
{
if( p )
@@ -760,8 +791,9 @@ void SfxStyleSheetBasePool::ChangeParent(const OUString& rOld,
const OUString& rNew,
bool bVirtual)
{
- SfxStyleSheetIterator iter(this, GetSearchFamily(), SFXSTYLEBIT_ALL);
- for (SfxStyleSheetBase* p = iter.First(); p; p = iter.Next())
+ const sal_uInt16 nTmpMask = GetSearchMask();
+ SetSearchMask(GetSearchFamily(), SFXSTYLEBIT_ALL);
+ for( SfxStyleSheetBase* p = First(); p; p = Next() )
{
if( p->GetParent() == rOld )
{
@@ -771,6 +803,7 @@ void SfxStyleSheetBasePool::ChangeParent(const OUString& rOld,
p->aParent = rNew;
}
}
+ SetSearchMask(GetSearchFamily(), nTmpMask);
}
void SfxStyleSheetBase::Load( SvStream&, sal_uInt16 )
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 63b3a9b45f31..11d235e57870 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -894,16 +894,16 @@ void SvxSearchDialog::Init_Impl( int bSearchPattern )
m_pSearchTmplLB->Clear();
m_pReplaceTmplLB->Clear();
SfxStyleSheetBasePool* pStylePool = pShell->GetStyleSheetPool();
- SfxStyleSheetIterator iter(pStylePool, pSearchItem->GetFamily(),
+ pStylePool->SetSearchMask( pSearchItem->GetFamily(),
SFXSTYLEBIT_ALL );
- SfxStyleSheetBase* pBase = iter.First();
+ SfxStyleSheetBase* pBase = pStylePool->First();
while ( pBase )
{
if ( pBase->IsUsed() )
m_pSearchTmplLB->InsertEntry( pBase->GetName() );
m_pReplaceTmplLB->InsertEntry( pBase->GetName() );
- pBase = iter.Next();
+ pBase = pStylePool->Next();
}
m_pSearchTmplLB->SelectEntry( pSearchItem->GetSearchString() );
m_pReplaceTmplLB->SelectEntry( pSearchItem->GetReplaceString() );
@@ -1564,18 +1564,17 @@ void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool )
String aOldRepl( m_pReplaceTmplLB->GetSelectEntry() );
m_pSearchTmplLB->Clear();
m_pReplaceTmplLB->Clear();
+ rPool.SetSearchMask( pSearchItem->GetFamily(), SFXSTYLEBIT_ALL );
m_pSearchTmplLB->SetUpdateMode( sal_False );
m_pReplaceTmplLB->SetUpdateMode( sal_False );
- SfxStyleSheetIterator iter(&rPool,
- pSearchItem->GetFamily(), SFXSTYLEBIT_ALL);
- SfxStyleSheetBase* pBase = iter.First();
+ SfxStyleSheetBase* pBase = rPool.First();
while ( pBase )
{
if ( pBase->IsUsed() )
m_pSearchTmplLB->InsertEntry( pBase->GetName() );
m_pReplaceTmplLB->InsertEntry( pBase->GetName() );
- pBase = iter.Next();
+ pBase = rPool.Next();
}
m_pSearchTmplLB->SetUpdateMode( sal_True );
m_pReplaceTmplLB->SetUpdateMode( sal_True );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index aa5a5910c39f..779753c45b5f 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -420,11 +420,11 @@ void SvxStyleBox_Impl::Select()
if ( pPool )
{
- SfxStyleSheetIterator iter(pPool, eStyleFamily, SFXSTYLEBIT_ALL);
+ pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
- pStyle = iter.First();
+ pStyle = pPool->First();
while ( pStyle && OUString( pStyle->GetName() ) != aSearchEntry )
- pStyle = iter.Next();
+ pStyle = pPool->Next();
}
if ( !pStyle )
@@ -569,11 +569,11 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
if ( pPool )
{
- SfxStyleSheetIterator iter(pPool, eStyleFamily, SFXSTYLEBIT_ALL);
+ pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
- pStyle = iter.First();
+ pStyle = pPool->First();
while ( pStyle && OUString( pStyle->GetName() ) != aStyleName )
- pStyle = iter.Next();
+ pStyle = pPool->Next();
}
if ( !pStyle )
@@ -1942,16 +1942,17 @@ void SvxStyleToolBoxControl::FillStyleBox()
if ( pStyleSheetPool && pBox && nActFamily!=0xffff )
{
const SfxStyleFamily eFamily = GetActFamily();
+ sal_uInt16 nCount = pStyleSheetPool->Count();
SfxStyleSheetBase* pStyle = NULL;
bool bDoFill = false;
- SfxStyleSheetIterator iter(pStyleSheetPool, eFamily, SFXSTYLEBIT_USED);
+ pStyleSheetPool->SetSearchMask( eFamily, SFXSTYLEBIT_USED );
// Check whether fill is necessary
- pStyle = iter.First();
+ pStyle = pStyleSheetPool->First();
//!!! TODO: This condition isn't right any longer, because we always show some default entries
//!!! so the list doesn't show the count
- if (iter.Count() != pBox->GetEntryCount())
+ if ( nCount != pBox->GetEntryCount() )
{
bDoFill = true;
}
@@ -1961,7 +1962,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
while ( pStyle && !bDoFill )
{
bDoFill = ( pBox->GetEntry(i) != pStyle->GetName() );
- pStyle = iter.Next();
+ pStyle = pStyleSheetPool->Next();
i++;
}
}
@@ -1975,7 +1976,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
sal_uInt16 _i;
sal_uInt32 nCnt = pImpl->aDefaultStyles.size();
- pStyle = iter.First();
+ pStyle = pStyleSheetPool->First();
if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
{
@@ -1996,7 +1997,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
if( bInsert )
pBox->InsertEntry( aName );
- pStyle = iter.Next();
+ pStyle = pStyleSheetPool->Next();
}
}
else
@@ -2004,7 +2005,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
while ( pStyle )
{
pBox->InsertEntry( pStyle->GetName() );
- pStyle = iter.Next();
+ pStyle = pStyleSheetPool->Next();
}
}
}
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index f422d97baabd..900bbbc596ec 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -175,6 +175,8 @@ public:
virtual SfxStyleSheetBase* Find(const OUString& rStr);
virtual void Notify( SfxBroadcaster&, const SfxHint& );
+
+ void InvalidateIterator();
};
@@ -218,6 +220,8 @@ public:
virtual void SAL_CALL acquire( ) throw ();
virtual void SAL_CALL release( ) throw ();
+ void InvalidateIterator();
+
protected:
virtual ~SwDocStyleSheetPool();
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 152e3e3e7a13..1eaa460e8597 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1900,15 +1900,14 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
//
sal_Int16 nIdx = GetCommandContextIndex( pSeq[i].Name );
- SfxStyleSheetIterator iter(pBasePool,
- SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
+ pBasePool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
sal_Bool bStyleFound = sal_False;
- const SfxStyleSheetBase* pBase = iter.First();
+ const SfxStyleSheetBase* pBase = pBasePool->First();
while (pBase && !bStyleFound)
{
if(pBase->GetName() == aStyleName)
bStyleFound = sal_True;
- pBase = iter.Next();
+ pBase = pBasePool->Next();
}
if (nIdx == -1 || !bStyleFound)
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 4f10b1cdb354..dc78296ca79e 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -476,6 +476,8 @@ void SwDocStyleSheet::SetHidden( sal_Bool bValue )
if( bChg )
{
+ // calling pPool->First() here would be quite slow...
+ dynamic_cast<SwDocStyleSheetPool*>(pPool)->InvalidateIterator(); // internal list has to be updated
pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
SwEditShell* pSh = rDoc.GetEditShell();
if( pSh )
@@ -911,6 +913,7 @@ bool SwDocStyleSheet::SetName( const OUString& rStr)
if( bChg )
{
+ pPool->First(); // internal list has to be updated
pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
SwEditShell* pSh = rDoc.GetEditShell();
if( pSh )
@@ -2864,6 +2867,21 @@ void SwStyleSheetIterator::AppendStyleList(const boost::ptr_vector<String>& rLis
}
}
+void SwDocStyleSheetPool::InvalidateIterator()
+{
+ dynamic_cast<SwStyleSheetIterator&>(GetIterator_Impl()).InvalidateIterator();
+}
+
+void SwStyleSheetIterator::InvalidateIterator()
+{
+ // potentially we could send an SfxHint to Notify but currently it's
+ // iterating over the vector anyway so would still be slow - why does
+ // this iterator not use a map?
+ bFirstCalled = false;
+ nLastPos = 0;
+ aLst.Erase();
+}
+
void SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
// search and remove from View-List!!
diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx
index 17e39a58a313..20b4f957de30 100644
--- a/sw/source/ui/chrdlg/pardlg.cxx
+++ b/sw/source/ui/chrdlg/pardlg.cxx
@@ -240,14 +240,13 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
((SwParagraphNumTabPage&)rPage).EnableNewStart();
ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
- SfxStyleSheetIterator iter(pPool,
- SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
- SfxStyleSheetBase const* pBase = iter.First();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
+ const SfxStyleSheetBase* pBase = pPool->First();
std::set<String> aNames;
while(pBase)
{
aNames.insert(pBase->GetName());
- pBase = iter.Next();
+ pBase = pPool->Next();
}
for(std::set<String>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
rBox.InsertEntry(*it);
diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx
index c46eceb7eb20..beb916efbc8a 100644
--- a/sw/source/ui/chrdlg/swuiccoll.cxx
+++ b/sw/source/ui/chrdlg/swuiccoll.cxx
@@ -184,14 +184,14 @@ void SwCondCollPage::Reset(const SfxItemSet &/*rSet*/)
aTbLinks.Clear();
SfxStyleSheetBasePool* pPool = rSh.GetView().GetDocShell()->GetStyleSheetPool();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
aStyleLB.Clear();
- SfxStyleSheetIterator iter(pPool, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
- const SfxStyleSheetBase* pBase = iter.First();
+ const SfxStyleSheetBase* pBase = pPool->First();
while( pBase )
{
if(!pFmt || pBase->GetName() != pFmt->GetName())
aStyleLB.InsertEntry(pBase->GetName());
- pBase = iter.Next();
+ pBase = pPool->Next();
}
aStyleLB.SelectEntryPos(0);
@@ -274,14 +274,14 @@ IMPL_LINK( SwCondCollPage, SelectHdl, ListBox*, pBox)
sal_uInt16 nSearchFlags = pBox->GetSelectEntryPos();
nSearchFlags = *(sal_uInt16*)aFilterLB.GetEntryData(nSearchFlags);
SfxStyleSheetBasePool* pPool = rSh.GetView().GetDocShell()->GetStyleSheetPool();
- SfxStyleSheetIterator iter(pPool, SFX_STYLE_FAMILY_PARA, nSearchFlags);
- const SfxStyleSheetBase* pBase = iter.First();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, nSearchFlags);
+ const SfxStyleSheetBase* pBase = pPool->First();
while( pBase )
{
if(!pFmt || pBase->GetName() != pFmt->GetName())
aStyleLB.InsertEntry(pBase->GetName());
- pBase = iter.Next();
+ pBase = pPool->Next();
}
aStyleLB.SelectEntryPos(0);
SelectHdl(&aStyleLB);
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index da49467b451d..8fc1c6ce6d4e 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -348,15 +348,14 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
// fill paragraph templates-ListBox
{
SfxStyleSheetBasePool* pPool = pView->GetDocShell()->GetStyleSheetPool();
- SfxStyleSheetIterator iter(pPool,
- SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
+ pPool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
aLbDbParaColl.InsertEntry( sNoTmpl );
- const SfxStyleSheetBase* pBase = iter.First();
+ const SfxStyleSheetBase* pBase = pPool->First();
while( pBase )
{
aLbDbParaColl.InsertEntry( pBase->GetName() );
- pBase = iter.Next();
+ pBase = pPool->Next();
}
aLbDbParaColl.SelectEntryPos( 0 );
}
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index ca6da1fae5dc..af1c631843e9 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -420,14 +420,13 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
}//<-end
ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
- SfxStyleSheetIterator iter(pPool,
- SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
- const SfxStyleSheetBase* pBase = iter.First();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
+ const SfxStyleSheetBase* pBase = pPool->First();
std::set<String> aNames;
while(pBase)
{
aNames.insert(pBase->GetName());
- pBase = iter.Next();
+ pBase = pPool->Next();
}
for(std::set<String>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
rBox.InsertEntry(*it);
@@ -489,13 +488,12 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
{
SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
GetView().GetDocShell()->GetStyleSheetPool();
- SfxStyleSheetIterator iter(pStyleSheetPool,
- SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
- SfxStyleSheetBase *pFirstStyle = iter.First();
+ pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
+ SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
while(pFirstStyle)
{
aList.push_back( pFirstStyle->GetName() );
- pFirstStyle = iter.Next();
+ pFirstStyle = pStyleSheetPool->Next();
}
}
aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));
diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx
index 767906823570..e515491ad19b 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -171,14 +171,13 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& )
// styles special regions
// paragraph
- SfxStyleSheetBasePool *const pSPool =
- pSh->GetView().GetDocShell()->GetStyleSheetPool();
- SfxStyleSheetIterator iter(pSPool, SFX_STYLE_FAMILY_PARA, SWSTYLEBIT_EXTRA);
- SfxStyleSheetBase *pStyle = iter.First();
+ SfxStyleSheetBasePool* pStyleSheetPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
+ pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, SWSTYLEBIT_EXTRA);
+ SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
while(pStyle)
{
m_pParaTemplBox->InsertEntry(pStyle->GetName());
- pStyle = iter.Next();
+ pStyle = pStyleSheetPool->Next();
}
String sStr;
diff --git a/sw/source/ui/utlui/tmplctrl.cxx b/sw/source/ui/utlui/tmplctrl.cxx
index bb3ec4fb5a94..456faf6e7d8b 100644
--- a/sw/source/ui/utlui/tmplctrl.cxx
+++ b/sw/source/ui/utlui/tmplctrl.cxx
@@ -104,17 +104,16 @@ void SwTemplateControl::Command( const CommandEvent& rCEvt )
{
SfxStyleSheetBasePool* pPool = pView->GetDocShell()->
GetStyleSheetPool();
- SfxStyleSheetIterator iter(pPool,
- SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
- if (iter.Count() > 1)
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
+ if( pPool->Count() > 1 )
{
sal_uInt16 nCount = 0;
- SfxStyleSheetBase* pStyle = iter.First();
+ SfxStyleSheetBase* pStyle = pPool->First();
while( pStyle )
{
nCount++;
aPop.InsertItem( nCount, pStyle->GetName() );
- pStyle = iter.Next();
+ pStyle = pPool->Next();
}
aPop.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
@@ -122,7 +121,7 @@ void SwTemplateControl::Command( const CommandEvent& rCEvt )
if( nCurrId != USHRT_MAX)
{
// looks a bit awkward, but another way is not possible
- pStyle = iter.operator[]( nCurrId - 1 );
+ pStyle = pPool->operator[]( nCurrId - 1 );
SfxStringItem aStyle( FN_SET_PAGE_STYLE, pStyle->GetName() );
pWrtShell->GetView().GetViewFrame()->GetDispatcher()->Execute(
FN_SET_PAGE_STYLE,
diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx
index 8251b326f985..70e5e2234b36 100644
--- a/sw/source/ui/utlui/uitool.cxx
+++ b/sw/source/ui/utlui/uitool.cxx
@@ -598,9 +598,9 @@ void FillCharStyleListBox(ListBox& rToFill, SwDocShell* pDocSh, bool bSorted, bo
{
sal_Bool bHasOffset = rToFill.GetEntryCount() > 0;
SfxStyleSheetBasePool* pPool = pDocSh->GetStyleSheetPool();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_CHAR, SFXSTYLEBIT_ALL);
SwDoc* pDoc = pDocSh->GetDoc();
- SfxStyleSheetIterator iter(pPool, SFX_STYLE_FAMILY_CHAR, SFXSTYLEBIT_ALL);
- const SfxStyleSheetBase* pBase = iter.First();
+ const SfxStyleSheetBase* pBase = pPool->First();
String sStandard;
SwStyleNameMapper::FillUIName( RES_POOLCOLL_STANDARD, sStandard );
while(pBase)
@@ -615,7 +615,7 @@ void FillCharStyleListBox(ListBox& rToFill, SwDocShell* pDocSh, bool bSorted, bo
sal_IntPtr nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( pBase->GetName(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
rToFill.SetEntryData( nPos, (void*) (nPoolId));
}
- pBase = iter.Next();
+ pBase = pPool->Next();
}
// non-pool styles
const SwCharFmts* pFmts = pDoc->GetCharFmts();