diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-05 14:29:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-10 12:31:43 +0200 |
commit | 0fb5ca6cc9cc55a4436a36c533461769b1fc8526 (patch) | |
tree | 30e21bfcb0a6ad46f52a4e664728753c03d7a837 | |
parent | 1a33947a91685808fd5f6d4903b6ae896686066d (diff) |
tdf#79877 perf loading docx file, writerfilter/ improvements
this improves load time by 20%.
We switch from shared_ptr to tools::SvRef to manage the objects
I noticed some double inheritance like this:
DomainMapper
LoggedProperties
Properties
SvRefBase
LoggedTable
Table
SvRefBase
so to be safe I made all the ref-count-base-class inheritance
virtual.
Change-Id: Ia3de9733f5c6966e8171f43d083dcc087040b8cd
Reviewed-on: https://gerrit.libreoffice.org/57022
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
78 files changed, 655 insertions, 720 deletions
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx index 68a1c3f56f09..62ac4952c6dc 100644 --- a/include/tools/ref.hxx +++ b/include/tools/ref.hxx @@ -130,11 +130,9 @@ protected: public: SvRefBase() : nRefCount(0), bNoDelete(1) {} - SvRefBase(const SvRefBase &) : nRefCount(0), bNoDelete(1) {} - SvRefBase & operator = ( const SvRefBase & ) - { return *this; } + SvRefBase & operator=(const SvRefBase &) { return *this; } void RestoreNoDelete() { bNoDelete = 1; } diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk index e6487f4b51e4..26fad1da3633 100644 --- a/writerfilter/Library_writerfilter.mk +++ b/writerfilter/Library_writerfilter.mk @@ -44,6 +44,7 @@ $(eval $(call gb_Library_use_libraries,writerfilter,\ msfilter \ oox \ sal \ + salhelper \ sax \ sfx \ sot \ diff --git a/writerfilter/inc/dmapper/resourcemodel.hxx b/writerfilter/inc/dmapper/resourcemodel.hxx index 116b4192d9be..b2caa3ad97fa 100644 --- a/writerfilter/inc/dmapper/resourcemodel.hxx +++ b/writerfilter/inc/dmapper/resourcemodel.hxx @@ -25,6 +25,8 @@ #include <sal/types.h> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/uno/Any.hxx> +#include <tools/ref.hxx> + /** @file resourcemodel.hxx @@ -76,7 +78,7 @@ namespace writerfilter { */ template <class T> -class SAL_DLLPUBLIC_TEMPLATE Reference +class SAL_DLLPUBLIC_TEMPLATE Reference : public virtual SvRefBase { public: /** @@ -85,7 +87,7 @@ public: @attention The ownership of a reference is transferred when the reference is passed. */ - typedef std::shared_ptr< Reference<T> > Pointer_t; + typedef tools::SvRef< Reference<T> > Pointer_t; /** Resolves the reference. @@ -98,7 +100,7 @@ public: virtual void resolve(T & rHandler) = 0; protected: - ~Reference() {} + ~Reference() override {} }; class Value; @@ -107,7 +109,7 @@ class Sprm; /** Handler for properties. */ -class Properties +class Properties : public virtual SvRefBase { public: /** @@ -126,16 +128,16 @@ public: virtual void sprm(Sprm & sprm) = 0; protected: - ~Properties() {} + ~Properties() override {} }; /** Handler for tables. */ -class Table +class Table : public virtual SvRefBase { public: - typedef std::shared_ptr<Table> Pointer_t; + typedef tools::SvRef<Table> Pointer_t; /** Receives an entry of the table. @@ -146,7 +148,7 @@ public: virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) = 0; protected: - ~Table() {} + ~Table() override {} }; /** @@ -176,14 +178,14 @@ const sal_uInt8 cFieldEnd = 0x15; /** Handler for a stream. */ -class Stream +class Stream : public virtual SvRefBase { public: /** Pointer to this stream. */ - typedef std::shared_ptr<Stream> Pointer_t; + typedef tools::SvRef<Stream> Pointer_t; /** Receives start mark for group with the same section properties. @@ -298,7 +300,7 @@ public: virtual void endGlossaryEntry() = 0; protected: - ~Stream() {} + ~Stream() override {} }; /** @@ -308,15 +310,13 @@ protected: makes no sense for a certain value, e.g. the integer value of a string. */ -class Value +class Value : public virtual SvRefBase { public: /** Pointer to a value. */ - typedef std::unique_ptr<Value> Pointer_t; - - virtual ~Value() {} + typedef tools::SvRef<Value> Pointer_t; /** Returns integer representation of the value. @@ -355,10 +355,10 @@ public: An SPRM: Section, Paragraph and Run Modifier */ -class Sprm +class Sprm : public virtual SvRefBase { public: - typedef std::unique_ptr<Sprm> Pointer_t; + typedef tools::SvRef<Sprm> Pointer_t; /** Returns id of the SPRM. @@ -391,7 +391,7 @@ public: #endif protected: - ~Sprm() {} + ~Sprm() override {} }; typedef sal_Int32 Token_t; diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx index 909a5491b59a..124368ee0bc1 100644 --- a/writerfilter/inc/ooxml/OOXMLDocument.hxx +++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx @@ -71,14 +71,12 @@ namespace writerfilter { namespace ooxml { -class OOXMLStream +class OOXMLStream : public virtual SvRefBase { public: enum StreamType_t { UNKNOWN, DOCUMENT, STYLES, WEBSETTINGS, FONTTABLE, NUMBERING, FOOTNOTES, ENDNOTES, COMMENTS, THEME, CUSTOMXML, CUSTOMXMLPROPS, GLOSSARY, CHARTS, EMBEDDINGS, SETTINGS, VBAPROJECT, FOOTER, HEADER, VBADATA }; - typedef std::shared_ptr<OOXMLStream> Pointer_t; - - virtual ~OOXMLStream() {} + typedef tools::SvRef<OOXMLStream> Pointer_t; /** Returns fast parser for this stream. @@ -114,9 +112,7 @@ public: /** Pointer to this stream. */ - typedef std::shared_ptr<OOXMLDocument> Pointer_t; - - virtual ~OOXMLDocument() {} + typedef tools::SvRef<OOXMLDocument> Pointer_t; /** Resolves this document to a stream handler. diff --git a/writerfilter/inc/ooxml/QNameToString.hxx b/writerfilter/inc/ooxml/QNameToString.hxx index 7e6a0b9ec4e2..3508a5f4229e 100644 --- a/writerfilter/inc/ooxml/QNameToString.hxx +++ b/writerfilter/inc/ooxml/QNameToString.hxx @@ -29,9 +29,9 @@ namespace writerfilter { -class QNameToString +class QNameToString : public virtual SvRefBase { - typedef std::shared_ptr<QNameToString> Pointer_t; + typedef tools::SvRef<QNameToString> Pointer_t; typedef std::map < Id, std::string > Map; static Pointer_t pInstance; diff --git a/writerfilter/inc/rtftok/RTFDocument.hxx b/writerfilter/inc/rtftok/RTFDocument.hxx index f35d337413db..55b1fbee3f4a 100644 --- a/writerfilter/inc/rtftok/RTFDocument.hxx +++ b/writerfilter/inc/rtftok/RTFDocument.hxx @@ -26,9 +26,7 @@ class RTFDocument : public writerfilter::Reference<Stream> { public: /// Pointer to this stream. - using Pointer_t = std::shared_ptr<RTFDocument>; - - virtual ~RTFDocument() = default; + using Pointer_t = tools::SvRef<RTFDocument>; /// Resolves this document to a stream handler. void resolve(Stream& rHandler) override = 0; diff --git a/writerfilter/source/dmapper/BorderHandler.hxx b/writerfilter/source/dmapper/BorderHandler.hxx index a51bdff52f09..3e7a120c3907 100644 --- a/writerfilter/source/dmapper/BorderHandler.hxx +++ b/writerfilter/source/dmapper/BorderHandler.hxx @@ -67,7 +67,7 @@ public: explicit BorderHandler( bool bOOXML ); virtual ~BorderHandler() override; - ::std::shared_ptr<PropertyMap> getProperties(); + ::tools::SvRef<PropertyMap> getProperties(); css::table::BorderLine2 getBorderLine(); sal_Int32 getLineDistance() const { return m_nLineDistance;} bool getShadow() { return m_bShadow;} diff --git a/writerfilter/source/dmapper/CellColorHandler.hxx b/writerfilter/source/dmapper/CellColorHandler.hxx index 8392a3d32d44..7a1d0e1cd643 100644 --- a/writerfilter/source/dmapper/CellColorHandler.hxx +++ b/writerfilter/source/dmapper/CellColorHandler.hxx @@ -53,7 +53,7 @@ public: CellColorHandler( ); virtual ~CellColorHandler() override; - ::std::shared_ptr<TablePropertyMap> getProperties(); + ::tools::SvRef<TablePropertyMap> getProperties(); void setOutputFormat( OutputFormat format ) { m_OutputFormat = format; } diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index a11e47a01eb7..ce3508f4a90c 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1391,7 +1391,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) pCellColorHandler->enableInteropGrabBag( "TempShdPropsGrabBag" ); pProperties->resolve(*pCellColorHandler); - rContext->InsertProps(pCellColorHandler->getProperties()); + rContext->InsertProps(pCellColorHandler->getProperties().get()); rContext->Insert(PROP_CHAR_THEME_FILL, pCellColorHandler->getInteropGrabBag().Value, true, PARA_GRAB_BAG); if(bEnableTempGrabBag) @@ -1759,7 +1759,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) std::shared_ptr<CellColorHandler> pCellColorHandler( new CellColorHandler ); pCellColorHandler->setOutputFormat( CellColorHandler::Character ); pProperties->resolve(*pCellColorHandler); - rContext->InsertProps(pCellColorHandler->getProperties()); + rContext->InsertProps(pCellColorHandler->getProperties().get()); m_pImpl->GetTopContext()->Insert(PROP_CHAR_SHADING_MARKER, uno::makeAny(true), true, CHAR_GRAB_BAG ); } break; @@ -2021,7 +2021,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) if( pProperties.get()) { - std::shared_ptr< SectionColumnHandler > pSectHdl( new SectionColumnHandler ); + tools::SvRef< SectionColumnHandler > pSectHdl( new SectionColumnHandler ); pProperties->resolve(*pSectHdl); if(pSectionContext && !m_pImpl->isInIndexContext()) { @@ -2081,7 +2081,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get( ) && pSectionContext ) { - std::shared_ptr< PageBordersHandler > pHandler( new PageBordersHandler ); + tools::SvRef< PageBordersHandler > pHandler( new PageBordersHandler ); pProperties->resolve( *pHandler ); // Set the borders to the context and apply them to the styles @@ -2613,7 +2613,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_stylisticSets_stylisticSets: case NS_ooxml::LN_cntxtAlts_cntxtAlts: { - std::shared_ptr<TextEffectsHandler> pTextEffectsHandlerPtr( new TextEffectsHandler(nSprmId) ); + tools::SvRef<TextEffectsHandler> pTextEffectsHandlerPtr( new TextEffectsHandler(nSprmId) ); boost::optional<PropertyIds> aPropertyId = pTextEffectsHandlerPtr->getGrabBagPropertyId(); if(aPropertyId) { @@ -3033,7 +3033,7 @@ void DomainMapper::PopStyleSheetProperties( bool bAffectTableMngr ) } } -void DomainMapper::PushListProperties( const ::std::shared_ptr<PropertyMap>& pListProperties ) +void DomainMapper::PushListProperties( const ::tools::SvRef<PropertyMap>& pListProperties ) { m_pImpl->PushListProperties( pListProperties ); } @@ -3151,7 +3151,7 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, size_t len) else { if (pContext == nullptr) - pContext.reset(new PropertyMap()); + pContext = new PropertyMap(); m_pImpl->appendTextPortion( sText, pContext ); } @@ -3411,7 +3411,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) else { if (pContext == nullptr) - pContext.reset(new PropertyMap()); + pContext = new PropertyMap(); m_pImpl->appendTextPortion( sText, pContext ); } @@ -3490,7 +3490,7 @@ void DomainMapper::lcl_endGlossaryEntry() m_pImpl->appendGlossaryEntry(); } -void DomainMapper::handleUnderlineType(const Id nId, const ::std::shared_ptr<PropertyMap>& rContext) +void DomainMapper::handleUnderlineType(const Id nId, const ::tools::SvRef<PropertyMap>& rContext) { sal_Int16 nUnderline = awt::FontUnderline::NONE; @@ -3554,7 +3554,7 @@ void DomainMapper::handleUnderlineType(const Id nId, const ::std::shared_ptr<Pro rContext->Insert(PROP_CHAR_UNDERLINE, uno::makeAny(nUnderline)); } -void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::std::shared_ptr<PropertyMap>& rContext, const bool bExchangeLeftRight) +void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::tools::SvRef<PropertyMap>& rContext, const bool bExchangeLeftRight) { style::ParagraphAdjust nAdjust = style::ParagraphAdjust_LEFT; style::ParagraphAdjust nLastLineAdjust = style::ParagraphAdjust_LEFT; diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx index 18c61cfa9693..b245bb000228 100644 --- a/writerfilter/source/dmapper/DomainMapper.hxx +++ b/writerfilter/source/dmapper/DomainMapper.hxx @@ -86,12 +86,12 @@ public: virtual void data(const sal_uInt8* buf, size_t len, writerfilter::Reference<Properties>::Pointer_t ref) override; - void sprmWithProps( Sprm& sprm, const ::std::shared_ptr<PropertyMap>& pContext ); + void sprmWithProps( Sprm& sprm, const ::tools::SvRef<PropertyMap>& pContext ); - void PushStyleSheetProperties( const ::std::shared_ptr<PropertyMap>& pStyleProperties, bool bAffectTableMngr = false ); + void PushStyleSheetProperties( const ::tools::SvRef<PropertyMap>& pStyleProperties, bool bAffectTableMngr = false ); void PopStyleSheetProperties( bool bAffectTableMngr = false ); - void PushListProperties( const ::std::shared_ptr<PropertyMap>& pListProperties ); + void PushListProperties( const ::tools::SvRef<PropertyMap>& pListProperties ); void PopListProperties(); bool IsOOXMLImport() const; @@ -100,7 +100,7 @@ public: css::uno::Reference<css::text::XTextRange> GetCurrentTextRange(); OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ); - std::shared_ptr< StyleSheetTable > const & GetStyleSheetTable( ); + tools::SvRef< StyleSheetTable > const & GetStyleSheetTable( ); GraphicZOrderHelper* graphicZOrderHelper(); GraphicNamingHelper& GetGraphicNamingHelper(); @@ -156,8 +156,8 @@ private: // Table virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) override; - static void handleUnderlineType(const Id nId, const ::std::shared_ptr<PropertyMap>& rContext); - void handleParaJustification(const sal_Int32 nIntValue, const ::std::shared_ptr<PropertyMap>& rContext, const bool bExchangeLeftRight); + static void handleUnderlineType(const Id nId, const ::tools::SvRef<PropertyMap>& rContext); + void handleParaJustification(const sal_Int32 nIntValue, const ::tools::SvRef<PropertyMap>& rContext, const bool bExchangeLeftRight); static bool getColorFromId(const Id, sal_Int32 &nColor); static sal_Int16 getEmphasisValue(const sal_Int32 nIntValue); static OUString getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix = true); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 287028cff621..443d44bbd40a 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -96,7 +96,7 @@ PropertyMapPtr lcl_SearchParentStyleSheetAndMergeProperties(const StyleSheetEntr } else { - pRet.reset( new PropertyMap ); + pRet = new PropertyMap; } if (pRet) @@ -382,7 +382,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo if( pStyleSheet ) { // First get the style properties, then the table ones - PropertyMapPtr pTableProps( m_aTableProperties ); + PropertyMapPtr pTableProps( m_aTableProperties.get() ); TablePropertyMapPtr pEmptyProps( new TablePropertyMap ); m_aTableProperties = pEmptyProps; @@ -443,7 +443,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo } // Set the table default attributes for the cells - rInfo.pTableDefaults->InsertProps(m_aTableProperties); + rInfo.pTableDefaults->InsertProps(m_aTableProperties.get()); #ifdef DEBUG_WRITERFILTER TagLogger::getInstance().startElement("TableDefaults"); @@ -491,17 +491,17 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo table::TableBorder aTableBorder; table::BorderLine2 aBorderLine, aLeftBorder; - if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_TOP_BORDER, rInfo, aBorderLine)) + if (lcl_extractTableBorderProperty(m_aTableProperties.get(), PROP_TOP_BORDER, rInfo, aBorderLine)) { aTableBorder.TopLine = aBorderLine; aTableBorder.IsTopLineValid = true; } - if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_BOTTOM_BORDER, rInfo, aBorderLine)) + if (lcl_extractTableBorderProperty(m_aTableProperties.get(), PROP_BOTTOM_BORDER, rInfo, aBorderLine)) { aTableBorder.BottomLine = aBorderLine; aTableBorder.IsBottomLineValid = true; } - if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_LEFT_BORDER, rInfo, aLeftBorder)) + if (lcl_extractTableBorderProperty(m_aTableProperties.get(), PROP_LEFT_BORDER, rInfo, aLeftBorder)) { aTableBorder.LeftLine = aLeftBorder; aTableBorder.IsLeftLineValid = true; @@ -514,17 +514,17 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo lcl_DecrementHoriOrientPosition(rFrameProperties, aLeftBorder.LineWidth * 0.5); } } - if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_RIGHT_BORDER, rInfo, aBorderLine)) + if (lcl_extractTableBorderProperty(m_aTableProperties.get(), PROP_RIGHT_BORDER, rInfo, aBorderLine)) { aTableBorder.RightLine = aBorderLine; aTableBorder.IsRightLineValid = true; } - if (lcl_extractTableBorderProperty(m_aTableProperties, META_PROP_HORIZONTAL_BORDER, rInfo, aBorderLine)) + if (lcl_extractTableBorderProperty(m_aTableProperties.get(), META_PROP_HORIZONTAL_BORDER, rInfo, aBorderLine)) { aTableBorder.HorizontalLine = aBorderLine; aTableBorder.IsHorizontalLineValid = true; } - if (lcl_extractTableBorderProperty(m_aTableProperties, META_PROP_VERTICAL_BORDER, rInfo, aBorderLine)) + if (lcl_extractTableBorderProperty(m_aTableProperties.get(), META_PROP_VERTICAL_BORDER, rInfo, aBorderLine)) { aTableBorder.VerticalLine = aBorderLine; aTableBorder.IsVerticalLineValid = true; @@ -1170,7 +1170,7 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab m_rDMapper_Impl.m_bConvertedTable = true; } - m_aTableProperties.reset(); + m_aTableProperties.clear(); m_aCellProperties.clear(); m_aRowProperties.clear(); m_bHadFootOrEndnote = false; @@ -1183,7 +1183,7 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab void DomainMapperTableHandler::startRow(const TablePropertyMapPtr& pProps) { - m_aRowProperties.push_back( pProps ); + m_aRowProperties.push_back( pProps.get() ); m_aCellProperties.emplace_back( ); #ifdef DEBUG_WRITERFILTER @@ -1208,13 +1208,13 @@ void DomainMapperTableHandler::startCell(const css::uno::Reference< css::text::X { sal_uInt32 nRow = m_aRowProperties.size(); if ( pProps.get( ) ) - m_aCellProperties[nRow - 1].push_back( pProps ); + m_aCellProperties[nRow - 1].push_back( pProps.get() ); else { // Adding an empty cell properties map to be able to get // the table defaults properties TablePropertyMapPtr pEmptyProps( new TablePropertyMap( ) ); - m_aCellProperties[nRow - 1].push_back( pEmptyProps ); + m_aCellProperties[nRow - 1].push_back( pEmptyProps.get() ); } #ifdef DEBUG_WRITERFILTER diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx index 814566e3bfd8..78517b3f9919 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx @@ -57,7 +57,7 @@ struct HorizontallyMergedCell }; /// Class to handle events generated by TableManager::resolveCurrentTable(). -class DomainMapperTableHandler final +class DomainMapperTableHandler final : public virtual SvRefBase { css::uno::Reference<css::text::XTextAppendAndConvert> m_xText; DomainMapper_Impl& m_rDMapper_Impl; @@ -78,11 +78,11 @@ class DomainMapperTableHandler final css::uno::Sequence<css::beans::PropertyValues> endTableGetRowProperties(); public: - typedef std::shared_ptr<DomainMapperTableHandler> Pointer_t; + typedef tools::SvRef<DomainMapperTableHandler> Pointer_t; DomainMapperTableHandler(css::uno::Reference<css::text::XTextAppendAndConvert> const& xText, DomainMapper_Impl& rDMapper_Impl); - ~DomainMapperTableHandler(); + ~DomainMapperTableHandler() override; /** Handle start of table. diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 613282e39683..5b105402d1a5 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -338,7 +338,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) if ( !pHandler ) { m_aTmpPosition.pop_back(); - pHandler.reset( new TablePositionHandler ); + pHandler = new TablePositionHandler; m_aTmpPosition.push_back( pHandler ); } pProperties->resolve(*m_aTmpPosition.back()); @@ -486,7 +486,7 @@ void DomainMapperTableManager::endLevel( ) TableManager::endLevel( ); #ifdef DEBUG_WRITERFILTER TagLogger::getInstance().startElement("dmappertablemanager.endLevel"); - PropertyMapPtr pProps = getTableProps(); + PropertyMapPtr pProps = getTableProps().get(); if (pProps.get() != nullptr) getTableProps()->dumpXml(); @@ -553,7 +553,7 @@ void DomainMapperTableManager::endOfRowAction() // Push the tmp position now that we compared it m_aTablePositions.pop_back(); m_aTablePositions.push_back( pTmpPosition ); - m_aTmpPosition.back().reset( ); + m_aTmpPosition.back().clear( ); IntVectorPtr pTableGrid = getCurrentGrid( ); @@ -760,7 +760,7 @@ void DomainMapperTableManager::clearData() { m_nRow = m_nHeaderRepeat = m_nTableWidth = m_nLayoutType = 0; m_sTableStyleName.clear(); - m_pTableStyleTextProperies.reset(); + m_pTableStyleTextProperies.clear(); } }} diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx index 538fa94cc4d2..48c5f8fee3ea 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx @@ -107,7 +107,7 @@ public: virtual void cellProps(const TablePropertyMapPtr& pProps) override { if ( m_pStyleProps.get( ) ) - m_pStyleProps->InsertProps(pProps); + m_pStyleProps->InsertProps(pProps.get()); else TableManager::cellProps( pProps ); }; @@ -115,7 +115,7 @@ public: virtual void cellPropsByCell(unsigned int i, const TablePropertyMapPtr& pProps) override { if ( m_pStyleProps.get( ) ) - m_pStyleProps->InsertProps(pProps); + m_pStyleProps->InsertProps(pProps.get()); else TableManager::cellPropsByCell( i, pProps ); }; @@ -123,7 +123,7 @@ public: virtual void insertRowProps(const TablePropertyMapPtr& pProps) override { if ( m_pStyleProps.get( ) ) - m_pStyleProps->InsertProps(pProps); + m_pStyleProps->InsertProps(pProps.get()); else TableManager::insertRowProps( pProps ); }; @@ -131,9 +131,9 @@ public: virtual void insertTableProps(const TablePropertyMapPtr& pProps) override { if ( m_pStyleProps.get( ) ) - m_pStyleProps->InsertProps(pProps); + m_pStyleProps->InsertProps(pProps.get()); else - m_aTmpTableProperties.back()->InsertProps(pProps); + m_aTmpTableProperties.back()->InsertProps(pProps.get()); }; bool IsRowSizeTypeInserted() const diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8b772f7577a9..8b1462b7b527 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -267,14 +267,13 @@ DomainMapper_Impl::DomainMapper_Impl( //todo: does it make sense to set the body text as static text interface? uno::Reference< text::XTextAppendAndConvert > xBodyTextAppendAndConvert( m_xBodyText, uno::UNO_QUERY ); - m_pTableHandler.reset - (new DomainMapperTableHandler(xBodyTextAppendAndConvert, *this)); + m_pTableHandler = new DomainMapperTableHandler(xBodyTextAppendAndConvert, *this); getTableManager( ).setHandler(m_pTableHandler); getTableManager( ).startLevel(); m_bUsingEnhancedFields = !utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Filter::Microsoft::Import::ImportWWFieldsAsEnhancedFields::get(m_xComponentContext); - m_pSdtHelper.reset(new SdtHelper(*this)); + m_pSdtHelper = new SdtHelper(*this); m_aRedlines.push(std::vector<RedlineParamsPtr>()); } @@ -578,7 +577,7 @@ void DomainMapper_Impl::PopProperties(ContextType eId) else { // OSL_ENSURE(eId == CONTEXT_SECTION, "this should happen at a section context end"); - m_pTopContext.reset(); + m_pTopContext.clear(); } } @@ -699,8 +698,8 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId) ListsManager::Pointer const & DomainMapper_Impl::GetListTable() { if(!m_pListTable) - m_pListTable.reset( - new ListsManager( m_rDMapper, m_xTextFactory )); + m_pListTable = + new ListsManager( m_rDMapper, m_xTextFactory ); return m_pListTable; } @@ -1209,7 +1208,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap ) xParaProperties->setPropertyToDefault(getPropertyName(PROP_CHAR_ESCAPEMENT)); xParaProperties->setPropertyToDefault(getPropertyName(PROP_CHAR_HEIGHT)); //handles (2) and part of (6) - pToBeSavedProperties.reset( new ParagraphProperties(*pParaContext) ); + pToBeSavedProperties = new ParagraphProperties(*pParaContext); sal_Int32 nCount = xParaCursor->getString().getLength(); pToBeSavedProperties->SetDropCapLength(nCount > 0 && nCount < 255 ? static_cast<sal_Int8>(nCount) : 1); } @@ -1226,7 +1225,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap ) aDrop.Distance = nHSpace > 0 && nHSpace < SAL_MAX_INT16 ? static_cast<sal_Int16>(nHSpace) : 0; //completes (5) if( pParaContext->IsFrameMode() ) - pToBeSavedProperties.reset( new ParagraphProperties(*pParaContext) ); + pToBeSavedProperties = new ParagraphProperties(*pParaContext); } else if(*rAppendContext.pLastParagraphProperties == *pParaContext ) { @@ -1242,7 +1241,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap ) // If different frame properties are set on this paragraph, keep them. if ( !bIsDropCap && pParaContext->IsFrameMode() ) { - pToBeSavedProperties.reset( new ParagraphProperties(*pParaContext) ); + pToBeSavedProperties = new ParagraphProperties(*pParaContext); lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap, rAppendContext); } } @@ -1254,7 +1253,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap ) if( !bIsDropCap && pParaContext->IsFrameMode() ) { - pToBeSavedProperties.reset( new ParagraphProperties(*pParaContext) ); + pToBeSavedProperties = new ParagraphProperties(*pParaContext); lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap, rAppendContext); } } @@ -1899,8 +1898,8 @@ void DomainMapper_Impl::CheckParaMarkerRedline( uno::Reference< text::XTextRange CreateRedline( xRange, m_pParaMarkerRedline ); if ( m_pParaMarkerRedline.get( ) ) { - m_pParaMarkerRedline.reset(); - m_currentRedline.reset(); + m_pParaMarkerRedline.clear(); + m_currentRedline.clear(); } } } @@ -1942,7 +1941,7 @@ void DomainMapper_Impl::StartParaMarkerChange( ) void DomainMapper_Impl::EndParaMarkerChange( ) { m_bIsParaMarkerChange = false; - m_currentRedline.reset(); + m_currentRedline.clear(); } @@ -2905,7 +2904,7 @@ void DomainMapper_Impl::PushFieldContext() uno::Reference< text::XTextCursor > xCrsr = xTextAppend->createTextCursorByRange( xTextAppend->getEnd() ); xStart = xCrsr->getStart(); } - m_aFieldStack.push( std::make_shared<FieldContext>( xStart ) ); + m_aFieldStack.push( new FieldContext( xStart ) ); } /*------------------------------------------------------------------------- //the current field context waits for the completion of the command @@ -2944,7 +2943,7 @@ FieldContext::FieldContext(uno::Reference< text::XTextRange > const& xStart) , m_xStartRange( xStart ) , m_bFieldLocked( false ) { - m_pProperties.reset(new PropertyMap()); + m_pProperties = new PropertyMap(); } @@ -5148,7 +5147,7 @@ void DomainMapper_Impl::AddAnnotationPosition( GraphicImportPtr const & DomainMapper_Impl::GetGraphicImport(GraphicImportType eGraphicImportType) { if(!m_pGraphicImport) - m_pGraphicImport.reset( new GraphicImport( m_xComponentContext, m_xTextFactory, m_rDMapper, eGraphicImportType, m_aPositionOffsets, m_aAligns, m_aPositivePercentages ) ); + m_pGraphicImport = new GraphicImport( m_xComponentContext, m_xTextFactory, m_rDMapper, eGraphicImportType, m_aPositionOffsets, m_aAligns, m_aPositivePercentages ); return m_pGraphicImport; } /*------------------------------------------------------------------------- @@ -5156,7 +5155,7 @@ GraphicImportPtr const & DomainMapper_Impl::GetGraphicImport(GraphicImportType e -----------------------------------------------------------------------*/ void DomainMapper_Impl::ResetGraphicImport() { - m_pGraphicImport.reset(); + m_pGraphicImport.clear(); } @@ -5242,7 +5241,7 @@ void DomainMapper_Impl::ImportGraphic(const writerfilter::Reference< Properties // TextFrame, we won't try to resize it (to match the size of the // TextFrame) here. m_xEmbedded.clear(); - m_pGraphicImport.reset(); + m_pGraphicImport.clear(); } @@ -5369,7 +5368,7 @@ void DomainMapper_Impl::AddNewRedline( sal_uInt32 sprmId ) void DomainMapper_Impl::SetCurrentRedlineIsRead() { - m_currentRedline.reset(); + m_currentRedline.clear(); } sal_Int32 DomainMapper_Impl::GetCurrentRedlineToken( ) @@ -5446,7 +5445,7 @@ void DomainMapper_Impl::RemoveTopRedline( ) { assert( m_aRedlines.top().size( ) > 0 ); m_aRedlines.top().pop_back( ); - m_currentRedline.reset(); + m_currentRedline.clear(); } void DomainMapper_Impl::ApplySettingsTable() diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index e386252fd9bc..187c6f435d30 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -131,7 +131,7 @@ public: }; /// field stack element -class FieldContext +class FieldContext : public virtual SvRefBase { bool m_bFieldCommandCompleted; css::uno::Reference<css::text::XTextRange> m_xStartRange; @@ -159,7 +159,7 @@ class FieldContext public: explicit FieldContext(css::uno::Reference<css::text::XTextRange> const& xStart); - ~FieldContext(); + ~FieldContext() override; const css::uno::Reference<css::text::XTextRange>& GetStartRange() const { return m_xStartRange; } @@ -240,7 +240,7 @@ struct AnchoredContext } }; -typedef std::shared_ptr<FieldContext> FieldContextPtr; +typedef tools::SvRef<FieldContext> FieldContextPtr; /*------------------------------------------------------------------------- extended tab stop struct @@ -454,8 +454,8 @@ private: SymbolData m_aSymbolData; // TableManagers are stacked: one for each stream to avoid any confusion - std::stack< std::shared_ptr< DomainMapperTableManager > > m_aTableManagers; - std::shared_ptr<DomainMapperTableHandler> m_pTableHandler; + std::stack< tools::SvRef< DomainMapperTableManager > > m_aTableManagers; + tools::SvRef<DomainMapperTableHandler> m_pTableHandler; //each context needs a stack of currently used attributes std::stack<PropertyMapPtr> m_aPropertyStacks[NUMBER_OF_CONTEXTS]; @@ -659,27 +659,27 @@ public: FontTablePtr const & GetFontTable() { if(!m_pFontTable) - m_pFontTable.reset(new FontTable()); + m_pFontTable = new FontTable(); return m_pFontTable; } StyleSheetTablePtr const & GetStyleSheetTable() { if(!m_pStyleSheetTable) - m_pStyleSheetTable.reset(new StyleSheetTable( m_rDMapper, m_xTextDocument, m_bIsNewDoc )); + m_pStyleSheetTable = new StyleSheetTable( m_rDMapper, m_xTextDocument, m_bIsNewDoc ); return m_pStyleSheetTable; } ListsManager::Pointer const & GetListTable(); ThemeTablePtr const & GetThemeTable() { if(!m_pThemeTable) - m_pThemeTable.reset( new ThemeTable ); + m_pThemeTable = new ThemeTable; return m_pThemeTable; } SettingsTablePtr const & GetSettingsTable() { if( !m_pSettingsTable ) - m_pSettingsTable.reset(new SettingsTable(m_rDMapper)); + m_pSettingsTable = new SettingsTable(m_rDMapper); return m_pSettingsTable; } @@ -800,13 +800,13 @@ public: DomainMapperTableManager& getTableManager() { - std::shared_ptr< DomainMapperTableManager > pMngr = m_aTableManagers.top(); + tools::SvRef< DomainMapperTableManager > pMngr = m_aTableManagers.top(); return *pMngr.get( ); } void appendTableManager( ) { - std::shared_ptr<DomainMapperTableManager> pMngr(new DomainMapperTableManager()); + tools::SvRef<DomainMapperTableManager> pMngr(new DomainMapperTableManager()); m_aTableManagers.push( pMngr ); } @@ -901,7 +901,7 @@ public: /// If we're inside <w:rPr>, inside <w:style w:type="table"> bool m_bInTableStyleRunProps; - std::shared_ptr<SdtHelper> m_pSdtHelper; + tools::SvRef<SdtHelper> m_pSdtHelper; /// Document background color, applied to every page style. boost::optional<sal_Int32> m_oBackgroundColor; diff --git a/writerfilter/source/dmapper/FFDataHandler.hxx b/writerfilter/source/dmapper/FFDataHandler.hxx index 3ec35292549f..7289d6f6c09f 100644 --- a/writerfilter/source/dmapper/FFDataHandler.hxx +++ b/writerfilter/source/dmapper/FFDataHandler.hxx @@ -27,7 +27,7 @@ class FFDataHandler : public LoggedProperties { public: // typedefs - typedef ::std::shared_ptr<FFDataHandler> Pointer_t; + typedef ::tools::SvRef<FFDataHandler> Pointer_t; typedef ::std::vector<OUString> DropDownEntries_t; // constructor diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx index 70b425e91fae..67224202b886 100644 --- a/writerfilter/source/dmapper/FontTable.cxx +++ b/writerfilter/source/dmapper/FontTable.cxx @@ -159,11 +159,11 @@ void FontTable::lcl_entry(int /*pos*/, writerfilter::Reference<Properties>::Poin { //create a new font entry SAL_WARN_IF( m_pImpl->pCurrentEntry, "writerfilter.dmapper", "current entry has to be NULL here" ); - m_pImpl->pCurrentEntry.reset(new FontEntry); + m_pImpl->pCurrentEntry = new FontEntry; ref->resolve(*this); //append it to the table m_pImpl->aFontEntries.push_back( m_pImpl->pCurrentEntry ); - m_pImpl->pCurrentEntry.reset(); + m_pImpl->pCurrentEntry.clear(); } void FontTable::lcl_startSectionGroup() diff --git a/writerfilter/source/dmapper/FontTable.hxx b/writerfilter/source/dmapper/FontTable.hxx index 553ac267ce50..fa922258dffc 100644 --- a/writerfilter/source/dmapper/FontTable.hxx +++ b/writerfilter/source/dmapper/FontTable.hxx @@ -30,9 +30,9 @@ namespace dmapper { struct FontTable_Impl; -struct FontEntry +struct FontEntry : public virtual SvRefBase { - typedef std::shared_ptr<FontEntry> Pointer_t; + typedef tools::SvRef<FontEntry> Pointer_t; OUString sFontName; sal_Int32 nTextEncoding; @@ -81,7 +81,7 @@ class FontTable : public LoggedProperties, public LoggedTable virtual void lcl_endShape( ) override; }; -typedef std::shared_ptr< FontTable > FontTablePtr; +typedef tools::SvRef< FontTable > FontTablePtr; class EmbeddedFontHandler : public LoggedProperties { diff --git a/writerfilter/source/dmapper/FormControlHelper.cxx b/writerfilter/source/dmapper/FormControlHelper.cxx index a520a81dd7ab..f1ddacf2ae2f 100644 --- a/writerfilter/source/dmapper/FormControlHelper.cxx +++ b/writerfilter/source/dmapper/FormControlHelper.cxx @@ -43,7 +43,7 @@ namespace dmapper { using namespace ::com::sun::star; -struct FormControlHelper::FormControlHelper_Impl +struct FormControlHelper::FormControlHelper_Impl : public virtual SvRefBase { FieldId m_eFieldId; awt::Size aSize; diff --git a/writerfilter/source/dmapper/FormControlHelper.hxx b/writerfilter/source/dmapper/FormControlHelper.hxx index da4c8e53bcb4..dd7f7d38c3fa 100644 --- a/writerfilter/source/dmapper/FormControlHelper.hxx +++ b/writerfilter/source/dmapper/FormControlHelper.hxx @@ -28,14 +28,14 @@ namespace writerfilter { namespace dmapper { -class FormControlHelper +class FormControlHelper : public virtual SvRefBase { public: - typedef std::shared_ptr<FormControlHelper> Pointer_t; + typedef tools::SvRef<FormControlHelper> Pointer_t; FormControlHelper(FieldId eFieldId, css::uno::Reference<css::text::XTextDocument> const& rTextDocument, FFDataHandler::Pointer_t const & pFFData); - ~FormControlHelper(); + ~FormControlHelper() override; void insertControl(css::uno::Reference<css::text::XTextRange> const& xTextRange); void processField(css::uno::Reference<css::text::XFormField> const& xFormField); @@ -43,7 +43,7 @@ public: private: FFDataHandler::Pointer_t m_pFFData; struct FormControlHelper_Impl; - std::shared_ptr<FormControlHelper_Impl> m_pImpl; + tools::SvRef<FormControlHelper_Impl> m_pImpl; bool createCheckbox(css::uno::Reference<css::text::XTextRange> const& xTextRange, const OUString & rControlName); diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx index 92c8ea5100cf..ee3b5b7cdb05 100644 --- a/writerfilter/source/dmapper/GraphicImport.hxx +++ b/writerfilter/source/dmapper/GraphicImport.hxx @@ -126,7 +126,7 @@ public: void handleWrapTextValue(sal_uInt32 nVal); }; -typedef std::shared_ptr<GraphicImport> GraphicImportPtr; +typedef tools::SvRef<GraphicImport> GraphicImportPtr; }} diff --git a/writerfilter/source/dmapper/LoggedResources.hxx b/writerfilter/source/dmapper/LoggedResources.hxx index 85569b58e7c4..5e86f552c93f 100644 --- a/writerfilter/source/dmapper/LoggedResources.hxx +++ b/writerfilter/source/dmapper/LoggedResources.hxx @@ -50,7 +50,7 @@ class LoggedStream : public Stream { public: explicit LoggedStream(const std::string & sPrefix); - virtual ~LoggedStream(); + virtual ~LoggedStream() override; void startSectionGroup() override; void endSectionGroup() override; @@ -103,7 +103,7 @@ class LoggedProperties : public Properties { public: explicit LoggedProperties(const std::string & sPrefix); - virtual ~LoggedProperties(); + virtual ~LoggedProperties() override; void attribute(Id name, Value & val) override; void sprm(Sprm & sprm) override; @@ -121,7 +121,7 @@ class LoggedTable : public Table { public: explicit LoggedTable(const std::string & sPrefix); - virtual ~LoggedTable(); + virtual ~LoggedTable() override; void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) override; diff --git a/writerfilter/source/dmapper/MeasureHandler.hxx b/writerfilter/source/dmapper/MeasureHandler.hxx index 92741825f5c0..caf631e0a49d 100644 --- a/writerfilter/source/dmapper/MeasureHandler.hxx +++ b/writerfilter/source/dmapper/MeasureHandler.hxx @@ -57,7 +57,7 @@ public: void enableInteropGrabBag(const OUString& aName); css::beans::PropertyValue getInteropGrabBag(); }; -typedef std::shared_ptr +typedef tools::SvRef < MeasureHandler > MeasureHandlerPtr; }} diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index c717a9af3898..5defd92f0d49 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -129,7 +129,7 @@ bool ListLevel::HasValues() const return m_bHasValues; } -void ListLevel::SetParaStyle( const std::shared_ptr< StyleSheetEntry >& pStyle ) +void ListLevel::SetParaStyle( const tools::SvRef< StyleSheetEntry >& pStyle ) { if (!pStyle) return; @@ -821,7 +821,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) { //create a new Abstract list entry OSL_ENSURE( !m_pCurrentDefinition.get(), "current entry has to be NULL here"); - m_pCurrentDefinition.reset( new AbstractListDef ); + m_pCurrentDefinition = new AbstractListDef; pProperties->resolve( *this ); //append it to the table m_aAbstractLists.push_back( m_pCurrentDefinition ); @@ -837,7 +837,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) // Create a new list entry OSL_ENSURE( !m_pCurrentDefinition.get(), "current entry has to be NULL here"); ListDef::Pointer listDef( new ListDef ); - m_pCurrentDefinition = listDef; + m_pCurrentDefinition = listDef.get(); pProperties->resolve( *this ); //append it to the table m_aLists.push_back( listDef ); @@ -1088,7 +1088,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) default: if (ListLevel::Pointer pCurrentLevel = m_pCurrentDefinition->GetCurrentLevel()) { - m_rDMapper.PushListProperties(pCurrentLevel); + m_rDMapper.PushListProperties(pCurrentLevel.get()); m_rDMapper.sprm( rSprm ); m_rDMapper.PopListProperties(); } @@ -1107,7 +1107,7 @@ void ListsManager::lcl_entry( int /* pos */, { // Create AbstractListDef's OSL_ENSURE( !m_pCurrentDefinition.get(), "current entry has to be NULL here"); - m_pCurrentDefinition.reset( new AbstractListDef( ) ); + m_pCurrentDefinition = new AbstractListDef( ); ref->resolve(*this); //append it to the table m_aAbstractLists.push_back( m_pCurrentDefinition ); diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx index 98e029d2188b..ed4b1e4f6ffe 100644 --- a/writerfilter/source/dmapper/NumberingManager.hxx +++ b/writerfilter/source/dmapper/NumberingManager.hxx @@ -50,13 +50,13 @@ class ListLevel : public PropertyMap css::awt::Size m_aGraphicSize; css::uno::Reference<css::awt::XBitmap> m_xGraphicBitmap; sal_Int32 m_nTabstop; - std::shared_ptr< StyleSheetEntry > m_pParaStyle; + tools::SvRef< StyleSheetEntry > m_pParaStyle; bool m_outline; bool m_bHasValues = false; public: - typedef std::shared_ptr< ListLevel > Pointer; + typedef tools::SvRef< ListLevel > Pointer; ListLevel() : m_nIStartAt(-1) @@ -74,11 +74,11 @@ public: void SetGraphicBitmap(css::uno::Reference<css::awt::XBitmap> const& xGraphicBitmap) { m_xGraphicBitmap = xGraphicBitmap; } - void SetParaStyle( const std::shared_ptr< StyleSheetEntry >& pStyle ); + void SetParaStyle( const tools::SvRef< StyleSheetEntry >& pStyle ); // Getters const OUString& GetBulletChar( ) { return m_sBulletChar; }; - const std::shared_ptr< StyleSheetEntry >& GetParaStyle( ) { return m_pParaStyle; }; + const tools::SvRef< StyleSheetEntry >& GetParaStyle( ) { return m_pParaStyle; }; bool isOutlineNumbering() const { return m_outline; } /// Determines if SetValue() was called at least once. bool HasValues() const; @@ -100,12 +100,12 @@ private: }; /// Represents a numbering picture bullet: an id and a graphic. -class NumPicBullet final +class NumPicBullet final : public virtual SvRefBase { public: - typedef std::shared_ptr<NumPicBullet> Pointer; + typedef tools::SvRef<NumPicBullet> Pointer; NumPicBullet(); - ~NumPicBullet(); + ~NumPicBullet() override; void SetId(sal_Int32 nId); sal_Int32 GetId() { return m_nId;} @@ -116,7 +116,7 @@ private: css::uno::Reference<css::drawing::XShape> m_xShape; }; -class AbstractListDef +class AbstractListDef : public virtual SvRefBase { private: // The ID member reflects either the abstractNumId or the numId @@ -134,10 +134,10 @@ private: ::rtl::OUString m_sNumStyleLink; public: - typedef std::shared_ptr< AbstractListDef > Pointer; + typedef tools::SvRef< AbstractListDef > Pointer; AbstractListDef( ); - virtual ~AbstractListDef( ); + virtual ~AbstractListDef( ) override; // Setters using during the import void SetId( sal_Int32 nId ) { m_nId = nId; }; @@ -168,7 +168,7 @@ private: css::uno::Reference< css::container::XIndexReplace > m_xNumRules; public: - typedef std::shared_ptr< ListDef > Pointer; + typedef tools::SvRef< ListDef > Pointer; ListDef( ); virtual ~ListDef( ) override; @@ -223,7 +223,7 @@ public: ListsManager(DomainMapper& rDMapper, const css::uno::Reference<css::lang::XMultiServiceFactory>& xFactory); virtual ~ListsManager() override; - typedef std::shared_ptr< ListsManager > Pointer; + typedef tools::SvRef< ListsManager > Pointer; ListDef::Pointer GetList( sal_Int32 nId ); diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx index 9ddeedd0461a..fc0268623f5d 100644 --- a/writerfilter/source/dmapper/OLEHandler.cxx +++ b/writerfilter/source/dmapper/OLEHandler.cxx @@ -156,7 +156,7 @@ void OLEHandler::lcl_sprm(Sprm & rSprm) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if ( pProperties.get( ) ) { - std::shared_ptr<WrapHandler> pHandler( new WrapHandler ); + tools::SvRef<WrapHandler> pHandler( new WrapHandler ); pProperties->resolve( *pHandler ); m_nWrapMode = pHandler->getWrapMode( ); diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index 91962a7b0adb..c20951c624c9 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -78,7 +78,7 @@ enum GrabBagType CHAR_GRAB_BAG }; -struct RedlineParams +struct RedlineParams : public virtual SvRefBase { OUString m_sAuthor; OUString m_sDate; @@ -88,7 +88,7 @@ struct RedlineParams css::uno::Sequence< css::beans::PropertyValue > m_aRevertProperties; }; -typedef std::shared_ptr< RedlineParams > RedlineParamsPtr; +typedef tools::SvRef< RedlineParams > RedlineParamsPtr; class PropValue { @@ -114,7 +114,7 @@ public: GrabBagType getGrabBagType() const { return m_GrabBagType; } }; -class PropertyMap +class PropertyMap : public virtual SvRefBase { private: // Cache the property values for the GetPropertyValues() call(s). @@ -130,7 +130,6 @@ public: typedef std::pair< PropertyIds, css::uno::Any > Property; PropertyMap() {} - virtual ~PropertyMap() {} // Sequence: Grab Bags: The CHAR_GRAB_BAG has Name "CharInteropGrabBag" and the PARA_GRAB_BAG has Name "ParaInteropGrabBag" // the contained properties are their Value. @@ -143,7 +142,7 @@ public: void Erase( PropertyIds eId); // Imports properties from pMap, overwriting those with the same PropertyIds as the current map - void InsertProps( const std::shared_ptr< PropertyMap >& rMap ); + void InsertProps( const tools::SvRef< PropertyMap >& rMap ); // Returns a copy of the property if it exists, .first is its PropertyIds and .second is its Value (type css::uno::Any) boost::optional< Property > getProperty( PropertyIds eId ) const; @@ -177,7 +176,7 @@ protected: } }; -typedef std::shared_ptr< PropertyMap > PropertyMapPtr; +typedef tools::SvRef< PropertyMap > PropertyMapPtr; class SectionPropertyMap : public PropertyMap { @@ -380,7 +379,7 @@ public: void ClearHeaderFooterLinkToPrevious( bool bHeader, PageType eType ); }; -class ParagraphProperties +class ParagraphProperties : public virtual SvRefBase { private: bool m_bFrameMode; @@ -409,7 +408,6 @@ private: public: ParagraphProperties(); - virtual ~ParagraphProperties() {} // Does not compare the starting/ending range, m_sParaStyleName and m_nDropCapLength bool operator==( const ParagraphProperties& ); @@ -476,7 +474,7 @@ public: void ResetFrameProperties(); }; -typedef std::shared_ptr< ParagraphProperties > ParagraphPropertiesPtr; +typedef tools::SvRef< ParagraphProperties > ParagraphPropertiesPtr; /*------------------------------------------------------------------------- property map of a stylesheet @@ -562,7 +560,7 @@ public: virtual void insertTableProperties( const PropertyMap* ) override; }; -typedef std::shared_ptr< TablePropertyMap > TablePropertyMapPtr; +typedef tools::SvRef< TablePropertyMap > TablePropertyMapPtr; } // namespace dmapper } // namespace writerfilter diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx index 2d9309adee49..48fa71d73c41 100644 --- a/writerfilter/source/dmapper/SdtHelper.hxx +++ b/writerfilter/source/dmapper/SdtHelper.hxx @@ -15,6 +15,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <rtl/ustrbuf.hxx> +#include <tools/ref.hxx> namespace com { @@ -43,7 +44,7 @@ class DomainMapper_Impl; * w:sdt tokens can't be imported as form fields, as w:sdt supports * e.g. date picking as well. */ -class SdtHelper final +class SdtHelper final : public virtual SvRefBase { DomainMapper_Impl& m_rDM_Impl; @@ -68,7 +69,7 @@ class SdtHelper final void createControlShape(css::awt::Size aSize, css::uno::Reference<css::awt::XControlModel> const& xControlModel, const css::uno::Sequence<css::beans::PropertyValue>& rGrabBag); public: explicit SdtHelper(DomainMapper_Impl& rDM_Impl); - ~SdtHelper(); + ~SdtHelper() override; std::vector<OUString>& getDropDownItems() { diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx index a36115616e4f..edffff67cfeb 100644 --- a/writerfilter/source/dmapper/SettingsTable.hxx +++ b/writerfilter/source/dmapper/SettingsTable.hxx @@ -94,7 +94,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) override; }; -typedef std::shared_ptr< SettingsTable > SettingsTablePtr; +typedef tools::SvRef< SettingsTable > SettingsTablePtr; }} #endif diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 263d74881ad5..a9bb010db5da 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -443,8 +443,8 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val) if ( nType == STYLE_TYPE_TABLE ) { StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry; - std::shared_ptr<TableStyleSheetEntry> pTableEntry( new TableStyleSheetEntry( *pEntry.get( ) ) ); - m_pImpl->m_pCurrentEntry = pTableEntry; + tools::SvRef<TableStyleSheetEntry> pTableEntry( new TableStyleSheetEntry( *pEntry.get( ) ) ); + m_pImpl->m_pCurrentEntry = pTableEntry.get(); } else m_pImpl->m_pCurrentEntry->nStyleTypeCode = nType; @@ -714,7 +714,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if (pProperties.get()) { - std::shared_ptr<LatentStyleHandler> pLatentStyleHandler(new LatentStyleHandler()); + tools::SvRef<LatentStyleHandler> pLatentStyleHandler(new LatentStyleHandler()); pProperties->resolve(*pLatentStyleHandler); beans::PropertyValue aValue; aValue.Name = "lsdException"; @@ -732,7 +732,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) if (!m_pImpl->m_pCurrentEntry) break; - std::shared_ptr<TablePropertiesHandler> pTblHandler(new TablePropertiesHandler()); + tools::SvRef<TablePropertiesHandler> pTblHandler(new TablePropertiesHandler()); pTblHandler->SetProperties( m_pImpl->m_pCurrentEntry->pProperties ); if ( !pTblHandler->sprm( rSprm ) ) { diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx index dc1f0acf3eb5..8f045b65102e 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.hxx +++ b/writerfilter/source/dmapper/StyleSheetTable.hxx @@ -49,7 +49,7 @@ enum StyleType }; struct StyleSheetTable_Impl; -class StyleSheetEntry +class StyleSheetEntry : public virtual SvRefBase { std::vector<css::beans::PropertyValue> m_aInteropGrabBag; public: @@ -72,10 +72,10 @@ public: css::beans::PropertyValues GetInteropGrabBagSeq(); ///< Used for existing styles, just a list of properties. StyleSheetEntry(); - virtual ~StyleSheetEntry(); + virtual ~StyleSheetEntry() override; }; -typedef std::shared_ptr<StyleSheetEntry> StyleSheetEntryPtr; +typedef tools::SvRef<StyleSheetEntry> StyleSheetEntryPtr; class DomainMapper; class StyleSheetTable : @@ -112,7 +112,7 @@ private: void applyDefaults(bool bParaProperties); }; -typedef std::shared_ptr< StyleSheetTable > StyleSheetTablePtr; +typedef tools::SvRef< StyleSheetTable > StyleSheetTablePtr; class TableStyleSheetEntry : diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx b/writerfilter/source/dmapper/TDefTableHandler.cxx index b86f37ed8bf3..1a29fbc4b6b2 100644 --- a/writerfilter/source/dmapper/TDefTableHandler.cxx +++ b/writerfilter/source/dmapper/TDefTableHandler.cxx @@ -414,7 +414,7 @@ void TDefTableHandler::lcl_sprm(Sprm & rSprm) } void TDefTableHandler::fillCellProperties( - size_t nCell, const ::std::shared_ptr< TablePropertyMap >& pCellProperties ) const + size_t nCell, const ::tools::SvRef< TablePropertyMap >& pCellProperties ) const { if( m_aTopBorderLines.size() > nCell ) pCellProperties->Insert( PROP_TOP_BORDER, uno::makeAny( m_aTopBorderLines[nCell] ) ); diff --git a/writerfilter/source/dmapper/TDefTableHandler.hxx b/writerfilter/source/dmapper/TDefTableHandler.hxx index 18a52cf9de88..09ef72e8320d 100644 --- a/writerfilter/source/dmapper/TDefTableHandler.hxx +++ b/writerfilter/source/dmapper/TDefTableHandler.hxx @@ -64,7 +64,7 @@ public: TDefTableHandler(); virtual ~TDefTableHandler() override; - void fillCellProperties( size_t nCell, const ::std::shared_ptr< TablePropertyMap >& pCellProperties) const; + void fillCellProperties( size_t nCell, const ::tools::SvRef< TablePropertyMap >& pCellProperties) const; void enableInteropGrabBag(const OUString& aName); css::beans::PropertyValue getInteropGrabBag(const OUString& aName = OUString()); static OUString getBorderTypeString(sal_Int32 nType); diff --git a/writerfilter/source/dmapper/TableData.hxx b/writerfilter/source/dmapper/TableData.hxx index a3614b953605..44805a070d75 100644 --- a/writerfilter/source/dmapper/TableData.hxx +++ b/writerfilter/source/dmapper/TableData.hxx @@ -33,7 +33,7 @@ namespace dmapper /** Class containing the data to describe a table cell. */ -class CellData final +class CellData final : public virtual SvRefBase { /** Handle to start of cell. @@ -53,7 +53,7 @@ class CellData final bool mbOpen; public: - typedef std::shared_ptr<CellData> Pointer_t; + typedef tools::SvRef<CellData> Pointer_t; CellData(css::uno::Reference<css::text::XTextRange> const & start, TablePropertyMapPtr pProps) : mStart(start), mEnd(start), mpProps(pProps), mbOpen(true) @@ -75,7 +75,7 @@ public: void insertProperties(TablePropertyMapPtr pProps) { if( mpProps.get() ) - mpProps->InsertProps(pProps); + mpProps->InsertProps(pProps.get()); else mpProps = pProps; } @@ -101,7 +101,7 @@ public: /** Class to handle data of a table row. */ -class RowData final +class RowData final : public virtual SvRefBase { typedef ::std::vector<CellData::Pointer_t> Cells; @@ -116,12 +116,12 @@ class RowData final mutable TablePropertyMapPtr mpProperties; public: - typedef std::shared_ptr<RowData> Pointer_t; + typedef tools::SvRef<RowData> Pointer_t; RowData() {} RowData(const RowData& rRowData) - : mCells(rRowData.mCells), mpProperties(rRowData.mpProperties) + : SvRefBase(), mCells(rRowData.mCells), mpProperties(rRowData.mpProperties) { } @@ -161,7 +161,7 @@ public: if( !mpProperties.get() ) mpProperties = pProperties; else - mpProperties->InsertProps(pProperties); + mpProperties->InsertProps(pProperties.get()); } } @@ -235,7 +235,7 @@ public: /** Class that holds the data of a table. */ -class TableData +class TableData : public virtual SvRefBase { typedef RowData::Pointer_t RowPointer_t; typedef ::std::vector<RowPointer_t> Rows; @@ -261,7 +261,7 @@ class TableData void newRow() { mpRow = RowPointer_t(new RowData()); } public: - typedef std::shared_ptr<TableData> Pointer_t; + typedef tools::SvRef<TableData> Pointer_t; explicit TableData(unsigned int nDepth) : mnDepth(nDepth) { newRow(); } diff --git a/writerfilter/source/dmapper/TableManager.cxx b/writerfilter/source/dmapper/TableManager.cxx index d9245678d5dc..198a793e61e1 100644 --- a/writerfilter/source/dmapper/TableManager.cxx +++ b/writerfilter/source/dmapper/TableManager.cxx @@ -67,7 +67,7 @@ void TableManager::insertTableProps(const TablePropertyMapPtr& pProps) #endif if (getTableProps().get() && getTableProps() != pProps) - getTableProps()->InsertProps(pProps); + getTableProps()->InsertProps(pProps.get()); else mState.setTableProps(pProps); @@ -83,7 +83,7 @@ void TableManager::insertRowProps(const TablePropertyMapPtr& pProps) #endif if (getRowProps().get()) - getRowProps()->InsertProps(pProps); + getRowProps()->InsertProps(pProps.get()); else mState.setRowProps(pProps); @@ -112,7 +112,7 @@ void TableManager::cellProps(const TablePropertyMapPtr& pProps) #endif if (getCellProps().get()) - getCellProps()->InsertProps(pProps); + getCellProps()->InsertProps(pProps.get()); else mState.setCellProps(pProps); @@ -385,7 +385,7 @@ void TableManager::startLevel() pTableData2->addCell(mpUnfinishedRow->getCellStart(i), mpUnfinishedRow->getCellProperties(i)); pTableData2->endCell(mpUnfinishedRow->getCellEnd(i)); } - mpUnfinishedRow.reset(); + mpUnfinishedRow.clear(); } mTableDataStack.push(pTableData2); @@ -411,7 +411,7 @@ void TableManager::handle(const css::uno::Reference<css::text::XTextRange>& rHan setHandle(rHandle); } -void TableManager::setHandler(const std::shared_ptr<DomainMapperTableHandler>& pTableDataHandler) +void TableManager::setHandler(const tools::SvRef<DomainMapperTableHandler>& pTableDataHandler) { mpTableDataHandler = pTableDataHandler; } diff --git a/writerfilter/source/dmapper/TableManager.hxx b/writerfilter/source/dmapper/TableManager.hxx index cd5c9f981dfc..0be365ae4e33 100644 --- a/writerfilter/source/dmapper/TableManager.hxx +++ b/writerfilter/source/dmapper/TableManager.hxx @@ -25,6 +25,7 @@ #include "PropertyMap.hxx" #include "TableData.hxx" +#include "DomainMapperTableHandler.hxx" namespace writerfilter { @@ -41,7 +42,7 @@ class DomainMapperTableHandler; table structure. The events have to be handles by a TableDataHandler. */ -class TableManager +class TableManager : public virtual SvRefBase { class TableManagerState final { @@ -107,7 +108,7 @@ class TableManager void resetCellProps() { - mpCellProps.reset(); + mpCellProps.clear(); } void setCellProps(TablePropertyMapPtr pProps) @@ -122,7 +123,7 @@ class TableManager void resetRowProps() { - mpRowProps.reset(); + mpRowProps.clear(); } void setRowProps(TablePropertyMapPtr pProps) @@ -138,7 +139,7 @@ class TableManager void resetTableProps() { if (mTableProps.size() > 0) - mTableProps.top().reset(); + mTableProps.top().clear(); } void setTableProps(TablePropertyMapPtr pProps) @@ -249,7 +250,7 @@ protected: } private: - typedef std::shared_ptr< css::uno::Reference<css::text::XTextRange> > T_p; + typedef tools::SvRef< css::uno::Reference<css::text::XTextRange> > T_p; /** depth of the current cell @@ -275,7 +276,7 @@ private: /** handler for resolveCurrentTable */ - std::shared_ptr<DomainMapperTableHandler> mpTableDataHandler; + tools::SvRef<DomainMapperTableHandler> mpTableDataHandler; /** Set flag which indicates the current handle is in a cell. @@ -352,14 +353,13 @@ protected: public: TableManager(); - virtual ~TableManager(){} /** Set handler for resolveCurrentTable. @param pTableDataHandler the handler */ - void setHandler(const std::shared_ptr<DomainMapperTableHandler>& pTableDataHandler); + void setHandler(const tools::SvRef<DomainMapperTableHandler>& pTableDataHandler); /** Set the current handle. diff --git a/writerfilter/source/dmapper/TablePositionHandler.hxx b/writerfilter/source/dmapper/TablePositionHandler.hxx index e34dde0c1cf6..345a4a01fe73 100644 --- a/writerfilter/source/dmapper/TablePositionHandler.hxx +++ b/writerfilter/source/dmapper/TablePositionHandler.hxx @@ -107,7 +107,7 @@ public: bool operator== (const TablePositionHandler& rHandler) const; }; -using TablePositionHandlerPtr = std::shared_ptr<TablePositionHandler>; +using TablePositionHandlerPtr = tools::SvRef<TablePositionHandler>; } // namespace dmapper } // namespace writerfilter diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx index bbe9067ffdec..b109c36f10b3 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx @@ -236,7 +236,7 @@ namespace dmapper { if( pProperties.get()) { //in OOXML there's one set of borders at each cell (if there is any) - std::shared_ptr< TDefTableHandler > pTDefTableHandler( new TDefTableHandler()); + tools::SvRef< TDefTableHandler > pTDefTableHandler( new TDefTableHandler()); if (m_pCurrentInteropGrabBag) pTDefTableHandler->enableInteropGrabBag("tcBorders"); pProperties->resolve( *pTDefTableHandler ); diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.hxx b/writerfilter/source/dmapper/TablePropertiesHandler.hxx index b3858f170d72..c39106af258c 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.hxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.hxx @@ -34,7 +34,7 @@ namespace dmapper { class DomainMapper; -class TablePropertiesHandler final +class TablePropertiesHandler final : public virtual SvRefBase { private: PropertyMapPtr m_pCurrentProperties; @@ -65,7 +65,7 @@ private: if ( m_pTableManager ) m_pTableManager->cellProps( pProps ); else - m_pCurrentProperties->InsertProps(pProps); + m_pCurrentProperties->InsertProps(pProps.get()); }; void insertRowProps( TablePropertyMapPtr pProps ) @@ -73,7 +73,7 @@ private: if ( m_pTableManager ) m_pTableManager->insertRowProps( pProps ); else - m_pCurrentProperties->InsertProps(pProps); + m_pCurrentProperties->InsertProps(pProps.get()); }; void insertTableProps( TablePropertyMapPtr pProps ) @@ -81,7 +81,7 @@ private: if ( m_pTableManager ) m_pTableManager->insertTableProps( pProps ); else - m_pCurrentProperties->InsertProps(pProps); + m_pCurrentProperties->InsertProps(pProps.get()); }; }; diff --git a/writerfilter/source/dmapper/TagLogger.hxx b/writerfilter/source/dmapper/TagLogger.hxx index b03da6cfcfe5..eb9bdc616e28 100644 --- a/writerfilter/source/dmapper/TagLogger.hxx +++ b/writerfilter/source/dmapper/TagLogger.hxx @@ -33,7 +33,7 @@ namespace writerfilter class TagLogger { private: - static std::shared_ptr<TagLogger> instance; + static tools::SvRef<TagLogger> instance; xmlTextWriterPtr pWriter; const char* pName; diff --git a/writerfilter/source/dmapper/ThemeTable.hxx b/writerfilter/source/dmapper/ThemeTable.hxx index 7115f3b44da2..c998b9bdd205 100644 --- a/writerfilter/source/dmapper/ThemeTable.hxx +++ b/writerfilter/source/dmapper/ThemeTable.hxx @@ -57,7 +57,7 @@ public: static OUString fromLocaleToScriptTag(const OUString& sLocale); static OUString fromLCIDToScriptTag(LanguageType lang); }; -typedef std::shared_ptr< ThemeTable > ThemeTablePtr; +typedef tools::SvRef< ThemeTable > ThemeTablePtr; }} #endif diff --git a/writerfilter/source/dmapper/TrackChangesHandler.cxx b/writerfilter/source/dmapper/TrackChangesHandler.cxx index b5a7fc3c3d31..71629000ed49 100644 --- a/writerfilter/source/dmapper/TrackChangesHandler.cxx +++ b/writerfilter/source/dmapper/TrackChangesHandler.cxx @@ -22,7 +22,7 @@ using namespace oox; TrackChangesHandler::TrackChangesHandler( sal_Int32 nToken ) : LoggedProperties("TrackChangesHandler"), - m_pRedlineParams(std::make_shared<RedlineParams>()) + m_pRedlineParams(new RedlineParams) { m_pRedlineParams->m_nToken = nToken; } diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.hxx b/writerfilter/source/dmapper/WrapPolygonHandler.hxx index 3192408aa330..d1e274ca9304 100644 --- a/writerfilter/source/dmapper/WrapPolygonHandler.hxx +++ b/writerfilter/source/dmapper/WrapPolygonHandler.hxx @@ -29,18 +29,18 @@ namespace writerfilter { namespace dmapper { -class WrapPolygon final +class WrapPolygon final : public virtual SvRefBase { public: typedef std::vector<css::awt::Point> Points_t; - typedef ::std::shared_ptr<WrapPolygon> Pointer_t; + typedef ::tools::SvRef<WrapPolygon> Pointer_t; private: Points_t mPoints; public: WrapPolygon(); - ~WrapPolygon(); + ~WrapPolygon() override; void addPoint(const css::awt::Point & rPoint); diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 431fc2e8015d..eb3ead50bd97 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -41,7 +41,6 @@ #include <oox/ole/vbaproject.hxx> #include <ooxml/OOXMLDocument.hxx> #include <unotools/mediadescriptor.hxx> -#include <rtl/ref.hxx> using namespace ::com::sun::star; @@ -255,7 +254,7 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc } } - pStream.reset(); + pStream.clear(); return true; } diff --git a/writerfilter/source/ooxml/Handler.hxx b/writerfilter/source/ooxml/Handler.hxx index eb6b8b63fa91..5de41e351981 100644 --- a/writerfilter/source/ooxml/Handler.hxx +++ b/writerfilter/source/ooxml/Handler.hxx @@ -31,7 +31,7 @@ class OOXMLFootnoteHandler : public Properties public: explicit OOXMLFootnoteHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLFootnoteHandler(); + virtual ~OOXMLFootnoteHandler() override; virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; @@ -42,7 +42,7 @@ class OOXMLEndnoteHandler : public Properties OOXMLFastContextHandler * mpFastContext; public: explicit OOXMLEndnoteHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLEndnoteHandler(); + virtual ~OOXMLEndnoteHandler() override; virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; @@ -55,7 +55,6 @@ class OOXMLFooterHandler : public Properties sal_Int32 mnType; public: explicit OOXMLFooterHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLFooterHandler() {} void finalize(); virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; @@ -68,7 +67,6 @@ class OOXMLHeaderHandler : public Properties sal_Int32 mnType; public: explicit OOXMLHeaderHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLHeaderHandler() {} void finalize(); virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; @@ -79,7 +77,7 @@ class OOXMLCommentHandler : public Properties OOXMLFastContextHandler * mpFastContext; public: explicit OOXMLCommentHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLCommentHandler(); + virtual ~OOXMLCommentHandler() override; virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; }; @@ -90,7 +88,7 @@ class OOXMLOLEHandler : public Properties public: explicit OOXMLOLEHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLOLEHandler(); + virtual ~OOXMLOLEHandler() override; virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; @@ -102,7 +100,7 @@ class OOXMLEmbeddedFontHandler : public Properties public: explicit OOXMLEmbeddedFontHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLEmbeddedFontHandler(); + virtual ~OOXMLEmbeddedFontHandler() override; virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; @@ -114,7 +112,7 @@ class OOXMLBreakHandler : public Properties Stream & mrStream; public: explicit OOXMLBreakHandler(Stream & rStream); - virtual ~OOXMLBreakHandler(); + virtual ~OOXMLBreakHandler() override; virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; }; @@ -124,7 +122,7 @@ class OOXMLPictureHandler : public Properties OOXMLFastContextHandler * mpFastContext; public: explicit OOXMLPictureHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLPictureHandler(); + virtual ~OOXMLPictureHandler() override; virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; @@ -138,7 +136,7 @@ class OOXMLHyperlinkHandler : public Properties public: explicit OOXMLHyperlinkHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLHyperlinkHandler(); + virtual ~OOXMLHyperlinkHandler() override; void writetext(); virtual void attribute(Id name, Value & val) override; @@ -152,7 +150,7 @@ class OOXMLHyperlinkURLHandler : public Properties public: explicit OOXMLHyperlinkURLHandler(OOXMLFastContextHandler * pContext); - virtual ~OOXMLHyperlinkURLHandler(); + virtual ~OOXMLHyperlinkURLHandler() override; virtual void attribute(Id name, Value & val) override; virtual void sprm(Sprm & sprm) override; diff --git a/writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx b/writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx index 794d700fdc73..979998fec317 100644 --- a/writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx +++ b/writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx @@ -37,7 +37,7 @@ class OOXMLBinaryObjectReference : public: explicit OOXMLBinaryObjectReference(OOXMLStream::Pointer_t const & pStream); - virtual ~OOXMLBinaryObjectReference(); + virtual ~OOXMLBinaryObjectReference() override; virtual void resolve(BinaryObj & rHandler) override; }; diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index dd0e82d9dbb3..3b5cdd6573af 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -358,7 +358,7 @@ void OOXMLDocumentImpl::resolvePicture(Stream & rStream, { OOXMLPropertySet::Pointer_t pProps(getPicturePropSet(rId)); - rStream.props(pProps); + rStream.props(pProps.get()); } OUString OOXMLDocumentImpl::getTargetForId(const OUString & rId) diff --git a/writerfilter/source/ooxml/OOXMLFactory.hxx b/writerfilter/source/ooxml/OOXMLFactory.hxx index fcf89155ae7c..f4513ea6bdf3 100644 --- a/writerfilter/source/ooxml/OOXMLFactory.hxx +++ b/writerfilter/source/ooxml/OOXMLFactory.hxx @@ -64,9 +64,9 @@ struct AttributeInfo Id m_nRef; }; -class OOXMLFactory_ns { +class OOXMLFactory_ns : public virtual SvRefBase { public: - typedef std::shared_ptr<OOXMLFactory_ns> Pointer_t; + typedef tools::SvRef<OOXMLFactory_ns> Pointer_t; virtual void startAction(OOXMLFastContextHandler * pHandler); virtual void charactersAction(OOXMLFastContextHandler * pHandler, const OUString & rString); @@ -74,7 +74,7 @@ public: virtual void attributeAction(OOXMLFastContextHandler * pHandler, Token_t nToken, const OOXMLValue::Pointer_t& pValue); protected: - virtual ~OOXMLFactory_ns(); + virtual ~OOXMLFactory_ns() override; public: virtual bool getListValue(Id nId, const OUString& rValue, sal_uInt32& rOutValue) = 0; diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 5ed859bfd1f9..bac67461d74d 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -66,7 +66,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler m_bTookChoice(false) { if (mpParserState.get() == nullptr) - mpParserState.reset(new OOXMLParserState()); + mpParserState = new OOXMLParserState(); mpParserState->incContextCount(); } @@ -86,7 +86,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler(OOXMLFastContextHandler * pCont m_bTookChoice(pContext->m_bTookChoice) { if (mpParserState.get() == nullptr) - mpParserState.reset(new OOXMLParserState()); + mpParserState = new OOXMLParserState(); mpParserState->incContextCount(); } @@ -314,7 +314,7 @@ void OOXMLFastContextHandler::sendTableDepth() const pProps->add(NS_ooxml::LN_inTbl, pVal, OOXMLProperty::SPRM); } - mpStream->props(pProps); + mpStream->props(pProps.get()); } } @@ -394,7 +394,7 @@ void OOXMLFastContextHandler::startSdt() OOXMLPropertySet::Pointer_t pProps(new OOXMLPropertySet); OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(1); pProps->add(NS_ooxml::LN_CT_SdtBlock_sdtContent, pVal, OOXMLProperty::ATTRIBUTE); - mpStream->props(pProps); + mpStream->props(pProps.get()); } void OOXMLFastContextHandler::endSdt() @@ -402,7 +402,7 @@ void OOXMLFastContextHandler::endSdt() OOXMLPropertySet::Pointer_t pProps(new OOXMLPropertySet); OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(1); pProps->add(NS_ooxml::LN_CT_SdtBlock_sdtEndContent, pVal, OOXMLProperty::ATTRIBUTE); - mpStream->props(pProps); + mpStream->props(pProps.get()); } void OOXMLFastContextHandler::startSectionGroup() @@ -718,7 +718,7 @@ void OOXMLFastContextHandler::sendTableProperties() void OOXMLFastContextHandler::clearTableProps() { - mpParserState->setTableProperties(std::make_shared<OOXMLPropertySet>()); + mpParserState->setTableProperties(new OOXMLPropertySet()); } void OOXMLFastContextHandler::sendPropertiesWithId(Id nId) @@ -727,12 +727,12 @@ void OOXMLFastContextHandler::sendPropertiesWithId(Id nId) OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySet); pPropertySet->add(nId, pValue, OOXMLProperty::SPRM); - mpStream->props(pPropertySet); + mpStream->props(pPropertySet.get()); } void OOXMLFastContextHandler::clearProps() { - setPropertySet(std::make_shared<OOXMLPropertySet>()); + setPropertySet(new OOXMLPropertySet()); } void OOXMLFastContextHandler::setDefaultBooleanValue() @@ -980,7 +980,7 @@ void OOXMLFastContextHandlerProperties::lcl_endFastElement { if (isForwardEvents()) { - mpStream->props(mpPropertySet); + mpStream->props(mpPropertySet.get()); } } else @@ -1356,7 +1356,7 @@ void OOXMLFastContextHandlerTextTableCell::startCell() pProps->add(NS_ooxml::LN_tcStart, pVal, OOXMLProperty::SPRM); } - mpStream->props(pProps); + mpStream->props(pProps.get()); } } @@ -1382,7 +1382,7 @@ void OOXMLFastContextHandlerTextTableCell::endCell() pProps->add(NS_ooxml::LN_tcEnd, pVal, OOXMLProperty::SPRM); } - mpStream->props(pProps); + mpStream->props(pProps.get()); } } @@ -1432,7 +1432,7 @@ void OOXMLFastContextHandlerTextTableRow::endRow() pProps->add(NS_ooxml::LN_tblRow, pVal, OOXMLProperty::SPRM); } - mpStream->props(pProps); + mpStream->props(pProps.get()); } startCharacterGroup(); @@ -1494,7 +1494,7 @@ void OOXMLFastContextHandlerTextTableRow::handleGridBefore( const OOXMLValue::Po pProps->add(NS_ooxml::LN_tblCell, pVal, OOXMLProperty::SPRM); } - mpStream->props(pProps); + mpStream->props(pProps.get()); // fake <w:tcBorders> with no border OOXMLPropertySet::Pointer_t pCellProps( new OOXMLPropertySet ); @@ -2110,7 +2110,7 @@ void OOXMLFastContextHandlerMath::process() OOXMLPropertySet::Pointer_t pProps(new OOXMLPropertySet); OOXMLValue::Pointer_t pVal( new OOXMLStarMathValue( ref )); pProps->add(NS_ooxml::LN_starmath, pVal, OOXMLProperty::ATTRIBUTE); - mpStream->props( pProps ); + mpStream->props( pProps.get() ); } } diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx index a89644dc6e2d..cd6768e4fbb0 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx @@ -38,7 +38,7 @@ class OOXMLDocumentImpl; class OOXMLFastContextHandler: public ::cppu::WeakImplHelper<css::xml::sax::XFastContextHandler> { public: - typedef std::shared_ptr<OOXMLFastContextHandler> Pointer_t; + typedef tools::SvRef<OOXMLFastContextHandler> Pointer_t; enum ResourceEnum_t { UNKNOWN, STREAM, PROPERTIES, TABLE, SHAPE }; diff --git a/writerfilter/source/ooxml/OOXMLFastHelper.hxx b/writerfilter/source/ooxml/OOXMLFastHelper.hxx index b368916c6a1c..7c92553a9639 100644 --- a/writerfilter/source/ooxml/OOXMLFastHelper.hxx +++ b/writerfilter/source/ooxml/OOXMLFastHelper.hxx @@ -32,7 +32,7 @@ template <class T> class OOXMLFastHelper { public: - static css::uno::Reference<css::xml::sax::XFastContextHandler> createAndSetParentAndDefine + static OOXMLFastContextHandler* createAndSetParentAndDefine (OOXMLFastContextHandler * pHandler, sal_uInt32 nToken, Id nId, Id nDefine); static void newProperty(OOXMLFastContextHandler * pHandler, @@ -40,7 +40,7 @@ public: }; template <class T> -css::uno::Reference<css::xml::sax::XFastContextHandler> OOXMLFastHelper<T>::createAndSetParentAndDefine (OOXMLFastContextHandler * pHandler, sal_uInt32 nToken, Id nId, Id nDefine) +OOXMLFastContextHandler* OOXMLFastHelper<T>::createAndSetParentAndDefine (OOXMLFastContextHandler * pHandler, sal_uInt32 nToken, Id nId, Id nDefine) { OOXMLFastContextHandler * pTmp = new T(pHandler); @@ -48,9 +48,7 @@ css::uno::Reference<css::xml::sax::XFastContextHandler> OOXMLFastHelper<T>::crea pTmp->setId(nId); pTmp->setDefine(nDefine); - css::uno::Reference<css::xml::sax::XFastContextHandler> aResult(pTmp); - - return aResult; + return pTmp; } template <class T> diff --git a/writerfilter/source/ooxml/OOXMLParserState.cxx b/writerfilter/source/ooxml/OOXMLParserState.cxx index 3e4d3a7bcc0a..0e13832c5631 100644 --- a/writerfilter/source/ooxml/OOXMLParserState.cxx +++ b/writerfilter/source/ooxml/OOXMLParserState.cxx @@ -117,8 +117,8 @@ void OOXMLParserState::resolveCharacterProperties(Stream & rStream) { if (mpCharacterProps.get() != nullptr) { - rStream.props(mpCharacterProps); - mpCharacterProps.reset(new OOXMLPropertySet); + rStream.props(mpCharacterProps.get()); + mpCharacterProps = new OOXMLPropertySet; } } @@ -164,8 +164,8 @@ void OOXMLParserState::resolveCellProperties(Stream & rStream) if (rCellProps.get() != nullptr) { - rStream.props(rCellProps); - rCellProps.reset(new OOXMLPropertySet); + rStream.props(rCellProps.get()); + rCellProps = new OOXMLPropertySet; } } } @@ -178,8 +178,8 @@ void OOXMLParserState::resolveRowProperties(Stream & rStream) if (rRowProps.get() != nullptr) { - rStream.props(rRowProps); - rRowProps.reset(new OOXMLPropertySet); + rStream.props(rRowProps.get()); + rRowProps = new OOXMLPropertySet; } } } @@ -192,7 +192,7 @@ void OOXMLParserState::resolveTableProperties(Stream & rStream) if (rTableProps.get() != nullptr) { - rStream.props(rTableProps); + rStream.props(rTableProps.get()); // Don't clean the table props to send them again for each row // This mimics the behaviour from RTF tokenizer. } diff --git a/writerfilter/source/ooxml/OOXMLParserState.hxx b/writerfilter/source/ooxml/OOXMLParserState.hxx index f2895e9b9274..01abebcfed37 100644 --- a/writerfilter/source/ooxml/OOXMLParserState.hxx +++ b/writerfilter/source/ooxml/OOXMLParserState.hxx @@ -39,7 +39,7 @@ struct SavedAlternateState bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead? }; -class OOXMLParserState final +class OOXMLParserState final : public virtual SvRefBase { bool mbInSectionGroup; bool mbInParagraphGroup; @@ -62,10 +62,10 @@ class OOXMLParserState final std::vector<OOXMLPropertySet::Pointer_t> mvPostponedBreaks; public: - typedef std::shared_ptr<OOXMLParserState> Pointer_t; + typedef tools::SvRef<OOXMLParserState> Pointer_t; OOXMLParserState(); - ~OOXMLParserState(); + ~OOXMLParserState() override; bool isInSectionGroup() const { return mbInSectionGroup;} void setInSectionGroup(bool bInSectionGroup); diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx b/writerfilter/source/ooxml/OOXMLPropertySet.cxx index cf61d8596458..be1f72ac8ecf 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx +++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx @@ -38,7 +38,7 @@ OOXMLProperty::OOXMLProperty(Id id, const OOXMLValue::Pointer_t& pValue, } OOXMLProperty::OOXMLProperty(const OOXMLProperty & rSprm) -: mId(rSprm.mId), mpValue(rSprm.mpValue), meType(rSprm.meType) +: SvRefBase(), mId(rSprm.mId), mpValue(rSprm.mpValue), meType(rSprm.meType) { } @@ -394,9 +394,15 @@ void OOXMLPropertySet::add(const OOXMLPropertySet::Pointer_t& pPropertySet) if (pSet != nullptr) { - mProperties.reserve(mProperties.size() + pSet->mProperties.size()); - for (const auto& aIt: pSet->mProperties) - add(aIt); + int x = mProperties.size(); + mProperties.resize(mProperties.size() + pSet->mProperties.size()); + auto itSrc = pSet->mProperties.begin(); + auto itDest = mProperties.begin() + x; + while (itSrc != pSet->mProperties.end()) + { + *itDest = *itSrc; + ++itDest; ++itSrc; + } } } diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.hxx b/writerfilter/source/ooxml/OOXMLPropertySet.hxx index 07b5abfaf40d..2950d250b398 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySet.hxx +++ b/writerfilter/source/ooxml/OOXMLPropertySet.hxx @@ -31,7 +31,7 @@ namespace ooxml class OOXMLValue : public Value { public: - typedef std::shared_ptr<OOXMLValue> Pointer_t; + typedef tools::SvRef<OOXMLValue> Pointer_t; OOXMLValue(); virtual ~OOXMLValue() override; @@ -50,7 +50,7 @@ public: class OOXMLProperty : public Sprm { public: - typedef std::shared_ptr<OOXMLProperty> Pointer_t; + typedef tools::SvRef<OOXMLProperty> Pointer_t; enum Type_t { SPRM, ATTRIBUTE }; private: Id mId; @@ -60,7 +60,7 @@ private: public: OOXMLProperty(Id id, const OOXMLValue::Pointer_t& pValue, Type_t eType); OOXMLProperty(const OOXMLProperty & rSprm); - virtual ~OOXMLProperty(); + virtual ~OOXMLProperty() override; sal_uInt32 getId() const override; Value::Pointer_t getValue() override; @@ -138,13 +138,13 @@ class OOXMLPropertySet : public writerfilter::Reference<Properties> { public: typedef std::vector<OOXMLProperty::Pointer_t> OOXMLProperties_t; - typedef std::shared_ptr<OOXMLPropertySet> Pointer_t; + typedef tools::SvRef<OOXMLPropertySet> Pointer_t; private: OOXMLProperties_t mProperties; void add(const OOXMLProperty::Pointer_t& pProperty); public: OOXMLPropertySet(); - virtual ~OOXMLPropertySet(); + virtual ~OOXMLPropertySet() override; void resolve(Properties & rHandler) override; void add(Id id, const OOXMLValue::Pointer_t& pValue, OOXMLProperty::Type_t eType); @@ -166,9 +166,9 @@ class OOXMLValue; class OOXMLTable : public writerfilter::Reference<Table> { public: - typedef std::shared_ptr<OOXMLValue> ValuePointer_t; + typedef tools::SvRef<OOXMLValue> ValuePointer_t; OOXMLTable(); - virtual ~OOXMLTable(); + virtual ~OOXMLTable() override; void resolve(Table & rTable) override; void add(const ValuePointer_t& pPropertySet); @@ -313,7 +313,7 @@ class OOXMLPropertySetEntryToString : public Properties public: explicit OOXMLPropertySetEntryToString(Id nId); - virtual ~OOXMLPropertySetEntryToString(); + virtual ~OOXMLPropertySetEntryToString() override; virtual void sprm(Sprm & rSprm) override; virtual void attribute(Id nId, Value & rValue) override; @@ -327,7 +327,7 @@ class OOXMLPropertySetEntryToInteger : public Properties int mnValue; public: explicit OOXMLPropertySetEntryToInteger(Id nId); - virtual ~OOXMLPropertySetEntryToInteger(); + virtual ~OOXMLPropertySetEntryToInteger() override; virtual void sprm(Sprm & rSprm) override; virtual void attribute(Id nId, Value & rValue) override; @@ -341,7 +341,7 @@ class OOXMLPropertySetEntryToBool : public Properties bool mValue; public: explicit OOXMLPropertySetEntryToBool(Id nId); - virtual ~OOXMLPropertySetEntryToBool(); + virtual ~OOXMLPropertySetEntryToBool() override; virtual void sprm(Sprm & rSprm) override; virtual void attribute(Id nId, Value & rValue) override; diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx index 97084a5a4044..7a1b353cba64 100644 --- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx @@ -415,7 +415,7 @@ OOXMLDocumentFactory::createStream if (nStreamType != OOXMLStream::VBADATA) { if (OOXMLStreamImpl* pImpl = dynamic_cast<OOXMLStreamImpl *>(pStream.get())) - pRet.reset(new OOXMLStreamImpl(*pImpl, nStreamType)); + pRet = new OOXMLStreamImpl(*pImpl, nStreamType); } else { @@ -423,7 +423,7 @@ OOXMLDocumentFactory::createStream if (OOXMLStreamImpl* pImpl = dynamic_cast<OOXMLStreamImpl *>(pStream.get())) { std::unique_ptr<OOXMLStreamImpl> pProject(new OOXMLStreamImpl(*pImpl, OOXMLStream::VBAPROJECT)); - pRet.reset(new OOXMLStreamImpl(*pProject, OOXMLStream::VBADATA)); + pRet = new OOXMLStreamImpl(*pProject, OOXMLStream::VBADATA); } } @@ -436,7 +436,7 @@ OOXMLDocumentFactory::createStream { OOXMLStream::Pointer_t pRet; if (OOXMLStreamImpl* pImpl = dynamic_cast<OOXMLStreamImpl *>(pStream.get())) - pRet.reset(new OOXMLStreamImpl(*pImpl, rId)); + pRet = new OOXMLStreamImpl(*pImpl, rId); return pRet; } diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.hxx b/writerfilter/source/ooxml/OOXMLStreamImpl.hxx index 6a168cfd9134..b7d5b4aaa7ed 100644 --- a/writerfilter/source/ooxml/OOXMLStreamImpl.hxx +++ b/writerfilter/source/ooxml/OOXMLStreamImpl.hxx @@ -57,7 +57,7 @@ class OOXMLStreamImpl : public OOXMLStream const OUString & rId, OUString & rDocumentTarget); public: - typedef std::shared_ptr<OOXMLStreamImpl> Pointer_t; + typedef tools::SvRef<OOXMLStreamImpl> Pointer_t; OOXMLStreamImpl (OOXMLStreamImpl const & rStream, StreamType_t nType); diff --git a/writerfilter/source/ooxml/factory_ns.py b/writerfilter/source/ooxml/factory_ns.py index 54afd1e1d568..507f8f012430 100644 --- a/writerfilter/source/ooxml/factory_ns.py +++ b/writerfilter/source/ooxml/factory_ns.py @@ -21,6 +21,7 @@ def createHeader(model, ns): #include "OOXMLFactory_generated.hxx" #include "oox/token/namespaces.hxx" #include "ooxml/resourceids.hxx" +#include "tools/ref.hxx" namespace writerfilter { namespace ooxml { @@ -31,7 +32,7 @@ namespace ooxml { print("""class OOXMLFactory_%s : public OOXMLFactory_ns { public: - typedef std::shared_ptr <OOXMLFactory_ns> Pointer_t; + typedef tools::SvRef<OOXMLFactory_ns> Pointer_t; static Pointer_t getInstance(); diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py b/writerfilter/source/ooxml/factoryimpl_ns.py index 54e3b8c9060a..682239cf95ee 100644 --- a/writerfilter/source/ooxml/factoryimpl_ns.py +++ b/writerfilter/source/ooxml/factoryimpl_ns.py @@ -51,8 +51,8 @@ def factoryGetInstance(nsLabel): OOXMLFactory_ns::Pointer_t OOXMLFactory_%s::getInstance() { - if (m_pInstance.get() == NULL) - m_pInstance.reset(new OOXMLFactory_%s()); + if (!m_pInstance) + m_pInstance = new OOXMLFactory_%s(); return m_pInstance; }""" % (nsLabel, nsLabel, nsLabel)) diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx index ef6525ca1b2b..bb9253a201f5 100644 --- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx +++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx @@ -294,18 +294,17 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) else { RTFSprms aAttributes; - aAttributes.set(Id(0), std::make_shared<RTFValue>(m_nGroupStartPos - 1)); - aAttributes.set(Id(1), std::make_shared<RTFValue>(nId)); - aAttributes.set(Id(2), std::make_shared<RTFValue>(aCustomMark)); + aAttributes.set(Id(0), new RTFValue(m_nGroupStartPos - 1)); + aAttributes.set(Id(1), new RTFValue(nId)); + aAttributes.set(Id(2), new RTFValue(aCustomMark)); m_aStates.top().pCurrentBuffer->push_back( - Buf_t(BUFFER_RESOLVESUBSTREAM, std::make_shared<RTFValue>(aAttributes), - nullptr)); + Buf_t(BUFFER_RESOLVESUBSTREAM, new RTFValue(aAttributes), nullptr)); } if (bCustomMark) { m_aStates.top().aCharacterAttributes.clear(); m_aStates.top().aCharacterSprms.clear(); - auto pValue = std::make_shared<RTFValue>(1); + auto pValue = new RTFValue(1); m_aStates.top().aCharacterAttributes.set( NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows, pValue); text(aCustomMark); @@ -344,16 +343,16 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) RTFSprms aAttributes; if (!m_aAuthor.isEmpty()) { - auto pValue = std::make_shared<RTFValue>(m_aAuthor); + auto pValue = new RTFValue(m_aAuthor); aAttributes.set(NS_ooxml::LN_CT_TrackChange_author, pValue); } if (!m_aAuthorInitials.isEmpty()) { - auto pValue = std::make_shared<RTFValue>(m_aAuthorInitials); + auto pValue = new RTFValue(m_aAuthorInitials); aAttributes.set(NS_ooxml::LN_CT_Comment_initials, pValue); } writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aAttributes); + = new RTFReferenceProperties(aAttributes); Mapper().props(pProperties); } } @@ -387,7 +386,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) RTFSdrImport::SHAPE); else { - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aShape); + auto pValue = new RTFValue(m_aStates.top().aShape); m_aStates.top().pCurrentBuffer->push_back( Buf_t(BUFFER_STARTSHAPE, pValue, nullptr)); } @@ -617,7 +616,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_aStates.top().eDestination = Destination::FOOTNOTESEPARATOR; m_aStates.top().aCharacterAttributes.set( NS_ooxml::LN_CT_FtnEdn_type, - std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_FtnEdn_separator)); + new RTFValue(NS_ooxml::LN_Value_doc_ST_FtnEdn_separator)); break; case RTF_USERPROPS: // Container of all user-defined properties. diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 6099d4e23bc4..ec73d0b4b64d 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -50,7 +50,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nSprm >= 0) { - auto pValue = std::make_shared<RTFValue>(nSprm); + auto pValue = new RTFValue(nSprm); m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue); return RTFError::OK; } @@ -78,7 +78,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_jc, pValue); m_bNeedPap = true; return RTFError::OK; @@ -108,7 +108,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_textAlignment, pValue); return RTFError::OK; } @@ -130,7 +130,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_val, pValue); return RTFError::OK; } @@ -161,7 +161,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_leader, pValue); return RTFError::OK; } @@ -223,7 +223,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_val, pValue); return RTFError::OK; } @@ -256,7 +256,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { m_nResetBreakOnSectBreak = nKeyword; } - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_type, pValue); return RTFError::OK; } @@ -287,7 +287,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_CT_FtnProps_numFmt, pValue); return RTFError::OK; @@ -310,7 +310,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue); return RTFError::OK; @@ -342,7 +342,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_endnotePr, NS_ooxml::LN_CT_EdnProps_numFmt, pValue); return RTFError::OK; @@ -364,7 +364,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TrPrBase_jc, pValue); return RTFError::OK; } @@ -392,7 +392,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_textDirection, pValue); } @@ -421,7 +421,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } if (nParam >= 0) { - auto pValue = std::make_shared<RTFValue>(1); + auto pValue = new RTFValue(1); m_aStates.top().aParagraphSprms.erase(NS_ooxml::LN_inTbl); m_aStates.top().aParagraphSprms.set(nParam, pValue); return RTFError::OK; @@ -483,14 +483,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) else { // We are still in a table. - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_inTbl, - std::make_shared<RTFValue>(1)); + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_inTbl, new RTFValue(1)); if (m_bAfterCellBeforeRow && pOldStyle) // And we still have the same paragraph style. m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, pOldStyle); // Ideally getDefaultSPRM() would take care of this, but it would not when we're buffering. - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_tabs, - std::make_shared<RTFValue>()); + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_tabs, new RTFValue()); } resetFrame(); @@ -504,7 +502,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) && getStyleType(0) != NS_ooxml::LN_Value_ST_StyleType_character) { m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, - std::make_shared<RTFValue>(aName)); + new RTFValue(aName)); m_aStates.top().nCurrentStyleIndex = 0; } else @@ -535,14 +533,14 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_WIDCTLPAR: case RTF_NOWIDCTLPAR: { - auto pValue = std::make_shared<RTFValue>(int(nKeyword == RTF_WIDCTLPAR)); + auto pValue = new RTFValue(int(nKeyword == RTF_WIDCTLPAR)); m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_widowControl, pValue); } break; case RTF_BOX: { RTFSprms aAttributes; - auto pValue = std::make_shared<RTFValue>(aAttributes); + auto pValue = new RTFValue(aAttributes); for (int i = 0; i < 4; i++) m_aStates.top().aParagraphSprms.set(getParagraphBorder(i), pValue); m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH_BOX; @@ -551,7 +549,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_LTRSECT: case RTF_RTLSECT: { - auto pValue = std::make_shared<RTFValue>(nKeyword == RTF_LTRSECT ? 0 : 1); + auto pValue = new RTFValue(nKeyword == RTF_LTRSECT ? 0 : 1); m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_EG_SectPrContents_textDirection, pValue); } @@ -559,15 +557,14 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_LTRPAR: case RTF_RTLPAR: { - auto pValue = std::make_shared<RTFValue>(nKeyword == RTF_LTRPAR ? 0 : 1); + auto pValue = new RTFValue(nKeyword == RTF_LTRPAR ? 0 : 1); m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_bidi, pValue); } break; case RTF_LTRROW: case RTF_RTLROW: - m_aStates.top().aTableRowSprms.set( - NS_ooxml::LN_CT_TblPrBase_bidiVisual, - std::make_shared<RTFValue>(int(nKeyword == RTF_RTLROW))); + m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblPrBase_bidiVisual, + new RTFValue(int(nKeyword == RTF_RTLROW))); break; case RTF_LTRCH: // dmapper does not support this. @@ -580,7 +577,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_ULNONE: { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Underline_none); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_Underline_none); m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue); } break; @@ -595,7 +592,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { RTFSprms aAttributes; RTFSprms aSprms; - auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); + auto pValue = new RTFValue(aAttributes, aSprms); switch (nKeyword) { case RTF_CLBRDRT: @@ -625,7 +622,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { RTFSprms aAttributes; RTFSprms aSprms; - auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); + auto pValue = new RTFValue(aAttributes, aSprms); switch (nKeyword) { case RTF_PGBRDRT: @@ -655,7 +652,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { RTFSprms aAttributes; RTFSprms aSprms; - auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); + auto pValue = new RTFValue(aAttributes, aSprms); switch (nKeyword) { case RTF_BRDRT: @@ -681,32 +678,32 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_CHBRDR: { RTFSprms aAttributes; - auto pValue = std::make_shared<RTFValue>(aAttributes); + auto pValue = new RTFValue(aAttributes); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_bdr, pValue); m_aStates.top().nBorderState = RTFBorderState::CHARACTER; } break; case RTF_CLMGF: { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_restart); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart); m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue); } break; case RTF_CLMRG: { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_continue); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue); m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue); } break; case RTF_CLVMGF: { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_restart); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart); m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue); } break; case RTF_CLVMRG: { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_continue); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue); m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue); } break; @@ -728,19 +725,19 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) default: break; } - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vAlign, pValue); } break; case RTF_TRKEEP: { - auto pValue = std::make_shared<RTFValue>(1); + auto pValue = new RTFValue(1); m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TrPrBase_cantSplit, pValue); } break; case RTF_SECTUNLOCKED: { - auto pValue = std::make_shared<RTFValue>(int(!nParam)); + auto pValue = new RTFValue(int(!nParam)); m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue); } break; @@ -759,7 +756,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_TITLEPG: { - auto pValue = std::make_shared<RTFValue>(1); + auto pValue = new RTFValue(1); m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_titlePg, pValue); } break; @@ -768,13 +765,13 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (!m_aStates.top().pCurrentBuffer) m_aStates.top().pCurrentBuffer = &m_aSuperBuffer; - auto pValue = std::make_shared<RTFValue>("superscript"); + auto pValue = new RTFValue("superscript"); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue); } break; case RTF_SUB: { - auto pValue = std::make_shared<RTFValue>("subscript"); + auto pValue = new RTFValue("subscript"); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue); } break; @@ -791,9 +788,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_LINEPPAGE: case RTF_LINECONT: { - auto pValue = std::make_shared<RTFValue>( - nKeyword == RTF_LINEPPAGE ? NS_ooxml::LN_Value_ST_LineNumberRestart_newPage - : NS_ooxml::LN_Value_ST_LineNumberRestart_continuous); + auto pValue = new RTFValue(nKeyword == RTF_LINEPPAGE + ? NS_ooxml::LN_Value_ST_LineNumberRestart_newPage + : NS_ooxml::LN_Value_ST_LineNumberRestart_continuous); putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_restart, pValue); @@ -816,7 +813,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_ENDDOC: { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_RestartNumber_eachSect); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_RestartNumber_eachSect); putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue); @@ -1026,49 +1023,46 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_CONTEXTUALSPACE: { - auto pValue = std::make_shared<RTFValue>(1); + auto pValue = new RTFValue(1); m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_contextualSpacing, pValue); } break; case RTF_LINKSTYLES: { - auto pValue = std::make_shared<RTFValue>(1); + auto pValue = new RTFValue(1); m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_linkStyles, pValue); } break; case RTF_PNLVLBODY: { - auto pValue = std::make_shared<RTFValue>(2); + auto pValue = new RTFValue(2); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pValue); } break; case RTF_PNDEC: { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_decimal); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_decimal); m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pValue); } break; case RTF_PNLVLBLT: { - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, - std::make_shared<RTFValue>(1)); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, new RTFValue(1)); m_aStates.top().aTableSprms.set( NS_ooxml::LN_CT_Lvl_numFmt, - std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_bullet)); + new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_bullet)); } break; case RTF_LANDSCAPE: { - auto pValue - = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_PageOrientation_landscape); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_PageOrientation_landscape); putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, pValue); SAL_FALLTHROUGH; // set the default + current value } case RTF_LNDSCPSXN: { - auto pValue - = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_PageOrientation_landscape); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_PageOrientation_landscape); putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, pValue); } @@ -1100,42 +1094,35 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_bMathNor = true; break; case RTF_REVISIONS: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_trackRevisions, - std::make_shared<RTFValue>(1)); + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_trackRevisions, new RTFValue(1)); break; case RTF_BRDRSH: - putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_shadow, - std::make_shared<RTFValue>(1)); + putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_shadow, new RTFValue(1)); break; case RTF_NOCOLBAL: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_noColumnBalance, - std::make_shared<RTFValue>(1)); + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_noColumnBalance, new RTFValue(1)); break; case RTF_MARGMIRROR: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_mirrorMargins, - std::make_shared<RTFValue>(1)); + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_mirrorMargins, new RTFValue(1)); break; case RTF_SAUTOUPD: - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_autoRedefine, - std::make_shared<RTFValue>(1)); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_autoRedefine, new RTFValue(1)); break; case RTF_WIDOWCTRL: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_widowControl, - std::make_shared<RTFValue>(1)); + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_widowControl, new RTFValue(1)); break; case RTF_LINEBETCOL: putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, - NS_ooxml::LN_CT_Columns_sep, std::make_shared<RTFValue>(1)); + NS_ooxml::LN_CT_Columns_sep, new RTFValue(1)); break; case RTF_PGNRESTART: putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, - NS_ooxml::LN_CT_PageNumber_start, std::make_shared<RTFValue>(1)); + NS_ooxml::LN_CT_PageNumber_start, new RTFValue(1)); break; case RTF_PGNUCLTR: { - auto pIntValue - = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_upperLetter); + auto pIntValue = new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_upperLetter); putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); @@ -1143,8 +1130,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_PGNLCLTR: { - auto pIntValue - = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter); + auto pIntValue = new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter); putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); @@ -1152,8 +1138,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_PGNUCRM: { - auto pIntValue - = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_upperRoman); + auto pIntValue = new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_upperRoman); putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); @@ -1161,8 +1146,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_PGNLCRM: { - auto pIntValue - = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman); + auto pIntValue = new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman); putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); @@ -1170,7 +1154,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_PGNDEC: { - auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_decimal); + auto pIntValue = new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_decimal); putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); @@ -1178,7 +1162,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_HTMAUTSP: m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing, - std::make_shared<RTFValue>(0)); + new RTFValue(0)); break; default: { diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index e5ae836bb206..5478f5ec0f1a 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -112,9 +112,9 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) // Was in table, but not anymore -> tblEnd. RTFSprms aAttributes; RTFSprms aSprms; - aSprms.set(NS_ooxml::LN_tblEnd, std::make_shared<RTFValue>(1)); + aSprms.set(NS_ooxml::LN_tblEnd, new RTFValue(1)); writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); + = new RTFReferenceProperties(aAttributes, aSprms); Mapper().props(pProperties); } m_nCellxMax = 0; @@ -180,11 +180,11 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) if (m_bNeedPap) { // There were no runs in the cell, so we need to send paragraph and character properties here. - auto pPValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, - m_aStates.top().aParagraphSprms); + auto pPValue = new RTFValue(m_aStates.top().aParagraphAttributes, + m_aStates.top().aParagraphSprms); m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pPValue, nullptr)); - auto pCValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, - m_aStates.top().aCharacterSprms); + auto pCValue = new RTFValue(m_aStates.top().aCharacterAttributes, + m_aStates.top().aCharacterSprms); m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pCValue, nullptr)); } @@ -195,7 +195,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) break; case RTF_NESTROW: { - std::shared_ptr<TableRowBuffer> const pBuffer( + tools::SvRef<TableRowBuffer> const pBuffer( new TableRowBuffer(m_aTableBufferStack.back(), m_aNestedTableCellsSprms, m_aNestedTableCellsAttributes, m_nNestedCells)); prepareProperties(m_aStates.top(), pBuffer->pParaProperties, pBuffer->pFrameProperties, @@ -234,7 +234,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) { // Add fake cellx / cell, RTF equivalent of // OOXMLFastContextHandlerTextTableRow::handleGridAfter(). - auto pXValue = std::make_shared<RTFValue>(m_aStates.top().nTableRowWidthAfter); + auto pXValue = new RTFValue(m_aStates.top().nTableRowWidthAfter); m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND); dispatchSymbol(RTF_CELL); @@ -261,8 +261,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) auto pXValueLast = m_aStates.top().aTableRowSprms.find( NS_ooxml::LN_CT_TblGridBase_gridCol, false); const int nXValueLast = pXValueLast ? pXValueLast->getInt() : 0; - auto pXValue = std::make_shared<RTFValue>(nXValueLast + m_nCellxMax - - m_nTopLevelCurrentCellX); + auto pXValue = new RTFValue(nXValueLast + m_nCellxMax - m_nTopLevelCurrentCellX); m_aStates.top().aTableRowSprms.eraseLast(NS_ooxml::LN_CT_TblGridBase_gridCol); m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND); diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index b605a6ea534a..f10e95119e26 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -113,7 +113,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) checkUnicode(/*bUnicode =*/nKeyword != RTF_U, /*bHex =*/true); RTFSkipDestination aSkip(*this); int nSprm = 0; - auto pIntValue = std::make_shared<RTFValue>(nParam); + auto pIntValue = new RTFValue(nParam); // Trivial table sprms. switch (nKeyword) { @@ -133,12 +133,12 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) nValue = NS_ooxml::LN_Value_ST_Jc_right; break; } - pIntValue = std::make_shared<RTFValue>(nValue); + pIntValue = new RTFValue(nValue); break; } case RTF_LEVELNFC: nSprm = NS_ooxml::LN_CT_Lvl_numFmt; - pIntValue = std::make_shared<RTFValue>(getNumberFormat(nParam)); + pIntValue = new RTFValue(getNumberFormat(nParam)); break; case RTF_LEVELSTARTAT: nSprm = NS_ooxml::LN_CT_Lvl_start; @@ -148,7 +148,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_SBASEDON: nSprm = NS_ooxml::LN_CT_Style_basedOn; - pIntValue = std::make_shared<RTFValue>(getStyleName(nParam)); + pIntValue = new RTFValue(getStyleName(nParam)); break; default: break; @@ -214,7 +214,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (nSprm > 0) { LanguageTag aTag((LanguageType(static_cast<sal_uInt16>(nParam)))); - auto pValue = std::make_shared<RTFValue>(aTag.getBcp47()); + auto pValue = new RTFValue(aTag.getBcp47()); putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_lang, nSprm, pValue); // Language is a character property, but we should store it at a paragraph level as well for fields. @@ -233,7 +233,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (nParam == 0 && (m_nTopLevelCells != 0 || m_nNestedCells != 0)) { nParam = 1; - pIntValue = std::make_shared<RTFValue>(nParam); + pIntValue = new RTFValue(nParam); } break; default: @@ -358,19 +358,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) else if (m_aStates.top().eDestination == Destination::LISTLEVEL) { RTFSprms aFontAttributes; - aFontAttributes.set(nSprm, - std::make_shared<RTFValue>(m_aFontNames[getFontIndex(nParam)])); + aFontAttributes.set(nSprm, new RTFValue(m_aFontNames[getFontIndex(nParam)])); RTFSprms aRunPropsSprms; - aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, - std::make_shared<RTFValue>(aFontAttributes)); - m_aStates.top().aTableSprms.set( - NS_ooxml::LN_CT_Lvl_rPr, std::make_shared<RTFValue>(RTFSprms(), aRunPropsSprms), - RTFOverwrite::NO_APPEND); + aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, new RTFValue(aFontAttributes)); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_rPr, + new RTFValue(RTFSprms(), aRunPropsSprms), + RTFOverwrite::NO_APPEND); } else { m_nCurrentFontIndex = getFontIndex(nParam); - auto pValue = std::make_shared<RTFValue>(getFontName(m_nCurrentFontIndex)); + auto pValue = new RTFValue(getFontName(m_nCurrentFontIndex)); putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, nSprm, pValue); if (nKeyword == RTF_F) @@ -424,10 +422,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_CF: { RTFSprms aAttributes; - auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam))); + auto pValue = new RTFValue(sal_uInt32(getColorTable(nParam))); aAttributes.set(NS_ooxml::LN_CT_Color_val, pValue); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_color, - std::make_shared<RTFValue>(aAttributes)); + new RTFValue(aAttributes)); } break; case RTF_S: @@ -438,7 +436,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) || m_aStates.top().eDestination == Destination::STYLEENTRY) { m_nCurrentStyleIndex = nParam; - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_StyleType_paragraph); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_paragraph); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // paragraph style } @@ -449,10 +447,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { if (m_aStates.top().eDestination == Destination::LISTLEVEL) m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_pStyle, - std::make_shared<RTFValue>(aName)); + new RTFValue(aName)); else m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, - std::make_shared<RTFValue>(aName)); + new RTFValue(aName)); } } } @@ -463,7 +461,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) || m_aStates.top().eDestination == Destination::STYLEENTRY) { m_nCurrentStyleIndex = nParam; - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_StyleType_character); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_character); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // character style } @@ -472,7 +470,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) OUString aName = getStyleName(nParam); if (!aName.isEmpty()) m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_rStyle, - std::make_shared<RTFValue>(aName)); + new RTFValue(aName)); } break; case RTF_DS: @@ -480,7 +478,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) || m_aStates.top().eDestination == Destination::STYLEENTRY) { m_nCurrentStyleIndex = nParam; - auto pValue = std::make_shared<RTFValue>(0); // TODO no value in enum StyleType? + auto pValue = new RTFValue(0); // TODO no value in enum StyleType? m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // section style } @@ -491,7 +489,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { m_nCurrentStyleIndex = nParam; // FIXME the correct value would be NS_ooxml::LN_Value_ST_StyleType_table but maybe table styles mess things up in dmapper, be cautious and disable them for now - auto pValue = std::make_shared<RTFValue>(0); + auto pValue = new RTFValue(0); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // table style } @@ -503,7 +501,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_ADEFLANG: { LanguageTag aTag((LanguageType(nParam))); - auto pValue = std::make_shared<RTFValue>(aTag.getBcp47()); + auto pValue = new RTFValue(aTag.getBcp47()); putNestedAttribute(m_aStates.top().aCharacterSprms, (nKeyword == RTF_DEFLANG ? NS_ooxml::LN_EG_RPrBase_lang : NS_ooxml::LN_CT_Language_bidi), @@ -512,8 +510,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_CHCBPAT: { - auto pValue - = std::make_shared<RTFValue>(sal_uInt32(nParam ? getColorTable(nParam) : COL_AUTO)); + auto pValue = new RTFValue(sal_uInt32(nParam ? getColorTable(nParam) : COL_AUTO)); putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue); } @@ -521,7 +518,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_CLCBPAT: case RTF_CLCBPATRAW: { - auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam))); + auto pValue = new RTFValue(sal_uInt32(getColorTable(nParam))); putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue); } @@ -529,34 +526,33 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_CBPAT: if (nParam) { - auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam))); + auto pValue = new RTFValue(sal_uInt32(getColorTable(nParam))); putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue); } break; case RTF_ULC: { - auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam))); + auto pValue = new RTFValue(sal_uInt32(getColorTable(nParam))); m_aStates.top().aCharacterSprms.set(0x6877, pValue); } break; case RTF_HIGHLIGHT: { - auto pValue - = std::make_shared<RTFValue>(sal_uInt32(nParam ? getColorTable(nParam) : COL_AUTO)); + auto pValue = new RTFValue(sal_uInt32(nParam ? getColorTable(nParam) : COL_AUTO)); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_highlight, pValue); } break; case RTF_UP: case RTF_DN: { - auto pValue = std::make_shared<RTFValue>(nParam * (nKeyword == RTF_UP ? 1 : -1)); + auto pValue = new RTFValue(nParam * (nKeyword == RTF_UP ? 1 : -1)); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_position, pValue); } break; case RTF_HORZVERT: { - auto pValue = std::make_shared<RTFValue>(int(true)); + auto pValue = new RTFValue(int(true)); m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_vert, pValue); if (nParam) // rotate fits to a single line @@ -567,13 +563,13 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_EXPND: { // Convert quarter-points to twentieths of a point - auto pValue = std::make_shared<RTFValue>(nParam * 5); + auto pValue = new RTFValue(nParam * 5); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_spacing, pValue); } break; case RTF_TWOINONE: { - auto pValue = std::make_shared<RTFValue>(int(true)); + auto pValue = new RTFValue(int(true)); m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_combine, pValue); nId = 0; @@ -597,20 +593,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } if (nId > 0) m_aStates.top().aCharacterAttributes.set( - NS_ooxml::LN_CT_EastAsianLayout_combineBrackets, - std::make_shared<RTFValue>(nId)); + NS_ooxml::LN_CT_EastAsianLayout_combineBrackets, new RTFValue(nId)); } break; case RTF_SL: { // This is similar to RTF_ABSH, negative value means 'exact', positive means 'at least'. - auto pValue - = std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast); + auto pValue = new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast); if (nParam < 0) { - pValue - = std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact); - pIntValue = std::make_shared<RTFValue>(-nParam); + pValue = new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact); + pIntValue = new RTFValue(-nParam); } m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue); m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_line, pIntValue); @@ -619,8 +612,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_SLMULT: if (nParam > 0) { - auto pValue - = std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_auto); + auto pValue = new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_auto); m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue); } break; @@ -629,27 +621,27 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // dmapper expects it in 1/8 pt, we have it in twip - but avoid rounding 1 to 0 if (nParam > 1) nParam = nParam * 2 / 5; - auto pValue = std::make_shared<RTFValue>(nParam); + auto pValue = new RTFValue(nParam); putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_sz, pValue); } break; case RTF_BRDRCF: { - auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam))); + auto pValue = new RTFValue(sal_uInt32(getColorTable(nParam))); putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_color, pValue); } break; case RTF_BRSP: { // dmapper expects it in points, we have it in twip - auto pValue = std::make_shared<RTFValue>(nParam / 20); + auto pValue = new RTFValue(nParam / 20); putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_space, pValue); } break; case RTF_TX: { m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_pos, pIntValue); - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aTabAttributes); + auto pValue = new RTFValue(m_aStates.top().aTabAttributes); if (m_aStates.top().eDestination == Destination::LISTLEVEL) putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); @@ -733,8 +725,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; } if (!sValue.isEmpty()) - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_suff, - std::make_shared<RTFValue>(sValue)); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_suff, new RTFValue(sValue)); } break; case RTF_FPRQ: @@ -755,9 +746,9 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (nValue) { RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_Pitch_val, std::make_shared<RTFValue>(nValue)); + aAttributes.set(NS_ooxml::LN_CT_Pitch_val, new RTFValue(nValue)); m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Font_pitch, - std::make_shared<RTFValue>(aAttributes)); + new RTFValue(aAttributes)); } } break; @@ -814,7 +805,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) default: break; } - auto pValue = std::make_shared<RTFValue>(nValue); + auto pValue = new RTFValue(nValue); RTFValue::Pointer_t pTight = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_EG_WrapType_wrapTight); if (pTight) @@ -837,12 +828,12 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case 3: m_aStates.top().aShape.nWrap = text::WrapTextMode_THROUGH; m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, - std::make_shared<RTFValue>()); + new RTFValue()); break; case 4: m_aStates.top().aShape.nWrap = text::WrapTextMode_PARALLEL; m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapTight, - std::make_shared<RTFValue>()); + new RTFValue()); break; case 5: m_aStates.top().aShape.nWrap = text::WrapTextMode_THROUGH; @@ -873,7 +864,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } rCurrentCellX = nParam; - auto pXValue = std::make_shared<RTFValue>(nCellX); + auto pXValue = new RTFValue(nCellX); m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND); if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) @@ -900,9 +891,9 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // Wasn't in table, but now is -> tblStart. RTFSprms aAttributes; RTFSprms aSprms; - aSprms.set(NS_ooxml::LN_tblStart, std::make_shared<RTFValue>(1)); + aSprms.set(NS_ooxml::LN_tblStart, new RTFValue(1)); writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); + = new RTFReferenceProperties(aAttributes, aSprms); Mapper().props(pProperties); } m_nCellxMax = std::max(m_nCellxMax, nParam); @@ -913,8 +904,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) OUString hRule("auto"); if (nParam < 0) { - auto pAbsValue = std::make_shared<RTFValue>(-nParam); - pIntValue.swap(pAbsValue); + auto pAbsValue = new RTFValue(-nParam); + std::swap(pIntValue, pAbsValue); hRule = "exact"; } @@ -924,7 +915,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TrPrBase_trHeight, NS_ooxml::LN_CT_Height_val, pIntValue); - auto pHRule = std::make_shared<RTFValue>(hRule); + auto pHRule = new RTFValue(hRule); putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TrPrBase_trHeight, NS_ooxml::LN_CT_Height_hRule, pHRule); } @@ -934,9 +925,9 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // the value is in twips putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblInd, NS_ooxml::LN_CT_TblWidth_type, - std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)); putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblInd, - NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(nParam)); + NS_ooxml::LN_CT_TblWidth_w, new RTFValue(nParam)); auto const aDestination = m_aStates.top().eDestination; int& rCurrentTRLeft((Destination::NESTEDTABLEPROPERTIES == aDestination) ? m_nNestedTRLeft @@ -1047,7 +1038,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_REVAUTH: case RTF_REVAUTHDEL: { - auto pValue = std::make_shared<RTFValue>(m_aAuthors[nParam]); + auto pValue = new RTFValue(m_aAuthors[nParam]); putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_author, pValue); } @@ -1057,7 +1048,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { OUString aStr( OStringToOUString(DTTM22OString(nParam), m_aStates.top().nCurrentEncoding)); - auto pValue = std::make_shared<RTFValue>(aStr); + auto pValue = new RTFValue(aStr); putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_date, pValue); } @@ -1219,11 +1210,11 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_PNF: { - auto pValue = std::make_shared<RTFValue>(m_aFontNames[getFontIndex(nParam)]); + auto pValue = new RTFValue(m_aFontNames[getFontIndex(nParam)]); RTFSprms aAttributes; aAttributes.set(NS_ooxml::LN_CT_Fonts_ascii, pValue); putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_rPr, - NS_ooxml::LN_EG_RPrBase_rFonts, std::make_shared<RTFValue>(aAttributes)); + NS_ooxml::LN_EG_RPrBase_rFonts, new RTFValue(aAttributes)); } break; case RTF_VIEWSCALE: @@ -1338,7 +1329,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } if (nValue != -1) putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_shd, - NS_ooxml::LN_CT_Shd_val, std::make_shared<RTFValue>(nValue)); + NS_ooxml::LN_CT_Shd_val, new RTFValue(nValue)); } break; case RTF_DODHGT: @@ -1388,8 +1379,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { RTFSprms aAttributes; aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, - std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); - aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(nParam)); + new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, new RTFValue(nParam)); // Top and left is swapped, that's what Word does. switch (nKeyword) { @@ -1409,7 +1400,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; } putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, - std::make_shared<RTFValue>(aAttributes)); + new RTFValue(aAttributes)); } break; case RTF_TRPADDFB: @@ -1422,7 +1413,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { case 3: aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, - std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)); break; } switch (nKeyword) @@ -1443,9 +1434,9 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; } putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, - nSprm, std::make_shared<RTFValue>(aAttributes)); + nSprm, new RTFValue(aAttributes)); putNestedAttribute(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, - nSprm, std::make_shared<RTFValue>(aAttributes)); + nSprm, new RTFValue(aAttributes)); } break; case RTF_TRPADDB: @@ -1454,7 +1445,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_TRPADDT: { RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(nParam)); + aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, new RTFValue(nParam)); switch (nKeyword) { case RTF_TRPADDB: @@ -1473,9 +1464,9 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; } putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, - std::make_shared<RTFValue>(aAttributes)); + new RTFValue(aAttributes)); putNestedSprm(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, - std::make_shared<RTFValue>(aAttributes)); + new RTFValue(aAttributes)); } break; case RTF_FI: @@ -1509,7 +1500,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // It turns out \li should reset the \fi inherited from the stylesheet. // So set the direct formatting to zero, if we don't have such direct formatting yet. putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, - NS_ooxml::LN_CT_Ind_firstLine, std::make_shared<RTFValue>(0), + NS_ooxml::LN_CT_Ind_firstLine, new RTFValue(0), RTFOverwrite::NO_IGNORE); } break; @@ -1534,14 +1525,12 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { RTFSprms aAttributes; aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, - std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)); aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, pIntValue); putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, - NS_ooxml::LN_CT_TblCellMar_left, - std::make_shared<RTFValue>(aAttributes)); + NS_ooxml::LN_CT_TblCellMar_left, new RTFValue(aAttributes)); putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, - NS_ooxml::LN_CT_TblCellMar_right, - std::make_shared<RTFValue>(aAttributes)); + NS_ooxml::LN_CT_TblCellMar_right, new RTFValue(aAttributes)); } break; case RTF_TRFTSWIDTH: @@ -1595,7 +1584,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (nId > 0) m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_effect, - std::make_shared<RTFValue>(nId)); + new RTFValue(nId)); break; } case RTF_VIEWBKSP: diff --git a/writerfilter/source/rtftok/rtfdocumentfactory.cxx b/writerfilter/source/rtftok/rtfdocumentfactory.cxx index ad5e503a3276..5a8de68916c3 100644 --- a/writerfilter/source/rtftok/rtfdocumentfactory.cxx +++ b/writerfilter/source/rtftok/rtfdocumentfactory.cxx @@ -21,8 +21,8 @@ RTFDocument::Pointer_t RTFDocumentFactory::createDocument( css::uno::Reference<css::task::XStatusIndicator> const& xStatusIndicator, const utl::MediaDescriptor& rMediaDescriptor) { - return std::make_shared<RTFDocumentImpl>(xContext, xInputStream, xDstDoc, xFrame, - xStatusIndicator, rMediaDescriptor); + return new RTFDocumentImpl(xContext, xInputStream, xDstDoc, xFrame, xStatusIndicator, + rMediaDescriptor); } } // namespace rtftok diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index aa4f859aabc3..20fb1ca4fab8 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -87,12 +87,10 @@ void putNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId, const RTFValue::Po if (nParent == NS_ooxml::LN_CT_TcPrBase_shd) { // RTF default is 'auto', see writerfilter::dmapper::CellColorHandler - aAttributes.set(NS_ooxml::LN_CT_Shd_color, - std::make_shared<RTFValue>(sal_uInt32(COL_AUTO))); - aAttributes.set(NS_ooxml::LN_CT_Shd_fill, - std::make_shared<RTFValue>(sal_uInt32(COL_AUTO))); + aAttributes.set(NS_ooxml::LN_CT_Shd_color, new RTFValue(sal_uInt32(COL_AUTO))); + aAttributes.set(NS_ooxml::LN_CT_Shd_fill, new RTFValue(sal_uInt32(COL_AUTO))); } - auto pParentValue = std::make_shared<RTFValue>(aAttributes); + auto pParentValue = new RTFValue(aAttributes); rSprms.set(nParent, pParentValue, eOverwrite); pParent = pParentValue; } @@ -189,11 +187,11 @@ OString DTTM22OString(long nDTTM) static RTFSprms lcl_getBookmarkProperties(int nPos, OUString& rString) { RTFSprms aAttributes; - auto pPos = std::make_shared<RTFValue>(nPos); + auto pPos = new RTFValue(nPos); if (!rString.isEmpty()) { // If present, this should be sent first. - auto pString = std::make_shared<RTFValue>(rString); + auto pString = new RTFValue(rString); aAttributes.set(NS_ooxml::LN_CT_Bookmark_name, pString); } aAttributes.set(NS_ooxml::LN_CT_MarkupRangeBookmark_id, pPos); @@ -309,8 +307,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x m_pGraphicHelper.reset(new oox::GraphicHelper(m_xContext, xFrame, oox::StorageRef())); - m_pTokenizer.reset(new RTFTokenizer(*this, m_pInStream.get(), m_xStatusIndicator)); - m_pSdrImport.reset(new RTFSdrImport(*this, m_xDstDoc)); + m_pTokenizer = new RTFTokenizer(*this, m_pInStream.get(), m_xStatusIndicator); + m_pSdrImport = new RTFSdrImport(*this, m_xDstDoc); } RTFDocumentImpl::~RTFDocumentImpl() = default; @@ -334,8 +332,8 @@ void RTFDocumentImpl::resolveSubstream(std::size_t nPos, Id nId, OUString const& { sal_uInt64 const nCurrent = Strm().Tell(); // Seek to header position, parse, then seek back. - auto pImpl = std::make_shared<RTFDocumentImpl>(m_xContext, m_xInputStream, m_xDstDoc, m_xFrame, - m_xStatusIndicator, m_rMediaDescriptor); + auto pImpl = new RTFDocumentImpl(m_xContext, m_xInputStream, m_xDstDoc, m_xFrame, + m_xStatusIndicator, m_rMediaDescriptor); pImpl->setSuperstream(this); pImpl->m_nStreamType = nId; pImpl->m_aIgnoreFirst = rIgnoreFirst; @@ -359,12 +357,11 @@ void RTFDocumentImpl::resolveSubstream(std::size_t nPos, Id nId, OUString const& void RTFDocumentImpl::outputSettingsTable() { - writerfilter::Reference<Properties>::Pointer_t pProp = std::make_shared<RTFReferenceProperties>( - m_aSettingsTableAttributes, m_aSettingsTableSprms); + writerfilter::Reference<Properties>::Pointer_t pProp + = new RTFReferenceProperties(m_aSettingsTableAttributes, m_aSettingsTableSprms); RTFReferenceTable::Entries_t aSettingsTableEntries; aSettingsTableEntries.insert(std::make_pair(0, pProp)); - writerfilter::Reference<Table>::Pointer_t pTable - = std::make_shared<RTFReferenceTable>(aSettingsTableEntries); + writerfilter::Reference<Table>::Pointer_t pTable = new RTFReferenceTable(aSettingsTableEntries); Mapper().table(NS_ooxml::LN_settings_settings, pTable); } @@ -508,13 +505,13 @@ RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms const& rSprms, Id // Get rid of direct formatting what is already in the style. RTFSprms const sprms(aSprms.cloneAndDeduplicate(aStyleSprms)); RTFSprms const attributes(rAttributes.cloneAndDeduplicate(aStyleAttributes)); - return std::make_shared<RTFReferenceProperties>(attributes, sprms); + return new RTFReferenceProperties(attributes, sprms); } if (pAbstractList) aSprms.duplicateList(pAbstractList); writerfilter::Reference<Properties>::Pointer_t pRet - = std::make_shared<RTFReferenceProperties>(rAttributes, aSprms); + = new RTFReferenceProperties(rAttributes, aSprms); return pRet; } @@ -557,8 +554,8 @@ void RTFDocumentImpl::checkNeedPap() } else { - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, - m_aStates.top().aParagraphSprms); + auto pValue = new RTFValue(m_aStates.top().aParagraphAttributes, + m_aStates.top().aParagraphSprms); m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, pValue, nullptr)); } } @@ -575,8 +572,8 @@ void RTFDocumentImpl::runProps() } else { - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, - m_aStates.top().aCharacterSprms); + auto pValue + = new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, pValue, nullptr)); } @@ -661,13 +658,12 @@ void RTFDocumentImpl::sectBreak(bool bFinal) } // Section properties are a paragraph sprm. - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aSectionAttributes, - m_aStates.top().aSectionSprms); + auto pValue = new RTFValue(m_aStates.top().aSectionAttributes, m_aStates.top().aSectionSprms); RTFSprms aAttributes; RTFSprms aSprms; aSprms.set(NS_ooxml::LN_CT_PPr_sectPr, pValue); writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); + = new RTFReferenceProperties(aAttributes, aSprms); if (bFinal && !m_pSuperstream) // This is the end of the document, not just the end of e.g. a header. @@ -956,7 +952,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS xPropertySet->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AS_CHARACTER)); - auto pShapeValue = std::make_shared<RTFValue>(xShape); + auto pShapeValue = new RTFValue(xShape); m_aObjectAttributes.set(NS_ooxml::LN_shape, pShapeValue); return; } @@ -974,20 +970,20 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS RTFSprms aAttributes; // shape attribute RTFSprms aPicAttributes; - auto pShapeValue = std::make_shared<RTFValue>(xShape); + auto pShapeValue = new RTFValue(xShape); aPicAttributes.set(NS_ooxml::LN_shape, pShapeValue); // pic sprm RTFSprms aGraphicDataAttributes; RTFSprms aGraphicDataSprms; - auto pPicValue = std::make_shared<RTFValue>(aPicAttributes); + auto pPicValue = new RTFValue(aPicAttributes); aGraphicDataSprms.set(NS_ooxml::LN_pic_pic, pPicValue); // graphicData sprm RTFSprms aGraphicAttributes; RTFSprms aGraphicSprms; - auto pGraphicDataValue = std::make_shared<RTFValue>(aGraphicDataAttributes, aGraphicDataSprms); + auto pGraphicDataValue = new RTFValue(aGraphicDataAttributes, aGraphicDataSprms); aGraphicSprms.set(NS_ooxml::LN_CT_GraphicalObject_graphicData, pGraphicDataValue); // graphic sprm - auto pGraphicValue = std::make_shared<RTFValue>(aGraphicAttributes, aGraphicSprms); + auto pGraphicValue = new RTFValue(aGraphicAttributes, aGraphicSprms); // extent sprm RTFSprms aExtentAttributes; int nXExt, nYExt; @@ -1009,31 +1005,31 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS nXExt = m_aStates.top().aShape.nRight - m_aStates.top().aShape.nLeft; nYExt = m_aStates.top().aShape.nBottom - m_aStates.top().aShape.nTop; } - auto pXExtValue = std::make_shared<RTFValue>(oox::drawingml::convertHmmToEmu(nXExt)); - auto pYExtValue = std::make_shared<RTFValue>(oox::drawingml::convertHmmToEmu(nYExt)); + auto pXExtValue = new RTFValue(oox::drawingml::convertHmmToEmu(nXExt)); + auto pYExtValue = new RTFValue(oox::drawingml::convertHmmToEmu(nYExt)); aExtentAttributes.set(NS_ooxml::LN_CT_PositiveSize2D_cx, pXExtValue); aExtentAttributes.set(NS_ooxml::LN_CT_PositiveSize2D_cy, pYExtValue); - auto pExtentValue = std::make_shared<RTFValue>(aExtentAttributes); + auto pExtentValue = new RTFValue(aExtentAttributes); // docpr sprm RTFSprms aDocprAttributes; for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes) if (rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_name || rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_descr) aDocprAttributes.set(rCharacterAttribute.first, rCharacterAttribute.second); - auto pDocprValue = std::make_shared<RTFValue>(aDocprAttributes); + auto pDocprValue = new RTFValue(aDocprAttributes); if (bInline) { RTFSprms aInlineAttributes; - aInlineAttributes.set(NS_ooxml::LN_CT_Inline_distT, std::make_shared<RTFValue>(0)); - aInlineAttributes.set(NS_ooxml::LN_CT_Inline_distB, std::make_shared<RTFValue>(0)); - aInlineAttributes.set(NS_ooxml::LN_CT_Inline_distL, std::make_shared<RTFValue>(0)); - aInlineAttributes.set(NS_ooxml::LN_CT_Inline_distR, std::make_shared<RTFValue>(0)); + aInlineAttributes.set(NS_ooxml::LN_CT_Inline_distT, new RTFValue(0)); + aInlineAttributes.set(NS_ooxml::LN_CT_Inline_distB, new RTFValue(0)); + aInlineAttributes.set(NS_ooxml::LN_CT_Inline_distL, new RTFValue(0)); + aInlineAttributes.set(NS_ooxml::LN_CT_Inline_distR, new RTFValue(0)); RTFSprms aInlineSprms; aInlineSprms.set(NS_ooxml::LN_CT_Inline_extent, pExtentValue); aInlineSprms.set(NS_ooxml::LN_CT_Inline_docPr, pDocprValue); aInlineSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue); // inline sprm - auto pValue = std::make_shared<RTFValue>(aInlineAttributes, aInlineSprms); + auto pValue = new RTFValue(aInlineAttributes, aInlineSprms); aSprms.set(NS_ooxml::LN_inline_inline, pValue); } else // anchored @@ -1042,7 +1038,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS RTFSprms aAnchorWrapAttributes; m_aStates.top().aShape.aAnchorAttributes.set( NS_ooxml::LN_CT_Anchor_behindDoc, - std::make_shared<RTFValue>((m_aStates.top().aShape.bInBackground) ? 1 : 0)); + new RTFValue((m_aStates.top().aShape.bInBackground) ? 1 : 0)); RTFSprms aAnchorSprms; for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes) { @@ -1062,13 +1058,12 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS && !m_aStates.top().aShape.aWrapPolygonSprms.empty()) rCharacterSprm.second->getSprms().set( NS_ooxml::LN_CT_WrapTight_wrapPolygon, - std::make_shared<RTFValue>(RTFSprms(), - m_aStates.top().aShape.aWrapPolygonSprms)); + new RTFValue(RTFSprms(), m_aStates.top().aShape.aWrapPolygonSprms)); aAnchorSprms.set(rCharacterSprm.first, rCharacterSprm.second); } } - auto pAnchorWrapValue = std::make_shared<RTFValue>(aAnchorWrapAttributes); + auto pAnchorWrapValue = new RTFValue(aAnchorWrapAttributes); aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue); if (!aAnchorWrapAttributes.empty() && nWrap == -1) aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue); @@ -1077,44 +1072,41 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS RTFSprms aPoshAttributes; RTFSprms aPoshSprms; if (m_aStates.top().aShape.nHoriOrientRelationToken > 0) - aPoshAttributes.set( - NS_ooxml::LN_CT_PosH_relativeFrom, - std::make_shared<RTFValue>(m_aStates.top().aShape.nHoriOrientRelationToken)); + aPoshAttributes.set(NS_ooxml::LN_CT_PosH_relativeFrom, + new RTFValue(m_aStates.top().aShape.nHoriOrientRelationToken)); if (m_aStates.top().aShape.nLeft != 0) { Mapper().positionOffset( OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nLeft)), /*bVertical=*/false); - aPoshSprms.set(NS_ooxml::LN_CT_PosH_posOffset, std::make_shared<RTFValue>()); + aPoshSprms.set(NS_ooxml::LN_CT_PosH_posOffset, new RTFValue()); } aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, - std::make_shared<RTFValue>(aPoshAttributes, aPoshSprms)); + new RTFValue(aPoshAttributes, aPoshSprms)); RTFSprms aPosvAttributes; RTFSprms aPosvSprms; if (m_aStates.top().aShape.nVertOrientRelationToken > 0) - aPosvAttributes.set( - NS_ooxml::LN_CT_PosV_relativeFrom, - std::make_shared<RTFValue>(m_aStates.top().aShape.nVertOrientRelationToken)); + aPosvAttributes.set(NS_ooxml::LN_CT_PosV_relativeFrom, + new RTFValue(m_aStates.top().aShape.nVertOrientRelationToken)); if (m_aStates.top().aShape.nTop != 0) { Mapper().positionOffset( OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nTop)), /*bVertical=*/true); - aPosvSprms.set(NS_ooxml::LN_CT_PosV_posOffset, std::make_shared<RTFValue>()); + aPosvSprms.set(NS_ooxml::LN_CT_PosV_posOffset, new RTFValue()); } aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, - std::make_shared<RTFValue>(aPosvAttributes, aPosvSprms)); + new RTFValue(aPosvAttributes, aPosvSprms)); aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue); aAnchorSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue); // anchor sprm - auto pValue - = std::make_shared<RTFValue>(m_aStates.top().aShape.aAnchorAttributes, aAnchorSprms); + auto pValue = new RTFValue(m_aStates.top().aShape.aAnchorAttributes, aAnchorSprms); aSprms.set(NS_ooxml::LN_anchor_anchor, pValue); } writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); + = new RTFReferenceProperties(aAttributes, aSprms); checkFirstRun(); if (!m_aStates.top().pCurrentBuffer) @@ -1125,7 +1117,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS } else { - auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); + auto pValue = new RTFValue(aAttributes, aSprms); m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, pValue, nullptr)); } } @@ -1273,7 +1265,7 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps) else { pCurrentBuffer->push_back(Buf_t(BUFFER_STARTRUN, nullptr, nullptr)); - auto pValue = std::make_shared<RTFValue>(*sValue); + auto pValue = new RTFValue(*sValue); pCurrentBuffer->push_back(Buf_t(BUFFER_TEXT, pValue, nullptr)); pCurrentBuffer->push_back(Buf_t(BUFFER_ENDRUN, nullptr, nullptr)); } @@ -1324,7 +1316,7 @@ void RTFDocumentImpl::text(OUString& rString) m_nCurrentEncoding = -1; } m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Font_name, - std::make_shared<RTFValue>(aName)); + new RTFValue(aName)); writerfilter::Reference<Properties>::Pointer_t const pProp( new RTFReferenceProperties(m_aStates.top().aTableAttributes, @@ -1351,7 +1343,7 @@ void RTFDocumentImpl::text(OUString& rString) // Word strips whitespace around style names. m_aStyleNames[m_nCurrentStyleIndex] = aName.trim(); m_aStyleTypes[m_nCurrentStyleIndex] = pType->getInt(); - auto pValue = std::make_shared<RTFValue>(aName.trim()); + auto pValue = new RTFValue(aName.trim()); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, pValue); m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue); @@ -1444,7 +1436,7 @@ void RTFDocumentImpl::text(OUString& rString) && m_nTopLevelCells == 0) { m_aTableBufferStack.back().emplace_back( - Buf_t(BUFFER_UTEXT, std::make_shared<RTFValue>(rString), nullptr)); + Buf_t(BUFFER_UTEXT, new RTFValue(rString), nullptr)); return; } @@ -1477,7 +1469,7 @@ void RTFDocumentImpl::text(OUString& rString) Mapper().utext(reinterpret_cast<sal_uInt8 const*>(rString.getStr()), rString.getLength()); else { - auto pValue = std::make_shared<RTFValue>(rString); + auto pValue = new RTFValue(rString); pCurrentBuffer->push_back(Buf_t(BUFFER_UTEXT, pValue, nullptr)); } @@ -1503,8 +1495,7 @@ void RTFDocumentImpl::prepareProperties( if (rState.aFrame.hasProperties()) { - o_rpFrameProperties - = std::make_shared<RTFReferenceProperties>(RTFSprms(), rState.aFrame.getSprms()); + o_rpFrameProperties = new RTFReferenceProperties(RTFSprms(), rState.aFrame.getSprms()); } // Table width. @@ -1512,15 +1503,15 @@ void RTFDocumentImpl::prepareProperties( = rState.aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblW); if (!pTableWidthProps.get()) { - auto pUnitValue = std::make_shared<RTFValue>(3); + auto pUnitValue = new RTFValue(3); putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_type, pUnitValue); - auto pWValue = std::make_shared<RTFValue>(nCurrentCellX); + auto pWValue = new RTFValue(nCurrentCellX); putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pWValue); } - auto pRowValue = std::make_shared<RTFValue>(1); + auto pRowValue = new RTFValue(1); if (nCells > 0) rState.aTableRowSprms.set(NS_ooxml::LN_tblRow, pRowValue); @@ -1531,16 +1522,16 @@ void RTFDocumentImpl::prepareProperties( // If no cell margins are defined, the default left/right margin is 0 in Word, but not in Writer. RTFSprms aAttributes; aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, - std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); - aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(0)); + new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, new RTFValue(0)); putNestedSprm(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, - NS_ooxml::LN_CT_TblCellMar_left, std::make_shared<RTFValue>(aAttributes)); + NS_ooxml::LN_CT_TblCellMar_left, new RTFValue(aAttributes)); putNestedSprm(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, - NS_ooxml::LN_CT_TblCellMar_right, std::make_shared<RTFValue>(aAttributes)); + NS_ooxml::LN_CT_TblCellMar_right, new RTFValue(aAttributes)); } - o_rpTableRowProperties = std::make_shared<RTFReferenceProperties>(rState.aTableRowAttributes, - rState.aTableRowSprms); + o_rpTableRowProperties + = new RTFReferenceProperties(rState.aTableRowAttributes, rState.aTableRowSprms); } void RTFDocumentImpl::sendProperties( @@ -1604,7 +1595,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms, else if (std::get<0>(aTuple) == BUFFER_CELLEND) { assert(pSprms && pAttributes); - auto pValue = std::make_shared<RTFValue>(1); + auto pValue = new RTFValue(1); pSprms->set(NS_ooxml::LN_tblCell, pValue); writerfilter::Reference<Properties>::Pointer_t const pTableCellProperties( new RTFReferenceProperties(*pAttributes, *pSprms)); @@ -1687,8 +1678,8 @@ void RTFDocumentImpl::restoreTableRowProperties() void RTFDocumentImpl::resetTableRowProperties() { m_aStates.top().aTableRowSprms = m_aDefaultState.aTableRowSprms; - m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, - std::make_shared<RTFValue>(-1), RTFOverwrite::NO_APPEND); + m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, new RTFValue(-1), + RTFOverwrite::NO_APPEND); m_aStates.top().aTableRowAttributes = m_aDefaultState.aTableRowAttributes; if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) { @@ -1708,7 +1699,7 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n checkUnicode(/*bUnicode =*/true, /*bHex =*/true); RTFSkipDestination aSkip(*this); int nSprm = -1; - auto pBoolValue = std::make_shared<RTFValue>(int(!bParam || nParam != 0)); + auto pBoolValue = new RTFValue(int(!bParam || nParam != 0)); // Underline toggles. switch (nKeyword) @@ -1763,8 +1754,8 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n } if (nSprm >= 0) { - auto pValue = std::make_shared<RTFValue>( - (!bParam || nParam != 0) ? nSprm : NS_ooxml::LN_Value_ST_Underline_none); + auto pValue + = new RTFValue((!bParam || nParam != 0) ? nSprm : NS_ooxml::LN_Value_ST_Underline_none); m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue); return RTFError::OK; } @@ -1792,7 +1783,7 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n } if (nSprm >= 0) { - auto pValue = std::make_shared<RTFValue>((!bParam || nParam != 0) ? nSprm : 0); + auto pValue = new RTFValue((!bParam || nParam != 0) ? nSprm : 0); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_em, pValue); return RTFError::OK; } @@ -1855,8 +1846,7 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n case RTF_DELETED: case RTF_REVISED: { - auto pValue - = std::make_shared<RTFValue>(nKeyword == RTF_DELETED ? oox::XML_del : oox::XML_ins); + auto pValue = new RTFValue(nKeyword == RTF_DELETED ? oox::XML_del : oox::XML_ins); putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, NS_ooxml::LN_token, pValue); } @@ -1876,9 +1866,8 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_autoHyphenation, pBoolValue); break; case RTF_HYPHPAR: - m_aStates.top().aParagraphSprms.set( - NS_ooxml::LN_CT_PPrBase_suppressAutoHyphens, - std::make_shared<RTFValue>(int(bParam && nParam == 0))); + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_suppressAutoHyphens, + new RTFValue(int(bParam && nParam == 0))); break; default: { @@ -1928,7 +1917,7 @@ RTFError RTFDocumentImpl::pushState() // the *default* is \s0 i.e. paragraph style default // this will be overwritten by \sN \csN \dsN \tsN m_nCurrentStyleIndex = 0; - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_StyleType_paragraph); + auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_paragraph); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); } break; @@ -1989,10 +1978,10 @@ writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::createStylePrope } } - RTFValue::Pointer_t pParaProps = std::make_shared<RTFValue>( - m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms); - RTFValue::Pointer_t pCharProps = std::make_shared<RTFValue>( - m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); + RTFValue::Pointer_t pParaProps + = new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms); + RTFValue::Pointer_t pCharProps + = new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); // resetSprms will clean up this modification m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_pPr, pParaProps); @@ -2059,8 +2048,7 @@ RTFError RTFDocumentImpl::popState() Mapper().table(NS_ooxml::LN_FONTTABLE, pTable); if (m_nDefaultFontIndex >= 0) { - auto pValue - = std::make_shared<RTFValue>(m_aFontNames[getFontIndex(m_nDefaultFontIndex)]); + auto pValue = new RTFValue(m_aFontNames[getFontIndex(m_nDefaultFontIndex)]); putNestedAttribute(m_aDefaultState.aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii, pValue); } @@ -2077,7 +2065,7 @@ RTFError RTFDocumentImpl::popState() { RTFSprms aListTableAttributes; writerfilter::Reference<Properties>::Pointer_t pProp - = std::make_shared<RTFReferenceProperties>(aListTableAttributes, m_aListTableSprms); + = new RTFReferenceProperties(aListTableAttributes, m_aListTableSprms); RTFReferenceTable::Entries_t aListTableEntries; aListTableEntries.insert(std::make_pair(0, pProp)); writerfilter::Reference<Table>::Pointer_t const pTable( @@ -2092,19 +2080,19 @@ RTFError RTFDocumentImpl::popState() break; case Destination::FIELDINSTRUCTION: { - auto pValue = std::make_shared<RTFValue>(m_aFormfieldAttributes, m_aFormfieldSprms); + auto pValue = new RTFValue(m_aFormfieldAttributes, m_aFormfieldSprms); RTFSprms aFFAttributes; RTFSprms aFFSprms; aFFSprms.set(NS_ooxml::LN_ffdata, pValue); if (!m_aStates.top().pCurrentBuffer) { writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aFFAttributes, aFFSprms); + = new RTFReferenceProperties(aFFAttributes, aFFSprms); Mapper().props(pProperties); } else { - auto pFFValue = std::make_shared<RTFValue>(aFFAttributes, aFFSprms); + auto pFFValue = new RTFValue(aFFAttributes, aFFSprms); m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, pFFValue, nullptr)); } m_aFormfieldAttributes.clear(); @@ -2170,7 +2158,7 @@ RTFError RTFDocumentImpl::popState() aValue = aStr.copy(1, nLength); else aValue = aStr; - auto pValue = std::make_shared<RTFValue>(aValue, true); + auto pValue = new RTFValue(aValue, true); aState.aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue); } break; @@ -2259,10 +2247,10 @@ RTFError RTFDocumentImpl::popState() // Shape inside table: buffer the import to have correct anchor position. // Also buffer the RTFPicture of the state stack as it contains // the shape size. - auto pPictureValue = std::make_shared<RTFValue>(m_aStates.top().aPicture); + auto pPictureValue = new RTFValue(m_aStates.top().aPicture); m_aStates.top().pCurrentBuffer->push_back( Buf_t(BUFFER_PICTURE, pPictureValue, nullptr)); - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aShape); + auto pValue = new RTFValue(m_aStates.top().aShape); m_aStates.top().pCurrentBuffer->push_back( Buf_t(BUFFER_RESOLVESHAPE, pValue, nullptr)); } @@ -2283,12 +2271,10 @@ RTFError RTFDocumentImpl::popState() int nPos = m_aBookmarks.size(); m_aBookmarks[aStr] = nPos; if (!m_aStates.top().pCurrentBuffer) - Mapper().props(std::make_shared<RTFReferenceProperties>( - lcl_getBookmarkProperties(nPos, aStr))); + Mapper().props(new RTFReferenceProperties(lcl_getBookmarkProperties(nPos, aStr))); else m_aStates.top().pCurrentBuffer->push_back(Buf_t( - BUFFER_PROPS, std::make_shared<RTFValue>(lcl_getBookmarkProperties(nPos, aStr)), - nullptr)); + BUFFER_PROPS, new RTFValue(lcl_getBookmarkProperties(nPos, aStr)), nullptr)); } break; case Destination::BOOKMARKEND: @@ -2297,12 +2283,11 @@ RTFError RTFDocumentImpl::popState() break; // not for nested group OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); if (!m_aStates.top().pCurrentBuffer) - Mapper().props(std::make_shared<RTFReferenceProperties>( + Mapper().props(new RTFReferenceProperties( lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr))); else m_aStates.top().pCurrentBuffer->push_back(Buf_t( - BUFFER_PROPS, - std::make_shared<RTFValue>(lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr)), + BUFFER_PROPS, new RTFValue(lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr)), nullptr)); } break; @@ -2328,8 +2313,7 @@ RTFError RTFDocumentImpl::popState() { if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) break; // not for nested group - auto pValue = std::make_shared<RTFValue>( - m_aStates.top().pDestinationText->makeStringAndClear()); + auto pValue = new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear()); m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pValue); } break; @@ -2337,8 +2321,7 @@ RTFError RTFDocumentImpl::popState() { if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) break; // not for nested group - auto pValue = std::make_shared<RTFValue>( - m_aStates.top().pDestinationText->makeStringAndClear()); + auto pValue = new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear()); m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue); } break; @@ -2392,14 +2375,13 @@ RTFError RTFDocumentImpl::popState() nLength = aStr.toChar(); if (!aStr.isEmpty()) aStr = aStr.copy(1); - auto pNValue - = std::make_shared<RTFValue>(OStringToOUString(aName, aState.nCurrentEncoding)); + auto pNValue = new RTFValue(OStringToOUString(aName, aState.nCurrentEncoding)); m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue); if (nLength > 0) { OString aDefaultText = aStr.copy(0, std::min(nLength, aStr.getLength())); - auto pDValue = std::make_shared<RTFValue>( - OStringToOUString(aDefaultText, aState.nCurrentEncoding)); + auto pDValue + = new RTFValue(OStringToOUString(aDefaultText, aState.nCurrentEncoding)); m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue); } @@ -2499,8 +2481,7 @@ RTFError RTFDocumentImpl::popState() break; case Destination::OBJCLASS: { - auto pValue = std::make_shared<RTFValue>( - m_aStates.top().pDestinationText->makeStringAndClear()); + auto pValue = new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear()); m_aOLEAttributes.set(NS_ooxml::LN_CT_OLEObject_ProgID, pValue); break; } @@ -2515,15 +2496,15 @@ RTFError RTFDocumentImpl::popState() } RTFSprms aObjectSprms; - auto pOLEValue = std::make_shared<RTFValue>(m_aOLEAttributes); + auto pOLEValue = new RTFValue(m_aOLEAttributes); aObjectSprms.set(NS_ooxml::LN_OLEObject_OLEObject, pOLEValue); RTFSprms aObjAttributes; RTFSprms aObjSprms; - auto pValue = std::make_shared<RTFValue>(m_aObjectAttributes, aObjectSprms); + auto pValue = new RTFValue(m_aObjectAttributes, aObjectSprms); aObjSprms.set(NS_ooxml::LN_object, pValue); writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aObjAttributes, aObjSprms); + = new RTFReferenceProperties(aObjAttributes, aObjSprms); uno::Reference<drawing::XShape> xShape; RTFValue::Pointer_t pShape = m_aObjectAttributes.find(NS_ooxml::LN_shape); OSL_ASSERT(pShape.get()); @@ -2547,11 +2528,11 @@ RTFError RTFDocumentImpl::popState() OUString aStr(OStringToOUString( DTTM22OString(m_aStates.top().pDestinationText->makeStringAndClear().toInt32()), aState.nCurrentEncoding)); - auto pValue = std::make_shared<RTFValue>(aStr); + auto pValue = new RTFValue(aStr); RTFSprms aAnnAttributes; aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue); writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aAnnAttributes); + = new RTFReferenceProperties(aAnnAttributes); Mapper().props(pProperties); } break; @@ -2571,14 +2552,14 @@ RTFError RTFDocumentImpl::popState() if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) break; // not for nested group OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); - auto pValue = std::make_shared<RTFValue>(aStr.toInt32()); + auto pValue = new RTFValue(aStr.toInt32()); RTFSprms aAttributes; if (aState.eDestination == Destination::ANNOTATIONREFERENCESTART) aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart, pValue); else aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue); writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aAttributes); + = new RTFReferenceProperties(aAttributes); Mapper().props(pProperties); } break; @@ -2588,9 +2569,8 @@ RTFError RTFDocumentImpl::popState() break; // not for nested group OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); RTFSprms aAnnAttributes; - aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, - std::make_shared<RTFValue>(aStr.toInt32())); - Mapper().props(std::make_shared<RTFReferenceProperties>(aAnnAttributes)); + aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, new RTFValue(aStr.toInt32())); + Mapper().props(new RTFReferenceProperties(aAnnAttributes)); } break; case Destination::FALT: @@ -2598,7 +2578,7 @@ RTFError RTFDocumentImpl::popState() if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) break; // not for nested group OUString aStr(m_aStates.top().pDestinationText->makeStringAndClear()); - auto pValue = std::make_shared<RTFValue>(aStr); + auto pValue = new RTFValue(aStr); aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue); } break; @@ -2695,11 +2675,11 @@ RTFError RTFDocumentImpl::popState() auto& rImport = dynamic_cast<oox::FormulaImportBase&>( dynamic_cast<SfxBaseModel&>(*xComponent.get())); rImport.readFormulaOoxml(m_aMathBuffer); - auto pValue = std::make_shared<RTFValue>(xObject); + auto pValue = new RTFValue(xObject); RTFSprms aMathAttributes; aMathAttributes.set(NS_ooxml::LN_starmath, pValue); writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aMathAttributes); + = new RTFReferenceProperties(aMathAttributes); Mapper().props(pProperties); m_aMathBuffer = oox::formulaimport::XmlStreamBuilder(); } @@ -3005,13 +2985,13 @@ RTFError RTFDocumentImpl::popState() if (aState.bStartedTrackchange) { RTFSprms aTCSprms; - auto pValue = std::make_shared<RTFValue>(0); + auto pValue = new RTFValue(0); aTCSprms.set(NS_ooxml::LN_endtrackchange, pValue); if (!m_aStates.top().pCurrentBuffer) - Mapper().props(std::make_shared<RTFReferenceProperties>(RTFSprms(), aTCSprms)); + Mapper().props(new RTFReferenceProperties(RTFSprms(), aTCSprms)); else m_aStates.top().pCurrentBuffer->push_back( - Buf_t(BUFFER_PROPS, std::make_shared<RTFValue>(RTFSprms(), aTCSprms), nullptr)); + Buf_t(BUFFER_PROPS, new RTFValue(RTFSprms(), aTCSprms), nullptr)); } // This is the end of the doc, see if we need to close the last section. @@ -3036,7 +3016,7 @@ RTFError RTFDocumentImpl::popState() { case Destination::LISTENTRY: { - auto pValue = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); + auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pValue, RTFOverwrite::NO_APPEND); m_aListTable[aState.nCurrentListIndex] = pValue; @@ -3064,12 +3044,12 @@ RTFError RTFDocumentImpl::popState() = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelSuffix_val); if (pTextAfter) aTextValue += pTextAfter->getString(); - auto pTextValue = std::make_shared<RTFValue>(aTextValue); + auto pTextValue = new RTFValue(aTextValue); aLeveltextAttributes.set(NS_ooxml::LN_CT_LevelText_val, pTextValue); RTFSprms aLevelAttributes; RTFSprms aLevelSprms; - auto pIlvlValue = std::make_shared<RTFValue>(0); + auto pIlvlValue = new RTFValue(0); aLevelAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pIlvlValue); RTFValue::Pointer_t pFmtValue = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_numFmt); @@ -3081,7 +3061,7 @@ RTFError RTFDocumentImpl::popState() if (pStartatValue) aLevelSprms.set(NS_ooxml::LN_CT_Lvl_start, pStartatValue); - auto pLeveltextValue = std::make_shared<RTFValue>(aLeveltextAttributes); + auto pLeveltextValue = new RTFValue(aLeveltextAttributes); aLevelSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pLeveltextValue); RTFValue::Pointer_t pRunProps = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr); if (pRunProps) @@ -3090,13 +3070,12 @@ RTFError RTFDocumentImpl::popState() RTFSprms aAbstractAttributes; RTFSprms aAbstractSprms; aAbstractAttributes.set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIdValue); - auto pLevelValue = std::make_shared<RTFValue>(aLevelAttributes, aLevelSprms); + auto pLevelValue = new RTFValue(aLevelAttributes, aLevelSprms); aAbstractSprms.set(NS_ooxml::LN_CT_AbstractNum_lvl, pLevelValue, RTFOverwrite::NO_APPEND); RTFSprms aListTableSprms; - auto pAbstractValue - = std::make_shared<RTFValue>(aAbstractAttributes, aAbstractSprms); + auto pAbstractValue = new RTFValue(aAbstractAttributes, aAbstractSprms); // It's important that Numbering_abstractNum and Numbering_num never overwrites previous values. aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pAbstractValue, RTFOverwrite::NO_APPEND); @@ -3106,16 +3085,14 @@ RTFError RTFDocumentImpl::popState() RTFSprms aNumberingSprms; aNumberingAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIdValue); aNumberingSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIdValue); - auto pNumberingValue - = std::make_shared<RTFValue>(aNumberingAttributes, aNumberingSprms); + auto pNumberingValue = new RTFValue(aNumberingAttributes, aNumberingSprms); aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pNumberingValue, RTFOverwrite::NO_APPEND); // Table RTFSprms aListTableAttributes; writerfilter::Reference<Properties>::Pointer_t pProp - = std::make_shared<RTFReferenceProperties>(aListTableAttributes, - aListTableSprms); + = new RTFReferenceProperties(aListTableAttributes, aListTableSprms); RTFReferenceTable::Entries_t aListTableEntries; aListTableEntries.insert(std::make_pair(0, pProp)); @@ -3135,8 +3112,7 @@ RTFError RTFDocumentImpl::popState() if (!m_aStates.empty()) { // FIXME: don't use pDestinationText, points to popped state - auto pValue = std::make_shared<RTFValue>( - aState.aDestinationText.makeStringAndClear(), true); + auto pValue = new RTFValue(aState.aDestinationText.makeStringAndClear(), true); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelSuffix_val, pValue); } break; @@ -3144,8 +3120,7 @@ RTFError RTFDocumentImpl::popState() if (!m_aStates.empty()) { // FIXME: don't use pDestinationText, points to popped state - auto pValue = std::make_shared<RTFValue>( - aState.aDestinationText.makeStringAndClear(), true); + auto pValue = new RTFValue(aState.aDestinationText.makeStringAndClear(), true); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue); } break; @@ -3154,11 +3129,10 @@ RTFError RTFDocumentImpl::popState() case Destination::LISTLEVEL: if (!m_aStates.empty()) { - auto pInnerValue = std::make_shared<RTFValue>(m_aStates.top().nListLevelNum++); + auto pInnerValue = new RTFValue(m_aStates.top().nListLevelNum++); aState.aTableAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue); - auto pValue - = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); + auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); if (m_aStates.top().eDestination != Destination::LFOLEVEL) m_aStates.top().aListLevelEntries.set(NS_ooxml::LN_CT_AbstractNum_lvl, pValue, RTFOverwrite::NO_APPEND); @@ -3169,11 +3143,10 @@ RTFError RTFDocumentImpl::popState() case Destination::LFOLEVEL: if (!m_aStates.empty()) { - auto pInnerValue = std::make_shared<RTFValue>(m_aStates.top().nListLevelNum++); + auto pInnerValue = new RTFValue(m_aStates.top().nListLevelNum++); aState.aTableAttributes.set(NS_ooxml::LN_CT_NumLvl_ilvl, pInnerValue); - auto pValue - = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); + auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, pValue, RTFOverwrite::NO_APPEND); } @@ -3190,8 +3163,7 @@ RTFError RTFDocumentImpl::popState() } else { - auto pValue - = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); + auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, RTFOverwrite::NO_APPEND); m_aListOverrideTable[aState.nCurrentListOverrideIndex] @@ -3202,7 +3174,7 @@ RTFError RTFDocumentImpl::popState() case Destination::LEVELTEXT: if (!m_aStates.empty()) { - auto pValue = std::make_shared<RTFValue>(aState.aTableAttributes); + auto pValue = new RTFValue(aState.aTableAttributes); m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pValue); } break; @@ -3273,11 +3245,11 @@ RTFError RTFDocumentImpl::popState() { RTFSprms aAttributes; aAttributes.set(NS_ooxml::LN_CT_NumPicBullet_numPicBulletId, - std::make_shared<RTFValue>(m_nListPictureId++)); + new RTFValue(m_nListPictureId++)); RTFSprms aSprms; // Dummy value, real picture is already sent to dmapper. - aSprms.set(NS_ooxml::LN_CT_NumPicBullet_pict, std::make_shared<RTFValue>(0)); - auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); + aSprms.set(NS_ooxml::LN_CT_NumPicBullet_pict, new RTFValue(0)); + auto pValue = new RTFValue(aAttributes, aSprms); m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_numPicBullet, pValue, RTFOverwrite::NO_APPEND); } @@ -3358,7 +3330,7 @@ RTFError RTFDocumentImpl::handleEmbeddedObject() uno::Reference<io::XInputStream> xInputStream( new utl::OSeekableInputStreamWrapper(pStream.release(), /*_bOwner=*/true)); - auto pStreamValue = std::make_shared<RTFValue>(xInputStream); + auto pStreamValue = new RTFValue(xInputStream); m_aOLEAttributes.set(NS_ooxml::LN_inputstream, pStreamValue); return RTFError::OK; @@ -3539,53 +3511,52 @@ RTFSprms RTFFrame::getSprms() { case NS_ooxml::LN_CT_FramePr_x: if (m_nX != 0) - pValue = std::make_shared<RTFValue>(m_nX); + pValue = new RTFValue(m_nX); break; case NS_ooxml::LN_CT_FramePr_y: if (m_nY != 0) - pValue = std::make_shared<RTFValue>(m_nY); + pValue = new RTFValue(m_nY); break; case NS_ooxml::LN_CT_FramePr_h: if (m_nH != 0) { if (m_nHRule == NS_ooxml::LN_Value_doc_ST_HeightRule_exact) - pValue = std::make_shared<RTFValue>( - -m_nH); // The negative value just sets nHRule + pValue = new RTFValue(-m_nH); // The negative value just sets nHRule else - pValue = std::make_shared<RTFValue>(m_nH); + pValue = new RTFValue(m_nH); } break; case NS_ooxml::LN_CT_FramePr_w: if (m_nW != 0) - pValue = std::make_shared<RTFValue>(m_nW); + pValue = new RTFValue(m_nW); break; case NS_ooxml::LN_CT_FramePr_hSpace: if (m_nHoriPadding != 0) - pValue = std::make_shared<RTFValue>(m_nHoriPadding); + pValue = new RTFValue(m_nHoriPadding); break; case NS_ooxml::LN_CT_FramePr_vSpace: if (m_nVertPadding != 0) - pValue = std::make_shared<RTFValue>(m_nVertPadding); + pValue = new RTFValue(m_nVertPadding); break; case NS_ooxml::LN_CT_FramePr_hAnchor: { if (m_nHoriAnchor == 0) m_nHoriAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin; - pValue = std::make_shared<RTFValue>(m_nHoriAnchor); + pValue = new RTFValue(m_nHoriAnchor); } break; case NS_ooxml::LN_CT_FramePr_vAnchor: { if (m_nVertAnchor == 0) m_nVertAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin; - pValue = std::make_shared<RTFValue>(m_nVertAnchor); + pValue = new RTFValue(m_nVertAnchor); } break; case NS_ooxml::LN_CT_FramePr_xAlign: - pValue = std::make_shared<RTFValue>(m_nHoriAlign); + pValue = new RTFValue(m_nHoriAlign); break; case NS_ooxml::LN_CT_FramePr_yAlign: - pValue = std::make_shared<RTFValue>(m_nVertAlign); + pValue = new RTFValue(m_nVertAlign); break; case NS_ooxml::LN_CT_FramePr_hRule: { @@ -3593,12 +3564,12 @@ RTFSprms RTFFrame::getSprms() m_nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_exact; else if (m_nH > 0) m_nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_atLeast; - pValue = std::make_shared<RTFValue>(m_nHRule); + pValue = new RTFValue(m_nHRule); } break; case NS_ooxml::LN_CT_FramePr_wrap: if (m_oWrap) - pValue = std::make_shared<RTFValue>(*m_oWrap); + pValue = new RTFValue(*m_oWrap); break; default: break; @@ -3609,7 +3580,7 @@ RTFSprms RTFFrame::getSprms() } RTFSprms frameprSprms; - frameprSprms.set(NS_ooxml::LN_CT_PPrBase_framePr, std::make_shared<RTFValue>(sprms)); + frameprSprms.set(NS_ooxml::LN_CT_PPrBase_framePr, new RTFValue(sprms)); return frameprSprms; } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 3f4503f5f680..f5d595057d59 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -118,11 +118,11 @@ enum class RTFFieldStatus }; /// A buffer storing dmapper calls. -using Buf_t = std::tuple<RTFBufferTypes, RTFValue::Pointer_t, std::shared_ptr<TableRowBuffer>>; +using Buf_t = std::tuple<RTFBufferTypes, RTFValue::Pointer_t, tools::SvRef<TableRowBuffer>>; using RTFBuffer_t = std::deque<Buf_t>; /// holds one nested table row -struct TableRowBuffer +struct TableRowBuffer : public virtual SvRefBase { RTFBuffer_t buffer; ::std::deque<RTFSprms> cellsSprms; @@ -171,7 +171,7 @@ private: }; /// Stores the properties of a shape. -class RTFShape +class RTFShape : public virtual SvRefBase { public: RTFShape(); @@ -220,7 +220,7 @@ public: }; /// Stores the properties of a picture. -class RTFPicture +class RTFPicture : public virtual SvRefBase { public: RTFPicture(); @@ -432,7 +432,7 @@ OString DTTM22OString(long nDTTM); class RTFDocumentImpl : public RTFDocument, public RTFListener { public: - using Pointer_t = std::shared_ptr<RTFDocumentImpl>; + using Pointer_t = tools::SvRef<RTFDocumentImpl>; RTFDocumentImpl(css::uno::Reference<css::uno::XComponentContext> const& xContext, css::uno::Reference<css::io::XInputStream> const& xInputStream, css::uno::Reference<css::lang::XComponent> const& xDstDoc, @@ -551,8 +551,8 @@ private: css::uno::Reference<css::document::XDocumentProperties> m_xDocumentProperties; std::shared_ptr<SvStream> m_pInStream; Stream* m_pMapperStream; - std::shared_ptr<RTFSdrImport> m_pSdrImport; - std::shared_ptr<RTFTokenizer> m_pTokenizer; + tools::SvRef<RTFSdrImport> m_pSdrImport; + tools::SvRef<RTFTokenizer> m_pTokenizer; RTFStack m_aStates; /// Read by RTF_PARD. RTFParserState m_aDefaultState; diff --git a/writerfilter/source/rtftok/rtflookahead.cxx b/writerfilter/source/rtftok/rtflookahead.cxx index f7c457bc754c..16ac509e0cde 100644 --- a/writerfilter/source/rtftok/rtflookahead.cxx +++ b/writerfilter/source/rtftok/rtflookahead.cxx @@ -39,7 +39,7 @@ RTFLookahead::RTFLookahead(SvStream& rStream, sal_uInt64 nGroupStart) sal_uInt64 const nPos = m_rStream.Tell(); m_rStream.Seek(nGroupStart); uno::Reference<task::XStatusIndicator> xStatusIndicator; - m_pTokenizer.reset(new RTFTokenizer(*this, &m_rStream, xStatusIndicator)); + m_pTokenizer = new RTFTokenizer(*this, &m_rStream, xStatusIndicator); m_pTokenizer->resolveParse(); m_rStream.Seek(nPos); } diff --git a/writerfilter/source/rtftok/rtflookahead.hxx b/writerfilter/source/rtftok/rtflookahead.hxx index 86de830a2e22..a5779fcc9dea 100644 --- a/writerfilter/source/rtftok/rtflookahead.hxx +++ b/writerfilter/source/rtftok/rtflookahead.hxx @@ -12,6 +12,7 @@ #include <memory> #include <sal/types.h> +#include <tools/ref.hxx> #include "rtflistener.hxx" class SvStream; @@ -49,7 +50,7 @@ public: bool hasTable() { return m_bHasTable; } private: - std::shared_ptr<RTFTokenizer> m_pTokenizer; + tools::SvRef<RTFTokenizer> m_pTokenizer; SvStream& m_rStream; bool m_bHasTable; }; diff --git a/writerfilter/source/rtftok/rtfreferenceproperties.hxx b/writerfilter/source/rtftok/rtfreferenceproperties.hxx index e10976619708..b4cc0a26c02d 100644 --- a/writerfilter/source/rtftok/rtfreferenceproperties.hxx +++ b/writerfilter/source/rtftok/rtfreferenceproperties.hxx @@ -22,7 +22,7 @@ class RTFReferenceProperties : public writerfilter::Reference<Properties> public: RTFReferenceProperties(const RTFSprms& rAttributes, const RTFSprms& rSprms); explicit RTFReferenceProperties(const RTFSprms& rAttributes); - virtual ~RTFReferenceProperties(); + virtual ~RTFReferenceProperties() override; void resolve(Properties& rHandler) override; RTFSprms& getAttributes() { return m_aAttributes; } RTFSprms& getSprms() { return m_aSprms; } diff --git a/writerfilter/source/rtftok/rtfreferencetable.hxx b/writerfilter/source/rtftok/rtfreferencetable.hxx index a21ed18fb76a..58e57e3ea99d 100644 --- a/writerfilter/source/rtftok/rtfreferencetable.hxx +++ b/writerfilter/source/rtftok/rtfreferencetable.hxx @@ -24,7 +24,7 @@ public: using Entries_t = std::map<int, writerfilter::Reference<Properties>::Pointer_t>; using Entry_t = std::pair<int, writerfilter::Reference<Properties>::Pointer_t>; explicit RTFReferenceTable(Entries_t aEntries); - virtual ~RTFReferenceTable(); + virtual ~RTFReferenceTable() override; void resolve(Table& rHandler) override; private: diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index f2ea5d920be1..1b6c819b671d 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -606,9 +606,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap else if (rProperty.first == "dxWrapDistLeft") { if (m_bTextGraphicObject) - rShape.aAnchorAttributes.set( - NS_ooxml::LN_CT_Anchor_distL, - std::make_shared<RTFValue>(rProperty.second.toInt32())); + rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distL, + new RTFValue(rProperty.second.toInt32())); else if (xPropertySet.is()) xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(rProperty.second.toInt32() / 360)); @@ -616,9 +615,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap else if (rProperty.first == "dyWrapDistTop") { if (m_bTextGraphicObject) - rShape.aAnchorAttributes.set( - NS_ooxml::LN_CT_Anchor_distT, - std::make_shared<RTFValue>(rProperty.second.toInt32())); + rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distT, + new RTFValue(rProperty.second.toInt32())); else if (xPropertySet.is()) xPropertySet->setPropertyValue("TopMargin", uno::makeAny(rProperty.second.toInt32() / 360)); @@ -626,9 +624,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap else if (rProperty.first == "dxWrapDistRight") { if (m_bTextGraphicObject) - rShape.aAnchorAttributes.set( - NS_ooxml::LN_CT_Anchor_distR, - std::make_shared<RTFValue>(rProperty.second.toInt32())); + rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distR, + new RTFValue(rProperty.second.toInt32())); else if (xPropertySet.is()) xPropertySet->setPropertyValue("RightMargin", uno::makeAny(rProperty.second.toInt32() / 360)); @@ -636,9 +633,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap else if (rProperty.first == "dyWrapDistBottom") { if (m_bTextGraphicObject) - rShape.aAnchorAttributes.set( - NS_ooxml::LN_CT_Anchor_distB, - std::make_shared<RTFValue>(rProperty.second.toInt32())); + rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distB, + new RTFValue(rProperty.second.toInt32())); else if (xPropertySet.is()) xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(rProperty.second.toInt32() / 360)); @@ -844,11 +840,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap oY.reset(aPoint.toInt32()); } while (nI >= 0); RTFSprms aPathAttributes; - aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, std::make_shared<RTFValue>(*oX)); - aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, std::make_shared<RTFValue>(*oY)); + aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, new RTFValue(*oX)); + aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, new RTFValue(*oY)); aPolygonSprms.set(NS_ooxml::LN_CT_WrapPath_lineTo, - std::make_shared<RTFValue>(aPathAttributes), - RTFOverwrite::NO_APPEND); + new RTFValue(aPathAttributes), RTFOverwrite::NO_APPEND); } } while (nCharIndex >= 0); rShape.aWrapPolygonSprms = aPolygonSprms; @@ -1098,9 +1093,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap { RTFSprms aAttributes; aAttributes.set(NS_ooxml::LN_CT_Background_color, - std::make_shared<RTFValue>( - xPropertySet->getPropertyValue("FillColor").get<sal_Int32>())); - m_rImport.Mapper().props(std::make_shared<RTFReferenceProperties>(aAttributes)); + new RTFValue(xPropertySet->getPropertyValue("FillColor").get<sal_Int32>())); + m_rImport.Mapper().props(new RTFReferenceProperties(aAttributes)); uno::Reference<lang::XComponent> xComponent(xShape, uno::UNO_QUERY); xComponent->dispose(); diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index 75c9249306cf..cdf088857466 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -14,6 +14,7 @@ #include <vector> #include <dmapper/GraphicZOrderHelper.hxx> +#include <tools/ref.hxx> namespace com { @@ -47,12 +48,12 @@ class RTFDocumentImpl; class RTFShape; /// Handles the import of drawings using RTF markup. -class RTFSdrImport final +class RTFSdrImport final : public virtual SvRefBase { public: RTFSdrImport(RTFDocumentImpl& rDocument, css::uno::Reference<css::lang::XComponent> const& xDstDoc); - ~RTFSdrImport(); + ~RTFSdrImport() override; enum ShapeOrPict { diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index f768785a5cba..94acac0d1f25 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -147,7 +147,7 @@ static RTFValue::Pointer_t getDefaultSPRM(Id const id) case NS_ooxml::LN_CT_Ind_left: case NS_ooxml::LN_CT_Ind_right: case NS_ooxml::LN_CT_Ind_firstLine: - return std::make_shared<RTFValue>(0); + return new RTFValue(0); default: return RTFValue::Pointer_t(); @@ -235,7 +235,7 @@ static void cloneAndDeduplicateSprm(std::pair<Id, RTFValue::Pointer_t> const& rS RTFSprms().cloneAndDeduplicate(rSprm.second->getAttributes())); if (!sprms.empty() || !attributes.empty()) { - ret.set(rSprm.first, std::make_shared<RTFValue>(attributes, sprms)); + ret.set(rSprm.first, new RTFValue(attributes, sprms)); } } } @@ -372,7 +372,11 @@ RTFSprms::RTFSprms() RTFSprms::~RTFSprms() = default; -RTFSprms::RTFSprms(const RTFSprms& rSprms) { *this = rSprms; } +RTFSprms::RTFSprms(const RTFSprms& rSprms) + : SvRefBase() +{ + *this = rSprms; +} void RTFSprms::clear() { diff --git a/writerfilter/source/rtftok/rtfsprm.hxx b/writerfilter/source/rtftok/rtfsprm.hxx index 2c4247925f8b..f5a294d601ea 100644 --- a/writerfilter/source/rtftok/rtfsprm.hxx +++ b/writerfilter/source/rtftok/rtfsprm.hxx @@ -25,7 +25,7 @@ namespace rtftok using RTFSprmsImplBase = std::vector<std::pair<Id, RTFValue::Pointer_t>>; /// The payload of RTFSprms which is only copied on write. -class RTFSprmsImpl : public RTFSprmsImplBase, public SvRefBase +class RTFSprmsImpl : public RTFSprmsImplBase, public virtual SvRefBase { }; @@ -38,16 +38,16 @@ enum class RTFOverwrite }; /// A list of RTFSprm with a copy constructor that performs a deep copy. -class RTFSprms +class RTFSprms : public virtual SvRefBase { public: - using Pointer_t = std::shared_ptr<RTFSprms>; + using Pointer_t = tools::SvRef<RTFSprms>; using Entry_t = std::pair<Id, RTFValue::Pointer_t>; using Iterator_t = std::vector<Entry_t>::iterator; using ReverseIterator_t = std::vector<Entry_t>::reverse_iterator; RTFSprms(); RTFSprms(const RTFSprms& rSprms); - ~RTFSprms(); + ~RTFSprms() override; RTFValue::Pointer_t find(Id nKeyword, bool bFirst = true, bool bForWrite = false); /// Does the same as ->push_back(), except that it can overwrite or ignore existing entries. void set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwrite = RTFOverwrite::YES); @@ -79,7 +79,6 @@ class RTFSprm : public Sprm { public: RTFSprm(Id nKeyword, RTFValue::Pointer_t& pValue); - virtual ~RTFSprm() = default; sal_uInt32 getId() const override; Value::Pointer_t getValue() override; writerfilter::Reference<Properties>::Pointer_t getProps() override; diff --git a/writerfilter/source/rtftok/rtftokenizer.hxx b/writerfilter/source/rtftok/rtftokenizer.hxx index b260ae8d0a7b..7ff91a52fc2f 100644 --- a/writerfilter/source/rtftok/rtftokenizer.hxx +++ b/writerfilter/source/rtftok/rtftokenizer.hxx @@ -17,6 +17,7 @@ #include <com/sun/star/uno/Reference.h> #include <rtl/ustring.hxx> +#include <tools/ref.hxx> namespace com { @@ -38,12 +39,12 @@ namespace writerfilter namespace rtftok { /// RTF tokenizer that separates control words from text. -class RTFTokenizer final +class RTFTokenizer final : public virtual SvRefBase { public: RTFTokenizer(RTFListener& rImport, SvStream* pInStream, css::uno::Reference<css::task::XStatusIndicator> const& xStatusIndicator); - ~RTFTokenizer(); + ~RTFTokenizer() override; RTFError resolveParse(); /// Number of states on the stack. diff --git a/writerfilter/source/rtftok/rtfvalue.cxx b/writerfilter/source/rtftok/rtfvalue.cxx index c378364952bf..9272ba13647b 100644 --- a/writerfilter/source/rtftok/rtfvalue.cxx +++ b/writerfilter/source/rtftok/rtfvalue.cxx @@ -23,100 +23,100 @@ RTFValue::RTFValue(int nValue, OUString sValue, RTFSprms rAttributes, RTFSprms r const RTFShape& aShape, const RTFPicture& rPicture) : m_nValue(nValue) , m_sValue(std::move(sValue)) - , m_pAttributes(std::make_shared<RTFSprms>(rAttributes)) - , m_pSprms(std::make_shared<RTFSprms>(rSprms)) + , m_pAttributes(new RTFSprms(rAttributes)) + , m_pSprms(new RTFSprms(rSprms)) , m_xShape(std::move(xShape)) , m_xStream(std::move(xStream)) , m_xObject(std::move(xObject)) , m_bForceString(bForceString) - , m_pShape(std::make_shared<RTFShape>(aShape)) - , m_pPicture(std::make_shared<RTFPicture>(rPicture)) + , m_pShape(new RTFShape(aShape)) + , m_pPicture(new RTFPicture(rPicture)) { } RTFValue::RTFValue() - : m_pAttributes(std::make_shared<RTFSprms>()) - , m_pSprms(std::make_shared<RTFSprms>()) - , m_pShape(std::make_shared<RTFShape>()) - , m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(new RTFSprms()) + , m_pSprms(new RTFSprms()) + , m_pShape(new RTFShape()) + , m_pPicture(new RTFPicture()) { } RTFValue::RTFValue(int nValue) : m_nValue(nValue) - , m_pAttributes(std::make_shared<RTFSprms>()) - , m_pSprms(std::make_shared<RTFSprms>()) - , m_pPicture(std::make_shared<RTFPicture>()) + , m_pAttributes(new RTFSprms()) + , m_pSprms(new RTFSprms()) + , m_pPicture(new RTFPicture()) { - m_pShape.reset(new RTFShape()); + m_pShape = new RTFShape(); } RTFValue::RTFValue(OUString sValue, bool bForce) : m_sValue(std::move(sValue)) - , m_pAttributes(std::make_shared<RTFSprms>()) - , m_pSprms(std::make_shared<RTFSprms>()) + , m_pAttributes(new RTFSprms()) + , m_pSprms(new RTFSprms()) , m_bForceString(bForce) - , m_pShape(std::make_shared<RTFShape>()) - , m_pPicture(std::make_shared<RTFPicture>()) + , m_pShape(new RTFShape()) + , m_pPicture(new RTFPicture()) { } RTFValue::RTFValue(RTFSprms rAttributes) - : m_pAttributes(std::make_shared<RTFSprms>(rAttributes)) - , m_pSprms(std::make_shared<RTFSprms>()) - , m_pShape(std::make_shared<RTFShape>()) - , m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(new RTFSprms(rAttributes)) + , m_pSprms(new RTFSprms()) + , m_pShape(new RTFShape()) + , m_pPicture(new RTFPicture()) { } RTFValue::RTFValue(RTFSprms rAttributes, RTFSprms rSprms) - : m_pAttributes(std::make_shared<RTFSprms>(rAttributes)) - , m_pSprms(std::make_shared<RTFSprms>(rSprms)) - , m_pShape(std::make_shared<RTFShape>()) - , m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(new RTFSprms(rAttributes)) + , m_pSprms(new RTFSprms(rSprms)) + , m_pShape(new RTFShape()) + , m_pPicture(new RTFPicture()) { } RTFValue::RTFValue(uno::Reference<drawing::XShape> xShape) - : m_pAttributes(std::make_shared<RTFSprms>()) - , m_pSprms(std::make_shared<RTFSprms>()) + : m_pAttributes(new RTFSprms()) + , m_pSprms(new RTFSprms()) , m_xShape(std::move(xShape)) - , m_pShape(std::make_shared<RTFShape>()) - , m_pPicture(std::make_shared<RTFPicture>()) + , m_pShape(new RTFShape()) + , m_pPicture(new RTFPicture()) { } RTFValue::RTFValue(uno::Reference<io::XInputStream> xStream) - : m_pAttributes(std::make_shared<RTFSprms>()) - , m_pSprms(std::make_shared<RTFSprms>()) + : m_pAttributes(new RTFSprms()) + , m_pSprms(new RTFSprms()) , m_xStream(std::move(xStream)) - , m_pShape(std::make_shared<RTFShape>()) - , m_pPicture(std::make_shared<RTFPicture>()) + , m_pShape(new RTFShape()) + , m_pPicture(new RTFPicture()) { } RTFValue::RTFValue(uno::Reference<embed::XEmbeddedObject> xObject) - : m_pAttributes(std::make_shared<RTFSprms>()) - , m_pSprms(std::make_shared<RTFSprms>()) + : m_pAttributes(new RTFSprms()) + , m_pSprms(new RTFSprms()) , m_xObject(std::move(xObject)) - , m_pShape(std::make_shared<RTFShape>()) - , m_pPicture(std::make_shared<RTFPicture>()) + , m_pShape(new RTFShape()) + , m_pPicture(new RTFPicture()) { } RTFValue::RTFValue(const RTFShape& aShape) - : m_pAttributes(std::make_shared<RTFSprms>()) - , m_pSprms(std::make_shared<RTFSprms>()) - , m_pShape(std::make_shared<RTFShape>(aShape)) - , m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(new RTFSprms()) + , m_pSprms(new RTFSprms()) + , m_pShape(new RTFShape(aShape)) + , m_pPicture(new RTFPicture()) { } RTFValue::RTFValue(const RTFPicture& rPicture) - : m_pAttributes(std::make_shared<RTFSprms>()) - , m_pSprms(std::make_shared<RTFSprms>()) - , m_pShape(std::make_shared<RTFShape>()) - , m_pPicture(std::make_shared<RTFPicture>(rPicture)) + : m_pAttributes(new RTFSprms()) + , m_pSprms(new RTFSprms()) + , m_pShape(new RTFShape()) + , m_pPicture(new RTFPicture(rPicture)) { } @@ -156,7 +156,7 @@ RTFPicture& RTFValue::getPicture() const { return *m_pPicture; } writerfilter::Reference<Properties>::Pointer_t RTFValue::getProperties() { - return std::make_shared<RTFReferenceProperties>(*m_pAttributes, *m_pSprms); + return new RTFReferenceProperties(*m_pAttributes, *m_pSprms); } writerfilter::Reference<BinaryObj>::Pointer_t RTFValue::getBinary() diff --git a/writerfilter/source/rtftok/rtfvalue.hxx b/writerfilter/source/rtftok/rtfvalue.hxx index 644cb7693d5f..a775c795a716 100644 --- a/writerfilter/source/rtftok/rtfvalue.hxx +++ b/writerfilter/source/rtftok/rtfvalue.hxx @@ -41,7 +41,7 @@ class RTFPicture; class RTFValue : public Value { public: - using Pointer_t = std::shared_ptr<RTFValue>; + using Pointer_t = tools::SvRef<RTFValue>; RTFValue(int nValue, OUString sValue, RTFSprms rAttributes, RTFSprms rSprms, css::uno::Reference<css::drawing::XShape> xShape, css::uno::Reference<css::io::XInputStream> xStream, @@ -79,14 +79,14 @@ public: private: int m_nValue = 0; OUString m_sValue; - std::shared_ptr<RTFSprms> m_pAttributes; - std::shared_ptr<RTFSprms> m_pSprms; + tools::SvRef<RTFSprms> m_pAttributes; + tools::SvRef<RTFSprms> m_pSprms; css::uno::Reference<css::drawing::XShape> m_xShape; css::uno::Reference<css::io::XInputStream> m_xStream; css::uno::Reference<css::embed::XEmbeddedObject> m_xObject; bool m_bForceString = false; - std::shared_ptr<RTFShape> m_pShape; - std::shared_ptr<RTFPicture> m_pPicture; + tools::SvRef<RTFShape> m_pShape; + tools::SvRef<RTFPicture> m_pPicture; }; } // namespace rtftok } // namespace writerfilter |