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

Michael Stahl mstahl at redhat.com
Mon Nov 9 08:14:04 PST 2015


 sc/source/filter/xml/xmlimprt.cxx |   18 ++--
 sc/source/filter/xml/xmlimprt.hxx |   14 +--
 sc/source/ui/inc/prevloc.hxx      |   15 ++-
 sc/source/ui/view/prevloc.cxx     |   62 ++++++--------
 starmath/inc/node.hxx             |   17 ++-
 starmath/source/mathmlimport.cxx  |  139 +++++++++++++++++---------------
 starmath/source/parse.cxx         |  162 ++++++++++++++++++++------------------
 7 files changed, 222 insertions(+), 205 deletions(-)

New commits:
commit 9ed9f30f2202cc7d57b1dbe68a37cc6fbbd2866a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Nov 9 15:25:29 2015 +0100

    starmath: replace boost::ptr_deque with std::deque<std::unique_ptr>
    
    Change-Id: I1d2671a0b355bd4dbb195d69af2c432c50df904e

diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 3126f58..c7f71ba 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -20,16 +20,16 @@
 #ifndef INCLUDED_STARMATH_INC_NODE_HXX
 #define INCLUDED_STARMATH_INC_NODE_HXX
 
-#include <vector>
-#include <ostream>
-
 #include "types.hxx"
 #include "token.hxx"
 #include "error.hxx"
 #include "rect.hxx"
 #include "format.hxx"
-#include <boost/ptr_container/ptr_deque.hpp>
+
 #include <memory>
+#include <vector>
+#include <deque>
+#include <ostream>
 
 #define ATTR_BOLD       0x0001
 #define ATTR_ITALIC     0x0002
@@ -61,15 +61,16 @@ class SmNode;
 class SmStructureNode;
 
 typedef std::shared_ptr<SmNode> SmNodePointer;
-typedef boost::ptr_deque<SmNode> SmNodeStack;
+typedef std::deque<std::unique_ptr<SmNode>> SmNodeStack;
 typedef std::vector< SmNode * > SmNodeArray;
 
 template < typename T >
-T* popOrZero( boost::ptr_deque<T> & rStack )
+T* popOrZero(std::deque<std::unique_ptr<T>> & rStack)
 {
     if (rStack.empty())
-        return 0;
-    auto pTmp = rStack.pop_front();
+        return nullptr;
+    std::unique_ptr<T> pTmp(std::move(rStack.front()));
+    rStack.pop_front();
     return pTmp.release();
 }
 
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 658b6b4..98cb9ad 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -42,6 +42,7 @@ one go*/
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/string.hxx>
+#include <o3tl/make_unique.hxx>
 #include <rtl/math.hxx>
 #include <sfx2/frame.hxx>
 #include <sfx2/docfile.hxx>
@@ -670,9 +671,9 @@ void SmXMLContext_Helper::ApplyAttrs()
                 aToken.eType = TBOLD;
             else
                 aToken.eType = TNBOLD;
-            SmFontNode *pFontNode = new SmFontNode(aToken);
+            std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken));
             pFontNode->SetSubNodes(0,popOrZero(rNodeStack));
-            rNodeStack.push_front(pFontNode);
+            rNodeStack.push_front(std::move(pFontNode));
         }
         if (nIsItalic != -1)
         {
@@ -680,14 +681,14 @@ void SmXMLContext_Helper::ApplyAttrs()
                 aToken.eType = TITALIC;
             else
                 aToken.eType = TNITALIC;
-            SmFontNode *pFontNode = new SmFontNode(aToken);
+            std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken));
             pFontNode->SetSubNodes(0,popOrZero(rNodeStack));
-            rNodeStack.push_front(pFontNode);
+            rNodeStack.push_front(std::move(pFontNode));
         }
         if (nFontSize != 0.0)
         {
             aToken.eType = TSIZE;
-            SmFontNode *pFontNode = new SmFontNode(aToken);
+            std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken));
 
             if (util::MeasureUnit::PERCENT == rContext.GetSmImport()
                     .GetMM100UnitConverter().GetXMLMeasureUnit())
@@ -703,7 +704,7 @@ void SmXMLContext_Helper::ApplyAttrs()
                 pFontNode->SetSizeParameter(Fraction(nFontSize),FontSizeType::ABSOLUT);
 
             pFontNode->SetSubNodes(0,popOrZero(rNodeStack));
-            rNodeStack.push_front(pFontNode);
+            rNodeStack.push_front(std::move(pFontNode));
         }
         if (!sFontFamily.isEmpty())
         {
@@ -718,9 +719,9 @@ void SmXMLContext_Helper::ApplyAttrs()
                 return;
 
             aToken.aText = sFontFamily;
-            SmFontNode *pFontNode = new SmFontNode(aToken);
+            std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken));
             pFontNode->SetSubNodes(0,popOrZero(rNodeStack));
-            rNodeStack.push_front(pFontNode);
+            rNodeStack.push_front(std::move(pFontNode));
         }
         if (!sColor.isEmpty())
         {
@@ -732,9 +733,9 @@ void SmXMLContext_Helper::ApplyAttrs()
             if (tok != XML_TOK_UNKNOWN)
             {
                 aToken.eType = static_cast<SmTokenType>(tok);
-                SmFontNode *pFontNode = new SmFontNode(aToken);
+                std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken));
                 pFontNode->SetSubNodes(0,popOrZero(rNodeStack));
-                rNodeStack.push_front(pFontNode);
+                rNodeStack.push_front(std::move(pFontNode));
             }
         }
 
@@ -929,10 +930,10 @@ void SmXMLPhantomContext_Impl::EndElement()
     aToken.nLevel = 5;
     aToken.eType = TPHANTOM;
 
-    SmFontNode *pPhantom = new SmFontNode(aToken);
+    std::unique_ptr<SmFontNode> pPhantom(new SmFontNode(aToken));
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
     pPhantom->SetSubNodes(0,popOrZero(rNodeStack));
-    rNodeStack.push_front(pPhantom);
+    rNodeStack.push_front(std::move(pPhantom));
 }
 
 
@@ -994,7 +995,7 @@ void SmXMLFencedContext_Impl::EndElement()
 
     aToken.eType = TLPARENT;
     aToken.cMathChar = cBegin;
-    SmStructureNode *pSNode = new SmBraceNode(aToken);
+    std::unique_ptr<SmStructureNode> pSNode(new SmBraceNode(aToken));
     SmNode *pLeft = new SmMathSymbolNode(aToken);
 
     aToken.cMathChar = cEnd;
@@ -1014,7 +1015,8 @@ void SmXMLFencedContext_Impl::EndElement()
     aRelationArray.resize(i);
     while (rNodeStack.size() > nElementCount)
     {
-        auto pNode = rNodeStack.pop_front();
+        auto pNode = std::move(rNodeStack.front());
+        rNodeStack.pop_front();
         aRelationArray[--i] = pNode.release();
         if (i > 1 && rNodeStack.size() > 1)
             aRelationArray[--i] = new SmGlyphSpecialNode(aToken);
@@ -1027,7 +1029,7 @@ void SmXMLFencedContext_Impl::EndElement()
 
     pSNode->SetSubNodes(pLeft,pBody,pRight);
     pSNode->SetScaleMode(SCALE_HEIGHT);
-    GetSmImport().GetNodeStack().push_front(pSNode);
+    GetSmImport().GetNodeStack().push_front(std::move(pSNode));
 }
 
 
@@ -1088,7 +1090,7 @@ void SmXMLNumberContext_Impl::TCharacters(const OUString &rChars)
 
 void SmXMLNumberContext_Impl::EndElement()
 {
-    GetSmImport().GetNodeStack().push_front(new SmTextNode(aToken,FNT_NUMBER));
+    GetSmImport().GetNodeStack().push_front(o3tl::make_unique<SmTextNode>(aToken,FNT_NUMBER));
 }
 
 
@@ -1167,7 +1169,7 @@ void SmXMLTextContext_Impl::TCharacters(const OUString &rChars)
 
 void SmXMLTextContext_Impl::EndElement()
 {
-    GetSmImport().GetNodeStack().push_front(new SmTextNode(aToken,FNT_TEXT));
+    GetSmImport().GetNodeStack().push_front(o3tl::make_unique<SmTextNode>(aToken,FNT_TEXT));
 }
 
 
