---
 starmath/inc/parse.hxx           |    3 +-
 starmath/source/math_pch.cxx     |    1 -
 starmath/source/mathmlimport.cxx |  223
++++++++++++++++++++++----------------
 starmath/source/mathmlimport.hxx |    8 ++-
 starmath/source/parse.cxx        |  222
++++++++++++++++++++++++--------------
 5 files changed, 279 insertions(+), 178 deletions(-)


diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index b8834be..5e4ce31 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -30,7 +30,6 @@
 
 
 #include <vcl/svapp.hxx>
-#include <tools/stack.hxx>
 #include <tools/string.hxx>
 
 #include <set>
@@ -167,7 +166,7 @@ struct SmErrorDesc
 };
 
 
-DECLARE_STACK(SmNodeStack,  SmNode *)
+typedef ::std::stack< SmNode* > SmNodeStack;
 typedef ::std::vector< SmErrorDesc* > SmErrDescList;
 
 /**************************************************************************/
diff --git a/starmath/source/math_pch.cxx b/starmath/source/math_pch.cxx
index 1119a19..b9e2270 100644
--- a/starmath/source/math_pch.cxx
+++ b/starmath/source/math_pch.cxx
@@ -141,7 +141,6 @@
 #include <tools/datetime.hxx>
 #include <tools/wldcrd.hxx>
 #include <parse.hxx>
-#include <tools/stack.hxx>
 #include <types.hxx>
 #include <config.hxx>
 #include <svtools/confitem.hxx>
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index b4d57bb..f42b420 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -747,8 +747,9 @@ void SmXMLContext_Helper::ApplyAttrs()
                 aToken.eType = TNBOLD;
             SmStructureNode *pFontNode = static_cast<SmStructureNode *>
                 (new SmFontNode(aToken));
-            pFontNode->SetSubNodes(0,rNodeStack.Pop());
-            rNodeStack.Push(pFontNode);
+            pFontNode->SetSubNodes(0,rNodeStack.top());
+            rNodeStack.pop();
+            rNodeStack.push(pFontNode);
         }
         if (nIsItalic != -1)
         {
@@ -758,8 +759,9 @@ void SmXMLContext_Helper::ApplyAttrs()
                 aToken.eType = TNITALIC;
             SmStructureNode *pFontNode = static_cast<SmStructureNode *>
                 (new SmFontNode(aToken));
-            pFontNode->SetSubNodes(0,rNodeStack.Pop());
-            rNodeStack.Push(pFontNode);
+            pFontNode->SetSubNodes(0,rNodeStack.top());
+            rNodeStack.pop();
+            rNodeStack.push(pFontNode);
         }
         if (nFontSize != 0.0)
         {
@@ -779,8 +781,9 @@ void SmXMLContext_Helper::ApplyAttrs()
             else
                 pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT);
 
-            pFontNode->SetSubNodes(0,rNodeStack.Pop());
-            rNodeStack.Push(pFontNode);
+            pFontNode->SetSubNodes(0,rNodeStack.top());
+            rNodeStack.pop();
+            rNodeStack.push(pFontNode);
         }
         if (sFontFamily.getLength())
         {
@@ -798,8 +801,9 @@ void SmXMLContext_Helper::ApplyAttrs()
 
             aToken.aText = sFontFamily;
             SmFontNode *pFontNode = new SmFontNode(aToken);
-            pFontNode->SetSubNodes(0,rNodeStack.Pop());
-            rNodeStack.Push(pFontNode);
+            pFontNode->SetSubNodes(0,rNodeStack.top());
+            rNodeStack.pop();
+            rNodeStack.push(pFontNode);
         }
         if (sColor.getLength())
         {
@@ -812,8 +816,9 @@ void SmXMLContext_Helper::ApplyAttrs()
             if (aToken.eType != -1)
             {
                 SmFontNode *pFontNode = new SmFontNode(aToken);
-                pFontNode->SetSubNodes(0,rNodeStack.Pop());
-                rNodeStack.Push(pFontNode);
+                pFontNode->SetSubNodes(0,rNodeStack.top());
+                rNodeStack.pop();
+                rNodeStack.push(pFontNode);
             }
         }
 
@@ -846,7 +851,7 @@ public:
     SmXMLRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
         const OUString& rLName)
         : SmXMLDocContext_Impl(rImport,nPrefix,rLName)
-        { nElementCount = GetSmImport().GetNodeStack().Count(); }
+        { nElementCount = GetSmImport().GetNodeStack().size(); }
 
     virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList);
 
@@ -925,7 +930,7 @@ void SmXMLStyleContext_Impl::EndElement()
     arguments
     */
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    if (rNodeStack.Count() - nElementCount > 1)
+    if (rNodeStack.size() - nElementCount > 1)
         SmXMLRowContext_Impl::EndElement();
     aStyleHelper.ApplyAttrs();
 }
@@ -950,7 +955,7 @@ void SmXMLPaddedContext_Impl::EndElement()
     contents are treated as a single "inferred <mrow>" containing its
     arguments
     */
-    if (GetSmImport().GetNodeStack().Count() - nElementCount > 1)
+    if (GetSmImport().GetNodeStack().size() - nElementCount > 1)
         SmXMLRowContext_Impl::EndElement();
 }
 
@@ -974,7 +979,7 @@ void SmXMLPhantomContext_Impl::EndElement()
     contents are treated as a single "inferred <mrow>" containing its
     arguments
     */
-    if (GetSmImport().GetNodeStack().Count() - nElementCount > 1)
+    if (GetSmImport().GetNodeStack().size() - nElementCount > 1)
         SmXMLRowContext_Impl::EndElement();
 
     SmToken aToken;
@@ -986,8 +991,9 @@ void SmXMLPhantomContext_Impl::EndElement()
     SmStructureNode *pPhantom = static_cast<SmStructureNode *>
         (new SmFontNode(aToken));
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    pPhantom->SetSubNodes(0,rNodeStack.Pop());
-    rNodeStack.Push(pPhantom);
+    pPhantom->SetSubNodes(0,rNodeStack.top());
+    rNodeStack.pop();
+    rNodeStack.push(pPhantom);
 }
 
 ////////////////////////////////////////////////////////////
@@ -1064,14 +1070,15 @@ void SmXMLFencedContext_Impl::EndElement()
     aToken.aText = ',';
     aToken.eType = TIDENT;
 
