bump product version to 4.1.6.2
[LibreOffice.git] / basic / source / inc / image.hxx
blob42d19f97b6751a3b1648b73fd239ebe1be35ee68
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef _SBIMAGE_HXX
21 #define _SBIMAGE_HXX
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.
30 class SbiImage {
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
39 bool bError;
40 sal_uInt16 nFlags;
41 short nStrings;
42 sal_uInt32 nStringSize;
43 sal_uInt32 nCodeSize;
44 sal_uInt16 nLegacyCodeSize;
45 sal_uInt16 nDimBase; // OPTION BASE value
46 rtl_TextEncoding eCharSet;
47 // temporary management-variable:
48 short nStringIdx;
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 *);
57 public:
58 OUString aName; // macro name
59 OUString aOUSource; // source code
60 OUString aComment;
61 bool bInit;
62 bool bFirstInit;
64 SbiImage();
65 ~SbiImage();
66 void Clear();
67 bool Load( SvStream&, sal_uInt32& nVer );
68 // nVer is set to version
69 // of image
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
95 #endif
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */