1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #include "sbintern.hxx"
24 #include <rtl/ustring.hxx>
25 #include <filefmt.hxx>
27 // This class reads in the image that's been produced by the compiler
28 // and manages the access to the single elements.
31 friend class SbiCodeGen
; // compiler classes, that the private-
33 SbxArrayRef rTypes
; // User defined types
34 SbxArrayRef rEnums
; // Enum types
35 sal_uInt32
* pStringOff
; // StringId-Offsets
36 sal_Unicode
* pStrings
; // StringPool
37 char* pCode
; // Code-Image
38 char* pLegacyPCode
; // Code-Image
42 sal_uInt32 nStringSize
;
44 sal_uInt16 nLegacyCodeSize
;
45 sal_uInt16 nDimBase
; // OPTION BASE value
46 rtl_TextEncoding eCharSet
;
47 // temporary management-variable:
49 sal_uInt32 nStringOff
; // current Pos in the stringbuffer
50 // routines for the compiler:
51 void MakeStrings( short ); // establish StringPool
52 void AddString( const OUString
& );
53 void AddCode( char*, sal_uInt32
);
54 void AddType(SbxObject
*);
55 void AddEnum(SbxObject
*);
58 OUString aName
; // macro name
59 OUString aOUSource
; // source code
67 bool Load( SvStream
&, sal_uInt32
& nVer
);
68 // nVer is set to version
70 bool Save( SvStream
&, sal_uInt32
= B_CURVERSION
);
71 bool IsError() { return bError
; }
73 const char* GetCode() const { return pCode
; }
74 sal_uInt32
GetCodeSize() const { return nCodeSize
; }
75 OUString
& GetSource32() { return aOUSource
; }
76 sal_uInt16
GetBase() const { return nDimBase
; }
77 OUString
GetString( short nId
) const;
78 const SbxObject
* FindType (OUString aTypeName
) const;
80 SbxArrayRef
GetEnums() { return rEnums
; }
82 void SetFlag( sal_uInt16 n
) { nFlags
|= n
; }
83 sal_uInt16
GetFlag( sal_uInt16 n
) const { return nFlags
& n
; }
84 sal_uInt16
CalcLegacyOffset( sal_Int32 nOffset
);
85 sal_uInt32
CalcNewOffset( sal_Int16 nOffset
);
86 void ReleaseLegacyBuffer();
87 bool ExceedsLegacyLimits();
90 #define SBIMG_EXPLICIT 0x0001 // OPTION EXPLICIT is active
91 #define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT is active
92 #define SBIMG_INITCODE 0x0004 // Init-Code does exist
93 #define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */