diff options
-rw-r--r-- | sc/source/core/data/patattr.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/stlsheet.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlfonte.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 2 | ||||
-rw-r--r-- | svl/inc/svl/style.hxx | 5 | ||||
-rw-r--r-- | svl/source/items/style.cxx | 20 | ||||
-rw-r--r-- | sw/inc/docstyle.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/app/docstyle.cxx | 5 |
9 files changed, 25 insertions, 28 deletions
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index a391ad136831..af1d5c9e6f8d 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -1161,9 +1161,8 @@ void ScPatternAttr::UpdateStyleSheet() //! es wird vorausgesetzt, dass "Standard" immer der erste Eintrag ist! if (!pStyle) { - SfxStyleSheetIterator* pIter = pDoc->GetStyleSheetPool()->CreateIterator( - SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL ); - pStyle = (ScStyleSheet*)pIter->First(); + SfxStyleSheetIteratorPtr pIter = pDoc->GetStyleSheetPool()->CreateIterator( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL ); + pStyle = dynamic_cast< ScStyleSheet* >(pIter->First()); } if (pStyle) diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 3ef1b42b9c76..eaa692a798cc 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -109,7 +109,7 @@ bool ScStyleSheet::SetParent( const String& rParentName ) SfxStyleSheetBase* pStyle = pPool->Find( aEffName, nFamily ); if (!pStyle) { - SfxStyleSheetIterator* pIter = pPool->CreateIterator( nFamily, SFXSTYLEBIT_ALL ); + SfxStyleSheetIteratorPtr pIter = pPool->CreateIterator( nFamily, SFXSTYLEBIT_ALL ); pStyle = pIter->First(); if (pStyle) aEffName = pStyle->GetName(); diff --git a/sc/source/filter/xml/xmlfonte.cxx b/sc/source/filter/xml/xmlfonte.cxx index 4092bfa18dfd..9b0c263c7c3f 100644 --- a/sc/source/filter/xml/xmlfonte.cxx +++ b/sc/source/filter/xml/xmlfonte.cxx @@ -82,7 +82,13 @@ ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl( const SfxItemPool* pEditPool(rExportP.GetDocument()->GetEditPool()); AddFontItems(aEditWhichIds, 3, pEditPool, false); - SfxStyleSheetIterator* pItr(rExportP.GetDocument() ? rExportP.GetDocument()->GetStyleSheetPool()->CreateIterator(SFX_STYLE_FAMILY_PAGE, 0xFFFF) : NULL); + SfxStyleSheetIteratorPtr pItr; + + if(rExportP.GetDocument()) + { + pItr = rExportP.GetDocument()->GetStyleSheetPool()->CreateIterator(SFX_STYLE_FAMILY_PAGE, 0xFFFF); + } + if(pItr) { SfxStyleSheetBase* pStyle(pItr->First()); diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index a03879c4ddbe..7f3a31e5213a 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -600,8 +600,6 @@ sal_Bool SfxObjectShell::Remove return bRet; } -//-------------------------------------------------------------------- - void SfxObjectShell::LoadStyles ( SfxObjectShell &rSource /* the document template from which diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx index 664ca5cb1ec2..af58cbc44327 100644 --- a/svl/inc/svl/style.hxx +++ b/svl/inc/svl/style.hxx @@ -37,10 +37,10 @@ #include <svl/stylesheetuser.hxx> #include <svl/style.hrc> +#include <boost/shared_ptr.hpp> class SfxItemSet; class SfxItemPool; - class SfxStyleSheetBasePool; class SvStream; @@ -192,6 +192,7 @@ private: friend class SfxStyleSheetBasePool; }; +typedef ::boost::shared_ptr< SfxStyleSheetIterator > SfxStyleSheetIteratorPtr; //========================================================================= class SfxStyleSheetBasePool_Impl; @@ -228,7 +229,7 @@ public: SfxItemPool& GetPool(); const SfxItemPool& GetPool() const; - virtual SfxStyleSheetIterator* CreateIterator(SfxStyleFamily, sal_uInt16 nMask); + virtual SfxStyleSheetIteratorPtr CreateIterator(SfxStyleFamily, sal_uInt16 nMask); virtual sal_uInt16 Count(); virtual SfxStyleSheetBase* operator[](sal_uInt16 nIdx); diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index cd44bea2bbb7..c2879e799f1a 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -83,10 +83,8 @@ SfxStyleSheetHint::SfxStyleSheetHint class SfxStyleSheetBasePool_Impl { - public: - SfxStyleSheetIterator *pIter; - SfxStyleSheetBasePool_Impl() : pIter(0){} - ~SfxStyleSheetBasePool_Impl(){delete pIter;} +public: + SfxStyleSheetIteratorPtr pIter; }; @@ -532,13 +530,12 @@ void SfxStyleSheetBasePool::Replace( SfxStyleSheetIterator& SfxStyleSheetBasePool::GetIterator_Impl() { - SfxStyleSheetIterator*& rpIter = pImp->pIter; - if( !rpIter || (rpIter->GetSearchMask() != nMask) || (rpIter->GetSearchFamily() != nSearchFamily) ) + if( !pImp->pIter || (pImp->pIter->GetSearchMask() != nMask) || (pImp->pIter->GetSearchFamily() != nSearchFamily) ) { - delete rpIter; - rpIter = CreateIterator( nSearchFamily, nMask ); + pImp->pIter = CreateIterator( nSearchFamily, nMask ); } - return *rpIter; + + return *pImp->pIter; } SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r ) @@ -603,14 +600,13 @@ sal_uInt16 SfxStyleSheetBasePool::GetSearchMask() const return nMask; } - -SfxStyleSheetIterator* SfxStyleSheetBasePool::CreateIterator +SfxStyleSheetIteratorPtr SfxStyleSheetBasePool::CreateIterator ( SfxStyleFamily eFam, sal_uInt16 mask ) { - return new SfxStyleSheetIterator(this,eFam,mask); + return SfxStyleSheetIteratorPtr(new SfxStyleSheetIterator(this,eFam,mask)); } SfxStyleSheetBase* SfxStyleSheetBasePool::Create diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 72ea158d3172..90a049e1ac88 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -208,8 +208,7 @@ public: void SetOrganizerMode( sal_Bool bMode ) { bOrganizer = bMode; } sal_Bool IsOrganizerMode() const { return bOrganizer; } - virtual SfxStyleSheetIterator* CreateIterator( SfxStyleFamily, - sal_uInt16 nMask ); + virtual SfxStyleSheetIteratorPtr CreateIterator( SfxStyleFamily, sal_uInt16 nMask ); SwDoc& GetDoc() const { return rDoc; } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 49502e0cdc9f..a7d3b1764680 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -785,7 +785,7 @@ uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::Runt uno::Sequence< OUString > aRet; if(pBasePool) { - SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL); + SfxStyleSheetIteratorPtr pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL); sal_uInt16 nCount = pIterator->Count(); aRet.realloc(nCount); OUString* pArray = aRet.getArray(); @@ -795,7 +795,6 @@ uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::Runt SwStyleNameMapper::FillProgName((*pIterator)[i]->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true ); pArray[i] = OUString ( aString ); } - delete pIterator; } else throw uno::RuntimeException(); diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index 2af3322ea944..934f7174b47b 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -2179,10 +2179,9 @@ void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource, } } -SfxStyleSheetIterator* SwDocStyleSheetPool::CreateIterator( - SfxStyleFamily eFam, sal_uInt16 _nMask ) +SfxStyleSheetIteratorPtr SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, sal_uInt16 _nMask ) { - return new SwStyleSheetIterator( this, eFam, _nMask ); + return SfxStyleSheetIteratorPtr(new SwStyleSheetIterator( this, eFam, _nMask )); } void SwDocStyleSheetPool::dispose() |