dbaccess/source/filter/xml/xmlStyleImport.cxx | 26 +++---- dbaccess/source/filter/xml/xmlStyleImport.hxx | 8 +- include/xmloff/shapeimport.hxx | 10 +-- include/xmloff/table/XMLTableImport.hxx | 12 +-- include/xmloff/txtimp.hxx | 22 +++--- include/xmloff/xmlimppr.hxx | 8 +- include/xmloff/xmlprcon.hxx | 4 - include/xmloff/xmlstyle.hxx | 9 -- reportdesign/source/filter/xml/xmlStyleImport.cxx | 32 ++++----- reportdesign/source/filter/xml/xmlStyleImport.hxx | 12 +-- sc/source/filter/xml/xmlstyli.cxx | 54 ++++++++-------- sc/source/filter/xml/xmlstyli.hxx | 10 +-- sw/source/filter/xml/xmlfmt.cxx | 52 +++++++++++---- sw/source/filter/xml/xmltexti.cxx | 16 ++-- xmloff/inc/XMLShapePropertySetContext.hxx | 2 xmloff/source/chart/XMLChartPropertyContext.cxx | 6 - xmloff/source/chart/XMLChartPropertyContext.hxx | 2 xmloff/source/chart/XMLChartStyleContext.cxx | 6 - xmloff/source/draw/XMLGraphicsDefaultStyle.cxx | 6 - xmloff/source/draw/XMLShapePropertySetContext.cxx | 6 - xmloff/source/draw/XMLShapeStyleContext.cxx | 16 ++-- xmloff/source/draw/shapeimport.cxx | 21 +++--- xmloff/source/draw/ximpstyl.cxx | 56 +++++++---------- xmloff/source/draw/ximpstyl.hxx | 3 xmloff/source/style/PageHeaderFooterContext.cxx | 4 - xmloff/source/style/PageHeaderFooterContext.hxx | 4 - xmloff/source/style/PageMasterImportContext.cxx | 26 +++---- xmloff/source/style/PagePropertySetContext.cxx | 14 ++-- xmloff/source/style/PagePropertySetContext.hxx | 2 xmloff/source/style/StylePropertiesContext.cxx | 4 - xmloff/source/style/StylePropertiesContext.hxx | 2 xmloff/source/style/prstylei.cxx | 28 ++++---- xmloff/source/style/xmlimppr.cxx | 29 ++++---- xmloff/source/style/xmlprcon.cxx | 8 +- xmloff/source/style/xmlstyle.cxx | 57 ++++++----------- xmloff/source/table/XMLTableImport.cxx | 8 +- xmloff/source/text/XMLTextPropertySetContext.cxx | 16 ++-- xmloff/source/text/XMLTextPropertySetContext.hxx | 2 xmloff/source/text/XMLTextShapeStyleContext.cxx | 20 +++--- xmloff/source/text/txtimp.cxx | 72 +++++++++++----------- xmloff/source/text/txtstyli.cxx | 20 +++--- 41 files changed, 354 insertions(+), 361 deletions(-)
New commits: commit 8009183a7a4cd1f5b2b6e78e480ade3f10d0eff2 Author: Noel Grandin <[email protected]> AuthorDate: Sat Apr 5 22:03:18 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sun Apr 6 14:25:02 2025 +0200 tdf#151876 shave some time off chart load (2) manage SvXMLImportPropertyMapper with unique_ptr instead of rtl::Reference, which avoids a bunch of ref-counting traffic Change-Id: I1e0e95408cdd5dc4271fa72178e57087737eb062 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183751 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/dbaccess/source/filter/xml/xmlStyleImport.cxx b/dbaccess/source/filter/xml/xmlStyleImport.cxx index 4196860031a0..4f3824008638 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.cxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.cxx @@ -152,42 +152,42 @@ void OTableStylesContext::endFastElement(sal_Int32 ) GetImport().GetStyles()->CopyStylesToDoc(true); } -rtl::Reference < SvXMLImportPropertyMapper > +SvXMLImportPropertyMapper* OTableStylesContext::GetImportPropertyMapper( XmlStyleFamily nFamily ) const { - rtl::Reference < SvXMLImportPropertyMapper > xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily); + SvXMLImportPropertyMapper* pMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily); - if (!xMapper.is()) + if (!pMapper) { switch( nFamily ) { case XmlStyleFamily::TABLE_TABLE: { - if ( !m_xTableImpPropMapper.is() ) - m_xTableImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); - xMapper = m_xTableImpPropMapper; + if ( !m_xTableImpPropMapper ) + m_xTableImpPropMapper = std::make_unique<SvXMLImportPropertyMapper>( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); + pMapper = m_xTableImpPropMapper.get(); } break; case XmlStyleFamily::TABLE_COLUMN: { - if ( !m_xColumnImpPropMapper.is() ) - m_xColumnImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); - xMapper = m_xColumnImpPropMapper; + if ( !m_xColumnImpPropMapper ) + m_xColumnImpPropMapper = std::make_unique<SvXMLImportPropertyMapper>( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); + pMapper = m_xColumnImpPropMapper.get(); } break; case XmlStyleFamily::TABLE_CELL: { - if ( !m_xCellImpPropMapper.is() ) - m_xCellImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); - xMapper = m_xCellImpPropMapper; + if ( !m_xCellImpPropMapper ) + m_xCellImpPropMapper = std::make_unique<SvXMLImportPropertyMapper>( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); + pMapper = m_xCellImpPropMapper.get(); } break; default: break; } } - return xMapper; + return pMapper; } SvXMLStyleContext *OTableStylesContext::CreateStyleStyleChildContext( diff --git a/dbaccess/source/filter/xml/xmlStyleImport.hxx b/dbaccess/source/filter/xml/xmlStyleImport.hxx index 7f6c9932dac7..552038fe8f8e 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.hxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.hxx @@ -65,9 +65,9 @@ namespace dbaxml sal_Int32 m_nMasterPageNameIndex; bool bAutoStyles : 1; - mutable rtl::Reference < SvXMLImportPropertyMapper > m_xTableImpPropMapper; - mutable rtl::Reference < SvXMLImportPropertyMapper > m_xColumnImpPropMapper; - mutable rtl::Reference < SvXMLImportPropertyMapper > m_xCellImpPropMapper; + mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xTableImpPropMapper; + mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xColumnImpPropMapper; + mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xCellImpPropMapper; ODBFilter& GetOwnImport(); @@ -88,7 +88,7 @@ namespace dbaxml virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; - virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper( + virtual SvXMLImportPropertyMapper* GetImportPropertyMapper( XmlStyleFamily nFamily ) const override; virtual OUString GetServiceName( XmlStyleFamily nFamily ) const override; diff --git a/include/xmloff/shapeimport.hxx b/include/xmloff/shapeimport.hxx index 7ce6019cd306..8bbffedfc91d 100644 --- a/include/xmloff/shapeimport.hxx +++ b/include/xmloff/shapeimport.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> #include <xmloff/dllapi.h> +#include <xmloff/xmlimppr.hxx> #include <com/sun/star/drawing/HomogenMatrix.hpp> #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> @@ -41,7 +42,6 @@ namespace com::sun::star::frame { class XModel; } class SvXMLImport; class SvXMLStylesContext; class XMLSdPropHdlFactory; -class SvXMLImportPropertyMapper; class XMLTableImport; // dr3d:3dlight context @@ -135,8 +135,8 @@ class XMLOFF_DLLPUBLIC XMLShapeImportHelper : public salhelper::SimpleReferenceO // PropertySetMappers and factory rtl::Reference<XMLSdPropHdlFactory> mpSdPropHdlFactory; - rtl::Reference<SvXMLImportPropertyMapper> mpPropertySetMapper; - rtl::Reference<SvXMLImportPropertyMapper> mpPresPagePropsMapper; + std::unique_ptr<SvXMLImportPropertyMapper> mpPropertySetMapper; + std::unique_ptr<SvXMLImportPropertyMapper> mpPresPagePropsMapper; // contexts for Style and AutoStyle import rtl::Reference<SvXMLStylesContext> mxStylesContext; @@ -150,7 +150,7 @@ protected: public: XMLShapeImportHelper( SvXMLImport& rImporter, const css::uno::Reference< css::frame::XModel>& rModel, - SvXMLImportPropertyMapper *pExtMapper=nullptr ); + std::unique_ptr<SvXMLImportPropertyMapper> pExtMapper={} ); virtual ~XMLShapeImportHelper() override; @@ -241,7 +241,7 @@ public: void restoreConnections(); /** creates a property mapper for external chaining */ - static SvXMLImportPropertyMapper* CreateShapePropMapper( + static std::unique_ptr<SvXMLImportPropertyMapper> CreateShapePropMapper( const css::uno::Reference< css::frame::XModel>& rModel, SvXMLImport& rImport ); /** defines if the import should increment the progress bar or not */ diff --git a/include/xmloff/table/XMLTableImport.hxx b/include/xmloff/table/XMLTableImport.hxx index 3577ed8adedf..2c21383547c7 100644 --- a/include/xmloff/table/XMLTableImport.hxx +++ b/include/xmloff/table/XMLTableImport.hxx @@ -53,9 +53,9 @@ public: SvXMLStyleContext* CreateTableTemplateContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); - const rtl::Reference< SvXMLImportPropertyMapper >& GetCellImportPropertySetMapper() const { return mxCellImportPropertySetMapper; } - const rtl::Reference< SvXMLImportPropertyMapper >& GetRowImportPropertySetMapper() const { return mxRowImportPropertySetMapper; } - const rtl::Reference< SvXMLImportPropertyMapper >& GetColumnImportPropertySetMapper() const { return mxColumnImportPropertySetMapper; } + SvXMLImportPropertyMapper* GetCellImportPropertySetMapper() const { return mxCellImportPropertySetMapper.get(); } + SvXMLImportPropertyMapper* GetRowImportPropertySetMapper() const { return mxRowImportPropertySetMapper.get(); } + SvXMLImportPropertyMapper* GetColumnImportPropertySetMapper() const { return mxColumnImportPropertySetMapper.get(); } void addTableTemplate( const OUString& rsStyleName, XMLTableTemplate& xTableTemplate ); /// Inserts all table templates. @@ -64,9 +64,9 @@ public: private: SvXMLImport& mrImport; bool mbWriter; - rtl::Reference< SvXMLImportPropertyMapper > mxCellImportPropertySetMapper; - rtl::Reference< SvXMLImportPropertyMapper > mxRowImportPropertySetMapper; - rtl::Reference< SvXMLImportPropertyMapper > mxColumnImportPropertySetMapper; + std::unique_ptr< SvXMLImportPropertyMapper > mxCellImportPropertySetMapper; + std::unique_ptr< SvXMLImportPropertyMapper > mxRowImportPropertySetMapper; + std::unique_ptr< SvXMLImportPropertyMapper > mxColumnImportPropertySetMapper; XMLTableTemplateMap maTableTemplates; }; diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx index c9e9d451afc7..e97d0dfac7b3 100644 --- a/include/xmloff/txtimp.hxx +++ b/include/xmloff/txtimp.hxx @@ -251,22 +251,22 @@ public: const OUString& rNextFrmName, const css::uno::Reference< css::beans::XPropertySet >& rFrmPropSet ); - rtl::Reference< SvXMLImportPropertyMapper > const& + SvXMLImportPropertyMapper* GetParaImportPropertySetMapper() const; - rtl::Reference< SvXMLImportPropertyMapper > const& + SvXMLImportPropertyMapper* GetTextImportPropertySetMapper() const; - rtl::Reference< SvXMLImportPropertyMapper > const& + SvXMLImportPropertyMapper* GetSectionImportPropertySetMapper() const; - rtl::Reference< SvXMLImportPropertyMapper > const& + SvXMLImportPropertyMapper* GetRubyImportPropertySetMapper() const; - static SvXMLImportPropertyMapper *CreateShapeExtPropMapper(SvXMLImport&); - static SvXMLImportPropertyMapper *CreateParaExtPropMapper(SvXMLImport&); - static SvXMLImportPropertyMapper* CreateParaDefaultExtPropMapper(SvXMLImport&); - static SvXMLImportPropertyMapper* CreateTableDefaultExtPropMapper(SvXMLImport&); - static SvXMLImportPropertyMapper* CreateTableRowDefaultExtPropMapper(SvXMLImport&); - static SvXMLImportPropertyMapper* CreateTableCellExtPropMapper(SvXMLImport&); - static SvXMLImportPropertyMapper* CreateDrawingPageExtPropMapper(SvXMLImport&); + static std::unique_ptr<SvXMLImportPropertyMapper> CreateShapeExtPropMapper(SvXMLImport&); + static std::unique_ptr<SvXMLImportPropertyMapper> CreateParaExtPropMapper(SvXMLImport&); + static std::unique_ptr<SvXMLImportPropertyMapper> CreateParaDefaultExtPropMapper(SvXMLImport&); + static std::unique_ptr<SvXMLImportPropertyMapper> CreateTableDefaultExtPropMapper(SvXMLImport&); + static std::unique_ptr<SvXMLImportPropertyMapper> CreateTableRowDefaultExtPropMapper(SvXMLImport&); + static std::unique_ptr<SvXMLImportPropertyMapper> CreateTableCellExtPropMapper(SvXMLImport&); + static std::unique_ptr<SvXMLImportPropertyMapper> CreateDrawingPageExtPropMapper(SvXMLImport&); SvI18NMap& GetRenameMap(); diff --git a/include/xmloff/xmlimppr.hxx b/include/xmloff/xmlimppr.hxx index 456eeb05a1ff..92f195586601 100644 --- a/include/xmloff/xmlimppr.hxx +++ b/include/xmloff/xmlimppr.hxx @@ -64,9 +64,9 @@ struct ContextID_Index_Pair css::drawing::FillStyle /*const*/ nExpectedFillStyle; }; -class XMLOFF_DLLPUBLIC SvXMLImportPropertyMapper : public salhelper::SimpleReferenceObject +class XMLOFF_DLLPUBLIC SvXMLImportPropertyMapper { - rtl::Reference< SvXMLImportPropertyMapper> mxNextMapper; + std::unique_ptr< SvXMLImportPropertyMapper> mxNextMapper; SvXMLImport& m_rImport; // access to error handling @@ -83,13 +83,13 @@ public: SvXMLImportPropertyMapper( rtl::Reference< XMLPropertySetMapper > xMapper, SvXMLImport& rImport); - virtual ~SvXMLImportPropertyMapper() override; + virtual ~SvXMLImportPropertyMapper(); // Add an ImportPropertyMapper at the end of the import mapper chain. // The added mapper MUST not be used outside the Mapper chain any longer, // because its PropertyMapper will be replaced. void ChainImportMapper( - const rtl::Reference< SvXMLImportPropertyMapper>& rMapper ); + std::unique_ptr< SvXMLImportPropertyMapper> rMapper ); /** fills the given itemset with the attributes in the given list * the map is only searched within the range diff --git a/include/xmloff/xmlprcon.hxx b/include/xmloff/xmlprcon.hxx index b89c4773e91b..83cea94761d0 100644 --- a/include/xmloff/xmlprcon.hxx +++ b/include/xmloff/xmlprcon.hxx @@ -34,7 +34,7 @@ protected: sal_Int32 mnEndIdx; sal_uInt32 mnFamily; ::std::vector< XMLPropertyState > &mrProperties; - rtl::Reference < SvXMLImportPropertyMapper > mxMapper; + SvXMLImportPropertyMapper* mpMapper; public: @@ -43,7 +43,7 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, sal_uInt32 nFamily, ::std::vector< XMLPropertyState > &rProps, - rtl::Reference < SvXMLImportPropertyMapper > xMap, + SvXMLImportPropertyMapper* pMap, sal_Int32 nStartIdx = -1, sal_Int32 nEndIdx = -1 ); SvXMLPropertySetContext(const SvXMLPropertySetContext&) = delete; SvXMLPropertySetContext(SvXMLPropertySetContext&&) = delete; diff --git a/include/xmloff/xmlstyle.hxx b/include/xmloff/xmlstyle.hxx index e4c9021a2a9e..0de0d76eaece 100644 --- a/include/xmloff/xmlstyle.hxx +++ b/include/xmloff/xmlstyle.hxx @@ -133,11 +133,8 @@ class XMLOFF_DLLPUBLIC SvXMLStylesContext : public SvXMLImportContext css::uno::Reference< css::style::XAutoStyleFamily > mxTextAutoStyles; - rtl::Reference < SvXMLImportPropertyMapper > mxParaImpPropMapper; - rtl::Reference < SvXMLImportPropertyMapper > mxTextImpPropMapper; - rtl::Reference < SvXMLImportPropertyMapper > mxShapeImpPropMapper; - mutable rtl::Reference < SvXMLImportPropertyMapper > mxChartImpPropMapper; - mutable rtl::Reference < SvXMLImportPropertyMapper > mxPageImpPropMapper; + mutable std::unique_ptr < SvXMLImportPropertyMapper > mxChartImpPropMapper; + mutable std::unique_ptr < SvXMLImportPropertyMapper > mxPageImpPropMapper; SvXMLStylesContext(SvXMLStylesContext const &) = delete; SvXMLStylesContext& operator =(SvXMLStylesContext const &) = delete; @@ -187,7 +184,7 @@ public: XmlStyleFamily nFamily, const OUString& rNamePrefix) const; static XmlStyleFamily GetFamily( std::u16string_view rFamily ); - virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper( + virtual SvXMLImportPropertyMapper* GetImportPropertyMapper( XmlStyleFamily nFamily ) const; virtual css::uno::Reference< css::container::XNameContainer > diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx b/reportdesign/source/filter/xml/xmlStyleImport.cxx index 4ccc672f97ca..7fa1056300fa 100644 --- a/reportdesign/source/filter/xml/xmlStyleImport.cxx +++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx @@ -169,53 +169,53 @@ void OReportStylesContext::endFastElement(sal_Int32 ) } -rtl::Reference < SvXMLImportPropertyMapper > +SvXMLImportPropertyMapper* OReportStylesContext::GetImportPropertyMapper( XmlStyleFamily nFamily ) const { - rtl::Reference < SvXMLImportPropertyMapper > xMapper(SvXMLStylesContext::GetImportPropertyMapper(nFamily)); + SvXMLImportPropertyMapper* pMapper(SvXMLStylesContext::GetImportPropertyMapper(nFamily)); - if (!xMapper.is()) + if (!pMapper) { ORptFilter& rImport = GetOwnImport(); switch( nFamily ) { case XmlStyleFamily::TABLE_CELL: { - if( !m_xCellImpPropMapper.is() ) + if( !m_xCellImpPropMapper ) { m_xCellImpPropMapper = - new XMLTextImportPropertyMapper/*OSpecialHandleXMLImportPropertyMapper*/( rImport.GetCellStylesPropertySetMapper(), m_rImport ); + std::make_unique<XMLTextImportPropertyMapper>/*OSpecialHandleXMLImportPropertyMapper*/( rImport.GetCellStylesPropertySetMapper(), m_rImport ); m_xCellImpPropMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(m_rImport)); } - xMapper = m_xCellImpPropMapper; + pMapper = m_xCellImpPropMapper.get(); } break; case XmlStyleFamily::TABLE_COLUMN: { - if( !m_xColumnImpPropMapper.is() ) + if( !m_xColumnImpPropMapper ) m_xColumnImpPropMapper = - new SvXMLImportPropertyMapper( rImport.GetColumnStylesPropertySetMapper(), m_rImport ); + std::make_unique<SvXMLImportPropertyMapper>( rImport.GetColumnStylesPropertySetMapper(), m_rImport ); - xMapper = m_xColumnImpPropMapper; + pMapper = m_xColumnImpPropMapper.get(); } break; case XmlStyleFamily::TABLE_ROW: { - if( !m_xRowImpPropMapper.is() ) - m_xRowImpPropMapper =new OSpecialHandleXMLImportPropertyMapper( rImport.GetRowStylesPropertySetMapper(), m_rImport ); - xMapper = m_xRowImpPropMapper; + if( !m_xRowImpPropMapper ) + m_xRowImpPropMapper = std::make_unique<OSpecialHandleXMLImportPropertyMapper>( rImport.GetRowStylesPropertySetMapper(), m_rImport ); + pMapper = m_xRowImpPropMapper.get(); } break; case XmlStyleFamily::TABLE_TABLE: { - if( !m_xTableImpPropMapper.is() ) + if( !m_xTableImpPropMapper ) { rtl::Reference < XMLPropertyHandlerFactory> xFac = new ::xmloff::OControlPropertyHandlerFactory(); - m_xTableImpPropMapper = new SvXMLImportPropertyMapper( new XMLPropertySetMapper(OXMLHelper::GetTableStyleProps(), xFac, false), m_rImport ); + m_xTableImpPropMapper = std::make_unique<SvXMLImportPropertyMapper>( new XMLPropertySetMapper(OXMLHelper::GetTableStyleProps(), xFac, false), m_rImport ); } - xMapper = m_xTableImpPropMapper; + pMapper = m_xTableImpPropMapper.get(); } break; default: @@ -223,7 +223,7 @@ rtl::Reference < SvXMLImportPropertyMapper > } } - return xMapper; + return pMapper; } SvXMLStyleContext *OReportStylesContext::CreateDefaultStyleStyleChildContext( diff --git a/reportdesign/source/filter/xml/xmlStyleImport.hxx b/reportdesign/source/filter/xml/xmlStyleImport.hxx index 691b6d384160..5ff05dd652cc 100644 --- a/reportdesign/source/filter/xml/xmlStyleImport.hxx +++ b/reportdesign/source/filter/xml/xmlStyleImport.hxx @@ -66,11 +66,11 @@ namespace rptxml sal_Int32 m_nNumberFormatIndex; bool bAutoStyles : 1; - //mutable rtl::Reference < SvXMLImportPropertyMapper > m_xControlImpPropMapper; - mutable rtl::Reference < SvXMLImportPropertyMapper > m_xCellImpPropMapper; - mutable rtl::Reference < SvXMLImportPropertyMapper > m_xColumnImpPropMapper; - mutable rtl::Reference < SvXMLImportPropertyMapper > m_xRowImpPropMapper; - mutable rtl::Reference < SvXMLImportPropertyMapper > m_xTableImpPropMapper; + //mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xControlImpPropMapper; + mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xCellImpPropMapper; + mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xColumnImpPropMapper; + mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xRowImpPropMapper; + mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xTableImpPropMapper; mutable css::uno::Reference< css::container::XNameContainer > m_xCellStyles; mutable css::uno::Reference< css::container::XNameContainer > m_xColumnStyles; @@ -104,7 +104,7 @@ namespace rptxml virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; - virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper( + virtual SvXMLImportPropertyMapper* GetImportPropertyMapper( XmlStyleFamily nFamily ) const override; virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer( XmlStyleFamily nFamily ) const override; diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 3c8bf9805ec8..3e3a218dcb13 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -274,7 +274,7 @@ class XMLTableCellPropsContext : public SvXMLPropertySetContext const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, sal_uInt32 nFamily, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap); + SvXMLImportPropertyMapper* pMap); using SvXMLPropertySetContext::createFastChildContext; virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext( @@ -291,9 +291,9 @@ XMLTableCellPropsContext::XMLTableCellPropsContext( const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, sal_uInt32 nFamily, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap) + SvXMLImportPropertyMapper* pMap) : SvXMLPropertySetContext( rImport, nElement, xAttrList, nFamily, - rProps, rMap ) + rProps, pMap ) { } @@ -303,7 +303,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTableCellPropsConte ::std::vector< XMLPropertyState > &rProperties, const XMLPropertyState& rProperty) { - switch (mxMapper->getPropertySetMapper()->GetEntryContextId(rProperty.mnIndex)) + switch (mpMapper->getPropertySetMapper()->GetEntryContextId(rProperty.mnIndex)) { case CTF_COMPLEX_COLOR: { @@ -460,15 +460,15 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTableStyleContext:: } else if ( nElement == XML_ELEMENT(STYLE, XML_TABLE_CELL_PROPERTIES) ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) + if( pImpPrMap ) xContext = new XMLTableCellPropsContext( GetImport(), nElement, xAttrList, XML_TYPE_PROP_TABLE_CELL, GetProperties(), - xImpPrMap ); + pImpPrMap ); } if (!xContext) @@ -577,11 +577,11 @@ XMLPropertyState* XMLTableStyleContext::FindProperty(const sal_Int16 nContextID) { XMLPropertyState* pRet = nullptr; rtl::Reference < XMLPropertySetMapper > xPrMap; - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = pStyles->GetImportPropertyMapper( GetFamily() ); - OSL_ENSURE( xImpPrMap.is(), "There is the import prop mapper" ); - if( xImpPrMap.is() ) - xPrMap = xImpPrMap->getPropertySetMapper(); + OSL_ENSURE( pImpPrMap, "There is the import prop mapper" ); + if( pImpPrMap ) + xPrMap = pImpPrMap->getPropertySetMapper(); if( xPrMap.is() ) { auto aIter = std::find_if(GetProperties().begin(), GetProperties().end(), @@ -698,56 +698,56 @@ void XMLTableStylesContext::endFastElement(sal_Int32 ) GetScImport().InsertStyles(); } -rtl::Reference < SvXMLImportPropertyMapper > +SvXMLImportPropertyMapper* XMLTableStylesContext::GetImportPropertyMapper( XmlStyleFamily nFamily ) const { - rtl::Reference < SvXMLImportPropertyMapper > xMapper(SvXMLStylesContext::GetImportPropertyMapper(nFamily)); + SvXMLImportPropertyMapper* pMapper(SvXMLStylesContext::GetImportPropertyMapper(nFamily)); - if (!xMapper.is()) + if (!pMapper) { switch( nFamily ) { case XmlStyleFamily::TABLE_CELL: { - if( !xCellImpPropMapper.is() ) + if( !xCellImpPropMapper ) { const_cast<XMLTableStylesContext *>(this)->xCellImpPropMapper = - new ScXMLCellImportPropertyMapper( GetScImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); + std::make_unique<ScXMLCellImportPropertyMapper>( GetScImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); xCellImpPropMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(const_cast<SvXMLImport&>(GetImport()))); } - xMapper = xCellImpPropMapper; + pMapper = xCellImpPropMapper.get(); } break; case XmlStyleFamily::TABLE_COLUMN: { - if( !xColumnImpPropMapper.is() ) + if( !xColumnImpPropMapper ) const_cast<XMLTableStylesContext *>(this)->xColumnImpPropMapper = - new SvXMLImportPropertyMapper( GetScImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); - xMapper = xColumnImpPropMapper; + std::make_unique<SvXMLImportPropertyMapper>( GetScImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); + pMapper = xColumnImpPropMapper.get(); } break; case XmlStyleFamily::TABLE_ROW: { - if( !xRowImpPropMapper.is() ) + if( !xRowImpPropMapper ) const_cast<XMLTableStylesContext *>(this)->xRowImpPropMapper = - new ScXMLRowImportPropertyMapper( GetScImport().GetRowStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); - xMapper = xRowImpPropMapper; + std::make_unique<ScXMLRowImportPropertyMapper>( GetScImport().GetRowStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); + pMapper = xRowImpPropMapper.get(); } break; case XmlStyleFamily::TABLE_TABLE: { - if( !xTableImpPropMapper.is() ) + if( !xTableImpPropMapper ) const_cast<XMLTableStylesContext *>(this)->xTableImpPropMapper = - new SvXMLImportPropertyMapper( GetScImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); - xMapper = xTableImpPropMapper; + std::make_unique<SvXMLImportPropertyMapper>( GetScImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); + pMapper = xTableImpPropMapper.get(); } break; default: break; } } - return xMapper; + return pMapper; } uno::Reference < XNameContainer > diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx index e977b84e0ec6..374c85ab81bd 100644 --- a/sc/source/filter/xml/xmlstyli.hxx +++ b/sc/source/filter/xml/xmlstyli.hxx @@ -125,10 +125,10 @@ class XMLTableStylesContext : public SvXMLStylesContext sal_Int32 nMasterPageNameIndex; bool bAutoStyles; - rtl::Reference < SvXMLImportPropertyMapper > xCellImpPropMapper; - rtl::Reference < SvXMLImportPropertyMapper > xColumnImpPropMapper; - rtl::Reference < SvXMLImportPropertyMapper > xRowImpPropMapper; - rtl::Reference < SvXMLImportPropertyMapper > xTableImpPropMapper; + std::unique_ptr < SvXMLImportPropertyMapper > xCellImpPropMapper; + std::unique_ptr < SvXMLImportPropertyMapper > xColumnImpPropMapper; + std::unique_ptr < SvXMLImportPropertyMapper > xRowImpPropMapper; + std::unique_ptr < SvXMLImportPropertyMapper > xTableImpPropMapper; const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); } ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); } @@ -154,7 +154,7 @@ public: virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; - virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper( + virtual SvXMLImportPropertyMapper* GetImportPropertyMapper( XmlStyleFamily nFamily ) const override; virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer( XmlStyleFamily nFamily ) const override; diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index dbd3eb0e1b19..6de032f131f2 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -451,14 +451,14 @@ void SwXMLCellStyleContext::AddDataFormat() if (nNumberFormat < 0) return; - rtl::Reference<SvXMLImportPropertyMapper> xPropertyMapper(GetStyles()->GetImportPropertyMapper(GetFamily())); - if (!xPropertyMapper.is()) + SvXMLImportPropertyMapper* pPropertyMapper(GetStyles()->GetImportPropertyMapper(GetFamily())); + if (!pPropertyMapper) { SAL_WARN("sw.xml", "there is no import prop mapper"); return; } - const rtl::Reference<XMLPropertySetMapper>& xPropertySetMapper(xPropertyMapper->getPropertySetMapper()); + const rtl::Reference<XMLPropertySetMapper>& xPropertySetMapper(pPropertyMapper->getPropertySetMapper()); sal_Int32 nIndex = xPropertySetMapper->GetEntryIndex(XML_NAMESPACE_STYLE, GetXMLToken(XML_DATA_STYLE_NAME), 0); if (nIndex < 0) { @@ -718,7 +718,7 @@ protected: XmlStyleFamily nFamily, sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) override; // HACK - virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper( + virtual SvXMLImportPropertyMapper* GetImportPropertyMapper( XmlStyleFamily nFamily ) const override; virtual uno::Reference < container::XNameContainer > @@ -735,6 +735,12 @@ public: virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + +private: + mutable std::unique_ptr<SvXMLImportPropertyMapper> mxTableTablePropMapper; + mutable std::unique_ptr<SvXMLImportPropertyMapper> mxTableRowPropMapper; + mutable std::unique_ptr<SvXMLImportPropertyMapper> mxTableCellPropMapper; + mutable std::unique_ptr<SvXMLImportPropertyMapper> mxDrawingPagePropMapper; }; } @@ -870,27 +876,41 @@ bool SwXMLStylesContext_Impl::InsertStyleFamily( XmlStyleFamily nFamily ) const return bIns; } -rtl::Reference < SvXMLImportPropertyMapper > SwXMLStylesContext_Impl::GetImportPropertyMapper( +SvXMLImportPropertyMapper* SwXMLStylesContext_Impl::GetImportPropertyMapper( XmlStyleFamily nFamily ) const { - rtl::Reference < SvXMLImportPropertyMapper > xMapper; + SvXMLImportPropertyMapper* pMapper = nullptr; if( nFamily == XmlStyleFamily::TABLE_TABLE ) - xMapper = XMLTextImportHelper::CreateTableDefaultExtPropMapper( - const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() ); + { + if (!mxTableTablePropMapper) + mxTableTablePropMapper = XMLTextImportHelper::CreateTableDefaultExtPropMapper( + const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() ); + pMapper = mxTableTablePropMapper.get(); + } else if( nFamily == XmlStyleFamily::TABLE_ROW ) - xMapper = XMLTextImportHelper::CreateTableRowDefaultExtPropMapper( - const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() ); + { + if (!mxTableRowPropMapper) + mxTableRowPropMapper = XMLTextImportHelper::CreateTableRowDefaultExtPropMapper( + const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() ); + pMapper = mxTableRowPropMapper.get(); + } else if( nFamily == XmlStyleFamily::TABLE_CELL ) - xMapper = XMLTextImportHelper::CreateTableCellExtPropMapper( - const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() ); + { + if (!mxTableCellPropMapper) + mxTableCellPropMapper = XMLTextImportHelper::CreateTableCellExtPropMapper( + const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() ); + pMapper = mxTableCellPropMapper.get(); + } else if (nFamily == XmlStyleFamily::SD_DRAWINGPAGE_ID) { - xMapper = XMLTextImportHelper::CreateDrawingPageExtPropMapper( - const_cast<SwXMLStylesContext_Impl*>(this)->GetImport()); + if (!mxDrawingPagePropMapper) + mxDrawingPagePropMapper = XMLTextImportHelper::CreateDrawingPageExtPropMapper( + const_cast<SwXMLStylesContext_Impl*>(this)->GetImport()); + pMapper = mxDrawingPagePropMapper.get(); } else - xMapper = SvXMLStylesContext::GetImportPropertyMapper( nFamily ); - return xMapper; + pMapper = SvXMLStylesContext::GetImportPropertyMapper( nFamily ); + return pMapper; } uno::Reference < container::XNameContainer > SwXMLStylesContext_Impl::GetStylesContainer( diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index bd3ea53780b0..0b60c5ea3bbf 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -421,14 +421,14 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( pStyle = FindAutoFrameStyle( rStyleName ); if( pStyle ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = pStyle->GetStyles() ->GetImportPropertyMapper(pStyle->GetFamily()); - OSL_ENSURE( xImpPrMap.is(), "Where is the import prop mapper?" ); - if( xImpPrMap.is() ) + OSL_ENSURE( pImpPrMap, "Where is the import prop mapper?" ); + if( pImpPrMap ) { rtl::Reference<XMLPropertySetMapper> rPropMapper = - xImpPrMap->getPropertySetMapper(); + pImpPrMap->getPropertySetMapper(); sal_Int32 nCount = pStyle->GetProperties().size(); for( sal_Int32 i=0; i < nCount; i++ ) @@ -735,14 +735,14 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra pStyle = FindAutoFrameStyle( rStyleName ); if( pStyle ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = pStyle->GetStyles() ->GetImportPropertyMapper(pStyle->GetFamily()); - OSL_ENSURE( xImpPrMap.is(), "Where is the import prop mapper?" ); - if( xImpPrMap.is() ) + OSL_ENSURE( pImpPrMap, "Where is the import prop mapper?" ); + if( pImpPrMap ) { rtl::Reference<XMLPropertySetMapper> rPropMapper = - xImpPrMap->getPropertySetMapper(); + pImpPrMap->getPropertySetMapper(); sal_Int32 nCount = pStyle->GetProperties().size(); for( sal_Int32 i=0; i < nCount; i++ ) diff --git a/xmloff/inc/XMLShapePropertySetContext.hxx b/xmloff/inc/XMLShapePropertySetContext.hxx index 4f63935ed8b2..617fccde0271 100644 --- a/xmloff/inc/XMLShapePropertySetContext.hxx +++ b/xmloff/inc/XMLShapePropertySetContext.hxx @@ -34,7 +34,7 @@ public: const css::uno::Reference<css::xml::sax::XFastAttributeList >& xAttrList, sal_uInt32 nFam, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap ); + SvXMLImportPropertyMapper* pMap ); virtual ~XMLShapePropertySetContext() override; diff --git a/xmloff/source/chart/XMLChartPropertyContext.cxx b/xmloff/source/chart/XMLChartPropertyContext.cxx index a06cad4780f4..8b95b8e775d3 100644 --- a/xmloff/source/chart/XMLChartPropertyContext.cxx +++ b/xmloff/source/chart/XMLChartPropertyContext.cxx @@ -33,8 +33,8 @@ XMLChartPropertyContext::XMLChartPropertyContext( const uno::Reference< xml::sax::XFastAttributeList > & xAttrList, sal_uInt32 nFamily, ::std::vector< XMLPropertyState >& rProps, - const rtl::Reference< SvXMLImportPropertyMapper >& rMapper ) : - SvXMLPropertySetContext( rImport, nElement, xAttrList, nFamily, rProps, rMapper ) + SvXMLImportPropertyMapper* pMapper ) : + SvXMLPropertySetContext( rImport, nElement, xAttrList, nFamily, rProps, pMapper ) { } @@ -47,7 +47,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLChartPropertyContex ::std::vector< XMLPropertyState > &rProperties, const XMLPropertyState& rProp ) { - switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) ) + switch( mpMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) ) { case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE: return new XMLSymbolImageContext( GetImport(), nElement, rProp, rProperties ); diff --git a/xmloff/source/chart/XMLChartPropertyContext.hxx b/xmloff/source/chart/XMLChartPropertyContext.hxx index d0fa489d390f..b5722fd00aa0 100644 --- a/xmloff/source/chart/XMLChartPropertyContext.hxx +++ b/xmloff/source/chart/XMLChartPropertyContext.hxx @@ -28,7 +28,7 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, sal_uInt32 nFamily, ::std::vector< XMLPropertyState >& rProps, - const rtl::Reference< SvXMLImportPropertyMapper >& rMapper ); + SvXMLImportPropertyMapper* pMapper ); virtual ~XMLChartPropertyContext() override; using SvXMLPropertySetContext::createFastChildContext; diff --git a/xmloff/source/chart/XMLChartStyleContext.cxx b/xmloff/source/chart/XMLChartStyleContext.cxx index 521c3d79bb60..53a790d216c7 100644 --- a/xmloff/source/chart/XMLChartStyleContext.cxx +++ b/xmloff/source/chart/XMLChartStyleContext.cxx @@ -122,12 +122,12 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLChartStyleContext:: nFamily = XML_TYPE_PROP_CHART; if( nFamily ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) + if( pImpPrMap ) return new XMLChartPropertyContext( GetImport(), nElement, xAttrList, nFamily, - GetProperties(), xImpPrMap ); + GetProperties(), pImpPrMap ); } } diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index 56f27fce6730..afd10208f25c 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -74,9 +74,9 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLGraphicsDefaultStyl nFamily = XML_TYPE_PROP_GRAPHIC; if( nFamily ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) - return new XMLShapePropertySetContext( GetImport(), nElement, xAttrList, nFamily, GetProperties(), xImpPrMap ); + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); + if( pImpPrMap ) + return new XMLShapePropertySetContext( GetImport(), nElement, xAttrList, nFamily, GetProperties(), pImpPrMap ); } } diff --git a/xmloff/source/draw/XMLShapePropertySetContext.cxx b/xmloff/source/draw/XMLShapePropertySetContext.cxx index 79b56b37c0d5..7a2bf51bfc9e 100644 --- a/xmloff/source/draw/XMLShapePropertySetContext.cxx +++ b/xmloff/source/draw/XMLShapePropertySetContext.cxx @@ -38,9 +38,9 @@ XMLShapePropertySetContext::XMLShapePropertySetContext( const Reference< xml::sax::XFastAttributeList > & xAttrList, sal_uInt32 nFam, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap ) : + SvXMLImportPropertyMapper* pMap ) : SvXMLPropertySetContext( rImport, nElement, xAttrList, nFam, - rProps, rMap ), + rProps, pMap ), mnBulletIndex(-1) { } @@ -69,7 +69,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLShapePropertySetCon ::std::vector< XMLPropertyState > &rProperties, const XMLPropertyState& rProp ) { - switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) ) + switch( mpMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) ) { case CTF_NUMBERINGRULES: mnBulletIndex = rProp.mnIndex; diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx index 85428c8bb4ee..4867ab575c3e 100644 --- a/xmloff/source/draw/XMLShapeStyleContext.cxx +++ b/xmloff/source/draw/XMLShapeStyleContext.cxx @@ -101,13 +101,13 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLShapeStyleContext:: nFamily = XML_TYPE_PROP_GRAPHIC; if( nFamily ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) + if( pImpPrMap ) return new XMLShapePropertySetContext( GetImport(), nElement, xAttrList, nFamily, GetProperties(), - xImpPrMap ); + pImpPrMap ); } } @@ -198,15 +198,15 @@ void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet XmlStyleFamily::SD_FILL_IMAGE_ID }; - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - SAL_WARN_IF( !xImpPrMap.is(), "xmloff", "There is the import prop mapper" ); - if( xImpPrMap.is() ) - xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs ); + SAL_WARN_IF( !pImpPrMap, "xmloff", "There is the import prop mapper" ); + if( pImpPrMap ) + pImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs ); Reference< XPropertySetInfo > xInfo; // get property set mapper - rtl::Reference<XMLPropertySetMapper> xPropMapper( xImpPrMap->getPropertySetMapper() ); + rtl::Reference<XMLPropertySetMapper> xPropMapper( pImpPrMap->getPropertySetMapper() ); for( sal_uInt16 i=0; aContextIDs[i].nContextID != -1; i++ ) { diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index fe251856a0e4..4c4e7478fea2 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -101,7 +101,7 @@ struct XMLShapeImportHelperImpl XMLShapeImportHelper::XMLShapeImportHelper( SvXMLImport& rImporter, const uno::Reference< frame::XModel>& rModel, - SvXMLImportPropertyMapper *pExtMapper ) + std::unique_ptr<SvXMLImportPropertyMapper> pExtMapper ) : mpImpl( new XMLShapeImportHelperImpl ), mrImporter( rImporter ) { @@ -114,12 +114,11 @@ XMLShapeImportHelper::XMLShapeImportHelper( // construct PropertySetMapper rtl::Reference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper(mpSdPropHdlFactory, false); - mpPropertySetMapper = new SvXMLImportPropertyMapper( xMapper, rImporter ); + mpPropertySetMapper = std::make_unique<SvXMLImportPropertyMapper>( xMapper, rImporter ); if( pExtMapper ) { - rtl::Reference < SvXMLImportPropertyMapper > xExtMapper( pExtMapper ); - mpPropertySetMapper->ChainImportMapper( xExtMapper ); + mpPropertySetMapper->ChainImportMapper( std::move(pExtMapper) ); } // chain text attributes @@ -128,7 +127,7 @@ XMLShapeImportHelper::XMLShapeImportHelper( // construct PresPagePropsMapper xMapper = new XMLPropertySetMapper(aXMLSDPresPageProps, mpSdPropHdlFactory, false); - mpPresPagePropsMapper = new SvXMLImportPropertyMapper( xMapper, rImporter ); + mpPresPagePropsMapper = std::make_unique<SvXMLImportPropertyMapper>( xMapper, rImporter ); uno::Reference< lang::XServiceInfo > xInfo( rImporter.GetModel(), uno::UNO_QUERY ); mpImpl->mbIsPresentationShapesSupported = xInfo.is() && xInfo->supportsService( u"com.sun.star.presentation.PresentationDocument"_ustr ); @@ -141,11 +140,11 @@ XMLShapeImportHelper::~XMLShapeImportHelper() // cleanup factory, decrease refcount. Should lead to destruction. mpSdPropHdlFactory.clear(); - // cleanup mapper, decrease refcount. Should lead to destruction. - mpPropertySetMapper.clear(); + // cleanup mapper + mpPropertySetMapper.reset(); - // cleanup presPage mapper, decrease refcount. Should lead to destruction. - mpPresPagePropsMapper.clear(); + // cleanup presPage mapper + mpPresPagePropsMapper.reset(); // Styles or AutoStyles context? if(mxStylesContext.is()) @@ -829,11 +828,11 @@ void XMLShapeImportHelper::restoreConnections() mpImpl->maConnections.clear(); } -SvXMLImportPropertyMapper* XMLShapeImportHelper::CreateShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport ) +std::unique_ptr<SvXMLImportPropertyMapper> XMLShapeImportHelper::CreateShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport ) { rtl::Reference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rModel, rImport ); rtl::Reference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory, false ); - SvXMLImportPropertyMapper* pResult = new SvXMLImportPropertyMapper( xMapper, rImport ); + std::unique_ptr<SvXMLImportPropertyMapper> pResult = std::make_unique<SvXMLImportPropertyMapper>( xMapper, rImport ); // chain text attributes pResult->ChainImportMapper( XMLTextImportHelper::CreateParaExtPropMapper( rImport ) ); diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 3e0d98bfa6ed..a213ed880be3 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -68,7 +68,7 @@ public: SdXMLDrawingPagePropertySetContext( SvXMLImport& rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap ); + SvXMLImportPropertyMapper* pMap ); using SvXMLPropertySetContext::createFastChildContext; virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext( @@ -83,9 +83,9 @@ SdXMLDrawingPagePropertySetContext::SdXMLDrawingPagePropertySetContext( SvXMLImport& rImport, sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap ) : + SvXMLImportPropertyMapper* pMap ) : SvXMLPropertySetContext( rImport, nElement, xAttrList, - XML_TYPE_PROP_DRAWING_PAGE, rProps, rMap ) + XML_TYPE_PROP_DRAWING_PAGE, rProps, pMap ) { } @@ -95,7 +95,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLDrawingPageProper ::std::vector< XMLPropertyState > &rProperties, const XMLPropertyState& rProp ) { - switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) ) + switch( mpMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) ) { case CTF_PAGE_SOUND_URL: { @@ -188,13 +188,13 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLDrawingPageStyleC { if( nElement == XML_ELEMENT(STYLE, XML_DRAWING_PAGE_PROPERTIES) ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) + if( pImpPrMap ) return new SdXMLDrawingPagePropertySetContext( GetImport(), nElement, xAttrList, GetProperties(), - xImpPrMap ); + pImpPrMap ); } return XMLPropStyleContext::createFastChildContext( nElement, xAttrList ); @@ -243,11 +243,11 @@ void SdXMLDrawingPageStyleContext::Finish( bool bOverwrite ) void XMLDrawingPageStyleContext::FillPropertySet( const Reference< beans::XPropertySet > & rPropSet ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - SAL_WARN_IF( !xImpPrMap.is(), "xmloff", "There is the import prop mapper" ); - if( xImpPrMap.is() ) - xImpPrMap->FillPropertySet(GetProperties(), rPropSet, m_pContextIDs.get()); + SAL_WARN_IF( !pImpPrMap, "xmloff", "There is the import prop mapper" ); + if( pImpPrMap ) + pImpPrMap->FillPropertySet(GetProperties(), rPropSet, m_pContextIDs.get()); Reference< beans::XPropertySetInfo > xInfo; for (size_t i=0; m_pContextIDs[i].nContextID != -1; ++i) @@ -269,7 +269,7 @@ void XMLDrawingPageStyleContext::FillPropertySet( sStyleName ); // get property set mapper rtl::Reference<XMLPropertySetMapper> rPropMapper = - xImpPrMap->getPropertySetMapper(); + pImpPrMap->getPropertySetMapper(); // set property const OUString& rPropertyName = @@ -1037,22 +1037,16 @@ SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext( return SvXMLStylesContext::CreateDefaultStyleStyleChildContext(nFamily, nElement, xAttrList); } -rtl::Reference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyMapper( +SvXMLImportPropertyMapper* SdXMLStylesContext::GetImportPropertyMapper( XmlStyleFamily nFamily) const { - rtl::Reference < SvXMLImportPropertyMapper > xMapper; + SvXMLImportPropertyMapper* pMapper = nullptr; switch( nFamily ) { case XmlStyleFamily::SD_DRAWINGPAGE_ID: { - if(!xPresImpPropMapper.is()) - { - rtl::Reference< XMLShapeImportHelper > aImpHelper = const_cast<SvXMLImport&>(GetImport()).GetShapeImport(); - const_cast<SdXMLStylesContext*>(this)->xPresImpPropMapper = - aImpHelper->GetPresPagePropsMapper(); - } - xMapper = xPresImpPropMapper; + pMapper = const_cast<SvXMLImport&>(GetImport()).GetShapeImport()->GetPresPagePropsMapper(); break; } @@ -1064,9 +1058,9 @@ rtl::Reference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropert switch( nFamily ) { - case XmlStyleFamily::TABLE_COLUMN: xMapper = xTableImport->GetColumnImportPropertySetMapper().get(); break; - case XmlStyleFamily::TABLE_ROW: xMapper = xTableImport->GetRowImportPropertySetMapper().get(); break; - case XmlStyleFamily::TABLE_CELL: xMapper = xTableImport->GetCellImportPropertySetMapper().get(); break; + case XmlStyleFamily::TABLE_COLUMN: pMapper = xTableImport->GetColumnImportPropertySetMapper(); break; + case XmlStyleFamily::TABLE_ROW: pMapper = xTableImport->GetRowImportPropertySetMapper(); break; + case XmlStyleFamily::TABLE_CELL: pMapper = xTableImport->GetCellImportPropertySetMapper(); break; default: break; } break; @@ -1075,9 +1069,9 @@ rtl::Reference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropert } // call base class - if( !xMapper.is() ) - xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily); - return xMapper; + if( !pMapper ) + pMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily); + return pMapper; } // Process all style and object info @@ -1276,10 +1270,10 @@ void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAc if( xPropState.is() ) { rtl::Reference < XMLPropertySetMapper > xPrMap; - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = GetImportPropertyMapper( nFamily ); - SAL_WARN_IF( !xImpPrMap.is(), "xmloff", "There is the import prop mapper" ); - if( xImpPrMap.is() ) - xPrMap = xImpPrMap->getPropertySetMapper(); + SvXMLImportPropertyMapper* pImpPrMap = GetImportPropertyMapper( nFamily ); + SAL_WARN_IF( !pImpPrMap, "xmloff", "There is the import prop mapper" ); + if( pImpPrMap ) + xPrMap = pImpPrMap->getPropertySetMapper(); if( xPrMap.is() ) { const sal_Int32 nCount = xPrMap->GetEntryCount(); diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx index 3b0bbe237032..ecfe0df6e4b4 100644 --- a/xmloff/source/draw/ximpstyl.hxx +++ b/xmloff/source/draw/ximpstyl.hxx @@ -169,7 +169,6 @@ public: class SdXMLStylesContext : public SvXMLStylesContext { - rtl::Reference< SvXMLImportPropertyMapper > xPresImpPropMapper; bool mbIsAutoStyle; std::unique_ptr<SvXMLNumFmtHelper> mpNumFmtHelper; std::unique_ptr<SvNumberFormatter> mpNumFormatter; @@ -206,7 +205,7 @@ public: bool bIsAutoStyle); virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; - virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override; + virtual SvXMLImportPropertyMapper* GetImportPropertyMapper(XmlStyleFamily nFamily) const override; void SetMasterPageStyles(SdXMLMasterPageContext const & rMaster) const; diff --git a/xmloff/source/style/PageHeaderFooterContext.cxx b/xmloff/source/style/PageHeaderFooterContext.cxx index b36473361ff0..fae3b1caecfc 100644 --- a/xmloff/source/style/PageHeaderFooterContext.cxx +++ b/xmloff/source/style/PageHeaderFooterContext.cxx @@ -31,14 +31,14 @@ using ::xmloff::token::XML_HEADER_FOOTER_PROPERTIES; PageHeaderFooterContext::PageHeaderFooterContext( SvXMLImport& rImport, ::std::vector< XMLPropertyState > & rTempProperties, - rtl::Reference < SvXMLImportPropertyMapper > xTempMap, + SvXMLImportPropertyMapper* pTempMap, sal_Int32 nStart, sal_Int32 nEnd, const bool bTempHeader ) : SvXMLImportContext( rImport ), rProperties(rTempProperties), nStartIndex(nStart), nEndIndex(nEnd), - rMap(std::move(xTempMap)) + rMap(pTempMap) { bHeader = bTempHeader; } diff --git a/xmloff/source/style/PageHeaderFooterContext.hxx b/xmloff/source/style/PageHeaderFooterContext.hxx index 30c2f430a8fe..0a1c190b38d8 100644 --- a/xmloff/source/style/PageHeaderFooterContext.hxx +++ b/xmloff/source/style/PageHeaderFooterContext.hxx @@ -27,13 +27,13 @@ class PageHeaderFooterContext : public SvXMLImportContext sal_Int32 nStartIndex; sal_Int32 nEndIndex; bool bHeader; - const rtl::Reference < SvXMLImportPropertyMapper > rMap; + SvXMLImportPropertyMapper* rMap; public: PageHeaderFooterContext( SvXMLImport& rImport, ::std::vector< XMLPropertyState > & rProperties, - rtl::Reference < SvXMLImportPropertyMapper > xMap, + SvXMLImportPropertyMapper* pMap, sal_Int32 nStartIndex, sal_Int32 nEndIndex, const bool bHeader); diff --git a/xmloff/source/style/PageMasterImportContext.cxx b/xmloff/source/style/PageMasterImportContext.cxx index 53e6654de37f..aa338ee88b72 100644 --- a/xmloff/source/style/PageMasterImportContext.cxx +++ b/xmloff/source/style/PageMasterImportContext.cxx @@ -80,11 +80,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > PageStyleContext::crea nElement == XML_ELEMENT(STYLE, XML_FOOTER_STYLE) ) { bool bHeader = nElement == XML_ELEMENT(STYLE, XML_HEADER_STYLE); - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) + if( pImpPrMap ) { - const rtl::Reference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper(); + const rtl::Reference< XMLPropertySetMapper >& rMapper = pImpPrMap->getPropertySetMapper(); sal_Int32 nFlag; if (bHeader) nFlag = CTF_PM_HEADERFLAG; @@ -115,17 +115,17 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > PageStyleContext::crea if (!bEnd) nEndIndex = nIndex; return new PageHeaderFooterContext(GetImport(), - GetProperties(), xImpPrMap, nStartIndex, nEndIndex, bHeader); + GetProperties(), pImpPrMap, nStartIndex, nEndIndex, bHeader); } } if( nElement == XML_ELEMENT(STYLE, XML_PAGE_LAYOUT_PROPERTIES) ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) + if( pImpPrMap ) { - const rtl::Reference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper(); + const rtl::Reference< XMLPropertySetMapper >& rMapper = pImpPrMap->getPropertySetMapper(); sal_Int32 nEndIndex (-1); bool bEnd(false); sal_Int32 nIndex = 0; @@ -146,7 +146,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > PageStyleContext::crea xAttrList, XML_TYPE_PROP_PAGE_LAYOUT, GetProperties(), - xImpPrMap, 0, nEndIndex, Page); + pImpPrMap, 0, nEndIndex, Page); } } @@ -193,9 +193,9 @@ void PageStyleContext::FillPropertySet_PageStyle( // do not use XMLPropStyleContext::FillPropertySet, we need to handle this ourselves since // we have properties which use the MID_FLAG_NO_PROPERTY_IMPORT flag since they need some special // handling - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper(GetFamily()); + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper(GetFamily()); - if(xImpPrMap.is()) + if(pImpPrMap) { // properties that need special handling because they need the used name to be translated first struct ContextID_Index_Pair aContextIDs[] = @@ -230,10 +230,10 @@ void PageStyleContext::FillPropertySet_PageStyle( }; // Fill PropertySet, but let it handle special properties not itself - xImpPrMap->FillPropertySet(GetProperties(), xPropSet, aContextIDs); + pImpPrMap->FillPropertySet(GetProperties(), xPropSet, aContextIDs); // get property set mapper - const rtl::Reference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper(); + const rtl::Reference< XMLPropertySetMapper >& rMapper = pImpPrMap->getPropertySetMapper(); Reference<XPropertySetInfo> const xInfo(xPropSet->getPropertySetInfo()); // don't look at the attributes, look at the property, could @@ -314,7 +314,7 @@ void PageStyleContext::FillPropertySet_PageStyle( } else { - OSL_ENSURE(xImpPrMap.is(), "Got no SvXMLImportPropertyMapper (!)"); + OSL_ENSURE(pImpPrMap, "Got no SvXMLImportPropertyMapper (!)"); } // pDrawingPageStyle overrides this diff --git a/xmloff/source/style/PagePropertySetContext.cxx b/xmloff/source/style/PagePropertySetContext.cxx index 583a5d14c321..601a85972fee 100644 --- a/xmloff/source/style/PagePropertySetContext.cxx +++ b/xmloff/source/style/PagePropertySetContext.cxx @@ -35,11 +35,11 @@ PagePropertySetContext::PagePropertySetContext( const Reference< xml::sax::XFastAttributeList > & xAttrList, sal_uInt32 nFam, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap, + SvXMLImportPropertyMapper* pMap, sal_Int32 nStartIndex, sal_Int32 nEndIndex, const PageContextType aTempType ) : SvXMLPropertySetContext( rImport, nElement, xAttrList, nFam, - rProps, rMap, nStartIndex, nEndIndex ) + rProps, pMap, nStartIndex, nEndIndex ) { aType = aTempType; } @@ -74,16 +74,16 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > PagePropertySetContext break; } - switch( mxMapper->getPropertySetMapper() + switch( mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex ) ) { case CTF_PM_GRAPHICURL: case CTF_PM_HEADERGRAPHICURL: case CTF_PM_FOOTERGRAPHICURL: DBG_ASSERT( rProp.mnIndex >= 2 && - nPos == mxMapper->getPropertySetMapper() + nPos == mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex-2 ) && - nFil == mxMapper->getPropertySetMapper() + nFil == mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex-1 ), "invalid property map!"); return @@ -93,7 +93,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > PagePropertySetContext rProp.mnIndex-2, rProp.mnIndex-1, -1, - mxMapper->getPropertySetMapper()->FindEntryIndex(CTF_PM_FILLBITMAPMODE), + mpMapper->getPropertySetMapper()->FindEntryIndex(CTF_PM_FILLBITMAPMODE), rProperties ); break; @@ -104,7 +104,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > PagePropertySetContext case CTF_PM_FTN_LINE_WEIGHT: return new XMLFootnoteSeparatorImport( GetImport(), nElement, rProperties, - mxMapper->getPropertySetMapper(), rProp.mnIndex); + mpMapper->getPropertySetMapper(), rProp.mnIndex); break; } diff --git a/xmloff/source/style/PagePropertySetContext.hxx b/xmloff/source/style/PagePropertySetContext.hxx index 2429dc1947ad..e059c6eb4f78 100644 --- a/xmloff/source/style/PagePropertySetContext.hxx +++ b/xmloff/source/style/PagePropertySetContext.hxx @@ -37,7 +37,7 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, sal_uInt32 nFam, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap, + SvXMLImportPropertyMapper* pMap, sal_Int32 nStartIndex, sal_Int32 nEndIndex, const PageContextType aType ); diff --git a/xmloff/source/style/StylePropertiesContext.cxx b/xmloff/source/style/StylePropertiesContext.cxx index ba64b7326e09..b815e5a16201 100644 --- a/xmloff/source/style/StylePropertiesContext.cxx +++ b/xmloff/source/style/StylePropertiesContext.cxx @@ -19,8 +19,8 @@ using namespace xmloff::token; StylePropertiesContext::StylePropertiesContext( SvXMLImport& rImport, sal_Int32 nElement, const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList, sal_uInt32 nFamily, - std::vector<XMLPropertyState>& rProps, const rtl::Reference<SvXMLImportPropertyMapper>& rMap) - : SvXMLPropertySetContext(rImport, nElement, xAttrList, nFamily, rProps, rMap) + std::vector<XMLPropertyState>& rProps, SvXMLImportPropertyMapper* pMap) + : SvXMLPropertySetContext(rImport, nElement, xAttrList, nFamily, rProps, pMap) { } diff --git a/xmloff/source/style/StylePropertiesContext.hxx b/xmloff/source/style/StylePropertiesContext.hxx index 6fa3ef8703d9..a875c1312874 100644 --- a/xmloff/source/style/StylePropertiesContext.hxx +++ b/xmloff/source/style/StylePropertiesContext.hxx @@ -17,7 +17,7 @@ public: StylePropertiesContext(SvXMLImport& rImport, sal_Int32 nElement, const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList, sal_uInt32 nFamily, std::vector<XMLPropertyState>& rProps, - const rtl::Reference<SvXMLImportPropertyMapper>& rMap); + SvXMLImportPropertyMapper* pMap); virtual ~StylePropertiesContext() override; diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index f2e8e7e94983..4386a4a8c9a9 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -206,11 +206,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLPropStyleContext::c } if( nFamily ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = mxStyles->GetImportPropertyMapper( GetFamily() ); - if (xImpPrMap.is()) + if (pImpPrMap) { - return new StylePropertiesContext(GetImport(), nElement, xAttrList, nFamily, maProperties, xImpPrMap); + return new StylePropertiesContext(GetImport(), nElement, xAttrList, nFamily, maProperties, pImpPrMap); } } XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); @@ -220,11 +220,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLPropStyleContext::c void XMLPropStyleContext::FillPropertySet( const Reference< XPropertySet > & rPropSet ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = mxStyles->GetImportPropertyMapper( GetFamily() ); - SAL_WARN_IF( !xImpPrMap.is(), "xmloff", "There is the import prop mapper" ); - if( xImpPrMap.is() ) - xImpPrMap->FillPropertySet( maProperties, rPropSet ); + SAL_WARN_IF( !pImpPrMap, "xmloff", "There is the import prop mapper" ); + if( pImpPrMap ) + pImpPrMap->FillPropertySet( maProperties, rPropSet ); } void XMLPropStyleContext::SetDefaults() @@ -255,12 +255,12 @@ Reference < XStyle > XMLPropStyleContext::Create() void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) { SvXMLStylesContext* pSvXMLStylesContext = mxStyles.get(); - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily()); - OSL_ENSURE(xImpPrMap.is(), "There is no import prop mapper"); + SvXMLImportPropertyMapper* pImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily()); + OSL_ENSURE(pImpPrMap, "There is no import prop mapper"); // need to filter out old fill definitions when the new ones are used. The new // ones are used when a FillStyle is defined - const bool bTakeCareOfDrawingLayerFillStyle(xImpPrMap.is() && GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH); + const bool bTakeCareOfDrawingLayerFillStyle(pImpPrMap && GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH); bool bDrawingLayerFillStylesUsed(false); if(bTakeCareOfDrawingLayerFillStyle) @@ -293,10 +293,10 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) Reference < XAutoStyleFamily > xAutoFamily = pSvXMLStylesContext->GetAutoStyles( GetFamily() ); if( !xAutoFamily.is() ) return; - if( xImpPrMap.is() ) + if( pImpPrMap ) { Sequence< PropertyValue > aValues; - xImpPrMap->FillPropertySequence( maProperties, aValues ); + pImpPrMap->FillPropertySequence( maProperties, aValues ); sal_Int32 nLen = aValues.getLength(); if( nLen ) @@ -390,8 +390,8 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) if( bOverwrite || bNew ) { rtl::Reference < XMLPropertySetMapper > xPrMap; - if( xImpPrMap.is() ) - xPrMap = xImpPrMap->getPropertySetMapper(); + if( pImpPrMap ) + xPrMap = pImpPrMap->getPropertySetMapper(); if( xPrMap.is() ) { Reference < XMultiPropertyStates > xMultiStates( xPropSet, diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index 2af2092378f9..ef4b2bb24513 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -71,32 +71,33 @@ SvXMLImportPropertyMapper::~SvXMLImportPropertyMapper() } void SvXMLImportPropertyMapper::ChainImportMapper( - const rtl::Reference< SvXMLImportPropertyMapper>& rMapper ) + std::unique_ptr< SvXMLImportPropertyMapper> rMapper ) { // add map entries from rMapper to current map maPropMapper->AddMapperEntry( rMapper->getPropertySetMapper() ); // rMapper uses the same map as 'this' rMapper->maPropMapper = maPropMapper; + auto pNewMapper = rMapper.get(); // set rMapper as last mapper in current chain - rtl::Reference< SvXMLImportPropertyMapper > xNext = mxNextMapper; - if( xNext.is()) + SvXMLImportPropertyMapper* pNext = mxNextMapper.get(); + if( pNext ) { - while( xNext->mxNextMapper.is()) - xNext = xNext->mxNextMapper; - xNext->mxNextMapper = rMapper; + while( pNext->mxNextMapper) + pNext = pNext->mxNextMapper.get(); + pNext->mxNextMapper = std::move(rMapper); } else - mxNextMapper = rMapper; + mxNextMapper = std::move(rMapper); // if rMapper was already chained, correct // map pointer of successors - xNext = rMapper; + pNext = pNewMapper; - while( xNext->mxNextMapper.is()) + while( pNext->mxNextMapper ) { - xNext = xNext->mxNextMapper; - xNext->maPropMapper = maPropMapper; + pNext = pNext->mxNextMapper.get(); + pNext->maPropMapper = maPropMapper; } } @@ -347,8 +348,8 @@ bool SvXMLImportPropertyMapper::handleSpecialItem( const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap ) const { - OSL_ENSURE( mxNextMapper.is(), "unsupported special item in xml import" ); - if( mxNextMapper.is() ) + OSL_ENSURE( mxNextMapper, "unsupported special item in xml import" ); + if( mxNextMapper ) return mxNextMapper->handleSpecialItem( rProperty, rProperties, rValue, rUnitConverter, rNamespaceMap ); else @@ -751,7 +752,7 @@ void SvXMLImportPropertyMapper::finished( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const { // nothing to do here - if( mxNextMapper.is() ) + if( mxNextMapper ) mxNextMapper->finished( rProperties, nStartIndex, nEndIndex ); } diff --git a/xmloff/source/style/xmlprcon.cxx b/xmloff/source/style/xmlprcon.cxx index 023a7f5b6b01..055bc986ce44 100644 --- a/xmloff/source/style/xmlprcon.cxx +++ b/xmloff/source/style/xmlprcon.cxx @@ -33,16 +33,16 @@ SvXMLPropertySetContext::SvXMLPropertySetContext( const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, sal_uInt32 nFam, std::vector< XMLPropertyState > &rProps, - rtl::Reference < SvXMLImportPropertyMapper > xMap, + SvXMLImportPropertyMapper* pMap, sal_Int32 nSIdx, sal_Int32 nEIdx ) : SvXMLImportContext( rImp ) , mnStartIdx( nSIdx ) , mnEndIdx( nEIdx ) , mnFamily( nFam ) , mrProperties( rProps ) -, mxMapper(std::move( xMap )) +, mpMapper( pMap ) { - mxMapper->importXML( mrProperties, xAttrList, + mpMapper->importXML( mrProperties, xAttrList, GetImport().GetMM100UnitConverter(), GetImport().GetNamespaceMap(), mnFamily, mnStartIdx, mnEndIdx ); @@ -57,7 +57,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SvXMLPropertySetContex const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) { rtl::Reference< XMLPropertySetMapper > aSetMapper( - mxMapper->getPropertySetMapper() ); + mpMapper->getPropertySetMapper() ); sal_Int32 nEntryIndex = aSetMapper->GetEntryIndex( nElement, mnFamily, mnStartIdx ); if( ( nEntryIndex != -1 ) && (-1 == mnEndIdx || nEntryIndex < mnEndIdx ) && diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index f1b3526ef970..1b0bdc44f2e6 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -576,87 +576,70 @@ XmlStyleFamily SvXMLStylesContext::GetFamily( std::u16string_view rValue ) return nFamily; } -rtl::Reference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportPropertyMapper( +SvXMLImportPropertyMapper* SvXMLStylesContext::GetImportPropertyMapper( XmlStyleFamily nFamily ) const { - rtl::Reference < SvXMLImportPropertyMapper > xMapper; + SvXMLImportPropertyMapper* pMapper = nullptr; + SvXMLStylesContext * pThis = const_cast<SvXMLStylesContext *>(this); switch( nFamily ) { case XmlStyleFamily::TEXT_PARAGRAPH: - if( !mxParaImpPropMapper.is() ) - { - SvXMLStylesContext * pThis = const_cast<SvXMLStylesContext *>(this); - pThis->mxParaImpPropMapper = - pThis->GetImport().GetTextImport() - ->GetParaImportPropertySetMapper(); - } - xMapper = mxParaImpPropMapper; + pMapper = + pThis->GetImport().GetTextImport() + ->GetParaImportPropertySetMapper(); break; case XmlStyleFamily::TEXT_TEXT: - if( !mxTextImpPropMapper.is() ) - { - SvXMLStylesContext * pThis = const_cast<SvXMLStylesContext *>(this); - pThis->mxTextImpPropMapper = - pThis->GetImport().GetTextImport() - ->GetTextImportPropertySetMapper(); - } - xMapper = mxTextImpPropMapper; + pMapper = + pThis->GetImport().GetTextImport() + ->GetTextImportPropertySetMapper(); break; case XmlStyleFamily::TEXT_SECTION: - // don't cache section mapper, as it's rarely used // *sigh*, cast to non-const, because this is a const method, // but SvXMLImport::GetTextImport() isn't. - xMapper = const_cast<SvXMLStylesContext*>(this)->GetImport().GetTextImport()-> - GetSectionImportPropertySetMapper(); + pMapper = pThis->GetImport().GetTextImport()-> + GetSectionImportPropertySetMapper(); break; case XmlStyleFamily::TEXT_RUBY: - // don't cache section mapper, as it's rarely used // *sigh*, cast to non-const, because this is a const method, // but SvXMLImport::GetTextImport() isn't. - xMapper = const_cast<SvXMLStylesContext*>(this)->GetImport().GetTextImport()-> + pMapper = pThis->GetImport().GetTextImport()-> GetRubyImportPropertySetMapper(); break; case XmlStyleFamily::SD_GRAPHICS_ID: case XmlStyleFamily::SD_PRESENTATION_ID: case XmlStyleFamily::SD_POOL_ID: - if(!mxShapeImpPropMapper.is()) - { - rtl::Reference< XMLShapeImportHelper > aImpHelper = const_cast<SvXMLImport&>(GetImport()).GetShapeImport(); - const_cast<SvXMLStylesContext*>(this)->mxShapeImpPropMapper = - aImpHelper->GetPropertySetMapper(); - } - xMapper = mxShapeImpPropMapper; + pMapper = const_cast<SvXMLImport&>(GetImport()).GetShapeImport()->GetPropertySetMapper(); break; #if !ENABLE_WASM_STRIP_CHART // WASM_CHART change case XmlStyleFamily::SCH_CHART_ID: - if( ! mxChartImpPropMapper.is() ) + if( ! mxChartImpPropMapper ) { XMLPropertySetMapper *const pPropMapper = new XMLChartPropertySetMapper(nullptr); - mxChartImpPropMapper = new XMLChartImportPropertyMapper( pPropMapper, GetImport() ); + mxChartImpPropMapper = std::make_unique<XMLChartImportPropertyMapper>( pPropMapper, GetImport() ); } - xMapper = mxChartImpPropMapper; + pMapper = mxChartImpPropMapper.get(); break; #endif case XmlStyleFamily::PAGE_MASTER: - if( ! mxPageImpPropMapper.is() ) + if( ! mxPageImpPropMapper ) { XMLPropertySetMapper *pPropMapper = new XMLPageMasterPropSetMapper(); mxPageImpPropMapper = - new PageMasterImportPropertyMapper( pPropMapper, + std::make_unique<PageMasterImportPropertyMapper>( pPropMapper, const_cast<SvXMLStylesContext*>(this)->GetImport() ); } - xMapper = mxPageImpPropMapper; + pMapper = mxPageImpPropMapper.get(); break; default: break; } - return xMapper; + return pMapper; } Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( XmlStyleFamily nFamily ) const diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index af7b849989eb..3982a577fa21 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -251,16 +251,16 @@ XMLTableImport::XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLP } else { - mxCellImportPropertySetMapper = new SvXMLImportPropertyMapper( xCellPropertySetMapper, rImport ); + mxCellImportPropertySetMapper = std::make_unique<SvXMLImportPropertyMapper>( xCellPropertySetMapper, rImport ); mxCellImportPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(rImport)); - mxCellImportPropertySetMapper->ChainImportMapper(new XMLCellImportPropertyMapper(new XMLPropertySetMapper(getCellPropertiesMap(), xFactoryRef, true), rImport)); + mxCellImportPropertySetMapper->ChainImportMapper(std::make_unique<XMLCellImportPropertyMapper>(new XMLPropertySetMapper(getCellPropertiesMap(), xFactoryRef, true), rImport)); } rtl::Reference < XMLPropertySetMapper > xRowMapper( new XMLPropertySetMapper( getRowPropertiesMap(), xFactoryRef, false ) ); - mxRowImportPropertySetMapper = new SvXMLImportPropertyMapper( xRowMapper, rImport ); + mxRowImportPropertySetMapper = std::make_unique<SvXMLImportPropertyMapper>( xRowMapper, rImport ); rtl::Reference < XMLPropertySetMapper > xColMapper( new XMLPropertySetMapper( getColumnPropertiesMap(), xFactoryRef, false ) ); - mxColumnImportPropertySetMapper = new SvXMLImportPropertyMapper( xColMapper, rImport ); + mxColumnImportPropertySetMapper = std::make_unique<SvXMLImportPropertyMapper>( xColMapper, rImport ); } XMLTableImport::~XMLTableImport() diff --git a/xmloff/source/text/XMLTextPropertySetContext.cxx b/xmloff/source/text/XMLTextPropertySetContext.cxx index 472001287e05..0fa11c7d9457 100644 --- a/xmloff/source/text/XMLTextPropertySetContext.cxx +++ b/xmloff/source/text/XMLTextPropertySetContext.cxx @@ -37,10 +37,10 @@ XMLTextPropertySetContext::XMLTextPropertySetContext( const Reference< xml::sax::XFastAttributeList > & xAttrList, sal_uInt32 nFamily, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap, + SvXMLImportPropertyMapper* pMap, OUString& rDCTextStyleName ) : SvXMLPropertySetContext( rImport, nElement, xAttrList, nFamily, - rProps, rMap ), + rProps, pMap ), rDropCapTextStyleName( rDCTextStyleName ) { } @@ -55,7 +55,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetCont ::std::vector< XMLPropertyState > &rProperties, const XMLPropertyState& rProp ) { - switch( mxMapper->getPropertySetMapper() + switch( mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex ) ) { case CTF_TABSTOP: @@ -76,7 +76,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetCont case CTF_DROPCAPFORMAT: { DBG_ASSERT( rProp.mnIndex >= 2 && - CTF_DROPCAPWHOLEWORD == mxMapper->getPropertySetMapper() + CTF_DROPCAPWHOLEWORD == mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex-2 ), "invalid property map!"); XMLTextDropCapImportContext *pDCContext = @@ -93,9 +93,9 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetCont case CTF_BACKGROUND_URL: { DBG_ASSERT( rProp.mnIndex >= 2 && - CTF_BACKGROUND_POS == mxMapper->getPropertySetMapper() + CTF_BACKGROUND_POS == mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex-2 ) && - CTF_BACKGROUND_FILTER == mxMapper->getPropertySetMapper() + CTF_BACKGROUND_FILTER == mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex-1 ), "invalid property map!"); @@ -104,7 +104,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetCont sal_Int32 nTranspIndex = -1; if( (rProp.mnIndex >= 3) && ( CTF_BACKGROUND_TRANSPARENCY == - mxMapper->getPropertySetMapper()->GetEntryContextId( + mpMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex-3 ) ) ) nTranspIndex = rProp.mnIndex-3; @@ -123,7 +123,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetCont case CTF_SECTION_ENDNOTE_END: return new XMLSectionFootnoteConfigImport( GetImport(), nElement, rProperties, - mxMapper->getPropertySetMapper()); + mpMapper->getPropertySetMapper()); break; } diff --git a/xmloff/source/text/XMLTextPropertySetContext.hxx b/xmloff/source/text/XMLTextPropertySetContext.hxx index 2286e773ffdd..774bdc696efc 100644 --- a/xmloff/source/text/XMLTextPropertySetContext.hxx +++ b/xmloff/source/text/XMLTextPropertySetContext.hxx @@ -34,7 +34,7 @@ public: const css::uno::Reference<css::xml::sax::XFastAttributeList >& xAttrList, sal_uInt32 nFamily, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap, + SvXMLImportPropertyMapper* pMap, OUString& rDopCapTextStyleName ); virtual ~XMLTextPropertySetContext() override; diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx index 5ce5fafe4f4f..b6462b79f8cc 100644 --- a/xmloff/source/text/XMLTextShapeStyleContext.cxx +++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx @@ -52,7 +52,7 @@ public: const Reference< XFastAttributeList >& xAttrList, sal_uInt32 nFamily, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap ); + SvXMLImportPropertyMapper* pMap ); using SvXMLPropertySetContext::createFastChildContext; virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext( @@ -69,9 +69,9 @@ XMLTextShapePropertySetContext_Impl::XMLTextShapePropertySetContext_Impl( const Reference< XFastAttributeList > & xAttrList, sal_uInt32 nFamily, ::std::vector< XMLPropertyState > &rProps, - const rtl::Reference < SvXMLImportPropertyMapper > &rMap ) : + SvXMLImportPropertyMapper* pMap ) : XMLShapePropertySetContext( rImport, nElement, xAttrList, nFamily, - rProps, rMap ) + rProps, pMap ) { } @@ -81,7 +81,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextShapePropertySe ::std::vector< XMLPropertyState > &rProperties, const XMLPropertyState& rProp ) { - switch( mxMapper->getPropertySetMapper() + switch( mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex ) ) { case CTF_TEXTCOLUMNS: @@ -96,11 +96,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextShapePropertySe case CTF_BACKGROUND_URL: DBG_ASSERT( rProp.mnIndex >= 3 && CTF_BACKGROUND_TRANSPARENCY == - mxMapper->getPropertySetMapper() + mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex-3 ) && - CTF_BACKGROUND_POS == mxMapper->getPropertySetMapper() + CTF_BACKGROUND_POS == mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex-2 ) && - CTF_BACKGROUND_FILTER == mxMapper->getPropertySetMapper() + CTF_BACKGROUND_FILTER == mpMapper->getPropertySetMapper() ->GetEntryContextId( rProp.mnIndex-1 ), "invalid property map!"); return @@ -164,13 +164,13 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextShapeStyleConte nFamily = XML_TYPE_PROP_GRAPHIC; if( nFamily ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) + if( pImpPrMap ) { return new XMLTextShapePropertySetContext_Impl( GetImport(), nElement, xAttrList, nFamily, - GetProperties(), xImpPrMap ); + GetProperties(), pImpPrMap ); } } } diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 35ceb8d2898e..3357c3e66527 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -97,11 +97,11 @@ struct XMLTextImportHelper::Impl rtl::Reference<SvXMLStylesContext> m_xAutoStyles; - rtl::Reference< SvXMLImportPropertyMapper > m_xParaImpPrMap; - rtl::Reference< SvXMLImportPropertyMapper > m_xTextImpPrMap; - rtl::Reference< SvXMLImportPropertyMapper > m_xFrameImpPrMap; - rtl::Reference< SvXMLImportPropertyMapper > m_xSectionImpPrMap; - rtl::Reference< SvXMLImportPropertyMapper > m_xRubyImpPrMap; + std::unique_ptr< SvXMLImportPropertyMapper > m_xParaImpPrMap; + std::unique_ptr< SvXMLImportPropertyMapper > m_xTextImpPrMap; + std::unique_ptr< SvXMLImportPropertyMapper > m_xFrameImpPrMap; + std::unique_ptr< SvXMLImportPropertyMapper > m_xSectionImpPrMap; + std::unique_ptr< SvXMLImportPropertyMapper > m_xRubyImpPrMap; std::unique_ptr<SvI18NMap> m_xRenameMap; @@ -288,28 +288,28 @@ XMLTextImportHelper::GetChapterNumbering() const return m_xImpl->m_xChapterNumbering; } -rtl::Reference< SvXMLImportPropertyMapper > const& +SvXMLImportPropertyMapper* XMLTextImportHelper::GetParaImportPropertySetMapper() const { - return m_xImpl->m_xParaImpPrMap; + return m_xImpl->m_xParaImpPrMap.get(); } -rtl::Reference< SvXMLImportPropertyMapper > const& +SvXMLImportPropertyMapper* XMLTextImportHelper::GetTextImportPropertySetMapper() const { - return m_xImpl->m_xTextImpPrMap; + return m_xImpl->m_xTextImpPrMap.get(); } -rtl::Reference< SvXMLImportPropertyMapper > const& +SvXMLImportPropertyMapper* XMLTextImportHelper::GetSectionImportPropertySetMapper() const { - return m_xImpl->m_xSectionImpPrMap; + return m_xImpl->m_xSectionImpPrMap.get(); } -rtl::Reference< SvXMLImportPropertyMapper > const& +SvXMLImportPropertyMapper* XMLTextImportHelper::GetRubyImportPropertySetMapper() const { - return m_xImpl->m_xRubyImpPrMap; + return m_xImpl->m_xRubyImpPrMap.get(); } void XMLTextImportHelper::SetInsideDeleteContext(bool const bNew) @@ -518,23 +518,23 @@ XMLTextImportHelper::XMLTextImportHelper( XMLPropertySetMapper *pPropMapper = new XMLTextPropertySetMapper( TextPropMap::PARA, false ); m_xImpl->m_xParaImpPrMap = - new XMLTextImportPropertyMapper( pPropMapper, rImport ); + std::make_unique<XMLTextImportPropertyMapper>( pPropMapper, rImport ); pPropMapper = new XMLTextPropertySetMapper( TextPropMap::TEXT, false ); m_xImpl->m_xTextImpPrMap = - new XMLTextImportPropertyMapper( pPropMapper, rImport ); + std::make_unique<XMLTextImportPropertyMapper>( pPropMapper, rImport ); pPropMapper = new XMLTextPropertySetMapper( TextPropMap::FRAME, false ); m_xImpl->m_xFrameImpPrMap = - new XMLTextImportPropertyMapper( pPropMapper, rImport ); + std::make_unique<XMLTextImportPropertyMapper>( pPropMapper, rImport ); pPropMapper = new XMLTextPropertySetMapper( TextPropMap::SECTION, false ); m_xImpl->m_xSectionImpPrMap = - new XMLTextImportPropertyMapper( pPropMapper, rImport ); + std::make_unique<XMLTextImportPropertyMapper>( pPropMapper, rImport ); pPropMapper = new XMLTextPropertySetMapper( TextPropMap::RUBY, false ); m_xImpl->m_xRubyImpPrMap = - new SvXMLImportPropertyMapper( pPropMapper, rImport ); + std::make_unique<SvXMLImportPropertyMapper>( pPropMapper, rImport ); } XMLTextImportHelper::~XMLTextImportHelper() @@ -547,67 +547,67 @@ void XMLTextImportHelper::dispose() m_xImpl->m_xAutoStyles->dispose(); } -SvXMLImportPropertyMapper *XMLTextImportHelper::CreateShapeExtPropMapper(SvXMLImport& rImport) +std::unique_ptr<SvXMLImportPropertyMapper> XMLTextImportHelper::CreateShapeExtPropMapper(SvXMLImport& rImport) { XMLPropertySetMapper *pPropMapper = new XMLTextPropertySetMapper( TextPropMap::FRAME, false ); - return new XMLTextImportPropertyMapper( pPropMapper, rImport ); + return std::make_unique<XMLTextImportPropertyMapper>( pPropMapper, rImport ); } -SvXMLImportPropertyMapper *XMLTextImportHelper::CreateParaExtPropMapper(SvXMLImport& rImport) +std::unique_ptr<SvXMLImportPropertyMapper> XMLTextImportHelper::CreateParaExtPropMapper(SvXMLImport& rImport) { XMLPropertySetMapper *pPropMapper = new XMLTextPropertySetMapper( TextPropMap::SHAPE_PARA, false ); - return new XMLTextImportPropertyMapper( pPropMapper, rImport ); + return std::make_unique<XMLTextImportPropertyMapper>( pPropMapper, rImport ); } -SvXMLImportPropertyMapper *XMLTextImportHelper::CreateParaDefaultExtPropMapper(SvXMLImport& rImport) +std::unique_ptr<SvXMLImportPropertyMapper> XMLTextImportHelper::CreateParaDefaultExtPropMapper(SvXMLImport& rImport) { XMLPropertySetMapper* pPropMapper = new XMLTextPropertySetMapper( TextPropMap::SHAPE_PARA, false ); - SvXMLImportPropertyMapper* pImportMapper = new XMLTextImportPropertyMapper( pPropMapper, rImport ); + std::unique_ptr<SvXMLImportPropertyMapper> pImportMapper(new XMLTextImportPropertyMapper( pPropMapper, rImport )); pPropMapper = new XMLTextPropertySetMapper( TextPropMap::TEXT_ADDITIONAL_DEFAULTS, false ); - pImportMapper->ChainImportMapper( new XMLTextImportPropertyMapper( pPropMapper, rImport ) ); + pImportMapper->ChainImportMapper( std::make_unique<XMLTextImportPropertyMapper>( pPropMapper, rImport ) ); return pImportMapper; } -SvXMLImportPropertyMapper* +std::unique_ptr<SvXMLImportPropertyMapper> XMLTextImportHelper::CreateTableDefaultExtPropMapper( SvXMLImport& rImport ) { XMLPropertySetMapper *pPropMapper = new XMLTextPropertySetMapper( TextPropMap::TABLE_DEFAULTS, false ); - return new SvXMLImportPropertyMapper( pPropMapper, rImport ); + return std::make_unique<SvXMLImportPropertyMapper>( pPropMapper, rImport ); } -SvXMLImportPropertyMapper* +std::unique_ptr<SvXMLImportPropertyMapper> XMLTextImportHelper::CreateTableRowDefaultExtPropMapper( SvXMLImport& rImport ) { XMLPropertySetMapper *pPropMapper = new XMLTextPropertySetMapper( TextPropMap::TABLE_ROW_DEFAULTS, false ); - return new SvXMLImportPropertyMapper( pPropMapper, rImport ); + return std::make_unique<SvXMLImportPropertyMapper>( pPropMapper, rImport ); } -SvXMLImportPropertyMapper* +std::unique_ptr<SvXMLImportPropertyMapper> XMLTextImportHelper::CreateTableCellExtPropMapper( SvXMLImport& rImport ) { XMLPropertySetMapper *pPropMapper = new XMLTextPropertySetMapper( TextPropMap::CELL, false ); - return new XMLTextImportPropertyMapper( pPropMapper, rImport ); + return std::make_unique<XMLTextImportPropertyMapper>( pPropMapper, rImport ); } -SvXMLImportPropertyMapper* +std::unique_ptr<SvXMLImportPropertyMapper> XMLTextImportHelper::CreateDrawingPageExtPropMapper(SvXMLImport& rImport) { rtl::Reference<XMLPropertyHandlerFactory> const pFactory(new XMLPageMasterPropHdlFactory); XMLPropertySetMapper *const pPropMapper( new XMLPropertySetMapper(g_XMLPageMasterDrawingPageStyleMap, pFactory, false)); - return new SvXMLImportPropertyMapper(pPropMapper, rImport); + return std::make_unique<SvXMLImportPropertyMapper>(pPropMapper, rImport); } void XMLTextImportHelper::SetCursor( const Reference < XTextCursor > & rCursor ) @@ -843,12 +843,12 @@ OUString XMLTextImportHelper::ConvertStarFonts( const OUString& rChars, sal_Int32 nCount = pStyle->GetProperties_().size(); if( nCount ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = m_xImpl->m_xAutoStyles->GetImportPropertyMapper(nFamily); - if( xImpPrMap.is() ) + if( pImpPrMap ) { rtl::Reference<XMLPropertySetMapper> rPropMapper = - xImpPrMap->getPropertySetMapper(); + pImpPrMap->getPropertySetMapper(); for( sal_Int32 i=0; i < nCount; i++ ) { const XMLPropertyState& rProp = pStyle->GetProperties_()[i]; diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index 055693d1c071..97a39a4c6914 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -165,13 +165,13 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextStyleContext::c nFamily = XML_TYPE_PROP_TABLE_ROW; if( nFamily ) { - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = + SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) + if( pImpPrMap ) return new XMLTextPropertySetContext( GetImport(), nElement, xAttrList, nFamily, GetProperties(), - xImpPrMap, + pImpPrMap, m_sDropCapTextStyleName); } } @@ -380,10 +380,10 @@ void XMLTextStyleContext::FillPropertySet( // imitate XMLPropStyleContext::FillPropertySet(...) SvXMLStylesContext* pSvXMLStylesContext = GetStyles(); - rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily()); - DBG_ASSERT(xImpPrMap.is(),"Where is the import prop mapper?"); + SvXMLImportPropertyMapper* pImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily()); + DBG_ASSERT(pImpPrMap,"Where is the import prop mapper?"); - if(!xImpPrMap.is()) + if(!pImpPrMap) return; // imitate SvXMLImportPropertyMapper::FillPropertySet(...) @@ -464,11 +464,11 @@ void XMLTextStyleContext::FillPropertySet( if( bAutomatic ) { - xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs ); + pImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs ); } else { - xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs ); + pImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs ); } sal_Int32 nIndex = aContextIDs[0].nIndex; @@ -558,7 +558,7 @@ void XMLTextStyleContext::FillPropertySet( { if(!rPropMapper.is()) { - rPropMapper = xImpPrMap->getPropertySetMapper(); + rPropMapper = pImpPrMap->getPropertySetMapper(); } // set property -e ... etc. - the rest is truncated
