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