@@ -1209,7 +1211,7 @@ void SmXMLStringContext_Impl::TCharacters(const OUString &rChars)
 
 void SmXMLStringContext_Impl::EndElement()
 {
-    GetSmImport().GetNodeStack().push_front(new SmTextNode(aToken,FNT_FIXED));
+    GetSmImport().GetNodeStack().push_front(o3tl::make_unique<SmTextNode>(aToken,FNT_FIXED));
 }
 
 
@@ -1240,18 +1242,18 @@ public:
 
 void SmXMLIdentifierContext_Impl::EndElement()
 {
-    SmTextNode *pNode = 0;
+    std::unique_ptr<SmTextNode> pNode;
     //we will handle identifier italic/normal here instead of with a standalone
     //font node
     if (((aStyleHelper.nIsItalic == -1) && (aToken.aText.getLength() > 1))
         || ((aStyleHelper.nIsItalic == 0) && (aToken.aText.getLength() == 1)))
     {
-        pNode = new SmTextNode(aToken,FNT_FUNCTION);
+        pNode.reset(new SmTextNode(aToken,FNT_FUNCTION));
         pNode->GetFont().SetItalic(ITALIC_NONE);
         aStyleHelper.nIsItalic = -1;
     }
     else
-        pNode = new SmTextNode(aToken,FNT_VARIABLE);
+        pNode.reset(new SmTextNode(aToken,FNT_VARIABLE));
     if (aStyleHelper.bFontNodeNeeded && aStyleHelper.nIsItalic != -1)
     {
         if (aStyleHelper.nIsItalic)
@@ -1268,7 +1270,7 @@ void SmXMLIdentifierContext_Impl::EndElement()
         aStyleHelper.bFontNodeNeeded=false;
     if (aStyleHelper.bFontNodeNeeded)
         aStyleHelper.ApplyAttrs();
-    GetSmImport().GetNodeStack().push_front(pNode);
+    GetSmImport().GetNodeStack().push_front(std::move(pNode));
 }
 
 void SmXMLIdentifierContext_Impl::TCharacters(const OUString &rChars)
@@ -1306,13 +1308,13 @@ void SmXMLOperatorContext_Impl::TCharacters(const OUString &rChars)
 
 void SmXMLOperatorContext_Impl::EndElement()
 {
-    SmMathSymbolNode *pNode = new SmMathSymbolNode(aToken);
+    std::unique_ptr<SmMathSymbolNode> pNode(new SmMathSymbolNode(aToken));
     //For stretchy scaling the scaling must be retrieved from this node
     //and applied to the expression itself so as to get the expression
     //to scale the operator to the height of the expression itself
     if (bIsStretchy)
         pNode->SetScaleMode(SCALE_HEIGHT);
-    GetSmImport().GetNodeStack().push_front(pNode);
+    GetSmImport().GetNodeStack().push_front(std::move(pNode));
 }
 
 
@@ -1365,9 +1367,9 @@ void SmXMLSpaceContext_Impl::StartElement(
     aToken.cMathChar = '\0';
     aToken.eType = TBLANK;
     aToken.nLevel = 5;
-    SmBlankNode *pBlank = new SmBlankNode(aToken);
+    std::unique_ptr<SmBlankNode> pBlank(new SmBlankNode(aToken));
     pBlank->IncreaseBy(aToken);
-    GetSmImport().GetNodeStack().push_front(pBlank);
+    GetSmImport().GetNodeStack().push_front(std::move(pBlank));
 }
 
 
@@ -1400,7 +1402,7 @@ void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup
     SmToken aToken;
     aToken.cMathChar = '\0';
     aToken.eType = eType;
-    SmSubSupNode *pNode = new SmSubSupNode(aToken);
+    std::unique_ptr<SmSubSupNode> pNode(new SmSubSupNode(aToken));
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
 
     // initialize subnodes array
@@ -1412,7 +1414,7 @@ void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup
     aSubNodes[eSubSup+1] = popOrZero(rNodeStack);
     aSubNodes[0] = popOrZero(rNodeStack);
     pNode->SetSubNodes(aSubNodes);
-    rNodeStack.push_front(pNode);
+    rNodeStack.push_front(std::move(pNode));
 }
 
 
@@ -1460,7 +1462,7 @@ void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType,
     SmToken aToken;
     aToken.cMathChar = '\0';
     aToken.eType = eType;
-    SmSubSupNode *pNode = new SmSubSupNode(aToken);
+    std::unique_ptr<SmSubSupNode> pNode(new SmSubSupNode(aToken));
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
 
     // initialize subnodes array
@@ -1473,7 +1475,7 @@ void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType,
     aSubNodes[aSub+1] = popOrZero(rNodeStack);
     aSubNodes[0] =  popOrZero(rNodeStack);
     pNode->SetSubNodes(aSubNodes);
-    rNodeStack.push_front(pNode);
+    rNodeStack.push_front(std::move(pNode));
 }
 
 
@@ -1519,7 +1521,7 @@ void SmXMLUnderContext_Impl::HandleAccent()
     SmNodeArray aSubNodes;
     aSubNodes.resize(2);
 
-    SmStructureNode *pNode = new SmAttributNode(aToken);
+    std::unique_ptr<SmStructureNode> pNode(new SmAttributNode(aToken));
     if ((pTest->GetToken().cMathChar & 0x0FFF) == 0x0332)
     {
         aSubNodes[0] = new SmRectangleNode(aToken);
@@ -1531,7 +1533,7 @@ void SmXMLUnderContext_Impl::HandleAccent()
     aSubNodes[1] = popOrZero(rNodeStack);
     pNode->SetSubNodes(aSubNodes);
     pNode->SetScaleMode(SCALE_WIDTH);
-    rNodeStack.push_front(pNode);
+    rNodeStack.push_front(std::move(pNode));
 }
 
 
@@ -1588,7 +1590,7 @@ void SmXMLOverContext_Impl::HandleAccent()
     aToken.cMathChar = '\0';
     aToken.eType = TACUTE;
 
-    SmAttributNode *pNode = new SmAttributNode(aToken);
+    std::unique_ptr<SmAttributNode> pNode(new SmAttributNode(aToken));
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
 
     SmNodeArray aSubNodes;
@@ -1597,7 +1599,7 @@ void SmXMLOverContext_Impl::HandleAccent()
     aSubNodes[1] = popOrZero(rNodeStack);
     pNode->SetSubNodes(aSubNodes);
     pNode->SetScaleMode(SCALE_WIDTH);
-    rNodeStack.push_front(pNode);
+    rNodeStack.push_front(std::move(pNode));
 
 }
 
@@ -1657,7 +1659,7 @@ void SmXMLNoneContext_Impl::EndElement()
     aToken.nLevel = 5;
     aToken.eType = TIDENT;
     GetSmImport().GetNodeStack().push_front(
-        new SmTextNode(aToken,FNT_VARIABLE));
+        o3tl::make_unique<SmTextNode>(aToken,FNT_VARIABLE));
 }
 
 
@@ -2136,21 +2138,22 @@ void SmXMLDocContext_Impl::EndElement()
     ContextArray[0] = popOrZero(rNodeStack);
 
     SmToken aDummy;
-    SmStructureNode *pSNode = new SmLineNode(aDummy);
+    std::unique_ptr<SmStructureNode> pSNode(new SmLineNode(aDummy));
     pSNode->SetSubNodes(ContextArray);
-    rNodeStack.push_front(pSNode);
+    rNodeStack.push_front(std::move(pSNode));
 
     SmNodeArray  LineArray;
     auto n = rNodeStack.size();
     LineArray.resize(n);
     for (size_t j = 0; j < n; j++)
     {
-        auto pNode = rNodeStack.pop_front();
+        auto pNode = std::move(rNodeStack.front());
+        rNodeStack.pop_front();
         LineArray[n - (j + 1)] = pNode.release();
     }
-    SmStructureNode *pSNode2 = new SmTableNode(aDummy);
+    std::unique_ptr<SmStructureNode> pSNode2(new SmTableNode(aDummy));
     pSNode2->SetSubNodes(LineArray);
-    rNodeStack.push_front(pSNode2);
+    rNodeStack.push_front(std::move(pSNode2));
 }
 
 void SmXMLFracContext_Impl::EndElement()
@@ -2164,12 +2167,12 @@ void SmXMLFracContext_Impl::EndElement()
     SmToken aToken;
     aToken.cMathChar = '\0';
     aToken.eType = TOVER;
-    SmStructureNode *pSNode = new SmBinVerNode(aToken);
+    std::unique_ptr<SmStructureNode> pSNode(new SmBinVerNode(aToken));
     SmNode *pOper = new SmRectangleNode(aToken);
     SmNode *pSecond = popOrZero(rNodeStack);
     SmNode *pFirst = popOrZero(rNodeStack);
     pSNode->SetSubNodes(pFirst,pOper,pSecond);
-    rNodeStack.push_front(pSNode);
+    rNodeStack.push_front(std::move(pSNode));
 }
 
 void SmXMLRootContext_Impl::EndElement()
@@ -2183,13 +2186,13 @@ void SmXMLRootContext_Impl::EndElement()
     SmToken aToken;
     aToken.cMathChar = MS_SQRT;  //Temporary: alert, based on StarSymbol font
     aToken.eType = TNROOT;
-    SmStructureNode *pSNode = new SmRootNode(aToken);
+    std::unique_ptr<SmStructureNode> pSNode(new SmRootNode(aToken));
     SmNode *pOper = new SmRootSymbolNode(aToken);
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
     SmNode *pIndex = popOrZero(rNodeStack);
     SmNode *pBase = popOrZero(rNodeStack);
     pSNode->SetSubNodes(pIndex,pOper,pBase);
-    rNodeStack.push_front(pSNode);
+    rNodeStack.push_front(std::move(pSNode));
 }
 
 void SmXMLSqrtContext_Impl::EndElement()
@@ -2205,11 +2208,11 @@ void SmXMLSqrtContext_Impl::EndElement()
     SmToken aToken;
     aToken.cMathChar = MS_SQRT;  //Temporary: alert, based on StarSymbol font
     aToken.eType = TSQRT;
-    SmStructureNode *pSNode = new SmRootNode(aToken);
+    std::unique_ptr<SmStructureNode> pSNode(new SmRootNode(aToken));
     SmNode *pOper = new SmRootSymbolNode(aToken);
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
     pSNode->SetSubNodes(0,pOper,popOrZero(rNodeStack));
-    rNodeStack.push_front(pSNode);
+    rNodeStack.push_front(std::move(pSNode));
 }
 
 void SmXMLRowContext_Impl::EndElement()
@@ -2224,7 +2227,8 @@ void SmXMLRowContext_Impl::EndElement()
         aRelationArray.resize(nSize);
         for (auto j=nSize;j > 0;j--)
         {
-            auto pNode = rNodeStack.pop_front();
+            auto pNode = std::move(rNodeStack.front());
+            rNodeStack.pop_front();
             aRelationArray[j-1] = pNode.release();
         }
 
@@ -2279,13 +2283,13 @@ void SmXMLRowContext_Impl::EndElement()
             }
 
             SmToken aDummy;
-            SmStructureNode *pSNode = new SmBraceNode(aToken);
+            std::unique_ptr<SmStructureNode> pSNode(new SmBraceNode(aToken));
             SmStructureNode *pBody = new SmExpressionNode(aDummy);
             pBody->SetSubNodes(aRelationArray2);
 
             pSNode->SetSubNodes(pLeft,pBody,pRight);
             pSNode->SetScaleMode(SCALE_HEIGHT);
-            rNodeStack.push_front(pSNode);
+            rNodeStack.push_front(std::move(pSNode));
             return;
         }
     }
@@ -2300,9 +2304,9 @@ void SmXMLRowContext_Impl::EndElement()
     }
 
     SmToken aDummy;
-    SmStructureNode *pSNode = new SmExpressionNode(aDummy);
+    std::unique_ptr<SmStructureNode> pSNode(new SmExpressionNode(aDummy));
     pSNode->SetSubNodes(aRelationArray);
-    rNodeStack.push_front(pSNode);
+    rNodeStack.push_front(std::move(pSNode));
 }
 
 
@@ -2429,8 +2433,9 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
         SmNodeStack aReverseStack;
         for (size_t i = 0; i < nCount + 1; i++)
         {
-            auto pNode = rNodeStack.pop_front();
-            aReverseStack.push_front(pNode.release());
+            auto pNode = std::move(rNodeStack.front());
+            rNodeStack.pop_front();
+            aReverseStack.push_front(std::move(pNode));
         }
 
         SmSubSup eSub = bIsPrescript ? LSUB : RSUB;
@@ -2438,7 +2443,7 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
 
         for (size_t i = 0; i < nCount; i += 2)
         {
-            SmSubSupNode *pNode = new SmSubSupNode(aToken);
+            std::unique_ptr<SmSubSupNode> pNode(new SmSubSupNode(aToken));
 
             // initialize subnodes array
             SmNodeArray aSubNodes(1 + SUBSUP_NUM_ENTRIES);
@@ -2459,11 +2464,12 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
                 aSubNodes[eSup+1] = pScriptNode;
 
             pNode->SetSubNodes(aSubNodes);
-            aReverseStack.push_front(pNode);
+            aReverseStack.push_front(std::move(pNode));
         }
         assert(!aReverseStack.empty());
-        auto pNode = aReverseStack.pop_front();
-        rNodeStack.push_front(pNode.release());
+        auto pNode = std::move(aReverseStack.front());
+        aReverseStack.pop_front();
+        rNodeStack.push_front(std::move(pNode));
     }
     else
     {
@@ -2489,8 +2495,8 @@ void SmXMLTableContext_Impl::EndElement()
     SmStructureNode *pArray;
     for (auto i=nRows;i > 0;i--)
     {
-        auto pNode = rNodeStack.pop_front();
-        pArray = static_cast<SmStructureNode *>(pNode.release());
+        pArray = static_cast<SmStructureNode *>(rNodeStack.front().release());
+        rNodeStack.pop_front();
         if (pArray->GetNumSubNodes() == 0)
         {
             //This is a little tricky, it is possible that there was
@@ -2511,14 +2517,14 @@ void SmXMLTableContext_Impl::EndElement()
 
         if (pArray->GetNumSubNodes() > nCols)
             nCols = pArray->GetNumSubNodes();
-        aReverseStack.push_front(pArray);
+        aReverseStack.push_front(std::unique_ptr<SmStructureNode>(pArray));
     }
     aExpressionArray.resize(nCols*nRows);
     size_t j=0;
     while ( !aReverseStack.empty() )
     {
-        auto pNode = aReverseStack.pop_front();
-        pArray = static_cast<SmStructureNode *>(pNode.release());
+        pArray = static_cast<SmStructureNode *>(aReverseStack.front().release());
+        aReverseStack.pop_front();
         for (sal_uInt16 i=0;i<pArray->GetNumSubNodes();i++)
             aExpressionArray[j++] = pArray->GetSubNode(i);
     }
@@ -2527,10 +2533,10 @@ void SmXMLTableContext_Impl::EndElement()
     aToken.cMathChar = '\0';
     aToken.nGroup = TRGROUP;
     aToken.eType = TMATRIX;
-    SmMatrixNode *pSNode = new SmMatrixNode(aToken);
+    std::unique_ptr<SmMatrixNode> pSNode(new SmMatrixNode(aToken));
     pSNode->SetSubNodes(aExpressionArray);
     pSNode->SetRowCol(static_cast<sal_uInt16>(nRows),nCols);
-    rNodeStack.push_front(pSNode);
+    rNodeStack.push_front(std::move(pSNode));
 }
 
 SvXMLImportContext *SmXMLTableRowContext_Impl::CreateChildContext(
@@ -2630,12 +2636,13 @@ void SmXMLActionContext_Impl::EndElement()
     {
         rNodeStack.pop_front();
     }
-    auto pSelected = rNodeStack.pop_front();
+    auto pSelected = std::move(rNodeStack.front());
+    rNodeStack.pop_front();
     for (auto i=rNodeStack.size()-nElementCount; i > 0; i--)
     {
         rNodeStack.pop_front();
     }
-    rNodeStack.push_front(pSelected.release());
+    rNodeStack.push_front(std::move(pSelected));
 }
 
 SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix,
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index e2ae2e2..d59fed9 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -23,6 +23,7 @@
 #include <editeng/unolingu.hxx>
 #include <unotools/syslocale.hxx>
 #include <sal/macros.h>
+#include <o3tl/make_unique.hxx>
 #include <vcl/settings.hxx>
 #include "parse.hxx"
 #include "starmath.hrc"
@@ -978,13 +979,14 @@ void SmParser::DoTable()
 
     for (size_t i = 0; i < n; i++)
     {
-        auto pNode = m_aNodeStack.pop_front();
+        auto pNode = std::move(m_aNodeStack.front());
+        m_aNodeStack.pop_front();
         LineArray[n - (i + 1)] = pNode.release();
     }
 
-    SmStructureNode *pSNode = new SmTableNode(m_aCurToken);
+    std::unique_ptr<SmStructureNode> pSNode(new SmTableNode(m_aCurToken));
     pSNode->SetSubNodes(LineArray);
-    m_aNodeStack.push_front(pSNode);
+    m_aNodeStack.push_front(std::move(pSNode));
 }
 
 void SmParser::DoAlign()
@@ -1012,7 +1014,7 @@ void SmParser::DoAlign()
     if (pSNode)
     {
         pSNode->SetSubNode(0, popOrZero(m_aNodeStack));
-        m_aNodeStack.push_front(pSNode);
+        m_aNodeStack.push_front(std::unique_ptr<SmStructureNode>(pSNode));
     }
 }
 
@@ -1045,9 +1047,9 @@ void SmParser::DoLine()
         ExpressionArray.push_back(new SmExpressionNode(aTok));
     }
 
-    SmStructureNode *pSNode = new SmLineNode(m_aCurToken);
+    std::unique_ptr<SmStructureNode> pSNode(new SmLineNode(m_aCurToken));
     pSNode->SetSubNodes(ExpressionArray);
-    m_aNodeStack.push_front(pSNode);
+    m_aNodeStack.push_front(std::move(pSNode));
 }
 
 void SmParser::DoExpression()
@@ -1055,11 +1057,16 @@ void SmParser::DoExpression()
     bool bUseExtraSpaces = true;
     if (!m_aNodeStack.empty())
     {
-        auto pNode = m_aNodeStack.pop_front();
+        auto pNode = std::move(m_aNodeStack.front());
+        m_aNodeStack.pop_front();
         if (pNode->GetToken().eType == TNOSPACE)
             bUseExtraSpaces = false;
         else
-            m_aNodeStack.push_front(pNode.release());  // push the node from above again (now to be used as argument to this current 'nospace' node)
+        {
+            // push the node from above again (now to be used as argument
+            // to this current 'nospace' node)
+            m_aNodeStack.push_front(std::move(pNode));
+        }
     }
 
     SmNodeArray  RelationArray;
@@ -1075,15 +1082,15 @@ void SmParser::DoExpression()
 
     if (RelationArray.size() > 1)
     {
-        SmExpressionNode *pSNode = new SmExpressionNode(m_aCurToken);
+        std::unique_ptr<SmExpressionNode> pSNode(new SmExpressionNode(m_aCurToken));
         pSNode->SetSubNodes(RelationArray);
         pSNode->SetUseExtraSpaces(bUseExtraSpaces);
-        m_aNodeStack.push_front(pSNode);
+        m_aNodeStack.push_front(std::move(pSNode));
     }
     else
     {
         // This expression has only one node so just push this node.
-        m_aNodeStack.push_front(RelationArray[0]);
+        m_aNodeStack.push_front(std::unique_ptr<SmNode>(RelationArray[0]));
     }
 }
 
@@ -1092,7 +1099,7 @@ void SmParser::DoRelation()
     DoSum();
     while (TokenInGroup(TGRELATION))
     {
-        SmStructureNode *pSNode  = new SmBinHorNode(m_aCurToken);
+        std::unique_ptr<SmStructureNode> pSNode(new SmBinHorNode(m_aCurToken));
         SmNode *pFirst = popOrZero(m_aNodeStack);
 
         DoOpSubSup();
@@ -1101,7 +1108,7 @@ void SmParser::DoRelation()
         DoSum();
 
         pSNode->SetSubNodes(pFirst, pSecond, popOrZero(m_aNodeStack));
-        m_aNodeStack.push_front(pSNode);
+        m_aNodeStack.push_front(std::move(pSNode));
     }
 }
 
@@ -1110,7 +1117,7 @@ void SmParser::DoSum()
     DoProduct();
     while (TokenInGroup(TGSUM))
     {
-        SmStructureNode *pSNode  = new SmBinHorNode(m_aCurToken);
+        std::unique_ptr<SmStructureNode> pSNode(new SmBinHorNode(m_aCurToken));
         SmNode *pFirst = popOrZero(m_aNodeStack);
 
         DoOpSubSup();
@@ -1119,7 +1126,7 @@ void SmParser::DoSum()
         DoProduct();
 
         pSNode->SetSubNodes(pFirst, pSecond, popOrZero(m_aNodeStack));
-        m_aNodeStack.push_front(pSNode);
+        m_aNodeStack.push_front(std::move(pSNode));
     }
 }
 
@@ -1195,7 +1202,7 @@ void SmParser::DoProduct()
         {
             pSNode->SetSubNodes(pFirst, pOper, popOrZero(m_aNodeStack));
         }
-        m_aNodeStack.push_front(pSNode);
+        m_aNodeStack.push_front(std::unique_ptr<SmStructureNode>(pSNode));
     }
 }
 
@@ -1208,7 +1215,7 @@ void SmParser::DoSubSup(sal_uLong nActiveGroup)
         // already finish
         return;
 
-    SmSubSupNode *pNode = new SmSubSupNode(m_aCurToken);
+    std::unique_ptr<SmSubSupNode> pNode(new SmSubSupNode(m_aCurToken));
     //! Of course 'm_aCurToken' is just the first sub-/supscript token.
     //! It should be of no further interest. The positions of the
     //! sub-/supscripts will be identified by the corresponding subnodes
@@ -1264,13 +1271,13 @@ void SmParser::DoSubSup(sal_uLong nActiveGroup)
     }
 
     pNode->SetSubNodes(aSubNodes);
-    m_aNodeStack.push_front(pNode);
+    m_aNodeStack.push_front(std::move(pNode));
 }
 
 void SmParser::DoOpSubSup()
 {
     // push operator symbol
-    m_aNodeStack.push_front(new SmMathSymbolNode(m_aCurToken));
+    m_aNodeStack.push_front(o3tl::make_unique<SmMathSymbolNode>(m_aCurToken));
     // skip operator token
     NextToken();
     // get sub- supscripts if any
@@ -1289,7 +1296,7 @@ void SmParser::DoPower()
 void SmParser::DoBlank()
 {
     OSL_ENSURE(TokenInGroup(TGBLANK), "Sm : wrong token");
-    SmBlankNode *pBlankNode = new SmBlankNode(m_aCurToken);
+    std::unique_ptr<SmBlankNode> pBlankNode(new SmBlankNode(m_aCurToken));
 
     while (TokenInGroup(TGBLANK))
     {
@@ -1304,7 +1311,7 @@ void SmParser::DoBlank()
         pBlankNode->Clear();
     }
 
-    m_aNodeStack.push_front(pBlankNode);
+    m_aNodeStack.push_front(std::move(pBlankNode));
 }
 
 void SmParser::DoTerm(bool bGroupNumberIdent)
@@ -1321,7 +1328,7 @@ void SmParser::DoTerm(bool bGroupNumberIdent)
             bool bNoSpace = m_aCurToken.eType == TNOSPACE;
             if (bNoSpace)   // push 'no space' node and continue to parse expression
             {
-                m_aNodeStack.push_front(new SmExpressionNode(m_aCurToken));
+                m_aNodeStack.push_front(o3tl::make_unique<SmExpressionNode>(m_aCurToken));
                 NextToken();
             }
             if (m_aCurToken.eType != TLGROUP)
@@ -1338,9 +1345,9 @@ void SmParser::DoTerm(bool bGroupNumberIdent)
                 {
                     if (bNoSpace)   // get rid of the 'no space' node pushed above
                         m_aNodeStack.pop_front();
-                    SmStructureNode *pSNode = new SmExpressionNode(m_aCurToken);
+                    std::unique_ptr<SmStructureNode> pSNode(new SmExpressionNode(m_aCurToken));
                     pSNode->SetSubNodes(NULL, NULL);
-                    m_aNodeStack.push_front(pSNode);
+                    m_aNodeStack.push_front(std::move(pSNode));
 
                     NextToken();
                 }
@@ -1366,17 +1373,17 @@ void SmParser::DoTerm(bool bGroupNumberIdent)
             break;
 
         case TTEXT :
-            m_aNodeStack.push_front(new SmTextNode(m_aCurToken, FNT_TEXT));
+            m_aNodeStack.push_front(o3tl::make_unique<SmTextNode>(m_aCurToken, FNT_TEXT));
             NextToken();
             break;
         case TCHARACTER :
-            m_aNodeStack.push_front(new SmTextNode(m_aCurToken, FNT_VARIABLE));
+            m_aNodeStack.push_front(o3tl::make_unique<SmTextNode>(m_aCurToken, FNT_VARIABLE));
             NextToken();
             break;
         case TIDENT :
         case TNUMBER :
         {
-            m_aNodeStack.push_front(new SmTextNode(m_aCurToken,
+            m_aNodeStack.push_front(o3tl::make_unique<SmTextNode>(m_aCurToken,
                                              m_aCurToken.eType == TNUMBER ?
                                              FNT_NUMBER :
                                              FNT_VARIABLE));
@@ -1413,7 +1420,7 @@ void SmParser::DoTerm(bool bGroupNumberIdent)
                         moveToNextToken = false;
                         break;
                     }
-                    m_aNodeStack.push_front(new SmTextNode(m_aCurToken,
+                    m_aNodeStack.push_front(o3tl::make_unique<SmTextNode>(m_aCurToken,
                                                      m_aCurToken.eType ==
                                                      TNUMBER ?
                                                      FNT_NUMBER :
@@ -1432,9 +1439,9 @@ void SmParser::DoTerm(bool bGroupNumberIdent)
                         nodeArray[nTokens-1] = popOrZero(m_aNodeStack);
                         nTokens--;
                     }
-                    SmExpressionNode* pNode = new SmExpressionNode(SmToken());
+                    std::unique_ptr<SmExpressionNode> pNode(new SmExpressionNode(SmToken()));
                     pNode->SetSubNodes(nodeArray);
-                    m_aNodeStack.push_front(pNode);
+                    m_aNodeStack.push_front(std::move(pNode));
                 }
             }
             break;
@@ -1459,7 +1466,7 @@ void SmParser::DoTerm(bool bGroupNumberIdent)
         case TDOTSLOW :
         case TDOTSUP :
         case TDOTSVERT :
-            m_aNodeStack.push_front(new SmMathSymbolNode(m_aCurToken));
+            m_aNodeStack.push_front(o3tl::make_unique<SmMathSymbolNode>(m_aCurToken));
             NextToken();
             break;
 
@@ -1477,12 +1484,12 @@ void SmParser::DoTerm(bool bGroupNumberIdent)
         case TWP :
         case TEMPTYSET :
         case TINFINITY :
-            m_aNodeStack.push_front(new SmMathIdentifierNode(m_aCurToken));
+            m_aNodeStack.push_front(o3tl::make_unique<SmMathIdentifierNode>(m_aCurToken));
             NextToken();
             break;
 
         case TPLACE:
-            m_aNodeStack.push_front(new SmPlaceNode(m_aCurToken));
+            m_aNodeStack.push_front(o3tl::make_unique<SmPlaceNode>(m_aCurToken));
             NextToken();
             break;
 
@@ -1546,7 +1553,7 @@ void SmParser::DoTerm(bool bGroupNumberIdent)
                     pNode->SetSubNodes(0, pFirstNode);
                     pFirstNode = pNode;
                 }
-                m_aNodeStack.push_front(pFirstNode);
+                m_aNodeStack.push_front(std::unique_ptr<SmNode>(pFirstNode));
             }
             else if (TokenInGroup(TGFUNCTION))
             {
@@ -1588,8 +1595,8 @@ void SmParser::DoEscape()
             Error(PE_UNEXPECTED_TOKEN);
     }
 
-    SmNode *pNode = new SmMathSymbolNode(m_aCurToken);
-    m_aNodeStack.push_front(pNode);
+    std::unique_ptr<SmNode> pNode(new SmMathSymbolNode(m_aCurToken));
+    m_aNodeStack.push_front(std::move(pNode));
 
     NextToken();
 }
@@ -1597,7 +1604,8 @@ void SmParser::DoEscape()
 void SmParser::DoOperator()
 {
     if (TokenInGroup(TGOPER))
-    {   SmStructureNode *pSNode = new SmOperNode(m_aCurToken);
+    {
+        std::unique_ptr<SmStructureNode> pSNode(new SmOperNode(m_aCurToken));
 
         // put operator on top of stack
         DoOper();
@@ -1610,14 +1618,14 @@ void SmParser::DoOperator()
         DoPower();
 
         pSNode->SetSubNodes(pOperator, popOrZero(m_aNodeStack));
-        m_aNodeStack.push_front(pSNode);
+        m_aNodeStack.push_front(std::move(pSNode));
     }
 }
 
 void SmParser::DoOper()
 {
     SmTokenType  eType (m_aCurToken.eType);
-    SmNode      *pNode = NULL;
+    std::unique_ptr<SmNode> pNode;
 
     switch (eType)
     {
@@ -1630,7 +1638,7 @@ void SmParser::DoOper()
         case TLINT :
         case TLLINT :
         case TLLLINT :
-            pNode = new SmMathSymbolNode(m_aCurToken);
+            pNode.reset(new SmMathSymbolNode(m_aCurToken));
             break;
 
         case TLIM :
@@ -1648,7 +1656,7 @@ void SmParser::DoOper()
                 }
                 if( pLim )
                     m_aCurToken.aText = OUString::createFromAscii(pLim);
-                pNode = new SmTextNode(m_aCurToken, FNT_TEXT);
+                pNode.reset(new SmTextNode(m_aCurToken, FNT_TEXT));
             }
             break;
 
@@ -1656,13 +1664,13 @@ void SmParser::DoOper()
             NextToken();
 
             OSL_ENSURE(m_aCurToken.eType == TSPECIAL, "Sm: wrong token");
-            pNode = new SmGlyphSpecialNode(m_aCurToken);
+            pNode.reset(new SmGlyphSpecialNode(m_aCurToken));
             break;
 
         default :
             assert(false && "unknown case");
     }
-    m_aNodeStack.push_front(pNode);
+    m_aNodeStack.push_front(std::move(pNode));
 
     NextToken();
 }
@@ -1675,7 +1683,7 @@ void SmParser::DoUnOper()
     SmTokenType  eType      = m_aCurToken.eType;
     bool         bIsPostfix = eType == TFACT;
 
-    SmStructureNode *pSNode;
+    std::unique_ptr<SmStructureNode> pSNode;
     SmNode *pOper   = 0,
            *pExtra  = 0,
            *pArg;
@@ -1725,7 +1733,8 @@ void SmParser::DoUnOper()
     pArg = popOrZero(m_aNodeStack);
 
     if (eType == TABS)
-    {   pSNode = new SmBraceNode(aNodeToken);
+    {
+        pSNode.reset(new SmBraceNode(aNodeToken));
         pSNode->SetScaleMode(SCALE_HEIGHT);
 
         // build nodes for left & right lines
@@ -1742,18 +1751,20 @@ void SmParser::DoUnOper()
         pSNode->SetSubNodes(pLeft, pArg, pRight);
     }
     else if (eType == TSQRT  ||  eType == TNROOT)
-    {  pSNode = new SmRootNode(aNodeToken);
+    {
+        pSNode.reset(new SmRootNode(aNodeToken));
         pOper = new SmRootSymbolNode(aNodeToken);
         pSNode->SetSubNodes(pExtra, pOper, pArg);
     }
     else if(eType == TINTD)
-    {  pSNode = new SmDynIntegralNode(aNodeToken);
+    {
+        pSNode.reset(new SmDynIntegralNode(aNodeToken));
         pOper = new SmDynIntegralSymbolNode(aNodeToken);
         pSNode->SetSubNodes(pOper, pArg);
     }
     else
-    {   pSNode = new SmUnHorNode(aNodeToken);
-
+    {
+        pSNode.reset(new SmUnHorNode(aNodeToken));
         if (bIsPostfix)
             pSNode->SetSubNodes(pArg, pOper);
         else
@@ -1761,14 +1772,14 @@ void SmParser::DoUnOper()
             pSNode->SetSubNodes(pOper, pArg);
     }
 
-    m_aNodeStack.push_front(pSNode);
+    m_aNodeStack.push_front(std::move(pSNode));
 }
 
 void SmParser::DoAttribut()
 {
     OSL_ENSURE(TokenInGroup(TGATTRIBUT), "Sm: wrong token group");
 
-    SmStructureNode *pSNode = new SmAttributNode(m_aCurToken);
+    std::unique_ptr<SmStructureNode> pSNode(new SmAttributNode(m_aCurToken));
     SmNode      *pAttr;
     SmScaleMode  eScaleMode = SCALE_NONE;
 
@@ -1796,7 +1807,7 @@ void SmParser::DoAttribut()
 
     pSNode->SetSubNodes(pAttr, 0);
     pSNode->SetScaleMode(eScaleMode);
-    m_aNodeStack.push_front(pSNode);
+    m_aNodeStack.push_front(std::move(pSNode));
 }
 
 
@@ -1811,7 +1822,7 @@ void SmParser::DoFontAttribut()
         case TBOLD :
         case TNBOLD :
         case TPHANTOM :
-            m_aNodeStack.push_front(new SmFontNode(m_aCurToken));
+            m_aNodeStack.push_front(o3tl::make_unique<SmFontNode>(m_aCurToken));
             NextToken();
             break;
 
@@ -1849,7 +1860,7 @@ void SmParser::DoColor()
             Error(PE_COLOR_EXPECTED);
     } while (m_aCurToken.eType == TCOLOR);
 
-    m_aNodeStack.push_front(new SmFontNode(aToken));
+    m_aNodeStack.push_front(o3tl::make_unique<SmFontNode>(aToken));
 }
 
 void SmParser::DoFont()
@@ -1869,7 +1880,7 @@ void SmParser::DoFont()
             Error(PE_FONT_EXPECTED);
     } while (m_aCurToken.eType == TFONT);
 
