[Libreoffice-commits] core.git: 4 commits - xmloff/inc xmloff/source

Michael Stahl mstahl at redhat.com
Mon Nov 2 02:58:37 PST 2015


 xmloff/inc/pch/precompiled_xo.hxx |    1 
 xmloff/source/style/impastpl.cxx  |   28 +++----
 xmloff/source/style/impastpl.hxx  |    7 -
 xmloff/source/style/xmlnumfe.cxx  |   34 ++++-----
 xmloff/source/style/xmlnumfi.cxx  |   23 +++---
 xmloff/source/text/txtparai.cxx   |  139 +++++++++++++++++++-------------------
 6 files changed, 117 insertions(+), 115 deletions(-)

New commits:
commit de1a1e4bec9934c1f4ce5da45cebaa1d6c342c79
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 30 22:59:14 2015 +0100

    xmloff: replace boost::ptr_vector with std::vector
    
    Change-Id: I6aacf764513b8f789d925db2943f4bf6f0039674

diff --git a/xmloff/inc/pch/precompiled_xo.hxx b/xmloff/inc/pch/precompiled_xo.hxx
index f11c370..00da3ef 100644
--- a/xmloff/inc/pch/precompiled_xo.hxx
+++ b/xmloff/inc/pch/precompiled_xo.hxx
@@ -33,7 +33,6 @@
 #include <basegfx/vector/b3dvector.hxx>
 #include <boost/iterator_adaptors.hpp>
 #include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
 #include <memory>
 #include <cassert>
 #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 6792140..eca9301 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -44,7 +44,7 @@
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/languagetagodf.hxx>
 
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
 
 using namespace ::com::sun::star;
 using namespace ::xmloff::token;
@@ -69,7 +69,7 @@ class SvXMLNumImpData
     SvXMLTokenMap*      pStyleAttrTokenMap;
     SvXMLTokenMap*      pStyleElemAttrTokenMap;
     LocaleDataWrapper*  pLocaleData;
-    boost::ptr_vector<SvXMLNumFmtEntry>      aNameEntries;
+    std::vector<SvXMLNumFmtEntry> m_NameEntries;
 
     uno::Reference< uno::XComponentContext > m_xContext;
 
@@ -382,10 +382,10 @@ SvXMLNumImpData::~SvXMLNumImpData()
 
 sal_uInt32 SvXMLNumImpData::GetKeyForName( const OUString& rName )
 {
-    sal_uInt16 nCount = aNameEntries.size();
+    sal_uInt16 nCount = m_NameEntries.size();
     for (sal_uInt16 i=0; i<nCount; i++)
     {
-        const SvXMLNumFmtEntry* pObj = &aNameEntries[i];
+        const SvXMLNumFmtEntry *const pObj = &m_NameEntries[i];
         if ( pObj->aName == rName )
             return pObj->nKey;              // found
     }
@@ -399,10 +399,10 @@ void SvXMLNumImpData::AddKey( sal_uInt32 nKey, const OUString& rName, bool bRemo
         //  if there is already an entry for this key without the bRemoveAfterUse flag,
         //  clear the flag for this entry, too
 
-        sal_uInt16 nCount = aNameEntries.size();
+        sal_uInt16 nCount = m_NameEntries.size();
         for (sal_uInt16 i=0; i<nCount; i++)
         {
-            SvXMLNumFmtEntry* pObj = &aNameEntries[i];
+            SvXMLNumFmtEntry *const pObj = &m_NameEntries[i];
             if ( pObj->nKey == nKey && !pObj->bRemoveAfterUse )
             {
                 bRemoveAfterUse = false;        // clear flag for new entry
@@ -416,16 +416,15 @@ void SvXMLNumImpData::AddKey( sal_uInt32 nKey, const OUString& rName, bool bRemo
         SetUsed( nKey );
     }
 
-    SvXMLNumFmtEntry* pObj = new SvXMLNumFmtEntry( rName, nKey, bRemoveAfterUse );
-    aNameEntries.push_back( pObj );
+    m_NameEntries.push_back(SvXMLNumFmtEntry(rName, nKey, bRemoveAfterUse));
 }
 
 void SvXMLNumImpData::SetUsed( sal_uInt32 nKey )
 {
-    sal_uInt16 nCount = aNameEntries.size();
+    sal_uInt16 nCount = m_NameEntries.size();
     for (sal_uInt16 i=0; i<nCount; i++)
     {
-        SvXMLNumFmtEntry* pObj = &aNameEntries[i];
+        SvXMLNumFmtEntry *const pObj = &m_NameEntries[i];
         if ( pObj->nKey == nKey )
         {
             pObj->bRemoveAfterUse = false;      // used -> don't remove
@@ -446,10 +445,10 @@ void SvXMLNumImpData::RemoveVolatileFormats()
     if ( !pFormatter )
         return;
 
-    sal_uInt16 nCount = aNameEntries.size();
+    sal_uInt16 nCount = m_NameEntries.size();
     for (sal_uInt16 i=0; i<nCount; i++)
     {
-        const SvXMLNumFmtEntry* pObj = &aNameEntries[i];
+        const SvXMLNumFmtEntry *const pObj = &m_NameEntries[i];
         if ( pObj->bRemoveAfterUse )
         {
             const SvNumberformat* pFormat = pFormatter->GetEntry(pObj->nKey);
commit 7c5d52999a0424e4980d48caa59005c197102abf
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 30 22:47:15 2015 +0100

    xmloff: replace boost::ptr_vector with std::vector
    
    Change-Id: Id7c1a28370f35fce7d885041a18e81a89defb69c

diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index c52a82d..2d6043d 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -46,7 +46,7 @@
 #include <xmloff/xmlexp.hxx>
 
 #include <set>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
 
 using namespace ::com::sun::star;
 using namespace ::xmloff::token;
@@ -62,16 +62,26 @@ struct LessuInt32
 
 typedef std::set< sal_uInt32, LessuInt32 >  SvXMLuInt32Set;
 
+struct SvXMLEmbeddedTextEntry
+{
+    sal_uInt16      nSourcePos;     // position in NumberFormat (to skip later)
+    sal_Int32       nFormatPos;     // resulting position in embedded-text element
+    OUString   aText;
+
+    SvXMLEmbeddedTextEntry( sal_uInt16 nSP, sal_Int32 nFP, const OUString& rT ) :
+        nSourcePos(nSP), nFormatPos(nFP), aText(rT) {}
+};
+
 class SvXMLEmbeddedTextEntryArr
 {
-    typedef boost::ptr_vector<SvXMLEmbeddedTextEntry> DataType;
+    typedef std::vector<SvXMLEmbeddedTextEntry> DataType;
     DataType maData;
 
 public:
 
-    void push_back( SvXMLEmbeddedTextEntry* p )
+    void push_back( SvXMLEmbeddedTextEntry const& r )
     {
-        maData.push_back(p);
+        maData.push_back(r);
     }
 
     const SvXMLEmbeddedTextEntry& operator[] ( size_t i ) const
@@ -109,16 +119,6 @@ public:
     void SetWasUsed(const uno::Sequence<sal_Int32>& rWasUsed);
 };
 
-struct SvXMLEmbeddedTextEntry
-{
-    sal_uInt16      nSourcePos;     // position in NumberFormat (to skip later)
-    sal_Int32       nFormatPos;     // resulting position in embedded-text element
-    OUString   aText;
-
-    SvXMLEmbeddedTextEntry( sal_uInt16 nSP, sal_Int32 nFP, const OUString& rT ) :
-        nSourcePos(nSP), nFormatPos(nFP), aText(rT) {}
-};
-
 //! SvXMLNumUsedList_Impl should be optimized!
 
 SvXMLNumUsedList_Impl::SvXMLNumUsedList_Impl() :
@@ -614,7 +614,7 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl(
     sal_uInt16 nEntryCount = rEmbeddedEntries.size();
     for (sal_uInt16 nEntry=0; nEntry<nEntryCount; nEntry++)
     {
-        const SvXMLEmbeddedTextEntry* pObj = &rEmbeddedEntries[nEntry];
+        const SvXMLEmbeddedTextEntry *const pObj = &rEmbeddedEntries[nEntry];
 
         //  position attribute
         rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_POSITION,
@@ -1289,8 +1289,8 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
                             }
                             sal_Int32 nEmbedPos = nIntegerSymbols - nDigitsPassed;
 
-                            SvXMLEmbeddedTextEntry* pObj = new SvXMLEmbeddedTextEntry( nPos, nEmbedPos, aEmbeddedStr );
-                            aEmbeddedEntries.push_back( pObj );
+                            aEmbeddedEntries.push_back(
+                                SvXMLEmbeddedTextEntry(nPos, nEmbedPos, aEmbeddedStr));
                         }
                         break;
                 }
commit 2ab470665f9cb350a9a3d10ecf1e1b85b72f676b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 30 22:30:56 2015 +0100

    xmloff: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: Icb51f02ca761d683d926135fcaedc1164cd1ae8d

diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx
index 51221b3..7c83433 100644
--- a/xmloff/source/style/impastpl.cxx
+++ b/xmloff/source/style/impastpl.cxx
@@ -282,9 +282,9 @@ bool XMLAutoStylePoolParent::Add( XMLAutoStyleFamily& rFamilyData, const vector<
     XMLAutoStylePoolProperties *pProperties = 0;
     sal_Int32 nProperties = rProperties.size();
     size_t i = 0;
-    for (size_t n = maPropertiesList.size(); i < n; ++i)
+    for (size_t n = m_PropertiesList.size(); i < n; ++i)
     {
-        XMLAutoStylePoolProperties* pIS = &maPropertiesList[i];
+        XMLAutoStylePoolProperties *const pIS = m_PropertiesList[i].get();
         if( nProperties > (sal_Int32)pIS->GetProperties().size() )
         {
             continue;
@@ -303,9 +303,9 @@ bool XMLAutoStylePoolParent::Add( XMLAutoStyleFamily& rFamilyData, const vector<
     if( !pProperties )
     {
         pProperties = new XMLAutoStylePoolProperties( rFamilyData, rProperties, msParent );
-        PropertiesListType::iterator it = maPropertiesList.begin();
+        PropertiesListType::iterator it = m_PropertiesList.begin();
         ::std::advance( it, i );
-        maPropertiesList.insert( it, pProperties );
+        m_PropertiesList.insert(it, std::unique_ptr<XMLAutoStylePoolProperties>(pProperties));
         bAdded = true;
     }
 
@@ -325,9 +325,9 @@ bool XMLAutoStylePoolParent::AddNamed( XMLAutoStyleFamily& rFamilyData, const ve
     bool bAdded = false;
     sal_Int32 nProperties = rProperties.size();
     size_t i = 0;
-    for (size_t n = maPropertiesList.size(); i < n; ++i)
+    for (size_t n = m_PropertiesList.size(); i < n; ++i)
     {
-        XMLAutoStylePoolProperties* pIS = &maPropertiesList[i];
+        XMLAutoStylePoolProperties *const pIS = m_PropertiesList[i].get();
         if( nProperties > (sal_Int32)pIS->GetProperties().size() )
         {
             continue;
@@ -340,13 +340,13 @@ bool XMLAutoStylePoolParent::AddNamed( XMLAutoStyleFamily& rFamilyData, const ve
 
     if (rFamilyData.maNameSet.find(rName) == rFamilyData.maNameSet.end())
     {
-        XMLAutoStylePoolProperties* pProperties =
-                new XMLAutoStylePoolProperties( rFamilyData, rProperties, msParent );
+        std::unique_ptr<XMLAutoStylePoolProperties> pProperties(
+            new XMLAutoStylePoolProperties(rFamilyData, rProperties, msParent));
         // ignore the generated name
         pProperties->SetName( rName );
-        PropertiesListType::iterator it = maPropertiesList.begin();
+        PropertiesListType::iterator it = m_PropertiesList.begin();
         ::std::advance( it, i );
-        maPropertiesList.insert( it, pProperties );
+        m_PropertiesList.insert(it, std::move(pProperties));
         bAdded = true;
     }
 
@@ -361,9 +361,9 @@ OUString XMLAutoStylePoolParent::Find( const XMLAutoStyleFamily& rFamilyData, co
 {
     OUString sName;
     vector< XMLPropertyState>::size_type nItems = rProperties.size();
-    for (size_t i = 0, n = maPropertiesList.size(); i < n; ++i)
+    for (size_t i = 0, n = m_PropertiesList.size(); i < n; ++i)
     {
-        const XMLAutoStylePoolProperties* pIS = &maPropertiesList[i];
+        const XMLAutoStylePoolProperties *const pIS = m_PropertiesList[i].get();
         if( nItems > pIS->GetProperties().size() )
         {
             continue;
@@ -636,8 +636,8 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
         size_t nProperties = rParent.GetPropertiesList().size();
         for( size_t j = 0; j < nProperties; j++ )
         {
-            XMLAutoStylePoolProperties* pProperties =
-                &rParent.GetPropertiesList()[j];
+            XMLAutoStylePoolProperties *const pProperties =
+                rParent.GetPropertiesList()[j].get();
             sal_uLong nPos = pProperties->GetPos();
             assert(nPos < nCount);
             assert(!aExpStyles[nPos].mpProperties);
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index d7a8240..c9113d4 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.hxx
@@ -35,7 +35,6 @@
 #include <xmloff/xmlexppr.hxx>
 
 #include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
 
 class SvXMLAutoStylePoolP;
 class XMLAutoStylePoolParent;
@@ -70,11 +69,11 @@ public:
 class XMLAutoStylePoolParent
 {
 public:
-    typedef boost::ptr_vector<XMLAutoStylePoolProperties> PropertiesListType;
+    typedef std::vector<std::unique_ptr<XMLAutoStylePoolProperties>> PropertiesListType;
 
 private:
     OUString msParent;
-    PropertiesListType maPropertiesList;
+    PropertiesListType m_PropertiesList;
 
 public:
 
@@ -95,7 +94,7 @@ public:
 
     PropertiesListType& GetPropertiesList()
     {
-        return maPropertiesList;
+        return m_PropertiesList;
     }
 
     bool operator< (const XMLAutoStylePoolParent& rOther) const;
commit 02b7f3d1a21d68611f2cd8405103c8546542960b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 30 22:23:48 2015 +0100

    xmloff: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: I3270237a8691a5f5f4495be8cf2e290cac0b2fcd

diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 888b3ca..ca8f246 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -18,9 +18,14 @@
  */
 
 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
+
+#include <memory>
+#include <vector>
+
 #include <rtl/ustring.hxx>
 #include <rtl/ustrbuf.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+
+#include <o3tl/make_unique.hxx>
 
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/text/XTextFrame.hpp>
@@ -53,7 +58,6 @@
 #include "txtlists.hxx"
 
 #include <txtparaimphint.hxx>
-class XMLHints_Impl : public boost::ptr_vector<XMLHint_Impl> {};
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -64,6 +68,8 @@ using namespace ::xmloff::token;
 using ::com::sun::star::container::XEnumerationAccess;
 using ::com::sun::star::container::XEnumeration;
 
+class XMLHints_Impl : public std::vector<std::unique_ptr<XMLHint_Impl>> {};
+
 TYPEINIT1( XMLCharContext, SvXMLImportContext );
 
 XMLCharContext::XMLCharContext(
@@ -161,7 +167,7 @@ public:
         SvXMLImport& rImport,
         sal_uInt16 nPrefix,
         const OUString& rLocalName,
-        XMLHints_Impl& rHnts,
+        XMLHints_Impl& rHints,
         const Reference<xml::sax::XAttributeList> & xAttrList);
 
     static bool FindName(
@@ -184,13 +190,13 @@ XMLStartReferenceContext_Impl::XMLStartReferenceContext_Impl(
 
     if (FindName(GetImport(), xAttrList, sName))
     {
-        XMLHint_Impl* pHint = new XMLReferenceHint_Impl(
-            sName, rImport.GetTextImport()->GetCursor()->getStart() );
+        std::unique_ptr<XMLHint_Impl> pHint(new XMLReferenceHint_Impl(
+            sName, rImport.GetTextImport()->GetCursor()->getStart()));
 
         // degenerates to point reference, if no end is found!
         pHint->SetEnd(rImport.GetTextImport()->GetCursor()->getStart() );
 
-        rHints.push_back(pHint);
+        rHints.push_back(std::move(pHint));
     }
 }
 
@@ -232,7 +238,7 @@ public:
         SvXMLImport& rImport,
         sal_uInt16 nPrefix,
         const OUString& rLocalName,
-        XMLHints_Impl& rHnts,
+        XMLHints_Impl& rHints,
         const Reference<xml::sax::XAttributeList> & xAttrList);
 };
 
@@ -255,7 +261,7 @@ XMLEndReferenceContext_Impl::XMLEndReferenceContext_Impl(
         sal_uInt16 nCount = rHints.size();
         for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
         {
-            XMLHint_Impl *pHint = &rHints[nPos];
+            XMLHint_Impl *const pHint = rHints[nPos].get();
             if ( pHint->IsReference() &&
                  sName.equals( static_cast<XMLReferenceHint_Impl *>(pHint)->GetRefName()) )
             {
@@ -271,7 +277,7 @@ XMLEndReferenceContext_Impl::XMLEndReferenceContext_Impl(
 
 class XMLImpSpanContext_Impl : public SvXMLImportContext
 {
-    XMLHints_Impl&      rHints;
+    XMLHints_Impl&      m_rHints;
     XMLStyleHint_Impl   *pHint;
 
     bool&                rIgnoreLeadingSpace;
@@ -287,7 +293,7 @@ public:
             sal_uInt16 nPrfx,
             const OUString& rLName,
             const Reference< xml::sax::XAttributeList > & xAttrList,
-            XMLHints_Impl& rHnts,
+            XMLHints_Impl& rHints,
             bool& rIgnLeadSpace,
             sal_uInt8 nSFConvFlags
                           );
@@ -298,7 +304,7 @@ public:
             SvXMLImport& rImport,
             sal_uInt16 nPrefix, const OUString& rLocalName,
             const Reference< xml::sax::XAttributeList > & xAttrList,
-            sal_uInt16 nToken, XMLHints_Impl& rHnts,
+            sal_uInt16 nToken, XMLHints_Impl& rHints,
             bool& rIgnLeadSpace,
             sal_uInt8 nStarFontsConvFlags = 0
              );
@@ -311,7 +317,7 @@ public:
 
 class XMLImpHyperlinkContext_Impl : public SvXMLImportContext
 {
-    XMLHints_Impl&  mrHints;
+    XMLHints_Impl&  m_rHints;
     XMLHyperlinkHint_Impl   *mpHint;
 
     bool&       mrbIgnoreLeadingSpace;
@@ -325,7 +331,7 @@ public:
             sal_uInt16 nPrfx,
             const OUString& rLName,
             const Reference< xml::sax::XAttributeList > & xAttrList,
-            XMLHints_Impl& rHnts,
+            XMLHints_Impl& rHints,
             bool& rIgnLeadSpace );
 
     virtual ~XMLImpHyperlinkContext_Impl();
@@ -344,10 +350,10 @@ XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl(
     sal_uInt16 nPrfx,
     const OUString& rLName,
     const Reference< xml::sax::XAttributeList > & xAttrList,
-    XMLHints_Impl& rHnts,
+    XMLHints_Impl& rHints,
     bool& rIgnLeadSpace )
     : SvXMLImportContext( rImport, nPrfx, rLName )
-    , mrHints( rHnts )
+    , m_rHints( rHints )
     , mpHint( new XMLHyperlinkHint_Impl( GetImport().GetTextImport()->GetCursorAsRange()->getStart() ) )
     , mrbIgnoreLeadingSpace( rIgnLeadSpace )
 {
@@ -403,7 +409,7 @@ XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl(
     }
     else
     {
-        mrHints.push_back( mpHint );
+        m_rHints.push_back(std::unique_ptr<XMLHyperlinkHint_Impl>(mpHint));
     }
 }
 
@@ -434,7 +440,7 @@ SvXMLImportContext *XMLImpHyperlinkContext_Impl::CreateChildContext(
 
         return XMLImpSpanContext_Impl::CreateChildContext(
             GetImport(), nPrefix, rLocalName, xAttrList,
-            nToken, mrHints, mrbIgnoreLeadingSpace );
+            nToken, m_rHints, mrbIgnoreLeadingSpace );
     }
 }
 
@@ -445,7 +451,7 @@ void XMLImpHyperlinkContext_Impl::Characters( const OUString& rChars )
 
 class XMLImpRubyBaseContext_Impl : public SvXMLImportContext
 {
-    XMLHints_Impl&  rHints;
+    XMLHints_Impl&  m_rHints;
 
     bool&       rIgnoreLeadingSpace;
 
@@ -458,7 +464,7 @@ public:
             sal_uInt16 nPrfx,
             const OUString& rLName,
             const Reference< xml::sax::XAttributeList > & xAttrList,
-            XMLHints_Impl& rHnts,
+            XMLHints_Impl& rHints,
             bool& rIgnLeadSpace );
 
     virtual ~XMLImpRubyBaseContext_Impl();
@@ -477,11 +483,11 @@ XMLImpRubyBaseContext_Impl::XMLImpRubyBaseContext_Impl(
         sal_uInt16 nPrfx,
         const OUString& rLName,
         const Reference< xml::sax::XAttributeList > &,
-        XMLHints_Impl& rHnts,
-        bool& rIgnLeadSpace ) :
-    SvXMLImportContext( rImport, nPrfx, rLName ),
-    rHints( rHnts ),
-    rIgnoreLeadingSpace( rIgnLeadSpace )
+        XMLHints_Impl& rHints,
+        bool& rIgnLeadSpace )
+    : SvXMLImportContext( rImport, nPrfx, rLName )
+    , m_rHints( rHints )
+    , rIgnoreLeadingSpace( rIgnLeadSpace )
 {
 }
 
@@ -499,7 +505,7 @@ SvXMLImportContext *XMLImpRubyBaseContext_Impl::CreateChildContext(
 
     return XMLImpSpanContext_Impl::CreateChildContext( GetImport(), nPrefix,
                                                        rLocalName, xAttrList,
-                               nToken, rHints, rIgnoreLeadingSpace );
+                               nToken, m_rHints, rIgnoreLeadingSpace );
 }
 
 void XMLImpRubyBaseContext_Impl::Characters( const OUString& rChars )
@@ -509,7 +515,7 @@ void XMLImpRubyBaseContext_Impl::Characters( const OUString& rChars )
 
 class XMLImpRubyContext_Impl : public SvXMLImportContext
 {
-    XMLHints_Impl&  rHints;
+    XMLHints_Impl&  m_rHints;
 
     bool&       rIgnoreLeadingSpace;
 
@@ -527,7 +533,7 @@ public:
             sal_uInt16 nPrfx,
             const OUString& rLName,
             const Reference< xml::sax::XAttributeList > & xAttrList,
-            XMLHints_Impl& rHnts,
+            XMLHints_Impl& rHints,
             bool& rIgnLeadSpace );
 
     virtual ~XMLImpRubyContext_Impl();
@@ -606,11 +612,11 @@ XMLImpRubyContext_Impl::XMLImpRubyContext_Impl(
         sal_uInt16 nPrfx,
         const OUString& rLName,
         const Reference< xml::sax::XAttributeList > & xAttrList,
-        XMLHints_Impl& rHnts,
-        bool& rIgnLeadSpace ) :
-    SvXMLImportContext( rImport, nPrfx, rLName ),
-    rHints( rHnts ),
-    rIgnoreLeadingSpace( rIgnLeadSpace )
+        XMLHints_Impl& rHints,
+        bool& rIgnLeadSpace )
+    : SvXMLImportContext( rImport, nPrfx, rLName )
+    , m_rHints( rHints )
+    , rIgnoreLeadingSpace( rIgnLeadSpace )
     , m_xStart( GetImport().GetTextImport()->GetCursorAsRange()->getStart() )
 {
     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
@@ -655,7 +661,7 @@ SvXMLImportContext *XMLImpRubyContext_Impl::CreateChildContext(
             pContext = new XMLImpRubyBaseContext_Impl( GetImport(), nPrefix,
                                                        rLocalName,
                                                        xAttrList,
-                                                       rHints,
+                                                       m_rHints,
                                                        rIgnoreLeadingSpace );
         else if( IsXMLToken( rLocalName, XML_RUBY_TEXT ) )
             pContext = new XMLImpRubyTextContext_Impl( GetImport(), nPrefix,
@@ -1002,7 +1008,7 @@ class XMLIndexMarkImportContext_Impl : public SvXMLImportContext
 {
     const OUString sAlternativeText;
 
-    XMLHints_Impl& rHints;
+    XMLHints_Impl& m_rHints;
     const enum XMLTextPElemTokens eToken;
     OUString sID;
 
@@ -1014,7 +1020,7 @@ public:
         sal_uInt16 nPrefix,
         const OUString& rLocalName,
         enum XMLTextPElemTokens nTok,
-        XMLHints_Impl& rHnts);
+        XMLHints_Impl& rHints);
 
     void StartElement(const Reference<xml::sax::XAttributeList> & xAttrList) override;
 
@@ -1051,11 +1057,11 @@ XMLIndexMarkImportContext_Impl::XMLIndexMarkImportContext_Impl(
     sal_uInt16 nPrefix,
     const OUString& rLocalName,
     enum XMLTextPElemTokens eTok,
-    XMLHints_Impl& rHnts) :
-        SvXMLImportContext(rImport, nPrefix, rLocalName),
-        sAlternativeText("AlternativeText"),
-        rHints(rHnts),
-        eToken(eTok)
+    XMLHints_Impl& rHints)
+    : SvXMLImportContext(rImport, nPrefix, rLocalName)
+    , sAlternativeText("AlternativeText")
+    , m_rHints(rHints)
+    , eToken(eTok)
 {
 }
 
@@ -1079,8 +1085,8 @@ void XMLIndexMarkImportContext_Impl::StartElement(
             if (CreateMark(xMark, sService))
             {
                 ProcessAttributes(xAttrList, xMark);
-                XMLHint_Impl* pHint = new XMLIndexMarkHint_Impl(xMark, xPos);
-                rHints.push_back(pHint);
+                m_rHints.push_back(
+                    o3tl::make_unique<XMLIndexMarkHint_Impl>(xMark, xPos));
             }
             // else: can't create mark -> ignore
             break;
@@ -1099,9 +1105,8 @@ void XMLIndexMarkImportContext_Impl::StartElement(
                 if (!sID.isEmpty())
                 {
                     // process only if we find an ID
-                    XMLHint_Impl* pHint =
-                        new XMLIndexMarkHint_Impl(xMark, xPos, sID);
-                    rHints.push_back(pHint);
+                    m_rHints.push_back(
+                        o3tl::make_unique<XMLIndexMarkHint_Impl>(xMark, xPos, sID));
                 }
                 // else: no ID -> we'll never find the end -> ignore
             }
@@ -1120,10 +1125,10 @@ void XMLIndexMarkImportContext_Impl::StartElement(
             if (!sID.isEmpty())
             {
                 // if we have an ID, find the hint and set the end position
-                sal_uInt16 nCount = rHints.size();
+                sal_uInt16 nCount = m_rHints.size();
                 for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
                 {
-                    XMLHint_Impl *pHint = &rHints[nPos];
+                    XMLHint_Impl *const pHint = m_rHints[nPos].get();
                     if ( pHint->IsIndexMark() &&
                          sID.equals(
                              static_cast<XMLIndexMarkHint_Impl *>(pHint)->GetID()) )
@@ -1287,7 +1292,7 @@ public:
         sal_uInt16 nPrefix,
         const OUString& rLocalName,
         enum XMLTextPElemTokens nTok,
-        XMLHints_Impl& rHnts);
+        XMLHints_Impl& rHints);
 
 protected:
 
@@ -1302,9 +1307,9 @@ TYPEINIT1( XMLTOCMarkImportContext_Impl, XMLIndexMarkImportContext_Impl );
 
 XMLTOCMarkImportContext_Impl::XMLTOCMarkImportContext_Impl(
     SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
-    enum XMLTextPElemTokens nTok, XMLHints_Impl& rHnts) :
+    enum XMLTextPElemTokens nTok, XMLHints_Impl& rHints) :
         XMLIndexMarkImportContext_Impl(rImport, nPrefix, rLocalName,
-                                       nTok, rHnts),
+                                       nTok, rHints),
         sLevel("Level")
 {
 }
@@ -1352,7 +1357,7 @@ public:
         sal_uInt16 nPrefix,
         const OUString& rLocalName,
         enum XMLTextPElemTokens nTok,
-        XMLHints_Impl& rHnts);
+        XMLHints_Impl& rHints);
 
 protected:
 
@@ -1367,9 +1372,9 @@ TYPEINIT1( XMLUserIndexMarkImportContext_Impl, XMLIndexMarkImportContext_Impl);
 
 XMLUserIndexMarkImportContext_Impl::XMLUserIndexMarkImportContext_Impl(
     SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
-    enum XMLTextPElemTokens nTok, XMLHints_Impl& rHnts) :
+    enum XMLTextPElemTokens nTok, XMLHints_Impl& rHints) :
         XMLIndexMarkImportContext_Impl(rImport, nPrefix, rLocalName,
-                                       nTok, rHnts),
+                                       nTok, rHints),
         sUserIndexName("UserIndexName"),
         sLevel("Level")
 {
@@ -1429,7 +1434,7 @@ public:
         sal_uInt16 nPrefix,
         const OUString& rLocalName,
         enum XMLTextPElemTokens nTok,
-        XMLHints_Impl& rHnts);
+        XMLHints_Impl& rHints);
 
 protected:
 
@@ -1445,9 +1450,9 @@ TYPEINIT1( XMLAlphaIndexMarkImportContext_Impl,
 
 XMLAlphaIndexMarkImportContext_Impl::XMLAlphaIndexMarkImportContext_Impl(
     SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
-    enum XMLTextPElemTokens nTok, XMLHints_Impl& rHnts) :
+    enum XMLTextPElemTokens nTok, XMLHints_Impl& rHints) :
         XMLIndexMarkImportContext_Impl(rImport, nPrefix, rLocalName,
-                                       nTok, rHnts),
+                                       nTok, rHints),
         sPrimaryKey("PrimaryKey"),
         sSecondaryKey("SecondaryKey"),
         sTextReading("TextReading"),
@@ -1513,12 +1518,12 @@ XMLImpSpanContext_Impl::XMLImpSpanContext_Impl(
         sal_uInt16 nPrfx,
         const OUString& rLName,
         const Reference< xml::sax::XAttributeList > & xAttrList,
-        XMLHints_Impl& rHnts,
+        XMLHints_Impl& rHints,
         bool& rIgnLeadSpace,
         sal_uInt8 nSFConvFlags
                                               )
 :   SvXMLImportContext( rImport, nPrfx, rLName )
-,   rHints( rHnts )
+,   m_rHints( rHints )
 ,   pHint( 0  )
 ,   rIgnoreLeadingSpace( rIgnLeadSpace )
 ,   nStarFontsConvFlags( nSFConvFlags & (CONV_FROM_STAR_BATS|CONV_FROM_STAR_MATH) )
@@ -1543,7 +1548,7 @@ XMLImpSpanContext_Impl::XMLImpSpanContext_Impl(
     {
         pHint = new XMLStyleHint_Impl( aStyleName,
                   GetImport().GetTextImport()->GetCursorAsRange()->getStart() );
-            rHints.push_back( pHint );
+        m_rHints.push_back(std::unique_ptr<XMLStyleHint_Impl>(pHint));
     }
 }
 
@@ -1691,8 +1696,8 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
             if( TextContentAnchorType_AT_CHARACTER ==
                                             pTextFrameContext->GetAnchorType() )
             {
-                rHints.push_back( new XMLTextFrameHint_Impl(
-                    pTextFrameContext, xAnchorPos ) );
+                rHints.push_back(o3tl::make_unique<XMLTextFrameHint_Impl>(
+                                    pTextFrameContext, xAnchorPos));
             }
             pContext = pTextFrameContext;
             rIgnoreLeadingSpace = false;
@@ -1705,9 +1710,8 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
                 new XMLTextFrameHyperlinkContext( rImport, nPrefix,
                                         rLocalName, xAttrList,
                                         TextContentAnchorType_AS_CHARACTER );
-            XMLTextFrameHint_Impl *pHint =
-                new XMLTextFrameHint_Impl( pContext, xAnchorPos);
-            rHints.push_back( pHint );
+            rHints.push_back(
+                o3tl::make_unique<XMLTextFrameHint_Impl>(pContext, xAnchorPos));
         }
         break;
 
@@ -1780,7 +1784,8 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
             // adjust its anchor position, if its at-character anchored
             Reference < XTextRange > xAnchorPos =
                 rImport.GetTextImport()->GetCursor()->getStart();
-            rHints.push_back( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ) );
+            rHints.push_back(
+                o3tl::make_unique<XMLDrawHint_Impl>(pShapeContext, xAnchorPos));
         }
         if( !pContext )
         {
@@ -1804,7 +1809,7 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
     sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
 
     return CreateChildContext( GetImport(), nPrefix, rLocalName, xAttrList,
-                               nToken, rHints, rIgnoreLeadingSpace
+                               nToken, m_rHints, rIgnoreLeadingSpace
                                ,nStarFontsConvFlags
                              );
 }
@@ -2076,7 +2081,7 @@ XMLParaContext::~XMLParaContext()
     {
         for( size_t i=0; i<pHints->size(); i++ )
         {
-            XMLHint_Impl *pHint = &(*pHints)[i];
+            XMLHint_Impl *const pHint = (*pHints)[i].get();
             xAttrCursor->gotoRange( pHint->GetStart(), sal_False );
             xAttrCursor->gotoRange( pHint->GetEnd(), sal_True );
             switch( pHint->GetType() )


More information about the Libreoffice-commits mailing list