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