-    sal_uLong i = rNodeStack.Count() - nElementCount;
-    if (rNodeStack.Count() - nElementCount > 1)
-        i += rNodeStack.Count() - 1 - nElementCount;
+    sal_uLong i = rNodeStack.size() - nElementCount;
+    if (rNodeStack.size() - nElementCount > 1)
+        i += rNodeStack.size() - 1 - nElementCount;
     aRelationArray.resize(i);
-    while (rNodeStack.Count() > nElementCount)
+    while (rNodeStack.size() > nElementCount)
     {
-        aRelationArray[--i] = rNodeStack.Pop();
-        if (i > 1 && rNodeStack.Count() > 1)
+        aRelationArray[--i] = rNodeStack.top();
+        rNodeStack.pop();
+        if (i > 1 && rNodeStack.size() > 1)
             aRelationArray[--i] = new SmGlyphSpecialNode(aToken);
     }
 
@@ -1082,7 +1089,7 @@ void SmXMLFencedContext_Impl::EndElement()
 
     pSNode->SetSubNodes(pLeft,pBody,pRight);
     pSNode->SetScaleMode(SCALE_HEIGHT);
-    GetSmImport().GetNodeStack().Push(pSNode);
+    GetSmImport().GetNodeStack().push(pSNode);
 }
 
 
@@ -1108,10 +1115,10 @@ void SmXMLErrorContext_Impl::EndElement()
      of something. For now just throw them all away.
      */
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    while (rNodeStack.Count() > nElementCount)
+    while (rNodeStack.size() > nElementCount)
     {
-        SmNode *pNode = rNodeStack.Pop();
-        delete pNode;
+        delete rNodeStack.top();
+        rNodeStack.pop();
     }
 }
 
@@ -1145,7 +1152,7 @@ void SmXMLNumberContext_Impl::TCharacters(const OUString &rChars)
 
 void SmXMLNumberContext_Impl::EndElement()
 {
-    GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_NUMBER));
+    GetSmImport().GetNodeStack().push(new SmTextNode(aToken,FNT_NUMBER));
 }
 
 ////////////////////////////////////////////////////////////
@@ -1226,7 +1233,7 @@ void SmXMLTextContext_Impl::TCharacters(const OUString &rChars)
 
 void SmXMLTextContext_Impl::EndElement()
 {
-    GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_TEXT));
+    GetSmImport().GetNodeStack().push(new SmTextNode(aToken,FNT_TEXT));
 }
 
 ////////////////////////////////////////////////////////////
@@ -1272,7 +1279,7 @@ void SmXMLStringContext_Impl::TCharacters(const OUString &rChars)
 
 void SmXMLStringContext_Impl::EndElement()
 {
-    GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_FIXED));
+    GetSmImport().GetNodeStack().push(new SmTextNode(aToken,FNT_FIXED));
 }
 
 ////////////////////////////////////////////////////////////
@@ -1332,7 +1339,7 @@ void SmXMLIdentifierContext_Impl::EndElement()
         aStyleHelper.bFontNodeNeeded=sal_False;
     if (aStyleHelper.bFontNodeNeeded)
         aStyleHelper.ApplyAttrs();
-    GetSmImport().GetNodeStack().Push(pNode);
+    GetSmImport().GetNodeStack().push(pNode);
 }
 
 void SmXMLIdentifierContext_Impl::TCharacters(const OUString &rChars)
@@ -1377,7 +1384,7 @@ void SmXMLOperatorContext_Impl::EndElement()
     //to scale the operator to the height of the expression itself
     if (bIsStretchy)
         pNode->SetScaleMode(SCALE_HEIGHT);
-    GetSmImport().GetNodeStack().Push(pNode);
+    GetSmImport().GetNodeStack().push(pNode);
 }
 
 
@@ -1431,7 +1438,7 @@ void SmXMLSpaceContext_Impl::StartElement(
     aToken.nLevel = 5;
     SmBlankNode *pBlank = new SmBlankNode(aToken);
     pBlank->IncreaseBy(aToken);
-    GetSmImport().GetNodeStack().Push(pBlank);
+    GetSmImport().GetNodeStack().push(pBlank);
 }
 
 ////////////////////////////////////////////////////////////
@@ -1456,7 +1463,7 @@ public:
 void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup)
 {
     /*The <msub> element requires exactly 2 arguments.*/
-    const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 2;
+    const bool bNodeCheck = GetSmImport().GetNodeStack().size() - nElementCount == 2;
     OSL_ENSURE( bNodeCheck, "Sub has not two arguments" );
     if (!bNodeCheck)
         return;
@@ -1475,10 +1482,12 @@ void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup
     for (sal_uLong i = 1;  i < aSubNodes.size();  i++)
         aSubNodes[i] = NULL;
 
-    aSubNodes[eSubSup+1] = rNodeStack.Pop();
-    aSubNodes[0] = rNodeStack.Pop();
+    aSubNodes[eSubSup+1] = rNodeStack.top();
+    rNodeStack.pop();
+    aSubNodes[0] = rNodeStack.top();
+    rNodeStack.pop();
     pNode->SetSubNodes(aSubNodes);
-    rNodeStack.Push(pNode);
+    rNodeStack.push(pNode);
 }
 
 ////////////////////////////////////////////////////////////
@@ -1518,7 +1527,7 @@ void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType,
         SmSubSup aSub,SmSubSup aSup)
 {
     /*The <msub> element requires exactly 3 arguments.*/
-    const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 3;
+    const bool bNodeCheck = GetSmImport().GetNodeStack().size() - nElementCount == 3;
     OSL_ENSURE( bNodeCheck, "SubSup has not three arguments" );
     if (!bNodeCheck)
         return;
@@ -1537,11 +1546,14 @@ void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType,
     for (sal_uLong i = 1;  i < aSubNodes.size();  i++)
         aSubNodes[i] = NULL;
 
-    aSubNodes[aSup+1] = rNodeStack.Pop();
-    aSubNodes[aSub+1] = rNodeStack.Pop();
-    aSubNodes[0] =  rNodeStack.Pop();
+    aSubNodes[aSup+1] = rNodeStack.top();
+    rNodeStack.pop();
+    aSubNodes[aSub+1] = rNodeStack.top();
+    rNodeStack.pop();
+    aSubNodes[0] =  rNodeStack.top();
+    rNodeStack.pop();
     pNode->SetSubNodes(aSubNodes);
-    rNodeStack.Push(pNode);
+    rNodeStack.push(pNode);
 }
 
 ////////////////////////////////////////////////////////////
