[Libreoffice-commits] core.git: sd/source
Tobias Lippert
drtl at fastmail.fm
Mon Mar 10 10:10:39 PDT 2014
sd/source/core/stlsheet.cxx | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
New commits:
commit e955433c3574cb602dedba96bc645898f97858bf
Author: Tobias Lippert <drtl at fastmail.fm>
Date: Wed Mar 5 19:51:58 2014 +0100
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 3611ce2..ce7fbf1 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;
}
}
More information about the Libreoffice-commits
mailing list