-    m_aNodeStack.push_front(new SmFontNode(aToken));
+    m_aNodeStack.push_front(o3tl::make_unique<SmFontNode>(aToken));
 }
 
 
@@ -1900,7 +1911,7 @@ void SmParser::DoFontSize()
     OSL_ENSURE(m_aCurToken.eType == TSIZE, "Sm : Ooops...");
 
     FontSizeType   Type;
-    SmFontNode *pFontNode = new SmFontNode(m_aCurToken);
+    std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(m_aCurToken));
 
     NextToken();
 
@@ -1913,7 +1924,6 @@ void SmParser::DoFontSize()
         case TDIVIDEBY: Type = FontSizeType::DIVIDE;   break;
 
         default:
-            delete pFontNode;
             Error(PE_SIZE_EXPECTED);
             return;
     }
@@ -1923,7 +1933,6 @@ void SmParser::DoFontSize()
         NextToken();
         if (m_aCurToken.eType != TNUMBER)
         {
-            delete pFontNode;
             Error(PE_SIZE_EXPECTED);
             return;
         }
@@ -1960,7 +1969,7 @@ void SmParser::DoFontSize()
     NextToken();
 
     pFontNode->SetSizeParameter(aValue, Type);
-    m_aNodeStack.push_front(pFontNode);
+    m_aNodeStack.push_front(std::move(pFontNode));
 }
 
 void SmParser::DoBrace()
@@ -1968,7 +1977,7 @@ void SmParser::DoBrace()
     OSL_ENSURE(m_aCurToken.eType == TLEFT  ||  TokenInGroup(TGLBRACES),
         "Sm: kein Klammer Ausdruck");
 
-    SmStructureNode *pSNode  = new SmBraceNode(m_aCurToken);
+    std::unique_ptr<SmStructureNode> pSNode(new SmBraceNode(m_aCurToken));
     SmNode *pBody   = 0,
            *pLeft   = 0,
            *pRight  = 0;
@@ -2049,10 +2058,11 @@ void SmParser::DoBrace()
         OSL_ENSURE(pRight, "Sm: NULL pointer");
         pSNode->SetSubNodes(pLeft, pBody, pRight);
         pSNode->SetScaleMode(eScaleMode);
-        m_aNodeStack.push_front(pSNode);
+        m_aNodeStack.push_front(std::move(pSNode));
     }
     else
-    {   delete pSNode;
+    {
+        pSNode.reset();
         delete pBody;
         delete pLeft;
         delete pRight;
@@ -2063,7 +2073,7 @@ void SmParser::DoBrace()
 
 void SmParser::DoBracebody(bool bIsLeftRight)
 {
-    SmStructureNode *pBody = new SmBracebodyNode(m_aCurToken);
+    std::unique_ptr<SmStructureNode> pBody(new SmBracebodyNode(m_aCurToken));
     SmNodeArray      aNodes;
     sal_uInt16           nNum = 0;
 
@@ -2074,7 +2084,7 @@ void SmParser::DoBracebody(bool bIsLeftRight)
         {
             if (m_aCurToken.eType == TMLINE)
             {
-                m_aNodeStack.push_front(new SmMathSymbolNode(m_aCurToken));
+                m_aNodeStack.push_front(o3tl::make_unique<SmMathSymbolNode>(m_aCurToken));
                 NextToken();
                 nNum++;
             }
@@ -2094,7 +2104,7 @@ void SmParser::DoBracebody(bool bIsLeftRight)
         {
             if (m_aCurToken.eType == TMLINE)
             {
-                m_aNodeStack.push_front(new SmMathSymbolNode(m_aCurToken));
+                m_aNodeStack.push_front(o3tl::make_unique<SmMathSymbolNode>(m_aCurToken));
                 NextToken();
                 nNum++;
             }
@@ -2118,7 +2128,7 @@ void SmParser::DoBracebody(bool bIsLeftRight)
 
     pBody->SetSubNodes(aNodes);
     pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE);
-    m_aNodeStack.push_front(pBody);
+    m_aNodeStack.push_front(std::move(pBody));
 }
 
 void SmParser::DoFunction()
@@ -2148,7 +2158,7 @@ void SmParser::DoFunction()
         case TLN :
         case TLOG :
         case TEXP :
-            m_aNodeStack.push_front(new SmTextNode(m_aCurToken, FNT_FUNCTION));
+            m_aNodeStack.push_front(o3tl::make_unique<SmTextNode>(m_aCurToken, FNT_FUNCTION));
             NextToken();
             break;
 
@@ -2160,7 +2170,7 @@ void SmParser::DoFunction()
 void SmParser::DoBinom()
 {
     SmNodeArray  ExpressionArray;
-    SmStructureNode *pSNode = new SmTableNode(m_aCurToken);
+    std::unique_ptr<SmStructureNode> pSNode(new SmTableNode(m_aCurToken));
 
     NextToken();
 
@@ -2175,7 +2185,7 @@ void SmParser::DoBinom()
     }
 
     pSNode->SetSubNodes(ExpressionArray);
-    m_aNodeStack.push_front(pSNode);
+    m_aNodeStack.push_front(std::move(pSNode));
 }
 
 void SmParser::DoStack()
@@ -2210,9 +2220,9 @@ void SmParser::DoStack()
         //it's used in SmNodeToTextVisitor
         SmToken aTok = m_aCurToken;
         aTok.eType = TSTACK;
-        SmStructureNode *pSNode = new SmTableNode(aTok);
+        std::unique_ptr<SmStructureNode> pSNode(new SmTableNode(aTok));
         pSNode->SetSubNodes(ExpressionArray);
-        m_aNodeStack.push_front(pSNode);
+        m_aNodeStack.push_front(std::move(pSNode));
     }
     else
         Error(PE_LGROUP_EXPECTED);
@@ -2271,10 +2281,10 @@ void SmParser::DoMatrix()
 
         NextToken();
 
-        SmMatrixNode *pMNode = new SmMatrixNode(m_aCurToken);
+        std::unique_ptr<SmMatrixNode> pMNode(new SmMatrixNode(m_aCurToken));
         pMNode->SetSubNodes(ExpressionArray);
         pMNode->SetRowCol(r, c);
-        m_aNodeStack.push_front(pMNode);
+        m_aNodeStack.push_front(std::move(pMNode));
     }
     else
         Error(PE_LGROUP_EXPECTED);
@@ -2317,13 +2327,13 @@ void SmParser::DoSpecial()
     if (!aSymbolName.isEmpty())
         AddToUsedSymbols( aSymbolName );
 
-    m_aNodeStack.push_front(new SmSpecialNode(m_aCurToken));
+    m_aNodeStack.push_front(o3tl::make_unique<SmSpecialNode>(m_aCurToken));
     NextToken();
 }
 
 void SmParser::DoGlyphSpecial()
 {
-    m_aNodeStack.push_front(new SmGlyphSpecialNode(m_aCurToken));
+    m_aNodeStack.push_front(o3tl::make_unique<SmGlyphSpecialNode>(m_aCurToken));
     NextToken();
 }
 
@@ -2336,7 +2346,7 @@ void SmParser::Error(SmParseError eError)
     //! put a structure node on the stack (instead of the error node itself)
     //! because sometimes such a node is expected in order to attach some
     //! subnodes
-    m_aNodeStack.push_front(pSNode);
+    m_aNodeStack.push_front(std::unique_ptr<SmStructureNode>(pSNode));
 
     AddError(eError, pSNode);
 
commit e126cf6c66635c34b61952262d5aa6d745c29198
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Nov 9 14:01:11 2015 +0100

    sc: add missing includes to prevloc.hxx
    
    Change-Id: I7ee876d52a0a04a162ee7acd0ec03e73557abe89

