[Libreoffice-commits] core.git: include/tools writerfilter/inc writerfilter/Library_writerfilter.mk writerfilter/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Jul 10 10:32:13 UTC 2018


 include/tools/ref.hxx                                    |    4 
 writerfilter/Library_writerfilter.mk                     |    1 
 writerfilter/inc/dmapper/resourcemodel.hxx               |   36 -
 writerfilter/inc/ooxml/OOXMLDocument.hxx                 |   10 
 writerfilter/inc/ooxml/QNameToString.hxx                 |    4 
 writerfilter/inc/rtftok/RTFDocument.hxx                  |    4 
 writerfilter/source/dmapper/BorderHandler.hxx            |    2 
 writerfilter/source/dmapper/CellColorHandler.hxx         |    2 
 writerfilter/source/dmapper/DomainMapper.cxx             |   20 
 writerfilter/source/dmapper/DomainMapper.hxx             |   12 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   26 -
 writerfilter/source/dmapper/DomainMapperTableHandler.hxx |    6 
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    8 
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |   10 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx        |   39 -
 writerfilter/source/dmapper/DomainMapper_Impl.hxx        |   24 -
 writerfilter/source/dmapper/FFDataHandler.hxx            |    2 
 writerfilter/source/dmapper/FontTable.cxx                |    4 
 writerfilter/source/dmapper/FontTable.hxx                |    6 
 writerfilter/source/dmapper/FormControlHelper.cxx        |    2 
 writerfilter/source/dmapper/FormControlHelper.hxx        |    8 
 writerfilter/source/dmapper/GraphicImport.hxx            |    2 
 writerfilter/source/dmapper/LoggedResources.hxx          |    6 
 writerfilter/source/dmapper/MeasureHandler.hxx           |    2 
 writerfilter/source/dmapper/NumberingManager.cxx         |   10 
 writerfilter/source/dmapper/NumberingManager.hxx         |   24 -
 writerfilter/source/dmapper/OLEHandler.cxx               |    2 
 writerfilter/source/dmapper/PropertyMap.hxx              |   18 
 writerfilter/source/dmapper/SdtHelper.hxx                |    5 
 writerfilter/source/dmapper/SettingsTable.hxx            |    2 
 writerfilter/source/dmapper/StyleSheetTable.cxx          |    8 
 writerfilter/source/dmapper/StyleSheetTable.hxx          |    8 
 writerfilter/source/dmapper/TDefTableHandler.cxx         |    2 
 writerfilter/source/dmapper/TDefTableHandler.hxx         |    2 
 writerfilter/source/dmapper/TableData.hxx                |   18 
 writerfilter/source/dmapper/TableManager.cxx             |   10 
 writerfilter/source/dmapper/TableManager.hxx             |   16 
 writerfilter/source/dmapper/TablePositionHandler.hxx     |    2 
 writerfilter/source/dmapper/TablePropertiesHandler.cxx   |    2 
 writerfilter/source/dmapper/TablePropertiesHandler.hxx   |    8 
 writerfilter/source/dmapper/TagLogger.hxx                |    2 
 writerfilter/source/dmapper/ThemeTable.hxx               |    2 
 writerfilter/source/dmapper/TrackChangesHandler.cxx      |    2 
 writerfilter/source/dmapper/WrapPolygonHandler.hxx       |    6 
 writerfilter/source/filter/WriterFilter.cxx              |    3 
 writerfilter/source/ooxml/Handler.hxx                    |   20 
 writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx |    2 
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx          |    2 
 writerfilter/source/ooxml/OOXMLFactory.hxx               |    6 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx    |   28 -
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx    |    2 
 writerfilter/source/ooxml/OOXMLFastHelper.hxx            |    8 
 writerfilter/source/ooxml/OOXMLParserState.cxx           |   14 
 writerfilter/source/ooxml/OOXMLParserState.hxx           |    6 
 writerfilter/source/ooxml/OOXMLPropertySet.cxx           |   14 
 writerfilter/source/ooxml/OOXMLPropertySet.hxx           |   20 
 writerfilter/source/ooxml/OOXMLStreamImpl.cxx            |    6 
 writerfilter/source/ooxml/OOXMLStreamImpl.hxx            |    2 
 writerfilter/source/ooxml/factory_ns.py                  |    3 
 writerfilter/source/ooxml/factoryimpl_ns.py              |    4 
 writerfilter/source/rtftok/rtfdispatchdestination.cxx    |   21 
 writerfilter/source/rtftok/rtfdispatchflag.cxx           |  142 ++----
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx         |   19 
 writerfilter/source/rtftok/rtfdispatchvalue.cxx          |  157 +++----
 writerfilter/source/rtftok/rtfdocumentfactory.cxx        |    4 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx           |  319 ++++++---------
 writerfilter/source/rtftok/rtfdocumentimpl.hxx           |   14 
 writerfilter/source/rtftok/rtflookahead.cxx              |    2 
 writerfilter/source/rtftok/rtflookahead.hxx              |    3 
 writerfilter/source/rtftok/rtfreferenceproperties.hxx    |    2 
 writerfilter/source/rtftok/rtfreferencetable.hxx         |    2 
 writerfilter/source/rtftok/rtfsdrimport.cxx              |   32 -
 writerfilter/source/rtftok/rtfsdrimport.hxx              |    5 
 writerfilter/source/rtftok/rtfsprm.cxx                   |   10 
 writerfilter/source/rtftok/rtfsprm.hxx                   |    9 
 writerfilter/source/rtftok/rtftokenizer.hxx              |    5 
 writerfilter/source/rtftok/rtfvalue.cxx                  |   90 ++--
 writerfilter/source/rtftok/rtfvalue.hxx                  |   10 
 78 files changed, 655 insertions(+), 720 deletions(-)

New commits:
commit 0fb5ca6cc9cc55a4436a36c533461769b1fc8526
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jul 5 14:29:11 2018 +0200

    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 at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

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)
     }

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list