@@ -1569,14 +1581,15 @@ void SmXMLUnderContext_Impl::StartElement(const uno::Reference<
 
 void SmXMLUnderContext_Impl::HandleAccent()
 {
-    const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 2;
+    const bool bNodeCheck = GetSmImport().GetNodeStack().size() - nElementCount == 2;
     OSL_ENSURE( bNodeCheck, "Sub has not two arguments" );
     if (!bNodeCheck)
         return;
 
     /*Just one special case for the underline thing*/
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    SmNode *pTest = rNodeStack.Pop();
+    SmNode *pTest = rNodeStack.top();
+    rNodeStack.pop();
     SmToken aToken;
     aToken.cMathChar = '\0';
     aToken.nGroup = 0;
@@ -1596,10 +1609,11 @@ void SmXMLUnderContext_Impl::HandleAccent()
     else
         aSubNodes[0] = pTest;
 
-    aSubNodes[1] = rNodeStack.Pop();
+    aSubNodes[1] = rNodeStack.top();
+    rNodeStack.pop();
     pNode->SetSubNodes(aSubNodes);
     pNode->SetScaleMode(SCALE_WIDTH);
-    rNodeStack.Push(pNode);
+    rNodeStack.push(pNode);
 }
 
 
@@ -1647,7 +1661,7 @@ void SmXMLOverContext_Impl::EndElement()
 
 void SmXMLOverContext_Impl::HandleAccent()
 {
-    const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 2;
+    const bool bNodeCheck = GetSmImport().GetNodeStack().size() - nElementCount == 2;
     OSL_ENSURE (bNodeCheck, "Sub has not two arguments");
     if (!bNodeCheck)
         return;
@@ -1663,11 +1677,13 @@ void SmXMLOverContext_Impl::HandleAccent()
 
     SmNodeArray aSubNodes;
     aSubNodes.resize(2);
-    aSubNodes[0] = rNodeStack.Pop();
-    aSubNodes[1] = rNodeStack.Pop();
+    aSubNodes[0] = rNodeStack.top();
+    rNodeStack.pop();
+    aSubNodes[1] = rNodeStack.top();
+    rNodeStack.pop();
     pNode->SetSubNodes(aSubNodes);
     pNode->SetScaleMode(SCALE_WIDTH);
-    rNodeStack.Push(pNode);
+    rNodeStack.push(pNode);
 
 }
 
@@ -1727,7 +1743,7 @@ void SmXMLNoneContext_Impl::EndElement(void)
     aToken.aText.Erase();
     aToken.nLevel = 5;
     aToken.eType = TIDENT;
-    GetSmImport().GetNodeStack().Push(
+    GetSmImport().GetNodeStack().push(
         new SmTextNode(aToken,FNT_VARIABLE));
 }
 
@@ -2179,27 +2195,33 @@ void SmXMLDocContext_Impl::EndElement()
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
 
     for (sal_uLong i=0;i< 1;i++)
-        ContextArray[i] = rNodeStack.Pop();
+    {
+        ContextArray[i] = rNodeStack.top();
+        rNodeStack.pop();
+    }
 
     SmToken aDummy;
     SmStructureNode *pSNode = new SmLineNode(aDummy);
     pSNode->SetSubNodes(ContextArray);
-    rNodeStack.Push(pSNode);
+    rNodeStack.push(pSNode);
 
     SmNodeArray  LineArray;
-    sal_uLong n = rNodeStack.Count();
+    sal_uLong n = rNodeStack.size();
     LineArray.resize(n);
     for (sal_uLong j = 0; j < n; j++)
-        LineArray[n - (j + 1)] = rNodeStack.Pop();
+    {
+        LineArray[n - (j + 1)] = rNodeStack.top();
+        rNodeStack.pop();
+    }
     SmStructureNode *pSNode2 = new SmTableNode(aDummy);
     pSNode2->SetSubNodes(LineArray);
-    rNodeStack.Push(pSNode2);
+    rNodeStack.push(pSNode2);
 }
 
 void SmXMLFracContext_Impl::EndElement()
 {
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    const bool bNodeCheck = rNodeStack.Count() - nElementCount == 2;
+    const bool bNodeCheck = rNodeStack.size() - nElementCount == 2;
     OSL_ENSURE( bNodeCheck, "Fraction (mfrac) tag is missing component" );
     if (!bNodeCheck)
         return;
@@ -2211,16 +2233,18 @@ void SmXMLFracContext_Impl::EndElement()
     aToken.eType = TOVER;
     SmStructureNode *pSNode = new SmBinVerNode(aToken);
     SmNode *pOper = new SmRectangleNode(aToken);
-    SmNode *pSecond = rNodeStack.Pop();
-    SmNode *pFirst = rNodeStack.Pop();
+    SmNode *pSecond = rNodeStack.top();
+    rNodeStack.pop();
+    SmNode *pFirst = rNodeStack.top();
+    rNodeStack.pop();
     pSNode->SetSubNodes(pFirst,pOper,pSecond);
-    rNodeStack.Push(pSNode);
+    rNodeStack.push(pSNode);
 }
 
 void SmXMLRootContext_Impl::EndElement()
 {
     /*The <mroot> element requires exactly 2 arguments.*/
-    const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 2;
+    const bool bNodeCheck = GetSmImport().GetNodeStack().size() - nElementCount == 2;
     OSL_ENSURE( bNodeCheck, "Root tag is missing component");
     if (!bNodeCheck)
         return;
@@ -2233,10 +2257,12 @@ void SmXMLRootContext_Impl::EndElement()
     SmStructureNode *pSNode = new SmRootNode(aToken);
     SmNode *pOper = new SmRootSymbolNode(aToken);
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    SmNode *pIndex = rNodeStack.Pop();
-    SmNode *pBase = rNodeStack.Pop();
+    SmNode *pIndex = rNodeStack.top();
+    rNodeStack.pop();
+    SmNode *pBase = rNodeStack.top();
+    rNodeStack.pop();
     pSNode->SetSubNodes(pIndex,pOper,pBase);
-    rNodeStack.Push(pSNode);
+    rNodeStack.push(pSNode);
 }
 
 void SmXMLSqrtContext_Impl::EndElement()
@@ -2246,7 +2272,7 @@ void SmXMLSqrtContext_Impl::EndElement()
     contents are treated as a single "inferred <mrow>" containing its
     arguments
     */
-    if (GetSmImport().GetNodeStack().Count() - nElementCount > 1)
+    if (GetSmImport().GetNodeStack().size() - nElementCount > 1)
         SmXMLRowContext_Impl::EndElement();
 
     SmToken aToken;
