summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2')
-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
4 files changed, 38 insertions, 33 deletions
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 698baafabb32..b26c08cd5f53 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -83,7 +83,6 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
if ( pPool )
{
pPool->SetSearchMask( pStyle->GetFamily() );
- pPool->First(); // for SW - update internal list
}
if ( pStyle->GetName().isEmpty() && pPool )
@@ -119,12 +118,14 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
if ( pStyle->HasFollowSupport() && pPool )
{
- SfxStyleSheetBase* pPoolStyle = pPool->First();
+ SfxStyleSheetIterator iter(pPool, pStyle->GetFamily(), SFXSTYLEBIT_ALL);
+
+ SfxStyleSheetBase* pPoolStyle = iter.First();
while ( pPoolStyle )
{
m_pFollowLb->InsertEntry( pPoolStyle->GetName() );
- pPoolStyle = pPool->Next();
+ pPoolStyle = iter.Next();
}
// A new Template is not yet in the Pool
@@ -143,7 +144,9 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
// the base template can be set to NULL
m_pBaseLb->InsertEntry( SfxResId(STR_NONE).toString() );
- SfxStyleSheetBase* pPoolStyle = pPool->First();
+ SfxStyleSheetIterator iter(pPool, pStyle->GetFamily(), SFXSTYLEBIT_ALL);
+
+ SfxStyleSheetBase* pPoolStyle = iter.First();
while ( pPoolStyle )
{
@@ -151,7 +154,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
// own name as base template
if ( aStr != aName )
m_pBaseLb->InsertEntry( aStr );
- pPoolStyle = pPool->Next();
+ pPoolStyle = iter.Next();
}
}
else
diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx
index a81cd6d2a38e..18780f20c3b3 100644
--- a/sfx2/source/dialog/newstyle.cxx
+++ b/sfx2/source/dialog/newstyle.cxx
@@ -81,11 +81,13 @@ SfxNewStyleDlg::SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& rInPool
aColBox.SetDoubleClickHdl(LINK(this, SfxNewStyleDlg, OKHdl));
// aColBox.SetAccessibleName(SfxResId(FL_COL).toString());
- SfxStyleSheetBase *pStyle = rPool.First();
+ SfxStyleSheetIterator iter(&rPool,
+ rPool.GetSearchFamily(), rPool.GetSearchMask());
+ SfxStyleSheetBase *pStyle = iter.First();
while ( pStyle )
{
aColBox.InsertEntry(pStyle->GetName());
- pStyle = rPool.Next();
+ pStyle = iter.Next();
}
}
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 73c9f8705b5e..9bf8063c4568 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1227,7 +1227,10 @@ void SfxCommonTemplateDialog_Impl::EnableTreeDrag( sal_Bool bEnable )
{
if ( pStyleSheetPool )
{
- SfxStyleSheetBase* pStyle = pStyleSheetPool->First();
+ SfxStyleSheetIterator iter(pStyleSheetPool,
+ pStyleSheetPool->GetSearchFamily(),
+ pStyleSheetPool->GetSearchMask());
+ SfxStyleSheetBase* pStyle = iter.First();
if ( pTreeBox )
{
if ( pStyle && pStyle->HasParentSupport() && bEnable )
@@ -1248,8 +1251,10 @@ 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 = pStyleSheetPool->First();
+ SfxStyleSheetBase *pStyle = iter.First();
if(pStyle && pStyle->HasParentSupport() && bTreeDrag )
pTreeBox->SetDragDropMode(SV_DRAGDROP_CTRL_MOVE);
else
@@ -1259,7 +1264,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
StyleTree_Impl* pNew =
new StyleTree_Impl(pStyle->GetName(), pStyle->GetParent());
aArr.push_back(pNew);
- pStyle = pStyleSheetPool->Next();
+ pStyle = iter.Next();
}
MakeTree_Impl(aArr);
ExpandedEntries_t aEntries;
@@ -1392,7 +1397,10 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
{
EnableItem(SID_STYLE_WATERCAN,sal_False);
- SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
+ SfxStyleSheetIterator iter(pStyleSheetPool,
+ pStyleSheetPool->GetSearchFamily(),
+ pStyleSheetPool->GetSearchMask());
+ SfxStyleSheetBase *pStyle = iter.First();
SvTreeListEntry* pEntry = aFmtLb.First();
std::vector<OUString> aStrings;
@@ -1407,7 +1415,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 = pStyleSheetPool->Next();
+ pStyle = iter.Next();
}
size_t nCount = aStrings.size();
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 49f9745f4f96..da71fafe3133 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -319,21 +319,15 @@ 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");
- pSourcePool->SetSearchMask(SFX_STYLE_FAMILY_ALL, SFXSTYLEBIT_ALL);
- Styles_Impl *pFound = new Styles_Impl[pSourcePool->Count()];
- sal_uInt16 nFound = 0;
+ SfxStyleSheetIterator iter(pSourcePool,
+ SFX_STYLE_FAMILY_ALL, SFXSTYLEBIT_ALL);
+ std::vector<std::pair<SfxStyleSheetBase*, SfxStyleSheetBase*> > found;
- SfxStyleSheetBase *pSource = pSourcePool->First();
+ SfxStyleSheetBase *pSource = iter.First();
while ( pSource )
{
SfxStyleSheetBase *pDest =
@@ -344,21 +338,19 @@ void SfxObjectShell::LoadStyles
pSource->GetFamily(), pSource->GetMask());
// Setting of Parents, the next style
}
- pFound[nFound].pSource = pSource;
- pFound[nFound].pDest = pDest;
- ++nFound;
- pSource = pSourcePool->Next();
+ found.push_back(std::make_pair(pSource, pDest));
+ pSource = iter.Next();
}
- for ( sal_uInt16 i = 0; i < nFound; ++i )
+ for (size_t i = 0; i < found.size(); ++i)
{
- 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());
+ 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());
}
- delete [] pFound;
}
//--------------------------------------------------------------------