diff options
author | Mark Page <aptitude@btconnect.com> | 2016-06-03 08:13:31 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-04 09:45:55 +0000 |
commit | 954f853c7b776719a6dfd5230d2be6ea3e948fcf (patch) | |
tree | fa20a4cca64c0c035cdf9a5a07867fdac245882f /sw | |
parent | 660b91b07788077cfee9ba309d45db6819c00781 (diff) |
tdf#96099 Remove sfx std::shared_ptr typedefs
Removed SfxItemSet_Pointer_t and SfxStyleSheetIteratorPtr
Change-Id: Ibfa6a79809fdbbe2648dacc02625e620ceaf9bf0
Reviewed-on: https://gerrit.libreoffice.org/25851
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/docstyle.hxx | 2 | ||||
-rw-r--r-- | sw/inc/istyleaccess.hxx | 8 | ||||
-rw-r--r-- | sw/inc/unostyle.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/swstylemanager.cxx | 30 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/app/docstyle.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 4 |
9 files changed, 39 insertions, 40 deletions
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index df1d070208de..a58ba3afb3c4 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -213,7 +213,7 @@ public: bool IsOrganizerMode() const { return bOrganizer; } - virtual SfxStyleSheetIteratorPtr CreateIterator( SfxStyleFamily, sal_uInt16 nMask ) override; + virtual std::shared_ptr<SfxStyleSheetIterator> CreateIterator( SfxStyleFamily, sal_uInt16 nMask ) override; SwDoc& GetDoc() const { return rDoc; } diff --git a/sw/inc/istyleaccess.hxx b/sw/inc/istyleaccess.hxx index f961ea468f55..1f47ee8ecb82 100644 --- a/sw/inc/istyleaccess.hxx +++ b/sw/inc/istyleaccess.hxx @@ -36,17 +36,17 @@ public: virtual ~IStyleAccess() {} - virtual StylePool::SfxItemSet_Pointer_t getAutomaticStyle( const SfxItemSet& rSet, + virtual std::shared_ptr<SfxItemSet> getAutomaticStyle( const SfxItemSet& rSet, SwAutoStyleFamily eFamily ) = 0; - virtual void getAllStyles( std::vector<StylePool::SfxItemSet_Pointer_t> &rStyles, + virtual void getAllStyles( std::vector<std::shared_ptr<SfxItemSet>> &rStyles, SwAutoStyleFamily eFamily ) = 0; /** It's slow to iterate through a stylepool looking for a special name, but if the style has been inserted via "cacheAutomaticStyle" instead of "getAutomaticStyle", it's faster */ - virtual StylePool::SfxItemSet_Pointer_t getByName( const OUString& rName, + virtual std::shared_ptr<SfxItemSet> getByName( const OUString& rName, SwAutoStyleFamily eFamily ) = 0; /// insert the style to the pool and the cache (used during import) - virtual StylePool::SfxItemSet_Pointer_t cacheAutomaticStyle( const SfxItemSet& rSet, + virtual std::shared_ptr<SfxItemSet> cacheAutomaticStyle( const SfxItemSet& rSet, SwAutoStyleFamily eFamily ) = 0; /// To release the cached styles (shared_pointer!) virtual void clearCaches() = 0; diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx index 9b5909181463..43e438d2b71e 100644 --- a/sw/inc/unostyle.hxx +++ b/sw/inc/unostyle.hxx @@ -53,7 +53,6 @@ namespace sw { class XStyleFamily; }; -typedef std::shared_ptr<SfxItemSet> SfxItemSet_Pointer_t; class SwXStyleFamilies : public cppu::WeakImplHelper < @@ -202,7 +201,7 @@ class SwXAutoStyle : public cppu::WeakImplHelper public SwClient { private: - SfxItemSet_Pointer_t mpSet; + std::shared_ptr<SfxItemSet> mpSet; IStyleAccess::SwAutoStyleFamily meFamily; SwDoc& mrDoc; @@ -210,7 +209,7 @@ private: public: - SwXAutoStyle( SwDoc* pDoc, SfxItemSet_Pointer_t pInitSet, IStyleAccess::SwAutoStyleFamily eFam ); + SwXAutoStyle( SwDoc* pDoc, std::shared_ptr<SfxItemSet> pInitSet, IStyleAccess::SwAutoStyleFamily eFam ); virtual ~SwXAutoStyle(); //XPropertySet diff --git a/sw/source/core/doc/swstylemanager.cxx b/sw/source/core/doc/swstylemanager.cxx index e5be8bc1d4ef..a4fbc5c0c9ec 100644 --- a/sw/source/core/doc/swstylemanager.cxx +++ b/sw/source/core/doc/swstylemanager.cxx @@ -27,7 +27,7 @@ #include <unordered_map> typedef std::unordered_map< OUString, - StylePool::SfxItemSet_Pointer_t, + std::shared_ptr<SfxItemSet>, OUStringHash > SwStyleNameCache; class SwStyleCache @@ -35,16 +35,16 @@ class SwStyleCache SwStyleNameCache mMap; public: SwStyleCache() {} - void addStyleName( const StylePool::SfxItemSet_Pointer_t& pStyle ) + void addStyleName( const std::shared_ptr<SfxItemSet>& pStyle ) { mMap[ StylePool::nameOf(pStyle) ] = pStyle; } void addCompletePool( StylePool& rPool ); - StylePool::SfxItemSet_Pointer_t getByName( const OUString& rName ) { return mMap[rName]; } + std::shared_ptr<SfxItemSet> getByName( const OUString& rName ) { return mMap[rName]; } }; void SwStyleCache::addCompletePool( StylePool& rPool ) { IStylePoolIteratorAccess *pIter = rPool.createIterator(); - StylePool::SfxItemSet_Pointer_t pStyle = pIter->getNext(); + std::shared_ptr<SfxItemSet> pStyle = pIter->getNext(); while( pStyle.get() ) { OUString aName( StylePool::nameOf(pStyle) ); @@ -70,13 +70,13 @@ public: mpParaCache(nullptr) {} virtual ~SwStyleManager(); - virtual StylePool::SfxItemSet_Pointer_t getAutomaticStyle( const SfxItemSet& rSet, + virtual std::shared_ptr<SfxItemSet> getAutomaticStyle( const SfxItemSet& rSet, IStyleAccess::SwAutoStyleFamily eFamily ) override; - virtual StylePool::SfxItemSet_Pointer_t getByName( const OUString& rName, + virtual std::shared_ptr<SfxItemSet> getByName( const OUString& rName, IStyleAccess::SwAutoStyleFamily eFamily ) override; - virtual void getAllStyles( std::vector<StylePool::SfxItemSet_Pointer_t> &rStyles, + virtual void getAllStyles( std::vector<std::shared_ptr<SfxItemSet>> &rStyles, IStyleAccess::SwAutoStyleFamily eFamily ) override; - virtual StylePool::SfxItemSet_Pointer_t cacheAutomaticStyle( const SfxItemSet& rSet, + virtual std::shared_ptr<SfxItemSet> cacheAutomaticStyle( const SfxItemSet& rSet, SwAutoStyleFamily eFamily ) override; virtual void clearCaches() override; }; @@ -100,18 +100,18 @@ void SwStyleManager::clearCaches() mpParaCache = nullptr; } -StylePool::SfxItemSet_Pointer_t SwStyleManager::getAutomaticStyle( const SfxItemSet& rSet, +std::shared_ptr<SfxItemSet> SwStyleManager::getAutomaticStyle( const SfxItemSet& rSet, IStyleAccess::SwAutoStyleFamily eFamily ) { StylePool& rAutoPool = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? aAutoCharPool : aAutoParaPool; return rAutoPool.insertItemSet( rSet ); } -StylePool::SfxItemSet_Pointer_t SwStyleManager::cacheAutomaticStyle( const SfxItemSet& rSet, +std::shared_ptr<SfxItemSet> SwStyleManager::cacheAutomaticStyle( const SfxItemSet& rSet, IStyleAccess::SwAutoStyleFamily eFamily ) { StylePool& rAutoPool = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? aAutoCharPool : aAutoParaPool; - StylePool::SfxItemSet_Pointer_t pStyle = rAutoPool.insertItemSet( rSet ); + std::shared_ptr<SfxItemSet> pStyle = rAutoPool.insertItemSet( rSet ); SwStyleCache* &rpCache = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? mpCharCache : mpParaCache; if( !rpCache ) @@ -120,14 +120,14 @@ StylePool::SfxItemSet_Pointer_t SwStyleManager::cacheAutomaticStyle( const SfxIt return pStyle; } -StylePool::SfxItemSet_Pointer_t SwStyleManager::getByName( const OUString& rName, +std::shared_ptr<SfxItemSet> SwStyleManager::getByName( const OUString& rName, IStyleAccess::SwAutoStyleFamily eFamily ) { StylePool& rAutoPool = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? aAutoCharPool : aAutoParaPool; SwStyleCache* &rpCache = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? mpCharCache : mpParaCache; if( !rpCache ) rpCache = new SwStyleCache(); - StylePool::SfxItemSet_Pointer_t pStyle = rpCache->getByName( rName ); + std::shared_ptr<SfxItemSet> pStyle = rpCache->getByName( rName ); if( !pStyle.get() ) { // Ok, ok, it's allowed to ask for uncached styles (from UNO) but it should not be done @@ -139,13 +139,13 @@ StylePool::SfxItemSet_Pointer_t SwStyleManager::getByName( const OUString& rName return pStyle; } -void SwStyleManager::getAllStyles( std::vector<StylePool::SfxItemSet_Pointer_t> &rStyles, +void SwStyleManager::getAllStyles( std::vector<std::shared_ptr<SfxItemSet>> &rStyles, IStyleAccess::SwAutoStyleFamily eFamily ) { StylePool& rAutoPool = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? aAutoCharPool : aAutoParaPool; // setup <StylePool> iterator, which skips unused styles and ignorable items IStylePoolIteratorAccess *pIter = rAutoPool.createIterator( true, true ); - StylePool::SfxItemSet_Pointer_t pStyle = pIter->getNext(); + std::shared_ptr<SfxItemSet> pStyle = pIter->getNext(); while( pStyle.get() ) { rStyles.push_back( pStyle ); diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index fa2f73cf0fd9..b2228ec57443 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1004,7 +1004,7 @@ SwTextAttr* MakeTextAttr( { // If the attribute is an auto-style which refers to a pool that is // different from rDoc's pool, we have to correct this: - const StylePool::SfxItemSet_Pointer_t pAutoStyle = static_cast<const SwFormatAutoFormat&>(rAttr).GetStyleHandle(); + const std::shared_ptr<SfxItemSet> pAutoStyle = static_cast<const SwFormatAutoFormat&>(rAttr).GetStyleHandle(); std::unique_ptr<const SfxItemSet> pNewSet( pAutoStyle->SfxItemSet::Clone( true, &rDoc.GetAttrPool() )); SwTextAttr* pNew = MakeTextAttr( rDoc, *pNewSet, nStt, nEnd ); @@ -1105,7 +1105,7 @@ SwTextAttr* MakeTextAttr( SwDoc & rDoc, const SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd ) { IStyleAccess& rStyleAccess = rDoc.GetIStyleAccess(); - const StylePool::SfxItemSet_Pointer_t pAutoStyle = rStyleAccess.getAutomaticStyle( rSet, IStyleAccess::AUTO_STYLE_CHAR ); + const std::shared_ptr<SfxItemSet> pAutoStyle = rStyleAccess.getAutomaticStyle( rSet, IStyleAccess::AUTO_STYLE_CHAR ); SwFormatAutoFormat aNewAutoFormat; aNewAutoFormat.SetStyleHandle( pAutoStyle ); SwTextAttr* pNew = MakeTextAttr( rDoc, aNewAutoFormat, nStt, nEnd ); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 600c393bb698..658a5c219759 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -241,7 +241,7 @@ throw (lang::IllegalArgumentException) { throw lang::IllegalArgumentException(); } - StylePool::SfxItemSet_Pointer_t pStyle = bPara ? + std::shared_ptr<SfxItemSet> pStyle = bPara ? rStyleAccess.getByName(uStyle, IStyleAccess::AUTO_STYLE_PARA ): rStyleAccess.getByName(uStyle, IStyleAccess::AUTO_STYLE_CHAR ); if(pStyle.get()) diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 07c0c5180638..0adfc3feddde 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -817,7 +817,7 @@ uno::Any XStyleFamily::getByName(const OUString& rName) SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.m_aPoolId, true); if(!m_pBasePool) throw uno::RuntimeException(); - SfxStyleSheetIteratorPtr pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL); + std::shared_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL); SfxStyleSheetBase* pBase = pIt->Find(sStyleName); if(!pBase) throw container::NoSuchElementException(); @@ -833,7 +833,7 @@ uno::Sequence<OUString> XStyleFamily::getElementNames() throw( uno::RuntimeExcep if(!m_pBasePool) throw uno::RuntimeException(); std::vector<OUString> vRet; - SfxStyleSheetIteratorPtr pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL); + std::shared_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL); for (SfxStyleSheetBase* pStyle = pIt->First(); pStyle; pStyle = pIt->Next()) { OUString sName; @@ -850,7 +850,7 @@ sal_Bool XStyleFamily::hasByName(const OUString& rName) throw( uno::RuntimeExcep throw uno::RuntimeException(); OUString sStyleName; SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.m_aPoolId, true); - SfxStyleSheetIteratorPtr pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL); + std::shared_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL); SfxStyleSheetBase* pBase = pIt->Find(sStyleName); return nullptr != pBase; } @@ -3261,14 +3261,14 @@ const IStyleAccess::SwAutoStyleFamily aAutoStyleByIndex[] = class SwAutoStylesEnumImpl { - std::vector<SfxItemSet_Pointer_t> mAutoStyles; - std::vector<SfxItemSet_Pointer_t>::iterator aIter; + std::vector<std::shared_ptr<SfxItemSet>> mAutoStyles; + std::vector<std::shared_ptr<SfxItemSet>>::iterator aIter; SwDoc* pDoc; IStyleAccess::SwAutoStyleFamily eFamily; public: SwAutoStylesEnumImpl( SwDoc* pInitDoc, IStyleAccess::SwAutoStyleFamily eFam ); bool hasMoreElements() { return aIter != mAutoStyles.end(); } - SfxItemSet_Pointer_t nextElement() { return *(aIter++); } + std::shared_ptr<SfxItemSet> nextElement() { return *(aIter++); } IStyleAccess::SwAutoStyleFamily getFamily() const { return eFamily; } SwDoc* getDoc() const { return pDoc; } }; @@ -3624,7 +3624,7 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( m_pDocShell->GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aSet); // AutomaticStyle creation - SfxItemSet_Pointer_t pSet = m_pDocShell->GetDoc()->GetIStyleAccess().cacheAutomaticStyle( aSet, m_eFamily ); + std::shared_ptr<SfxItemSet> pSet = m_pDocShell->GetDoc()->GetIStyleAccess().cacheAutomaticStyle( aSet, m_eFamily ); uno::Reference<style::XAutoStyle> xRet = new SwXAutoStyle(m_pDocShell->GetDoc(), pSet, m_eFamily); return xRet; @@ -3668,7 +3668,7 @@ SwAutoStylesEnumImpl::SwAutoStylesEnumImpl( SwDoc* pInitDoc, IStyleAccess::SwAut if ( aRubyMap.find( aPair ) == aRubyMap.end() ) { aRubyMap.insert( aPair ); - SfxItemSet_Pointer_t pItemSet( new SfxItemSet( rAttrPool, RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY ) ); + std::shared_ptr<SfxItemSet> pItemSet( new SfxItemSet( rAttrPool, RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY ) ); pItemSet->Put( *pItem ); mAutoStyles.push_back( pItemSet ); } @@ -3721,7 +3721,7 @@ uno::Any SwXAutoStylesEnumerator::nextElement( ) uno::Any aRet; if( m_pImpl->hasMoreElements() ) { - SfxItemSet_Pointer_t pNextSet = m_pImpl->nextElement(); + std::shared_ptr<SfxItemSet> pNextSet = m_pImpl->nextElement(); uno::Reference< style::XAutoStyle > xAutoStyle = new SwXAutoStyle(m_pImpl->getDoc(), pNextSet, m_pImpl->getFamily()); aRet <<= xAutoStyle; @@ -3738,7 +3738,7 @@ uno::Any SwXAutoStylesEnumerator::nextElement( ) SwXAutoStyle::SwXAutoStyle( SwDoc* pDoc, - SfxItemSet_Pointer_t pInitSet, + std::shared_ptr<SfxItemSet> pInitSet, IStyleAccess::SwAutoStyleFamily eFam) : mpSet(pInitSet), meFamily(eFam), diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 52001b9c8ed5..dde0a14a107d 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -2326,9 +2326,9 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Create( const OUString &, return nullptr; } -SfxStyleSheetIteratorPtr SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, sal_uInt16 _nMask ) +std::shared_ptr<SfxStyleSheetIterator> SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, sal_uInt16 _nMask ) { - return SfxStyleSheetIteratorPtr(new SwStyleSheetIterator( this, eFam, _nMask )); + return std::shared_ptr<SfxStyleSheetIterator>(new SwStyleSheetIterator( this, eFam, _nMask )); } void SwDocStyleSheetPool::dispose() diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 28ecfb6ab4fe..57a9bc9b21a5 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3602,11 +3602,11 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages( }; for (IStyleAccess::SwAutoStyleFamily i : aFam) { - std::vector< SfxItemSet_Pointer_t > rStyles; + std::vector< std::shared_ptr<SfxItemSet> > rStyles; pDoc->GetIStyleAccess().getAllStyles(rStyles, i); while (!rStyles.empty()) { - SfxItemSet_Pointer_t pStyle = rStyles.back(); + std::shared_ptr<SfxItemSet> pStyle = rStyles.back(); rStyles.pop_back(); const SfxItemSet *pSet = dynamic_cast< const SfxItemSet * >(pStyle.get()); |