diff --git a/sc/source/ui/inc/prevloc.hxx b/sc/source/ui/inc/prevloc.hxx
index 95b5853..2e22cbf 100644
--- a/sc/source/ui/inc/prevloc.hxx
+++ b/sc/source/ui/inc/prevloc.hxx
@@ -21,10 +21,13 @@
 #define INCLUDED_SC_SOURCE_UI_INC_PREVLOC_HXX
 
 #include <sal/types.h>
-#include <vcl/mapmod.hxx>
 
 #include "address.hxx"
 
+#include <vcl/mapmod.hxx>
+#include <vcl/vclptr.hxx>
+#include <tools/gen.hxx>
+
 #include <memory>
 #include <list>
 
diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx
index 371e456..8dd0621 100644
--- a/sc/source/ui/view/prevloc.cxx
+++ b/sc/source/ui/view/prevloc.cxx
@@ -17,11 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <vcl/outdev.hxx>
-
 #include "prevloc.hxx"
 #include "document.hxx"
 
+#include <vcl/outdev.hxx>
+
 #include <o3tl/make_unique.hxx>
 
 enum ScPreviewLocationType
commit 5abe5c141fc8ef23a1968f43bd0928b65101851f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Nov 9 13:36:43 2015 +0100

    sc: replace boost::ptr_list with std::list<std::unique_ptr>
    
    Change-Id: Ic1202dc49789d7f392fc7c0065e071e114687717

diff --git a/sc/source/ui/inc/prevloc.hxx b/sc/source/ui/inc/prevloc.hxx
index 3f59e33..95b5853 100644
--- a/sc/source/ui/inc/prevloc.hxx
+++ b/sc/source/ui/inc/prevloc.hxx
@@ -20,13 +20,14 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_PREVLOC_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_PREVLOC_HXX
 
-#include <boost/ptr_container/ptr_list.hpp>
-
 #include <sal/types.h>
 #include <vcl/mapmod.hxx>
 
 #include "address.hxx"
 
+#include <memory>
+#include <list>
+
 #define SC_PREVIEW_MAXRANGES    4
 #define SC_PREVIEW_RANGE_EDGE   0
 #define SC_PREVIEW_RANGE_REPCOL 1
@@ -82,6 +83,9 @@ public:
 
 class ScPreviewLocationData
 {
+public:
+    typedef std::list<std::unique_ptr<ScPreviewLocationEntry>> Entries_t;
+private:
     VclPtr<OutputDevice> pWindow;
     ScDocument* pDoc;
     MapMode     aCellMapMode;
@@ -90,7 +94,7 @@ class ScPreviewLocationData
         sal_uInt8       aDrawRangeId[SC_PREVIEW_MAXRANGES];
     sal_uInt16      nDrawRanges;
     SCTAB       nPrintTab;
-    boost::ptr_list<ScPreviewLocationEntry> aEntries;
+    Entries_t m_Entries;
 
     Rectangle   GetOffsetPixel( const ScAddress& rCellPos, const ScRange& rRange ) const;
 
diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx
index 7da573b..371e456 100644
--- a/sc/source/ui/view/prevloc.cxx
+++ b/sc/source/ui/view/prevloc.cxx
@@ -22,6 +22,8 @@
 #include "prevloc.hxx"
 #include "document.hxx"
 
+#include <o3tl/make_unique.hxx>
+
 enum ScPreviewLocationType
 {
     SC_PLOC_CELLRANGE,
@@ -170,7 +172,7 @@ void ScPreviewLocationData::SetPrintTab( SCTAB nNew )
 
 void ScPreviewLocationData::Clear()
 {
-    aEntries.clear();
+    m_Entries.clear();
 
     nDrawRanges = 0;
 }
@@ -179,7 +181,7 @@ void ScPreviewLocationData::AddCellRange( const Rectangle& rRect, const ScRange&
                                             const MapMode& rDrawMap )
 {
     Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
-    aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_CELLRANGE, aPixelRect, rRange, bRepCol, bRepRow ) );
+    m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_CELLRANGE, aPixelRect, rRange, bRepCol, bRepRow) );
 
     OSL_ENSURE( nDrawRanges < SC_PREVIEW_MAXRANGES, "too many ranges" );
 
@@ -213,7 +215,7 @@ void ScPreviewLocationData::AddColHeaders( const Rectangle& rRect, SCCOL nStartC
     ScRange aRange( nStartCol, 0, nTab, nEndCol, 0, nTab );
     Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
 
-    aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_COLHEADER, aPixelRect, aRange, bRepCol, false ) );
+    m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_COLHEADER, aPixelRect, aRange, bRepCol, false) );
 }
 
 void ScPreviewLocationData::AddRowHeaders( const Rectangle& rRect, SCROW nStartRow, SCROW nEndRow, bool bRepRow )
@@ -222,7 +224,7 @@ void ScPreviewLocationData::AddRowHeaders( const Rectangle& rRect, SCROW nStartR
     ScRange aRange( 0, nStartRow, nTab, 0, nEndRow, nTab );
     Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
 
-    aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_ROWHEADER, aPixelRect, aRange, false, bRepRow ) );
+    m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_ROWHEADER, aPixelRect, aRange, false, bRepRow) );
 }
 
 void ScPreviewLocationData::AddHeaderFooter( const Rectangle& rRect, bool bHeader, bool bLeft )
@@ -234,7 +236,7 @@ void ScPreviewLocationData::AddHeaderFooter( const Rectangle& rRect, bool bHeade
                 ( bLeft ? SC_PLOC_LEFTHEADER : SC_PLOC_RIGHTHEADER ) :
                 ( bLeft ? SC_PLOC_LEFTFOOTER : SC_PLOC_RIGHTFOOTER );
 
-    aEntries.push_front( new ScPreviewLocationEntry( eType, aPixelRect, aRange, false, false ) );
+    m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(eType, aPixelRect, aRange, false, false) );
 }
 
 void ScPreviewLocationData::AddNoteMark( const Rectangle& rRect, const ScAddress& rPos )
@@ -242,7 +244,7 @@ void ScPreviewLocationData::AddNoteMark( const Rectangle& rRect, const ScAddress
     ScRange aRange( rPos );
     Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
 
-    aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_NOTEMARK, aPixelRect, aRange, false, false ) );
+    m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_NOTEMARK, aPixelRect, aRange, false, false) );
 }
 
 void ScPreviewLocationData::AddNoteText( const Rectangle& rRect, const ScAddress& rPos )
@@ -250,7 +252,7 @@ void ScPreviewLocationData::AddNoteText( const Rectangle& rRect, const ScAddress
     ScRange aRange( rPos );
     Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
 
-    aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_NOTETEXT, aPixelRect, aRange, false, false ) );
+    m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_NOTETEXT, aPixelRect, aRange, false, false) );
 }
 
 void ScPreviewLocationData::GetDrawRange( sal_uInt16 nPos, Rectangle& rPixelRect, MapMode& rMapMode, sal_uInt8& rRangeId ) const
@@ -264,14 +266,14 @@ void ScPreviewLocationData::GetDrawRange( sal_uInt16 nPos, Rectangle& rPixelRect
     }
 }
 
-static ScPreviewLocationEntry* lcl_GetEntryByAddress( const boost::ptr_list<ScPreviewLocationEntry> &rEntries,
-                                               const ScAddress& rPos, ScPreviewLocationType eType )
+static ScPreviewLocationEntry* lcl_GetEntryByAddress(
+        ScPreviewLocationData::Entries_t const& rEntries,
+        const ScAddress& rPos, ScPreviewLocationType const eType)
 {
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = rEntries.begin(); it != rEntries.end(); ++it)
+    for (auto const& it : rEntries)
     {
         if ( it->eType == eType && it->aCellRange.In( rPos ) )
-            return const_cast<ScPreviewLocationEntry*>(&(*it));
+            return const_cast<ScPreviewLocationEntry*>(it.get());
     }
 
     return NULL;
