[Libreoffice-commits] core.git: 6 commits - cui/source editeng/source include/sfx2 include/svl sc/inc sc/source sd/source sfx2/source svl/source svx/source sw/inc sw/source

Michael Stahl mstahl at redhat.com
Fri Jul 26 15:51:42 PDT 2013


 cui/source/tabpages/paragrph.cxx    |    7 
 editeng/source/editeng/editdbg.cxx  |    6 
 include/sfx2/objsh.hxx              |   31 ---
 include/svl/style.hxx               |   11 -
 sc/inc/stlpool.hxx                  |    2 
 sc/source/core/data/stlpool.cxx     |    6 
 sc/source/filter/html/htmlexp.cxx   |   14 +
 sc/source/ui/docshell/docsh6.cxx    |   19 --
 sc/source/ui/inc/docsh.hxx          |    3 
 sd/source/core/drawdoc3.cxx         |    7 
 sd/source/ui/docshell/docshel3.cxx  |    6 
 sd/source/ui/func/fuhhconv.cxx      |    6 
 sd/source/ui/inc/DrawDocShell.hxx   |    1 
 sfx2/source/dialog/mgetempl.cxx     |   13 -
 sfx2/source/dialog/newstyle.cxx     |    6 
 sfx2/source/dialog/templdlg.cxx     |   18 +
 sfx2/source/doc/objcont.cxx         |  331 +-----------------------------------
 svl/source/items/style.cxx          |   52 -----
 svx/source/dialog/srchdlg.cxx       |   13 -
 svx/source/tbxctrls/tbcontrl.cxx    |   27 +-
 sw/inc/docsh.hxx                    |   17 -
 sw/inc/docstyle.hxx                 |    3 
 sw/source/core/unocore/unostyle.cxx |    7 
 sw/source/ui/app/docsh2.cxx         |  278 ------------------------------
 sw/source/ui/app/docst.cxx          |    7 
 sw/source/ui/app/docstyle.cxx       |    6 
 sw/source/ui/chrdlg/pardlg.cxx      |    7 
 sw/source/ui/chrdlg/swuiccoll.cxx   |   12 -
 sw/source/ui/dbui/dbinsdlg.cxx      |    7 
 sw/source/ui/fmtui/tmpdlg.cxx       |   14 -
 sw/source/ui/misc/docfnote.cxx      |    9 
 sw/source/ui/utlui/tmplctrl.cxx     |   11 -
 sw/source/ui/utlui/uitool.cxx       |    6 
 33 files changed, 142 insertions(+), 821 deletions(-)

New commits:
commit 3a46d91f8de420f38dd763028e91229c846dff52
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jul 27 00:43:34 2013 +0200

    SfxStyleSheetBasePool: remove internal iterator
    
    The clients always start with First() anyway so they might as well use
    external iterators, which makes calling First() in certain situations
    just so the internal iterator is invalidated unnecessary.
    
    Change-Id: I0948576c20410136448e8b85311c21a257469bc7

diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index f9ab85f..c336b52 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -1942,8 +1942,9 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSe
     if ( pSh )
     {
         SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
-        pPool->SetSearchMask( SFX_STYLE_FAMILY_PAGE );
-        SfxStyleSheetBase* pStyle = pPool->First();
+        SfxStyleSheetIterator iter(pPool,
+            SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
+        SfxStyleSheetBase* pStyle = iter.First();
         String aStdName;
 
         while( pStyle )
@@ -1952,7 +1953,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSe
                 // first style == standard style
                 aStdName = pStyle->GetName();
             m_pApplyCollBox->InsertEntry( pStyle->GetName() );
-            pStyle = pPool->Next();
+            pStyle = iter.Next();
         }
         nStdPos = m_pApplyCollBox->GetEntryPos( aStdName );
     }
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index 4006918..785deda 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() )
     {
-        sal_uLong nStyles = pEE->pImpEditEngine->GetStyleSheetPool() ? pEE->pImpEditEngine->GetStyleSheetPool()->Count() : 0;
+        SfxStyleSheetIterator aIter( pEE->pImpEditEngine->GetStyleSheetPool(), SFX_STYLE_FAMILY_ALL );
+        sal_uLong nStyles = pEE->pImpEditEngine->GetStyleSheetPool() ? aIter.Count() : 0;
         fprintf( fp, "\n\n================================================================================" );
         fprintf( fp, "\n==================   Stylesheets   =============================================" );
         fprintf( fp, "\n================================================================================" );
-        fprintf( fp, "\n#Template:   %lu\n", nStyles );
-        SfxStyleSheetIterator aIter( pEE->pImpEditEngine->GetStyleSheetPool(), SFX_STYLE_FAMILY_ALL );
+        fprintf( fp, "\n#Styles:     %lu\n", nStyles );
         SfxStyleSheetBase* pStyle = aIter.First();
         while ( pStyle )
         {
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 9d4b3be..464a9c8 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -204,8 +204,6 @@ friend class SfxStyleSheetBase;
     SfxStyleSheetBasePool_Impl *pImp;
 
 protected:
-    SfxStyleSheetIterator&      GetIterator_Impl();
-
     OUString                    aAppName;
     SfxItemPool&                rPool;
     SfxStyles                   aStyles;
@@ -229,8 +227,6 @@ 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,
@@ -248,8 +244,6 @@ 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 5cbf833..05c3e9d 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -447,13 +447,16 @@ 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)
-            pStyleSheet = pStylePool->First();
+        {
+            SfxStyleSheetIterator iter(pStylePool,
+                    SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
+            pStyleSheet = iter.First();
+        }
         const SfxItemSet& rSetPara = pStyleSheet->GetItemSet();
 
         aHTMLStyle.nDefaultScriptType = ScGlobal::GetDefaultScriptType();
@@ -470,11 +473,14 @@ 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)
-        pStyleSheet = pStylePool->First();
+    {
+        SfxStyleSheetIterator iter(pStylePool,
+             SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
+        pStyleSheet = iter.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 3256980..a1b2985 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -231,8 +231,9 @@ SfxStyleSheetBasePool* ScDocShell::GetStyleSheetPool()
 
 static void lcl_AdjustPool( SfxStyleSheetBasePool* pStylePool )
 {
-    pStylePool->SetSearchMask(SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
-    SfxStyleSheetBase *pStyle = pStylePool->First();
+    SfxStyleSheetIterator iter(pStylePool,
+            SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
+    SfxStyleSheetBase *pStyle = iter.First();
     while ( pStyle )
     {
         SfxItemSet& rStyleSet = pStyle->GetItemSet();
@@ -253,7 +254,7 @@ static void lcl_AdjustPool( SfxStyleSheetBasePool* pStylePool )
             rStyleSet.Put(SvxSetItem(ATTR_PAGE_FOOTERSET,pDestSet));
         }
 
-        pStyle = pStylePool->Next();
+        pStyle = iter.Next();
     }
 }
 
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 3881a9f..35ef319 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1494,11 +1494,12 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             // only worry about presentation templates
             String aName;
             SdStyleSheetPool* pSourceStyleSheetPool = (SdStyleSheetPool*) pSourceDoc->GetStyleSheetPool();
-            pSourceStyleSheetPool->SetSearchMask(SD_STYLE_FAMILY_MASTERPAGE);
+            SfxStyleSheetIterator iter(pSourceStyleSheetPool,
+                    SD_STYLE_FAMILY_MASTERPAGE, SFXSTYLEBIT_ALL);
             static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->SetSearchMask(SD_STYLE_FAMILY_MASTERPAGE);
 
             SdStyleSheetVector aCreatedStyles;          // List of created stylesheets
-            SfxStyleSheetBase* pHisSheet = pSourceStyleSheetPool->First();
+            SfxStyleSheetBase* pHisSheet = iter.First();
 
             while (pHisSheet)
             {
@@ -1561,7 +1562,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                     aReplList.push_back(aReplData);
                 }
 
-                pHisSheet = (SfxStyleSheet*) pSourceStyleSheetPool->Next();
+                pHisSheet = iter.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 bc73ef6..acc5929 100644
--- a/sd/source/ui/func/fuhhconv.cxx
+++ b/sd/source/ui/func/fuhhconv.cxx
@@ -163,7 +163,9 @@ void FuHangulHanjaConversion::ConvertStyles( sal_Int16 nTargetLanguage, const Fo
     if( !pStyleSheetPool )
         return;
 
-    SfxStyleSheetBase* pStyle = pStyleSheetPool->First();
+    SfxStyleSheetIterator iter(pStyleSheetPool,
+        pStyleSheetPool->GetSearchFamily(), pStyleSheetPool->GetSearchMask());
+    SfxStyleSheetBase* pStyle = iter.First();
     while( pStyle )
     {
         SfxItemSet& rSet = pStyle->GetItemSet();
@@ -186,7 +188,7 @@ void FuHangulHanjaConversion::ConvertStyles( sal_Int16 nTargetLanguage, const Fo
             rSet.Put( aFontItem );
         }
 
-        pStyle = pStyleSheetPool->Next();
+        pStyle = iter.Next();
     }
 
     mpDoc->SetLanguage( EE_CHAR_LANGUAGE_CJK, nTargetLanguage );
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 698baaf..b26c08c 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 a81cd6d..18780f2 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 73c9f87..9bf8063 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 49f9745..da71faf 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;
 }
 
 //--------------------------------------------------------------------
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 1c04655..57f2024 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -83,8 +83,7 @@ SfxStyleSheetHint::SfxStyleSheetHint
 
 class SfxStyleSheetBasePool_Impl
 {
-public:
-    SfxStyleSheetIteratorPtr pIter;
+    // TODO: move members here
 };
 
 
@@ -531,16 +530,6 @@ 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)
@@ -682,16 +671,6 @@ 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)
@@ -705,16 +684,6 @@ 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 )
@@ -791,9 +760,8 @@ void SfxStyleSheetBasePool::ChangeParent(const OUString& rOld,
                                          const OUString& rNew,
                                          bool bVirtual)
 {
-    const sal_uInt16 nTmpMask = GetSearchMask();
-    SetSearchMask(GetSearchFamily(), SFXSTYLEBIT_ALL);
-    for( SfxStyleSheetBase* p = First(); p; p = Next() )
+    SfxStyleSheetIterator iter(this, GetSearchFamily(), SFXSTYLEBIT_ALL);
+    for (SfxStyleSheetBase* p = iter.First(); p; p = iter.Next())
     {
         if( p->GetParent() == rOld )
         {
@@ -803,7 +771,6 @@ 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 11d235e..63b3a9b 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();
-            pStylePool->SetSearchMask( pSearchItem->GetFamily(),
+            SfxStyleSheetIterator iter(pStylePool, pSearchItem->GetFamily(),
                                        SFXSTYLEBIT_ALL );
-            SfxStyleSheetBase* pBase = pStylePool->First();
+            SfxStyleSheetBase* pBase = iter.First();
 
             while ( pBase )
             {
                 if ( pBase->IsUsed() )
                     m_pSearchTmplLB->InsertEntry( pBase->GetName() );
                 m_pReplaceTmplLB->InsertEntry( pBase->GetName() );
-                pBase = pStylePool->Next();
+                pBase = iter.Next();
             }
             m_pSearchTmplLB->SelectEntry( pSearchItem->GetSearchString() );
             m_pReplaceTmplLB->SelectEntry( pSearchItem->GetReplaceString() );
@@ -1564,17 +1564,18 @@ 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 );
-    SfxStyleSheetBase* pBase = rPool.First();
+    SfxStyleSheetIterator iter(&rPool,
+            pSearchItem->GetFamily(), SFXSTYLEBIT_ALL);
+    SfxStyleSheetBase* pBase = iter.First();
 
     while ( pBase )
     {
         if ( pBase->IsUsed() )
             m_pSearchTmplLB->InsertEntry( pBase->GetName() );
         m_pReplaceTmplLB->InsertEntry( pBase->GetName() );
-        pBase = rPool.Next();
+        pBase = iter.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 779753c..aa5a591 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -420,11 +420,11 @@ void SvxStyleBox_Impl::Select()
 
         if ( pPool )
         {
-            pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
+            SfxStyleSheetIterator iter(pPool, eStyleFamily, SFXSTYLEBIT_ALL);
 
-            pStyle = pPool->First();
+            pStyle = iter.First();
             while ( pStyle && OUString( pStyle->GetName() ) != aSearchEntry )
-                pStyle = pPool->Next();
+                pStyle = iter.Next();
         }
 
         if ( !pStyle )
@@ -569,11 +569,11 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
 
         if ( pPool )
         {
-            pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
+            SfxStyleSheetIterator iter(pPool, eStyleFamily, SFXSTYLEBIT_ALL);
 
-            pStyle = pPool->First();
+            pStyle = iter.First();
             while ( pStyle && OUString( pStyle->GetName() ) != aStyleName )
-                pStyle = pPool->Next();
+                pStyle = iter.Next();
         }
 
         if ( !pStyle )
@@ -1942,17 +1942,16 @@ void SvxStyleToolBoxControl::FillStyleBox()
     if ( pStyleSheetPool && pBox && nActFamily!=0xffff )
     {
         const SfxStyleFamily    eFamily     = GetActFamily();
-        sal_uInt16                  nCount      = pStyleSheetPool->Count();
         SfxStyleSheetBase*      pStyle      = NULL;
         bool                    bDoFill     = false;
 
-        pStyleSheetPool->SetSearchMask( eFamily, SFXSTYLEBIT_USED );
+        SfxStyleSheetIterator iter(pStyleSheetPool, eFamily, SFXSTYLEBIT_USED);
 
         // Check whether fill is necessary
-        pStyle = pStyleSheetPool->First();
+        pStyle = iter.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 ( nCount != pBox->GetEntryCount() )
+        if (iter.Count() != pBox->GetEntryCount())
         {
             bDoFill = true;
         }
@@ -1962,7 +1961,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
             while ( pStyle && !bDoFill )
             {
                 bDoFill = ( pBox->GetEntry(i) != pStyle->GetName() );
-                pStyle = pStyleSheetPool->Next();
+                pStyle = iter.Next();
                 i++;
             }
         }
@@ -1976,7 +1975,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
                 sal_uInt16  _i;
                 sal_uInt32  nCnt = pImpl->aDefaultStyles.size();
 
-                pStyle = pStyleSheetPool->First();
+                pStyle = iter.First();
 
                 if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
                 {
@@ -1997,7 +1996,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
 
                         if( bInsert )
                             pBox->InsertEntry( aName );
-                        pStyle = pStyleSheetPool->Next();
+                        pStyle = iter.Next();
                     }
                 }
                 else
@@ -2005,7 +2004,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
                     while ( pStyle )
                     {
                         pBox->InsertEntry( pStyle->GetName() );
-                        pStyle = pStyleSheetPool->Next();
+                        pStyle = iter.Next();
                     }
                 }
             }
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index 900bbbc..f422d97 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -175,8 +175,6 @@ public:
     virtual SfxStyleSheetBase* Find(const OUString& rStr);
 
     virtual void Notify( SfxBroadcaster&, const SfxHint& );
-
-    void InvalidateIterator();
 };
 
 
@@ -220,8 +218,6 @@ 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 1eaa460..152e3e3 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1900,14 +1900,15 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
                     //
                     sal_Int16 nIdx = GetCommandContextIndex( pSeq[i].Name );
 
-                    pBasePool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
+                    SfxStyleSheetIterator iter(pBasePool,
+                        SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
                     sal_Bool bStyleFound = sal_False;
-                    const SfxStyleSheetBase* pBase = pBasePool->First();
+                    const SfxStyleSheetBase* pBase = iter.First();
                     while (pBase && !bStyleFound)
                     {
                         if(pBase->GetName() == aStyleName)
                             bStyleFound = sal_True;
-                        pBase = pBasePool->Next();
+                        pBase = iter.Next();
                     }
 
                     if (nIdx == -1 || !bStyleFound)
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index dc78296..4f10b1c 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -476,8 +476,6 @@ 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 )
@@ -913,7 +911,6 @@ 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 )
@@ -2867,21 +2864,6 @@ 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 20b4f95..17e39a5 100644
--- a/sw/source/ui/chrdlg/pardlg.cxx
+++ b/sw/source/ui/chrdlg/pardlg.cxx
@@ -240,13 +240,14 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
         ((SwParagraphNumTabPage&)rPage).EnableNewStart();
         ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
         SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
-        pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
-        const SfxStyleSheetBase* pBase = pPool->First();
+        SfxStyleSheetIterator iter(pPool,
+            SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
+        SfxStyleSheetBase const* pBase = iter.First();
         std::set<String> aNames;
         while(pBase)
         {
             aNames.insert(pBase->GetName());
-            pBase = pPool->Next();
+            pBase = iter.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 beb916e..c46eceb 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();
-    const SfxStyleSheetBase* pBase = pPool->First();
+    SfxStyleSheetIterator iter(pPool, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
+    const SfxStyleSheetBase* pBase = iter.First();
     while( pBase )
     {
         if(!pFmt || pBase->GetName() != pFmt->GetName())
             aStyleLB.InsertEntry(pBase->GetName());
-        pBase = pPool->Next();
+        pBase = iter.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();
-        pPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, nSearchFlags);
-        const SfxStyleSheetBase* pBase = pPool->First();
+        SfxStyleSheetIterator iter(pPool, SFX_STYLE_FAMILY_PARA, nSearchFlags);
+        const SfxStyleSheetBase* pBase = iter.First();
 
         while( pBase )
         {
             if(!pFmt || pBase->GetName() != pFmt->GetName())
                 aStyleLB.InsertEntry(pBase->GetName());
-            pBase = pPool->Next();
+            pBase = iter.Next();
         }
         aStyleLB.SelectEntryPos(0);
         SelectHdl(&aStyleLB);
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 8fc1c6c..da49467 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -348,14 +348,15 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
     // fill paragraph templates-ListBox
     {
         SfxStyleSheetBasePool* pPool = pView->GetDocShell()->GetStyleSheetPool();
-        pPool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
+        SfxStyleSheetIterator iter(pPool,
+                SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
         aLbDbParaColl.InsertEntry( sNoTmpl );
 
-        const SfxStyleSheetBase* pBase = pPool->First();
+        const SfxStyleSheetBase* pBase = iter.First();
         while( pBase )
         {
             aLbDbParaColl.InsertEntry( pBase->GetName() );
-            pBase = pPool->Next();
+            pBase = iter.Next();
         }
         aLbDbParaColl.SelectEntryPos( 0 );
     }
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index af1c631..ca6da1f 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -420,13 +420,14 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
                 }//<-end
                 ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
                 SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
-                pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
-                const SfxStyleSheetBase* pBase = pPool->First();
+                SfxStyleSheetIterator iter(pPool,
+                    SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
+                const SfxStyleSheetBase* pBase = iter.First();
                 std::set<String> aNames;
                 while(pBase)
                 {
                     aNames.insert(pBase->GetName());
-                    pBase = pPool->Next();
+                    pBase = iter.Next();
                 }
                 for(std::set<String>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
                     rBox.InsertEntry(*it);
@@ -488,12 +489,13 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
                 {
                     SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
                                 GetView().GetDocShell()->GetStyleSheetPool();
-                    pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
-                    SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
+                    SfxStyleSheetIterator iter(pStyleSheetPool,
+                            SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
+                    SfxStyleSheetBase *pFirstStyle = iter.First();
                     while(pFirstStyle)
                     {
                         aList.push_back( pFirstStyle->GetName() );
-                        pFirstStyle = pStyleSheetPool->Next();
+                        pFirstStyle = iter.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 e515491..7679068 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -171,13 +171,14 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& )
 
         // styles   special regions
         // paragraph
-    SfxStyleSheetBasePool* pStyleSheetPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
-    pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, SWSTYLEBIT_EXTRA);
-    SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
+    SfxStyleSheetBasePool *const pSPool =
+        pSh->GetView().GetDocShell()->GetStyleSheetPool();
+    SfxStyleSheetIterator iter(pSPool, SFX_STYLE_FAMILY_PARA, SWSTYLEBIT_EXTRA);
+    SfxStyleSheetBase *pStyle = iter.First();
     while(pStyle)
     {
         m_pParaTemplBox->InsertEntry(pStyle->GetName());
-        pStyle = pStyleSheetPool->Next();
+        pStyle = iter.Next();
     }
 
     String sStr;
diff --git a/sw/source/ui/utlui/tmplctrl.cxx b/sw/source/ui/utlui/tmplctrl.cxx
index 456faf6..bb3ec4f 100644
--- a/sw/source/ui/utlui/tmplctrl.cxx
+++ b/sw/source/ui/utlui/tmplctrl.cxx
@@ -104,16 +104,17 @@ void SwTemplateControl::Command( const CommandEvent& rCEvt )
             {
                 SfxStyleSheetBasePool* pPool = pView->GetDocShell()->
                                                             GetStyleSheetPool();
-                pPool->SetSearchMask(SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
-                if( pPool->Count() > 1 )
+                SfxStyleSheetIterator iter(pPool,
+                        SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
+                if (iter.Count() > 1)
                 {
                     sal_uInt16 nCount = 0;
-                    SfxStyleSheetBase* pStyle = pPool->First();
+                    SfxStyleSheetBase* pStyle = iter.First();
                     while( pStyle )
                     {
                         nCount++;
                         aPop.InsertItem( nCount, pStyle->GetName() );
-                        pStyle = pPool->Next();
+                        pStyle = iter.Next();
                     }
 
                     aPop.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
@@ -121,7 +122,7 @@ void SwTemplateControl::Command( const CommandEvent& rCEvt )
                     if( nCurrId != USHRT_MAX)
                     {
                         // looks a bit awkward, but another way is not possible
-                        pStyle = pPool->operator[]( nCurrId - 1 );
+                        pStyle = iter.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 70e5e22..8251b32 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();
-    const SfxStyleSheetBase* pBase = pPool->First();
+    SfxStyleSheetIterator iter(pPool, SFX_STYLE_FAMILY_CHAR, SFXSTYLEBIT_ALL);
+    const SfxStyleSheetBase* pBase = iter.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 = pPool->Next();
+        pBase = iter.Next();
     }
     // non-pool styles
     const SwCharFmts* pFmts = pDoc->GetCharFmts();
commit 197010643e7e1b8c973013efa9034ffc9bdb56c0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 26 22:38:28 2013 +0200

    remove some more SfxObjectShell methods that only call each other
    
    Change-Id: I71807adff43ce2cfb748764edcc5880cdbba746f

diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index b9013e9..3f29fcf0 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -508,24 +508,6 @@ public:
 #define DEF_CONTENT_COUNT 1
 
 
-    virtual void                SetOrganizerSearchMask(
-                                    SfxStyleSheetBasePool* ) const;
-
-    virtual sal_Bool            CanHaveChildren(
-                                        sal_uInt16 nIdx1,
-                                        sal_uInt16 nIdx2 = INDEX_IGNORE
-                                );
-
-    virtual void                GetContent( String &,
-                                        Bitmap &rClosedBitmap,
-                                        Bitmap &rOpenedBitmap,
-                                        sal_Bool   &bCanDelete,
-                                        sal_uInt16 nPos,
-                                        sal_uInt16 nIdx1
-                                );
-
-    virtual Bitmap              GetStyleFamilyBitmap(SfxStyleFamily eFamily);
-
     virtual void                LoadStyles( SfxObjectShell &rSource );
     void                        ReadNote( INote * );
     void                        UpdateNote( INote * );
diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx
index 1cf4784..5282ba5 100644
--- a/sd/source/ui/docshell/docshel3.cxx
+++ b/sd/source/ui/docshell/docshel3.cxx
@@ -212,12 +212,6 @@ void DrawDocShell::Execute( SfxRequest& rReq )
     }
 }
 
-void DrawDocShell::SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const
-{
-    pBasePool->SetSearchMask(SD_STYLE_FAMILY_GRAPHICS, SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED);
-}
-
-
 void DrawDocShell::SetDocShellFunction( const ::sd::FunctionReference& xFunction )
 {
     if( mxDocShellFunction.is() )
diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx
index 46afc63..c36f038 100644
--- a/sd/source/ui/inc/DrawDocShell.hxx
+++ b/sd/source/ui/inc/DrawDocShell.hxx
@@ -94,7 +94,6 @@ public:
     virtual Printer*        GetDocumentPrinter();
     virtual void            OnDocumentPrinterChanged(Printer* pNewPrinter);
     virtual SfxStyleSheetBasePool* GetStyleSheetPool();
-    virtual void            SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const;
     virtual Size            GetFirstPageSize();
     virtual void            FillClass(SvGlobalName* pClassName, sal_uInt32*  pFormat, OUString* pAppName, OUString* pFullTypeName, OUString* pShortTypeName, sal_Int32 nFileFormat, sal_Bool bTemplate = sal_False ) const;
     virtual void            SetModified( sal_Bool = sal_True );
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index dbac74b..49f9745 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -303,119 +303,6 @@ SfxStyleSheetBasePool* SfxObjectShell::GetStyleSheetPool()
     return 0;
 }
 
-void SfxObjectShell::SetOrganizerSearchMask(
-    SfxStyleSheetBasePool* pStylePool) const
-{
-    pStylePool->SetSearchMask(
-        SFX_STYLE_FAMILY_ALL,
-        SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED);
-}
-
-//--------------------------------------------------------------------
-
-sal_Bool SfxObjectShell::CanHaveChildren(sal_uInt16 nIdx1, sal_uInt16 nIdx2)
-{
-    switch(nIdx1)
-    {
-    case INDEX_IGNORE:
-        return true;
-    case CONTENT_STYLE:
-        return INDEX_IGNORE == nIdx2 || !GetStyleSheetPool() ? false : true;
-    case CONTENT_MACRO:
-        return false;
-    }
-    return false;
-}
-
-//--------------------------------------------------------------------
-
-void SfxObjectShell::GetContent(String &rText,
-                                Bitmap &rClosedBitmap,
-                                Bitmap &rOpenedBitmap,
-                                sal_Bool &bCanDel,
-                                sal_uInt16 i,
-                                sal_uInt16 nIdx
-)
-{
-    bCanDel=true;
-
-    switch(nIdx)
-    {
-        case INDEX_IGNORE:
-        {
-            sal_uInt16 nTextResId = 0;
-            sal_uInt16 nClosedBitmapResId = 0; // evtl. sp"ater mal unterschiedliche
-            sal_uInt16 nOpenedBitmapResId = 0; // "     "       "   "
-            switch(i)
-            {
-                case CONTENT_STYLE:
-                    nTextResId = STR_STYLES;
-                    nClosedBitmapResId= BMP_STYLES_CLOSED;
-                    nOpenedBitmapResId= BMP_STYLES_OPENED;
-                    break;
-                case CONTENT_MACRO:
-                    nTextResId = STR_MACROS;
-                    nClosedBitmapResId= BMP_STYLES_CLOSED;
-                    nOpenedBitmapResId= BMP_STYLES_OPENED;
-                    break;
-            }
-
-            if ( nTextResId )
-            {
-                rText = SfxResId(nTextResId).toString();
-                rClosedBitmap = Bitmap(SfxResId(nClosedBitmapResId));
-                rOpenedBitmap = Bitmap(SfxResId(nOpenedBitmapResId));
-            }
-            break;
-        }
-
-        case CONTENT_STYLE:
-        {
-            SfxStyleSheetBasePool *pStylePool = GetStyleSheetPool();
-            SetOrganizerSearchMask(pStylePool);
-            SfxStyleSheetBase *pStyle = (*pStylePool)[i];
-            rText = pStyle->GetName();
-            bCanDel=((pStyle->GetMask() & SFXSTYLEBIT_USERDEF)
-                     == SFXSTYLEBIT_USERDEF);
-            rClosedBitmap = rOpenedBitmap =
-                GetStyleFamilyBitmap(pStyle->GetFamily());
-        }
-            break;
-        case CONTENT_MACRO:
-            break;
-    }
-}
-
-//--------------------------------------------------------------------
-
-Bitmap SfxObjectShell::GetStyleFamilyBitmap(SfxStyleFamily eFamily)
-{
-    sal_uInt16 nResId = 0;
-    switch(eFamily)
-    {
-        case SFX_STYLE_FAMILY_CHAR:
-            nResId = BMP_STYLES_FAMILY1;
-            break;
-        case SFX_STYLE_FAMILY_PARA:
-            nResId = BMP_STYLES_FAMILY2;
-            break;
-        case SFX_STYLE_FAMILY_FRAME:
-            nResId = BMP_STYLES_FAMILY3;
-            break;
-        case SFX_STYLE_FAMILY_PAGE :
-            nResId = BMP_STYLES_FAMILY4;
-            break;
-        case SFX_STYLE_FAMILY_PSEUDO:
-        case SFX_STYLE_FAMILY_ALL:
-            break;
-    }
-
-    if ( nResId )
-        return Bitmap(SfxResId(nResId));
-    else
-        return Bitmap();
-}
-
 void SfxObjectShell::LoadStyles
 (
     SfxObjectShell &rSource         /*  the document template from which
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 27519cda..48c5612 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -135,7 +135,6 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
 
 
     using SfxObjectShell::GetVisArea;
-    using SfxObjectShell::GetStyleFamilyBitmap;
 
 protected:
     /// override to update text fields
@@ -199,9 +198,6 @@ public:
     /// For Style PI.
     virtual SfxStyleSheetBasePool*  GetStyleSheetPool();
 
-    /// For Organizer.
-    virtual Bitmap      GetStyleFamilyBitmap( SfxStyleFamily eFamily );
-
     /// Set View for actions via Shell.
     void          SetView(SwView* pVw);
     const SwView *GetView() const { return pView; }
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index b5145bd..6e0594f 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -1320,11 +1320,4 @@ void SwDocShell::FormatPage(
     Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, sal_False, nSlot, &rActShell);
 }
 
-Bitmap SwDocShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily )
-{
-    if( SFX_STYLE_FAMILY_PSEUDO == eFamily )
-        return Bitmap( SW_RES( BMP_STYLES_FAMILY_NUM ));
-    return SfxObjectShell::GetStyleFamilyBitmap( eFamily );
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1ed9d506f8b0cc246c952673a2fff11e8314ba46
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 26 19:34:44 2013 +0200

    SfxStyleSheetBasePool::Make: remove nPos parameter
    
    The only caller who could have used a non-default value was
    SfxObjectShell::Insert().
    
    Change-Id: I18174a54a9c0246850dc6347d0147e8640ad101d

diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 9671bcf6..9d4b3be 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -61,7 +61,7 @@ SfxSimpleHint(SFX_HINT_DYING) from:
 
 SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) from:
    SfxStyleSheetBasePool::Make( const String& rName,
-   SfxStyleFamily eFam, sal_uInt16 mask, sal_uInt16 nPos)
+   SfxStyleFamily eFam, sal_uInt16 mask)
 
 SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *pNew ) from:
    SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet )
@@ -234,8 +234,7 @@ public:
 
     virtual SfxStyleSheetBase&  Make(const OUString&,
                                      SfxStyleFamily eFam,
-                                     sal_uInt16 nMask = SFXSTYLEBIT_ALL ,
-                                     sal_uInt16 nPos = 0xffff);
+                                     sal_uInt16 nMask = SFXSTYLEBIT_ALL);
 
     virtual void             Replace(
         SfxStyleSheetBase& rSource, SfxStyleSheetBase& rTarget );
diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx
index f3abe11..c17b5a6 100644
--- a/sc/inc/stlpool.hxx
+++ b/sc/inc/stlpool.hxx
@@ -54,7 +54,7 @@ public:
     const OUString*     GetForceStdName() const { return pForceStdName; }
 
     virtual SfxStyleSheetBase& Make( const OUString&, SfxStyleFamily eFam,
-                                     sal_uInt16 nMask = SFXSTYLEBIT_ALL, sal_uInt16 nPos = 0xffff );
+                                     sal_uInt16 nMask = SFXSTYLEBIT_ALL) SAL_OVERRIDE;
 
 protected:
     virtual             ~ScStyleSheetPool();
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index da1ddb3..3d4cb2c 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -81,7 +81,7 @@ void ScStyleSheetPool::SetDocument( ScDocument* pDocument )
 //------------------------------------------------------------------------
 
 SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName,
-                                           SfxStyleFamily eFam, sal_uInt16 mask, sal_uInt16 nPos )
+                                           SfxStyleFamily eFam, sal_uInt16 mask)
 {
     //  When updating styles from a template, Office 5.1 sometimes created
     //  files with multiple default styles.
@@ -98,11 +98,11 @@ SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName,
             OUString aNewName = ScGlobal::GetRscString(STR_STYLENAME_STANDARD);
             aNewName += OUString::number( nAdd );
             if ( Find( aNewName, eFam ) == NULL )
-                return SfxStyleSheetPool::Make( aNewName, eFam, mask, nPos );
+                return SfxStyleSheetPool::Make(aNewName, eFam, mask);
         }
     }
 
-    return SfxStyleSheetPool::Make( rName, eFam, mask, nPos );
+    return SfxStyleSheetPool::Make(rName, eFam, mask);
 }
 
 //------------------------------------------------------------------------
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 72519f5..1c04655 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -627,27 +627,18 @@ SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r )
     return new SfxStyleSheetBase( r );
 }
 
-SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleFamily eFam, sal_uInt16 mask, sal_uInt16 nPos)
+SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleFamily eFam, sal_uInt16 mask)
 {
     OSL_ENSURE( eFam != SFX_STYLE_FAMILY_ALL, "svl::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" );
 
     SfxStyleSheetIterator aIter(this, eFam, mask);
     rtl::Reference< SfxStyleSheetBase > xStyle( aIter.Find( rName ) );
     OSL_ENSURE( !xStyle.is(), "svl::SfxStyleSheetBasePool::Make(), StyleSheet already exists" );
-    SfxStyleSheetIterator& rIter = GetIterator_Impl();
 
     if( !xStyle.is() )
     {
         xStyle = Create( rName, eFam, mask );
-        if(0xffff == nPos || nPos == aStyles.size() || nPos == rIter.Count())
-        {
-            aStyles.push_back( xStyle );
-        }
-        else
-        {
-            rIter[nPos];
-            aStyles.insert( aStyles.begin() + rIter.GetPos(), xStyle );
-        }
+        aStyles.push_back(xStyle);
         Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xStyle.get() ) );
     }
     return *xStyle.get();
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index 14a7891..900bbbc 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -197,7 +197,8 @@ public:
 
     virtual void Replace( SfxStyleSheetBase& rSource,
                           SfxStyleSheetBase& rTarget );
-    virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily, sal_uInt16 nMask, sal_uInt16 nPos = 0xffff);
+    virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily,
+            sal_uInt16 nMask) SAL_OVERRIDE;
 
     virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam,
                                     sal_uInt16 n=SFXSTYLEBIT_ALL );
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 4e55b76..dc78296 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -2053,8 +2053,7 @@ void SAL_CALL SwDocStyleSheetPool::release(  ) throw ()
 
 SfxStyleSheetBase&   SwDocStyleSheetPool::Make( const OUString&   rName,
                                                 SfxStyleFamily  eFam,
-                                                sal_uInt16          _nMask,
-                                                sal_uInt16          /*nPos*/ )
+                                                sal_uInt16          _nMask)
 {
     mxStyleSheet->PresetName(rName);
     mxStyleSheet->PresetParent(aEmptyStr);
commit e039978b5256bfa0c42b1ce546c27326ef052412
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 26 19:33:06 2013 +0200

    turns out nobody calls those SfxObjectShell methods, remove them
    
    Change-Id: Ic04fc47e88f0d12a0889fd9e28ff0fc42c6556aa

diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index be4a075..b9013e9 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -526,19 +526,6 @@ public:
 
     virtual Bitmap              GetStyleFamilyBitmap(SfxStyleFamily eFamily);
 
-    virtual sal_Bool            InsertStuffWithIndexes( SfxObjectShell &rSource,
-                                        sal_uInt16 nSourceIdx1,
-                                        sal_uInt16 nSourceIdx2,
-                                        sal_uInt16 nSourceIdx3,
-                                        sal_uInt16 &nIdx1,
-                                        sal_uInt16 &nIdx2,
-                                        sal_uInt16 &nIdx3,
-                                        sal_uInt16 &rIdxDeleted);
-
-    virtual sal_Bool            RemoveStuffWithIndexes( sal_uInt16 nIdx1,
-                                        sal_uInt16 nIdx2 = INDEX_IGNORE,
-                                        sal_uInt16 nIdx3 = INDEX_IGNORE);
-
     virtual void                LoadStyles( SfxObjectShell &rSource );
     void                        ReadNote( INote * );
     void                        UpdateNote( INote * );
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 9f968b4..3256980 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -340,19 +340,6 @@ void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellS
 }
 
 
-sal_Bool ScDocShell::InsertStuffWithIndexes( SfxObjectShell &rSource,
-                                sal_uInt16 nSourceIdx1, sal_uInt16 nSourceIdx2, sal_uInt16 nSourceIdx3,
-                                sal_uInt16 &nIdx1, sal_uInt16 &nIdx2, sal_uInt16 &nIdx3, sal_uInt16 &rIdxDeleted )
-{
-    sal_Bool bRet = SfxObjectShell::InsertStuffWithIndexes(
-                rSource, nSourceIdx1, nSourceIdx2, nSourceIdx3,
-                                            nIdx1, nIdx2, nIdx3, rIdxDeleted );
-    if (bRet)
-        lcl_AdjustPool( GetStyleSheetPool() );      // SetItems anpassen
-
-    return bRet;
-}
-
 void ScDocShell::ReconnectDdeLink(SfxObjectShell& rServer)
 {
     ::sfx2::LinkManager* pLinkManager = aDocument.GetLinkManager();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index b7f000c..0e7f16b 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -209,9 +209,6 @@ public:
     virtual void    PrepareReload();
     virtual sal_Bool    IsInformationLost();
     virtual void    LoadStyles( SfxObjectShell &rSource );
-    virtual sal_Bool    InsertStuffWithIndexes( SfxObjectShell &rSource,
-                                sal_uInt16 nSourceIdx1, sal_uInt16 nSourceIdx2, sal_uInt16 nSourceIdx3,
-                                sal_uInt16 &nIdx1, sal_uInt16 &nIdx2, sal_uInt16 &nIdx3, sal_uInt16 &rIdxDeleted ) SAL_OVERRIDE;
 
     virtual sal_Bool    SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& );      // SfxInPlaceObject
     virtual sal_Bool    DoSaveCompleted( SfxMedium * pNewStor);     // SfxObjectShell
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index b28e805..dbac74b 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -416,190 +416,6 @@ Bitmap SfxObjectShell::GetStyleFamilyBitmap(SfxStyleFamily eFamily)
         return Bitmap();
 }
 
-
-//--------------------------------------------------------------------
-
-sal_Bool SfxObjectShell::InsertStuffWithIndexes(SfxObjectShell &rSource,
-                              sal_uInt16 nSourceIdx1,
-                              sal_uInt16 nSourceIdx2,
-                              sal_uInt16 /*nSourceIdx3*/,
-                              sal_uInt16 &nIdx1,
-                              sal_uInt16 &nIdx2,
-                              sal_uInt16 &/*nIdx3*/,
-                              sal_uInt16 &/*nDeleted*/)
-{
-    sal_Bool bRet = sal_False;
-
-    if (INDEX_IGNORE == nIdx1 && CONTENT_STYLE == nSourceIdx1)
-        nIdx1 = CONTENT_STYLE;
-
-    if (CONTENT_STYLE == nSourceIdx1 && CONTENT_STYLE == nIdx1)
-    {
-        SfxStyleSheetBasePool* pHisPool  = rSource.GetStyleSheetPool();
-        SfxStyleSheetBasePool* pMyPool   = GetStyleSheetPool();
-        SetOrganizerSearchMask(pHisPool);
-        SetOrganizerSearchMask(pMyPool);
-        SfxStyleSheetBase* pHisSheet = NULL;
-
-        if ( pHisPool && pHisPool->Count() > nSourceIdx2 )
-            pHisSheet = (*pHisPool)[nSourceIdx2];
-
-        // Pasting is only needed if a style sheet is moved between
-        // different (!) Pools
-
-        if ( pHisSheet && pMyPool != pHisPool )
-        {
-            if (INDEX_IGNORE == nIdx2)
-            {
-                nIdx2 = pMyPool->Count();
-            }
-
-            // if such a template already exists: delete!
-            OUString aOldName(pHisSheet->GetName());
-            SfxStyleFamily eOldFamily = pHisSheet->GetFamily();
-
-            SfxStyleSheetBase* pExist = pMyPool->Find(aOldName, eOldFamily);
-            sal_Bool bUsedOrUserDefined;
-            if( pExist )
-            {
-                bUsedOrUserDefined =
-                    pExist->IsUsed() || pExist->IsUserDefined();
-                if( ErrorHandler::HandleError(
-                    *new MessageInfo( ERRCODE_SFXMSG_STYLEREPLACE, aOldName ) )
-                    != ERRCODE_BUTTON_OK )
-                    return sal_False;
-                else
-                {
-                    pMyPool->Replace( *pHisSheet, *pExist );
-                    SetModified( sal_True );
-                    nIdx2 = nIdx1 = INDEX_IGNORE;
-                    return sal_True;
-                }
-            }
-
-            SfxStyleSheetBase& rNewSheet = pMyPool->Make(
-                aOldName, eOldFamily,
-                pHisSheet->GetMask(), nIdx2);
-
-            // Fill the Itemset of the new template
-            rNewSheet.GetItemSet().Set(pHisSheet->GetItemSet());
-
-            // Who gets the new one as a Parent?
-            // Who is using the new one as Follow?
-            SfxStyleSheetBase* pTestSheet = pMyPool->First();
-            while (pTestSheet)
-            {
-                if (pTestSheet->GetFamily() == eOldFamily &&
-                    pTestSheet->HasParentSupport() &&
-                    pTestSheet->GetParent() == aOldName)
-                {
-                    pTestSheet->SetParent(aOldName);
-                    // Rebuild Link
-                }
-
-                if (pTestSheet->GetFamily() == eOldFamily &&
-                    pTestSheet->HasFollowSupport() &&
-                    pTestSheet->GetFollow() == aOldName)
-                {
-                    pTestSheet->SetFollow(aOldName);
-                    // Rebuild Link
-                }
-
-                pTestSheet = pMyPool->Next();
-            }
-            bUsedOrUserDefined =
-                rNewSheet.IsUsed() || rNewSheet.IsUserDefined();
-
-
-            // has a New Parent? if so, start search with the same name
-            if (pHisSheet->HasParentSupport())
-            {
-                const String& rParentName = pHisSheet->GetParent();
-                if (0 != rParentName.Len())
-                {
-                    SfxStyleSheetBase* pParentOfNew =
-                        pMyPool->Find(rParentName, eOldFamily);
-                    if (pParentOfNew)
-                        rNewSheet.SetParent(rParentName);
-                }
-            }
-
-            // Has the new got a Follow? if so start search
-            // with the same name.
-            if (pHisSheet->HasFollowSupport())
-            {
-                const String& rFollowName = pHisSheet->GetFollow();
-                if (0 != rFollowName.Len())
-                {
-                    SfxStyleSheetBase* pFollowOfNew =
-                        pMyPool->Find(rFollowName, eOldFamily);
-                    if (pFollowOfNew)
-                        rNewSheet.SetFollow(rFollowName);
-                }
-            }
-
-            SetModified( sal_True );
-            if( !bUsedOrUserDefined ) nIdx2 = nIdx1 = INDEX_IGNORE;
-
-            bRet = sal_True;
-        }
-        else
-            bRet = sal_False;
-    }
-
-    return bRet;
-}
-
-//--------------------------------------------------------------------
-
-sal_Bool SfxObjectShell::RemoveStuffWithIndexes
-(
-    sal_uInt16 nIdx1,
-    sal_uInt16 nIdx2,
-    sal_uInt16 /*nIdx3*/
-)
-{
-    sal_Bool bRet = sal_False;
-
-    if (CONTENT_STYLE == nIdx1)
-    {
-        SfxStyleSheetBasePool* pMyPool  = GetStyleSheetPool();
-
-        SetOrganizerSearchMask(pMyPool);
-
-        SfxStyleSheetBase* pMySheet =  (*pMyPool)[nIdx2];
-        OUString aName(pMySheet->GetName());
-        OUString aEmpty;
-        SfxStyleFamily  eFamily = pMySheet->GetFamily();
-        pMyPool->Remove(pMySheet);
-        bRet = sal_True;
-
-        SfxStyleSheetBase* pTestSheet = pMyPool->First();
-        while (pTestSheet)
-        {
-            if (pTestSheet->GetFamily() == eFamily &&
-                pTestSheet->HasParentSupport() &&
-                pTestSheet->GetParent() == aName)
-            {
-                pTestSheet->SetParent(aEmpty); // Remove link
-            }
-
-            if (pTestSheet->GetFamily() == eFamily &&
-                pTestSheet->HasFollowSupport() &&
-                pTestSheet->GetFollow() == aName)
-            {
-                pTestSheet->SetFollow(aEmpty); // Remove link
-            }
-
-            pTestSheet = pMyPool->Next();
-        }
-
-        SetModified( sal_True );
-    }
-
-    return bRet;
-}
-
 void SfxObjectShell::LoadStyles
 (
     SfxObjectShell &rSource         /*  the document template from which
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 7475766..27519cda 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -200,19 +200,6 @@ public:
     virtual SfxStyleSheetBasePool*  GetStyleSheetPool();
 
     /// For Organizer.
-    virtual sal_Bool InsertStuffWithIndexes(SfxObjectShell &rSource,
-                        sal_uInt16  nSourceIdx1,
-                        sal_uInt16  nSourceIdx2,
-                        sal_uInt16  nSourceIdx3,
-                        sal_uInt16& nIdx1,
-                        sal_uInt16& nIdx2,
-                        sal_uInt16& nIdx3,
-                        sal_uInt16& nRemovedIdx) SAL_OVERRIDE;
-
-    virtual sal_Bool RemoveStuffWithIndexes(sal_uInt16 nIdx1,
-                        sal_uInt16 nIdx2 = INDEX_IGNORE,
-                        sal_uInt16 nIdx3 = INDEX_IGNORE) SAL_OVERRIDE;
-
     virtual Bitmap      GetStyleFamilyBitmap( SfxStyleFamily eFamily );
 
     /// Set View for actions via Shell.
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index 87789d1..ab2781b 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -323,284 +323,6 @@ sal_uInt16 SwDocShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
     return nRet;
 }
 
-// Organizer
-sal_Bool SwDocShell::InsertStuffWithIndexes( SfxObjectShell &rSource,
-    sal_uInt16  nSourceIdx1,        // SourcePool: uppermost content level (templates/macros)
-    sal_uInt16  nSourceIdx2,        // Index in the content
-    sal_uInt16  nSourceIdx3,        // Index in the content level
-    sal_uInt16 &rIdx1,              // and the same for the DestinationPool
-    sal_uInt16 &rIdx2,              //      ""
-    sal_uInt16 &rIdx3,              //      ""
-    sal_uInt16 &rRemovedIdx )       // if doubles are being deleted, Pos back
-{
-    // #i48949# - actions aren't undoable. Thus, allow no undo
-    // actions
-    // Note: The undo action stack is cleared at the end of this method.
-    ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
-
-    sal_Bool bRet = sal_False;
-
-    if (INDEX_IGNORE == rIdx1 && CONTENT_STYLE == nSourceIdx1)
-        rIdx1 = CONTENT_STYLE;
-
-    if (CONTENT_STYLE == nSourceIdx1 && CONTENT_STYLE == rIdx1)
-    {
-        SfxStyleSheetBasePool* pHisPool  = rSource.GetStyleSheetPool();
-        SwDocStyleSheetPool* pMyPool =
-            (SwDocStyleSheetPool*)GetStyleSheetPool();
-
-        // we can't move back and forth within ourselves
-        if( pHisPool == pMyPool )
-            return sal_False;
-
-        if( INDEX_IGNORE == rIdx2 )
-            rIdx2 = pMyPool->Count();
-
-        // firstly "position" to the search-mask
-        pHisPool->First();
-        SfxStyleSheetBase* pHisSheet = (*pHisPool)[nSourceIdx2];
-
-        // when such a template already exists: delete!
-        const String& rOldName = pHisSheet->GetName();
-        SfxStyleFamily eOldFamily( pHisSheet->GetFamily() );
-
-        // never delete default PageDesc and Standard Charactertemplate !!!
-        if( ( SFX_STYLE_FAMILY_PAGE == eOldFamily &&
-              pDoc->GetPageDesc(0).GetName() ==
-              rOldName ) ||
-              ( SFX_STYLE_FAMILY_CHAR == eOldFamily &&
-                rOldName == SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
-                                                RES_POOLCOLL_TEXT_BEGIN ] ))
-            return sal_False;
-
-        SfxStyleFamily eMyOldFamily( pMyPool->GetSearchFamily() );
-        sal_uInt16 nMySrchMask = pMyPool->GetSearchMask();
-
-        SfxStyleSheetBase* pExist;
-        if( ::FindPhyStyle( *pDoc, rOldName, eOldFamily ) )
-        {
-            // only take over, if desired!
-            if( ERRCODE_BUTTON_OK != ErrorHandler::HandleError(
-                *new MessageInfo( ERRCODE_SFXMSG_STYLEREPLACE, rOldName )) )
-            {
-                return sal_False;
-            }
-
-            // Because Replace needs the aStyleSheet-Member itself, the result
-            // has to be copied from Find (see below))
-            rtl::Reference< SwDocStyleSheet > xExist( new SwDocStyleSheet(
-                    *(SwDocStyleSheet*)pMyPool->Find( rOldName, eOldFamily ) ) );
-            pMyPool->Replace( *pHisSheet, *xExist.get() );
-
-            // The ordering of the templates in the Pool is not changed.
-            rIdx2 = rIdx1 = INDEX_IGNORE;
-
-            GetDoc()->SetModified();
-
-            return sal_True;
-        }
-
-        pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
-
-        // SwDocStyleSheetPool::Make returns a pointer to
-        // SwDocStyleSheetPool::aStyleSheet that uses same members of
-        // SwDocStyleSheetPool::Find. Therefore a copy has to be used
-        // here. Attention: SfxStylessheetBase::SetFollow calls itself
-        // a SwDocStyleSheetPool::Find, so that it's not sufficient to
-        // to eliminate the Find-calls in this method.
-
-        rtl::Reference< SwDocStyleSheet > xNewSheet( new SwDocStyleSheet( (SwDocStyleSheet&)pMyPool
-                ->Make(rOldName, eOldFamily, pHisSheet->GetMask() ) ) );
-        if( SFX_STYLE_FAMILY_PAGE == eOldFamily && rSource.ISA(SwDocShell) )
-        {
-            // to deal with separately!!
-            SwPageDesc* pDestDsc = (SwPageDesc*)xNewSheet->GetPageDesc();
-            SwPageDesc* pCpyDsc = (SwPageDesc*)((SwDocStyleSheet*)pHisSheet)->GetPageDesc();
-            pDoc->CopyPageDesc( *pCpyDsc, *pDestDsc );
-        }
-        else
-            // populate the new templates with the attributes
-            xNewSheet->SetItemSet( pHisSheet->GetItemSet() );
-
-        pMyPool->SetSearchMask( SFX_STYLE_FAMILY_ALL, nMySrchMask );
-
-        if( xNewSheet->IsUserDefined() || xNewSheet->IsUsed() )
-        {
-            // Used and User-defined templates are being showed. That's why
-            // the Index of the template in the pool has to be found out.
-            pExist = pMyPool->First();
-            sal_uInt16 nIdx = 0;
-            while( pExist )
-            {
-                if( pExist->GetName() == rOldName &&
-                   eOldFamily == pExist->GetFamily() )
-                {
-                    rIdx2 = nIdx;
-                    break;
-                }
-                pExist = pMyPool->Next();
-                nIdx++;
-            }
-        }
-        else
-        {
-            // Other templates are not being showed.
-            rIdx1 = rIdx2 = INDEX_IGNORE;
-        }
-
-        // who gets the new one as parent? who uses the new one as Follow?
-        // (always using the instanciated!!!)
-        pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
-        pMyPool->SetOrganizerMode( sal_True );
-        SfxStyleSheetBase* pTestSheet = pMyPool->First();
-        while (pTestSheet)
-        {
-            if (pTestSheet->GetFamily() == eOldFamily &&
-                pTestSheet->HasParentSupport()        &&
-                pTestSheet->GetParent() == rOldName)
-            {
-                pTestSheet->SetParent(rOldName); // establish the link newly
-            }
-
-            if (pTestSheet->GetFamily() == eOldFamily &&
-                pTestSheet->HasFollowSupport()        &&
-                pTestSheet->GetFollow() == rOldName)
-            {
-                pTestSheet->SetFollow(rOldName); // establish the link newly
-            }
-
-            pTestSheet = pMyPool->Next();
-        }
-        pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
-
-        // does the new one have a parent? if yes, search with the same name at our place.
-        if (pHisSheet->HasParentSupport())
-        {
-            const String& rParentName = pHisSheet->GetParent();
-            if (0 != rParentName.Len())
-            {
-                SfxStyleSheetBase* pParentOfNew = pMyPool->Find(rParentName,
-                                                                eOldFamily);
-                if (pParentOfNew)
-                {
-                    xNewSheet->SetParent(rParentName);
-                }
-                pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
-            }
-        }
-
-        // does the new one have a Follow? if yes, search with the same name at our place.
-        if (pHisSheet->HasFollowSupport())
-        {
-            const String& rFollowName = pHisSheet->GetFollow();
-            if (0 != rFollowName.Len())
-            {
-                SfxStyleSheetBase* pFollowOfNew = pMyPool->Find(rFollowName,
-                                                                eOldFamily);
-                if (pFollowOfNew)
-                {
-                    xNewSheet->SetFollow(rFollowName);
-                }
-                pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
-            }
-        }
-
-        // set old settings again
-        pMyPool->SetSearchMask( eMyOldFamily, nMySrchMask );
-
-        // Model changed
-        OSL_ENSURE(pDoc, "Doc missing");
-        GetDoc()->SetModified();
-
-        bRet = sal_True;
-    }
-    else
-        bRet = SfxObjectShell::InsertStuffWithIndexes( rSource,
-                    nSourceIdx1,
-                    nSourceIdx2,
-                    nSourceIdx3,
-                    rIdx1,
-                    rIdx2,
-                    rIdx3,
-                    rRemovedIdx);
-
-    // #i48949# - actions aren't undoable and could have change
-    // the document node array. Thus, clear the undo action stack.
-    if (undoGuard.UndoWasEnabled())
-    {
-        GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
-    }
-
-    return bRet;
-}
-
-// template Remove
-sal_Bool SwDocShell::RemoveStuffWithIndexes(sal_uInt16 nIdx1,       // see Insert
-                        sal_uInt16 nIdx2,
-                        sal_uInt16 nIdx3)
-{
-    sal_Bool bRet = sal_False;
-
-    if (CONTENT_STYLE == nIdx1)
-    {
-        SwDocStyleSheetPool* pMyPool = (SwDocStyleSheetPool*)GetStyleSheetPool();
-
-        pMyPool->First();       // update Pool before access!!
-        SfxStyleSheetBase* pMySheet = (*pMyPool)[nIdx2];
-
-        String aName( pMySheet->GetName() );
-        SfxStyleFamily eFamily( pMySheet->GetFamily() );
-
-        // never delete default PageDesc and Standard Character template!!!
-        if( ( SFX_STYLE_FAMILY_PAGE == eFamily &&
-              pDoc->GetPageDesc(0).GetName()
-              == aName ) ||
-              ( SFX_STYLE_FAMILY_CHAR == eFamily &&
-                aName == SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
-                                                RES_POOLCOLL_TEXT_BEGIN ] ))
-            return sal_False;
-
-        // so delete
-        pMyPool->Remove( pMySheet );
-
-        // now correct the Parents/Follows of all instanciated
-        pMyPool->SetOrganizerMode( sal_True );
-        SfxStyleSheetBase* pTestSheet = pMyPool->First();
-        while (pTestSheet)
-        {
-            if (pTestSheet->GetFamily() == eFamily &&
-                pTestSheet->HasParentSupport()     &&
-                pTestSheet->GetParent() == aName)
-            {
-                pTestSheet->SetParent( aEmptyStr ); // resolve link
-            }
-
-            if (pTestSheet->GetFamily() == eFamily &&
-                pTestSheet->HasFollowSupport()        &&
-                pTestSheet->GetFollow() == aName)
-            {
-                pTestSheet->SetFollow( aEmptyStr ); // resolve link
-            }
-
-            pTestSheet = pMyPool->Next();
-        }
-        pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
-
-        bRet = sal_True;
-    }
-    else
-        bRet = SfxObjectShell::RemoveStuffWithIndexes(  nIdx1,
-                                        nIdx2,
-                                        nIdx3 );
-
-
-    // Model changed
-    OSL_ENSURE(pDoc, "Doc missing");
-    GetDoc()->SetModified();
-
-    return bRet;
-}
-
 void SwDocShell::Execute(SfxRequest& rReq)
 {
     const SfxItemSet* pArgs = rReq.GetArgs();
commit c7dd322b3c37d84f6962f9d91a8770d3cb9d4888
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 26 19:15:40 2013 +0200

    rename SfxObjectShell::Insert / Remove ...
    
    ... to something more unique, and use SAL_OVERRIDE.
    
    Change-Id: I0f991870974cad42c86d6af162359dafb475c5aa

diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 4fbda63..be4a075 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -526,7 +526,7 @@ public:
 
     virtual Bitmap              GetStyleFamilyBitmap(SfxStyleFamily eFamily);
 
-    virtual sal_Bool            Insert( SfxObjectShell &rSource,
+    virtual sal_Bool            InsertStuffWithIndexes( SfxObjectShell &rSource,
                                         sal_uInt16 nSourceIdx1,
                                         sal_uInt16 nSourceIdx2,
                                         sal_uInt16 nSourceIdx3,
@@ -535,7 +535,7 @@ public:
                                         sal_uInt16 &nIdx3,
                                         sal_uInt16 &rIdxDeleted);
 
-    virtual sal_Bool            Remove( sal_uInt16 nIdx1,
+    virtual sal_Bool            RemoveStuffWithIndexes( sal_uInt16 nIdx1,
                                         sal_uInt16 nIdx2 = INDEX_IGNORE,
                                         sal_uInt16 nIdx3 = INDEX_IGNORE);
 
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index ecfed5d..9f968b4 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -340,11 +340,12 @@ void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellS
 }
 
 
-sal_Bool ScDocShell::Insert( SfxObjectShell &rSource,
+sal_Bool ScDocShell::InsertStuffWithIndexes( SfxObjectShell &rSource,
                                 sal_uInt16 nSourceIdx1, sal_uInt16 nSourceIdx2, sal_uInt16 nSourceIdx3,
                                 sal_uInt16 &nIdx1, sal_uInt16 &nIdx2, sal_uInt16 &nIdx3, sal_uInt16 &rIdxDeleted )
 {
-    sal_Bool bRet = SfxObjectShell::Insert( rSource, nSourceIdx1, nSourceIdx2, nSourceIdx3,
+    sal_Bool bRet = SfxObjectShell::InsertStuffWithIndexes(
+                rSource, nSourceIdx1, nSourceIdx2, nSourceIdx3,
                                             nIdx1, nIdx2, nIdx3, rIdxDeleted );
     if (bRet)
         lcl_AdjustPool( GetStyleSheetPool() );      // SetItems anpassen
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index ec2201f..b7f000c 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -209,9 +209,9 @@ public:
     virtual void    PrepareReload();
     virtual sal_Bool    IsInformationLost();
     virtual void    LoadStyles( SfxObjectShell &rSource );
-    virtual sal_Bool    Insert( SfxObjectShell &rSource,
+    virtual sal_Bool    InsertStuffWithIndexes( SfxObjectShell &rSource,
                                 sal_uInt16 nSourceIdx1, sal_uInt16 nSourceIdx2, sal_uInt16 nSourceIdx3,
-                                sal_uInt16 &nIdx1, sal_uInt16 &nIdx2, sal_uInt16 &nIdx3, sal_uInt16 &rIdxDeleted );
+                                sal_uInt16 &nIdx1, sal_uInt16 &nIdx2, sal_uInt16 &nIdx3, sal_uInt16 &rIdxDeleted ) SAL_OVERRIDE;
 
     virtual sal_Bool    SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& );      // SfxInPlaceObject
     virtual sal_Bool    DoSaveCompleted( SfxMedium * pNewStor);     // SfxObjectShell
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 15c98d9f..b28e805 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -419,7 +419,7 @@ Bitmap SfxObjectShell::GetStyleFamilyBitmap(SfxStyleFamily eFamily)
 
 //--------------------------------------------------------------------
 
-sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource,
+sal_Bool SfxObjectShell::InsertStuffWithIndexes(SfxObjectShell &rSource,
                               sal_uInt16 nSourceIdx1,
                               sal_uInt16 nSourceIdx2,
                               sal_uInt16 /*nSourceIdx3*/,
@@ -552,7 +552,7 @@ sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource,
 
 //--------------------------------------------------------------------
 
-sal_Bool SfxObjectShell::Remove
+sal_Bool SfxObjectShell::RemoveStuffWithIndexes
 (
     sal_uInt16 nIdx1,
     sal_uInt16 nIdx2,
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 08ae99e..7475766 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -200,18 +200,18 @@ public:
     virtual SfxStyleSheetBasePool*  GetStyleSheetPool();
 
     /// For Organizer.
-    virtual sal_Bool Insert(SfxObjectShell &rSource,
+    virtual sal_Bool InsertStuffWithIndexes(SfxObjectShell &rSource,
                         sal_uInt16  nSourceIdx1,
                         sal_uInt16  nSourceIdx2,
                         sal_uInt16  nSourceIdx3,
                         sal_uInt16& nIdx1,
                         sal_uInt16& nIdx2,
                         sal_uInt16& nIdx3,
-                        sal_uInt16& nRemovedIdx);
+                        sal_uInt16& nRemovedIdx) SAL_OVERRIDE;
 
-    virtual sal_Bool Remove(sal_uInt16 nIdx1,
+    virtual sal_Bool RemoveStuffWithIndexes(sal_uInt16 nIdx1,
                         sal_uInt16 nIdx2 = INDEX_IGNORE,
-                        sal_uInt16 nIdx3 = INDEX_IGNORE);
+                        sal_uInt16 nIdx3 = INDEX_IGNORE) SAL_OVERRIDE;
 
     virtual Bitmap      GetStyleFamilyBitmap( SfxStyleFamily eFamily );
 
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index 2123202..87789d1 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -324,7 +324,7 @@ sal_uInt16 SwDocShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
 }
 
 // Organizer
-sal_Bool SwDocShell::Insert( SfxObjectShell &rSource,
+sal_Bool SwDocShell::InsertStuffWithIndexes( SfxObjectShell &rSource,
     sal_uInt16  nSourceIdx1,        // SourcePool: uppermost content level (templates/macros)
     sal_uInt16  nSourceIdx2,        // Index in the content
     sal_uInt16  nSourceIdx3,        // Index in the content level
@@ -515,7 +515,7 @@ sal_Bool SwDocShell::Insert( SfxObjectShell &rSource,
         bRet = sal_True;
     }
     else
-        bRet = SfxObjectShell::Insert( rSource,
+        bRet = SfxObjectShell::InsertStuffWithIndexes( rSource,
                     nSourceIdx1,
                     nSourceIdx2,
                     nSourceIdx3,
@@ -535,7 +535,7 @@ sal_Bool SwDocShell::Insert( SfxObjectShell &rSource,
 }
 
 // template Remove
-sal_Bool SwDocShell::Remove(sal_uInt16 nIdx1,       // see Insert
+sal_Bool SwDocShell::RemoveStuffWithIndexes(sal_uInt16 nIdx1,       // see Insert
                         sal_uInt16 nIdx2,
                         sal_uInt16 nIdx3)
 {
@@ -589,7 +589,7 @@ sal_Bool SwDocShell::Remove(sal_uInt16 nIdx1,       // see Insert
         bRet = sal_True;
     }
     else
-        bRet = SfxObjectShell::Remove(  nIdx1,
+        bRet = SfxObjectShell::RemoveStuffWithIndexes(  nIdx1,
                                         nIdx2,
                                         nIdx3 );
 
commit 8fb210a2ddc0b09288316cf459bebfe196ea94fb
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 26 17:05:24 2013 +0200

    fdo#67303: sw: speed up setting IsHidden property on styles
    
    Importing an ODF document with 4089 styles is ridiculously slow,
    spending most of the time in SwStyleSheetIterator::First() to reset
    an existing iterator.
    
    Since the SwStyleSheetIterator can handle the case when First() has not
    been called anyway, just add a new method that resets the bFirstCalled
    flag, which takes next to no time.
    
    (regression from a0dcf961879ab644a52f801f65466756cb144b72)
    
    Change-Id: I8741b4c0cd51f8c244462ce28a754abc427d0df3

diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index c54313e..9671bcf6 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -203,9 +203,9 @@ friend class SfxStyleSheetBase;
 
     SfxStyleSheetBasePool_Impl *pImp;
 
-private:
-    SVL_DLLPRIVATE SfxStyleSheetIterator&      GetIterator_Impl();
 protected:
+    SfxStyleSheetIterator&      GetIterator_Impl();
+
     OUString                    aAppName;
     SfxItemPool&                rPool;
     SfxStyles                   aStyles;
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index fc2a59f..14a7891 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();
 };
 
 
@@ -217,6 +219,8 @@ public:
     virtual void SAL_CALL acquire(  ) throw ();
     virtual void SAL_CALL release(  ) throw ();
 
+    void InvalidateIterator();
+
 protected:
     virtual ~SwDocStyleSheetPool();
 
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 740b30f..4e55b76 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -476,7 +476,8 @@ void SwDocStyleSheet::SetHidden( sal_Bool bValue )
 
     if( bChg )
     {
-        pPool->First();  // internal list has to be updated
+        // 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 )
@@ -2772,6 +2773,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
 
 SfxStyleSheetBase*  SwStyleSheetIterator::Next()
 {
+    assert(bFirstCalled);
     ++nLastPos;
     if(!aLst.empty() && nLastPos < aLst.size())
     {
@@ -2866,6 +2868,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!!


More information about the Libreoffice-commits mailing list