summaryrefslogtreecommitdiffstats
path: root/include/oox/ole
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /include/oox/ole
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/oox/ole')
-rw-r--r--include/oox/ole/axbinaryreader.hxx261
-rw-r--r--include/oox/ole/axbinarywriter.hxx167
-rw-r--r--include/oox/ole/axcontrol.hxx993
-rw-r--r--include/oox/ole/axcontrolfragment.hxx76
-rw-r--r--include/oox/ole/axfontdata.hxx86
-rw-r--r--include/oox/ole/olehelper.hxx198
-rw-r--r--include/oox/ole/oleobjecthelper.hxx87
-rw-r--r--include/oox/ole/olestorage.hxx115
-rw-r--r--include/oox/ole/vbacontrol.hxx214
-rw-r--r--include/oox/ole/vbaexport.hxx155
-rw-r--r--include/oox/ole/vbahelper.hxx91
-rw-r--r--include/oox/ole/vbainputstream.hxx74
-rw-r--r--include/oox/ole/vbamodule.hxx123
-rw-r--r--include/oox/ole/vbaproject.hxx211
14 files changed, 2851 insertions, 0 deletions
diff --git a/include/oox/ole/axbinaryreader.hxx b/include/oox/ole/axbinaryreader.hxx
new file mode 100644
index 0000000000..e5e59b970d
--- /dev/null
+++ b/include/oox/ole/axbinaryreader.hxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXBINARYREADER_HXX
+#define INCLUDED_OOX_OLE_AXBINARYREADER_HXX
+
+#include <cstddef>
+#include <utility>
+#include <vector>
+
+#include <oox/helper/binaryinputstream.hxx>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/refvector.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox::ole { struct AxFontData; }
+
+namespace oox::ole {
+
+
+/** A wrapper for a binary input stream that supports aligned read operations.
+
+ The implementation does not support seeking back the wrapped stream. All
+ seeking operations (tell, seekTo, align) are performed relative to the
+ position of the wrapped stream at construction time of this wrapper. It is
+ possible to construct this wrapper with an unseekable input stream without
+ losing any functionality.
+ */
+class AxAlignedInputStream final : public BinaryInputStream
+{
+public:
+ explicit AxAlignedInputStream( BinaryInputStream& rInStrm );
+
+ /** Returns the size of the data this stream represents, if the wrapped
+ stream supports the size() operation. */
+ virtual sal_Int64 size() const override;
+ /** Return the current relative stream position (relative to position of
+ the wrapped stream at construction time). */
+ virtual sal_Int64 tell() const override;
+ /** Seeks the stream to the passed relative position, if it is behind the
+ current position. */
+ virtual void seek( sal_Int64 nPos ) override;
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close() override;
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+ /** Seeks the stream forward by the passed number of bytes. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Aligns the stream to a multiple of the passed size (relative to the
+ position of the wrapped stream at construction time). */
+ void align( size_t nSize );
+
+ /** Aligns the stream according to the passed type and reads a value. */
+ template< typename Type >
+ [[nodiscard]]
+ Type readAligned() { align( sizeof( Type ) ); return readValue< Type >(); }
+ /** Aligns the stream according to the passed type and skips the size of the type. */
+ template< typename Type >
+ void skipAligned() { align( sizeof( Type ) ); skip( sizeof( Type ) ); }
+
+private:
+ BinaryInputStream* mpInStrm; ///< The wrapped input stream.
+ sal_Int64 mnStrmPos; ///< Tracks relative position in the stream.
+ sal_Int64 mnStrmSize; ///< Size of the wrapped stream data.
+};
+
+
+/** A pair of integer values as a property. */
+typedef ::std::pair< sal_Int32, sal_Int32 > AxPairData;
+
+/** An array of string values as a property. */
+typedef ::std::vector< OUString > AxArrayString;
+
+
+/** Import helper to read simple and complex ActiveX form control properties
+ from a binary input stream. */
+class AxBinaryPropertyReader
+{
+public:
+ explicit AxBinaryPropertyReader( BinaryInputStream& rInStrm, bool b64BitPropFlags = false );
+
+ /** Reads the next integer property value from the stream, if the
+ respective flag in the property mask is set. */
+ template< typename StreamType, typename DataType >
+ void readIntProperty( DataType& ornValue )
+ { if( startNextProperty() ) ornValue = maInStrm.readAligned< StreamType >(); }
+ /** Reads the next boolean property value from the stream, if the
+ respective flag in the property mask is set. */
+ void readBoolProperty( bool& orbValue, bool bReverse = false );
+ /** Reads the next pair property from the stream, if the respective flag in
+ the property mask is set. */
+ void readPairProperty( AxPairData& orPairData );
+ /** Reads the next string property from the stream, if the respective flag
+ in the property mask is set. */
+ void readStringProperty( OUString& orValue );
+ /** Reads ArrayString, an array of fmString ( compressed or uncompressed )
+ is read from the stream and inserted into rStrings */
+ void readArrayStringProperty( std::vector< OUString >& rStrings );
+ /** Reads the next GUID property from the stream, if the respective flag
+ in the property mask is set. The GUID will be enclosed in braces. */
+ void readGuidProperty( OUString& orGuid );
+ /** Reads the next font property from the stream, if the respective flag in
+ the property mask is set. */
+ void readFontProperty( AxFontData& orFontData );
+ /** Reads the next picture property from the stream, if the respective flag
+ in the property mask is set. */
+ void readPictureProperty( StreamDataSequence& orPicData );
+
+ /** Skips the next integer property value in the stream, if the respective
+ flag in the property mask is set. */
+ template< typename StreamType >
+ void skipIntProperty() { if( startNextProperty() ) maInStrm.skipAligned< StreamType >(); }
+ /** Skips the next boolean property value in the stream, if the respective
+ flag in the property mask is set. */
+ void skipBoolProperty() { (void)startNextProperty(); }
+ /** Skips the next string property in the stream, if the respective flag in
+ the property mask is set. */
+ void skipStringProperty() { readStringProperty( maDummyString ); }
+ /** Skips the next ArrayString property in the stream, if the respective flag in
+ the property mask is set. */
+ void skipArrayStringProperty() { readArrayStringProperty( maDummyArrayString ); }
+ /** Skips the next GUID property in the stream, if the respective flag in
+ the property mask is set. */
+ void skipGuidProperty() { readGuidProperty( maDummyString ); }
+ /** Skips the next picture property in the stream, if the respective flag
+ in the property mask is set. */
+ void skipPictureProperty() { readPictureProperty( maDummyPicData ); }
+ /** Has to be called for undefined properties. If the respective flag in
+ the mask is set, the property import cannot be finished successfully. */
+ void skipUndefinedProperty() { ensureValid( !startNextProperty() ); }
+
+ /** Final processing, reads contents of all complex properties. */
+ bool finalizeImport();
+
+private:
+ bool ensureValid( bool bCondition = true );
+ bool startNextProperty();
+
+private:
+ /** Base class for complex properties such as string, point, size, GUID, picture. */
+ struct ComplexProperty
+ {
+ virtual ~ComplexProperty();
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) = 0;
+ };
+
+ /** Complex property for a 32-bit value pair, e.g. point or size. */
+ struct PairProperty final : public ComplexProperty
+ {
+ private:
+ AxPairData& mrPairData;
+ public:
+ explicit PairProperty( AxPairData& rPairData ) :
+ mrPairData( rPairData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Complex property for a string value. */
+ struct StringProperty final : public ComplexProperty
+ {
+ private:
+ OUString& mrValue;
+ sal_uInt32 mnSize;
+ public:
+ explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
+ mrValue( rValue ), mnSize( nSize ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Complex property for an array of strings. */
+ struct ArrayStringProperty final : public ComplexProperty
+ {
+ private:
+ AxArrayString& mrArray;
+ sal_uInt32 mnSize;
+ public:
+ explicit ArrayStringProperty( AxArrayString& rArray, sal_uInt32 nSize ) :
+ mrArray( rArray ), mnSize( nSize ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Complex property for a GUID value. */
+ struct GuidProperty final : public ComplexProperty
+ {
+ private:
+ OUString& mrGuid;
+
+ public:
+ explicit GuidProperty( OUString& rGuid ) :
+ mrGuid( rGuid ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Stream property for a font structure. */
+ struct FontProperty final : public ComplexProperty
+ {
+ private:
+ AxFontData& mrFontData;
+
+ public:
+ explicit FontProperty( AxFontData& rFontData ) :
+ mrFontData( rFontData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ /** Stream property for a picture or mouse icon. */
+ struct PictureProperty final : public ComplexProperty
+ {
+ private:
+ StreamDataSequence& mrPicData;
+
+ public:
+ explicit PictureProperty( StreamDataSequence& rPicData ) :
+ mrPicData( rPicData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
+ };
+
+ typedef RefVector< ComplexProperty > ComplexPropVector;
+
+private:
+ AxAlignedInputStream maInStrm; ///< The input stream to read from.
+ ComplexPropVector maLargeProps; ///< Stores info for all used large properties.
+ ComplexPropVector maStreamProps; ///< Stores info for all used stream data properties.
+ StreamDataSequence maDummyPicData; ///< Dummy picture for unsupported properties.
+ OUString maDummyString; ///< Dummy string for unsupported properties.
+ AxArrayString maDummyArrayString; ///< Dummy strings for unsupported ArrayString properties.
+ sal_Int64 mnPropFlags; ///< Flags specifying existing properties.
+ sal_Int64 mnNextProp; ///< Next property to read.
+ sal_Int64 mnPropsEnd; ///< End position of simple/large properties.
+ bool mbValid; ///< True = stream still valid.
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axbinarywriter.hxx b/include/oox/ole/axbinarywriter.hxx
new file mode 100644
index 0000000000..d19e2ae3b3
--- /dev/null
+++ b/include/oox/ole/axbinarywriter.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXBINARYWRITER_HXX
+#define INCLUDED_OOX_OLE_AXBINARYWRITER_HXX
+
+#include <cstddef>
+#include <utility>
+
+#include <oox/helper/binaryoutputstream.hxx>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/refvector.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox::ole {
+
+
+/** A wrapper for a binary output stream that supports aligned write operations.
+
+ The implementation does support seeking back the wrapped stream. All
+ seeking operations (tell, seekTo, align) are performed relative to the
+ position of the wrapped stream at construction time of this wrapper.
+ Unlike it's reader class counterpart it is NOT possible to construct this
+ wrapper with an unseekable output stream.
+ */
+class AxAlignedOutputStream final : public BinaryOutputStream
+{
+public:
+ explicit AxAlignedOutputStream( BinaryOutputStream& rOutStrm );
+
+ /** Returns the size of the data this stream represents, if the wrapped
+ stream supports the size() operation. */
+ virtual sal_Int64 size() const override;
+ /** Return the current relative stream position (relative to position of
+ the wrapped stream at construction time). */
+ virtual sal_Int64 tell() const override;
+ /** Seeks the stream to the passed relative position, if it is behind the
+ current position. */
+ virtual void seek( sal_Int64 nPos ) override;
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close() override;
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual void writeData( const StreamDataSequence& orData, size_t nAtomSize = 1 ) override;
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+ /** Aligns the stream to a multiple of the passed size (relative to the
+ position of the wrapped stream at construction time). */
+ void align( size_t nSize );
+
+ void pad( sal_Int32 nBytes );
+
+ /** Aligns the stream according to the passed type and reads a value. */
+ template< typename Type >
+ void writeAligned( Type nVal ) { align( sizeof( Type ) ); writeValue( nVal ); }
+
+private:
+ BinaryOutputStream* mpOutStrm; ///< The wrapped input stream.
+ sal_Int64 mnStrmPos; ///< Tracks relative position in the stream.
+ sal_Int64 mnStrmSize; ///< Size of the wrapped stream data.
+ sal_Int64 mnWrappedBeginPos; ///< starting pos or wrapped stream
+};
+
+/** A pair of integer values as a property. */
+typedef ::std::pair< sal_Int32, sal_Int32 > AxPairData;
+
+/** Export helper to write simple and complex ActiveX form control properties
+ to a binary input stream. */
+class AxBinaryPropertyWriter
+{
+public:
+ explicit AxBinaryPropertyWriter( BinaryOutputStream& rOutStrm, bool b64BitPropFlags = false );
+
+ /** Write an integer property value to the stream, the
+ respective flag in the property mask is set. */
+ template< typename StreamType, typename DataType >
+ void writeIntProperty( DataType ornValue )
+ { startNextProperty(); maOutStrm.writeAligned< StreamType >( ornValue ); }
+ /** Write a boolean property value to the stream, the
+ respective flag in the property mask is set. */
+ void writeBoolProperty( bool orbValue );
+ /** Write a pair property the stream, the respective flag in
+ the property mask is set. */
+ void writePairProperty( AxPairData& orPairData );
+ /** Write a string property to the stream, the respective flag
+ in the property mask is set. */
+ void writeStringProperty( OUString& orValue );
+
+ /** Skips the next property clears the respective
+ flag in the property mask. */
+ void skipProperty() { startNextProperty( true ); }
+
+ /** Final processing, write contents of all complex properties, writes record size */
+ void finalizeExport();
+
+private:
+ bool ensureValid();
+ void startNextProperty( bool bSkip = false );
+
+private:
+ /** Base class for complex properties such as string, point, size, GUID, picture. */
+ struct ComplexProperty
+ {
+ virtual ~ComplexProperty();
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm ) = 0;
+ };
+
+ /** Complex property for a 32-bit value pair, e.g. point or size. */
+ struct PairProperty final : public ComplexProperty
+ {
+ private:
+ AxPairData& mrPairData;
+
+ public:
+ explicit PairProperty( AxPairData& rPairData ) :
+ mrPairData( rPairData ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm ) override;
+ };
+
+ /** Complex property for a string value. */
+ struct StringProperty final : public ComplexProperty
+ {
+ private:
+ OUString& mrValue;
+ sal_uInt32 mnSize;
+ public:
+ explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
+ mrValue( rValue ), mnSize( nSize ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm ) override;
+ };
+
+ /** Stream property for a picture or mouse icon. */
+ struct PictureProperty final : public ComplexProperty
+ {
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm ) override;
+ };
+
+ typedef RefVector< ComplexProperty > ComplexPropVector;
+
+private:
+ AxAlignedOutputStream maOutStrm; ///< The input stream to read from.
+ ComplexPropVector maLargeProps; ///< Stores info for all used large properties.
+ ComplexPropVector maStreamProps; ///< Stores info for all used stream data properties.
+ sal_Int16 mnBlockSize;
+ sal_Int64 mnPropFlagsStart; ///< pos of Prop flags
+ sal_Int64 mnPropFlags; ///< Flags specifying existing properties.
+ sal_Int64 mnNextProp; ///< Next property to read.
+ bool mbValid; ///< True = stream still valid.
+ bool mb64BitPropFlags;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axcontrol.hxx b/include/oox/ole/axcontrol.hxx
new file mode 100644
index 0000000000..28559ecbd1
--- /dev/null
+++ b/include/oox/ole/axcontrol.hxx
@@ -0,0 +1,993 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXCONTROL_HXX
+#define INCLUDED_OOX_OLE_AXCONTROL_HXX
+
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/propertyset.hxx>
+#include <oox/ole/axbinaryreader.hxx>
+#include <oox/ole/axfontdata.hxx>
+#include <oox/ole/olehelper.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace awt { class XControlModel; }
+ namespace container { class XIndexContainer; }
+ namespace drawing { class XDrawPage; }
+ namespace frame { class XModel; }
+ namespace form { class XFormsSupplier; }
+ namespace lang { class XMultiServiceFactory; }
+}
+
+namespace oox {
+ class BinaryInputStream;
+ class BinaryOutputStream;
+ class GraphicHelper;
+ class PropertyMap;
+}
+
+namespace oox::ole {
+
+
+#define COMCTL_GUID_SCROLLBAR_60 "{FE38753A-44A3-11D1-B5B7-0000C09000C4}"
+#define COMCTL_GUID_PROGRESSBAR_50 "{0713E8D2-850A-101B-AFC0-4210102A8DA7}"
+#define COMCTL_GUID_PROGRESSBAR_60 "{35053A22-8589-11D1-B16A-00C0F0283628}"
+
+const sal_uInt16 COMCTL_VERSION_50 = 5;
+const sal_uInt16 COMCTL_VERSION_60 = 6;
+
+
+#define AX_GUID_COMMANDBUTTON "{D7053240-CE69-11CD-a777-00dd01143c57}"
+#define AX_GUID_LABEL "{978C9E23-D4B0-11CE-bf2d-00aa003f40d0}"
+#define AX_GUID_IMAGE "{4C599241-6926-101B-9992-00000b65c6f9}"
+#define AX_GUID_TOGGLEBUTTON "{8BD21D60-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_CHECKBOX "{8BD21D40-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_OPTIONBUTTON "{8BD21D50-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_TEXTBOX "{8BD21D10-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_LISTBOX "{8BD21D20-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_COMBOBOX "{8BD21D30-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_SPINBUTTON "{79176FB0-B7F2-11CE-97ef-00aa006d2776}"
+#define AX_GUID_SCROLLBAR "{DFD181E0-5E2F-11CE-a449-00aa004a803d}"
+#define AX_GUID_FRAME "{6E182020-F460-11CE-9bcd-00aa00608e01}"
+
+// Html control GUID(s)
+
+#define HTML_GUID_SELECT "{5512D122-5CC6-11CF-8d67-00aa00bdce1d}"
+#define HTML_GUID_TEXTBOX "{5512D124-5CC6-11CF-8d67-00aa00bdce1d}"
+
+const sal_uInt32 AX_SYSCOLOR_WINDOWBACK = 0x80000005;
+const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME = 0x80000006;
+const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT = 0x80000008;
+const sal_uInt32 AX_SYSCOLOR_BUTTONFACE = 0x8000000F;
+const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT = 0x80000012;
+
+const sal_uInt32 AX_FLAGS_ENABLED = 0x00000002;
+const sal_uInt32 AX_FLAGS_LOCKED = 0x00000004;
+const sal_uInt32 AX_FLAGS_OPAQUE = 0x00000008;
+const sal_uInt32 AX_FLAGS_COLUMNHEADS = 0x00000400;
+const sal_uInt32 AX_FLAGS_ENTIREROWS = 0x00000800;
+const sal_uInt32 AX_FLAGS_EXISTINGENTRIES = 0x00001000;
+const sal_uInt32 AX_FLAGS_CAPTIONLEFT = 0x00002000;
+const sal_uInt32 AX_FLAGS_EDITABLE = 0x00004000;
+const sal_uInt32 AX_FLAGS_IMEMODE_MASK = 0x00078000;
+const sal_uInt32 AX_FLAGS_DRAGENABLED = 0x00080000;
+const sal_uInt32 AX_FLAGS_ENTERASNEWLINE = 0x00100000;
+const sal_uInt32 AX_FLAGS_KEEPSELECTION = 0x00200000;
+const sal_uInt32 AX_FLAGS_TABASCHARACTER = 0x00400000;
+const sal_uInt32 AX_FLAGS_WORDWRAP = 0x00800000;
+const sal_uInt32 AX_FLAGS_BORDERSSUPPRESSED = 0x02000000;
+const sal_uInt32 AX_FLAGS_SELECTLINE = 0x04000000;
+const sal_uInt32 AX_FLAGS_SINGLECHARSELECT = 0x08000000;
+const sal_uInt32 AX_FLAGS_AUTOSIZE = 0x10000000;
+const sal_uInt32 AX_FLAGS_HIDESELECTION = 0x20000000;
+const sal_uInt32 AX_FLAGS_MAXLENAUTOTAB = 0x40000000;
+const sal_uInt32 AX_FLAGS_MULTILINE = 0x80000000;
+
+const sal_Int32 AX_BORDERSTYLE_NONE = 0;
+const sal_Int32 AX_BORDERSTYLE_SINGLE = 1;
+
+const sal_Int32 AX_SPECIALEFFECT_FLAT = 0;
+const sal_Int32 AX_SPECIALEFFECT_RAISED = 1;
+const sal_Int32 AX_SPECIALEFFECT_SUNKEN = 2;
+const sal_Int32 AX_SPECIALEFFECT_ETCHED = 3;
+const sal_Int32 AX_SPECIALEFFECT_BUMPED = 6;
+
+const sal_Int32 AX_PICSIZE_CLIP = 0;
+const sal_Int32 AX_PICSIZE_STRETCH = 1;
+const sal_Int32 AX_PICSIZE_ZOOM = 3;
+
+const sal_Int32 AX_PICALIGN_TOPLEFT = 0;
+const sal_Int32 AX_PICALIGN_TOPRIGHT = 1;
+const sal_Int32 AX_PICALIGN_CENTER = 2;
+const sal_Int32 AX_PICALIGN_BOTTOMLEFT = 3;
+const sal_Int32 AX_PICALIGN_BOTTOMRIGHT = 4;
+
+const sal_Int32 AX_DISPLAYSTYLE_TEXT = 1;
+const sal_Int32 AX_DISPLAYSTYLE_LISTBOX = 2;
+const sal_Int32 AX_DISPLAYSTYLE_COMBOBOX = 3;
+const sal_Int32 AX_DISPLAYSTYLE_CHECKBOX = 4;
+const sal_Int32 AX_DISPLAYSTYLE_OPTBUTTON = 5;
+const sal_Int32 AX_DISPLAYSTYLE_TOGGLE = 6;
+const sal_Int32 AX_DISPLAYSTYLE_DROPDOWN = 7;
+
+const sal_Int32 AX_SELECTION_SINGLE = 0;
+const sal_Int32 AX_SELECTION_MULTI = 1;
+const sal_Int32 AX_SELECTION_EXTENDED = 2;
+
+const sal_Int32 AX_SHOWDROPBUTTON_NEVER = 0;
+const sal_Int32 AX_SHOWDROPBUTTON_FOCUS = 1;
+const sal_Int32 AX_SHOWDROPBUTTON_ALWAYS = 2;
+
+const sal_Int32 AX_SCROLLBAR_NONE = 0x00;
+const sal_Int32 AX_SCROLLBAR_HORIZONTAL = 0x01;
+const sal_Int32 AX_SCROLLBAR_VERTICAL = 0x02;
+
+
+/** Enumerates all UNO API control types supported by these filters. */
+enum ApiControlType
+{
+ API_CONTROL_BUTTON,
+ API_CONTROL_FIXEDTEXT,
+ API_CONTROL_IMAGE,
+ API_CONTROL_CHECKBOX,
+ API_CONTROL_RADIOBUTTON,
+ API_CONTROL_EDIT,
+ API_CONTROL_NUMERIC,
+ API_CONTROL_LISTBOX,
+ API_CONTROL_COMBOBOX,
+ API_CONTROL_SPINBUTTON,
+ API_CONTROL_SCROLLBAR,
+ API_CONTROL_TABSTRIP, //11
+ API_CONTROL_PROGRESSBAR,
+ API_CONTROL_GROUPBOX,
+ API_CONTROL_FRAME, // 14
+ API_CONTROL_PAGE, // 15
+ API_CONTROL_MULTIPAGE, // 16
+ API_CONTROL_DIALOG // 17
+};
+
+
+/** Specifies how a form control supports transparent background. */
+enum class ApiTransparencyMode
+{
+ NotSupported, ///< Control does not support transparency.
+ Void, ///< Transparency is enabled by missing fill color.
+};
+
+/** Specifies how a form control supports the DefaultState property. */
+enum ApiDefaultStateMode
+{
+ API_DEFAULTSTATE_BOOLEAN, ///< Control does not support tri-state, state is given as boolean.
+ API_DEFAULTSTATE_SHORT, ///< Control does not support tri-state, state is given as short.
+ API_DEFAULTSTATE_TRISTATE ///< Control supports tri-state, state is given as short.
+};
+
+
+/** A base class with useful helper functions for something that is able to
+ convert ActiveX and ComCtl form controls.
+ */
+class OOX_DLLPUBLIC ControlConverter final
+{
+public:
+ explicit ControlConverter(
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+ ~ControlConverter();
+
+ // Generic conversion -----------------------------------------------------
+
+ /** Converts the passed position in 1/100 mm to UNO properties. */
+ void convertPosition(
+ PropertyMap& rPropMap,
+ const AxPairData& rPos ) const;
+
+ /** Converts the passed size in 1/100 mm to UNO properties. */
+ void convertSize(
+ PropertyMap& rPropMap,
+ const AxPairData& rSize ) const;
+
+ /** Converts the passed encoded OLE color to UNO properties. */
+ void convertColor(
+ PropertyMap& rPropMap,
+ sal_Int32 nPropId,
+ sal_uInt32 nOleColor ) const;
+
+ static void convertToMSColor(
+ PropertySet const & rPropSet,
+ sal_Int32 nPropId,
+ sal_uInt32& nOleColor,
+ sal_uInt32 nDefault = 0 );
+
+
+ /** Converts the passed StdPic picture stream to UNO properties. */
+ void convertPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData ) const;
+
+ /** Converts the control orientation to UNO properties. */
+ static void convertOrientation(
+ PropertyMap& rPropMap,
+ bool bHorizontal );
+
+ static void convertToMSOrientation(
+ PropertySet const & rPropMap,
+ bool& bHorizontal );
+
+ /** Converts the vertical alignment to UNO properties. */
+ static void convertVerticalAlign(
+ PropertyMap& rPropMap,
+ sal_Int32 nVerticalAlign );
+
+ /** Converts common scrollbar settings to UNO properties. */
+ static void convertScrollBar(
+ PropertyMap& rPropMap,
+ sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
+ sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel );
+
+ /** Converts scrollability settings to UNO properties. */
+ void convertScrollabilitySettings(
+ PropertyMap& rPropMap,
+ const AxPairData& rScrollPos, const AxPairData& rScrollArea,
+ sal_Int32 nScrollBars ) const;
+
+ /** Binds the passed control model to the passed data sources. The
+ implementation will check which source types are supported. */
+ void bindToSources(
+ const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel,
+ const OUString& rCtrlSource,
+ const OUString& rRowSource,
+ sal_Int32 nRefSheet = 0 ) const;
+
+ // ActiveX (Forms 2.0) specific conversion --------------------------------
+
+ /** Converts the Forms 2.0 background formatting to UNO properties. */
+ void convertAxBackground(
+ PropertyMap& rPropMap,
+ sal_uInt32 nBackColor,
+ sal_uInt32 nFlags,
+ ApiTransparencyMode eTranspMode ) const;
+
+ /** Converts the Forms 2.0 border formatting to UNO properties. */
+ void convertAxBorder(
+ PropertyMap& rPropMap,
+ sal_uInt32 nBorderColor,
+ sal_Int32 nBorderStyle,
+ sal_Int32 nSpecialEffect ) const;
+
+ static void convertToAxBorder(
+ PropertySet const & rPropSet,
+ sal_uInt32& nBorderColor,
+ sal_Int32& nBorderStyle,
+ sal_Int32& nSpecialEffect );
+
+ /** Converts the Forms 2.0 special effect to UNO properties. */
+ static void convertAxVisualEffect(
+ PropertyMap& rPropMap,
+ sal_Int32 nSpecialEffect );
+
+ static void convertToAxVisualEffect(
+ PropertySet const & rPropSet,
+ sal_Int32& nSpecialEffect );
+
+ /** Converts the passed picture stream and Forms 2.0 position to UNO
+ properties. */
+ void convertAxPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData,
+ sal_uInt32 nPicPos ) const;
+
+ /** Converts the passed picture stream and Forms 2.0 position to UNO
+ properties. */
+ void convertAxPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData,
+ sal_Int32 nPicSizeMode ) const;
+
+ /** Converts the Forms 2.0 value for checked/unchecked/dontknow to UNO
+ properties. */
+ static void convertAxState(
+ PropertyMap& rPropMap,
+ std::u16string_view rValue,
+ sal_Int32 nMultiSelect,
+ ApiDefaultStateMode eDefStateMode,
+ bool bAwtModel );
+
+ static void convertToAxState(
+ PropertySet const & rPropSet,
+ OUString& rValue,
+ sal_Int32& nMultiSelect,
+ ApiDefaultStateMode eDefStateMode );
+
+ /** Converts the Forms 2.0 control orientation to UNO properties. */
+ static void convertAxOrientation(
+ PropertyMap& rPropMap,
+ const AxPairData& rSize,
+ sal_Int32 nOrientation );
+
+ static void convertToAxOrientation(
+ PropertySet const & rPropSet,
+ sal_Int32& nOrientation );
+
+private:
+ css::uno::Reference< css::frame::XModel > mxDocModel;
+ const GraphicHelper& mrGraphicHelper;
+ mutable PropertySet maAddressConverter;
+ mutable PropertySet maRangeConverter;
+ bool mbDefaultColorBgr;
+};
+
+
+/** Base class for all models of form controls. */
+class OOX_DLLPUBLIC ControlModelBase
+{
+public:
+ explicit ControlModelBase();
+ virtual ~ControlModelBase();
+
+ /** Sets this control model to AWT model mode. */
+ void setAwtModelMode() { mbAwtModel = true; }
+ /** Sets this control model to form component mode. */
+ void setFormComponentMode() { mbAwtModel = false; }
+
+ /** Returns the UNO service name used to construct the AWT control model,
+ or the control form component. */
+ OUString getServiceName() const;
+
+ /** Derived classes set specific OOXML properties at the model structure. */
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ /** Derived classes set binary data (picture, mouse icon) at the model structure. */
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
+ /** Derived classes import a form control model from the passed input stream. */
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) = 0;
+ /** Derived classes export a form control model to the passed output stream. */
+ virtual void exportBinaryModel( BinaryOutputStream& /*rOutStrm*/ ) {}
+ /** Derived classes export CompObjStream contents. */
+ virtual void exportCompObj( BinaryOutputStream& /*rOutStrm*/ ) {}
+ /** Derived classes return the UNO control type enum value. */
+ virtual ApiControlType getControlType() const = 0;
+ /** Derived classes convert all control properties. */
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ /** Derived classes convert from uno control properties to equiv. MS values. */
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+ /** Converts the control size to UNO properties. */
+ void convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+public: // direct access needed for legacy VML drawing controls
+ AxPairData maSize; ///< Size of the control in 1/100 mm.
+
+protected:
+ bool mbAwtModel; ///< True = AWT control model, false = form component.
+};
+
+typedef std::shared_ptr< ControlModelBase > ControlModelRef;
+
+
+/** Base class for all models of ComCtl form controls. */
+class ComCtlModelBase : public ControlModelBase
+{
+public:
+ explicit ComCtlModelBase(
+ sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6, sal_uInt16 nVersion );
+
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm ) = 0;
+
+private:
+ /** Returns the data part identifier according to the model version. */
+ sal_uInt32 getDataPartId() const;
+
+ static bool readPartHeader( BinaryInputStream& rInStrm,
+ sal_uInt32 nExpPartId,
+ sal_uInt16 nExpMajor = SAL_MAX_UINT16,
+ sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
+
+ bool importSizePart( BinaryInputStream& rInStrm );
+ bool importCommonPart( BinaryInputStream& rInStrm, sal_uInt32 nPartSize );
+ bool importComplexPart( BinaryInputStream& rInStrm );
+
+protected:
+ StdFontInfo maFontData; ///< Font formatting.
+ StreamDataSequence maMouseIcon; ///< Binary picture stream for mouse icon.
+ sal_uInt32 mnFlags; ///< Common flags for ComCtl controls.
+ const sal_uInt16 mnVersion; ///< Current version of the ComCtl control model.
+
+private:
+ sal_uInt32 mnDataPartId5; ///< Identifier for version 5.0 control data.
+ sal_uInt32 mnDataPartId6; ///< Identifier for version 6.0 control data.
+ bool mbCommonPart; ///< True = the COMCTL_COMMONDATA part exists.
+ bool mbComplexPart; ///< True = the COMCTL_COMPLEXDATA part exists.
+};
+
+
+/** Model for a ComCtl scroll bar. */
+class ComCtlScrollBarModel final : public ComCtlModelBase
+{
+public:
+ explicit ComCtlScrollBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+private:
+ virtual void importControlData( BinaryInputStream& rInStrm ) override;
+
+ sal_uInt32 mnScrollBarFlags; ///< Special flags for scroll bar model.
+ sal_Int32 mnLargeChange; ///< Increment step size (thumb).
+ sal_Int32 mnSmallChange; ///< Increment step size (buttons).
+ sal_Int32 mnMin; ///< Minimum of the value range.
+ sal_Int32 mnMax; ///< Maximum of the value range.
+ sal_Int32 mnPosition; ///< Value of the spin button.
+};
+
+
+/** Model for a ComCtl progress bar. */
+class ComCtlProgressBarModel final : public ComCtlModelBase
+{
+public:
+ explicit ComCtlProgressBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+private:
+ virtual void importControlData( BinaryInputStream& rInStrm ) override;
+
+ float mfMin; ///< Minimum of the value range.
+ float mfMax; ///< Maximum of the value range.
+ sal_uInt16 mnVertical; ///< 0 = horizontal, 1 = vertical.
+ sal_uInt16 mnSmooth; ///< 0 = progress blocks, 1 = pixel resolution.
+};
+
+
+/** Base class for all models of Form 2.0 form controls. */
+class OOX_DLLPUBLIC AxControlModelBase : public ControlModelBase
+{
+public:
+ explicit AxControlModelBase();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+};
+
+
+/** Base class for Forms 2.0 controls supporting text formatting. */
+class OOX_DLLPUBLIC AxFontDataModel : public AxControlModelBase
+{
+public:
+ explicit AxFontDataModel( bool bSupportsAlign = true );
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+ /** Returns the font height in points. */
+ sal_Int16 getFontHeight() const { return maFontData.getHeightPoints(); }
+
+public: // direct access needed for legacy VML drawing controls
+ AxFontData maFontData; ///< The font settings.
+
+private:
+ bool mbSupportsAlign; ///< True = UNO model supports Align property.
+};
+
+
+/** Model for a Forms 2.0 command button. */
+class OOX_DLLPUBLIC AxCommandButtonModel final : public AxFontDataModel
+{
+public:
+ explicit AxCommandButtonModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ OUString maCaption; ///< Visible caption of the button.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnPicturePos; ///< Position of the picture relative to text.
+ sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
+ bool mbFocusOnClick; ///< True = take focus on click.
+};
+
+
+/** Model for a Forms 2.0 label. */
+class OOX_DLLPUBLIC AxLabelModel final : public AxFontDataModel
+{
+public:
+ explicit AxLabelModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ OUString maCaption; ///< Visible caption of the button.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
+};
+
+
+/** Model for a Forms 2.0 image. */
+class OOX_DLLPUBLIC AxImageModel final : public AxControlModelBase
+{
+public:
+ explicit AxImageModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+private:
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom.
+ sal_Int32 mnPicAlign; ///< Anchor position of the picture.
+ bool mbPicTiling; ///< True = picture is repeated.
+};
+
+class OOX_DLLPUBLIC AxTabStripModel final : public AxFontDataModel
+{
+public:
+ explicit AxTabStripModel();
+
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+
+public:
+ sal_uInt32 mnListIndex;
+ sal_uInt32 mnTabStyle;
+ sal_uInt32 mnTabData;
+ sal_uInt32 mnVariousPropertyBits;
+ std::vector< OUString > maItems; // captions for each tab
+ std::vector< OUString > maTabNames; // names for each tab
+};
+
+
+/** Base class for a Forms 2.0 morph data control. */
+class OOX_DLLPUBLIC AxMorphDataModelBase : public AxFontDataModel
+{
+public:
+ explicit AxMorphDataModelBase();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ OUString maCaption; ///< Visible caption of the button.
+ OUString maValue; ///< Current value of the control.
+ OUString maGroupName; ///< Group name for option buttons.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnPicturePos; ///< Position of the picture relative to text.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnDisplayStyle; ///< Type of the morph control.
+ sal_Int32 mnMultiSelect; ///< Selection mode.
+ sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
+ sal_Int32 mnMatchEntry; ///< Auto completion mode.
+ sal_Int32 mnShowDropButton; ///< When to show the dropdown button.
+ sal_Int32 mnMaxLength; ///< Maximum character count.
+ sal_Int32 mnPasswordChar; ///< Password character in edit fields.
+ sal_Int32 mnListRows; ///< Number of rows in dropdown box.
+ sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
+};
+
+
+/** Model for a Forms 2.0 toggle button. */
+class OOX_DLLPUBLIC AxToggleButtonModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxToggleButtonModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 check box. */
+class OOX_DLLPUBLIC AxCheckBoxModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxCheckBoxModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 option button. */
+class OOX_DLLPUBLIC AxOptionButtonModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxOptionButtonModel();
+
+ /** Returns the group name used to group several option buttons together. */
+ const OUString& getGroupName() const { return maGroupName; }
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 text box. */
+class OOX_DLLPUBLIC AxTextBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxTextBoxModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a numeric field (legacy drawing controls only). */
+class OOX_DLLPUBLIC AxNumericFieldModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxNumericFieldModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 list box. */
+class OOX_DLLPUBLIC AxListBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxListBoxModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 combo box. */
+class OOX_DLLPUBLIC AxComboBoxModel final : public AxMorphDataModelBase
+{
+public:
+ explicit AxComboBoxModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+};
+
+
+/** Model for a Forms 2.0 spin button. */
+class OOX_DLLPUBLIC AxSpinButtonModel final : public AxControlModelBase
+{
+public:
+ explicit AxSpinButtonModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ sal_uInt32 mnArrowColor; ///< Button arrow color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_Int32 mnOrientation; ///< Orientation of the buttons.
+ sal_Int32 mnMin; ///< Minimum of the value range.
+ sal_Int32 mnMax; ///< Maximum of the value range.
+ sal_Int32 mnPosition; ///< Value of the spin button.
+ sal_Int32 mnSmallChange; ///< Increment step size.
+ sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
+};
+
+
+/** Model for a Forms 2.0 scroll bar. */
+class OOX_DLLPUBLIC AxScrollBarModel final : public AxControlModelBase
+{
+public:
+ explicit AxScrollBarModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm ) override;
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
+
+public: // direct access needed for legacy VML drawing controls
+ sal_uInt32 mnArrowColor; ///< Button arrow color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_Int32 mnOrientation; ///< Orientation of the buttons.
+ sal_Int32 mnPropThumb; ///< Proportional thumb size.
+ sal_Int32 mnMin; ///< Minimum of the value range.
+ sal_Int32 mnMax; ///< Maximum of the value range.
+ sal_Int32 mnPosition; ///< Value of the spin button.
+ sal_Int32 mnSmallChange; ///< Increment step size (buttons).
+ sal_Int32 mnLargeChange; ///< Increment step size (thumb).
+ sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
+};
+
+
+typedef ::std::vector< OUString > AxClassTable;
+
+/** Base class for ActiveX container controls. */
+class OOX_DLLPUBLIC AxContainerModelBase : public AxFontDataModel
+{
+public:
+ explicit AxContainerModelBase( bool bFontSupport = false );
+
+ /** Allows to set single properties specified by XML token identifier. */
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) override;
+ /** Reads the leading structure in the 'f' stream containing the model for
+ this control. */
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ /** Converts font settings if supported. */
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+
+ /** Reads the class table structure for embedded controls following the own
+ model from the 'f' stream. */
+ bool importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable );
+
+public: // direct access needed for legacy VML drawing controls
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ OUString maCaption; ///< Visible caption of the form.
+ AxPairData maLogicalSize; ///< Logical form size (scroll area).
+ AxPairData maScrollPos; ///< Scroll position.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
+ sal_Int32 mnCycleType; ///< Cycle in all forms or in this form.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnPicAlign; ///< Anchor position of the picture.
+ sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom.
+ bool mbPicTiling; ///< True = picture is repeated.
+ bool mbFontSupport; ///< True = control supports the font property.
+};
+
+
+/** Model for a Forms 2.0 frame control. */
+class OOX_DLLPUBLIC AxFrameModel final : public AxContainerModelBase
+{
+public:
+ explicit AxFrameModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+};
+
+class OOX_DLLPUBLIC AxPageModel final : public AxContainerModelBase
+{
+public:
+ explicit AxPageModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+};
+
+class OOX_DLLPUBLIC AxMultiPageModel final : public AxContainerModelBase
+{
+public:
+ explicit AxMultiPageModel();
+
+ virtual ApiControlType getControlType() const override;
+ void importPageAndMultiPageProperties( BinaryInputStream& rInStrm, sal_Int32 nPages );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+ std::vector<sal_uInt32> mnIDs;
+ sal_uInt32 mnActiveTab;
+ sal_uInt32 mnTabStyle;
+};
+
+
+/** Model for a Forms 2.0 user form. */
+class OOX_DLLPUBLIC AxUserFormModel final : public AxContainerModelBase
+{
+public:
+ explicit AxUserFormModel();
+
+ virtual ApiControlType getControlType() const override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+};
+
+class HtmlSelectModel final : public AxListBoxModel
+{
+ css::uno::Sequence< OUString > msListData;
+ css::uno::Sequence< sal_Int16 > msIndices;
+public:
+ HtmlSelectModel();
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+};
+
+class HtmlTextBoxModel final : public AxTextBoxModel
+{
+public:
+ explicit HtmlTextBoxModel();
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) override;
+};
+
+
+/** A form control embedded in a document draw page. Contains a specific model
+ structure according to the type of the control. */
+class OOX_DLLPUBLIC EmbeddedControl
+{
+public:
+ explicit EmbeddedControl( OUString aName );
+
+ /** Creates and returns the internal control model of the specified type. */
+ template< typename ModelType >
+ inline ModelType& createModel();
+
+ /** Creates and returns the internal control model of the specified type. */
+ template< typename ModelType, typename ParamType >
+ inline ModelType& createModel( const ParamType& rParam );
+
+ /** Creates and returns the internal control model according to the passed
+ MS class identifier. */
+ ControlModelBase* createModelFromGuid( std::u16string_view rClassId );
+
+ /** Returns true, if the internal control model exists. */
+ bool hasModel() const { return bool(mxModel); }
+ /** Returns read-only access to the internal control model. */
+ const ControlModelBase* getModel() const { return mxModel.get(); }
+ /** Returns read/write access to the internal control model. */
+ ControlModelBase* getModel() { return mxModel.get(); }
+
+ /** Returns the UNO service name needed to construct the control model. */
+ OUString getServiceName() const;
+
+ /** Converts all control properties and inserts them into the passed model. */
+ bool convertProperties(
+ const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv ) const;
+
+ void convertFromProperties(
+ const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv );
+
+private:
+ ControlModelRef mxModel; ///< Control model containing the properties.
+ OUString maName; ///< Name of the control.
+};
+
+
+template< typename ModelType >
+inline ModelType& EmbeddedControl::createModel()
+{
+ auto xModel = std::make_shared<ModelType>();
+ mxModel = xModel;
+ xModel->setFormComponentMode();
+ return *xModel;
+}
+
+template< typename ModelType, typename ParamType >
+inline ModelType& EmbeddedControl::createModel( const ParamType& rParam )
+{
+ auto xModel = std::make_shared<ModelType>( rParam );
+ mxModel = xModel;
+ xModel->setFormComponentMode();
+ return *xModel;
+}
+
+
+/** A wrapper for a control form embedded directly in a draw page. */
+class EmbeddedForm
+{
+public:
+ explicit EmbeddedForm(
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage,
+ const GraphicHelper& rGraphicHelper );
+
+ /** Converts the passed control and inserts the control model into the form.
+ @return The API control model, if conversion was successful. */
+ css::uno::Reference< css::awt::XControlModel >
+ convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex );
+
+ /** Returns the XIndexContainer interface of the UNO control form, if existing. */
+ const css::uno::Reference< css::container::XIndexContainer >&
+ getXForm() const { return mxFormIC; }
+
+private:
+ /** Creates the form that will hold the form controls. */
+ css::uno::Reference< css::container::XIndexContainer > const &
+ createXForm();
+
+private:
+ ControlConverter maControlConv;
+ css::uno::Reference< css::lang::XMultiServiceFactory > mxModelFactory;
+ css::uno::Reference< css::form::XFormsSupplier > mxFormsSupp;
+ css::uno::Reference< css::container::XIndexContainer > mxFormIC;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axcontrolfragment.hxx b/include/oox/ole/axcontrolfragment.hxx
new file mode 100644
index 0000000000..e6b87b4160
--- /dev/null
+++ b/include/oox/ole/axcontrolfragment.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXCONTROLFRAGMENT_HXX
+#define INCLUDED_OOX_OLE_AXCONTROLFRAGMENT_HXX
+
+#include <oox/core/contexthandler.hxx>
+#include <oox/core/contexthandler2.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class AttributeList; }
+namespace oox::core { class XmlFilterBase; }
+
+namespace oox::ole {
+
+class ControlModelBase;
+class EmbeddedControl;
+
+
+/** Context handler for ActiveX form control model properties. */
+class AxControlPropertyContext final : public ::oox::core::ContextHandler2
+{
+public:
+ explicit AxControlPropertyContext(
+ ::oox::core::FragmentHandler2 const & rFragment,
+ ControlModelBase& rModel );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+private:
+ ControlModelBase& mrModel;
+ sal_Int32 mnPropId; ///< Identifier of currently processed property.
+};
+
+
+/** Fragment handler for an embedded ActiveX form control fragment. */
+class AxControlFragment final : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit AxControlFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ EmbeddedControl& rControl );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
+
+private:
+ EmbeddedControl& mrControl;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axfontdata.hxx b/include/oox/ole/axfontdata.hxx
new file mode 100644
index 0000000000..df35032471
--- /dev/null
+++ b/include/oox/ole/axfontdata.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_AXFONTDATA_HXX
+#define INCLUDED_OOX_OLE_AXFONTDATA_HXX
+
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace oox {
+ class BinaryInputStream;
+ class BinaryOutputStream;
+}
+
+enum class AxFontFlags {
+ NONE = 0x00000000,
+ Bold = 0x00000001,
+ Italic = 0x00000002,
+ Underline = 0x00000004,
+ Strikeout = 0x00000008,
+ Disabled = 0x00002000,
+ AutoColor = 0x40000000,
+};
+namespace o3tl {
+ template<> struct typed_flags<AxFontFlags> : is_typed_flags<AxFontFlags, 0x4000200f> {};
+}
+
+namespace oox::ole {
+
+enum class AxHorizontalAlign {
+ Left = 1, Right = 2, Center = 3
+};
+
+/** All entries of a font property. */
+struct OOX_DLLPUBLIC AxFontData
+{
+ OUString maFontName; ///< Name of the used font.
+ AxFontFlags mnFontEffects; ///< Font effect flags.
+ sal_Int32 mnFontHeight; ///< Height of the font (not really twips, see code).
+ sal_Int32 mnFontCharSet; ///< Windows character set of the font.
+ AxHorizontalAlign mnHorAlign; ///< Horizontal text alignment.
+ bool mbDblUnderline; ///< True = double underline style (legacy VML drawing controls only).
+
+ explicit AxFontData();
+
+ /** Converts the internal representation of the font height to points. */
+ sal_Int16 getHeightPoints() const;
+ /** Converts the passed font height from points to the internal representation. */
+ void setHeightPoints( sal_Int16 nPoints );
+
+ /** Reads the font data settings from the passed input stream. */
+ bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ /** Reads the font data settings from the passed input stream that contains
+ an OLE StdFont structure. */
+ bool importStdFont( BinaryInputStream& rInStrm );
+ /** Reads the font data settings from the passed input stream depending on
+ the GUID preceding the actual font data. */
+ bool importGuidAndFont( BinaryInputStream& rInStrm );
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx
new file mode 100644
index 0000000000..a2810460bc
--- /dev/null
+++ b/include/oox/ole/olehelper.hxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_OLEHELPER_HXX
+#define INCLUDED_OOX_OLE_OLEHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msocximex.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <oox/helper/graphichelper.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/ref.hxx>
+#include <memory>
+
+namespace com::sun::star {
+ namespace awt { class XControlModel; }
+ namespace awt { struct Size; }
+ namespace form { class XFormComponent; }
+ namespace frame { class XModel; }
+ namespace io { class XOutputStream; }
+ namespace uno { class XComponentContext; }
+}
+
+class SotStorage;
+class SotStorageStream;
+class SvGlobalName;
+
+namespace oox {
+ class BinaryInputStream;
+ class BinaryOutputStream;
+}
+
+namespace oox::ole {
+ class ControlModelBase;
+ class EmbeddedControl;
+
+
+#define OLE_GUID_STDFONT "{0BE35203-8F91-11CE-9DE3-00AA004BB851}"
+#define OLE_GUID_STDPIC "{0BE35204-8F91-11CE-9DE3-00AA004BB851}"
+
+
+const sal_uInt16 OLE_STDFONT_NORMAL = 400;
+const sal_uInt16 OLE_STDFONT_BOLD = 700;
+
+const sal_uInt8 OLE_STDFONT_ITALIC = 0x02;
+const sal_uInt8 OLE_STDFONT_UNDERLINE = 0x04;
+const sal_uInt8 OLE_STDFONT_STRIKE = 0x08;
+
+/** Stores data about a StdFont font structure. */
+struct StdFontInfo
+{
+ OUString maName; ///< Font name.
+ sal_uInt32 mnHeight; ///< Font height (1/10,000 points).
+ sal_uInt16 mnWeight; ///< Font weight (normal/bold).
+ sal_uInt16 mnCharSet; ///< Font charset.
+ sal_uInt8 mnFlags; ///< Font flags.
+
+ explicit StdFontInfo();
+ explicit StdFontInfo(
+ OUString aName,
+ sal_uInt32 nHeight );
+};
+
+
+/** Stores data about a StdHlink hyperlink. */
+struct StdHlinkInfo
+{
+ OUString maTarget;
+ OUString maLocation;
+ OUString maDisplay;
+};
+
+
+/** Static helper functions for OLE import/export. */
+namespace OleHelper
+{
+ /** Returns the UNO RGB color from the passed encoded OLE color.
+
+ @param bDefaultColorBgr
+ True = OLE default color type is treated as BGR color.
+ False = OLE default color type is treated as palette color.
+ */
+ OOX_DLLPUBLIC ::Color decodeOleColor(
+ const GraphicHelper& rGraphicHelper,
+ sal_uInt32 nOleColor,
+ bool bDefaultColorBgr );
+
+ /** Returns the OLE color from the passed UNO RGB color.
+ */
+ OOX_DLLPUBLIC sal_uInt32 encodeOleColor( sal_Int32 nRgbColor );
+ inline sal_uInt32 encodeOleColor( Color nRgbColor ) { return encodeOleColor(sal_Int32(nRgbColor)); }
+
+ /** Imports a GUID from the passed binary stream and returns its string
+ representation (in uppercase characters).
+ */
+ OOX_DLLPUBLIC OUString importGuid( BinaryInputStream& rInStrm );
+ OOX_DLLPUBLIC void exportGuid( BinaryOutputStream& rOutStrm, const SvGlobalName& rId );
+
+ /** Imports an OLE StdFont font structure from the current position of the
+ passed binary stream.
+ */
+ OOX_DLLPUBLIC bool importStdFont(
+ StdFontInfo& orFontInfo,
+ BinaryInputStream& rInStrm,
+ bool bWithGuid );
+
+ /** Imports an OLE StdPic picture from the current position of the passed
+ binary stream.
+ */
+ OOX_DLLPUBLIC bool importStdPic(
+ StreamDataSequence& orGraphicData,
+ BinaryInputStream& rInStrm );
+}
+
+class OOX_DLLPUBLIC OleFormCtrlExportHelper final
+{
+ std::unique_ptr<::oox::ole::EmbeddedControl> mpControl;
+ ::oox::ole::ControlModelBase* mpModel;
+ ::oox::GraphicHelper maGrfHelper;
+ css::uno::Reference< css::frame::XModel > mxDocModel;
+ css::uno::Reference< css::awt::XControlModel > mxControlModel;
+
+ OUString maName;
+ OUString maTypeName;
+ OUString maFullName;
+ OUString maGUID;
+public:
+ OleFormCtrlExportHelper( const css::uno::Reference< css::uno::XComponentContext >& rxCtx, const css::uno::Reference< css::frame::XModel >& xDocModel, const css::uno::Reference< css::awt::XControlModel >& xModel );
+ ~OleFormCtrlExportHelper();
+
+ std::u16string_view getGUID() const
+ {
+ std::u16string_view sResult;
+ if ( maGUID.getLength() > 2 )
+ sResult = maGUID.subView(1, maGUID.getLength() - 2 );
+ return sResult;
+ }
+ const OUString& getFullName() const { return maFullName; }
+ const OUString& getTypeName() const { return maTypeName; }
+ const OUString& getName() const { return maName; }
+ bool isValid() const { return mpModel != nullptr; }
+ void exportName( const css::uno::Reference< css::io::XOutputStream >& rxOut );
+ void exportCompObj( const css::uno::Reference< css::io::XOutputStream >& rxOut );
+ void exportControl( const css::uno::Reference< css::io::XOutputStream >& rxOut, const css::awt::Size& rSize, bool bAutoClose = false );
+};
+
+// ideally it would be great to get rid of SvxMSConvertOCXControls
+// however msfilter/source/msfilter/svdfppt.cxx still uses
+// SvxMSConvertOCXControls as a base class, unfortunately oox depends on
+// msfilter. Probably the solution would be to move the svdfppt.cxx
+// implementation into the sd module itself.
+class OOX_DLLPUBLIC MSConvertOCXControls : public SvxMSConvertOCXControls
+{
+ css::uno::Reference< css::uno::XComponentContext > mxCtx;
+ ::oox::GraphicHelper maGrfHelper;
+
+protected:
+ bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
+ css::uno::Reference< css::form::XFormComponent > & rxFormComp,
+ std::u16string_view rGuidString );
+ bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
+ css::uno::Reference< css::form::XFormComponent > & rxFormComp,
+ const OUString& rGuidString,
+ sal_Int32 nSize );
+public:
+ MSConvertOCXControls( const css::uno::Reference< css::frame::XModel >& rxModel );
+ virtual ~MSConvertOCXControls() override;
+ bool ReadOCXStorage( tools::SvRef<SotStorage> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp );
+ bool ReadOCXCtlsStream(tools::SvRef<SotStorageStream> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp,
+ sal_Int32 nPos, sal_Int32 nSize );
+ static bool WriteOCXStream( const css::uno::Reference< css::frame::XModel >& rxModel, tools::SvRef<SotStorage> const &rSrc1, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size& rSize,OUString &rName);
+ static bool WriteOCXExcelKludgeStream( const css::uno::Reference< css::frame::XModel >& rxModel, const css::uno::Reference< css::io::XOutputStream >& xOutStrm, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size& rSize,OUString &rName);
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/oleobjecthelper.hxx b/include/oox/ole/oleobjecthelper.hxx
new file mode 100644
index 0000000000..76ee9190a0
--- /dev/null
+++ b/include/oox/ole/oleobjecthelper.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_OLEOBJECTHELPER_HXX
+#define INCLUDED_OOX_OLE_OLEOBJECTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/binarystreambase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace awt { struct Size; }
+ namespace document { class XEmbeddedObjectResolver; }
+ namespace frame { class XModel; }
+ namespace lang { class XMultiServiceFactory; }
+}
+
+namespace oox { class PropertyMap; }
+
+namespace oox::ole {
+
+
+/** Contains generic information about an OLE object. */
+struct OleObjectInfo
+{
+ StreamDataSequence maEmbeddedData; ///< Data of an embedded OLE object.
+ OUString maTargetLink; ///< Path to external data for linked OLE object.
+ OUString maProgId;
+ bool mbLinked; ///< True = linked OLE object, false = embedded OLE object.
+ bool mbShowAsIcon; ///< True = show as icon, false = show contents.
+ bool mbAutoUpdate;
+ bool mbHasPicture; ///<Ole object requires a picture element according to spec.>
+
+ explicit OleObjectInfo();
+};
+
+
+/** Helper for OLE object handling. */
+class OleObjectHelper
+{
+public:
+ explicit OleObjectHelper(
+ const css::uno::Reference<css::lang::XMultiServiceFactory>& rxModelFactory,
+ css::uno::Reference<css::frame::XModel> xModel);
+ ~OleObjectHelper();
+
+ bool importOleObject(
+ PropertyMap& rPropMap,
+ const OleObjectInfo& rOleObject,
+ const css::awt::Size& rObjSize );
+
+private:
+ css::uno::Reference<css::frame::XModel> m_xModel;
+ css::uno::Reference< css::document::XEmbeddedObjectResolver > mxResolver;
+ sal_Int32 mnObjectId;
+};
+
+
+OOX_DLLPUBLIC void SaveInteropProperties(
+ css::uno::Reference<css::frame::XModel> const& xModel,
+ OUString const& rObjectName, OUString const* pOldObjectName,
+ OUString const& rProgId);
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/olestorage.hxx b/include/oox/ole/olestorage.hxx
new file mode 100644
index 0000000000..b7ac512f11
--- /dev/null
+++ b/include/oox/ole/olestorage.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_OLESTORAGE_HXX
+#define INCLUDED_OOX_OLE_OLESTORAGE_HXX
+
+#include <vector>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/storagebase.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star {
+ namespace container { class XNameContainer; }
+ namespace embed { class XStorage; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox::ole {
+
+
+/** Implements stream access for binary OLE storages. */
+class OOX_DLLPUBLIC OleStorage final : public StorageBase
+{
+public:
+ explicit OleStorage(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XInputStream >& rxInStream,
+ bool bBaseStreamAccess );
+
+ explicit OleStorage(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::io::XStream >& rxOutStream,
+ bool bBaseStreamAccess );
+
+ virtual ~OleStorage() override;
+
+private:
+ explicit OleStorage(
+ const OleStorage& rParentStorage,
+ const css::uno::Reference< css::container::XNameContainer >& rxStorage,
+ const OUString& rElementName,
+ bool bReadOnly );
+ explicit OleStorage(
+ const OleStorage& rParentStorage,
+ const css::uno::Reference< css::io::XStream >& rxOutStream,
+ const OUString& rElementName );
+
+ /** Initializes the API storage object for input. */
+ void initStorage( const css::uno::Reference< css::io::XInputStream >& rxInStream );
+ /** Initializes the API storage object for input/output. */
+ void initStorage( const css::uno::Reference< css::io::XStream >& rxOutStream );
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const override;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage.
+
+ @attention
+ This function is not implemented for binary OLE storages.
+ */
+ virtual css::uno::Reference< css::embed::XStorage >
+ implGetXStorage() const override;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const override;
+
+ /** Opens and returns the specified sub storage from the storage. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreateMissing ) override;
+
+ /** Opens and returns the specified input stream from the storage. */
+ virtual css::uno::Reference< css::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName ) override;
+
+ /** Opens and returns the specified output stream from the storage. */
+ virtual css::uno::Reference< css::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName ) override;
+
+ /** Commits the current storage. */
+ virtual void implCommit() const override;
+
+private:
+ css::uno::Reference< css::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ css::uno::Reference< css::container::XNameContainer >
+ mxStorage; ///< Access to elements of this sub storage.
+ const OleStorage* mpParentStorage; ///< Parent OLE storage that contains this storage.
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbacontrol.hxx b/include/oox/ole/vbacontrol.hxx
new file mode 100644
index 0000000000..c0afd6ae7e
--- /dev/null
+++ b/include/oox/ole/vbacontrol.hxx
@@ -0,0 +1,214 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBACONTROL_HXX
+#define INCLUDED_OOX_OLE_VBACONTROL_HXX
+
+#include <memory>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/helper/refvector.hxx>
+#include <oox/ole/axbinaryreader.hxx>
+#include <oox/ole/axcontrol.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace awt { class XControlModel; }
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+ class BinaryInputStream;
+ class GraphicHelper;
+ class PropertyMap;
+ class StorageBase;
+}
+
+namespace oox::ole {
+
+
+/** Common properties for all controls that are part of a VBA user form or of
+ another container control in a VBA user form. */
+class VbaSiteModel final
+{
+public:
+ explicit VbaSiteModel();
+ ~VbaSiteModel();
+
+ /** Allows to set single properties specified by XML token identifier. */
+ void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ /** Imports the site model data from the passed input stream. */
+ bool importBinaryModel( BinaryInputStream& rInStrm );
+ /** Moves the control relative to its current position by the passed distance. */
+ void moveRelative( const AxPairData& rDistance );
+
+ /** Returns the programmatical name of the control. */
+ const OUString& getName() const { return maName; }
+ /** Returns the position of the control in its parent. */
+ const AxPairData& getPosition() const { return maPos; }
+ /** Returns the unique identifier of this control. */
+ sal_Int32 getId() const { return mnId; }
+ /** Returns true, if this control is a container control. */
+ bool isContainer() const;
+ /** Returns the length of the stream data for stream based controls. */
+ sal_uInt32 getStreamLength() const;
+ /** Returns the name of the substorage for the container control data. */
+ OUString getSubStorageName() const;
+ /** Returns the tab index of the control. */
+ sal_Int16 getTabIndex() const { return mnTabIndex; }
+
+ /** Tries to create the control model according to the site model. */
+ ControlModelRef createControlModel( const AxClassTable& rClassTable ) const;
+ /** Converts all form site properties. */
+ void convertProperties(
+ PropertyMap& rPropMap,
+ const ControlConverter& rConv,
+ ApiControlType eCtrlType,
+ sal_Int32 nCtrlIndex ) const;
+ const OUString& getControlSource() const { return maControlSource; }
+ const OUString& getRowSource() const { return maRowSource; }
+private:
+ OUString maName; ///< Name of the control.
+ OUString maTag; ///< User defined tag.
+ OUString maToolTip; ///< Tool tip for the control.
+ OUString maControlSource; ///< Linked cell for the control value in a spreadsheet.
+ OUString maRowSource; ///< Source data for the control in a spreadsheet.
+
+ AxPairData maPos; ///< Position in parent container.
+ sal_Int32 mnId; ///< Control identifier.
+ sal_Int32 mnHelpContextId; ///< Help context identifier.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnStreamLen; ///< Size of control stream data.
+ sal_Int16 mnTabIndex; ///< Tab order index.
+ sal_uInt16 mnClassIdOrCache; ///< Class name identifier or GUID cache index.
+ sal_uInt16 mnGroupId; ///< Group identifier for grouped controls.
+};
+
+typedef std::shared_ptr< VbaSiteModel > VbaSiteModelRef;
+
+
+/** A control that is embedded in a VBA user form or in another container
+ control in a VBA user form.
+
+ The control may be a 'simple' control with its data stored in the 'o'
+ stream, or it may be a container control with its data stored in an own
+ substorage.
+ */
+class VbaFormControl
+{
+public:
+ explicit VbaFormControl();
+ virtual ~VbaFormControl();
+
+ /** Imports the model from the passed stream or storage, depending on the
+ control's type. Imports all embedded controls, if this is a container. */
+ void importModelOrStorage(
+ BinaryInputStream& rInStrm,
+ StorageBase& rStrg,
+ const AxClassTable& rClassTable );
+
+ /** Returns the programmatical name of the control. */
+ OUString getControlName() const;
+
+ /** Creates the UNO control model, inserts it into the passed container,
+ and converts all control properties. */
+ void createAndConvert(
+ sal_Int32 nCtrlIndex,
+ const css::uno::Reference< css::container::XNameContainer >& rxParentNC,
+ const ControlConverter& rConv ) const;
+
+protected:
+ /** Creates and imports the control model containing properties of the control. */
+ void importControlModel( BinaryInputStream& rInStrm, const AxClassTable& rClassTable );
+ /** Creates and imports the control model, and imports all embedded
+ controls from the passed substorage. */
+ void importStorage( StorageBase& rStrg, const AxClassTable& rClassTable );
+
+ /** Converts all control properties, and inserts and converts embedded controls. */
+ bool convertProperties(
+ const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv,
+ sal_Int32 nCtrlIndex ) const;
+
+private:
+ typedef RefVector< VbaFormControl > VbaFormControlVector;
+ typedef VbaFormControlVector::value_type VbaFormControlRef;
+
+ /** Creates the control model according to the current site model. */
+ void createControlModel( const AxClassTable& rClassTable );
+ /** Imports the site model data containing common properties of the control. */
+ bool importSiteModel( BinaryInputStream& rInStrm );
+
+ /** Imports the site models of all embedded controls from the 'f' stream. */
+ void importEmbeddedSiteModels( BinaryInputStream& rInStrm );
+ /* Final processing of all embedded controls after import. */
+ void finalizeEmbeddedControls();
+
+ /** Moves the control relative to its current position by the passed distance. */
+ void moveRelative( const AxPairData& rDistance );
+ /** Moves all embedded controls from their relative position in this
+ control to an absolute position in the parent of this control. */
+ void moveEmbeddedToAbsoluteParent();
+
+ /** Functor for comparing controls by their tab index. */
+ static bool compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight );
+
+protected:
+ VbaSiteModelRef mxSiteModel; ///< Common control properties.
+ ControlModelRef mxCtrlModel; ///< Specific control properties.
+
+private:
+ VbaFormControlVector maControls; ///< All embedded form controls.
+ AxClassTable maClassTable; ///< Class identifiers for exotic embedded controls.
+};
+
+
+class VbaUserForm final : public VbaFormControl
+{
+public:
+ explicit VbaUserForm(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr );
+
+ /** Imports the form and its embedded controls, and inserts the form with
+ all its controls into the passed dialog library. */
+ void importForm(
+ const css::uno::Reference< css::container::XNameContainer >& rxDialogLib,
+ StorageBase& rVbaFormStrg,
+ const OUString& rModuleName,
+ rtl_TextEncoding eTextEnc );
+
+private:
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::frame::XModel > mxDocModel;
+ ControlConverter maConverter;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbaexport.hxx b/include/oox/ole/vbaexport.hxx
new file mode 100644
index 0000000000..a8c763c555
--- /dev/null
+++ b/include/oox/ole/vbaexport.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAEXPORT_HXX
+#define INCLUDED_OOX_OLE_VBAEXPORT_HXX
+
+#include <cstddef>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+class SotStorage;
+class SvStream;
+class SvMemoryStream;
+
+namespace com::sun::star {
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+ namespace script { class XLibraryContainer; }
+}
+
+class OOX_DLLPUBLIC VbaExport
+{
+public:
+ VbaExport(css::uno::Reference<css::frame::XModel> xModel);
+
+ void exportVBA(SotStorage* pRootStorage);
+
+ bool containsVBAProject();
+
+private:
+
+ css::uno::Reference<css::container::XNameContainer>
+ getBasicLibrary() const;
+
+ css::uno::Reference<css::script::XLibraryContainer>
+ getLibraryContainer() const;
+
+ OUString getProjectName() const;
+ rtl_TextEncoding getVBATextEncoding() const;
+
+ css::uno::Reference<css::frame::XModel> mxModel;
+};
+
+class VBACompressionChunk
+{
+public:
+
+ VBACompressionChunk(SvStream& rCompressedStream, const sal_uInt8* pData, std::size_t nChunkSize);
+
+ void write();
+
+private:
+ SvStream& mrCompressedStream;
+ const sal_uInt8* mpUncompressedData;
+ sal_uInt8* mpCompressedChunkStream;
+
+ // same as DecompressedChunkEnd in the spec
+ std::size_t mnChunkSize;
+
+ // CompressedCurrent according to the spec
+ sal_uInt64 mnCompressedCurrent;
+
+ // CompressedEnd according to the spec
+ sal_uInt64 mnCompressedEnd;
+
+ // DecompressedCurrent according to the spec
+ sal_uInt64 mnDecompressedCurrent;
+
+ // DecompressedEnd according to the spec
+ sal_uInt64 mnDecompressedEnd;
+
+ static void PackCompressedChunkSize(size_t nSize, sal_uInt16& rHeader);
+
+ static void PackCompressedChunkFlag(bool bCompressed, sal_uInt16& rHeader);
+
+ static void PackCompressedChunkSignature(sal_uInt16& rHeader);
+
+ void compressTokenSequence();
+
+ void compressToken(size_t index, sal_uInt8& nFlagByte);
+
+ static void SetFlagBit(size_t index, bool bVal, sal_uInt8& rFlag);
+
+ sal_uInt16 CopyToken(size_t nLength, size_t nOffset);
+
+ void match(size_t& rLength, size_t& rOffset);
+
+ void CopyTokenHelp(sal_uInt16& rLengthMask, sal_uInt16& rOffsetMask,
+ sal_uInt16& rBitCount, sal_uInt16& rMaximumLength);
+
+ void writeRawChunk();
+
+ sal_uInt16 handleHeader(bool bCompressed);
+};
+
+class OOX_DLLPUBLIC VBACompression
+{
+public:
+ VBACompression(SvStream& rCompressedStream,
+ SvMemoryStream& rUncompressedStream);
+
+ void write();
+
+private:
+ SvStream& mrCompressedStream;
+ SvMemoryStream& mrUncompressedStream;
+};
+
+class OOX_DLLPUBLIC VBAEncryption
+{
+public:
+ VBAEncryption(const sal_uInt8* pData,
+ const sal_uInt16 nLength,
+ SvStream& rEncryptedData,
+ sal_uInt8 nProjKey,
+ rtl_TextEncoding eTextEncoding);
+
+ void write();
+
+ static sal_uInt8 calculateProjKey(const OUString& rString);
+
+private:
+ const sal_uInt8* mpData; // an array of bytes to be obfuscated
+ const sal_uInt16 mnLength; // the length of Data
+ SvStream& mrEncryptedData; // Encrypted Data Structure
+ sal_uInt8 mnUnencryptedByte1; // the last unencrypted byte read or written
+ sal_uInt8 mnEncryptedByte1; // the last encrypted byte read or written
+ sal_uInt8 mnEncryptedByte2; // the next-to-last encrypted byte read or written
+ sal_Unicode mnProjKey; // a project-specific encryption key
+ sal_uInt8 mnIgnoredLength; // the length in bytes of IgnoredEnc
+
+ sal_uInt8 mnSeed; // the seed value
+ sal_uInt8 mnVersionEnc; // the version encoding
+ rtl_TextEncoding meTextEncoding; // the VBA text encoding on export
+
+ void writeSeed();
+ void writeVersionEnc();
+ void writeProjKeyEnc();
+ void writeIgnoredEnc();
+ void writeDataLengthEnc();
+ void writeDataEnc();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbahelper.hxx b/include/oox/ole/vbahelper.hxx
new file mode 100644
index 0000000000..248d09810d
--- /dev/null
+++ b/include/oox/ole/vbahelper.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAHELPER_HXX
+#define INCLUDED_OOX_OLE_VBAHELPER_HXX
+
+#include <oox/helper/binarystreambase.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace oox { class BinaryInputStream; }
+
+namespace oox::ole {
+
+// Directory stream record identifiers ========================================
+
+const sal_uInt16 VBA_ID_MODULECOOKIE = 0x002C;
+const sal_uInt16 VBA_ID_MODULEDOCSTRING = 0x001C;
+const sal_uInt16 VBA_ID_MODULEDOCSTRINGUNICODE = 0x0048;
+const sal_uInt16 VBA_ID_MODULEEND = 0x002B;
+const sal_uInt16 VBA_ID_MODULEHELPCONTEXT = 0x001E;
+const sal_uInt16 VBA_ID_MODULENAME = 0x0019;
+const sal_uInt16 VBA_ID_MODULENAMEUNICODE = 0x0047;
+const sal_uInt16 VBA_ID_MODULEOFFSET = 0x0031;
+const sal_uInt16 VBA_ID_MODULEPRIVATE = 0x0028;
+const sal_uInt16 VBA_ID_MODULEREADONLY = 0x0025;
+const sal_uInt16 VBA_ID_MODULESTREAMNAME = 0x001A;
+const sal_uInt16 VBA_ID_MODULESTREAMNAMEUNICODE = 0x0032;
+const sal_uInt16 VBA_ID_MODULETYPEDOCUMENT = 0x0022;
+const sal_uInt16 VBA_ID_MODULETYPEPROCEDURAL = 0x0021;
+const sal_uInt16 VBA_ID_PROJECTCODEPAGE = 0x0003;
+const sal_uInt16 VBA_ID_PROJECTEND = 0x0010;
+const sal_uInt16 VBA_ID_PROJECTMODULES = 0x000F;
+const sal_uInt16 VBA_ID_PROJECTNAME = 0x0004;
+const sal_uInt16 VBA_ID_PROJECTVERSION = 0x0009;
+
+
+/** Static helper functions for the VBA filters. */
+namespace VbaHelper
+{
+ /** Reads the next record from the VBA directory stream 'dir'.
+
+ @param rnRecId (out parameter) The record identifier of the new record.
+ @param rRecData (out parameter) The contents of the new record.
+ @param rInStrm The 'dir' stream.
+
+ @return True = next record successfully read. False on any error, or
+ if the stream is EOF.
+ */
+ bool readDirRecord(
+ sal_uInt16& rnRecId,
+ StreamDataSequence& rRecData,
+ BinaryInputStream& rInStrm );
+
+ /** Extracts a key/value pair from a string separated by an equality sign.
+
+ @param rKey (out parameter) The key before the separator.
+ @param rValue (out parameter) The value following the separator.
+ @param rCodeLine The source key/value pair.
+
+ @return True = Equality sign separator found, and the returned key and
+ value are not empty. False otherwise.
+ */
+ bool extractKeyValue(
+ OUString& rKey,
+ OUString& rValue,
+ std::u16string_view rKeyValue );
+}
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbainputstream.hxx b/include/oox/ole/vbainputstream.hxx
new file mode 100644
index 0000000000..4f2f78d815
--- /dev/null
+++ b/include/oox/ole/vbainputstream.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAINPUTSTREAM_HXX
+#define INCLUDED_OOX_OLE_VBAINPUTSTREAM_HXX
+
+#include <cstddef>
+#include <vector>
+
+#include <oox/helper/binaryinputstream.hxx>
+#include <oox/helper/binarystreambase.hxx>
+#include <sal/types.h>
+
+namespace oox::ole {
+
+
+/** A non-seekable input stream that implements run-length decompression. */
+class VbaInputStream final : public BinaryInputStream
+{
+public:
+ explicit VbaInputStream( BinaryInputStream& rInStrm );
+
+ /** Returns -1, stream size is not determinable. */
+ virtual sal_Int64 size() const override;
+ /** Returns -1, stream position is not tracked. */
+ virtual sal_Int64 tell() const override;
+ /** Does nothing, stream is not seekable. */
+ virtual void seek( sal_Int64 nPos ) override;
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close() override;
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+ /** Seeks the stream forward by the passed number of bytes. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
+
+private:
+ /** If no data left in chunk buffer, reads the next chunk from stream. */
+ bool updateChunk();
+
+private:
+ typedef ::std::vector< sal_uInt8 > ChunkBuffer;
+
+ BinaryInputStream* mpInStrm;
+ ChunkBuffer maChunk;
+ size_t mnChunkPos;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbamodule.hxx b/include/oox/ole/vbamodule.hxx
new file mode 100644
index 0000000000..64a1ec04e7
--- /dev/null
+++ b/include/oox/ole/vbamodule.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAMODULE_HXX
+#define INCLUDED_OOX_OLE_VBAMODULE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vector>
+
+namespace com::sun::star {
+ namespace container { class XNameAccess; }
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace oox {
+ class BinaryInputStream;
+ class StorageBase;
+}
+
+namespace oox::ole {
+
+/** Stores, which key shortcut maps to which VBA macro method. */
+struct VbaMacroKeyAndMethodBinding
+{
+ // This describes a key combination in "raw" VBA Macro form, that
+ // still needs translated to a key event that can be used in
+ // LibreOffice.
+ OUString msApiKey;
+ // The name of the macro method
+ OUString msMethodName;
+};
+
+class VbaModule
+{
+public:
+ explicit VbaModule(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ OUString aName,
+ rtl_TextEncoding eTextEnc,
+ bool bExecutable );
+
+ /** Returns the module type (com.sun.star.script.ModuleType constant). */
+ sal_Int32 getType() const { return mnType; }
+ /** Sets the passed module type. */
+ void setType( sal_Int32 nType ) { mnType = nType; }
+
+ /** Returns the name of the module. */
+ const OUString& getName() const { return maName; }
+ /** Returns the stream name of the module. */
+ const OUString& getStreamName() const { return maStreamName; }
+
+ /** Imports all records for this module until the MODULEEND record. */
+ void importDirRecords( BinaryInputStream& rDirStrm );
+
+ /** Imports the VBA source code into the passed Basic library. */
+ void createAndImportModule(
+ StorageBase& rVbaStrg,
+ const css::uno::Reference< css::container::XNameContainer >& rxBasicLib,
+ const css::uno::Reference< css::container::XNameAccess >& rxDocObjectNA );
+ /** Creates an empty Basic module in the passed Basic library. */
+ void createEmptyModule(
+ const css::uno::Reference< css::container::XNameContainer >& rxBasicLib,
+ const css::uno::Reference< css::container::XNameAccess >& rxDocObjectNA ) const;
+
+ void registerShortcutKeys();
+
+private:
+ /** Reads and returns the VBA source code from the passed storage. */
+ OUString readSourceCode( StorageBase& rVbaStrg );
+
+ /** Creates a new Basic module and inserts it into the passed Basic library. */
+ void createModule(
+ std::u16string_view rVBASourceCode,
+ const css::uno::Reference< css::container::XNameContainer >& rxBasicLib,
+ const css::uno::Reference< css::container::XNameAccess >& rxDocObjectNA ) const;
+
+private:
+ css::uno::Reference< css::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ css::uno::Reference< css::frame::XModel >
+ mxDocModel; ///< Document model used to import/export the VBA project.
+ OUString maName;
+ OUString maStreamName;
+ OUString maDocString;
+ rtl_TextEncoding meTextEnc;
+ sal_Int32 mnType;
+ sal_uInt32 mnOffset;
+ bool mbReadOnly;
+ bool mbPrivate;
+ bool mbExecutable;
+
+ /** Keys and VBA macro method bindings */
+ std::vector<VbaMacroKeyAndMethodBinding> maKeyBindings;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbaproject.hxx b/include/oox/ole/vbaproject.hxx
new file mode 100644
index 0000000000..a5a239ab03
--- /dev/null
+++ b/include/oox/ole/vbaproject.hxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_OLE_VBAPROJECT_HXX
+#define INCLUDED_OOX_OLE_VBAPROJECT_HXX
+
+#include <functional>
+#include <map>
+#include <string_view>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+#include <oox/helper/refmap.hxx>
+#include <oox/helper/refvector.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+ namespace script { class XLibraryContainer; }
+ namespace script::vba { class XVBAMacroResolver; }
+ namespace uno { class XComponentContext; }
+ namespace uno { class XInterface; }
+ namespace io { class XInputStream; }
+}
+
+namespace oox {
+ class GraphicHelper;
+ class StorageBase;
+}
+
+namespace oox::ole {
+
+class VbaModule;
+
+class VbaFilterConfig
+{
+public:
+ explicit VbaFilterConfig(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ std::u16string_view rConfigCompName );
+ ~VbaFilterConfig();
+
+ /** Returns true, if the VBA source code and forms should be imported. */
+ bool isImportVba() const;
+ /** Returns true, if the VBA source code should be imported executable. */
+ bool isImportVbaExecutable() const;
+ /** Returns true, if the VBA source code and forms should be exported. */
+ bool isExportVba() const;
+
+private:
+ css::uno::Reference< css::uno::XInterface >
+ mxConfigAccess;
+};
+
+
+/** Base class for objects that attach a macro to a specific action.
+
+ Purpose is to collect objects that need to attach a VBA macro to an action.
+ The VBA project will be loaded at a very late point of the document import
+ process, because it depends on an initialized core document model (e.g.
+ spreadsheet codenames). Some objects that want to attach a VBA macro to an
+ action (e.g. mouse click action for drawing shapes) are loaded long before
+ the VBA project. The drawback is that in most cases macros are specified
+ without module name, or the VBA project name is part of the macro name.
+ In the former case, all code modules have to be scanned for the macro to be
+ able to create a valid script URL.
+
+ The import code will register these requests to attach a VBA macro with an
+ instance of a class derived from this base class. The derived class will
+ store all information needed to finally attach the macro to the action,
+ once the VBA project has been imported.
+ */
+class OOX_DLLPUBLIC VbaMacroAttacherBase
+{
+public:
+ explicit VbaMacroAttacherBase( OUString aMacroName );
+ virtual ~VbaMacroAttacherBase();
+
+ /** Resolves the internal macro name to the related macro URL, and attaches
+ the macro to the object. */
+ void resolveAndAttachMacro(
+ const css::uno::Reference< css::script::vba::XVBAMacroResolver >& rxResolver );
+
+private:
+ /** Called after the VBA project has been imported. Derived classes will
+ attach the passed script to the object represented by this instance. */
+ virtual void attachMacro( const OUString& rScriptUrl ) = 0;
+
+private:
+ OUString maMacroName;
+};
+
+typedef std::shared_ptr< VbaMacroAttacherBase > VbaMacroAttacherRef;
+
+
+class OOX_DLLPUBLIC VbaProject : public VbaFilterConfig
+{
+public:
+ explicit VbaProject(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XModel >& rxDocModel,
+ std::u16string_view rConfigCompName );
+ virtual ~VbaProject();
+
+ /** Imports the entire VBA project from the passed storage.
+
+ @param rVbaPrjStrg The root storage of the entire VBA project.
+ */
+ void importVbaProject(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper );
+
+ bool importVbaProject(
+ StorageBase& rVbaPrjStrg );
+
+ /// Imports VBA data for a VBA project, e.g. word/vbaData.xml.
+ void importVbaData(const css::uno::Reference<css::io::XInputStream>& xInputStream);
+
+ /** Reads vba module related information from the project streams */
+ void readVbaModules( StorageBase& rVbaPrjStrg );
+ /** Imports (and creates) vba modules and user forms from the vba project records previously read.
+ Note: ( expects that readVbaModules was already called ) */
+ void importModulesAndForms( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper );
+ /** Registers a macro attacher object. For details, see description of the
+ VbaMacroAttacherBase class. */
+ void registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher );
+
+ /** Attaches VBA macros to objects registered via registerMacroAttacher(). */
+ void attachMacros();
+
+ void setOleOverridesSink( css::uno::Reference< css::container::XNameContainer > const & rxOleOverridesSink ){ mxOleOverridesSink = rxOleOverridesSink; }
+
+protected:
+ /** Registers a dummy module that will be created when the VBA project is
+ imported. */
+ void addDummyModule( const OUString& rName, sal_Int32 nType );
+
+ /** Called when the import process of the VBA project has been started. */
+ virtual void prepareImport();
+
+private:
+ VbaProject( const VbaProject& ) = delete;
+ VbaProject& operator=( const VbaProject& ) = delete;
+
+ /** Returns the Basic or dialog library container. */
+ css::uno::Reference< css::script::XLibraryContainer >
+ getLibraryContainer( sal_Int32 nPropId );
+ /** Opens a Basic or dialog library, creates missing if not found. */
+ css::uno::Reference< css::container::XNameContainer >
+ openLibrary( sal_Int32 nPropId );
+ /** Creates and returns the Basic library of the document used for import. */
+ css::uno::Reference< css::container::XNameContainer > const &
+ createBasicLibrary();
+ /** Creates and returns the dialog library of the document used for import. */
+ css::uno::Reference< css::container::XNameContainer > const &
+ createDialogLibrary();
+
+ /** Imports the VBA code modules and forms. */
+ void importVba(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper );
+
+ /** Copies the entire VBA project storage to the passed document model. */
+ void copyStorage( StorageBase& rVbaPrjStrg );
+
+private:
+ typedef RefVector< VbaMacroAttacherBase > MacroAttacherVector;
+ typedef ::std::map< OUString, sal_Int32 > DummyModuleMap;
+
+ css::uno::Reference< css::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ css::uno::Reference< css::frame::XModel >
+ mxDocModel; ///< Document model used to import/export the VBA project.
+ css::uno::Reference< css::container::XNameContainer >
+ mxBasicLib; ///< The Basic library of the document used for import.
+ css::uno::Reference< css::container::XNameContainer >
+ mxDialogLib; ///< The dialog library of the document used for import.
+ MacroAttacherVector maMacroAttachers; ///< Objects that want to attach a VBA macro to an action.
+ DummyModuleMap maDummyModules; ///< Additional empty modules created on import.
+ OUString maPrjName; ///< Name of the VBA project.
+ css::uno::Reference< css::container::XNameContainer >
+ mxOleOverridesSink;
+ typedef RefMap< OUString, VbaModule > VbaModuleMap;
+ VbaModuleMap maModules;
+ VbaModuleMap maModulesByStrm;
+};
+
+
+} // namespace oox::ole
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */