filter/source/msfilter/msdffimp.cxx | 24 +------ framework/inc/uifactory/configurationaccessfactorymanager.hxx | 6 - framework/inc/uifactory/factoryconfiguration.hxx | 6 - framework/inc/xml/imagesdocumenthandler.hxx | 6 - framework/inc/xml/statusbardocumenthandler.hxx | 7 -- framework/inc/xml/toolboxdocumenthandler.hxx | 7 -- framework/source/fwe/xml/statusbardocumenthandler.cxx | 4 - framework/source/fwe/xml/toolboxdocumenthandler.cxx | 4 - framework/source/uifactory/factoryconfiguration.cxx | 4 - framework/source/uifactory/uielementfactorymanager.cxx | 7 -- framework/source/xml/imagesdocumenthandler.cxx | 4 - include/filter/msfilter/msdffimp.hxx | 4 - ucb/source/ucp/package/pkgprovider.cxx | 31 +--------- ucb/source/ucp/package/pkgprovider.hxx | 4 - 14 files changed, 32 insertions(+), 86 deletions(-)
New commits: commit 68ba1c02ac9c93db329d92c9dca0c0b8e2ecff07 Author: Noel Grandin <[email protected]> AuthorDate: Fri May 16 11:17:33 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Fri May 16 13:38:01 2025 +0200 no need to subclass std::unordered_map here Change-Id: Ib7be7dac8f394a35eed7212c6fbad3cefa39eaa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185399 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/framework/inc/uifactory/configurationaccessfactorymanager.hxx b/framework/inc/uifactory/configurationaccessfactorymanager.hxx index 2272aabc355c..5373f3da969c 100644 --- a/framework/inc/uifactory/configurationaccessfactorymanager.hxx +++ b/framework/inc/uifactory/configurationaccessfactorymanager.hxx @@ -62,10 +62,6 @@ class ConfigurationAccess_FactoryManager final : public ::cppu::WeakImplHelper< virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; private: - class FactoryManagerMap : public std::unordered_map<OUString, - OUString> - { - }; bool impl_getElementProps( const css::uno::Any& rElement, OUString& rType, OUString& rName, OUString& rModule, OUString& rServiceSpecifier ) const; @@ -75,7 +71,7 @@ class ConfigurationAccess_FactoryManager final : public ::cppu::WeakImplHelper< OUString m_aPropModule; OUString m_aPropFactory; OUString m_sRoot; - FactoryManagerMap m_aFactoryManagerMap; + std::unordered_map<OUString, OUString> m_aFactoryManagerMap; css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider; css::uno::Reference< css::container::XNameAccess > m_xConfigAccess; rtl::Reference< WeakContainerListener > m_xConfigListener; diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx index 4d6b80d7943b..e637a9347e60 100644 --- a/framework/inc/uifactory/factoryconfiguration.hxx +++ b/framework/inc/uifactory/factoryconfiguration.hxx @@ -74,10 +74,6 @@ private: ControllerInfo(OUString _aImplementationName, OUString _aValue) : m_aImplementationName(std::move(_aImplementationName)),m_aValue(std::move(_aValue)){} ControllerInfo(){} }; - class MenuControllerMap : public std::unordered_map< OUString, - ControllerInfo > - { - }; bool impl_getElementProps( const css::uno::Any& aElement, OUString& aCommand, OUString& aModule, OUString& aServiceSpecifier,OUString& aValue ) const; @@ -87,7 +83,7 @@ private: OUString m_aPropController; OUString m_aPropValue; OUString m_sRoot; - MenuControllerMap m_aMenuControllerMap; + std::unordered_map< OUString, ControllerInfo > m_aMenuControllerMap; css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider; css::uno::Reference< css::container::XNameAccess > m_xConfigAccess; rtl::Reference< WeakContainerListener > m_xConfigAccessListener; diff --git a/framework/inc/xml/imagesdocumenthandler.hxx b/framework/inc/xml/imagesdocumenthandler.hxx index 2dd1ee2bda1d..d1694c8de278 100644 --- a/framework/inc/xml/imagesdocumenthandler.hxx +++ b/framework/inc/xml/imagesdocumenthandler.hxx @@ -87,14 +87,10 @@ class OReadImagesDocumentHandler final : public ::cppu::WeakImplHelper< css::xml private: OUString getErrorLineString(); - class ImageHashMap : public std::unordered_map< OUString, Image_XML_Entry > - { - }; - bool m_bImageContainerStartFound; bool m_bImageContainerEndFound; bool m_bImagesStartFound; - ImageHashMap m_aImageMap; + std::unordered_map< OUString, Image_XML_Entry > m_aImageMap; ImageItemDescriptorList& m_rImageList; css::uno::Reference< css::xml::sax::XLocator > m_xLocator; }; diff --git a/framework/inc/xml/statusbardocumenthandler.hxx b/framework/inc/xml/statusbardocumenthandler.hxx index c4cdb0429ed4..a3d991c7f2eb 100644 --- a/framework/inc/xml/statusbardocumenthandler.hxx +++ b/framework/inc/xml/statusbardocumenthandler.hxx @@ -89,14 +89,9 @@ class OReadStatusBarDocumentHandler final : public OReadStatusBarDocumentHandler private: OUString getErrorLineString(); - class StatusBarHashMap : public std::unordered_map<OUString, - StatusBar_XML_Entry > - { - }; - bool m_bStatusBarStartFound; bool m_bStatusBarItemStartFound; - StatusBarHashMap m_aStatusBarMap; + std::unordered_map<OUString, StatusBar_XML_Entry > m_aStatusBarMap; css::uno::Reference< css::container::XIndexContainer > m_aStatusBarItems; css::uno::Reference< css::xml::sax::XLocator > m_xLocator; }; diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx index 3e13b948a063..5cb9babf67cb 100644 --- a/framework/inc/xml/toolboxdocumenthandler.hxx +++ b/framework/inc/xml/toolboxdocumenthandler.hxx @@ -88,17 +88,12 @@ class OReadToolBoxDocumentHandler final : public OReadToolBoxDocumentHandler_Bas private: OUString getErrorLineString(); - class ToolBoxHashMap : public std::unordered_map<OUString, - ToolBox_XML_Entry> - { - }; - bool m_bToolBarStartFound : 1; bool m_bToolBarItemStartFound : 1; bool m_bToolBarSpaceStartFound : 1; bool m_bToolBarBreakStartFound : 1; bool m_bToolBarSeparatorStartFound : 1; - ToolBoxHashMap m_aToolBoxMap; + std::unordered_map<OUString, ToolBox_XML_Entry> m_aToolBoxMap; css::uno::Reference< css::container::XIndexContainer > m_rItemContainer; css::uno::Reference< css::xml::sax::XLocator > m_xLocator; diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx index 2294e7f51ea4..e897c533f54a 100644 --- a/framework/source/fwe/xml/statusbardocumenthandler.cxx +++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx @@ -188,7 +188,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::endDocument() void SAL_CALL OReadStatusBarDocumentHandler::startElement( const OUString& aName, const Reference< XAttributeList > &xAttribs ) { - StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName ); + auto pStatusBarEntry = m_aStatusBarMap.find( aName ); if ( pStatusBarEntry == m_aStatusBarMap.end() ) return; @@ -384,7 +384,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( void SAL_CALL OReadStatusBarDocumentHandler::endElement(const OUString& aName) { - StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName ); + auto pStatusBarEntry = m_aStatusBarMap.find( aName ); if ( pStatusBarEntry == m_aStatusBarMap.end() ) return; diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 48e30561531e..2c07203c5f33 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -176,7 +176,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::endDocument() void SAL_CALL OReadToolBoxDocumentHandler::startElement( const OUString& aName, const Reference< XAttributeList > &xAttribs ) { - ToolBoxHashMap::const_iterator pToolBoxEntry = m_aToolBoxMap.find( aName ); + auto pToolBoxEntry = m_aToolBoxMap.find( aName ); if ( pToolBoxEntry == m_aToolBoxMap.end() ) return; @@ -442,7 +442,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( void SAL_CALL OReadToolBoxDocumentHandler::endElement(const OUString& aName) { - ToolBoxHashMap::const_iterator pToolBoxEntry = m_aToolBoxMap.find( aName ); + auto pToolBoxEntry = m_aToolBoxMap.find( aName ); if ( pToolBoxEntry == m_aToolBoxMap.end() ) return; diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx index c8b44eaec34c..a81228e2a7af 100644 --- a/framework/source/uifactory/factoryconfiguration.cxx +++ b/framework/source/uifactory/factoryconfiguration.cxx @@ -77,7 +77,7 @@ ConfigurationAccess_ControllerFactory::~ConfigurationAccess_ControllerFactory() OUString ConfigurationAccess_ControllerFactory::getServiceFromCommandModule( std::u16string_view rCommandURL, std::u16string_view rModule ) const { std::unique_lock g(m_mutex); - MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule )); + auto pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule )); if ( pIter != m_aMenuControllerMap.end() ) return pIter->second.m_aImplementationName; @@ -97,7 +97,7 @@ OUString ConfigurationAccess_ControllerFactory::getValueFromCommandModule( std:: { std::unique_lock g(m_mutex); - MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule )); + auto pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule )); if ( pIter != m_aMenuControllerMap.end() ) return pIter->second.m_aValue; diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index bff442dda8f4..edae9eb48eaa 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -90,8 +90,7 @@ OUString ConfigurationAccess_FactoryManager::getFactorySpecifierFromTypeNameModu // SAFE std::unique_lock g(m_aMutex); - FactoryManagerMap::const_iterator pIter = - m_aFactoryManagerMap.find( getHashKeyFromStrings( rType, rName, rModule )); + auto pIter = m_aFactoryManagerMap.find( getHashKeyFromStrings( rType, rName, rModule )); if ( pIter != m_aFactoryManagerMap.end() ) return pIter->second; else @@ -128,7 +127,7 @@ void ConfigurationAccess_FactoryManager::addFactorySpecifierToTypeNameModule( st OUString aHashKey = getHashKeyFromStrings( rType, rName, rModule ); - FactoryManagerMap::const_iterator pIter = m_aFactoryManagerMap.find( aHashKey ); + auto pIter = m_aFactoryManagerMap.find( aHashKey ); if ( pIter != m_aFactoryManagerMap.end() ) throw ElementExistException(); @@ -142,7 +141,7 @@ void ConfigurationAccess_FactoryManager::removeFactorySpecifierFromTypeNameModul OUString aHashKey = getHashKeyFromStrings( rType, rName, rModule ); - FactoryManagerMap::const_iterator pIter = m_aFactoryManagerMap.find( aHashKey ); + auto pIter = m_aFactoryManagerMap.find( aHashKey ); if ( pIter == m_aFactoryManagerMap.end() ) throw NoSuchElementException(); diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index e11af9aae325..408e136aec85 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -137,7 +137,7 @@ void SAL_CALL OReadImagesDocumentHandler::endDocument() void SAL_CALL OReadImagesDocumentHandler::startElement( const OUString& aName, const Reference< XAttributeList > &xAttribs ) { - ImageHashMap::const_iterator pImageEntry = m_aImageMap.find( aName ); + auto pImageEntry = m_aImageMap.find( aName ); if ( pImageEntry == m_aImageMap.end() ) return; @@ -224,7 +224,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( void SAL_CALL OReadImagesDocumentHandler::endElement(const OUString& aName) { - ImageHashMap::const_iterator pImageEntry = m_aImageMap.find( aName ); + auto pImageEntry = m_aImageMap.find( aName ); if ( pImageEntry == m_aImageMap.end() ) return; diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx index ffac012e4993..4725b68d57ba 100644 --- a/ucb/source/ucp/package/pkgprovider.cxx +++ b/ucb/source/ucp/package/pkgprovider.cxx @@ -46,8 +46,6 @@ namespace package_ucp -namespace { - class Package : public cppu::OWeakObject, public container::XHierarchicalNameAccess { @@ -86,10 +84,6 @@ public: } -class Packages : public std::unordered_map<OUString, Package*> {}; - -} - using namespace package_ucp; @@ -207,17 +201,12 @@ ContentProvider::createPackage( const PackageUri & rURI ) OUString rURL = rURI.getPackage() + rURI.getParam(); - if ( m_pPackages ) + auto it = m_aPackages.find( rURL ); + if ( it != m_aPackages.end() ) { - Packages::const_iterator it = m_pPackages->find( rURL ); - if ( it != m_pPackages->end() ) - { - // Already instantiated. Return package. - return (*it).second->m_xNA; - } + // Already instantiated. Return package. + return (*it).second->m_xNA; } - else - m_pPackages.reset( new Packages ); // Create new package... uno::Sequence< uno::Any > aArguments{ uno::Any(rURL) }; @@ -242,7 +231,7 @@ ContentProvider::createPackage( const PackageUri & rURI ) } rtl::Reference< Package> xPackage = new Package( rURL, xNameAccess, this ); - (*m_pPackages)[ rURL ] = xPackage.get(); + m_aPackages[ rURL ] = xPackage.get(); return xPackage; } @@ -251,15 +240,7 @@ void ContentProvider::removePackage( const OUString & rName ) { osl::MutexGuard aGuard( m_aMutex ); - if ( m_pPackages ) - { - Packages::iterator it = m_pPackages->find( rName ); - if ( it != m_pPackages->end() ) - { - m_pPackages->erase( it ); - return; - } - } + m_aPackages.erase( rName ); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/ucb/source/ucp/package/pkgprovider.hxx b/ucb/source/ucp/package/pkgprovider.hxx index 37584e9734c7..d31801b18400 100644 --- a/ucb/source/ucp/package/pkgprovider.hxx +++ b/ucb/source/ucp/package/pkgprovider.hxx @@ -41,11 +41,11 @@ namespace package_ucp { "application/" PACKAGE_ZIP_URL_SCHEME "-stream" -class Packages; +class Package; class ContentProvider : public ::ucbhelper::ContentProviderImplHelper { - std::unique_ptr<Packages> m_pPackages; + std::unordered_map<OUString, Package*> m_aPackages; public: explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); commit fdafe86081022e881061aea81566ae9513620500 Author: Noel Grandin <[email protected]> AuthorDate: Fri May 16 11:08:07 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Fri May 16 13:37:53 2025 +0200 simplify SvxMSDffBLIPInfos no need to wrap a sal_uInt32 in a struct Change-Id: I5db794fced7b8f5de1ad154ceedb8509a627d7a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185398 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 3d1d45b509b1..a972ccf5ba00 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -187,20 +187,8 @@ enum class OfficeArtBlipRecInstance : sal_uInt32 TIFF = 0x6E4 // defined in section 2.2.30. }; -struct SvxMSDffBLIPInfo -{ - sal_uInt32 nFilePos; ///< offset of the BLIP in data stream - explicit SvxMSDffBLIPInfo(sal_uInt32 nFPos) - : nFilePos(nFPos) - { - } -}; - } -/// the following will be sorted by the order of their appearance: -struct SvxMSDffBLIPInfos : public std::vector<SvxMSDffBLIPInfo> {}; - /************************************************************************/ void Impl_OlePres::Write( SvStream & rStm ) { @@ -5768,7 +5756,6 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_, SvStream* pStData2_, bool bSkipImages ) :DffPropertyReader( *this ), - m_pBLIPInfos( new SvxMSDffBLIPInfos ), m_xShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ), nOffsDgg( nOffsDgg_ ), nBLIPCount( USHRT_MAX ), // initialize with error, since we first check if the @@ -5811,7 +5798,6 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_, SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, OUString aBaseURL ) :DffPropertyReader( *this ), - m_pBLIPInfos( new SvxMSDffBLIPInfos ), m_xShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ), nOffsDgg( 0 ), nBLIPCount( USHRT_MAX ), // initialize with error, since we first have to check @@ -6109,7 +6095,7 @@ void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, sal_uInt32 nL nBLIPCount++; // now save the info for later access - m_pBLIPInfos->push_back(SvxMSDffBLIPInfo(nBLIPPos)); + m_aBLIPOffsets.push_back(nBLIPPos); } if (!checkSeek(rSt, rSt.Tell() + nLength)) return; // invalid offset @@ -6455,7 +6441,7 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rGraphic, tools::Rectan if (!bOk) { sal_uInt16 nIdx = sal_uInt16( nIdx_ ); - if (!nIdx || (m_pBLIPInfos->size() < nIdx)) + if (!nIdx || (m_aBLIPOffsets.size() < nIdx)) return false; // possibly delete old error flag(s) @@ -6470,9 +6456,9 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rGraphic, tools::Rectan sal_uInt64 nOldPosData = pStData->Tell(); // fetch matching info struct out of the pointer array - SvxMSDffBLIPInfo& rInfo = (*m_pBLIPInfos)[ nIdx-1 ]; + const sal_uInt32 nBlipFilePos = m_aBLIPOffsets[ nIdx-1 ]; // jump to the BLIP atom in the data stream - bOk = checkSeek(*pStData, rInfo.nFilePos); + bOk = checkSeek(*pStData, nBlipFilePos); // possibly reset error status if (!bOk || pStData->GetError()) pStData->ResetError(); @@ -6486,7 +6472,7 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rGraphic, tools::Rectan pStData2->ResetError(); sal_uInt64 nOldPosData2 = pStData2->Tell(); // jump to the BLIP atom in the second data stream - bOk = checkSeek(*pStData2, rInfo.nFilePos); + bOk = checkSeek(*pStData2, nBlipFilePos); // reset error status if necessary if (!bOk || pStData2->GetError()) pStData2->ResetError(); diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx index 968670335990..9f2717d4aab9 100644 --- a/include/filter/msfilter/msdffimp.hxx +++ b/include/filter/msfilter/msdffimp.hxx @@ -412,7 +412,9 @@ public: */ class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader { - std::unique_ptr<SvxMSDffBLIPInfos> m_pBLIPInfos; + /// Offsets of the BLIP in data stream. + /// They are sorted by the order of their appearance. + std::vector<sal_uInt32> m_aBLIPOffsets; std::unique_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_xShapeInfosByTxBxComp; std::unique_ptr<SvxMSDffShapeInfos_ById> m_xShapeInfosById; SvxMSDffShapeOrders m_aShapeOrders;
