1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _SBIMAGE_HXX 29*cdf0e10cSrcweir #define _SBIMAGE_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "sbintern.hxx" 32*cdf0e10cSrcweir #ifndef _RTL_USTRING_HXX 33*cdf0e10cSrcweir #include <rtl/ustring.hxx> 34*cdf0e10cSrcweir #endif 35*cdf0e10cSrcweir #include <filefmt.hxx> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir // Diese Klasse liest das vom Compiler erzeugte Image ein und verwaltet 38*cdf0e10cSrcweir // den Zugriff auf die einzelnen Elemente. 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir struct SbPublicEntry; 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir class SbiImage { 43*cdf0e10cSrcweir friend class SbiCodeGen; // Compiler-Klassen, die die private- 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir SbxArrayRef rTypes; // User defined types 46*cdf0e10cSrcweir SbxArrayRef rEnums; // Enum types 47*cdf0e10cSrcweir sal_uInt32* pStringOff; // StringId-Offsets 48*cdf0e10cSrcweir sal_Unicode* pStrings; // StringPool 49*cdf0e10cSrcweir char* pCode; // Code-Image 50*cdf0e10cSrcweir char* pLegacyPCode; // Code-Image 51*cdf0e10cSrcweir sal_Bool bError; // sal_True: Fehler 52*cdf0e10cSrcweir sal_uInt16 nFlags; // Flags (s.u.) 53*cdf0e10cSrcweir short nStrings; // Anzahl Strings 54*cdf0e10cSrcweir sal_uInt32 nStringSize; // Groesse des String-Puffers 55*cdf0e10cSrcweir sal_uInt32 nCodeSize; // Groesse des Code-Blocks 56*cdf0e10cSrcweir sal_uInt16 nLegacyCodeSize; // Groesse des Code-Blocks 57*cdf0e10cSrcweir sal_uInt16 nDimBase; // OPTION BASE-Wert 58*cdf0e10cSrcweir rtl_TextEncoding eCharSet; // Zeichensatz fuer Strings 59*cdf0e10cSrcweir // temporaere Verwaltungs-Variable: 60*cdf0e10cSrcweir short nStringIdx; // aktueller String-Index 61*cdf0e10cSrcweir sal_uInt32 nStringOff; // aktuelle Pos im Stringpuffer 62*cdf0e10cSrcweir // Routinen fuer Compiler: 63*cdf0e10cSrcweir void MakeStrings( short ); // StringPool einrichten 64*cdf0e10cSrcweir void AddString( const String& );// String zufuegen 65*cdf0e10cSrcweir void AddCode( char*, sal_uInt32 ); // Codeblock dazu 66*cdf0e10cSrcweir void AddType(SbxObject *); // User-Type mit aufnehmen 67*cdf0e10cSrcweir void AddEnum(SbxObject *); // Register enum type 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir public: 70*cdf0e10cSrcweir String aName; // Makroname 71*cdf0e10cSrcweir ::rtl::OUString aOUSource; // Quellcode 72*cdf0e10cSrcweir String aComment; // Kommentar 73*cdf0e10cSrcweir sal_Bool bInit; // sal_True: Init-Code ist gelaufen 74*cdf0e10cSrcweir sal_Bool bFirstInit; // sal_True, wenn das Image das erste mal nach 75*cdf0e10cSrcweir // dem Compilieren initialisiert wird. 76*cdf0e10cSrcweir SbiImage(); 77*cdf0e10cSrcweir ~SbiImage(); 78*cdf0e10cSrcweir void Clear(); // Inhalt loeschen 79*cdf0e10cSrcweir sal_Bool Load( SvStream&, sal_uInt32& nVer ); // Loads image from stream 80*cdf0e10cSrcweir // nVer is set to version 81*cdf0e10cSrcweir // of image 82*cdf0e10cSrcweir sal_Bool Load( SvStream& ); 83*cdf0e10cSrcweir sal_Bool Save( SvStream&, sal_uInt32 = B_CURVERSION ); 84*cdf0e10cSrcweir sal_Bool IsError() { return bError; } 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir const char* GetCode() const { return pCode; } 87*cdf0e10cSrcweir sal_uInt32 GetCodeSize() const { return nCodeSize; } 88*cdf0e10cSrcweir ::rtl::OUString& GetSource32() { return aOUSource; } 89*cdf0e10cSrcweir sal_uInt16 GetBase() const { return nDimBase; } 90*cdf0e10cSrcweir String GetString( short nId ) const; 91*cdf0e10cSrcweir //const char* GetString( short nId ) const; 92*cdf0e10cSrcweir const SbxObject* FindType (String aTypeName) const; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir SbxArrayRef GetEnums() { return rEnums; } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir void SetFlag( sal_uInt16 n ) { nFlags |= n; } 97*cdf0e10cSrcweir sal_uInt16 GetFlag( sal_uInt16 n ) const { return nFlags & n; } 98*cdf0e10cSrcweir sal_uInt16 CalcLegacyOffset( sal_Int32 nOffset ); 99*cdf0e10cSrcweir sal_uInt32 CalcNewOffset( sal_Int16 nOffset ); 100*cdf0e10cSrcweir void ReleaseLegacyBuffer(); 101*cdf0e10cSrcweir sal_Bool ExceedsLegacyLimits(); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir }; 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir #define SBIMG_EXPLICIT 0x0001 // OPTION EXPLICIT ist aktiv 106*cdf0e10cSrcweir #define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT ist aktiv 107*cdf0e10cSrcweir #define SBIMG_INITCODE 0x0004 // Init-Code vorhanden 108*cdf0e10cSrcweir #define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir #endif 111