@@ -2257,22 +2283,25 @@ void SmXMLSqrtContext_Impl::EndElement()
     SmStructureNode *pSNode = new SmRootNode(aToken);
     SmNode *pOper = new SmRootSymbolNode(aToken);
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    pSNode->SetSubNodes(0,pOper,rNodeStack.Pop());
-    rNodeStack.Push(pSNode);
+    pSNode->SetSubNodes(0,pOper,rNodeStack.top());
+    rNodeStack.pop();
+    rNodeStack.push(pSNode);
 }
 
 void SmXMLRowContext_Impl::EndElement()
 {
     SmNodeArray aRelationArray;
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    sal_uLong nSize = rNodeStack.Count()-nElementCount;
+    sal_uLong nSize = rNodeStack.size()-nElementCount;
 
     if (nSize > 0)
     {
         aRelationArray.resize(nSize);
-        for (sal_uLong j=rNodeStack.Count()-nElementCount;j > 0;j--)
-            aRelationArray[j-1] = rNodeStack.Pop();
-
+        for (sal_uLong j=rNodeStack.size()-nElementCount;j > 0;j--)
+        {
+            aRelationArray[j-1] = rNodeStack.top();
+            rNodeStack.pop();
+        }
 
         //If the first or last element is an operator with stretchyness
         //set then we must create a brace node here from those elements,
@@ -2332,7 +2361,7 @@ void SmXMLRowContext_Impl::EndElement()
 
             pSNode->SetSubNodes(pLeft,pBody,pRight);
             pSNode->SetScaleMode(SCALE_HEIGHT);
-            rNodeStack.Push(pSNode);
+            rNodeStack.push(pSNode);
             return;
         }
     }
@@ -2350,7 +2379,7 @@ void SmXMLRowContext_Impl::EndElement()
     SmToken aDummy;
     SmStructureNode *pSNode = new SmExpressionNode(aDummy);
     pSNode->SetSubNodes(aRelationArray);
-    rNodeStack.Push(pSNode);
+    rNodeStack.push(pSNode);
 }
 
 
@@ -2461,10 +2490,10 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
 {
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
 
-    if (rNodeStack.Count() <= nElementCount)
+    if (rNodeStack.size() <= nElementCount)
         return;
 
-    sal_uLong nCount = rNodeStack.Count() - nElementCount - 1;
+    sal_uLong nCount = rNodeStack.size() - nElementCount - 1;
     if (nCount == 0)
         return;
 
@@ -2478,7 +2507,10 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
 
         SmNodeStack aReverseStack;
         for (sal_uLong i = 0; i < nCount + 1; i++)
-            aReverseStack.Push(rNodeStack.Pop());
+        {
+            aReverseStack.push(rNodeStack.top());
+            rNodeStack.pop();
+        }
 
         SmSubSup eSub = bIsPrescript ? LSUB : RSUB;
         SmSubSup eSup = bIsPrescript ? LSUP : RSUP;
@@ -2493,28 +2525,34 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
             /*On each loop the base and its sub sup pair becomes the
              base for the next loop to which the next sub sup pair is
              attached, i.e. wheels within wheels*/
-            aSubNodes[0] = aReverseStack.Pop();
+            aSubNodes[0] = aReverseStack.top();
+            aReverseStack.pop();
 
-            SmNode *pScriptNode = aReverseStack.Pop();
+            SmNode *pScriptNode = aReverseStack.top();
+            aReverseStack.pop();
 
             if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) ||
                 (pScriptNode->GetToken().aText.Len())))
                 aSubNodes[eSub+1] = pScriptNode;
-            pScriptNode = aReverseStack.Pop();
+            pScriptNode = aReverseStack.top();
+            aReverseStack.pop();
             if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) ||
                 (pScriptNode->GetToken().aText.Len())))
                 aSubNodes[eSup+1] = pScriptNode;
 
             pNode->SetSubNodes(aSubNodes);
-            aReverseStack.Push(pNode);
+            aReverseStack.push(pNode);
         }
-        rNodeStack.Push(aReverseStack.Pop());
+        rNodeStack.push(aReverseStack.top());
     }
     else
     {
         // Ignore odd number of elements.
         for (sal_uLong i = 0; i < nCount; i++)
-            delete rNodeStack.Pop();
+        {
+            delete rNodeStack.top();
+            rNodeStack.pop();
+        }
     }
 }
 
@@ -2524,15 +2562,16 @@ void SmXMLTableContext_Impl::EndElement()
     SmNodeArray aExpressionArray;
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
     SmNodeStack aReverseStack;
-    aExpressionArray.resize(rNodeStack.Count()-nElementCount);
+    aExpressionArray.resize(rNodeStack.size()-nElementCount);
 
-    sal_uLong nRows = rNodeStack.Count()-nElementCount;
+    sal_uLong nRows = rNodeStack.size()-nElementCount;
     sal_uInt16 nCols = 0;
 
     SmStructureNode *pArray;
-    for (sal_uLong i=rNodeStack.Count()-nElementCount;i > 0;i--)
+    for (sal_uLong i=rNodeStack.size()-nElementCount;i > 0;i--)
     {
-        pArray = (SmStructureNode *)rNodeStack.Pop();
+        pArray = (SmStructureNode *)rNodeStack.top();
+        rNodeStack.pop();
         if (pArray->GetNumSubNodes() == 0)
         {
             //This is a little tricky, it is possible that there was
@@ -2553,13 +2592,14 @@ void SmXMLTableContext_Impl::EndElement()
 
         if (pArray->GetNumSubNodes() > nCols)
             nCols = pArray->GetNumSubNodes();
-        aReverseStack.Push(pArray);
+        aReverseStack.push(pArray);
     }
     aExpressionArray.resize(nCols*nRows);
     sal_uLong j=0;
-    while (aReverseStack.Count())
+    while ( !aReverseStack.empty() )
     {
-        pArray = (SmStructureNode *)aReverseStack.Pop();
+        pArray = (SmStructureNode *)aReverseStack.top();
+        aReverseStack.pop();
         for (sal_uInt16 i=0;i<pArray->GetNumSubNodes();i++)
             aExpressionArray[j++] = pArray->GetSubNode(i);
     }
@@ -2572,7 +2612,7 @@ void SmXMLTableContext_Impl::EndElement()
     SmMatrixNode *pSNode = new SmMatrixNode(aToken);
     pSNode->SetSubNodes(aExpressionArray);
     pSNode->SetRowCol(static_cast<sal_uInt16>(nRows),nCols);
-    rNodeStack.Push(pSNode);
+    rNodeStack.push(pSNode);
 }
 
 SvXMLImportContext *SmXMLTableRowContext_Impl::CreateChildContext(
@@ -2634,9 +2674,10 @@ void SmXMLActionContext_Impl::EndElement()
      first pushed one*/
 
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    for (sal_uLong i=rNodeStack.Count()-nElementCount;i > 1;i--)
+    for (sal_uLong i=rNodeStack.size()-nElementCount;i > 1;i--)
     {
-        delete rNodeStack.Pop();
+        delete rNodeStack.top();
+        rNodeStack.pop();
     }
 }
 
diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx
index db44e4a..5ed8096 100644
--- a/starmath/source/mathmlimport.hxx
+++ b/starmath/source/mathmlimport.hxx
@@ -252,7 +252,13 @@ public:
     const SvXMLTokenMap &GetColorTokenMap();
 
     SmNodeStack & GetNodeStack()    { return aNodeStack; }
-    SmNode *GetTree()               { return aNodeStack.Pop(); }
+    SmNode *GetTree()
+    {
+        SmNode* result = aNodeStack.top();
+        aNodeStack.pop();
+        return result;
+    }
+
     sal_Bool GetSuccess()           { return bSuccess; }
     String &GetText()               { return aText; }
 
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index a01a85b..123b190 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -999,16 +999,19 @@ void SmParser::Table()
     if (m_aCurToken.eType != TEND)
         Error(PE_UNEXPECTED_CHAR);
 
-    sal_uLong n = m_aNodeStack.Count();
+    sal_uLong n = m_aNodeStack.size();
 
     LineArray.resize(n);
 
     for (sal_uLong i = 0; i < n; i++)
-        LineArray[n - (i + 1)] = m_aNodeStack.Pop();
+    {
+        LineArray[n - (i + 1)] = m_aNodeStack.top();
+        m_aNodeStack.pop();
+    }
 
     SmStructureNode *pSNode = new SmTableNode(m_aCurToken);
     pSNode->SetSubNodes(LineArray);
-    m_aNodeStack.Push(pSNode);
+    m_aNodeStack.push(pSNode);
 }
 
 
@@ -1062,8 +1065,10 @@ void SmParser::Align()
         Insert('}', GetTokenIndex());
 
     if (pSNode)
-    {   pSNode->SetSubNodes(m_aNodeStack.Pop(), 0);
-        m_aNodeStack.Push(pSNode);
+    {
+        pSNode->SetSubNodes(m_aNodeStack.top(), 0);
+        m_aNodeStack.pop();
+        m_aNodeStack.push(pSNode);
     }
 }
 
@@ -1081,7 +1086,8 @@ void SmParser::Line()
     if (m_aCurToken.eType != TEND  &&  m_aCurToken.eType != TNEWLINE)
     {   Align();
         ExpressionArray.resize(++n);
-        ExpressionArray[n - 1] = m_aNodeStack.Pop();
+        ExpressionArray[n - 1] = m_aNodeStack.top();
+        m_aNodeStack.pop();
     }
 
     while (m_aCurToken.eType != TEND  &&  m_aCurToken.eType != TNEWLINE)
@@ -1090,7 +1096,8 @@ void SmParser::Line()
         else
             Align();
         ExpressionArray.resize(++n);
-        ExpressionArray[n - 1] = m_aNodeStack.Pop();
+        ExpressionArray[n - 1] = m_aNodeStack.top();
+        m_aNodeStack.pop();
     }
 
     //If there's no expression, add an empty one.
@@ -1101,20 +1108,21 @@ void SmParser::Line()
 
     SmStructureNode *pSNode = new SmLineNode(m_aCurToken);
     pSNode->SetSubNodes(ExpressionArray);
-    m_aNodeStack.Push(pSNode);
+    m_aNodeStack.push(pSNode);
 }
 
 
 void SmParser::Expression()
 {
     bool bUseExtraSpaces = true;
-    SmNode *pNode = m_aNodeStack.Pop();
+    SmNode *pNode = m_aNodeStack.top();
+    m_aNodeStack.pop();
     if (pNode)
     {
         if (pNode->GetToken().eType == TNOSPACE)
             bUseExtraSpaces = false;
         else
-            m_aNodeStack.Push(pNode);  // push the node from above again (now to be used as argument to this current 'nospace' node)
+            m_aNodeStack.push(pNode);  // push the node from above again (now to be used as argument to this current 'nospace' node)
     }
 
     sal_uInt16       n = 0;
@@ -1124,18 +1132,20 @@ void SmParser::Expression()
 
     Relation();
     RelationArray.resize(++n);
-    RelationArray[n - 1] = m_aNodeStack.Pop();
+    RelationArray[n - 1] = m_aNodeStack.top();
+    m_aNodeStack.pop();
 
     while (m_aCurToken.nLevel >= 4)
     {   Relation();
         RelationArray.resize(++n);
-        RelationArray[n - 1] = m_aNodeStack.Pop();
+        RelationArray[n - 1] = m_aNodeStack.top();
+        m_aNodeStack.pop();
     }
 
     SmExpressionNode *pSNode = new SmExpressionNode(m_aCurToken);
     pSNode->SetSubNodes(RelationArray);
     pSNode->SetUseExtraSpaces(bUseExtraSpaces);
-    m_aNodeStack.Push(pSNode);
+    m_aNodeStack.push(pSNode);
 }
 
 
@@ -1145,15 +1155,18 @@ void SmParser::Relation()
     while (TokenInGroup(TGRELATION))
     {
         SmStructureNode *pSNode  = new SmBinHorNode(m_aCurToken);
-        SmNode *pFirst = m_aNodeStack.Pop();
+        SmNode *pFirst = m_aNodeStack.top();
+        m_aNodeStack.pop();
 
         OpSubSup();
-        SmNode *pSecond = m_aNodeStack.Pop();
+        SmNode *pSecond = m_aNodeStack.top();
+        m_aNodeStack.pop();
 
         Sum();
 
-        pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.Pop());
-        m_aNodeStack.Push(pSNode);
+        pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.top());
+        m_aNodeStack.pop();
+        m_aNodeStack.push(pSNode);
     }
 }
 
@@ -1164,15 +1177,17 @@ void SmParser::Sum()
     while (TokenInGroup(TGSUM))
     {
         SmStructureNode *pSNode  = new SmBinHorNode(m_aCurToken);
-        SmNode *pFirst = m_aNodeStack.Pop();
+        SmNode *pFirst = m_aNodeStack.top();
+        m_aNodeStack.pop();
 
         OpSubSup();
-        SmNode *pSecond = m_aNodeStack.Pop();
+        SmNode *pSecond = m_aNodeStack.top();
+        m_aNodeStack.pop();
 
         Product();
 
-        pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.Pop());
-        m_aNodeStack.Push(pSNode);
+        pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.top());
+        m_aNodeStack.push(pSNode);
     }
 }
 
@@ -1183,8 +1198,9 @@ void SmParser::Product()
 
     while (TokenInGroup(TGPRODUCT))
     {   SmStructureNode *pSNode;
-        SmNode *pFirst = m_aNodeStack.Pop(),
+        SmNode *pFirst = m_aNodeStack.top(),
                *pOper;
+        m_aNodeStack.pop();
         bool bSwitchArgs = false;
 
         SmTokenType eType = m_aCurToken.eType;
@@ -1206,7 +1222,8 @@ void SmParser::Product()
                 m_aCurToken.nGroup = TGPRODUCT;
 
                 GlyphSpecial();
-                pOper = m_aNodeStack.Pop();
+                pOper = m_aNodeStack.top();
+                m_aNodeStack.pop();
                 break;
 
             case TOVERBRACE :
@@ -1235,17 +1252,24 @@ void SmParser::Product()
                 pSNode = new SmBinHorNode(m_aCurToken);
 
                 OpSubSup();
-                pOper = m_aNodeStack.Pop();
+                pOper = m_aNodeStack.top();
+                m_aNodeStack.pop();
         }
 
         Power();
 
         if (bSwitchArgs)
+        {
             //! vgl siehe SmBinDiagonalNode::Arrange
-            pSNode->SetSubNodes(pFirst, m_aNodeStack.Pop(), pOper);
+            pSNode->SetSubNodes(pFirst, m_aNodeStack.top(), pOper);
+            m_aNodeStack.pop();
+        }
         else
-            pSNode->SetSubNodes(pFirst, pOper, m_aNodeStack.Pop());
-        m_aNodeStack.Push(pSNode);
+        {
+            pSNode->SetSubNodes(pFirst, pOper, m_aNodeStack.top());
+            m_aNodeStack.pop();
+        }
+        m_aNodeStack.push(pSNode);
     }
 }
 
@@ -1270,7 +1294,8 @@ void SmParser::SubSup(sal_uLong nActiveGroup)
     // initialize subnodes array
     SmNodeArray  aSubNodes;
     aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES);
-    aSubNodes[0] = m_aNodeStack.Pop();
+    aSubNodes[0] = m_aNodeStack.top();
+    m_aNodeStack.pop();
     for (sal_uInt16 i = 1;  i < aSubNodes.size();  i++)
         aSubNodes[i] = NULL;
 
@@ -1310,18 +1335,19 @@ void SmParser::SubSup(sal_uLong nActiveGroup)
         // set sub-/supscript if not already done
         if (aSubNodes[nIndex] != NULL)
             Error(PE_DOUBLE_SUBSUPSCRIPT);
-        aSubNodes[nIndex] = m_aNodeStack.Pop();
+        aSubNodes[nIndex] = m_aNodeStack.top();
+        m_aNodeStack.pop();
     }
 
     pNode->SetSubNodes(aSubNodes);
-    m_aNodeStack.Push(pNode);
+    m_aNodeStack.push(pNode);
 }
 
 
 void SmParser::OpSubSup()
 {
     // push operator symbol
-    m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
+    m_aNodeStack.push(new SmMathSymbolNode(m_aCurToken));
     // skip operator token
     NextToken();
     // get sub- supscripts if any
@@ -1357,7 +1383,7 @@ void SmParser::Blank()
         pBlankNode->Clear();
     }
 
-    m_aNodeStack.Push(pBlankNode);
+    m_aNodeStack.push(pBlankNode);
 }
 
 
@@ -1375,12 +1401,12 @@ void SmParser::Term()
             bool bNoSpace = m_aCurToken.eType == TNOSPACE;
             if (bNoSpace)   // push 'no space' node and continue to parse expression
             {
-                m_aNodeStack.Push(new SmExpressionNode(m_aCurToken));
+                m_aNodeStack.push(new SmExpressionNode(m_aCurToken));
                 NextToken();
             }
             if (m_aCurToken.eType != TLGROUP)
             {
-                m_aNodeStack.Pop();    // get rid of the 'no space' node pushed above
+                m_aNodeStack.pop();    // get rid of the 'no space' node pushed above
                 Term();
             }
             else
@@ -1391,10 +1417,10 @@ void SmParser::Term()
                 if (m_aCurToken.eType == TRGROUP)
                 {
                     if (bNoSpace)   // get rid of the 'no space' node pushed above
-                        m_aNodeStack.Pop();
+                        m_aNodeStack.pop();
                     SmStructureNode *pSNode = new SmExpressionNode(m_aCurToken);
                     pSNode->SetSubNodes(NULL, NULL);
-                    m_aNodeStack.Push(pSNode);
+                    m_aNodeStack.push(pSNode);
 
                     NextToken();
                 }
@@ -1420,16 +1446,16 @@ void SmParser::Term()
             break;
 
         case TTEXT :
-            m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_TEXT));
+            m_aNodeStack.push(new SmTextNode(m_aCurToken, FNT_TEXT));
             NextToken();
             break;
         case TIDENT :
         case TCHARACTER :
-            m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_VARIABLE));
+            m_aNodeStack.push(new SmTextNode(m_aCurToken, FNT_VARIABLE));
             NextToken();
             break;
         case TNUMBER :
-            m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_NUMBER));
+            m_aNodeStack.push(new SmTextNode(m_aCurToken, FNT_NUMBER));
             NextToken();
             break;
 
@@ -1467,12 +1493,12 @@ void SmParser::Term()
         case TDOTSLOW :
         case TDOTSUP :
         case TDOTSVERT :
-            m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
+            m_aNodeStack.push(new SmMathSymbolNode(m_aCurToken));
             NextToken();
             break;
 
         case TPLACE:
-            m_aNodeStack.Push(new SmPlaceNode(m_aCurToken));
+            m_aNodeStack.push(new SmPlaceNode(m_aCurToken));
             NextToken();
             break;
 
@@ -1520,19 +1546,21 @@ void SmParser::Term()
                     // check if casting in following line is ok
                     OSL_ENSURE(!m_aNodeStack.Top()->IsVisible(), "Sm : Ooops...");
 
-                    aArray[n] = (SmStructureNode *) m_aNodeStack.Pop();
+                    aArray[n] = (SmStructureNode *) m_aNodeStack.top();
+                    m_aNodeStack.pop();
                     n++;
                 }
 
                 Power();
 
-                SmNode *pFirstNode = m_aNodeStack.Pop();
+                SmNode *pFirstNode = m_aNodeStack.top();
+                m_aNodeStack.pop();
                 while (n > 0)
                 {   aArray[n - 1]->SetSubNodes(0, pFirstNode);
                     pFirstNode = aArray[n - 1];
                     n--;
                 }
-                m_aNodeStack.Push(pFirstNode);
+                m_aNodeStack.push(pFirstNode);
             }
             else if (TokenInGroup(TGFUNCTION))
             {   if (CONVERT_40_TO_50 != GetConversion())
@@ -1548,7 +1576,8 @@ void SmParser::Term()
                     //
                     Function();
 
-                    SmNode *pFunc = m_aNodeStack.Pop();
+                    SmNode *pFunc = m_aNodeStack.top();
+                    m_aNodeStack.pop();
 
                     if (m_aCurToken.eType == TLPARENT)
                     {   Term();
@@ -1561,8 +1590,9 @@ void SmParser::Term()
                     Insert('}', GetTokenIndex());
 
                     SmStructureNode *pSNode = new SmExpressionNode(pFunc->GetToken());
-                    pSNode->SetSubNodes(pFunc, m_aNodeStack.Pop());
-                    m_aNodeStack.Push(pSNode);
+                    pSNode->SetSubNodes(pFunc, m_aNodeStack.top());
+                    m_aNodeStack.pop();
+                    m_aNodeStack.push(pSNode);
                 }
             }
             else
@@ -1603,7 +1633,7 @@ void SmParser::Escape()
     }
 
     SmNode *pNode = new SmMathSymbolNode(m_aCurToken);
-    m_aNodeStack.Push(pNode);
+    m_aNodeStack.push(pNode);
 
     NextToken();
 }
@@ -1619,13 +1649,15 @@ void SmParser::Operator()
 
         if (TokenInGroup(TGLIMIT) || TokenInGroup(TGPOWER))
             SubSup(m_aCurToken.nGroup);
-        SmNode *pOperator = m_aNodeStack.Pop();
+        SmNode *pOperator = m_aNodeStack.top();
+        m_aNodeStack.pop();
 
         // get argument
         Power();
 
-        pSNode->SetSubNodes(pOperator, m_aNodeStack.Pop());
-        m_aNodeStack.Push(pSNode);
+        pSNode->SetSubNodes(pOperator, m_aNodeStack.top());
+        m_aNodeStack.pop();
+        m_aNodeStack.push(pSNode);
     }
 }
 
@@ -1683,7 +1715,7 @@ void SmParser::Oper()
         default :
             OSL_FAIL("Sm: unknown case");
     }
-    m_aNodeStack.Push(pNode);
+    m_aNodeStack.push(pNode);
 
     NextToken();
 }
@@ -1712,7 +1744,8 @@ void SmParser::UnOper()
         case TNROOT :
             NextToken();
             Power();
-            pExtra = m_aNodeStack.Pop();
+            pExtra = m_aNodeStack.top();
+            m_aNodeStack.pop();
             break;
 
         case TUOPER :
@@ -1721,7 +1754,8 @@ void SmParser::UnOper()
             m_aCurToken.eType = TUOPER;
             m_aCurToken.nGroup = TGUNOPER;
             GlyphSpecial();
-            pOper = m_aNodeStack.Pop();
+            pOper = m_aNodeStack.top();
+            m_aNodeStack.pop();
             break;
 
         case TPLUS :
@@ -1731,7 +1765,8 @@ void SmParser::UnOper()
         case TNEG :
         case TFACT :
             OpSubSup();
-            pOper = m_aNodeStack.Pop();
+            pOper = m_aNodeStack.top();
+            m_aNodeStack.pop();
             break;
 
         default :
@@ -1740,7 +1775,8 @@ void SmParser::UnOper()
 
     // get argument
     Power();
-    pArg = m_aNodeStack.Pop();
+    pArg = m_aNodeStack.top();
+    m_aNodeStack.pop();
 
     if (eType == TABS)
     {   pSNode = new SmBraceNode(aNodeToken);
@@ -1774,7 +1810,7 @@ void SmParser::UnOper()
             pSNode->SetSubNodes(pOper, pArg);
     }
 
-    m_aNodeStack.Push(pSNode);
+    m_aNodeStack.push(pSNode);
 }
 
 
@@ -1810,7 +1846,7 @@ void SmParser::Attribut()
 
     pSNode->SetSubNodes(pAttr, 0);
     pSNode->SetScaleMode(eScaleMode);
-    m_aNodeStack.Push(pSNode);
+    m_aNodeStack.push(pSNode);
 }
 
 
@@ -1825,7 +1861,7 @@ void SmParser::FontAttribut()
         case TBOLD :
         case TNBOLD :
         case TPHANTOM :
-            m_aNodeStack.Push(new SmFontNode(m_aCurToken));
+            m_aNodeStack.push(new SmFontNode(m_aCurToken));
             NextToken();
             break;
 
@@ -1864,7 +1900,7 @@ void SmParser::Color()
             Error(PE_COLOR_EXPECTED);
     } while (m_aCurToken.eType == TCOLOR);
 
-    m_aNodeStack.Push(new SmFontNode(aToken));
+    m_aNodeStack.push(new SmFontNode(aToken));
 }
 
 
@@ -1885,7 +1921,7 @@ void SmParser::Font()
             Error(PE_FONT_EXPECTED);
     } while (m_aCurToken.eType == TFONT);
 
-    m_aNodeStack.Push(new SmFontNode(aToken));
+    m_aNodeStack.push(new SmFontNode(aToken));
 }
 
 
@@ -1976,7 +2012,7 @@ void SmParser::FontSize()
     NextToken();
 
     pFontNode->SetSizeParameter(aValue, Type);
-    m_aNodeStack.Push(pFontNode);
+    m_aNodeStack.push(pFontNode);
 }
 
 
@@ -2004,7 +2040,8 @@ void SmParser::Brace()
 
             NextToken();
             Bracebody(true);
-            pBody = m_aNodeStack.Pop();
+            pBody = m_aNodeStack.top();
+            m_aNodeStack.pop();
 
             if (m_aCurToken.eType == TRIGHT)
             {   NextToken();
@@ -2032,7 +2069,8 @@ void SmParser::Brace()
 
             NextToken();
             Bracebody(false);
-            pBody = m_aNodeStack.Pop();
+            pBody = m_aNodeStack.top();
+            m_aNodeStack.pop();
 
             SmTokenType  eExpectedType = TUNKNOWN;
             switch (pLeft->GetToken().eType)
@@ -2066,7 +2104,7 @@ void SmParser::Brace()
         OSL_ENSURE(pRight, "Sm: NULL pointer");
         pSNode->SetSubNodes(pLeft, pBody, pRight);
         pSNode->SetScaleMode(eScaleMode);
-        m_aNodeStack.Push(pSNode);
+        m_aNodeStack.push(pSNode);
     }
     else
     {   delete pSNode;
@@ -2092,7 +2130,7 @@ void SmParser::Bracebody(bool bIsLeftRight)
         {
             if (m_aCurToken.eType == TMLINE)
             {
-                m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
+                m_aNodeStack.push(new SmMathSymbolNode(m_aCurToken));
                 NextToken();
                 nNum++;
             }
@@ -2111,7 +2149,7 @@ void SmParser::Bracebody(bool bIsLeftRight)
         {
             if (m_aCurToken.eType == TMLINE)
             {
-                m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
+                m_aNodeStack.push(new SmMathSymbolNode(m_aCurToken));
                 NextToken();
                 nNum++;
             }
@@ -2128,11 +2166,14 @@ void SmParser::Bracebody(bool bIsLeftRight)
     // build argument vector in parsing order
     aNodes.resize(nNum);
     for (sal_uInt16 i = 0;  i < nNum;  i++)
-        aNodes[nNum - 1 - i] = m_aNodeStack.Pop();
+    {
+        aNodes[nNum - 1 - i] = m_aNodeStack.top();
+        m_aNodeStack.pop();
+    }
 
     pBody->SetSubNodes(aNodes);
     pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE);
-    m_aNodeStack.Push(pBody);
+    m_aNodeStack.push(pBody);
 }
 
 
@@ -2163,7 +2204,7 @@ void SmParser::Function()
         case TLN :
         case TLOG :
         case TEXP :
-            m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_FUNCTION));
+            m_aNodeStack.push(new SmTextNode(m_aCurToken, FNT_FUNCTION));
             NextToken();
             break;
 
@@ -2186,10 +2227,13 @@ void SmParser::Binom()
     ExpressionArray.resize(2);
 
     for (int i = 0;  i < 2;  i++)
-        ExpressionArray[2 - (i + 1)] = m_aNodeStack.Pop();
+    {
+        ExpressionArray[2 - (i + 1)] = m_aNodeStack.top();
+        m_aNodeStack.pop();
+    }
 
     pSNode->SetSubNodes(ExpressionArray);
-    m_aNodeStack.Push(pSNode);
+    m_aNodeStack.push(pSNode);
 }
 
 
@@ -2212,7 +2256,10 @@ void SmParser::Stack()
         ExpressionArray.resize(n);
 
         for (sal_uInt16 i = 0; i < n; i++)
-            ExpressionArray[n - (i + 1)] = m_aNodeStack.Pop();
+        {
+            ExpressionArray[n - (i + 1)] = m_aNodeStack.top();
+            m_aNodeStack.pop();
+        }
 
         if (m_aCurToken.eType != TRGROUP)
             Error(PE_RGROUP_EXPECTED);
@@ -2225,7 +2272,7 @@ void SmParser::Stack()
         aTok.eType = TSTACK;
         SmStructureNode *pSNode = new SmTableNode(aTok);
         pSNode->SetSubNodes(ExpressionArray);
-        m_aNodeStack.Push(pSNode);
+        m_aNodeStack.push(pSNode);
     }
     else
         Error(PE_LGROUP_EXPECTED);
@@ -2276,7 +2323,10 @@ void SmParser::Matrix()
         ExpressionArray.resize(nRC);
 
         for (sal_uInt16 i = 0; i < (nRC); i++)
-            ExpressionArray[(nRC) - (i + 1)] = m_aNodeStack.Pop();
+        {
+            ExpressionArray[(nRC) - (i + 1)] = m_aNodeStack.top();
+            m_aNodeStack.pop();
+        }
 
         if (m_aCurToken.eType != TRGROUP)
             Error(PE_RGROUP_EXPECTED);
@@ -2286,7 +2336,7 @@ void SmParser::Matrix()
         SmMatrixNode *pMNode = new SmMatrixNode(m_aCurToken);
         pMNode->SetSubNodes(ExpressionArray);
         pMNode->SetRowCol(r, c);
-        m_aNodeStack.Push(pMNode);
+        m_aNodeStack.push(pMNode);
     }
     else
         Error(PE_LGROUP_EXPECTED);
@@ -2368,14 +2418,14 @@ void SmParser::Special()
     if (aSymbolName.Len() > 0 )
         AddToUsedSymbols( aSymbolName );
 
-    m_aNodeStack.Push(new SmSpecialNode(m_aCurToken));
+    m_aNodeStack.push(new SmSpecialNode(m_aCurToken));
     NextToken();
 }
 
 
 void SmParser::GlyphSpecial()
 {
-    m_aNodeStack.Push(new SmGlyphSpecialNode(m_aCurToken));
+    m_aNodeStack.push(new SmGlyphSpecialNode(m_aCurToken));
     NextToken();
 }
 
@@ -2389,7 +2439,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(pSNode);
+    m_aNodeStack.push(pSNode);
 
     AddError(eError, pSNode);
 
@@ -2424,13 +2474,16 @@ SmNode *SmParser::Parse(const String &rBuffer)
         delete m_aErrDescList[ i ];
     m_aErrDescList.clear();
 
-    m_aNodeStack.Clear();
+    while ( !m_aNodeStack.empty() )
+        m_aNodeStack.pop();
 
     SetLanguage( Application::GetSettings().GetUILanguage() );
     NextToken();
     Table();
 
-    return m_aNodeStack.Pop();
+    SmNode* result = m_aNodeStack.top();
+    m_aNodeStack.pop();
+    return result;
 }
 
 SmNode *SmParser::ParseExpression(const String &rBuffer)
@@ -2447,13 +2500,16 @@ SmNode *SmParser::ParseExpression(const String &rBuffer)
         delete m_aErrDescList[ i ];
     m_aErrDescList.clear();
 
-    m_aNodeStack.Clear();
+    while ( !m_aNodeStack.empty() )
+        m_aNodeStack.pop();
 
     SetLanguage( Application::GetSettings().GetUILanguage() );
     NextToken();
     Expression();
 
-    return m_aNodeStack.Pop();
+    SmNode* result = m_aNodeStack.top();
+    m_aNodeStack.pop();
+    return result;
 }
 
 

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to