diff options
Diffstat (limited to 'rsc/source/parser')
-rw-r--r-- | rsc/source/parser/erscerr.cxx | 476 | ||||
-rw-r--r-- | rsc/source/parser/makefile.mk | 67 | ||||
-rw-r--r-- | rsc/source/parser/rscdb.cxx | 1034 | ||||
-rw-r--r-- | rsc/source/parser/rscibas.cxx | 644 | ||||
-rw-r--r-- | rsc/source/parser/rscicpx.cxx | 2350 | ||||
-rw-r--r-- | rsc/source/parser/rscinit.cxx | 934 | ||||
-rw-r--r-- | rsc/source/parser/rsckey.cxx | 192 | ||||
-rw-r--r-- | rsc/source/parser/rsclex.cxx | 451 | ||||
-rw-r--r-- | rsc/source/parser/rsclex.hxx | 131 | ||||
-rw-r--r-- | rsc/source/parser/rscpar.cxx | 218 | ||||
-rw-r--r-- | rsc/source/parser/rscyacc.cxx | 270 | ||||
-rw-r--r-- | rsc/source/parser/rscyacc.y | 1118 |
12 files changed, 7885 insertions, 0 deletions
diff --git a/rsc/source/parser/erscerr.cxx b/rsc/source/parser/erscerr.cxx new file mode 100644 index 000000000000..23337514b2c5 --- /dev/null +++ b/rsc/source/parser/erscerr.cxx @@ -0,0 +1,476 @@ +/* -*- 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): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +#include <stdlib.h> +#include <stdio.h> + +#include <tools/rcid.h> +#include <rschash.hxx> +#include <rscerror.h> +#include <rscall.h> +#include <rscdb.hxx> +#include <rscpar.hxx> + +#include "rsclex.hxx" + +/************************************************************************* +|* +|* ERRTYPE::operator = ; +|* +*************************************************************************/ +ERRTYPE& ERRTYPE::operator = ( const ERRTYPE & rError ) +{ + if( !IsError() ){ + if( rError.IsError() || !IsWarning() ) + nError = rError.nError; + } + return *this; +} + +/************************************************************************* +|* +|* RscError::StdOut(); +|* +*************************************************************************/ +void RscError::StdOut( const char * pStr, const RscVerbosity _verbosityLevel ) +{ + if ( m_verbosity >= _verbosityLevel ) + { + if( pStr ){ + printf( "%s", pStr ); + fflush( stdout ); + } + } +} + +/************************************************************************* +|* +|* RscError::StdErr(); +|* +*************************************************************************/ +void RscError::StdErr( const char * pStr ) +{ + if( pStr ) + fprintf( stderr, "%s", pStr ); +} + +/************************************************************************* +|* +|* RscError::LstOut(); +|* +*************************************************************************/ +void RscError::LstOut( const char * pStr ){ + if( fListing && pStr ) + fprintf( fListing, "%s", pStr ); +} + +/************************************************************************* +|* +|* RscError::StdLstOut(); +|* +*************************************************************************/ +void RscError::StdLstOut( const char * pStr ){ + StdOut( pStr ); + LstOut( pStr ); +} + +/************************************************************************* +|* +|* RscError::StdLstErr(); +|* +*************************************************************************/ +void RscError::StdLstErr( const char * pStr ){ + StdErr( pStr ); + LstOut( pStr ); +} + +/************************************************************************* +|* +|* RscError::WriteError(); +|* +*************************************************************************/ +void RscError::WriteError( const ERRTYPE& rError, const char * pMessage ) +{ + switch( rError ) + { + case ERR_ERROR: { + StdLstErr( "!! " ); + if( 1 == nErrors ) + StdLstErr( ByteString::CreateFromInt32( nErrors ).GetBuffer() ); + else + StdLstErr( ByteString::CreateFromInt32( (nErrors -1) ).GetBuffer() ); + StdLstErr( " Error" ); + StdLstErr( " found!!" ); + } + break; + + case ERR_UNKNOWN_METHOD: + StdLstErr( "The used type is not allowed." ); + break; + + case ERR_OPENFILE: + StdLstErr( "This file <" ); + StdLstErr( pMessage ); + StdLstErr( "> cannot be opened." ); + break; + + case ERR_RENAMEFILE: + StdLstErr( "rename <" ); + StdLstErr( pMessage ); + StdLstErr( "> s not possible." ); + break; + + case ERR_FILESIZE: + StdLstErr( "Wrong file <" ); + StdLstErr( pMessage ); + StdLstErr( "> length." ); + break; + + case ERR_FILEFORMAT: + StdLstErr( "Wrong file type <" ); + StdLstErr( pMessage ); + StdLstErr( ">." ); + break; + + case ERR_NOCHAR: + StdLstErr( "Character: '\\xxx'; The value xxx is greater than 255."); + break; + + case ERR_NORSCINST: + StdLstErr( "Internal error, instance invalid."); + break; + + + case ERR_NOINPUT: + StdLstErr( "Input file was not specified.\n"); + case ERR_USAGE: + StdLstOut( "Copyright (C) 2000, 2010 Oracle and/or its affiliates.\n" ); + { + char buf[40]; + + StdLstOut( "DataVersion: " ); + sprintf( buf, "%d.%d\n\n", + RSCVERSION_ID / 100, RSCVERSION_ID % 100 ); + StdLstOut( buf ); + }; + + StdLstOut( "Command line: rsc [Switches] <Source File(s)>\n" ); + StdLstOut( "Command line: rsc @<Command File>\n" ); + StdLstOut( "-h shows this help.\n" ); + StdLstOut( "-p No Preprocessor.\n" ); + StdLstOut( "-s Syntax analysis, creates .srs file\n"); + StdLstOut( "-l Linker, links files created with rsc -s,\n" ); + StdLstOut( " creates .rc file and .res file.\n" ); + StdLstOut( "-r Prevents .res file.\n" ); + StdLstOut( "-d Symbol definitions for the Preprocessor.\n" ); + StdLstOut( "-i Include directives for the Preprocessor.\n" ); + StdLstOut( "-presponse Use response file for Preprocessor.\n" ); + StdLstOut( "-lg<language> Use a different language.\n" ); + StdLstOut( "-pp=<filename> Use a different Preprocessor.\n" ); + StdLstOut( "-rsc2=<filename> Specify the location for rsc2.\n" ); + StdLstOut( "No longer existent: -rc<filename> Use a different system resource compiler.\n" ); + StdLstOut( "-fs=<filename> Name of the .res file.\n" ); + StdLstOut( "-lip=<path> additional search path for system dependant files\n" ); + StdLstOut( "-fp=<filename> Renaming of the .srs file.\n" ); + StdLstOut( "-fl=<filename> Listing file.\n" ); + StdLstOut( "-fh=<filename> Header file.\n" ); + StdLstOut( "-fc=<filename> Code file.\n" ); + StdLstOut( "-ft=<filename> Touch a file when done in rsc2 (for dependencies)\n" ); + StdLstOut( "-fr=<filename> Ressource constructor .cxx-file.\n" ); + StdLstOut( "-fx=<filename> Name of .src-file.\n" ); + StdLstOut( "-oil=<dir> Output directory for image list files\n" ); + StdLstOut( "-r<ENV>=<path> replace <path> by <ENV> in image list files\n" ); + StdLstOut( "-CHARSET_... Convert to this character set.\n" ); + StdLstOut( "-BIGENDIAN Format of number values.\n" ); + StdLstOut( "-LITTLEENDIAN Format of number values.\n" ); + StdLstOut( "-SMART Generate smart names (cxx, hxx).\n" ); + StdLstOut( "-SrsDefault Only write one language to srs file.\n" ); + StdLstOut( "\nwhen creating multiple .res files in one pass, please give these\n" ); + StdLstOut( "options in consecutive blocks:\n" ); + StdLstOut( "-lg<language> -fs<filename> [-lip<path> [-lip<path>] ]\n" ); + StdLstOut( "a new block begins when either -lg or -fs is used again.\n" ); + break; + + case ERR_UNKNOWNSW: + StdLstErr( "Unknown switch <" ); + StdLstErr( pMessage ); + StdLstErr( ">." ); + break; + + case ERR_REFTODEEP: + StdLstErr( "Too many reference levels have been used (see Switch -RefDeep)." ); + break; + + case ERR_CONT_INVALIDPOS: + StdLstErr( "Internal error, Container class: invalid position." ); + break; + + case ERR_CONT_INVALIDTYPE: + StdLstErr( "Invalid type <" ); + StdLstErr( pMessage ); + StdLstErr( ">." ); + break; + + case ERR_ARRAY_INVALIDINDEX: + StdLstErr( "Internal error, Array class: invalid index." ); + break; + + case ERR_RSCINST_NOVARNAME: + StdLstErr( "Internal error, invalid name of variable." ); + break; + + case ERR_YACC: + StdLstErr( pMessage ); + break; + + case ERR_DOUBLEID: + StdLstErr( "Two global resources have the same identifier." ); + break; + + case ERR_FALSETYPE: + StdLstErr( "Wrong type <" ); + StdLstErr( pMessage ); + StdLstErr( ">." ); + break; + + case ERR_NOVARIABLENAME: + StdLstErr( "The variable <" ); + StdLstErr( pMessage ); + StdLstErr( "> must not be used here." ); + break; + + case ERR_RSCRANGE_OUTDEFSET: + StdLstErr( "The used value is not in the expected domain." ); + break; + + case ERR_USHORTRANGE: + StdLstErr( "Value is <" ); + StdLstErr( pMessage ); + StdLstErr( "> the allowed domain is from 0 up to 65535." ); + break; + + case ERR_IDRANGE: + StdLstErr( "Value is <" ); + StdLstErr( pMessage ); + StdLstErr( "> the allowed domain is from 1 up to 32767." ); + break; + + case ERR_NOCOPYOBJ: + StdLstErr( "Default resource <" ); + StdLstErr( pMessage ); + StdLstErr( "> not found." ); + break; + + case ERR_REFNOTALLOWED: + StdLstErr( "The use of a reference is not allowed." ); + break; + + case ERR_COPYNOTALLOWED: + StdLstErr( "The use of a default resource is not allowed." ); + break; + + case ERR_IDEXPECTED: + StdLstErr( "An identifier needs to be specified." ); + break; + + case ERR_DOUBLEDEFINE: + StdLstErr( "The symbol <" ); + StdLstErr( pMessage ); + StdLstErr( "> is defined twice." ); + break; + + case ERR_RSCINST_RESERVEDNAME: + StdLstErr( "The symbol <" ); + StdLstErr( pMessage ); + StdLstErr( "> is a reserved name." ); + break; + + case ERR_ZERODIVISION: + StdLstErr( "Attempt to divide by zero." ); + break; + + case ERR_PRAGMA: + StdLstErr( "Error in a #pragma statement." ); + break; + + case ERR_DECLAREDEFINE: + StdLstErr( "Error in the declaration part of the macro." ); + break; + + case ERR_NOTYPE: + StdLstErr( "type expected." ); + break; + + case ERR_NOIMAGE: + StdLstErr( "The image(s) <" ); + StdLstErr( pMessage ); + StdLstErr( "> could not be found." ); + break; + +/****************** W A R N I N G S **************************************/ + case WRN_LOCALID: + StdLstErr( "Sub resources should have an identifier < 256." ); + break; + + case WRN_GLOBALID: + StdLstErr( "Global resources should have an identifier >= 256." ); + break; + + case WRN_SUBINMEMBER: + StdLstErr( "Sub resources are ignored." ); + break; + + case WRN_CONT_NOID: + StdLstErr( "Resources without name are ignored." ); + break; + + case WRN_CONT_DOUBLEID: + StdLstErr( "Two local resources have the same identifier." ); + break; + + case WRN_STR_REFNOTFOUND: + StdLstErr( "String reference <" ); + StdLstErr( pMessage ); + StdLstErr( " > could not be resolved." ); + break; + + case WRN_MGR_REFNOTFOUND: + StdLstErr( "Reference <" ); + StdLstErr( pMessage ); + StdLstErr( " > could not be resolved." ); + break; + + default: + if( pMessage ){ + StdLstErr( "\nMessage: " ); + StdLstErr( pMessage ); + }; + break; + } +} + +/************************************************************************* +|* +|* RscErrorFormat() +|* +*************************************************************************/ +void RscError::ErrorFormat( const ERRTYPE& rError, RscTop * pClass, + const RscId & aId ){ + char buf[ 10 ]; + sal_uInt32 i; + + if( pFI ) + { + pFI->SetError( rError ); + StdErr( "\n" ); + StdErr( pFI->GetLine() ); + StdErr( "\n" ); + // Fehlerposition anzeigen + for( i = 0; (i +1) < pFI->GetScanPos(); i++ ) + StdLstErr( " " ); + LstOut( " ^" ); //Zeilennummern beachten + StdErr( "^" ); + StdLstErr( "\n" ); + } + StdLstErr( "f" ); + sprintf( buf, "%u", (unsigned int)rError ); + StdLstErr( buf ); + + if( pFI && pTC ){ + StdLstErr( ": \"" ); + StdLstErr( pTC->aFileTab.Get( pFI->GetFileIndex() )->aFileName.GetBuffer() ); + StdLstErr( "\", line " ); + sprintf( buf, "%u", (unsigned int)pFI->GetLineNo() ); + StdLstErr( buf ); + } + + if( rError.IsError() ) + StdLstErr( ": Error" ); + else + StdLstErr( ": Warning" ); + + if( pClass || aId.IsId() ) + { + StdLstErr( " in the object (" ); + if( pClass ) + { + StdLstErr( "Type: " ); + StdLstErr( pHS->getString( pClass->GetId() ).getStr() ); + if( aId.IsId() ) + StdLstErr( ", " ); + } + if( aId.IsId() ) + StdLstErr( aId.GetName().GetBuffer() ); + StdLstErr( "):\n" ); + } + else + StdLstErr( ": " ); +} + +/************************************************************************* +|* +|* RscError::Error() +|* +*************************************************************************/ +void RscError::Error( const ERRTYPE& rError, RscTop * pClass, + const RscId & aId, const char * pMessage ) +{ + if( WRN_LOCALID == rError ) // Keine Warning erzeugen + return; + if( rError.IsError() ) + nErrors++; + if( rError.IsError() || rError.IsWarning() ){ + ErrorFormat( rError, pClass, aId ); + WriteError( rError, pMessage ); + StdLstErr( "\n" ); + }; +} + +/************************************************************************* +|* +|* RscError::FatalError(); +|* +*************************************************************************/ +void RscError::FatalError( const ERRTYPE& rError, const RscId &aId, + const char * pMessage ) +{ + if( ERR_USAGE != rError ){ + nErrors++; + ErrorFormat( rError, NULL, aId ); + WriteError( rError, pMessage ); + StdLstErr( "\nTerminating compiler\n" ); + } + else + WriteError( rError, pMessage ); + + exit( 1 ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/makefile.mk b/rsc/source/parser/makefile.mk new file mode 100644 index 000000000000..a46c60aae213 --- /dev/null +++ b/rsc/source/parser/makefile.mk @@ -0,0 +1,67 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +PRJ=..$/.. + +PROJECTPCH=parser +PROJECTPCHSOURCE=parser +PRJNAME=rsc +TARGET=rscpar + +# --- Settings ----------------------------------------------------- + +#prjpch=T + +ENABLE_EXCEPTIONS=true + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +YACCTARGET= $(INCCOM)$/yyrscyacc.cxx +YACCFILES= rscyacc.y + +OBJFILES= $(OBJ)$/rscpar.obj \ + $(OBJ)$/rscyacc.obj \ + $(OBJ)$/rsclex.obj \ + $(OBJ)$/erscerr.obj \ + $(OBJ)$/rsckey.obj \ + $(OBJ)$/rscinit.obj \ + $(OBJ)$/rscibas.obj \ + $(OBJ)$/rscdb.obj \ + $(OBJ)$/rscicpx.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +$(OBJ)$/rscibas.obj : $(YACCTARGET) +$(OBJ)$/rscinit.obj : $(YACCTARGET) +$(OBJ)$/rscicpx.obj : $(YACCTARGET) +$(OBJ)$/rsclex.obj : $(YACCTARGET) +$(OBJ)$/rscyacc.obj : $(YACCTARGET) + diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx new file mode 100644 index 000000000000..a71b4a51eea2 --- /dev/null +++ b/rsc/source/parser/rscdb.cxx @@ -0,0 +1,1034 @@ +/* -*- 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): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <ctype.h> // isdigit(), isalpha() +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <tools/fsys.hxx> +#include <tools/rc.h> +#include <tools/isofallback.hxx> +#include <rtl/strbuf.hxx> +#include <sal/macros.h> + +// Programmabhaengige Includes. +#include <rsctree.hxx> +#include <rsctop.hxx> +#include <rscmgr.hxx> +#include <rscdb.hxx> +#include <rscrsc.hxx> + +using ::rtl::OString; +using ::rtl::OStringBuffer; + +/************************************************************************* +|* +|* RscTypCont :: RscTypCont +|* +*************************************************************************/ +RscTypCont :: RscTypCont( RscError * pErrHdl, + RSCBYTEORDER_TYPE nOrder, + const ByteString & rSearchPath, + sal_uInt32 nFlagsP ) + : + nSourceCharSet( RTL_TEXTENCODING_UTF8 ), + nByteOrder( nOrder ), + aSearchPath( rSearchPath ), + aBool( pHS->getID( "sal_Bool" ), RSC_NOTYPE ), + aShort( pHS->getID( "short" ), RSC_NOTYPE ), + aUShort( pHS->getID( "sal_uInt16" ), RSC_NOTYPE ), + aLong( pHS->getID( "long" ), RSC_NOTYPE ), + aEnumLong( pHS->getID( "enum_long" ), RSC_NOTYPE ), + aIdUShort( pHS->getID( "IDUSHORT" ), RSC_NOTYPE ), + aIdNoZeroUShort( pHS->getID( "IDUSHORT" ), RSC_NOTYPE ), + aNoZeroShort( pHS->getID( "NoZeroShort" ), RSC_NOTYPE ), + a1to12Short( pHS->getID( "MonthShort" ), RSC_NOTYPE ), + a0to23Short( pHS->getID( "HourShort" ), RSC_NOTYPE ), + a1to31Short( pHS->getID( "DayShort" ), RSC_NOTYPE ), + a0to59Short( pHS->getID( "MinuteShort" ), RSC_NOTYPE ), + a0to99Short( pHS->getID( "_0to59Short" ), RSC_NOTYPE ), + a0to9999Short( pHS->getID( "YearShort" ), RSC_NOTYPE ), + aIdLong( pHS->getID( "IDLONG" ), RSC_NOTYPE ), + aString( pHS->getID( "Chars" ), RSC_NOTYPE ), + aStringLiteral( pHS->getID( "Chars" ), RSC_NOTYPE ), + aWinBits( pHS->getID( "WinBits" ), RSC_NOTYPE ), + aLangType(), + aLangString( pHS->getID( "Lang_Chars" ), RSC_NOTYPE, &aString, &aLangType ), + aLangShort( pHS->getID( "Lang_short" ), RSC_NOTYPE, &aShort, &aLangType ), + nAcceleratorType( 0 ), + nFlags( nFlagsP ) +{ + nUniqueId = 256; + nPMId = RSC_VERSIONCONTROL +1; //mindestens einen groesser + pEH = pErrHdl; + Init(); +} + +static sal_uInt32 getLangIdAndShortenLocale( RscTypCont* pTypCont, + rtl::OString& rLang, + rtl::OString& rCountry, + rtl::OString& rVariant ) +{ + rtl::OStringBuffer aLangStr( 64 ); + aLangStr.append( rLang.toAsciiLowerCase() ); + if( rCountry.getLength() ) + { + aLangStr.append( '-' ); + aLangStr.append( rCountry.toAsciiUpperCase() ); + } + if( rVariant.getLength() ) + { + aLangStr.append( '-' ); + aLangStr.append( rVariant ); + } + rtl::OString aL( aLangStr.makeStringAndClear() ); + sal_uInt32 nRet = GetLangId( aL ); + if( nRet == 0 ) + { + pTypCont->AddLanguage( aL ); + nRet = GetLangId( aL ); + } + if( rVariant.getLength() ) + rVariant = rtl::OString(); + else if( rCountry.getLength() ) + rCountry = rtl::OString(); + else + rLang = rtl::OString(); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, " %s (0x%hx)", aL.getStr(), (int)nRet ); +#endif + return nRet; +} + +ByteString RscTypCont::ChangeLanguage( const ByteString& rNewLang ) +{ + ByteString aRet = aLanguage; + aLanguage = rNewLang; + + rtl::OString aLang = aLanguage; + rtl::OString aLg, aCountry, aVariant; + sal_Int32 nIndex = 0; + aLg = aLang.getToken( 0, '-', nIndex ); + if( nIndex != -1 ) + aCountry = aLang.getToken( 0, '-', nIndex ); + if( nIndex != -1 ) + aVariant = aLang.copy( nIndex ); + + bool bAppendEnUsFallback = + ! (rNewLang.EqualsIgnoreCaseAscii( "en-US" ) || + rNewLang.EqualsIgnoreCaseAscii( "x-no-translate" ) ); + +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "RscTypCont::ChangeLanguage:" ); +#endif + aLangFallbacks.clear(); + + do + { + aLangFallbacks.push_back(getLangIdAndShortenLocale( this, aLg, aCountry, aVariant ) ); + } while( aLg.getLength() ); + + if( bAppendEnUsFallback ) + { + aLg = "en"; + aCountry = "US"; + aVariant = rtl::OString(); + aLangFallbacks.push_back( getLangIdAndShortenLocale( this, aLg, aCountry, aVariant ) ); + } + +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "\n" ); +#endif + + return aRet; +} + +Atom RscTypCont::AddLanguage( const char* pLang ) +{ + return aLangType.AddLanguage( pLang, aNmTb ); +} + + +/************************************************************************* +|* +|* RscTypCont :: ~RscTypCont +|* +*************************************************************************/ +void DestroyNode( RscTop * pRscTop, ObjNode * pObjNode ){ + if( pObjNode ){ + DestroyNode( pRscTop, (ObjNode*)pObjNode->Left() ); + DestroyNode( pRscTop, (ObjNode*)pObjNode->Right() ); + + if( pObjNode->GetRscObj() ){ + pRscTop->Destroy( RSCINST( pRscTop, pObjNode->GetRscObj() ) ); + rtl_freeMemory( pObjNode->GetRscObj() ); + } + delete pObjNode; + }; +} + +void DestroySubTrees( RscTop * pRscTop ){ + if( pRscTop ){ + DestroySubTrees( (RscTop*)pRscTop->Left() ); + + DestroyNode( pRscTop, pRscTop->GetObjNode() ); + + DestroySubTrees( (RscTop*)pRscTop->Right() ); + }; +} + +void DestroyTree( RscTop * pRscTop ){ + if( pRscTop ){ + DestroyTree( (RscTop*)pRscTop->Left() ); + DestroyTree( (RscTop*)pRscTop->Right() ); + + delete pRscTop; + }; +} + +void Pre_dtorTree( RscTop * pRscTop ){ + if( pRscTop ){ + Pre_dtorTree( (RscTop*)pRscTop->Left() ); + Pre_dtorTree( (RscTop*)pRscTop->Right() ); + + pRscTop->Pre_dtor(); + }; +} + +RscTypCont :: ~RscTypCont(){ + // Alle Unterbaeume loeschen + aVersion.pClass->Destroy( aVersion ); + rtl_freeMemory( aVersion.pData ); + DestroySubTrees( pRoot ); + + // Alle Klassen noch gueltig, jeweilige Instanzen freigeben + // BasisTypen + for ( size_t i = 0, n = aBaseLst.size(); i < n; ++i ) + aBaseLst[ i ]->Pre_dtor(); + aBool.Pre_dtor(); + aShort.Pre_dtor(); + aUShort.Pre_dtor(); + aIdUShort.Pre_dtor(); + aIdNoZeroUShort.Pre_dtor(); + aNoZeroShort.Pre_dtor(); + aIdLong.Pre_dtor(); + aString.Pre_dtor(); + aWinBits.Pre_dtor(); + aVersion.pClass->Pre_dtor(); + // Zusammengesetzte Typen + Pre_dtorTree( pRoot ); + + // Klassen zerstoeren + delete aVersion.pClass; + DestroyTree( pRoot ); + + for ( size_t i = 0, n = aBaseLst.size(); i < n; ++i ) + delete aBaseLst[ i ]; + aBaseLst.clear(); + + for ( size_t i = 0, n = aSysLst.size(); i < n; ++i ) + delete aSysLst[ i ]; + aSysLst.clear(); +} + +void RscTypCont::ClearSysNames() +{ + for ( size_t i = 0, n = aSysLst.size(); i < n; ++i ) + delete aSysLst[ i ]; + aSysLst.clear(); +} + +//======================================================================= +RscTop * RscTypCont::SearchType( Atom nId ) +/* [Beschreibung] + + Sucht eine Basistyp nId; +*/ +{ + if( nId == InvalidAtom ) + return NULL; + +#define ELSE_IF( a ) \ + else if( a.GetId() == nId ) \ + return &a; \ + + if( aBool.GetId() == nId ) + return &aBool; + ELSE_IF( aShort ) + ELSE_IF( aUShort ) + ELSE_IF( aLong ) + ELSE_IF( aEnumLong ) + ELSE_IF( aIdUShort ) + ELSE_IF( aIdNoZeroUShort ) + ELSE_IF( aNoZeroShort ) + ELSE_IF( a1to12Short ) + ELSE_IF( a0to23Short ) + ELSE_IF( a1to31Short ) + ELSE_IF( a0to59Short ) + ELSE_IF( a0to99Short ) + ELSE_IF( a0to9999Short ) + ELSE_IF( aIdLong ) + ELSE_IF( aString ) + ELSE_IF( aWinBits ) + ELSE_IF( aLangType ) + ELSE_IF( aLangString ) + ELSE_IF( aLangShort ) + + for ( size_t i = 0, n = aBaseLst.size(); i < n; ++i ) + { + RscTop* pEle = aBaseLst[ i ]; + if( pEle->GetId() == nId ) + return pEle; + } + return NULL; +} + +/************************************************************************* +|* +|* RscTypCont :: Search +|* +*************************************************************************/ +RscTop * RscTypCont :: Search( Atom nRT ){ + return( (RscTop *)pRoot->Search( nRT ) ); +} + +CLASS_DATA RscTypCont :: Search( Atom nRT, const RscId & rId ){ + ObjNode *pObjNode; + RscTop *pRscTop; + + if( NULL != (pRscTop = Search( nRT )) ){ + if( NULL != (pObjNode = pRscTop->GetObjNode( rId )) ){ + return( pObjNode->GetRscObj() ); + } + } + return( (CLASS_DATA)0 ); +} + +/************************************************************************* +|* +|* RscTypCont :: Delete() +|* +*************************************************************************/ +void RscTypCont :: Delete( Atom nRT, const RscId & rId ){ + ObjNode * pObjNode; + RscTop * pRscTop; + + if( NULL != (pRscTop = Search( nRT )) ){ + if( NULL != (pObjNode = pRscTop->GetObjNode()) ){ + pObjNode = pObjNode->Search( rId ); + + if( pObjNode ){ + //Objekt aus Baum entfernen + pRscTop->pObjBiTree = + (ObjNode *)pRscTop->pObjBiTree->Remove( pObjNode ); + + if( pObjNode->GetRscObj() ){ + pRscTop->Destroy( RSCINST( pRscTop, + pObjNode->GetRscObj() ) ); + rtl_freeMemory( pObjNode->GetRscObj() ); + } + delete pObjNode; + } + } + } +} + +/************************************************************************* +|* +|* RscTypCont :: PutSysName() +|* +*************************************************************************/ +sal_uInt32 RscTypCont :: PutSysName( sal_uInt32 nRscTyp, char * pFileName, + sal_uInt32 nConst, sal_uInt32 nId, sal_Bool bFirst ) +{ + RscSysEntry *pSysEntry; + RscSysEntry *pFoundEntry = NULL; + sal_Bool bId1 = sal_False; + + for ( size_t i = 0, n = aSysLst.size(); i < n; ++i ) + { + pSysEntry = aSysLst[ i ]; + if( pSysEntry->nKey == 1 ) + bId1 = sal_True; + if( !strcmp( pSysEntry->aFileName.GetBuffer(), pFileName ) ) + if( pSysEntry->nRscTyp == nRscTyp + && pSysEntry->nTyp == nConst + && pSysEntry->nRefId == nId + ) { + pFoundEntry = pSysEntry; + break; + } + } + pSysEntry = pFoundEntry; + + if ( !pSysEntry || (bFirst && !bId1) ) + { + pSysEntry = new RscSysEntry; + pSysEntry->nKey = nUniqueId++; + pSysEntry->nRscTyp = nRscTyp; + pSysEntry->nTyp = nConst; + pSysEntry->nRefId = nId; + pSysEntry->aFileName = (const char*)pFileName; + if( bFirst && !bId1 ) + { + pSysEntry->nKey = 1; + aSysLst.insert( aSysLst.begin(), pSysEntry ); + } + else + aSysLst.push_back( pSysEntry ); + } + + return pSysEntry->nKey; +} + +/************************************************************************* +|* +|* RscTypCont :: WriteInc +|* +*************************************************************************/ +void RscTypCont :: WriteInc( FILE * fOutput, sal_uLong lFileKey ) +{ + RscFile * pFName; + + if( NOFILE_INDEX == lFileKey ) + { + pFName = aFileTab.First(); + while( pFName ) + { + if( pFName && pFName->IsIncFile() ) + { + fprintf( fOutput, "#include " ); + fprintf( fOutput, "\"%s\"\n", + pFName->aFileName.GetBuffer() ); + } + pFName = aFileTab.Next(); + } + } + else + { + RscDepend * pDep; + RscFile * pFile; + + pFName = aFileTab.Get( lFileKey ); + if( pFName ) + { + for ( size_t i = 0, n = pFName->aDepLst.size(); i < n; ++i ) + { + pDep = pFName->aDepLst[ i ]; + if( pDep->GetFileKey() != lFileKey ) + { + pFile = aFileTab.GetFile( pDep->GetFileKey() ); + if( pFile ) + { + fprintf( fOutput, "#include " ); + fprintf( fOutput, "\"%s\"\n", + pFile->aFileName.GetBuffer() ); + } + } + }; + }; + }; +} + +/************************************************************************* +|* +|* RscTypCont :: Methoden die ueber all Knoten laufen +|* +*************************************************************************/ + +class RscEnumerateObj +{ +friend class RscEnumerateRef; +private: + ERRTYPE aError; // Enthaelt den ersten Fehler + RscTypCont* pTypCont; + FILE * fOutput; // AusgabeDatei + sal_uLong lFileKey; // Welche src-Datei + RscTop * pClass; + + DECL_LINK( CallBackWriteRc, ObjNode * ); + DECL_LINK( CallBackWriteSrc, ObjNode * ); + DECL_LINK( CallBackWriteCxx, ObjNode * ); + DECL_LINK( CallBackWriteHxx, ObjNode * ); + + ERRTYPE WriteRc( RscTop * pCl, ObjNode * pRoot ) + { + pClass = pCl; + if( pRoot ) + pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteRc ) ); + return aError; + } + ERRTYPE WriteSrc( RscTop * pCl, ObjNode * pRoot ){ + pClass = pCl; + if( pRoot ) + pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteSrc ) ); + return aError; + } + ERRTYPE WriteCxx( RscTop * pCl, ObjNode * pRoot ){ + pClass = pCl; + if( pRoot ) + pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteCxx ) ); + return aError; + } + ERRTYPE WriteHxx( RscTop * pCl, ObjNode * pRoot ){ + pClass = pCl; + if( pRoot ) + pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteHxx ) ); + return aError; + } +public: + void WriteRcFile( RscWriteRc & rMem, FILE * fOutput ); +}; + +/************************************************************************* +|* +|* RscEnumerateObj :: CallBackWriteRc +|* +*************************************************************************/ +IMPL_LINK( RscEnumerateObj, CallBackWriteRc, ObjNode *, pObjNode ) +{ + RscWriteRc aMem( pTypCont->GetByteOrder() ); + + aError = pClass->WriteRcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), + aMem, pTypCont, + pObjNode->GetRscId(), 0, sal_True ); + if( aError.IsError() || aError.IsWarning() ) + pTypCont->pEH->Error( aError, pClass, pObjNode->GetRscId() ); + + WriteRcFile( aMem, fOutput ); + return 0; +} + +/************************************************************************* +|* +|* RscEnumerateObj :: CallBackWriteSrc +|* +*************************************************************************/ +IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteSrc, ObjNode *, pObjNode ) +{ + if( pObjNode->GetFileKey() == lFileKey ){ + pClass->WriteSrcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), + fOutput, pTypCont, 0, + pObjNode->GetRscId(), "" ); + fprintf( fOutput, ";\n" ); + } + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateObj, CallBackWriteSrc, ObjNode *, pObjNode ) + +/************************************************************************* +|* +|* RscEnumerateObj :: CallBackWriteCxx +|* +*************************************************************************/ +IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteCxx, ObjNode *, pObjNode ) +{ + if( pClass->IsCodeWriteable() && pObjNode->GetFileKey() == lFileKey ) + aError = pClass->WriteCxxHeader( + RSCINST( pClass, pObjNode->GetRscObj() ), + fOutput, pTypCont, pObjNode->GetRscId() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateObj, CallBackWriteCxx, ObjNode *, pObjNode ) + +/************************************************************************* +|* +|* RscEnumerateObj :: CallBackWriteHxx +|* +*************************************************************************/ +IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteHxx, ObjNode *, pObjNode ) +{ + if( pClass->IsCodeWriteable() && pObjNode->GetFileKey() == lFileKey ) + aError = pClass->WriteHxxHeader( + RSCINST( pClass, pObjNode->GetRscObj() ), + fOutput, pTypCont, pObjNode->GetRscId() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateObj, CallBackWriteHxx, ObjNode *, pObjNode ) + +/************************************************************************* +|* +|* RscEnumerateObj :: WriteRcFile +|* +*************************************************************************/ +void RscEnumerateObj :: WriteRcFile( RscWriteRc & rMem, FILE * fOut ){ + // Definition der Struktur, aus denen die Resource aufgebaut ist + /* + struct RSHEADER_TYPE{ + sal_uInt32 nId; // Identifier der Resource + sal_uInt32 nRT; // Resource Typ + sal_uInt32 nGlobOff; // Globaler Offset + sal_uInt32 nLocalOff; // Lokaler Offset + } aHeader; + */ + + sal_uInt32 nId = rMem.GetLong( 0 ); + sal_uInt32 nRT = rMem.GetLong( 4 ); + + // Tabelle wird entsprechend gefuellt + pTypCont->PutTranslatorKey( (sal_uInt64(nRT) << 32) + sal_uInt64(nId) ); + + if( nRT == RSC_VERSIONCONTROL ) + { // kommt immmer als letztes + sal_Int32 nCount = pTypCont->aIdTranslator.size(); + // groesse der Tabelle + sal_uInt32 nSize = (nCount * (sizeof(sal_uInt64)+sizeof(sal_Int32))) + sizeof(sal_Int32); + + rMem.Put( nCount ); //Anzahl speichern + for( std::map< sal_uInt64, sal_uLong >::const_iterator it = + pTypCont->aIdTranslator.begin(); it != pTypCont->aIdTranslator.end(); ++it ) + { + // Schluessel schreiben + rMem.Put( it->first ); + // Objekt Id oder Position schreiben + rMem.Put( (sal_Int32)it->second ); + } + rMem.Put( nSize ); // Groesse hinten Speichern + } + + //Dateioffset neu setzen + pTypCont->IncFilePos( rMem.Size() ); + + + //Position wurde vorher in Tabelle geschrieben + fwrite( rMem.GetBuffer(), rMem.Size(), 1, fOut ); + +}; + +class RscEnumerateRef +{ +private: + RscTop * pRoot; + + DECL_LINK( CallBackWriteRc, RscTop * ); + DECL_LINK( CallBackWriteSrc, RscTop * ); + DECL_LINK( CallBackWriteCxx, RscTop * ); + DECL_LINK( CallBackWriteHxx, RscTop * ); + DECL_LINK( CallBackWriteSyntax, RscTop * ); + DECL_LINK( CallBackWriteRcCtor, RscTop * ); +public: + RscEnumerateObj aEnumObj; + + RscEnumerateRef( RscTypCont * pTC, RscTop * pR, + FILE * fOutput ) + { + aEnumObj.pTypCont = pTC; + aEnumObj.fOutput = fOutput; + pRoot = pR; + } + ERRTYPE WriteRc() + { + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteRc ) ); + return aEnumObj.aError; + }; + + ERRTYPE WriteSrc( sal_uLong lFileKey ) + { + aEnumObj.lFileKey = lFileKey; + + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteSrc ) ); + return aEnumObj.aError; + } + + ERRTYPE WriteCxx( sal_uLong lFileKey ) + { + aEnumObj.lFileKey = lFileKey; + + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteCxx ) ); + return aEnumObj.aError; + } + + ERRTYPE WriteHxx( sal_uLong lFileKey ) + { + aEnumObj.lFileKey = lFileKey; + + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteHxx ) ); + return aEnumObj.aError; + } + + void WriteSyntax() + { + pRoot->EnumNodes( LINK( this, RscEnumerateRef, + CallBackWriteSyntax ) ); + } + + void WriteRcCtor() + { + pRoot->EnumNodes( LINK( this, RscEnumerateRef, + CallBackWriteRcCtor ) ); + } +}; + +/************************************************************************* +|* +|* RscRscEnumerateRef :: CallBack... +|* +*************************************************************************/ +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteRc, RscTop *, pRef ) +{ + aEnumObj.WriteRc( pRef, pRef->GetObjNode() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteRc, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteSrc, RscTop *, pRef ) +{ + aEnumObj.WriteSrc( pRef, pRef->GetObjNode() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteSrc, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteCxx, RscTop *, pRef ) +{ + if( pRef->IsCodeWriteable() ) + aEnumObj.WriteCxx( pRef, pRef->GetObjNode() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteCxx, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteHxx, RscTop *, pRef ) +{ + if( pRef->IsCodeWriteable() ) + aEnumObj.WriteHxx( pRef, pRef->GetObjNode() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteHxx, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteSyntax, RscTop *, pRef ) +{ + pRef->WriteSyntaxHeader( aEnumObj.fOutput, aEnumObj.pTypCont ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteSyntax, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteRcCtor, RscTop *, pRef ) +{ + pRef->WriteRcCtor( aEnumObj.fOutput, aEnumObj.pTypCont ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteRcCtor, RscTop *, pRef ) + +/************************************************************************* +|* +|* RscTypCont :: WriteRc +|* +*************************************************************************/ + +ERRTYPE RscTypCont::WriteRc( WriteRcContext& rContext ) +{ + ERRTYPE aError; + RscEnumerateRef aEnumRef( this, pRoot, rContext.fOutput ); + + aIdTranslator.clear(); + nFilePos = 0; + nPMId = RSCVERSION_ID +1; //mindestens einen groesser + + aError = aEnumRef.WriteRc(); + + // version control + RscWriteRc aMem( nByteOrder ); + aVersion.pClass->WriteRcHeader( aVersion, aMem, this, RscId( RSCVERSION_ID ), 0, sal_True ); + aEnumRef.aEnumObj.WriteRcFile( aMem, rContext.fOutput ); + + return aError; +} + +/************************************************************************* +|* +|* RscTypCont :: WriteSrc +|* +*************************************************************************/ +void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey, + CharSet /*nCharSet*/, sal_Bool bName ) +{ + RscFile * pFName; + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + + unsigned char aUTF8BOM[3] = { 0xef, 0xbb, 0xbf }; + fwrite( aUTF8BOM, sizeof(unsigned char), SAL_N_ELEMENTS(aUTF8BOM), fOutput ); + if( bName ) + { + WriteInc( fOutput, nFileKey ); + + if( NOFILE_INDEX == nFileKey ) + { + pFName = aFileTab.First(); + while( pFName ){ + if( !pFName->IsIncFile() ) + pFName->aDefLst.WriteAll( fOutput ); + aEnumRef.WriteSrc( aFileTab.GetIndex( pFName ) ); + pFName = aFileTab.Next(); + }; + } + else + { + pFName = aFileTab.Get( nFileKey ); + if( pFName ){ + pFName->aDefLst.WriteAll( fOutput ); + aEnumRef.WriteSrc( nFileKey ); + } + } + } + else + { + RscId::SetNames( sal_False ); + if( NOFILE_INDEX == nFileKey ) + { + pFName = aFileTab.First(); + while( pFName ) + { + aEnumRef.WriteSrc( aFileTab.GetIndex( pFName ) ); + pFName = aFileTab.Next(); + }; + } + else + aEnumRef.WriteSrc( nFileKey ); + RscId::SetNames(); + }; +} + +/************************************************************************* +|* +|* RscTypCont :: WriteHxx +|* +*************************************************************************/ +ERRTYPE RscTypCont :: WriteHxx( FILE * fOutput, sal_uLong nFileKey ) +{ + fprintf( fOutput, "#include <tools/rc.hxx>\n" ); + fprintf( fOutput, "#include <tools/resid.hxx>\n" ); + fprintf( fOutput, "#include <vcl/accel.hxx>\n" ); + fprintf( fOutput, "#include <vcl/bitmap.hxx>\n" ); + fprintf( fOutput, "#include <vcl/button.hxx>\n" ); + fprintf( fOutput, "#include <tools/color.hxx>\n" ); + fprintf( fOutput, "#include <vcl/combobox.hxx>\n" ); + fprintf( fOutput, "#include <vcl/ctrl.hxx>\n" ); + fprintf( fOutput, "#include <vcl/dialog.hxx>\n" ); + fprintf( fOutput, "#include <vcl/edit.hxx>\n" ); + fprintf( fOutput, "#include <vcl/field.hxx>\n" ); + fprintf( fOutput, "#include <vcl/fixed.hxx>\n" ); + fprintf( fOutput, "#include <vcl/group.hxx>\n" ); + fprintf( fOutput, "#include <vcl/image.hxx>\n" ); + fprintf( fOutput, "#include <vcl/button.hxx>\n" ); + fprintf( fOutput, "#include <vcl/keycod.hxx>\n" ); + fprintf( fOutput, "#include <vcl/lstbox.hxx>\n" ); + fprintf( fOutput, "#include <vcl/mapmod.hxx>\n" ); + fprintf( fOutput, "#include <vcl/menu.hxx>\n" ); + fprintf( fOutput, "#include <vcl/menubtn.hxx>\n" ); + fprintf( fOutput, "#include <vcl/morebtn.hxx>\n" ); + fprintf( fOutput, "#include <vcl/msgbox.hxx>\n" ); + fprintf( fOutput, "#include <vcl/scrbar.hxx>\n" ); + fprintf( fOutput, "#include <vcl/spin.hxx>\n" ); + fprintf( fOutput, "#include <vcl/spinfld.hxx>\n" ); + fprintf( fOutput, "#include <vcl/splitwin.hxx>\n" ); + fprintf( fOutput, "#include <vcl/status.hxx>\n" ); + fprintf( fOutput, "#include <vcl/tabctrl.hxx>\n" ); + fprintf( fOutput, "#include <vcl/tabdlg.hxx>\n" ); + fprintf( fOutput, "#include <vcl/tabpage.hxx>\n" ); + fprintf( fOutput, "#include <vcl/toolbox.hxx>\n" ); + fprintf( fOutput, "#include <vcl/window.hxx>\n" ); + fprintf( fOutput, "#include <vcl/wrkwin.hxx>\n" ); + fprintf( fOutput, "#include <svtools/svmedit.hxx>\n" ); + + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + ERRTYPE aError; + + if( NOFILE_INDEX == nFileKey ) + { + RscFile * pFName; + + pFName = aFileTab.First(); + while( pFName ) + { + aError = aEnumRef.WriteHxx( aFileTab.GetIndex( pFName ) ); + pFName = aFileTab.Next(); + }; + } + else + aError = aEnumRef.WriteHxx( nFileKey ); + + return aError; +} + +/************************************************************************* +|* +|* RscTypCont :: WriteCxx +|* +*************************************************************************/ +ERRTYPE RscTypCont::WriteCxx( FILE * fOutput, sal_uLong nFileKey, + const ByteString & rHxxName ) +{ + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + ERRTYPE aError; + fprintf( fOutput, "#include <string.h>\n" ); + WriteInc( fOutput, nFileKey ); + if( rHxxName.Len() ) + fprintf( fOutput, "#include \"%s\"\n", rHxxName.GetBuffer() ); + fprintf( fOutput, "\n\n" ); + + if( NOFILE_INDEX == nFileKey ) + { + RscFile * pFName; + + pFName = aFileTab.First(); + while( pFName ) + { + aError = aEnumRef.WriteCxx( aFileTab.GetIndex( pFName ) ); + pFName = aFileTab.Next(); + }; + } + else + aError = aEnumRef.WriteCxx( nFileKey ); + + return aError; +} + +/************************************************************************* +|* +|* RscTypCont :: WriteSyntax +|* +*************************************************************************/ +void RscTypCont::WriteSyntax( FILE * fOutput ) +{ + for( size_t i = 0; i < aBaseLst.size(); i++ ) + aBaseLst[ i ]->WriteSyntaxHeader( fOutput, this ); + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + aEnumRef.WriteSyntax(); +} + +//======================================================================= +void RscTypCont::WriteRcCtor +( + FILE * fOutput +) +{ + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + aEnumRef.WriteRcCtor(); +} + +/************************************************************************* +|* +|* RscTypCont :: Delete() +|* +*************************************************************************/ +class RscDel +{ + sal_uLong lFileKey; + DECL_LINK( Delete, RscTop * ); +public: + RscDel( RscTop * pRoot, sal_uLong lKey ); +}; + + +inline RscDel::RscDel( RscTop * pRoot, sal_uLong lKey ) +{ + lFileKey = lKey; + pRoot->EnumNodes( LINK( this, RscDel, Delete ) ); +} + +IMPL_LINK_INLINE_START( RscDel, Delete, RscTop *, pNode ) +{ + if( pNode->GetObjNode() ) + pNode->pObjBiTree = pNode->GetObjNode()->DelObjNode( pNode, lFileKey ); + return 0; +} +IMPL_LINK_INLINE_END( RscDel, Delete, RscTop *, pNode ) + +void RscTypCont :: Delete( sal_uLong lFileKey ){ + // Resourceinstanzen loeschen + RscDel aDel( pRoot, lFileKey ); + // Defines loeschen + aFileTab.DeleteFileContext( lFileKey ); +} + +/************************************************************************* +|* +|* RscTypCont :: MakeConsistent() +|* +*************************************************************************/ +sal_Bool IsInstConsistent( ObjNode * pObjNode, RscTop * pRscTop ) +{ + sal_Bool bRet = sal_True; + + if( pObjNode ){ + RSCINST aTmpI; + + if( ! IsInstConsistent( (ObjNode*)pObjNode->Left(), pRscTop ) ) + bRet = sal_False; + + aTmpI.pClass = pRscTop; + aTmpI.pData = pObjNode->GetRscObj(); + if( ! aTmpI.pClass->IsConsistent( aTmpI ) ) + bRet = sal_False; + + if( ! IsInstConsistent( (ObjNode*)pObjNode->Right(), pRscTop ) ) + bRet = sal_False; + }; + + return( bRet ); +} + +sal_Bool MakeConsistent( RscTop * pRscTop ) +{ + sal_Bool bRet = sal_True; + + if( pRscTop ){ + if( ! ::MakeConsistent( (RscTop*)pRscTop->Left() ) ) + bRet = sal_False; + + if( pRscTop->GetObjNode() ){ + if( ! pRscTop->GetObjNode()->IsConsistent() ){ + pRscTop->GetObjNode()->OrderTree(); + if( ! pRscTop->GetObjNode()->IsConsistent() ) + bRet = sal_False; + } + if( ! IsInstConsistent( pRscTop->GetObjNode(), pRscTop ) ) + bRet = sal_False; + } + + if( ! ::MakeConsistent( (RscTop*)pRscTop->Right() ) ) + bRet = sal_False; + }; + + return bRet; +} + +sal_Bool RscTypCont :: MakeConsistent(){ + return( ::MakeConsistent( pRoot ) ); +} + +sal_uInt32 RscTypCont::PutTranslatorKey( sal_uInt64 nKey ) +{ + aIdTranslator[ nKey ] = nFilePos; + return nPMId++; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx new file mode 100644 index 000000000000..f2456cfca257 --- /dev/null +++ b/rsc/source/parser/rscibas.cxx @@ -0,0 +1,644 @@ +/* -*- 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): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <i18npool/mslangid.hxx> +#include <tools/rc.h> +#include <tools/color.hxx> + +#include <vclrsc.hxx> +#include <rscconst.hxx> +#include <rscarray.hxx> +#include <rscclass.hxx> +#include <rsccont.hxx> +#include <rscdb.hxx> + + +#include "rsclex.hxx" +#include <yyrscyacc.hxx> + +#include <boost/unordered_map.hpp> + +/****************** M A C R O S ******************************************/ +void RscTypCont::SETCONST( RscConst * pClass, const char * szString, sal_uInt32 nVal ) +{ +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "setconst : %s\n", szString ); +#endif + pClass->SetConstant( aNmTb.Put( szString, + CONSTNAME, nVal ), nVal ); +} + +void RscTypCont::SETCONST( RscConst * pClass, Atom nName, sal_uInt32 nVal ) +{ +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "setconst hash: %u\n", (unsigned int)nName ); +#endif + pClass->SetConstant( aNmTb.Put( nName, + CONSTNAME, nVal ), nVal ); +} + +/****************** C O D E **********************************************/ +/************************************************************************* +|* RscTypCont::InitLangType() +|* +|* Beschreibung +*************************************************************************/ + +typedef boost::unordered_map< rtl::OString, sal_uInt32, rtl::OStringHash > langmap; +static langmap ULong_Iso_map; + +sal_uInt32 GetLangId( const ByteString& aLang ) +{ + langmap::iterator pIter = ULong_Iso_map.find( aLang ); + if ( pIter != ULong_Iso_map.end()) + return pIter->second; + return 0; +} + +void RscLangEnum::Init( RscNameTable& rNames ) +{ + SetConstant( rNames.Put( "SYSTEM", CONSTNAME, (long)LANGUAGE_SYSTEM ), LANGUAGE_SYSTEM ); + SetConstant( rNames.Put( "DONTKNOW", CONSTNAME, LANGUAGE_DONTKNOW ), LANGUAGE_DONTKNOW ); + + sal_Int32 nIndex = 0; + mnLangId = 0x400; // stay away from selfdefined... + char csep = '-'; + const MsLangId::IsoLangEntry* pLangEntry; + ByteString aCountry, aLang; + + while ( NULL != ( pLangEntry = MsLangId::getIsoLangEntry( nIndex )) && ( pLangEntry->mnLang != LANGUAGE_DONTKNOW )) + { +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "ISO Language in : %d\n", + (int)nIndex, + pLangEntry->mnLang, + MsLangId::convertLanguageToIsoByteString( pLangEntry->mnLang ).getStr() ); +#endif + aLang = pLangEntry->maLangStr; + aCountry = pLangEntry->maCountry; + if ( aLang.EqualsIgnoreCaseAscii( aCountry ) || ! aCountry.Len() ) + { + SetConstant( rNames.Put( aLang.GetBuffer(), CONSTNAME, mnLangId ), mnLangId ); + if ( ! GetLangId( aLang )) + ULong_Iso_map[ aLang ] = mnLangId; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "ISO Language out: %s 0x%lx\n", aLang.GetBuffer(), mnLangId ); +#endif + mnLangId++; + } + else + { + SetConstant( rNames.Put( aLang.GetBuffer(), CONSTNAME, mnLangId ), mnLangId ); + if ( ! GetLangId( aLang )) + ULong_Iso_map[ aLang ] = mnLangId; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "ISO Language out: %s 0x%lx", aLang.GetBuffer(), mnLangId ); +#endif + mnLangId++; + aLang += csep; + aLang += aCountry.ToUpperAscii(); + SetConstant( rNames.Put( aLang.GetBuffer(), CONSTNAME, mnLangId ), mnLangId ); + if ( ! GetLangId( aLang )) + ULong_Iso_map[ aLang ] = mnLangId; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, " %s 0x%lx\n", aLang.GetBuffer(), mnLangId ); +#endif + mnLangId++; +// hack - survive "x-no-translate" + if ( aLang == "en-US" ) + { +// SetConstant( rNames.Put( "x-no-translate", CONSTNAME, mnLangId ), mnLangId ); +// mnLangId++; + SetConstant( rNames.Put( "x-comment", CONSTNAME, mnLangId ), mnLangId ); + mnLangId++; + } + } + nIndex++; + } + + ByteString aEnvIsoTokens = getenv( "RSC_LANG_ISO" ); + if ( aEnvIsoTokens.Len() ) + { + ByteString aIsoToken; + sal_uInt16 nTokenCounter = 0; + sal_Bool bOneMore = 1; + while ( bOneMore ) + { + aIsoToken = aEnvIsoTokens.GetToken( nTokenCounter, ' ' ); + if ( aIsoToken.Len() ) + { + SetConstant( rNames.Put( aIsoToken.GetBuffer(), CONSTNAME, mnLangId ), mnLangId ); + if ( ! GetLangId( aIsoToken )) + ULong_Iso_map[ aIsoToken ] = mnLangId; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "Env ISO Language out: %s 0x%lx\n", aIsoToken.GetBuffer(), mnLangId ); +#endif + mnLangId++; + } + else + bOneMore = 0; + nTokenCounter++; + } + } + + SetConstant( rNames.Put( "LANGUAGE_USER1", CONSTNAME, LANGUAGE_USER1 ), LANGUAGE_USER1 ); + SetConstant( rNames.Put( "LANGUAGE_USER2", CONSTNAME, LANGUAGE_USER2 ), LANGUAGE_USER2 ); + SetConstant( rNames.Put( "LANGUAGE_USER3", CONSTNAME, LANGUAGE_USER3 ), LANGUAGE_USER3 ); + SetConstant( rNames.Put( "LANGUAGE_USER4", CONSTNAME, LANGUAGE_USER4 ), LANGUAGE_USER4 ); + SetConstant( rNames.Put( "LANGUAGE_USER5", CONSTNAME, LANGUAGE_USER5 ), LANGUAGE_USER5 ); + SetConstant( rNames.Put( "LANGUAGE_USER6", CONSTNAME, LANGUAGE_USER6 ), LANGUAGE_USER6 ); + SetConstant( rNames.Put( "LANGUAGE_USER7", CONSTNAME, LANGUAGE_USER7 ), LANGUAGE_USER7 ); + SetConstant( rNames.Put( "LANGUAGE_USER8", CONSTNAME, LANGUAGE_USER8 ), LANGUAGE_USER8 ); + SetConstant( rNames.Put( "EXTERN", CONSTNAME, LANGUAGE_USER9 ), LANGUAGE_USER9 ); +} + +Atom RscLangEnum::AddLanguage( const char* pLang, RscNameTable& rNames ) +{ + Atom nResult = 0; + KEY_STRUCT aStruct; + if( ! rNames.Get( nResult = pHS->getID( pLang ), &aStruct ) ) + { + SetConstant( nResult = rNames.Put( pLang, CONSTNAME, mnLangId ), mnLangId ); + // insert new lang to ULong_Iso_map + rtl::OString aLang( pLang ); + if ( ! GetLangId( aLang )) + ULong_Iso_map[ aLang ] = mnLangId; + // increase id counter + mnLangId++; + } + #if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "AddLanguage( %s ) = %d\n", pLang, nResult ); + #endif + return nResult; +} + +RscEnum * RscTypCont::InitLangType() +{ + aLangType.Init( aNmTb ); + return( &aLangType ); +} + +/************************************************************************* +|* +|* RscTypCont::InitFieldUnitsType() +|* +*************************************************************************/ +RscEnum * RscTypCont::InitFieldUnitsType() +{ + RscEnum * pFieldUnits; + pFieldUnits = new RscEnum( pHS->getID( "EnumFieldUnit" ), RSC_NOTYPE ); + + SETCONST( pFieldUnits, "FUNIT_NONE", FUNIT_NONE ); + SETCONST( pFieldUnits, "FUNIT_MM", FUNIT_MM ); + SETCONST( pFieldUnits, "FUNIT_CM", FUNIT_CM ); + SETCONST( pFieldUnits, "FUNIT_M", FUNIT_M ); + SETCONST( pFieldUnits, "FUNIT_KM", FUNIT_KM ); + SETCONST( pFieldUnits, "FUNIT_TWIP", FUNIT_TWIP ); + SETCONST( pFieldUnits, "FUNIT_POINT", FUNIT_POINT ); + SETCONST( pFieldUnits, "FUNIT_PICA", FUNIT_PICA ); + SETCONST( pFieldUnits, "FUNIT_INCH", FUNIT_INCH ); + SETCONST( pFieldUnits, "FUNIT_FOOT", FUNIT_FOOT ); + SETCONST( pFieldUnits, "FUNIT_MILE", FUNIT_MILE ); + SETCONST( pFieldUnits, "FUNIT_CUSTOM", FUNIT_CUSTOM ); + // Amelia : adds two units ,"char" and "line" + SETCONST( pFieldUnits, "FUNIT_CHAR", FUNIT_CHAR ); + SETCONST( pFieldUnits, "FUNIT_LINE", FUNIT_LINE ); + SETCONST( pFieldUnits, "FUNIT_PERCENT", FUNIT_PERCENT ); + + return pFieldUnits; +} + +/************************************************************************* +|* +|* RscTypCont::InitTimeFieldFormat() +|* +*************************************************************************/ +RscEnum * RscTypCont::InitTimeFieldFormat() +{ + RscEnum * pTimeFieldFormat; + pTimeFieldFormat = new RscEnum( pHS->getID( "EnumTimeFieldFormat" ), + RSC_NOTYPE ); + + SETCONST( pTimeFieldFormat, "TIMEF_NONE", TIMEF_NONE ); + SETCONST( pTimeFieldFormat, "TIMEF_SEC", TIMEF_SEC ); + SETCONST( pTimeFieldFormat, "TIMEF_100TH_SEC", TIMEF_100TH_SEC ); + + return pTimeFieldFormat; +} + +/************************************************************************* +|* +|* RscTypCont::InitColor() +|* +*************************************************************************/ +RscEnum * RscTypCont::InitColor(){ + RscEnum * pColor; + pColor = new RscEnum( pHS->getID( "EnumColor" ), RSC_NOTYPE ); + + SETCONST( pColor, "COL_BLACK", COL_BLACK ); + SETCONST( pColor, "COL_BLUE", COL_BLUE ); + SETCONST( pColor, "COL_GREEN", COL_GREEN ); + SETCONST( pColor, "COL_CYAN", COL_CYAN ); + SETCONST( pColor, "COL_RED", COL_RED ); + SETCONST( pColor, "COL_MAGENTA", COL_MAGENTA ); + SETCONST( pColor, "COL_BROWN", COL_BROWN ); + SETCONST( pColor, "COL_GRAY", COL_GRAY ); + SETCONST( pColor, "COL_LIGHTGRAY", COL_LIGHTGRAY ); + SETCONST( pColor, "COL_LIGHTBLUE", COL_LIGHTBLUE ); + SETCONST( pColor, "COL_LIGHTGREEN", COL_LIGHTGREEN ); + SETCONST( pColor, "COL_LIGHTCYAN", COL_LIGHTCYAN ); + SETCONST( pColor, "COL_LIGHTRED", COL_LIGHTRED ); + SETCONST( pColor, "COL_LIGHTMAGENTA", COL_LIGHTMAGENTA ); + SETCONST( pColor, "COL_YELLOW", COL_YELLOW ); + SETCONST( pColor, "COL_WHITE", COL_WHITE ); + + return( pColor ); +} + +/************************************************************************* +|* +|* RscTypCont::InitMapUnit() +|* +*************************************************************************/ +RscEnum * RscTypCont::InitMapUnit(){ + RscEnum * pMapUnit; + pMapUnit = new RscEnum( pHS->getID( "EnumMapUnit" ), RSC_NOTYPE ); + + SETCONST( pMapUnit, "MAP_PIXEL", MAP_PIXEL ); + SETCONST( pMapUnit, "MAP_SYSFONT", MAP_SYSFONT ); + SETCONST( pMapUnit, "MAP_100TH_MM", MAP_100TH_MM ); + SETCONST( pMapUnit, "MAP_10TH_MM", MAP_10TH_MM ); + SETCONST( pMapUnit, "MAP_MM", MAP_MM ); + SETCONST( pMapUnit, "MAP_CM", MAP_CM ); + SETCONST( pMapUnit, "MAP_1000TH_INCH", MAP_1000TH_INCH ); + SETCONST( pMapUnit, "MAP_100TH_INCH", MAP_100TH_INCH ); + SETCONST( pMapUnit, "MAP_10TH_INCH", MAP_10TH_INCH ); + SETCONST( pMapUnit, "MAP_INCH", MAP_INCH ); + SETCONST( pMapUnit, "MAP_POINT", MAP_POINT ); + SETCONST( pMapUnit, "MAP_TWIP", MAP_TWIP ); + SETCONST( pMapUnit, "MAP_APPFONT", MAP_APPFONT ); + SETCONST( pMapUnit, "MAP_SV", RSC_EXTRAMAPUNIT ); + return( pMapUnit ); +} + +/************************************************************************* +|* +|* RscTypCont::InitKey() +|* +*************************************************************************/ +RscEnum * RscTypCont::InitKey(){ + RscEnum * pKey; + pKey = new RscEnum( pHS->getID( "EnumKey" ), RSC_NOTYPE ); + + SETCONST( pKey, "KEY_0", com::sun::star::awt::Key::NUM0 ); + SETCONST( pKey, "KEY_1", com::sun::star::awt::Key::NUM1 ); + SETCONST( pKey, "KEY_2", com::sun::star::awt::Key::NUM2 ); + SETCONST( pKey, "KEY_3", com::sun::star::awt::Key::NUM3 ); + SETCONST( pKey, "KEY_4", com::sun::star::awt::Key::NUM4 ); + SETCONST( pKey, "KEY_5", com::sun::star::awt::Key::NUM5 ); + SETCONST( pKey, "KEY_6", com::sun::star::awt::Key::NUM6 ); + SETCONST( pKey, "KEY_7", com::sun::star::awt::Key::NUM7 ); + SETCONST( pKey, "KEY_8", com::sun::star::awt::Key::NUM8 ); + SETCONST( pKey, "KEY_9", com::sun::star::awt::Key::NUM9 ); + + SETCONST( pKey, "KEY_A", com::sun::star::awt::Key::A ); + SETCONST( pKey, "KEY_B", com::sun::star::awt::Key::B ); + SETCONST( pKey, "KEY_C", com::sun::star::awt::Key::C ); + SETCONST( pKey, "KEY_D", com::sun::star::awt::Key::D ); + SETCONST( pKey, "KEY_E", com::sun::star::awt::Key::E ); + SETCONST( pKey, "KEY_F", com::sun::star::awt::Key::F ); + SETCONST( pKey, "KEY_G", com::sun::star::awt::Key::G ); + SETCONST( pKey, "KEY_H", com::sun::star::awt::Key::H ); + SETCONST( pKey, "KEY_I", com::sun::star::awt::Key::I ); + SETCONST( pKey, "KEY_J", com::sun::star::awt::Key::J ); + SETCONST( pKey, "KEY_K", com::sun::star::awt::Key::K ); + SETCONST( pKey, "KEY_L", com::sun::star::awt::Key::L ); + SETCONST( pKey, "KEY_M", com::sun::star::awt::Key::M ); + SETCONST( pKey, "KEY_N", com::sun::star::awt::Key::N ); + SETCONST( pKey, "KEY_O", com::sun::star::awt::Key::O ); + SETCONST( pKey, "KEY_P", com::sun::star::awt::Key::P ); + SETCONST( pKey, "KEY_Q", com::sun::star::awt::Key::Q ); + SETCONST( pKey, "KEY_R", com::sun::star::awt::Key::R ); + SETCONST( pKey, "KEY_S", com::sun::star::awt::Key::S ); + SETCONST( pKey, "KEY_T", com::sun::star::awt::Key::T ); + SETCONST( pKey, "KEY_U", com::sun::star::awt::Key::U ); + SETCONST( pKey, "KEY_V", com::sun::star::awt::Key::V ); + SETCONST( pKey, "KEY_W", com::sun::star::awt::Key::W ); + SETCONST( pKey, "KEY_X", com::sun::star::awt::Key::X ); + SETCONST( pKey, "KEY_Y", com::sun::star::awt::Key::Y ); + SETCONST( pKey, "KEY_Z", com::sun::star::awt::Key::Z ); + + SETCONST( pKey, "KEY_F1", com::sun::star::awt::Key::F1 ); + SETCONST( pKey, "KEY_F2", com::sun::star::awt::Key::F2 ); + SETCONST( pKey, "KEY_F3", com::sun::star::awt::Key::F3 ); + SETCONST( pKey, "KEY_F4", com::sun::star::awt::Key::F4 ); + SETCONST( pKey, "KEY_F5", com::sun::star::awt::Key::F5 ); + SETCONST( pKey, "KEY_F6", com::sun::star::awt::Key::F6 ); + SETCONST( pKey, "KEY_F7", com::sun::star::awt::Key::F7 ); + SETCONST( pKey, "KEY_F8", com::sun::star::awt::Key::F8 ); + SETCONST( pKey, "KEY_F9", com::sun::star::awt::Key::F9 ); + SETCONST( pKey, "KEY_F10", com::sun::star::awt::Key::F10 ); + SETCONST( pKey, "KEY_F11", com::sun::star::awt::Key::F11 ); + SETCONST( pKey, "KEY_F12", com::sun::star::awt::Key::F12 ); + SETCONST( pKey, "KEY_F13", com::sun::star::awt::Key::F13 ); + SETCONST( pKey, "KEY_F14", com::sun::star::awt::Key::F14 ); + SETCONST( pKey, "KEY_F15", com::sun::star::awt::Key::F15 ); + SETCONST( pKey, "KEY_F16", com::sun::star::awt::Key::F16 ); + SETCONST( pKey, "KEY_F17", com::sun::star::awt::Key::F17 ); + SETCONST( pKey, "KEY_F18", com::sun::star::awt::Key::F18 ); + SETCONST( pKey, "KEY_F19", com::sun::star::awt::Key::F19 ); + SETCONST( pKey, "KEY_F20", com::sun::star::awt::Key::F20 ); + SETCONST( pKey, "KEY_F21", com::sun::star::awt::Key::F21 ); + SETCONST( pKey, "KEY_F22", com::sun::star::awt::Key::F22 ); + SETCONST( pKey, "KEY_F23", com::sun::star::awt::Key::F23 ); + SETCONST( pKey, "KEY_F24", com::sun::star::awt::Key::F24 ); + SETCONST( pKey, "KEY_F25", com::sun::star::awt::Key::F25 ); + SETCONST( pKey, "KEY_F26", com::sun::star::awt::Key::F26 ); + + SETCONST( pKey, "KEY_DOWN", com::sun::star::awt::Key::DOWN ); + SETCONST( pKey, "KEY_UP", com::sun::star::awt::Key::UP ); + SETCONST( pKey, "KEY_LEFT", com::sun::star::awt::Key::LEFT ); + SETCONST( pKey, "KEY_RIGHT", com::sun::star::awt::Key::RIGHT ); + SETCONST( pKey, "KEY_HOME", com::sun::star::awt::Key::HOME ); + SETCONST( pKey, "KEY_END", com::sun::star::awt::Key::END ); + SETCONST( pKey, "KEY_PAGEUP", com::sun::star::awt::Key::PAGEUP ); + SETCONST( pKey, "KEY_PAGEDOWN", com::sun::star::awt::Key::PAGEDOWN ); + + SETCONST( pKey, "KEY_RETURN", com::sun::star::awt::Key::RETURN ); + SETCONST( pKey, "KEY_ESCAPE", com::sun::star::awt::Key::ESCAPE ); + SETCONST( pKey, "KEY_TAB", com::sun::star::awt::Key::TAB ); + SETCONST( pKey, "KEY_BACKSPACE", com::sun::star::awt::Key::BACKSPACE ); + SETCONST( pKey, "KEY_SPACE", com::sun::star::awt::Key::SPACE ); + SETCONST( pKey, "KEY_INSERT", com::sun::star::awt::Key::INSERT ); + SETCONST( pKey, "KEY_DELETE", com::sun::star::awt::Key::DELETE ); + + SETCONST( pKey, "KEY_ADD", com::sun::star::awt::Key::ADD ); + SETCONST( pKey, "KEY_SUBTRACT", com::sun::star::awt::Key::SUBTRACT ); + SETCONST( pKey, "KEY_MULTIPLY", com::sun::star::awt::Key::MULTIPLY ); + SETCONST( pKey, "KEY_DIVIDE", com::sun::star::awt::Key::DIVIDE ); + SETCONST( pKey, "KEY_POINT", com::sun::star::awt::Key::POINT ); + SETCONST( pKey, "KEY_COMMA", com::sun::star::awt::Key::COMMA ); + SETCONST( pKey, "KEY_LESS", com::sun::star::awt::Key::LESS ); + SETCONST( pKey, "KEY_GREATER", com::sun::star::awt::Key::GREATER ); + SETCONST( pKey, "KEY_EQUAL", com::sun::star::awt::Key::EQUAL ); + + SETCONST( pKey, "KEY_OPEN", com::sun::star::awt::Key::OPEN ); + SETCONST( pKey, "KEY_CUT", com::sun::star::awt::Key::CUT ); + SETCONST( pKey, "KEY_COPY", com::sun::star::awt::Key::COPY ); + SETCONST( pKey, "KEY_PASTE", com::sun::star::awt::Key::PASTE ); + SETCONST( pKey, "KEY_UNDO", com::sun::star::awt::Key::UNDO ); + SETCONST( pKey, "KEY_REPEAT", com::sun::star::awt::Key::REPEAT ); + SETCONST( pKey, "KEY_FIND", com::sun::star::awt::Key::FIND ); + SETCONST( pKey, "KEY_PROPERTIES", com::sun::star::awt::Key::PROPERTIES ); + SETCONST( pKey, "KEY_FRONT", com::sun::star::awt::Key::FRONT ); + SETCONST( pKey, "KEY_CONTEXTMENU", com::sun::star::awt::Key::CONTEXTMENU ); + SETCONST( pKey, "KEY_HELP", com::sun::star::awt::Key::HELP ); + SETCONST( pKey, "KEY_HANGUL_HANJA", com::sun::star::awt::Key::HANGUL_HANJA ); + SETCONST( pKey, "KEY_DECIMAL", com::sun::star::awt::Key::DECIMAL ); + SETCONST( pKey, "KEY_TILDE", com::sun::star::awt::Key::TILDE ); + SETCONST( pKey, "KEY_QUOTELEFT", com::sun::star::awt::Key::QUOTELEFT ); + + return( pKey ); +} + +/************************************************************************* +|* +|* RscTypCont::InitTriState() +|* +*************************************************************************/ +RscEnum * RscTypCont::InitTriState(){ + RscEnum * pTriState; + pTriState = new RscEnum( pHS->getID( "EnumTriState" ), RSC_NOTYPE ); + + SETCONST( pTriState, "STATE_NOCHECK", STATE_NOCHECK ); + SETCONST( pTriState, "STATE_CHECK", STATE_CHECK ); + SETCONST( pTriState, "STATE_DONTKNOW", STATE_DONTKNOW ); + + return( pTriState ); +} + +/************************************************************************* +|* +|* RscTypCont::InitMessButtons() +|* +*************************************************************************/ +RscEnum * RscTypCont::InitMessButtons() +{ + RscEnum * pMessButtons; + pMessButtons = new RscEnum( pHS->getID( "EnumMessButtons" ), RSC_NOTYPE ); + SETCONST( pMessButtons, "WB_OK", sal::static_int_cast<sal_uInt32>(WB_OK) ); + SETCONST( pMessButtons, "WB_OK_CANCEL", sal::static_int_cast<sal_uInt32>(WB_OK_CANCEL) ); + SETCONST( pMessButtons, "WB_YES_NO", sal::static_int_cast<sal_uInt32>(WB_YES_NO) ); + SETCONST( pMessButtons, "WB_YES_NO_CANCEL", sal::static_int_cast<sal_uInt32>(WB_YES_NO_CANCEL) ); + SETCONST( pMessButtons, "WB_RETRY_CANCEL", sal::static_int_cast<sal_uInt32>(WB_RETRY_CANCEL) ); + SETCONST( pMessButtons, "WB_ABORT_RETRY_IGNORE", sal::static_int_cast<sal_uInt32>(WB_ABORT_RETRY_IGNORE) ); + return( pMessButtons ); +} + +/************************************************************************* +|* +|* RscTypCont::InitMessDefButton() +|* +*************************************************************************/ +RscEnum * RscTypCont::InitMessDefButton(){ + RscEnum * pMessDefButton; + pMessDefButton = new RscEnum( pHS->getID( "EnumMessDefButton" ), + RSC_NOTYPE ); + + SETCONST( pMessDefButton, "WB_DEF_OK", sal::static_int_cast<sal_uInt32>(WB_DEF_OK) ); + SETCONST( pMessDefButton, "WB_DEF_CANCEL", sal::static_int_cast<sal_uInt32>(WB_DEF_CANCEL) ); + SETCONST( pMessDefButton, "WB_DEF_RETRY", sal::static_int_cast<sal_uInt32>(WB_DEF_RETRY) ); + SETCONST( pMessDefButton, "WB_DEF_YES", sal::static_int_cast<sal_uInt32>(WB_DEF_YES) ); + SETCONST( pMessDefButton, "WB_DEF_NO", sal::static_int_cast<sal_uInt32>(WB_DEF_NO) ); + SETCONST( pMessDefButton, "WB_DEF_IGNORE", sal::static_int_cast<sal_uInt32>(WB_DEF_IGNORE) ); + return( pMessDefButton ); +} + +/************************************************************************* +|* +|* RscTypCont::InitGeometry() +|* +*************************************************************************/ +RscTupel * RscTypCont::InitGeometry() +{ + RscTop * pTupel; + Atom nId; + + // Clientvariablen einfuegen + pTupel = new RscTupel( pHS->getID( "TupelDeltaSystem" ), + RSC_NOTYPE, NULL ); + nId = aNmTb.Put( "X", VARNAME ); + pTupel->SetVariable( nId, &aShort ); + nId = aNmTb.Put( "Y", VARNAME ); + pTupel->SetVariable( nId, &aShort ); + nId = aNmTb.Put( "WIDTH", VARNAME ); + pTupel->SetVariable( nId, &aShort ); + nId = aNmTb.Put( "HEIGHT", VARNAME ); + pTupel->SetVariable( nId, &aShort ); + + return (RscTupel *)pTupel; +} + +/************************************************************************* +|* +|* RscTypCont::InitLangGeometry() +|* +*************************************************************************/ +RscArray * RscTypCont::InitLangGeometry( RscTupel * pGeo ) +{ + return new RscArray( pHS->getID( "Lang_TupelGeometry" ), RSC_NOTYPE, pGeo, &aLangType ); +} + +/************************************************************************* +|* +|* RscTypCont::InitStringList() +|* +*************************************************************************/ +RscCont * RscTypCont::InitStringList() +{ + RscCont * pCont; + + pCont = new RscCont( pHS->getID( "Chars[]" ), RSC_NOTYPE ); + pCont->SetTypeClass( &aString ); + + return pCont; +} + +/************************************************************************* +|* +|* RscTypCont::InitLangStringList() +|* +*************************************************************************/ +RscArray * RscTypCont::InitLangStringList( RscCont * pStrLst ) +{ + return new RscArray( pHS->getID( "Lang_CharsList" ), + RSC_NOTYPE, pStrLst, &aLangType ); +} + +/************************************************************************* +|* +|* RscTypCont::InitStringTupel() +|* +*************************************************************************/ +RscTupel * RscTypCont::InitStringTupel() +{ + RscTop * pTupel; + Atom nId; + + // Clientvariablen einfuegen + pTupel = new RscTupel( pHS->getID( "CharsTupel" ), RSC_NOTYPE, NULL ); + nId = aNmTb.Put( "FILTER", VARNAME ); + pTupel->SetVariable( nId, &aString ); + nId = aNmTb.Put( "MASK", VARNAME ); + pTupel->SetVariable( nId, &aString ); + + return (RscTupel *)pTupel; +} + +/************************************************************************* +|* +|* RscTypCont::InitStringLongTupel() +|* +*************************************************************************/ +RscTupel * RscTypCont::InitStringLongTupel() +{ + RscTop * pTupel; + Atom nId; + + // Clientvariablen einfuegen + pTupel = new RscTupel( pHS->getID( "CharsLongTupel" ), RSC_NOTYPE, NULL ); + nId = aNmTb.Put( "ItemText", VARNAME ); + pTupel->SetVariable( nId, &aString ); + nId = aNmTb.Put( "ItemId", VARNAME ); + pTupel->SetVariable( nId, &aEnumLong ); + + return (RscTupel *)pTupel; +} + +/************************************************************************* +|* +|* RscTypCont::InitStringTupelList() +|* +*************************************************************************/ +RscCont * RscTypCont::InitStringTupelList( RscTupel * pTupelString ) +{ + RscCont * pCont; + + pCont = new RscCont( pHS->getID( "CharsCharsTupel[]" ), RSC_NOTYPE ); + pCont->SetTypeClass( pTupelString ); + + return pCont; +} + +/************************************************************************* +|* +|* RscTypCont::InitStringLongTupelList() +|* +*************************************************************************/ +RscCont * RscTypCont::InitStringLongTupelList( RscTupel * pStringLong ) +{ + RscCont * pCont; + + pCont = new RscCont( pHS->getID( "CharsLongTupel[]" ), RSC_NOTYPE ); + pCont->SetTypeClass( pStringLong ); + + return pCont; +} + +/************************************************************************* +|* +|* RscTypCont::InitLangStringTupelList() +|* +*************************************************************************/ +RscArray * RscTypCont::InitLangStringTupelList( RscCont * pStrTupelLst ) +{ + return new RscArray( pHS->getID( "Lang_CharsCharsTupel" ), + RSC_NOTYPE, pStrTupelLst, &aLangType ); +} + +/************************************************************************* +|* +|* RscTypCont::InitLangStringLongTupelList() +|* +*************************************************************************/ +RscArray * RscTypCont::InitLangStringLongTupelList( RscCont * pStrLongTupelLst ) +{ + return new RscArray( pHS->getID( "Lang_CharsLongTupelList" ), + RSC_NOTYPE, pStrLongTupelLst, &aLangType ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx new file mode 100644 index 000000000000..072f1f085649 --- /dev/null +++ b/rsc/source/parser/rscicpx.cxx @@ -0,0 +1,2350 @@ +/* -*- 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): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> + +#include <tools/rc.h> + +#include <vclrsc.hxx> +#include <rscmgr.hxx> +#include <rscclass.hxx> +#include <rsccont.hxx> +#include <rscdb.hxx> +#include <rsc/rscsfx.hxx> + +#include "rsclex.hxx" +#include <yyrscyacc.hxx> + +/************************************************************************* +|* RscTypCont::InsWinBit() +*************************************************************************/ +void RscTypCont::InsWinBit( RscTop * pClass, const ByteString & rName, + Atom nVal ) +{ + RscClient * pClient; + + // Clientvariablen einfuegen + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, &aWinBits, nVal ) + ); + Atom nId = aNmTb.Put( rName.GetBuffer(), VARNAME ); + pClass->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nWinBitVarId ); +} + +#define INS_WINBIT( pClass, WinBit ) \ + InsWinBit( pClass, #WinBit, n##WinBit##Id ); + +/************************************************************************* +|* RscTypCont::InitClassMgr() +*************************************************************************/ +RscTop * RscTypCont::InitClassMgr() +{ + RscTop * pClassMgr; + RscBaseCont * pClass; + Atom nId; + + aBaseLst.push_back( pClass = new RscBaseCont( InvalidAtom, RSC_NOTYPE, NULL, sal_False ) ); + + nId = pHS->getID( "Resource" ); + pClassMgr = new RscMgr( nId, RSC_RESOURCE, pClass ); + aNmTb.Put( nId, CLASSNAME, pClassMgr ); + pClassMgr->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + { + RscContWriteSrc * pCont; + + // Variablen anlegen + aBaseLst.push_back( pCont = new RscContExtraData( pHS->getID( "ContExtradata" ), RSC_NOTYPE ) ); + pCont->SetTypeClass( &aShort, &aString ); + nRsc_EXTRADATA = nId = aNmTb.Put( "ExtraData", VARNAME ); + pClassMgr->SetVariable( nId, pCont ); + }; + nId = aNmTb.Put( "Comment", VARNAME ); + pClassMgr->SetVariable( nId, &aString, NULL, VAR_NORC ); + + pClass->SetTypeClass( pClassMgr ); + + return pClassMgr; +} + +/************************************************************************* +|* RscTypCont::InitClassString() +*************************************************************************/ +RscTop * RscTypCont::InitClassString( RscTop * pSuper ){ + Atom nId; + RscTop * pClassString; + + nId = pHS->getID( "String" ); + pClassString = new RscClass( nId, RSC_STRING, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassString ); + pClassString->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Text", VARNAME ); + pClassString->SetVariable( nId, &aLangString ); + return( pClassString ); +} + +/************************************************************************* +|* RscTypCont::InitClassBitmap() +*************************************************************************/ +RscTop * RscTypCont::InitClassBitmap( RscTop * pSuper ){ + Atom nId; + RscTop * pClassBitmap; + + nId = pHS->getID( "Bitmap" ); + pClassBitmap = new RscSysDepend( nId, RSC_BITMAP, pSuper ); + pClassBitmap->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassBitmap ); + + // Die Klasse RscSysDepend behandelt die Variablen + // "FILE" gesondert + nId = aNmTb.Put( "File", VARNAME ); + pClassBitmap->SetVariable( nId, &aLangString, NULL, VAR_NORC ); + + return( pClassBitmap ); +} + +/************************************************************************* +|* RscTypCont::InitClassColor() +*************************************************************************/ +RscTop * RscTypCont::InitClassColor( RscTop * pSuper, RscEnum * pColor ){ + Atom nId; + RscTop * pClassColor; + + // Klasse anlegen + nId = pHS->getID( "Color" ); + pClassColor = new RscClass( nId, RSC_COLOR, pSuper ); + pClassColor->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassColor ); + + // Variablen anlegen + nId = aNmTb.Put( "Red", VARNAME ); + pClassColor->SetVariable( nId, &aUShort ); + nId = aNmTb.Put( "Green", VARNAME ); + pClassColor->SetVariable( nId, &aUShort ); + nId = aNmTb.Put( "Blue", VARNAME ); + pClassColor->SetVariable( nId, &aUShort ); + nId = aNmTb.Put( "Predefine", VARNAME ); + pClassColor->SetVariable( nId, pColor ); + + return( pClassColor ); +} + +/************************************************************************* +|* RscTypCont::InitClassImage() +*************************************************************************/ +RscTop * RscTypCont::InitClassImage( RscTop * pSuper, RscTop * pClassBitmap, + RscTop * pClassColor ) +{ + Atom nId; + RscTop * pClassImage; + + // Klasse anlegen + nId = pHS->getID( "Image" ); + pClassImage = new RscClass( nId, RSC_IMAGE, pSuper ); + pClassImage->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassImage ); + + // Variablen anlegen + nId = aNmTb.Put( "ImageBitmap", VARNAME ); + pClassImage->SetVariable( nId, pClassBitmap, NULL, 0, RSC_IMAGE_IMAGEBITMAP ); + nId = aNmTb.Put( "MaskBitmap", VARNAME ); + pClassImage->SetVariable( nId, pClassBitmap, NULL, 0, RSC_IMAGE_MASKBITMAP ); + nId = aNmTb.Put( "MaskColor", VARNAME ); + pClassImage->SetVariable( nId, pClassColor, NULL, + VAR_SVDYNAMIC, RSC_IMAGE_MASKCOLOR ); + + return( pClassImage ); +} + +/************************************************************************* +|* RscTypCont::InitClassImageList() +*************************************************************************/ +RscTop * RscTypCont::InitClassImageList( RscTop * pSuper, RscTop * /*pClassBitmap*/, + RscTop * pClassColor, RscCont * pStrLst ) +{ + Atom nId; + RscTop * pClassImageList; + + // Klasse anlegen + nId = pHS->getID( "ImageList" ); + pClassImageList = new RscClass( nId, RSC_IMAGELIST, pSuper ); + pClassImageList->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassImageList ); + + nId = aNmTb.Put( "Prefix", VARNAME ); + pClassImageList->SetVariable( nId, &aString ); + + nId = aNmTb.Put( "MaskColor", VARNAME ); + pClassImageList->SetVariable( nId, pClassColor, NULL, + VAR_SVDYNAMIC, RSC_IMAGELIST_MASKCOLOR ); + + RscCont * pCont = new RscCont( pHS->getID( "sal_uInt16 *" ), RSC_NOTYPE ); + pCont->SetTypeClass( &aIdUShort ); + aBaseLst.push_back( pCont ); + nId = aNmTb.Put( "IdList", VARNAME ); + pClassImageList->SetVariable( nId, pCont, NULL, 0, + RSC_IMAGELIST_IDLIST ); + + nId = aNmTb.Put( "FileList", VARNAME ); + pClassImageList->SetVariable( nId, pStrLst ); + + nId = aNmTb.Put( "IdCount", VARNAME ); + pClassImageList->SetVariable( nId, &aUShort, NULL, 0, + RSC_IMAGELIST_IDCOUNT ); + return( pClassImageList ); +} + +/************************************************************************* +|* RscTypCont::InitClassWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit, + RscArray * pLangGeo ) +{ + Atom nId; + RscTop * pClassWindow; + + // Klasse anlegen + nId = pHS->getID( "Window" ); + pClassWindow = new RscClass( nId, RSC_WINDOW, pSuper ); + pClassWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassWindow ); + + // Variablen anlegen + { + RscFlag * pFlag; + RscClient * pClient; + Atom nVarId, nDisableId, nOutputSizeId; + + aBaseLst.push_back( pFlag = new RscFlag( pHS->getID( "FlagWndExtra" ), RSC_NOTYPE ) ); + + // Konstanten in Tabelle stellen + nDisableId = pHS->getID( "RSWND_DISABLE" ); + SETCONST( pFlag, nDisableId, RSWND_DISABLED ); + nOutputSizeId = pHS->getID( "RSWND_OUTPUTSIZE" ); + SETCONST( pFlag, nOutputSizeId, RSWND_CLIENTSIZE ); + + // Variable einfuegen + nVarId = aNmTb.Put( "_RscExtraFlags", VARNAME ); + pClassWindow->SetVariable( nVarId, pFlag, NULL, + VAR_HIDDEN | VAR_NOENUM ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nDisableId ) + ); + nId = aNmTb.Put( "Disable", VARNAME ); + pClassWindow->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nOutputSizeId ) + ); + nId = aNmTb.Put( "OutputSize", VARNAME ); + pClassWindow->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + } + + pClassWindow->SetVariable( nWinBitVarId, &aWinBits, NULL, + VAR_HIDDEN | VAR_NOENUM ); + + INS_WINBIT(pClassWindow,Border) + INS_WINBIT(pClassWindow,Hide) + INS_WINBIT(pClassWindow,ClipChildren) + INS_WINBIT(pClassWindow,SVLook) + InsWinBit( pClassWindow, "DialogControl", nTabControlId ); + + nId = aNmTb.Put( "HelpID", VARNAME ); + pClassWindow->SetVariable( nId, &aStringLiteral, NULL, 0, WINDOW_HELPID ); + + + nRsc_XYMAPMODEId = nId = aNmTb.Put( "_XYMapMode", VARNAME ); + pClassWindow->SetVariable( nId, pMapUnit, NULL, 0, WINDOW_XYMAPMODE ); + nRsc_X = nId = aNmTb.Put( "_X", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_X ); + nRsc_Y = nId = aNmTb.Put( "_Y", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_Y ); + + nRsc_WHMAPMODEId = nId = aNmTb.Put( "_WHMapMode", VARNAME ); + pClassWindow->SetVariable( nId, pMapUnit, NULL, 0, WINDOW_WHMAPMODE ); + nRsc_WIDTH = nId = aNmTb.Put( "_Width", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_WIDTH ); + nRsc_HEIGHT = nId = aNmTb.Put( "_Height", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_HEIGHT ); + + nRsc_DELTALANG = nId = aNmTb.Put( "DeltaLang", VARNAME ); + pClassWindow->SetVariable( nId, pLangGeo, NULL, VAR_NORC | VAR_NOENUM); + nId = aNmTb.Put( "Text", VARNAME ); + pClassWindow->SetVariable( nId, &aLangString, NULL, 0, WINDOW_TEXT ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassWindow->SetVariable( nId, &aLangString, NULL, 0, WINDOW_HELPTEXT ); + nId = aNmTb.Put( "QuickHelpText", VARNAME ); + pClassWindow->SetVariable( nId, &aLangString, NULL, 0, WINDOW_QUICKTEXT ); + nId = aNmTb.Put( "ExtraLong", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_EXTRALONG ); + nId = aNmTb.Put( "UniqueId", VARNAME ); + pClassWindow->SetVariable( nId, &aString, NULL, 0, WINDOW_UNIQUEID ); + + // BorderStyle + RscEnum* pBorderStyleEnum = new RscEnum( pHS->getID( "WindowBorderStyle" ), RSC_NOTYPE ); + aBaseLst.push_back( pBorderStyleEnum ); + + // Konstanten in Tabelle stellen + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_NORMAL" ), WINDOW_BORDER_NORMAL ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_MONO" ), WINDOW_BORDER_MONO ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_ACTIVE" ), WINDOW_BORDER_ACTIVE ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_DOUBLEOUT" ), WINDOW_BORDER_DOUBLEOUT ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_MENU" ), WINDOW_BORDER_MENU ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_NOBORDER" ), WINDOW_BORDER_NOBORDER ); + + // Variable einfuegen + nId = aNmTb.Put( "BorderStyle", VARNAME ); + pClassWindow->SetVariable( nId, pBorderStyleEnum, NULL, + 0, + WINDOW_BORDER_STYLE ); + + return( pClassWindow ); +} + +/************************************************************************* +|* RscTypCont::InitClassSystemWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassSystemWindow( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassSystemWindow; + + // Klasse anlegen + nId = pHS->getID( "SystemWindow" ); + pClassSystemWindow = new RscClass( nId, RSC_SYSWINDOW, pSuper ); + pClassSystemWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassSystemWindow ); + + INS_WINBIT(pClassSystemWindow,Sizeable) + INS_WINBIT(pClassSystemWindow,Moveable) + InsWinBit( pClassSystemWindow, "Minable", nMinimizeId ); + InsWinBit( pClassSystemWindow, "Maxable", nMaximizeId ); + INS_WINBIT(pClassSystemWindow,Closeable) + INS_WINBIT(pClassSystemWindow,App) + INS_WINBIT(pClassSystemWindow,SysWin) + + return pClassSystemWindow ; +} + +/************************************************************************* +|* RscTypCont::InitClassWorkWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassWorkWindow( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassWorkWindow; + + // Klasse anlegen + nId = pHS->getID( "WorkWindow" ); + pClassWorkWindow = new RscClass( nId, RSC_WORKWIN, pSuper ); + pClassWorkWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassWorkWindow ); + + // Variablen anlegen + { + Atom nVarId; + RscEnum * pShow; + + aBaseLst.push_back( pShow = new RscEnum( pHS->getID( "EnumShowState" ), RSC_NOTYPE ) ); + + SETCONST( pShow, "SHOW_NORMAL", WORKWIN_SHOWNORMAL ); + SETCONST( pShow, "SHOW_MINIMIZED", WORKWIN_SHOWMINIMIZED ); + SETCONST( pShow, "SHOW_MAXIMIZED", WORKWIN_SHOWMAXIMIZED ); + + + // Variable einfuegen + nVarId = aNmTb.Put( "Show", VARNAME ); + pClassWorkWindow->SetVariable( nVarId, pShow, NULL ); + } + + return pClassWorkWindow; +} + +/************************************************************************* +|* RscTypCont::InitClassDialogBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassModalDialog( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassDialog; + + // Klasse anlegen + nId = pHS->getID( "ModalDialog" ); + pClassDialog = new RscClass( nId, RSC_MODALDIALOG, pSuper ); + pClassDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassDialog ); + + InsWinBit( pClassDialog, "SysModal", nSysmodalId ); + + return pClassDialog; +} + +/************************************************************************* +|* RscTypCont::InitClassModelessDialog() +*************************************************************************/ +RscTop * RscTypCont::InitClassModelessDialog( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassDialog; + + // Klasse anlegen + nId = pHS->getID( "ModelessDialog" ); + pClassDialog = new RscClass( nId, RSC_MODELESSDIALOG, pSuper ); + pClassDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassDialog ); + + return pClassDialog; +} + +/************************************************************************* +|* RscTypCont::InitClassControl() +*************************************************************************/ +RscTop * RscTypCont::InitClassControl( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassControl; + + // Klasse anlegen + nId = pHS->getID( "Control" ); + pClassControl = new RscClass( nId, RSC_CONTROL, pSuper ); + pClassControl->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassControl ); + + InsWinBit( pClassControl, "TabStop", nTabstopId ); + INS_WINBIT(pClassControl,Group) + + return pClassControl; +} + +/************************************************************************* +|* RscTypCont::InitClassCheckBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassCheckBox( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassCheckBox; + + // Klasse anlegen + nId = pHS->getID( "CheckBox" ); + pClassCheckBox = new RscClass( nId, RSC_CHECKBOX, pSuper ); + pClassCheckBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassCheckBox ); + + // Variablen anlegen + INS_WINBIT( pClassCheckBox, WordBreak ) + INS_WINBIT( pClassCheckBox, Top ) + INS_WINBIT( pClassCheckBox, VCenter ) + INS_WINBIT( pClassCheckBox, Bottom ) + + nId = aNmTb.Put( "Check", VARNAME ); + pClassCheckBox->SetVariable( nId, &aBool ); + + return pClassCheckBox; +} + +/************************************************************************* +|* RscTypCont::InitClassPushButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassPushButton( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassPushButton; + + // Klasse anlegen + nId = pHS->getID( "PushButton" ); + pClassPushButton = new RscClass( nId, RSC_PUSHBUTTON, pSuper ); + pClassPushButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassPushButton ); + + InsWinBit( pClassPushButton, "DefButton", nDefaultId ); + INS_WINBIT( pClassPushButton, Top ) + INS_WINBIT( pClassPushButton, VCenter ) + INS_WINBIT( pClassPushButton, Bottom ) + + return pClassPushButton; +} + +/************************************************************************* +|* RscTypCont::InitClassTriStateBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassTriStateBox( RscTop * pSuper, + RscEnum * pTriState ) +{ + Atom nId; + RscTop * pClassTriStateBox; + + nId = pHS->getID( "TriStateBox" ); + pClassTriStateBox = new RscClass( nId, RSC_TRISTATEBOX, pSuper ); + pClassTriStateBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassTriStateBox ); + + // Variablen anlegen + nId = aNmTb.Put( "State", VARNAME ); + pClassTriStateBox->SetVariable( nId, pTriState ); + nId = aNmTb.Put( "TriStateDisable", VARNAME ); + pClassTriStateBox->SetVariable( nId, &aBool ); + + return( pClassTriStateBox ); +} + +/************************************************************************* +|* RscTypCont::InitClassMenuButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassMenuButton( RscTop * pSuper, + RscTop * pClassMenu ) +{ + Atom nId; + RscTop * pClassMenuButton; + + nId = pHS->getID( "MenuButton" ); + pClassMenuButton = new RscClass( nId, RSC_MENUBUTTON, pSuper ); + pClassMenuButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassMenuButton ); + + // Variablen anlegen + nId = aNmTb.Put( "ButtonMenu", VARNAME ); + pClassMenuButton->SetVariable( nId, pClassMenu, NULL, 0, + RSCMENUBUTTON_MENU ); + + return( pClassMenuButton ); +} + + +/************************************************************************* +|* RscTypCont::InitClassImageButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassImageButton( RscTop * pSuper, + RscTop * pClassImage, + RscEnum * pTriState ) +{ + Atom nId; + RscTop * pClassImageButton; + + // Klasse anlegen + nId = pHS->getID( "ImageButton" ); + pClassImageButton = new RscClass( nId, RSC_IMAGEBUTTON, pSuper ); + pClassImageButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassImageButton ); + + // Variablen anlegen + { + nId = aNmTb.Put( "ButtonImage", VARNAME ); + pClassImageButton->SetVariable( nId, pClassImage, NULL, 0, + RSC_IMAGEBUTTON_IMAGE ); + } + // Variablen anlegen + { + Atom nVarId; + RscEnum * pSymbol; + + aBaseLst.push_back( pSymbol = new RscEnum( pHS->getID( "EnumSymbolButton" ), RSC_NOTYPE ) ); + + SETCONST( pSymbol, "IMAGEBUTTON_DONTKNOW", SYMBOL_DONTKNOW ); + SETCONST( pSymbol, "IMAGEBUTTON_IMAGE", SYMBOL_IMAGE ); + SETCONST( pSymbol, "IMAGEBUTTON_ARROW_UP", SYMBOL_ARROW_UP ); + SETCONST( pSymbol, "IMAGEBUTTON_ARROW_DOWN", SYMBOL_ARROW_DOWN ); + SETCONST( pSymbol, "IMAGEBUTTON_ARROW_LEFT", SYMBOL_ARROW_LEFT ); + SETCONST( pSymbol, "IMAGEBUTTON_ARROW_RIGHT", SYMBOL_ARROW_RIGHT ); + SETCONST( pSymbol, "IMAGEBUTTON_SPIN_UP", SYMBOL_SPIN_UP ); + SETCONST( pSymbol, "IMAGEBUTTON_SPIN_DOWN", SYMBOL_SPIN_DOWN ); + SETCONST( pSymbol, "IMAGEBUTTON_SPIN_LEFT", SYMBOL_SPIN_LEFT ); + SETCONST( pSymbol, "IMAGEBUTTON_SPIN_RIGHT", SYMBOL_SPIN_RIGHT ); + SETCONST( pSymbol, "IMAGEBUTTON_FIRST", SYMBOL_FIRST ); + SETCONST( pSymbol, "IMAGEBUTTON_LAST", SYMBOL_LAST ); + SETCONST( pSymbol, "IMAGEBUTTON_PREV", SYMBOL_PREV ); + SETCONST( pSymbol, "IMAGEBUTTON_NEXT", SYMBOL_NEXT ); + SETCONST( pSymbol, "IMAGEBUTTON_PAGEUP", SYMBOL_PAGEUP ); + SETCONST( pSymbol, "IMAGEBUTTON_PAGEDOWN", SYMBOL_PAGEDOWN ); + SETCONST( pSymbol, "IMAGEBUTTON_PLAY", SYMBOL_PLAY ); + SETCONST( pSymbol, "IMAGEBUTTON_REVERSEPLAY", SYMBOL_REVERSEPLAY ); + SETCONST( pSymbol, "IMAGEBUTTON_STOP", SYMBOL_STOP ); + SETCONST( pSymbol, "IMAGEBUTTON_PAUSE", SYMBOL_PAUSE ); + SETCONST( pSymbol, "IMAGEBUTTON_WINDSTART", SYMBOL_WINDSTART ); + SETCONST( pSymbol, "IMAGEBUTTON_WINDEND", SYMBOL_WINDEND ); + SETCONST( pSymbol, "IMAGEBUTTON_WINDBACKWARD", SYMBOL_WINDBACKWARD ); + SETCONST( pSymbol, "IMAGEBUTTON_WINDFORWARD", SYMBOL_WINDFORWARD ); + + // Variable einfuegen + nVarId = aNmTb.Put( "Symbol", VARNAME ); + pClassImageButton->SetVariable( nVarId, pSymbol, NULL, 0, + RSC_IMAGEBUTTON_SYMBOL ); + } + nId = aNmTb.Put( "State", VARNAME ); + pClassImageButton->SetVariable( nId, pTriState, NULL, 0, + RSC_IMAGEBUTTON_STATE ); + + INS_WINBIT(pClassImageButton,Repeat) + INS_WINBIT(pClassImageButton,SmallStyle) + INS_WINBIT(pClassImageButton,RectStyle) + + return pClassImageButton; +} + +/************************************************************************* +|* RscTypCont::InitClassEdit() +*************************************************************************/ +RscTop * RscTypCont::InitClassEdit( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassEdit; + + // Klasse anlegen + nId = pHS->getID( "Edit" ); + pClassEdit = new RscClass( nId, RSC_EDIT, pSuper ); + pClassEdit->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassEdit ); + + INS_WINBIT(pClassEdit,Left) + INS_WINBIT(pClassEdit,Center) + INS_WINBIT(pClassEdit,Right) + INS_WINBIT(pClassEdit,PassWord) + INS_WINBIT(pClassEdit,ReadOnly) + + nId = aNmTb.Put( "MaxTextLength", VARNAME ); + pClassEdit->SetVariable( nId, &aUShort ); + + return pClassEdit; +} + +/************************************************************************* +|* RscTypCont::InitClassMultiLineedit() +*************************************************************************/ +RscTop * RscTypCont::InitClassMultiLineEdit( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassMultiLineEdit; + + // Klasse anlegen + nId = pHS->getID( "MultiLineEdit" ); + pClassMultiLineEdit = new RscClass( nId, RSC_MULTILINEEDIT, pSuper ); + pClassMultiLineEdit->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassMultiLineEdit ); + + INS_WINBIT( pClassMultiLineEdit, HScroll ); + INS_WINBIT( pClassMultiLineEdit, VScroll ); + INS_WINBIT( pClassMultiLineEdit, IgnoreTab ); + INS_WINBIT( pClassMultiLineEdit, AutoVScroll ) + + return pClassMultiLineEdit; +} + +/************************************************************************* +|* RscTypCont::InitClassScrollBar() +*************************************************************************/ +RscTop * RscTypCont::InitClassScrollBar( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassScrollBar; + + // Klasse anlegen + nId = pHS->getID( "ScrollBar" ); + pClassScrollBar = new RscClass( nId, RSC_SCROLLBAR, pSuper ); + pClassScrollBar->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassScrollBar ); + + // Variablen anlegen + nId = aNmTb.Put( "MinPos", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort ); + { + RSCINST aDfltI; + + aDfltI = aShort.Create( NULL, RSCINST(), sal_False ); + aDfltI.pClass->SetNumber( aDfltI, 100 ); +// aDfltI.pClass->MakeDefault( aDfltI ); + + nId = aNmTb.Put( "MaxPos", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort, &aDfltI ); + } + nId = aNmTb.Put( "ThumbPos", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort ); + { + RSCINST aDfltI; + + aDfltI = aShort.Create( NULL, RSCINST(), sal_False ); + aDfltI.pClass->SetNumber( aDfltI, 1 ); +// aDfltI.pClass->MakeDefault( aDfltI ); + + nId = aNmTb.Put( "PageSize", VARNAME); + pClassScrollBar->SetVariable( nId, &aShort, &aDfltI ); + } + { + RSCINST aDfltI; + + aDfltI = aShort.Create( NULL, RSCINST(), sal_False ); + aDfltI.pClass->SetNumber( aDfltI, 1 ); +// aDfltI.pClass->MakeDefault( aDfltI ); + nId = aNmTb.Put( "LineSize", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort, &aDfltI ); + } + nId = aNmTb.Put( "VisibleSize", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort ); + + INS_WINBIT( pClassScrollBar, HScroll ); + INS_WINBIT( pClassScrollBar, VScroll ); + INS_WINBIT( pClassScrollBar, Drag ) + + return pClassScrollBar; +} + +/************************************************************************* +|* RscTypCont::InitClassListBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassListBox( RscTop * pSuper, RscArray * pStrLst ) +{ + Atom nId; + RscTop * pClassListBox; + + // Klasse anlegen + nId = pHS->getID( "ListBox" ); + pClassListBox = new RscClass( nId, RSC_LISTBOX, pSuper ); + pClassListBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassListBox ); + + // Variablen anlegen + INS_WINBIT(pClassListBox,Sort) + INS_WINBIT(pClassListBox,DropDown) + INS_WINBIT(pClassListBox,HScroll); + INS_WINBIT(pClassListBox,VScroll); + INS_WINBIT(pClassListBox,AutoSize) + INS_WINBIT(pClassListBox,AutoHScroll) + INS_WINBIT(pClassListBox,DDExtraWidth) + + { + RSCINST aDflt = aUShort.Create( NULL, RSCINST(), sal_False ); + aDflt.pClass->SetNumber( aDflt, (sal_uInt16)0xFFFF ); + nId = aNmTb.Put( "CurPos", VARNAME ); + pClassListBox->SetVariable( nId, &aUShort, &aDflt ); + } + nId = aNmTb.Put( "StringList", VARNAME ); + pClassListBox->SetVariable( nId, pStrLst ); + + return pClassListBox; +} + +/************************************************************************* +|* RscTypCont::InitClassMultiListBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassMultiListBox( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassMultiListBox; + + // Klasse anlegen + nId = pHS->getID( "MultiListBox" ); + pClassMultiListBox = new RscClass( nId, RSC_MULTILISTBOX, pSuper ); + pClassMultiListBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassMultiListBox ); + + INS_WINBIT(pClassMultiListBox,SimpleMode) + + return pClassMultiListBox; +} + +/************************************************************************* +|* RscTypCont::InitClassComboBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassComboBox( RscTop * pSuper, RscArray * pStrLst ) +{ + Atom nId; + RscTop * pClassComboBox; + + // Klasse anlegen + nId = pHS->getID( "ComboBox" ); + pClassComboBox = new RscClass( nId, RSC_COMBOBOX, pSuper ); + pClassComboBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassComboBox ); + + // Variablen anlegen + INS_WINBIT(pClassComboBox,DropDown) + INS_WINBIT(pClassComboBox,Sort) + INS_WINBIT(pClassComboBox,HScroll); + INS_WINBIT(pClassComboBox,VScroll); + INS_WINBIT(pClassComboBox,AutoSize) + INS_WINBIT(pClassComboBox,AutoHScroll) + INS_WINBIT(pClassComboBox,DDExtraWidth) + + nId = aNmTb.Put( "StringList", VARNAME ); + pClassComboBox->SetVariable( nId, pStrLst ); + + return pClassComboBox; +} + +/************************************************************************* +|* RscTypCont::InitClassFixedText() +*************************************************************************/ +RscTop * RscTypCont::InitClassFixedText( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassFixedText; + + // Klasse anlegen + nId = pHS->getID( "FixedText" ); + pClassFixedText = new RscClass( nId, RSC_TEXT, pSuper ); + pClassFixedText->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassFixedText ); + + // Variablen anlegen + INS_WINBIT(pClassFixedText,Left) + INS_WINBIT(pClassFixedText,Center) + INS_WINBIT(pClassFixedText,Right) + INS_WINBIT(pClassFixedText,WordBreak) + INS_WINBIT(pClassFixedText,LeftLabel) + INS_WINBIT(pClassFixedText,NoLabel) + INS_WINBIT(pClassFixedText,Top) + INS_WINBIT(pClassFixedText,VCenter) + INS_WINBIT(pClassFixedText,Bottom) + + return pClassFixedText; +} + +/************************************************************************* +|* RscTypCont::InitClassFixedBitmap() +*************************************************************************/ +RscTop * RscTypCont::InitClassFixedBitmap( RscTop * pSuper, RscTop * pClassBitmap ) +{ + Atom nId; + RscTop * pClassFixedBitmap; + + // Klasse anlegen + nId = pHS->getID( "FixedBitmap" ); + pClassFixedBitmap = new RscClass( nId, RSC_FIXEDBITMAP, pSuper ); + pClassFixedBitmap->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassFixedBitmap ); + + INS_WINBIT(pClassFixedBitmap,Scale) + + // Variablen anlegen + nId = aNmTb.Put( "Fixed", VARNAME ); + pClassFixedBitmap->SetVariable( nId, pClassBitmap, 0, 0, RSC_FIXEDBITMAP_BITMAP ); + + return pClassFixedBitmap; +} + +/************************************************************************* +|* RscTypCont::InitClassFixedImage() +*************************************************************************/ +RscTop * RscTypCont::InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage ) +{ + Atom nId; + RscTop * pClassFixedImage; + + // Klasse anlegen + nId = pHS->getID( "FixedImage" ); + pClassFixedImage = new RscClass( nId, RSC_FIXEDIMAGE, pSuper ); + pClassFixedImage->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassFixedImage ); + + // Variablen anlegen + nId = aNmTb.Put( "Fixed", VARNAME ); + pClassFixedImage->SetVariable( nId, pClassImage, 0, 0, RSC_FIXEDIMAGE_IMAGE ); + + return pClassFixedImage; +} + +/************************************************************************* +|* RscTypCont::InitClassImageRadioButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassRadioButton( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassRadioButton; + + // Klasse anlegen + nId = pHS->getID( "RadioButton" ); + pClassRadioButton = new RscClass( nId, RSC_RADIOBUTTON, pSuper ); + pClassRadioButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassRadioButton ); + + // Variablen anlegen + INS_WINBIT( pClassRadioButton, WordBreak ) + INS_WINBIT( pClassRadioButton, Top ) + INS_WINBIT( pClassRadioButton, VCenter ) + INS_WINBIT( pClassRadioButton, Bottom ) + + nId = aNmTb.Put( "Check", VARNAME ); + pClassRadioButton->SetVariable( nId, &aBool ); + + return pClassRadioButton; +} + +/************************************************************************* +|* RscTypCont::InitClassImageRadioButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassImageRadioButton( RscTop * pSuper, RscTop * pClassImage ) +{ + Atom nId; + RscTop * pClassImageRadioButton; + + // Klasse anlegen + nId = pHS->getID( "ImageRadioButton" ); + pClassImageRadioButton = new RscClass( nId, RSC_IMAGERADIOBUTTON, pSuper ); + pClassImageRadioButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassImageRadioButton ); + + // Variablen anlegen + INS_WINBIT(pClassImageRadioButton,TopImage) + nId = aNmTb.Put( "RadioButtonImage", VARNAME ); + pClassImageRadioButton->SetVariable( nId, pClassImage, 0, 0, RSC_IMAGERADIOBUTTON_IMAGE ); + + return pClassImageRadioButton; +} + +/************************************************************************* +|* RscTypCont::InitClassKeyCode() +*************************************************************************/ +RscTop * RscTypCont::InitClassKeyCode( RscTop * pSuper, RscEnum * pKey ) +{ + Atom nId; + RscTop * pClassKeyCode; + + // Klasse anlegen + nId = pHS->getID( "KeyCode" ); + pClassKeyCode = new RscClass( nId, RSC_KEYCODE, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassKeyCode ); + + // Variablen anlegen + nId = aNmTb.Put( "Code", VARNAME ); + pClassKeyCode->SetVariable( nId, pKey ); + + { + RscFlag * pFlag; + RscClient * pClient; + Atom nVarId, nShiftId, nMod1Id, nMod2Id; + + aBaseLst.push_back( pFlag = new RscFlag( pHS->getID( "FlagKeyModifier" ), RSC_NOTYPE ) ); + + // Konstanten in Tabelle stellen + nShiftId = pHS->getID( "KEY_SHIFT" ); + SETCONST( pFlag, nShiftId, KEY_SHIFT ); + nMod1Id = pHS->getID( "KEY_MOD1" ); + SETCONST( pFlag, nMod1Id, KEY_MOD1 ); + nMod2Id = pHS->getID( "KEY_MOD2" ); + SETCONST( pFlag, nMod2Id, KEY_MOD2 ); + + // Variable einfuegen + nVarId = aNmTb.Put( "_ModifierFlags", VARNAME ); + pClassKeyCode->SetVariable( nVarId, pFlag, NULL, + VAR_HIDDEN | VAR_NOENUM ); + + // Clientvariablen einfuegen + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nShiftId ) + ); + nId = aNmTb.Put( "Shift", VARNAME ); + pClassKeyCode->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nMod1Id ) + ); + nId = aNmTb.Put( "Modifier1", VARNAME ); + pClassKeyCode->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nMod2Id ) + ); + nId = aNmTb.Put( "Modifier2", VARNAME ); + pClassKeyCode->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + } + { + Atom nVarId; + RscEnum * pKeyFunc; + + aBaseLst.push_back( pKeyFunc = new RscEnum( pHS->getID( "EnumKeyFunc" ), RSC_NOTYPE ) ); + + SETCONST( pKeyFunc, "KEYFUNC_DONTKNOW", KEYFUNC_DONTKNOW ); + SETCONST( pKeyFunc, "KEYFUNC_NEW", KEYFUNC_NEW ); + SETCONST( pKeyFunc, "KEYFUNC_OPEN", KEYFUNC_OPEN ); + SETCONST( pKeyFunc, "KEYFUNC_SAVE", KEYFUNC_SAVE ); + SETCONST( pKeyFunc, "KEYFUNC_SAVEAS", KEYFUNC_SAVEAS ); + SETCONST( pKeyFunc, "KEYFUNC_PRINT", KEYFUNC_PRINT ); + SETCONST( pKeyFunc, "KEYFUNC_CLOSE", KEYFUNC_CLOSE ); + SETCONST( pKeyFunc, "KEYFUNC_QUIT", KEYFUNC_QUIT ); + SETCONST( pKeyFunc, "KEYFUNC_CUT", KEYFUNC_CUT ); + SETCONST( pKeyFunc, "KEYFUNC_COPY", KEYFUNC_COPY ); + SETCONST( pKeyFunc, "KEYFUNC_PASTE", KEYFUNC_PASTE ); + SETCONST( pKeyFunc, "KEYFUNC_UNDO", KEYFUNC_UNDO ); + SETCONST( pKeyFunc, "KEYFUNC_REDO", KEYFUNC_REDO ); + SETCONST( pKeyFunc, "KEYFUNC_DELETE", KEYFUNC_DELETE ); + SETCONST( pKeyFunc, "KEYFUNC_REPEAT", KEYFUNC_REPEAT ); + SETCONST( pKeyFunc, "KEYFUNC_FIND", KEYFUNC_FIND ); + SETCONST( pKeyFunc, "KEYFUNC_PROPERTIES", KEYFUNC_PROPERTIES ); + SETCONST( pKeyFunc, "KEYFUNC_FRONT", KEYFUNC_FRONT ); + SETCONST( pKeyFunc, "KEYFUNC_FINDBACKWARD", KEYFUNC_FINDBACKWARD ); + // Variable einfuegen + nVarId = aNmTb.Put( "Function", VARNAME ); + pClassKeyCode->SetVariable( nVarId, pKeyFunc, NULL ); + } + + return pClassKeyCode; +} + +/************************************************************************* +|* RscTypCont::InitClassAccelItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassAccelItem( RscTop * pSuper, + RscTop * pClassKeyCode ) +{ + Atom nId; + RscTop * pClassAccelItem; + + // Klasse anlegen + nId = pHS->getID( "AcceleratorItem" ); + pClassAccelItem = new RscClass( nId, RSC_ACCELITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassAccelItem ); + + // Variablen anlegen + nId = aNmTb.Put( "Identifier", VARNAME ); + pClassAccelItem->SetVariable( nId, &aIdNoZeroUShort ); + nId = aNmTb.Put( "Disable", VARNAME ); + pClassAccelItem->SetVariable( nId, &aBool ); + nId = aNmTb.Put( "Key", VARNAME ); + pClassAccelItem->SetVariable( nId, pClassKeyCode, NULL, 0, + ACCELITEM_KEY ); + + return pClassAccelItem; +} + +/************************************************************************* +|* RscTypCont::InitClassAccelm() +*************************************************************************/ +RscTop * RscTypCont::InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem ) +{ + Atom nId; + RscTop * pClassAccel; + + // Klasse anlegen + nId = pHS->getID( "Accelerator" ); + pClassAccel = new RscClass( nId, RSC_ACCEL, pSuper ); + pClassAccel->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassAccel ); + + // Variablen anlegen + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassAccel->SetVariable( nId, &aLangString ); + { + RscCont * pCont; + + aBaseLst.push_back( + pCont = new RscCont( pHS->getID( "ContAcceleratorKey" ), RSC_NOTYPE ) + ); + pCont->SetTypeClass( pClassAccelItem ); + nId = aNmTb.Put( "ItemList", VARNAME ); + pClassAccel->SetVariable( nId, pCont ); + } + + return pClassAccel; +} + +/************************************************************************* +|* RscTypCont::InitClassMenuItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper, + RscTop * pClassBitmap, + RscTop * pClassKeyCode ) +{ + Atom nId; + RscTop * pClassMenuItem; + + // Klasse anlegen + nId = pHS->getID( "MenuItem" ); + pClassMenuItem = new RscClass( nId, RSC_MENUITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassMenuItem ); + + // Variablen anlegen + nId = aNmTb.Put( "Separator", VARNAME ); + pClassMenuItem->SetVariable( nId, &aBool, NULL, 0, + RSC_MENUITEM_SEPARATOR ); + nId = aNmTb.Put( "Identifier", VARNAME ); + pClassMenuItem->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, + RSC_MENUITEM_ID ); + { + RscFlag * pFlag; + RscClient * pClient; + Atom nVarId, nAutoCheckId, nRadioCheckId; + Atom nCheckableId, nAboutId, nHelpId; + + aBaseLst.push_back( pFlag = new RscFlag( pHS->getID( "FlagMenuState" ), RSC_NOTYPE ) ); + + // Konstanten in Tabelle stellen + nCheckableId = pHS->getID( "MIB_CHECKABLE" ); + SETCONST( pFlag, nCheckableId, MIB_CHECKABLE ); + nAutoCheckId = pHS->getID( "MIB_AUTOCHECK" ); + SETCONST( pFlag, nAutoCheckId, MIB_AUTOCHECK ); + nRadioCheckId = pHS->getID( "MIB_RADIOCHECK" ); + SETCONST( pFlag, nRadioCheckId, MIB_RADIOCHECK ); + nAboutId = pHS->getID( "MIB_ABOUT" ); + SETCONST( pFlag, nAboutId, MIB_ABOUT ); + nHelpId = pHS->getID( "MIB_HELP" ); + SETCONST( pFlag, nHelpId, MIB_HELP ); + + // Variable einfuegen + nVarId = aNmTb.Put( "_MenuItemFlags", VARNAME ); + pClassMenuItem->SetVariable( nVarId, pFlag, NULL, + VAR_HIDDEN | VAR_NOENUM, + RSC_MENUITEM_STATUS ); + + // Clientvariablen einfuegen + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nCheckableId ) + ); + nId = aNmTb.Put( "Checkable", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nAutoCheckId ) + ); + nId = aNmTb.Put( "AutoCheck", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nRadioCheckId ) + ); + nId = aNmTb.Put( "RadioCheck", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nAboutId ) + ); + nId = aNmTb.Put( "About", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nHelpId ) + ); + nId = aNmTb.Put( "Help", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + } + nId = aNmTb.Put( "Text", VARNAME ); + pClassMenuItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_MENUITEM_TEXT ); + nId = aNmTb.Put( "ItemBitmap", VARNAME ); + pClassMenuItem->SetVariable( nId, pClassBitmap, NULL, 0, + RSC_MENUITEM_BITMAP ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassMenuItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_MENUITEM_HELPTEXT ); + nId = aNmTb.Put( "HelpID", VARNAME ); + pClassMenuItem->SetVariable( nId, &aStringLiteral, NULL, 0, + RSC_MENUITEM_HELPID ); + nId = aNmTb.Put( "AccelKey", VARNAME ); + pClassMenuItem->SetVariable( nId, pClassKeyCode, NULL, 0, + RSC_MENUITEM_KEYCODE ); + nId = aNmTb.Put( "Check", VARNAME ); + pClassMenuItem->SetVariable( nId, &aBool, NULL, 0, + RSC_MENUITEM_CHECKED ); + nId = aNmTb.Put( "Disable", VARNAME ); + pClassMenuItem->SetVariable( nId, &aBool, NULL, 0, + RSC_MENUITEM_DISABLE ); + nId = aNmTb.Put( "Command", VARNAME ); + pClassMenuItem->SetVariable( nId, &aString, NULL, 0, + RSC_MENUITEM_COMMAND ); + + return pClassMenuItem; +} + +/************************************************************************* +|* RscTypCont::InitClassMenu() +*************************************************************************/ +RscTop * RscTypCont::InitClassMenu( RscTop * pSuper, + RscTop * pClassMenuItem ) +{ + Atom nId; + RscTop * pClassMenu; + + // Klasse anlegen + nId = pHS->getID( "Menu" ); + pClassMenu = new RscClass( nId, RSC_MENU, pSuper ); + pClassMenu->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassMenu ); + + // Variablen anlegen + { + RscCont * pCont; + + aBaseLst.push_back( pCont = new RscCont( pHS->getID( "ContMenuItem" ), RSC_NOTYPE ) ); + pCont->SetTypeClass( pClassMenuItem ); + nId = aNmTb.Put( "ItemList", VARNAME ); + pClassMenu->SetVariable( nId, pCont, NULL, 0, RSC_MENU_ITEMS ); + } + nId = aNmTb.Put( "Text", VARNAME ); + pClassMenu->SetVariable( nId, &aLangString, NULL, 0, RSC_MENU_TEXT ); + nId = aNmTb.Put( "DefaultItemId", VARNAME ); + pClassMenu->SetVariable( nId, &aIdUShort, NULL, 0, + RSC_MENU_DEFAULTITEMID ); + + return pClassMenu; +} + +/************************************************************************* +|* RscTypCont::InitClassMessageBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassMessBox( RscTop * pSuper, + RscEnum * pMessButtons, + RscEnum * pMessDefButton ) +{ + Atom nId; + RscTop * pClassMessBox; + + // Klasse anlegen + nId = pHS->getID( "MessBox" ); + pClassMessBox = new RscClass( nId, RSC_MESSBOX, pSuper ); + pClassMessBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassMessBox ); + + // Variablen anlegen + nId = aNmTb.Put( "Buttons", VARNAME ); + pClassMessBox->SetVariable( nId, pMessButtons ); + nId = aNmTb.Put( "DefButton", VARNAME ); + pClassMessBox->SetVariable( nId, pMessDefButton ); + nId = aNmTb.Put( "HelpID", VARNAME ); + pClassMessBox->SetVariable( nId, &aStringLiteral ); + nId = aNmTb.Put( "SysModal", VARNAME ); + pClassMessBox->SetVariable( nId, &aBool ); + nId = aNmTb.Put( "Title", VARNAME ); + pClassMessBox->SetVariable( nId, &aLangString ); + nId = aNmTb.Put( "Message", VARNAME ); + pClassMessBox->SetVariable( nId, &aLangString ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassMessBox->SetVariable( nId, &aLangString ); + + return pClassMessBox; +} + +/************************************************************************* +|* RscTypCont::InitClassSplitter() +*************************************************************************/ +RscTop * RscTypCont::InitClassSplitter( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassSplitter; + + // Klasse anlegen + nId = pHS->getID( "Splitter" ); + pClassSplitter = new RscClass( nId, RSC_SPLITTER, pSuper ); + pClassSplitter->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassSplitter ); + + INS_WINBIT(pClassSplitter,HScroll); + INS_WINBIT(pClassSplitter,VScroll); + + return pClassSplitter; +} + +/************************************************************************* +|* RscTypCont::InitClassSplitWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassSplitWindow( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassSplitWindow; + + // Klasse anlegen + nId = pHS->getID( "SplitWindow" ); + pClassSplitWindow = new RscClass( nId, RSC_SPLITWINDOW, pSuper ); + pClassSplitWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassSplitWindow ); + + INS_WINBIT(pClassSplitWindow,Sizeable) + INS_WINBIT(pClassSplitWindow,NoSplitDraw) + + return pClassSplitWindow; +} + +/************************************************************************* +|* RscTypCont::InitClassTime() +*************************************************************************/ +RscTop * RscTypCont::InitClassTime( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassTime; + + // Klasse anlegen + nId = pHS->getID( "Time" ); + pClassTime = new RscClass( nId, RSC_TIME, pSuper ); + pClassTime->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + aNmTb.Put( nId, CLASSNAME, pClassTime ); + + // Variablen anlegen + nId = aNmTb.Put( "Hour", VARNAME ); + pClassTime->SetVariable( nId, &a0to23Short, NULL, 0, TIME_HOUR ); + + nId = aNmTb.Put( "Minute", VARNAME ); + pClassTime->SetVariable( nId, &a0to59Short, NULL, 0, TIME_MINUTE ); + + nId = aNmTb.Put( "Second", VARNAME ); + pClassTime->SetVariable( nId, &a0to59Short, NULL, 0, TIME_SECOND ); + + nId = aNmTb.Put( "Sec100", VARNAME ); // weiss noch nich + pClassTime->SetVariable( nId, &a0to99Short, NULL, 0, TIME_SEC100 ); + + return pClassTime; +} + +/************************************************************************* +|* RscTypCont::InitClassDate() +*************************************************************************/ +RscTop * RscTypCont::InitClassDate( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassDate; + + // Klasse anlegen + nId = pHS->getID( "Date" ); + pClassDate = new RscClass( nId, RSC_DATE, pSuper ); + pClassDate->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + aNmTb.Put( nId, CLASSNAME, pClassDate ); + + // Variablen anlegen + nId = aNmTb.Put( "Year", VARNAME ); + pClassDate->SetVariable( nId, &a0to9999Short, NULL, 0, DATE_YEAR ); + + nId = aNmTb.Put( "Month", VARNAME ); + pClassDate->SetVariable( nId, &a1to12Short, NULL, 0, DATE_MONTH ); + + nId = aNmTb.Put( "Day", VARNAME ); + pClassDate->SetVariable( nId, &a1to31Short, NULL, 0, DATE_DAY ); + + return pClassDate; +} + +/************************************************************************* +|* RscTypCont::InitClassPatternFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassPatternFormatter( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassPattern; + + // Klasse anlegen + nId = pHS->getID( "PatternFormatter" ); + pClassPattern = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassPattern->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "StrictFormat", VARNAME ); + pClassPattern->SetVariable( nId, &aBool, NULL, + 0, PATTERNFORMATTER_STRICTFORMAT ); + nId = aNmTb.Put( "EditMask", VARNAME ); + pClassPattern->SetVariable( nId, &aLangString, NULL, + 0, PATTERNFORMATTER_EDITMASK ); + nId = aNmTb.Put( "LiteralMask", VARNAME ); + pClassPattern->SetVariable( nId, &aLangString, NULL, + 0, PATTERNFORMATTER_LITTERALMASK ); + + return pClassPattern; +} + +/************************************************************************* +|* RscTypCont::InitClassNumericFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassNumericFormatter( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassNumeric; + + // Klasse anlegen + nId = pHS->getID( "NumericFormatter" ); + pClassNumeric = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassNumeric->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Minimum", VARNAME ); + pClassNumeric->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFORMATTER_MIN ); + nId = aNmTb.Put( "Maximum", VARNAME ); + pClassNumeric->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFORMATTER_MAX ); + nId = aNmTb.Put( "StrictFormat", VARNAME ); + pClassNumeric->SetVariable( nId, &aBool, NULL, + 0, NUMERICFORMATTER_STRICTFORMAT ); + nId = aNmTb.Put( "DecimalDigits", VARNAME ); + pClassNumeric->SetVariable( nId, &aUShort, NULL, + 0, NUMERICFORMATTER_DECIMALDIGITS ); + nId = aNmTb.Put( "Value", VARNAME ); + pClassNumeric->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFORMATTER_VALUE ); + nId = aNmTb.Put( "NoThousandSep", VARNAME ); + pClassNumeric->SetVariable( nId, &aBool, NULL, + 0, NUMERICFORMATTER_NOTHOUSANDSEP ); + + return pClassNumeric; +} + +/************************************************************************* +|* RscTypCont::InitClassMetricFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassMetricFormatter( RscTop * pSuper, + RscEnum * pFieldUnits ) +{ + Atom nId; + RscTop * pClassMetric; + + // Klasse anlegen + nId = pHS->getID( "MetricFormatter" ); + pClassMetric = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassMetric->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Unit", VARNAME ); + pClassMetric->SetVariable( nId, pFieldUnits, NULL, + 0, METRICFORMATTER_UNIT ); + nId = aNmTb.Put( "CustomUnitText", VARNAME ); + pClassMetric->SetVariable( nId, &aLangString, NULL, + 0, METRICFORMATTER_CUSTOMUNITTEXT ); + + return pClassMetric; +} + +/************************************************************************* +|* RscTypCont::InitClassCurrencyFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassCurrencyFormatter +( + RscTop * pSuper, + RscEnum * /* pFieldUnits */) +{ + Atom nId; + RscTop * pClassCurrency; + + // Klasse anlegen + nId = pHS->getID( "CurrencyFormatter" ); + pClassCurrency = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassCurrency->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + return pClassCurrency; +} + +/************************************************************************* +|* RscTypCont::InitClassDateFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassDateFormatter( RscTop * pSuper, + RscTop * pClassDate ) +{ + Atom nId; + RscTop * pClassDateF; + + // Klasse anlegen + nId = pHS->getID( "DateFormatter" ); + pClassDateF = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassDateF->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Minimum", VARNAME ); + pClassDateF->SetVariable( nId, pClassDate, NULL, + 0, DATEFORMATTER_MIN ); + nId = aNmTb.Put( "Maximum", VARNAME ); + pClassDateF->SetVariable( nId, pClassDate, NULL, + 0, DATEFORMATTER_MAX ); + nId = aNmTb.Put( "LongFormat", VARNAME ); + pClassDateF->SetVariable( nId, &aBool, NULL, + 0, DATEFORMATTER_LONGFORMAT ); + nId = aNmTb.Put( "StrictFormat", VARNAME ); + pClassDateF->SetVariable( nId, &aBool, NULL, + 0, DATEFORMATTER_STRICTFORMAT ); + nId = aNmTb.Put( "Value", VARNAME ); + pClassDateF->SetVariable( nId, pClassDate, NULL, + 0, DATEFORMATTER_VALUE ); + + return pClassDateF; +} + +/************************************************************************* +|* RscTypCont::InitClassTimeFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassTimeFormatter( RscTop * pSuper, + RscTop * pClassTime, + RscEnum * pTimeFieldFormat ) +{ + Atom nId; + RscTop * pClassTimeF; + + // Klasse anlegen + nId = pHS->getID( "TimeFormatter" ); + pClassTimeF = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassTimeF->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Minimum", VARNAME ); + pClassTimeF->SetVariable( nId, pClassTime, NULL, + 0, TIMEFORMATTER_MIN ); + nId = aNmTb.Put( "Maximum", VARNAME ); + pClassTimeF->SetVariable( nId, pClassTime, NULL, + 0, TIMEFORMATTER_MAX ); + nId = aNmTb.Put( "Format", VARNAME ); + pClassTimeF->SetVariable( nId, pTimeFieldFormat, NULL, + 0, TIMEFORMATTER_TIMEFIELDFORMAT ); + nId = aNmTb.Put( "Duration", VARNAME ); + pClassTimeF->SetVariable( nId, &aBool, NULL, + 0, TIMEFORMATTER_DURATION ); + nId = aNmTb.Put( "StrictFormat", VARNAME ); + pClassTimeF->SetVariable( nId, &aBool, NULL, + 0, TIMEFORMATTER_STRICTFORMAT ); + nId = aNmTb.Put( "Value", VARNAME ); + pClassTimeF->SetVariable( nId, pClassTime, NULL, + 0, TIMEFORMATTER_VALUE ); + + return pClassTimeF; +} + +/************************************************************************* +|* RscTypCont::InitClassSpinField() +*************************************************************************/ +RscTop * RscTypCont::InitClassSpinField( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassSpinField; + + // Klasse anlegen + nId = pHS->getID( "SpinField" ); + pClassSpinField = new RscClass( nId, RSC_SPINFIELD, pSuper ); + pClassSpinField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassSpinField ); + + INS_WINBIT(pClassSpinField,Repeat) + INS_WINBIT(pClassSpinField,Spin) + + return pClassSpinField; +} + +/************************************************************************* +|* RscTypCont::InitClassPatternField() +*************************************************************************/ +RscTop * RscTypCont::InitClassPatternField( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassPatternField; + + // Klasse anlegen + nId = pHS->getID( "PatternField" ); + pClassPatternField = new RscClass( nId, RSC_PATTERNFIELD, pSuper ); + pClassPatternField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassPatternField ); + + return pClassPatternField; +} + +/************************************************************************* +|* RscTypCont::InitClassNumericField() +*************************************************************************/ +RscTop * RscTypCont::InitClassNumericField( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassNumericField; + + // Klasse anlegen + nId = pHS->getID( "NumericField" ); + pClassNumericField = new RscClass( nId, RSC_NUMERICFIELD, pSuper ); + pClassNumericField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassNumericField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassNumericField->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassNumericField->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFIELD_LAST ); + nId = aNmTb.Put( "SpinSize", VARNAME ); + pClassNumericField->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFIELD_SPINSIZE ); + return pClassNumericField; +} + +/************************************************************************* +|* RscTypCont::InitClassMetricField() +*************************************************************************/ +RscTop * RscTypCont::InitClassMetricField( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassMetricField; + + // Klasse anlegen + nId = pHS->getID( "MetricField" ); + pClassMetricField = new RscClass( nId, RSC_METRICFIELD, pSuper ); + pClassMetricField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassMetricField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassMetricField->SetVariable( nId, &aIdLong, NULL, + 0, METRICFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassMetricField->SetVariable( nId, &aIdLong, NULL, + 0, METRICFIELD_LAST ); + nId = aNmTb.Put( "SpinSize", VARNAME ); + pClassMetricField->SetVariable( nId, &aIdLong, NULL, + 0, METRICFIELD_SPINSIZE ); + + return pClassMetricField; +} + +/************************************************************************* +|* RscTypCont::InitClassCurrencyField() +*************************************************************************/ +RscTop * RscTypCont::InitClassCurrencyField +( + const char * pClassName, + sal_uInt32 nRT, + RscTop * pSuper +) +{ + Atom nId; + RscTop * pClassCurrencyField; + + // Klasse anlegen + nId = pHS->getID( pClassName ); + pClassCurrencyField = new RscClass( nId, nRT, pSuper ); + pClassCurrencyField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassCurrencyField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassCurrencyField->SetVariable( nId, &aIdLong, NULL, + 0, CURRENCYFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassCurrencyField->SetVariable( nId, &aIdLong, NULL, + 0, CURRENCYFIELD_LAST ); + nId = aNmTb.Put( "SpinSize", VARNAME ); + pClassCurrencyField->SetVariable( nId, &aIdLong, NULL, + 0, CURRENCYFIELD_SPINSIZE ); + + return pClassCurrencyField; +} + +/************************************************************************* +|* RscTypCont::InitClassDateField() +*************************************************************************/ +RscTop * RscTypCont::InitClassDateField( RscTop * pSuper, RscTop * pClassDate ) +{ + Atom nId; + RscTop * pClassDateField; + + // Klasse anlegen + nId = pHS->getID( "DateField" ); + pClassDateField = new RscClass( nId, RSC_DATEFIELD, pSuper ); + pClassDateField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassDateField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassDateField->SetVariable( nId, pClassDate, NULL, 0, DATEFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassDateField->SetVariable( nId, pClassDate, NULL, 0, DATEFIELD_LAST ); + + return pClassDateField; +} + +/************************************************************************* +|* RscTypCont::InitClassTimeField() +*************************************************************************/ +RscTop * RscTypCont::InitClassTimeField( RscTop * pSuper, RscTop * pClassTime ) +{ + Atom nId; + RscTop * pClassTimeField; + + // Klasse anlegen + nId = pHS->getID( "TimeField" ); + pClassTimeField = new RscClass( nId, RSC_TIMEFIELD, pSuper ); + pClassTimeField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassTimeField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassTimeField->SetVariable( nId, pClassTime, NULL, 0, TIMEFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassTimeField->SetVariable( nId, pClassTime, NULL, 0, TIMEFIELD_LAST ); + + return pClassTimeField; +} + +/************************************************************************* +|* RscTypCont::InitClassPatternBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassPatternBox( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassPatternBox; + + // Klasse anlegen + nId = pHS->getID( "PatternBox" ); + pClassPatternBox = new RscClass( nId, RSC_PATTERNBOX, pSuper ); + pClassPatternBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassPatternBox ); + + return pClassPatternBox; +} + +/************************************************************************* +|* RscTypCont::InitClassNumericBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassNumericBox( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassNumericBox; + + // Klasse anlegen + nId = pHS->getID( "NumericBox" ); + pClassNumericBox = new RscClass( nId, RSC_NUMERICBOX, pSuper ); + pClassNumericBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassNumericBox ); + + // Variablen anlegen + + return pClassNumericBox; +} + +/************************************************************************* +|* RscTypCont::InitClassMetricBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassMetricBox( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassMetricBox; + + // Klasse anlegen + nId = pHS->getID( "MetricBox" ); + pClassMetricBox = new RscClass( nId, RSC_METRICBOX, pSuper ); + pClassMetricBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassMetricBox ); + + // Variablen anlegen + + return pClassMetricBox; +} + +/************************************************************************* +|* RscTypCont::InitClassCurrencyBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassCurrencyBox +( + const char * pClassName, + sal_uInt32 nRT, + RscTop * pSuper +) +{ + Atom nId; + RscTop * pClassCurrencyBox; + + // Klasse anlegen + nId = pHS->getID( pClassName ); + pClassCurrencyBox = new RscClass( nId, nRT, pSuper ); + pClassCurrencyBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassCurrencyBox ); + + // Variablen anlegen + + return pClassCurrencyBox; +} + +/************************************************************************* +|* RscTypCont::InitClassDateBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassDateBox( RscTop * pSuper, + RscTop * /*pClassDate*/ ) +{ + Atom nId; + RscTop * pClassDateBox; + + // Klasse anlegen + nId = pHS->getID( "DateBox" ); + pClassDateBox = new RscClass( nId, RSC_DATEBOX, pSuper ); + pClassDateBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassDateBox ); + + // Variablen anlegen + + return pClassDateBox; +} + +/************************************************************************* +|* RscTypCont::InitClassTimeBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassTimeBox( RscTop * pSuper, + RscTop * /*pClassTime*/ ) +{ + Atom nId; + RscTop * pClassTimeBox; + + // Klasse anlegen + nId = pHS->getID( "TimeBox" ); + pClassTimeBox = new RscClass( nId, RSC_TIMEBOX, pSuper ); + pClassTimeBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassTimeBox ); + + // Variablen anlegen + + return pClassTimeBox; +} + +/************************************************************************* +|* RscTypCont::InitClassDockWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassDockingWindow( RscTop * pSuper, + RscEnum * pMapUnit ) +{ + Atom nId; + RscTop * pClassDockWindow; + + // Klasse anlegen + nId = pHS->getID( "DockingWindow" ); + pClassDockWindow = new RscClass( nId, RSC_DOCKINGWINDOW, pSuper ); + pClassDockWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassDockWindow ); + + // Variablen anlegen + nId = aNmTb.Put( "_FloatingPosMapMode", VARNAME ); + pClassDockWindow->SetVariable( nId, pMapUnit, NULL, 0, + RSC_DOCKINGWINDOW_XYMAPMODE ); + nId = aNmTb.Put( "_FloatingPosX", VARNAME ); + pClassDockWindow->SetVariable( nId, &aShort, NULL, 0, + RSC_DOCKINGWINDOW_X ); + nId = aNmTb.Put( "_FloatingPosY", VARNAME ); + pClassDockWindow->SetVariable( nId, &aShort, NULL, 0, + RSC_DOCKINGWINDOW_Y ); + nId = aNmTb.Put( "FloatingMode", VARNAME ); + pClassDockWindow->SetVariable( nId, &aBool, NULL, 0, + RSC_DOCKINGWINDOW_FLOATING ); + + INS_WINBIT(pClassDockWindow,Moveable) + INS_WINBIT(pClassDockWindow,Sizeable) + INS_WINBIT(pClassDockWindow,EnableResizing) + INS_WINBIT(pClassDockWindow,Closeable) + INS_WINBIT(pClassDockWindow,HideWhenDeactivate); + INS_WINBIT(pClassDockWindow,Zoomable); + INS_WINBIT(pClassDockWindow,Dockable); + + return pClassDockWindow; +} + +/************************************************************************* +|* RscTypCont::InitClassToolBoxItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassToolBoxItem( RscTop * pSuper, + RscTop * pClassBitmap, + RscTop * pClassImage, + RscEnum * pTriState ) +{ + Atom nId; + RscTop * pClassToolBoxItem; + + // Klasse anlegen + nId = pHS->getID( "ToolBoxItem" ); + pClassToolBoxItem = new RscClass( nId, RSC_TOOLBOXITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassToolBoxItem ); + + // Variablen anlegen + nId = aNmTb.Put( "Identifier", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, + RSC_TOOLBOXITEM_ID ); + { + RscEnum * pEnum; + + aBaseLst.push_back( pEnum = new RscEnum( pHS->getID( "EnumToolBoxItemType" ), RSC_NOTYPE ) ); + SETCONST( pEnum, "TOOLBOXITEM_BUTTON", TOOLBOXITEM_BUTTON ); + SETCONST( pEnum, "TOOLBOXITEM_SPACE", TOOLBOXITEM_SPACE ); + SETCONST( pEnum, "TOOLBOXITEM_SEPARATOR", TOOLBOXITEM_SEPARATOR ); + SETCONST( pEnum, "TOOLBOXITEM_BREAK", TOOLBOXITEM_BREAK ); + + // Variable einfuegen + nId = aNmTb.Put( "Type", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pEnum, NULL, 0, + RSC_TOOLBOXITEM_TYPE ); + } + { + RscFlag * pFlag; + RscClient * pClient; + Atom l_nVarId, l_nAutoCheckId, l_nRadioCheckId, l_nCheckableId, l_nLeftId, l_nAutoSizeId, l_nDropDownId; + + aBaseLst.push_back( pFlag = new RscFlag( pHS->getID( "FlagToolBoxState" ), RSC_NOTYPE ) ); + + // Konstanten in Tabelle stellen + l_nCheckableId = pHS->getID( "TIB_CHECKABLE" ); + SETCONST( pFlag, l_nCheckableId, TIB_CHECKABLE ); + l_nAutoCheckId = pHS->getID( "TIB_AUTOCHECK" ); + SETCONST( pFlag, l_nAutoCheckId, TIB_AUTOCHECK ); + l_nRadioCheckId = pHS->getID( "TIB_RADIOCHECK" ); + SETCONST( pFlag, l_nRadioCheckId, TIB_RADIOCHECK ); + l_nLeftId = pHS->getID( "TIB_LEFT" ); + SETCONST( pFlag, l_nLeftId, TIB_LEFT ); + l_nAutoSizeId = pHS->getID( "TIB_AUTOSIZE" ); + SETCONST( pFlag, l_nAutoSizeId, TIB_AUTOSIZE ); + l_nDropDownId = pHS->getID( "TIB_DROPDOWN" ); + SETCONST( pFlag, l_nDropDownId, TIB_DROPDOWN ); + + // Variable einfuegen + l_nVarId = aNmTb.Put( "_ToolBoxItemFlags", VARNAME ); + pClassToolBoxItem->SetVariable( l_nVarId, pFlag, NULL, + VAR_HIDDEN | VAR_NOENUM, + RSC_TOOLBOXITEM_STATUS ); + + // Clientvariablen einfuegen + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, l_nCheckableId ) + ); + nId = aNmTb.Put( "Checkable", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, l_nAutoCheckId ) + ); + nId = aNmTb.Put( "AutoCheck", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, l_nRadioCheckId ) + ); + nId = aNmTb.Put( "RadioCheck", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, l_nLeftId ) + ); + nId = aNmTb.Put( "Left", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, l_nAutoSizeId ) + ); + nId = aNmTb.Put( "AutoSize", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, l_nDropDownId ) + ); + nId = aNmTb.Put( "DropDown", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + } + nId = aNmTb.Put( "HelpID", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aStringLiteral, NULL, 0, + RSC_TOOLBOXITEM_HELPID ); + nId = aNmTb.Put( "Text", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_TOOLBOXITEM_TEXT ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_TOOLBOXITEM_HELPTEXT ); + nId = aNmTb.Put( "ItemBitmap", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClassBitmap, NULL, 0, + RSC_TOOLBOXITEM_BITMAP ); + nId = aNmTb.Put( "ItemImage", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClassImage, NULL, 0, + RSC_TOOLBOXITEM_IMAGE ); + nId = aNmTb.Put( "Disable", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOXITEM_DISABLE ); + + nId = aNmTb.Put( "State", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pTriState, NULL, 0, + RSC_TOOLBOXITEM_STATE ); + nId = aNmTb.Put( "Hide", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOXITEM_HIDE ); + nId = aNmTb.Put( "Hide", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOXITEM_HIDE ); + nId = aNmTb.Put( "Command", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aString, NULL, 0, + RSC_TOOLBOXITEM_COMMAND ); + + return pClassToolBoxItem; +} + +/************************************************************************* +|* RscTypCont::InitClassToolBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassToolBox( RscTop * pSuper, + RscTop * pClassToolBoxItem, + RscTop * pClassImageList ) +{ + Atom nId; + RscTop * pClassToolBox; + + // Klasse anlegen + nId = pHS->getID( "ToolBox" ); + pClassToolBox = new RscClass( nId, RSC_TOOLBOX, pSuper ); + pClassToolBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassToolBox ); + + // Variablen anlegen + { + RscEnum * pEnum; + + aBaseLst.push_back( pEnum = new RscEnum( pHS->getID( "EnumButtonType" ), RSC_NOTYPE ) ); + SETCONST( pEnum, "BUTTON_SYMBOL", BUTTON_SYMBOL ); + SETCONST( pEnum, "BUTTON_TEXT", BUTTON_TEXT ); + SETCONST( pEnum, "BUTTON_SYMBOLTEXT", BUTTON_SYMBOLTEXT ); + + // Variable einfuegen + nId = aNmTb.Put( "ButtonType", VARNAME ); + pClassToolBox->SetVariable( nId, pEnum, NULL, 0, + RSC_TOOLBOX_BUTTONTYPE ); + } + { + RscEnum * pEnum; + + aBaseLst.push_back( pEnum = new RscEnum( pHS->getID( "EnumToolBoxAlign" ), RSC_NOTYPE ) ); + SETCONST( pEnum, "BOXALIGN_TOP", WINDOWALIGN_TOP ); + SETCONST( pEnum, "BOXALIGN_LEFT", WINDOWALIGN_LEFT ); + SETCONST( pEnum, "BOXALIGN_RIGHT", WINDOWALIGN_RIGHT ); + SETCONST( pEnum, "BOXALIGN_BOTTOM", WINDOWALIGN_BOTTOM ); + + // Variable einfuegen + nId = aNmTb.Put( "Align", VARNAME ); + pClassToolBox->SetVariable( nId, pEnum, NULL, 0, + RSC_TOOLBOX_ALIGN ); + } + nId = aNmTb.Put( "LineCount", VARNAME ); + pClassToolBox->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, + RSC_TOOLBOX_LINECOUNT ); + nId = aNmTb.Put( "FloatingLines", VARNAME ); + pClassToolBox->SetVariable( nId, &aUShort, NULL, 0, + RSC_TOOLBOX_FLOATLINES ); + nId = aNmTb.Put( "Customize", VARNAME ); + pClassToolBox->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOX_CUSTOMIZE ); + nId = aNmTb.Put( "MenuStrings", VARNAME ); + pClassToolBox->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOX_MENUSTRINGS ); + nId = aNmTb.Put( "ItemImageList", VARNAME ); + pClassToolBox->SetVariable( nId, pClassImageList, NULL, 0, + RSC_TOOLBOX_ITEMIMAGELIST ); + { + RscLangArray* pLA; + RscCont * pCont; + + aBaseLst.push_back( pCont = new RscCont( pHS->getID( "ContToolBoxItem" ), RSC_NOTYPE ) ); + pCont->SetTypeClass( pClassToolBoxItem ); + aBaseLst.push_back( + pLA = new RscLangArray( pHS->getID( "LangContToolBoxItem" ) + , RSC_NOTYPE + , pCont + , &aLangType + ) + ); + nId = aNmTb.Put( "ItemList", VARNAME ); + pClassToolBox->SetVariable( nId, pLA, NULL, 0, + RSC_TOOLBOX_ITEMLIST ); + } + INS_WINBIT(pClassToolBox,Scroll) + INS_WINBIT(pClassToolBox,LineSpacing) + INS_WINBIT(pClassToolBox,RectStyle) + INS_WINBIT(pClassToolBox,Tabstop) + + return pClassToolBox; +} + +/************************************************************************* +|* RscTypCont::InitClassStatusBar() +*************************************************************************/ +RscTop * RscTypCont::InitClassStatusBar( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassStatusBar; + + // Klasse anlegen + nId = pHS->getID( "StatusBar" ); + pClassStatusBar = new RscClass( nId, RSC_STATUSBAR, pSuper ); + pClassStatusBar->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassStatusBar ); + + // Variablen anlegen + INS_WINBIT(pClassStatusBar,Left) + INS_WINBIT(pClassStatusBar,Right) + + return pClassStatusBar; +} + +/************************************************************************* +|* RscTypCont::InitClassMoreButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassMoreButton( RscTop * pSuper, RscEnum * pMapUnit ) +{ + Atom nId; + RscTop * pClassMoreButton; + + // Klasse anlegen + nId = pHS->getID( "MoreButton" ); + pClassMoreButton = new RscClass( nId, RSC_MOREBUTTON, pSuper ); + pClassMoreButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassMoreButton ); + + // Variablen anlegen + nId = aNmTb.Put( "State", VARNAME ); + pClassMoreButton->SetVariable( nId, &aBool, NULL, 0, + RSC_MOREBUTTON_STATE ); + nId = aNmTb.Put( "MapUnit", VARNAME ); + pClassMoreButton->SetVariable( nId, pMapUnit, NULL, 0, + RSC_MOREBUTTON_MAPUNIT ); + nId = aNmTb.Put( "Delta", VARNAME ); + pClassMoreButton->SetVariable( nId, &aUShort, NULL, 0, + RSC_MOREBUTTON_DELTA ); + + return pClassMoreButton; +} + +/************************************************************************* +|* RscTypCont::InitClassFloatingWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassFloatingWindow( RscTop * pSuper, + RscEnum * pMapUnit ) +{ + Atom nId; + RscTop * pClassFloatingWindow; + + // Klasse anlegen + nId = pHS->getID( "FloatingWindow" ); + pClassFloatingWindow = new RscClass( nId, RSC_FLOATINGWINDOW, pSuper ); + pClassFloatingWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassFloatingWindow ); + + // Variablen anlegen + nId = aNmTb.Put( "_ZoomInMapMode", VARNAME ); + pClassFloatingWindow->SetVariable( nId, pMapUnit, NULL, 0, + RSC_FLOATINGWINDOW_WHMAPMODE ); + nId = aNmTb.Put( "_ZoomInWidth", VARNAME ); + pClassFloatingWindow->SetVariable( nId, &aShort, NULL, 0, + RSC_FLOATINGWINDOW_WIDTH ); + nId = aNmTb.Put( "_ZoomInHeight", VARNAME ); + pClassFloatingWindow->SetVariable( nId, &aShort, NULL, 0, + RSC_FLOATINGWINDOW_HEIGHT ); + nId = aNmTb.Put( "ZoomIn", VARNAME ); + pClassFloatingWindow->SetVariable( nId, &aBool, NULL, 0, + RSC_FLOATINGWINDOW_ZOOMIN ); + + INS_WINBIT(pClassFloatingWindow,Zoomable) + INS_WINBIT(pClassFloatingWindow,HideWhenDeactivate) + INS_WINBIT(pClassFloatingWindow,EnableResizing) + INS_WINBIT(pClassFloatingWindow,StdPopup) + + return pClassFloatingWindow; +} + +/************************************************************************* +|* RscTypCont::InitClassTabControlItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassTabControlItem( RscTop * pSuper, + RscTop * /*pClassTabPage*/ ) +{ + Atom nId; + RscTop * pClassTabControlItem; + + // Klasse anlegen + nId = pHS->getID( "PageItem" ); + pClassTabControlItem = new RscClass( nId, RSC_TABCONTROLITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassTabControlItem ); + + // Variablen anlegen + nId = aNmTb.Put( "Identifier", VARNAME ); + pClassTabControlItem->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, + RSC_TABCONTROLITEM_ID ); + nId = aNmTb.Put( "Text", VARNAME ); + pClassTabControlItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_TABCONTROLITEM_TEXT ); + nId = aNmTb.Put( "PageResID", VARNAME ); + pClassTabControlItem->SetVariable( nId, &aIdLong, NULL, 0, + RSC_TABCONTROLITEM_PAGERESID ); + + return pClassTabControlItem; +} + +/************************************************************************* +|* RscTypCont::InitClassTabControl() +*************************************************************************/ +RscTop * RscTypCont::InitClassTabControl( RscTop * pSuper, + RscTop * pClassTabControlItem ) +{ + Atom nId; + RscTop * pClassTabControl; + + // Klasse anlegen + nId = pHS->getID( "TabControl" ); + pClassTabControl = new RscClass( nId, RSC_TABCONTROL, pSuper ); + pClassTabControl->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassTabControl ); + + // Variablen anlegen + { + RscCont * pCont; + + aBaseLst.push_back( pCont = new RscCont( pHS->getID( "ContTabControlItem" ), RSC_NOTYPE ) ); + pCont->SetTypeClass( pClassTabControlItem ); + nId = aNmTb.Put( "PageList", VARNAME ); + pClassTabControl->SetVariable( nId, pCont, NULL, 0, + RSC_TABCONTROL_ITEMLIST ); + + INS_WINBIT( pClassTabControl, DropDown ); + } + + return pClassTabControl; +} + +/************************************************************************* +|* RscTypCont::InitClassSfxFamilyStyleItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassSfxStyleFamilyItem( RscTop * pSuper, + RscTop * pClassBitmap, + RscTop * pClassImage, + RscArray * pStrLst ) +{ + Atom nId; + RscTop * pClassSfxFamilyStyleItem; + + // Klasse anlegen + nId = pHS->getID( "SfxStyleFamilyItem" ); + pClassSfxFamilyStyleItem = new RscClass( nId, RSC_SFX_STYLE_FAMILY_ITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassSfxFamilyStyleItem ); + + nId = aNmTb.Put( "FilterList", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, pStrLst, NULL, 0, + RSC_SFX_STYLE_ITEM_LIST ); + nId = aNmTb.Put( "StyleBitmap", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, pClassBitmap, NULL, 0, + RSC_SFX_STYLE_ITEM_BITMAP ); + nId = aNmTb.Put( "Text", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_SFX_STYLE_ITEM_TEXT ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_SFX_STYLE_ITEM_HELPTEXT ); + { + RscEnum * pSfxStyleFamily; + pSfxStyleFamily = new RscEnum( pHS->getID( "StyleFamily" ), + RSC_NOTYPE ); + + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_PARA", SFX_STYLE_FAMILY_PARA ); + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_CHAR", SFX_STYLE_FAMILY_CHAR ); + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_FRAME",SFX_STYLE_FAMILY_FRAME); + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_PAGE", SFX_STYLE_FAMILY_PAGE ); + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_PSEUDO", SFX_STYLE_FAMILY_PSEUDO ); + aBaseLst.push_back( pSfxStyleFamily ); + + nId = aNmTb.Put( "StyleFamily", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, pSfxStyleFamily, NULL, 0, + RSC_SFX_STYLE_ITEM_STYLEFAMILY ); + } + nId = aNmTb.Put( "StyleImage", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, pClassImage, NULL, 0, + RSC_SFX_STYLE_ITEM_IMAGE ); + return pClassSfxFamilyStyleItem; +} + +/************************************************************************* +|* RscTypCont::InitClassSfxTemplateDialogm() +*************************************************************************/ +RscTop * RscTypCont::InitClassSfxTemplateDialog( RscTop * pSuper, + RscTop * pClassFamilyStyleItem ) +{ + Atom nId; + RscTop * pClassSfxTemplateDialog; + + // Klasse anlegen + nId = pHS->getID( "SfxStyleFamilies" ); + pClassSfxTemplateDialog = new RscClass( nId, RSC_SFX_STYLE_FAMILIES, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassSfxTemplateDialog ); + + // Variablen anlegen + { + RscCont * pCont; + + aBaseLst.push_back( + pCont = new RscCont( pHS->getID( "ContFamilyStyleItem" ), RSC_NOTYPE ) + ); + pCont->SetTypeClass( pClassFamilyStyleItem ); + nId = aNmTb.Put( "StyleFamilyList", VARNAME ); + pClassSfxTemplateDialog->SetVariable( nId, pCont ); + } + + return pClassSfxTemplateDialog; +} + +/************************************************************************* +|* RscTypCont::InitClassSfxSlotInfo() +*************************************************************************/ +RscTop * RscTypCont::InitClassSfxSlotInfo( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassSfxSlotInfo; + + // Klasse anlegen + nId = pHS->getID( "SfxSlotInfo" ); + pClassSfxSlotInfo = new RscClass( nId, RSC_SFX_SLOT_INFO, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassSfxSlotInfo ); + + nId = aNmTb.Put( "SlotName", VARNAME ); + pClassSfxSlotInfo->SetVariable( nId, &aLangString, NULL, 0, + RSC_SFX_SLOT_INFO_SLOTNAME ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassSfxSlotInfo->SetVariable( nId, &aLangString, NULL, 0, + RSC_SFX_SLOT_INFO_HELPTEXT ); + return pClassSfxSlotInfo; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx new file mode 100644 index 000000000000..c16c9826dbf7 --- /dev/null +++ b/rsc/source/parser/rscinit.cxx @@ -0,0 +1,934 @@ +/* -*- 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): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> + +#include <tools/rc.h> + +#include <vclrsc.hxx> + +// Programmabhaengige Includes. +#include <rsctree.hxx> +#include <rsctop.hxx> +#include <rscrange.hxx> +#include <rscconst.hxx> +#include <rscflag.hxx> +#include <rscstr.hxx> +#include <rsccont.hxx> +#include <rscmgr.hxx> +#include <rscclass.hxx> +#include <rsckey.hxx> +#include <rscdb.hxx> + +#include "rsclex.hxx" +#include <yyrscyacc.hxx> + +/****************** M a c r o s ******************************************/ +#define INS_WINBIT( pClass, WinBit ) \ + InsWinBit( pClass, #WinBit, n##WinBit##Id ); + +/****************** C O D E **********************************************/ +void NameToVerCtrl( RSCINST & aVersion, RscTop * pClass, + RscTop * pClassString ) +{ + if( pClass ) + { + NameToVerCtrl( aVersion, (RscTop *)pClass->Left(), pClassString ); + { + RSCINST aVI; + RSCINST aStr; + + // Namen in Versionskontrolle einsetzen + aVersion.pClass-> + GetElement( aVersion, RscId( pClass->GetTypId() ), + pClassString, RSCINST(), &aVI ); + aStr = aVI.pClass->GetVariable( aVI, pHS->getID( "TEXT" ), + RSCINST() ); + aStr.pClass->SetString( aStr, pHS->getString( pClass->GetId() ).getStr() ); + } + NameToVerCtrl( aVersion, (RscTop *)pClass->Right(), pClassString ); + } +} + +/************************************************************************* +|* +|* RscTypCont::Init() +|* +*************************************************************************/ +void RscTypCont::Init() +{ + RscEnum * pFieldUnits; + RscEnum * pTimeFieldFormat; + RscEnum * pColor; + RscEnum * pMapUnit; + RscEnum * pKey; + RscEnum * pTriState; + RscEnum * pMessButtons; + RscEnum * pMessDefButton; + RscTupel * pGeometry; + RscArray * pLangGeometry; + RscCont * pStringList; + RscArray * pLangStringList; + RscTupel * pStringTupel; + RscTupel * pStringLongTupel; + RscCont * pStringTupelList; + RscCont * pStringLongTupelList; + RscArray * pLangStringTupelList; + RscArray * pLangStringLongTupelList; + + RscTop * pClassMgr; + RscTop * pClassString; + RscTop * pClassStringArray; + RscTop * pClassBitmap; + RscTop * pClassColor; + RscTop * pClassImage; + RscTop * pClassImageList; + RscTop * pClassWindow; + RscTop * pClassSystemWindow; + RscTop * pClassWorkWindow; + RscTop * pClassDialog; + RscTop * pClassModalDialog; + RscTop * pClassModelessDialog; + RscTop * pClassControl; + RscTop * pClassButton; + RscTop * pClassCheckBox; + RscTop * pClassPushButton; + RscTop * pClassOKButton; + RscTop * pClassCancelButton; + RscTop * pClassHelpButton; + RscTop * pClassRadioButton; + RscTop * pClassImageRadioButton; + RscTop * pClassImageButton; + RscTop * pClassTriStateBox; + RscTop * pClassEdit; + RscTop * pClassMultiLineEdit; + RscTop * pClassScrollBar; + RscTop * pClassListBox; + RscTop * pClassMultiListBox; + RscTop * pClassComboBox; + RscTop * pClassFixedText; + RscTop * pClassFixedBitmap; + RscTop * pClassFixedImage; + RscTop * pClassGroupBox; + RscTop * pClassKeyCode; + RscTop * pLangClassKeyCode; + RscTop * pClassAccelItem; + RscTop * pClassAccel; + RscTop * pClassMenuItem; + RscTop * pClassMenu; + RscTop * pClassMenuButton; + RscTop * pClassMessBox; + RscTop * pClassInfoBox; + RscTop * pClassWarningBox; + RscTop * pClassErrorBox; + RscTop * pClassQueryBox; + RscTop * pClassSplitter; + RscTop * pClassSplitWindow; + RscTop * pClassSpinButton; + RscTop * pClassTime; + RscTop * pClassDate; + RscTop * pClassSpinField; + RscTop * pClassPatternField; + RscTop * pClassNumericField; + RscTop * pClassMetricField; + RscTop * pClassCurrencyField; + RscTop * pClassLongCurrencyField; + RscTop * pClassDateField; + RscTop * pClassTimeField; + RscTop * pClassPatternBox; + RscTop * pClassNumericBox; + RscTop * pClassMetricBox; + RscTop * pClassCurrencyBox; + RscTop * pClassLongCurrencyBox; + RscTop * pClassDateBox; + RscTop * pClassTimeBox; + RscTop * pClassDockingWindow; + RscTop * pClassToolBoxItem; + RscTop * pClassToolBox; + RscTop * pClassStatusBar; + RscTop * pClassMoreButton; + RscTop * pClassFloatingWindow; + RscTop * pClassTabPage; + RscTop * pClassTabDialog; + RscTop * pClassTabControlItem; + RscTop * pClassTabControl; + RscTop * pClassFixedLine; + RscTop * pClassScrollBarBox; + RscTop * pClassSfxStyleFamilyItem; + RscTop * pClassSfxTemplateDialog; + RscTop * pClassSfxSlotInfo; + + Atom nId; + + aNmTb.SetSort( sal_False ); +{ + /********** C O M P I L E R T Y P E N ******************************/ + aNmTb.Put( "LINE", LINE, (long)0 ); + aNmTb.Put( "NOT", NOT, (long)0 ); + aNmTb.Put( "DEFINE", DEFINE, (long)0 ); + aNmTb.Put( "INCLUDE", INCLUDE, (long)0 ); + aNmTb.Put( "DEFAULT", DEFAULT, (long)0 ); + aNmTb.Put( "class", CLASS, (long)0 ); + aNmTb.Put( "extendable", EXTENDABLE, (long)0 ); + aNmTb.Put( "writeifset", WRITEIFSET, (long)0 ); + +/* Werte fuer Aufzaehlungstypen */ + aNmTb.Put( "TRUE", BOOLEAN, (long)sal_True ); + aNmTb.Put( "FALSE", BOOLEAN, (long)sal_False ); + + #if 0 +/* Vordefinierte HilfeId's */ + aNmTb.Put( "HELP_INDEX", NUMBER, OOO_HELP_INDEX ); + aNmTb.Put( "HELP_HELPONHELP", NUMBER, OOO_HELP_HELPONHELP ); + #endif + + aNmTb.Put( "XSCALE", XSCALE , (long)0 ); + aNmTb.Put( "YSCALE", YSCALE , (long)0 ); + aNmTb.Put( "RGB", RGB , (long)0 ); + aNmTb.Put( "POSSIZE", GEOMETRY, (long)0 ); + aNmTb.Put( "POS", POSITION, (long)0 ); + aNmTb.Put( "SIZE", DIMENSION, (long)0 ); + aNmTb.Put( "ZoomInOutputSize", INZOOMOUTPUTSIZE,(long)0 ); + aNmTb.Put( "FloatingPos", FLOATINGPOS, (long)0 ); +} + /********** B A S I S T Y P E N ************************************/ +{ + /********** S H O R T ************************************************/ + aShort.SetRange( -32768, 32767 ); + + /********** U S H O R T **********************************************/ + aUShort.SetRange( 0, 0xFFFF ); + + /********** L O N G **************************************************/ + aLong.SetRange( SAL_MIN_INT32, SAL_MAX_INT32 ); + aEnumLong.SetRange( SAL_MIN_INT32, SAL_MAX_INT32 ); + + /********** I D U S H O R T ******************************************/ + aIdUShort.SetRange( 0, 0xFFFF ); + + /********** I D N O Z E R O U S H O R T ******************************/ + aIdNoZeroUShort.SetRange( 1, 0xFFFF ); + + /********** N O Z E R O S H O R T ************************************/ + aNoZeroShort.SetRange( -32768, 32767 ); + aNoZeroShort.SetOutRange( 0 ); + + /********** R A N G E S H O R T **************************************/ + a1to12Short.SetRange( 1, 12 ); + a0to23Short.SetRange( 0, 23 ); + a1to31Short.SetRange( 1, 31 ); + a0to59Short.SetRange( 0, 59 ); + a0to99Short.SetRange( 0, 99 ); + a0to9999Short.SetRange( 0, 9999 ); + + /********** I D R A N G E ********************************************/ + aIdLong.SetRange( SAL_MIN_INT32, SAL_MAX_INT32 ); +} +{ + /********** W I N B I T S F L A G ************************************/ + // Variablenname fuer WinBits + nWinBitVarId = aNmTb.Put( "_WinBits", VARNAME ); + + // Windows + nBorderId = pHS->getID( "WB_BORDER" ); + aWinBits.SetConstant( nBorderId, sal::static_int_cast<sal_Int32>(WB_BORDER) ); + nHideId = pHS->getID( "WB_HIDE" ); + aWinBits.SetConstant( nHideId, sal::static_int_cast<sal_Int32>(WB_HIDE) ); + nClipChildrenId = pHS->getID( "WB_CLIPCHILDREN" ); + aWinBits.SetConstant( nClipChildrenId, sal::static_int_cast<sal_Int32>(WB_CLIPCHILDREN) ); + nSizeableId = pHS->getID( "WB_SIZEABLE" ); + aWinBits.SetConstant( nSizeableId, sal::static_int_cast<sal_Int32>(WB_SIZEABLE) ); + nMoveableId = pHS->getID( "WB_MOVEABLE" ); + aWinBits.SetConstant( nMoveableId, sal::static_int_cast<sal_Int32>(WB_MOVEABLE) ); + nMinimizeId = pHS->getID( "WB_MINABLE" ); + aWinBits.SetConstant( nMinimizeId, 0 /*WB_MINABLE*/ ); + nMaximizeId = pHS->getID( "WB_MAXABLE" ); + aWinBits.SetConstant( nMaximizeId, 0 /*WB_MAXABLE*/ ); + nCloseableId = pHS->getID( "WB_CLOSEABLE" ); + aWinBits.SetConstant( nCloseableId, sal::static_int_cast<sal_Int32>(WB_CLOSEABLE) ); + nAppId = pHS->getID( "WB_APP" ); + aWinBits.SetConstant( nAppId, sal::static_int_cast<sal_Int32>(WB_APP) ); + nTabstopId = pHS->getID( "WB_TABSTOP" ); + aWinBits.SetConstant( nTabstopId, sal::static_int_cast<sal_Int32>(WB_TABSTOP) ); + nGroupId = pHS->getID( "WB_GROUP" ); + aWinBits.SetConstant( nGroupId, sal::static_int_cast<sal_Int32>(WB_GROUP) ); + nSysmodalId = pHS->getID( "WB_SYSMODAL" ); + aWinBits.SetConstant( nSysmodalId, 0 /*WB_SYSMODAL*/ ); +} +{ + nLeftId = pHS->getID( "WB_LEFT" ); + aWinBits.SetConstant( nLeftId, sal::static_int_cast<sal_Int32>(WB_LEFT) ); + nCenterId = pHS->getID( "WB_CENTER" ); + aWinBits.SetConstant( nCenterId, sal::static_int_cast<sal_Int32>(WB_CENTER) ); + nRightId = pHS->getID( "WB_RIGHT" ); + aWinBits.SetConstant( nRightId, sal::static_int_cast<sal_Int32>(WB_RIGHT) ); + nTopId = pHS->getID( "WB_TOP" ); + aWinBits.SetConstant( nTopId, sal::static_int_cast<sal_Int32>(WB_TOP) ); + nVCenterId = pHS->getID( "WB_VCENTER" ); + aWinBits.SetConstant( nVCenterId, sal::static_int_cast<sal_Int32>(WB_VCENTER) ); + nBottomId = pHS->getID( "WB_BOTTOM" ); + aWinBits.SetConstant( nBottomId, sal::static_int_cast<sal_Int32>(WB_BOTTOM) ); + nHScrollId = pHS->getID( "WB_HSCROLL" ); + aWinBits.SetConstant( nHScrollId, sal::static_int_cast<sal_Int32>(WB_HSCROLL) ); + nVScrollId = pHS->getID( "WB_VSCROLL" ); + aWinBits.SetConstant( nVScrollId, sal::static_int_cast<sal_Int32>(WB_VSCROLL) ); + nSortId = pHS->getID( "WB_SORT" ); + aWinBits.SetConstant( nSortId, sal::static_int_cast<sal_Int32>(WB_SORT) ); + nDefaultId = pHS->getID( "WB_DEFBUTTON" ); + aWinBits.SetConstant( nDefaultId, sal::static_int_cast<sal_Int32>(WB_DEFBUTTON) ); + nRepeatId = pHS->getID( "WB_REPEAT" ); + aWinBits.SetConstant( nRepeatId, sal::static_int_cast<sal_Int32>(WB_REPEAT) ); + nSVLookId = pHS->getID( "WB_SVLOOK" ); + aWinBits.SetConstant( nSVLookId, sal::static_int_cast<sal_Int32>(WB_3DLOOK) ); + nDropDownId = pHS->getID( "WB_DROPDOWN" ); + aWinBits.SetConstant( nDropDownId, sal::static_int_cast<sal_Int32>(WB_DROPDOWN) ); + nPassWordId = pHS->getID( "WB_PASSWORD" ); + aWinBits.SetConstant( nPassWordId, sal::static_int_cast<sal_Int32>(WB_PASSWORD) ); + nReadOnlyId = pHS->getID( "WB_READONLY" ); + aWinBits.SetConstant( nReadOnlyId, sal::static_int_cast<sal_Int32>(WB_READONLY) ); + nAutoSizeId = pHS->getID( "WB_AUTOSIZE" ); + aWinBits.SetConstant( nAutoSizeId, sal::static_int_cast<sal_Int32>(WB_AUTOSIZE) ); + nSpinId = pHS->getID( "WB_SPIN" ); + aWinBits.SetConstant( nSpinId, sal::static_int_cast<sal_Int32>(WB_SPIN) ); + nTabControlId = pHS->getID( "WB_DIALOGCONTROL" ); + aWinBits.SetConstant( nTabControlId, sal::static_int_cast<sal_Int32>(WB_DIALOGCONTROL) ); + nSimpleModeId = pHS->getID( "WB_SIMPLEMODE" ); + aWinBits.SetConstant( nSimpleModeId, sal::static_int_cast<sal_Int32>(WB_SIMPLEMODE) ); + nDragId = pHS->getID( "WB_DRAG" ); + aWinBits.SetConstant( nDragId, sal::static_int_cast<sal_Int32>(WB_DRAG) ); + nScrollId = pHS->getID( "WB_SCROLL" ); + aWinBits.SetConstant( nScrollId, sal::static_int_cast<sal_Int32>(WB_SCROLL) ); + nZoomableId = pHS->getID( "WB_ZOOMABLE" ); + aWinBits.SetConstant( nZoomableId, sal::static_int_cast<sal_Int32>(WB_ROLLABLE) ); + nHideWhenDeactivateId = pHS->getID( "WB_HIDEWHENDEACTIVATE" ); + aWinBits.SetConstant( nHideWhenDeactivateId, 0 /*WB_HIDEWHENDEACTIVATE*/ ); + nAutoHScrollId = pHS->getID( "WB_AUTOHSCROLL" ); + aWinBits.SetConstant( nAutoHScrollId, sal::static_int_cast<sal_Int32>(WB_AUTOHSCROLL) ); + nAutoVScrollId = pHS->getID( "WB_AUTOVSCROLL" ); + aWinBits.SetConstant( nAutoVScrollId, sal::static_int_cast<sal_Int32>(WB_AUTOVSCROLL) ); + nDDExtraWidthId = pHS->getID( "WB_DDEXTRAWIDTH" ); + aWinBits.SetConstant( nDDExtraWidthId, 0 /*WB_DDEXTRAWIDTH*/ ); + nWordBreakId = pHS->getID( "WB_WORDBREAK" ); + aWinBits.SetConstant( nWordBreakId, sal::static_int_cast<sal_Int32>(WB_WORDBREAK) ); + nLeftLabelId = pHS->getID( "WB_LEFTLABEL" ); + aWinBits.SetConstant( nLeftLabelId, 0 /*WB_LEFTLABEL*/ ); + nHasLinesId = pHS->getID( "WB_HASLINES" ); + aWinBits.SetConstant( nHasLinesId, sal::static_int_cast<sal_Int32>(WB_HASLINES) ); + nHasButtonsId = pHS->getID( "WB_HASBUTTONS" ); + aWinBits.SetConstant( nHasButtonsId, sal::static_int_cast<sal_Int32>(WB_HASBUTTONS) ); + nRectStyleId = pHS->getID( "WB_RECTSTYLE" ); + aWinBits.SetConstant( nRectStyleId, sal::static_int_cast<sal_Int32>(WB_RECTSTYLE) ); + nLineSpacingId = pHS->getID( "WB_LINESPACING" ); + aWinBits.SetConstant( nLineSpacingId, sal::static_int_cast<sal_Int32>(WB_LINESPACING) ); + nSmallStyleId = pHS->getID( "WB_SMALLSTYLE" ); + aWinBits.SetConstant( nSmallStyleId, sal::static_int_cast<sal_Int32>(WB_SMALLSTYLE) ); + nEnableResizingId = pHS->getID( "WB_ENABLERESIZING" ); + aWinBits.SetConstant( nEnableResizingId, 0 /*WB_ENABLERESIZING*/ ); + nDockableId = pHS->getID( "WB_DOCKABLE" ); + aWinBits.SetConstant( nDockableId, sal::static_int_cast<sal_Int32>(WB_DOCKABLE) ); + nScaleId = pHS->getID( "WB_SCALE" ); + aWinBits.SetConstant( nScaleId, sal::static_int_cast<sal_Int32>(WB_SCALE) ); + nIgnoreTabId = pHS->getID( "WB_IGNORETAB" ); + aWinBits.SetConstant( nIgnoreTabId, sal::static_int_cast<sal_Int32>(WB_IGNORETAB) ); + nNoSplitDrawId = pHS->getID( "WB_NOSPLITDRAW" ); + aWinBits.SetConstant( nNoSplitDrawId, sal::static_int_cast<sal_Int32>(WB_NOSPLITDRAW) ); + nTopImageId = pHS->getID( "WB_TOPIMAGE" ); + aWinBits.SetConstant( nTopImageId, sal::static_int_cast<sal_Int32>(WB_TOPIMAGE) ); + nNoLabelId = pHS->getID( "WB_NOLABEL" ); + aWinBits.SetConstant( nNoLabelId, sal::static_int_cast<sal_Int32>(WB_NOLABEL) ); + nVertId = pHS->getID( "WB_VERT" ); + aWinBits.SetConstant( nVertId, sal::static_int_cast<sal_Int32>(WB_VERT) ); + nSysWinId = pHS->getID( "WB_SYSTEMWINDOW" ); + aWinBits.SetConstant( nSysWinId, sal::static_int_cast<sal_Int32>(WB_SYSTEMWINDOW) ); + nStdPopupId = pHS->getID( "WB_STDPOPUP" ); + aWinBits.SetConstant( nStdPopupId, sal::static_int_cast<sal_Int32>(WB_STDPOPUP) ); +} +{ + /********** I n i t B a s i c T y p e s **************************/ + InitLangType(); + aBaseLst.push_back( pFieldUnits = InitFieldUnitsType() ); + aBaseLst.push_back( pTimeFieldFormat = InitTimeFieldFormat() ); + aBaseLst.push_back( pColor = InitColor() ); + aBaseLst.push_back( pMapUnit = InitMapUnit() ); + aBaseLst.push_back( pKey = InitKey() ); + aBaseLst.push_back( pTriState = InitTriState() ); + aBaseLst.push_back( pMessButtons = InitMessButtons() ); + aBaseLst.push_back( pMessDefButton = InitMessDefButton() ); + + aBaseLst.push_back( pGeometry = InitGeometry() ); + aBaseLst.push_back( pLangGeometry = InitLangGeometry( pGeometry ) ); + aBaseLst.push_back( pStringList = InitStringList() ); + aBaseLst.push_back( pLangStringList = InitLangStringList( pStringList ) ); + aBaseLst.push_back( pStringTupel = InitStringTupel() ); + aBaseLst.push_back( pStringTupelList = InitStringTupelList( pStringTupel ) ); + aBaseLst.push_back( pLangStringTupelList = InitLangStringTupelList( pStringTupelList ) ); + aBaseLst.push_back( pStringLongTupel = InitStringLongTupel() ); + aBaseLst.push_back( pStringLongTupelList = InitStringLongTupelList( pStringLongTupel ) ); + aBaseLst.push_back( pLangStringLongTupelList = InitLangStringLongTupelList( pStringLongTupelList ) ); +} +{ + /********** R E S O U R C E T Y P E N ******************************/ + /********** R S C M G R **********************************************/ + pRoot = pClassMgr = InitClassMgr(); + + /********** V e r s i o n s k o n t r o l l e ************************/ + aVersion.pClass = new RscClass( pHS->getID( "VersionControl" ), + RSC_VERSIONCONTROL, pClassMgr ); + aVersion = aVersion.pClass->Create( NULL, RSCINST() ); + + /********** S T R I N G **********************************************/ + pClassString = InitClassString( pClassMgr ); + pRoot->Insert( pClassString ); + + // String als Referenzklasse des Basisstrings einsetzen + aString.SetRefClass( pClassString ); + + /********** S T R I N G L I S T **************************************/ + // Klasse anlegen + nId = pHS->getID( "StringArray" ); + pClassStringArray = new RscClass( nId, RSC_STRINGARRAY, pClassMgr ); + pClassStringArray->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassStringArray ); + pRoot->Insert( pClassStringArray ); + + // Variablen anlegen + nId = aNmTb.Put( "ItemList", VARNAME ); + pClassStringArray->SetVariable( nId, pLangStringLongTupelList ); + + /********** B I T M A P **********************************************/ + pClassBitmap = InitClassBitmap( pClassMgr ); + pRoot->Insert( pClassBitmap ); + +} +{ + /********** C O L O R ************************************************/ + pClassColor = InitClassColor( pClassMgr, pColor ); + pRoot->Insert( pClassColor ); + + /********** I M A G E ************************************************/ + pClassImage = InitClassImage( pClassMgr, pClassBitmap, pClassColor ); + pRoot->Insert( pClassImage ); + + /********** I M A G E L I S T ****************************************/ + pClassImageList = InitClassImageList( pClassMgr, pClassBitmap, + pClassColor, pStringLongTupelList ); + pRoot->Insert( pClassImageList ); + + /********** W I N D O W **********************************************/ + pClassWindow = InitClassWindow( pClassMgr, pMapUnit, + pLangGeometry ); + pRoot->Insert( pClassWindow ); +} +{ + + /********** S Y S T E M W I N D O W **********************************/ + pClassSystemWindow = InitClassSystemWindow( pClassWindow ); + //aBaseLst.Insert( pClassSystemWindow, LIST_APPEND ); + pRoot->Insert( pClassSystemWindow ); + + /********** W O R K W I N D O W **************************************/ + pClassWorkWindow = InitClassWorkWindow( pClassSystemWindow ); + pRoot->Insert( pClassWorkWindow ); + + /********** D I A L O G **********************************************/ + // Klasse anlegen + pClassDialog = new RscClass( pHS->getID( "Dialog" ), + RSC_DIALOG, pClassSystemWindow ); + pClassDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aBaseLst.push_back( pClassDialog ); + + /********** M O D A L D I A L O G ***********************************/ + // Klasse anlegen + pClassModalDialog = InitClassModalDialog( pClassDialog ); + pRoot->Insert( pClassModalDialog ); + + /********** M O D E L E S S D I A L O G ******************************/ + // Klasse anlegen + pClassModelessDialog = InitClassModelessDialog( pClassDialog ); + pRoot->Insert( pClassModelessDialog ); +} +{ + /********** C O N T R O L ********************************************/ + pClassControl = InitClassControl( pClassWindow ); + pRoot->Insert( pClassControl ); + + /********** B U T T O N **********************************************/ + // Klasse anlegen + nId = pHS->getID( "Button" ); + pClassButton = new RscClass( nId, RSC_BUTTON, pClassControl ); + pClassButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassButton ); + pRoot->Insert( pClassButton ); + + /********** C H E C K B O X ******************************************/ + pClassCheckBox = InitClassCheckBox( pClassButton ); + pRoot->Insert( pClassCheckBox ); + + /********** P U S H B U T T O N **************************************/ + // Klasse anlegen + pClassPushButton = InitClassPushButton( pClassButton ); + pRoot->Insert( pClassPushButton ); + + /********** H E L P B U T T O N **************************************/ + // Klasse anlegen + nId = pHS->getID( "HelpButton" ); + pClassHelpButton = new RscClass( nId, RSC_HELPBUTTON, + pClassPushButton ); + pClassHelpButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassHelpButton ); + pRoot->Insert( pClassHelpButton ); + + /********** O K B U T T O N ******************************************/ + // Klasse anlegen + nId = pHS->getID( "OKButton" ); + pClassOKButton = new RscClass( nId, RSC_OKBUTTON, + pClassPushButton ); + pClassOKButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassOKButton ); + pRoot->Insert( pClassOKButton ); + + /********** C A N C E L B U T T O N **********************************/ + // Klasse anlegen + nId = pHS->getID( "CancelButton" ); + pClassCancelButton = new RscClass( nId, RSC_CANCELBUTTON, + pClassPushButton ); + pClassCancelButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassCancelButton ); + pRoot->Insert( pClassCancelButton ); +} +{ + /********** R A D I O B U T T O N ************************************/ + pClassRadioButton = InitClassRadioButton( pClassButton ); + pRoot->Insert( pClassRadioButton ); + + /********** I m a g e R a d i o B u t t o n **************************/ + nId = pHS->getID( "ImageRadioButton" ); + pClassImageRadioButton = InitClassImageRadioButton( pClassRadioButton, + pClassImage ); + pRoot->Insert( pClassImageRadioButton ); + + /********** T R I S T A T E B O X ************************************/ + pClassTriStateBox = InitClassTriStateBox( pClassControl, pTriState ); + pRoot->Insert( pClassTriStateBox ); + + /********** I M A G E B U T T O N ************************************/ + pClassImageButton = InitClassImageButton( pClassPushButton, + pClassImage, pTriState ); + pRoot->Insert( pClassImageButton ); + + /********** E D I T **************************************************/ + pClassEdit = InitClassEdit( pClassControl ); + pRoot->Insert( pClassEdit ); + + /********** M U L T I L I N E E D I T ********************************/ + pClassMultiLineEdit = InitClassMultiLineEdit( pClassEdit ); + pRoot->Insert( pClassMultiLineEdit ); + + /********** S C R O L L B A R ****************************************/ + pClassScrollBar = InitClassScrollBar( pClassControl ); + pRoot->Insert( pClassScrollBar ); + +} +{ + /********** L I S T B O X ********************************************/ + pClassListBox = InitClassListBox( pClassControl, pLangStringLongTupelList ); + pRoot->Insert( pClassListBox ); + + /********** M U L T I L I S T B O X **********************************/ + pClassMultiListBox = InitClassMultiListBox( pClassListBox); + pRoot->Insert( pClassMultiListBox ); + + /********** C O M B O B O X ******************************************/ + pClassComboBox = InitClassComboBox( pClassEdit, pLangStringList ); + pRoot->Insert( pClassComboBox ); + + /********** F I X E D T E X T ****************************************/ + pClassFixedText = InitClassFixedText( pClassControl ); + pRoot->Insert( pClassFixedText ); + + /********** F i x e d B i t m a p ************************************/ + pClassFixedBitmap = InitClassFixedBitmap( pClassControl, pClassBitmap ); + pRoot->Insert( pClassFixedBitmap ); + + /********** F i x e d I m a g e **************************************/ + pClassFixedImage = InitClassFixedImage( pClassControl, pClassImage ); + pRoot->Insert( pClassFixedImage ); + + /********** G R O U P B O X ******************************************/ + // Klasse anlegen + nId = pHS->getID( "GroupBox" ); + pClassGroupBox = new RscClass( nId, RSC_GROUPBOX, pClassControl ); + pClassGroupBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassGroupBox ); + pRoot->Insert( pClassGroupBox ); + + /********** K E Y C O D E ********************************************/ + pClassKeyCode = InitClassKeyCode( pClassMgr, pKey ); + pRoot->Insert( pClassKeyCode ); + { + pLangClassKeyCode = new RscClassArray( pHS->getID( "LangKeyCode" ), + RSC_KEYCODE, pClassKeyCode, &aLangType ); + aBaseLst.push_back( pLangClassKeyCode ); + } + + /********** A C C E L I T E M ***************************************/ + pClassAccelItem = InitClassAccelItem( pClassMgr, pLangClassKeyCode ); + pRoot->Insert( pClassAccelItem ); +} +{ + /********** A C C E L E R A T O R ************************************/ + pClassAccel = InitClassAccel( pClassMgr, pClassAccelItem ); + pRoot->Insert( pClassAccel ); + nAcceleratorType = pClassAccel->GetId(); + + /********** A C C E L I T E M ***************************************/ + // pClassAccel ist erst hier definiert + nId = aNmTb.Put( "SubAccelerator", VARNAME ); + pClassAccelItem->SetVariable( nId, pClassAccel, NULL, VAR_SVDYNAMIC, + ACCELITEM_ACCEL ); + + /********** M E N U I T E M ******************************************/ + pClassMenuItem = InitClassMenuItem( pClassMgr, pClassBitmap, + pLangClassKeyCode ); + pRoot->Insert( pClassMenuItem ); + + /********** M E N U **************************************************/ + pClassMenu = InitClassMenu( pClassMgr, pClassMenuItem ); + pRoot->Insert( pClassMenu ); + + /********** M E N U I T E M ******************************************/ + // pClassMenu ist erst hier definiert + nId = aNmTb.Put( "SubMenu", VARNAME ); + pClassMenuItem->SetVariable( nId, pClassMenu, NULL, VAR_SVDYNAMIC, + RSC_MENUITEM_MENU ); + + /********** M E N U B U T T O N **************************************/ + pClassMenuButton = InitClassMenuButton( pClassControl, pClassMenu ); + pRoot->Insert( pClassMenuButton ); + + /********** M E S S A G E B O X **************************************/ + pClassMessBox = InitClassMessBox( pClassMgr, pMessButtons, + pMessDefButton ); + pRoot->Insert( pClassMessBox ); + + /********** I N F O B O X ********************************************/ + // Klasse anlegen + nId = pHS->getID( "InfoBox" ); + pClassInfoBox = new RscClass( nId, RSC_INFOBOX, pClassMessBox ); + pClassInfoBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassInfoBox ); + pRoot->Insert( pClassInfoBox ); + + /********** W A R N I N G B O X **************************************/ + // Klasse anlegen + nId = pHS->getID( "WarningBox" ); + pClassWarningBox = new RscClass( nId, RSC_WARNINGBOX, pClassMessBox ); + pClassWarningBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassWarningBox ); + pRoot->Insert( pClassWarningBox ); + + /********** E R R O R B O X ******************************************/ + // Klasse anlegen + nId = pHS->getID( "ErrorBox" ); + pClassErrorBox = new RscClass( nId, RSC_ERRORBOX, pClassMessBox ); + pClassErrorBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassErrorBox ); + pRoot->Insert( pClassErrorBox ); + + /********** Q U E R Y B O X ******************************************/ + // Klasse anlegen + nId = pHS->getID( "QueryBox" ); + pClassQueryBox = new RscClass( nId, RSC_QUERYBOX, pClassMessBox ); + pClassQueryBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassQueryBox ); + pRoot->Insert( pClassQueryBox ); +} +{ + /********** S P L I T T E R ******************************************/ + pClassSplitter = InitClassSplitter( pClassWindow ); + pRoot->Insert( pClassSplitter ); + + /********** S P L I T W I N D O W ************************************/ + pClassSplitWindow = InitClassSplitWindow( pClassWindow ); + pRoot->Insert( pClassSplitWindow ); + + /********** S P I N B U T T O N **************************************/ + // Klasse anlegen + nId = pHS->getID( "SpinButton" ); + pClassSpinButton = new RscClass( nId, RSC_SPINBUTTON, pClassControl ); + pClassSpinButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassSpinButton ); + { + RscClient * pClient; + + // Clientvariablen einfuegen + // Sysmodal + aBaseLst.push_back( + pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, &aWinBits, nRepeatId ) + ); + nId = aNmTb.Put( "Repeat", VARNAME ); + pClassSpinButton->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nWinBitVarId ); + } + pRoot->Insert( pClassSpinButton ); +} +{ + /********** T I M E **************************************************/ + pClassTime = InitClassTime( pClassMgr ); + pRoot->Insert( pClassTime ); + + /********** D A T E **************************************************/ + pClassDate = InitClassDate( pClassMgr ); + pRoot->Insert( pClassDate ); +} +{ + /********** S P I N F I E L D ****************************************/ + pClassSpinField = InitClassSpinField( pClassEdit ); + pRoot->Insert( pClassSpinField ); +} +{ + /********** P A T T E R N F I E L D **********************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassPatternFormatter( pClassSpinField ); + aBaseLst.push_back( pClassTmp ); + + pClassPatternField = InitClassPatternField( pClassTmp ); + pRoot->Insert( pClassPatternField ); + } + /********** N U M E R I C F I E L D **********************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassSpinField ); + aBaseLst.push_back( pClassTmp ); + + pClassNumericField = InitClassNumericField( pClassTmp ); + pRoot->Insert( pClassNumericField ); + } + /********** M E T R I C F I E L D ************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassSpinField ); + aBaseLst.push_back( pClassTmp ); + pClassTmp = InitClassMetricFormatter( pClassTmp, pFieldUnits ); + aBaseLst.push_back( pClassTmp ); + + pClassMetricField = InitClassMetricField( pClassTmp ); + pRoot->Insert( pClassMetricField ); + } + /********** C U R R E N C Y F I E L D ********************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassSpinField ); + aBaseLst.push_back( pClassTmp ); + pClassTmp = InitClassCurrencyFormatter( pClassTmp, pFieldUnits ); + aBaseLst.push_back( pClassTmp ); + + pClassCurrencyField = InitClassCurrencyField( "CurrencyField", RSC_CURRENCYFIELD, pClassTmp ); + pRoot->Insert( pClassCurrencyField ); + + pClassLongCurrencyField = InitClassCurrencyField( "LongCurrencyField", RSC_LONGCURRENCYFIELD, pClassTmp ); + pRoot->Insert( pClassLongCurrencyField ); + + } + /********** D A T E F I E L D ****************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassDateFormatter( pClassSpinField, pClassDate ); + aBaseLst.push_back( pClassTmp ); + + pClassDateField = InitClassDateField( pClassTmp, pClassDate ); + pRoot->Insert( pClassDateField ); + } + /********** T I M E F I E L D ****************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassTimeFormatter( pClassSpinField, pClassTime, + pTimeFieldFormat ); + aBaseLst.push_back( pClassTmp ); + + pClassTimeField = InitClassTimeField( pClassTmp, pClassTime ); + pRoot->Insert( pClassTimeField ); + } + /********** P A T T E R N B O X **************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassPatternFormatter( pClassComboBox ); + aBaseLst.push_back( pClassTmp ); + + pClassPatternBox = InitClassPatternBox( pClassTmp ); + pRoot->Insert( pClassPatternBox ); + } + /********** N U M E R I C B O X **************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassComboBox ); + aBaseLst.push_back( pClassTmp ); + + pClassNumericBox = InitClassNumericBox( pClassTmp ); + pRoot->Insert( pClassNumericBox ); + } +} +{ + /********** M E T R I C B O X ****************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassComboBox ); + aBaseLst.push_back( pClassTmp ); + pClassTmp = InitClassMetricFormatter( pClassTmp, pFieldUnits ); + aBaseLst.push_back( pClassTmp ); + + pClassMetricBox = InitClassMetricBox( pClassTmp ); + pRoot->Insert( pClassMetricBox ); + } + /********** C U R R E N C Y B O X ************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassComboBox ); + aBaseLst.push_back( pClassTmp ); + pClassTmp = InitClassCurrencyFormatter( pClassTmp, pFieldUnits ); + aBaseLst.push_back( pClassTmp ); + + pClassCurrencyBox = InitClassCurrencyBox( "CurrencyBox", RSC_CURRENCYBOX, pClassTmp ); + pRoot->Insert( pClassCurrencyBox ); + + pClassLongCurrencyBox = InitClassCurrencyBox( "LongCurrencyBox", RSC_LONGCURRENCYBOX, pClassTmp ); + pRoot->Insert( pClassLongCurrencyBox ); + } + /********** D A T E B O X ********************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassDateFormatter( pClassComboBox, pClassDate ); + aBaseLst.push_back( pClassTmp ); + + pClassDateBox = InitClassDateBox( pClassTmp, pClassDate ); + pRoot->Insert( pClassDateBox ); + } + /********** T I M E B O X ********************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassTimeFormatter( pClassComboBox, pClassTime, + pTimeFieldFormat ); + aBaseLst.push_back( pClassTmp ); + + pClassTimeBox = InitClassTimeBox( pClassTmp, pClassTime ); + pRoot->Insert( pClassTimeBox ); + } + /********** D O C K I N G W I N D O W ********************************/ + pClassDockingWindow = InitClassDockingWindow( pClassWindow, pMapUnit ); + pRoot->Insert( pClassDockingWindow ); + + /********** T O O L B O X I T E M ************************************/ + pClassToolBoxItem = InitClassToolBoxItem( pClassMgr, pClassBitmap, + pClassImage, pTriState ); + pRoot->Insert( pClassToolBoxItem ); + + /********** T O O L B O X ********************************************/ + pClassToolBox = InitClassToolBox( pClassDockingWindow, pClassToolBoxItem, + pClassImageList ); + pRoot->Insert( pClassToolBox ); + + /********** S T A T U S B A R ****************************************/ + pClassStatusBar = InitClassStatusBar( pClassWindow ); + pRoot->Insert( pClassStatusBar ); + + /********** M O R E B U T T O N **************************************/ + pClassMoreButton = InitClassMoreButton( pClassPushButton, pMapUnit ); + pRoot->Insert( pClassMoreButton ); + + /********** F L O A T W I N D O W ************************************/ + pClassFloatingWindow = InitClassFloatingWindow( pClassSystemWindow, + pMapUnit ); + pRoot->Insert( pClassFloatingWindow ); + + /********** T A B P A G E ********************************************/ + // Klasse anlegen + nId = pHS->getID( "TabPage" ); + pClassTabPage = + new RscClass( nId, RSC_TABPAGE, pClassWindow ); + pClassTabPage->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassTabPage ); + pRoot->Insert( pClassTabPage ); + + /********** T A B D I A L O G ****************************************/ + // Klasse anlegen + nId = pHS->getID( "TabDialog" ); + pClassTabDialog = + new RscClass( nId, RSC_TABDIALOG, pClassModalDialog ); + pClassTabDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassTabDialog ); + pRoot->Insert( pClassTabDialog ); + + /********** T A B C O N T R O L I T E M *******************************/ + pClassTabControlItem = InitClassTabControlItem( pClassMgr, + pClassTabPage ); + pRoot->Insert( pClassTabControlItem ); + + /********** T A B C O N T R O L **************************************/ + pClassTabControl = InitClassTabControl( pClassControl, + pClassTabControlItem ); + pRoot->Insert( pClassTabControl ); + + /********** F I X E D L I N E ****************************************/ + // Klasse anlegen + nId = pHS->getID( "FixedLine" ); + pClassFixedLine = + new RscClass( nId, RSC_FIXEDLINE, pClassControl ); + pClassFixedLine->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + INS_WINBIT(pClassFixedLine,Vert) + + aNmTb.Put( nId, CLASSNAME, pClassFixedLine ); + pRoot->Insert( pClassFixedLine ); + + /********** S C R O L L B A R B O X **********************************/ + // Klasse anlegen + nId = pHS->getID( "ScrollBarBox" ); + pClassScrollBarBox = + new RscClass( nId, RSC_SCROLLBARBOX, pClassWindow ); + pClassScrollBarBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassScrollBarBox ); + pRoot->Insert( pClassScrollBarBox ); + INS_WINBIT(pClassScrollBarBox,Sizeable) + + /********** S F X S T Y L E F A M I L Y I T E M **********************/ + pClassSfxStyleFamilyItem = InitClassSfxStyleFamilyItem( pClassMgr, + pClassBitmap, + pClassImage, + pLangStringLongTupelList ); + pRoot->Insert( pClassSfxStyleFamilyItem ); + + /********** S F X T E M P L A T E D I A L O G ************************/ + pClassSfxTemplateDialog = InitClassSfxTemplateDialog( pClassMgr, + pClassSfxStyleFamilyItem ); + pRoot->Insert( pClassSfxTemplateDialog ); + + /********** S F X I N F O I T E M ************************************/ + pClassSfxSlotInfo = InitClassSfxSlotInfo( pClassMgr ); + pRoot->Insert( pClassSfxSlotInfo ); +} + NameToVerCtrl( aVersion, pRoot, pClassString ); + + aNmTb.SetSort(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rsckey.cxx b/rsc/source/parser/rsckey.cxx new file mode 100644 index 000000000000..e6e1559a4130 --- /dev/null +++ b/rsc/source/parser/rsckey.cxx @@ -0,0 +1,192 @@ +/* -*- 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): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ +#include <stdlib.h> +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <rscall.h> +#include <rsctools.hxx> +#include <rschash.hxx> +#include <rsckey.hxx> + +#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) +#define _cdecl __cdecl +#endif + +/****************** C o d e **********************************************/ +/****************** keyword sort function ********************************/ +extern "C" { +#if defined( WNT ) && !defined (ICC) + int _cdecl KeyCompare( const void * pFirst, const void * pSecond ); +#else + int KeyCompare( const void * pFirst, const void * pSecond ); +#endif +} + +#if defined( WNT ) && !defined(ICC) +int _cdecl KeyCompare( const void * pFirst, const void * pSecond ){ +#else +int KeyCompare( const void * pFirst, const void * pSecond ){ +#endif + if( ((KEY_STRUCT *)pFirst)->nName > ((KEY_STRUCT *)pSecond)->nName ) + return( 1 ); + else if( ((KEY_STRUCT *)pFirst)->nName < ((KEY_STRUCT *)pSecond)->nName ) + return( -1 ); + else + return( 0 ); +} + +/************************************************************************* +|* +|* RscNameTable::RscNameTable() +|* +*************************************************************************/ +RscNameTable::RscNameTable() { + bSort = sal_True; + nEntries = 0; + pTable = NULL; +}; + +/************************************************************************* +|* +|* RscNameTable::~RscNameTable() +|* +*************************************************************************/ +RscNameTable::~RscNameTable() { + if( pTable ) + rtl_freeMemory( pTable ); +}; + + +/************************************************************************* +|* +|* RscNameTable::SetSort() +|* +*************************************************************************/ +void RscNameTable::SetSort( sal_Bool bSorted ){ + bSort = bSorted; + if( bSort && pTable){ + // Schluesselwort Feld sortieren + qsort( (void *)pTable, nEntries, + sizeof( KEY_STRUCT ), KeyCompare ); + }; +}; + +/************************************************************************* +|* +|* RscNameTable::Put() +|* +*************************************************************************/ +Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, long nValue ){ + if( pTable ) + pTable = (KEY_STRUCT *) + rtl_reallocateMemory( (void *)pTable, + ((nEntries +1) * sizeof( KEY_STRUCT )) ); + else + pTable = (KEY_STRUCT *) + rtl_allocateMemory( ((nEntries +1) + * sizeof( KEY_STRUCT )) ); + pTable[ nEntries ].nName = nName; + pTable[ nEntries ].nTyp = nTyp; + pTable[ nEntries ].yylval = nValue; + nEntries++; + if( bSort ) + SetSort(); + return( nName ); +}; + +Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, long nValue ) +{ + return( Put( pHS->getID( pName ), nTyp, nValue ) ); +}; + +Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp ) +{ + return( Put( nName, nTyp, (long)nName ) ); +}; + +Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp ) +{ + Atom nId; + + nId = pHS->getID( pName ); + return( Put( nId, nTyp, (long)nId ) ); +}; + +Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ) +{ + return( Put( nName, nTyp, (long)pClass ) ); +}; + +Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, RscTop * pClass ) +{ + return( Put( pHS->getID( pName ), nTyp, (long)pClass ) ); +}; + +/************************************************************************* +|* +|* RscNameTable::Get() +|* +*************************************************************************/ +sal_Bool RscNameTable::Get( Atom nName, KEY_STRUCT * pEle ){ + KEY_STRUCT * pKey = NULL; + KEY_STRUCT aSearchName; + sal_uInt32 i; + + if( bSort ){ + // Suche nach dem Schluesselwort + aSearchName.nName = nName; + pKey = (KEY_STRUCT *)bsearch( +#ifdef UNX + (const char *) &aSearchName, (char *)pTable, +#else + (const void *) &aSearchName, (const void *)pTable, +#endif + nEntries, sizeof( KEY_STRUCT ), KeyCompare ); + } + else{ + i = 0; + while( i < nEntries && !pKey ){ + if( pTable[ i ].nName == nName ) + pKey = &pTable[ i ]; + i++; + }; + }; + + if( pKey ){ // Schluesselwort gefunden + *pEle = *pKey; + return( sal_True ); + }; + return( sal_False ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx new file mode 100644 index 000000000000..0f59c7ab4cdf --- /dev/null +++ b/rsc/source/parser/rsclex.cxx @@ -0,0 +1,451 @@ +/* -*- 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): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <limits.h> + +#ifdef _RSCERROR_H +#include <rscerror.h> +#endif +#include <rschash.hxx> +#include <rscdb.hxx> +#include <rsctop.hxx> +#include <rsckey.hxx> +#include <rscpar.hxx> +#include <rscdef.hxx> + +#include "rsclex.hxx" +#include <yyrscyacc.hxx> + +#include <rtl/textcvt.h> +#include <rtl/textenc.h> +#include <tools/list.hxx> + +using ::rtl::OString; +using ::rtl::OStringBuffer; +using ::rtl::OStringHash; + +const char* StringContainer::putString( const char* pString ) +{ + OString aString( static_cast<const sal_Char*>(pString) ); + std::pair< + boost::unordered_set< OString, OStringHash >::iterator, + bool > aInsert = + m_aStrings.insert( aString ); + + return aInsert.first->getStr(); +} + +/*************************************************************************/ +int c; +sal_Bool bLastInclude;// War letztes Symbol INCLUDE +RscFileInst* pFI; +RscTypCont* pTC; +RscExpression * pExp; +struct KeyVal { + int nKeyWord; + YYSTYPE aYYSType; +} aKeyVal[ 1 ]; +sal_Bool bTargetDefined; + +StringContainer* pStringContainer = NULL; + + +/****************** C O D E **********************************************/ +sal_uInt32 GetNumber(){ + sal_uInt32 l = 0; + sal_uInt32 nLog = 10; + + if( '0' == c ){ + c = pFI->GetFastChar(); + if( 'x' == c ){ + nLog = 16; + c = pFI->GetFastChar(); + } + }; + + if( nLog == 16 ){ + while( isxdigit( c ) ){ + if( isdigit( c ) ) + l = l * nLog + (c - '0'); + else + l = l * nLog + (toupper( c ) - 'A' + 10 ); + c = pFI->GetFastChar(); + } + } + else{ + while( isdigit( c ) || 'x' == c ){ + l = l * nLog + (c - '0'); + c = pFI->GetFastChar(); + } + } + + while( c=='U' || c=='u' || c=='l' || c=='L' ) //Wg. Unsigned Longs + c = pFI->GetFastChar(); + + if( l > 0x7fffffff ) //Oberstes bit gegebenenfalls abschneiden; + l &= 0x7fffffff; + + return( l ); +} + +int MakeToken( YYSTYPE * pTokenVal ){ + int c1; + + while( sal_True ){ // Kommentare und Leerzeichen ueberlesen + while( isspace( c ) ) + c = pFI->GetFastChar(); + if( '/' == c ){ + c1 = c; + c = pFI->GetFastChar(); + if( '/' == c ){ + while( '\n' != c && !pFI->IsEof() ) + c = pFI->GetFastChar(); + c = pFI->GetFastChar(); + } + else if( '*' == c ){ + c = pFI->GetFastChar(); + do { + while( '*' != c && !pFI->IsEof() ) + c = pFI->GetFastChar(); + c = pFI->GetFastChar(); + } while( '/' != c && !pFI->IsEof() ); + c = pFI->GetFastChar(); + } + else + return( c1 ); + } + else + break; + }; + + if( c == pFI->IsEof() ){ + return( 0 ); + } + + if( bLastInclude ){ + bLastInclude = sal_False; //Zuruecksetzten + if( '<' == c ){ + OStringBuffer aBuf( 256 ); + c = pFI->GetFastChar(); + while( '>' != c && !pFI->IsEof() ) + { + aBuf.append( sal_Char(c) ); + c = pFI->GetFastChar(); + }; + c = pFI->GetFastChar(); + pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); + return( INCLUDE_STRING ); + }; + } + + if( c == '"' ) + { + OStringBuffer aBuf( 256 ); + sal_Bool bDone = sal_False; + while( !bDone && !pFI->IsEof() && c ) + { + c = pFI->GetFastChar(); + if( c == '"' ) + { + do + { + c = pFI->GetFastChar(); + } + while( c == ' ' || c == '\t' ); + if( c == '"' ) + { + // this is a continued string + // note: multiline string continuations are handled by the parser + // see rscyacc.y + } + else + bDone = sal_True; + } + else if( c == '\\' ) + { + aBuf.append( '\\' ); + c = pFI->GetFastChar(); + if( c ) + aBuf.append( sal_Char(c) ); + } + else + aBuf.append( sal_Char(c) ); + } + pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); + return( STRING ); + } + if (isdigit (c)){ + pTokenVal->value = GetNumber(); + return( NUMBER ); + } + + if( isalpha (c) || (c == '_') ){ + Atom nHashId; + OStringBuffer aBuf( 256 ); + + while( isalnum (c) || (c == '_') || (c == '-') ) + { + aBuf.append( sal_Char(c) ); + c = pFI->GetFastChar(); + } + + nHashId = pHS->getID( aBuf.getStr(), true ); + if( InvalidAtom != nHashId ) + { + KEY_STRUCT aKey; + + // Suche nach dem Schluesselwort + if( pTC->aNmTb.Get( nHashId, &aKey ) ) + { + + // Schluesselwort gefunden + switch( aKey.nTyp ) + { + case CLASSNAME: + pTokenVal->pClass = (RscTop *)aKey.yylval; + break; + case VARNAME: + pTokenVal->varid = aKey.nName; + break; + case CONSTNAME: + pTokenVal->constname.hashid = aKey.nName; + pTokenVal->constname.nValue = aKey.yylval; + break; + case BOOLEAN: + pTokenVal->svbool = (sal_Bool)aKey.yylval; + break; + case INCLUDE: + bLastInclude = sal_True; + default: + pTokenVal->value = aKey.yylval; + }; + + return( aKey.nTyp ); + } + else + { + pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); + return( SYMBOL ); + } + } + else{ // Symbol + RscDefine * pDef; + + pDef = pTC->aFileTab.FindDef( aBuf.getStr() ); + if( pDef ){ + pTokenVal->defineele = pDef; + + return( RSCDEFINE ); + } + + pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); + return( SYMBOL ); + } + } + + if( c=='<' ) + { + c = pFI->GetFastChar(); + if( c=='<' ) + { + c = pFI->GetFastChar(); + return LEFTSHIFT; + } + else + return '<'; + } + + if( c=='>' ) + { + c = pFI->GetFastChar(); + if( c=='>' ) + { + c = pFI->GetFastChar(); + return RIGHTSHIFT; + } + else + return '>'; + } + + c1 = c; + c = pFI->GetFastChar(); + return( c1 ); +} + +#if defined( RS6000 ) +extern "C" int yylex() +#else +int yylex() +#endif +{ + if( bTargetDefined ) + bTargetDefined = sal_False; + else + aKeyVal[ 0 ].nKeyWord = + MakeToken( &aKeyVal[ 0 ].aYYSType ); + + yylval = aKeyVal[ 0 ].aYYSType; + return( aKeyVal[ 0 ].nKeyWord ); +} + +/****************** yyerror **********************************************/ +#ifdef RS6000 +extern "C" void yyerror( char* pMessage ) +#elif defined SOLARIS +extern "C" void yyerror( const char* pMessage ) +#else +void yyerror( char* pMessage ) +#endif +{ + pTC->pEH->Error( ERR_YACC, NULL, RscId(), pMessage ); +} + +/****************** parser start function ********************************/ +void InitParser( RscFileInst * pFileInst ) +{ + pTC = pFileInst->pTypCont; // Datenkontainer setzten + pFI = pFileInst; + pStringContainer = new StringContainer(); + pExp = NULL; //fuer MacroParser + bTargetDefined = sal_False; + + // Anfangszeichen initialisieren + bLastInclude = sal_False; + c = pFI->GetFastChar(); +} + +void EndParser(){ + // Stack abraeumen + while( ! S.IsEmpty() ) + S.Pop(); + + // free string container + delete pStringContainer; + pStringContainer = NULL; + + if( pExp ) + delete pExp; + pTC = NULL; + pFI = NULL; + pExp = NULL; + +} + +void IncludeParser( RscFileInst * pFileInst ) +{ + int nToken; // Wert des Tokens + YYSTYPE aYYSType; // Daten des Tokens + RscFile * pFName; // Filestruktur + sal_uLong lKey; // Fileschluessel + RscTypCont * pTypCon = pFileInst->pTypCont; + + pFName = pTypCon->aFileTab.Get( pFileInst->GetFileIndex() ); + InitParser( pFileInst ); + + nToken = MakeToken( &aYYSType ); + while( 0 != nToken && CLASSNAME != nToken ){ + if( '#' == nToken ){ + if( INCLUDE == (nToken = MakeToken( &aYYSType )) ){ + if( STRING == (nToken = MakeToken( &aYYSType )) ){ + lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string, + aYYSType.string ); + pFName->InsertDependFile( lKey, LIST_APPEND ); + } + else if( INCLUDE_STRING == nToken ){ + lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string, + ByteString() ); + pFName->InsertDependFile( lKey, LIST_APPEND ); + }; + }; + }; + nToken = MakeToken( &aYYSType ); + }; + + EndParser(); +} + +ERRTYPE parser( RscFileInst * pFileInst ) +{ + ERRTYPE aError; + + InitParser( pFileInst ); + + aError = yyparse(); + + EndParser(); + + // yyparser gibt 0 zurueck, wenn erfolgreich + if( 0 == aError ) + aError.Clear(); + if( pFileInst->pTypCont->pEH->nErrors ) + aError = ERR_ERROR; + pFileInst->SetError( aError ); + return( aError ); +} + +RscExpression * MacroParser( RscFileInst & rFileInst ) +{ + ERRTYPE aError; + RscExpression * pExpression; + + InitParser( &rFileInst ); + + //Ziel auf macro_expression setzen + aKeyVal[ 0 ].nKeyWord = MACROTARGET; + bTargetDefined = sal_True; + aError = yyparse(); + + pExpression = pExp; + //EndParser() wuerde pExp loeschen + if( pExp ) + pExp = NULL; + + EndParser(); + + // yyparser gibt 0 zurueck, wenn erfolgreich + if( 0 == aError ) + aError.Clear(); + if( rFileInst.pTypCont->pEH->nErrors ) + aError = ERR_ERROR; + rFileInst.SetError( aError ); + + //im Fehlerfall pExpression loeschen + if( aError.IsError() && pExpression ){ + delete pExpression; + pExpression = NULL; + }; + return( pExpression ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rsclex.hxx b/rsc/source/parser/rsclex.hxx new file mode 100644 index 000000000000..c861e89402f6 --- /dev/null +++ b/rsc/source/parser/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/source/parser/rscpar.cxx b/rsc/source/parser/rscpar.cxx new file mode 100644 index 000000000000..fc3c44c8754d --- /dev/null +++ b/rsc/source/parser/rscpar.cxx @@ -0,0 +1,218 @@ +/* -*- 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): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <string.h> +#include <rscpar.hxx> +#include <rscdb.hxx> + +/****************** R s c F i l e I n s t ********************************/ +/****************** C O D E **********************************************/ +/************************************************************************* +|* +|* RscFileInst::Init() +|* +*************************************************************************/ +void RscFileInst::Init() +{ + nLineNo = 0; + nLineBufLen = 256; + pLine = (char *)rtl_allocateMemory( nLineBufLen ); + *pLine = '\0'; + nScanPos = 0; + cLastChar = '\0'; + bEof = sal_False; +}; + +/************************************************************************* +|* +|* RscFileInst::RscFileInst() +|* +*************************************************************************/ +RscFileInst::RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, + sal_uLong lFIndex, FILE * fFile ) +{ + pTypCont = pTC; + Init(); + + lFileIndex = lFIndex; + lSrcIndex = lIndexSrc; + fInputFile = fFile; + + //Status: Zeiger am Ende des Lesepuffers + nInputPos = nInputEndPos = nInputBufLen = READBUFFER_MAX; + pInput = (char *)rtl_allocateMemory( nInputBufLen ); +} + +RscFileInst::RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, + sal_uLong lFIndex, const ByteString& rBuf ) +{ + pTypCont = pTC; + Init(); + lFileIndex = lFIndex; + lSrcIndex = lIndexSrc; + fInputFile = NULL; + nInputPos = 0; + nInputEndPos = rBuf.Len(); + + // Muss groesser sein wegen Eingabeende bei nInputBufLen < nInputEndPos + nInputBufLen = nInputEndPos +1; + pInput = (char *)rtl_allocateMemory( nInputBufLen +100 ); + memcpy( pInput, rBuf.GetBuffer(), nInputEndPos ); +} + +/************************************************************************* +|* +|* RscFileInst::~RscFileInst() +|* +*************************************************************************/ +RscFileInst::~RscFileInst(){ + if( pInput ) + rtl_freeMemory( pInput ); + if( pLine ) + rtl_freeMemory( pLine ); +} + +/************************************************************************* +|* +|* RscFileInst::GetChar() +|* +*************************************************************************/ +int RscFileInst::GetChar() +{ + if( pLine[ nScanPos ] ) + return( pLine[ nScanPos++ ] ); + else if( nInputPos >= nInputEndPos && nInputEndPos != nInputBufLen ) + { + // Dateiende + bEof = sal_True; + return 0; + } + else + { + GetNewLine(); + return( '\n' ); + } +} + +/************************************************************************* +|* +|* RscFileInst::GetNewLine() +|* +*************************************************************************/ +void RscFileInst::GetNewLine() +{ + nLineNo++; + nScanPos = 0; + + //laeuft bis Dateiende + sal_uInt32 nLen = 0; + while( (nInputPos < nInputEndPos) || (nInputEndPos == nInputBufLen) ) + { + if( (nInputPos >= nInputEndPos) && fInputFile ) + { + nInputEndPos = fread( pInput, 1, nInputBufLen, fInputFile ); + nInputPos = 0; + } + + while( nInputPos < nInputEndPos ) + { + //immer eine Zeile lesen + if( nLen >= nLineBufLen ) + { + nLineBufLen += 256; + // einen dazu fuer '\0' + pLine = (char*)rtl_reallocateMemory( pLine, nLineBufLen +1 ); + } + + // cr lf, lf cr, lf oder cr wird '\0' + if( pInput[ nInputPos ] == '\n' ){ + nInputPos++; + if( cLastChar != '\r' ){ + cLastChar = '\n'; + pLine[ nLen++ ] = '\0'; + goto END; + } + } + else if( pInput[ nInputPos ] == '\r' ){ + nInputPos++; + if( cLastChar != '\n' ){ + cLastChar = '\r'; + pLine[ nLen++ ] = '\0'; + goto END; + } + } + else + { + pLine[ nLen++ ] = pInput[ nInputPos++ ]; + if( nLen > 2 ) + { + if( (unsigned char)pLine[nLen-3] == 0xef && + (unsigned char)pLine[nLen-2] == 0xbb && + (unsigned char)pLine[nLen-1] == 0xbf ) + { + nLen -= 3; + } + } + } + }; + }; + + // Abbruch ueber EOF + pLine[ nLen ] = '\0'; + +END: + if( pTypCont->pEH->GetListFile() ){ + char buf[ 10 ]; + + sprintf( buf, "%5d ", (int)GetLineNo() ); + pTypCont->pEH->LstOut( buf ); + pTypCont->pEH->LstOut( GetLine() ); + pTypCont->pEH->LstOut( "\n" ); + } +} + +/************************************************************************* +|* +|* RscFileInst::SetError() +|* +*************************************************************************/ +void RscFileInst::SetError( ERRTYPE aError ) +{ + if( aError.IsOk() ) + { + aFirstError = aError; + nErrorLine = GetLineNo(); + nErrorPos = GetScanPos() -1; + }; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rscyacc.cxx b/rsc/source/parser/rscyacc.cxx new file mode 100644 index 000000000000..efef5f3b42ff --- /dev/null +++ b/rsc/source/parser/rscyacc.cxx @@ -0,0 +1,270 @@ +/* -*- 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): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +#include <stdio.h> +#include <ctype.h> +#include <string.h> + +#include <tools/rc.h> +#include <tools/list.hxx> +#include <rscerror.h> +#include <rsctools.hxx> +#include <rscclass.hxx> +#include <rsccont.hxx> +#include <rsctree.hxx> +#include <rscdb.hxx> +#include <rscdef.hxx> +#include <rscpar.hxx> + +#include "rsclex.hxx" + +/************** V a r i a b l e n ****************************************/ +ObjectStack S; +RscTop * pCurClass; +sal_uInt32 nCurMask; +char szErrBuf[ 100 ]; + +/************** H i l f s F u n k t i o n e n ****************************/ +RSCINST GetVarInst( const RSCINST & rInst, const char * pVarName ) +{ + RSCINST aInst; + + aInst = rInst.pClass->GetVariable( rInst, pHS->getID( pVarName ), + RSCINST() ); + + if( !aInst.pData ) + pTC->pEH->Error( ERR_NOVARIABLENAME, rInst.pClass, RscId() ); + + return( aInst ); +} + +void SetNumber( const RSCINST & rInst, const char * pVarName, sal_Int32 lValue ) +{ + RSCINST aInst; + + aInst = GetVarInst( rInst, pVarName ); + + if( aInst.pData ){ + ERRTYPE aError; + aError = aInst.pClass->SetNumber( aInst, lValue ); + + if( aError.IsError() ) + pTC->pEH->Error( aError, aInst.pClass, RscId() ); + } +} + +void SetConst( const RSCINST & rInst, const char * pVarName, + Atom nValueId, sal_Int32 nVal ) +{ + RSCINST aInst; + + aInst = GetVarInst( rInst, pVarName ); + if( aInst.pData ) + { + ERRTYPE aError; + aError = aInst.pClass->SetConst( aInst, nValueId, nVal ); + + if( aError.IsError() ) + pTC->pEH->Error( aError, aInst.pClass, RscId() ); + } +} + +void SetString( const RSCINST & rInst, const char * pVarName, const char * pStr ) +{ + RSCINST aInst; + + aInst = GetVarInst( rInst, pVarName ); + if( aInst.pData ){ + ERRTYPE aError; + aError = aInst.pClass->SetString( aInst, pStr ); + + if( aError.IsError() ) + pTC->pEH->Error( aError, aInst.pClass, RscId() ); + } +} + +RscId MakeRscId( RscExpType aExpType ) +{ + if( !aExpType.IsNothing() ){ + sal_Int32 lValue; + + if( !aExpType.Evaluate( &lValue ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + if( lValue < 1 || lValue > (sal_Int32)0x7FFF ) + { + pTC->pEH->Error( ERR_IDRANGE, NULL, RscId(), + ByteString::CreateFromInt32( lValue ).GetBuffer() ); + } + + if( aExpType.IsDefinition() ) + return RscId( aExpType.aExp.pDef ); + else + return RscId( lValue ); + } + return RscId(); +} + +sal_Bool DoClassHeader( RSCHEADER * pHeader, sal_Bool bMember ) +{ + RSCINST aCopyInst; + RscId aName1 = MakeRscId( pHeader->nName1 ); + RscId aName2 = MakeRscId( pHeader->nName2 ); + + if( pHeader->pRefClass ) + aCopyInst.pClass = pHeader->pRefClass; + else + aCopyInst.pClass = pHeader->pClass; + + if( TYPE_COPY == pHeader->nTyp ) + { + ObjNode * pCopyObj = aCopyInst.pClass->GetObjNode( aName2 ); + + if( !pCopyObj ) + { + ByteString aMsg( pHS->getString( aCopyInst.pClass->GetId() ) ); + aMsg += ' '; + aMsg += aName2.GetName(); + pTC->pEH->Error( ERR_NOCOPYOBJ, pHeader->pClass, aName1, + aMsg.GetBuffer() ); + } + else + aCopyInst.pData = pCopyObj->GetRscObj(); + } + + if( bMember ) + { + // Angabe von Superklassen oder abgeleiteten Klassen ist jetzt erlaubt + if( S.Top().pClass->InHierarchy( pHeader->pClass ) + || pHeader->pClass->InHierarchy( S.Top().pClass) ) + { + if( aCopyInst.IsInst() ) + { + RSCINST aTmpI( S.Top() ); + aTmpI.pClass->Destroy( aTmpI ); + aTmpI.pClass->Create( &aTmpI, aCopyInst ); + }; + } + else + pTC->pEH->Error( ERR_FALSETYPE, S.Top().pClass, aName1, + pHS->getString( pHeader->pClass->GetId() ) ); + } + else + { + if( S.IsEmpty() ) + { + if( (sal_Int32)aName1 < 256 ) + pTC->pEH->Error( WRN_GLOBALID, pHeader->pClass, aName1 ); + + if( aCopyInst.IsInst() ) + S.Push( pHeader->pClass->Create( NULL, aCopyInst ) ); + else + S.Push( pHeader->pClass->Create( NULL, RSCINST() ) ); + + ObjNode * pNode = new ObjNode( aName1, S.Top().pData, + pFI->GetFileIndex() ); + pTC->pEH->StdOut( ".", RscVerbosityVerbose ); + + if( !aName1.IsId() ) + pTC->pEH->Error( ERR_IDEXPECTED, pHeader->pClass, aName1 ); + else if( !pHeader->pClass->PutObjNode( pNode ) ) + pTC->pEH->Error( ERR_DOUBLEID, pHeader->pClass, aName1 ); + } + else + { + RSCINST aTmpI; + ERRTYPE aError; + + if( (sal_Int32)aName1 >= 256 && aName1.IsId() ) + pTC->pEH->Error( WRN_LOCALID, pHeader->pClass, aName1 ); + aError = S.Top().pClass->GetElement( S.Top(), aName1, + pHeader->pClass, aCopyInst, &aTmpI ); + + if( aError.IsWarning() ) + pTC->pEH->Error( aError, pHeader->pClass, aName1 ); + else if( aError.IsError() ) + { + if( ERR_CONT_INVALIDTYPE == aError ) + pTC->pEH->Error( aError, S.Top().pClass, aName1, + pHS->getString( pHeader->pClass->GetId() ) ); + else + pTC->pEH->Error( aError, S.Top().pClass, aName1 ); + S.Top().pClass->GetElement( S.Top(), RscId(), + pHeader->pClass, RSCINST(), &aTmpI ); + + if( !aTmpI.IsInst() ) + return( sal_False ); + } + S.Push( aTmpI ); + }; + }; + if( TYPE_REF == pHeader->nTyp ) + { + ERRTYPE aError; + + aError = S.Top().pClass->SetRef( S.Top(), aName2 ); + pTC->pEH->Error( aError, S.Top().pClass, aName1 ); + } + + return( sal_True ); +} + +RSCINST GetFirstTupelEle( const RSCINST & rTop ) +{ // Aufwaertskompatible, Tupel probieren + RSCINST aInst; + ERRTYPE aErr; + + aErr = rTop.pClass->GetElement( rTop, RscId(), NULL, RSCINST(), &aInst ); + if( !aErr.IsError() ) + aInst = aInst.pClass->GetTupelVar( aInst, 0, RSCINST() ); + return aInst; +} + +/************** Y a c c C o d e ****************************************/ +//#define YYDEBUG 1 + +#define TYPE_Atom 0 +#define TYPE_RESID 1 + +#ifdef UNX +#define YYMAXDEPTH 2000 +#else +#define YYMAXDEPTH 800 +#endif + +#if defined _MSC_VER +#pragma warning(push, 1) +#pragma warning(disable:4129 4273 4701 4702) +#endif +#include "yyrscyacc.cxx" +#if defined _MSC_VER +#pragma warning(pop) +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y new file mode 100644 index 000000000000..329884e498b6 --- /dev/null +++ b/rsc/source/parser/rscyacc.y @@ -0,0 +1,1118 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +%{ +#if defined __GNUC__ +#pragma GCC system_header +#elif defined __SUNPRO_CC +#pragma disable_warn +#endif +%} + +/* Compilerstack */ + +%union { + Atom varid; + struct { + Atom hashid; + sal_Int32 nValue; + } constname; + RscTop * pClass; + RSCHEADER header; + struct { + CLASS_DATA pData; + RscTop * pClass; + } instance; + sal_Int32 value; + sal_uInt16 ushort; + short exp_short; + char * string; + sal_Bool svbool; + REF_ENUM copyref; + RscDefine * defineele; + CharSet charset; + RscExpType macrostruct; +} + +/* Token */ +%token <value> NUMBER +%token <string> SYMBOL +%token <defineele> RSCDEFINE +%token <string> STRING +%token <string> INCLUDE_STRING +%token <character> CHARACTER +%token <svbool> BOOLEAN + +%token LINE +%token AUTO_ID +%token NOT +%token XSCALE +%token YSCALE +%token RGB +%token GEOMETRY +%token POSITION +%token DIMENSION +%token INZOOMOUTPUTSIZE +%token FLOATINGPOS +%token DEFINE +%token INCLUDE +%token MACROTARGET +%token DEFAULT + + +%token <pClass> CLASSNAME +%token <varid> VARNAME +%token <constname> CONSTNAME +%token CLASS +%token EXTENDABLE +%token WRITEIFSET + + +%type <macrostruct> macro_expression +%type <macrostruct> id_expression +%type <value> long_expression +%type <string> string_multiline + +%type <pClass> type +%type <pClass> type_base +%type <header> class_header_body +%type <header> class_header +%type <header> var_header_class +%type <copyref> copy_ref +%type <ushort> type_flags + + +%left '|' +%left '&' +%left LEFTSHIFT RIGHTSHIFT +%left '+' '-' +%left '*' '/' +%left UNARYMINUS +%left UNARYPLUS +%left ',' +%left '(' ')' + + +/* Grammatik */ + +%start resource_definitions + +%% + +/********************** D E F I N I T I O N S ****************************/ +resource_definitions + : + | resource_definitions resource_definition + | MACROTARGET macro_expression + { + RscExpType aExpType; + sal_Int32 lValue; + + aExpType.cType = RSCEXP_NOTHING; + pExp = new RscExpression( aExpType, '+', $2 ); + if( !pExp->Evaluate( &lValue ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + } + ; + +resource_definition + : line_number + | '#' DEFINE SYMBOL macro_expression + { + sal_Bool bError = sal_False; + + if( $4.IsNumber() ){ + if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), + ByteString( $3 ), + $4.GetLong(), LIST_APPEND ) ) + bError = sal_True; + } + else if( $4.IsDefinition() ){ + RscExpType aExpType; + RscExpression * pExpr; + + aExpType.cType = RSCEXP_NOTHING; + aExpType.SetLong( 0 ); + aExpType.cType = RSCEXP_LONG; + pExpr = new RscExpression( aExpType, '+', $4 ); + + if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), + ByteString( $3 ), pExpr, LIST_APPEND ) ) + bError = sal_True; + } + else if( $4.IsExpression() ){ + if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), + ByteString( $3 ), $4.aExp.pExp, + LIST_APPEND ) ) + bError = sal_True; + } + + if( bError ){ + pTC->pEH->Error( ERR_DECLAREDEFINE, NULL, RscId(), $3 ); + } + } + | '#' DEFINE RSCDEFINE macro_expression + { + pTC->pEH->Error( ERR_DOUBLEDEFINE, NULL, RscId(), $3->GetName().GetBuffer() ); + } + | '#' INCLUDE STRING + { + } + | '#' INCLUDE INCLUDE_STRING + { + } + | class_definition ';' + { +#ifdef D40 + void * pMem; + pMem = rtl_allocateMemory( 20000 ); + rtl_freeMemory( pMem ); +#endif + } + | new_class_definition_header '{' new_class_definition_body '}' ';' + | new_class_definition_header ';' + ; + +new_class_definition_header + : CLASS SYMBOL id_expression ':' CLASSNAME + { + sal_Int32 lType; + + $3.Evaluate( &lType ); + + // Klasse anlegen + Atom nId = pHS->getID( $2 ); + pCurClass = new RscClass( nId, lType, $5 ); + nCurMask = 1; + pTC->aNmTb.Put( nId, CLASSNAME, pCurClass ); + pTC->GetRoot()->Insert( pCurClass ); + } + | CLASS CLASSNAME id_expression ':' CLASSNAME + { + pCurClass = $2; + nCurMask = 1; + } + ; + +new_class_definition_body + : + | property_definition ';' new_class_definition_body + ; + +property_definition + : type_flags type SYMBOL + { + // Variable anlegen + Atom nId = pTC->aNmTb.Put( $3, VARNAME ); + pCurClass->SetVariable( nId, $2, NULL, $1, nCurMask ); + nCurMask <<= 1; + } + | type_flags type VARNAME + { + pCurClass->SetVariable( $3, $2, NULL, $1, nCurMask ); + nCurMask <<= 1; + } + ; + +type_flags + : type_flags EXTENDABLE + { + $$ = $1 | VAR_EXTENDABLE; + } + | type_flags WRITEIFSET + { + $$ = $1 | VAR_SVDYNAMIC; + } + | + { + $$ = 0; + } + ; + +type + : type_base + { + $$ = $1; + } + | type_base '[' ']' + { + if( $1 ) + { + ByteString aTypeName = pHS->getString( $1->GetId() ); + aTypeName += "[]"; + $$ = pTC->SearchType( pHS->getID( aTypeName.GetBuffer(), true ) ); + if( !$$ ) + { + RscCont * pCont; + pCont = new RscCont( pHS->getID( aTypeName.GetBuffer() ), RSC_NOTYPE ); + pCont->SetTypeClass( $1 ); + pTC->InsertType( pCont ); + $$ = pCont; + } + } + else + $$ = NULL; + } + ; + +type_base + : CLASSNAME + { + $$ = $1; + } + | SYMBOL + { + RscTop * pType = pTC->SearchType( pHS->getID( $1, true ) ); + if( !pType ) + pTC->pEH->Error( ERR_NOTYPE, pCurClass, RscId() ); + $$ = pType; + } + ; + +class_definition + : class_header class_body + { + if( TYPE_REF == $1.nTyp ) + pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, + RscId( $1.nName1 ) ); + S.Pop(); + } + | class_header + { + ERRTYPE aError; + RscId aRscId( $1.nName1 ); + + if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) + aError = S.Top().pClass->SetRef( S.Top(), aRscId ); + else if( TYPE_COPY == $1.nTyp ) + aError = ERR_COPYNOTALLOWED; + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, aRscId ); + S.Pop(); + } + ; + +class_header + : class_header_body + { + if( !DoClassHeader( &$1, sal_False ) ) + return( ERR_ERROR ); + $$ = $1; + } + ; + +copy_ref + : '<' + { + $$ = TYPE_COPY; + } + | ',' + { + $$ = TYPE_REF; + } + ; + +class_header_body + : CLASSNAME id_expression copy_ref CLASSNAME id_expression + { + $$.pClass = $1; + $$.nName1 = $2; + $$.nTyp = $3; + $$.pRefClass = $4; + $$.nName2 = $5; + } + | CLASSNAME id_expression copy_ref id_expression + { + $$.pClass = $1; + $$.nName1 = $2; + $$.nTyp = $3; + $$.pRefClass = NULL; + $$.nName2 = $4; + } + | CLASSNAME id_expression + { + $$.pClass = $1; + $$.nName1 = $2; + $$.nTyp = TYPE_NOTHING; + $$.pRefClass = NULL; + $$.nName2.cType = RSCEXP_NOTHING; + } + | CLASSNAME copy_ref id_expression + { + $$.pClass = $1; + $$.nName1.cType = RSCEXP_NOTHING; + $$.nTyp = $2; + $$.pRefClass = NULL; + $$.nName2 = $3; + } + | CLASSNAME copy_ref CLASSNAME id_expression + { + $$.pClass = $1; + $$.nName1.cType = RSCEXP_NOTHING; + $$.nTyp = $2; + $$.pRefClass = $3; + $$.nName2 = $4; + } + | CLASSNAME + { + $$.pClass = $1; + $$.nName1.cType = RSCEXP_NOTHING; + $$.nTyp = TYPE_NOTHING; + $$.nName2.cType = RSCEXP_NOTHING; + } + ; + +class_body + : '{' var_definitions '}' + | '{' '}' + | string_multiline + { + SetString( S.Top(), "TEXT", $1 ); + } + ; + +var_definitions + : var_definition + | var_definitions var_definition + ; + +xy_mapmode + : CONSTNAME + { + SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue ); + } + | + ; + +wh_mapmode + : CONSTNAME + { + SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue ); + } + | + ; + +xywh_mapmode + : CONSTNAME + { + SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue ); + SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue ); + } + | + ; + +var_definition + : line_number + | var_header var_body ';' + { + S.Pop(); + } + | class_definition ';' + | var_header_class class_body ';' + { + if( TYPE_REF == $1.nTyp ) + pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, + RscId( $1.nName1 ) ); + + if( S.Top().pClass->GetCount( S.Top() ) ) + pTC->pEH->Error( WRN_SUBINMEMBER, S.Top().pClass, + RscId( $1.nName1 ) ); + + S.Pop(); + } + | var_header_class ';' + { + ERRTYPE aError; + RscId aRscId( $1.nName1 ); + + if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) + aError = S.Top().pClass->SetRef( S.Top(), aRscId ); + else if( TYPE_COPY == $1.nTyp ) + aError = ERR_COPYNOTALLOWED; + if( S.Top().pClass->GetCount( S.Top() ) ) + aError = WRN_SUBINMEMBER; + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, aRscId ); + + S.Pop(); + } + | XSCALE '=' '(' long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_XNUMERATOR", $4 ); + SetNumber( S.Top(), "_XDENOMINATOR", $6 ); + } + | YSCALE '=' '(' long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_YNUMERATOR", $4 ); + SetNumber( S.Top(), "_YDENOMINATOR", $6 ); + } + | RGB '=' '(' long_expression ',' long_expression + ',' long_expression ')' ';' + { + SetNumber( S.Top(), "RED", $4 ); + SetNumber( S.Top(), "GREEN", $6 ); + SetNumber( S.Top(), "BLUE", $8 ); + } + | GEOMETRY '=' xywh_mapmode '(' long_expression ',' long_expression ',' + long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_X", $5 ); + SetNumber( S.Top(), "_Y", $7 ); + SetNumber( S.Top(), "_WIDTH", $9 ); + SetNumber( S.Top(), "_HEIGHT", $11 ); + } + | POSITION '=' xy_mapmode '(' long_expression ',' long_expression + ')' ';' + { + SetNumber( S.Top(), "_X", $5 ); + SetNumber( S.Top(), "_Y", $7 ); + } + | DIMENSION '=' wh_mapmode '(' long_expression ',' long_expression + ')' ';' + { + SetNumber( S.Top(), "_WIDTH", $5 ); + SetNumber( S.Top(), "_HEIGHT", $7 ); + } + | INZOOMOUTPUTSIZE '=' CONSTNAME '(' long_expression ',' long_expression + ')' ';' + { + SetConst( S.Top(), "_ZOOMINMAPMODE", $3.hashid, $3.nValue ); + SetNumber( S.Top(), "_ZOOMINWIDTH", $5 ); + SetNumber( S.Top(), "_ZOOMINHEIGHT", $7 ); + } + | INZOOMOUTPUTSIZE '=' '(' long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_ZOOMINWIDTH", $4 ); + SetNumber( S.Top(), "_ZOOMINHEIGHT", $6 ); + } + | FLOATINGPOS '=' CONSTNAME '(' long_expression ',' long_expression + ')' ';' + { + SetConst( S.Top(), "_FLOATINGPOSMAPMODE", $3.hashid, $3.nValue ); + SetNumber( S.Top(), "_FLOATINGPOSX", $5 ); + SetNumber( S.Top(), "_FLOATINGPOSY", $7 ); + } + | FLOATINGPOS '=' '(' long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_FLOATINGPOSX", $4 ); + SetNumber( S.Top(), "_FLOATINGPOSY", $6 ); + } + ; + +var_header_class + : VARNAME '=' class_header_body + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST(), sal_False, $3.pClass ); + + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + + if( !DoClassHeader( &$3, sal_True ) ) + return( ERR_ERROR ); + $$ = $3; + } + | VARNAME '[' CONSTNAME ']' '=' class_header_body + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return( ERR_ERROR ); + S.Push( aIdxInst ); + } + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + if( !DoClassHeader( &$6, sal_True ) ) + return( ERR_ERROR ); + $$ = $6; + } + | VARNAME '[' SYMBOL ']' '=' class_header_body + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + long nNewLang = pTC->AddLanguage( $3 ); + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return( ERR_ERROR ); + S.Push( aIdxInst ); + } + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + if( !DoClassHeader( &$6, sal_True ) ) + return( ERR_ERROR ); + $$ = $6; + } + ; + +var_header + : VARNAME '=' + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + S.Push( aInst ); + else{ + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + } + | VARNAME '[' CONSTNAME ']' '=' + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return( ERR_ERROR ); + S.Push( aIdxInst ); + } + else{ + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + } + | VARNAME '[' SYMBOL ']' '=' + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + long nNewLang = pTC->AddLanguage( $3 ); + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return( ERR_ERROR ); + S.Push( aIdxInst ); + } + else{ + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + } + ; +tupel_header0 + : + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 0, RSCINST() ); + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return( ERR_ERROR ); + }; + } + ; + +tupel_header1 + : + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 1, RSCINST() ); + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return( ERR_ERROR ); + }; + } + ; + +tupel_header2 + : + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 2, RSCINST() ); + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return( ERR_ERROR ); + }; + } + ; + +tupel_header3 + : + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 3, RSCINST() ); + if( !aInst.pData ) + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return( ERR_ERROR ); + }; + S.Push( aInst ); + } + ; + +tupel_body + : var_body + { + S.Pop(); + } + ; + +var_list_header + : + { + ERRTYPE aError; + RSCINST aInst; + + aError = S.Top().pClass->GetElement( S.Top(), RscId(), + NULL, RSCINST(), &aInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + { // unbedingt Instanz auf den Stack bringen + aInst = S.Top().pClass->Create( NULL, RSCINST() ); + } + S.Push( aInst ); + } + ; + +list_body + : var_bodycomplex + { + S.Pop(); + } + ; + +list_header + : + { + sal_uInt32 nCount = S.Top().pClass->GetCount( S.Top() ); + sal_uInt32 i; + + for( i = nCount; i > 0; i-- ) + S.Top().pClass->DeletePos( S.Top(), i -1 ); + } + ; + +list + : list var_list_header list_body ';' + | list var_bodysimple ';' + | list class_definition ';' + | list line_number + | + ; + +var_bodysimple + : macro_expression + { + sal_Int32 l; + ERRTYPE aError; + + if( !$1.Evaluate( &l ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + else + { + aError = S.Top().pClass->SetRef( S.Top(), RscId( $1 ) ); + if( aError.IsError() ) + { + aError.Clear(); + aError = S.Top().pClass->SetNumber( S.Top(), l ); + } + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetRef( aInst, RscId( $1 ) ); + if( aError.IsError() ) + { + aError.Clear(); + aError = aInst.pClass->SetNumber( aInst, l ); + } + } + } + } + + if( $1.IsExpression() ) + delete $1.aExp.pExp; + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | CONSTNAME + { + ERRTYPE aError; + aError = S.Top().pClass->SetConst( S.Top(), $1.hashid, $1.nValue ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetConst( aInst, $1.hashid, $1.nValue ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | NOT CONSTNAME + { + ERRTYPE aError; + aError = S.Top().pClass->SetNotConst( S.Top(), $2.hashid ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetNotConst( aInst, $2.hashid ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | BOOLEAN + { + ERRTYPE aError; + aError = S.Top().pClass->SetBool( S.Top(), $1 ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetBool( aInst, $1 ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | string_multiline + { + ERRTYPE aError; + aError = S.Top().pClass->SetString( S.Top(), $1 ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetString( aInst, $1 ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | DEFAULT + ; + +var_bodycomplex + : '{' list_header list '}' + | '<' tupel_header0 tupel_body ';' '>' + | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' '>' + | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' + tupel_header2 tupel_body ';' '>' + | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' + tupel_header2 tupel_body ';' tupel_header3 tupel_body ';' '>' + ; + +var_body + : var_bodysimple + | var_bodycomplex + ; + +/********************** work on yacc stack *******************************/ +string_multiline + : STRING + { + $$ = $1; + } + | string_multiline STRING + { + rtl::OStringBuffer aBuf( 256 ); + aBuf.append( $1 ); + aBuf.append( $2 ); + $$ = (char*)pStringContainer->putString( aBuf.getStr() ); + } + ; + +long_expression + : macro_expression + { + if( !$1.Evaluate( &$$ ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + if( $1.IsExpression() ) + delete $1.aExp.pExp; + } + ; + +macro_expression + : RSCDEFINE + { + $$.cType = RSCEXP_DEF; + $$.aExp.pDef = $1; + } + | NUMBER + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1 ); + } + | '-' macro_expression %prec UNARYMINUS + { + if( $2.IsNumber() ){ + $$.cType = $2.cType; + $$.SetLong( - $2.GetLong() ); + } + else{ + RscExpType aLeftExp; + + aLeftExp.cType = RSCEXP_NOTHING; + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( aLeftExp, '-', $2 ); + } + } + | '+' macro_expression %prec UNARYPLUS + { + $$ = $2; + } + | macro_expression '+' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() + $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '+', $3 ); + } + } + | macro_expression '-' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() - $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '-', $3 ); + } + } + | macro_expression '*' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() * $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '*', $3 ); + } + } + | macro_expression '/' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + if( 0 == $3.GetLong() ){ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '/', $3 ); + } + else{ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() / $3.GetLong() ); + } + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '/', $3 ); + } + } + | macro_expression '&' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() & $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '&', $3 ); + } + } + | macro_expression '|' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() | $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '|', $3 ); + } + } + | '(' macro_expression ')' + { + $$ = $2; + } + | macro_expression LEFTSHIFT macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() << $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, 'l', $3 ); + } + } + | macro_expression RIGHTSHIFT macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() >> $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, 'r', $3 ); + } + } + ; + +id_expression + : id_expression line_number + | macro_expression + { // pExpession auswerten und loeschen + if( RSCEXP_EXP == $1.cType ){ + sal_Int32 lValue; + + if( !$1.Evaluate( &lValue ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + delete $1.aExp.pExp; + $$.cType = RSCEXP_LONG; + $$.SetLong( lValue ); + } + else + $$ = $1; + } + ; + +DUMMY_NUMBER + : NUMBER + { + } + | + { + } + ; + +line_number + : '#' LINE NUMBER STRING + { + RscFile * pFName; + + pFI->SetLineNo( $3 ); + pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( ByteString( $4 ) ) ); + pFName = pTC->aFileTab.Get( pFI->GetFileIndex() ); + pFName->bLoaded = sal_True; + pFName->bScanned = sal_True; + } + | '#' NUMBER STRING DUMMY_NUMBER + { + RscFile * pFName; + + pFI->SetLineNo( $2 ); + pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( ByteString( $3 ) ) ); + pFName = pTC->aFileTab.Get( pFI->GetFileIndex() ); + pFName->bLoaded = sal_True; + pFName->bScanned = sal_True; + } + | '#' NUMBER + { + pFI->SetLineNo( $2 ); + } + ; + + + + |