summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-07-27 16:54:50 +0200
committerMichael Stahl <mstahl@redhat.com>2013-07-27 17:15:55 +0200
commita1c081a7c213a56321b0b60651a1dbd63bcaec80 (patch)
tree52d8070fc39e37d42f5d9c9a4c0147757859fab8 /sfx2/source
parent21a4f5df04849a943764918147183ffba3710e87 (diff)
Revert "SfxStyleSheetBasePool: remove internal iterator"
This reverts commit 3a46d91f8de420f38dd763028e91229c846dff52. This breaks the Stylist, not sure why (does it depend on something setting the search flags before?) so revert for now. Change-Id: Ia50feeebae8bf852c827e4f270e81e9f08d2b1ac
Diffstat (limited to 'sfx2/source')
-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, 33 insertions, 38 deletions
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;
}
//--------------------------------------------------------------------