merge the formfield patch from ooo-build
[ooovba.git] / rsc / source / parser / rsclex.hxx
blobbf541de51ebc62ac4ed6007ccbfab00517210079
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rsclex.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include <tools/stack.hxx>
32 #include <hash_set>
33 #include <rtl/strbuf.hxx>
34 #include <rtl/string.hxx>
36 // a buffer for unique strings
37 class StringContainer
39 std::hash_set< rtl::OString, rtl::OStringHash > m_aStrings;
40 public:
41 StringContainer() {}
42 ~StringContainer() {}
44 const char* putString( const char* pString );
48 enum MODE_ENUM { MODE_MODELESS, MODE_APPLICATIONMODAL, MODE_SYSTEMMODAL };
50 enum JUSTIFY_ENUM { JUST_CENTER, JUST_RIGHT, JUST_LEFT };
52 enum SHOW_ENUM { SHOW_NORMAL, SHOW_MINIMIZED, SHOW_MAXIMIZED };
54 enum ENUMHEADER { HEADER_NAME, HEADER_NUMBER };
56 enum REF_ENUM { TYPE_NOTHING, TYPE_REF, TYPE_COPY };
58 struct RSCHEADER {
59 RscTop * pClass;
60 RscExpType nName1;
61 REF_ENUM nTyp;
62 RscTop * pRefClass;
63 RscExpType nName2;
66 /************** O b j e c t s t a c k ************************************/
67 struct Node {
68 Node* pPrev;
69 RSCINST aInst;
70 sal_uInt32 nTupelRec; // Rekursionstiefe fuer Tupel
71 Node() { pPrev = NULL; nTupelRec = 0; };
74 class ObjectStack {
75 private :
76 Node* pRoot;
77 public :
79 ObjectStack () { pRoot = NULL; }
81 const RSCINST & Top () { return pRoot->aInst; }
82 BOOL IsEmpty() { return( pRoot == NULL ); }
83 void IncTupelRec() { pRoot->nTupelRec++; }
84 void DecTupelRec() { pRoot->nTupelRec--; }
85 sal_uInt32 TupelRecCount() const { return pRoot->nTupelRec; }
86 void Push( RSCINST aInst )
88 Node* pTmp;
90 pTmp = pRoot;
91 pRoot = new Node;
92 pRoot->aInst = aInst;
93 pRoot->pPrev = pTmp;
95 void Pop()
97 Node* pTmp;
99 pTmp = pRoot;
100 pRoot = pTmp->pPrev;
101 delete pTmp;
105 /****************** F o r w a r d s **************************************/
106 #if defined( RS6000 )
107 extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion
108 extern "C" void yyerror( char * );
109 extern "C" int yylex( void );
110 #elif defined( HP9000 ) || defined( SCO ) || defined ( IRIX ) || defined ( SOLARIS )
111 extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion
112 extern "C" void yyerror( const char * );
113 extern "C" int yylex( void );
114 #else
115 #if defined ( WTC ) || defined ( GCC ) || (_MSC_VER >= 1400)
116 int yyparse(); // forward Deklaration fuer erzeugte Funktion
117 #else
118 yyparse(); // forward Deklaration fuer erzeugte Funktion
119 #endif
120 void yyerror( char * );
121 int yylex( void );
122 #endif
124 class RscTypCont;
125 class RscFileInst;
127 extern RscTypCont* pTC;
128 extern RscFileInst * pFI;
129 extern RscExpression * pExp;
130 extern ObjectStack S;
131 extern StringContainer* pStringContainer;