@@ -308,7 +310,7 @@ Rectangle ScPreviewLocationData::GetOffsetPixel( const ScAddress& rCellPos, cons
 
 bool ScPreviewLocationData::GetCellPosition( const ScAddress& rCellPos, Rectangle& rCellRect ) const
 {
-    ScPreviewLocationEntry* pEntry = lcl_GetEntryByAddress( aEntries, rCellPos, SC_PLOC_CELLRANGE );
+    ScPreviewLocationEntry* pEntry = lcl_GetEntryByAddress( m_Entries, rCellPos, SC_PLOC_CELLRANGE );
     if ( pEntry )
     {
         Rectangle aOffsetRect = GetOffsetPixel( rCellPos, pEntry->aCellRange );
@@ -323,8 +325,7 @@ bool ScPreviewLocationData::GetCellPosition( const ScAddress& rCellPos, Rectangl
 
 bool ScPreviewLocationData::HasCellsInRange( const Rectangle& rVisiblePixel ) const
 {
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == SC_PLOC_CELLRANGE || it->eType == SC_PLOC_COLHEADER || it->eType == SC_PLOC_ROWHEADER )
             if ( it->aPixelRect.IsOver( rVisiblePixel ) )
@@ -336,8 +337,7 @@ bool ScPreviewLocationData::HasCellsInRange( const Rectangle& rVisiblePixel ) co
 
 bool ScPreviewLocationData::GetHeaderPosition( Rectangle& rRect ) const
 {
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == SC_PLOC_LEFTHEADER || it->eType == SC_PLOC_RIGHTHEADER )
         {
@@ -351,8 +351,7 @@ bool ScPreviewLocationData::GetHeaderPosition( Rectangle& rRect ) const
 
 bool ScPreviewLocationData::GetFooterPosition( Rectangle& rRect ) const
 {
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == SC_PLOC_LEFTFOOTER || it->eType == SC_PLOC_RIGHTFOOTER )
         {
@@ -366,8 +365,7 @@ bool ScPreviewLocationData::GetFooterPosition( Rectangle& rRect ) const
 
 bool ScPreviewLocationData::IsHeaderLeft() const
 {
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == SC_PLOC_LEFTHEADER )
             return true;
@@ -381,8 +379,7 @@ bool ScPreviewLocationData::IsHeaderLeft() const
 
 bool ScPreviewLocationData::IsFooterLeft() const
 {
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == SC_PLOC_LEFTFOOTER )
             return true;
@@ -399,8 +396,7 @@ long ScPreviewLocationData::GetNoteCountInRange( const Rectangle& rVisiblePixel,
     ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;
 
     sal_uLong nRet = 0;
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) )
             ++nRet;
@@ -415,8 +411,7 @@ bool ScPreviewLocationData::GetNoteInRange( const Rectangle& rVisiblePixel, long
     ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;
 
     sal_uLong nPos = 0;
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) )
         {
@@ -438,8 +433,7 @@ Rectangle ScPreviewLocationData::GetNoteInRangeOutputRect(const Rectangle& rVisi
     ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;
 
     sal_uLong nPos = 0;
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) )
         {
@@ -478,8 +472,7 @@ void ScPreviewLocationData::GetTableInfo( const Rectangle& rVisiblePixel, ScPrev
     Rectangle aHeaderRect, aRepeatRect, aMainRect;
     SCTAB nTab = 0;
 
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == SC_PLOC_CELLRANGE )
         {
@@ -714,8 +707,7 @@ Rectangle ScPreviewLocationData::GetCellOutputRect(const ScAddress& rCellPos) co
 
 bool ScPreviewLocationData::GetMainCellRange( ScRange& rRange, Rectangle& rPixRect ) const
 {
-    boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
-    for (it = aEntries.begin(); it != aEntries.end(); ++it)
+    for (auto const& it : m_Entries)
     {
         if ( it->eType == SC_PLOC_CELLRANGE && !it->bRepeatCol && !it->bRepeatRow )
         {
commit 1f0c3a16321ca0d63e09b733170b0375cf2d4ee3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Nov 9 13:19:03 2015 +0100

    sc: replace boost::ptr_list with std::list<std::unique_ptr>
    
    Change-Id: I6162cfaacf25db4d1261b67ba99e33c729be86cb

diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 85ba478..62d128b 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -2074,7 +2074,7 @@ ScXMLImport::ScXMLImport(
     pDataStreamAttrTokenMap(NULL),
     mpPostProcessData(NULL),
     aTables(*this),
-    pMyNamedExpressions(NULL),
+    m_pMyNamedExpressions(nullptr),
     pMyLabelRanges(NULL),
     pValidations(NULL),
     pDetectiveOpArray(NULL),
@@ -2223,7 +2223,7 @@ ScXMLImport::~ScXMLImport() throw()
 
     delete pSolarMutexGuard;
 
-    delete pMyNamedExpressions;
+    delete m_pMyNamedExpressions;
     delete pMyLabelRanges;
     delete pValidations;
     delete pDetectiveOpArray;
@@ -2411,7 +2411,7 @@ void ScXMLImport::AddNamedExpression(SCTAB nTab, ScMyNamedExpression* pNamedExp)
         itr = r.first;
     }
     ScMyNamedExpressions& r = *itr->second;
-    o3tl::ptr_container::push_back(r, std::move(p));
+    r.push_back(std::move(p));
 }
 
 ScXMLChangeTrackingImportHelper* ScXMLImport::GetChangeTrackingImportHelper()
@@ -3101,11 +3101,11 @@ public:
     RangeNameInserter(ScDocument* pDoc, ScRangeName& rRangeName, ScXMLImport& rXmlImport) :
         mpDoc(pDoc), mrRangeName(rRangeName), mrXmlImport(rXmlImport) {}
 
-    void operator() (const ScMyNamedExpression& r) const
+    void operator() (const std::unique_ptr<ScMyNamedExpression>& p) const
     {
         using namespace formula;
 
-        const OUString& aType = r.sRangeType;
+        const OUString& aType = p->sRangeType;
         sal_uInt32 nUnoType = ScXMLImport::GetRangeType(aType);
 
         sal_uInt16 nNewType = RT_NAME;
@@ -3120,16 +3120,16 @@ public:
             ScAddress aPos;
             sal_Int32 nOffset = 0;
             bool bSuccess = ScRangeStringConverter::GetAddressFromString(
-                aPos, r.sBaseCellAddress, mpDoc, FormulaGrammar::CONV_OOO, nOffset);
+                aPos, p->sBaseCellAddress, mpDoc, FormulaGrammar::CONV_OOO, nOffset);
 
             if (bSuccess)
             {
-                OUString aContent = r.sContent;
-                if (!r.bIsExpression)
+                OUString aContent = p->sContent;
+                if (!p->bIsExpression)
                     ScXMLConverter::ParseFormula(aContent, false);
 
                 ScRangeData* pData = new ScRangeData(
-                    mpDoc, r.sName, aContent, aPos, nNewType, r.eGrammar);
+                    mpDoc, p->sName, aContent, aPos, nNewType, p->eGrammar);
                 mrRangeName.insert(pData);
             }
         }
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 7ff29c7..4b562b8 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -45,7 +45,7 @@
 #include <memory>
 #include <unordered_map>
 #include <vector>
-#include <boost/ptr_container/ptr_list.hpp>
+#include <list>
 #include <boost/ptr_container/ptr_map.hpp>
 #include <boost/noncopyable.hpp>
 
@@ -782,7 +782,7 @@ struct ScMyNamedExpression
     bool               bIsExpression;
 };
 
-typedef ::boost::ptr_list<ScMyNamedExpression> ScMyNamedExpressions;
+typedef ::std::list<std::unique_ptr<ScMyNamedExpression>> ScMyNamedExpressions;
 
 struct ScMyLabelRange
 {
@@ -938,7 +938,7 @@ class ScXMLImport: public SvXMLImport, boost::noncopyable
 
     ScMyTables              aTables;
 
-    ScMyNamedExpressions*   pMyNamedExpressions;
+    ScMyNamedExpressions*   m_pMyNamedExpressions;
     SheetNamedExpMap maSheetNamedExpressions;
 
     ScMyLabelRanges*        pMyLabelRanges;
@@ -1112,12 +1112,12 @@ public:
 
     void AddNamedExpression(ScMyNamedExpression* pMyNamedExpression)
     {
-        if (!pMyNamedExpressions)
-            pMyNamedExpressions = new ScMyNamedExpressions();
-        pMyNamedExpressions->push_back(pMyNamedExpression);
+        if (!m_pMyNamedExpressions)
+            m_pMyNamedExpressions = new ScMyNamedExpressions();
+        m_pMyNamedExpressions->push_back(std::unique_ptr<ScMyNamedExpression>(pMyNamedExpression));
     }
 
-    ScMyNamedExpressions* GetNamedExpressions() { return pMyNamedExpressions; }
+    ScMyNamedExpressions* GetNamedExpressions() { return m_pMyNamedExpressions; }
 
     void AddNamedExpression(SCTAB nTab, ScMyNamedExpression* pNamedExp);
 


More information about the Libreoffice-commits mailing list