diff options
Diffstat (limited to 'rsc/inc')
-rw-r--r-- | rsc/inc/pch/precompiled_rsc.cxx | 31 | ||||
-rw-r--r-- | rsc/inc/pch/precompiled_rsc.hxx | 34 | ||||
-rw-r--r-- | rsc/inc/rsc/rscsfx.hxx | 65 | ||||
-rw-r--r-- | rsc/inc/rscall.h | 115 | ||||
-rw-r--r-- | rsc/inc/rscarray.hxx | 139 | ||||
-rw-r--r-- | rsc/inc/rscclass.hxx | 133 | ||||
-rw-r--r-- | rsc/inc/rscclobj.hxx | 99 | ||||
-rw-r--r-- | rsc/inc/rscconst.hxx | 113 | ||||
-rw-r--r-- | rsc/inc/rsccont.hxx | 156 | ||||
-rw-r--r-- | rsc/inc/rscdb.hxx | 359 | ||||
-rw-r--r-- | rsc/inc/rscdef.hxx | 267 | ||||
-rw-r--r-- | rsc/inc/rscerror.h | 165 | ||||
-rw-r--r-- | rsc/inc/rscflag.hxx | 109 | ||||
-rw-r--r-- | rsc/inc/rschash.hxx | 56 | ||||
-rw-r--r-- | rsc/inc/rscinst.hxx | 245 | ||||
-rw-r--r-- | rsc/inc/rsckey.hxx | 62 | ||||
-rw-r--r-- | rsc/inc/rsclex.hxx | 131 | ||||
-rw-r--r-- | rsc/inc/rsclst.hxx | 65 | ||||
-rw-r--r-- | rsc/inc/rscmgr.hxx | 82 | ||||
-rw-r--r-- | rsc/inc/rscpar.hxx | 92 | ||||
-rw-r--r-- | rsc/inc/rscrange.hxx | 212 | ||||
-rw-r--r-- | rsc/inc/rscrsc.hxx | 129 | ||||
-rw-r--r-- | rsc/inc/rscstr.hxx | 82 | ||||
-rw-r--r-- | rsc/inc/rsctools.hxx | 224 | ||||
-rw-r--r-- | rsc/inc/rsctop.hxx | 249 | ||||
-rw-r--r-- | rsc/inc/rsctree.hxx | 121 | ||||
-rw-r--r-- | rsc/inc/vclrsc.hxx | 176 |
27 files changed, 3711 insertions, 0 deletions
diff --git a/rsc/inc/pch/precompiled_rsc.cxx b/rsc/inc/pch/precompiled_rsc.cxx new file mode 100644 index 000000000000..a8edf6962a99 --- /dev/null +++ b/rsc/inc/pch/precompiled_rsc.cxx @@ -0,0 +1,31 @@ +/* -*- 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. + * + ************************************************************************/ + +#include "precompiled_rsc.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/pch/precompiled_rsc.hxx b/rsc/inc/pch/precompiled_rsc.hxx new file mode 100644 index 000000000000..051d99585bba --- /dev/null +++ b/rsc/inc/pch/precompiled_rsc.hxx @@ -0,0 +1,34 @@ +/* -*- 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:55.014369 + +#ifdef PRECOMPILED_HEADERS +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rsc/rscsfx.hxx b/rsc/inc/rsc/rscsfx.hxx new file mode 100644 index 000000000000..36babfb8c520 --- /dev/null +++ b/rsc/inc/rsc/rscsfx.hxx @@ -0,0 +1,65 @@ +/* -*- 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 _RSCSFX_HXX +#define _RSCSFX_HXX + +// StarView (RSC_NOTYPE) bis (RSC_NOTYPE + 0x190) +// Sfx (RSC_NOTYPE + 0x200) bis (RSC_NOTYPE + 0x20F) +#define RSC_SFX_STYLE_FAMILIES (0x100 + 0x201) +#define RSC_SFX_STYLE_FAMILY_ITEM (0x100 + 0x202) +#define RSC_SFX_SLOT_INFO (0x100 + 0x203) +// StarMoney (RSC_NOTYPE + 0x210) bis (RSC_NOTYPE + 0x22F) +// Public (RSC_NOTYPE + 0x300) bis (RSC_NOTYPE + 0x3FF) + +//========== S F X ======================================= +enum SfxStyleFamily { SFX_STYLE_FAMILY_CHAR = 1, + SFX_STYLE_FAMILY_PARA = 2, + SFX_STYLE_FAMILY_FRAME = 4, + SFX_STYLE_FAMILY_PAGE = 8, + SFX_STYLE_FAMILY_PSEUDO = 16, + SFX_STYLE_FAMILY_ALL = 0x7fff + }; + + +// SfxTemplateDialog +#define RSC_SFX_STYLE_ITEM_LIST 0x1 +#define RSC_SFX_STYLE_ITEM_BITMAP 0x2 +#define RSC_SFX_STYLE_ITEM_TEXT 0x4 +#define RSC_SFX_STYLE_ITEM_HELPTEXT 0x8 +#define RSC_SFX_STYLE_ITEM_STYLEFAMILY 0x10 +#define RSC_SFX_STYLE_ITEM_IMAGE 0x20 + + +// SfxSlotInfo +#define RSC_SFX_SLOT_INFO_SLOTNAME 0x1 +#define RSC_SFX_SLOT_INFO_HELPTEXT 0x2 + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscall.h b/rsc/inc/rscall.h new file mode 100644 index 000000000000..fed155cc90d3 --- /dev/null +++ b/rsc/inc/rscall.h @@ -0,0 +1,115 @@ +/* -*- 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 _RSCALL_H +#define _RSCALL_H + +#include <tools/string.hxx> +#include <rsctools.hxx> +#include <rscerror.h> +#include <rscdef.hxx> +#include <rschash.hxx> +#include <rtl/alloc.h> + +/******************* T y p e s *******************************************/ +typedef char * CLASS_DATA; // Zeiger auf die Daten einer Klasse + +/******************* C l a s s e s F o r w a r d s *********************/ +class RscCompiler; +class RscTop; +class RscTypCont; +class RscIncList; + +/******************* G l o b a l V a r i a b l e s *********************/ +extern ByteString* pStdParType; +extern ByteString* pStdPar1; +extern ByteString* pStdPar2; +extern ByteString* pWinParType; +extern ByteString* pWinPar1; +extern ByteString* pWinPar2; +extern sal_uInt32 nRefDeep; +extern sal_uInt32 nRsc_XYMAPMODEId; +extern sal_uInt32 nRsc_WHMAPMODEId; +extern sal_uInt32 nRsc_X; +extern sal_uInt32 nRsc_Y; +extern sal_uInt32 nRsc_WIDTH; +extern sal_uInt32 nRsc_HEIGHT; +extern sal_uInt32 nRsc_DELTALANG; +extern sal_uInt32 nRsc_DELTASYSTEM; +extern sal_uInt32 nRsc_EXTRADATA; +extern AtomContainer* pHS; + +/******************* D e f i n e s ***************************************/ + +#define HELP_FLAG 0x0001 // Hilfe anzeigen +#define NOPREPRO_FLAG 0x0002 // kein Preprozesor +#define NOSYNTAX_FLAG 0x0004 // keine Syntaxanalyse +#define NOLINK_FLAG 0x0008 // nicht linken +#define NORESFILE_FLAG 0x0010 // keine .res-Datei erzeugen +#define DEFINE_FLAG 0x0020 // es wurde Definitionen angegeben +#define INCLUDE_FLAG 0x0040 // der Include-Pfad wurde erweitert +#define MSCPREPRO_FLAG 0x0080 // spezial Preprozessor +#define PRINTSYNTAX_FLAG 0x0100 // Syntax ausgeben +#define PRELOAD_FLAG 0x0200 // Alle Ressourcen Preloaden +#define SMART_FLAG 0x0400 // abgekuertze Name +#define SRSDEFAULT_FLAG 0x1000 // immer der Default geschrieben +#define NOSYSRESTEST_FLAG 0x2000 // ueberprueft nicht die Richtigkeit von (bmp, ico, cur) + + +/******************* T y p e s *******************************************/ +enum RSCCLASS_TYPE { RSCCLASS_BOOL, RSCCLASS_STRING, RSCCLASS_NUMBER, + RSCCLASS_CONST, RSCCLASS_COMPLEX, RSCCLASS_ENUMARRAY }; + +typedef void (* VarEnumCallbackProc)( void * pData, RSCCLASS_TYPE, Atom ); + +/******************* S t r u c t s ***************************************/ +struct RSCINST { + RscTop * pClass; + CLASS_DATA pData; + + RSCINST(){ pClass = NULL; pData = NULL; } + RSCINST( RscTop * pCl, CLASS_DATA pClassData ){ + pClass = pCl; + pData = pClassData; + } + sal_Bool IsInst() const { return( pData != NULL ); } +}; + +/********************** S U B I N F O S T R U C T ************************/ +struct SUBINFO_STRUCT { + SUBINFO_STRUCT(){ nPos = 0; pClass = NULL; }; + RscId aId; // Identifier der Resource + sal_uInt32 nPos; // Position der Resource + RscTop * pClass; // Klasse des Eintrages +}; + +/******************* F u n c t i o n *************************************/ +void InitRscCompiler(); + +#endif // _RSCALL_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscarray.hxx b/rsc/inc/rscarray.hxx new file mode 100644 index 000000000000..52ef742b55f7 --- /dev/null +++ b/rsc/inc/rscarray.hxx @@ -0,0 +1,139 @@ +/* -*- 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 _RSCARRAY_HXX +#define _RSCARRAY_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rsctop.hxx> + +class RscEnum; + +/******************* R s c A r r a y ************************************/ +class RscInstNode : public IdNode +{ + sal_uInt32 nTypeId; +protected: + using NameNode::Search; +public: + RSCINST aInst; + RscInstNode( sal_uInt32 nId ); + ~RscInstNode(); + virtual sal_uInt32 GetId() const; + RscInstNode * Left() const { return (RscInstNode *)pLeft ; }; + RscInstNode * Right() const{ return (RscInstNode *)pRight ; }; + RscInstNode * Search( sal_uInt32 nId ) const + { + return (RscInstNode *)IdNode::Search( nId ); + } +}; + +struct RscArrayInst +{ + RscInstNode * pNode; +}; + +/* Der Baum wird ueber die Werte des Enums sortiert, nicht ueber + seine HashId. +*/ +class RscArray : public RscTop +{ +protected: + RscEnum * pTypeClass; // Typ der Eintraege + sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse + // mit Superklassen + sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten + void WriteSrcArray( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); +public: + RscArray( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper, RscEnum * pTypeClass ); + ~RscArray(); + virtual RSCCLASS_TYPE GetClassType() const; + + void SetTypeClass( RscEnum * pClass ) + { + pTypeClass = pClass; + } + virtual RscTop * GetTypeClass() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + void Destroy( const RSCINST & rInst ); + virtual ERRTYPE GetValueEle( const RSCINST & rInst, sal_Int32 lValue, + RscTop * pCreateClass, + RSCINST * pGetInst ); + virtual ERRTYPE GetArrayEle( const RSCINST & rInst, Atom nId, + RscTop * pCreateClass, + RSCINST * pGetInst ); + + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 Size(){ return( nSize ); }; + + sal_Bool IsConsistent( const RSCINST & rInst ); + virtual void SetToDefault( const RSCINST & rInst ); + sal_Bool IsDefault( const RSCINST & rInst ); + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, + const RscId & aId, const char * ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +class RscClassArray : public RscArray +{ +public: + RscClassArray( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper, RscEnum * pTypeClass ); + ~RscClassArray(); + virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, + const RscId & aId, const char * ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & aId, + sal_uInt32 nDeep, sal_Bool bExtra ); +}; + + +class RscLangArray : public RscArray +{ +public: + RscLangArray( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper, RscEnum * pTypeClass ); + virtual RSCCLASS_TYPE GetClassType() const; +}; + +#endif //_RSCARRAY + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscclass.hxx b/rsc/inc/rscclass.hxx new file mode 100644 index 000000000000..36bc5be7c4ca --- /dev/null +++ b/rsc/inc/rscclass.hxx @@ -0,0 +1,133 @@ +/* -*- 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 _RSCCLASS_HXX +#define _RSCCLASS_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> + +/******************* R s c C l a s s *************************************/ +class RscClass : public RscTop +{ +protected: + struct RscClassInst{ + sal_uLong nVarDflt; + }; + struct VARTYPE_STRUCT { + Atom nVarName; // Variablenname + RSCVAR nVarType; // Variablentyp + sal_uInt32 nMask; // Maskierungsbit + sal_uInt32 nOffset; // Beginn der Instanzdaten + RscTop * pClass; // Klasse + CLASS_DATA pDefault; // Zeiger auf DefaultDaten + Atom nDataBaseName;//Name fuer Fremddatenbereich + }; + sal_uInt32 nSuperSize; // Groesse der Instanzdaten der SuperKl. + sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse + // mit Superklassen + sal_uInt32 nEntries; // Eintraege in pVarTypeList + VARTYPE_STRUCT * pVarTypeList; // Variablenliste + RSCINST GetInstData( CLASS_DATA pData, sal_uInt32 nEle, + sal_Bool bGetCopy = sal_False ); + CLASS_DATA GetDfltData( sal_uInt32 nEle ); + sal_Bool IsDflt( CLASS_DATA pData, sal_uInt32 nEle ); + sal_Bool IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle ); + void SetVarDflt( CLASS_DATA pData, sal_uInt32 nEle, + sal_Bool bSet ); + sal_Int32 GetCorrectValues( const RSCINST & rInst, sal_uInt32 nVarPos, + sal_uInt32 nTupelIdx, RscTypCont * pTC ); +public: + RscClass( Atom nId, sal_uInt32 nTypId, RscTop * pSuperCl ); + ~RscClass(); + + virtual RSCCLASS_TYPE GetClassType() const; + + void Pre_dtor(); + ERRTYPE SetVariable( Atom nVarName, RscTop * pClass, + RSCINST * pDflt, + RSCVAR nVarType, sal_uInt32 nMask, + Atom nDataBaseName ); + virtual void EnumVariables( void * pData, VarEnumCallbackProc ); + RSCINST GetVariable( const RSCINST & rInst, Atom nVarName, + const RSCINST & rInitInst, + sal_Bool nInitDflt = sal_False, + RscTop * pCreateClass = NULL ); + RSCINST GetCopyVar( const RSCINST & rInst, Atom nVarName ); + + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 Size(){ return( nSize ); }; + + sal_Bool IsConsistent( const RSCINST & rInst ); + void SetToDefault( const RSCINST & rInst ); + sal_Bool IsDefault( const RSCINST & rInst ); + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + void SetDefault( const RSCINST & rData, Atom nVarId ); + using RscTop::GetDefault; + RSCINST GetDefault( Atom nVarId ); + + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + void Destroy( const RSCINST & rInst ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteInstRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + void WriteSyntax( FILE * fOutput, RscTypCont * pTC ); + + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + void WriteRcCtor( FILE * fOutput, RscTypCont * pTC ); +}; + +class RscSysDepend : public RscClass +{ +public: + RscSysDepend( Atom nId, sal_uInt32 nTypId, RscTop * pSuper ); + ERRTYPE WriteSysDependRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra, + sal_Bool bFirst = sal_False ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); +}; + +class RscTupel : public RscClass +{ +public: + RscTupel( Atom nId, sal_uInt32 nTypId, RscTop * pSuper ); + RSCINST GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos, + const RSCINST & rInitInst ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); +}; + +#endif //_RSCCLASS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscclobj.hxx b/rsc/inc/rscclobj.hxx new file mode 100644 index 000000000000..3a6006501b7a --- /dev/null +++ b/rsc/inc/rscclobj.hxx @@ -0,0 +1,99 @@ +/* -*- 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 _RSCCLOBJ_HXX +#define _RSCCLOBJ_HXX + +#include <rsctree.hxx> +#include <rscdef.hxx> +#include <rscall.h> + +/******************* O b j N o d e ***************************************/ +class ObjNode : public IdNode{ + RscId aRscId; // Id der Resource + CLASS_DATA pRscObj;// pointer to a resourceobject + sal_uLong lFileKey;// Dateischluessel +protected: + using NameNode::Search; + +public: + using NameNode::Insert; + + ObjNode( const RscId & rId, CLASS_DATA pData, sal_uLong lKey ); + ObjNode * DelObjNode( RscTop * pClass, sal_uLong lFileKey ); + sal_uInt32 GetId() const; + RscId GetRscId(){ return( aRscId ); } + sal_uLong GetFileKey(){ return lFileKey; }; + ObjNode* Search( const RscId &rName ) const{ + // search the index in the b-tree + return( (ObjNode *)IdNode::Search( rName ) ); + } + sal_Bool Insert( ObjNode* pTN ){ + // insert a new node in the b-tree + return( IdNode::Insert( (IdNode *)pTN ) ); + } + CLASS_DATA GetRscObj(){ + // get the Object from this Node + return( pRscObj ); + } + sal_Bool IsConsistent(); +}; + +/******************* R e f N o d e ***************************************/ +class RefNode : public IdNode{ + Atom nTypNameId; // index of a Name in a hashtabel +protected: + using NameNode::Search; + +public: + using NameNode::Insert; + + ObjNode* pObjBiTree; // Zeiger auf Objektbaum + RefNode( Atom nTyp ); + sal_uInt32 GetId() const; + RefNode* Search( Atom typ ) const{ + // search the index in the b-tree + return( (RefNode *)IdNode::Search( typ ) ); + }; + sal_Bool Insert( RefNode* pTN ){ + // insert a new node in the b-tree + return( IdNode::Insert( (IdNode *)pTN ) ); + }; + sal_Bool PutObjNode( ObjNode * pPutObject ); + + // insert new node in b-tree pObjBiTree + ObjNode * GetObjNode( const RscId &rRscId ); + + ObjNode * GetObjNode(){ + // hole pObjBiTree + return( pObjBiTree ); + }; +}; + +#endif // _RSCCLOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscconst.hxx b/rsc/inc/rscconst.hxx new file mode 100644 index 000000000000..d1ebeeff87d3 --- /dev/null +++ b/rsc/inc/rscconst.hxx @@ -0,0 +1,113 @@ +/* -*- 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 _RSCCONST_HXX +#define _RSCCONST_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> + +/******************* R s c C o n s t *************************************/ +class RscConst : public RscTop +{ +protected: + struct VarEle { + Atom nId; // Name der Konstante + sal_Int32 lValue; // Wert der Konstante + }; + VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten + sal_uInt32 nEntries; // Anzahle der Eintraege im Feld +public: + RscConst( Atom nId, sal_uInt32 nTypId ); + ~RscConst(); + virtual RSCCLASS_TYPE GetClassType() const; + sal_uInt32 GetEntryCount() const { return nEntries; } + // Die erlaubten Werte werden gesetzt + ERRTYPE SetConstant( Atom nVarName, sal_Int32 lValue ); + Atom GetConstant( sal_uInt32 nPos ); + sal_Bool GetConstValue( Atom nConstId, sal_Int32 * pVal ) const; + sal_Bool GetValueConst( sal_Int32 nValue, Atom * pConstId ) const; + sal_uInt32 GetConstPos( Atom nConstId ); + virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC ); + virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +/******************* R s c E n u m ***************************************/ +class RscEnum : public RscConst { + struct RscEnumInst { + sal_uInt32 nValue; // Position der Konstanten im Array + sal_Bool bDflt; // Ist Default + }; + sal_uInt32 nSize; +public: + RscEnum( Atom nId, sal_uInt32 nTypId ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + sal_uInt32 Size(){ return nSize; } + + virtual void SetToDefault( const RSCINST & rInst ) + { + ((RscEnumInst*)rInst.pData)->bDflt = sal_True; + } + sal_Bool IsDefault( const RSCINST & rInst ) + { + return( ((RscEnumInst*)rInst.pData)->bDflt ); + }; + // Als Default setzen + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, + sal_Int32 nValue ); + ERRTYPE SetNumber( const RSCINST & rInst, sal_Int32 nValue ); + ERRTYPE GetConst( const RSCINST & rInst, Atom * ); + ERRTYPE GetNumber( const RSCINST & rInst, sal_Int32 * nValue ); + void WriteSrc( const RSCINST &rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); +}; + +class RscNameTable; + +sal_uInt32 GetLangId( const ByteString& alang); + +class RscLangEnum : public RscEnum +{ + long mnLangId; +public: + RscLangEnum(); + + void Init( RscNameTable& rNames ); + + Atom AddLanguage( const char* pLang, RscNameTable& rNames ); +}; + +#endif // _RSCCONST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rsccont.hxx b/rsc/inc/rsccont.hxx new file mode 100644 index 000000000000..3c34377bbe1a --- /dev/null +++ b/rsc/inc/rsccont.hxx @@ -0,0 +1,156 @@ +/* -*- 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 _RSCCONT_HXX +#define _RSCCONT_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rsctop.hxx> + +/******************* R s c B a s e C o n t *******************************/ +struct ENTRY_STRUCT { + RscId aName; + RSCINST aInst; + void Create(){ aName.Create(); aInst = RSCINST(); } + void Destroy(); +}; +struct RscBaseContInst { + sal_uInt32 nEntries; + ENTRY_STRUCT * pEntries; + sal_Bool bDflt; +}; + +class RscBaseCont : public RscTop +{ +protected: + RscTop * pTypeClass; // Typ der Eintraege + RscTop * pTypeClass1;// Zwei verschiedene Typen moeglich + sal_Bool bNoId; // Keine Identifier + sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse + // mit Superklassen + sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten + void DestroyElements( RscBaseContInst * pClassData ); + RSCINST SearchElePos( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass, sal_uInt32 nPos ); +protected: + void ContWriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE ContWriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + void ContWriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char *, sal_Bool nWriteSize ); +public: + RscBaseCont( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper = NULL, + sal_Bool bNoId = sal_True ); + ~RscBaseCont(); + virtual RSCCLASS_TYPE GetClassType() const; + void SetTypeClass( RscTop * pClass, RscTop * pClass1 = NULL ) + { + pTypeClass = pClass; + pTypeClass1 = pClass1; + }; + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + void Destroy( const RSCINST & rInst ); + ERRTYPE GetElement( const RSCINST & rInst, const RscId & rEleName, + RscTop * pCreateClass, const RSCINST & rCreateInst, + RSCINST * pGetInst ); + RSCINST SearchEle( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass ); + sal_uInt32 GetCount( const RSCINST & rInst ); + RSCINST GetPosEle( const RSCINST & rInst, sal_uInt32 nPos ); + ERRTYPE MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos, + sal_uInt32 nSourcePos ); + virtual ERRTYPE SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos, + const RscId & rRscId); + SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ); + ERRTYPE SetString( const RSCINST &, const char * pStr ); + ERRTYPE SetNumber( const RSCINST &, sal_Int32 lValue ); + ERRTYPE SetBool( const RSCINST & rInst, sal_Bool bValue ); + ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, + sal_Int32 nValue ); + ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); + + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 Size(){ return( nSize ); }; + + sal_Bool IsConsistent( const RSCINST & rInst ); + void SetToDefault( const RSCINST & rInst ); + sal_Bool IsDefault( const RSCINST & rInst ); + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + void Delete( const RSCINST & rInst, RscTop * pClass, + const RscId & rId ); + void DeletePos( const RSCINST & rInst, sal_uInt32 nPos ); + + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32 , sal_Bool bExtra); + ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId &rId ); +}; + +/******************* R s c C o n t W r i t e S r c ***********************/ +class RscContWriteSrc : public RscBaseCont +{ +public: + RscContWriteSrc( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper = NULL, + sal_Bool bNoId = sal_True ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); +}; + +/******************* R s c C o n t ***************************************/ +class RscCont : public RscContWriteSrc { +public: + RscCont( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper = NULL, + sal_Bool bNoId = sal_True ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +/******************* R s c C o n t E x t r a D a t a *********************/ +class RscContExtraData : public RscContWriteSrc { +public: + RscContExtraData( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper = NULL, + sal_Bool bNoId = sal_True ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); +}; + +#endif //_RSCCONT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx new file mode 100644 index 000000000000..012c340bc42e --- /dev/null +++ b/rsc/inc/rscdb.hxx @@ -0,0 +1,359 @@ +/* -*- 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 _RSCDB_HXX +#define _RSCDB_HXX + +#include <rscall.h> +#include <rsckey.hxx> +#include <rscconst.hxx> +#include <rscflag.hxx> +#include <rscrange.hxx> +#include <rscstr.hxx> +#include <rscarray.hxx> +#include <rscdef.hxx> + +#include <vector> +#include <map> + +class RscError; +class REResourceList; +class RscTupel; +class RscCont; +class RscCmdLine; + +struct WriteRcContext +{ + FILE * fOutput; + rtl::OString aOutputRc; + rtl::OString aOutputSysList; + RscCmdLine* pCmdLine; +}; + +/****************** R s c T y p C o n ************************************/ +// Liste die alle Basistypen enthaelt +typedef ::std::vector< RscTop* > RscBaseList; + +// Tabelle fuer Systemabhaengige Resourcen +struct RscSysEntry +{ + sal_uInt32 nKey; + sal_uInt32 nRscTyp; + ByteString aFileName; + sal_uInt32 nTyp; + sal_uInt32 nRefId; +}; + +typedef ::std::vector< RscSysEntry* > RscSysList; + +class RscTypCont +{ + CharSet nSourceCharSet; + sal_uInt32 nMachineId; // Globaler Maschinentyp + RSCBYTEORDER_TYPE nByteOrder; // Intel oder + ByteString aLanguage; // output language + std::vector< sal_uInt32 > aLangFallbacks; // language fallback list (entry 0 is language itself) + ByteString aSearchPath; // Suchen der Bitmap, Icon, Pointer + ByteString aSysSearchPath; // aSearchPath plus language specific paths + sal_uInt32 nUniqueId; // eindeutiger Id fuer Systemresourcen + sal_uLong nFilePos; // Position in der Datei ( MTF ) + sal_uInt32 nPMId; // eindeutiger Id fuer PM-Rseourcefile + // muss groesser als RSC_VERSIONCONTROL_ID sein + RscTop * pRoot; // Zeiger auf die Wurzel vom Typenbaum + RSCINST aVersion; // Versionskontrollinstanz + + RscBaseList aBaseLst; // Liste der einfachen Resourceklasse + RscSysList aSysLst; // Liste der Systemresourcen + + Atom nWinBitVarId; // Name der Winbitvariablen + Atom nBorderId; + Atom nHideId; + Atom nClipChildrenId; + Atom nSizeableId; + Atom nMoveableId; + Atom nMinimizeId; + Atom nMaximizeId; + Atom nCloseableId; + Atom nStdPopupId; + Atom nAppId; + Atom nTabstopId; + Atom nGroupId; + Atom nSysmodalId; + Atom nLeftId; + Atom nCenterId; + Atom nRightId; + Atom nTopId; + Atom nVCenterId; + Atom nBottomId; + Atom nHScrollId; + Atom nVScrollId; + Atom nSortId; + Atom nDefaultId; + Atom nSVLookId; + Atom nRepeatId; + Atom nDropDownId; + Atom nPassWordId; + Atom nReadOnlyId; + Atom nAutoSizeId; + Atom nSpinId; + Atom nTabControlId; + Atom nSimpleModeId; + Atom nDragId; + Atom nScrollId; + Atom nZoomableId; + Atom nHideWhenDeactivateId; + Atom nAutoHScrollId; + Atom nAutoVScrollId; + Atom nDDExtraWidthId; + Atom nWordBreakId; + Atom nLeftLabelId; + Atom nHasLinesId; + Atom nHasButtonsId; + Atom nRectStyleId; + Atom nLineSpacingId; + Atom nSmallStyleId; + Atom nEnableResizingId; + Atom nDockableId; + Atom nScaleId; + Atom nIgnoreTabId; + Atom nNoSplitDrawId; + Atom nTopImageId; + Atom nNoLabelId; + Atom nVertId; + Atom nSysWinId; + + void Init(); // Initialisiert Klassen und Tabelle + void SETCONST( RscConst *, const char *, sal_uInt32 ); + void SETCONST( RscConst *, Atom, sal_uInt32 ); + RscEnum * InitLangType(); + RscEnum * InitFieldUnitsType(); + RscEnum * InitTimeFieldFormat(); + RscEnum * InitColor(); + RscEnum * InitMapUnit(); + RscEnum * InitKey(); + RscEnum * InitTriState(); + RscEnum * InitMessButtons(); + RscEnum * InitMessDefButton(); + RscTupel * InitGeometry(); + RscArray * InitLangGeometry( RscTupel * pGeo ); + RscArray * InitSystemGeometry( RscTupel * pGeo ); + RscCont * InitStringList(); + RscArray * InitLangStringList( RscCont * pStrLst ); + RscTupel * InitStringTupel(); + RscTupel * InitStringLongTupel(); + RscCont * InitStringTupelList( RscTupel * pStringTupel ); + RscCont * InitStringLongTupelList( RscTupel * pStringLongTupel ); + RscArray * InitLangStringTupelList( RscCont * pStrTupelLst ); + RscArray * InitLangStringLongTupelList( RscCont * pStrLongTupelLst ); + + RscTop * InitClassMgr(); + RscTop * InitClassString( RscTop * pSuper ); + RscTop * InitClassBitmap( RscTop * pSuper ); + RscTop * InitClassColor( RscTop * pSuper, RscEnum * pColor ); + RscTop * InitClassImage( RscTop * pSuper, RscTop *pClassBitmap, + RscTop * pClassColor ); + RscTop * InitClassImageList( RscTop * pSuper, RscTop *pClassBitmap, + RscTop * pClassColor, RscCont * pStrLst ); + RscTop * InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit, + RscArray * pLangGeo ); + RscTop * InitClassSystemWindow( RscTop * pSuper ); + RscTop * InitClassWorkWindow( RscTop * pSuper ); + RscTop * InitClassModalDialog( RscTop * pSuper ); + RscTop * InitClassModelessDialog( RscTop * pSuper ); + RscTop * InitClassControl( RscTop * pSuper ); + RscTop * InitClassCheckBox( RscTop * pSuper ); + RscTop * InitClassPushButton( RscTop * pSuper ); + RscTop * InitClassTriStateBox( RscTop * pSuper, RscEnum * pTriState ); + RscTop * InitClassMenuButton( RscTop * pSuper, RscTop * pClasMenu ); + RscTop * InitClassImageButton( RscTop * pSuper, RscTop * pClassImage, + RscEnum * pTriState ); + RscTop * InitClassEdit( RscTop * pSuper ); + RscTop * InitClassMultiLineEdit( RscTop * pSuper ); + RscTop * InitClassScrollBar( RscTop * pSuper ); + RscTop * InitClassListBox( RscTop * pSuper, RscArray * pStrLst ); + RscTop * InitClassMultiListBox( RscTop * pSuper ); + RscTop * InitClassComboBox( RscTop * pSuper, RscArray * pStrLst ); + RscTop * InitClassFixedText( RscTop * pSuper ); + RscTop * InitClassFixedBitmap( RscTop * pSuper, RscTop * pClassBitmap ); + RscTop * InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage ); + RscTop * InitClassRadioButton( RscTop * pSuper ); + RscTop * InitClassImageRadioButton( RscTop * pSuper, RscTop * pClassImage ); + RscTop * InitClassKeyCode( RscTop * pSuper, RscEnum * pKey ); + RscTop * InitClassAccelItem( RscTop * pSuper, RscTop * pKeyCode ); + RscTop * InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem ); + RscTop * InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap, + RscTop * pClassKeyCode ); + RscTop * InitClassMenu( RscTop * pSuper, RscTop * pMenuItem ); + RscTop * InitClassMessBox( RscTop * pSuper, + RscEnum * pMessButtons, + RscEnum * pMessDefButton ); + RscTop * InitClassSplitter( RscTop * pSuper ); + RscTop * InitClassSplitWindow( RscTop * pSuper ); + RscTop * InitClassTime( RscTop * pSuper ); + RscTop * InitClassDate( RscTop * pSuper ); + + RscTop * InitClassPatternFormatter( RscTop * pSuper ); + RscTop * InitClassNumericFormatter( RscTop * pSuper ); + RscTop * InitClassMetricFormatter( RscTop * pSuper, + RscEnum * pFieldUnits ); + RscTop * InitClassCurrencyFormatter( RscTop * pSuper, + RscEnum * pFieldUnits ); + RscTop * InitClassDateFormatter( RscTop * pSuper, RscTop * pClassDate ); + RscTop * InitClassTimeFormatter( RscTop * pSuper, RscTop * pClassTime, + RscEnum * pTimeFieldFormat ); + + RscTop * InitClassSpinField( RscTop * pSuper ); + RscTop * InitClassPatternField( RscTop * pSuper ); + RscTop * InitClassNumericField( RscTop * pSuper ); + RscTop * InitClassMetricField( RscTop * pSuper ); + RscTop * InitClassCurrencyField( const char * pClassName, sal_uInt32 nRT, + RscTop * pSuper ); + RscTop * InitClassDateField( RscTop * pSuper, RscTop * pClassDate ); + RscTop * InitClassTimeField( RscTop * pSuper, RscTop * pClassTime ); + RscTop * InitClassPatternBox( RscTop * pSuper ); + RscTop * InitClassNumericBox( RscTop * pSuper ); + RscTop * InitClassMetricBox( RscTop * pSuper ); + RscTop * InitClassCurrencyBox( const char * pClassName, sal_uInt32 nRT, + RscTop * pSuper ); + RscTop * InitClassDateBox( RscTop * pSuper, RscTop * pClassDate ); + RscTop * InitClassTimeBox( RscTop * pSuper, RscTop * pClassTime ); + + RscTop * InitClassDockingWindow( RscTop * pSuper, + RscEnum * pMapUnit ); + RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap, + RscTop * pClassImage, + RscEnum * pTriState ); + RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem, + RscTop * pClassImageList ); + RscTop * InitClassStatusBar( RscTop * pSuper ); + RscTop * InitClassMoreButton( RscTop * pSuper, RscEnum * pMapUnit ); + RscTop * InitClassFloatingWindow( RscTop * pSuper, + RscEnum * pMapUnit ); + RscTop * InitClassTabControlItem( RscTop * pSuper, + RscTop * pClassTabPage ); + RscTop * InitClassTabControl( RscTop * pSuper, + RscTop * pClassTabControlItem ); + RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper, + RscTop * pClassBitmap, + RscTop * pClassImage, + RscArray * pStrLst ); + RscTop * InitClassSfxTemplateDialog( RscTop * pSuper, + RscTop * pStyleFamily ); + RscTop * InitClassSfxSlotInfo( RscTop * pSuper ); + + void InsWinBit( RscTop * pClass, const ByteString & rName, + Atom nVal ); + void WriteInc( FILE * fOutput, sal_uLong lKey ); + +public: + RscBool aBool; + RscRange aShort; + RscRange aUShort; + RscLongRange aLong; + RscLongEnumRange aEnumLong; + RscIdRange aIdUShort; + RscIdRange aIdNoZeroUShort; + RscBreakRange aNoZeroShort; + RscRange a1to12Short; + RscRange a0to23Short; + RscRange a1to31Short; + RscRange a0to59Short; + RscRange a0to99Short; + RscRange a0to9999Short; + RscIdRange aIdLong; + RscString aString; + RscString aStringLiteral; + RscFlag aWinBits; + RscLangEnum aLangType; + RscLangArray aLangString; + RscLangArray aLangShort; + + Atom nAcceleratorType; + + RscError* pEH; // Fehlerhandler + RscNameTable aNmTb; // Tabelle fuer Namen + RscFileTab aFileTab; // Tabelle der Dateinamen + sal_uInt32 nFlags; + std::map<sal_uInt64, sal_uLong> aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu + //(unter PM), oder eine Dateiposition (MTF) + + RscTypCont( RscError *, RSCBYTEORDER_TYPE, const ByteString & rSearchPath, sal_uInt32 nFlags ); + ~RscTypCont(); + + Atom AddLanguage( const char* ); + + sal_Bool IsPreload() const + { return (nFlags & PRELOAD_FLAG) ? sal_True : sal_False; } + sal_Bool IsSmart() const + { return (nFlags & SMART_FLAG) ? sal_True : sal_False; } + sal_Bool IsSysResTest() const + { return (nFlags & NOSYSRESTEST_FLAG) ? sal_False : sal_True; } + sal_Bool IsSrsDefault() const + { return (nFlags & SRSDEFAULT_FLAG) ? sal_True : sal_False; } + ByteString ChangeLanguage( const ByteString& rNewLang ); + const std::vector< sal_uInt32 >& GetFallbacks() const + { return aLangFallbacks; } + + RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; } + CharSet GetSourceCharSet() const { return nSourceCharSet; } + CharSet SetSourceCharSet( CharSet aCharSet ) + { + CharSet aOld = nSourceCharSet; + nSourceCharSet = aCharSet; + return aOld; + } + void SetSearchPath( const ByteString & rStr) { aSearchPath = rStr; } + ByteString GetSearchPath() const { return aSearchPath; } + void SetSysSearchPath( const ByteString& rStr ) { aSysSearchPath = rStr; } + ByteString GetSysSearchPath() const { return aSysSearchPath; } + void InsertType( RscTop * pType ) + { + aBaseLst.push_back( pType ); + } + RscTop * SearchType( Atom nTypId ); + // loescht alle Resourceobjekte diese Datei + void Delete( sal_uLong lFileKey ); + RscTop * GetRoot() { return( pRoot ); }; + sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst, + sal_uInt32 nId, sal_Bool bFirst ); + void ClearSysNames(); + ERRTYPE WriteRc( WriteRcContext& rContext ); + void WriteSrc( FILE * fOutput, sal_uLong nFileIndex, + CharSet nCharSet, sal_Bool bName = sal_True ); + ERRTYPE WriteHxx( FILE * fOutput, sal_uLong nFileKey); + ERRTYPE WriteCxx( FILE * fOutput, sal_uLong nFileKey, + const ByteString & rHxxName ); + void WriteSyntax( FILE * fOutput ); + void WriteRcCtor( FILE * fOutput ); + sal_uInt32 PutTranslatorKey( sal_uInt64 nKey ); + void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscdef.hxx b/rsc/inc/rscdef.hxx new file mode 100644 index 000000000000..6d335d5544b0 --- /dev/null +++ b/rsc/inc/rscdef.hxx @@ -0,0 +1,267 @@ +/* -*- 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 _RSCDEF_HXX +#define _RSCDEF_HXX + +#include <tools/unqidx.hxx> +#include <rsctree.hxx> +#include <rtl/strbuf.hxx> +#include <vector> + +/****************** C L A S S E S ****************************************/ +class RscExpression; +class RscFileTab; +class RscDefine; + +/*********** R s c E x p r e s s i o n ***********************************/ +#define RSCEXP_LONG 0 +#define RSCEXP_EXP 1 +#define RSCEXP_DEF 2 +#define RSCEXP_NOTHING 3 + +class RscExpType +{ +public: + union { + RscExpression * pExp; + RscDefine * pDef; + struct { + short nHi; + unsigned short nLo; + } aLong; + } aExp; + char cType; + char cUnused; + sal_Bool IsNumber() const { return( RSCEXP_LONG == cType ); } + sal_Bool IsExpression()const { return( RSCEXP_EXP == cType ); } + sal_Bool IsDefinition()const { return( RSCEXP_DEF == cType ); } + sal_Bool IsNothing() const { return( RSCEXP_NOTHING == cType ); } + void SetLong( sal_Int32 lValue ){ + aExp.aLong.nHi = (short)(lValue >> 16); + aExp.aLong.nLo = (unsigned short)lValue; + cType = RSCEXP_LONG; + } + sal_Int32 GetLong() const{ + return aExp.aLong.nLo | + ((sal_Int32)aExp.aLong.nHi << 16); + } + sal_Bool Evaluate( sal_Int32 * pValue ) const; + void AppendMacro( rtl::OStringBuffer & ) const; +}; + +/*********** R s c I d ***************************************************/ +class RscId +{ + static sal_Bool bNames;// sal_False, bei den Namenoperation nur Zahlen +public: + RscExpType aExp; // Zahl, Define oder Ausdruck + sal_Int32 GetNumber() const; + void Create( const RscExpType & rExpType ); + void Create(){ aExp.cType = RSCEXP_NOTHING; } + + RscId() { Create(); } + + RscId( RscDefine * pEle ); + RscId( sal_Int32 lNumber ) + { aExp.SetLong( lNumber ); } + + RscId( const RscExpType & rExpType ) + { Create( rExpType ); } + + void Destroy(); + + ~RscId(){ + Destroy(); + } + + RscId( const RscId& rRscId ); + + RscId& operator = ( const RscId& rRscId ); + + static void SetNames( sal_Bool bSet = sal_True ); + operator sal_Int32() const; // Gibt Nummer zurueck + ByteString GetName() const; // Gibt den Namen des Defines zurueck + sal_Bool operator < ( const RscId& rRscId ) const; + sal_Bool operator > ( const RscId& rRscId ) const; + sal_Bool operator == ( const RscId& rRscId ) const; + sal_Bool operator <= ( const RscId& rRscId ) const + { return !(operator > ( rRscId )); } + sal_Bool operator >= ( const RscId& rRscId ) const + { return !(operator < ( rRscId )); } + sal_Bool IsId() const { return !aExp.IsNothing(); } +}; + +/*********** R s c D e f i n e *******************************************/ +class RscDefine : public StringNode +{ +friend class RscFileTab; +friend class RscDefineList; +friend class RscDefTree; +friend class RscExpression; +friend class RscId; + sal_uLong lFileKey; // zu welcher Datei gehoert das Define + sal_uInt32 nRefCount; // Wieviele Referenzen auf dieses Objekt + sal_Int32 lId; // Identifier + RscExpression * pExp; // Ausdruck +protected: + + RscDefine( sal_uLong lFileKey, const ByteString & rDefName, + sal_Int32 lDefId ); + RscDefine( sal_uLong lFileKey, const ByteString & rDefName, + RscExpression * pExpression ); + ~RscDefine(); + void IncRef(){ nRefCount++; } + sal_uInt32 GetRefCount() const { return nRefCount; } + void DecRef(); + void DefineToNumber(); + void SetName( const ByteString & rNewName ){ aName = rNewName; } + + using StringNode::Search; +public: + RscDefine * Search( const char * ); + sal_uLong GetFileKey() const { return lFileKey; } + sal_Bool Evaluate(); + sal_Int32 GetNumber() const { return lId; } + ByteString GetMacro(); +}; + +typedef ::std::vector< RscDefine* > RscSubDefList; + +class RscDefineList { +friend class RscFile; +friend class RscFileTab; +private: + RscSubDefList maList; + // pExpression wird auf jedenfall Eigentum der Liste + RscDefine * New( sal_uLong lFileKey, const ByteString & rDefName, + sal_Int32 lDefId, size_t lPos ); + RscDefine * New( sal_uLong lFileKey, const ByteString & rDefName, + RscExpression * pExpression, size_t lPos ); + sal_Bool Remove(); + size_t GetPos( RscDefine* item ) { + for ( size_t i = 0, n = maList.size(); i < n; ++i ) + if ( maList[ i ] == item ) + return i; + return size_t(-1); + } +public: + void WriteAll( FILE * fOutput ); +}; + +/*********** R s c E x p r e s s i o n ***********************************/ +class RscExpression { +friend class RscFileTab; + char cOperation; + RscExpType aLeftExp; + RscExpType aRightExp; +public: + RscExpression( RscExpType aLE, char cOp, + RscExpType aRE ); + ~RscExpression(); + sal_Bool Evaluate( sal_Int32 * pValue ); + ByteString GetMacro(); +}; + +/********************** R S C F I L E ************************************/ +class RscDepend { + sal_uLong lKey; +public: + RscDepend( sal_uLong lIncKey ){ lKey = lIncKey; }; + sal_uLong GetFileKey(){ return lKey; } +}; + +typedef ::std::vector< RscDepend* > RscDependList; + +// Tabelle die alle Dateinamen enthaelt +class RscFile +{ +friend class RscFileTab; + sal_Bool bIncFile; // Ist es eine Include-Datei +public: + sal_Bool bLoaded; // Ist die Datei geladen + sal_Bool bScanned; // Wurde Datei nach Inclide abgesucht + sal_Bool bDirty; // Dirty-Flag + ByteString aFileName; // Name der Datei + ByteString aPathName; // Pfad und Name der Datei + RscDefineList aDefLst; // Liste der Defines + RscDependList aDepLst; // List of Depend + + RscFile(); + ~RscFile(); + sal_Bool InsertDependFile( sal_uLong lDepFile, size_t lPos ); + sal_Bool Depend( sal_uLong lDepend, sal_uLong lFree ); + void SetIncFlag(){ bIncFile = sal_True; }; + sal_Bool IsIncFile(){ return bIncFile; }; +}; + +DECLARE_UNIQUEINDEX( RscSubFileTab, RscFile * ) +#define NOFILE_INDEX UNIQUEINDEX_ENTRY_NOTFOUND + +class RscDefTree { + RscDefine * pDefRoot; +public: + static sal_Bool Evaluate( RscDefine * pDef ); + RscDefTree(){ pDefRoot = NULL; } + ~RscDefTree(); + void Remove(); + RscDefine * Search( const char * pName ); + void Insert( RscDefine * pDef ); + void Remove( RscDefine * pDef ); +}; + +class RscFileTab : public RscSubFileTab { + RscDefTree aDefTree; + sal_uLong Find( const ByteString & rName ); +public: + RscFileTab(); + ~RscFileTab(); + + RscDefine * FindDef( const char * ); + RscDefine * FindDef( const ByteString& rStr ) { return FindDef( rStr.GetBuffer() ); } + + sal_Bool Depend( sal_uLong lDepend, sal_uLong lFree ); + sal_Bool TestDef( sal_uLong lFileKey, size_t lPos, + const RscDefine * pDefDec ); + sal_Bool TestDef( sal_uLong lFileKey, size_t lPos, + const RscExpression * pExpDec ); + + RscDefine * NewDef( sal_uLong lKey, const ByteString & rDefName, + sal_Int32 lId, sal_uLong lPos ); + RscDefine * NewDef( sal_uLong lKey, const ByteString & rDefName, + RscExpression *, sal_uLong lPos ); + + // Alle Defines die in dieser Datei Definiert sind loeschen + void DeleteFileContext( sal_uLong lKey ); + sal_uLong NewCodeFile( const ByteString & rName ); + sal_uLong NewIncFile( const ByteString & rName, const ByteString & rPath ); + RscFile * GetFile( sal_uLong lFileKey ){ return Get( lFileKey ); } +}; + +#endif // _RSCDEF_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscerror.h b/rsc/inc/rscerror.h new file mode 100644 index 000000000000..bc1516a73c41 --- /dev/null +++ b/rsc/inc/rscerror.h @@ -0,0 +1,165 @@ +/* -*- 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 _RSCERROR_H +#define _RSCERROR_H + +#ifndef _TOOLS_SOLAR_H +#include <tools/solar.h> +#endif + +/****************** D E F I N I T I O N S ********************************/ +/******************* R e t u r n E r r o r s *******************/ +#define ERR_OK 0xFFFFFFFF + +#define ERR_ERROR 0x0100 +#define ERR_UNKNOWN_METHOD 0x0101 // Return +#define ERR_OPENFILE 0x0102 // Return +#define ERR_NOCHAR 0x0103 // Return +#define ERR_NORSCINST 0x0104 // Return +#define ERR_USAGE 0x0105 // +#define ERR_NOINPUT 0x0106 // Return +#define ERR_UNKNOWNSW 0x0107 // +#define ERR_REFTODEEP 0x0108 // Return +#define ERR_FILEFORMAT 0x0109 // Return +#define ERR_FILESIZE 0x010A // Return +#define ERR_RENAMEFILE 0x010B // Return +#define ERR_NOIMAGE 0x010C // Return + +#define ERR_RSCRANGE 0x0200 // Return +#define ERR_RSCRANGE_OUTDEFSET (ERR_RSCRANGE +1 ) + +#define ERR_RSCENUM 0x0210 // Return +#define ERR_RSCFLAG 0x0220 // Return +#define ERR_RSCCONT 0x0240 // Return +#define ERR_CONT_INVALIDPOS (ERR_RSCCONT +1 ) // Return +#define ERR_CONT_INVALIDTYPE (ERR_RSCCONT +2 ) // Return + +#define ERR_RSCCMPED 0x0250 +#define ERR_RSCINST 0x0260 +#define ERR_RSCINST_NOVARNAME (ERR_RSCINST +1 ) // Return +#define ERR_RSCINST_RESERVEDNAME (ERR_RSCINST +2 ) // Return + +#define ERR_LEX 0x0270 +#define ERR_YACC 0x0280 // +#define ERR_DOUBLEID (ERR_YACC +1 ) // +#define ERR_FALSETYPE (ERR_YACC +2 ) // +#define ERR_NOVARIABLENAME (ERR_YACC +3 ) // +#define ERR_USHORTRANGE (ERR_YACC +4 ) // +#define ERR_IDRANGE (ERR_YACC +5 ) // +#define ERR_NOCOPYOBJ (ERR_YACC +6 ) // +#define ERR_REFNOTALLOWED (ERR_YACC +7 ) // Return +#define ERR_DOUBLEDEFINE (ERR_YACC +8 ) // +#define ERR_COPYNOTALLOWED (ERR_YACC +9 ) // +#define ERR_IDEXPECTED (ERR_YACC +10) // +#define ERR_ZERODIVISION (ERR_YACC +11) // +#define ERR_PRAGMA (ERR_YACC +12) // +#define ERR_DECLAREDEFINE (ERR_YACC +13) // +#define ERR_NOTUPELNAME (ERR_YACC +14) // +#define ERR_NOTYPE (ERR_YACC +15) // + +#define ERR_RSCARRAY 0x02A0 // Return +#define ERR_ARRAY_INVALIDINDEX (ERR_RSCARRAY +1 ) // Return + +#define ERR_ERROREND 0x1000 + +#define ERR_WARNINGSTART 0x1001 +#define WRN_LOCALID (ERR_WARNINGSTART +1 ) +#define WRN_GLOBALID (ERR_WARNINGSTART +2 ) +#define WRN_SUBINMEMBER (ERR_WARNINGSTART +3 ) +#define WRN_CONT_NOID (ERR_WARNINGSTART +4 ) +#define WRN_STR_REFNOTFOUND (ERR_WARNINGSTART +5 ) +#define WRN_MGR_REFNOTFOUND (ERR_WARNINGSTART +6 ) +#define WRN_CONT_DOUBLEID (ERR_WARNINGSTART +7 ) + +#define ERR_WARNINGEND 0x2000 + +class ERRTYPE { + sal_uInt32 nError; +public: + ERRTYPE() { nError = ERR_OK; } + ERRTYPE( sal_uInt32 nErr ) { nError = nErr; } + ERRTYPE( const ERRTYPE & rErr ) { nError = rErr.nError; }; + ERRTYPE& operator = ( const ERRTYPE & rError ); + operator sal_uInt32() const { return( nError ); } + sal_Bool IsError() const { return( nError <= ERR_ERROREND ); } + sal_Bool IsOk() const { return( !IsError() ); } + sal_Bool IsWarning() const { + return( nError >= ERR_WARNINGSTART && nError <= ERR_WARNINGEND ); + }; + void Clear(){ nError = ERR_OK; } +}; + +/****************** R s c E r r o r **************************************/ +class RscId; +class RscTop; + +enum RscVerbosity +{ + RscVerbositySilent = 0, + RscVerbosityNormal = 1, + RscVerbosityVerbose = 2 +}; + +class RscError +{ + FILE * fListing; + RscVerbosity m_verbosity; + + void WriteError( const ERRTYPE& rError, const char * pMessage ); + void StdLstOut( const char * pStr ); + void StdLstErr( const char * pStr ); + void ErrorFormat( const ERRTYPE& rError, RscTop * pClass, + const RscId & aId ); +public: + sal_uInt32 nErrors;// Anzahl der Fehler + RscError( RscVerbosity _verbosity ) { + fListing = NULL; + nErrors = 0; + m_verbosity = _verbosity; + }; + void SetListFile( FILE * fList ){ + fListing = fList; + }; + FILE * GetListFile(){ + return fListing; + }; + RscVerbosity GetVerbosity() const { return m_verbosity; } + virtual void StdOut( const char *, const RscVerbosity _verbosityLevel = RscVerbosityNormal ); + virtual void StdErr( const char * ); + virtual void LstOut( const char * ); + virtual void Error( const ERRTYPE& rError, RscTop* pClass, const RscId &aId, + const char * pMessage = NULL ); + // Dieser Fehler sollte nur im Compilermodus auftreten, + // das Programm wird mit exit() verlassen + virtual void FatalError( const ERRTYPE& rError, const RscId &aId, + const char * pMessage = NULL ); +}; + +#endif // _RSCERROR_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscflag.hxx b/rsc/inc/rscflag.hxx new file mode 100644 index 000000000000..48770605f0a3 --- /dev/null +++ b/rsc/inc/rscflag.hxx @@ -0,0 +1,109 @@ +/* -*- 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 _RSCFLAG_HXX +#define _RSCFLAG_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rscconst.hxx> + +/******************* R s c F l a g ***************************************/ +class RscFlag : public RscConst { + struct RscFlagInst{ + sal_uInt32 nFlags; + sal_uInt32 nDfltFlags; + }; + RSCINST CreateBasic( RSCINST * pInst ); +public: + RscFlag( Atom nId, sal_uInt32 nTypId ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + RSCINST CreateClient( RSCINST * pInst, const RSCINST & rDflt, + sal_Bool bOwnClass, Atom nConsId ); + sal_uInt32 Size(); + + virtual void SetToDefault( const RSCINST & rInst ); + sal_Bool IsDefault( const RSCINST & rInst ); + sal_Bool IsDefault( const RSCINST & rInst, Atom nConstId ); + + // Ist das Flag gesetzt + sal_Bool IsSet( const RSCINST & rInst, Atom nConstId ); + + // Als Default setzen + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, + Atom nConstId ); + + ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, + sal_Int32 nValue ); + ERRTYPE SetNotConst( const RSCINST & rInst, Atom nConstId ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); +}; + +/******************* R s c C l i e n t ***********************************/ +class RscClient : public RscTop +{ + RscFlag * pRefClass; //Klasse die als Server benutzt wird + Atom nConstId; //Id des zu setzenden Wertes +public: + RscClient( Atom nId, sal_uInt32 nTypId, RscFlag * pClass, + Atom nConstantId ); + virtual RSCCLASS_TYPE GetClassType() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + sal_uInt32 Size(){ return( pRefClass->Size() ); }; + + // Eine Zuweisung an eine Variable + sal_Bool IsDefault( const RSCINST & rInst ){ + return( pRefClass->IsDefault( rInst, nConstId ) ); + }; + // Als Default setzen + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ + return pRefClass->IsValueDefault( rInst, + pDef, nConstId ); + } + ERRTYPE SetBool( const RSCINST & rInst, sal_Bool bValue ){ + if( bValue ) + return( pRefClass->SetConst( rInst, nConstId, bValue ) ); + else + return( pRefClass-> + SetNotConst( rInst, nConstId ) ); + }; + ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB ){ + *pB = pRefClass->IsSet( rInst, nConstId ); + return( ERR_OK ); + }; + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); +}; + +#endif // _RSCFLAG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rschash.hxx b/rsc/inc/rschash.hxx new file mode 100644 index 000000000000..dcba480ecd67 --- /dev/null +++ b/rsc/inc/rschash.hxx @@ -0,0 +1,56 @@ +/* -*- 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 _RSCHASH_HXX +#define _RSCHASH_HXX + +#include <sal/types.h> +#include <rtl/string.hxx> +#include <boost/unordered_map.hpp> + +typedef sal_uInt32 Atom; + +#define InvalidAtom Atom( ~0 ) + +class AtomContainer +{ + Atom m_nNextID; + boost::unordered_map< rtl::OString, Atom, rtl::OStringHash > m_aStringToID; + boost::unordered_map< Atom, rtl::OString > m_aIDToString; + + public: + AtomContainer(); + ~AtomContainer(); + + Atom getID( const rtl::OString& rStr, bool bOnlyIfExists = false ); + const rtl::OString& getString( Atom nAtom ); + +}; + +#endif // _RSCHASH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscinst.hxx b/rsc/inc/rscinst.hxx new file mode 100644 index 000000000000..13535411c4bd --- /dev/null +++ b/rsc/inc/rscinst.hxx @@ -0,0 +1,245 @@ +/* -*- 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 _RSCINST_HXX +#define _RSCINST_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rsctools.hxx> + +/******************* C l a s s e s F o r w a r d s *********************/ +class RscTypCont; +class RscCmdLine; +class REResourceList; +class RscTop; +class RscInstCopy; + +/******************* F u n c t i o n F o r w a r d s *******************/ +Atom HashId( const char * ); // Gibt zu einem String eine HashId +const char * GetHashString( Atom ); // Gibt zu einer Atom einen String + // NULL, wenn kein Eintrag vorhanden + +/******************* S t r u c t s ***************************************/ + +/****************** C L A S S E S ****************************************/ +class RscInst +{ + void MakeCopy( RSCINST aCopyInst ); + static RSCINST GetSysLangInst( RSCINST & rInst ); +public: + RSCINST aInst; + + RscInst(); + RscInst( const RscInst & rInst ); + RscInst( RSCINST aTmpI ); + RscInst& operator = ( const RscInst& rRscInst ); + ~RscInst(); + void OverWrite( RscInstCopy & rInst ); + sal_Bool IsInst() const { return( aInst.IsInst() ); } + + // Listen Methoden + ERRTYPE SetElement( const RscId & rName, RscInstCopy & rInst ); + ERRTYPE SetPosEle( sal_uInt32 nPos, RscInstCopy & rInst ); + ERRTYPE SetPosRscId( sal_uInt32 nPos, const RscId & rId ); + SUBINFO_STRUCT GetInfoEle( sal_uInt32 nPos ); + sal_uInt32 GetCount(); + RscInst GetElement( RscTop * pClass, const RscId & rName ); + RscInst GetPosEle( sal_uInt32 nPos ); + ERRTYPE MovePosEle( sal_uInt32 nDestPos, sal_uInt32 nSourcePos ); + ERRTYPE DeleteElement( RscTop * pClass, const RscId & rName ); + ERRTYPE DeletePosEle( sal_uInt32 nPos ); + + ERRTYPE SetVar( Atom nVarName, RscInstCopy & rInst ); + ERRTYPE SetConst( Atom nVarName, Atom nConstId ); + ERRTYPE SetBool( Atom nVarName, sal_Bool ); + + // Hack fuer X, Y, Width, Height + static ERRTYPE SetCorrectValues( RSCINST & rInst, RSCINST & rVarInst, + sal_Int32 lValue, sal_uInt32 nTupelIdx ); + ERRTYPE SetNumber( Atom nVarName, sal_Int32 ); + + ERRTYPE SetString( Atom nVarName, const char * ); + ERRTYPE SetConst( Atom nConstId ); + ERRTYPE SetBool( sal_Bool ); + ERRTYPE SetNumber( sal_Int32 ); + ERRTYPE SetString( const char * ); + ERRTYPE SetRef( const RscId & rRscId ); + ERRTYPE SetDefault( Atom nVarName ); + + RscInst GetVar( Atom nVarName ); + Atom GetConst( Atom nVarName = InvalidAtom ); + sal_uInt32 GetConstPos( Atom nVarName = InvalidAtom ); + sal_Bool GetBool( Atom nVarName = InvalidAtom ); + + // Hack fuer X, Y, Width, Height + static sal_Int32 GetCorrectValues( RSCINST & rInst, RSCINST & rVarInst, + sal_uInt32 nTupelIdx ); + sal_Int32 GetNumber( Atom nVarName = InvalidAtom ); + + const char *GetString( Atom nVarName = InvalidAtom ); + RscId GetRef(); + sal_Bool IsDefault( Atom nVarName ); + sal_Bool IsConsistent( RscInconsList * pList ); + + Atom GetClassEnum( Atom nVarName, sal_uInt32 nPos ); + Atom GetClassEnum( sal_uInt32 nPos ); + RscTop * GetClassType(){ return aInst.pClass; }; + Atom GetClassName(); + void EnumClassVariables( void * pData, VarEnumCallbackProc ) const; + ERRTYPE WriteRc( RscWriteRc & aMem ); +}; + +class RscInstCopy : public RscInst { + void MakeCopy( RSCINST aCopyInst ); +public: + RscInstCopy(); + RscInstCopy( const RscInstCopy & rInst ); + RscInstCopy( const RscInst & rInst ); + RscInstCopy( RSCINST aTmpI ); + RscInstCopy( RscTop * pNewType, const RscInst & rInst ); + RscInstCopy& operator = ( const RscInstCopy & rRscInst ); + RscInstCopy& operator = ( const RscInst & rRscInst ); + ~RscInstCopy(); +}; + +class RscDataBase +{ +friend class RscHrc; +friend class RscSrc; +friend class RscInst; + + RscCmdLine * pCmdLine; + RscTypCont * pTC; + LanguageType nLangType; +public: + RscDataBase( RscError * ); + ~RscDataBase(); + +// void SetLanguage( LanguageType nTyp ) { nLangType = nTyp; } + void SetLanguage( Atom nId ); + Atom GetLanguage() const; + + ByteString GetPath() const; + void SetPath( const ByteString & rPath ); + // Konvertiert einen Namen in einen Typ + RscTop* GetClassType( Atom nClassName ); + // Instanz einer Klasse erzeugen + sal_Bool MakeConsistent( RscInconsList * pList ); + // Array mit Dateinamen + RscFileTab* GetFileTab(); + // Eine Dateinamen-Instanz holen + RscFile * GetFileStruct( sal_uLong lKey ); + + sal_uLong AddSrcFile( const ByteString & rFileName ); + sal_uLong AddHrcFile( const ByteString & rFileName ); + // Traegt die Include-Dateien in die Abhaengigkeitsliste + // von lFileKey ein + void ScanForIncFiles( sal_uLong lFileKey ); + void RemoveFile( sal_uLong lKey ); + + // Suche ueber alle DEFINES + RscDefine * FindDef( const ByteString & rName ); + sal_uLong GetFileKey( const ByteString & rFileName ); +}; + +class RscHrc +{ +protected: + sal_uLong lFileKey; // Index der Instanz + RscDataBase * pDataBase;// Datenbasis +public: + + // Kompilerinstanz erzeugen + RscHrc( RscDataBase * pDBase, sal_uLong lKey ); + ~RscHrc(); + + // Daten von Datei uebernehmen + ERRTYPE ReadFile(); + + sal_uLong GetFileKey() const { return lFileKey; } + + void SetDirty( sal_Bool bSet ); + sal_Bool IsDirty(); + void SetPathName( const ByteString & ); + ByteString GetPathName(); + void SetFileName( const ByteString & ); + ByteString GetFileName(); + + //Depend-Datei anhaengen + void InsertDepend( sal_uLong lKey, sal_uLong lPos ); + + // DefineList holen + RscDefineList * GetDefineList(); + // Suche ueber all DEFINES im Zugriff + RscDefine * FindDef( const ByteString & rName ); + ERRTYPE NewDef( const ByteString & rMacroName, sal_Int32 lValue, + sal_uLong lPos ); + ERRTYPE NewDef( const ByteString & rMacroName, const ByteString & rMacro, + sal_uLong lPos ); + ERRTYPE ChangeDef( const ByteString & rMacroName, sal_Int32 lValue ); + ERRTYPE ChangeDef( const ByteString & rMacroName, + const ByteString & rMacro ); + sal_Bool IsDefUsed( const ByteString & ); + void DeleteDef( const ByteString & rMacroName ); + + // Dateinamen-Instanz holen + RscFile * GetFileStruct(); + //Abhaengigkeitsliste holen holen + RscDependList * GetDependList(); + + // Datei schreiben + ERRTYPE WriteFile(); +}; + +class RscSrc : public RscHrc { +public: + // Kompilerinstanz erzeugen + RscSrc( RscDataBase * pDBase, sal_uLong lKey ); + ~RscSrc(); + + + RscInstCopy CreateRscInst( RscTop * pClass ); + // Instanz loeschen + ERRTYPE DeleteRscInst( RscTop * pClass, const RscId & rInstName ); + // Datenbasis nach Define Veraenderung wiederherstellen + //Instanz global zur Verfuegung stellen + ERRTYPE SetRscInst( const RscId & rInstName, RscInstCopy & ); + //Instanz holen + RscInst GetRscInst( RscTop* pClass, const RscId & rInstName ); + + // Namen und Identifier Liste fuellen + void FillNameIdList( REResourceList * pList ); + + // C++ Resourcekonstruktor schreiben + ERRTYPE WriteCxxFile( const ByteString &, const ByteString & rHxxName ); + ERRTYPE WriteHxxFile( const ByteString & ); // C++ Klasskopf schreiben +}; + +#endif //_RSCINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rsckey.hxx b/rsc/inc/rsckey.hxx new file mode 100644 index 000000000000..65125c2904d1 --- /dev/null +++ b/rsc/inc/rsckey.hxx @@ -0,0 +1,62 @@ +/* -*- 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 _RSCKEY_HXX +#define _RSCKEY_HXX + +/****************** C l a s s F o r w a r d s **************************/ +class RscTop; + +#include <rscall.h> + +typedef struct { + Atom nName; + sal_uInt32 nTyp; + long yylval; +} KEY_STRUCT; + +class RscNameTable { + sal_Bool bSort; //soll bei jedem einfuegen sortiert werden? + sal_uInt32 nEntries; //Anzahl der Eintr�ge + KEY_STRUCT * pTable; +public: + RscNameTable(); + ~RscNameTable(); + void SetSort( sal_Bool bSorted = sal_True ); + Atom Put( Atom nName, sal_uInt32 nTyp, long nValue ); + Atom Put( const char * pName, sal_uInt32 nTyp, long nValue ); + Atom Put( const char * pName, sal_uInt32 nTyp ); + Atom Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ); + + // sal_True, wurde gefunden + sal_Bool Get( Atom nName, KEY_STRUCT * pEle ); +}; + + +#endif// _RSCKEY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rsclex.hxx b/rsc/inc/rsclex.hxx new file mode 100644 index 000000000000..c861e89402f6 --- /dev/null +++ b/rsc/inc/rsclex.hxx @@ -0,0 +1,131 @@ +/* -*- 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. + * + ************************************************************************/ +#include <tools/stack.hxx> + +#include <boost/unordered_set.hpp> +#include <rtl/strbuf.hxx> +#include <rtl/string.hxx> + +// a buffer for unique strings +class StringContainer +{ + boost::unordered_set< rtl::OString, rtl::OStringHash > m_aStrings; +public: + StringContainer() {} + ~StringContainer() {} + + const char* putString( const char* pString ); +}; + + +enum MODE_ENUM { MODE_MODELESS, MODE_APPLICATIONMODAL, MODE_SYSTEMMODAL }; + +enum JUSTIFY_ENUM { JUST_CENTER, JUST_RIGHT, JUST_LEFT }; + +enum SHOW_ENUM { SHOW_NORMAL, SHOW_MINIMIZED, SHOW_MAXIMIZED }; + +enum ENUMHEADER { HEADER_NAME, HEADER_NUMBER }; + +enum REF_ENUM { TYPE_NOTHING, TYPE_REF, TYPE_COPY }; + +struct RSCHEADER { + RscTop * pClass; + RscExpType nName1; + REF_ENUM nTyp; + RscTop * pRefClass; + RscExpType nName2; +}; + +/************** O b j e c t s t a c k ************************************/ +struct Node { + Node* pPrev; + RSCINST aInst; + sal_uInt32 nTupelRec; // Rekursionstiefe fuer Tupel + Node() { pPrev = NULL; nTupelRec = 0; }; +}; + +class ObjectStack { + private : + Node* pRoot; + public : + + ObjectStack () { pRoot = NULL; } + + const RSCINST & Top () { return pRoot->aInst; } + sal_Bool IsEmpty() { return( pRoot == NULL ); } + void IncTupelRec() { pRoot->nTupelRec++; } + void DecTupelRec() { pRoot->nTupelRec--; } + sal_uInt32 TupelRecCount() const { return pRoot->nTupelRec; } + void Push( RSCINST aInst ) + { + Node* pTmp; + + pTmp = pRoot; + pRoot = new Node; + pRoot->aInst = aInst; + pRoot->pPrev = pTmp; + } + void Pop() + { + Node* pTmp; + + pTmp = pRoot; + pRoot = pTmp->pPrev; + delete pTmp; + } +}; + +/****************** F o r w a r d s **************************************/ +#if defined( RS6000 ) +extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion +extern "C" void yyerror( char * ); +extern "C" int yylex( void ); +#elif defined ( SOLARIS ) +extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion +extern "C" void yyerror( const char * ); +extern "C" int yylex( void ); +#else +#if defined ( GCC ) || (_MSC_VER >= 1400) +int yyparse(); // forward Deklaration fuer erzeugte Funktion +#else +yyparse(); // forward Deklaration fuer erzeugte Funktion +#endif +void yyerror( char * ); +int yylex( void ); +#endif + +class RscTypCont; +class RscFileInst; + +extern RscTypCont* pTC; +extern RscFileInst * pFI; +extern RscExpression * pExp; +extern ObjectStack S; +extern StringContainer* pStringContainer; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rsclst.hxx b/rsc/inc/rsclst.hxx new file mode 100644 index 000000000000..32d64d424006 --- /dev/null +++ b/rsc/inc/rsclst.hxx @@ -0,0 +1,65 @@ +/* -*- 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 _RSCLST_HXX +#define _RSCLST_HXX + +#include <rscall.h> + +class REResourceList; + +class REResourceList +{ +protected: + REResourceList* pParent; + RscId aRscId; //Id und Name des Resourceobjektes + ByteString aClassName; + sal_Bool bVisible; + +public: + REResourceList(); + REResourceList( REResourceList * pParentList, + ByteString& rClassName, + const RscId & rResourceID, + sal_Bool bVisible = sal_False ); + ~REResourceList(); + + REResourceList* GetParent() { return pParent; } + ByteString GetObjName() { return aRscId.GetName(); } + ByteString GetClassName() { return aClassName; } + RscId GetRscId() { return aRscId; } + void SetRscId( const RscId & rId ){ aRscId = rId; } + + void SetVisible( sal_Bool bVis ) + { bVisible = bVis; } + sal_Bool IsVisible() { return bVisible; } +}; + +#endif // _RSCLST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscmgr.hxx b/rsc/inc/rscmgr.hxx new file mode 100644 index 000000000000..09303a4944bb --- /dev/null +++ b/rsc/inc/rscmgr.hxx @@ -0,0 +1,82 @@ +/* -*- 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 _RSCMGR_HXX +#define _RSCMGR_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> +#include <rscclass.hxx> + +/******************* R s c M g r *****************************************/ +class RscMgr : public RscClass { + struct RscMgrInst { + RscId aRefId; // nRefId = Referenz Identifier + sal_Bool bDflt; // Ist Default + void Create(){ aRefId.Create(); bDflt = sal_True; } + void Destroy(){ aRefId.Destroy(); } + }; + ERRTYPE IsToDeep( const RSCINST & rInst, sal_uInt32 nDeep = 0 ); +public: + RscMgr( Atom nId, sal_uInt32 nTypId, RscTop * pSuperCl ); + + void SetToDefault( const RSCINST & rInst ); + sal_Bool IsDefault( const RSCINST & rInst ); + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + void Destroy( const RSCINST & rInst ); + sal_uInt32 Size(); + void WriteSrcHeader( const RSCINST & aInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, + const RscId & rId, const char * ); + + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & rId, + sal_uInt32, sal_Bool bExtra ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + ERRTYPE WriteHxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + ERRTYPE WriteCxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + sal_Bool IsConsistent( const RSCINST & rInst ); + ERRTYPE GetRef( const RSCINST & rInst, RscId * ); + ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); +}; + +#endif //_RSCMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscpar.hxx b/rsc/inc/rscpar.hxx new file mode 100644 index 000000000000..779f2572afb7 --- /dev/null +++ b/rsc/inc/rscpar.hxx @@ -0,0 +1,92 @@ +/* -*- 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 _RSCPAR_HXX +#define _RSCPAR_HXX + +#include <rsctools.hxx> +#include <rscerror.h> + +/****************** C L A S S E S ****************************************/ +class RscTypCont; +class RscExpression; +/*********** R s c F i l e I n s t ***************************************/ + +#define READBUFFER_MAX 256 +class RscFileInst +{ + ERRTYPE aFirstError;// Erster Fehler + sal_uInt32 nErrorLine; // Zeile des ersten Fehlers + sal_uInt32 nErrorPos; // Position des ersten Fehlers + sal_Bool bIncLine; // Muss Zeilennummer incrementiert werden + sal_uInt32 nLineNo; // Zeile in der Eingabedatei + sal_uLong lFileIndex; // Index auf Eingabedatei + sal_uLong lSrcIndex; // Index auf Basisdatei + FILE * fInputFile; // Eingabedatei + char * pInput; // Lesepuffer + sal_uInt32 nInputBufLen; // Laenge des Lesepuffers + sal_uInt32 nInputPos; // Position im Lesepuffer + sal_uInt32 nInputEndPos;// Ende im Lesepuffer + char * pLine; // Zeile + sal_uInt32 nLineBufLen;//Lange des Zeilenpuffres + sal_uInt32 nScanPos; // Position in der Zeile + int cLastChar; + sal_Bool bEof; + +public: + RscTypCont * pTypCont; + void Init(); // ctor initialisieren + RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, + sal_uLong lFileIndex, FILE * fFile ); + ~RscFileInst(); + sal_Bool IsEof() const { return bEof; } + void SetFileIndex( sal_uLong lFIndex ) { lFileIndex = lFIndex; } + sal_uLong GetFileIndex() { return( lFileIndex ); } + sal_uLong GetSrcIndex() { return( lSrcIndex ); } + void SetLineNo( sal_uInt32 nLine ) { nLineNo = nLine; } + sal_uInt32 GetLineNo() { return( nLineNo ); } + sal_uInt32 GetScanPos() { return( nScanPos ); } + char * GetLine() { return( pLine ); } + int GetChar(); + int GetFastChar() { return pLine[ nScanPos ] ? + pLine[ nScanPos++ ] : GetChar(); + } + void GetNewLine(); + // Fehlerbehandlung + void SetError( ERRTYPE aError ); + ERRTYPE GetError() { return aFirstError; } + sal_uInt32 GetErrorLine() { return nErrorLine; } + sal_uInt32 GetErrorPos() { return nErrorPos; } +}; + +/******************* F u n c t i o n *************************************/ +void IncludeParser( RscFileInst * pFileInst ); +ERRTYPE parser( RscFileInst * pFileInst ); + +#endif // _RSCPAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscrange.hxx b/rsc/inc/rscrange.hxx new file mode 100644 index 000000000000..fc43ae88a388 --- /dev/null +++ b/rsc/inc/rscrange.hxx @@ -0,0 +1,212 @@ +/* -*- 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 _RSCRANGE_HXX +#define _RSCRANGE_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> + +/******************* R s c R a n g e *************************************/ +class RscRange : public RscTop +{ +protected: + struct RscRangeInst { + sal_uInt16 nValue; // nValue = Ausgangswert - nMin + sal_Bool bDflt; // Ist Default + }; + sal_Int32 nMin; // Minimum des Bereiches + sal_Int32 nMax; // Maximum des Bereiches + sal_uInt32 nSize; +public: + RscRange( Atom nId, sal_uInt32 nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ); + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 Size(){ return nSize; } + // Eine Zuweisung an eine Variable + virtual void SetToDefault( const RSCINST & rInst ) + { + ((RscRangeInst*)rInst.pData)->bDflt = sal_True; + } + sal_Bool IsDefault( const RSCINST & rInst) + { + return( ((RscRangeInst*)rInst.pData)->bDflt ); + }; + // Als Default setzen + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); + ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +/******************* R s c L o n g R a n g e ******************************/ +class RscLongRange : public RscTop +{ +protected: + struct RscLongRangeInst + { + sal_Int32 nValue; // nValue = Ausgangswert - nMin + sal_Bool bDflt; // Ist Default + }; + sal_Int32 nMin; // Minimum des Bereiches + sal_Int32 nMax; // Maximum des Bereiches + sal_uInt32 nSize; +public: + RscLongRange( Atom nId, sal_uInt32 nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ); + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 Size(){ return nSize; } + // Eine Zuweisung an eine Variable + virtual void SetToDefault( const RSCINST & rInst ) + { + ((RscLongRangeInst*)rInst.pData)->bDflt = sal_True; + } + sal_Bool IsDefault( const RSCINST & rInst) + { + return( ((RscLongRangeInst*)rInst.pData)->bDflt ); + }; + // Als Default setzen + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); + ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + +}; + +/******************* R s c L o n g E n u m R a n g e ******************/ +class RscLongEnumRange : public RscLongRange +{ +public: + RscLongEnumRange( Atom nId, sal_uInt32 nTypId ); + + ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, + sal_Int32 nValue ); +}; + +/******************* R s c I d R a n g e ***********************************/ +class RscIdRange : public RscTop +{ + sal_uInt32 nSize; +protected: + sal_Int32 nMin; // Minimum des Bereiches + sal_Int32 nMax; // Maximum des Bereiches +public: + RscIdRange( Atom nId, sal_uInt32 nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ){ + nMin = nMinimum; + nMax = nMaximum; + return ERR_OK; + } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + void Destroy( const RSCINST & rInst ); + sal_uInt32 Size(){ return nSize; } + virtual void SetToDefault( const RSCINST & rInst ) + { + ((RscId*)rInst.pData)->aExp.cUnused = sal_True; + } + sal_Bool IsDefault( const RSCINST & rInst) + { + //cUnused wird fuer Defaultkennung verwendet + return ((RscId*)rInst.pData)->aExp.cUnused + ? sal_True : sal_False; + } + // Als Default setzen + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); + ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ); + ERRTYPE SetRef( const RSCINST &, const RscId & rRscId ); + ERRTYPE GetRef( const RSCINST & rInst, RscId * ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + sal_Bool IsConsistent( const RSCINST & rInst ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + +}; + +/******************* R s c B o o l ***************************************/ +class RscBool : public RscRange +{ +public: + RscBool( Atom nId, sal_uInt32 nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( sal_Int32, sal_Int32 ){ + return( ERR_UNKNOWN_METHOD ); + }; + ERRTYPE SetBool( const RSCINST & rInst, sal_Bool b ){ + return( SetNumber( rInst, (sal_Int32)b ) ); + }; + ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB){ + sal_Int32 l; + GetNumber( rInst, &l ); + *pB = (0 != l); + return( ERR_OK ); + }; + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + +}; + +class RscBreakRange : public RscRange { + sal_Int32 nOutRange; +public: + RscBreakRange( Atom nId, sal_uInt32 nTypId ); + void SetOutRange( sal_Int32 nNumber ){ + nOutRange = nNumber; + } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); +}; + +#endif // _RSCRANGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx new file mode 100644 index 000000000000..aa7ee437643a --- /dev/null +++ b/rsc/inc/rscrsc.hxx @@ -0,0 +1,129 @@ +/* -*- 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 _RSCRSC_HXX +#define _RSCRSC_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rsctools.hxx> + +#include <list> + +class RscTypCont; +class DirEntry; + +/****************** T Y P E S ********************************************/ + +#define MAX_INPUTFILES 100 +#define MAX_SYMBOLS 10 +#define MAX_INCLUDES 10 + +/****************** R s c C m d L i n e **********************************/ +class RscCmdLine +{ + void Init(); + +public: + + RscStrList aInputList; // Liste der Quelldateien + ByteString aPath; // Liste der Pfade + RSCBYTEORDER_TYPE nByteOrder; + unsigned short nCommands; // Steuerbits + ByteString aOutputLst; // Name der List-Ausgabedatei + ByteString aOutputSrs; // Name der Srs-Ausgabedatei + ByteString aOutputSrc; // Name der Src-Ausgabedatei + ByteString aOutputRcCtor; // Name der Ctor-Ausgabedatei + ByteString aOutputCxx; // Name der Cxx-Ausgabedatei + ByteString aOutputHxx; // Name der Hxx-Ausgabedatei + ByteString aTouchFile; // create this file when done in rsc2 + ByteString aILDir; + + struct OutputFile + { + ByteString aLangName; // language name + ByteString aOutputRc; // target file + ByteString aLangSearchPath; // language specific search path + ::std::list< ByteString > aSysSearchDirs; // pathes to search for images + + OutputFile() {} + }; + + std::list<OutputFile> m_aOutputFiles; + std::list< std::pair< rtl::OString, rtl::OString > > m_aReplacements; + + RscCmdLine( int argc, char ** argv, RscError * pEH ); + ~RscCmdLine(); + + ::rtl::OString substitutePaths( const ::rtl::OString& rIn ); +}; +/****************** R s c ************************************************/ + +struct WriteRcContext; + +class RscCompiler +{ +private: + ByteString aTmpOutputHxx; // Name der TempHxx-Ausgabedatei + ByteString aTmpOutputCxx; // Name der TempCxx-Ausgabedatei + ByteString aTmpOutputRcCtor; // Name der Temp Ctor-Ausgabedatei + ByteString aTmpOutputSrc; // Name der TempSrc-Ausgabedatei + + void CreateResFile( const char * pRc ); + void Append( const ByteString& rOutputSrs, const ByteString& rTmpFile ); + + bool GetImageFilePath( const RscCmdLine::OutputFile& rOutputFile, + const WriteRcContext& rContext, + const ByteString& rBaseFileName, + ByteString& rImagePath, + FILE* pSysListFile ); + void PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, + const WriteRcContext& rContext, + const DirEntry& rSrsInPath, + const DirEntry& rSrsOutPath ); + +public: + RscTypCont* pTC; // String und Id-Verwalter + RscCmdLine* pCL; // Kommandozeile + FILE * fListing; // Ausgabedatei fuer Listings + FILE * fExitFile; // bei Abbruch muss diese Datei geschlossen werden + + RscCompiler( RscCmdLine *, RscTypCont * ); + ~RscCompiler(); + + ERRTYPE Start(); + + // Include Statements lesen + ERRTYPE IncludeParser( sal_uLong lFileKey ); + ERRTYPE ParseOneFile( sal_uLong lFileKey, const RscCmdLine::OutputFile* pOutputFile, const WriteRcContext* pContext ); + ERRTYPE Link(); + void EndCompile(); +}; + +#endif //_RSCRSC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rscstr.hxx b/rsc/inc/rscstr.hxx new file mode 100644 index 000000000000..7df40992cdce --- /dev/null +++ b/rsc/inc/rscstr.hxx @@ -0,0 +1,82 @@ +/* -*- 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 _RSCSTR_HXX +#define _RSCSTR_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> + +/******************* R s c S t r i n g ***********************************/ +class RscString : public RscTop +{ + RscTop * pRefClass; + struct RscStringInst { + char * pStr; // Zeiger auf String + sal_Bool bDflt; // Ist Default + RscId aRefId; // ReferenzName + }; + sal_uInt32 nSize; +public: + RscString( Atom nId, sal_uInt32 nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + + void SetRefClass( RscTop * pClass ) + { + pRefClass = pClass; + }; + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + // Der zulaessige Bereich wird gesetzt + void Destroy( const RSCINST & rInst ); + sal_uInt32 Size(){ return nSize; } + void SetToDefault( const RSCINST & rInst ) + { + ((RscStringInst*)rInst.pData)->bDflt = sal_True; + } + sal_Bool IsDefault( const RSCINST & rInst) + { + return( ((RscStringInst*)rInst.pData)->bDflt ); + }; + // Als Default setzen + sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + ERRTYPE SetString( const RSCINST &, const char * pStr ); + ERRTYPE GetString( const RSCINST &, char ** ppStr ); + ERRTYPE GetRef( const RSCINST & rInst, RscId * ); + ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +#endif // _RSCSTR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx new file mode 100644 index 000000000000..5792c1de8cff --- /dev/null +++ b/rsc/inc/rsctools.hxx @@ -0,0 +1,224 @@ +/* -*- 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. + * + ************************************************************************/ +struct RSHEADER_TYPE; +class RscPtrPtr; + +#ifndef _RSCTOOLS_HXX +#define _RSCTOOLS_HXX + +#ifdef UNX +#include <stdlib.h> +#endif +#include <stdio.h> +#include <tools/string.hxx> +#include <vector> + +/******************* T y p e s *******************************************/ +// Zeichensatz +enum COMPARE { LESS = -1, EQUAL = 0, GREATER = 1 }; + +enum RSCBYTEORDER_TYPE { RSC_BIGENDIAN, RSC_LITTLEENDIAN, RSC_SYSTEMENDIAN }; + +/******************* M A K R O S *****************************************/ +#define ALIGNED_SIZE( nSize ) \ + (nSize + sizeof( void * ) -1) / sizeof( void * ) * sizeof( void * ) +/******************* F u n c t i o n F o r w a r d s *******************/ +ByteString GetTmpFileName(); +sal_Bool Append( ByteString aDestFile, ByteString aSourceFile ); +sal_Bool Append( FILE * fDest, ByteString aSourceFile ); +ByteString OutputFile( ByteString aInput, const char * ext ); +char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv, + sal_uInt32 nArgc ); +void RscExit( sal_uInt32 nExit ); + +/********* A n s i - F u n c t i o n F o r w a r d s *******************/ +int rsc_strnicmp( const char *string1, const char *string2, size_t count ); +int rsc_stricmp( const char *string1, const char *string2 ); +char* rsc_strdup( const char* ); + +/****************** C L A S S E S ****************************************/ + +typedef ::std::vector< ByteString* > RscStrList; + +/*********** R s c C h a r ***********************************************/ +class RscChar +{ +public: + static char * MakeUTF8( char * pStr, sal_uInt16 nTextEncoding ); +}; + +/****************** R s c P t r P t r ************************************/ +class RscPtrPtr +{ + sal_uInt32 nCount; + void ** pMem; +public: + RscPtrPtr(); + ~RscPtrPtr(); + void Reset(); + sal_uInt32 Append( void * ); + sal_uInt32 Append( char * pStr ){ + return( Append( (void *)pStr ) ); + }; + sal_uInt32 GetCount(){ return( nCount ); }; + void * GetEntry( sal_uInt32 nEle ); + void ** GetBlock(){ return( pMem ); }; +}; + +/****************** R s c W r i t e R c **********************************/ +class RscWriteRc +{ + sal_uInt32 nLen; + sal_Bool bSwap; + RSCBYTEORDER_TYPE nByteOrder; + char * pMem; + char * GetPointer( sal_uInt32 nSize ); +public: + RscWriteRc( RSCBYTEORDER_TYPE nOrder = RSC_SYSTEMENDIAN ); + ~RscWriteRc(); + sal_uInt32 IncSize( sal_uInt32 nSize );// gibt die vorherige Groesse + void * GetBuffer() + { + return GetPointer( 0 ); + } + sal_uInt16 GetShort( sal_uInt32 nPos ) + { + sal_uInt16 nVal = 0; + char* pFrom = GetPointer(nPos); + char* pTo = (char*)&nVal; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + return bSwap ? SWAPSHORT( nVal ) : nVal; + } + sal_uInt32 GetLong( sal_uInt32 nPos ) + { + sal_uInt32 nVal = 0; + char* pFrom = GetPointer(nPos); + char* pTo = (char*)&nVal; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + return bSwap ? SWAPLONG( nVal ) : nVal; + } + char * GetUTF8( sal_uInt32 nPos ) + { + return GetPointer( nPos ); + } + + + RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; } + sal_uInt32 Size(){ return( nLen ); }; + void Put( sal_uInt64 lVal ) + { + union + { + sal_uInt64 lVal64; + sal_uInt32 aVal32[2]; + }; + lVal64 = lVal; + if( bSwap ) + { + Put( aVal32[1] ); + Put( aVal32[0] ); + } + else + { + Put( aVal32[0] ); + Put( aVal32[1] ); + } + } + void Put( sal_Int32 lVal ) + { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + + if( bSwap ) + { + Put( aVal16[1] ); + Put( aVal16[0] ); + } + else + { + Put( aVal16[0] ); + Put( aVal16[1] ); + } + } + void Put( sal_uInt32 nValue ) + { Put( (sal_Int32)nValue ); } + void Put( sal_uInt16 nValue ); + void Put( sal_Int16 nValue ) + { Put( (sal_uInt16)nValue ); } + void PutUTF8( char * pData ); + + void PutAt( sal_uInt32 nPos, sal_Int32 lVal ) + { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + + if( bSwap ) + { + PutAt( nPos, aVal16[1] ); + PutAt( nPos + 2, aVal16[0] ); + } + else + { + PutAt( nPos, aVal16[0] ); + PutAt( nPos + 2, aVal16[1] ); + } + } + void PutAt( sal_uInt32 nPos, sal_uInt32 lVal ) + { + PutAt( nPos, (sal_Int32)lVal); + } + void PutAt( sal_uInt32 nPos, short nVal ) + { + PutAt( nPos, (sal_uInt16)nVal ); + } + void PutAt( sal_uInt32 nPos, sal_uInt16 nVal ) + { + if( bSwap ) + nVal = SWAPSHORT( nVal ); + char* pTo = GetPointer( nPos ); + char* pFrom = (char*)&nVal; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + } +}; + +#endif // _RSCTOOLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rsctop.hxx b/rsc/inc/rsctop.hxx new file mode 100644 index 000000000000..77e32041ac8b --- /dev/null +++ b/rsc/inc/rsctop.hxx @@ -0,0 +1,249 @@ +/* -*- 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 _RSCTOP_HXX +#define _RSCTOP_HXX + +#include <rscerror.h> +#include <rsctools.hxx> +#include <rschash.hxx> +#include <rscclobj.hxx> + +/****************** T Y P E S ********************************************/ +typedef sal_uInt32 RSCVAR; +#define VAR_POINTER 0x0001 +#define VAR_HIDDEN 0x0002 +#define VAR_NODATAINST 0x0004 +#define VAR_NORC 0x0008 +#define VAR_SVDYNAMIC 0x0010 +#define VAR_NOENUM 0x0020 +#define VAR_EXTENDABLE 0x0040 /* Auch die Ableitung einer Klasse kann angegeben werden */ + +/****************** C L A S S E S ****************************************/ +/******************* R s c C l a s s *************************************/ +class RscTop : public RefNode +{ + RscTop * pSuperClass; + RSCINST aDfltInst; + sal_uInt32 nTypId; + RscTop * pRefClass; + +protected: + RscTop( Atom nId, sal_uInt32 nTypIdent, + RscTop * pSuperCl = NULL ); + +public: + ByteString aCallPar1; // Klassenaufruf ohne Typen bis ResId + ByteString aCallPar2; // Klassenaufruf ohne Typen ab ResId + ByteString aCallParType; // Klassenaufruf mit Typen + + void SetSuperClass( RscTop * pClass ) + { + pSuperClass = pClass; + } + RscTop* GetSuperClass() const + { return pSuperClass; } + // Gibt den Typidentifier zurueck + sal_uInt32 GetTypId() const + { return nTypId; }; + // Gibt die Oberklasse zurueck + sal_Bool InHierarchy( RscTop * pClass ); + sal_Bool IsCodeWriteable() const + { + return( 0 != aCallParType.Len() ); + } + void SetCallPar( const ByteString & rPar1, const ByteString & rPar2, + const ByteString & rParType ); + void SetRefClass( RscTop * pRef ) { pRefClass = pRef; } + RscTop* GetRefClass() const { return pRefClass; } + virtual RSCCLASS_TYPE GetClassType() const = 0; + RSCINST GetDefault(); + + // Vorbereitung auf den dtor aufruf + // Da die Klassen gegenseitige Abhaengigkeiten + // aufweisen koennen, kann man im dtor nicht davon + // ausgehen, dass alle Klassenzeiger noch gueltig sind + virtual void Pre_dtor(); + + virtual Atom GetConstant( sal_uInt32 ); + + virtual RscTop * GetTypeClass() const; + + // Gibt die Groesse der Klasse in Bytes + virtual sal_uInt32 Size(); + + // Gibt die Referenz zurueck + virtual ERRTYPE GetRef( const RSCINST & rInst, RscId * ); + + // Gibt die Referenz zurueck + virtual ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); + + // Variable anlegen + virtual ERRTYPE SetVariable( Atom nVarName, RscTop * pClass, + RSCINST * pDflt = NULL, + RSCVAR nVarType = 0, sal_uInt32 nMask = 0, + Atom nDataBaseName = InvalidAtom ); + + // Zaehlt alle Variablen auf + virtual void EnumVariables( void * pData, VarEnumCallbackProc ); + + // Liefert Instanz der Variablen zurueck + // pData, pClass im return koennen NULL sein + virtual RSCINST GetVariable( const RSCINST & rInst, Atom nVarName, + const RSCINST & rInitInst, + sal_Bool nInitDflt = sal_False, + RscTop * pCreateClass = NULL ); + virtual RSCINST GetCopyVar( const RSCINST & rInst, Atom nVarName ); + + virtual RSCINST GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos, + const RSCINST & rInitInst ); + + // Liefert Instanz aus einem Feld zurueck + // pGetInst im return kann NULL sein + virtual ERRTYPE GetElement( const RSCINST & rInst, const RscId & rEleName, + RscTop *pCreateClass, const RSCINST & rCreateInst, + RSCINST * pGetInst ); + + // Liefert Instanz aus einem Feld zurueck + // pGetInst im return kann NULL sein + virtual ERRTYPE GetValueEle( const RSCINST & rInst, sal_Int32 lValue, + RscTop * pCreateClass, + RSCINST * pGetInst ); + + // Liefert Instanz aus einem Feld zurueck + // pGetInst im return kann NULL sein + virtual ERRTYPE GetArrayEle( const RSCINST & rInst, Atom nId, + RscTop * pCreateClass, + RSCINST * pGetInst ); + + virtual RSCINST SearchEle( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass ); + + // Liefert Instanz an der Position zurueck + virtual RSCINST GetPosEle( const RSCINST & rInst, sal_uInt32 nPos ); + + // verschiebt eine Instanz + virtual ERRTYPE MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos, + sal_uInt32 nSourcePos ); + + // aendert RscId an Position + virtual ERRTYPE SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos, + const RscId & rRscId); + + // Liefert Information ueber Instanz + // an der Position zurueck + virtual SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ); + + // Anzahl der Eintraege + virtual sal_uInt32 GetCount( const RSCINST & rInst ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetNumber( const RSCINST & rInst, sal_Int32 lValue ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetBool( const RSCINST & rInst, sal_Bool bValue ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, + sal_Int32 nValue ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetNotConst( const RSCINST & rInst, Atom nId ); + + virtual ERRTYPE SetString( const RSCINST & rInst, const char * pStr ); + + virtual ERRTYPE GetNumber( const RSCINST & rInst, sal_Int32 * pN ); + + virtual ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB ); + + virtual ERRTYPE GetConst( const RSCINST & rInst, Atom * pH ); + + virtual ERRTYPE GetString( const RSCINST & rInst, char ** ppStr ); + + virtual RSCINST Create( RSCINST * pInst, + const RSCINST & rDefInst, sal_Bool bOwnClass = sal_False ); + + // Instanz zerstoeren + virtual void Destroy( const RSCINST & rInst ); + + // prueft auf konsistenz + virtual sal_Bool IsConsistent( const RSCINST & rInst ); + + // Alles auf Default setzen + virtual void SetToDefault( const RSCINST & rInst ); + + // Ist Eingabe = Default + virtual sal_Bool IsDefault( const RSCINST & rInst ); + + // Gleiche Werte auf Default setzen + virtual sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + // Instanz auf Default setzen + virtual void SetDefault( const RSCINST & rInst, Atom nVarId ); + + // Default zu einer Variablen holen + virtual RSCINST GetDefault( Atom nVarId ); + + virtual void Delete( const RSCINST & rInst, RscTop * pClass, + const RscId & rId ); + + virtual void DeletePos( const RSCINST & rInst, sal_uInt32 nPos ); + + // Schreibt den Kopf und das Ende einer Resource + // Script Datei + virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, + const RscId & aId, const char * ); + virtual void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab,const char * ); + virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & aId, + sal_uInt32 nDeep, sal_Bool bExtra ); + virtual ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ); + + // Weiterleitung an Superklassen wird unterbunden + virtual ERRTYPE WriteHxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + virtual ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId &rId ); + virtual ERRTYPE WriteCxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId &rId ); + virtual ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId &rId ); + + void WriteSyntaxHeader( FILE * fOutput, RscTypCont * pTC ); + virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC ); + + virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + virtual void WriteRcCtor( FILE * fOutput, RscTypCont * pTC ); +}; + +#endif //_RSCTOP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/rsctree.hxx b/rsc/inc/rsctree.hxx new file mode 100644 index 000000000000..0ff82212bbbf --- /dev/null +++ b/rsc/inc/rsctree.hxx @@ -0,0 +1,121 @@ +/* -*- 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 _RSCTREE_HXX +#define _RSCTREE_HXX + +#include <tools/link.hxx> +#include <rsctools.hxx> + +/****************** C L A S S E S ****************************************/ +class BiNode +{ +protected: + BiNode* pLeft; // left subtree + BiNode* pRight; // right subtree + +public: + + // Wandelt eine doppelt verkettete Liste in + // einen binaeren Baum um + BiNode * ChangeDLListBTree( BiNode * pList ); + + BiNode(); + virtual ~BiNode(); + + + // Wandelt einen binaeren Baum in eine doppelt + // verkettete Liste um + BiNode* ChangeBTreeDLList(); + + BiNode * Left() const { return pLeft ; }; + BiNode * Right() const{ return pRight ; }; + void EnumNodes( Link aLink ) const; +}; + +/*************************************************************************/ +class NameNode : public BiNode +{ + void SubOrderTree( NameNode * pOrderNode ); + +protected: + // pCmp ist Zeiger auf Namen + NameNode* Search( const void * pCmp ) const; + +public: + NameNode* Left() const { return (NameNode *)pLeft ; }; + NameNode* Right() const{ return (NameNode *)pRight ; }; + NameNode* Search( const NameNode * pName ) const; + // insert a new node in the b-tree + sal_Bool Insert( NameNode * pTN, sal_uInt32 * nDepth ); + sal_Bool Insert( NameNode* pTN ); + virtual COMPARE Compare( const NameNode * ) const; + virtual COMPARE Compare( const void * ) const; + NameNode* SearchParent( const NameNode * ) const; + // return ist neue Root + NameNode* Remove( NameNode * ); + void OrderTree(); + sal_Bool IsOrderTree() const; + +}; + +/*************************************************************************/ +class IdNode : public NameNode +{ + virtual COMPARE Compare( const NameNode * ) const; + virtual COMPARE Compare( const void * ) const; +protected: + using NameNode::Search; + +public: + + IdNode* Search( sal_uInt32 nTypName ) const; + virtual sal_uInt32 GetId() const; +}; + +/*************************************************************************/ +class StringNode : public NameNode +{ + virtual COMPARE Compare( const NameNode * ) const; + virtual COMPARE Compare( const void * ) const; + +protected: + using NameNode::Search; + + ByteString aName; + +public: + StringNode(){}; + StringNode( const ByteString & rStr ) { aName = rStr; } + + StringNode* Search( const char * ) const; + ByteString GetName() const { return aName; } +}; + +#endif // _RSCTREE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/inc/vclrsc.hxx b/rsc/inc/vclrsc.hxx new file mode 100644 index 000000000000..2189340bc74d --- /dev/null +++ b/rsc/inc/vclrsc.hxx @@ -0,0 +1,176 @@ +/* -*- 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 _TOOLS_VCLRSC_HXX +#define _TOOLS_VCLRSC_HXX + +#include <sal/types.h> +#include <tools/solar.h> +#include <tools/wintypes.hxx> +#include <tools/fldunit.hxx> +#include <tools/mapunit.hxx> +#include <tools/wintypes.hxx> + +// from vcl/inc/vclenum.hxx +#ifndef ENUM_TIMEFIELDFORMAT_DECLARED +#define ENUM_TIMEFIELDFORMAT_DECLARED + +enum TimeFieldFormat {TIMEF_NONE, TIMEF_SEC, TIMEF_100TH_SEC, TIMEF_SEC_CS, TimeFieldFormat_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ----------------- +// - KeyCode-Types - +// ----------------- +#include <com/sun/star/awt/Key.hpp> +#include <com/sun/star/awt/KeyGroup.hpp> + +#define KEY_CODE ((sal_uInt16)0x0FFF) + +// Modifier-Tasten +#define KEY_SHIFT ((sal_uInt16)0x1000) +#define KEY_MOD1 ((sal_uInt16)0x2000) +#define KEY_MOD2 ((sal_uInt16)0x4000) +#define KEY_MOD3 ((sal_uInt16)0x8000) +#define KEY_MODTYPE ((sal_uInt16)0xF000) +#define KEY_ALLMODTYPE ((sal_uInt16)0xF000) + + +// from vcl/inc/vclenum.hxx +#ifndef ENUM_KEYFUNCTYPE_DECLARED +#define ENUM_KEYFUNCTYPE_DECLARED + +enum KeyFuncType { KEYFUNC_DONTKNOW, KEYFUNC_NEW, KEYFUNC_OPEN, KEYFUNC_SAVE, + KEYFUNC_SAVEAS, KEYFUNC_PRINT, KEYFUNC_CLOSE, KEYFUNC_QUIT, + KEYFUNC_CUT, KEYFUNC_COPY, KEYFUNC_PASTE, KEYFUNC_UNDO, + KEYFUNC_REDO, KEYFUNC_DELETE, KEYFUNC_REPEAT, KEYFUNC_FIND, + KEYFUNC_FINDBACKWARD, KEYFUNC_PROPERTIES, KEYFUNC_FRONT, + KeyFuncType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + + +// -------------------------- +// - Bits fuer ToolBoxItems - +// -------------------------- + +// from vcl/inc/toolbox.hxx +typedef sal_uInt16 ToolBoxItemBits; + +#define TIB_CHECKABLE ((ToolBoxItemBits)0x0001) +#define TIB_RADIOCHECK ((ToolBoxItemBits)0x0002) +#define TIB_AUTOCHECK ((ToolBoxItemBits)0x0004) +#define TIB_LEFT ((ToolBoxItemBits)0x0008) +#define TIB_AUTOSIZE ((ToolBoxItemBits)0x0010) +#define TIB_DROPDOWN ((ToolBoxItemBits)0x0020) +#define TIB_REPEAT ((ToolBoxItemBits)0x0040) + +enum ButtonType { BUTTON_SYMBOL, BUTTON_TEXT, BUTTON_SYMBOLTEXT }; + +enum ToolBoxItemType { TOOLBOXITEM_DONTKNOW, TOOLBOXITEM_BUTTON, + TOOLBOXITEM_SPACE, TOOLBOXITEM_SEPARATOR, + TOOLBOXITEM_BREAK }; + + +// --------------- +// - BorderStyle - +// --------------- + +typedef sal_uInt16 WindowBorderStyle; + +#define WINDOW_BORDER_NORMAL ((WindowBorderStyle)0x0001) +#define WINDOW_BORDER_MONO ((WindowBorderStyle)0x0002) +#define WINDOW_BORDER_ACTIVE ((WindowBorderStyle)0x0004) +#define WINDOW_BORDER_DOUBLEOUT ((WindowBorderStyle)0x0008) +#define WINDOW_BORDER_MENU ((WindowBorderStyle)0x0010) +#define WINDOW_BORDER_NOBORDER ((WindowBorderStyle)0x1000) + +// -------------- +// - Menu-Types - +// -------------- + +// from vcl/inc/menu.hxx +enum MenuItemType { MENUITEM_DONTKNOW, MENUITEM_STRING, MENUITEM_IMAGE, + MENUITEM_STRINGIMAGE, MENUITEM_SEPARATOR }; + +typedef sal_uInt16 MenuItemBits; + +#define MIB_CHECKABLE ((MenuItemBits)0x0001) +#define MIB_RADIOCHECK ((MenuItemBits)0x0002) +#define MIB_AUTOCHECK ((MenuItemBits)0x0004) +#define MIB_ABOUT ((MenuItemBits)0x0008) +#define MIB_HELP ((MenuItemBits)0x0010) +#define MIB_POPUPSELECT ((MenuItemBits)0x0020) + +// ---------------- +// - Symbol-Types - +// ---------------- + +// from vcl/inc/symbol.hxx +typedef sal_uInt16 SymbolType; +#define SYMBOL_DONTKNOW ((SymbolType)0) +#define SYMBOL_IMAGE ((SymbolType)1) +#define SYMBOL_ARROW_UP ((SymbolType)2) +#define SYMBOL_ARROW_DOWN ((SymbolType)3) +#define SYMBOL_ARROW_LEFT ((SymbolType)4) +#define SYMBOL_ARROW_RIGHT ((SymbolType)5) +#define SYMBOL_SPIN_UP ((SymbolType)6) +#define SYMBOL_SPIN_DOWN ((SymbolType)7) +#define SYMBOL_SPIN_LEFT ((SymbolType)8) +#define SYMBOL_SPIN_RIGHT ((SymbolType)9) +#define SYMBOL_FIRST ((SymbolType)10) +#define SYMBOL_LAST ((SymbolType)11) +#define SYMBOL_PREV ((SymbolType)12) +#define SYMBOL_NEXT ((SymbolType)13) +#define SYMBOL_PAGEUP ((SymbolType)14) +#define SYMBOL_PAGEDOWN ((SymbolType)15) +#define SYMBOL_PLAY ((SymbolType)16) +#define SYMBOL_REVERSEPLAY ((SymbolType)17) +#define SYMBOL_RECORD ((SymbolType)18) +#define SYMBOL_STOP ((SymbolType)19) +#define SYMBOL_PAUSE ((SymbolType)20) +#define SYMBOL_WINDSTART ((SymbolType)21) +#define SYMBOL_WINDEND ((SymbolType)22) +#define SYMBOL_WINDBACKWARD ((SymbolType)23) +#define SYMBOL_WINDFORWARD ((SymbolType)24) +#define SYMBOL_CLOSE ((SymbolType)25) +#define SYMBOL_ROLLUP ((SymbolType)26) +#define SYMBOL_ROLLDOWN ((SymbolType)27) +#define SYMBOL_CHECKMARK ((SymbolType)28) +#define SYMBOL_RADIOCHECKMARK ((SymbolType)29) +#define SYMBOL_SPIN_UPDOWN ((SymbolType)30) +#define SYMBOL_FLOAT ((SymbolType)31) +#define SYMBOL_DOCK ((SymbolType)32) +#define SYMBOL_HIDE ((SymbolType)33) +#define SYMBOL_HELP ((SymbolType)34) + +#define SYMBOL_NOSYMBOL (SYMBOL_DONTKNOW) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |