summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Lippert <drtl@fastmail.fm>2014-03-05 19:51:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-03-10 12:10:15 -0500
commite955433c3574cb602dedba96bc645898f97858bf (patch)
treea0957ec069399e95c39344e9f510709b73af7d0b
parentf52ae6a8da2c2965e0c07020fda367095cea00e3 (diff)
Use SfxStyleSheetIterator to iterate over style sheets in sd/stlsheet.cxx
It is not possible to access n#708518. We must hope that this is not a regression Change-Id: I4500d72cc7d6fc488fb015aa8b7907238fa09ac0 Reviewed-on: https://gerrit.libreoffice.org/8484 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sd/source/core/stlsheet.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 3611ce2377d3..ce7fbf1cdb5c 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -56,6 +56,7 @@
#include "../ui/inc/ViewShellBase.hxx"
#include <editeng/boxitem.hxx>
+#include <boost/make_shared.hpp>
using ::osl::MutexGuard;
using ::osl::ClearableMutexGuard;
@@ -970,19 +971,17 @@ void SAL_CALL SdStyleSheet::setParentStyle( const OUString& rParentName ) throw
if( !rParentName.isEmpty() )
{
- const SfxStyles& rStyles = mxPool->GetStyles();
-
- /* Use reverse iterator to find the parents quicker - most probably its inserted recently.
- * Also avoids/fixes the issue n#708518
- * To fix it completely its probably wiser to compare this->GetName() and pStyle->GetName() or use complete names for styles (?)
- */
- for( SfxStyles::const_reverse_iterator iter( rStyles.rbegin() ); iter != rStyles.rend(); ++iter )
+ SfxStyleSheetIteratorPtr aSSSI = boost::make_shared<SfxStyleSheetIterator>(mxPool.get(), nFamily, SFX_STYLE_FAMILY_ALL);
+ for (SfxStyleSheetBase *pStyle = aSSSI->First(); pStyle; pStyle = aSSSI->Next())
{
- SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
- if( pStyle && (pStyle->nFamily == nFamily) && (pStyle->msApiName == rParentName) )
+ // we hope that we have only sd style sheets
+ SdStyleSheet* pSdStyleSheet = static_cast<SdStyleSheet*>(pStyle);
+ if (pSdStyleSheet->msApiName == rParentName)
{
if( pStyle != this )
+ {
SetParent( pStyle->GetName() );
+ }
return;
}
}