summaryrefslogtreecommitdiff
path: root/sw/source/ui/app/docstyle.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/app/docstyle.cxx')
-rw-r--r--sw/source/ui/app/docstyle.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 934f7174b47b..b0f1701e267b 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!!