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