[Libreoffice-commits] .: 11 commits - filter/source sc/inc sc/source starmath/inc starmath/source tools/inc tools/Package_inc.mk vcl/inc vcl/source
Eike Rathke
erack at kemper.freedesktop.org
Mon Dec 5 13:55:24 PST 2011
filter/source/svg/svgwriter.hxx | 17 +-
sc/inc/chgtrack.hxx | 10 -
sc/source/core/tool/chgtrack.cxx | 69 ++++----
sc/source/filter/html/htmlpars.cxx | 35 ++--
sc/source/filter/inc/XclExpChangeTrack.hxx | 22 --
sc/source/filter/inc/filt_pch.hxx | 1
sc/source/filter/inc/htmlpars.hxx | 7
sc/source/filter/inc/xcl97esc.hxx | 4
sc/source/filter/xcl97/XclExpChangeTrack.cxx | 28 +--
sc/source/filter/xcl97/xcl97esc.cxx | 10 -
sc/source/filter/xml/xmlfilti.hxx | 24 ++
starmath/inc/parse.hxx | 3
starmath/source/math_pch.cxx | 1
starmath/source/mathmlimport.cxx | 224 +++++++++++++++-----------
starmath/source/mathmlimport.hxx | 8
starmath/source/parse.cxx | 225 ++++++++++++++++-----------
tools/Package_inc.mk | 1
tools/inc/tools/stack.hxx | 103 ------------
vcl/inc/vcl/cvtsvm.hxx | 5
vcl/source/gdi/cvtsvm.cxx | 35 ++--
20 files changed, 425 insertions(+), 407 deletions(-)
New commits:
commit 072b13738781f78a8318053d8cfea39558de17f5
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 19:08:42 2011 +0100
Remove unused tools/stack.hxx
diff --git a/sc/source/filter/inc/filt_pch.hxx b/sc/source/filter/inc/filt_pch.hxx
index 805cad1..aa0115e 100644
--- a/sc/source/filter/inc/filt_pch.hxx
+++ b/sc/source/filter/inc/filt_pch.hxx
@@ -219,7 +219,6 @@
#include <com/sun/star/lang/WrappedTargetException.hdl>
#include <com/sun/star/lang/WrappedTargetException.hpp>
#include <sfx2/shell.hxx>
-#include <tools/stack.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XComponent.hdl>
#include <editeng/svxenum.hxx>
diff --git a/tools/Package_inc.mk b/tools/Package_inc.mk
index d1ca76b..fc36d8c 100644
--- a/tools/Package_inc.mk
+++ b/tools/Package_inc.mk
@@ -79,7 +79,6 @@ $(eval $(call gb_Package_add_file,tools_inc,inc/tools/shl.hxx,tools/shl.hxx))
$(eval $(call gb_Package_add_file,tools_inc,inc/tools/simplerm.hxx,tools/simplerm.hxx))
$(eval $(call gb_Package_add_file,tools_inc,inc/tools/solar.h,tools/solar.h))
$(eval $(call gb_Package_add_file,tools_inc,inc/tools/solarmutex.hxx,tools/solarmutex.hxx))
-$(eval $(call gb_Package_add_file,tools_inc,inc/tools/stack.hxx,tools/stack.hxx))
$(eval $(call gb_Package_add_file,tools_inc,inc/tools/stream.hxx,tools/stream.hxx))
$(eval $(call gb_Package_add_file,tools_inc,inc/tools/string.hxx,tools/string.hxx))
$(eval $(call gb_Package_add_file,tools_inc,inc/tools/svborder.hxx,tools/svborder.hxx))
diff --git a/tools/inc/tools/stack.hxx b/tools/inc/tools/stack.hxx
deleted file mode 100644
index a8f8cb5..0000000
--- a/tools/inc/tools/stack.hxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _STACK_HXX
-#define _STACK_HXX
-
-#include <tools/contnr.hxx>
-
-// ---------
-// - Stack -
-// ---------
-
-#define STACK_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND
-
-class Stack : private Container
-{
-public:
- using Container::Clear;
- using Container::Count;
- using Container::GetObject;
- using Container::GetPos;
-
- Stack( sal_uInt16 _nInitSize = 16, sal_uInt16 _nReSize = 16 ) :
- Container( CONTAINER_MAXBLOCKSIZE, _nInitSize, _nReSize ) {}
- Stack( const Stack& rStack ) : Container( rStack ) {}
-
- void Push( void* p ) { Container::Insert( p, CONTAINER_APPEND ); }
- void* Pop() { return Container::Remove( Count()-1 ); }
- void* Top() const { return Container::GetObject( Count()-1 ); }
-
- Stack& operator =( const Stack& rStack )
- { Container::operator =( rStack ); return *this; }
-
- sal_Bool operator ==( const Stack& rStack ) const
- { return Container::operator ==( rStack ); }
- sal_Bool operator !=( const Stack& rStack ) const
- { return Container::operator !=( rStack ); }
-};
-
-// -----------------
-// - DECLARE_STACK -
-// -----------------
-
-#define DECLARE_STACK( ClassName, Type ) \
-class ClassName : private Stack \
-{ \
-public: \
- using Stack::Clear; \
- using Stack::Count; \
- \
- ClassName( sal_uInt16 _nInitSize = 16, \
- sal_uInt16 _nReSize = 16 ) : \
- Stack( _nInitSize, _nReSize ) {} \
- ClassName( const ClassName& rClassName ) : \
- Stack( rClassName ) {} \
- \
- void Push( Type p ) { Stack::Push( (void*)p ); } \
- Type Pop() { return (Type)Stack::Pop(); } \
- Type Top() const { return (Type)Stack::Top(); } \
- \
- Type GetObject( sal_uIntPtr nIndex ) const \
- { return (Type)Stack::GetObject( nIndex ); } \
- sal_uIntPtr GetPos( const Type p ) const \
- { return Stack::GetPos( (const void*)p ); } \
- \
- ClassName& operator =( const ClassName& rClassName ) \
- { Stack::operator =( rClassName ); \
- return *this; } \
- \
- sal_Bool operator ==( const ClassName& rStack ) const \
- { return Stack::operator ==( rStack ); } \
- sal_Bool operator !=( const ClassName& rStack ) const \
- { return Stack::operator !=( rStack ); } \
-};
-
-#endif // _STACK_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 050b170e8cf911679a4d3697ae81ee49e67d10a7
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 19:08:40 2011 +0100
Replace ScHTMLAdjustStack with std::stack< ScHTMLAdjustStackEntry* >
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index b8bce20..cdd0534 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -544,8 +544,11 @@ void ScHTMLLayoutParser::Adjust()
ScEEParseEntry* pE = maList[ i ];
if ( pE->nTab < nTab )
{ // Table beendet
- if ( (pS = aStack.Pop()) != 0 )
+ if ( !aStack.empty() )
{
+ pS = aStack.top();
+ aStack.pop();
+
nLastCol = pS->nLastCol;
nNextRow = pS->nNextRow;
nCurRow = pS->nCurRow;
@@ -573,7 +576,7 @@ void ScHTMLLayoutParser::Adjust()
nLastCol = pE->nCol; // eingelesene Col
if ( pE->nTab > nTab )
{ // neue Table
- aStack.Push( new ScHTMLAdjustStackEntry(
+ aStack.push( new ScHTMLAdjustStackEntry(
nLastCol, nNextRow, nCurRow ) );
nTab = pE->nTab;
pTab = (pTables ? (Table*) pTables->Get( nTab ) : NULL);
@@ -642,8 +645,11 @@ void ScHTMLLayoutParser::Adjust()
if ( nRowMax < nRowTmp )
nRowMax = nRowTmp;
}
- while ( (pS = aStack.Pop()) != 0 )
- delete pS;
+ while ( !aStack.empty() )
+ {
+ delete aStack.top();
+ aStack.pop();
+ }
}
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index d8f6ea4..4c3ea8e 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -29,8 +29,6 @@
#ifndef SC_HTMLPARS_HXX
#define SC_HTMLPARS_HXX
-#include <tools/stack.hxx>
-
#include <memory>
#include <stack>
#include <vector>
@@ -158,7 +156,7 @@ struct ScHTMLAdjustStackEntry
nCurRow( nCRow )
{}
};
-DECLARE_STACK( ScHTMLAdjustStack, ScHTMLAdjustStackEntry* )
+typedef ::std::stack< ScHTMLAdjustStackEntry* > ScHTMLAdjustStack;
// ============================================================================
commit 0c173e748936231846c9e3e87832754c496ebc35
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 19:08:40 2011 +0100
Replace ScHTMLTableStack with std::stack< ScHTMLTableStackEntry* >
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 6cebfae..b8bce20 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -255,9 +255,11 @@ ScHTMLLayoutParser::ScHTMLLayoutParser(
ScHTMLLayoutParser::~ScHTMLLayoutParser()
{
- ScHTMLTableStackEntry* pS;
- while ( (pS = aTableStack.Pop()) != 0 )
+ while ( !aTableStack.empty() )
{
+ ScHTMLTableStackEntry* pS = aTableStack.top();
+ aTableStack.pop();
+
bool found = false;
for ( size_t i = 0, nListSize = maList.size(); i < nListSize; ++i )
{
@@ -1092,7 +1094,7 @@ void ScHTMLLayoutParser::TableOn( ImportInfo* pInfo )
{ // Table in Table
sal_uInt16 nTmpColOffset = nColOffset; // wird in Colonize noch angepasst
Colonize( pActEntry );
- aTableStack.Push( new ScHTMLTableStackEntry(
+ aTableStack.push( new ScHTMLTableStackEntry(
pActEntry, xLockedList, pLocalColOffset, nFirstTableCell,
nColCnt, nRowCnt, nColCntStart, nMaxCol, nTable,
nTableWidth, nColOffset, nColOffsetStart,
@@ -1154,7 +1156,7 @@ void ScHTMLLayoutParser::TableOn( ImportInfo* pInfo )
CloseEntry( pInfo );
NextRow( pInfo );
}
- aTableStack.Push( new ScHTMLTableStackEntry(
+ aTableStack.push( new ScHTMLTableStackEntry(
pActEntry, xLockedList, pLocalColOffset, nFirstTableCell,
nColCnt, nRowCnt, nColCntStart, nMaxCol, nTable,
nTableWidth, nColOffset, nColOffsetStart,
@@ -1208,9 +1210,11 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
}
if ( --nTableLevel > 0 )
{ // Table in Table beendet
- ScHTMLTableStackEntry* pS = aTableStack.Pop();
- if ( pS )
+ if ( !aTableStack.empty() )
{
+ ScHTMLTableStackEntry* pS = aTableStack.top();
+ aTableStack.pop();
+
ScEEParseEntry* pE = pS->pCellEntry;
SCROW nRows = nRowCnt - pS->nRowCnt;
if ( nRows > 1 )
@@ -1344,11 +1348,12 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
else
{ // einfache Table beendet
SetWidths();
- ScHTMLTableStackEntry* pS = aTableStack.Pop();
nMaxCol = 0;
nTable = 0;
- if ( pS )
+ if ( !aTableStack.empty() )
{
+ ScHTMLTableStackEntry* pS = aTableStack.top();
+ aTableStack.pop();
if ( pLocalColOffset )
delete pLocalColOffset;
pLocalColOffset = pS->pLocalColOffset;
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index 5d7667d..d8f6ea4 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -32,6 +32,7 @@
#include <tools/stack.hxx>
#include <memory>
+#include <stack>
#include <vector>
#include <list>
#include <map>
@@ -144,7 +145,7 @@ struct ScHTMLTableStackEntry
{}
~ScHTMLTableStackEntry() {}
};
-DECLARE_STACK( ScHTMLTableStack, ScHTMLTableStackEntry* )
+typedef ::std::stack< ScHTMLTableStackEntry* > ScHTMLTableStack;
struct ScHTMLAdjustStackEntry
{
commit b3ba4376c6f5e63aeeadec95c51bcd164d10f2b5
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 19:08:38 2011 +0100
Replace Stack with std::stack< SVGAttributeWriter* >
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index dd033a2..0b6048e 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -29,13 +29,13 @@
#ifndef SVGWRITER_HXX
#define SVGWRITER_HXX
+#include <stack>
#include <cppuhelper/weak.hxx>
#include <rtl/ustring.hxx>
#include <tools/debug.hxx>
#include <tools/stream.hxx>
#include <tools/string.hxx>
#include <tools/urlobj.hxx>
-#include <tools/stack.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/metaact.hxx>
@@ -164,7 +164,7 @@ private:
sal_Int32 mnCurGradientId;
sal_Int32 mnCurMaskId;
sal_Int32 mnCurPatternId;
- Stack maContextStack;
+ ::std::stack< SVGAttributeWriter* > maContextStack;
::std::auto_ptr< SVGShapeDescriptor > mapCurShape;
SVGExport& mrExport;
SVGFontExport& mrFontExport;
@@ -179,8 +179,17 @@ private:
sal_Bool mbIsPlacehlolderShape;
- SVGAttributeWriter* ImplAcquireContext() { maContextStack.Push( mpContext = new SVGAttributeWriter( mrExport, mrFontExport ) ); return mpContext; }
- void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); }
+ SVGAttributeWriter* ImplAcquireContext()
+ {
+ maContextStack.push( mpContext = new SVGAttributeWriter( mrExport, mrFontExport ) );
+ return mpContext;
+ }
+ void ImplReleaseContext()
+ {
+ delete maContextStack.top();
+ maContextStack.pop();
+ mpContext = maContextStack.top();
+ }
long ImplMap( sal_Int32 nVal ) const;
Point& ImplMap( const Point& rPt, Point& rDstPt ) const;
commit 49ac37ddfcd39eef947d4d4d5805e89bfa4ca063
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 19:08:37 2011 +0100
Replace Stack with std::stack< LineInfo* >
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 7d9ec4d..bb5628f 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -29,7 +29,6 @@
#include <algorithm>
#include <string.h>
-#include <tools/stack.hxx>
#include <tools/debug.hxx>
#include <tools/stream.hxx>
#include <vcl/virdev.hxx>
@@ -530,7 +529,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
}
LineInfo aLineInfo( LINE_NONE, 0 );
- Stack aLIStack;
+ ::std::stack< LineInfo* > aLIStack;
VirtualDevice aFontVDev;
rtl_TextEncoding eActualCharSet = osl_getThreadTextEncoding();
sal_Bool bFatLine = sal_False;
@@ -1145,7 +1144,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case( GDI_PUSH_ACTION ):
{
- aLIStack.Push( new LineInfo( aLineInfo ) );
+ aLIStack.push( new LineInfo( aLineInfo ) );
rMtf.AddAction( new MetaPushAction( PUSH_ALL ) );
// #106172# Track font relevant data in shadow VDev
@@ -1156,7 +1155,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case( GDI_POP_ACTION ):
{
- LineInfo* pLineInfo = (LineInfo*) aLIStack.Pop();
+ LineInfo* pLineInfo = aLIStack.top();
+ aLIStack.pop();
// restore line info
if( pLineInfo )
@@ -1353,11 +1353,14 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rIStm.SeekRel( nActionSize - 4L );
break;
}
- }
+ }
- // cleanup push-pop stack if neccessary
- for( void* pLineInfo = aLIStack.Pop(); pLineInfo; pLineInfo = aLIStack.Pop() )
- delete (LineInfo*) pLineInfo;
+ // cleanup push-pop stack if neccessary
+ while( !aLIStack.empty() )
+ {
+ delete aLIStack.top();
+ aLIStack.pop();
+ }
rIStm.SetNumberFormatInt( nOldFormat );
}
commit dc6431f7fde63691a0022bec662e554b0bd432ed
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 19:08:36 2011 +0100
Replace Stack with std::stack< Color* >
diff --git a/vcl/inc/vcl/cvtsvm.hxx b/vcl/inc/vcl/cvtsvm.hxx
index de4158e..370871b 100644
--- a/vcl/inc/vcl/cvtsvm.hxx
+++ b/vcl/inc/vcl/cvtsvm.hxx
@@ -29,6 +29,7 @@
#ifndef _SV_CVTMTF_HXX
#define _SV_CVTMTF_HXX
+#include <stack>
#include <vcl/dllapi.h>
#include <vcl/metaact.hxx>
#include <vcl/gdimtf.hxx>
@@ -91,8 +92,6 @@
// - SVMConverter -
// ----------------
-class Stack;
-
class VCL_PLUGIN_PUBLIC SVMConverter
{
private:
@@ -100,7 +99,7 @@ private:
SAL_DLLPRIVATE void ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf );
SAL_DLLPRIVATE sal_uLong ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
VirtualDevice& rSaveVDev, sal_Bool& rRop_0_1,
- Color& rLineCol, Stack& rLineColStack,
+ Color& rLineCol, ::std::stack<Color*>& rLineColStack,
rtl_TextEncoding& rActualCharSet );
public:
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 92b326c..7d9ec4d 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -1374,7 +1374,7 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf )
sal_Bool bRop_0_1 = sal_False;
VirtualDevice aSaveVDev;
Color aLineCol( COL_BLACK );
- Stack aLineColStack;
+ ::std::stack< Color* > aLineColStack;
rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
@@ -1399,15 +1399,18 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf )
rOStm.SetNumberFormatInt( nOldFormat );
// cleanup push-pop stack if neccessary
- for( void* pCol = aLineColStack.Pop(); pCol; pCol = aLineColStack.Pop() )
- delete (Color*) pCol;
+ while ( !aLineColStack.empty() )
+ {
+ delete aLineColStack.top();
+ aLineColStack.pop();
+ }
}
// ------------------------------------------------------------------------
sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
VirtualDevice& rSaveVDev, sal_Bool& rRop_0_1,
- Color& rLineCol, Stack& rLineColStack,
+ Color& rLineCol, ::std::stack< Color* >& rLineColStack,
rtl_TextEncoding& rActualCharSet )
{
sal_uLong nCount = 0;
@@ -2054,7 +2057,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
case( META_PUSH_ACTION ):
{
ImplWritePushAction( rOStm );
- rLineColStack.Push( new Color( rLineCol ) );
+ rLineColStack.push( new Color( rLineCol ) );
rSaveVDev.Push();
nCount++;
}
@@ -2062,7 +2065,8 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
case( META_POP_ACTION ):
{
- Color* pCol = (Color*) rLineColStack.Pop();
+ Color* pCol = rLineColStack.top();
+ rLineColStack.pop();
if( pCol )
{
commit f5b63844cc6a4b96fcf0db0c0c9c1194847fc914
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 20:08:35 2011 +0100
Replace SmNodeStack with std::stack< SmNode* >
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..0db8cc4 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,35 @@ 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());
+ aReverseStack.pop();
}
else
{
// Ignore odd number of elements.
for (sal_uLong i = 0; i < nCount; i++)
- delete rNodeStack.Pop();
+ {
+ delete rNodeStack.top();
+ rNodeStack.pop();
+ }
}
}
@@ -2524,15 +2563,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 +2593,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 +2613,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 +2675,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..232be48 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,18 @@ 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.pop();
+ m_aNodeStack.push(pSNode);
}
}
@@ -1183,8 +1199,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 +1223,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 +1253,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 +1295,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 +1336,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 +1384,7 @@ void SmParser::Blank()
pBlankNode->Clear();
}
- m_aNodeStack.Push(pBlankNode);
+ m_aNodeStack.push(pBlankNode);
}
@@ -1375,12 +1402,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 +1418,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 +1447,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 +1494,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;
@@ -1518,21 +1545,23 @@ void SmParser::Term()
FontAttribut();
// check if casting in following line is ok
- OSL_ENSURE(!m_aNodeStack.Top()->IsVisible(), "Sm : Ooops...");
+ 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 +1577,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 +1591,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 +1634,7 @@ void SmParser::Escape()
}
SmNode *pNode = new SmMathSymbolNode(m_aCurToken);
- m_aNodeStack.Push(pNode);
+ m_aNodeStack.push(pNode);
NextToken();
}
@@ -1619,13 +1650,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 +1716,7 @@ void SmParser::Oper()
default :
OSL_FAIL("Sm: unknown case");
}
- m_aNodeStack.Push(pNode);
+ m_aNodeStack.push(pNode);
NextToken();
}
@@ -1712,7 +1745,8 @@ void SmParser::UnOper()
case TNROOT :
NextToken();
Power();
- pExtra = m_aNodeStack.Pop();
+ pExtra = m_aNodeStack.top();
+ m_aNodeStack.pop();
break;
case TUOPER :
@@ -1721,7 +1755,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 +1766,8 @@ void SmParser::UnOper()
case TNEG :
case TFACT :
OpSubSup();
- pOper = m_aNodeStack.Pop();
+ pOper = m_aNodeStack.top();
+ m_aNodeStack.pop();
break;
default :
@@ -1740,7 +1776,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 +1811,7 @@ void SmParser::UnOper()
pSNode->SetSubNodes(pOper, pArg);
}
- m_aNodeStack.Push(pSNode);
+ m_aNodeStack.push(pSNode);
}
@@ -1810,7 +1847,7 @@ void SmParser::Attribut()
pSNode->SetSubNodes(pAttr, 0);
pSNode->SetScaleMode(eScaleMode);
- m_aNodeStack.Push(pSNode);
+ m_aNodeStack.push(pSNode);
}
@@ -1825,7 +1862,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 +1901,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 +1922,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 +2013,7 @@ void SmParser::FontSize()
NextToken();
pFontNode->SetSizeParameter(aValue, Type);
- m_aNodeStack.Push(pFontNode);
+ m_aNodeStack.push(pFontNode);
}
@@ -2004,7 +2041,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 +2070,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 +2105,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 +2131,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 +2150,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 +2167,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 +2205,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 +2228,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 +2257,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 +2273,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 +2324,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 +2337,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 +2419,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 +2440,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 +2475,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 +2501,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;
}
commit 6c6bc18961eb74074183a68d8dbea7e4bbefe059
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 20:08:34 2011 +0100
Replace XclExpChTrActionStack with std::stack< XclExpChTrAction* >
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index b3e8009..4997f0e 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -29,8 +29,8 @@
#ifndef SC_XCLEXPCHANGETRACK_HXX
#define SC_XCLEXPCHANGETRACK_HXX
+#include <stack>
#include <tools/datetime.hxx>
-#include <tools/stack.hxx>
#include <rtl/uuid.h>
#include "bigrange.hxx"
#include "chgtrack.hxx"
@@ -601,29 +601,14 @@ public:
};
//___________________________________________________________________
-// XclExpChTrActionStack - temporary action stack
-
-class XclExpChTrActionStack : private Stack
-{
-public:
- virtual ~XclExpChTrActionStack();
-
- void Push( XclExpChTrAction* pNewRec );
- inline XclExpChTrAction* Pop() { return (XclExpChTrAction*) Stack::Pop(); }
-
-private:
- using Stack::Push;
-};
-
-//___________________________________________________________________
// XclExpChangeTrack - exports the "Revision Log" stream
class XclExpChangeTrack : protected XclExpRoot
{
private:
- std::vector<ExcRecord*> aRecList; // list of "Revision Log" stream records
- XclExpChTrActionStack aActionStack;
- XclExpChTrTabIdBuffer* pTabIdBuffer;
+ std::vector<ExcRecord*> aRecList; // list of "Revision Log" stream records
+ std::stack<XclExpChTrAction*> aActionStack;
+ XclExpChTrTabIdBuffer* pTabIdBuffer;
std::vector<XclExpChTrTabIdBuffer*> maBuffers;
ScDocument* pTempDoc; // empty document
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 8ffc516..13c279f 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -1325,21 +1325,6 @@ void XclExpChTr0x014A::SaveXml( XclExpXmlStream& rStrm )
//___________________________________________________________________
-XclExpChTrActionStack::~XclExpChTrActionStack()
-{
- while( XclExpChTrAction* pRec = Pop() )
- delete pRec;
-}
-
-void XclExpChTrActionStack::Push( XclExpChTrAction* pNewRec )
-{
- OSL_ENSURE( pNewRec, "XclExpChTrActionStack::Push - NULL pointer" );
- if( pNewRec )
- Stack::Push( pNewRec );
-}
-
-//___________________________________________________________________
-
class ExcXmlRecord : public ExcRecord
{
public:
@@ -1479,8 +1464,11 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
DateTime aLastDateTime( DateTime::EMPTY );
sal_uInt32 nIndex = 1;
sal_Int32 nLogNumber = 1;
- while( XclExpChTrAction* pAction = aActionStack.Pop() )
+ while( !aActionStack.empty() )
{
+ XclExpChTrAction* pAction = aActionStack.top();
+ aActionStack.pop();
+
if( (nIndex == 1) || pAction->ForceInfoRecord() ||
(pAction->GetUsername() != sLastUsername) ||
(pAction->GetDateTime() != aLastDateTime) )
@@ -1526,6 +1514,12 @@ XclExpChangeTrack::~XclExpChangeTrack()
for ( pIter = maBuffers.begin(); pIter != maBuffers.end(); ++pIter )
delete *pIter;
+ while( !aActionStack.empty() )
+ {
+ delete aActionStack.top();
+ aActionStack.pop();
+ }
+
if( pTempDoc )
delete pTempDoc;
}
@@ -1592,7 +1586,7 @@ void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction )
default:;
}
if( pXclAction )
- aActionStack.Push( pXclAction );
+ aActionStack.push( pXclAction );
}
sal_Bool XclExpChangeTrack::WriteUserNamesStream()
commit ecfcc545433d30e3b70fd0c909cce782edbdee39
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 20:08:33 2011 +0100
Replace Stack with std::stack< std::pair< XclObj*, XclEscherHostAppData* > >
diff --git a/sc/source/filter/inc/xcl97esc.hxx b/sc/source/filter/inc/xcl97esc.hxx
index df7c09d..a2af601 100644
--- a/sc/source/filter/inc/xcl97esc.hxx
+++ b/sc/source/filter/inc/xcl97esc.hxx
@@ -30,8 +30,8 @@
#define SC_XCL97ESC_HXX
#include <memory>
+#include <stack>
#include <tools/table.hxx>
-#include <tools/stack.hxx>
#include <filter/msfilter/escherex.hxx>
#include "xlescher.hxx"
#include "xeroot.hxx"
@@ -149,7 +149,7 @@ private:
private:
XclExpObjectManager& mrObjMgr;
- Stack aStack;
+ std::stack< std::pair< XclObj*, XclEscherHostAppData* > > aStack;
XclObj* pCurrXclObj;
XclEscherHostAppData* pCurrAppData;
XclEscherClientData* pTheClientData; // always the same
diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx
index 50b7e9e..207a37d 100644
--- a/sc/source/filter/xcl97/xcl97esc.cxx
+++ b/sc/source/filter/xcl97/xcl97esc.cxx
@@ -115,7 +115,7 @@ XclEscherEx::XclEscherEx( const XclExpRoot& rRoot, XclExpObjectManager& rObjMgr,
XclEscherEx::~XclEscherEx()
{
- OSL_ENSURE( !aStack.Count(), "~XclEscherEx: stack not empty" );
+ OSL_ENSURE( !aStack.empty(), "~XclEscherEx: stack not empty" );
DeleteCurrAppData();
delete pTheClientData;
}
@@ -207,8 +207,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
UpdateDffFragmentEnd();
}
}
- aStack.Push( pCurrXclObj );
- aStack.Push( pCurrAppData );
+ aStack.push( std::make_pair( pCurrXclObj, pCurrAppData ) );
pCurrAppData = new XclEscherHostAppData;
SdrObject* pObj = GetSdrObjectFromXShape( rxShape );
if ( !pObj )
@@ -347,8 +346,9 @@ void XclEscherEx::EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID )
// get next object from stack
DeleteCurrAppData();
- pCurrAppData = static_cast< XclEscherHostAppData* >( aStack.Pop() );
- pCurrXclObj = static_cast< XclObj* >( aStack.Pop() );
+ pCurrXclObj = aStack.top().first;
+ pCurrAppData = aStack.top().second;
+ aStack.pop();
if( nAdditionalText == 3 )
nAdditionalText = 0;
}
commit 149c1746a1e2ee0557c72c067fe6fe79f0781c4d
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 20:08:32 2011 +0100
Replace Stack with std::stack< bool >
diff --git a/sc/source/filter/xml/xmlfilti.hxx b/sc/source/filter/xml/xmlfilti.hxx
index 92a094c..bb30101 100644
--- a/sc/source/filter/xml/xmlfilti.hxx
+++ b/sc/source/filter/xml/xmlfilti.hxx
@@ -36,7 +36,6 @@
#include <com/sun/star/sheet/FilterOperator.hpp>
#include <com/sun/star/sheet/FilterOperator2.hpp>
#include <com/sun/star/sheet/TableFilterField2.hpp>
-#include <tools/stack.hxx>
#include "xmldrani.hxx"
#include "xmldpimp.hxx"
@@ -228,7 +227,7 @@ class ScXMLDPFilterContext : public SvXMLImportContext
bool bConnectionOr;
bool bNextConnectionOr;
bool bConditionSourceRange;
- Stack aConnectionOrStack;
+ ::std::stack<bool> aConnectionOrStack;
const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
@@ -252,10 +251,23 @@ public:
void SetIsCaseSensitive(const bool bTemp) { bIsCaseSensitive = bTemp; }
void SetUseRegularExpressions(const bool bTemp) { if (!bUseRegularExpressions) bUseRegularExpressions = bTemp;}
- void OpenConnection(const bool bTemp) { bool* pTemp = new bool; *pTemp = bConnectionOr;
- bConnectionOr = bNextConnectionOr; bNextConnectionOr = bTemp;
- aConnectionOrStack.Push(pTemp);}
- void CloseConnection() { bool* pTemp = static_cast <bool*> (aConnectionOrStack.Pop()); bConnectionOr = *pTemp; bNextConnectionOr = *pTemp; delete pTemp;}
+
+ void OpenConnection(const bool bVal)
+ {
+ bool bTemp = bConnectionOr;
+ bConnectionOr = bNextConnectionOr;
+ bNextConnectionOr = bVal;
+ aConnectionOrStack.push(bTemp);
+ }
+
+ void CloseConnection()
+ {
+ bool bTemp = aConnectionOrStack.top();
+ aConnectionOrStack.pop();
+ bConnectionOr = bTemp;
+ bNextConnectionOr = bTemp;
+ }
+
bool GetConnection() { bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; }
void AddFilterField (const ScQueryEntry& aFilterField);
};
commit 0158333f1b8d578cc56dc51c3e3f8daf0578210b
Author: Marcel Metz <mmetz at adrian-broher.net>
Date: Mon Dec 5 20:08:31 2011 +0100
Replace ScChangeTrackMsgStack with std::stack< ScChangeTrackMsgInfo* >
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 11159ed..5dc02d8 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -30,11 +30,11 @@
#define SC_CHGTRACK_HXX
#include <deque>
+#include <stack>
#include <tools/string.hxx>
#include <tools/datetime.hxx>
#include <tools/table.hxx>
-#include <tools/stack.hxx>
#include <tools/mempool.hxx>
#include <tools/link.hxx>
#include <unotools/options.hxx>
@@ -689,8 +689,6 @@ enum ScChangeActionContentCellType
SC_CACCT_MATREF
};
-class Stack;
-
class ScChangeActionContent : public ScChangeAction
{
friend class ScChangeTrack;
@@ -779,7 +777,7 @@ class ScChangeActionContent : public ScChangeAction
// pRejectActions!=NULL: reject actions get
// stacked, no SetNewValue, no Append
sal_Bool Select( ScDocument*, ScChangeTrack*,
- sal_Bool bOldest, Stack* pRejectActions );
+ sal_Bool bOldest, ::std::stack<ScChangeActionContent*>* pRejectActions );
void PutValueToDoc( ScBaseCell*, const String&,
ScDocument*, SCsCOL nDx, SCsROW nDy ) const;
@@ -901,8 +899,6 @@ public:
// --- ScChangeActionReject -------------------------------------------------
-class Stack;
-
class ScChangeActionReject : public ScChangeAction
{
friend class ScChangeTrack;
@@ -955,7 +951,7 @@ struct ScChangeTrackMsgInfo
// MsgQueue for notification via ModifiedLink
typedef std::deque<ScChangeTrackMsgInfo*> ScChangeTrackMsgQueue;
-DECLARE_STACK( ScChangeTrackMsgStack, ScChangeTrackMsgInfo* )
+typedef std::stack<ScChangeTrackMsgInfo*> ScChangeTrackMsgStack;
enum ScChangeTrackMergeState
{
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index f047773..a94b0d3 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -29,7 +29,6 @@
#include <tools/shl.hxx> // SHL_CALC
-#include <tools/stack.hxx>
#include <tools/rtti.hxx>
#include <svl/zforlist.hxx>
#include <svl/itemset.hxx>
@@ -53,13 +52,9 @@
#include "globstr.hrc"
-#include <stack>
-
#define SC_CHGTRACK_CXX
#include "chgtrack.hxx"
-DECLARE_STACK( ScChangeActionStack, ScChangeAction* )
-
const sal_uInt16 nMemPoolChangeActionCellListEntry = (0x2000 - 64) / sizeof(ScChangeActionCellListEntry);
IMPL_FIXEDMEMPOOL_NEWDEL( ScChangeActionCellListEntry, nMemPoolChangeActionCellListEntry, nMemPoolChangeActionCellListEntry )
@@ -1520,7 +1515,7 @@ sal_Bool ScChangeActionContent::Reject( ScDocument* pDoc )
sal_Bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack,
- sal_Bool bOldest, Stack* pRejectActions )
+ sal_Bool bOldest, ::std::stack<ScChangeActionContent*>* pRejectActions )
{
if ( !aBigRange.IsValid( pDoc ) )
return false;
@@ -1565,7 +1560,7 @@ sal_Bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack,
pNew->SetRejectAction( bOldest ? GetActionNumber() : pEnd->GetActionNumber() );
pNew->SetState( SC_CAS_ACCEPTED );
if ( pRejectActions )
- pRejectActions->Push( pNew );
+ pRejectActions->push( pNew );
else
{
pNew->SetNewValue( pDoc->GetCell( rPos ), pDoc );
@@ -2147,11 +2142,16 @@ void ScChangeTrack::ClearMsgQueue()
delete pBlockModifyMsg;
pBlockModifyMsg = NULL;
}
- ScChangeTrackMsgInfo* pMsgInfo;
- while ( ( pMsgInfo = aMsgStackTmp.Pop() ) != NULL )
- delete pMsgInfo;
- while ( ( pMsgInfo = aMsgStackFinal.Pop() ) != NULL )
- delete pMsgInfo;
+ while ( !aMsgStackTmp.empty() )
+ {
+ delete aMsgStackTmp.top();
+ aMsgStackTmp.pop();
+ }
+ while ( !aMsgStackFinal.empty() )
+ {
+ delete aMsgStackFinal.top();
+ aMsgStackFinal.pop();
+ }
ScChangeTrackMsgQueue::iterator itQueue;
for ( itQueue = aMsgQueue.begin(); itQueue != aMsgQueue.end(); ++itQueue)
@@ -2218,7 +2218,7 @@ void ScChangeTrack::StartBlockModify( ScChangeTrackMsgType eMsgType,
if ( aModifiedLink.IsSet() )
{
if ( pBlockModifyMsg )
- aMsgStackTmp.Push( pBlockModifyMsg ); // Block im Block
+ aMsgStackTmp.push( pBlockModifyMsg ); // Block im Block
pBlockModifyMsg = new ScChangeTrackMsgInfo;
pBlockModifyMsg->eMsgType = eMsgType;
pBlockModifyMsg->nStartAction = nStartAction;
@@ -2236,19 +2236,20 @@ void ScChangeTrack::EndBlockModify( sal_uLong nEndAction )
{
pBlockModifyMsg->nEndAction = nEndAction;
// Blocks in Blocks aufgeloest
- aMsgStackFinal.Push( pBlockModifyMsg );
+ aMsgStackFinal.push( pBlockModifyMsg );
}
else
delete pBlockModifyMsg;
- pBlockModifyMsg = aMsgStackTmp.Pop(); // evtl. Block im Block
+ pBlockModifyMsg = aMsgStackTmp.top(); // evtl. Block im Block
+ aMsgStackTmp.pop();
}
if ( !pBlockModifyMsg )
{
sal_Bool bNew = false;
- ScChangeTrackMsgInfo* pMsg;
- while ( ( pMsg = aMsgStackFinal.Pop() ) != NULL )
+ while ( !aMsgStackFinal.empty() )
{
- aMsgQueue.push_back( pMsg );
+ aMsgQueue.push_back( aMsgStackFinal.top() );
+ aMsgStackFinal.pop();
bNew = sal_True;
}
if ( bNew )
@@ -3850,10 +3851,15 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
sal_Bool bIsDelete = pAct->IsDeleteType();
sal_Bool bIsMasterDelete = ( bListMasterDelete && pAct->IsMasterDelete() );
- const ScChangeAction* pCur = pAct;
- ScChangeActionStack* pStack = new ScChangeActionStack;
- do
+ const ScChangeAction* pCur = NULL;
+ ::std::stack<ScChangeAction*> cStack;
+ cStack.push(pAct);
+
+ while ( !cStack.empty() )
{
+ pCur = cStack.top();
+ cStack.pop();
+
if ( pCur->IsInsertType() )
{
const ScChangeActionLinkEntry* pL = pCur->GetFirstDependentEntry();
@@ -3867,7 +3873,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
sal_uLong n = p->GetActionNumber();
if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
if ( p->HasDependent() )
- pStack->Push( p );
+ cStack.push( p );
}
else
{
@@ -3915,7 +3921,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
if ( p->HasDeleted() ||
p->GetType() == SC_CAT_CONTENT )
- pStack->Push( p );
+ cStack.push( p );
}
else
{
@@ -3946,7 +3952,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
// nur ein TopContent einer Kette ist in LinkDeleted
if ( bAllFlat && (p->HasDeleted() ||
p->GetType() == SC_CAT_CONTENT) )
- pStack->Push( p );
+ cStack.push( p );
}
pL = pL->GetNext();
}
@@ -3963,7 +3969,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
sal_uLong n = p->GetActionNumber();
if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
if ( p->HasDependent() || p->HasDeleted() )
- pStack->Push( p );
+ cStack.push( p );
}
else
{
@@ -4007,7 +4013,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
sal_uLong n = p->GetActionNumber();
if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
if ( p->HasDependent() )
- pStack->Push( p );
+ cStack.push( p );
}
else
rTable.Insert( p->GetActionNumber(), p );
@@ -4022,11 +4028,10 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
ScChangeAction* p = GetAction(
((ScChangeActionReject*)pCur)->GetRejectAction() );
if ( p != pAct && !rTable.Get( p->GetActionNumber() ) )
- pStack->Push( p );
+ cStack.push( p );
}
}
- } while ( ( pCur = pStack->Pop() ) != NULL );
- delete pStack;
+ }
}
@@ -4071,7 +4076,7 @@ sal_Bool ScChangeTrack::SelectContent( ScChangeAction* pAct, sal_Bool bOldest )
if ( pContent->HasDependent() )
{
sal_Bool bOk = sal_True;
- Stack aRejectActions;
+ ::std::stack<ScChangeActionContent*> aRejectActions;
const ScChangeActionLinkEntry* pL = pContent->GetFirstDependentEntry();
while ( pL )
{
@@ -4096,8 +4101,10 @@ sal_Bool ScChangeTrack::SelectContent( ScChangeAction* pAct, sal_Bool bOldest )
// now the matrix is inserted and new content values are ready
ScChangeActionContent* pNew;
- while ( ( pNew = (ScChangeActionContent*) aRejectActions.Pop() ) != NULL )
+ while ( !aRejectActions.empty() )
{
+ pNew = aRejectActions.top();
+ aRejectActions.pop();
ScAddress aPos( pNew->GetBigRange().aStart.MakeAddress() );
pNew->SetNewValue( pDoc->GetCell( aPos ), pDoc );
Append( pNew );
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index 3fb4883..b3e8009 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -30,6 +30,7 @@
#define SC_XCLEXPCHANGETRACK_HXX
#include <tools/datetime.hxx>
+#include <tools/stack.hxx>
#include <rtl/uuid.h>
#include "bigrange.hxx"
#include "chgtrack.hxx"
More information about the Libreoffice-commits
mailing list