summaryrefslogtreecommitdiff
path: root/include/oox
diff options
context:
space:
mode:
Diffstat (limited to 'include/oox')
-rw-r--r--include/oox/core/binarycodec.hxx316
-rw-r--r--include/oox/core/contexthandler.hxx117
-rw-r--r--include/oox/core/contexthandler2.hxx272
-rw-r--r--include/oox/core/fastparser.hxx97
-rw-r--r--include/oox/core/fasttokenhandler.hxx67
-rw-r--r--include/oox/core/filterbase.hxx293
-rw-r--r--include/oox/core/filterdetect.hxx162
-rw-r--r--include/oox/core/fragmenthandler.hxx131
-rw-r--r--include/oox/core/fragmenthandler2.hxx121
-rw-r--r--include/oox/core/recordparser.hxx90
-rw-r--r--include/oox/core/relations.hxx103
-rw-r--r--include/oox/core/relationshandler.hxx54
-rw-r--r--include/oox/core/xmlfilterbase.hxx256
-rw-r--r--include/oox/dllapi.h33
-rw-r--r--include/oox/drawingml/chart/axiscontext.hxx120
-rw-r--r--include/oox/drawingml/chart/axisconverter.hxx64
-rw-r--r--include/oox/drawingml/chart/axismodel.hxx105
-rw-r--r--include/oox/drawingml/chart/chartcontextbase.hxx95
-rw-r--r--include/oox/drawingml/chart/chartconverter.hxx104
-rw-r--r--include/oox/drawingml/chart/chartdrawingfragment.hxx115
-rw-r--r--include/oox/drawingml/chart/chartspaceconverter.hxx57
-rw-r--r--include/oox/drawingml/chart/chartspacefragment.hxx55
-rw-r--r--include/oox/drawingml/chart/chartspacemodel.hxx72
-rw-r--r--include/oox/drawingml/chart/converterbase.hxx153
-rw-r--r--include/oox/drawingml/chart/datasourcecontext.hxx94
-rw-r--r--include/oox/drawingml/chart/datasourceconverter.hxx71
-rw-r--r--include/oox/drawingml/chart/datasourcemodel.hxx65
-rw-r--r--include/oox/drawingml/chart/modelbase.hxx134
-rw-r--r--include/oox/drawingml/chart/objectformatter.hxx157
-rw-r--r--include/oox/drawingml/chart/plotareacontext.hxx83
-rw-r--r--include/oox/drawingml/chart/plotareaconverter.hxx103
-rw-r--r--include/oox/drawingml/chart/plotareamodel.hxx87
-rw-r--r--include/oox/drawingml/chart/seriescontext.hxx266
-rw-r--r--include/oox/drawingml/chart/seriesconverter.hxx167
-rw-r--r--include/oox/drawingml/chart/seriesmodel.hxx237
-rw-r--r--include/oox/drawingml/chart/titlecontext.hxx83
-rw-r--r--include/oox/drawingml/chart/titleconverter.hxx106
-rw-r--r--include/oox/drawingml/chart/titlemodel.hxx89
-rw-r--r--include/oox/drawingml/chart/typegroupcontext.hxx164
-rw-r--r--include/oox/drawingml/chart/typegroupconverter.hxx198
-rw-r--r--include/oox/drawingml/chart/typegroupmodel.hxx96
-rw-r--r--include/oox/drawingml/clrscheme.hxx62
-rw-r--r--include/oox/drawingml/clrschemecontext.hxx62
-rw-r--r--include/oox/drawingml/color.hxx144
-rw-r--r--include/oox/drawingml/colorchoicecontext.hxx80
-rw-r--r--include/oox/drawingml/connectorshapecontext.hxx41
-rw-r--r--include/oox/drawingml/customshapegeometry.hxx71
-rw-r--r--include/oox/drawingml/customshapeproperties.hxx189
-rw-r--r--include/oox/drawingml/diagram/diagram.hxx58
-rw-r--r--include/oox/drawingml/drawingmltypes.hxx200
-rw-r--r--include/oox/drawingml/effectproperties.hxx53
-rw-r--r--include/oox/drawingml/effectpropertiescontext.hxx41
-rw-r--r--include/oox/drawingml/embeddedwavaudiofile.hxx51
-rw-r--r--include/oox/drawingml/fillproperties.hxx152
-rw-r--r--include/oox/drawingml/fillpropertiesgroupcontext.hxx208
-rw-r--r--include/oox/drawingml/graphicshapecontext.hxx110
-rw-r--r--include/oox/drawingml/guidcontext.hxx43
-rw-r--r--include/oox/drawingml/lineproperties.hxx74
-rw-r--r--include/oox/drawingml/linepropertiescontext.hxx52
-rw-r--r--include/oox/drawingml/objectdefaultcontext.hxx43
-rw-r--r--include/oox/drawingml/scene3dcontext.hxx47
-rw-r--r--include/oox/drawingml/shape.hxx273
-rw-r--r--include/oox/drawingml/shape3dproperties.hxx125
-rw-r--r--include/oox/drawingml/shapecontext.hxx53
-rw-r--r--include/oox/drawingml/shapegroupcontext.hxx46
-rw-r--r--include/oox/drawingml/shapepropertiescontext.hxx43
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx147
-rw-r--r--include/oox/drawingml/shapestylecontext.hxx45
-rw-r--r--include/oox/drawingml/spdefcontext.hxx42
-rw-r--r--include/oox/drawingml/table/tablebackgroundstylecontext.hxx47
-rw-r--r--include/oox/drawingml/table/tablecell.hxx115
-rw-r--r--include/oox/drawingml/table/tablecellcontext.hxx48
-rw-r--r--include/oox/drawingml/table/tablecontext.hxx48
-rw-r--r--include/oox/drawingml/table/tablepartstylecontext.hxx47
-rw-r--r--include/oox/drawingml/table/tableproperties.hxx80
-rw-r--r--include/oox/drawingml/table/tablerow.hxx49
-rw-r--r--include/oox/drawingml/table/tablerowcontext.hxx49
-rw-r--r--include/oox/drawingml/table/tablestyle.hxx85
-rw-r--r--include/oox/drawingml/table/tablestylecellstylecontext.hxx48
-rw-r--r--include/oox/drawingml/table/tablestylecontext.hxx49
-rw-r--r--include/oox/drawingml/table/tablestylelist.hxx54
-rw-r--r--include/oox/drawingml/table/tablestylelistfragmenthandler.hxx56
-rw-r--r--include/oox/drawingml/table/tablestylepart.hxx73
-rw-r--r--include/oox/drawingml/table/tablestyletextstylecontext.hxx49
-rw-r--r--include/oox/drawingml/textbody.hxx73
-rw-r--r--include/oox/drawingml/textbodycontext.hxx63
-rw-r--r--include/oox/drawingml/textbodyproperties.hxx56
-rw-r--r--include/oox/drawingml/textbodypropertiescontext.hxx47
-rw-r--r--include/oox/drawingml/textcharacterproperties.hxx84
-rw-r--r--include/oox/drawingml/textcharacterpropertiescontext.hxx48
-rw-r--r--include/oox/drawingml/textfield.hxx62
-rw-r--r--include/oox/drawingml/textfieldcontext.hxx52
-rw-r--r--include/oox/drawingml/textfont.hxx73
-rw-r--r--include/oox/drawingml/textliststyle.hxx61
-rw-r--r--include/oox/drawingml/textliststylecontext.hxx45
-rw-r--r--include/oox/drawingml/textparagraph.hxx73
-rw-r--r--include/oox/drawingml/textparagraphproperties.hxx128
-rw-r--r--include/oox/drawingml/textparagraphpropertiescontext.hxx58
-rw-r--r--include/oox/drawingml/textrun.hxx62
-rw-r--r--include/oox/drawingml/textspacing.hxx69
-rw-r--r--include/oox/drawingml/theme.hxx116
-rw-r--r--include/oox/drawingml/themeelementscontext.hxx51
-rw-r--r--include/oox/drawingml/themefragmenthandler.hxx55
-rw-r--r--include/oox/drawingml/transform2dcontext.hxx52
-rw-r--r--include/oox/dump/dffdumper.hxx70
-rw-r--r--include/oox/dump/dumperbase.hxx1871
-rw-r--r--include/oox/dump/oledumper.hxx905
-rw-r--r--include/oox/dump/pptxdumper.hxx71
-rw-r--r--include/oox/dump/xlsbdumper.hxx136
-rw-r--r--include/oox/export/chartexport.hxx204
-rw-r--r--include/oox/export/drawingml.hxx160
-rw-r--r--include/oox/export/shapes.hxx170
-rw-r--r--include/oox/export/utils.hxx59
-rw-r--r--include/oox/export/vmlexport.hxx132
-rw-r--r--include/oox/helper/attributelist.hxx170
-rw-r--r--include/oox/helper/binaryinputstream.hxx438
-rw-r--r--include/oox/helper/binaryoutputstream.hxx189
-rw-r--r--include/oox/helper/binarystreambase.hxx187
-rw-r--r--include/oox/helper/containerhelper.hxx410
-rw-r--r--include/oox/helper/graphichelper.hxx168
-rw-r--r--include/oox/helper/helper.hxx334
-rw-r--r--include/oox/helper/modelobjecthelper.hxx125
-rw-r--r--include/oox/helper/progressbar.hxx138
-rw-r--r--include/oox/helper/propertymap.hxx111
-rw-r--r--include/oox/helper/propertyset.hxx146
-rw-r--r--include/oox/helper/refmap.hxx185
-rw-r--r--include/oox/helper/refvector.hxx195
-rw-r--r--include/oox/helper/storagebase.hxx191
-rw-r--r--include/oox/helper/textinputstream.hxx122
-rw-r--r--include/oox/helper/zipstorage.hxx88
-rw-r--r--include/oox/mathml/export.hxx40
-rw-r--r--include/oox/mathml/import.hxx46
-rw-r--r--include/oox/mathml/importutils.hxx254
-rw-r--r--include/oox/ole/axbinaryreader.hxx257
-rw-r--r--include/oox/ole/axbinarywriter.hxx194
-rw-r--r--include/oox/ole/axcontrol.hxx1031
-rw-r--r--include/oox/ole/axcontrolfragment.hxx74
-rw-r--r--include/oox/ole/axfontdata.hxx81
-rw-r--r--include/oox/ole/olehelper.hxx203
-rw-r--r--include/oox/ole/oleobjecthelper.hxx79
-rw-r--r--include/oox/ole/olestorage.hxx110
-rw-r--r--include/oox/ole/vbacontrol.hxx205
-rw-r--r--include/oox/ole/vbahelper.hxx98
-rw-r--r--include/oox/ole/vbainputstream.hxx74
-rw-r--r--include/oox/ole/vbamodule.hxx109
-rw-r--r--include/oox/ole/vbaproject.hxx206
-rw-r--r--include/oox/ppt/animationspersist.hxx126
-rw-r--r--include/oox/ppt/backgroundproperties.hxx44
-rw-r--r--include/oox/ppt/comments.hxx139
-rw-r--r--include/oox/ppt/customshowlistcontext.hxx53
-rw-r--r--include/oox/ppt/dgmimport.hxx62
-rw-r--r--include/oox/ppt/dgmlayout.hxx63
-rw-r--r--include/oox/ppt/headerfooter.hxx45
-rw-r--r--include/oox/ppt/layoutfragmenthandler.hxx42
-rw-r--r--include/oox/ppt/pptgraphicshapecontext.hxx40
-rw-r--r--include/oox/ppt/pptimport.hxx91
-rw-r--r--include/oox/ppt/pptshape.hxx73
-rw-r--r--include/oox/ppt/pptshapecontext.hxx40
-rw-r--r--include/oox/ppt/pptshapegroupcontext.hxx56
-rw-r--r--include/oox/ppt/pptshapepropertiescontext.hxx40
-rw-r--r--include/oox/ppt/presentationfragmenthandler.hxx72
-rw-r--r--include/oox/ppt/slidefragmenthandler.hxx60
-rw-r--r--include/oox/ppt/slidemastertextstylescontext.hxx45
-rw-r--r--include/oox/ppt/slidepersist.hxx161
-rw-r--r--include/oox/ppt/slidetimingcontext.hxx48
-rw-r--r--include/oox/ppt/slidetransition.hxx72
-rw-r--r--include/oox/ppt/slidetransitioncontext.hxx52
-rw-r--r--include/oox/ppt/soundactioncontext.hxx55
-rw-r--r--include/oox/ppt/timenode.hxx128
-rw-r--r--include/oox/ppt/timenodelistcontext.hxx65
-rw-r--r--include/oox/token/namespacemap.hxx43
-rw-r--r--include/oox/token/propertynames.hxx43
-rw-r--r--include/oox/token/tokenmap.hxx73
-rw-r--r--include/oox/vml/vmldrawing.hxx213
-rw-r--r--include/oox/vml/vmldrawingfragment.hxx60
-rw-r--r--include/oox/vml/vmlformatting.hxx248
-rw-r--r--include/oox/vml/vmlinputstream.hxx98
-rw-r--r--include/oox/vml/vmlshape.hxx439
-rw-r--r--include/oox/vml/vmlshapecontainer.hxx153
-rw-r--r--include/oox/vml/vmlshapecontext.hxx188
-rw-r--r--include/oox/vml/vmltextbox.hxx104
-rw-r--r--include/oox/vml/vmltextboxcontext.hxx78
182 files changed, 23480 insertions, 0 deletions
diff --git a/include/oox/core/binarycodec.hxx b/include/oox/core/binarycodec.hxx
new file mode 100644
index 000000000000..64b06d4244ef
--- /dev/null
+++ b/include/oox/core/binarycodec.hxx
@@ -0,0 +1,316 @@
+/* -*- 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 OOX_CORE_BINARYCODEC_HXX
+#define OOX_CORE_BINARYCODEC_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <rtl/cipher.h>
+#include <rtl/digest.h>
+#include "oox/dllapi.h"
+
+namespace oox { class AttributeList; }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC CodecHelper
+{
+public:
+ /** Returns the password hash if it is in the required 16-bit limit. */
+ static sal_uInt16 getPasswordHash( const AttributeList& rAttribs, sal_Int32 nElement );
+
+private:
+ CodecHelper();
+ ~CodecHelper();
+};
+
+// ============================================================================
+
+/** Encodes and decodes data from/to protected MS Office documents.
+
+ Implements a simple XOR encoding/decoding algorithm used in MS Office
+ versions up to MSO 95.
+ */
+class OOX_DLLPUBLIC BinaryCodec_XOR
+{
+public:
+ /** Enumerates codec types supported by this XOR codec implementation. */
+ enum CodecType
+ {
+ CODEC_WORD, ///< MS Word XOR codec.
+ CODEC_EXCEL ///< MS Excel XOR codec.
+ };
+
+public:
+ /** Default constructor.
+
+ Two-step construction in conjunction with the initKey() and verifyKey()
+ functions allows to try to initialize with different passwords (e.g.
+ built-in default password used for Excel workbook protection).
+ */
+ explicit BinaryCodec_XOR( CodecType eCodecType );
+
+ ~BinaryCodec_XOR();
+
+ /** Initializes the algorithm with the specified password.
+
+ @param pnPassData
+ Character array containing the password. Must be zero terminated,
+ which results in a maximum length of 15 characters.
+ */
+ void initKey( const sal_uInt8 pnPassData[ 16 ] );
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool initCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getEncryptionData();
+
+ /** Verifies the validity of the password using the passed key and hash.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nKey
+ Password key value read from the file.
+ @param nHash
+ Password hash value read from the file.
+
+ @return
+ True = test was successful.
+ */
+ bool verifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const;
+
+ /** Reinitializes the codec to start a new memory block.
+
+ Resets the internal key offset to 0.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+ */
+ void startBlock();
+
+ /** Decodes a block of memory.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param pnDestData
+ Destination buffer. Will contain the decrypted data afterwards.
+ @param pnSrcData
+ Encrypted data block.
+ @param nBytes
+ Size of the passed data blocks. pnDestData and pnSrcData must be of
+ this size.
+
+ @return
+ True = decoding was successful (no error occurred).
+ */
+ bool decode(
+ sal_uInt8* pnDestData,
+ const sal_uInt8* pnSrcData,
+ sal_Int32 nBytes );
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of decode().
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+
+ @return
+ True = skip was successful (no error occurred).
+ */
+ bool skip( sal_Int32 nBytes );
+
+private:
+ CodecType meCodecType; ///< Codec type.
+ sal_uInt8 mpnKey[ 16 ]; ///< Encryption key.
+ sal_Int32 mnOffset; ///< Key offset.
+ sal_uInt16 mnBaseKey; ///< Base key from password.
+ sal_uInt16 mnHash; ///< Hash value from password.
+};
+
+// ============================================================================
+
+/** Encodes and decodes data from protected MSO 97+ documents.
+
+ This is a wrapper class around low level cryptographic functions from RTL.
+ Implementation is based on the wvDecrypt package by Caolan McNamara:
+ http://www.csn.ul.ie/~caolan/docs/wvDecrypt.html
+ */
+class OOX_DLLPUBLIC BinaryCodec_RCF
+{
+public:
+ /** Default constructor.
+
+ Two-step construction in conjunction with the initKey() and verifyKey()
+ functions allows to try to initialize with different passwords (e.g.
+ built-in default password used for Excel workbook protection).
+ */
+ explicit BinaryCodec_RCF();
+
+ ~BinaryCodec_RCF();
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool initCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getEncryptionData();
+
+ /** Initializes the algorithm with the specified password and document ID.
+
+ @param pnPassData
+ Unicode character array containing the password. Must be zero
+ terminated, which results in a maximum length of 15 characters.
+ @param pnSalt
+ Random salt data block read from or written to the file.
+ */
+ void initKey(
+ const sal_uInt16 pnPassData[ 16 ],
+ const sal_uInt8 pnSalt[ 16 ] );
+
+ /** Verifies the validity of the password using the passed salt data.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param pnVerifier
+ Verifier block read from the file.
+ @param pnVerifierHash
+ Verifier hash read from the file.
+
+ @return
+ True = test was successful.
+ */
+ bool verifyKey(
+ const sal_uInt8 pnVerifier[ 16 ],
+ const sal_uInt8 pnVerifierHash[ 16 ] );
+
+ /** Rekeys the codec using the specified counter.
+
+ After reading a specific amount of data the cipher algorithm needs to
+ be rekeyed using a counter that counts the data blocks.
+
+ The block size is for example 512 bytes for MS Word files and 1024
+ bytes for MS Excel files.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nCounter
+ Block counter used to rekey the cipher.
+ */
+ bool startBlock( sal_Int32 nCounter );
+
+ /** Decodes a block of memory.
+
+ @see rtl_cipher_decode()
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param pnDestData
+ Destination buffer. Will contain the decrypted data afterwards.
+ @param pnSrcData
+ Encrypted data block.
+ @param nBytes
+ Size of the passed data blocks. pnDestData and pnSrcData must be of
+ this size.
+
+ @return
+ True = decoding was successful (no error occurred).
+ */
+ bool decode(
+ sal_uInt8* pnDestData,
+ const sal_uInt8* pnSrcData,
+ sal_Int32 nBytes );
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of decode().
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+
+ @return
+ True = skip was successful (no error occurred).
+ */
+ bool skip( sal_Int32 nBytes );
+
+private:
+ void InitKeyImpl(
+ const sal_uInt8 pKeyData[64],
+ const sal_uInt8 pUnique[16] );
+
+ rtlCipher mhCipher;
+ rtlDigest mhDigest;
+ sal_uInt8 mpnDigestValue[ RTL_DIGEST_LENGTH_MD5 ];
+ sal_uInt8 mpnUnique[16];
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/contexthandler.hxx b/include/oox/core/contexthandler.hxx
new file mode 100644
index 000000000000..f11dc1d6260a
--- /dev/null
+++ b/include/oox/core/contexthandler.hxx
@@ -0,0 +1,117 @@
+/* -*- 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 OOX_CORE_CONTEXTHANDLER_HXX
+#define OOX_CORE_CONTEXTHANDLER_HXX
+
+#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+#include <boost/shared_ptr.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/ref.hxx>
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XLocator; } }
+} } }
+
+namespace oox { class SequenceInputStream; }
+
+namespace oox {
+namespace core {
+
+class XmlFilterBase;
+class FragmentHandler;
+struct Relation;
+class Relations;
+
+// ============================================================================
+
+class ContextHandler;
+typedef ::rtl::Reference< ContextHandler > ContextHandlerRef;
+
+struct FragmentBaseData;
+typedef ::boost::shared_ptr< FragmentBaseData > FragmentBaseDataRef;
+
+typedef ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler > ContextHandler_BASE;
+
+class OOX_DLLPUBLIC ContextHandler : public ContextHandler_BASE
+{
+public:
+ explicit ContextHandler( const ContextHandler& rParent );
+ virtual ~ContextHandler();
+
+ /** Returns the filter instance. */
+ XmlFilterBase& getFilter() const;
+ /** Returns the relations of the current fragment. */
+ const Relations& getRelations() const;
+ /** Returns the full path of the current fragment. */
+ const OUString& getFragmentPath() const;
+
+ /** Returns the full fragment path for the target of the passed relation. */
+ OUString getFragmentPathFromRelation( const Relation& rRelation ) const;
+ /** Returns the full fragment path for the passed relation identifier. */
+ OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
+ /** Returns the full fragment path for the first relation of the passed type. */
+ OUString getFragmentPathFromFirstType( const OUString& rType ) const;
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // record context interface -----------------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+protected:
+ /** Helper constructor for the FragmentHandler. */
+ explicit ContextHandler( const FragmentBaseDataRef& rxBaseData );
+
+ void implSetLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& rxLocator );
+
+#ifdef _MSC_VER
+ ContextHandler() {} // workaround
+#endif
+
+private:
+ ContextHandler& operator=( const ContextHandler& );
+
+private:
+ FragmentBaseDataRef mxBaseData; ///< Base data of the fragment.
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/contexthandler2.hxx b/include/oox/core/contexthandler2.hxx
new file mode 100644
index 000000000000..f1a0c7db38b2
--- /dev/null
+++ b/include/oox/core/contexthandler2.hxx
@@ -0,0 +1,272 @@
+/* -*- 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 OOX_CORE_CONTEXTHANDLER2_HXX
+#define OOX_CORE_CONTEXTHANDLER2_HXX
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+const sal_Int32 XML_ROOT_CONTEXT = SAL_MAX_INT32;
+
+// ============================================================================
+
+struct ElementInfo;
+
+/** Helper class that provides a context stack.
+
+ Fragment handlers and context handlers derived from this helper class will
+ track the identifiers of the visited elements in a stack. The idea is to
+ use the same instance of a fragment handler or context handler to process
+ several nested elements in an XML stream. For that, the abstract function
+ onCreateContext() has to return 'this' for the passed element.
+
+ Derived classes have to implement the createFastChildContext(),
+ startFastElement(), characters(), and endFastElement() functions from the
+ com.sun.star.xml.sax.XFastContextHandler interface by simply forwarding
+ them to the respective implCreateChildContext(), implStartElement(),
+ implCharacters(), and implEndElement() functions of this helper. This is
+ implemented already in the classes ContextHandler2 and FragmentHandler2.
+ The new abstract functions have to be implemented according to the elements
+ to be processed.
+
+ Similarly, for binary import, derived classes have to forward the
+ createRecordContext(), startRecord(), and endRecord() functions from the
+ ContextHandler class to the implCreateRecordContext(), implStartRecord(),
+ and implEndRecord() functions of this helper. Again, this is implemented
+ already in the classes ContextHandler2 and FragmentHandler2.
+ */
+class OOX_DLLPUBLIC ContextHandler2Helper
+{
+public:
+ explicit ContextHandler2Helper( bool bEnableTrimSpace );
+ explicit ContextHandler2Helper( const ContextHandler2Helper& rParent );
+ virtual ~ContextHandler2Helper();
+
+ // allow instances to be stored in ::rtl::Reference
+ virtual void SAL_CALL acquire() throw() = 0;
+ virtual void SAL_CALL release() throw() = 0;
+
+ // interface --------------------------------------------------------------
+
+ /** Will be called to create a context handler for the passed element.
+
+ Usually 'this' can be returned to improve performance by reusing the
+ same instance to process several elements. Used by OOXML import only.
+ */
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) = 0;
+
+ /** Will be called when a new element has been started.
+
+ This function is called at the context handler returned from
+ onCreateContext(), or, for root elements of an XML stream, at the
+ fragment handler itself.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onStartElement( const AttributeList& rAttribs ) = 0;
+
+ /** Will be called before a new child element starts, or if the current
+ element is about to be left.
+
+ This helper function collects all text fragments received by the
+ characters() function (such as encoded characters which are passed in
+ separate calls to the characters() function), and passes the
+ concatenated and trimmed string.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onCharacters( const OUString& rChars ) = 0;
+
+ /** Will be called when the current element is about to be left.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onEndElement() = 0;
+
+ /** Will be called to create a context handler for the passed record.
+
+ Usually 'this' can be returned to improve performance by reusing the
+ same instance to process several records. Used by BIFF import only.
+ */
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) = 0;
+
+ /** Will be called when a new record block in a binary stream has been
+ started.
+
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
+ */
+ virtual void onStartRecord( SequenceInputStream& rStrm ) = 0;
+
+ /** Will be called when the current record block is about to be left.
+
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
+ */
+ virtual void onEndRecord() = 0;
+
+ // helpers ----------------------------------------------------------------
+
+ /** Returns the identifier of the currently processed element. Ignores MCE elements in stack */
+ sal_Int32 getCurrentElement() const;
+
+ /** Returns the identifier of the currently processed element - Including MCE root elements */
+ sal_Int32 getCurrentElementWithMce() const;
+
+ /** Returns true, if nElement contains the identifier of the currently
+ processed element. */
+ inline bool isCurrentElement( sal_Int32 nElement ) const
+ { return getCurrentElement() == nElement; }
+
+ /** Returns true, if either nElement1 or nElement2 contain the identifier
+ of the currently processed element. */
+ inline bool isCurrentElement( sal_Int32 nElement1, sal_Int32 nElement2 ) const
+ { return isCurrentElement( nElement1 ) || isCurrentElement( nElement2 ); }
+
+ /** Returns the identifier of the specified parent element. */
+ sal_Int32 getParentElement( sal_Int32 nCountBack = 1 ) const;
+
+ /** Returns true, if nElement contains the identifier of the specified
+ parent element. */
+ inline sal_Int32 isParentElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 ) const
+ { return getParentElement( nCountBack ) == nElement; }
+
+ /** Returns true, if the element currently processed is the root element of
+ the context or fragment handler. */
+ bool isRootElement() const;
+
+ // implementation ---------------------------------------------------------
+
+protected:
+ /** Must be called from createFastChildContext() in derived classes. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
+ implCreateChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Must be called from startFastElement() in derived classes. */
+ void implStartElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Must be called from characters() in derived classes. */
+ void implCharacters( const OUString& rChars );
+
+ /** Must be called from endFastElement() in derived classes. */
+ void implEndElement( sal_Int32 nElement );
+
+ /** Must be called from createRecordContext() in derived classes. */
+ ContextHandlerRef implCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ /** Must be called from startRecord() in derived classes. */
+ void implStartRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ /** Must be called from endRecord() in derived classes. */
+ void implEndRecord( sal_Int32 nRecId );
+
+private:
+ ContextHandler2Helper& operator=( const ContextHandler2Helper& );
+
+ ElementInfo& pushElementInfo( sal_Int32 nElement );
+ void popElementInfo();
+ void processCollectedChars();
+
+private:
+ typedef ::std::vector< ElementInfo > ContextStack;
+ typedef ::boost::shared_ptr< ContextStack > ContextStackRef;
+
+ ContextStackRef mxContextStack; ///< Stack of all processed elements.
+ size_t mnRootStackSize; ///< Stack size on construction time.
+ bool mbEnableTrimSpace; ///< True = trim whitespace in characters().
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ContextHandler2 : public ContextHandler, public ContextHandler2Helper
+{
+public:
+ explicit ContextHandler2( ContextHandler2Helper& rParent );
+ virtual ~ContextHandler2();
+
+ // resolve ambiguity from base classes
+ virtual void SAL_CALL acquire() throw() { ContextHandler::acquire(); }
+ virtual void SAL_CALL release() throw() { ContextHandler::release(); }
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL characters( const OUString& rChars )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // oox.core.ContextHandler interface --------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
+ virtual void onEndRecord();
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fastparser.hxx b/include/oox/core/fastparser.hxx
new file mode 100644
index 000000000000..40b5e763998f
--- /dev/null
+++ b/include/oox/core/fastparser.hxx
@@ -0,0 +1,97 @@
+/* -*- 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 OOX_CORE_FASTPARSER_HXX
+#define OOX_CORE_FASTPARSER_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/xml/sax/XFastParser.hpp>
+
+namespace oox {
+ struct NamespaceMap;
+ class StorageBase;
+}
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Wrapper for a fast SAX parser that works on automatically generated OOXML
+ token and namespace identifiers.
+ */
+class FastParser
+{
+public:
+ explicit FastParser(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~FastParser();
+
+ /** Registers an OOXML namespace at the parser. */
+ void registerNamespace( sal_Int32 nNamespaceId )
+ throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ /** Sets the passed document handler that will receive the SAX parser events. */
+ void setDocumentHandler(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& rxDocHandler )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ /** Parses the passed SAX input source.
+ @param bCloseStream True = closes the stream in the input source after parsing. */
+ void parseStream( const ::com::sun::star::xml::sax::InputSource& rInputSource, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ /** Parses the passed input stream.
+ @param bCloseStream True = closes the passed stream after parsing. */
+ void parseStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
+ const OUString& rStreamName, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ /** Parses a stream from the passed storage with the specified name.
+ @param bCloseStream True = closes the stream after parsing. */
+ void parseStream( StorageBase& rStorage, const OUString& rStreamName, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ OUString getNamespaceURL( const OUString& rPrefix )
+ throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ sal_Int32 getNamespaceId( const OUString& aUrl );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >
+ getTokenHandler() const { return mxTokenHandler; }
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastParser >
+ mxParser;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >
+ mxTokenHandler;
+ const NamespaceMap& mrNamespaceMap;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fasttokenhandler.hxx b/include/oox/core/fasttokenhandler.hxx
new file mode 100644
index 000000000000..05c7063d3925
--- /dev/null
+++ b/include/oox/core/fasttokenhandler.hxx
@@ -0,0 +1,67 @@
+/* -*- 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 OOX_CORE_FASTTOKENHANDLER_HXX
+#define OOX_CORE_FASTTOKENHANDLER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace oox { class TokenMap; }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandler_BASE;
+
+/** Wrapper implementing the com.sun.star.xml.sax.XFastTokenHandler API interface
+ that provides access to the tokens generated from the internal token name list.
+ */
+class FastTokenHandler : public FastTokenHandler_BASE
+{
+public:
+ explicit FastTokenHandler();
+ virtual ~FastTokenHandler();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XFastTokenHandler
+ virtual sal_Int32 SAL_CALL getToken( const OUString& rIdentifier ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getIdentifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTokenFromUTF8( const ::com::sun::star::uno::Sequence< sal_Int8 >& Identifier ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const TokenMap& mrTokenMap; ///< Reference to global token map singleton.
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx
new file mode 100644
index 000000000000..6f4fc40499c7
--- /dev/null
+++ b/include/oox/core/filterbase.hxx
@@ -0,0 +1,293 @@
+/* -*- 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 OOX_CORE_FILTERBASE_HXX
+#define OOX_CORE_FILTERBASE_HXX
+
+#include <memory>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct DeviceInfo; }
+ namespace frame { class XFrame; }
+ namespace frame { class XModel; }
+ namespace drawing { class XShape; }
+ namespace graphic { class XGraphic; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+ namespace lang { class XMultiComponentFactory; }
+ namespace lang { class XMultiServiceFactory; }
+ namespace task { class XInteractionHandler; }
+ namespace task { class XStatusIndicator; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+ class IDocPasswordVerifier;
+ class MediaDescriptor;
+}
+
+namespace oox {
+ class GraphicHelper;
+ class ModelObjectHelper;
+}
+
+namespace oox { namespace ole {
+ class OleObjectHelper;
+ class VbaProject;
+} }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+enum OoxmlVersion
+{
+ ECMA_DIALECT,
+ ISOIEC_29500_2008
+};
+
+struct FilterBaseImpl;
+
+typedef ::cppu::WeakImplHelper5<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::document::XImporter,
+ ::com::sun::star::document::XExporter,
+ ::com::sun::star::document::XFilter >
+ FilterBase_BASE;
+
+class OOX_DLLPUBLIC FilterBase : public FilterBase_BASE, public ::cppu::BaseMutex
+{
+public:
+ explicit FilterBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~FilterBase();
+
+ /** Returns true, if filter is an import filter. */
+ bool isImportFilter() const;
+ /** Returns true, if filter is an export filter. */
+ bool isExportFilter() const;
+
+ OoxmlVersion getVersion() const;
+
+ /** Derived classes implement import of the entire document. */
+ virtual bool importDocument() = 0;
+
+ /** Derived classes implement export of the entire document. */
+ virtual bool exportDocument() = 0;
+
+ // ------------------------------------------------------------------------
+
+ /** Returns the component context passed in the filter constructor (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
+ getComponentContext() const;
+
+ /** Returns the multi service factory of the component (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
+ getServiceFactory() const;
+
+ /** Returns the document model (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >&
+ getModel() const;
+
+ /** Returns the service factory provided by the document model (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
+ getModelFactory() const;
+
+ /** Returns the frame that will contain the document model (may be null). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
+ getTargetFrame() const;
+
+ /// Returns the parent shape to load into (if any)
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&
+ getParentShape() const;
+
+ /** Returns the status indicator (may be null). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >&
+ getStatusIndicator() const;
+
+ /** Returns the FilterData */
+ ::comphelper::SequenceAsHashMap& getFilterData() const;
+
+ /** Returns the media descriptor. */
+ ::comphelper::MediaDescriptor& getMediaDescriptor() const;
+
+ /** Returns the URL of the imported or exported file. */
+ const OUString& getFileUrl() const;
+
+ /** Returns an absolute URL for the passed relative or absolute URL. */
+ OUString getAbsoluteUrl( const OUString& rUrl ) const;
+
+ /** Returns the base storage of the imported/exported file. */
+ StorageRef getStorage() const;
+
+ /** Opens and returns the specified input stream from the base storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openInputStream( const OUString& rStreamName ) const;
+
+ /** Opens and returns the specified output stream from the base storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openOutputStream( const OUString& rStreamName ) const;
+
+ /** Commits changes to base storage (and substorages) */
+ void commitStorage() const;
+
+ // helpers ----------------------------------------------------------------
+
+ /** Returns a helper for the handling of graphics and graphic objects. */
+ GraphicHelper& getGraphicHelper() const;
+
+ /** Returns a helper with containers for various named drawing objects for
+ the imported document. */
+ ModelObjectHelper& getModelObjectHelper() const;
+
+ /** Returns a helper for the handling of OLE objects. */
+ ::oox::ole::OleObjectHelper& getOleObjectHelper() const;
+
+ /** Returns the VBA project manager. */
+ ::oox::ole::VbaProject& getVbaProject() const;
+
+ /** Imports the raw binary data from the specified stream.
+ @return True, if the data could be imported from the stream. */
+ bool importBinaryData( StreamDataSequence& orDataSeq, const OUString& rStreamName );
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& rServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.lang.XInitialization interface ----------------------------
+
+ /** Receives user defined arguments.
+
+ @param rArgs
+ the sequence of arguments passed to the filter. The implementation
+ expects one or two arguments. The first argument shall be the
+ com.sun.star.lang.XMultiServiceFactory interface of the global
+ service factory. The optional second argument may contain a
+ sequence of com.sun.star.beans.NamedValue objects. The different
+ filter implemetations may support different arguments.
+ */
+ virtual void SAL_CALL initialize(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs )
+ throw( ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XImporter interface ------------------------------
+
+ virtual void SAL_CALL setTargetDocument(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxDocument )
+ throw( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XExporter interface ------------------------------
+
+ virtual void SAL_CALL setSourceDocument(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxDocument )
+ throw( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XFilter interface --------------------------------
+
+ virtual sal_Bool SAL_CALL filter(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL cancel()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // ------------------------------------------------------------------------
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implGetInputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
+ implGetOutputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+
+private:
+ void setMediaDescriptor(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq );
+
+ /** Derived classes may create a specialized graphic helper, e.g. for
+ resolving palette colors. */
+ virtual GraphicHelper* implCreateGraphicHelper() const;
+
+ /** Derived classes create a VBA project manager object. */
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const = 0;
+
+ virtual OUString implGetImplementationName() const = 0;
+
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ) const = 0;
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const = 0;
+
+private:
+ ::std::auto_ptr< FilterBaseImpl > mxImpl;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/filterdetect.hxx b/include/oox/core/filterdetect.hxx
new file mode 100644
index 000000000000..cd9573b0f0bd
--- /dev/null
+++ b/include/oox/core/filterdetect.hxx
@@ -0,0 +1,162 @@
+/* -*- 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 OOX_CORE_FILTERDETECT_HXX
+#define OOX_CORE_FILTERDETECT_HXX
+
+#include <vector>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper { class MediaDescriptor; }
+
+namespace oox { class AttributeList; }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Document handler specifically designed for detecting OOXML file formats.
+
+ It takes a reference to the filter string object via its constructor, and
+ puts the name of the detected filter to it, if it successfully finds one.
+ */
+class FilterDetectDocHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastDocumentHandler >
+{
+public:
+ explicit FilterDetectDocHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, OUString& rFilter );
+ virtual ~FilterDetectDocHandler();
+
+ // XFastDocumentHandler
+ virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // XFastContextHandler
+ virtual void SAL_CALL startFastElement( sal_Int32 nElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endFastElement( sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ void parseRelationship( const AttributeList& rAttribs );
+
+ OUString getFilterNameFromContentType( const OUString& rContentType ) const;
+ void parseContentTypesDefault( const AttributeList& rAttribs );
+ void parseContentTypesOverride( const AttributeList& rAttribs );
+
+private:
+ typedef ::std::vector< sal_Int32 > ContextVector;
+
+ OUString& mrFilterName;
+ ContextVector maContextStack;
+ OUString maTargetPath;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC FilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo >
+{
+public:
+ explicit FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ~FilterDetect();
+
+ /** Tries to extract an unencrypted ZIP package from the passed media
+ descriptor.
+
+ First, this function checks if the input stream provided by the media
+ descriptor property 'InputStream' contains a ZIP package. If yes, this
+ stream is returned.
+
+ Second, this function checks if the 'ComponentData' property exists and
+ contains a sequence of com.sun.star.beans.NamedValue. If yes, a named
+ value is searched with the name 'DecryptedPackage' and a value of type
+ com.sun.star.io.XStream. If the input stream provided by this XStream
+ contains a ZIP package, this input stream is returned.
+
+ Third, this function checks if the input stream of the media descriptor
+ contains an OLE package. If yes, it checks the existence of the streams
+ 'EncryptionInfo' and 'EncyptedPackage' and tries to decrypt the package
+ into a temporary file. This may include requesting a password from the
+ media descriptor property 'Password' or from the user, using the
+ interaction handler provided by the descriptor. On success, and if the
+ decrypted package is a ZIP package, the XStream of the temporary file
+ is stored in the property 'ComponentData' of the media descriptor and
+ its input stream is returned.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ extractUnencryptedPackage( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XExtendedFilterDetection interface ---------------
+
+ /** Detects MS Office 2007 file types and supports package decryption.
+
+ The following file types are detected:
+ - MS Word 2007 XML Document (*.docx, *.docm)
+ - MS Word 2007 XML Template (*.dotx, *.dotm)
+ - MS Excel 2007 XML Document (*.xlsx, *.xlsm)
+ - MS Excel 2007 BIFF12 Document (*.xlsb)
+ - MS Excel 2007 XML Template (*.xltx, *.xltm)
+ - MS Powerpoint 2007 XML Document (*.pptx, *.pptm)
+ - MS Powerpoint 2007 XML Template (*.potx, *.potm)
+
+ If the package is encrypted, the detection tries to decrypt it into a
+ temporary file. The user may be asked for a password. The XStream
+ interface of the temporary file will be stored in the 'ComponentData'
+ property of the passed media descriptor.
+ */
+ virtual OUString SAL_CALL
+ detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fragmenthandler.hxx b/include/oox/core/fragmenthandler.hxx
new file mode 100644
index 000000000000..236e212e6e32
--- /dev/null
+++ b/include/oox/core/fragmenthandler.hxx
@@ -0,0 +1,131 @@
+/* -*- 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 OOX_CORE_FRAGMENTHANDLER_HXX
+#define OOX_CORE_FRAGMENTHANDLER_HXX
+
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "oox/core/contexthandler.hxx"
+#include "oox/core/relations.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Base data of a fragment.
+
+ This data is stored in a separate struct to make it accessible in every
+ child context handler of the fragment.
+ */
+struct FragmentBaseData
+{
+ XmlFilterBase& mrFilter;
+ const OUString maFragmentPath;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >
+ mxLocator;
+ RelationsRef mxRelations;
+
+ explicit FragmentBaseData(
+ XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ RelationsRef xRelations );
+};
+
+// ============================================================================
+
+/** Describes record identifiers used to create contexts in a binary stream.
+
+ If a record is used to start a new context, usually the record identifier
+ increased by 1 is used to mark the end of this context, e.g. the Excel
+ record SHEETDATA == 0x0091 starts the <sheetData> context, and the record
+ SHEETDATA_END == 0x0092 ends this context. But some records are used to
+ start a new context, though there is no identifier to end this context,
+ e.g. the ROW or EXTROW records. These record identifiers can be marked by
+ setting the mnEndRecId member of this struct to -1.
+ */
+struct RecordInfo
+{
+ sal_Int32 mnStartRecId; ///< Record identifier for context start.
+ sal_Int32 mnEndRecId; ///< Record identifier for context end, -1 = no record.
+};
+
+// ============================================================================
+
+typedef ::cppu::ImplInheritanceHelper1< ContextHandler, ::com::sun::star::xml::sax::XFastDocumentHandler > FragmentHandler_BASE;
+
+class OOX_DLLPUBLIC FragmentHandler : public FragmentHandler_BASE
+{
+public:
+ explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath );
+ virtual ~FragmentHandler();
+
+ /** Returns the com.sun.star.xml.sax.XFastContextHandler interface of this context. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
+ getFastContextHandler() { return static_cast< ContextHandler* >( this ); }
+
+ // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
+
+ virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& rxLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // XML stream handling ----------------------------------------------------
+
+ /** Opens the fragment stream referred by the own fragment path. Derived
+ classes may provide specilized stream implementations. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openFragmentStream() const;
+
+ // binary records ---------------------------------------------------------
+
+ virtual const RecordInfo* getRecordInfos() const;
+
+protected:
+ explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations );
+};
+
+typedef ::rtl::Reference< FragmentHandler > FragmentHandlerRef;
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fragmenthandler2.hxx b/include/oox/core/fragmenthandler2.hxx
new file mode 100644
index 000000000000..21ad03619fd1
--- /dev/null
+++ b/include/oox/core/fragmenthandler2.hxx
@@ -0,0 +1,121 @@
+/* -*- 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 OOX_CORE_FRAGMENTHANDLER2_HXX
+#define OOX_CORE_FRAGMENTHANDLER2_HXX
+
+#include "oox/core/contexthandler2.hxx"
+#include "oox/core/fragmenthandler.hxx"
+#include <vector>
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
+{
+protected:
+ enum MCE_STATE
+ {
+ MCE_UNUSED,
+ MCE_STARTED,
+ MCE_FOUND_CHOICE
+ };
+ ::std::vector<MCE_STATE> aMceState;
+
+ bool prepareMceContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+
+public:
+ explicit FragmentHandler2(
+ XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ bool bEnableTrimSpace = true );
+ virtual ~FragmentHandler2();
+
+ // resolve ambiguity from base classes
+ virtual void SAL_CALL acquire() throw() { FragmentHandler::acquire(); }
+ virtual void SAL_CALL release() throw() { FragmentHandler::release(); }
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL characters( const OUString& rChars )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
+
+ virtual void SAL_CALL startDocument()
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL endDocument()
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // oox.core.ContextHandler interface --------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
+ virtual void onEndRecord();
+
+ // oox.core.FragmentHandler2 interface ------------------------------------
+
+ virtual void initializeImport();
+ virtual void finalizeImport();
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/recordparser.hxx b/include/oox/core/recordparser.hxx
new file mode 100644
index 000000000000..9e417c03d01a
--- /dev/null
+++ b/include/oox/core/recordparser.hxx
@@ -0,0 +1,90 @@
+/* -*- 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 OOX_CORE_RECORDPARSER_HXX
+#define OOX_CORE_RECORDPARSER_HXX
+
+#include <map>
+#include <com/sun/star/io/IOException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <rtl/ref.hxx>
+#include "oox/helper/binaryinputstream.hxx"
+
+namespace oox {
+namespace core {
+
+class FragmentHandler;
+struct RecordInfo;
+
+namespace prv { class Locator; }
+namespace prv { class ContextStack; }
+
+// ============================================================================
+
+struct RecordInputSource
+{
+ BinaryInputStreamRef mxInStream;
+ OUString maPublicId;
+ OUString maSystemId;
+};
+
+// ============================================================================
+
+class RecordParser
+{
+public:
+ explicit RecordParser();
+ virtual ~RecordParser();
+
+ void setFragmentHandler( const ::rtl::Reference< FragmentHandler >& rxHandler );
+
+ void parseStream( const RecordInputSource& rInputSource )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+
+ inline const RecordInputSource& getInputSource() const { return maSource; }
+
+private:
+ /** Returns a RecordInfo struct that contains the passed record identifier
+ as context start identifier. */
+ const RecordInfo* getStartRecordInfo( sal_Int32 nRecId ) const;
+ /** Returns a RecordInfo struct that contains the passed record identifier
+ as context end identifier. */
+ const RecordInfo* getEndRecordInfo( sal_Int32 nRecId ) const;
+
+private:
+ typedef ::std::map< sal_Int32, RecordInfo > RecordInfoMap;
+
+ RecordInputSource maSource;
+ ::rtl::Reference< FragmentHandler > mxHandler;
+ ::rtl::Reference< prv::Locator > mxLocator;
+ ::std::auto_ptr< prv::ContextStack > mxStack;
+ RecordInfoMap maStartMap;
+ RecordInfoMap maEndMap;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/relations.hxx b/include/oox/core/relations.hxx
new file mode 100644
index 000000000000..b78d0d3056eb
--- /dev/null
+++ b/include/oox/core/relations.hxx
@@ -0,0 +1,103 @@
+/* -*- 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 OOX_CORE_RELATIONS_HXX
+#define OOX_CORE_RELATIONS_HXX
+
+#include <map>
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Expands to an OUString containing an 'officeDocument' relation type created
+ from the passed literal(!) ASCII(!) character array. */
+#define CREATE_OFFICEDOC_RELATION_TYPE( ascii ) \
+ ( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii )
+
+/** Expands to an OUString containing a 'package' relation type created from
+ the passed literal(!) ASCII(!) character array. */
+#define CREATE_PACKAGE_RELATION_TYPE( ascii ) \
+ ( "http://schemas.openxmlformats.org/package/2006/relationships/" ascii )
+
+/** Expands to an OUString containing an MS Office specific relation type
+ created from the passed literal(!) ASCII(!) character array. */
+#define CREATE_MSOFFICE_RELATION_TYPE( ascii ) \
+ ( "http://schemas.microsoft.com/office/2006/relationships/" ascii )
+
+// ============================================================================
+
+struct Relation
+{
+ OUString maId;
+ OUString maType;
+ OUString maTarget;
+ bool mbExternal;
+
+ inline explicit Relation() : mbExternal( false ) {}
+};
+
+// ============================================================================
+
+class Relations;
+typedef ::boost::shared_ptr< Relations > RelationsRef;
+
+class OOX_DLLPUBLIC Relations : public ::std::map< OUString, Relation >
+{
+public:
+ explicit Relations( const OUString& rFragmentPath );
+
+ /** Returns the path of the fragment this relations collection is related to. */
+ inline const OUString& getFragmentPath() const { return maFragmentPath; }
+
+ /** Returns the relation with the passed relation identifier. */
+ const Relation* getRelationFromRelId( const OUString& rId ) const;
+ /** Returns the first relation with the passed type. */
+ const Relation* getRelationFromFirstType( const OUString& rType ) const;
+ /** Finds all relations associated with the passed type. */
+ RelationsRef getRelationsFromType( const OUString& rType ) const;
+
+ /** Returns the external target of the relation with the passed relation identifier. */
+ OUString getExternalTargetFromRelId( const OUString& rRelId ) const;
+ /** Returns the internal target of the relation with the passed relation identifier. */
+ OUString getInternalTargetFromRelId( const OUString& rRelId ) const;
+
+ /** Returns the full fragment path for the target of the passed relation. */
+ OUString getFragmentPathFromRelation( const Relation& rRelation ) const;
+ /** Returns the full fragment path for the passed relation identifier. */
+ OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
+ /** Returns the full fragment path for the first relation of the passed type. */
+ OUString getFragmentPathFromFirstType( const OUString& rType ) const;
+
+private:
+ OUString maFragmentPath;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/relationshandler.hxx b/include/oox/core/relationshandler.hxx
new file mode 100644
index 000000000000..d42e5d1ad8b7
--- /dev/null
+++ b/include/oox/core/relationshandler.hxx
@@ -0,0 +1,54 @@
+/* -*- 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 OOX_CORE_RELATIONSHANDLER_HXX
+#define OOX_CORE_RELATIONSHANDLER_HXX
+
+#include "oox/core/fragmenthandler.hxx"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+class RelationsFragment : public FragmentHandler
+{
+public:
+ explicit RelationsFragment(
+ XmlFilterBase& rFilter,
+ RelationsRef xRelations );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ RelationsRef mxRelations;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
new file mode 100644
index 000000000000..4b5c1e093657
--- /dev/null
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -0,0 +1,256 @@
+/* -*- 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 OOX_CORE_XMLFILTERBASE_HXX
+#define OOX_CORE_XMLFILTERBASE_HXX
+
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <rtl/ref.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include "oox/core/filterbase.hxx"
+#include "oox/core/relations.hxx"
+#include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace document { class XDocumentProperties; }
+ namespace xml { namespace dom { class XDocument; } }
+ namespace xml { namespace sax { class XLocator; } }
+ namespace xml { namespace sax { class XFastDocumentHandler; } }
+ namespace xml { namespace sax { class XFastSAXSerializable; } }
+} } }
+
+namespace oox {
+ namespace drawingml { class Theme; }
+ namespace drawingml { namespace chart { class ChartConverter; } }
+ namespace vml { class Drawing; }
+}
+
+namespace sax_fastparser {
+ class FastSerializerHelper;
+
+ typedef boost::shared_ptr< FastSerializerHelper > FSHelperPtr;
+}
+
+namespace oox {
+namespace core {
+
+class FragmentHandler;
+
+// ============================================================================
+
+struct TextField {
+ com::sun::star::uno::Reference< com::sun::star::text::XText > xText;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > xTextCursor;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextField > xTextField;
+};
+typedef std::vector< TextField > TextFieldStack;
+
+// ============================================================================
+
+struct XmlFilterBaseImpl;
+
+class OOX_DLLPUBLIC XmlFilterBase : public FilterBase
+{
+public:
+ explicit XmlFilterBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~XmlFilterBase();
+
+ /** Has to be implemented by each filter, returns the current theme. */
+ virtual const ::oox::drawingml::Theme*
+ getCurrentTheme() const = 0;
+
+ /** Has to be implemented by each filter to return the collection of VML shapes. */
+ virtual ::oox::vml::Drawing* getVmlDrawing() = 0;
+
+ /** Has to be implemented by each filter, returns a filter-specific chart
+ converter object, that should be global per imported document. */
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() = 0;
+
+ /** Has to be implemented by each filter to return the table style list. */
+ virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
+
+ // ------------------------------------------------------------------------
+
+ /** Returns the fragment path from the first relation of the passed type,
+ used for fragments referred by the root relations. */
+ OUString getFragmentPathFromFirstType( const OUString& rType );
+
+ /** Imports a fragment using the passed fragment handler, which contains
+ the full path to the fragment stream.
+
+ @return True, if the fragment could be imported.
+ */
+ bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler );
+
+ /** Imports a fragment into an xml::dom::XDocument.
+
+ @param rFragmentPath path to fragment
+
+ @return a non-empty reference to the XDocument, if the
+ fragment could be imported.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument> importFragment( const OUString& rFragmentPath );
+
+ /** Imports a fragment from an xml::dom::XDocument using the
+ passed fragment handler
+
+ @param rxHandler fragment handler; path to fragment is
+ ignored, input source is the rxSerializer
+
+ @param rxSerializer usually retrieved from a
+ xml::dom::XDocument, will get serialized into rxHandler
+
+ @return true, if the fragment could be imported.
+ */
+ bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XFastSAXSerializable >& rxSerializer );
+
+ /** Imports the relations fragment associated with the specified fragment.
+
+ @return The relations collection of the specified fragment.
+ */
+ RelationsRef importRelations( const OUString& rFragmentPath );
+
+ /** Adds new relation.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ OUString addRelation( const OUString& rType, const OUString& rTarget, bool bExternal = false );
+
+ /** Adds new relation to part's relations.
+
+ @param rPartName
+ Part name the relations are related to. The relations will be stored in <rPartName::path>/_rels/<rPartName::name>.rels.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ OUString addRelation( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutputStream, const OUString& rType, const OUString& rTarget, bool bExternal = false );
+
+ /** Returns a stack of used textfields, used by the pptx importer to replace links to slidepages with rhe real page name */
+ TextFieldStack& getTextFieldStack() const;
+
+ /** Opens and returns the specified output stream from the base storage with specified media type.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base
+ storage.
+
+ @return The opened output stream.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openFragmentStream(
+ const OUString& rStreamName,
+ const OUString& rMediaType );
+
+ /** Opens specified output stream from the base storage with specified
+ media type and returns new fast serializer for that stream.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base
+ storage.
+
+ @return newly created serializer helper.
+ */
+ ::sax_fastparser::FSHelperPtr
+ openFragmentStreamWithSerializer(
+ const OUString& rStreamName,
+ const OUString& rMediaType );
+
+ /** Returns new unique ID for exported document.
+
+ @return newly created ID.
+ */
+ inline sal_Int32 GetUniqueId() { return mnMaxDocId++; }
+ inline OString GetUniqueIdOString() { return OString::valueOf( mnMaxDocId++ ); }
+ inline OUString GetUniqueIdOUString() { return OUString::valueOf( mnMaxDocId++ ); }
+
+ /** Write the document properties into into the current OPC package.
+
+ @param xProperties The document properties to export.
+
+ @return *this
+ */
+ XmlFilterBase& exportDocumentProperties( ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > xProperties );
+
+ OUString getNamespaceURL( const OUString& rPrefix );
+
+ sal_Int32 getNamespaceId( const OUString& rUrl );
+
+ void importDocumentProperties();
+
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implGetInputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+
+private:
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ) const;
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const;
+
+private:
+ ::std::auto_ptr< XmlFilterBaseImpl > mxImpl;
+ sal_Int32 mnRelId;
+ sal_Int32 mnMaxDocId;
+};
+
+typedef ::rtl::Reference< XmlFilterBase > XmlFilterRef;
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dllapi.h b/include/oox/dllapi.h
new file mode 100644
index 000000000000..6026aef0ae58
--- /dev/null
+++ b/include/oox/dllapi.h
@@ -0,0 +1,33 @@
+/* -*- 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_DLLAPI_H
+#define INCLUDED_OOX_DLLAPI_H
+
+#include "sal/types.h"
+
+#if defined OOX_DLLIMPLEMENTATION
+#define OOX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define OOX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/axiscontext.hxx b/include/oox/drawingml/chart/axiscontext.hxx
new file mode 100644
index 000000000000..d22a53f23227
--- /dev/null
+++ b/include/oox/drawingml/chart/axiscontext.hxx
@@ -0,0 +1,120 @@
+/* -*- 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 OOX_DRAWINGML_CHART_AXISCONTEXT_HXX
+#define OOX_DRAWINGML_CHART_AXISCONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct AxisDispUnitsModel;
+
+/** Handler for a value axis display units context (c:dispUnits element).
+ */
+class AxisDispUnitsContext : public ContextBase< AxisDispUnitsModel >
+{
+public:
+ explicit AxisDispUnitsContext( ::oox::core::ContextHandler2Helper& rParent, AxisDispUnitsModel& rModel );
+ virtual ~AxisDispUnitsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct AxisModel;
+
+/** Base class for axis context handlers (c:catAx, c:dateAx, c:serAx, c:valAx
+ elements).
+ */
+class AxisContextBase : public ContextBase< AxisModel >
+{
+public:
+ explicit AxisContextBase( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~AxisContextBase();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a category axis context (c:catAx element).
+ */
+class CatAxisContext : public AxisContextBase
+{
+public:
+ explicit CatAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~CatAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a date axis context (c:dateAx element).
+ */
+class DateAxisContext : public AxisContextBase
+{
+public:
+ explicit DateAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~DateAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a series axis context (c:serAx element).
+ */
+class SerAxisContext : public AxisContextBase
+{
+public:
+ explicit SerAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~SerAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a value axis context (c:valAx element).
+ */
+class ValAxisContext : public AxisContextBase
+{
+public:
+ explicit ValAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~ValAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/axisconverter.hxx b/include/oox/drawingml/chart/axisconverter.hxx
new file mode 100644
index 000000000000..fac1d67c8997
--- /dev/null
+++ b/include/oox/drawingml/chart/axisconverter.hxx
@@ -0,0 +1,64 @@
+/* -*- 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 OOX_DRAWINGML_CHART_AXISCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_AXISCONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XAxis; }
+ namespace chart2 { class XCoordinateSystem; }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct AxisModel;
+class TypeGroupConverter;
+
+class AxisConverter : public ConverterBase< AxisModel >
+{
+public:
+ explicit AxisConverter(
+ const ConverterRoot& rParent,
+ AxisModel& rModel );
+ virtual ~AxisConverter();
+
+ /** Creates a chart2 axis and inserts it into the passed coordinate system. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem,
+ TypeGroupConverter& rTypeGroup,
+ const AxisModel* pCrossingAxis,
+ sal_Int32 nAxesSetIdx,
+ sal_Int32 nAxisIdx );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/axismodel.hxx b/include/oox/drawingml/chart/axismodel.hxx
new file mode 100644
index 000000000000..30ceae499b0a
--- /dev/null
+++ b/include/oox/drawingml/chart/axismodel.hxx
@@ -0,0 +1,105 @@
+/* -*- 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 OOX_DRAWINGML_CHART_AXISMODEL_HXX
+#define OOX_DRAWINGML_CHART_AXISMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct AxisDispUnitsModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ ShapeRef mxShapeProp; /// Label frame formatting.
+ TextBodyRef mxTextProp; /// Label text formatting.
+ LayoutRef mxLayout; /// Layout/position of the axis units label.
+ TextRef mxText; /// Text source of the axis units label.
+ double mfCustomUnit; /// Custom unit size on value axis.
+ sal_Int32 mnBuiltInUnit; /// Built-in unit on value axis.
+
+ explicit AxisDispUnitsModel();
+ ~AxisDispUnitsModel();
+};
+
+// ============================================================================
+
+struct AxisModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< TitleModel > TitleRef;
+ typedef ModelRef< AxisDispUnitsModel > AxisDispUnitsRef;
+
+ ShapeRef mxShapeProp; /// Axis line formatting.
+ TextBodyRef mxTextProp; /// Axis label text formatting.
+ TitleRef mxTitle; /// Axis title.
+ AxisDispUnitsRef mxDispUnits; /// Axis units label.
+ ShapeRef mxMajorGridLines; /// Major grid lines formatting.
+ ShapeRef mxMinorGridLines; /// Minor grid lines formatting.
+ NumberFormat maNumberFormat; /// Number format for axis tick labels.
+ OptValue< double > mofCrossesAt; /// Position on this axis where another axis crosses.
+ OptValue< double > mofMajorUnit; /// Unit for major tick marks on date/value axis.
+ OptValue< double > mofMinorUnit; /// Unit for minor tick marks on date/value axis.
+ OptValue< double > mofLogBase; /// Logarithmic base for logarithmic axes.
+ OptValue< double > mofMax; /// Maximum axis value.
+ OptValue< double > mofMin; /// Minimum axis value.
+ OptValue< sal_Int32 > monBaseTimeUnit; /// Base time unit shown on a date axis.
+ sal_Int32 mnAxisId; /// Unique axis identifier.
+ sal_Int32 mnAxisPos; /// Position of the axis (top/bottom/left/right).
+ sal_Int32 mnCrossAxisId; /// Identifier of a crossing axis.
+ sal_Int32 mnCrossBetween; /// This value axis crosses between or inside category.
+ sal_Int32 mnCrossMode; /// Mode this axis crosses another axis (min, max, auto).
+ sal_Int32 mnLabelAlign; /// Tick mark label alignment.
+ sal_Int32 mnLabelOffset; /// Tick mark label distance from axis.
+ sal_Int32 mnMajorTickMark; /// Major tick mark style.
+ sal_Int32 mnMajorTimeUnit; /// Time unit for major tick marks on date axis.
+ sal_Int32 mnMinorTickMark; /// Mainor tick mark style.
+ sal_Int32 mnMinorTimeUnit; /// Time unit for minor tick marks on date axis.
+ sal_Int32 mnOrientation; /// Axis orientation (value order min to max, or max to min).
+ sal_Int32 mnTickLabelPos; /// Position of tick mark labels relative to the axis.
+ sal_Int32 mnTickLabelSkip; /// Number of tick mark labels to skip.
+ sal_Int32 mnTickMarkSkip; /// Number of tick marks to skip.
+ sal_Int32 mnTypeId; /// Type identifier of this axis.
+ bool mbAuto; /// True = automatic selection of text/date axis type.
+ bool mbDeleted; /// True = axis has been deleted manually.
+ bool mbNoMultiLevel; /// True = no multi-level categories supported.
+
+ explicit AxisModel( sal_Int32 nTypeId );
+ ~AxisModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartcontextbase.hxx b/include/oox/drawingml/chart/chartcontextbase.hxx
new file mode 100644
index 000000000000..218e7bf4406e
--- /dev/null
+++ b/include/oox/drawingml/chart/chartcontextbase.hxx
@@ -0,0 +1,95 @@
+/* -*- 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 OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX
+#define OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox { namespace drawingml { class Shape; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+template< typename ModelType >
+class ContextBase : public ::oox::core::ContextHandler2
+{
+public:
+ inline explicit ContextBase( ::oox::core::ContextHandler2Helper& rParent, ModelType& rModel ) :
+ ::oox::core::ContextHandler2( rParent ), mrModel( rModel ) {}
+ virtual ~ContextBase() {}
+
+protected:
+ ModelType& mrModel;
+};
+
+// ============================================================================
+
+template< typename ModelType >
+class FragmentBase : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit FragmentBase( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, ModelType& rModel ) :
+ ::oox::core::FragmentHandler2( rFilter, rFragmentPath, false ), mrModel( rModel ) {}
+ virtual ~FragmentBase() {}
+
+protected:
+ ModelType& mrModel;
+};
+
+// ============================================================================
+
+/** Help class for all contexts that have only the c:spPr child element.
+ */
+class ShapePrWrapperContext : public ContextBase< Shape >
+{
+public:
+ explicit ShapePrWrapperContext( ::oox::core::ContextHandler2Helper& rParent, Shape& rModel );
+ virtual ~ShapePrWrapperContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct LayoutModel;
+
+/** Handler for a chart layout context (c:layout element).
+ */
+class LayoutContext : public ContextBase< LayoutModel >
+{
+public:
+ explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel );
+ virtual ~LayoutContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartconverter.hxx b/include/oox/drawingml/chart/chartconverter.hxx
new file mode 100644
index 000000000000..bbc7e0fafd28
--- /dev/null
+++ b/include/oox/drawingml/chart/chartconverter.hxx
@@ -0,0 +1,104 @@
+/* -*- 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 OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Point; }
+ namespace awt { struct Size; }
+ namespace drawing { class XShapes; }
+ namespace chart2 { class XChartDocument; }
+ namespace chart2 { namespace data { class XDataProvider; } }
+ namespace chart2 { namespace data { class XDataSequence; } }
+} } }
+
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+struct ChartSpaceModel;
+struct DataSequenceModel;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ChartConverter
+{
+public:
+ explicit ChartConverter();
+ virtual ~ChartConverter();
+
+ /** Converts the passed OOXML chart model to the passed chart2 document.
+
+ @param rChartModel The filled MSOOXML chart model structure.
+
+ @param rxChartDoc The UNO chart document model to be initialized.
+
+ @param rxExternalPage If null, all embedded shapes will be inserted
+ into the internal drawing page of the chart document. If not null,
+ all embedded shapes will be inserted into this shapes collection.
+
+ @param rChartPos The position of the chart shape in its drawing page,
+ in 1/100 mm. Will be used only, if parameter rxExternalPage is not
+ null, for correct positioning of the embedded shapes in the
+ external drawing page.
+
+ @param rChartSize The size of the chart shape in 1/100 mm. Needed for
+ calculation of position and size of the chart elements (diagram,
+ titles, legend, etc.) and embedded shapes.
+ */
+ void convertFromModel(
+ ::oox::core::XmlFilterBase& rFilter,
+ ChartSpaceModel& rChartModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage,
+ const ::com::sun::star::awt::Point& rChartPos,
+ const ::com::sun::star::awt::Size& rChartSize );
+
+ /** Creates an internal data provider. Derived classes may override this
+ function to create an external data provider. */
+ virtual void createDataProvider(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc );
+
+ /** Creates a data sequence from a formula. Dummy implementation. Derived
+ classes have to override this function to actually parse the formula. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >& rxDataProvider,
+ const DataSequenceModel& rDataSeq );
+
+private:
+ ChartConverter( const ChartConverter& );
+ ChartConverter& operator=( const ChartConverter& );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartdrawingfragment.hxx b/include/oox/drawingml/chart/chartdrawingfragment.hxx
new file mode 100644
index 000000000000..43d27f586514
--- /dev/null
+++ b/include/oox/drawingml/chart/chartdrawingfragment.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 OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX
+#define OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+/** Relative shape position in a chart object. */
+struct AnchorPosModel
+{
+ double mfX; /// X coordinate relative to chart object (0.0 to 1.0).
+ double mfY; /// Y coordinate relative to chart object (0.0 to 1.0).
+
+ inline explicit AnchorPosModel() : mfX( -1.0 ), mfY( -1.0 ) {}
+ inline bool isValid() const { return (0.0 <= mfX) && (mfX <= 1.0) && (0.0 <= mfY) && (mfY <= 1.0); }
+};
+
+// ----------------------------------------------------------------------------
+
+/** Absolute shape size in a chart object (in EMUs). */
+struct AnchorSizeModel : public EmuSize
+{
+ inline explicit AnchorSizeModel() : EmuSize( -1, -1 ) {}
+ inline bool isValid() const { return (Width >= 0) && (Height >= 0); }
+};
+
+// ============================================================================
+
+/** Contains the position of a shape in the chart object. Supports different
+ shape anchor modes (absolute, relative).
+ */
+class ShapeAnchor
+{
+public:
+ explicit ShapeAnchor( bool bRelSize );
+
+ /** Imports the absolute anchor size from the cdr:ext element. */
+ void importExt( const AttributeList& rAttribs );
+ /** Sets an the relative anchor position from the cdr:from or cdr:to element. */
+ void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue );
+
+ /** Calculates the resulting shape anchor in EMUs. */
+ EmuRectangle calcAnchorRectEmu( const EmuRectangle& rChartRect ) const;
+
+private:
+ AnchorPosModel maFrom; /// Top-left position relative to chart object.
+ AnchorPosModel maTo; /// Bottom-right position relative to chart object.
+ AnchorSizeModel maSize; /// Shape size, if anchor has absolute size.
+ bool mbRelSize; /// True = relative size, false = absolute size.
+};
+
+typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef;
+
+// ============================================================================
+
+/** Handler for a chart drawing fragment (c:userShapes root element).
+ */
+class ChartDrawingFragment : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit ChartDrawingFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxDrawPage,
+ const ::com::sun::star::awt::Size& rChartSize,
+ const ::com::sun::star::awt::Point& rShapesOffset,
+ bool bOleSupport );
+ virtual ~ChartDrawingFragment();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ mxDrawPage; /// Drawing page of this sheet.
+ ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape.
+ ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape.
+ EmuRectangle maChartRectEmu; /// Position and size of the chart object for embedded shapes (in EMUs).
+ bool mbOleSupport; /// True = allow to insert OLE objects into the drawing page.
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartspaceconverter.hxx b/include/oox/drawingml/chart/chartspaceconverter.hxx
new file mode 100644
index 000000000000..2bdeb013b1b3
--- /dev/null
+++ b/include/oox/drawingml/chart/chartspaceconverter.hxx
@@ -0,0 +1,57 @@
+/* -*- 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 OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX
+#define OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct ChartSpaceModel;
+
+class ChartSpaceConverter : public ConverterBase< ChartSpaceModel >
+{
+public:
+ explicit ChartSpaceConverter( const ConverterRoot& rParent, ChartSpaceModel& rModel );
+ virtual ~ChartSpaceConverter();
+
+ /** Converts the contained OOXML chart model to a chart2 document. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage,
+ const ::com::sun::star::awt::Point& rChartPos );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartspacefragment.hxx b/include/oox/drawingml/chart/chartspacefragment.hxx
new file mode 100644
index 000000000000..c9b1e0c6b776
--- /dev/null
+++ b/include/oox/drawingml/chart/chartspacefragment.hxx
@@ -0,0 +1,55 @@
+/* -*- 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 OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX
+#define OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct ChartSpaceModel;
+
+/** Handler for a chart fragment (c:chartSpace root element).
+ */
+class ChartSpaceFragment : public FragmentBase< ChartSpaceModel >
+{
+public:
+ explicit ChartSpaceFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ ChartSpaceModel& rModel );
+ virtual ~ChartSpaceFragment();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartspacemodel.hxx b/include/oox/drawingml/chart/chartspacemodel.hxx
new file mode 100644
index 000000000000..b3d3405c4670
--- /dev/null
+++ b/include/oox/drawingml/chart/chartspacemodel.hxx
@@ -0,0 +1,72 @@
+/* -*- 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 OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX
+#define OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/plotareamodel.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct ChartSpaceModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< PlotAreaModel > PlotAreaRef;
+ typedef ModelRef< WallFloorModel > WallFloorRef;
+ typedef ModelRef< View3DModel > View3DRef;
+ typedef ModelRef< TitleModel > TitleRef;
+ typedef ModelRef< LegendModel > LegendRef;
+
+ ShapeRef mxShapeProp; /// Chart frame formatting.
+ TextBodyRef mxTextProp; /// Global chart text formatting.
+ PlotAreaRef mxPlotArea; /// Plot area of the chart.
+ WallFloorRef mxFloor; /// Floor formatting in 3D charts.
+ WallFloorRef mxBackWall; /// Back wall formatting in 3D charts.
+ WallFloorRef mxSideWall; /// Side wall formatting in 3D charts.
+ View3DRef mxView3D; /// 3D settings.
+ TitleRef mxTitle; /// Chart main title.
+ LegendRef mxLegend; /// Chart legend.
+ OUString maDrawingPath; /// Path to drawing fragment with embedded shapes.
+ sal_Int32 mnDispBlanksAs; /// Mode how to display blank values.
+ sal_Int32 mnStyle; /// Index to default formatting.
+ bool mbAutoTitleDel; /// True = automatic title deleted manually.
+ bool mbPlotVisOnly; /// True = plot visible cells in a sheet only.
+ bool mbShowLabelsOverMax;/// True = show labels over chart maximum.
+ bool mbPivotChart; /// True = pivot chart.
+
+ explicit ChartSpaceModel();
+ ~ChartSpaceModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/converterbase.hxx b/include/oox/drawingml/chart/converterbase.hxx
new file mode 100644
index 000000000000..21a03441e803
--- /dev/null
+++ b/include/oox/drawingml/chart/converterbase.hxx
@@ -0,0 +1,153 @@
+/* -*- 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 OOX_DRAWINGML_CHART_CONVERTERBASE_HXX
+#define OOX_DRAWINGML_CHART_CONVERTERBASE_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+#include "oox/drawingml/chart/objectformatter.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Rectangle; }
+ namespace awt { struct Size; }
+ namespace chart2 { class XChartDocument; }
+ namespace chart2 { class XTitle; }
+ namespace drawing { class XShape; }
+} } }
+
+namespace oox { namespace core {
+ class XmlFilterBase;
+} }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+class ChartConverter;
+struct ChartSpaceModel;
+struct ConverterData;
+
+// ============================================================================
+
+const sal_Int32 API_PRIM_AXESSET = 0;
+const sal_Int32 API_SECN_AXESSET = 1;
+
+const sal_Int32 API_X_AXIS = 0;
+const sal_Int32 API_Y_AXIS = 1;
+const sal_Int32 API_Z_AXIS = 2;
+
+// ============================================================================
+
+class ConverterRoot
+{
+public:
+ explicit ConverterRoot(
+ ::oox::core::XmlFilterBase& rFilter,
+ ChartConverter& rChartConverter,
+ const ChartSpaceModel& rChartModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
+ const ::com::sun::star::awt::Size& rChartSize );
+ virtual ~ConverterRoot();
+
+ /** Creates an instance for the passed service name, using the process service factory. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ createInstance( const OUString& rServiceName ) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ getComponentContext() const;
+
+protected:
+ /** Returns the filter object of the imported/exported document. */
+ ::oox::core::XmlFilterBase& getFilter() const;
+ /** Returns the chart converter. */
+ ChartConverter* getChartConverter() const;
+ /** Returns the API chart document model. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
+ getChartDocument() const;
+ /** Returns the position and size of the chart shape in 1/100 mm. */
+ const ::com::sun::star::awt::Size& getChartSize() const;
+ /** Returns the object formatter. */
+ ObjectFormatter& getFormatter() const;
+
+ /** Registers a title object and its layout data, needed for conversion of
+ the title position using the old Chart1 API. */
+ void registerTitleLayout(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle >& rxTitle,
+ const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType,
+ sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 );
+ /** Converts the positions of the main title and all axis titles. */
+ void convertTitlePositions();
+
+private:
+ ::boost::shared_ptr< ConverterData > mxData;
+};
+
+// ============================================================================
+
+/** Base class of all converter classes. Holds a reference to a model structure
+ of the specified type.
+ */
+template< typename ModelType >
+class ConverterBase : public ConverterRoot
+{
+public:
+ inline const ModelType& getModel() const { return mrModel; }
+
+protected:
+ inline explicit ConverterBase( const ConverterRoot& rParent, ModelType& rModel ) :
+ ConverterRoot( rParent ), mrModel( rModel ) {}
+ virtual ~ConverterBase() {}
+
+protected:
+ ModelType& mrModel;
+};
+
+// ============================================================================
+
+/** A layout converter calculates positions and sizes for various chart objects.
+ */
+class LayoutConverter : public ConverterBase< LayoutModel >
+{
+public:
+ explicit LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel );
+ virtual ~LayoutConverter();
+
+ /** Tries to calculate the absolute position and size from the contained
+ OOXML layout model. Returns true, if returned rectangle is valid. */
+ bool calcAbsRectangle( ::com::sun::star::awt::Rectangle& orRect ) const;
+
+ /** Tries to set the position and size from the contained OOXML layout model.
+ Returns true, if a manual position and size could be calculated. */
+ bool convertFromModel( PropertySet& rPropSet );
+
+ /** Tries to set the position from the contained OOXML layout model.
+ Returns true, if a manual position could be calculated. */
+ bool convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ double fRotationAngle );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourcecontext.hxx b/include/oox/drawingml/chart/datasourcecontext.hxx
new file mode 100644
index 000000000000..163b99c868e4
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourcecontext.hxx
@@ -0,0 +1,94 @@
+/* -*- 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 OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX
+#define OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataSequenceModel;
+
+typedef ContextBase< DataSequenceModel > DataSequenceContextBase;
+
+// ============================================================================
+
+/** Handler for a double sequence context (c:numLit, c:numRef elements).
+ */
+class DoubleSequenceContext : public DataSequenceContextBase
+{
+public:
+ explicit DoubleSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel );
+ virtual ~DoubleSequenceContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+
+private:
+ sal_Int32 mnPtIndex; /// Current data point index.
+};
+
+// ============================================================================
+
+/** Handler for a string sequence context (c:multiLvlStrRef, c:strLit,
+ c:strRef elements).
+ */
+class StringSequenceContext : public DataSequenceContextBase
+{
+public:
+ explicit StringSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel );
+ virtual ~StringSequenceContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+
+private:
+ sal_Int32 mnPtIndex; /// Current data point index.
+};
+
+// ============================================================================
+
+struct DataSourceModel;
+
+/** Handler for a data source context (c:bubbleSize, c:cat, c:minus, c:plus,
+ c:val, c:xVal, c:yVal elements).
+ */
+class DataSourceContext : public ContextBase< DataSourceModel >
+{
+public:
+ explicit DataSourceContext( ::oox::core::ContextHandler2Helper& rParent, DataSourceModel& rModel );
+ virtual ~DataSourceContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourceconverter.hxx b/include/oox/drawingml/chart/datasourceconverter.hxx
new file mode 100644
index 000000000000..e8b5649e1bef
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourceconverter.hxx
@@ -0,0 +1,71 @@
+/* -*- 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 OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX
+#define OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { namespace data { class XDataSequence; } }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataSequenceModel;
+
+class DataSequenceConverter : public ConverterBase< DataSequenceModel >
+{
+public:
+ explicit DataSequenceConverter( const ConverterRoot& rParent, DataSequenceModel& rModel );
+ virtual ~DataSequenceConverter();
+
+ /** Creates a data sequence object from the contained formula link. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence( const OUString& rRole );
+};
+
+// ============================================================================
+
+struct DataSourceModel;
+
+class DataSourceConverter : public ConverterBase< DataSourceModel >
+{
+public:
+ explicit DataSourceConverter( const ConverterRoot& rParent, DataSourceModel& rModel );
+ virtual ~DataSourceConverter();
+
+ /** Creates a data sequence object from the contained series data. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence( const OUString& rRole );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourcemodel.hxx b/include/oox/drawingml/chart/datasourcemodel.hxx
new file mode 100644
index 000000000000..d43048ef071c
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourcemodel.hxx
@@ -0,0 +1,65 @@
+/* -*- 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 OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX
+#define OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include "oox/drawingml/chart/modelbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataSequenceModel
+{
+ typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > AnyMap;
+
+ AnyMap maData; /// Map of values, indexed by point identifier.
+ OUString maFormula; /// Formula reference, e.g. into a spreadsheet.
+ OUString maFormatCode; /// Number format for double values.
+ sal_Int32 mnPointCount; /// Number of points in this series source.
+
+ explicit DataSequenceModel();
+ ~DataSequenceModel();
+};
+
+// ============================================================================
+
+struct DataSourceModel
+{
+ typedef ModelRef< DataSequenceModel > DataSequenceRef;
+
+ DataSequenceRef mxDataSeq; /// The data sequence or formula link of this source.
+
+ explicit DataSourceModel();
+ ~DataSourceModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/modelbase.hxx b/include/oox/drawingml/chart/modelbase.hxx
new file mode 100644
index 000000000000..985221ec394b
--- /dev/null
+++ b/include/oox/drawingml/chart/modelbase.hxx
@@ -0,0 +1,134 @@
+/* -*- 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 OOX_DRAWINGML_CHART_MODELBASE_HXX
+#define OOX_DRAWINGML_CHART_MODELBASE_HXX
+
+#include "oox/helper/helper.hxx"
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
+
+namespace oox { class AttributeList; }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+template< typename ModelType >
+class ModelRef : public ::boost::shared_ptr< ModelType >
+{
+public:
+ inline explicit ModelRef() {}
+ inline ModelRef( const ::boost::shared_ptr< ModelType >& rxModel ) : ::boost::shared_ptr< ModelType >( rxModel ) {}
+ inline ~ModelRef() {}
+
+ inline bool is() const { return this->get() != 0; }
+
+ inline ModelType& create() { this->reset( new ModelType ); return **this; }
+ template< typename Param1Type >
+ inline ModelType& create( const Param1Type& rParam1 ) { this->reset( new ModelType( rParam1 ) ); return **this; }
+
+ inline ModelType& getOrCreate() { if( !*this ) this->reset( new ModelType ); return **this; }
+ template< typename Param1Type >
+ inline ModelType& getOrCreate( const Param1Type& rParam1 ) { if( !*this ) this->reset( new ModelType( rParam1 ) ); return **this; }
+};
+
+// ============================================================================
+
+template< typename ModelType >
+class ModelVector : public RefVector< ModelType >
+{
+public:
+ typedef typename RefVector< ModelType >::value_type value_type;
+ typedef typename RefVector< ModelType >::size_type size_type;
+
+ inline explicit ModelVector() {}
+ inline ~ModelVector() {}
+
+ inline ModelType& create() { return append( new ModelType ); }
+ template< typename Param1Type >
+ inline ModelType& create( const Param1Type& rParam1 ) { return append( new ModelType( rParam1 ) ); }
+
+private:
+ inline ModelType& append( ModelType* pModel ) { this->push_back( value_type( pModel ) ); return *pModel; }
+};
+
+// ============================================================================
+
+template< typename KeyType, typename ModelType >
+class ModelMap : public RefMap< KeyType, ModelType >
+{
+public:
+ typedef typename RefMap< KeyType, ModelType >::key_type key_type;
+ typedef typename RefMap< KeyType, ModelType >::mapped_type mapped_type;
+ typedef typename RefMap< KeyType, ModelType >::value_type value_type;
+
+ inline explicit ModelMap() {}
+ inline ~ModelMap() {}
+
+ inline ModelType& create( KeyType eKey ) { return insert( eKey, new ModelType ); }
+ template< typename Param1Type >
+ inline ModelType& create( KeyType eKey, const Param1Type& rParam1 ) { return insert( eKey, new ModelType( rParam1 ) ); }
+
+private:
+ inline ModelType& insert( KeyType eKey, ModelType* pModel ) { (*this)[ eKey ].reset( pModel ); return *pModel; }
+};
+
+// ============================================================================
+
+struct NumberFormat
+{
+ OUString maFormatCode; /// Number format code.
+ bool mbSourceLinked; /// True = number format linked to source data.
+
+ explicit NumberFormat();
+
+ void setAttributes( const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct LayoutModel
+{
+ double mfX; /// Left position of this object.
+ double mfY; /// Top position of this object.
+ double mfW; /// Width of this object.
+ double mfH; /// Height of this object.
+ sal_Int32 mnXMode; /// Mode for left position.
+ sal_Int32 mnYMode; /// Mode for top position.
+ sal_Int32 mnWMode; /// Mode for width.
+ sal_Int32 mnHMode; /// Mode for height.
+ sal_Int32 mnTarget; /// Layout target for plot area.
+ bool mbAutoLayout; /// True = automatic positioning.
+
+ explicit LayoutModel();
+ ~LayoutModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/objectformatter.hxx b/include/oox/drawingml/chart/objectformatter.hxx
new file mode 100644
index 000000000000..5b2bb727f4fd
--- /dev/null
+++ b/include/oox/drawingml/chart/objectformatter.hxx
@@ -0,0 +1,157 @@
+/* -*- 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 OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
+#define OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
+
+#include "oox/helper/propertyset.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/chart/modelbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XChartDocument; }
+} } }
+
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+/** Enumerates different object types for specific automatic formatting behaviour. */
+enum ObjectType
+{
+ OBJECTTYPE_CHARTSPACE, /// Chart background.
+ OBJECTTYPE_CHARTTITLE, /// Chart title.
+ OBJECTTYPE_LEGEND, /// Legend.
+ OBJECTTYPE_PLOTAREA2D, /// Plot area containing axes and data series in 2D charts.
+ OBJECTTYPE_PLOTAREA3D, /// Plot area containing axes and data series in 3D charts.
+ OBJECTTYPE_WALL, /// Background and side wall in 3D charts.
+ OBJECTTYPE_FLOOR, /// Floor in 3D charts.
+ OBJECTTYPE_AXIS, /// Axis line, labels, tick marks.
+ OBJECTTYPE_AXISTITLE, /// Axis title.
+ OBJECTTYPE_AXISUNIT, /// Axis unit label.
+ OBJECTTYPE_MAJORGRIDLINE, /// Axis major grid line.
+ OBJECTTYPE_MINORGRIDLINE, /// Axis minor grid line.
+ OBJECTTYPE_LINEARSERIES2D, /// Linear series in 2D line/radarline/scatter charts.
+ OBJECTTYPE_FILLEDSERIES2D, /// Filled series in 2D bar/area/radararea/bubble/pie/surface charts.
+ OBJECTTYPE_FILLEDSERIES3D, /// Filled series in 3D charts.
+ OBJECTTYPE_DATALABEL, /// Labels for data points.
+ OBJECTTYPE_TRENDLINE, /// Data series trend line.
+ OBJECTTYPE_TRENDLINELABEL, /// Trend line label.
+ OBJECTTYPE_ERRORBAR, /// Data series error indicator line.
+ OBJECTTYPE_SERLINE, /// Data point connector lines.
+ OBJECTTYPE_LEADERLINE, /// Leader lines between pie slice and data label.
+ OBJECTTYPE_DROPLINE, /// Drop lines between data points and X axis.
+ OBJECTTYPE_HILOLINE, /// High/low lines in line/stock charts.
+ OBJECTTYPE_UPBAR, /// Up-bar in line/stock charts.
+ OBJECTTYPE_DOWNBAR, /// Down-bar in line/stock charts.
+ OBJECTTYPE_DATATABLE /// Data table.
+};
+
+// ============================================================================
+
+struct ChartSpaceModel;
+struct ObjectFormatterData;
+struct PictureOptionsModel;
+
+class ObjectFormatter
+{
+public:
+ explicit ObjectFormatter(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
+ const ChartSpaceModel& rChartSpace );
+ ~ObjectFormatter();
+
+ /** Sets the maximum series index used for color cycling/fading. */
+ void setMaxSeriesIndex( sal_Int32 nMaxSeriesIdx );
+ /** Returns the current maximum series index used for color cycling/fading. */
+ sal_Int32 getMaxSeriesIndex() const;
+
+ /** Sets frame formatting properties to the passed property set. */
+ void convertFrameFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< Shape >& rxShapeProp,
+ ObjectType eObjType,
+ sal_Int32 nSeriesIdx = -1 );
+
+ /** Sets frame formatting properties to the passed property set. */
+ void convertFrameFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< Shape >& rxShapeProp,
+ const PictureOptionsModel& rPicOptions,
+ ObjectType eObjType,
+ sal_Int32 nSeriesIdx = -1 );
+
+ /** Sets text formatting properties to the passed property set. */
+ void convertTextFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< TextBody >& rxTextProp,
+ ObjectType eObjType );
+
+ /** Sets frame/text formatting properties to the passed property set. */
+ void convertFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< Shape >& rxShapeProp,
+ const ModelRef< TextBody >& rxTextProp,
+ ObjectType eObjType );
+
+ /** Sets text formatting properties to the passed property set. */
+ void convertTextFormatting(
+ PropertySet& rPropSet,
+ const TextCharacterProperties& rTextProps,
+ ObjectType eObjType );
+
+ /** Sets text rotation properties to the passed property set. */
+ void convertTextRotation(
+ PropertySet& rPropSet,
+ const ModelRef< TextBody >& rxTextProp,
+ bool bSupportsStacked );
+
+ /** Sets number format properties to the passed property set. */
+ void convertNumberFormat(
+ PropertySet& rPropSet,
+ const NumberFormat& rNumberFormat,
+ bool bPercentFormat = false );
+
+ /** Sets automatic fill properties to the passed property set. */
+ void convertAutomaticFill(
+ PropertySet& rPropSet,
+ ObjectType eObjType,
+ sal_Int32 nSeriesIdx = -1 );
+
+ /** Returns true, if the passed shape properties have automatic fill mode. */
+ static bool isAutomaticFill( const ModelRef< Shape >& rxShapeProp );
+
+private:
+ ::boost::shared_ptr< ObjectFormatterData > mxData;
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/plotareacontext.hxx b/include/oox/drawingml/chart/plotareacontext.hxx
new file mode 100644
index 000000000000..d9966a8d8bf4
--- /dev/null
+++ b/include/oox/drawingml/chart/plotareacontext.hxx
@@ -0,0 +1,83 @@
+/* -*- 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 OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX
+#define OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct View3DModel;
+
+/** Handler for a chart plot area context (c:plotArea element).
+ */
+class View3DContext : public ContextBase< View3DModel >
+{
+public:
+ explicit View3DContext( ::oox::core::ContextHandler2Helper& rParent, View3DModel& rModel );
+ virtual ~View3DContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct WallFloorModel;
+
+/** Handler for a chart wall/floor context (c:backWall, c:floor, c:sideWall
+ elements).
+ */
+class WallFloorContext : public ContextBase< WallFloorModel >
+{
+public:
+ explicit WallFloorContext( ::oox::core::ContextHandler2Helper& rParent, WallFloorModel& rModel );
+ virtual ~WallFloorContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct PlotAreaModel;
+
+/** Handler for a chart plot area context (c:plotArea element).
+ */
+class PlotAreaContext : public ContextBase< PlotAreaModel >
+{
+public:
+ explicit PlotAreaContext( ::oox::core::ContextHandler2Helper& rParent, PlotAreaModel& rModel );
+ virtual ~PlotAreaContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/plotareaconverter.hxx b/include/oox/drawingml/chart/plotareaconverter.hxx
new file mode 100644
index 000000000000..6796ffbd6a1c
--- /dev/null
+++ b/include/oox/drawingml/chart/plotareaconverter.hxx
@@ -0,0 +1,103 @@
+/* -*- 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 OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX
+#define OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XDiagram; }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct View3DModel;
+class TypeGroupConverter;
+
+class View3DConverter : public ConverterBase< View3DModel >
+{
+public:
+ explicit View3DConverter( const ConverterRoot& rParent, View3DModel& rModel );
+ virtual ~View3DConverter();
+
+ /** Converts the OOXML plot area model to a chart2 diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
+ TypeGroupConverter& rTypeGroup );
+};
+
+// ============================================================================
+
+struct WallFloorModel;
+
+class WallFloorConverter : public ConverterBase< WallFloorModel >
+{
+public:
+ explicit WallFloorConverter( const ConverterRoot& rParent, WallFloorModel& rModel );
+ virtual ~WallFloorConverter();
+
+ /** Converts the OOXML wall/floor model to a chart2 diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
+ ObjectType eObjType );
+};
+
+// ============================================================================
+
+struct PlotAreaModel;
+
+class PlotAreaConverter : public ConverterBase< PlotAreaModel >
+{
+public:
+ explicit PlotAreaConverter( const ConverterRoot& rParent, PlotAreaModel& rModel );
+ virtual ~PlotAreaConverter();
+
+ /** Converts the OOXML plot area model to a chart2 diagram. */
+ void convertFromModel( View3DModel& rView3DModel );
+ /** Converts the manual plot area position and size, if set. */
+ void convertPositionFromModel();
+
+ /** Returns the automatic chart title if the chart contains only one series. */
+ inline const OUString& getAutomaticTitle() const { return maAutoTitle; }
+ /** Returns true, if the chart is three-dimensional. */
+ inline bool is3dChart() const { return mb3dChart; }
+ /** Returns true, if chart type supports wall and floor format in 3D mode. */
+ inline bool isWall3dChart() const { return mbWall3dChart; }
+
+private:
+ OUString maAutoTitle;
+ bool mb3dChart;
+ bool mbWall3dChart;
+ bool mbPieChart;
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/plotareamodel.hxx b/include/oox/drawingml/chart/plotareamodel.hxx
new file mode 100644
index 000000000000..2afd6ccdd1da
--- /dev/null
+++ b/include/oox/drawingml/chart/plotareamodel.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 OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX
+#define OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/axismodel.hxx"
+#include "oox/drawingml/chart/seriesmodel.hxx"
+#include "oox/drawingml/chart/typegroupmodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct View3DModel
+{
+ OptValue< sal_Int32 > monHeightPercent; /// Height of the 3D view, relative to chart width.
+ OptValue< sal_Int32 > monRotationX; /// Horizontal rotation in degrees.
+ OptValue< sal_Int32 > monRotationY; /// Vertical rotation in degrees.
+ sal_Int32 mnDepthPercent; /// Depth of the 3D view, relative to chart width.
+ sal_Int32 mnPerspective; /// Eye distance to the 3D objects.
+ bool mbRightAngled; /// True = right-angled axes in 3D view.
+
+ explicit View3DModel();
+ ~View3DModel();
+};
+
+// ============================================================================
+
+struct WallFloorModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
+
+ ShapeRef mxShapeProp; /// Wall/floor frame formatting.
+ PictureOptionsRef mxPicOptions; /// Fill bitmap settings.
+
+ explicit WallFloorModel();
+ ~WallFloorModel();
+};
+
+// ============================================================================
+
+struct PlotAreaModel
+{
+ typedef ModelVector< TypeGroupModel > TypeGroupVector;
+ typedef ModelVector< AxisModel > AxisVector;
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+
+ TypeGroupVector maTypeGroups; /// All chart type groups contained in the chart.
+ AxisVector maAxes; /// All axes contained in the chart.
+ ShapeRef mxShapeProp; /// Plot area frame formatting.
+ LayoutRef mxLayout; /// Layout/position of the plot area.
+
+ explicit PlotAreaModel();
+ ~PlotAreaModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/seriescontext.hxx b/include/oox/drawingml/chart/seriescontext.hxx
new file mode 100644
index 000000000000..e31156dd2796
--- /dev/null
+++ b/include/oox/drawingml/chart/seriescontext.hxx
@@ -0,0 +1,266 @@
+/* -*- 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 OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX
+#define OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataLabelModel;
+
+/** Handler for a chart data point label context (c:dLbl element).
+ */
+class DataLabelContext : public ContextBase< DataLabelModel >
+{
+public:
+ explicit DataLabelContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelModel& rModel );
+ virtual ~DataLabelContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct DataLabelsModel;
+
+/** Handler for a chart data point label context (c:dLbl element).
+ */
+class DataLabelsContext : public ContextBase< DataLabelsModel >
+{
+public:
+ explicit DataLabelsContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelsModel& rModel );
+ virtual ~DataLabelsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct PictureOptionsModel;
+
+/** Handler for fill bitmap settings (c:pictureOptions element).
+ */
+class PictureOptionsContext : public ContextBase< PictureOptionsModel >
+{
+public:
+ explicit PictureOptionsContext( ::oox::core::ContextHandler2Helper& rParent, PictureOptionsModel& rModel );
+ virtual ~PictureOptionsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct ErrorBarModel;
+
+/** Handler for a series error bar context (c:errBars element).
+ */
+class ErrorBarContext : public ContextBase< ErrorBarModel >
+{
+public:
+ explicit ErrorBarContext( ::oox::core::ContextHandler2Helper& rParent, ErrorBarModel& rModel );
+ virtual ~ErrorBarContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TrendlineLabelModel;
+
+/** Handler for a series trendline label context (c:trendlineLbl element).
+ */
+class TrendlineLabelContext : public ContextBase< TrendlineLabelModel >
+{
+public:
+ explicit TrendlineLabelContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineLabelModel& rModel );
+ virtual ~TrendlineLabelContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TrendlineModel;
+
+/** Handler for a series trendline context (c:trendline element).
+ */
+class TrendlineContext : public ContextBase< TrendlineModel >
+{
+public:
+ explicit TrendlineContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineModel& rModel );
+ virtual ~TrendlineContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct DataPointModel;
+
+/** Handler for a chart data point context (c:dPt element).
+ */
+class DataPointContext : public ContextBase< DataPointModel >
+{
+public:
+ explicit DataPointContext( ::oox::core::ContextHandler2Helper& rParent, DataPointModel& rModel );
+ virtual ~DataPointContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct SeriesModel;
+
+/** Handler base class for chart data series contexts (c:ser element).
+ */
+class SeriesContextBase : public ContextBase< SeriesModel >
+{
+public:
+ explicit SeriesContextBase( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~SeriesContextBase();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for area chart types (c:ser element).
+ */
+class AreaSeriesContext : public SeriesContextBase
+{
+public:
+ explicit AreaSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~AreaSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for bar chart types (c:ser element).
+ */
+class BarSeriesContext : public SeriesContextBase
+{
+public:
+ explicit BarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~BarSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for bubble chart types (c:ser element).
+ */
+class BubbleSeriesContext : public SeriesContextBase
+{
+public:
+ explicit BubbleSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~BubbleSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for line and stock chart types (c:ser
+ element).
+ */
+class LineSeriesContext : public SeriesContextBase
+{
+public:
+ explicit LineSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~LineSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for pie and doughnut chart types (c:ser
+ element).
+ */
+class PieSeriesContext : public SeriesContextBase
+{
+public:
+ explicit PieSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~PieSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for radar chart types (c:ser element).
+ */
+class RadarSeriesContext : public SeriesContextBase
+{
+public:
+ explicit RadarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~RadarSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for scatter chart types (c:ser element).
+ */
+class ScatterSeriesContext : public SeriesContextBase
+{
+public:
+ explicit ScatterSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~ScatterSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for scatter chart types (c:ser element).
+ */
+class SurfaceSeriesContext : public SeriesContextBase
+{
+public:
+ explicit SurfaceSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~SurfaceSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/seriesconverter.hxx b/include/oox/drawingml/chart/seriesconverter.hxx
new file mode 100644
index 000000000000..073073c5bbe7
--- /dev/null
+++ b/include/oox/drawingml/chart/seriesconverter.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/.
+ *
+ * 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 OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+#include "oox/drawingml/chart/seriesmodel.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XDataSeries; }
+ namespace chart2 { namespace data { class XLabeledDataSequence; } }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+class TypeGroupConverter;
+
+// #i66858# enable this when Chart2 supports smoothed lines per data series
+#define OOX_CHART_SMOOTHED_PER_SERIES 0
+
+// ============================================================================
+
+class DataLabelConverter : public ConverterBase< DataLabelModel >
+{
+public:
+ explicit DataLabelConverter( const ConverterRoot& rParent, DataLabelModel& rModel );
+ virtual ~DataLabelConverter();
+
+ /** Converts OOXML data label settings for the passed data point. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries,
+ const TypeGroupConverter& rTypeGroup );
+
+ /** Conversion helper for data series and data points. */
+ static void convertLabelFormatting(
+ PropertySet& rPropSet,
+ ObjectFormatter& rFormatter,
+ const DataLabelModelBase& rDataLabel,
+ const TypeGroupConverter& rTypeGroup,
+ bool bDataSeriesLabel );
+};
+
+// ============================================================================
+
+class DataLabelsConverter : public ConverterBase< DataLabelsModel >
+{
+public:
+ explicit DataLabelsConverter( const ConverterRoot& rParent, DataLabelsModel& rModel );
+ virtual ~DataLabelsConverter();
+
+ /** Converts OOXML data label settings for the passed data series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries,
+ const TypeGroupConverter& rTypeGroup );
+};
+
+// ============================================================================
+
+class ErrorBarConverter : public ConverterBase< ErrorBarModel >
+{
+public:
+ explicit ErrorBarConverter( const ConverterRoot& rParent, ErrorBarModel& rModel );
+ virtual ~ErrorBarConverter();
+
+ /** Converts an OOXML errorbar and inserts it into the passed data series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence( ErrorBarModel::SourceType eSourceType );
+};
+
+// ============================================================================
+
+class TrendlineLabelConverter : public ConverterBase< TrendlineLabelModel >
+{
+public:
+ explicit TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel );
+ virtual ~TrendlineLabelConverter();
+
+ /** Converts the OOXML trendline label. */
+ void convertFromModel( PropertySet& rPropSet );
+};
+
+// ============================================================================
+
+class TrendlineConverter : public ConverterBase< TrendlineModel >
+{
+public:
+ explicit TrendlineConverter( const ConverterRoot& rParent, TrendlineModel& rModel );
+ virtual ~TrendlineConverter();
+
+ /** Converts an OOXML trendline and inserts it into the passed data series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries );
+};
+
+// ============================================================================
+
+class DataPointConverter : public ConverterBase< DataPointModel >
+{
+public:
+ explicit DataPointConverter( const ConverterRoot& rParent, DataPointModel& rModel );
+ virtual ~DataPointConverter();
+
+ /** Converts settings for a data point in the passed series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries,
+ const TypeGroupConverter& rTypeGroup,
+ const SeriesModel& rSeries );
+};
+
+// ============================================================================
+
+class SeriesConverter : public ConverterBase< SeriesModel >
+{
+public:
+ explicit SeriesConverter( const ConverterRoot& rParent, SeriesModel& rModel );
+ virtual ~SeriesConverter();
+
+ /** Creates a labeled data sequence object from category data link. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createCategorySequence( const OUString& rRole );
+ /** Creates a labeled data sequence object from value data link. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createValueSequence( const OUString& rRole );
+ /** Creates a data series object with initialized source links. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >
+ createDataSeries( const TypeGroupConverter& rTypeGroup, bool bVaryColorsByPoint );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence(
+ SeriesModel::SourceType eSourceType,
+ const OUString& rRole,
+ bool bUseTextLabel );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/seriesmodel.hxx b/include/oox/drawingml/chart/seriesmodel.hxx
new file mode 100644
index 000000000000..998065f7f8ad
--- /dev/null
+++ b/include/oox/drawingml/chart/seriesmodel.hxx
@@ -0,0 +1,237 @@
+/* -*- 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 OOX_DRAWINGML_CHART_SERIESMODEL_HXX
+#define OOX_DRAWINGML_CHART_SERIESMODEL_HXX
+
+#include "oox/drawingml/chart/datasourcemodel.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataLabelModelBase
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+
+ ShapeRef mxShapeProp; /// Data label frame formatting.
+ TextBodyRef mxTextProp; /// Data label text formatting.
+ NumberFormat maNumberFormat; /// Number format for numeric data labels.
+ OptValue< OUString > moaSeparator;/// Separator between label components.
+ OptValue< sal_Int32 > monLabelPos; /// Data label position.
+ OptValue< bool > mobShowBubbleSize; /// True = show size of bubbles in bubble charts.
+ OptValue< bool > mobShowCatName; /// True = show category name of data points.
+ OptValue< bool > mobShowLegendKey; /// True = show legend key of data series.
+ OptValue< bool > mobShowPercent; /// True = show percentual value in pie/doughnut charts.
+ OptValue< bool > mobShowSerName; /// True = show series name.
+ OptValue< bool > mobShowVal; /// True = show data point value.
+ bool mbDeleted; /// True = data label(s) deleted.
+
+ explicit DataLabelModelBase();
+ ~DataLabelModelBase();
+};
+
+// ============================================================================
+
+struct DataLabelModel : public DataLabelModelBase
+{
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ LayoutRef mxLayout; /// Layout/position of the data point label frame.
+ TextRef mxText; /// Manual or linked text for this data point label.
+ sal_Int32 mnIndex; /// Data point index for this data label.
+
+ explicit DataLabelModel();
+ ~DataLabelModel();
+};
+
+// ============================================================================
+
+struct DataLabelsModel : public DataLabelModelBase
+{
+ typedef ModelVector< DataLabelModel > DataLabelVector;
+ typedef ModelRef< Shape > ShapeRef;
+
+ DataLabelVector maPointLabels; /// Settings for individual data point labels.
+ ShapeRef mxLeaderLines; /// Formatting of connector lines between data points and labels.
+ bool mbShowLeaderLines; /// True = show connector lines between data points and labels.
+
+ explicit DataLabelsModel();
+ ~DataLabelsModel();
+};
+
+// ============================================================================
+
+struct PictureOptionsModel
+{
+ double mfStackUnit; /// Bitmap stacking unit.
+ sal_Int32 mnPictureFormat; /// Bitmap mode (stretch/tile).
+ bool mbApplyToFront; /// True = draw picture at front/back side of 3D data points.
+ bool mbApplyToSides; /// True = draw picture at left/right side of 3D data points.
+ bool mbApplyToEnd; /// True = draw picture at top/bottom side of 3D data points.
+
+ explicit PictureOptionsModel();
+ ~PictureOptionsModel();
+};
+
+// ============================================================================
+
+struct ErrorBarModel
+{
+ enum SourceType
+ {
+ PLUS, /// Plus error bar values.
+ MINUS /// Minus error bar values.
+ };
+
+ typedef ModelMap< SourceType, DataSourceModel > DataSourceMap;
+ typedef ModelRef< Shape > ShapeRef;
+
+ DataSourceMap maSources; /// Source ranges for manual error bar values.
+ ShapeRef mxShapeProp; /// Error line formatting.
+ double mfValue; /// Fixed value for several error bar types.
+ sal_Int32 mnDirection; /// Direction of the error bars (x/y).
+ sal_Int32 mnTypeId; /// Type of the error bars (plus/minus/both).
+ sal_Int32 mnValueType; /// Type of the values.
+ bool mbNoEndCap; /// True = no end cap at error bar lines.
+
+ explicit ErrorBarModel();
+ ~ErrorBarModel();
+};
+
+// ============================================================================
+
+struct TrendlineLabelModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ ShapeRef mxShapeProp; /// Label frame formatting.
+ TextBodyRef mxTextProp; /// Label text formatting.
+ LayoutRef mxLayout; /// Layout/position of the frame.
+ TextRef mxText; /// Text source of the label.
+ NumberFormat maNumberFormat; /// Number format for coefficients.
+
+ explicit TrendlineLabelModel();
+ ~TrendlineLabelModel();
+};
+
+// ============================================================================
+
+struct TrendlineModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TrendlineLabelModel > TrendlineLabelRef;
+
+ ShapeRef mxShapeProp; /// Trendline formatting.
+ TrendlineLabelRef mxLabel; /// Trendline label text object.
+ OUString maName; /// User-defined name of the trendline.
+ OptValue< double > mfBackward; /// Size of trendline before first data point.
+ OptValue< double > mfForward; /// Size of trendline behind last data point.
+ OptValue< double > mfIntercept; /// Crossing point with Y axis.
+ sal_Int32 mnOrder; /// Polynomial order in range [2, 6].
+ sal_Int32 mnPeriod; /// Moving average period in range [2, 255].
+ sal_Int32 mnTypeId; /// Type of the trendline.
+ bool mbDispEquation; /// True = show equation of the trendline.
+ bool mbDispRSquared; /// True = show R-squared of the trendline.
+
+ explicit TrendlineModel();
+ ~TrendlineModel();
+};
+
+// ============================================================================
+
+struct DataPointModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
+
+ ShapeRef mxShapeProp; /// Data point formatting.
+ PictureOptionsRef mxPicOptions; /// Fill bitmap settings.
+ ShapeRef mxMarkerProp; /// Data point marker formatting.
+ OptValue< sal_Int32 > monExplosion; /// Pie slice moved from pie center.
+ OptValue< sal_Int32 > monMarkerSize; /// Size of the series line marker (2...72).
+ OptValue< sal_Int32 > monMarkerSymbol; /// Series line marker symbol.
+ OptValue< bool > mobBubble3d; /// True = show bubbles with 3D shade.
+ sal_Int32 mnIndex; /// Unique data point index.
+ bool mbInvertNeg; /// True = invert negative data points (not derived from series!).
+
+ explicit DataPointModel();
+ ~DataPointModel();
+};
+
+// ============================================================================
+
+struct SeriesModel
+{
+ enum SourceType
+ {
+ CATEGORIES, /// Data point categories.
+ VALUES, /// Data point values.
+ POINTS /// Data point size (e.g. bubble size in bubble charts).
+ };
+
+ typedef ModelMap< SourceType, DataSourceModel > DataSourceMap;
+ typedef ModelVector< ErrorBarModel > ErrorBarVector;
+ typedef ModelVector< TrendlineModel > TrendlineVector;
+ typedef ModelVector< DataPointModel > DataPointVector;
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
+ typedef ModelRef< TextModel > TextRef;
+ typedef ModelRef< DataLabelsModel > DataLabelsRef;
+
+ DataSourceMap maSources; /// Series source ranges.
+ ErrorBarVector maErrorBars; /// All error bars of this series.
+ TrendlineVector maTrendlines; /// All trendlines of this series.
+ DataPointVector maPoints; /// Explicit formatted data points.
+ ShapeRef mxShapeProp; /// Series formatting.
+ PictureOptionsRef mxPicOptions; /// Fill bitmap settings.
+ ShapeRef mxMarkerProp; /// Data point marker formatting.
+ TextRef mxText; /// Series title source.
+ DataLabelsRef mxLabels; /// Data point label settings for all points.
+ OptValue< sal_Int32 > monShape; /// 3D bar shape type.
+ sal_Int32 mnExplosion; /// Pie slice moved from pie center.
+ sal_Int32 mnIndex; /// Series index used for automatic formatting.
+ sal_Int32 mnMarkerSize; /// Size of the series line marker (2...72).
+ sal_Int32 mnMarkerSymbol; /// Series line marker symbol.
+ sal_Int32 mnOrder; /// Series order.
+ bool mbBubble3d; /// True = show bubbles with 3D shade.
+ bool mbInvertNeg; /// True = invert negative data points.
+ bool mbSmooth; /// True = smooth series line.
+
+ explicit SeriesModel();
+ ~SeriesModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/titlecontext.hxx b/include/oox/drawingml/chart/titlecontext.hxx
new file mode 100644
index 000000000000..b00a9ed45b6d
--- /dev/null
+++ b/include/oox/drawingml/chart/titlecontext.hxx
@@ -0,0 +1,83 @@
+/* -*- 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 OOX_DRAWINGML_CHART_TITLECONTEXT_HXX
+#define OOX_DRAWINGML_CHART_TITLECONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct TextModel;
+
+/** Handler for a chart text context (c:tx element).
+ */
+class TextContext : public ContextBase< TextModel >
+{
+public:
+ explicit TextContext( ::oox::core::ContextHandler2Helper& rParent, TextModel& rModel );
+ virtual ~TextContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct TitleModel;
+
+/** Handler for a chart title context (c:title element).
+ */
+class TitleContext : public ContextBase< TitleModel >
+{
+public:
+ explicit TitleContext( ::oox::core::ContextHandler2Helper& rParent, TitleModel& rModel );
+ virtual ~TitleContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct LegendModel;
+
+/** Handler for a chart legend context (c:legend element).
+ */
+class LegendContext : public ContextBase< LegendModel >
+{
+public:
+ explicit LegendContext( ::oox::core::ContextHandler2Helper& rParent, LegendModel& rModel );
+ virtual ~LegendContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/titleconverter.hxx b/include/oox/drawingml/chart/titleconverter.hxx
new file mode 100644
index 000000000000..ad3694568efe
--- /dev/null
+++ b/include/oox/drawingml/chart/titleconverter.hxx
@@ -0,0 +1,106 @@
+/* -*- 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 OOX_DRAWINGML_CHART_TITLECONVERTER_HXX
+#define OOX_DRAWINGML_CHART_TITLECONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XDiagram; }
+ namespace chart2 { class XFormattedString; }
+ namespace chart2 { class XTitled; }
+ namespace chart2 { namespace data { class XDataSequence; } }
+} } }
+
+namespace oox { namespace drawingml { struct TextCharacterProperties; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct TextModel;
+
+class TextConverter : public ConverterBase< TextModel >
+{
+public:
+ explicit TextConverter( const ConverterRoot& rParent, TextModel& rModel );
+ virtual ~TextConverter();
+
+ /** Creates a data sequence object from the contained text data. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence( const OUString& rRole );
+ /** Creates a sequence of formatted string objects. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > >
+ createStringSequence(
+ const OUString& rDefaultText,
+ const ModelRef< TextBody >& rxTextProp,
+ ObjectType eObjType );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString >
+ appendFormattedString(
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > >& orStringVec,
+ const OUString& rString,
+ bool bAddNewLine ) const;
+};
+
+// ============================================================================
+
+struct TitleModel;
+
+class TitleConverter : public ConverterBase< TitleModel >
+{
+public:
+ explicit TitleConverter( const ConverterRoot& rParent, TitleModel& rModel );
+ virtual ~TitleConverter();
+
+ /** Creates a title text object and attaches it at the passed interface. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitled >& rxTitled,
+ const OUString& rAutoTitle, ObjectType eObjType,
+ sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 );
+};
+
+// ============================================================================
+
+struct LegendModel;
+
+class LegendConverter : public ConverterBase< LegendModel >
+{
+public:
+ explicit LegendConverter( const ConverterRoot& rParent, LegendModel& rModel );
+ virtual ~LegendConverter();
+
+ /** Creates a legend object and attaches it at the passed diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/titlemodel.hxx b/include/oox/drawingml/chart/titlemodel.hxx
new file mode 100644
index 000000000000..f365d0b6ec89
--- /dev/null
+++ b/include/oox/drawingml/chart/titlemodel.hxx
@@ -0,0 +1,89 @@
+/* -*- 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 OOX_DRAWINGML_CHART_TITLEMODEL_HXX
+#define OOX_DRAWINGML_CHART_TITLEMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/datasourcemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct TextModel
+{
+ typedef ModelRef< DataSequenceModel > DataSequenceRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+
+ DataSequenceRef mxDataSeq; /// The string data or formula link of this text.
+ TextBodyRef mxTextBody; /// Rich-formatted literal text (for title objects only).
+
+ explicit TextModel();
+ ~TextModel();
+};
+
+// ============================================================================
+
+struct TitleModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ ShapeRef mxShapeProp; /// Title shape formatting.
+ TextBodyRef mxTextProp; /// Title text formatting.
+ LayoutRef mxLayout; /// Layout/position of the frame.
+ TextRef mxText; /// Text source of the title.
+ bool mbOverlay; /// True = title may overlay other objects.
+
+ explicit TitleModel();
+ ~TitleModel();
+};
+
+// ============================================================================
+
+struct LegendModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+
+ ShapeRef mxShapeProp; /// Legend shape formatting.
+ TextBodyRef mxTextProp; /// Legend text formatting.
+ LayoutRef mxLayout; /// Layout/position of the legend.
+ sal_Int32 mnPosition; /// Legend position.
+ bool mbOverlay; /// True = legend may overlay other objects.
+
+ explicit LegendModel();
+ ~LegendModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/typegroupcontext.hxx b/include/oox/drawingml/chart/typegroupcontext.hxx
new file mode 100644
index 000000000000..52667817ff0d
--- /dev/null
+++ b/include/oox/drawingml/chart/typegroupcontext.hxx
@@ -0,0 +1,164 @@
+/* -*- 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 OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX
+#define OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct UpDownBarsModel;
+
+/** Handler for an up/down bars context (c:upDownBars element).
+ */
+class UpDownBarsContext : public ContextBase< UpDownBarsModel >
+{
+public:
+ explicit UpDownBarsContext( ::oox::core::ContextHandler2Helper& rParent, UpDownBarsModel& rModel );
+ virtual ~UpDownBarsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TypeGroupModel;
+typedef ContextBase< TypeGroupModel > TypeGroupContextBase;
+
+// ============================================================================
+
+/** Handler for area type group contexts (c:area3DChart, c:areaChart elements).
+ */
+class AreaTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit AreaTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~AreaTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for bar type group contexts (c:bar3DChart, c:barChart elements).
+ */
+class BarTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit BarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~BarTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for bubble type group context (c:bubbleChart element).
+ */
+class BubbleTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit BubbleTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~BubbleTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for line type group contexts (c:line3DChart, c:lineChart,
+ c:stockChart elements).
+ */
+class LineTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit LineTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~LineTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for pie type group contexts (c:doughnutChart, c:ofPieChart,
+ c:pie3DChart, c:pieChart elements).
+ */
+class PieTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit PieTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~PieTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for radar type group context (c:radarChart element).
+ */
+class RadarTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit RadarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~RadarTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for scatter type group context (c:scatterChart element).
+ */
+class ScatterTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit ScatterTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~ScatterTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for surface type group contexts (c:surface3DChart, c:surfaceChart
+ elements).
+ */
+class SurfaceTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit SurfaceTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~SurfaceTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/typegroupconverter.hxx b/include/oox/drawingml/chart/typegroupconverter.hxx
new file mode 100644
index 000000000000..dfce05065c18
--- /dev/null
+++ b/include/oox/drawingml/chart/typegroupconverter.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 OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XChartType; }
+ namespace chart2 { class XCoordinateSystem; }
+ namespace chart2 { class XDataSeries; }
+ namespace chart2 { class XDiagram; }
+ namespace chart2 { namespace data { class XLabeledDataSequence; } }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+/** Enumerates different chart types. */
+enum TypeId
+{
+ TYPEID_BAR, /// Vertical bar chart.
+ TYPEID_HORBAR, /// Horizontal bar chart.
+ TYPEID_LINE, /// Line chart.
+ TYPEID_AREA, /// Area chart.
+ TYPEID_STOCK, /// Stock chart.
+ TYPEID_RADARLINE, /// Linear radar chart.
+ TYPEID_RADARAREA, /// Filled radar chart.
+ TYPEID_PIE, /// Pie chart.
+ TYPEID_DOUGHNUT, /// Doughnut (ring) chart.
+ TYPEID_OFPIE, /// Pie-to-pie or pie-to-bar chart.
+ TYPEID_SCATTER, /// Scatter (XY) chart.
+ TYPEID_BUBBLE, /// Bubble chart.
+ TYPEID_SURFACE, /// Surface chart.
+ TYPEID_UNKNOWN /// Default for unknown chart types.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Enumerates different categories of similar chart types. */
+enum TypeCategory
+{
+ TYPECATEGORY_BAR, /// Bar charts (horizontal or vertical).
+ TYPECATEGORY_LINE, /// Line charts (line, area, stock charts).
+ TYPECATEGORY_RADAR, /// Radar charts (linear or filled).
+ TYPECATEGORY_PIE, /// Pie and donut charts.
+ TYPECATEGORY_SCATTER, /// Scatter and bubble charts.
+ TYPECATEGORY_SURFACE /// Surface charts.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Enumerates modes for varying point colors in a series. */
+enum VarPointMode
+{
+ VARPOINTMODE_NONE, /// No varied colors supported.
+ VARPOINTMODE_SINGLE, /// Only supported, if type group contains only one series.
+ VARPOINTMODE_MULTI /// Supported for multiple series in a chart type group.
+};
+
+// ============================================================================
+
+/** Contains info for a chart type related to the OpenOffice.org chart module. */
+struct TypeGroupInfo
+{
+ TypeId meTypeId; /// Unique chart type identifier.
+ TypeCategory meTypeCategory; /// Category this chart type belongs to.
+ const sal_Char* mpcServiceName; /// Service name of the type.
+ VarPointMode meVarPointMode; /// Mode for varying point colors.
+ sal_Int32 mnDefLabelPos; /// Default data label position (API constant).
+ bool mbCombinable2d; /// True = types can be combined in one axes set.
+ bool mbSupports3d; /// True = 3D type allowed, false = only 2D type.
+ bool mbPolarCoordSystem; /// True = polar, false = cartesian.
+ bool mbSeriesIsFrame2d; /// True = 2D type series with area formatting.
+ bool mbSingleSeriesVis; /// True = only first series visible (e.g. pie charts).
+ bool mbCategoryAxis; /// True = X axis contains categories.
+ bool mbSwappedAxesSet; /// True = X axis and Y axis are swapped.
+ bool mbSupportsStacking; /// True = data points can be stacked on each other.
+ bool mbReverseSeries; /// True = insert unstacked series in reverse order.
+ bool mbTicksBetweenCateg; /// True = X axis ticks between categories.
+ bool mbPictureOptions; /// True = bitmaps support options from c:pictureOptions.
+};
+
+// ============================================================================
+
+struct UpDownBarsModel;
+
+class UpDownBarsConverter : public ConverterBase< UpDownBarsModel >
+{
+public:
+ explicit UpDownBarsConverter( const ConverterRoot& rParent, UpDownBarsModel& rModel );
+ virtual ~UpDownBarsConverter();
+
+ /** Converts the OOXML up/down bars. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType );
+};
+
+// ============================================================================
+
+struct TypeGroupModel;
+struct View3DModel;
+
+class TypeGroupConverter : public ConverterBase< TypeGroupModel >
+{
+public:
+ explicit TypeGroupConverter( const ConverterRoot& rParent, TypeGroupModel& rModel );
+ virtual ~TypeGroupConverter();
+
+ /** Returns the type info struct that describes this chart type group. */
+ inline const TypeGroupInfo& getTypeInfo() const { return maTypeInfo; }
+
+ /** Returns true, if the series in this chart type group are stacked on each other (no percentage). */
+ bool isStacked() const;
+ /** Returns true, if the series in this chart type group are stacked on each other as percentage. */
+ bool isPercent() const;
+ /** Returns true, if the chart is three-dimensional. */
+ bool is3dChart() const;
+ /** Returns true, if chart type supports wall and floor format in 3D mode. */
+ bool isWall3dChart() const;
+ /** Returns true, if the series in this chart type group are ordered on the Z axis. */
+ bool isDeep3dChart() const;
+
+ /** Returns true, if this chart type supports area formatting for its series. */
+ bool isSeriesFrameFormat() const;
+ /** Returns the object type for a series depending on the chart type. */
+ ObjectType getSeriesObjectType() const;
+
+ /** Returns true, if this chart type has to reverse its series order. */
+ bool isReverseSeries() const;
+ /** Returns series title, if the chart type group contains only one single series. */
+ OUString getSingleSeriesTitle() const;
+
+ /** Creates a coordinate system according to the contained chart type. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >
+ createCoordinateSystem();
+ /** Creates a labeled data sequence object for axis categories. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createCategorySequence();
+
+ /** Converts the OOXML type group model into a chart2 coordinate system. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem,
+ sal_Int32 nAxesSetIdx, bool bSupportsVaryColorsByPoint );
+
+ /** Sets the passed OOXML marker style at the passed property set. */
+ void convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSymbol, sal_Int32 nOoxSize ) const;
+ /** Sets the passed OOXML line smoothing at the passed property set. */
+ void convertLineSmooth( PropertySet& rPropSet, bool bOoxSmooth ) const;
+ /** Sets the passed OOXML bar 3D geometry at the passed property set. */
+ void convertBarGeometry( PropertySet& rPropSet, sal_Int32 nOoxShape ) const;
+ /** Sets the passed OOXML pie rotation at the passed property set. */
+ void convertPieRotation( PropertySet& rPropSet, sal_Int32 nOoxAngle ) const;
+ /** Sets the passed OOXML pie explosion at the passed property set. */
+ void convertPieExplosion( PropertySet& rPropSet, sal_Int32 nOoxExplosion ) const;
+
+private:
+ /** Inserts the passed series into the chart type. Adds additional properties to the series. */
+ void insertDataSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxSeries,
+ sal_Int32 nAxesSetIdx );
+
+private:
+ TypeGroupInfo maTypeInfo; /// Extended type info for contained chart type model.
+ bool mb3dChart; /// True = type is a 3D chart type.
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/typegroupmodel.hxx b/include/oox/drawingml/chart/typegroupmodel.hxx
new file mode 100644
index 000000000000..1949a3ee892e
--- /dev/null
+++ b/include/oox/drawingml/chart/typegroupmodel.hxx
@@ -0,0 +1,96 @@
+/* -*- 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 OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX
+#define OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX
+
+#include "oox/drawingml/chart/seriesmodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct UpDownBarsModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+
+ ShapeRef mxDownBars; /// Formatting of down bars.
+ ShapeRef mxUpBars; /// Formatting of up bars.
+ sal_Int32 mnGapWidth; /// Space between up/down bars.
+
+ explicit UpDownBarsModel();
+ ~UpDownBarsModel();
+};
+
+// ============================================================================
+
+struct TypeGroupModel
+{
+ typedef ModelVector< SeriesModel > SeriesVector;
+ typedef ::std::vector< sal_Int32 > AxisIdVector;
+ typedef ModelRef< DataLabelsModel > DataLabelsRef;
+ typedef ModelRef< UpDownBarsModel > UpDownBarsRef;
+ typedef ModelRef< Shape > ShapeRef;
+
+ SeriesVector maSeries; /// Series attached to this chart type group.
+ AxisIdVector maAxisIds; /// List of axis identifiers used by this chart type.
+ DataLabelsRef mxLabels; /// Data point label settings for all series.
+ UpDownBarsRef mxUpDownBars; /// Up/down bars in stock charts.
+ ShapeRef mxSerLines; /// Connector lines in stacked bar charts.
+ ShapeRef mxDropLines; /// Drop lines connecting data points with X axis.
+ ShapeRef mxHiLowLines; /// High/low lines connecting lowest and highest data points.
+ double mfSplitPos; /// Threshold value in pie-to charts.
+ sal_Int32 mnBarDir; /// Bar direction in bar charts (vertical/horizontal).
+ sal_Int32 mnBubbleScale; /// Relative scaling of bubble size (percent).
+ sal_Int32 mnFirstAngle; /// Rotation angle of first slice in pie charts.
+ sal_Int32 mnGapDepth; /// Space between series in deep 3D charts.
+ sal_Int32 mnGapWidth; /// Space between bars in bar charts, or space in pie-to charts.
+ sal_Int32 mnGrouping; /// Series grouping mode.
+ sal_Int32 mnHoleSize; /// Hole size in doughnut charts.
+ sal_Int32 mnOfPieType; /// Pie-to-pie or pie-to-bar chart.
+ sal_Int32 mnOverlap; /// Bar overlap per category (2D bar charts only).
+ sal_Int32 mnRadarStyle; /// Type of radar chart (lines, markers, filled).
+ sal_Int32 mnScatterStyle; /// Type of scatter chart (lines, markers, smooth).
+ sal_Int32 mnSecondPieSize; /// relative size of second pie/bar in pie-to charts (percent).
+ sal_Int32 mnShape; /// 3D bar shape type.
+ sal_Int32 mnSizeRepresents; /// Bubble size represents area or width.
+ sal_Int32 mnSplitType; /// Split type in pie-to charts.
+ sal_Int32 mnTypeId; /// Chart type identifier.
+ bool mbBubble3d; /// True = show bubbles with 3D shade.
+ bool mbShowMarker; /// True = show point markers in line charts.
+ bool mbShowNegBubbles; /// True = show absolute value of negative bubbles.
+ bool mbSmooth; /// True = smooth lines in line charts.
+ bool mbVaryColors; /// True = different automatic colors for each point.
+ bool mbWireframe; /// True = wireframe surface chart, false = filled surface chart.
+
+ explicit TypeGroupModel( sal_Int32 nTypeId );
+ ~TypeGroupModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/clrscheme.hxx b/include/oox/drawingml/clrscheme.hxx
new file mode 100644
index 000000000000..7c4f0106cb43
--- /dev/null
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -0,0 +1,62 @@
+/* -*- 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 OOX_DRAWINGML_CLRSCHEME_HXX
+#define OOX_DRAWINGML_CLRSCHEME_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <map>
+#include <vector>
+#include "oox/drawingml/color.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class ClrMap
+{
+ std::map < sal_Int32, sal_Int32 > maClrMap;
+
+public:
+
+ sal_Bool getColorMap( sal_Int32& nClrToken );
+ void setColorMap( sal_Int32 nClrToken, sal_Int32 nMappedClrToken );
+};
+
+typedef boost::shared_ptr< ClrMap > ClrMapPtr;
+
+class OOX_DLLPUBLIC ClrScheme
+{
+ std::map < sal_Int32, sal_Int32 > maClrScheme;
+
+public:
+
+ ClrScheme();
+ ~ClrScheme();
+
+ sal_Bool getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const;
+ void setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor );
+};
+
+typedef boost::shared_ptr< ClrScheme > ClrSchemePtr;
+
+} }
+
+#endif // OOX_DRAWINGML_CLRSCHEME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/clrschemecontext.hxx b/include/oox/drawingml/clrschemecontext.hxx
new file mode 100644
index 000000000000..466b852a37cf
--- /dev/null
+++ b/include/oox/drawingml/clrschemecontext.hxx
@@ -0,0 +1,62 @@
+/* -*- 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 OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX
+#define OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/clrscheme.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/colorchoicecontext.hxx"
+
+namespace oox { namespace drawingml {
+
+class clrMapContext : public oox::core::ContextHandler
+{
+public:
+ clrMapContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, ClrMap& rClrMap );
+};
+
+class clrSchemeColorContext : private Color, public ColorContext
+{
+public:
+ clrSchemeColorContext( ::oox::core::ContextHandler& rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken );
+ virtual ~clrSchemeColorContext();
+
+private:
+ ClrScheme& mrClrScheme;
+ sal_Int32 mnColorToken;
+};
+
+class clrSchemeContext : public oox::core::ContextHandler
+{
+public:
+ clrSchemeContext( ::oox::core::ContextHandler& rParent, ClrScheme& rClrScheme );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ClrScheme& mrClrScheme;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
new file mode 100644
index 000000000000..b58f0b8ae5b3
--- /dev/null
+++ b/include/oox/drawingml/color.hxx
@@ -0,0 +1,144 @@
+/* -*- 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 OOX_DRAWINGML_COLOR_HXX
+#define OOX_DRAWINGML_COLOR_HXX
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { class GraphicHelper; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC Color
+{
+public:
+ Color();
+ ~Color();
+
+ /** Returns the RGB value for the passed DrawingML color token, or nDefaultRgb on error. */
+ static sal_Int32 getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
+ /** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */
+ static sal_Int32 getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
+
+ /** Sets the color to unused state. */
+ void setUnused();
+ /** Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element. */
+ void setSrgbClr( sal_Int32 nRgb );
+ /** Sets the percentual RGB values from the a:scrgbClr element. */
+ void setScrgbClr( sal_Int32 nR, sal_Int32 nG, sal_Int32 nB );
+ /** Sets the HSL values from the a:hslClr element. */
+ void setHslClr( sal_Int32 nHue, sal_Int32 nSat, sal_Int32 nLum );
+ /** Sets a predefined color from the a:prstClr element. */
+ void setPrstClr( sal_Int32 nToken );
+ /** Sets a scheme color from the a:schemeClr element. */
+ void setSchemeClr( sal_Int32 nToken );
+ /** Sets a system color from the a:sysClr element. */
+ void setSysClr( sal_Int32 nToken, sal_Int32 nLastRgb );
+ /** Sets a palette color index. */
+ void setPaletteClr( sal_Int32 nPaletteIdx );
+
+ /** Inserts the passed color transformation. */
+ void addTransformation( sal_Int32 nElement, sal_Int32 nValue = -1 );
+ /** Inserts Chart specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */
+ void addChartTintTransformation( double fTint );
+ /** Inserts Excel specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */
+ void addExcelTintTransformation( double fTint );
+ /** Removes all color transformations. */
+ void clearTransformations();
+ /** Removes transparence from the color. */
+ void clearTransparence();
+
+ /** Overwrites this color with the passed color, if it is used. */
+ inline void assignIfUsed( const Color& rColor ) { if( rColor.isUsed() ) *this = rColor; }
+
+ /** Returns true, if the color is initialized. */
+ bool isUsed() const { return meMode != COLOR_UNUSED; }
+ /** Returns true, if the color is a placeholder color in theme style lists. */
+ bool isPlaceHolder() const { return meMode == COLOR_PH; }
+ /** Returns the final RGB color value.
+ @param nPhClr Actual color for the phClr placeholder color used in theme style lists. */
+ sal_Int32 getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+
+ /** Returns true, if the color is transparent. */
+ bool hasTransparency() const;
+ /** Returns the transparency of the color (0 = opaque, 100 = full transparent). */
+ sal_Int16 getTransparency() const;
+
+private:
+ /** Internal helper for getColor(). */
+ void setResolvedRgb( sal_Int32 nRgb ) const;
+
+ /** Converts the color components to RGB values. */
+ void toRgb() const;
+ /** Converts the color components to CRGB values (gamma corrected percentage). */
+ void toCrgb() const;
+ /** Converts the color components to HSL values. */
+ void toHsl() const;
+
+private:
+ enum ColorMode
+ {
+ COLOR_UNUSED, /// Color is not used, or undefined.
+ COLOR_RGB, /// Absolute RGB (r/g/b: 0...255).
+ COLOR_CRGB, /// Relative RGB (r/g/b: 0...100000).
+ COLOR_HSL, /// HSL (hue: 0...21600000, sat/lum: 0...100000).
+ COLOR_SCHEME, /// Color from scheme.
+ COLOR_PALETTE, /// Color from application defined palette.
+ COLOR_SYSTEM, /// Color from system palette.
+ COLOR_PH, /// Placeholder color in theme style lists.
+ COLOR_FINAL /// Finalized RGB color.
+ };
+
+ struct Transformation
+ {
+ sal_Int32 mnToken;
+ sal_Int32 mnValue;
+
+ explicit Transformation( sal_Int32 nToken, sal_Int32 nValue ) : mnToken( nToken ), mnValue( nValue ) {}
+ };
+ typedef ::std::vector< Transformation > TransformVec;
+
+ mutable ColorMode meMode; /// Current color mode.
+ mutable TransformVec maTransforms; /// Color transformations.
+ mutable sal_Int32 mnC1; /// Red, red%, hue, scheme token, palette index, system token, or final RGB.
+ mutable sal_Int32 mnC2; /// Green, green%, saturation, or system default RGB.
+ mutable sal_Int32 mnC3; /// Blue, blue%, or luminance.
+ sal_Int32 mnAlpha; /// Alpha value (color opacity).
+};
+
+typedef boost::shared_ptr< Color > ColorPtr;
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/colorchoicecontext.hxx b/include/oox/drawingml/colorchoicecontext.hxx
new file mode 100644
index 000000000000..aaacfd44d5b7
--- /dev/null
+++ b/include/oox/drawingml/colorchoicecontext.hxx
@@ -0,0 +1,80 @@
+/* -*- 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 OOX_DRAWINGML_COLORCHOICECONTEXT_HXX
+#define OOX_DRAWINGML_COLORCHOICECONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox {
+namespace drawingml {
+
+class Color;
+
+// ============================================================================
+
+/** Context handler for the different color value elements (a:scrgbClr,
+ a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */
+class ColorValueContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit ColorValueContext( ::oox::core::ContextHandler& rParent, Color& rColor );
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ Color& mrColor;
+};
+
+// ============================================================================
+
+/** Context handler for elements that *contain* a color value element
+ (a:scrgbClr, a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */
+class ColorContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit ColorContext( ::oox::core::ContextHandler& rParent, Color& rColor );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ Color& mrColor;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/connectorshapecontext.hxx b/include/oox/drawingml/connectorshapecontext.hxx
new file mode 100644
index 000000000000..48a03ae317af
--- /dev/null
+++ b/include/oox/drawingml/connectorshapecontext.hxx
@@ -0,0 +1,41 @@
+/* -*- 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 OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+#define OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ConnectorShapeContext : public ShapeContext
+{
+public:
+ ConnectorShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr );
+ virtual ~ConnectorShapeContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/customshapegeometry.hxx b/include/oox/drawingml/customshapegeometry.hxx
new file mode 100644
index 000000000000..3920881f123a
--- /dev/null
+++ b/include/oox/drawingml/customshapegeometry.hxx
@@ -0,0 +1,71 @@
+/* -*- 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 OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX
+#define OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "oox/helper/propertymap.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace drawingml {
+
+
+// ---------------------------------------------------------------------
+// CT_CustomGeometry2D
+class CustomShapeGeometryContext : public ::oox::core::ContextHandler
+{
+public:
+ CustomShapeGeometryContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ CustomShapeProperties& mrCustomShapeProperties;
+};
+
+// ---------------------------------------------------------------------
+// CT_PresetGeometry2D
+class PresetShapeGeometryContext : public ::oox::core::ContextHandler
+{
+public:
+ PresetShapeGeometryContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ CustomShapeProperties& mrCustomShapeProperties;
+};
+
+// ---------------------------------------------------------------------
+// CT_PresetTextShape
+class PresetTextShapeContext : public ::oox::core::ContextHandler
+{
+public:
+ PresetTextShapeContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ CustomShapeProperties& mrCustomShapeProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/customshapeproperties.hxx b/include/oox/drawingml/customshapeproperties.hxx
new file mode 100644
index 000000000000..e44f20db95e2
--- /dev/null
+++ b/include/oox/drawingml/customshapeproperties.hxx
@@ -0,0 +1,189 @@
+/* -*- 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 OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
+#define OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <boost/unordered_map.hpp>
+#include <vector>
+#include <map>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/token/tokens.hxx"
+
+namespace oox { namespace drawingml {
+
+class CustomShapeProperties;
+
+typedef boost::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
+
+struct CustomShapeGuide
+{
+ OUString maName;
+ OUString maFormula;
+};
+
+struct AdjustHandle
+{
+ sal_Bool polar;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair
+ pos;
+
+ // depending to the type (polar or not):
+ OptValue< OUString > gdRef1; // gdRefX or gdRefR
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ min1; // minX or minR
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ max1; // maxX or maxR
+ OptValue< OUString > gdRef2; // gdRefY or gdRefAng
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ min2; // minX or minAng
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ max2; // maxY or maxAng
+
+ AdjustHandle( sal_Bool bPolar ) : polar( bPolar ) {};
+};
+
+struct ConnectionSite
+{
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair
+ pos;
+ com::sun::star::drawing::EnhancedCustomShapeParameter
+ ang;
+};
+
+struct GeomRect
+{
+ com::sun::star::drawing::EnhancedCustomShapeParameter l;
+ com::sun::star::drawing::EnhancedCustomShapeParameter t;
+ com::sun::star::drawing::EnhancedCustomShapeParameter r;
+ com::sun::star::drawing::EnhancedCustomShapeParameter b;
+};
+
+struct Path2D
+{
+ sal_Int64 w;
+ sal_Int64 h;
+ sal_Int32 fill;
+ sal_Bool stroke;
+ sal_Bool extrusionOk;
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > parameter;
+
+ Path2D() : w( 0 ), h( 0 ), fill( XML_norm ), stroke( sal_True ), extrusionOk( sal_True ) {};
+};
+
+
+class CustomShapeProvider {
+protected:
+ struct ParameterPairData {
+ sal_uInt16 nFirstType;
+ sal_uInt16 nSecondType;
+ sal_uInt32 nFirstValue;
+ sal_uInt32 nSecondValue;
+ };
+ static com::sun::star::uno::Any createStringSequence( size_t nStrings, const char **pStrings );
+ static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > createSegmentSequence( size_t nElems, const sal_uInt16 *pValues );
+ static com::sun::star::drawing::EnhancedCustomShapeParameterPair createParameterPair( const ParameterPairData *pData );
+ static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > createParameterPairSequence( size_t nElems, const ParameterPairData *pData );
+public:
+ virtual ~CustomShapeProvider() {}
+ virtual PropertyMap getProperties() = 0;
+};
+
+class CustomShapeProperties
+{
+public:
+
+ CustomShapeProperties();
+ virtual ~CustomShapeProperties();
+
+ void pushToPropSet( const ::oox::core::FilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape);
+
+ sal_Int32 getShapePresetType() const { return mnShapePresetType; }
+ OUString getShapePresetTypeName() const;
+ void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; };
+
+ std::vector< CustomShapeGuide >& getAdjustmentGuideList(){ return maAdjustmentGuideList; };
+ std::vector< CustomShapeGuide >& getGuideList(){ return maGuideList; };
+ std::vector< AdjustHandle >& getAdjustHandleList(){ return maAdjustHandleList; };
+ std::vector< ConnectionSite >& getConnectionSiteList(){ return maConnectionSiteList; };
+ OptValue< GeomRect >& getTextRect(){ return maTextRect; };
+ std::vector< Path2D >& getPath2DList(){ return maPath2DList; };
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; };
+ void setMirroredX( sal_Bool bMirroredX ) { mbMirroredX = bMirroredX; };
+ void setMirroredY( sal_Bool bMirroredY ) { mbMirroredY = bMirroredY; };
+ void setTextRotateAngle( sal_Int32 nAngle ) { mnTextRotateAngle = nAngle; };
+
+ static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
+ static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const OUString& rFormulaName );
+
+ sal_Int32 getArcNum() { return mnArcNum++; }
+
+private:
+
+ sal_Int32 mnShapePresetType;
+ std::vector< CustomShapeGuide > maAdjustmentGuideList;
+ std::vector< CustomShapeGuide > maGuideList;
+ std::vector< AdjustHandle > maAdjustHandleList;
+ std::vector< ConnectionSite > maConnectionSiteList;
+ OptValue< GeomRect > maTextRect;
+ std::vector< Path2D > maPath2DList;
+
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >
+ maSegments;
+ sal_Bool mbMirroredX;
+ sal_Bool mbMirroredY;
+ sal_Int32 mnTextRotateAngle;
+
+ typedef boost::unordered_map< sal_Int32, CustomShapeProvider * > PresetsMap;
+
+ static PresetsMap maPresetsMap;
+ static void initializePresetsMap();
+ static void initializePresetsMap1();
+ static void initializePresetsMap2();
+ static void initializePresetsMap3();
+ static void initializePresetsMap4();
+ static void initializePresetsMap5();
+ static void initializePresetsMap6();
+
+ sal_Int32 mnArcNum;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/diagram/diagram.hxx b/include/oox/drawingml/diagram/diagram.hxx
new file mode 100644
index 000000000000..e37c1a44e42f
--- /dev/null
+++ b/include/oox/drawingml/diagram/diagram.hxx
@@ -0,0 +1,58 @@
+/* -*- 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 OOX_DRAWINGML_DIAGRAM_HXX
+#define OOX_DRAWINGML_DIAGRAM_HXX
+
+#include <rtl/ustring.hxx>
+#include "oox/drawingml/shape.hxx"
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/xml/dom/XDocument.hpp>
+
+namespace oox { namespace drawingml {
+
+/** load diagram data, and put resulting graphic into shape
+
+ This method loads the diagram data fragments from the given paths,
+ generate and layout the shapes, and push it as children into the
+ referenced shape.
+ */
+void loadDiagram( ShapePtr& pShape,
+ core::XmlFilterBase& rFilter,
+ const OUString& rDataModelPath,
+ const OUString& rLayoutPath,
+ const OUString& rQStylePath,
+ const OUString& rColorStylePath );
+
+void loadDiagram( const ShapePtr& pShape,
+ core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXDataModelDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXLayoutDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXQStyleDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXColorStyleDom );
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx
new file mode 100644
index 000000000000..5df664ee66a4
--- /dev/null
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -0,0 +1,200 @@
+/* -*- 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 OOX_DRAWINGML_TYPES_HXX
+#define OOX_DRAWINGML_TYPES_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/style/TabAlign.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include "oox/helper/helper.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+const sal_Int32 PER_PERCENT = 1000;
+const sal_Int32 MAX_PERCENT = 100 * PER_PERCENT;
+
+const sal_Int32 PER_DEGREE = 60000;
+const sal_Int32 MAX_DEGREE = 360 * PER_DEGREE;
+
+// ============================================================================
+
+struct LineProperties;
+typedef ::boost::shared_ptr< LineProperties > LinePropertiesPtr;
+
+struct FillProperties;
+typedef ::boost::shared_ptr< FillProperties > FillPropertiesPtr;
+
+struct GraphicProperties;
+typedef ::boost::shared_ptr< GraphicProperties > GraphicPropertiesPtr;
+
+struct Shape3DProperties;
+typedef ::boost::shared_ptr< Shape3DProperties > Shape3DPropertiesPtr;
+
+struct TextCharacterProperties;
+typedef ::boost::shared_ptr< TextCharacterProperties > TextCharacterPropertiesPtr;
+
+struct TextBodyProperties;
+typedef ::boost::shared_ptr< TextBodyProperties > TextBodyPropertiesPtr;
+
+struct EffectProperties;
+typedef ::boost::shared_ptr< EffectProperties > EffectPropertiesPtr;
+
+class TextBody;
+typedef ::boost::shared_ptr< TextBody > TextBodyPtr;
+
+class Shape;
+typedef ::boost::shared_ptr< Shape > ShapePtr;
+
+class Theme;
+typedef ::boost::shared_ptr< Theme > ThemePtr;
+
+// ---------------------------------------------------------------------------
+
+namespace table {
+
+class TableProperties;
+typedef ::boost::shared_ptr< TableProperties > TablePropertiesPtr;
+
+} // namespace table
+
+// ============================================================================
+
+/** converts the attributes from an CT_TLPoint into an awt Point with 1/1000% */
+com::sun::star::awt::Point GetPointPercent( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs );
+
+
+/** converts the attributes from an CT_Size2D into an awt Size with 1/100th mm */
+com::sun::star::awt::Size GetSize2D( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+/** converts the attributes from a CT_RelativeRect to an IntegerRectangle2D */
+com::sun::star::geometry::IntegerRectangle2D GetRelativeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+/** converts EMUs into 1/100th mmm */
+sal_Int32 GetCoordinate( sal_Int32 nValue );
+
+/** converts an emu string into 1/100th mmm */
+sal_Int32 GetCoordinate( const OUString& sValue );
+
+/** converts a ST_Percentage % string into 1/1000th of % */
+sal_Int32 GetPercent( const OUString& sValue );
+
+/** Converts a ST_PositiveFixedPercentage to a float. 1.0 == 100% */
+double GetPositiveFixedPercentage( const OUString& sValue );
+
+/** converts the ST_TextFontSize to point */
+float GetTextSize( const OUString& rValue );
+
+/** converts the ST_TextSpacingPoint to 1/100mm */
+sal_Int32 GetTextSpacingPoint( const OUString& sValue );
+sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue );
+
+/** */
+::com::sun::star::style::TabAlign GetTabAlign( ::sal_Int32 aToken );
+
+float GetFontHeight( sal_Int32 nHeight );
+
+sal_Int16 GetFontUnderline( sal_Int32 nToken );
+
+sal_Int16 GetFontStrikeout( sal_Int32 nToken );
+
+sal_Int16 GetCaseMap( sal_Int32 nToken );
+
+/** converts a paragraph align to a ParaAdjust */
+sal_Int16 GetParaAdjust( sal_Int32 nAlign );
+
+// ============================================================================
+
+// CT_IndexRange
+struct IndexRange {
+ sal_Int32 start;
+ sal_Int32 end;
+};
+
+/** retrieve the content of CT_IndexRange */
+IndexRange GetIndexRange( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+// ============================================================================
+
+const sal_Int32 EMU_PER_HMM = 360; /// 360 EMUs per 1/100 mm.
+
+/** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */
+inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
+{
+ return static_cast< sal_Int64 >( nValue ) * EMU_PER_HMM;
+}
+
+/** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
+inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
+{
+ return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + EMU_PER_HMM / 2) / EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
+}
+
+// ============================================================================
+
+/** A structure for a point with 64-bit interger components. */
+struct EmuPoint
+{
+ sal_Int64 X;
+ sal_Int64 Y;
+
+ inline explicit EmuPoint() : X( 0 ), Y( 0 ) {}
+ inline explicit EmuPoint( sal_Int64 nX, sal_Int64 nY ) : X( nX ), Y( nY ) {}
+};
+
+// ============================================================================
+
+/** A structure for a size with 64-bit interger components. */
+struct EmuSize
+{
+ sal_Int64 Width;
+ sal_Int64 Height;
+
+ inline explicit EmuSize() : Width( 0 ), Height( 0 ) {}
+ inline explicit EmuSize( sal_Int64 nWidth, sal_Int64 nHeight ) : Width( nWidth ), Height( nHeight ) {}
+};
+
+// ============================================================================
+
+/** A structure for a rectangle with 64-bit interger components. */
+struct EmuRectangle : public EmuPoint, public EmuSize
+{
+ inline explicit EmuRectangle() {}
+ inline explicit EmuRectangle( const EmuPoint& rPos, const EmuSize& rSize ) : EmuPoint( rPos ), EmuSize( rSize ) {}
+ inline explicit EmuRectangle( sal_Int64 nX, sal_Int64 nY, sal_Int64 nWidth, sal_Int64 nHeight ) : EmuPoint( nX, nY ), EmuSize( nWidth, nHeight ) {}
+
+ inline void setPos( const EmuPoint& rPos ) { static_cast< EmuPoint& >( *this ) = rPos; }
+ inline void setSize( const EmuSize& rSize ) { static_cast< EmuSize& >( *this ) = rSize; }
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/effectproperties.hxx b/include/oox/drawingml/effectproperties.hxx
new file mode 100644
index 000000000000..55c5ec34a20f
--- /dev/null
+++ b/include/oox/drawingml/effectproperties.hxx
@@ -0,0 +1,53 @@
+/* -*- 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 OOX_DRAWINGML_EFFECTPROPERTIES_HXX
+#define OOX_DRAWINGML_EFFECTPROPERTIES_HXX
+
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct EffectShadowProperties
+{
+ OptValue< sal_Int64 > moShadowDist;
+ OptValue< sal_Int64 > moShadowDir;
+ OptValue< sal_Int64 > moShadowAlpha;
+ Color moShadowColor;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const EffectShadowProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC EffectProperties
+{
+ EffectShadowProperties maShadow;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const EffectProperties& rSourceProps );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/effectpropertiescontext.hxx b/include/oox/drawingml/effectpropertiescontext.hxx
new file mode 100644
index 000000000000..cd5e2eba28f5
--- /dev/null
+++ b/include/oox/drawingml/effectpropertiescontext.hxx
@@ -0,0 +1,41 @@
+/* -*- 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 OOX_DRAWINGML_EFFECTPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_EFFECTPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+// ---------------------------------------------------------------------
+
+struct EffectProperties;
+
+class OOX_DLLPUBLIC EffectPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ EffectPropertiesContext( ::oox::core::ContextHandler& rParent,
+ EffectProperties& rEffectProperties ) throw();
+ ~EffectPropertiesContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ EffectProperties& mrEffectProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_EFFECTPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/embeddedwavaudiofile.hxx b/include/oox/drawingml/embeddedwavaudiofile.hxx
new file mode 100644
index 000000000000..97cebd54947b
--- /dev/null
+++ b/include/oox/drawingml/embeddedwavaudiofile.hxx
@@ -0,0 +1,51 @@
+/* -*- 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 OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX
+#define OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+
+#include "oox/core/fragmenthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+ struct EmbeddedWAVAudioFile
+ {
+ EmbeddedWAVAudioFile()
+ : mbBuiltIn(false)
+ {
+ }
+ bool mbBuiltIn;
+ OUString msName;
+ OUString msEmbed;
+ };
+
+ void getEmbeddedWAVAudioFile(
+ const ::oox::core::Relations& rRelations,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs,
+ EmbeddedWAVAudioFile & aAudio );
+
+} }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/fillproperties.hxx b/include/oox/drawingml/fillproperties.hxx
new file mode 100644
index 000000000000..fb9aa849e92e
--- /dev/null
+++ b/include/oox/drawingml/fillproperties.hxx
@@ -0,0 +1,152 @@
+/* -*- 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 OOX_DRAWINGML_FILLPROPERTIES_HXX
+#define OOX_DRAWINGML_FILLPROPERTIES_HXX
+
+#include <map>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/drawingml/embeddedwavaudiofile.hxx"
+
+namespace oox {
+ class GraphicHelper;
+ class PropertyMap;
+ class PropertySet;
+}
+
+namespace oox {
+namespace drawingml {
+
+class ShapePropertyMap;
+
+// ============================================================================
+
+struct GradientFillProperties
+{
+ typedef ::std::map< double, Color > GradientStopMap;
+
+ GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moTileRect;
+ OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
+ OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
+ OptValue< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape.
+ OptValue< bool > moShadeScaled; /// True = scale gradient into shape.
+ OptValue< bool > moRotateWithShape; /// True = rotate gradient with shape.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const GradientFillProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct PatternFillProperties
+{
+ Color maPattFgColor; /// Pattern foreground color.
+ Color maPattBgColor; /// Pattern background color.
+ OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const PatternFillProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct BlipFillProperties
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ mxGraphic; /// The fill graphic.
+ OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
+ moFillRect; /// Stretch fill offsets.
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
+ moClipRect;
+ OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs).
+ OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs).
+ OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent).
+ OptValue< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent).
+ OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
+ OptValue< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles.
+ OptValue< bool > moRotateWithShape; /// True = rotate bitmap with shape.
+ // effects
+ OptValue< sal_Int32 > moColorEffect; /// XML token for a color effect.
+ OptValue< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000].
+ OptValue< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000].
+ Color maColorChangeFrom; /// Start color of color transformation.
+ Color maColorChangeTo; /// Destination color of color transformation.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const BlipFillProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC FillProperties
+{
+ OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
+ Color maFillColor; /// Solid fill color and transparence.
+ GradientFillProperties maGradientProps; /// Properties for gradient fills.
+ PatternFillProperties maPatternProps; /// Properties for pattern fills.
+ BlipFillProperties maBlipProps; /// Properties for bitmap fills.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const FillProperties& rSourceProps );
+
+ /** Tries to resolve current settings to a solid color, e.g. returns the
+ start color of a gradient. */
+ Color getBestSolidColor() const;
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper,
+ sal_Int32 nShapeRotation = 0,
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT,
+ bool bFlipH = false,
+ bool bFlipV = false ) const;
+};
+
+// ============================================================================
+
+struct GraphicProperties
+{
+ BlipFillProperties maBlipProps; /// Properties for the graphic.
+ EmbeddedWAVAudioFile maAudio; /// Audio file details
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const GraphicProperties& rSourceProps );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper,
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/fillpropertiesgroupcontext.hxx b/include/oox/drawingml/fillpropertiesgroupcontext.hxx
new file mode 100644
index 000000000000..81d8a6e0db20
--- /dev/null
+++ b/include/oox/drawingml/fillpropertiesgroupcontext.hxx
@@ -0,0 +1,208 @@
+/* -*- 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 OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
+#define OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
+
+#include "oox/drawingml/colorchoicecontext.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** Context handler that imports the a:solidFill element. */
+class SolidFillContext : public ColorContext
+{
+public:
+ explicit SolidFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ FillProperties& rFillProps );
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:gradFill element. */
+class GradientFillContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit GradientFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ GradientFillProperties& rGradientProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ GradientFillProperties& mrGradientProps;
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:pattFill element. */
+class PatternFillContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit PatternFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ PatternFillProperties& rPatternProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ PatternFillProperties& mrPatternProps;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Context handler that imports the a:clrChange element containing the colors
+ of a bitmap color change transformation. */
+class ColorChangeContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit ColorChangeContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ BlipFillProperties& rBlipProps );
+ virtual ~ColorChangeContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ BlipFillProperties& mrBlipProps;
+ bool mbUseAlpha;
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:blip element containing the fill bitmap
+ and bitmap color transformation settings. */
+class BlipContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit BlipContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ BlipFillProperties& rBlipProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ BlipFillProperties& mrBlipProps;
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:blipFill element. */
+class BlipFillContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit BlipFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ BlipFillProperties& rBlipProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ BlipFillProperties& mrBlipProps;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Context handler for elements that contain a fill property element
+ (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */
+class FillPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit FillPropertiesContext(
+ ::oox::core::ContextHandler& rParent,
+ FillProperties& rFillProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
+ createFillContext(
+ ::oox::core::ContextHandler& rParent,
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ FillProperties& rFillProps );
+
+protected:
+ FillProperties& mrFillProps;
+};
+
+// ============================================================================
+
+/** Context handler for elements that contain a fill property element
+ (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill).
+
+ This context handler takes a simple color instead of a fill properties
+ struct. The imported fill properties are converted automatically to the
+ best fitting solid color.
+ */
+class SimpleFillPropertiesContext : private FillProperties, public FillPropertiesContext
+{
+public:
+ explicit SimpleFillPropertiesContext(
+ ::oox::core::ContextHandler& rParent,
+ Color& rColor );
+ virtual ~SimpleFillPropertiesContext();
+
+protected:
+ Color& mrColor;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/graphicshapecontext.hxx b/include/oox/drawingml/graphicshapecontext.hxx
new file mode 100644
index 000000000000..c5984d503363
--- /dev/null
+++ b/include/oox/drawingml/graphicshapecontext.hxx
@@ -0,0 +1,110 @@
+/* -*- 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 OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+#define OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace vml { struct OleObjectInfo; } }
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC GraphicShapeContext : public ShapeContext
+{
+public:
+ GraphicShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+};
+
+// ====================================================================
+
+class OOX_DLLPUBLIC GraphicalObjectFrameContext : public ShapeContext
+{
+public:
+ GraphicalObjectFrameContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ bool mbEmbedShapesInChart;
+};
+
+// ====================================================================
+
+class OleObjectGraphicDataContext : public ShapeContext
+{
+public:
+ OleObjectGraphicDataContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr );
+ ~OleObjectGraphicDataContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::oox::vml::OleObjectInfo& mrOleObjectInfo;
+};
+
+// ====================================================================
+
+class Diagram;
+
+class DiagramGraphicDataContext
+ : public ShapeContext
+{
+public:
+ DiagramGraphicDataContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr );
+ virtual ~DiagramGraphicDataContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ OUString msDm;
+ OUString msLo;
+ OUString msQs;
+ OUString msCs;
+};
+
+// ====================================================================
+
+class ChartGraphicDataContext : public ShapeContext
+{
+public:
+ explicit ChartGraphicDataContext(
+ ::oox::core::ContextHandler& rParent,
+ const ShapePtr& rxShape, bool bEmbedShapes );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartShapeInfo& mrChartShapeInfo;
+};
+
+// ====================================================================
+
+} }
+
+#endif // OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/guidcontext.hxx b/include/oox/drawingml/guidcontext.hxx
new file mode 100644
index 000000000000..8a60bf20ab5c
--- /dev/null
+++ b/include/oox/drawingml/guidcontext.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 OOX_DRAWINGML_GUIDCONTEXT_HXX
+#define OOX_DRAWINGML_GUIDCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+ class GuidContext : public ::oox::core::ContextHandler
+ {
+
+ public:
+ GuidContext( ::oox::core::ContextHandler& rParent, OUString& rGuidId );
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ private:
+
+ OUString& mrGuidId;
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/lineproperties.hxx b/include/oox/drawingml/lineproperties.hxx
new file mode 100644
index 000000000000..7ffdc04230a0
--- /dev/null
+++ b/include/oox/drawingml/lineproperties.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 OOX_DRAWINGML_LINEPROPERTIES_HXX
+#define OOX_DRAWINGML_LINEPROPERTIES_HXX
+
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct LineArrowProperties
+{
+ OptValue< sal_Int32 > moArrowType;
+ OptValue< sal_Int32 > moArrowWidth;
+ OptValue< sal_Int32 > moArrowLength;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const LineArrowProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC LineProperties
+{
+ typedef ::std::pair< sal_Int32, sal_Int32 > DashStop;
+ typedef ::std::vector< DashStop > DashStopVector;
+
+ LineArrowProperties maStartArrow; /// Start line arrow style.
+ LineArrowProperties maEndArrow; /// End line arrow style.
+ FillProperties maLineFill; /// Line fill (solid, gradient, ...).
+ DashStopVector maCustomDash; /// User-defined line dash style.
+ OptValue< sal_Int32 > moLineWidth; /// Line width (EMUs).
+ OptValue< sal_Int32 > moPresetDash; /// Preset dash (OOXML token).
+ OptValue< sal_Int32 > moLineCompound; /// Line compound type (OOXML token).
+ OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token).
+ OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token).
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const LineProperties& rSourceProps );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper,
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/linepropertiescontext.hxx b/include/oox/drawingml/linepropertiescontext.hxx
new file mode 100644
index 000000000000..e0454ddb2250
--- /dev/null
+++ b/include/oox/drawingml/linepropertiescontext.hxx
@@ -0,0 +1,52 @@
+/* -*- 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 OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+// ---------------------------------------------------------------------
+
+struct LineProperties;
+
+class OOX_DLLPUBLIC LinePropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ LinePropertiesContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes,
+ LineProperties& rLineProperties ) throw();
+ ~LinePropertiesContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ LineProperties& mrLineProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/objectdefaultcontext.hxx b/include/oox/drawingml/objectdefaultcontext.hxx
new file mode 100644
index 000000000000..b8b1d5b95ede
--- /dev/null
+++ b/include/oox/drawingml/objectdefaultcontext.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX
+#define OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class Theme;
+
+class objectDefaultContext : public oox::core::ContextHandler
+{
+public:
+ objectDefaultContext( ::oox::core::ContextHandler& rParent, Theme& rTheme );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Theme& mrTheme;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/scene3dcontext.hxx b/include/oox/drawingml/scene3dcontext.hxx
new file mode 100644
index 000000000000..cc3341ddf310
--- /dev/null
+++ b/include/oox/drawingml/scene3dcontext.hxx
@@ -0,0 +1,47 @@
+/* -*- 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 OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+#define OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct Shape3DProperties;
+
+// ---------------------------------------------------------------------
+
+class Scene3DPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ Scene3DPropertiesContext( ::oox::core::ContextHandler& rParent, Shape3DProperties& r3DProperties ) throw();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ Shape3DProperties& mr3DProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
new file mode 100644
index 000000000000..f8a58ec5340b
--- /dev/null
+++ b/include/oox/drawingml/shape.hxx
@@ -0,0 +1,273 @@
+/* -*- 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 OOX_DRAWINGML_SHAPE_HXX
+#define OOX_DRAWINGML_SHAPE_HXX
+
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/customshapeproperties.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/drawingml/shape3dproperties.hxx"
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vector>
+#include <map>
+#include "oox/dllapi.h"
+
+namespace oox { namespace vml {
+ struct OleObjectInfo;
+} }
+
+namespace oox { namespace drawingml {
+
+class CustomShapeProperties;
+typedef boost::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
+
+typedef ::std::map< OUString, ShapePtr > ShapeIdMap;
+
+struct ShapeStyleRef
+{
+ Color maPhClr;
+ sal_Int32 mnThemedIdx;
+};
+
+typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap;
+
+// ============================================================================
+
+/** Additional information for a chart embedded in a drawing shape. */
+struct ChartShapeInfo
+{
+ OUString maFragmentPath; ///< Path to related XML stream, e.g. for charts.
+ bool mbEmbedShapes; ///< True = load chart shapes into chart, false = load into parent drawpage.
+
+ inline explicit ChartShapeInfo( bool bEmbedShapes ) : mbEmbedShapes( bEmbedShapes ) {}
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC Shape
+ : public boost::enable_shared_from_this< Shape >
+{
+public:
+
+ explicit Shape( const sal_Char* pServiceType = 0 );
+ explicit Shape( const ShapePtr& pSourceShape );
+ virtual ~Shape();
+
+ OUString& getServiceName(){ return msServiceName; }
+ void setServiceName( const sal_Char* pServiceName );
+
+ PropertyMap& getShapeProperties(){ return maShapeProperties; }
+
+ inline LineProperties& getLineProperties() { return *mpLinePropertiesPtr; }
+ inline const LineProperties& getLineProperties() const { return *mpLinePropertiesPtr; }
+
+ inline FillProperties& getFillProperties() { return *mpFillPropertiesPtr; }
+ inline const FillProperties& getFillProperties() const { return *mpFillPropertiesPtr; }
+
+ inline GraphicProperties& getGraphicProperties() { return *mpGraphicPropertiesPtr; }
+ inline const GraphicProperties& getGraphicProperties() const { return *mpGraphicPropertiesPtr; }
+
+ CustomShapePropertiesPtr getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; }
+
+ Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; }
+ const Shape3DProperties& get3DProperties() const { return *mp3DPropertiesPtr; }
+
+ table::TablePropertiesPtr getTableProperties();
+
+ inline EffectProperties& getEffectProperties() { return *mpEffectPropertiesPtr; }
+
+ void setChildPosition( com::sun::star::awt::Point nPosition ){ maChPosition = nPosition; }
+ void setChildSize( com::sun::star::awt::Size aSize ){ maChSize = aSize; }
+ void moveAllToPosition( const com::sun::star::awt::Point &rPoint );
+
+ void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
+ const com::sun::star::awt::Point& getPosition() const { return maPosition; }
+
+ void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
+ const com::sun::star::awt::Size& getSize() const { return maSize; }
+
+ void setRotation( sal_Int32 nRotation ) { mnRotation = nRotation; }
+ void setFlip( sal_Bool bFlipH, sal_Bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; }
+ void addChild( const ShapePtr pChildPtr ) { maChildren.push_back( pChildPtr ); }
+ std::vector< ShapePtr >& getChildren() { return maChildren; }
+
+ void setName( const OUString& rName ) { msName = rName; }
+ OUString getName( ) { return msName; }
+ void setId( const OUString& rId ) { msId = rId; }
+ OUString getId() { return msId; }
+ void setHidden( sal_Bool bHidden ) { mbHidden = bHidden; }
+ sal_Bool getHidden() const { return mbHidden; };
+ void setHiddenMasterShape( sal_Bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; }
+ void setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; }
+ sal_Int32 getSubType() const { return mnSubType; }
+ void setSubTypeIndex( sal_Int32 nSubTypeIndex ) { moSubTypeIndex = nSubTypeIndex; }
+ const OptValue< sal_Int32 >& getSubTypeIndex() const { return moSubTypeIndex; }
+
+ // setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value)
+ void setDefaults();
+
+ ::oox::vml::OleObjectInfo& setOleObjectType();
+ ChartShapeInfo& setChartType( bool bEmbedShapes );
+ void setDiagramType();
+ void setTableType();
+
+ void setTextBody(const TextBodyPtr & pTextBody);
+ TextBodyPtr getTextBody();
+ void setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle );
+ TextListStylePtr getMasterTextListStyle() const { return mpMasterTextListStyle; }
+
+ inline ShapeStyleRefMap& getShapeStyleRefs() { return maShapeStyleRefs; }
+ inline const ShapeStyleRefMap& getShapeStyleRefs() const { return maShapeStyleRefs; }
+ const ShapeStyleRef* getShapeStyleRef( sal_Int32 nRefType ) const;
+
+ // addShape is creating and inserting the corresponding XShape.
+ void addShape(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ basegfx::B2DHomMatrix& aTransformation,
+ FillProperties& rShapeOrParentShapeFillProps,
+ const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
+ ShapeIdMap* pShapeMap = 0 );
+
+ void dropChildren() { maChildren.clear(); }
+
+ void addChildren(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ basegfx::B2DHomMatrix& aTransformation,
+ const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
+ ShapeIdMap* pShapeMap = 0 );
+
+ void setXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape )
+ { mxShape = rXShape; };
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
+ getXShape() const { return mxShape; }
+
+ virtual void applyShapeReference( const Shape& rReferencedShape, bool bUseText = true );
+ const ::std::vector<OUString>&
+ getExtDrawings() { return maExtDrawings; }
+ void addExtDrawingRelId( const OUString &rRelId ) { maExtDrawings.push_back( rRelId ); }
+
+protected:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsert(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const OUString& rServiceName,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle* pShapeRect,
+ sal_Bool bClearText,
+ sal_Bool bDoNotInsertEmptyTextBody,
+ basegfx::B2DHomMatrix& aTransformation,
+ FillProperties& rShapeOrParentShapeFillProps
+ );
+
+ void addChildren(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ Shape& rMaster,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rClientRect,
+ ShapeIdMap* pShapeMap,
+ basegfx::B2DHomMatrix& aTransformation );
+
+ virtual OUString finalizeServiceName(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rServiceName,
+ const ::com::sun::star::awt::Rectangle& rShapeRect );
+
+ virtual void finalizeXShape(
+ ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+
+ std::vector< ShapePtr > maChildren; // only used for group shapes
+ com::sun::star::awt::Size maChSize; // only used for group shapes
+ com::sun::star::awt::Point maChPosition; // only used for group shapes
+ com::sun::star::awt::Size maAbsoluteSize; // only used for group shapes
+ com::sun::star::awt::Point maAbsolutePosition; // only used for group shapes
+ sal_Bool mbIsChild;
+
+ TextBodyPtr mpTextBody;
+ LinePropertiesPtr mpLinePropertiesPtr;
+ FillPropertiesPtr mpFillPropertiesPtr;
+ GraphicPropertiesPtr mpGraphicPropertiesPtr;
+ CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
+ table::TablePropertiesPtr mpTablePropertiesPtr;
+ Shape3DPropertiesPtr mp3DPropertiesPtr;
+ EffectPropertiesPtr mpEffectPropertiesPtr;
+ PropertyMap maShapeProperties;
+ PropertyMap maDefaultShapeProperties;
+ TextListStylePtr mpMasterTextListStyle;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
+
+ OUString msServiceName;
+ OUString msName;
+ OUString msId;
+ sal_Int32 mnSubType; // if this type is not zero, then the shape is a placeholder
+ OptValue< sal_Int32 > moSubTypeIndex;
+
+ ShapeStyleRefMap maShapeStyleRefs;
+
+ com::sun::star::awt::Size maSize;
+ com::sun::star::awt::Point maPosition;
+ ::std::vector<OUString> maExtDrawings;
+
+private:
+ enum FrameType
+ {
+ FRAMETYPE_GENERIC, ///< Generic shape, no special type.
+ FRAMETYPE_OLEOBJECT, ///< OLE object embedded in a shape.
+ FRAMETYPE_CHART, ///< Chart embedded in a shape.
+ FRAMETYPE_DIAGRAM, ///< Complex diagram drawing shape.
+ FRAMETYPE_TABLE ///< A table embedded in a shape.
+ };
+
+ typedef ::boost::shared_ptr< ::oox::vml::OleObjectInfo > OleObjectInfoRef;
+ typedef ::boost::shared_ptr< ChartShapeInfo > ChartShapeInfoRef;
+
+ FrameType meFrameType; ///< Type for graphic frame shapes.
+ OleObjectInfoRef mxOleObjectInfo; ///< Additional data for OLE objects.
+ ChartShapeInfoRef mxChartShapeInfo; ///< Additional data for chart shapes.
+
+ sal_Int32 mnRotation;
+ sal_Bool mbFlipH;
+ sal_Bool mbFlipV;
+ sal_Bool mbHidden;
+ sal_Bool mbHiddenMasterShape; // master shapes can be hidden in layout slides
+ // we need separate flag because we don't want
+ // to propagate it when applying reference shape
+};
+
+// ============================================================================
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx
new file mode 100644
index 000000000000..d1891402757c
--- /dev/null
+++ b/include/oox/drawingml/shape3dproperties.hxx
@@ -0,0 +1,125 @@
+/* -*- 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 OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
+#define OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
+
+#include <map>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+
+namespace oox { class PropertyMap; }
+namespace oox { class PropertySet; }
+namespace oox { namespace core { class ModelObjectContainer; } }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct Shape3DPropertyNames
+{
+ OUString maFillStyle;
+ OUString maFillColor;
+ OUString maFillTransparence;
+ OUString maFillGradient;
+ OUString maFillBitmap;
+ OUString maFillBitmapMode;
+ OUString maFillBitmapTile;
+ OUString maFillBitmapStretch;
+ OUString maFillBitmapLogicalSize;
+ OUString maFillBitmapSizeX;
+ OUString maFillBitmapSizeY;
+ OUString maFillBitmapOffsetX;
+ OUString maFillBitmapOffsetY;
+ OUString maFillBitmapRectanglePoint;
+ bool mbNamedFillGradient;
+ bool mbNamedFillBitmap;
+ bool mbTransformGraphic;
+
+ Shape3DPropertyNames();
+};
+
+// ============================================================================
+
+struct Shape3DProperties
+{
+ typedef ::std::map< double, Color > GradientStopMap;
+
+ OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
+ OptValue< bool > moRotateWithShape; /// True = rotate gradient/bitmap with shape.
+ Color maFillColor; /// Solid fill color and transparence.
+ GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
+ OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
+ OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
+ OptValue< bool > moShadeScaled;
+ OptValue< sal_Int32 > moFlipModeToken;
+ OptValue< com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
+ OptValue< com::sun::star::geometry::IntegerRectangle2D > moTileRect;
+ OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
+ Color maPattFgColor; /// Pattern foreground color.
+ Color maPattBgColor; /// Pattern background color.
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > mxGraphic;
+ Color maColorChangeFrom; /// Start color of color transformation.
+ Color maColorChangeTo; /// Destination color of color transformation.
+ OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
+ OptValue< sal_Int32 > moTileX; /// Width of bitmap tiles.
+ OptValue< sal_Int32 > moTileY; /// Height of bitmap tiles.
+ OptValue< sal_Int32 > moTileSX;
+ OptValue< sal_Int32 > moTileSY;
+ OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
+
+ static Shape3DPropertyNames DEFAULTNAMES; /// Default fill property names for shape fill.
+ static Shape3DPropertyNames DEFAULTPICNAMES; /// Default fill property names for pictures.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const Shape3DProperties& rSourceProps );
+
+ /** Tries to resolve current settings to a solid color, e.g. returns the
+ start color of a gradient. */
+ Color getBestSolidColor() const;
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const Shape3DPropertyNames& rPropNames,
+ const ::oox::core::XmlFilterBase& rFilter,
+ ::oox::core::ModelObjectContainer& rObjContainer,
+ sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
+
+ /** Writes the properties to the passed property set. */
+ void pushToPropSet(
+ PropertySet& rPropSet,
+ const Shape3DPropertyNames& rPropNames,
+ const ::oox::core::XmlFilterBase& rFilter,
+ ::oox::core::ModelObjectContainer& rObjContainer,
+ sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapecontext.hxx b/include/oox/drawingml/shapecontext.hxx
new file mode 100644
index 000000000000..277ee91017ec
--- /dev/null
+++ b/include/oox/drawingml/shapecontext.hxx
@@ -0,0 +1,53 @@
+/* -*- 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 OOX_DRAWINGML_SHAPECONTEXT_HXX
+#define OOX_DRAWINGML_SHAPECONTEXT_HXX
+
+#include <com/sun/star/drawing/XShapes.hpp>
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapepropertiescontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ShapeContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr );
+ virtual ~ShapeContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ ShapePtr getShape();
+
+protected:
+
+ ShapePtr mpMasterShapePtr;
+ ShapePtr mpShapePtr;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapegroupcontext.hxx b/include/oox/drawingml/shapegroupcontext.hxx
new file mode 100644
index 000000000000..65b86ac99567
--- /dev/null
+++ b/include/oox/drawingml/shapegroupcontext.hxx
@@ -0,0 +1,46 @@
+/* -*- 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 OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+#define OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ShapeGroupContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapeGroupContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr );
+ virtual ~ShapeGroupContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ ShapePtr mpGroupShapePtr;
+ ShapePtr mpMasterShapePtr;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapepropertiescontext.hxx b/include/oox/drawingml/shapepropertiescontext.hxx
new file mode 100644
index 000000000000..31da8a9c0f23
--- /dev/null
+++ b/include/oox/drawingml/shapepropertiescontext.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace drawingml {
+
+class ShapePropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapePropertiesContext( ::oox::core::ContextHandler& rParent, Shape& rShape );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrShape;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
new file mode 100644
index 000000000000..a5cc12f5484c
--- /dev/null
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -0,0 +1,147 @@
+/* -*- 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 OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+#define OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+
+#include "oox/helper/propertymap.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { class ModelObjectHelper; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** Enumeration for various properties related to drawing shape formatting.
+
+ This is an abstraction for shape formatting properties that have different
+ names in various implementations, e.g. drawing shapes vs. chart objects.
+ */
+enum ShapePropertyId
+{
+ SHAPEPROP_LineStyle,
+ SHAPEPROP_LineWidth,
+ SHAPEPROP_LineColor,
+ SHAPEPROP_LineTransparency,
+ SHAPEPROP_LineDash, /// Explicit line dash or name of a line dash stored in a global container.
+ SHAPEPROP_LineJoint,
+ SHAPEPROP_LineStart, /// Explicit line start marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineStartWidth,
+ SHAPEPROP_LineStartCenter,
+ SHAPEPROP_LineEnd, /// Explicit line end marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineEndWidth,
+ SHAPEPROP_LineEndCenter,
+ SHAPEPROP_FillStyle,
+ SHAPEPROP_FillColor,
+ SHAPEPROP_FillTransparency,
+ SHAPEPROP_GradientTransparency,
+ SHAPEPROP_FillGradient, /// Explicit fill gradient or name of a fill gradient stored in a global container.
+ SHAPEPROP_FillBitmapUrl, /// Explicit fill bitmap URL or name of a fill bitmap URL stored in a global container.
+ SHAPEPROP_FillBitmapMode,
+ SHAPEPROP_FillBitmapSizeX,
+ SHAPEPROP_FillBitmapSizeY,
+ SHAPEPROP_FillBitmapOffsetX,
+ SHAPEPROP_FillBitmapOffsetY,
+ SHAPEPROP_FillBitmapRectanglePoint,
+ SHAPEPROP_ShadowXDistance,
+ SHAPEPROP_END
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC ShapePropertyInfo
+{
+ const sal_Int32* mpnPropertyIds; /// Pointer to array of property identifiers for all SHAPEPROP properties.
+ bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
+ bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
+ bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
+ bool mbNamedFillBitmapUrl; /// True = use named fill bitmap URL instead of explicit fill bitmap URL.
+
+ static ShapePropertyInfo DEFAULT; /// Default property info (used as default parameter of other methods).
+
+ explicit ShapePropertyInfo(
+ const sal_Int32* pnPropertyIds,
+ bool bNamedLineMarker,
+ bool bNamedLineDash,
+ bool bNamedFillGradient,
+ bool bNamedFillBitmapUrl );
+
+ inline bool has( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
+ inline sal_Int32 operator[]( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ShapePropertyMap : public PropertyMap
+{
+public:
+ explicit ShapePropertyMap(
+ ModelObjectHelper& rModelObjHelper,
+ const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT );
+
+ /** Returns true, if the specified property is supported. */
+ bool supportsProperty( ShapePropertyId ePropId ) const;
+
+ /** Returns true, if named line markers are supported, and the specified
+ line marker has already been inserted into the marker table. */
+ bool hasNamedLineMarkerInTable( const OUString& rMarkerName ) const;
+
+ /** Sets the specified shape property to the passed value. */
+ bool setAnyProperty( ShapePropertyId ePropId, const ::com::sun::star::uno::Any& rValue );
+
+ /** Sets the specified shape property to the passed value. */
+ template< typename Type >
+ inline bool setProperty( ShapePropertyId ePropId, const Type& rValue )
+ { return setAnyProperty( ePropId, ::com::sun::star::uno::Any( rValue ) ); }
+
+ using PropertyMap::setAnyProperty;
+ using PropertyMap::setProperty;
+ using PropertyMap::operator[];
+
+private:
+ /** Sets an explicit line marker, or creates a named line marker. */
+ bool setLineMarker( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit line dash, or creates a named line dash. */
+ bool setLineDash( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill gradient, or creates a named fill gradient. */
+ bool setFillGradient( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Creates a named transparency gradient. */
+ bool setGradientTrans( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill bitmap URL, or creates a named fill bitmap URL. */
+ bool setFillBitmapUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+
+ // not implemented, to prevent implicit conversion from enum to int
+ ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId );
+ const ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId ) const;
+
+private:
+ ModelObjectHelper& mrModelObjHelper;
+ ShapePropertyInfo maShapePropInfo;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapestylecontext.hxx b/include/oox/drawingml/shapestylecontext.hxx
new file mode 100644
index 000000000000..88338a16b59a
--- /dev/null
+++ b/include/oox/drawingml/shapestylecontext.hxx
@@ -0,0 +1,45 @@
+/* -*- 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 OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX
+#define OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class ShapeStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapeStyleContext( ::oox::core::ContextHandler& rParent, Shape& rShape );
+ ~ShapeStyleContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrShape;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/spdefcontext.hxx b/include/oox/drawingml/spdefcontext.hxx
new file mode 100644
index 000000000000..1fa773fb57dc
--- /dev/null
+++ b/include/oox/drawingml/spdefcontext.hxx
@@ -0,0 +1,42 @@
+/* -*- 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 OOX_DRAWINGML_SPDEFCONTEXT_HXX
+#define OOX_DRAWINGML_SPDEFCONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class spDefContext : public oox::core::ContextHandler
+{
+public:
+ spDefContext( ::oox::core::ContextHandler& rParent, Shape& rDefaultObject );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrDefaultObject;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SPDEFCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablebackgroundstylecontext.hxx b/include/oox/drawingml/table/tablebackgroundstylecontext.hxx
new file mode 100644
index 000000000000..185987df8ad7
--- /dev/null
+++ b/include/oox/drawingml/table/tablebackgroundstylecontext.hxx
@@ -0,0 +1,47 @@
+/* -*- 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 OOX_DRAWINGML_TABLEBACKGROUNDSTYLECONTEXT
+#define OOX_DRAWINGML_TABLEBACKGROUNDSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableBackgroundStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableBackgroundStyleContext( ::oox::core::ContextHandler& rParent, TableStyle& rTableStyle );
+ ~TableBackgroundStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStyle& mrTableStyle;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablecell.hxx b/include/oox/drawingml/table/tablecell.hxx
new file mode 100644
index 000000000000..9bb721f8599a
--- /dev/null
+++ b/include/oox/drawingml/table/tablecell.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 OOX_DRAWINGML_TABLECELL_HXX
+#define OOX_DRAWINGML_TABLECELL_HXX
+
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/lineproperties.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include <com/sun/star/table/XCell.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <vector>
+#include <map>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableCellContext;
+class TableProperties;
+class TableStyle;
+
+class TableCell
+{
+ friend class TableCellContext;
+
+public:
+
+ TableCell();
+ ~TableCell();
+
+ sal_Int32 getRowSpan() const { return mnRowSpan; };
+ void setRowSpan( sal_Int32 nRowSpan ){ mnRowSpan = nRowSpan; };
+ sal_Int32 getGridSpan() const { return mnGridSpan; };
+ void setGridSpan( sal_Int32 nGridSpan ){ mnGridSpan = nGridSpan; };
+ sal_Bool gethMerge() const { return mbhMerge; };
+ void sethMerge( sal_Bool bhMerge ){ mbhMerge = bhMerge; };
+ sal_Bool getvMerge() const { return mbvMerge; };
+ void setvMerge( sal_Bool bvMerge ){ mbvMerge = bvMerge; };
+ sal_Int32 getLeftMargin() const { return mnMarL; };
+ void setLeftMargin( sal_Int32 nMargin ){ mnMarL = nMargin; };
+ sal_Int32 getRightMargin() const { return mnMarR; };
+ void setRightMargin( sal_Int32 nMargin ){ mnMarR = nMargin; };
+ sal_Int32 getTopMargin() const { return mnMarT; };
+ void setTopMargin( sal_Int32 nMargin ){ mnMarT = nMargin; };
+ sal_Int32 getBottomMargin() const { return mnMarB; };
+ void setBottomMargin( sal_Int32 nMargin ){ mnMarB = nMargin; };
+ sal_Int32 getVertToken() const { return mnVertToken; };
+ void setVertToken( sal_Int32 nToken ){ mnVertToken = nToken; };
+ sal_Int32 getAnchorToken() const { return mnAnchorToken; };
+ void setAnchorToken( sal_Int32 nToken ){ mnAnchorToken = nToken; };
+ sal_Bool getAnchorCtr() const { return mbAnchorCtr; };
+ void setAnchorCtr( sal_Bool bAnchorCtr ){ mbAnchorCtr = bAnchorCtr; };
+ sal_Int32 getHorzOverflowToken() const { return mnHorzOverflowToken; };
+ void setHorzOverflowToken( sal_Int32 nToken ){ mnHorzOverflowToken = nToken; };
+
+ void setTextBody( const oox::drawingml::TextBodyPtr& pTextBody ){ mpTextBody = pTextBody; };
+ oox::drawingml::TextBodyPtr getTextBody(){ return mpTextBody; };
+
+ void pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::table::XCell >& rxCell, const TableProperties& rTableProperties,
+ const TableStyle& rTable, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow );
+
+private:
+
+ oox::drawingml::TextBodyPtr mpTextBody;
+
+ oox::drawingml::LineProperties maLinePropertiesLeft;
+ oox::drawingml::LineProperties maLinePropertiesRight;
+ oox::drawingml::LineProperties maLinePropertiesTop;
+ oox::drawingml::LineProperties maLinePropertiesBottom;
+ oox::drawingml::LineProperties maLinePropertiesTopLeftToBottomRight;
+ oox::drawingml::LineProperties maLinePropertiesBottomLeftToTopRight;
+
+ oox::drawingml::FillProperties maFillProperties;
+
+ sal_Int32 mnRowSpan;
+ sal_Int32 mnGridSpan;
+ sal_Bool mbhMerge;
+ sal_Bool mbvMerge;
+
+ sal_Int32 mnMarL;
+ sal_Int32 mnMarR;
+ sal_Int32 mnMarT;
+ sal_Int32 mnMarB;
+ sal_Int32 mnVertToken;
+ sal_Int32 mnAnchorToken;
+ sal_Bool mbAnchorCtr;
+ sal_Int32 mnHorzOverflowToken;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLECELL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablecellcontext.hxx b/include/oox/drawingml/table/tablecellcontext.hxx
new file mode 100644
index 000000000000..a2c04bbff9a7
--- /dev/null
+++ b/include/oox/drawingml/table/tablecellcontext.hxx
@@ -0,0 +1,48 @@
+/* -*- 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 OOX_DRAWINGML_TABLECELLCONTEXT
+#define OOX_DRAWINGML_TABLECELLCONTEXT
+
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/drawingml/table/tablecell.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableCellContext : public ::oox::core::ContextHandler
+{
+public:
+ TableCellContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TableCell& rTableCell );
+ ~TableCellContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableCell& mrTableCell;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablecontext.hxx b/include/oox/drawingml/table/tablecontext.hxx
new file mode 100644
index 000000000000..175f7f84cb43
--- /dev/null
+++ b/include/oox/drawingml/table/tablecontext.hxx
@@ -0,0 +1,48 @@
+/* -*- 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 OOX_DRAWINGML_TABLECONTEXT
+#define OOX_DRAWINGML_TABLECONTEXT
+
+#include "oox/drawingml/shapecontext.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableProperties;
+
+class TableContext : public ShapeContext
+{
+public:
+ TableContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr );
+ ~TableContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableProperties& mrTableProperties;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablepartstylecontext.hxx b/include/oox/drawingml/table/tablepartstylecontext.hxx
new file mode 100644
index 000000000000..14b38547d9f4
--- /dev/null
+++ b/include/oox/drawingml/table/tablepartstylecontext.hxx
@@ -0,0 +1,47 @@
+/* -*- 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 OOX_DRAWINGML_TABLEPARTSTYLECONTEXT
+#define OOX_DRAWINGML_TABLEPARTSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestylepart.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TablePartStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TablePartStyleContext( ::oox::core::ContextHandler& rParent, TableStylePart& rTableStylePart );
+ ~TablePartStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStylePart& mrTableStylePart;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tableproperties.hxx b/include/oox/drawingml/table/tableproperties.hxx
new file mode 100644
index 000000000000..8c584b1f8959
--- /dev/null
+++ b/include/oox/drawingml/table/tableproperties.hxx
@@ -0,0 +1,80 @@
+/* -*- 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 OOX_DRAWINGML_TABLEPROPERTIES_HXX
+#define OOX_DRAWINGML_TABLEPROPERTIES_HXX
+
+#include "oox/drawingml/table/tablerow.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/color.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <vector>
+#include <map>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableProperties
+{
+public:
+
+ TableProperties();
+ ~TableProperties();
+
+ std::vector< sal_Int32 >& getTableGrid() { return mvTableGrid; };
+ std::vector< TableRow >& getTableRows() { return mvTableRows; };
+
+ OUString& getStyleId(){ return maStyleId; };
+ boost::shared_ptr< TableStyle >& getTableStyle(){ return mpTableStyle; };
+ sal_Bool& isRtl(){ return mbRtl; };
+ sal_Bool& isFirstRow(){ return mbFirstRow; };
+ sal_Bool& isFirstCol(){ return mbFirstCol; };
+ sal_Bool& isLastRow(){ return mbLastRow; };
+ sal_Bool& isLastCol(){ return mbLastCol; };
+ sal_Bool& isBandRow(){ return mbBandRow; };
+ sal_Bool& isBandCol(){ return mbBandCol; };
+
+ void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet, ::oox::drawingml::TextListStylePtr pMasterTextListStyle );
+
+private:
+
+ const TableStyle& getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase );
+
+ OUString maStyleId; // either StyleId is available
+ boost::shared_ptr< TableStyle > mpTableStyle; // or the complete TableStyle
+ std::vector< sal_Int32 > mvTableGrid;
+ std::vector< TableRow > mvTableRows;
+
+ sal_Bool mbRtl;
+ sal_Bool mbFirstRow;
+ sal_Bool mbFirstCol;
+ sal_Bool mbLastRow;
+ sal_Bool mbLastCol;
+ sal_Bool mbBandRow;
+ sal_Bool mbBandCol;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLEPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablerow.hxx b/include/oox/drawingml/table/tablerow.hxx
new file mode 100644
index 000000000000..299ffabfd8b1
--- /dev/null
+++ b/include/oox/drawingml/table/tablerow.hxx
@@ -0,0 +1,49 @@
+/* -*- 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 OOX_DRAWINGML_TABLEROW_HXX
+#define OOX_DRAWINGML_TABLEROW_HXX
+
+#include "oox/drawingml/table/tablecell.hxx"
+#include <vector>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableRow
+{
+public:
+
+ TableRow();
+ ~TableRow();
+
+ void setHeight( sal_Int32 nHeight ){ mnHeight = nHeight; };
+ sal_Int32 getHeight() const { return mnHeight; };
+ std::vector< TableCell >& getTableCells() { return mvTableCells; };
+
+private:
+
+ sal_Int32 mnHeight;
+ std::vector< TableCell > mvTableCells;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLEROW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablerowcontext.hxx b/include/oox/drawingml/table/tablerowcontext.hxx
new file mode 100644
index 000000000000..58ab0da0cd3a
--- /dev/null
+++ b/include/oox/drawingml/table/tablerowcontext.hxx
@@ -0,0 +1,49 @@
+/* -*- 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 OOX_DRAWINGML_TABLEROWCONTEXT
+#define OOX_DRAWINGML_TABLEROWCONTEXT
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableRow;
+
+class TableRowContext : public ::oox::core::ContextHandler
+{
+public:
+ TableRowContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TableRow& rTableRow );
+ ~TableRowContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableRow& mrTableRow;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestyle.hxx b/include/oox/drawingml/table/tablestyle.hxx
new file mode 100644
index 000000000000..b31b5891a32b
--- /dev/null
+++ b/include/oox/drawingml/table/tablestyle.hxx
@@ -0,0 +1,85 @@
+/* -*- 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 OOX_DRAWINGML_TABLESTYLE_HXX
+#define OOX_DRAWINGML_TABLESTYLE_HXX
+
+#include "oox/drawingml/table/tablestylepart.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyle
+{
+public:
+
+ TableStyle();
+ ~TableStyle();
+
+ OUString& getStyleId(){ return maStyleId; }
+ OUString& getStyleName() { return maStyleName; }
+
+ ::oox::drawingml::ShapeStyleRef& getBackgroundFillStyleRef(){ return maFillStyleRef; }
+
+ ::oox::drawingml::FillPropertiesPtr& getBackgroundFillProperties(){ return mpFillProperties; }
+
+ TableStylePart& getWholeTbl() { return maWholeTbl; }
+ TableStylePart& getBand1H() { return maBand1H; }
+ TableStylePart& getBand2H() { return maBand2H; }
+ TableStylePart& getBand1V() { return maBand1V; }
+ TableStylePart& getBand2V() { return maBand2V; }
+ TableStylePart& getLastCol() { return maLastCol; }
+ TableStylePart& getFirstCol() { return maFirstCol; }
+ TableStylePart& getLastRow() { return maLastRow; }
+ TableStylePart& getSeCell() { return maSeCell; }
+ TableStylePart& getSwCell() { return maSwCell; }
+ TableStylePart& getFirstRow() { return maFirstRow; }
+ TableStylePart& getNeCell() { return maNeCell; }
+ TableStylePart& getNwCell() { return maNwCell; }
+
+private:
+
+ OUString maStyleId;
+ OUString maStyleName;
+
+ ::oox::drawingml::ShapeStyleRef maFillStyleRef;
+
+ ::oox::drawingml::FillPropertiesPtr mpFillProperties;
+
+ TableStylePart maWholeTbl;
+ TableStylePart maBand1H;
+ TableStylePart maBand2H;
+ TableStylePart maBand1V;
+ TableStylePart maBand2V;
+ TableStylePart maLastCol;
+ TableStylePart maFirstCol;
+ TableStylePart maLastRow;
+ TableStylePart maSeCell;
+ TableStylePart maSwCell;
+ TableStylePart maFirstRow;
+ TableStylePart maNeCell;
+ TableStylePart maNwCell;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLESTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylecellstylecontext.hxx b/include/oox/drawingml/table/tablestylecellstylecontext.hxx
new file mode 100644
index 000000000000..ae0997ab6d88
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylecellstylecontext.hxx
@@ -0,0 +1,48 @@
+/* -*- 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 OOX_DRAWINGML_TABLESTYLECELLSTYLECONTEXT
+#define OOX_DRAWINGML_TABLESTYLECELLSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestylepart.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyleCellStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableStyleCellStyleContext( ::oox::core::ContextHandler& rParent, TableStylePart& rTableStylePart );
+ ~TableStyleCellStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStylePart& mrTableStylePart;
+ sal_Int32 mnLineType;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylecontext.hxx b/include/oox/drawingml/table/tablestylecontext.hxx
new file mode 100644
index 000000000000..f9600d38365c
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylecontext.hxx
@@ -0,0 +1,49 @@
+/* -*- 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 OOX_DRAWINGML_TABLESTYLECONTEXT
+#define OOX_DRAWINGML_TABLESTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableStyleContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs,
+ TableStyle& rTableStyle );
+ ~TableStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStyle& mrTableStyle;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylelist.hxx b/include/oox/drawingml/table/tablestylelist.hxx
new file mode 100644
index 000000000000..320609d064d9
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylelist.hxx
@@ -0,0 +1,54 @@
+/* -*- 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 OOX_DRAWINGML_TABLESTYLELIST_HXX
+#define OOX_DRAWINGML_TABLESTYLELIST_HXX
+
+#include <rtl/ustring.hxx>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyle;
+
+class TableStyleList
+{
+public:
+
+ TableStyleList();
+ ~TableStyleList();
+
+ OUString& getDefaultStyleId() { return maDefaultStyleId; };
+ std::vector< TableStyle >& getTableStyles(){ return maTableStyles; };
+
+private:
+
+ OUString maDefaultStyleId;
+ std::vector< TableStyle > maTableStyles;
+
+};
+
+typedef boost::shared_ptr< TableStyleList > TableStyleListPtr;
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLESTYLELIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylelistfragmenthandler.hxx b/include/oox/drawingml/table/tablestylelistfragmenthandler.hxx
new file mode 100644
index 000000000000..d6ef77f8614c
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylelistfragmenthandler.hxx
@@ -0,0 +1,56 @@
+/* -*- 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 OOX_DRAWINGML_TABLESTYLELISTFRAGMENTHANDLER_HXX
+#define OOX_DRAWINGML_TABLESTYLELISTFRAGMENTHANDLER_HXX
+
+#include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace table {
+
+// ============================================================================
+
+class TableStyleListFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit TableStyleListFragmentHandler(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ TableStyleList& rTableStyleList );
+ virtual ~TableStyleListFragmentHandler();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStyleList& mrTableStyleList;
+};
+
+// ============================================================================
+
+} // namespace table
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylepart.hxx b/include/oox/drawingml/table/tablestylepart.hxx
new file mode 100644
index 000000000000..abfb21c890d9
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylepart.hxx
@@ -0,0 +1,73 @@
+/* -*- 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 OOX_DRAWINGML_TABLESTYLEPART_HXX
+#define OOX_DRAWINGML_TABLESTYLEPART_HXX
+
+#include <rtl/ustring.hxx>
+#include <boost/optional.hpp>
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/textfont.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+#include "oox/drawingml/lineproperties.hxx"
+#include "oox/drawingml/shape.hxx"
+#include <map>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStylePart
+{
+public:
+
+ TableStylePart();
+ ~TableStylePart();
+
+ ::oox::drawingml::Color& getTextColor(){ return maTextColor; }
+ ::boost::optional< sal_Bool >& getTextBoldStyle(){ return maTextBoldStyle; }
+ ::boost::optional< sal_Bool >& getTextItalicStyle(){ return maTextItalicStyle; }
+ ::oox::drawingml::TextFont& getAsianFont(){ return maAsianFont; }
+ ::oox::drawingml::TextFont& getComplexFont(){ return maComplexFont; }
+ ::oox::drawingml::TextFont& getSymbolFont(){ return maSymbolFont; }
+ ::oox::drawingml::TextFont& getLatinFont(){ return maLatinFont; }
+
+ ::oox::drawingml::FillPropertiesPtr& getFillProperties(){ return mpFillProperties; }
+ std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& getLineBorders(){ return maLineBorders; }
+
+ ::oox::drawingml::ShapeStyleRefMap& getStyleRefs(){ return maStyleRefs; }
+
+private:
+
+ ::oox::drawingml::Color maTextColor;
+ ::boost::optional< sal_Bool > maTextBoldStyle;
+ ::boost::optional< sal_Bool > maTextItalicStyle;
+ ::oox::drawingml::TextFont maAsianFont;
+ ::oox::drawingml::TextFont maComplexFont;
+ ::oox::drawingml::TextFont maSymbolFont;
+ ::oox::drawingml::TextFont maLatinFont;
+
+ ::oox::drawingml::FillPropertiesPtr mpFillProperties;
+ std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr > maLineBorders;
+ ::oox::drawingml::ShapeStyleRefMap maStyleRefs;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLESTYLEPART_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestyletextstylecontext.hxx b/include/oox/drawingml/table/tablestyletextstylecontext.hxx
new file mode 100644
index 000000000000..10714743ad58
--- /dev/null
+++ b/include/oox/drawingml/table/tablestyletextstylecontext.hxx
@@ -0,0 +1,49 @@
+/* -*- 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 OOX_DRAWINGML_TABLESTYLETEXTSTYLECONTEXT
+#define OOX_DRAWINGML_TABLESTYLETEXTSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestylepart.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyleTextStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableStyleTextStyleContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs,
+ TableStylePart& rTableStylePart );
+ ~TableStyleTextStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStylePart& mrTableStylePart;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbody.hxx b/include/oox/drawingml/textbody.hxx
new file mode 100644
index 000000000000..2d77cf277df6
--- /dev/null
+++ b/include/oox/drawingml/textbody.hxx
@@ -0,0 +1,73 @@
+/* -*- 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 OOX_DRAWINGML_TEXTBODY_HXX
+#define OOX_DRAWINGML_TEXTBODY_HXX
+
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/textbodyproperties.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XText; }
+ namespace text { class XTextCursor; }
+} } }
+
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox { namespace drawingml {
+
+class TextParagraph;
+typedef RefVector< TextParagraph > TextParagraphVector;
+
+class TextBody
+{
+public:
+ TextBody();
+ TextBody( TextBodyPtr pBody );
+ ~TextBody();
+
+ inline const TextParagraphVector& getParagraphs() const { return maParagraphs; }
+ TextParagraph& addParagraph();
+
+ inline const TextListStyle& getTextListStyle() const { return maTextListStyle; }
+ inline TextListStyle& getTextListStyle() { return maTextListStyle; }
+
+ inline const TextBodyProperties& getTextProperties() const { return maTextProperties; }
+ inline TextBodyProperties& getTextProperties() { return maTextProperties; }
+
+ /** insert the text body at the text cursor */
+ void insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > & xAt,
+ const TextCharacterProperties& rTextStyleProperties,
+ const TextListStylePtr& pMasterTextListStyle ) const;
+ bool isEmpty();
+protected:
+ TextParagraphVector maParagraphs;
+ TextBodyProperties maTextProperties;
+ TextListStyle maTextListStyle;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTBODY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbodycontext.hxx b/include/oox/drawingml/textbodycontext.hxx
new file mode 100644
index 000000000000..d46272e853a6
--- /dev/null
+++ b/include/oox/drawingml/textbodycontext.hxx
@@ -0,0 +1,63 @@
+/* -*- 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 OOX_DRAWINGML_TEXTBODYCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTBODYCONTEXT_HXX
+
+#include <com/sun/star/text/XText.hpp>
+
+#include "oox/drawingml/textbody.hxx"
+#include "oox/drawingml/textrun.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextBodyContext : public ::oox::core::ContextHandler
+{
+public:
+ TextBodyContext( ::oox::core::ContextHandler& rParent, TextBody& rTextBody );
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextBody& mrTextBody;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxText;
+};
+
+// CT_RegularTextRun
+class RegularTextRunContext : public ::oox::core::ContextHandler
+{
+public:
+ RegularTextRunContext( ::oox::core::ContextHandler& rParent, TextRunPtr pRunPtr );
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextRunPtr mpRunPtr;
+ bool mbIsInText;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTBODYCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbodyproperties.hxx b/include/oox/drawingml/textbodyproperties.hxx
new file mode 100644
index 000000000000..f8800be29659
--- /dev/null
+++ b/include/oox/drawingml/textbodyproperties.hxx
@@ -0,0 +1,56 @@
+/* -*- 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 OOX_DRAWINGML_TEXTBODYPROPERTIES_HXX
+#define OOX_DRAWINGML_TEXTBODYPROPERTIES_HXX
+
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include <boost/optional.hpp>
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct TextBodyProperties
+{
+ PropertyMap maPropertyMap;
+ OptValue< sal_Int32 > moRotation;
+ OptValue< sal_Int32 > moVert;
+ boost::optional< sal_Int32 > moInsets[4];
+ boost::optional< sal_Int32 > moTextOffX;
+ boost::optional< sal_Int32 > moTextOffY;
+ ::com::sun::star::drawing::TextVerticalAdjust meVA;
+
+ explicit TextBodyProperties();
+
+ void pushRotationAdjustments( sal_Int32 nRotation );
+ void pushVertSimulation();
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbodypropertiescontext.hxx b/include/oox/drawingml/textbodypropertiescontext.hxx
new file mode 100644
index 000000000000..e907a60b94d8
--- /dev/null
+++ b/include/oox/drawingml/textbodypropertiescontext.hxx
@@ -0,0 +1,47 @@
+/* -*- 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 OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct TextBodyProperties;
+
+class TextBodyPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ TextBodyPropertiesContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes,
+ TextBodyProperties& rTextBodyProp );
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextBodyProperties& mrTextBodyProp;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textcharacterproperties.hxx b/include/oox/drawingml/textcharacterproperties.hxx
new file mode 100644
index 000000000000..99792fe7725d
--- /dev/null
+++ b/include/oox/drawingml/textcharacterproperties.hxx
@@ -0,0 +1,84 @@
+/* -*- 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 OOX_DRAWINGML_TEXTCHARACTERPROPERTIES_HXX
+#define OOX_DRAWINGML_TEXTCHARACTERPROPERTIES_HXX
+
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/textfont.hxx"
+
+namespace oox { class PropertySet; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct TextCharacterProperties
+{
+ PropertyMap maHyperlinkPropertyMap;
+ TextFont maLatinFont;
+ TextFont maAsianFont;
+ TextFont maComplexFont;
+ TextFont maSymbolFont;
+ Color maCharColor;
+ Color maUnderlineColor;
+ Color maHighlightColor;
+ OptValue< OUString > moLang;
+ OptValue< sal_Int32 > moHeight;
+ OptValue< sal_Int32 > moSpacing;
+ OptValue< sal_Int32 > moUnderline;
+ OptValue< sal_Int32 > moStrikeout;
+ OptValue< sal_Int32 > moCaseMap;
+ OptValue< bool > moBold;
+ OptValue< bool > moItalic;
+ OptValue< bool > moUnderlineLineFollowText;
+ OptValue< bool > moUnderlineFillFollowText;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const TextCharacterProperties& rSourceProps );
+
+ /** Returns the current character size. If possible the masterstyle should
+ have been applied before, otherwise the character size can be zero and
+ the default value is returned. */
+ float getCharHeightPoints( float fDefault ) const;
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const ::oox::core::XmlFilterBase& rFilter,
+ bool bUseOptional = false ) const;
+
+ /** Writes the properties to the passed property set. */
+ void pushToPropSet(
+ PropertySet& rPropSet,
+ const ::oox::core::XmlFilterBase& rFilter,
+ bool bUseOptional = false ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textcharacterpropertiescontext.hxx b/include/oox/drawingml/textcharacterpropertiescontext.hxx
new file mode 100644
index 000000000000..f31e86b27ca4
--- /dev/null
+++ b/include/oox/drawingml/textcharacterpropertiescontext.hxx
@@ -0,0 +1,48 @@
+/* -*- 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 OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct TextCharacterProperties;
+
+class TextCharacterPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ TextCharacterPropertiesContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& rXAttributes,
+ TextCharacterProperties& rTextCharacterProperties );
+ virtual ~TextCharacterPropertiesContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextCharacterProperties& mrTextCharacterProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textfield.hxx b/include/oox/drawingml/textfield.hxx
new file mode 100644
index 000000000000..df98b0302560
--- /dev/null
+++ b/include/oox/drawingml/textfield.hxx
@@ -0,0 +1,62 @@
+/* -*- 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 OOX_DRAWINGML_TEXTFIELD_HXX
+#define OOX_DRAWINGML_TEXTFIELD_HXX
+
+#include <boost/shared_ptr.hpp>
+
+#include "oox/drawingml/textrun.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+
+namespace oox { namespace drawingml {
+
+struct TextCharacterProperties;
+
+class TextField
+ : public TextRun
+{
+public:
+ TextField();
+
+ inline TextParagraphProperties& getTextParagraphProperties() { return maTextParagraphProperties; }
+ inline const TextParagraphProperties& getTextParagraphProperties() const { return maTextParagraphProperties; }
+
+ inline void setType( const OUString& sType ) { msType = sType; }
+ inline void setUuid( const OUString & sUuid ) { msUuid = sUuid; }
+
+ virtual sal_Int32 insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt,
+ const TextCharacterProperties& rTextCharacterStyle ) const;
+
+private:
+ TextParagraphProperties maTextParagraphProperties;
+ OUString msType;
+ OUString msUuid;
+};
+
+typedef boost::shared_ptr< TextField > TextFieldPtr;
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textfieldcontext.hxx b/include/oox/drawingml/textfieldcontext.hxx
new file mode 100644
index 000000000000..3a50ea93620f
--- /dev/null
+++ b/include/oox/drawingml/textfieldcontext.hxx
@@ -0,0 +1,52 @@
+/* -*- 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 OOX_DRAWINGML_TEXTFIELDCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTFIELDCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextField;
+
+class TextFieldContext
+ : public ::oox::core::ContextHandler
+{
+public:
+ TextFieldContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rXAttributes,
+ TextField& rTextField);
+ virtual void SAL_CALL endFastElement( sal_Int32 aElementToken ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rXAttributes )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ TextField& mrTextField;
+ bool mbIsInText;
+};
+
+} }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textfont.hxx b/include/oox/drawingml/textfont.hxx
new file mode 100644
index 000000000000..95a7a1716a0d
--- /dev/null
+++ b/include/oox/drawingml/textfont.hxx
@@ -0,0 +1,73 @@
+/* -*- 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 OOX_DRAWINGNML_TEXTFONT_HXX
+#define OOX_DRAWINGNML_TEXTFONT_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace oox { class AttributeList; }
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** carries a CT_TextFont*/
+class TextFont
+{
+public:
+ explicit TextFont();
+
+ /** Sets attributes from the passed attribute list. */
+ void setAttributes( const AttributeList& rAttribs );
+
+ /** Overwrites this text font with the passed text font, if it is used. */
+ void assignIfUsed( const TextFont& rTextFont );
+
+ /** Returns the font name, pitch, and family; tries to resolve theme
+ placeholder names, e.g. '+mj-lt' for the major latin theme font. */
+ bool getFontData(
+ OUString& rFontName,
+ sal_Int16& rnFontPitch,
+ sal_Int16& rnFontFamily,
+ const ::oox::core::XmlFilterBase& rFilter ) const;
+
+private:
+ bool implGetFontData(
+ OUString& rFontName,
+ sal_Int16& rnFontPitch,
+ sal_Int16& rnFontFamily ) const;
+
+private:
+ OUString maTypeface;
+ OUString maPanose;
+ sal_Int32 mnPitch;
+ sal_Int32 mnCharset;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textliststyle.hxx b/include/oox/drawingml/textliststyle.hxx
new file mode 100644
index 000000000000..851c506af17e
--- /dev/null
+++ b/include/oox/drawingml/textliststyle.hxx
@@ -0,0 +1,61 @@
+/* -*- 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 OOX_DRAWINGML_TEXTLISTSTYLE_HXX
+#define OOX_DRAWINGML_TEXTLISTSTYLE_HXX
+
+#include "oox/drawingml/textparagraphproperties.hxx"
+#include "oox/helper/refvector.hxx"
+
+namespace oox { namespace drawingml {
+
+typedef RefVector< TextParagraphProperties > TextParagraphPropertiesVector;
+
+class TextListStyle
+{
+public:
+
+ TextListStyle();
+ ~TextListStyle();
+
+ void apply( const TextListStyle& rTextListStyle );
+
+ inline const TextParagraphPropertiesVector& getListStyle() const { return maListStyle; };
+ inline TextParagraphPropertiesVector& getListStyle() { return maListStyle; };
+
+ inline const TextParagraphPropertiesVector& getAggregationListStyle() const { return maAggregationListStyle; };
+ inline TextParagraphPropertiesVector& getAggregationListStyle() { return maAggregationListStyle; };
+
+#if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 1
+ void dump() const;
+#endif
+
+protected:
+
+ TextParagraphPropertiesVector maListStyle;
+ TextParagraphPropertiesVector maAggregationListStyle;
+};
+
+typedef boost::shared_ptr< TextListStyle > TextListStylePtr;
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTLISTSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textliststylecontext.hxx b/include/oox/drawingml/textliststylecontext.hxx
new file mode 100644
index 000000000000..2d480c709be5
--- /dev/null
+++ b/include/oox/drawingml/textliststylecontext.hxx
@@ -0,0 +1,45 @@
+/* -*- 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 OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX
+#define OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX
+
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextListStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TextListStyleContext( ::oox::core::ContextHandler& rParent, TextListStyle& rTextListStyle );
+ ~TextListStyleContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextListStyle& mrTextListStyle;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textparagraph.hxx b/include/oox/drawingml/textparagraph.hxx
new file mode 100644
index 000000000000..37c53268b001
--- /dev/null
+++ b/include/oox/drawingml/textparagraph.hxx
@@ -0,0 +1,73 @@
+/* -*- 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 OOX_DRAWINGML_TEXTPARAGRAPH_HXX
+#define OOX_DRAWINGML_TEXTPARAGRAPH_HXX
+
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/textrun.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+
+namespace oox { namespace drawingml {
+
+typedef RefVector< TextRun > TextRunVector;
+
+class TextParagraph
+{
+public:
+ TextParagraph();
+ ~TextParagraph();
+
+ inline TextRunVector& getRuns() { return maRuns; }
+ inline const TextRunVector& getRuns() const { return maRuns; }
+ inline void addRun( const TextRunPtr & pRun ) { maRuns.push_back( pRun ); }
+
+ inline TextParagraphProperties& getProperties() { return maProperties; }
+ inline const TextParagraphProperties& getProperties() const { return maProperties; }
+
+ inline TextCharacterProperties& getEndProperties() { return maEndProperties; }
+ inline const TextCharacterProperties& getEndProperties() const { return maEndProperties; }
+
+ //inline void setProperties( TextParagraphPropertiesPtr pProps ) { mpProperties = pProps; }
+
+ void insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt,
+ const TextCharacterProperties& rTextStyleProperties,
+ const TextListStyle& rTextListStyle,
+ bool bFirst = false ) const;
+
+private:
+ TextParagraphProperties maProperties;
+ TextCharacterProperties maEndProperties;
+ TextRunVector maRuns;
+};
+
+typedef boost::shared_ptr< TextParagraph > TextParagraphPtr;
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTPARAGRAPH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textparagraphproperties.hxx b/include/oox/drawingml/textparagraphproperties.hxx
new file mode 100644
index 000000000000..1cb8215a3fc1
--- /dev/null
+++ b/include/oox/drawingml/textparagraphproperties.hxx
@@ -0,0 +1,128 @@
+/* -*- 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 OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
+#define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
+#include "oox/drawingml/textcharacterproperties.hxx"
+#include <com/sun/star/style/NumberingType.hpp>
+#include "oox/drawingml/textfont.hxx"
+#include "textspacing.hxx"
+#include <boost/optional.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace graphic { class XGraphic; }
+} } }
+
+namespace oox { namespace drawingml {
+
+class TextParagraphProperties;
+
+typedef boost::shared_ptr< TextParagraphProperties > TextParagraphPropertiesPtr;
+
+class BulletList
+{
+public:
+ BulletList( );
+ bool is() const;
+ void apply( const BulletList& );
+ void pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, PropertyMap& xPropMap ) const;
+ void setBulletChar( const OUString & sChar );
+ void setStartAt( sal_Int32 nStartAt ){ mnStartAt <<= static_cast< sal_Int16 >( nStartAt ); }
+ void setType( sal_Int32 nType );
+ void setNone( );
+ void setSuffixParenBoth();
+ void setSuffixParenRight();
+ void setSuffixPeriod();
+ void setSuffixNone();
+ void setSuffixMinusRight();
+ void setBulletSize(sal_Int16 nSize);
+ void setFontSize(sal_Int16 nSize);
+ void setStyleName( const OUString& rStyleName ) { maStyleName <<= rStyleName; }
+ void setGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rXGraphic );
+
+ ::oox::drawingml::ColorPtr maBulletColorPtr;
+ ::com::sun::star::uno::Any mbBulletColorFollowText;
+ ::com::sun::star::uno::Any mbBulletFontFollowText;
+ ::oox::drawingml::TextFont maBulletFont;
+ ::com::sun::star::uno::Any msBulletChar;
+ ::com::sun::star::uno::Any mnStartAt;
+ ::com::sun::star::uno::Any mnNumberingType;
+ ::com::sun::star::uno::Any msNumberingPrefix;
+ ::com::sun::star::uno::Any msNumberingSuffix;
+ ::com::sun::star::uno::Any mnSize;
+ ::com::sun::star::uno::Any mnFontSize;
+ ::com::sun::star::uno::Any maStyleName;
+ ::com::sun::star::uno::Any maGraphic;
+ boost::optional< float > maFollowFontSize;
+};
+
+class TextParagraphProperties
+{
+public:
+
+ TextParagraphProperties();
+ ~TextParagraphProperties();
+
+ void setLevel( sal_Int16 nLevel ) { mnLevel = nLevel; }
+ sal_Int16 getLevel( ) const { return mnLevel; }
+ PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; }
+ BulletList& getBulletList() { return maBulletList; }
+ TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; }
+ const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; }
+
+ TextSpacing& getParaTopMargin() { return maParaTopMargin; }
+ TextSpacing& getParaBottomMargin() { return maParaBottomMargin; }
+ boost::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; }
+ boost::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; }
+
+ void apply( const TextParagraphProperties& rSourceProps );
+ void pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
+ PropertyMap& rioBulletList, const BulletList* pMasterBuList, sal_Bool bApplyBulletList, float fFontSize, bool bPushDefaultValues = false ) const;
+ void pushToPropSet( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet) const;
+
+ /** Returns the largest character size of this paragraph. If possible the
+ masterstyle should have been applied before, otherwise the character
+ size can be zero and the default value is returned. */
+ float getCharHeightPoints( float fDefault ) const;
+
+#ifdef DBG_UTIL
+ void dump() const;
+#endif
+
+protected:
+
+ TextCharacterProperties maTextCharacterProperties;
+ PropertyMap maTextParagraphPropertyMap;
+ BulletList maBulletList;
+ TextSpacing maParaTopMargin;
+ TextSpacing maParaBottomMargin;
+ boost::optional< sal_Int32 > moParaLeftMargin;
+ boost::optional< sal_Int32 > moFirstLineIndentation;
+ sal_Int16 mnLevel;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textparagraphpropertiescontext.hxx b/include/oox/drawingml/textparagraphpropertiescontext.hxx
new file mode 100644
index 000000000000..db0f3426a680
--- /dev/null
+++ b/include/oox/drawingml/textparagraphpropertiescontext.hxx
@@ -0,0 +1,58 @@
+/* -*- 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 OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
+
+#include <list>
+
+#include <com/sun/star/style/TabStop.hpp>
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+#include "oox/drawingml/textspacing.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextParagraphPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ TextParagraphPropertiesContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& rXAttributes,
+ TextParagraphProperties& rTextParagraphProperties );
+ ~TextParagraphPropertiesContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextParagraphProperties& mrTextParagraphProperties;
+ TextSpacing maLineSpacing;
+ TextSpacing& mrSpaceBefore;
+ TextSpacing& mrSpaceAfter;
+ BulletList& mrBulletList;
+ ::std::list< ::com::sun::star::style::TabStop > maTabList;
+ ::boost::shared_ptr< BlipFillProperties > mxBlipProps;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textrun.hxx b/include/oox/drawingml/textrun.hxx
new file mode 100644
index 000000000000..0e215bf68973
--- /dev/null
+++ b/include/oox/drawingml/textrun.hxx
@@ -0,0 +1,62 @@
+/* -*- 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 OOX_DRAWINGML_TEXTRUN_HXX
+#define OOX_DRAWINGML_TEXTRUN_HXX
+
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "oox/drawingml/textcharacterproperties.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextRun
+{
+public:
+ TextRun();
+ virtual ~TextRun();
+
+ inline OUString& getText() { return msText; }
+ inline const OUString& getText() const { return msText; }
+
+ inline TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; }
+ inline const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; }
+
+ inline void setLineBreak() { mbIsLineBreak = true; }
+
+ virtual sal_Int32 insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText >& xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor >& xAt,
+ const TextCharacterProperties& rTextCharacterStyle ) const;
+
+private:
+ OUString msText;
+ TextCharacterProperties maTextCharacterProperties;
+ bool mbIsLineBreak;
+};
+
+typedef boost::shared_ptr< TextRun > TextRunPtr;
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTRUN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textspacing.hxx b/include/oox/drawingml/textspacing.hxx
new file mode 100644
index 000000000000..c85936283b4b
--- /dev/null
+++ b/include/oox/drawingml/textspacing.hxx
@@ -0,0 +1,69 @@
+/* -*- 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 OOX_DRAWINGNML__TEXTSPACING_HXX
+#define OOX_DRAWINGNML__TEXTSPACING_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
+
+namespace oox { namespace drawingml {
+
+
+ /** carries a CT_TextSpacing */
+ class TextSpacing
+ {
+ public:
+ enum {
+ POINTS = 0,
+ PERCENT
+ };
+ TextSpacing()
+ : nUnit( POINTS ), nValue( 0 ), bHasValue( false )
+ {
+ }
+ TextSpacing( sal_Int32 nPoints ) : nUnit( POINTS ), nValue( nPoints ), bHasValue( true ){};
+ ::com::sun::star::style::LineSpacing toLineSpacing() const
+ {
+ ::com::sun::star::style::LineSpacing aSpacing;
+ aSpacing.Mode = ( nUnit == PERCENT
+ ? ::com::sun::star::style::LineSpacingMode::PROP
+ : ::com::sun::star::style::LineSpacingMode::MINIMUM );
+ aSpacing.Height = static_cast< sal_Int16 >( nUnit == PERCENT ? nValue / 1000 : nValue );
+ return aSpacing;
+ }
+ sal_Int32 toMargin( float fFontSize ) const
+ {
+ if ( nUnit == PERCENT )
+ return (sal_Int32) ((((fFontSize*nValue)/1000)*254 + 360)/720);
+ else
+ return nValue;
+ }
+ sal_Int32 nUnit;
+ sal_Int32 nValue;
+ bool bHasValue;
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx
new file mode 100644
index 000000000000..f167c43a4fd4
--- /dev/null
+++ b/include/oox/drawingml/theme.hxx
@@ -0,0 +1,116 @@
+/* -*- 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 OOX_DRAWINGML_THEME_HXX
+#define OOX_DRAWINGML_THEME_HXX
+
+#include "oox/drawingml/clrscheme.hxx"
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/textfont.hxx"
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+const sal_Int32 THEMED_STYLE_SUBTLE = 1;
+const sal_Int32 THEMED_STYLE_MODERATE = 2;
+const sal_Int32 THEMED_STYLE_INTENSE = 3;
+
+typedef RefVector< FillProperties > FillStyleList;
+typedef RefVector< LineProperties > LineStyleList;
+typedef RefVector< EffectProperties > EffectStyleList;
+typedef RefMap< sal_Int32, TextCharacterProperties > FontScheme;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC Theme
+{
+public:
+ explicit Theme();
+ ~Theme();
+
+ inline void setStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; }
+ inline const OUString& getStyleName() const { return maStyleName; }
+
+ inline ClrScheme& getClrScheme() { return maClrScheme; }
+ inline const ClrScheme& getClrScheme() const { return maClrScheme; }
+
+ inline FillStyleList& getFillStyleList() { return maFillStyleList; }
+ inline const FillStyleList& getFillStyleList() const { return maFillStyleList; }
+ inline FillStyleList& getBgFillStyleList() { return maBgFillStyleList; }
+ inline const FillStyleList& getBgFillStyleList() const { return maBgFillStyleList; }
+ /** Returns the fill properties of the passed one-based themed style index. */
+ const FillProperties* getFillStyle( sal_Int32 nIndex ) const;
+
+ inline LineStyleList& getLineStyleList() { return maLineStyleList; }
+ inline const LineStyleList& getLineStyleList() const { return maLineStyleList; }
+ /** Returns the line properties of the passed one-based themed style index. */
+ const LineProperties* getLineStyle( sal_Int32 nIndex ) const;
+
+ inline EffectStyleList& getEffectStyleList() { return maEffectStyleList; }
+ inline const EffectStyleList& getEffectStyleList() const { return maEffectStyleList; }
+ const EffectProperties* getEffectStyle( sal_Int32 nIndex ) const;
+
+ inline FontScheme& getFontScheme() { return maFontScheme; }
+ inline const FontScheme& getFontScheme() const { return maFontScheme; }
+ /** Returns theme font properties by scheme type (major/minor). */
+ const TextCharacterProperties* getFontStyle( sal_Int32 nSchemeType ) const;
+ /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */
+ const TextFont* resolveFont( const OUString& rName ) const;
+
+ inline Shape& getSpDef() { return maSpDef; }
+ inline const Shape& getSpDef() const { return maSpDef; }
+
+ inline Shape& getLnDef() { return maLnDef; }
+ inline const Shape& getLnDef() const { return maLnDef; }
+
+ inline Shape& getTxDef() { return maTxDef; }
+ inline const Shape& getTxDef() const { return maTxDef; }
+
+ void setFragment( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& getFragment() const { return mxFragment; }
+
+private:
+ OUString maStyleName;
+ ClrScheme maClrScheme;
+ FillStyleList maFillStyleList;
+ FillStyleList maBgFillStyleList;
+ LineStyleList maLineStyleList;
+ EffectStyleList maEffectStyleList;
+ FontScheme maFontScheme;
+ Shape maSpDef;
+ Shape maLnDef;
+ Shape maTxDef;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument> mxFragment;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/themeelementscontext.hxx b/include/oox/drawingml/themeelementscontext.hxx
new file mode 100644
index 000000000000..a3d36a9d8225
--- /dev/null
+++ b/include/oox/drawingml/themeelementscontext.hxx
@@ -0,0 +1,51 @@
+/* -*- 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 OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX
+#define OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox {
+namespace drawingml {
+
+class Theme;
+
+// ============================================================================
+
+class ThemeElementsContext : public oox::core::ContextHandler
+{
+public:
+ ThemeElementsContext( ::oox::core::ContextHandler& rParent, Theme& rTheme );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ Theme& mrTheme;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/themefragmenthandler.hxx b/include/oox/drawingml/themefragmenthandler.hxx
new file mode 100644
index 000000000000..61062775fa37
--- /dev/null
+++ b/include/oox/drawingml/themefragmenthandler.hxx
@@ -0,0 +1,55 @@
+/* -*- 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 OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX
+#define OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace drawingml {
+
+class Theme;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ThemeFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit ThemeFragmentHandler(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ Theme& rTheme );
+ virtual ~ThemeFragmentHandler();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ Theme& mrTheme;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/transform2dcontext.hxx b/include/oox/drawingml/transform2dcontext.hxx
new file mode 100644
index 000000000000..6bbbe191e77c
--- /dev/null
+++ b/include/oox/drawingml/transform2dcontext.hxx
@@ -0,0 +1,52 @@
+/* -*- 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 OOX_DRAWINGML_TRANSFORM2DCONTEXT_HXX
+#define OOX_DRAWINGML_TRANSFORM2DCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+class Shape;
+
+/** context to import a CT_Transform2D */
+class Transform2DContext : public ::oox::core::ContextHandler
+{
+public:
+ Transform2DContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, Shape& rShape, bool btxXfrm = false ) throw();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrShape;
+ bool mbtxXfrm;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/dffdumper.hxx b/include/oox/dump/dffdumper.hxx
new file mode 100644
index 000000000000..d041dcc0be66
--- /dev/null
+++ b/include/oox/dump/dffdumper.hxx
@@ -0,0 +1,70 @@
+/* -*- 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 OOX_DUMP_DFFDUMPER_HXX
+#define OOX_DUMP_DFFDUMPER_HXX
+
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+class DffStreamObject : public SequenceRecordObjectBase
+{
+public:
+ inline sal_uInt16 getVer() const { return mnInstVer & 0x000F; }
+ inline sal_uInt16 getInst() const { return (mnInstVer & 0xFFF0) >> 4; }
+ inline bool isContainer() const { return getVer() == 15; }
+
+protected:
+ inline explicit DffStreamObject() {}
+
+ using SequenceRecordObjectBase::construct;
+
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+ virtual void implWriteExtHeader();
+ virtual void implDumpRecordBody();
+ virtual void implDumpClientAnchor();
+
+private:
+ sal_uInt32 dumpDffSimpleColor( const String& rName );
+
+ void dumpDffOpt();
+ sal_uInt16 dumpDffOptPropHeader();
+
+private:
+ ItemFormatMap maSimpleProps;
+ ItemFormatMap maComplexProps;
+ sal_uInt16 mnInstVer;
+ sal_Int32 mnRealSize;
+};
+
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx
new file mode 100644
index 000000000000..043bb73ecfa8
--- /dev/null
+++ b/include/oox/dump/dumperbase.hxx
@@ -0,0 +1,1871 @@
+/* -*- 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 OOX_DUMP_DUMPERBASE_HXX
+#define OOX_DUMP_DUMPERBASE_HXX
+
+#include <math.h>
+#include <vector>
+#include <stack>
+#include <set>
+#include <map>
+#include <boost/shared_ptr.hpp>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/helper/storagebase.hxx"
+
+#define OOX_INCLUDE_DUMPER (OSL_DEBUG_LEVEL > 0)
+
+#if OOX_INCLUDE_DUMPER
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XTextOutputStream2; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+ class IDocPasswordVerifier;
+}
+
+namespace oox {
+ class BinaryOutputStream;
+ class TextInputStream;
+}
+
+namespace oox { namespace core {
+ class FilterBase;
+} }
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+#define OOX_DUMP_UNUSED "unused"
+#define OOX_DUMP_UNKNOWN "?unknown"
+
+#define OOX_DUMP_ERRASCII( ascii ) "?err:" ascii
+
+#define OOX_DUMP_ERR_NOMAP "no-map"
+#define OOX_DUMP_ERR_NONAME "no-name"
+#define OOX_DUMP_ERR_STREAM "stream-error"
+
+#define OOX_DUMP_DUMPEXT ".dump"
+
+const sal_Unicode OOX_DUMP_STRQUOTE = '\'';
+const sal_Unicode OOX_DUMP_FMLASTRQUOTE = '"';
+const sal_Unicode OOX_DUMP_ADDRABS = '$';
+const sal_Unicode OOX_DUMP_R1C1ROW = 'R';
+const sal_Unicode OOX_DUMP_R1C1COL = 'C';
+const sal_Unicode OOX_DUMP_R1C1OPEN = '[';
+const sal_Unicode OOX_DUMP_R1C1CLOSE = ']';
+const sal_Unicode OOX_DUMP_RANGESEP = ':';
+const sal_Unicode OOX_DUMP_BASECLASS = 'B';
+const sal_Unicode OOX_DUMP_FUNCSEP = ',';
+const sal_Unicode OOX_DUMP_LISTSEP = ',';
+const sal_Unicode OOX_DUMP_TABSEP = '!';
+const sal_Unicode OOX_DUMP_ARRAYSEP = ';';
+const sal_Unicode OOX_DUMP_EMPTYVALUE = '~';
+const sal_Unicode OOX_DUMP_CMDPROMPT = '?';
+const sal_Unicode OOX_DUMP_PLACEHOLDER = '\x01';
+
+typedef ::std::pair< OUString, OUString > OUStringPair;
+typedef ::std::pair< sal_Int64, sal_Int64 > Int64Pair;
+
+typedef ::std::vector< OUString > OUStringVector;
+typedef ::std::vector< sal_Int64 > Int64Vector;
+
+// ============================================================================
+// ============================================================================
+
+/** Static helper functions for system file and stream access. */
+class InputOutputHelper
+{
+public:
+ // file names -------------------------------------------------------------
+
+ static OUString convertFileNameToUrl( const OUString& rFileName );
+ static sal_Int32 getFileNamePos( const OUString& rFileUrl );
+ static OUString getFileNameExtension( const OUString& rFileUrl );
+
+ // input streams ----------------------------------------------------------
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ // output streams ---------------------------------------------------------
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream2 >
+ openTextOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
+ rtl_TextEncoding eTextEnc );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream2 >
+ openTextOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName,
+ rtl_TextEncoding eTextEnc );
+};
+
+// ============================================================================
+
+class BinaryInputStreamRef : public ::oox::BinaryInputStreamRef
+{
+public:
+ inline BinaryInputStreamRef() {}
+
+ inline /*implicit*/ BinaryInputStreamRef( BinaryInputStream* pInStrm ) :
+ ::oox::BinaryInputStreamRef( pInStrm ) {}
+
+ inline /*implicit*/ BinaryInputStreamRef( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( new BinaryXInputStream( rxInStrm, true ) ) {}
+
+ template< typename StreamType >
+ inline /*implicit*/ BinaryInputStreamRef( const ::boost::shared_ptr< StreamType >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( rxInStrm ) {}
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Specifiers for atomic data types. */
+enum DataType
+{
+ DATATYPE_VOID, ///< No data type.
+ DATATYPE_INT8, ///< Signed 8-bit integer.
+ DATATYPE_UINT8, ///< Unsigned 8-bit integer.
+ DATATYPE_INT16, ///< Signed 16-bit integer.
+ DATATYPE_UINT16, ///< Unsigned 16-bit integer.
+ DATATYPE_INT32, ///< Signed 32-bit integer.
+ DATATYPE_UINT32, ///< Unsigned 32-bit integer.
+ DATATYPE_INT64, ///< Signed 64-bit integer.
+ DATATYPE_UINT64, ///< Unsigned 64-bit integer.
+ DATATYPE_FLOAT, ///< Floating-point, single precision.
+ DATATYPE_DOUBLE ///< Floating-point, double precision.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Specifiers for the output format of values. */
+enum FormatType
+{
+ FORMATTYPE_NONE, ///< No numeric format (e.g. show name only).
+ FORMATTYPE_DEC, ///< Decimal.
+ FORMATTYPE_HEX, ///< Hexadecimal.
+ FORMATTYPE_SHORTHEX, ///< Hexadecimal, as short as possible (no leading zeros).
+ FORMATTYPE_BIN, ///< Binary.
+ FORMATTYPE_FIX, ///< Fixed-point.
+ FORMATTYPE_BOOL ///< Boolean ('true' or 'false').
+};
+
+// ----------------------------------------------------------------------------
+
+/** Describes the output format of a data item.
+
+ Data items are written in the following format:
+
+ <NAME>=<VALUE>=<NAME-FROM-LIST>
+
+ NAME is the name of the data item. The name is contained in the member
+ maItemName. If the name is empty, only the value is written (without a
+ leading equality sign).
+
+ VALUE is the numeric value of the data item. Its format is dependent on the
+ output format given in the member meFmtType. If the format type is
+ FORMATTYPE_NONE, no value is written.
+
+ NAME-FROM-LIST is a symbolic name for the current value of the data item.
+ Various types of name lists produce different names for values, which can
+ be used for enumerations or names for single bits in bitfields (see class
+ NameListBase and derived classes). The name of the list is given in the
+ member maListName. If it is empty, no name is written for the value.
+ */
+struct ItemFormat
+{
+ DataType meDataType; ///< Data type of the item.
+ FormatType meFmtType; ///< Output format for the value.
+ OUString maItemName; ///< Name of the item.
+ OUString maListName; ///< Name of a name list to be used for this item.
+
+ explicit ItemFormat();
+
+ void set( DataType eDataType, FormatType eFmtType, const OUString& rItemName );
+
+ /** Initializes the struct from a vector of strings containing the item format.
+
+ The vector must contain at least 2 strings. The struct is filled from
+ the strings in the vector in the following order:
+ 1) Data type (one of: [u]int8, [u]int16, [u]int32, [u]int64, float, double).
+ 2) Format type (one of: dec, hex, shorthex, bin, fix, bool, unused, unknown).
+ 3) Item name (optional).
+ 4) Name list name (optional).
+
+ @return Iterator pointing to the first unhandled string.
+ */
+ OUStringVector::const_iterator parse( const OUStringVector& rFormatVec );
+
+ /** Initializes the struct from a string containing the item format.
+
+ The string must have the following format:
+ DATATYPE,FORMATTYPE[,ITEMNAME[,LISTNAME]]
+
+ DATATYPE is the data type of the item (see above for possible values).
+ FORMATTYPE is the format type of the item (see above for possible values).
+ ITEMNAME is the name of the item (optional).
+ LISTNAME is the name of a name list (optional).
+
+ @return List containing remaining unhandled format strings.
+ */
+ OUStringVector parse( const OUString& rFormatStr );
+};
+
+// ============================================================================
+// ============================================================================
+
+struct Address
+{
+ sal_Int32 mnCol;
+ sal_Int32 mnRow;
+ inline explicit Address() : mnCol( 0 ), mnRow( 0 ) {}
+ inline explicit Address( sal_Int32 nCol, sal_Int32 nRow ) : mnCol( nCol ), mnRow( nRow ) {}
+};
+
+// ----------------------------------------------------------------------------
+
+struct Range
+{
+ Address maFirst;
+ Address maLast;
+ inline explicit Range() {}
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ::std::vector< Range > RangeList;
+
+// ============================================================================
+
+struct TokenAddress : public Address
+{
+ bool mbRelCol;
+ bool mbRelRow;
+ inline explicit TokenAddress() : mbRelCol( false ), mbRelRow( false ) {}
+};
+
+// ----------------------------------------------------------------------------
+
+struct TokenRange
+{
+ TokenAddress maFirst;
+ TokenAddress maLast;
+ inline explicit TokenRange() {}
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Static helper functions for formatted output to strings. */
+class StringHelper
+{
+public:
+ // append string to string ------------------------------------------------
+
+ static void appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount = 1 );
+ static void appendString( OUStringBuffer& rStr, const OUString& rData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+
+ // append decimal ---------------------------------------------------------
+
+ static void appendDec( OUStringBuffer& rStr, sal_uInt8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, double fData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+
+ // append hexadecimal -----------------------------------------------------
+
+ static void appendHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
+
+ // append shortened hexadecimal -------------------------------------------
+
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
+
+ // append binary ----------------------------------------------------------
+
+ static void appendBin( OUStringBuffer& rStr, sal_uInt8 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int8 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt16 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int16 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt32 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int32 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt64 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int64 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, double fData, bool bDots = true );
+
+ // append fixed-point decimal ---------------------------------------------
+
+ template< typename Type >
+ static void appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth = 0 );
+
+ // append formatted value -------------------------------------------------
+
+ static void appendBool( OUStringBuffer& rStr, bool bData );
+ template< typename Type >
+ static void appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType );
+
+ // encoded text output ----------------------------------------------------
+
+ static void appendCChar( OUStringBuffer& rStr, sal_Unicode cChar, bool bPrefix = true );
+ static void appendEncChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount = 1, bool bPrefix = true );
+ static void appendEncString( OUStringBuffer& rStr, const OUString& rData, bool bPrefix = true );
+
+ // token list -------------------------------------------------------------
+
+ static void appendToken( OUStringBuffer& rStr, const OUString& rToken, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+
+ static void appendIndex( OUStringBuffer& rStr, const OUString& rIdx );
+ static void appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx );
+
+ static OUString getToken( const OUString& rData, sal_Int32& rnPos, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+
+ /** Encloses the passed string with the passed characters. Uses cOpen, if cClose is NUL. */
+ static void enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose = '\0' );
+
+ // string conversion ------------------------------------------------------
+
+ static OUString trimSpaces( const OUString& rStr );
+ static OUString trimTrailingNul( const OUString& rStr );
+
+ static OString convertToUtf8( const OUString& rStr );
+ static DataType convertToDataType( const OUString& rStr );
+ static FormatType convertToFormatType( const OUString& rStr );
+
+ static bool convertFromDec( sal_Int64& ornData, const OUString& rData );
+ static bool convertFromHex( sal_Int64& ornData, const OUString& rData );
+
+ static bool convertStringToInt( sal_Int64& ornData, const OUString& rData );
+ static bool convertStringToDouble( double& orfData, const OUString& rData );
+ static bool convertStringToBool( const OUString& rData );
+
+ static OUStringPair convertStringToPair( const OUString& rString, sal_Unicode cSep = '=' );
+
+ // string to list conversion ----------------------------------------------
+
+ static void convertStringToStringList( OUStringVector& orVec, const OUString& rData, bool bIgnoreEmpty );
+ static void convertStringToIntList( Int64Vector& orVec, const OUString& rData, bool bIgnoreEmpty );
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void StringHelper::appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth )
+{
+ appendDec( rStr, static_cast< double >( nData ) / pow( 2.0, 4.0 * sizeof( Type ) ), nWidth );
+}
+
+template< typename Type >
+void StringHelper::appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType )
+{
+ switch( eFmtType )
+ {
+ case FORMATTYPE_DEC: appendDec( rStr, nData ); break;
+ case FORMATTYPE_HEX: appendHex( rStr, nData ); break;
+ case FORMATTYPE_SHORTHEX: appendShortHex( rStr, nData ); break;
+ case FORMATTYPE_BIN: appendBin( rStr, nData ); break;
+ case FORMATTYPE_FIX: appendFix( rStr, nData ); break;
+ case FORMATTYPE_BOOL: appendBool( rStr, nData ); break;
+ default:;
+ }
+}
+
+// ============================================================================
+
+class String : public OUString
+{
+public:
+ inline String() {}
+ inline /*implicit*/ String( const OUString& rStr ) : OUString( rStr ) {}
+ inline /*implicit*/ String( const sal_Char* pcStr ) : OUString( OUString::createFromAscii( pcStr ? pcStr : "" ) ) {}
+ inline /*implicit*/ String( sal_Unicode cChar ) : OUString( cChar ) {}
+
+ inline bool has() const { return getLength() > 0; }
+ inline OUString operator()( const sal_Char* pcDefault ) const { if( has() ) return *this; return String( pcDefault ); }
+};
+
+static const String EMPTY_STRING;
+
+// ============================================================================
+// ============================================================================
+
+class Base;
+typedef ::boost::shared_ptr< Base > BaseRef;
+
+/** Base class for all dumper classes.
+
+ Derived classes implement the virtual function implIsValid(). It should
+ check all members the other functions rely on. If the function
+ implIsValid() returns true, all references and pointers can be used without
+ further checking.
+
+ Overview of all classes in this header file based on this Base class:
+
+ Base
+ |
+ +----> NameListBase
+ | |
+ | +----> ConstList ------> MultiList
+ | |
+ | +----> FlagsList ------> CombiList
+ | |
+ | +----> UnitConverter
+ |
+ +----> SharedConfigData
+ |
+ +----> Config
+ |
+ +----> Output
+ |
+ +----> StorageIterator
+ |
+ +----> ObjectBase
+ |
+ +----> StorageObjectBase
+ |
+ +----> OutputObjectBase
+ | |
+ | +----> InputObjectBase
+ | |
+ | +----> BinaryStreamObject
+ | |
+ | +----> TextStreamObjectBase
+ | | |
+ | | +----> TextStreamObject
+ | | |
+ | | +----> XmlStreamObject
+ | |
+ | +----> RecordObjectBase
+ | |
+ | +----> SequenceRecordObjectBase
+ |
+ +----> DumperBase
+ */
+class Base
+{
+public:
+ virtual ~Base();
+
+ inline bool isValid() const { return implIsValid(); }
+ inline static bool isValid( const BaseRef& rxBase ) { return rxBase.get() && rxBase->isValid(); }
+
+protected:
+ inline explicit Base() {}
+
+ virtual bool implIsValid() const = 0;
+};
+
+// ============================================================================
+// ============================================================================
+
+class ConfigItemBase
+{
+public:
+ virtual ~ConfigItemBase();
+ void readConfigBlock( TextInputStream& rStrm );
+
+protected:
+ inline explicit ConfigItemBase() {}
+
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implProcessConfigItemInt(
+ TextInputStream& rStrm,
+ sal_Int64 nKey,
+ const OUString& rData );
+
+ void readConfigBlockContents(
+ TextInputStream& rStrm );
+
+private:
+ enum LineType { LINETYPE_DATA, LINETYPE_END };
+
+ LineType readConfigLine(
+ TextInputStream& rStrm,
+ OUString& orKey,
+ OUString& orData ) const;
+
+ void processConfigItem(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+};
+
+// ============================================================================
+
+class SharedConfigData;
+class Config;
+
+class NameListBase;
+typedef ::boost::shared_ptr< NameListBase > NameListRef;
+
+/** Base class of all classes providing names for specific values (name lists).
+
+ The idea is to provide a unique interfase for all different methods to
+ write specific names for any values. This can be enumerations (dedicated
+ names for a subset of values), or names for bits in bit fields. Classes
+ derived from this base class implement the specific behaviour for the
+ desired purpose.
+ */
+class NameListBase : public Base, public ConfigItemBase
+{
+public:
+ typedef ::std::map< sal_Int64, OUString > OUStringMap;
+ typedef OUStringMap::const_iterator const_iterator;
+
+public:
+ virtual ~NameListBase();
+
+ /** Sets a name for the specified key. */
+ void setName( sal_Int64 nKey, const String& rName );
+
+ /** Include all names of the passed list. */
+ void includeList( const NameListRef& rxList );
+
+ /** Returns true, if the map contains an entry for the passed key. */
+ template< typename Type >
+ inline bool hasName( Type nKey ) const
+ { return maMap.count( static_cast< sal_Int64 >( nKey ) ) != 0; }
+
+ /** Returns the name for the passed key. */
+ template< typename Type >
+ inline OUString getName( const Config& rCfg, Type nKey ) const
+ { return implGetName( rCfg, static_cast< sal_Int64 >( nKey ) ); }
+
+ /** Returns a display name for the passed double value. */
+ inline OUString getName( const Config& rCfg, double fValue ) const
+ { return implGetNameDbl( rCfg, fValue ); }
+
+ /** Returns a map iterator pointing to the first contained name. */
+ inline const_iterator begin() const { return maMap.begin(); }
+ /** Returns a map iterator pointing one past the last contained name. */
+ inline const_iterator end() const { return maMap.end(); }
+
+protected:
+ inline explicit NameListBase( const SharedConfigData& rCfgData ) : mrCfgData( rCfgData ) {}
+
+ virtual bool implIsValid() const;
+
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implProcessConfigItemInt(
+ TextInputStream& rStrm,
+ sal_Int64 nKey,
+ const OUString& rData );
+
+ /** Derived classes set the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName ) = 0;
+ /** Derived classes generate and return the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const = 0;
+ /** Derived classes generate and return the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const = 0;
+ /** Derived classes insert all names and other settings from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList ) = 0;
+
+ /** Inserts the passed name into the internal map. */
+ void insertRawName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key, or 0, if nothing found. */
+ const OUString* findRawName( sal_Int64 nKey ) const;
+
+private:
+ /** Includes name lists, given in a comma separated list of names of the lists. */
+ void include( const OUString& rListKeys );
+ /** Excludes names from the list, given in a comma separated list of their keys. */
+ void exclude( const OUString& rKeys );
+
+private:
+ OUStringMap maMap;
+ const SharedConfigData& mrCfgData;
+};
+
+// ============================================================================
+
+class ConstList : public NameListBase
+{
+public:
+ explicit ConstList( const SharedConfigData& rCfgData );
+
+ /** Sets a default name for unknown keys. */
+ inline void setDefaultName( const String& rDefName ) { maDefName = rDefName; }
+ /** Enables or disables automatic quotation of returned names. */
+ inline void setQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; }
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key, or the default name, if key is not contained. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Returns the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
+ /** Inserts all names from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ OUString maDefName;
+ bool mbQuoteNames;
+};
+
+// ============================================================================
+
+class MultiList : public ConstList
+{
+public:
+ explicit MultiList( const SharedConfigData& rCfgData );
+
+ void setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNames );
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+
+private:
+ void insertNames( sal_Int64 nStartKey, const OUString& rData );
+
+private:
+ bool mbIgnoreEmpty;
+};
+
+// ============================================================================
+
+class FlagsList : public NameListBase
+{
+public:
+ explicit FlagsList( const SharedConfigData& rCfgData );
+
+ /** Returns the flags to be ignored on output. */
+ inline sal_Int64 getIgnoreFlags() const { return mnIgnore; }
+ /** Sets flags to be ignored on output. */
+ inline void setIgnoreFlags( sal_Int64 nIgnore ) { mnIgnore = nIgnore; }
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Returns the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
+ /** Inserts all flags from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ sal_Int64 mnIgnore;
+};
+
+// ============================================================================
+
+class CombiList : public FlagsList
+{
+public:
+ explicit CombiList( const SharedConfigData& rCfgData );
+
+protected:
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Inserts all flags from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ struct ExtItemFormatKey
+ {
+ sal_Int64 mnKey;
+ Int64Pair maFilter;
+ inline explicit ExtItemFormatKey( sal_Int64 nKey ) : mnKey( nKey ), maFilter( 0, 0 ) {}
+ bool operator<( const ExtItemFormatKey& rRight ) const;
+
+ };
+ struct ExtItemFormat : public ItemFormat
+ {
+ bool mbShiftValue;
+ inline explicit ExtItemFormat() : mbShiftValue( true ) {}
+ };
+ typedef ::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap;
+ ExtItemFormatMap maFmtMap;
+};
+
+// ============================================================================
+
+class UnitConverter : public NameListBase
+{
+public:
+ explicit UnitConverter( const SharedConfigData& rCfgData );
+
+ inline void setUnitName( const String& rUnitName ) { maUnitName = rUnitName; }
+ inline void setFactor( double fFactor ) { mfFactor = fFactor; }
+
+protected:
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the converted value with appended unit name. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Returns the converted value with appended unit name. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
+ /** Empty implementation. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ OUString maUnitName;
+ double mfFactor;
+};
+
+// ============================================================================
+
+class NameListWrapper
+{
+public:
+ inline NameListWrapper() {}
+ inline /*implicit*/ NameListWrapper( const OUString& rListName ) : maName( rListName ) {}
+ inline /*implicit*/ NameListWrapper( const sal_Char* pcListName ) : maName( pcListName ) {}
+ inline /*implicit*/ NameListWrapper( const NameListRef& rxList ) : mxList( rxList ) {}
+
+ inline bool isEmpty() const { return !mxList && !maName.has(); }
+ NameListRef getNameList( const Config& rCfg ) const;
+
+private:
+ String maName;
+ mutable NameListRef mxList;
+};
+
+static const NameListWrapper NO_LIST;
+
+// ============================================================================
+
+class ItemFormatMap : public ::std::map< sal_Int64, ItemFormat >
+{
+public:
+ inline explicit ItemFormatMap() {}
+ inline explicit ItemFormatMap( const NameListRef& rxNameList ) { insertFormats( rxNameList ); }
+
+ void insertFormats( const NameListRef& rxNameList );
+};
+
+// ============================================================================
+// ============================================================================
+
+class SharedConfigData : public Base, public ConfigItemBase
+{
+public:
+ explicit SharedConfigData(
+ const OUString& rFileName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual ~SharedConfigData();
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxContext; }
+ inline const StorageRef& getRootStorage() const { return mxRootStrg; }
+ inline const OUString& getSysFileName() const { return maSysFileName; }
+
+ void setOption( const OUString& rKey, const OUString& rData );
+ const OUString* getOption( const OUString& rKey ) const;
+
+ template< typename ListType >
+ ::boost::shared_ptr< ListType > createNameList( const OUString& rListName );
+ void setNameList( const OUString& rListName, const NameListRef& rxList );
+ void eraseNameList( const OUString& rListName );
+ NameListRef getNameList( const OUString& rListName ) const;
+
+ inline bool isPasswordCancelled() const { return mbPwCancelled; }
+
+protected:
+ virtual bool implIsValid() const;
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+private:
+ bool readConfigFile( const OUString& rFileUrl );
+ template< typename ListType >
+ void readNameList( TextInputStream& rStrm, const OUString& rListName );
+ void createShortList( const OUString& rData );
+ void createUnitConverter( const OUString& rData );
+
+private:
+ typedef ::std::set< OUString > ConfigFileSet;
+ typedef ::std::map< OUString, OUString > ConfigDataMap;
+ typedef ::std::map< OUString, NameListRef > NameListMap;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+ StorageRef mxRootStrg;
+ OUString maSysFileName;
+ ConfigFileSet maConfigFiles;
+ ConfigDataMap maConfigData;
+ NameListMap maNameLists;
+ OUString maConfigPath;
+ bool mbLoaded;
+ bool mbPwCancelled;
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename ListType >
+::boost::shared_ptr< ListType > SharedConfigData::createNameList( const OUString& rListName )
+{
+ ::boost::shared_ptr< ListType > xList;
+ if( !rListName.isEmpty() )
+ {
+ xList.reset( new ListType( *this ) );
+ setNameList( rListName, xList );
+ }
+ return xList;
+}
+
+template< typename ListType >
+void SharedConfigData::readNameList( TextInputStream& rStrm, const OUString& rListName )
+{
+ NameListRef xList = createNameList< ListType >( rListName );
+ if( xList.get() )
+ xList->readConfigBlock( rStrm );
+}
+
+// ============================================================================
+
+class Config : public Base
+{
+public:
+ explicit Config( const Config& rParent );
+ explicit Config(
+ const sal_Char* pcEnvVar,
+ const ::oox::core::FilterBase& rFilter );
+ explicit Config(
+ const sal_Char* pcEnvVar,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual ~Config();
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxCfgData->getContext(); }
+ inline const StorageRef& getRootStorage() const { return mxCfgData->getRootStorage(); }
+ inline const OUString& getSysFileName() const { return mxCfgData->getSysFileName(); }
+
+ const OUString& getStringOption( const String& rKey, const OUString& rDefault ) const;
+ bool getBoolOption( const String& rKey, bool bDefault ) const;
+ template< typename Type >
+ Type getIntOption( const String& rKey, Type nDefault ) const;
+
+ bool isDumperEnabled() const;
+ bool isImportEnabled() const;
+
+ template< typename ListType >
+ ::boost::shared_ptr< ListType > createNameList( const String& rListName );
+ void eraseNameList( const String& rListName );
+ NameListRef getNameList( const String& rListName ) const;
+
+ /** Returns the name for the passed key from the passed name list. */
+ template< typename Type >
+ OUString getName( const NameListWrapper& rListWrp, Type nKey ) const;
+ /** Returns true, if the passed name list contains an entry for the passed key. */
+ template< typename Type >
+ bool hasName( const NameListWrapper& rListWrp, Type nKey ) const;
+
+ bool isPasswordCancelled() const;
+
+protected:
+ inline explicit Config() {}
+ void construct( const Config& rParent );
+ void construct(
+ const sal_Char* pcEnvVar,
+ const ::oox::core::FilterBase& rFilter );
+ void construct(
+ const sal_Char* pcEnvVar,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual bool implIsValid() const;
+ virtual const OUString* implGetOption( const OUString& rKey ) const;
+ virtual NameListRef implGetNameList( const OUString& rListName ) const;
+
+private:
+ typedef ::boost::shared_ptr< SharedConfigData > SharedConfigDataRef;
+ SharedConfigDataRef mxCfgData;
+};
+
+typedef ::boost::shared_ptr< Config > ConfigRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+Type Config::getIntOption( const String& rKey, Type nDefault ) const
+{
+ sal_Int64 nRawData;
+ const OUString* pData = implGetOption( rKey );
+ return (pData && StringHelper::convertStringToInt( nRawData, *pData )) ?
+ static_cast< Type >( nRawData ) : nDefault;
+}
+
+template< typename ListType >
+::boost::shared_ptr< ListType > Config::createNameList( const String& rListName )
+{
+ return mxCfgData->createNameList< ListType >( rListName );
+}
+
+template< typename Type >
+OUString Config::getName( const NameListWrapper& rListWrp, Type nKey ) const
+{
+ NameListRef xList = rListWrp.getNameList( *this );
+ return xList.get() ? xList->getName( *this, nKey ) : OOX_DUMP_ERR_NOMAP;
+}
+
+template< typename Type >
+bool Config::hasName( const NameListWrapper& rListWrp, Type nKey ) const
+{
+ NameListRef xList = rListWrp.getNameList( *this );
+ return xList.get() && xList->hasName( nKey );
+}
+
+// ============================================================================
+// ============================================================================
+
+class Output : public Base
+{
+public:
+ explicit Output(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ // ------------------------------------------------------------------------
+
+ void newLine();
+ void emptyLine( size_t nCount = 1 );
+ inline OUStringBuffer& getLine() { return maLine; }
+
+ void incIndent();
+ void decIndent();
+
+ void startTable( sal_Int32 nW1 );
+ void startTable( sal_Int32 nW1, sal_Int32 nW2 );
+ void startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 );
+ void startTable( size_t nColCount, const sal_Int32* pnColWidths );
+ void tab();
+ void tab( size_t nCol );
+ void endTable();
+
+ void resetItemIndex( sal_Int64 nIdx = 0 );
+ void startItem( const String& rItemName );
+ void contItem();
+ void endItem();
+ inline const OUString& getLastItemValue() const { return maLastItem; }
+
+ void startMultiItems();
+ void endMultiItems();
+
+ // ------------------------------------------------------------------------
+
+ void writeChar( sal_Unicode cChar, sal_Int32 nCount = 1 );
+ void writeAscii( const sal_Char* pcStr );
+ void writeString( const OUString& rStr );
+ void writeArray( const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ void writeBool( bool bData );
+ void writeDateTime( const ::com::sun::star::util::DateTime& rDateTime );
+
+ template< typename Type >
+ inline void writeDec( Type nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' )
+ { StringHelper::appendDec( maLine, nData, nWidth, cFill ); }
+ template< typename Type >
+ inline void writeHex( Type nData, bool bPrefix = true )
+ { StringHelper::appendHex( maLine, nData, bPrefix ); }
+ template< typename Type >
+ inline void writeShortHex( Type nData, bool bPrefix = true )
+ { StringHelper::appendShortHex( maLine, nData, bPrefix ); }
+ template< typename Type >
+ inline void writeBin( Type nData, bool bDots = true )
+ { StringHelper::appendBin( maLine, nData, bDots ); }
+ template< typename Type >
+ inline void writeFix( Type nData, sal_Int32 nWidth = 0 )
+ { StringHelper::appendFix( maLine, nData, nWidth ); }
+ template< typename Type >
+ inline void writeValue( Type nData, FormatType eFmtType )
+ { StringHelper::appendValue( maLine, nData, eFmtType ); }
+ template< typename Type >
+ inline void writeName( const Config& rCfg, Type nData, const NameListWrapper& rListWrp )
+ { writeString( rCfg.getName( rListWrp, nData ) ); }
+
+ // ------------------------------------------------------------------------
+protected:
+ virtual bool implIsValid() const;
+
+private:
+ void writeItemName( const String& rItemName );
+
+private:
+ typedef ::std::vector< sal_Int32 > StringLenVec;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream2 > mxStrm;
+ OUString maIndent;
+ OUStringBuffer maLine;
+ OUString maLastItem;
+ StringLenVec maColPos;
+ size_t mnCol;
+ size_t mnItemLevel;
+ size_t mnMultiLevel;
+ sal_Int64 mnItemIdx;
+ sal_Int32 mnLastItem;
+};
+
+typedef ::boost::shared_ptr< Output > OutputRef;
+
+// ============================================================================
+
+class IndentGuard
+{
+public:
+ inline explicit IndentGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.incIndent(); }
+ inline ~IndentGuard() { mrOut.decIndent(); }
+private:
+ IndentGuard( const IndentGuard& );
+ IndentGuard& operator=( const IndentGuard& );
+private:
+ Output& mrOut;
+};
+
+// ----------------------------------------------------------------------------
+
+class TableGuard
+{
+public:
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2, nW3, nW4 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, size_t nColCount,
+ const sal_Int32* pnColWidths ) :
+ mrOut( *rxOut ) { mrOut.startTable( nColCount, pnColWidths ); }
+ inline ~TableGuard() { mrOut.endTable(); }
+ inline void tab() { mrOut.tab(); }
+ inline void tab( size_t nCol ) { mrOut.tab( nCol ); }
+private:
+ TableGuard( const TableGuard& );
+ TableGuard& operator=( const TableGuard& );
+private:
+ Output& mrOut;
+};
+
+// ----------------------------------------------------------------------------
+
+class ItemGuard
+{
+public:
+ inline explicit ItemGuard( const OutputRef& rxOut, const String& rName = EMPTY_STRING ) :
+ mrOut( *rxOut ) { mrOut.startItem( rName ); }
+ inline ~ItemGuard() { mrOut.endItem(); }
+ inline void cont() { mrOut.contItem(); }
+private:
+ ItemGuard( const ItemGuard& );
+ ItemGuard& operator=( const ItemGuard& );
+private:
+ Output& mrOut;
+};
+
+// ----------------------------------------------------------------------------
+
+class MultiItemsGuard
+{
+public:
+ inline explicit MultiItemsGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.startMultiItems(); }
+ inline ~MultiItemsGuard() { mrOut.endMultiItems(); }
+private:
+ MultiItemsGuard( const MultiItemsGuard& );
+ MultiItemsGuard& operator=( const MultiItemsGuard& );
+private:
+ Output& mrOut;
+};
+
+// ============================================================================
+
+class StorageIterator : public Base
+{
+public:
+ explicit StorageIterator( const StorageRef& rxStrg );
+ virtual ~StorageIterator();
+
+ StorageIterator& operator++();
+
+ OUString getName() const;
+ bool isStream() const;
+ bool isStorage() const;
+
+private:
+ virtual bool implIsValid() const;
+
+private:
+ StorageRef mxStrg;
+ OUStringVector maNames;
+ OUStringVector::const_iterator maIt;
+};
+
+// ============================================================================
+// ============================================================================
+
+class ObjectBase : public Base
+{
+public:
+ virtual ~ObjectBase();
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
+ getContext() const { return mxConfig->getContext(); }
+
+ void dump();
+
+ // ------------------------------------------------------------------------
+protected:
+ inline explicit ObjectBase() {}
+
+ void construct( const ConfigRef& rxConfig );
+ void construct( const ObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ // ------------------------------------------------------------------------
+
+ inline Config& cfg() const { return *mxConfig; }
+
+private:
+ ConfigRef mxConfig;
+};
+
+typedef ::boost::shared_ptr< ObjectBase > ObjectRef;
+
+// ============================================================================
+// ============================================================================
+
+class StorageObjectBase : public ObjectBase
+{
+protected:
+ inline explicit StorageObjectBase() {}
+
+protected:
+ using ObjectBase::construct;
+ void construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+ void construct( const ObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+ void addPreferredStream( const String& rStrmName );
+ void addPreferredStorage( const String& rStrgPath );
+
+private:
+ OUString getSysFileName(
+ const OUString& rStrmName,
+ const OUString& rSysOutPath );
+
+ void extractStream(
+ StorageBase& rStrg,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+ void extractStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+ void extractItem(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rItemName,
+ const OUString& rSysPath,
+ bool bIsStrg, bool bIsStrm );
+
+private:
+ struct PreferredItem
+ {
+ OUString maName;
+ bool mbStorage;
+
+ inline explicit PreferredItem( const OUString rName, bool bStorage ) :
+ maName( rName ), mbStorage( bStorage ) {}
+ };
+ typedef ::std::vector< PreferredItem > PreferredItemVector;
+
+ StorageRef mxStrg;
+ OUString maSysPath;
+ PreferredItemVector maPreferred;
+};
+
+typedef ::boost::shared_ptr< StorageObjectBase > StorageObjectRef;
+
+// ============================================================================
+// ============================================================================
+
+class OutputObjectBase : public ObjectBase
+{
+public:
+ virtual ~OutputObjectBase();
+
+ // ------------------------------------------------------------------------
+protected:
+ inline explicit OutputObjectBase() {}
+
+ using ObjectBase::construct;
+ void construct( const ObjectBase& rParent, const OUString& rSysFileName );
+ void construct( const OutputObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+
+ // ------------------------------------------------------------------------
+
+ void writeEmptyItem( const String& rName );
+ void writeInfoItem( const String& rName, const String& rData );
+ void writeCharItem( const String& rName, sal_Unicode cData );
+ void writeStringItem( const String& rName, const OUString& rData );
+ void writeArrayItem( const String& rName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ void writeDateTimeItem( const String& rName, const ::com::sun::star::util::DateTime& rDateTime );
+ void writeGuidItem( const String& rName, const OUString& rGuid );
+
+ template< typename Type >
+ void addNameToItem( Type nData, const NameListWrapper& rListWrp );
+
+ template< typename Type >
+ void writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp );
+ template< typename Type >
+ void writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST );
+
+ template< typename Type >
+ void writeValueItem( const ItemFormat& rItemFmt, Type nData );
+
+ template< typename Type >
+ void writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
+ template< typename Type >
+ void writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
+
+protected:
+ OutputRef mxOut;
+ OUString maSysFileName;
+};
+
+typedef ::boost::shared_ptr< OutputObjectBase > OutputObjectRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void OutputObjectBase::addNameToItem( Type nData, const NameListWrapper& rListWrp )
+{
+ if( !rListWrp.isEmpty() )
+ {
+ mxOut->contItem();
+ mxOut->writeName( cfg(), nData, rListWrp );
+ }
+}
+
+template< typename Type >
+void OutputObjectBase::writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeName( cfg(), nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeHex( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeShortHex( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeBin( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeFix( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData );
+ aItem.cont();
+ mxOut->writeBool( nData != 0 );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp )
+{
+ if( eFmtType == FORMATTYPE_BOOL )
+ writeDecBoolItem( rName, nData, rListWrp );
+ else
+ {
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeValue( nData, eFmtType );
+ addNameToItem( nData, rListWrp );
+ }
+}
+
+template< typename Type >
+void OutputObjectBase::writeValueItem( const ItemFormat& rItemFmt, Type nData )
+{
+ OString aNameUtf8 = StringHelper::convertToUtf8( rItemFmt.maItemName );
+ writeValueItem( aNameUtf8.getStr(), nData, rItemFmt.meFmtType, rItemFmt.maListName );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData1 );
+ mxOut->writeChar( cSep );
+ mxOut->writeDec( nData2 );
+}
+
+template< typename Type >
+void OutputObjectBase::writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeHex( nData1 );
+ mxOut->writeChar( cSep );
+ mxOut->writeHex( nData2 );
+}
+
+// ============================================================================
+// ============================================================================
+
+class InputObjectBase : public OutputObjectBase
+{
+public:
+ virtual ~InputObjectBase();
+
+ // ------------------------------------------------------------------------
+protected:
+ inline explicit InputObjectBase() {}
+
+ using OutputObjectBase::construct;
+ void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+ void construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
+ void construct( const InputObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+
+ // ------------------------------------------------------------------------
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ getXInputStream() const;
+
+ // ------------------------------------------------------------------------
+
+ void skipBlock( sal_Int64 nBytes, bool bShowSize = true );
+ void dumpRawBinary( sal_Int64 nBytes, bool bShowOffset = true, bool bStream = false );
+
+ void dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset = true );
+ void dumpRemaining( sal_Int64 nBytes );
+ void dumpRemainingTo( sal_Int64 nPos );
+ void dumpRemainingStream();
+
+ void dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ inline void dumpUnused( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNUSED, nBytes ); }
+ inline void dumpUnknown( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNKNOWN, nBytes ); }
+
+ sal_Unicode dumpUnicode( const String& rName );
+
+ OUString dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul = false );
+ OUString dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul = false );
+
+ ::com::sun::star::util::DateTime dumpFileTime( const String& rName = EMPTY_STRING );
+ OUString dumpGuid( const String& rName = EMPTY_STRING );
+
+ void dumpItem( const ItemFormat& rItemFmt );
+
+ template< typename Type >
+ Type dumpName( const String& rName, const NameListWrapper& rListWrp );
+ template< typename Type >
+ Type dumpDec( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpHex( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpBin( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpFix( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpBool( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpValue( const ItemFormat& rItemFmt );
+
+ template< typename Type1, typename Type2 >
+ Type1 dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpValue( bool bType1, const ItemFormat& rItemFmt );
+
+ template< typename Type >
+ void dumpDecPair( const String& rName, sal_Unicode cSep = ',' );
+ template< typename Type >
+ void dumpHexPair( const String& rName, sal_Unicode cSep = ',' );
+
+protected:
+ BinaryInputStreamRef mxStrm;
+};
+
+typedef ::boost::shared_ptr< InputObjectBase > InputObjectRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+Type InputObjectBase::dumpName( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeNameItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpDec( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeDecItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpHex( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeHexItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpBin( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeBinItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpFix( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeFixItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpBool( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeDecBoolItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpValue( const ItemFormat& rItemFmt )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeValueItem( rItemFmt, nData );
+ return nData;
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpName< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpName< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpDec< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpDec< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpHex< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpHex< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpBin< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBin< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpFix< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpFix< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpBool< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBool< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpValue( bool bType1, const ItemFormat& rItemFmt )
+{
+ return bType1 ? dumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( dumpValue< Type2 >( rItemFmt ) );
+}
+
+template< typename Type >
+void InputObjectBase::dumpDecPair( const String& rName, sal_Unicode cSep )
+{
+ Type nData1, nData2;
+ *mxStrm >> nData1 >> nData2;
+ writeDecPairItem( rName, nData1, nData2, cSep );
+}
+
+template< typename Type >
+void InputObjectBase::dumpHexPair( const String& rName, sal_Unicode cSep )
+{
+ Type nData1, nData2;
+ *mxStrm >> nData1 >> nData2;
+ writeHexPairItem( rName, nData1, nData2, cSep );
+}
+
+// ============================================================================
+// ============================================================================
+
+class BinaryStreamObject : public InputObjectBase
+{
+public:
+ explicit BinaryStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+protected:
+ void dumpBinaryStream( bool bShowOffset = true );
+
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class TextStreamObjectBase : public InputObjectBase
+{
+protected:
+ inline TextStreamObjectBase() {}
+
+ using InputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc,
+ const OUString& rSysFileName );
+ void construct(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual void implDumpText( TextInputStream& rTextStrm ) = 0;
+
+private:
+ void constructTextStrmObj( rtl_TextEncoding eTextEnc );
+
+protected:
+ ::boost::shared_ptr< TextInputStream > mxTextStrm;
+};
+
+// ============================================================================
+
+class TextLineStreamObject : public TextStreamObjectBase
+{
+public:
+ explicit TextLineStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc,
+ const OUString& rSysFileName );
+
+ explicit TextLineStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc );
+
+protected:
+ virtual void implDumpText( TextInputStream& rTextStrm );
+ virtual void implDumpLine( const OUString& rLine, sal_uInt32 nLine );
+};
+
+// ============================================================================
+
+class XmlStreamObject : public TextStreamObjectBase
+{
+public:
+ explicit XmlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDumpText( TextInputStream& rTextStrm );
+};
+
+// ============================================================================
+// ============================================================================
+
+class RecordObjectBase : public InputObjectBase
+{
+protected:
+ inline explicit RecordObjectBase() {}
+
+ using InputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm,
+ const OUString& rSysFileName,
+ const BinaryInputStreamRef& rxRecStrm,
+ const String& rRecNames,
+ const String& rSimpleRecs = EMPTY_STRING );
+
+ inline sal_Int64 getRecPos() const { return mnRecPos; }
+ inline sal_Int64 getRecId() const { return mnRecId; }
+ inline sal_Int64 getRecSize() const { return mnRecSize; }
+ inline NameListRef getRecNames() const { return maRecNames.getNameList( cfg() ); }
+
+ inline void setBinaryOnlyMode( bool bBinaryOnly ) { mbBinaryOnly = bBinaryOnly; }
+ inline bool isBinaryOnlyMode() const { return mbBinaryOnly; }
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
+ virtual void implWriteExtHeader();
+ virtual void implDumpRecordBody();
+
+private:
+ void constructRecObjBase(
+ const BinaryInputStreamRef& rxBaseStrm,
+ const String& rRecNames,
+ const String& rSimpleRecs );
+
+ void writeHeader();
+
+private:
+ BinaryInputStreamRef mxBaseStrm;
+ NameListWrapper maRecNames;
+ NameListWrapper maSimpleRecs;
+ sal_Int64 mnRecPos;
+ sal_Int64 mnRecId;
+ sal_Int64 mnRecSize;
+ bool mbShowRecPos;
+ bool mbBinaryOnly;
+};
+
+// ============================================================================
+
+class SequenceRecordObjectBase : public RecordObjectBase
+{
+protected:
+ inline explicit SequenceRecordObjectBase() : mxRecData( new StreamDataSequence ) {}
+
+ inline StreamDataSequence& getRecordDataSequence() { return *mxRecData; }
+
+ using RecordObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm,
+ const OUString& rSysFileName,
+ const String& rRecNames,
+ const String& rSimpleRecs = EMPTY_STRING );
+
+ virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
+
+private:
+ typedef ::boost::shared_ptr< StreamDataSequence > StreamDataSeqRef;
+ StreamDataSeqRef mxRecData;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Base class for a file dumper. Derived classes implement the implDump()
+ function to add functionality.
+ */
+class DumperBase : public ObjectBase
+{
+public:
+ virtual ~DumperBase();
+
+ bool isImportEnabled() const;
+ bool isImportCancelled() const;
+
+protected:
+ inline explicit DumperBase() {}
+
+ using ObjectBase::construct;
+ void construct( const ConfigRef& rxConfig );
+};
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#define OOX_DUMP_FILE( DumperClassName ) \
+do { \
+ DumperClassName aDumper( *this ); \
+ aDumper.dump(); \
+ bool bCancelled = aDumper.isImportCancelled(); \
+ if( !aDumper.isImportEnabled() || bCancelled ) \
+ return aDumper.isValid() && !bCancelled; \
+} while( false )
+
+#else // OOX_INCLUDE_DUMPER
+
+#define OOX_DUMP_FILE( DumperClassName ) (void)0
+
+#endif // OOX_INCLUDE_DUMPER
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/oledumper.hxx b/include/oox/dump/oledumper.hxx
new file mode 100644
index 000000000000..b58500ef8f3c
--- /dev/null
+++ b/include/oox/dump/oledumper.hxx
@@ -0,0 +1,905 @@
+/* -*- 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 OOX_DUMP_OLEDUMPER_HXX
+#define OOX_DUMP_OLEDUMPER_HXX
+
+#include "oox/helper/storagebase.hxx"
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+// ============================================================================
+
+class OleInputObjectBase : public InputObjectBase
+{
+protected:
+ inline explicit OleInputObjectBase() {}
+
+ OUString dumpAnsiString32( const String& rName );
+ OUString dumpUniString32( const String& rName );
+
+ sal_Int32 dumpStdClipboardFormat( const String& rName = EMPTY_STRING );
+ OUString dumpAnsiString32OrStdClip( const String& rName );
+ OUString dumpUniString32OrStdClip( const String& rName );
+
+ void writeOleColorItem( const String& rName, sal_uInt32 nColor );
+ sal_uInt32 dumpOleColor( const String& rName );
+};
+
+// ============================================================================
+// ============================================================================
+
+class StdFontObject : public OleInputObjectBase
+{
+public:
+ explicit StdFontObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+
+class StdPicObject : public OleInputObjectBase
+{
+public:
+ explicit StdPicObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class OleStreamObject : public OleInputObjectBase
+{
+public:
+ explicit OleStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class OleCompObjObject : public OleStreamObject
+{
+public:
+ explicit OleCompObjObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class OlePropertyStreamObject : public InputObjectBase
+{
+public:
+ explicit OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+
+private:
+ void dumpSection( const OUString& rGuid, sal_uInt32 nStartPos );
+
+ void dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos );
+ void dumpCodePageProperty( sal_uInt32 nStartPos );
+ void dumpDictionaryProperty( sal_uInt32 nStartPos );
+
+ sal_uInt16 dumpPropertyContents( sal_Int32 nPropId );
+ void dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType );
+ void dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType );
+ void dumpPropertyArray( sal_Int32 nPropId, sal_uInt16 nBaseType );
+
+ sal_uInt16 dumpPropertyType();
+ void dumpBlob( sal_Int32 nPropId, const String& rName );
+ OUString dumpString8( const String& rName );
+ OUString dumpCharArray8( const String& rName, sal_Int32 nLen );
+ OUString dumpString16( const String& rName );
+ OUString dumpCharArray16( const String& rName, sal_Int32 nLen );
+ bool dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType );
+ void dumpHlinks( sal_Int32 nSize );
+
+ bool startElement( sal_uInt32 nStartPos );
+ void writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos );
+ void writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos );
+
+private:
+ NameListRef mxPropIds;
+ rtl_TextEncoding meTextEnc;
+ bool mbIsUnicode;
+};
+
+// ============================================================================
+
+class OleStorageObject : public StorageObjectBase
+{
+public:
+ explicit OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+protected:
+ inline explicit OleStorageObject() {}
+
+ using StorageObjectBase::construct;
+ void construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+// ============================================================================
+
+class ComCtlObjectBase : public OleInputObjectBase
+{
+protected:
+ explicit ComCtlObjectBase(
+ const InputObjectBase& rParent,
+ sal_uInt32 nDataId5, sal_uInt32 nDataId6, sal_uInt16 nVersion,
+ bool bCommonPart, bool bComplexPart );
+
+ virtual void implDump();
+ virtual void implDumpProperties() = 0;
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+
+private:
+ bool dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor = SAL_MAX_UINT16, sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
+ bool dumpComCtlSize();
+ bool dumpComCtlData( sal_uInt32& ornCommonPartSize );
+ bool dumpComCtlCommon( sal_uInt32 nPartSize );
+ bool dumpComCtlComplex();
+
+protected:
+ sal_uInt32 mnDataId5;
+ sal_uInt32 mnDataId6;
+ sal_uInt16 mnVersion;
+ bool mbCommonPart;
+ bool mbComplexPart;
+};
+
+// ============================================================================
+
+class ComCtlScrollBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlScrollBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlProgressBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlProgressBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlSliderObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlSliderObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlUpDownObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlUpDownObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlImageListObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlImageListObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+};
+
+// ============================================================================
+
+class ComCtlTabStripObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTabStripObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+};
+
+// ============================================================================
+
+class ComCtlTreeViewObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTreeViewObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+
+private:
+ sal_uInt32 mnStringFlags;
+};
+
+// ============================================================================
+
+class ComCtlStatusBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlStatusBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+};
+
+// ============================================================================
+// ============================================================================
+
+class AxPropertyObjectBase : public OleInputObjectBase
+{
+protected:
+ inline explicit AxPropertyObjectBase() {}
+
+ using OleInputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ const String& rPropNameList,
+ bool b64BitPropFlags = false );
+ void construct(
+ const InputObjectBase& rParent,
+ const String& rPropNameList,
+ bool b64BitPropFlags = false );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+ bool ensureValid( bool bCondition = true );
+
+ template< typename Type >
+ void alignInput();
+
+ void setAlignAnchor();
+ bool startNextProperty();
+ OUString getPropertyName() const;
+
+ template< typename Type >
+ Type dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+
+ inline bool dumpBoolProperty() { return startNextProperty(); }
+ inline sal_Int32 dumpHmmProperty() { return dumpDecProperty< sal_Int32 >( 0, "CONV-HMM-TO-CM" ); }
+ inline sal_uInt8 dumpMousePtrProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OLE-MOUSEPTR" ); }
+ template< typename Type >
+ inline Type dumpBorderStyleProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-BORDERSTYLE" ); }
+ template< typename Type >
+ inline Type dumpSpecialEffectProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-SPECIALEFFECT" ); }
+ inline sal_uInt32 dumpEnabledProperty() { return dumpDecProperty< sal_uInt32 >( 1, "AX-ENABLED" ); }
+ inline sal_Int32 dumpOrientationProperty() { return dumpDecProperty< sal_Int32 >( -1, "AX-ORIENTATION" ); }
+ inline sal_Int32 dumpDelayProperty() { return dumpDecProperty< sal_Int32 >( 50, "AX-CONV-MS" ); }
+ inline sal_uInt32 dumpImagePosProperty() { return dumpHexProperty< sal_uInt32 >( 0x00070001, "AX-IMAGEPOS" ); }
+ inline sal_uInt8 dumpImageSizeModeProperty() { return dumpDecProperty< sal_uInt8 >( 0, "AX-IMAGESIZEMODE" ); }
+ inline sal_uInt8 dumpImageAlignProperty() { return dumpDecProperty< sal_uInt8 >( 2, "AX-IMAGEALIGN" ); }
+
+ sal_uInt32 dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList = "AX-FLAGS" );
+ sal_uInt32 dumpColorProperty( sal_uInt32 nDefault );
+ sal_Unicode dumpUnicodeProperty();
+ void dumpUnknownProperty();
+
+ void dumpPosProperty();
+ void dumpSizeProperty();
+ void dumpGuidProperty( OUString* pValue = 0 );
+ void dumpStringProperty( OUString* pValue = 0 );
+ void dumpStringArrayProperty();
+ void dumpStreamProperty();
+
+ void dumpEmbeddedFont();
+ void dumpToPosition( sal_Int64 nPos );
+
+private:
+ void constructAxPropObj( const String& rPropNameList, bool b64BitPropFlags );
+
+ void dumpVersion();
+ OUString dumpString( const String& rName, sal_uInt32 nSize, bool bArray );
+ void dumpShortProperties();
+ void dumpLargeProperties();
+
+private:
+ struct LargeProperty
+ {
+ enum LargePropertyType { PROPTYPE_POS, PROPTYPE_SIZE, PROPTYPE_GUID, PROPTYPE_STRING, PROPTYPE_STRINGARRAY };
+
+ LargePropertyType mePropType;
+ OUString maItemName;
+ sal_uInt32 mnDataSize;
+ OUString* mpItemValue;
+ inline explicit LargeProperty( LargePropertyType ePropType, const String& rItemName, sal_uInt32 nDataSize, OUString* pItemValue = 0 ) :
+ mePropType( ePropType ), maItemName( rItemName ), mnDataSize( nDataSize ), mpItemValue( pItemValue ) {}
+ };
+ typedef ::std::vector< LargeProperty > LargePropertyVector;
+
+ struct StreamProperty
+ {
+ OUString maItemName;
+ sal_uInt16 mnData;
+ inline explicit StreamProperty( const String& rItemName, sal_uInt16 nData ) :
+ maItemName( rItemName ), mnData( nData ) {}
+ };
+ typedef ::std::vector< StreamProperty > StreamPropertyVector;
+
+ LargePropertyVector maLargeProps;
+ StreamPropertyVector maStreamProps;
+ NameListRef mxPropNames;
+ sal_Int64 mnPropertiesStart;
+ sal_Int64 mnPropertiesEnd;
+ sal_Int64 mnPropFlags;
+ sal_Int64 mnCurrProp;
+ bool mb64BitPropFlags;
+ bool mbValid;
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void AxPropertyObjectBase::alignInput()
+{
+ mxStrm->skip( (sizeof( Type ) - ((mxStrm->tell() - mnPropertiesStart) % sizeof( Type ))) % sizeof( Type ) );
+}
+
+template< typename Type >
+Type AxPropertyObjectBase::dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+ if( startNextProperty() )
+ {
+ alignInput< Type >();
+ return dumpDec< Type >( getPropertyName(), rListWrp );
+ }
+ return nDefault;
+}
+
+template< typename Type >
+Type AxPropertyObjectBase::dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+ if( startNextProperty() )
+ {
+ alignInput< Type >();
+ return dumpHex< Type >( getPropertyName(), rListWrp );
+ }
+ return nDefault;
+}
+
+// ============================================================================
+
+class AxCFontNewObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxCFontNewObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxColumnInfoObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxColumnInfoObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxCommandButtonObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxCommandButtonObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+};
+
+// ============================================================================
+
+class AxMorphControlObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxMorphControlObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ void dumpColumnInfos();
+
+private:
+ sal_uInt16 mnColInfoCount;
+ sal_uInt8 mnCtrlType;
+};
+
+// ============================================================================
+
+class AxLabelObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxLabelObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+};
+
+// ============================================================================
+
+class AxImageObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxImageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxScrollBarObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxScrollBarObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxSpinButtonObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxSpinButtonObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxTabStripObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxTabStripObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ sal_Int32 mnTabFlagCount;
+};
+
+// ============================================================================
+// ============================================================================
+
+class FormControlStreamObject : public OleInputObjectBase
+{
+public:
+ explicit FormControlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ const OUString* pProgId = 0 );
+ explicit FormControlStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString* pProgId = 0 );
+
+protected:
+ virtual void implDump();
+
+private:
+ void constructFormCtrlStrmObj( const OUString* pProgId );
+
+private:
+ OUString maProgId;
+ bool mbReadGuid;
+};
+
+// ============================================================================
+// ============================================================================
+
+struct VbaFormSiteInfo
+{
+ OUString maProgId;
+ sal_Int32 mnId;
+ sal_uInt32 mnLength;
+ bool mbInStream;
+
+ inline explicit VbaFormSiteInfo() : mnId( 0 ), mnLength( 0 ), mbInStream( false ) {}
+};
+
+typedef ::std::vector< VbaFormSiteInfo > VbaFormSiteInfoVector;
+
+// ============================================================================
+
+struct VbaFormSharedData
+{
+ OUStringVector maClassInfoProgIds;
+ VbaFormSiteInfoVector maSiteInfos;
+};
+
+// ============================================================================
+
+class VbaFormClassInfoObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormClassInfoObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaFormSiteObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormSiteObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaFormDesignExtObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormDesignExtObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class VbaFStreamObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ void dumpClassInfos();
+ void dumpFormSites( sal_uInt32 nCount );
+ void dumpSiteData();
+ void dumpDesignExtender();
+
+private:
+ VbaFormSharedData& mrFormData;
+ sal_uInt32 mnFlags;
+};
+
+// ============================================================================
+
+class VbaOStreamObject : public OleInputObjectBase
+{
+public:
+ explicit VbaOStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDump();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaPageObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaPageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class VbaMultiPageObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaMultiPageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ sal_Int32 mnPageCount;
+};
+
+// ============================================================================
+
+class VbaXStreamObject : public InputObjectBase
+{
+public:
+ explicit VbaXStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDump();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaContainerStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaContainerStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+private:
+ bool isFormStorage( const OUString& rStrgPath ) const;
+
+private:
+ VbaFormSharedData maFormData;
+};
+
+// ============================================================================
+// ============================================================================
+
+struct VbaSharedData
+{
+ typedef ::std::map< OUString, sal_Int32 > StreamOffsetMap;
+
+ StreamOffsetMap maStrmOffsets;
+ rtl_TextEncoding meTextEnc;
+
+ explicit VbaSharedData();
+
+ bool isModuleStream( const OUString& rStrmName ) const;
+ sal_Int32 getStreamOffset( const OUString& rStrmName ) const;
+};
+
+// ============================================================================
+
+class VbaDirStreamObject : public SequenceRecordObjectBase
+{
+public:
+ explicit VbaDirStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual bool implIsValid() const;
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+ virtual void implDumpRecordBody();
+
+private:
+ OUString dumpByteString( const String& rName = EMPTY_STRING );
+ OUString dumpUniString( const String& rName = EMPTY_STRING );
+
+ OUString dumpByteStringWithLength( const String& rName = EMPTY_STRING );
+
+private:
+ VbaSharedData& mrVbaData;
+ BinaryInputStreamRef mxInStrm;
+ OUString maCurrStream;
+ sal_Int32 mnCurrOffset;
+};
+
+// ============================================================================
+
+class VbaModuleStreamObject : public InputObjectBase
+{
+public:
+ explicit VbaModuleStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaSharedData& rVbaData,
+ sal_Int32 nStrmOffset );
+
+protected:
+ virtual void implDump();
+
+private:
+ VbaSharedData& mrVbaData;
+ sal_Int32 mnStrmOffset;
+};
+
+// ============================================================================
+
+class VbaStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+private:
+ VbaSharedData& mrVbaData;
+};
+
+// ============================================================================
+
+class VbaFormStorageObject : public VbaContainerStorageObject
+{
+public:
+ explicit VbaFormStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+private:
+ VbaSharedData& mrVbaData;
+};
+
+// ============================================================================
+
+class VbaProjectStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+private:
+ VbaSharedData maVbaData;
+};
+
+// ============================================================================
+// ============================================================================
+
+class ActiveXStorageObject : public VbaContainerStorageObject
+{
+public:
+ explicit ActiveXStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath );
+
+protected:
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/pptxdumper.hxx b/include/oox/dump/pptxdumper.hxx
new file mode 100644
index 000000000000..43f39002059b
--- /dev/null
+++ b/include/oox/dump/pptxdumper.hxx
@@ -0,0 +1,71 @@
+/* -*- 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 OOX_DUMP_PPTXDUMPER_HXX
+#define OOX_DUMP_PPTXDUMPER_HXX
+
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+namespace pptx {
+
+// ============================================================================
+
+class RootStorageObject : public StorageObjectBase
+{
+public:
+ explicit RootStorageObject( const DumperBase& rParent );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class Dumper : public DumperBase
+{
+public:
+ explicit Dumper( const ::oox::core::FilterBase& rFilter );
+
+ explicit Dumper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+
+} // namespace pptx
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/xlsbdumper.hxx b/include/oox/dump/xlsbdumper.hxx
new file mode 100644
index 000000000000..ffd24d4de808
--- /dev/null
+++ b/include/oox/dump/xlsbdumper.hxx
@@ -0,0 +1,136 @@
+/* -*- 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 OOX_DUMP_XLSBDUMPER_HXX
+#define OOX_DUMP_XLSBDUMPER_HXX
+
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox { namespace xls {
+ class FontPortionModelList;
+ class PhoneticPortionModelList;
+ struct FunctionInfo;
+ class FunctionProvider;
+} }
+
+namespace oox {
+namespace dump {
+namespace xlsb {
+
+// ============================================================================
+
+class RecordObjectBase : public SequenceRecordObjectBase
+{
+protected:
+ explicit RecordObjectBase();
+ virtual ~RecordObjectBase();
+
+ using SequenceRecordObjectBase::construct;
+ void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+ void construct( const RecordObjectBase& rParent );
+
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+
+ OUString getErrorName( sal_uInt8 nErrCode ) const;
+
+ // ------------------------------------------------------------------------
+
+ void readAddress( Address& orAddress );
+ void readRange( Range& orRange );
+ void readRangeList( RangeList& orRanges );
+
+ // ------------------------------------------------------------------------
+
+ void writeBooleanItem( const String& rName, sal_uInt8 nBool );
+ void writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode );
+
+ void writeFontPortions( const ::oox::xls::FontPortionModelList& rPortions );
+ void writePhoneticPortions( const ::oox::xls::PhoneticPortionModelList& rPhonetics );
+
+ // ------------------------------------------------------------------------
+
+ sal_uInt8 dumpBoolean( const String& rName = EMPTY_STRING );
+ sal_uInt8 dumpErrorCode( const String& rName = EMPTY_STRING );
+ OUString dumpString( const String& rName = EMPTY_STRING, bool bRich = false, bool b32BitLen = true );
+ void dumpColor( const String& rName = EMPTY_STRING );
+ ::com::sun::star::util::DateTime dumpPivotDateTime( const String& rName = EMPTY_STRING );
+
+ sal_Int32 dumpColIndex( const String& rName = EMPTY_STRING );
+ sal_Int32 dumpRowIndex( const String& rName = EMPTY_STRING );
+ sal_Int32 dumpColRange( const String& rName = EMPTY_STRING );
+ sal_Int32 dumpRowRange( const String& rName = EMPTY_STRING );
+
+ Address dumpAddress( const String& rName = EMPTY_STRING );
+ Range dumpRange( const String& rName = EMPTY_STRING );
+ void dumpRangeList( const String& rName = EMPTY_STRING );
+
+ // ------------------------------------------------------------------------
+private:
+ bool readCompressedInt( BinaryInputStream& rStrm, sal_Int32& ornValue );
+
+private:
+ typedef ::boost::shared_ptr< SequenceInputStream > SequenceInputStreamRef;
+
+ SequenceInputStreamRef mxBiffStrm;
+ NameListRef mxErrCodes;
+};
+
+// ============================================================================
+
+class RootStorageObject : public StorageObjectBase
+{
+public:
+ explicit RootStorageObject( const DumperBase& rParent );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class Dumper : public DumperBase
+{
+public:
+ explicit Dumper( const ::oox::core::FilterBase& rFilter );
+
+ explicit Dumper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+
+} // namespace xlsb
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
new file mode 100644
index 000000000000..10fc8922dc4a
--- /dev/null
+++ b/include/oox/export/chartexport.hxx
@@ -0,0 +1,204 @@
+/* -*- 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 _OOX_EXPORT_CHART_HXX_
+#define _OOX_EXPORT_CHART_HXX_
+
+#include <oox/dllapi.h>
+#include <com/sun/star/uno/XReference.hpp>
+#include <oox/export/drawingml.hxx>
+#include <oox/token/tokens.hxx>
+#include <sax/fshelper.hxx>
+#include <vcl/mapmod.hxx>
+#include <boost/unordered_map.hpp>
+#include <map>
+
+namespace com { namespace sun { namespace star {
+ namespace chart {
+ class XDiagram;
+ class XChartDocument;
+ class XChartDataArray;
+ struct ChartSeriesAddress;
+ }
+ namespace chart2 {
+ class XDiagram;
+ class XChartDocument;
+ class XDataSeries;
+ class XChartType;
+ namespace data
+ {
+ class XDataProvider;
+ class XDataSequence;
+ }
+ }
+ namespace drawing {
+ class XShape;
+ class XShapes;
+ }
+ namespace task {
+ class XStatusIndicator;
+ }
+ namespace frame {
+ class XModel;
+ }
+}}}
+
+namespace oox { namespace drawingml {
+
+const sal_Int32 AXIS_PRIMARY_X = 1;
+const sal_Int32 AXIS_PRIMARY_Y = 2;
+const sal_Int32 AXIS_PRIMARY_Z = 3;
+const sal_Int32 AXIS_SECONDARY_X = 4;
+const sal_Int32 AXIS_SECONDARY_Y = 5;
+
+struct AxisIdPair{
+ sal_Int32 nAxisType;
+ sal_Int32 nAxisId;
+ sal_Int32 nCrossAx;
+
+ AxisIdPair( sal_Int32 nType, sal_Int32 nId, sal_Int32 nAx ): nAxisType( nType ),nAxisId( nId ),nCrossAx( nAx ) {}
+};
+
+class OOX_DLLPUBLIC ChartExport : public DrawingML {
+
+public:
+ // first: data sequence for label, second: data sequence for values.
+ typedef ::std::vector< AxisIdPair > AxisVector;
+
+private:
+ sal_Int32 mnXmlNamespace;
+ Fraction maFraction;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel;
+ com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
+ com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram;
+
+ OUString msTableName;
+ OUStringBuffer msStringBuffer;
+ OUString msString;
+
+ // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
+ sal_Bool mbHasSeriesLabels;
+ sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
+ sal_Bool mbRowSourceColumns;
+ OUString msChartAddress;
+ OUString msTableNumberList;
+ ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
+
+ //::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > mxCategoriesValues;
+
+ AxisVector maAxes;
+ sal_Bool mbHasXAxis;
+ sal_Bool mbHasYAxis;
+ sal_Bool mbHasZAxis;
+ sal_Bool mbHasSecondaryXAxis;
+ sal_Bool mbHasSecondaryYAxis;
+ sal_Bool mbIs3DChart;
+
+
+private:
+ sal_Int32 getChartType(
+ );
+
+ OUString parseFormula( const OUString& rRange );
+ void InitPlotArea();
+
+ void _ExportContent();
+ void exportChartSpace( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc,
+ sal_Bool bIncludeTable );
+ void exportChart( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc );
+ void exportLegend( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc );
+ void exportTitle( com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > xShape );
+ void exportPlotArea( );
+
+ void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportBubbleChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportDoughnutChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportLineChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportOfPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportRadarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportScatterChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportStockChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportSuffaceChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+
+ void exportSeries( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType, sal_Int32& nAttachedAxis );
+ void exportCandleStickSeries(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
+ sal_Bool bJapaneseCandleSticks, sal_Int32& nAttachedAxis );
+ void exportSeriesText(
+ const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
+ void exportSeriesCategory(
+ const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
+ void exportSeriesValues(
+ const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
+ void exportShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
+ void exportDataPoints(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
+ sal_Int32 nSeriesLength );
+ void exportDataLabels(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
+ sal_Int32 nSeriesLength );
+ void exportGrouping( sal_Bool isBar = sal_False );
+ void exportMarker();
+ void exportSmooth();
+ void exportFirstSliceAng();
+
+ void exportAxes( );
+ void exportAxis( AxisIdPair aAxisIdPair );
+ void _exportAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxisTitle,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMajorGrid,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMinorGrid,
+ sal_Int32 nAxisType,
+ const char* sAxisPos,
+ AxisIdPair aAxisIdPair );
+ void exportAxesId( sal_Int32 nAttachedAxis );
+ void exportView3D();
+ sal_Bool isDeep3dChart();
+
+public:
+
+ ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+ virtual ~ChartExport() {}
+
+ sal_Int32 GetChartID( );
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel(){ return mxChartModel; }
+
+ virtual ChartExport& WriteChartObj( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_Int32 nChartCount );
+
+ void ExportContent();
+ void InitRangeSegmentationProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+};
+
+}}
+
+#endif /* ndef _OOX_EXPORT_CHART_HXX_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
new file mode 100644
index 000000000000..fa13a49ea090
--- /dev/null
+++ b/include/oox/export/drawingml.hxx
@@ -0,0 +1,160 @@
+/* -*- 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 _OOX_EXPORT_DRAWINGML_HXX_
+#define _OOX_EXPORT_DRAWINGML_HXX_
+
+#include <oox/dllapi.h>
+#include <sax/fshelper.hxx>
+#include <rtl/strbuf.hxx>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/uno/XReference.hpp>
+#include <tools/poly.hxx>
+#include <filter/msfilter/escherex.hxx>
+#ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY
+#define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000)
+#endif
+
+class Graphic;
+class String;
+
+namespace com { namespace sun { namespace star {
+namespace beans {
+ class XPropertySet;
+ class XPropertyState;
+}
+namespace drawing {
+ class XShape;
+}
+namespace style {
+ struct LineSpacing;
+}
+namespace text {
+ class XTextContent;
+ class XTextRange;
+}
+namespace io {
+ class XOutputStream;
+}
+}}}
+
+namespace oox {
+namespace core {
+ class XmlFilterBase;
+}
+
+namespace drawingml {
+
+class OOX_DLLPUBLIC DrawingML {
+public:
+ enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
+
+private:
+ static int mnImageCounter;
+
+ /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
+ DocumentType meDocumentType;
+
+protected:
+ ::com::sun::star::uno::Any mAny;
+ ::sax_fastparser::FSHelperPtr mpFS;
+ ::oox::core::XmlFilterBase* mpFB;
+
+ bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString aName );
+ bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > rXPropState,
+ String aName, ::com::sun::star::beans::PropertyState& eState );
+ const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, sal_Bool& bIsField );
+
+ OUString WriteImage( const OUString& rURL );
+
+ const char* GetComponentDir();
+ const char* GetRelationCompPrefix();
+
+public:
+ DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : meDocumentType( eDocumentType ), mpFS( pFS ), mpFB( pFB ) {}
+ void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
+ ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
+ ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
+ DocumentType GetDocumentType() { return meDocumentType; }
+
+ OUString WriteImage( const Graphic &rGraphic );
+
+ void WriteColor( sal_uInt32 nColor );
+ void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor );
+ void WriteLineArrow( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, sal_Bool bLineStart );
+ void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID );
+
+ void WriteSolidFill( sal_uInt32 nColor );
+ void WriteSolidFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+ void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+ void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName, sal_Int32 nXmlNamespace );
+ void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName );
+ void WriteSrcRect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, const OUString& );
+ void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+ void WriteStretch();
+ void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
+
+ OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString& rURL, const Graphic *pGraphic=NULL );
+ void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+
+ void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
+ sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Bool bSuppressRotation = false );
+ void WriteTransformation( const Rectangle& rRectangle,
+ sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 );
+
+ void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface );
+ void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
+ void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
+ void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+ sal_Int16 nLevel );
+ void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
+ void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rRun, sal_Bool bIsField );
+
+ void WritePresetShape( const char* pShape );
+ void WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
+ void WritePolyPolygon( const PolyPolygon& rPolyPolygon );
+ void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
+
+ static void ResetCounters();
+
+ void GetUUID( OStringBuffer& rBuffer );
+
+ static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc );
+
+ sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
+
+ static const char* GetAlignment( sal_Int32 nAlignment );
+
+ sax_fastparser::FSHelperPtr CreateOutputStream (
+ const OUString& sFullStream,
+ const OUString& sRelativeStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation,
+ const char* sContentType,
+ const char* sRelationshipType,
+ OUString* pRelationshipId = NULL );
+
+};
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
new file mode 100644
index 000000000000..39b4c0d9ec72
--- /dev/null
+++ b/include/oox/export/shapes.hxx
@@ -0,0 +1,170 @@
+/* -*- 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 _OOX_EXPORT_SHAPES_HXX_
+#define _OOX_EXPORT_SHAPES_HXX_
+
+#include <oox/dllapi.h>
+#include <com/sun/star/uno/XReference.hpp>
+#include <oox/export/drawingml.hxx>
+#include <sax/fshelper.hxx>
+#include <vcl/mapmod.hxx>
+#include <boost/unordered_map.hpp>
+
+namespace com { namespace sun { namespace star {
+namespace beans {
+ class XPropertySet;
+}
+namespace drawing {
+ class XShape;
+ class XShapes;
+}
+}}}
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ShapeExport : public DrawingML {
+
+private:
+ static int mnSpreadsheetCounter;
+ struct ShapeCheck
+ {
+ bool operator()( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s1, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s2 ) const
+ {
+ return s1 == s2;
+ }
+ };
+
+ struct ShapeHash
+ {
+ size_t operator()( const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > ) const;
+ };
+
+public:
+ typedef boost::unordered_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap;
+
+protected:
+ sal_Int32 mnShapeIdMax, mnPictureIdMax;
+
+ void WriteGraphicObjectShapePart( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, const Graphic *pGraphic=NULL );
+
+private:
+ sal_Int32 mnXmlNamespace;
+ Fraction maFraction;
+ MapMode maMapModeSrc, maMapModeDest;
+
+ ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
+
+ ShapeHashMap maShapeMap;
+ ShapeHashMap* mpShapeMap;
+
+public:
+
+ ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ShapeHashMap* pShapeMap = NULL, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+ virtual ~ShapeExport() {}
+
+ static sal_Bool NonEmptyText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface );
+
+ virtual ShapeExport&
+ WriteBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, sal_Bool bClosed );
+ virtual ShapeExport&
+ WriteClosedBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteConnectorShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteCustomShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteEllipseShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteGraphicObjectShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteLineShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteNonVisualDrawingProperties( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, const char* sName );
+ virtual ShapeExport&
+ WriteNonVisualProperties( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteOpenBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteRectangleShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+
+ /**
+ * Write the DrawingML for a particular shape.
+ *
+ * <p>This is the member function you want. It performs the type lookup and
+ * invokes the appropriate corresponding Write*() method for the specific
+ * type.</p>
+ *
+ * <p>To write an XShape, XShape::getShapeType() is called to determine
+ * the shape type, and the corresponding method in this table is
+ * invoked:</p>
+ *
+ * <table>
+ * <tr><th>Shape Type</th><th>Method</th></tr>
+ * <tr><td><tt>com.sun.star.drawing.ClosedBezierShape</tt></td> <td>ShapeExport::WriteClosedBezierShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.CustomShape</tt></td> <td>ShapeExport::WriteCustomShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.EllipseShape</tt></td> <td>ShapeExport::WriteEllipseShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.GraphicObjectShape</tt></td> <td>ShapeExport::WriteGraphicObjectShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.LineShape</tt></td> <td>ShapeExport::WriteLineShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.OpenBezierShape</tt></td> <td>ShapeExport::WriteOpenBezierShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.RectangleShape</tt></td> <td>ShapeExport::WriteRectangleShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.TableShape</tt></td> <td>ShapeExport::WriteTableShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.TextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.DateTimeShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.FooterShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.HeaderShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.NotesShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.OutlinerShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.SlideNumberShape</tt></td><td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.TitleTextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * </table>
+ *
+ * <p>If the shape type is not recognized, then
+ * <tt>ShapeExport::WriteUnknownShape</tt> is called.</p>
+ *
+ * @param xShape The shape to export as DrawingML.
+ * @return <tt>*this</tt>
+ */
+ virtual ShapeExport&
+ WriteShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteTextBox( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface, sal_Int32 nXmlNamespace );
+ virtual ShapeExport&
+ WriteTextShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteTableShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteOLE2Shape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteUnknownShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+
+ void WriteTable( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape );
+
+
+ sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+ sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB );
+ sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+ static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ShapeHashMap* pShapeMap );
+};
+
+}}
+
+#endif /* ndef _OOX_EXPORT_SHAPES_HXX_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx
new file mode 100644
index 000000000000..04c3b3375742
--- /dev/null
+++ b/include/oox/export/utils.hxx
@@ -0,0 +1,59 @@
+/* -*- 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 _OOX_EXPORT_UTILS_HXX_
+#define _OOX_EXPORT_UTILS_HXX_
+
+#define I32S(x) OString::valueOf( (sal_Int32) x ).getStr()
+#define I64S(x) OString::valueOf( (sal_Int64) x ).getStr()
+#define IS(x) OString::valueOf( x ).getStr()
+#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr()
+
+#ifndef DBG
+# if OSL_DEBUG_LEVEL > 0
+# define DBG(x) x
+# else
+# define DBG(x)
+# endif
+#endif
+
+// ---------------------------------------------------------------------------------------------
+
+static inline sal_Int64 PPTtoEMU( sal_Int32 nPPT )
+{
+ return (sal_Int64)( (double)nPPT * 1587.5 );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+static inline sal_Int64 MM100toEMU( sal_Int32 nMM100 )
+{
+ return (sal_Int64)nMM100 * 360;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+static inline sal_Int64 TwipsToEMU( sal_Int32 nTwips )
+{
+ return sal_Int64( nTwips ) * 635;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
new file mode 100644
index 000000000000..54212a65bccf
--- /dev/null
+++ b/include/oox/export/vmlexport.hxx
@@ -0,0 +1,132 @@
+/* -*- 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 _OOX_EXPORT_VMLEXPORT_HXX_
+#define _OOX_EXPORT_VMLEXPORT_HXX_
+
+#include <oox/dllapi.h>
+#include <oox/export/drawingml.hxx>
+#include <sax/fshelper.hxx>
+#include <filter/msfilter/escherex.hxx>
+#include <editeng/outlobj.hxx>
+
+
+namespace oox {
+
+namespace vml {
+
+/// Interface to be implemented by the parent exporter that knows how to handle shape text.
+class OOX_DLLPUBLIC VMLTextExport
+{
+public:
+ virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
+ virtual oox::drawingml::DrawingML& GetDrawingML() = 0;
+protected:
+ VMLTextExport() {}
+ virtual ~VMLTextExport() {}
+};
+
+class OOX_DLLPUBLIC VMLExport : public EscherEx
+{
+ /// Fast serializer to output the data
+ ::sax_fastparser::FSHelperPtr m_pSerializer;
+
+ /// Parent exporter, used for text callback.
+ VMLTextExport* m_pTextExport;
+
+ /// The object we're exporting.
+ const SdrObject* m_pSdrObject;
+
+ /// Fill the shape attributes as they come.
+ ::sax_fastparser::FastAttributeList *m_pShapeAttrList;
+
+ /// Remember the shape type.
+ sal_uInt32 m_nShapeType;
+
+ /// Remember the shape flags.
+ sal_uInt32 m_nShapeFlags;
+
+ /// Remember style, the most important shape attribute ;-)
+ OStringBuffer *m_pShapeStyle;
+
+ /// Remember which shape types we had already written.
+ bool *m_pShapeTypeWritten;
+
+public:
+ VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport = 0 );
+ virtual ~VMLExport();
+
+ ::sax_fastparser::FSHelperPtr
+ GetFS() { return m_pSerializer; }
+
+ /// Export the sdr object as VML.
+ ///
+ /// Call this when you need to export the object as VML.
+ sal_uInt32 AddSdrObject( const SdrObject& rObj );
+
+protected:
+ /// Add an attribute to the generated <v:shape/> element.
+ ///
+ /// This should be called from within StartShape() to ensure that the
+ /// added attribute is preserved.
+ void AddShapeAttribute( sal_Int32 nAttribute, const OString& sValue );
+
+ using EscherEx::StartShape;
+ using EscherEx::EndShape;
+
+ /// Start the shape for which we just collected the information.
+ ///
+ /// Returns the element's tag number, -1 means we wrote nothing.
+ virtual sal_Int32 StartShape();
+
+ /// End the shape.
+ ///
+ /// The parameter is just what we got from StartShape().
+ virtual void EndShape( sal_Int32 nShapeElement );
+
+ virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
+
+private:
+
+ virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
+ virtual void CloseContainer();
+
+ virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 );
+ virtual void LeaveGroup();
+
+ virtual void AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 nShapeId = 0 );
+
+private:
+ /// Create an OString representing the id from a numerical id.
+ static OString ShapeIdString( sal_uInt32 nId );
+
+ /// Add starting and ending point of a line to the m_pShapeAttrList.
+ void AddLineDimensions( const Rectangle& rRectangle );
+
+ /// Add position and size to the OStringBuffer.
+ void AddRectangleDimensions( OStringBuffer& rBuffer, const Rectangle& rRectangle );
+};
+
+} // namespace vml
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx
new file mode 100644
index 000000000000..55f41cf0a3b3
--- /dev/null
+++ b/include/oox/helper/attributelist.hxx
@@ -0,0 +1,170 @@
+/* -*- 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 OOX_HELPER_ATTRIBUTELIST_HXX
+#define OOX_HELPER_ATTRIBUTELIST_HXX
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+
+// ============================================================================
+
+/** Static helpers for conversion of strings to attribute values of various
+ different data types.
+ */
+class OOX_DLLPUBLIC AttributeConversion
+{
+public:
+ /** Returns the XML token identifier from the passed string. */
+ static sal_Int32 decodeToken( const OUString& rValue );
+
+ /** Returns the decoded string value. All characters in the format
+ '_xHHHH_' (H being a hexadecimal digit), will be decoded. */
+ static OUString decodeXString( const OUString& rValue );
+
+ /** Returns the double value from the passed string. */
+ static double decodeDouble( const OUString& rValue );
+
+ /** Returns the 32-bit signed integer value from the passed string (decimal). */
+ static sal_Int32 decodeInteger( const OUString& rValue );
+
+ /** Returns the 32-bit unsigned integer value from the passed string (decimal). */
+ static sal_uInt32 decodeUnsigned( const OUString& rValue );
+
+ /** Returns the 64-bit signed integer value from the passed string (decimal). */
+ static sal_Int64 decodeHyper( const OUString& rValue );
+
+ /** Returns the 32-bit signed integer value from the passed string (hexadecimal). */
+ static sal_Int32 decodeIntegerHex( const OUString& rValue );
+};
+
+// ============================================================================
+
+/** Provides access to attribute values of an element.
+
+ Wraps a com.sun.star.xml.sax.XFastAttributeList object. Provides
+ convenience functions that convert the string value of an attribute to
+ various other data types.
+ */
+class OOX_DLLPUBLIC AttributeList
+{
+public:
+ explicit AttributeList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Returns the wrapped com.sun.star.xml.sax.XFastAttributeList object. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >
+ getFastAttributeList() const { return mxAttribs; }
+
+ /** Returns true, if the specified attribute is present. */
+ bool hasAttribute( sal_Int32 nAttrToken ) const;
+
+ // optional return values -------------------------------------------------
+
+ /** Returns the token identifier of the value of the specified attribute. */
+ OptValue< sal_Int32 > getToken( sal_Int32 nAttrToken ) const;
+
+ /** Returns the string value of the specified attribute. */
+ OptValue< OUString > getString( sal_Int32 nAttrToken ) const;
+
+ /** Returns the string value of the specified attribute. All characters in
+ the format '_xHHHH_' (H being a hexadecimal digit), will be decoded. */
+ OptValue< OUString > getXString( sal_Int32 nAttrToken ) const;
+
+ /** Returns the double value of the specified attribute. */
+ OptValue< double > getDouble( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (decimal). */
+ OptValue< sal_Int32 > getInteger( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit unsigned integer value of the specified attribute (decimal). */
+ OptValue< sal_uInt32 > getUnsigned( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 64-bit signed integer value of the specified attribute (decimal). */
+ OptValue< sal_Int64 > getHyper( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (hexadecimal). */
+ OptValue< sal_Int32 > getIntegerHex( sal_Int32 nAttrToken ) const;
+
+ /** Returns the boolean value of the specified attribute. */
+ OptValue< bool > getBool( sal_Int32 nAttrToken ) const;
+
+ /** Returns the date/time value of the specified attribute. */
+ OptValue< ::com::sun::star::util::DateTime > getDateTime( sal_Int32 nAttrToken ) const;
+
+ // defaulted return values ------------------------------------------------
+
+ /** Returns the token identifier of the value of the specified attribute,
+ or the passed default identifier if the attribute is missing. */
+ sal_Int32 getToken( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the string value of the specified attribute, or the passed
+ default string if the attribute is missing. */
+ OUString getString( sal_Int32 nAttrToken, const OUString& rDefault ) const;
+
+ /** Returns the decoded string value of the specified attribute, or the
+ passed default string if the attribute is missing. */
+ OUString getXString( sal_Int32 nAttrToken, const OUString& rDefault ) const;
+
+ /** Returns the double value of the specified attribute, or the passed
+ default value if the attribute is missing or not convertible to a double. */
+ double getDouble( sal_Int32 nAttrToken, double fDefault ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to integer. */
+ sal_Int32 getInteger( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the 32-bit unsigned integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to unsigned. */
+ sal_uInt32 getUnsigned( sal_Int32 nAttrToken, sal_uInt32 nDefault ) const;
+
+ /** Returns the 64-bit signed integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to integer. */
+ sal_Int64 getHyper( sal_Int32 nAttrToken, sal_Int64 nDefault ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (hexadecimal),
+ or the passed default value if the attribute is missing or not convertible. */
+ sal_Int32 getIntegerHex( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the boolean value of the specified attribute, or the passed
+ default value if the attribute is missing or not convertible to bool. */
+ bool getBool( sal_Int32 nAttrToken, bool bDefault ) const;
+
+ /** Returns the date/time value of the specified attribute, or the default
+ value if the attribute is missing or not convertible to a date/time value. */
+ ::com::sun::star::util::DateTime getDateTime( sal_Int32 nAttrToken, const ::com::sun::star::util::DateTime& rDefault ) const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >
+ mxAttribs;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binaryinputstream.hxx b/include/oox/helper/binaryinputstream.hxx
new file mode 100644
index 000000000000..64d85357c2e8
--- /dev/null
+++ b/include/oox/helper/binaryinputstream.hxx
@@ -0,0 +1,438 @@
+/* -*- 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 OOX_HELPER_BINARYINPUTSTREAM_HXX
+#define OOX_HELPER_BINARYINPUTSTREAM_HXX
+
+#include <vector>
+#include <com/sun/star/io/XInputStream.hpp>
+#include "oox/helper/binarystreambase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+
+class BinaryOutputStream;
+
+// ============================================================================
+
+/** Interface for binary input stream classes.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC BinaryInputStream : public virtual BinaryStreamBase
+{
+public:
+ /** Derived classes implement reading nBytes bytes to the passed sequence.
+ The sequence will be reallocated internally.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement reading nBytes bytes to the (preallocated!)
+ memory buffer opMem.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement seeking the stream forward by the passed
+ number of bytes. This should work for non-seekable streams too.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Reads a value from the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ void readValue( Type& ornValue );
+
+ /** Reads a value from the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ inline Type readValue() { Type nValue; readValue( nValue ); return nValue; }
+
+ /** Stream operator for all data types supported by the readValue() function. */
+ template< typename Type >
+ inline BinaryInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+ inline sal_Int8 readInt8() { return readValue< sal_Int8 >(); }
+ inline sal_uInt8 readuInt8() { return readValue< sal_uInt8 >(); }
+ inline sal_Int16 readInt16() { return readValue< sal_Int16 >(); }
+ inline sal_uInt16 readuInt16() { return readValue< sal_uInt16 >(); }
+ inline sal_Int32 readInt32() { return readValue< sal_Int32 >(); }
+ inline sal_uInt32 readuInt32() { return readValue< sal_uInt32 >(); }
+ inline sal_Int64 readInt64() { return readValue< sal_Int64 >(); }
+ inline sal_uInt64 readuInt64() { return readValue< sal_uInt64 >(); }
+ inline float readFloat() { return readValue< float >(); }
+ inline double readDouble() { return readValue< double >(); }
+
+ /** Reads a (preallocated!) C array of values from the stream.
+
+ Converts all values in the array to platform byte order. All data types
+ supported by the ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of array elements to read (NOT byte count).
+
+ @return
+ Number of array elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( Type* opnArray, sal_Int32 nElemCount );
+
+ /** Reads a sequence of values from the stream.
+
+ The sequence will be reallocated internally. Converts all values in the
+ array to platform byte order. All data types supported by the
+ ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of elements to put into the sequence (NOT byte count).
+
+ @return
+ Number of sequence elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( ::com::sun::star::uno::Sequence< Type >& orSequence, sal_Int32 nElemCount );
+
+ /** Reads a vector of values from the stream.
+
+ The vector will be resized internally. Converts all values in the
+ vector to platform byte order. All data types supported by the
+ ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of elements to put into the vector (NOT byte count).
+
+ @return
+ Number of vector elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount );
+
+ /** Skips an array of values of a certain type in the stream.
+
+ All data types supported by the ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of array elements to skip (NOT byte count).
+ */
+ template< typename Type >
+ void skipArray( sal_Int32 nElemCount );
+
+ /** Reads a NUL-terminated Unicode character array and returns the string.
+ */
+ OUString readNulUnicodeArray();
+
+ /** Reads a byte character array and returns the string.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ OString readCharArray( sal_Int32 nChars, bool bAllowNulChars = false );
+
+ /** Reads a byte character array and returns a Unicode string.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.
+
+ @param eTextEnc
+ The text encoding used to create the Unicode string.
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ OUString readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc, bool bAllowNulChars = false );
+
+ /** Reads a Unicode character array and returns the string.
+
+ @param nChars
+ Number of 16-bit characters to read from the stream.
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ OUString readUnicodeArray( sal_Int32 nChars, bool bAllowNulChars = false );
+
+ /** Reads a Unicode character array (may be compressed) and returns the
+ string.
+
+ @param nChars
+ Number of 8-bit or 16-bit characters to read from the stream.
+
+ @param bCompressed
+ True = Character array is compressed (stored as 8-bit characters).
+ False = Character array is not compressed (stored as 16-bit characters).
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ OUString readCompressedUnicodeArray( sal_Int32 nChars, bool bCompressed, bool bAllowNulChars = false );
+
+ /** Copies nBytes bytes from the current position to the passed output stream.
+ */
+ void copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes = SAL_MAX_INT64, sal_Int32 nAtomSize = 1 );
+
+protected:
+ /** This dummy default c'tor will never call the c'tor of the virtual base
+ class BinaryStreamBase as this class cannot be instanciated directly. */
+ inline explicit BinaryInputStream() : BinaryStreamBase( false ) {}
+};
+
+typedef ::boost::shared_ptr< BinaryInputStream > BinaryInputStreamRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void BinaryInputStream::readValue( Type& ornValue )
+{
+ readMemory( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) );
+ ByteOrderConverter::convertLittleEndian( ornValue );
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( Type* opnArray, sal_Int32 nElemCount )
+{
+ sal_Int32 nRet = 0;
+ if( !mbEof )
+ {
+ sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ nRet = readMemory( opnArray, nReadSize, sizeof( Type ) ) / sizeof( Type );
+ ByteOrderConverter::convertLittleEndianArray( opnArray, static_cast< size_t >( nRet ) );
+ }
+ return nRet;
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( ::com::sun::star::uno::Sequence< Type >& orSequence, sal_Int32 nElemCount )
+{
+ orSequence.reallocate( nElemCount );
+ return orSequence.hasElements() ? readArray( orSequence.getArray(), nElemCount ) : 0;
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount )
+{
+ orVector.resize( static_cast< size_t >( nElemCount ) );
+ return orVector.empty() ? 0 : readArray( &orVector.front(), nElemCount );
+}
+
+template< typename Type >
+void BinaryInputStream::skipArray( sal_Int32 nElemCount )
+{
+ sal_Int32 nSkipSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ skip( nSkipSize, sizeof( Type ) );
+}
+
+// ============================================================================
+
+/** Wraps a UNO input stream and provides convenient access functions.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC BinaryXInputStream : public BinaryXSeekableStream, public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed input stream.
+
+ @param rxInStream
+ The com.sun.star.io.XInputStream interface of the UNO input stream
+ to be wrapped.
+
+ @param bAutoClose
+ True = automatically close the wrapped input stream on destruction
+ of this wrapper or when close() is called.
+ */
+ explicit BinaryXInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ bool bAutoClose );
+
+ virtual ~BinaryXInputStream();
+
+ /** Closes the input stream. Does also close the wrapped UNO input stream
+ if bAutoClose has been set to true in the constructor. */
+ virtual void close();
+
+ /** 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 );
+
+ /** 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 );
+
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the readValue() function. */
+ template< typename Type >
+ inline BinaryXInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+private:
+ StreamDataSequence maBuffer; ///< Data buffer used in readMemory() function.
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ mxInStrm; ///< Reference to the input stream.
+ bool mbAutoClose; ///< True = automatically close stream on destruction.
+};
+
+// ============================================================================
+
+/** Wraps a StreamDataSequence and provides convenient access functions.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC SequenceInputStream : public SequenceSeekableStream, public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed data sequence.
+
+ @attention
+ The passed data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long
+ as this stream wrapper is used to read from it.
+ */
+ explicit SequenceInputStream( const StreamDataSequence& rData );
+
+ /** 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 );
+
+ /** 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 );
+
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the readValue() function. */
+ template< typename Type >
+ inline SequenceInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+private:
+ /** Returns the number of bytes available in the sequence for the passed byte count. */
+ inline sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
+ { return getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mpData->getLength() - mnPos ); }
+};
+
+// ============================================================================
+
+/** Wraps a BinaryInputStream and provides access to a specific part of the
+ stream data.
+
+ Provides access to the stream data block starting at the current position
+ of the stream, and with a specific length. If the wrapped stream is
+ seekable, this wrapper will treat the position of the wrapped stream at
+ construction time as position "0" (therefore the class name).
+
+ The passed input stream MUST live at least as long as this stream wrapper.
+ The stream MUST NOT be changed from outside as long as this stream wrapper
+ is used to read from it.
+ */
+class RelativeInputStream : public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed stream.
+
+ @param nSize
+ If specified, restricts the amount of data that can be read from
+ the passed input stream.
+ */
+ explicit RelativeInputStream(
+ BinaryInputStream& rInStrm,
+ sal_Int64 nSize = SAL_MAX_INT64 );
+
+ /** Returns the size of the data block in the wrapped stream offered by
+ this wrapper. */
+ virtual sal_Int64 size() const;
+
+ /** Returns the current relative stream position. */
+ virtual sal_Int64 tell() const;
+
+ /** Seeks the stream to the passed relative position, if the wrapped stream
+ is seekable. */
+ virtual void seek( sal_Int64 nPos );
+
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
+ /** Reads nBytes bytes to the passed sequence. Does not read out of the
+ data block whose size has been specified on construction.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Reads nBytes bytes to the (existing) buffer opMem. Does not read out of
+ the data block whose size has been specified on construction.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. Does not seek out of the data block. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the readValue() function. */
+ template< typename Type >
+ inline RelativeInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+private:
+ /** Returns the number of bytes available in the sequence for the passed byte count. */
+ inline sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
+ { return getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnSize - mnRelPos ); }
+
+private:
+ BinaryInputStream* mpInStrm;
+ sal_Int64 mnStartPos;
+ sal_Int64 mnRelPos;
+ sal_Int64 mnSize;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binaryoutputstream.hxx b/include/oox/helper/binaryoutputstream.hxx
new file mode 100644
index 000000000000..0882821e9834
--- /dev/null
+++ b/include/oox/helper/binaryoutputstream.hxx
@@ -0,0 +1,189 @@
+/* -*- 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 OOX_HELPER_BINARYOUTPUTSTREAM_HXX
+#define OOX_HELPER_BINARYOUTPUTSTREAM_HXX
+
+#include "oox/helper/binarystreambase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XOutputStream; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** Interface for binary output stream classes.
+
+ The binary data in the stream is written in little-endian format.
+ */
+class BinaryOutputStream : public virtual BinaryStreamBase
+{
+public:
+ /** Derived classes implement writing the contents of the passed data
+ sequence.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement writing the contents of the (preallocated!)
+ memory buffer pMem.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Writes a value to the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ void writeValue( Type nValue );
+
+ template< typename Type >
+ void writeArray( Type* opnArray, sal_Int32 nElemCount );
+
+ /** Stream operator for all data types supported by the writeValue() function. */
+ template< typename Type >
+ inline BinaryOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
+
+ void writeCompressedUnicodeArray( const OUString& rString, bool bCompressed, bool bAllowNulChars = false );
+
+ void writeCharArrayUC( const OUString& rString, rtl_TextEncoding eTextEnc, bool bAllowNulChars = false );
+
+ void writeUnicodeArray( const OUString& rString, bool bAllowNulChars = false );
+
+protected:
+ /** This dummy default c'tor will never call the c'tor of the virtual base
+ class BinaryStreamBase as this class cannot be instanciated directly. */
+ inline explicit BinaryOutputStream() : BinaryStreamBase( false ) {}
+};
+
+template< typename Type >
+void BinaryOutputStream::writeArray( Type* opnArray, sal_Int32 nElemCount )
+{
+ sal_Int32 nWriteSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ ByteOrderConverter::convertLittleEndianArray( opnArray, static_cast< size_t >( nWriteSize ) );
+ writeMemory( opnArray, nWriteSize, sizeof( Type ) );
+}
+
+typedef ::boost::shared_ptr< BinaryOutputStream > BinaryOutputStreamRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void BinaryOutputStream::writeValue( Type nValue )
+{
+ ByteOrderConverter::convertLittleEndian( nValue );
+ writeMemory( &nValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) );
+}
+
+// ============================================================================
+
+/** Wraps a UNO output stream and provides convenient access functions.
+
+ The binary data in the stream is written in little-endian format.
+ */
+class BinaryXOutputStream : public BinaryXSeekableStream, public BinaryOutputStream
+{
+public:
+ /** Constructs the wrapper object for the passed output stream.
+
+ @param rxOutStream
+ The com.sun.star.io.XOutputStream interface of the output stream to
+ be wrapped.
+
+ @param bAutoClose
+ True = automatically close the wrapped output stream on destruction
+ of this wrapper or when close() is called.
+ */
+ explicit BinaryXOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
+ bool bAutoClose );
+
+ virtual ~BinaryXOutputStream();
+
+ /** Flushes and closes the output stream. Does also close the wrapped UNO
+ output stream if bAutoClose has been set to true in the constructor. */
+ void close();
+
+ /** Writes the passed data sequence. */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 );
+
+ /** Write nBytes bytes from the (preallocated!) buffer pMem. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the writeValue() function. */
+ template< typename Type >
+ inline BinaryXOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
+
+ /** Returns the XOutputStream interface of the wrapped output stream. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ getXOutputStream() const { return mxOutStrm; }
+
+private:
+ StreamDataSequence maBuffer; ///< Data buffer used in writeMemory() function.
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ mxOutStrm; ///< Reference to the output stream.
+ bool mbAutoClose; ///< True = automatically close stream on destruction.
+};
+
+// ============================================================================
+
+/** Wraps a StreamDataSequence and provides convenient access functions.
+
+ The binary data in the stream is written in little-endian format. After
+ construction, the stream points to the beginning of the passed data
+ sequence. The data sequence is expanded automatically while writing to it.
+ */
+class OOX_DLLPUBLIC SequenceOutputStream : public SequenceSeekableStream, public BinaryOutputStream
+{
+public:
+ /** Constructs the wrapper object for the passed data sequence.
+
+ @attention
+ The passed data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long
+ as this stream wrapper is used to write to it.
+ */
+ explicit SequenceOutputStream( StreamDataSequence& rData );
+
+ /** Writes the passed data sequence. */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 );
+
+ /** Write nBytes bytes from the (preallocated!) buffer pMem. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the writeValue() function. */
+ template< typename Type >
+ inline SequenceOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binarystreambase.hxx b/include/oox/helper/binarystreambase.hxx
new file mode 100644
index 000000000000..d9ab979de019
--- /dev/null
+++ b/include/oox/helper/binarystreambase.hxx
@@ -0,0 +1,187 @@
+/* -*- 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 OOX_HELPER_BINARYSTREAMBASE_HXX
+#define OOX_HELPER_BINARYSTREAMBASE_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XSeekable; }
+} } }
+
+namespace oox {
+
+typedef ::com::sun::star::uno::Sequence< sal_Int8 > StreamDataSequence;
+
+// ============================================================================
+
+/** Base class for binary stream classes.
+ */
+class OOX_DLLPUBLIC BinaryStreamBase
+{
+public:
+ virtual ~BinaryStreamBase();
+
+ /** Implementations return the size of the stream, if possible.
+
+ This function may be implemented for some types of unseekable streams,
+ and MUST be implemented for all seekable streams.
+
+ @return
+ The size of the stream in bytes, or -1, if not implemented.
+ */
+ virtual sal_Int64 size() const = 0;
+
+ /** Implementations return the current stream position, if possible.
+
+ This function may be implemented for some types of unseekable streams,
+ and MUST be implemented for all seekable streams.
+
+ @return
+ The current position in the stream, or -1, if not implemented.
+ */
+ virtual sal_Int64 tell() const = 0;
+
+ /** Implementations seek the stream to the passed position, if
+ the stream is seekable.
+ */
+ virtual void seek( sal_Int64 nPos ) = 0;
+
+ /** Implementations close the stream.
+ */
+ virtual void close() = 0;
+
+ /** Returns true, if the implementation supports the seek() operation.
+
+ Implementations may still implement size() and tell() even if the
+ stream is not seekable.
+ */
+ inline bool isSeekable() const { return mbSeekable; }
+
+ /** Returns true, if the stream position is invalid (EOF). This flag turns
+ true *after* the first attempt to seek/read beyond the stream end.
+ */
+ inline bool isEof() const { return mbEof; }
+
+ /** Returns the size of the remaining data available in the stream, if
+ stream supports size() and tell(), otherwise -1.
+ */
+ sal_Int64 getRemaining() const;
+
+ /** Seeks the stream to the beginning, if stream is seekable.
+ */
+ inline void seekToStart() { seek( 0 ); }
+
+ /** Seeks the stream to the end, if stream is seekable.
+ */
+ inline void seekToEnd() { seek( size() ); }
+
+ /** Seeks the stream forward to a position that is a multiple of the passed
+ block size, if stream is seekable.
+
+ @param nBlockSize
+ The size of the data blocks the streams needs to be aligned to.
+
+ @param nAnchorPos
+ Position in the stream the data blocks are aligned to.
+ */
+ void alignToBlock( sal_Int32 nBlockSize, sal_Int64 nAnchorPos = 0 );
+
+protected:
+ inline explicit BinaryStreamBase( bool bSeekable ) : mbEof( false ), mbSeekable( bSeekable ) {}
+
+private:
+ BinaryStreamBase( const BinaryStreamBase& );
+ BinaryStreamBase& operator=( const BinaryStreamBase& );
+
+protected:
+ bool mbEof; ///< End of stream flag.
+
+private:
+ const bool mbSeekable; ///< True = implementation supports seeking.
+};
+
+// ============================================================================
+
+/** Base class for binary input and output streams wrapping a UNO stream,
+ seekable via the com.sun.star.io.XSeekable interface.
+ */
+class OOX_DLLPUBLIC BinaryXSeekableStream : public virtual BinaryStreamBase
+{
+public:
+ virtual ~BinaryXSeekableStream();
+
+ /** Returns the size of the stream, if wrapped stream is seekable, otherwise -1. */
+ virtual sal_Int64 size() const;
+ /** Returns the current stream position, if wrapped stream is seekable, otherwise -1. */
+ virtual sal_Int64 tell() const;
+ /** Seeks the stream to the passed position, if wrapped stream is seekable. */
+ virtual void seek( sal_Int64 nPos );
+ /** Releases the reference to the UNO XSeekable interface. */
+ virtual void close();
+
+protected:
+ explicit BinaryXSeekableStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable >& rxSeekable );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable >
+ mxSeekable; ///< Stream seeking interface.
+};
+
+// ============================================================================
+
+/** Base class for binary input and output streams wrapping a
+ StreamDataSequence, which is always seekable.
+
+ The wrapped data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long as this
+ stream wrapper is used to modify it.
+ */
+class OOX_DLLPUBLIC SequenceSeekableStream : public virtual BinaryStreamBase
+{
+public:
+ /** Returns the size of the wrapped data sequence. */
+ virtual sal_Int64 size() const;
+ /** Returns the current stream position. */
+ virtual sal_Int64 tell() const;
+ /** Seeks the stream to the passed position. */
+ virtual void seek( sal_Int64 nPos );
+ /** Releases the reference to the data sequence. */
+ virtual void close();
+
+protected:
+ explicit SequenceSeekableStream( const StreamDataSequence& rData );
+
+protected:
+ const StreamDataSequence* mpData; ///< Wrapped data sequence.
+ sal_Int32 mnPos; ///< Current position in the sequence.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/containerhelper.hxx b/include/oox/helper/containerhelper.hxx
new file mode 100644
index 000000000000..f3b27f05b1e2
--- /dev/null
+++ b/include/oox/helper/containerhelper.hxx
@@ -0,0 +1,410 @@
+/* -*- 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 OOX_HELPER_CONTAINERHELPER_HXX
+#define OOX_HELPER_CONTAINERHELPER_HXX
+
+#include <map>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include "oox/dllapi.h"
+
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XIndexAccess; }
+ namespace container { class XIndexContainer; }
+ namespace container { class XNameAccess; }
+ namespace container { class XNameContainer; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** A range of signed 32-bit integer values. */
+struct ValueRange
+{
+ sal_Int32 mnFirst;
+ sal_Int32 mnLast;
+
+ inline explicit ValueRange( sal_Int32 nValue = 0 ) : mnFirst( nValue ), mnLast( nValue ) {}
+ inline explicit ValueRange( sal_Int32 nFirst, sal_Int32 nLast ) : mnFirst( nFirst ), mnLast( nLast ) {}
+
+ inline bool operator==( const ValueRange& rRange ) const { return (mnFirst == rRange.mnFirst) && (mnLast == rRange.mnLast); }
+ inline bool operator!=( const ValueRange& rRange ) const { return !(*this == rRange); }
+ inline bool contains( sal_Int32 nValue ) const { return (mnFirst <= nValue) && (nValue <= mnLast); }
+ inline bool contains( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnFirst) && (rRange.mnLast <= mnLast); }
+ inline bool intersects( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnLast) && (rRange.mnFirst <= mnLast); }
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ::std::vector< ValueRange > ValueRangeVector;
+
+// ----------------------------------------------------------------------------
+
+/** An ordered list of value ranges. The insertion operation will merge
+ consecutive value ranges.
+ */
+class OOX_DLLPUBLIC ValueRangeSet
+{
+public:
+ inline explicit ValueRangeSet() {}
+
+ /** Inserts the passed value into the range list. */
+ inline void insert( sal_Int32 nValue ) { insert( ValueRange( nValue ) ); }
+ /** Inserts the passed value range into the range list. */
+ void insert( const ValueRange& rRange );
+
+ /** Returns the ordered list of all value ranges. */
+ inline const ValueRangeVector& getRanges() const { return maRanges; }
+
+private:
+ ValueRangeVector maRanges;
+};
+
+// ============================================================================
+
+/** Template for a 2-dimensional array of objects.
+
+ This class template provides a similar interface to the ::std::vector
+ template.
+ */
+template< typename Type >
+class Matrix
+{
+public:
+ typedef ::std::vector< Type > container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::pointer pointer;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::size_type size_type;
+ typedef typename container_type::iterator iterator;
+ typedef typename container_type::const_iterator const_iterator;
+
+ inline explicit Matrix() : mnWidth( 0 ) {}
+ inline explicit Matrix( size_type nWidth, size_type nHeight ) { this->resize( nWidth, nHeight ); }
+ inline explicit Matrix( size_type nWidth, size_type nHeight, const_reference rData ) { this->resize( nWidth, nHeight, rData ); }
+
+ inline size_type capacity() const { return maData.capacity(); }
+ inline bool empty() const { return maData.empty(); }
+ inline size_type size() const { return maData.size(); }
+ inline size_type width() const { return mnWidth; }
+ inline size_type height() const { return this->empty() ? 0 : (this->size() / this->width()); }
+ inline bool has( size_type nX, size_type nY ) const { return (nX < this->width()) && (nY < this->height()); }
+
+ inline void reserve( size_type nWidth, size_type nHeight ) { maData.reserve( nWidth * nHeight ); }
+ inline void clear() { this->resize( 0, 0 ); }
+ inline void resize( size_type nWidth, size_type nHeight ) { mnWidth = nWidth; maData.resize( nWidth * nHeight ); }
+ inline void resize( size_type nWidth, size_type nHeight, const_reference rData ) { mnWidth = nWidth; maData.resize( nWidth * nHeight, rData ); }
+
+ inline iterator at( size_type nX, size_type nY ) { return maData.begin() + mnWidth * nY + nX; }
+ inline const_iterator at( size_type nX, size_type nY ) const { return maData.begin() + mnWidth * nY + nX; }
+
+ inline reference operator()( size_type nX, size_type nY ) { return *this->at( nX, nY ); }
+ inline const_reference operator()( size_type nX, size_type nY ) const { return *this->at( nX, nY ); }
+
+ inline iterator begin() { return maData.begin(); }
+ inline const_iterator begin() const { return maData.begin(); }
+ inline iterator end() { return maData.end(); }
+ inline const_iterator end() const { return maData.end(); }
+
+ inline reference front() { return maData.front(); }
+ inline const_reference front() const { return maData.front(); }
+ inline reference back() { return maData.back(); }
+ inline const_reference back() const { return maData.back(); }
+
+ inline iterator row_begin( size_type nY ) { return this->at( 0, nY ); }
+ inline const_iterator row_begin( size_type nY ) const { return this->at( 0, nY ); }
+ inline iterator row_end( size_type nY ) { return this->at( mnWidth, nY ); }
+ inline const_iterator row_end( size_type nY ) const { return this->at( mnWidth, nY ); }
+
+ inline reference row_front( size_type nY ) { return (*this)( 0, nY ); }
+ inline const_reference row_front( size_type nY ) const { return (*this)( 0, nY ); }
+ inline reference row_back( size_type nY ) { return (*this)( mnWidth - 1, nY ); }
+ inline const_reference row_back( size_type nY ) const { return (*this)( mnWidth - 1, nY ); }
+
+ inline void swap( Matrix& rMatrix ) { maData.swap( rMatrix.maData ); }
+
+private:
+ container_type maData;
+ size_type mnWidth;
+};
+
+// ============================================================================
+
+/** Static helper functions for improved API container handling. */
+class OOX_DLLPUBLIC ContainerHelper
+{
+public:
+
+ /** Returns a name that is not used in the passed name container.
+
+ @param rxNameAccess com.sun.star.container.XNameAccess interface of
+ the name container.
+
+ @param rSuggestedName Suggested name for the object.
+
+ @return An unused name. Will be equal to the suggested name, if not
+ contained, otherwise a numerical index will be appended.
+ */
+ static OUString getUnusedName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxNameAccess,
+ const OUString& rSuggestedName,
+ sal_Unicode cSeparator,
+ sal_Int32 nFirstIndexToAppend = 1 );
+
+ /** Inserts an object into a name container.
+
+ @param rxNameContainer com.sun.star.container.XNameContainer interface
+ of the name container.
+
+ @param rName Exact name for the object.
+
+ @param rObject The object to be inserted.
+
+ @return True = object successfully inserted.
+ */
+ static bool insertByName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxNameContainer,
+ const OUString& rName,
+ const ::com::sun::star::uno::Any& rObject,
+ bool bReplaceOldExisting = true );
+
+ /** Inserts an object into a name container.
+
+ The function will use an unused name to insert the object, based on the
+ suggested object name. It is possible to specify whether the existing
+ object or the new inserted object will be renamed, if the container
+ already has an object with the name suggested for the new object.
+
+ @param rxNameContainer com.sun.star.container.XNameContainer interface
+ of the name container.
+
+ @param rSuggestedName Suggested name for the object.
+
+ @param rObject The object to be inserted.
+
+ @param bRenameOldExisting Specifies behaviour if an object with the
+ suggested name already exists. If false (default), the new object
+ will be inserted with a name not yet extant in the container (this
+ is done by appending a numerical index to the suggested name). If
+ true, the existing object will be removed and inserted with an
+ unused name, and the new object will be inserted with the suggested
+ name.
+
+ @return The final name the object is inserted with. Will always be
+ equal to the suggested name, if parameter bRenameOldExisting is
+ true.
+ */
+ static OUString insertByUnusedName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxNameContainer,
+ const OUString& rSuggestedName,
+ sal_Unicode cSeparator,
+ const ::com::sun::star::uno::Any& rObject,
+ bool bRenameOldExisting = false );
+
+ // std::vector and std::map element access --------------------------------
+
+ /** Returns the pointer to an existing element of the passed vector, or a
+ null pointer, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static const typename VectorType::value_type*
+ getVectorElement( const VectorType& rVector, sal_Int32 nIndex );
+
+ /** Returns the pointer to an existing element of the passed vector, or a
+ null pointer, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static typename VectorType::value_type*
+ getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex );
+
+ /** Returns the reference to an existing element of the passed vector, or
+ the passed default value, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static const typename VectorType::value_type&
+ getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault );
+
+ /** Returns the reference to an existing element of the passed vector, or
+ the passed default value, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static typename VectorType::value_type&
+ getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault );
+
+ /** Returns the pointer to an existing element of the passed map, or a null
+ pointer, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static const typename MapType::mapped_type*
+ getMapElement( const MapType& rMap, const typename MapType::key_type& rKey );
+
+ /** Returns the pointer to an existing element of the passed map, or a null
+ pointer, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static typename MapType::mapped_type*
+ getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey );
+
+ /** Returns the reference to an existing element of the passed map, or the
+ passed default value, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static const typename MapType::mapped_type&
+ getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault );
+
+ /** Returns the reference to an existing element of the passed map, or the
+ passed default value, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static typename MapType::mapped_type&
+ getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault );
+
+ // vector/map/matrix to UNO sequence --------------------------------------
+
+ /** Creates a UNO sequence from a std::vector with copies of all elements.
+
+ @param rVector The vector to be converted to a sequence.
+
+ @return A com.sun.star.uno.Sequence object with copies of all objects
+ contained in the passed vector.
+ */
+ template< typename VectorType >
+ static ::com::sun::star::uno::Sequence< typename VectorType::value_type >
+ vectorToSequence( const VectorType& rVector );
+
+ /** Creates a UNO sequence from a std::map with copies of all elements.
+
+ @param rMap The map to be converted to a sequence.
+
+ @return A com.sun.star.uno.Sequence object with copies of all objects
+ contained in the passed map.
+ */
+ template< typename MapType >
+ static ::com::sun::star::uno::Sequence< typename MapType::mapped_type >
+ mapToSequence( const MapType& rMap );
+
+ /** Creates a UNO sequence of sequences from a matrix with copies of all elements.
+
+ @param rMatrix The matrix to be converted to a sequence of sequences.
+
+ @return A com.sun.star.uno.Sequence object containing
+ com.sun.star.uno.Sequence objects with copies of all objects
+ contained in the passed matrix.
+ */
+ template< typename MatrixType >
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > >
+ matrixToSequenceSequence( const MatrixType& rMatrix );
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename VectorType >
+/*static*/ const typename VectorType::value_type* ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
+}
+
+template< typename VectorType >
+/*static*/ typename VectorType::value_type* ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
+}
+
+template< typename VectorType >
+/*static*/ const typename VectorType::value_type& ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
+}
+
+template< typename VectorType >
+/*static*/ typename VectorType::value_type& ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
+}
+
+template< typename MapType >
+/*static*/ const typename MapType::mapped_type* ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey )
+{
+ typename MapType::const_iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? 0 : &aIt->second;
+}
+
+template< typename MapType >
+/*static*/ typename MapType::mapped_type* ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey )
+{
+ typename MapType::iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? 0 : &aIt->second;
+}
+
+template< typename MapType >
+/*static*/ const typename MapType::mapped_type& ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault )
+{
+ typename MapType::const_iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? rDefault : aIt->second;
+}
+
+template< typename MapType >
+/*static*/ typename MapType::mapped_type& ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault )
+{
+ typename MapType::iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? rDefault : aIt->second;
+}
+
+template< typename VectorType >
+/*static*/ ::com::sun::star::uno::Sequence< typename VectorType::value_type > ContainerHelper::vectorToSequence( const VectorType& rVector )
+{
+ typedef typename VectorType::value_type ValueType;
+ if( rVector.empty() )
+ return ::com::sun::star::uno::Sequence< ValueType >();
+ return ::com::sun::star::uno::Sequence< ValueType >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) );
+}
+
+template< typename MapType >
+/*static*/ ::com::sun::star::uno::Sequence< typename MapType::mapped_type > ContainerHelper::mapToSequence( const MapType& rMap )
+{
+ typedef typename MapType::mapped_type ValueType;
+ if( rMap.empty() )
+ return ::com::sun::star::uno::Sequence< ValueType >();
+ ::com::sun::star::uno::Sequence< ValueType > aSeq( static_cast< sal_Int32 >( rMap.size() ) );
+ sal_Int32 nIndex = 0;
+ for( typename MapType::const_iterator aIt = rMap.begin(), aEnd = rMap.end(); aIt != aEnd; ++aIt, ++nIndex )
+ aSeq[ nIndex ] = *aIt;
+ return aSeq;
+}
+
+template< typename MatrixType >
+/*static*/ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > > ContainerHelper::matrixToSequenceSequence( const MatrixType& rMatrix )
+{
+ typedef typename MatrixType::value_type ValueType;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ValueType > > aSeq;
+ if( !rMatrix.empty() )
+ {
+ aSeq.realloc( static_cast< sal_Int32 >( rMatrix.height() ) );
+ for( size_t nRow = 0, nHeight = rMatrix.height(); nRow < nHeight; ++nRow )
+ aSeq[ static_cast< sal_Int32 >( nRow ) ] =
+ ::com::sun::star::uno::Sequence< ValueType >( &rMatrix.row_front( nRow ), static_cast< sal_Int32 >( rMatrix.width() ) );
+ }
+ return aSeq;
+}
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
new file mode 100644
index 000000000000..0681716bc84f
--- /dev/null
+++ b/include/oox/helper/graphichelper.hxx
@@ -0,0 +1,168 @@
+/* -*- 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 OOX_HELPER_GRAPHICHELPER_HXX
+#define OOX_HELPER_GRAPHICHELPER_HXX
+
+#include <deque>
+#include <map>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/awt/DeviceInfo.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/storagebase.hxx"
+
+struct WMF_EXTERNALHEADER;
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Point; }
+ namespace awt { struct Size; }
+ namespace awt { class XUnitConversion; }
+ namespace io { class XInputStream; }
+ namespace frame { class XFrame; }
+ namespace graphic { class XGraphic; }
+ namespace graphic { class XGraphicObject; }
+ namespace graphic { class XGraphicProvider; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** Provides helper functions for colors, device measurement conversion,
+ graphics, and graphic objects handling.
+
+ All createGraphicObject() and importGraphicObject() functions create
+ persistent graphic objects internally and store them in an internal
+ container to prevent their early destruction. This makes it possible to use
+ the returned URL of the graphic object in any way (e.g. insert it into a
+ property map) without needing to store it immediately at an object that
+ resolves the graphic object from the passed URL and thus prevents it from
+ being destroyed.
+ */
+class OOX_DLLPUBLIC GraphicHelper
+{
+public:
+ explicit GraphicHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxTargetFrame,
+ const StorageRef& rxStorage );
+ virtual ~GraphicHelper();
+
+ // System colors and predefined colors ------------------------------------
+
+ /** Returns a system color specified by the passed XML token identifier. */
+ sal_Int32 getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb = API_RGB_TRANSPARENT ) const;
+ /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
+ virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+ /** Derived classes may implement to resolve a palette index to an RGB color. */
+ virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
+
+ // Device info and device dependent unit conversion -----------------------
+
+ /** Returns information about the output device. */
+ const ::com::sun::star::awt::DeviceInfo& getDeviceInfo() const;
+
+ /** Converts the passed value from horizontal screen pixels to 1/100 mm. */
+ sal_Int32 convertScreenPixelXToHmm( double fPixelX ) const;
+ /** Converts the passed value from vertical screen pixels to 1/100 mm. */
+ sal_Int32 convertScreenPixelYToHmm( double fPixelY ) const;
+ /** Converts the passed size from screen pixels to 1/100 mm. */
+ ::com::sun::star::awt::Size convertScreenPixelToHmm( const ::com::sun::star::awt::Size& rPixel ) const;
+
+ /** Converts the passed value from 1/100 mm to horizontal screen pixels. */
+ double convertHmmToScreenPixelX( sal_Int32 nHmmX ) const;
+ /** Converts the passed value from 1/100 mm to vertical screen pixels. */
+ double convertHmmToScreenPixelY( sal_Int32 nHmmY ) const;
+ /** Converts the passed point from 1/100 mm to screen pixels. */
+ ::com::sun::star::awt::Point convertHmmToScreenPixel( const ::com::sun::star::awt::Point& rHmm ) const;
+ /** Converts the passed size from 1/100 mm to screen pixels. */
+ ::com::sun::star::awt::Size convertHmmToScreenPixel( const ::com::sun::star::awt::Size& rHmm ) const;
+
+ /** Converts the passed point from 1/100 mm to AppFont units. */
+ ::com::sun::star::awt::Point convertHmmToAppFont( const ::com::sun::star::awt::Point& rHmm ) const;
+ /** Converts the passed size from 1/100 mm to AppFont units. */
+ ::com::sun::star::awt::Size convertHmmToAppFont( const ::com::sun::star::awt::Size& rHmm ) const;
+
+ // Graphics and graphic objects ------------------------------------------
+
+ /** Imports a graphic from the passed input stream. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ importGraphic(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const WMF_EXTERNALHEADER* pExtHeader = NULL ) const;
+
+ /** Imports a graphic from the passed binary memory block. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ importGraphic( const StreamDataSequence& rGraphicData ) const;
+
+ /** Imports a graphic from the storage stream with the passed path and name. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ importEmbeddedGraphic( const OUString& rStreamName ) const;
+
+ /** Creates a persistent graphic object from the passed graphic.
+ @return The URL of the created and internally cached graphic object. */
+ OUString createGraphicObject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) const;
+
+ /** Creates a persistent graphic object from the passed input stream.
+ @return The URL of the created and internally cached graphic object. */
+ OUString importGraphicObject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const WMF_EXTERNALHEADER* pExtHeader = NULL ) const;
+
+ /** Creates a persistent graphic object from the passed binary memory block.
+ @return The URL of the created and internally cached graphic object. */
+ OUString importGraphicObject( const StreamDataSequence& rGraphicData ) const;
+
+ /** Imports a graphic object from the storage stream with the passed path and name.
+ @return The URL of the created and internally cached graphic object. */
+ OUString importEmbeddedGraphicObject( const OUString& rStreamName ) const;
+
+ /** calculates the orignal size of a graphic which is necessary to be able to calculate cropping values
+ @return The original Graphic size in 100thmm */
+ ::com::sun::star::awt::Size getOriginalSize( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) const;
+
+ // ------------------------------------------------------------------------
+private:
+ typedef ::std::map< sal_Int32, sal_Int32 > SystemPalette;
+ typedef ::std::deque< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > > GraphicObjectDeque;
+ typedef ::std::map< OUString, ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > EmbeddedGraphicMap;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicProvider > mxGraphicProvider;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnitConversion > mxUnitConversion;
+ ::com::sun::star::awt::DeviceInfo maDeviceInfo; ///< Current output device info.
+ SystemPalette maSystemPalette; ///< Maps system colors (XML tokens) to RGB color values.
+ StorageRef mxStorage; ///< Storage containing embedded graphics.
+ mutable GraphicObjectDeque maGraphicObjects; ///< Caches all created graphic objects to keep them alive.
+ mutable EmbeddedGraphicMap maEmbeddedGraphics; ///< Maps all embedded graphics by their storage path.
+ const OUString maGraphicObjScheme; ///< The URL scheme name for graphic objects.
+ double mfPixelPerHmmX; ///< Number of screen pixels per 1/100 mm in X direction.
+ double mfPixelPerHmmY; ///< Number of screen pixels per 1/100 mm in Y direction.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
new file mode 100644
index 000000000000..4f8e738354d4
--- /dev/null
+++ b/include/oox/helper/helper.hxx
@@ -0,0 +1,334 @@
+/* -*- 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 OOX_HELPER_HELPER_HXX
+#define OOX_HELPER_HELPER_HXX
+
+#include <algorithm>
+#include <limits>
+#include <boost/static_assert.hpp>
+#include <osl/endian.h>
+#include <rtl/math.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <string.h>
+
+namespace oox {
+
+// Helper macros ==============================================================
+
+/** Expands to the number of elements in a STATIC data array. */
+#define STATIC_ARRAY_SIZE( array ) \
+ (sizeof(array)/sizeof(*(array)))
+
+/** Expands to a pointer behind the last element of a STATIC data array (like
+ STL end()). */
+#define STATIC_ARRAY_END( array ) \
+ ((array)+STATIC_ARRAY_SIZE(array))
+
+/** Expands to the 'index'-th element of a STATIC data array, or to 'def', if
+ 'index' is out of the array limits. */
+#define STATIC_ARRAY_SELECT( array, index, def ) \
+ ((static_cast<size_t>(index) < STATIC_ARRAY_SIZE(array)) ? ((array)[static_cast<size_t>(index)]) : (def))
+
+/** Expands to a temporary OString, created from a literal(!) character
+ array. */
+#define CREATE_OSTRING( ascii ) \
+ OString( RTL_CONSTASCII_STRINGPARAM( ascii ) )
+
+/** Convert an OUString to an ASCII C string. Use for debug purposes only. */
+#define OUSTRING_TO_CSTR( str ) \
+ OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr()
+
+// Common constants ===========================================================
+
+const sal_uInt8 WINDOWS_CHARSET_ANSI = 0;
+const sal_uInt8 WINDOWS_CHARSET_DEFAULT = 1;
+const sal_uInt8 WINDOWS_CHARSET_SYMBOL = 2;
+const sal_uInt8 WINDOWS_CHARSET_APPLE_ROMAN = 77;
+const sal_uInt8 WINDOWS_CHARSET_SHIFTJIS = 128;
+const sal_uInt8 WINDOWS_CHARSET_HANGEUL = 129;
+const sal_uInt8 WINDOWS_CHARSET_JOHAB = 130;
+const sal_uInt8 WINDOWS_CHARSET_GB2312 = 134;
+const sal_uInt8 WINDOWS_CHARSET_BIG5 = 136;
+const sal_uInt8 WINDOWS_CHARSET_GREEK = 161;
+const sal_uInt8 WINDOWS_CHARSET_TURKISH = 162;
+const sal_uInt8 WINDOWS_CHARSET_VIETNAMESE = 163;
+const sal_uInt8 WINDOWS_CHARSET_HEBREW = 177;
+const sal_uInt8 WINDOWS_CHARSET_ARABIC = 178;
+const sal_uInt8 WINDOWS_CHARSET_BALTIC = 186;
+const sal_uInt8 WINDOWS_CHARSET_RUSSIAN = 204;
+const sal_uInt8 WINDOWS_CHARSET_THAI = 222;
+const sal_uInt8 WINDOWS_CHARSET_EASTERN = 238;
+const sal_uInt8 WINDOWS_CHARSET_OEM = 255;
+
+// ----------------------------------------------------------------------------
+
+const sal_Int32 API_RGB_TRANSPARENT = -1; ///< Transparent color for API calls.
+const sal_Int32 API_RGB_BLACK = 0x000000; ///< Black color for API calls.
+const sal_Int32 API_RGB_GRAY = 0x808080; ///< Gray color for API calls.
+const sal_Int32 API_RGB_WHITE = 0xFFFFFF; ///< White color for API calls.
+
+const sal_Int16 API_LINE_SOLID = 0;
+const sal_Int16 API_LINE_DOTTED = 1;
+const sal_Int16 API_LINE_DASHED = 2;
+
+const sal_Int16 API_LINE_NONE = 0;
+const sal_Int16 API_LINE_HAIR = 2;
+const sal_Int16 API_LINE_THIN = 35;
+const sal_Int16 API_LINE_MEDIUM = 88;
+const sal_Int16 API_LINE_THICK = 141;
+
+const sal_Int16 API_ESCAPE_NONE = 0; ///< No escapement.
+const sal_Int16 API_ESCAPE_SUPERSCRIPT = 101; ///< Superscript: raise characters automatically (magic value 101).
+const sal_Int16 API_ESCAPE_SUBSCRIPT = -101; ///< Subscript: lower characters automatically (magic value -101).
+
+const sal_Int8 API_ESCAPEHEIGHT_NONE = 100; ///< Relative character height if not escaped.
+const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; ///< Relative character height if escaped.
+
+// ============================================================================
+
+// Limitate values ------------------------------------------------------------
+
+template< typename ReturnType, typename Type >
+inline ReturnType getLimitedValue( Type nValue, Type nMin, Type nMax )
+{
+ return static_cast< ReturnType >( ::std::min( ::std::max( nValue, nMin ), nMax ) );
+}
+
+template< typename ReturnType, typename Type >
+inline ReturnType getIntervalValue( Type nValue, Type nBegin, Type nEnd )
+{
+// this BOOST_STATIC_ASSERT fails with suncc
+// BOOST_STATIC_ASSERT( ::std::numeric_limits< Type >::is_integer );
+ Type nInterval = nEnd - nBegin;
+ Type nCount = (nValue < nBegin) ? -((nBegin - nValue - 1) / nInterval + 1) : ((nValue - nBegin) / nInterval);
+ return static_cast< ReturnType >( nValue - nCount * nInterval );
+}
+
+template< typename ReturnType >
+inline ReturnType getDoubleIntervalValue( double fValue, double fBegin, double fEnd )
+{
+ double fInterval = fEnd - fBegin;
+ double fCount = (fValue < fBegin) ? -(::rtl::math::approxFloor( (fBegin - fValue - 1.0) / fInterval ) + 1.0) : ::rtl::math::approxFloor( (fValue - fBegin) / fInterval );
+ return static_cast< ReturnType >( fValue - fCount * fInterval );
+}
+
+// Read from bitfields --------------------------------------------------------
+
+/** Returns true, if at least one of the bits set in nMask is set in nBitField. */
+template< typename Type >
+inline bool getFlag( Type nBitField, Type nMask )
+{
+ return (nBitField & nMask) != 0;
+}
+
+/** Returns nSet, if at least one bit of nMask is set in nBitField, otherwise nUnset. */
+template< typename ReturnType, typename Type >
+inline ReturnType getFlagValue( Type nBitField, Type nMask, ReturnType nSet, ReturnType nUnset )
+{
+ return getFlag( nBitField, nMask ) ? nSet : nUnset;
+}
+
+/** Extracts a value from a bit field.
+
+ Returns the data fragment from nBitField, that starts at bit nStartBit
+ (0-based, bit 0 is rightmost) with the width of nBitCount. The returned
+ value will be right-aligned (normalized).
+ For instance: extractValue<T>(0x4321,8,4) returns 3 (value in bits 8-11).
+ */
+template< typename ReturnType, typename Type >
+inline ReturnType extractValue( Type nBitField, sal_uInt8 nStartBit, sal_uInt8 nBitCount )
+{
+ sal_uInt64 nMask = 1; nMask <<= nBitCount; --nMask;
+ return static_cast< ReturnType >( nMask & (nBitField >> nStartBit) );
+}
+
+// Write to bitfields ---------------------------------------------------------
+
+/** Sets or clears (according to bSet) all set bits of nMask in ornBitField. */
+template< typename Type >
+inline void setFlag( Type& ornBitField, Type nMask, bool bSet = true )
+{
+ if( bSet ) ornBitField |= nMask; else ornBitField &= ~nMask;
+}
+
+/** Inserts a value into a bitfield.
+
+ Inserts the lower nBitCount bits of nValue into ornBitField, starting
+ there at bit nStartBit. Other contents of ornBitField keep unchanged.
+ */
+template< typename Type, typename InsertType >
+void insertValue( Type& ornBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount )
+{
+ sal_uInt64 nMask = 1; nMask <<= nBitCount; --nMask;
+ Type nNewValue = static_cast< Type >( nValue & nMask );
+ (ornBitField &= ~(nMask << nStartBit)) |= (nNewValue << nStartBit);
+}
+
+// ============================================================================
+
+/** Optional value, similar to ::boost::optional<>, with convenience accessors.
+ */
+template< typename Type >
+class OptValue
+{
+public:
+ inline explicit OptValue() : maValue(), mbHasValue( false ) {}
+ inline explicit OptValue( const Type& rValue ) : maValue( rValue ), mbHasValue( true ) {}
+ inline explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( rValue ), mbHasValue( bHasValue ) {}
+
+ inline bool has() const { return mbHasValue; }
+ inline bool operator!() const { return !mbHasValue; }
+ inline bool differsFrom( const Type& rValue ) const { return mbHasValue && (maValue != rValue); }
+
+ inline const Type& get() const { return maValue; }
+ inline const Type& get( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; }
+
+ inline void reset() { mbHasValue = false; }
+ inline void set( const Type& rValue ) { maValue = rValue; mbHasValue = true; }
+ inline Type& use() { mbHasValue = true; return maValue; }
+
+ inline OptValue& operator=( const Type& rValue ) { set( rValue ); return *this; }
+ inline bool operator==( const OptValue& rValue ) const {
+ return ( ( mbHasValue == false && rValue.mbHasValue == false ) ||
+ ( mbHasValue == rValue.mbHasValue && maValue == rValue.maValue ) );
+ }
+ inline void assignIfUsed( const OptValue& rValue ) { if( rValue.mbHasValue ) set( rValue.maValue ); }
+
+private:
+ Type maValue;
+ bool mbHasValue;
+};
+
+// ============================================================================
+
+/** Provides platform independent functions to convert from or to little-endian
+ byte order, e.g. for reading data from or writing data to memory or a
+ binary stream.
+
+ On big-endian platforms, the byte order in the passed values is swapped,
+ this can be used for converting big-endian to and from little-endian data.
+
+ On little-endian platforms, the conversion functions are implemented empty,
+ thus compilers should completely optimize away the function call.
+ */
+class ByteOrderConverter
+{
+public:
+#ifdef OSL_BIGENDIAN
+ inline static void convertLittleEndian( sal_Int8& ) {} // present for usage in templates
+ inline static void convertLittleEndian( sal_uInt8& ) {} // present for usage in templates
+ inline static void convertLittleEndian( sal_Int16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_uInt16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_Int32& rnValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_uInt32& rnValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_Int64& rnValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_uInt64& rnValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( float& rfValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rfValue ) ); }
+ inline static void convertLittleEndian( double& rfValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rfValue ) ); }
+
+ template< typename Type >
+ inline static void convertLittleEndianArray( Type* pnArray, size_t nElemCount );
+
+ inline static void convertLittleEndianArray( sal_Int8*, size_t ) {}
+ inline static void convertLittleEndianArray( sal_uInt8*, size_t ) {}
+
+#else
+ template< typename Type >
+ inline static void convertLittleEndian( Type& ) {}
+
+ template< typename Type >
+ inline static void convertLittleEndianArray( Type*, size_t ) {}
+
+#endif
+
+ /** Reads a value from memory, assuming memory buffer in little-endian.
+ @param ornValue (out-parameter) Contains the value read from memory.
+ @param pSrcBuffer The memory buffer to read the value from.
+ */
+ template< typename Type >
+ inline static void readLittleEndian( Type& ornValue, const void* pSrcBuffer );
+
+ /** Writes a value to memory, while converting it to little-endian.
+ @param pDstBuffer The memory buffer to write the value to.
+ @param nValue The value to be written to memory in little-endian.
+ */
+ template< typename Type >
+ inline static void writeLittleEndian( void* pDstBuffer, Type nValue );
+
+#ifdef OSL_BIGENDIAN
+private:
+ inline static void swap2( sal_uInt8* pnData );
+ inline static void swap4( sal_uInt8* pnData );
+ inline static void swap8( sal_uInt8* pnData );
+#endif
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+inline void ByteOrderConverter::readLittleEndian( Type& ornValue, const void* pSrcBuffer )
+{
+ memcpy( &ornValue, pSrcBuffer, sizeof( Type ) );
+ convertLittleEndian( ornValue );
+}
+
+template< typename Type >
+inline void ByteOrderConverter::writeLittleEndian( void* pDstBuffer, Type nValue )
+{
+ convertLittleEndian( nValue );
+ memcpy( pDstBuffer, &nValue, sizeof( Type ) );
+}
+
+#ifdef OSL_BIGENDIAN
+template< typename Type >
+inline void ByteOrderConverter::convertLittleEndianArray( Type* pnArray, size_t nElemCount )
+{
+ for( Type* pnArrayEnd = pnArray + nElemCount; pnArray != pnArrayEnd; ++pnArray )
+ convertLittleEndian( *pnArray );
+}
+
+inline void ByteOrderConverter::swap2( sal_uInt8* pnData )
+{
+ ::std::swap( pnData[ 0 ], pnData[ 1 ] );
+}
+
+inline void ByteOrderConverter::swap4( sal_uInt8* pnData )
+{
+ ::std::swap( pnData[ 0 ], pnData[ 3 ] );
+ ::std::swap( pnData[ 1 ], pnData[ 2 ] );
+}
+
+inline void ByteOrderConverter::swap8( sal_uInt8* pnData )
+{
+ ::std::swap( pnData[ 0 ], pnData[ 7 ] );
+ ::std::swap( pnData[ 1 ], pnData[ 6 ] );
+ ::std::swap( pnData[ 2 ], pnData[ 5 ] );
+ ::std::swap( pnData[ 3 ], pnData[ 4 ] );
+}
+#endif
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/modelobjecthelper.hxx b/include/oox/helper/modelobjecthelper.hxx
new file mode 100644
index 000000000000..253279a4c05a
--- /dev/null
+++ b/include/oox/helper/modelobjecthelper.hxx
@@ -0,0 +1,125 @@
+/* -*- 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 OOX_HELPER_MODELOBJECTHELPER_HXX
+#define OOX_HELPER_MODELOBJECTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Gradient; }
+ namespace container { class XNameContainer; }
+ namespace drawing { struct LineDash; }
+ namespace drawing { struct PolyPolygonBezierCoords; }
+ namespace lang { class XMultiServiceFactory; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** This helper manages named objects in a container, which is created on demand.
+ */
+class OOX_DLLPUBLIC ObjectContainer
+{
+public:
+ explicit ObjectContainer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory,
+ const OUString& rServiceName );
+ ~ObjectContainer();
+
+ /** Returns true, if the object with the passed name exists in the container. */
+ bool hasObject( const OUString& rObjName ) const;
+
+ /** Inserts the passed object into the container, returns its final name. */
+ OUString insertObject(
+ const OUString& rObjName,
+ const ::com::sun::star::uno::Any& rObj,
+ bool bInsertByUnusedName );
+
+private:
+ void createContainer() const;
+
+private:
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ mxModelFactory; ///< Factory to create the container.
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxContainer; ///< Container for the objects.
+ OUString maServiceName; ///< Service name to create the container.
+ sal_Int32 mnIndex; ///< Index to create unique identifiers.
+};
+
+// ============================================================================
+
+/** Contains tables for named drawing objects for a document model.
+
+ Contains tables for named line markers, line dashes, fill gradients, and
+ fill bitmap URLs. The class is needed to handle different document models
+ in the same filter (e.g. embedded charts) which carry their own drawing
+ object tables.
+ */
+class OOX_DLLPUBLIC ModelObjectHelper
+{
+public:
+ explicit ModelObjectHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory );
+
+ /** Returns true, if the model contains a line marker with the passed name. */
+ bool hasLineMarker( const OUString& rMarkerName ) const;
+
+ /** Inserts a new named line marker, overwrites an existing line marker
+ with the same name. Returns true, if the marker could be inserted. */
+ bool insertLineMarker(
+ const OUString& rMarkerName,
+ const ::com::sun::star::drawing::PolyPolygonBezierCoords& rMarker );
+
+ /** Inserts a new named line dash, returns the line dash name, based on an
+ internal constant name with a new unused index appended. */
+ OUString insertLineDash( const ::com::sun::star::drawing::LineDash& rDash );
+
+ /** Inserts a new named fill gradient, returns the gradient name, based on
+ an internal constant name with a new unused index appended. */
+ OUString insertFillGradient( const ::com::sun::star::awt::Gradient& rGradient );
+
+ OUString insertTransGrandient( const ::com::sun::star::awt::Gradient& rGradient );
+
+ /** Inserts a new named fill bitmap URL, returns the bitmap name, based on
+ an internal constant name with a new unused index appended. */
+ OUString insertFillBitmapUrl( const OUString& rGraphicUrl );
+
+private:
+ ObjectContainer maMarkerContainer; ///< Contains all named line markers (line end polygons).
+ ObjectContainer maDashContainer; ///< Contains all named line dsahes.
+ ObjectContainer maGradientContainer; ///< Contains all named fill gradients.
+ ObjectContainer maTransGradContainer; ///< Contains all named transparency Gradients.
+ ObjectContainer maBitmapUrlContainer; ///< Contains all named fill bitmap URLs.
+ const OUString maDashNameBase; ///< Base name for all named line dashes.
+ const OUString maGradientNameBase; ///< Base name for all named fill gradients.
+ const OUString maTransGradNameBase; ///< Base name for all named fill gradients.
+ const OUString maBitmapUrlNameBase; ///< Base name for all named fill bitmap URLs.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/progressbar.hxx b/include/oox/helper/progressbar.hxx
new file mode 100644
index 000000000000..ba0bdcfbb5c9
--- /dev/null
+++ b/include/oox/helper/progressbar.hxx
@@ -0,0 +1,138 @@
+/* -*- 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 OOX_HELPER_PROGRESSBAR_HXX
+#define OOX_HELPER_PROGRESSBAR_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include "oox/dllapi.h"
+
+
+namespace com { namespace sun { namespace star {
+ namespace task { class XStatusIndicator; }
+} } }
+
+namespace oox {
+
+// Interfaces =================================================================
+
+/** Interface for progress bar classes.
+ */
+class IProgressBar
+{
+public:
+ virtual ~IProgressBar();
+
+ /** Returns the current position of the progress bar.
+
+ @return Position of the progress bar, in the range from 0.0 (beginning
+ of the progress bar) to 1.0 (end of the progress bar) inclusive.
+ */
+ virtual double getPosition() const = 0;
+
+ /** Sets the current position of the progress bar.
+
+ @param fPosition New position of the progress bar, in the range from
+ 0.0 (beginning of the progress bar) to 1.0 (end of the progress bar)
+ inclusive.
+ */
+ virtual void setPosition( double fPosition ) = 0;
+};
+
+typedef ::boost::shared_ptr< IProgressBar > IProgressBarRef;
+
+// ----------------------------------------------------------------------------
+
+class ISegmentProgressBar;
+typedef ::boost::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef;
+
+/** Interface for a segment in a progress bar, that is able to create sub
+ segments from itself.
+ */
+class ISegmentProgressBar : public IProgressBar
+{
+public:
+ virtual ~ISegmentProgressBar();
+
+ /** Returns the length that is still free for creating sub segments. */
+ virtual double getFreeLength() const = 0;
+
+ /** Adds a new segment with the specified length. */
+ virtual ISegmentProgressBarRef createSegment( double fLength ) = 0;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** A simple progress bar.
+ */
+class OOX_DLLPUBLIC ProgressBar : public IProgressBar
+{
+public:
+ explicit ProgressBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& rxIndicator,
+ const OUString& rText );
+
+ virtual ~ProgressBar();
+
+ /** Returns the current position of the progress bar. */
+ virtual double getPosition() const;
+ /** Sets the current position of the progress bar. */
+ virtual void setPosition( double fPosition );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >
+ mxIndicator;
+ double mfPosition;
+};
+
+// ============================================================================
+
+/** A progress bar containing several independent segments.
+ */
+class OOX_DLLPUBLIC SegmentProgressBar : public ISegmentProgressBar
+{
+public:
+ explicit SegmentProgressBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& rxIndicator,
+ const OUString& rText );
+
+ /** Returns the current position of the progress bar segment. */
+ virtual double getPosition() const;
+ /** Sets the current position of the progress bar segment. */
+ virtual void setPosition( double fPosition );
+
+ /** Returns the length that is still free for creating sub segments. */
+ virtual double getFreeLength() const;
+ /** Adds a new segment with the specified length. */
+ virtual ISegmentProgressBarRef createSegment( double fLength );
+
+private:
+ ProgressBar maProgress;
+ double mfFreeStart;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/propertymap.hxx b/include/oox/helper/propertymap.hxx
new file mode 100644
index 000000000000..d03d891d93b5
--- /dev/null
+++ b/include/oox/helper/propertymap.hxx
@@ -0,0 +1,111 @@
+/* -*- 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 OOX_HELPER_PROPERTYMAP_HXX
+#define OOX_HELPER_PROPERTYMAP_HXX
+
+#include <vector>
+#include <map>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include "oox/token/properties.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct PropertyValue;
+ class XPropertySet;
+} } } }
+
+namespace oox {
+
+struct PropertyNameVector;
+
+// ============================================================================
+
+typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > PropertyMapBase;
+
+/** A helper that maps property identifiers to property values.
+
+ The property identifiers are generated on compile time and refer to the
+ property name strings that are held by a static vector. The identifier to
+ name mapping is done internally while the properties are written to
+ property sets.
+ */
+class OOX_DLLPUBLIC PropertyMap : public PropertyMapBase
+{
+public:
+ explicit PropertyMap();
+
+ /** Returns the name of the passed property identifier. */
+ static const OUString& getPropertyName( sal_Int32 nPropId );
+
+ /** Returns true, if the map contains a property with the passed identifier. */
+ inline bool hasProperty( sal_Int32 nPropId ) const
+ { return find( nPropId ) != end(); }
+
+ /** Sets the specified property to the passed value. Does nothing, if the
+ identifier is invalid. */
+ inline bool setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue )
+ { if( nPropId < 0 ) return false; (*this)[ nPropId ] = rValue; return true; }
+
+ /** Sets the specified property to the passed value. Does nothing, if the
+ identifier is invalid. */
+ template< typename Type >
+ inline bool setProperty( sal_Int32 nPropId, const Type& rValue )
+ { if( nPropId < 0 ) return false; (*this)[ nPropId ] <<= rValue; return true; }
+
+ /** Inserts all properties contained in the passed property map. */
+ inline void assignUsed( const PropertyMap& rPropMap )
+ { insert( rPropMap.begin(), rPropMap.end() ); }
+
+ /** Inserts all properties contained in the passed property map */
+ void assignAll( const PropertyMap& rPropMap );
+
+ /** Returns a sequence of property values, filled with all contained properties. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ makePropertyValueSequence() const;
+
+ /** Fills the passed sequences of names and anys with all contained properties. */
+ void fillSequences(
+ ::com::sun::star::uno::Sequence< OUString >& rNames,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) const;
+
+ /** Creates a property set supporting the XPropertySet interface and inserts all properties. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ makePropertySet() const;
+
+#if OSL_DEBUG_LEVEL > 0
+#ifdef DBG_UTIL
+ static void dump( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet);
+#endif
+ static void dumpCode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet);
+ void dumpCode();
+#endif
+private:
+ const PropertyNameVector* mpPropNames;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/propertyset.hxx b/include/oox/helper/propertyset.hxx
new file mode 100644
index 000000000000..2c97b29677fa
--- /dev/null
+++ b/include/oox/helper/propertyset.hxx
@@ -0,0 +1,146 @@
+/* -*- 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 OOX_HELPER_PROPERTYSET_HXX
+#define OOX_HELPER_PROPERTYSET_HXX
+
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include "oox/dllapi.h"
+
+namespace oox {
+
+class PropertyMap;
+
+// ============================================================================
+
+/** A wrapper for a UNO property set.
+
+ This class provides functions to silently get and set properties (without
+ exceptions, without the need to check validity of the UNO property set).
+
+ An instance is constructed with the reference to a UNO property set or any
+ other interface (the constructor will query for the
+ com.sun.star.beans.XPropertySet interface then). The reference to the
+ property set will be kept as long as the instance of this class is alive.
+
+ The functions setProperties() tries to handle all passed values at once,
+ using the com.sun.star.beans.XMultiPropertySet interface. If the
+ implementation does not support the XMultiPropertySet interface, all
+ properties are handled separately in a loop.
+ */
+class OOX_DLLPUBLIC PropertySet
+{
+public:
+ inline explicit PropertySet() {}
+
+ /** Constructs a property set wrapper with the passed UNO property set. */
+ inline explicit PropertySet(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxPropSet )
+ { set( rxPropSet ); }
+
+ /** Constructs a property set wrapper after querying the XPropertySet interface. */
+ template< typename Type >
+ inline explicit PropertySet( const Type& rObject ) { set( rObject ); }
+
+ /** Sets the passed UNO property set and releases the old UNO property set. */
+ void set( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxPropSet );
+
+ /** Queries the passed object (interface or any) for an XPropertySet and releases the old UNO property set. */
+ template< typename Type >
+ inline void set( const Type& rObject )
+ { set( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >( rObject, ::com::sun::star::uno::UNO_QUERY ) ); }
+
+ /** Returns true, if the contained XPropertySet interface is valid. */
+ inline bool is() const { return mxPropSet.is(); }
+
+ /** Returns the contained XPropertySet interface. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ getXPropertySet() const { return mxPropSet; }
+
+ /** Returns true, if the specified property is supported by the property set. */
+ bool hasProperty( sal_Int32 nPropId ) const;
+
+ // Get properties ---------------------------------------------------------
+
+ /** Gets the specified property from the property set.
+ @return the property value, or an empty Any, if the property is missing. */
+ ::com::sun::star::uno::Any getAnyProperty( sal_Int32 nPropId ) const;
+
+ /** Gets the specified property from the property set.
+ @return true, if the passed variable could be filled with the property value. */
+ template< typename Type >
+ inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const
+ { return getAnyProperty( nPropId ) >>= orValue; }
+
+ /** Gets the specified boolean property from the property set.
+ @return true = property contains true; false = property contains false or error occurred. */
+ inline bool getBoolProperty( sal_Int32 nPropId ) const
+ { bool bValue = false; return getProperty( bValue, nPropId ) && bValue; }
+ // Set properties ---------------------------------------------------------
+
+ /** Puts the passed any into the property set. */
+ bool setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+
+ /** Puts the passed value into the property set. */
+ template< typename Type >
+ inline bool setProperty( sal_Int32 nPropId, const Type& rValue )
+ { return setAnyProperty( nPropId, ::com::sun::star::uno::Any( rValue ) ); }
+
+ /** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface.
+ @param rPropNames The property names. MUST be ordered alphabetically.
+ @param rValues The related property values. */
+ void setProperties(
+ const ::com::sun::star::uno::Sequence< OUString >& rPropNames,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues );
+
+ /** Puts the passed property map into the property set. Tries to use the XMultiPropertySet interface.
+ @param rPropertyMap The property map. */
+ void setProperties( const PropertyMap& rPropertyMap );
+
+#ifdef DBG_UTIL
+ void dump();
+#endif
+
+ // ------------------------------------------------------------------------
+private:
+ /** Gets the specified property from the property set.
+ @return true, if the any could be filled with the property value. */
+ bool implGetPropertyValue( ::com::sun::star::uno::Any& orValue, const OUString& rPropName ) const;
+
+ /** Puts the passed any into the property set. */
+ bool implSetPropertyValue( const OUString& rPropName, const ::com::sun::star::uno::Any& rValue );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ mxPropSet; ///< The mandatory property set interface.
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet >
+ mxMultiPropSet; ///< The optional multi property set interface.
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ mxPropSetInfo; ///< Property information.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/refmap.hxx b/include/oox/helper/refmap.hxx
new file mode 100644
index 000000000000..c980039442b1
--- /dev/null
+++ b/include/oox/helper/refmap.hxx
@@ -0,0 +1,185 @@
+/* -*- 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 OOX_HELPER_REFMAP_HXX
+#define OOX_HELPER_REFMAP_HXX
+
+#include <map>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+
+namespace oox {
+
+// ============================================================================
+
+/** Template for a map of ref-counted objects with additional accessor functions.
+
+ An instance of the class RefMap< Type > stores elements of the type
+ ::boost::shared_ptr< Type >. The new accessor functions has() and get()
+ work correctly for nonexisting keys, there is no need to check the passed
+ key before.
+ */
+template< typename KeyType, typename ObjType, typename CompType = ::std::less< KeyType > >
+class RefMap : public ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType >
+{
+public:
+ typedef ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > container_type;
+ typedef typename container_type::key_type key_type;
+ typedef typename container_type::mapped_type mapped_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::key_compare key_compare;
+
+public:
+ /** Returns true, if the object associated to the passed key exists.
+ Returns false, if the key exists but points to an empty reference. */
+ inline bool has( key_type nKey ) const
+ {
+ const mapped_type* pxRef = getRef( nKey );
+ return pxRef && pxRef->get();
+ }
+
+ /** Returns a reference to the object associated to the passed key, or an
+ empty reference on error. */
+ inline mapped_type get( key_type nKey ) const
+ {
+ if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef;
+ return mapped_type();
+ }
+
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
+ template< typename FunctorType >
+ inline void forEach( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType >
+ inline void forEachMem( FuncType pFunc ) const
+ {
+ forEach( ::boost::bind( pFunc, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMem( FuncType pFunc, ParamType aParam ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3, typename ParamType4 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3, ParamType4 aParam4 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3, aParam4 ) );
+ }
+
+
+ /** Calls the passed functor for every contained object. Passes the key as
+ first argument and the object reference as second argument to rFunctor. */
+ template< typename FunctorType >
+ inline void forEachWithKey( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as argument to the member function. */
+ template< typename FuncType >
+ inline void forEachMemWithKey( FuncType pFunc ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType aParam ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+private:
+ template< typename FunctorType >
+ struct ForEachFunctor
+ {
+ FunctorType maFunctor;
+ inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); }
+ };
+
+ template< typename FunctorType >
+ struct ForEachFunctorWithKey
+ {
+ FunctorType maFunctor;
+ inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); }
+ };
+
+ inline const mapped_type* getRef( key_type nKey ) const
+ {
+ typename container_type::const_iterator aIt = this->find( nKey );
+ return (aIt == this->end()) ? 0 : &aIt->second;
+ }
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/refvector.hxx b/include/oox/helper/refvector.hxx
new file mode 100644
index 000000000000..c0602b571c23
--- /dev/null
+++ b/include/oox/helper/refvector.hxx
@@ -0,0 +1,195 @@
+/* -*- 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 OOX_HELPER_REFVECTOR_HXX
+#define OOX_HELPER_REFVECTOR_HXX
+
+#include <vector>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+
+namespace oox {
+
+// ============================================================================
+
+/** Template for a vector of ref-counted objects with additional accessor functions.
+
+ An instance of the class RefVector< Type > stores elements of the type
+ ::boost::shared_ptr< Type >. The new accessor functions has() and get()
+ work correctly for indexes out of the current range, there is no need to
+ check the passed index before.
+ */
+template< typename ObjType >
+class RefVector : public ::std::vector< ::boost::shared_ptr< ObjType > >
+{
+public:
+ typedef ::std::vector< ::boost::shared_ptr< ObjType > > container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::size_type size_type;
+
+public:
+ /** Returns true, if the object with the passed index exists. Returns
+ false, if the vector element exists but is an empty reference. */
+ inline bool has( sal_Int32 nIndex ) const
+ {
+ const value_type* pxRef = getRef( nIndex );
+ return pxRef && pxRef->get();
+ }
+
+ /** Returns a reference to the object with the passed index, or 0 on error. */
+ inline value_type get( sal_Int32 nIndex ) const
+ {
+ if( const value_type* pxRef = getRef( nIndex ) ) return *pxRef;
+ return value_type();
+ }
+
+ /** Returns the index of the last element, or -1, if the vector is empty.
+ Does *not* check whether the last element is an empty reference. */
+ inline sal_Int32 getLastIndex() const { return static_cast< sal_Int32 >( this->size() ) - 1; }
+
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
+ template< typename FunctorType >
+ inline void forEach( FunctorType aFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType >
+ inline void forEachMem( FuncType pFunc ) const
+ {
+ forEach( ::boost::bind( pFunc, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMem( FuncType pFunc, ParamType aParam ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Calls the passed functor for every contained object. Passes the index as
+ first argument and the object reference as second argument to rFunctor. */
+ template< typename FunctorType >
+ inline void forEachWithIndex( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index to the member function. */
+ template< typename FuncType >
+ inline void forEachMemWithIndex( FuncType pFunc ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType aParam ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Searches for an element by using the passed functor that takes a
+ constant reference of the object type (const ObjType&). */
+ template< typename FunctorType >
+ inline value_type findIf( const FunctorType& rFunctor ) const
+ {
+ typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) );
+ return (aIt == this->end()) ? value_type() : *aIt;
+ }
+
+private:
+ template< typename FunctorType >
+ struct ForEachFunctor
+ {
+ FunctorType maFunctor;
+ inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); }
+ };
+
+ template< typename FunctorType >
+ struct ForEachFunctorWithIndex
+ {
+ FunctorType maFunctor;
+ sal_Int32 mnIndex;
+ inline explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {}
+ inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( mnIndex, *rxValue ); ++mnIndex; }
+ };
+
+ template< typename FunctorType >
+ struct FindFunctor
+ {
+ FunctorType maFunctor;
+ inline explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); }
+ };
+
+ inline const value_type* getRef( sal_Int32 nIndex ) const
+ {
+ return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ?
+ &(*this)[ static_cast< size_type >( nIndex ) ] : 0;
+ }
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/storagebase.hxx b/include/oox/helper/storagebase.hxx
new file mode 100644
index 000000000000..f318f01b4768
--- /dev/null
+++ b/include/oox/helper/storagebase.hxx
@@ -0,0 +1,191 @@
+/* -*- 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 OOX_HELPER_STORAGEBASE_HXX
+#define OOX_HELPER_STORAGEBASE_HXX
+
+#include <vector>
+#include <com/sun/star/uno/Reference.hxx>
+#include "oox/helper/refmap.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace embed { class XStorage; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+class StorageBase;
+typedef ::boost::shared_ptr< StorageBase > StorageRef;
+
+/** Base class for storage access implementations.
+
+ Derived classes will be used to encapsulate storage access implementations
+ for ZIP storages containing XML streams, and OLE storages containing binary
+ data streams.
+ */
+class OOX_DLLPUBLIC StorageBase
+{
+public:
+ explicit StorageBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
+ bool bBaseStreamAccess );
+
+ explicit StorageBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
+ bool bBaseStreamAccess );
+
+ virtual ~StorageBase();
+
+ /** Returns true, if the object represents a valid storage. */
+ bool isStorage() const;
+
+ /** Returns true, if the object represents the root storage. */
+ bool isRootStorage() const;
+
+ /** Returns true, if the storage operates in read-only mode (based on an
+ input stream). */
+ bool isReadOnly() const;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ getXStorage() const;
+
+ /** Returns the element name of this storage. */
+ const OUString& getName() const;
+
+ /** Returns the full path of this storage. */
+ OUString getPath() const;
+
+ /** Fills the passed vector with the names of all direct elements of this
+ storage. */
+ void getElementNames( ::std::vector< OUString >& orElementNames ) const;
+
+ /** Opens and returns the specified sub storage from the storage.
+
+ @param rStorageName
+ The name of the embedded storage. The name may contain slashes to
+ open storages from embedded substorages.
+ @param bCreateMissing
+ True = create missing sub storages (for export filters). Must be
+ false for storages based on input streams.
+ */
+ StorageRef openSubStorage( const OUString& rStorageName, bool bCreateMissing );
+
+ /** Opens and returns the specified input stream from the storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the constructor, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openInputStream( const OUString& rStreamName );
+
+ /** Opens and returns the specified output stream from the storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to create and open streams in embedded substorages. If base
+ stream access has been enabled in the constructor, the base stream
+ can be accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openOutputStream( const OUString& rStreamName );
+
+ /** Copies the specified element from this storage to the passed
+ destination storage.
+
+ @param rElementName
+ The name of the embedded storage or stream. The name may contain
+ slashes to specify an element in an embedded substorage. In this
+ case, the element will be copied to the same substorage in the
+ destination storage.
+ */
+ void copyToStorage( StorageBase& rDestStrg, const OUString& rElementName );
+
+ /** Copies all streams of this storage and of all substorages to the passed
+ destination. */
+ void copyStorageToStorage( StorageBase& rDestStrg );
+
+ /** Commits the changes to the storage and all substorages. */
+ void commit();
+
+protected:
+ /** Special constructor for sub storage objects. */
+ explicit StorageBase( const StorageBase& rParentStorage, const OUString& rStorageName, bool bReadOnly );
+
+private:
+ StorageBase( const StorageBase& );
+ StorageBase& operator=( const StorageBase& );
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const = 0;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ implGetXStorage() const = 0;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const = 0;
+
+ /** Implementation of opening a storage element. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreate ) = 0;
+
+ /** Implementation of opening an input stream element. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName ) = 0;
+
+ /** Implementation of opening an output stream element. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName ) = 0;
+
+ /** Commits the current storage. */
+ virtual void implCommit() const = 0;
+
+ /** Helper that opens and caches the specified direct substorage. */
+ StorageRef getSubStorage( const OUString& rElementName, bool bCreateMissing );
+
+private:
+ typedef RefMap< OUString, StorageBase > SubStorageMap;
+
+ SubStorageMap maSubStorages; ///< Map of direct sub storages.
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ mxInStream; ///< Cached base input stream (to keep it alive).
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
+ mxOutStream; ///< Cached base output stream (to keep it alive).
+ OUString maParentPath; ///< Full path of parent storage.
+ OUString maStorageName; ///< Name of this storage, if it is a substorage.
+ bool mbBaseStreamAccess; ///< True = access base streams with empty stream name.
+ bool mbReadOnly; ///< True = storage opened read-only (based on input stream).
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/textinputstream.hxx b/include/oox/helper/textinputstream.hxx
new file mode 100644
index 000000000000..16a2d5145e9d
--- /dev/null
+++ b/include/oox/helper/textinputstream.hxx
@@ -0,0 +1,122 @@
+/* -*- 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 OOX_HELPER_TEXTINPUTSTREAM_HXX
+#define OOX_HELPER_TEXTINPUTSTREAM_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+ namespace io { class XTextInputStream2; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+
+class BinaryInputStream;
+
+// ============================================================================
+
+class TextInputStream
+{
+public:
+ explicit TextInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ explicit TextInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ BinaryInputStream& rInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ ~TextInputStream();
+
+ /** Returns true, if no more text is available in the stream.
+ */
+ bool isEof() const;
+
+ /** Reads a text line from the stream.
+
+ If the last line in the stream is not terminated with line-end
+ character(s), the stream will immediately go into EOF state and return
+ the text line. Otherwise, if the last character in the stream is a
+ line-end character, the next call to this function will turn the stream
+ into EOF state and return an empty string.
+ */
+ OUString readLine();
+
+ /** Reads a text portion from the stream until the specified character is
+ found.
+
+ If the end of the stream is not terminated with the specified
+ character, the stream will immediately go into EOF state and return the
+ remaining text portion. Otherwise, if the last character in the stream
+ is the specified character (and caller specifies to read and return it,
+ see parameter bIncludeChar), the next call to this function will turn
+ the stream into EOF state and return an empty string.
+
+ @param cChar
+ The separator character to be read to.
+
+ @param bIncludeChar
+ True = if found, the specified character will be read from stream
+ and included in the returned string.
+ False = the specified character will neither be read from the
+ stream nor included in the returned string, but will be
+ returned as first character in the next call of this function
+ or readLine().
+ */
+ OUString readToChar( sal_Unicode cChar, bool bIncludeChar );
+
+ // ------------------------------------------------------------------------
+
+ /** Creates a UNO text input stream object from the passed UNO input stream.
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream2 >
+ createXTextInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ // ------------------------------------------------------------------------
+private:
+ void init(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ /** Adds the pending character in front of the passed string, if existing. */
+ OUString createFinalString( const OUString& rString );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream2 >
+ mxTextStrm;
+ sal_Unicode mcPendingChar;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/zipstorage.hxx b/include/oox/helper/zipstorage.hxx
new file mode 100644
index 000000000000..e46df41387d7
--- /dev/null
+++ b/include/oox/helper/zipstorage.hxx
@@ -0,0 +1,88 @@
+/* -*- 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 OOX_HELPER_ZIPSTORAGE_HXX
+#define OOX_HELPER_ZIPSTORAGE_HXX
+
+#include "oox/helper/storagebase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** Implements stream access for ZIP storages containing XML streams. */
+class ZipStorage : public StorageBase
+{
+public:
+ explicit ZipStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream );
+
+ explicit ZipStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream );
+
+ virtual ~ZipStorage();
+
+private:
+ explicit ZipStorage(
+ const ZipStorage& rParentStorage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rxStorage,
+ const OUString& rElementName );
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ implGetXStorage() const;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const;
+
+ /** Opens and returns the specified sub storage from the storage. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreateMissing );
+
+ /** Opens and returns the specified input stream from the storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName );
+
+ /** Opens and returns the specified output stream from the storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName );
+
+ /** Commits the current storage. */
+ virtual void implCommit() const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ mxStorage; ///< Storage based on input or output stream.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/mathml/export.hxx b/include/oox/mathml/export.hxx
new file mode 100644
index 000000000000..3a0f3788a77f
--- /dev/null
+++ b/include/oox/mathml/export.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 _OOXMLEXPORT_HXX
+#define _OOXMLEXPORT_HXX
+
+#include <sax/fshelper.hxx>
+#include <rtl/strbuf.hxx>
+#include <oox/core/filterbase.hxx>
+#include <oox/dllapi.h>
+
+namespace oox
+{
+
+/**
+ Interface class, StarMath will implement writeFormula*() to write out markup
+ representing the formula.
+ */
+class OOX_DLLPUBLIC FormulaExportBase
+{
+public:
+ virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ) = 0;
+ virtual void writeFormulaRtf( OStringBuffer& rBuffer, rtl_TextEncoding nEncoding ) = 0;
+
+protected:
+ FormulaExportBase();
+
+ ~FormulaExportBase() {}
+};
+
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/mathml/import.hxx b/include/oox/mathml/import.hxx
new file mode 100644
index 000000000000..fe436d41a047
--- /dev/null
+++ b/include/oox/mathml/import.hxx
@@ -0,0 +1,46 @@
+/* -*- 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 _STARMATHIMPORT_HXX
+#define _STARMATHIMPORT_HXX
+
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <tools/gen.hxx>
+
+#include <oox/dllapi.h>
+
+namespace oox
+{
+
+namespace formulaimport
+{
+class XmlStream;
+}
+
+/**
+ Interface class, StarMath will implement readFormulaOoxml() to read OOXML
+ representing the formula and getFormulaSize() to provide the size of the resulting
+ formula.
+ */
+class OOX_DLLPUBLIC FormulaImportBase
+{
+public:
+ virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ) = 0;
+ virtual Size getFormulaSize() const = 0;
+
+protected:
+ FormulaImportBase();
+
+ ~FormulaImportBase() {}
+};
+
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/mathml/importutils.hxx b/include/oox/mathml/importutils.hxx
new file mode 100644
index 000000000000..c3c16482164f
--- /dev/null
+++ b/include/oox/mathml/importutils.hxx
@@ -0,0 +1,254 @@
+/* -*- 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 _STARMATHIMPORTUTILS_HXX
+#define _STARMATHIMPORTUTILS_HXX
+
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include <oox/token/tokens.hxx>
+#include <map>
+#include <vector>
+
+#include <oox/dllapi.h>
+
+namespace oox
+{
+
+namespace formulaimport
+{
+
+// used to differentiate between tags that opening or closing
+const int TAG_OPENING = 1 << 29;
+const int TAG_CLOSING = 1 << 30;
+
+// you probably want to #define these to something shorter in the .cxx file,
+// but they must be done as macros, otherwise they wouldn't be usable for case values,
+// and macros cannot be namespaced
+#define XML_STREAM_OPENING( token ) ( TAG_OPENING | token )
+#define XML_STREAM_CLOSING( token ) ( TAG_CLOSING | token )
+
+/**
+ Class for storing a stream of xml tokens.
+
+ A part of an XML file can be parsed and stored in this stream, from which it can be read
+ as if parsed linearly. The purpose of this class is to allow simpler handling of XML
+ files, unlike the usual LO way of using callbacks, context handlers and similar needlesly
+ complicated stuff (YMMV).
+
+ The advantages of this approach is easy to read and debug code (as it is just functions
+ reading tokens one by one and calling other functions, compared to having to use callbacks
+ and temporary storage). The disadvantage is that the XML structure needs to be handled
+ manually by the code.
+
+ Note that tag identifiers are simply int values and the API does not care besides matching
+ their values to XML stream contents and requiring that the values are not as high as TAG_OPENING.
+ Be prepared for the fact that some of the functions may throw exceptions if the input
+ stream does not match the required token (TBD).
+
+ The API tries to make the common idioms as simple as possible, see the following examples.
+
+ Parse <tagone attr="value"><tagtwo>text</tagtwo></tagone> , where tagtwo is optional:
+ @code
+XmlStream::Tag tagoneTag = stream.ensureOpeningTag( tagone );
+if( attributeTag.hasAttribute( attr ))
+ ... = attributeTag.attribute( attr, defaultValueOfTheRightType );
+if( XmlStream::Tag tagtwoTag = stream.checkOpeningTag( tagtwo ))
+{
+ ... = tagtwoTag.text;
+ stream.ensureClosingTag( tagtwo );
+}
+stream.ensureClosingTag( tagone );
+ @endcode
+
+ Parse an element that may contain several sub-elements of different types in random order:
+ @code
+stream.ensureOpeningTag( element );
+while( !stream.atEnd() && stream.currentToken() != CLOSING( element ))
+ {
+ switch( stream.currentToken())
+ {
+ case OPENING( subelement1 ):
+ handleSubElement1();
+ break;
+ case OPENING( subelement2 ):
+ ... process subelement2;
+ break;
+ default:
+ stream.handleUnexpectedTag();
+ break;
+ }
+stream.ensureClosingTag( element );
+ @endcode
+
+ If there may not be a zero number of sub-elements, use a helper bool variable or use a do-while loop.
+
+ Parse an element that may contain an unknown number of sub-elements of the same type:
+ @code
+stream.ensureOpeningTag( element );
+while( !stream.atEnd() && stream.findTag( OPENING( subelement )))
+ {
+ handleSubelement();
+ }
+stream.ensureClosingTag( element );
+ @endcode
+
+ If there may not be a zero number of sub-elements, use a helper bool variable or use a do-while loop.
+
+ @since 3.5
+*/
+class OOX_DLLPUBLIC XmlStream
+{
+public:
+ XmlStream();
+ /**
+ Structure representing a list of attributes.
+ */
+ // One could theoretically use oox::AttributeList, but that complains if the passed reference is empty,
+ // which would be complicated to avoid here. Also, parsers apparently reuse the same instance of XFastAttributeList,
+ // which means using oox::AttributeList would make them all point to the one instance.
+ struct OOX_DLLPUBLIC AttributeList
+ {
+ bool hasAttribute( int token ) const;
+ OUString& operator[] (int token);
+ OUString attribute( int token, const OUString& def = OUString()) const;
+ bool attribute( int token, bool def ) const;
+ sal_Unicode attribute( int token, sal_Unicode def ) const;
+ // when adding more attribute() overloads, add also to XmlStream itself
+ protected:
+ std::map< int, OUString > attrs;
+ };
+ /**
+ Structure representing a tag, including its attributes and content text immediatelly following it.
+ */
+ struct OOX_DLLPUBLIC Tag
+ {
+ Tag( int token = XML_TOKEN_INVALID,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& attributes = com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >(),
+ const OUString& text = OUString());
+ Tag( int token,
+ const AttributeList& attribs);
+ int token; ///< tag type, or XML_TOKEN_INVALID
+ AttributeList attributes;
+ OUString text;
+ /**
+ This function returns value of the given attribute, or the passed default value if not found.
+ The type of the default value selects the return type (OUString here).
+ */
+ OUString attribute( int token, const OUString& def = OUString()) const;
+ /**
+ @overload
+ */
+ bool attribute( int token, bool def ) const;
+ /**
+ @overload
+ */
+ sal_Unicode attribute( int token, sal_Unicode def ) const;
+ // when adding more attribute() overloads, add also to XmlStream::AttributeList and inline below
+ /**
+ Converts to true if the tag has a valid token, false otherwise. Allows simple
+ usage in if(), for example 'if( XmlStream::Tag foo = stream.checkOpeningTag( footoken ))'.
+ */
+ operator bool() const;
+ };
+ /**
+ @return true if current position is at the end of the XML stream
+ */
+ bool atEnd() const;
+ /**
+ @return data about the current tag
+ */
+ Tag currentTag() const;
+ /**
+ @return the token for the current tag
+ */
+ int currentToken() const;
+ /**
+ Moves position to the next tag.
+ */
+ void moveToNextTag();
+ /**
+ Ensures that an opening tag with the given token is read. If the current tag does not match,
+ writes out a warning and tries to recover by skipping tags until found (or until the current element would end).
+ If found, the position in the stream is afterwards moved to the next tag.
+ @return the matching found opening tag, or empty tag if not found
+ */
+ Tag ensureOpeningTag( int token );
+ /**
+ Tries to find an opening tag with the given token. Works similarly like ensureOpeningTag(),
+ but if a matching tag is not found, the position in the stream is not altered. The primary
+ use of this function is to check for optional elements.
+ @return the matching found opening tag, or empty tag if not found
+ */
+ Tag checkOpeningTag( int token );
+ /**
+ Ensures that a closing tag with the given token is read. Like ensureOpeningTag(),
+ if not, writes out a warning and tries to recover by skiping tags until found (or until the current element would end).
+ If found, the position in the stream is afterwards moved to the next tag.
+ */
+ void ensureClosingTag( int token );
+ /**
+ Tries to find the given token, until either found (returns true) or end of current element.
+ Position in the stream is set to make the tag current (i.e. it will be the next one read).
+ */
+ bool findTag( int token );
+ /**
+ Handle the current (unexpected) tag.
+ */
+ void handleUnexpectedTag();
+protected:
+ Tag checkTag( int token, bool optional );
+ bool findTagInternal( int token, bool silent );
+ void skipElementInternal( int token, bool silent );
+ std::vector< Tag > tags;
+ unsigned int pos;
+};
+
+/**
+ This class is used for creating XmlStream.
+
+ Simply use this class and then pass it as XmlStream to the consumer.
+
+ @since 3.5.0
+*/
+class OOX_DLLPUBLIC XmlStreamBuilder
+: public XmlStream
+{
+public:
+ void appendOpeningTag( int token,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& attributes = com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >());
+ void appendOpeningTag( int token,
+ const AttributeList& attribs );
+ void appendClosingTag( int token );
+ // appends the characters after the last appended token
+ void appendCharacters( const OUString& characters );
+};
+
+inline
+OUString XmlStream::Tag::attribute( int t, const OUString& def ) const
+{
+ return attributes.attribute( t, def );
+}
+
+inline
+bool XmlStream::Tag::attribute( int t, bool def ) const
+{
+ return attributes.attribute( t, def );
+}
+
+inline
+sal_Unicode XmlStream::Tag::attribute( int t, sal_Unicode def ) const
+{
+ return attributes.attribute( t, def );
+}
+
+} // namespace
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axbinaryreader.hxx b/include/oox/ole/axbinaryreader.hxx
new file mode 100644
index 000000000000..b6a937d14c4c
--- /dev/null
+++ b/include/oox/ole/axbinaryreader.hxx
@@ -0,0 +1,257 @@
+/* -*- 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 OOX_OLE_AXBINARYREADER_HXX
+#define OOX_OLE_AXBINARYREADER_HXX
+
+#include <utility>
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/refvector.hxx"
+#include "oox/ole/axfontdata.hxx"
+
+namespace oox {
+namespace 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
+ loosing any functionality.
+ */
+class AxAlignedInputStream : 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;
+ /** Return the current relative stream position (relative to position of
+ the wrapped stream at construction time). */
+ virtual sal_Int64 tell() const;
+ /** Seeks the stream to the passed relative position, if it is behind the
+ current position. */
+ virtual void seek( sal_Int64 nPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
+ /** 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 );
+ /** 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 );
+ /** Seeks the stream forward by the passed number of bytes. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** 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 >
+ inline 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 >
+ inline 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 >
+ inline 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 >
+ inline 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. */
+ inline void skipBoolProperty() { startNextProperty(); }
+ /** Skips the next pair property in the stream, if the respective flag in
+ the property mask is set. */
+ void skipPairProperty() { readPairProperty( maDummyPairData ); }
+ /** Skips the next string property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipStringProperty() { readStringProperty( maDummyString ); }
+ /** Skips the next ArrayString property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipArrayStringProperty() { readArrayStringProperty( maDummyArrayString ); }
+ /** Skips the next GUID property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipGuidProperty() { readGuidProperty( maDummyString ); }
+ /** Skips the next font property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipFontProperty() { readFontProperty( maDummyFontData ); }
+ /** Skips the next picture property in the stream, if the respective flag
+ in the property mask is set. */
+ inline 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. */
+ inline 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 : public ComplexProperty
+ {
+ AxPairData& mrPairData;
+
+ inline explicit PairProperty( AxPairData& rPairData ) :
+ mrPairData( rPairData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Complex property for a string value. */
+ struct StringProperty : public ComplexProperty
+ {
+ OUString& mrValue;
+ sal_uInt32 mnSize;
+
+ inline explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
+ mrValue( rValue ), mnSize( nSize ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Complex property for an array of strings. */
+ struct ArrayStringProperty : public ComplexProperty
+ {
+ AxArrayString& mrArray;
+ sal_uInt32 mnSize;
+ inline explicit ArrayStringProperty( AxArrayString& rArray, sal_uInt32 nSize ) :
+ mrArray( rArray ), mnSize( nSize ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Complex property for a GUID value. */
+ struct GuidProperty : public ComplexProperty
+ {
+ OUString& mrGuid;
+
+ inline explicit GuidProperty( OUString& rGuid ) :
+ mrGuid( rGuid ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Stream property for a font structure. */
+ struct FontProperty : public ComplexProperty
+ {
+ AxFontData& mrFontData;
+
+ inline explicit FontProperty( AxFontData& rFontData ) :
+ mrFontData( rFontData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Stream property for a picture or mouse icon. */
+ struct PictureProperty : public ComplexProperty
+ {
+ StreamDataSequence& mrPicData;
+
+ inline explicit PictureProperty( StreamDataSequence& rPicData ) :
+ mrPicData( rPicData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ 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.
+ AxPairData maDummyPairData; ///< Dummy pair for unsupported properties.
+ AxFontData maDummyFontData; ///< Dummy font for unsupported 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 ole
+} // namespace oox
+
+#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 000000000000..eb4aec532d1f
--- /dev/null
+++ b/include/oox/ole/axbinarywriter.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 Noel Power<noel.power@suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef OOX_OLE_AXBINARYWRITER_HXX
+#define OOX_OLE_AXBINARYWRITER_HXX
+
+#include <utility>
+#include "oox/helper/binaryoutputstream.hxx"
+#include "oox/helper/refvector.hxx"
+
+namespace oox {
+namespace 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 : 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;
+ /** Return the current relative stream position (relative to position of
+ the wrapped stream at construction time). */
+ virtual sal_Int64 tell() const;
+ /** Seeks the stream to the passed relative position, if it is behind the
+ current position. */
+ virtual void seek( sal_Int64 nPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual void writeData( const StreamDataSequence& orData, size_t nAtomSize = 1 );
+ /** 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 );
+
+ /** 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, size_t nAtomSize = 1);
+ /** Aligns the stream according to the passed type and reads a value. */
+ template< typename Type >
+ inline void writeAligned( Type nVal ) { align( sizeof( Type ) ); writeValue( nVal ); }
+ /** Aligns the stream according to the passed type and skips the size of the type. */
+ template< typename Type >
+ inline void padAligned() { align( sizeof( Type ) ); pad( sizeof( Type ) ); }
+
+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;
+
+/** An array of string values as a property. */
+typedef ::std::vector< OUString > AxStringArray;
+
+// ============================================================================
+
+/** 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 >
+ inline void writeIntProperty( DataType& ornValue )
+ { if( 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, bool bReverse = false );
+ /** 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, bool bCompressed = true );
+
+ /** Skips the next property clears the respective
+ flag in the property mask. */
+ inline void skipProperty() { startNextProperty( true ); }
+
+ /** Final processing, write contents of all complex properties, writes record size */
+ bool finalizeExport();
+
+private:
+ bool ensureValid( bool bCondition = true );
+ bool 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 : public ComplexProperty
+ {
+ AxPairData& mrPairData;
+
+ inline explicit PairProperty( AxPairData& rPairData ) :
+ mrPairData( rPairData ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm );
+ };
+
+ /** Complex property for a string value. */
+ struct StringProperty : public ComplexProperty
+ {
+ OUString& mrValue;
+ sal_uInt32 mnSize;
+
+ inline explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
+ mrValue( rValue ), mnSize( nSize ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm );
+ };
+
+ /** Stream property for a picture or mouse icon. */
+ struct PictureProperty : public ComplexProperty
+ {
+ StreamDataSequence& mrPicData;
+
+ inline explicit PictureProperty( StreamDataSequence& rPicData ) :
+ mrPicData( rPicData ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm );
+ };
+
+ 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.
+ AxPairData maDummyPairData; ///< Dummy pair for unsupported properties.
+ StreamDataSequence maDummyPicData; ///< Dummy picture for unsupported properties.
+ OUString maDummyString; ///< Dummy string for unsupported properties.
+ AxStringArray maDummyStringArray; ///< Dummy string array for unsupported 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 ole
+} // namespace oox
+
+#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 000000000000..84e3a3ecbcdd
--- /dev/null
+++ b/include/oox/ole/axcontrol.hxx
@@ -0,0 +1,1031 @@
+/* -*- 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 OOX_OLE_AXCONTROL_HXX
+#define OOX_OLE_AXCONTROL_HXX
+
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "oox/ole/axbinaryreader.hxx"
+#include "oox/ole/olehelper.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace 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 GraphicHelper;
+ class PropertyMap;
+}
+
+namespace oox {
+namespace 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_SELCTION_SINGLE = 0;
+const sal_Int32 AX_SELCTION_MULTI = 1;
+const sal_Int32 AX_SELCTION_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 ApiTransparencyMode
+{
+ API_TRANSPARENCY_NOTSUPPORTED, ///< Control does not support transparency.
+ API_TRANSPARENCY_VOID, ///< Transparency is enabled by missing fill color.
+ API_TRANSPARENCY_PAINTTRANSPARENT ///< Transparency is enabled by the 'PaintTransparent' property.
+};
+
+/** 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
+{
+public:
+ explicit ControlConverter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+ virtual ~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;
+
+ void convertToMSColor(
+ PropertySet& rPropSet,
+ sal_Int32 nPropId,
+ sal_uInt32& nOleColor,
+ sal_uInt32 nDefault = 0 ) const;
+
+
+ /** Converts the passed StdPic picture stream to UNO properties. */
+ void convertPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData ) const;
+
+ /** Converts the control orientation to UNO properties. */
+ void convertOrientation(
+ PropertyMap& rPropMap,
+ bool bHorizontal ) const;
+
+ void convertToMSOrientation(
+ PropertySet& rPropMap,
+ bool& bHorizontal ) const;
+
+ /** Converts the vertical alignment to UNO properties. */
+ void convertVerticalAlign(
+ PropertyMap& rPropMap,
+ sal_Int32 nVerticalAlign ) const;
+
+ /** Converts common scrollbar settings to UNO properties. */
+ void convertScrollBar(
+ PropertyMap& rPropMap,
+ sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
+ sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const;
+
+ /** 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 ::com::sun::star::uno::Reference< ::com::sun::star::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;
+
+ void convertToAxBorder(
+ PropertySet& rPropSet,
+ sal_uInt32& nBorderColor,
+ sal_Int32& nBorderStyle,
+ sal_Int32& nSpecialEffect ) const;
+
+ /** Converts the Forms 2.0 special effect to UNO properties. */
+ void convertAxVisualEffect(
+ PropertyMap& rPropMap,
+ sal_Int32 nSpecialEffect ) const;
+
+ void convertToAxVisualEffect(
+ PropertySet& rPropSet,
+ sal_Int32& nSpecialEffect ) const;
+
+ /** 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,
+ sal_Int32 nPicAlign,
+ bool bPicTiling ) const;
+
+ /** Converts the Forms 2.0 value for checked/unchecked/dontknow to UNO
+ properties. */
+ void convertAxState(
+ PropertyMap& rPropMap,
+ const OUString& rValue,
+ sal_Int32 nMultiSelect,
+ ApiDefaultStateMode eDefStateMode,
+ bool bAwtModel ) const;
+
+ void convertToAxState(
+ PropertySet& rPropSet,
+ OUString& rValue,
+ sal_Int32& nMultiSelect,
+ ApiDefaultStateMode eDefStateMode,
+ bool bAwtModel ) const;
+
+ /** Converts the Forms 2.0 control orientation to UNO properties. */
+ void convertAxOrientation(
+ PropertyMap& rPropMap,
+ const AxPairData& rSize,
+ sal_Int32 nOrientation ) const;
+
+ void convertToAxOrientation(
+ PropertySet& rPropSet,
+ const AxPairData& rSize,
+ sal_Int32& nOrientation ) const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::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. */
+ inline void setAwtModelMode() { mbAwtModel = true; }
+ /** Sets this control model to form component mode. */
+ inline 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 ::boost::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,
+ bool bCommonPart, bool bComplexPart );
+
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm ) = 0;
+ virtual void importCommonExtraData( BinaryInputStream& rInStrm );
+ virtual void importCommonTrailingData( BinaryInputStream& rInStrm );
+
+private:
+ /** Returns the data part identifier according to the model version. */
+ sal_uInt32 getDataPartId() const;
+
+ 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 : public ComCtlModelBase
+{
+public:
+ explicit ComCtlScrollBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm );
+
+private:
+ 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 : public ComCtlModelBase
+{
+public:
+ explicit ComCtlProgressBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm );
+
+private:
+ 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 );
+};
+
+// ============================================================================
+
+/** 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 );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+ /** Returns the font height in points. */
+ inline 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 : public AxFontDataModel
+{
+public:
+ explicit AxCommandButtonModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+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 : public AxFontDataModel
+{
+public:
+ explicit AxLabelModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+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 : public AxControlModelBase
+{
+public:
+ explicit AxImageModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+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 : public AxFontDataModel
+{
+public:
+ explicit AxTabStripModel();
+
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ virtual ApiControlType getControlType() const;
+
+public:
+ sal_uInt32 mnListIndex;
+ sal_uInt32 mnTabStyle;
+ sal_uInt32 mnTabData;
+ sal_uInt32 mnVariousPropertyBits;
+ std::vector< ::rtl::OUString > maItems; // captions for each tab
+ std::vector< ::rtl::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 );
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+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 : public AxMorphDataModelBase
+{
+public:
+ explicit AxToggleButtonModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 check box. */
+class OOX_DLLPUBLIC AxCheckBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxCheckBoxModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 option button. */
+class OOX_DLLPUBLIC AxOptionButtonModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxOptionButtonModel();
+
+ /** Returns the group name used to goup several option buttons gogether. */
+ inline const OUString& getGroupName() const { return maGroupName; }
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 text box. */
+class OOX_DLLPUBLIC AxTextBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxTextBoxModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a numeric field (legacy drawing controls only). */
+class OOX_DLLPUBLIC AxNumericFieldModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxNumericFieldModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 list box. */
+class OOX_DLLPUBLIC AxListBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxListBoxModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 combo box. */
+class OOX_DLLPUBLIC AxComboBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxComboBoxModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 spin button. */
+class OOX_DLLPUBLIC AxSpinButtonModel : public AxControlModelBase
+{
+public:
+ explicit AxSpinButtonModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+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 : public AxControlModelBase
+{
+public:
+ explicit AxScrollBarModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+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 );
+ /** Reads the leading structure in the 'f' stream containing the model for
+ this control. */
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ /** Converts font settings if supported. */
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+ /** 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.
+};
+
+typedef ::boost::shared_ptr< AxContainerModelBase > AxContainerModelRef;
+
+// ============================================================================
+
+/** Model for a Forms 2.0 frame control. */
+class OOX_DLLPUBLIC AxFrameModel : public AxContainerModelBase
+{
+public:
+ explicit AxFrameModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+class OOX_DLLPUBLIC AxPageModel : public AxContainerModelBase
+{
+public:
+ explicit AxPageModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+class OOX_DLLPUBLIC AxMultiPageModel : public AxContainerModelBase
+{
+public:
+ explicit AxMultiPageModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual bool importPageAndMultiPageProperties( BinaryInputStream& rInStrm, sal_Int32 nPages );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ std::vector<sal_uInt32> mnIDs;
+ sal_uInt32 mnActiveTab;
+ sal_uInt32 mnTabStyle;
+};
+
+// ============================================================================
+
+
+/** Model for a Forms 2.0 user form. */
+class OOX_DLLPUBLIC AxUserFormModel : public AxContainerModelBase
+{
+public:
+ explicit AxUserFormModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+class HtmlSelectModel : public AxListBoxModel
+{
+ com::sun::star::uno::Sequence< OUString > msListData;
+ com::sun::star::uno::Sequence< sal_Int16 > msIndices;
+public:
+ HtmlSelectModel();
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+class HtmlTextBoxModel : public AxTextBoxModel
+{
+public:
+ explicit HtmlTextBoxModel();
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+};
+// ============================================================================
+
+/** 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( const OUString& rName );
+ virtual ~EmbeddedControl();
+
+ /** 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( const OUString& rClassId );
+
+ /** Returns true, if the internal control model exists. */
+ inline bool hasModel() const { return mxModel.get() != 0; }
+ /** Returns read-only access to the internal control model. */
+ inline const ControlModelBase* getModel() const { return mxModel.get(); }
+ /** Returns read/write access to the internal control model. */
+ inline 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 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv ) const;
+
+ bool convertFromProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::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()
+{
+ ::boost::shared_ptr< ModelType > xModel( new ModelType );
+ mxModel = xModel;
+ xModel->setFormComponentMode();
+ return *xModel;
+}
+
+template< typename ModelType, typename ParamType >
+inline ModelType& EmbeddedControl::createModel( const ParamType& rParam )
+{
+ ::boost::shared_ptr< ModelType > xModel( new 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 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+
+ /** Converts the passed control and inserts the control model into the form.
+ @return The API control model, if conversion was successful. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
+ convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex );
+
+ /** Returns the XIndexContainer interface of the UNO control form, if existing. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
+ getXForm() const { return mxFormIC; }
+
+private:
+ /** Creates the form that will hold the form controls. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
+ createXForm();
+
+private:
+ ControlConverter maControlConv;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxModelFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier > mxFormsSupp;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxFormIC;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#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 000000000000..653f23c30479
--- /dev/null
+++ b/include/oox/ole/axcontrolfragment.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 OOX_OLE_AXCONTROLFRAGMENT_HXX
+#define OOX_OLE_AXCONTROLFRAGMENT_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox {
+namespace ole {
+
+class ControlModelBase;
+class EmbeddedControl;
+
+// ============================================================================
+
+/** Context handler for ActiveX form control model properties. */
+class AxControlPropertyContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit AxControlPropertyContext(
+ ::oox::core::FragmentHandler2& rFragment,
+ ControlModelBase& rModel );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ ControlModelBase& mrModel;
+ sal_Int32 mnPropId; ///< Identifier of currently processed property.
+};
+
+// ============================================================================
+
+/** Fragment handler for an embedded ActiveX form control fragment. */
+class AxControlFragment : 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 );
+
+private:
+ EmbeddedControl& mrControl;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#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 000000000000..9dbec1786261
--- /dev/null
+++ b/include/oox/ole/axfontdata.hxx
@@ -0,0 +1,81 @@
+/* -*- 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 OOX_OLE_AXFONTDATA_HXX
+#define OOX_OLE_AXFONTDATA_HXX
+
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/binaryoutputstream.hxx"
+#include "oox/helper/refvector.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+const sal_Char* const AX_GUID_CFONT = "{AFC20920-DA4E-11CE-B943-00AA006887B4}";
+
+const sal_uInt32 AX_FONTDATA_BOLD = 0x00000001;
+const sal_uInt32 AX_FONTDATA_ITALIC = 0x00000002;
+const sal_uInt32 AX_FONTDATA_UNDERLINE = 0x00000004;
+const sal_uInt32 AX_FONTDATA_STRIKEOUT = 0x00000008;
+const sal_uInt32 AX_FONTDATA_DISABLED = 0x00002000;
+const sal_uInt32 AX_FONTDATA_AUTOCOLOR = 0x40000000;
+
+const sal_Int32 AX_FONTDATA_LEFT = 1;
+const sal_Int32 AX_FONTDATA_RIGHT = 2;
+const sal_Int32 AX_FONTDATA_CENTER = 3;
+
+/** All entries of a font property. */
+struct OOX_DLLPUBLIC AxFontData
+{
+ OUString maFontName; ///< Name of the used font.
+ sal_uInt32 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.
+ sal_Int32 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 ole
+} // namespace oox
+
+#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 000000000000..e75a0cd07588
--- /dev/null
+++ b/include/oox/ole/olehelper.hxx
@@ -0,0 +1,203 @@
+/* -*- 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 OOX_OLE_OLEHELPER_HXX
+#define OOX_OLE_OLEHELPER_HXX
+
+#include <rtl/ustring.hxx>
+#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/helper/graphichelper.hxx"
+#include "com/sun/star/form/XFormComponent.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/frame/XModel.hpp"
+#include "com/sun/star/frame/XFrame.hpp"
+#include "com/sun/star/drawing/XShapes.hpp"
+#include "com/sun/star/awt/XControlModel.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/io/XOutputStream.hpp"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include "com/sun/star/container/XIndexContainer.hpp"
+#include <filter/msfilter/msocximex.hxx>
+#include "oox/dllapi.h"
+#include "sot/storage.hxx"
+
+namespace oox {
+ class BinaryInputStream;
+ class BinaryOutputStream;
+ class BinaryXInputStream;
+ class GraphicHelper;
+}
+
+namespace oox {
+
+typedef ::boost::shared_ptr< oox::BinaryXInputStream > BinaryXInputStreamRef;
+
+namespace ole {
+
+
+// ============================================================================
+
+#define OLE_GUID_STDFONT "{0BE35203-8F91-11CE-9DE3-00AA004BB851}"
+#define OLE_GUID_STDPIC "{0BE35204-8F91-11CE-9DE3-00AA004BB851}"
+#define OLE_GUID_STDHLINK "{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}"
+
+// ============================================================================
+
+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(
+ const OUString& rName,
+ sal_uInt32 nHeight,
+ sal_uInt16 nWeight = OLE_STDFONT_NORMAL,
+ sal_uInt16 nCharSet = WINDOWS_CHARSET_ANSI,
+ sal_uInt8 nFlags = 0 );
+};
+
+// ============================================================================
+
+/** Stores data about a StdHlink hyperlink. */
+struct StdHlinkInfo
+{
+ OUString maTarget;
+ OUString maLocation;
+ OUString maDisplay;
+ OUString maFrame;
+};
+
+// ============================================================================
+
+/** Static helper functions for OLE import/export. */
+class OOX_DLLPUBLIC OleHelper
+{
+public:
+ /** 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.
+ */
+ static sal_Int32 decodeOleColor(
+ const GraphicHelper& rGraphicHelper,
+ sal_uInt32 nOleColor,
+ bool bDefaultColorBgr = true );
+
+ /** Returns the OLE color from the passed UNO RGB color.
+ */
+ static sal_uInt32 encodeOleColor( sal_Int32 nRgbColor );
+
+ /** Imports a GUID from the passed binary stream and returns its string
+ representation (in uppercase characters).
+ */
+ static OUString importGuid( BinaryInputStream& rInStrm );
+
+ /** Imports an OLE StdFont font structure from the current position of the
+ passed binary stream.
+ */
+ static bool importStdFont(
+ StdFontInfo& orFontInfo,
+ BinaryInputStream& rInStrm,
+ bool bWithGuid );
+
+ /** Imports an OLE StdPic picture from the current position of the passed
+ binary stream.
+ */
+ static bool importStdPic(
+ StreamDataSequence& orGraphicData,
+ BinaryInputStream& rInStrm,
+ bool bWithGuid );
+
+private:
+ OleHelper(); // not implemented
+ ~OleHelper(); // not implemented
+};
+
+// 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
+{
+#ifdef SvxMSConvertOCXControlsRemoved
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxDrawPage;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > mxFormComps;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+#endif
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCtx;
+ ::oox::GraphicHelper maGrfHelper;
+
+ bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
+ ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
+ const OUString& rGuidString );
+ bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
+ ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
+ const OUString& rGuidString,
+ sal_Int32 nSize );
+public:
+ MSConvertOCXControls( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
+ ~MSConvertOCXControls();
+ sal_Bool ReadOCXStorage( SotStorageRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp );
+ sal_Bool ReadOCXCtlsStream(SotStorageStreamRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
+ sal_Int32 nPos, sal_Int32 nSize );
+ static sal_Bool WriteOCXStream( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, SotStorageRef &rSrc1, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > &rControlModel, const com::sun::star::awt::Size& rSize,OUString &rName);
+
+#ifdef SvxMSConvertOCXControlsRemoved
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > & GetShapes();
+ const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > & GetFormComps();
+ virtual const com::sun::star::uno::Reference<
+ com::sun::star::drawing::XDrawPage > & GetDrawPage();
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & GetServiceFactory();
+ virtual sal_Bool InsertControl(
+ const com::sun::star::uno::Reference<
+ com::sun::star::form::XFormComponent >& /*rFComp*/,
+ const com::sun::star::awt::Size& /*rSize*/,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape >* /*pShape*/,
+ sal_Bool /*bFloatingCtrl*/ ) {return sal_False;}
+#endif
+};
+
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#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 000000000000..9d97a8d95f71
--- /dev/null
+++ b/include/oox/ole/oleobjecthelper.hxx
@@ -0,0 +1,79 @@
+/* -*- 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 OOX_OLE_OLEOBJECTHELPER_HXX
+#define OOX_OLE_OLEOBJECTHELPER_HXX
+
+#include "oox/helper/binarystreambase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Size; }
+ namespace document { class XEmbeddedObjectResolver; }
+ namespace lang { class XMultiServiceFactory; }
+} } }
+
+namespace oox { class PropertyMap; }
+
+namespace oox {
+namespace 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;
+
+ explicit OleObjectInfo();
+};
+
+// ============================================================================
+
+/** Helper for OLE object handling. */
+class OleObjectHelper
+{
+public:
+ explicit OleObjectHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory );
+ ~OleObjectHelper();
+
+ bool importOleObject(
+ PropertyMap& rPropMap,
+ const OleObjectInfo& rOleObject,
+ const ::com::sun::star::awt::Size& rObjSize );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxResolver;
+ const OUString maEmbeddedObjScheme;
+ sal_Int32 mnObjectId;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#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 000000000000..1b48eab8213d
--- /dev/null
+++ b/include/oox/ole/olestorage.hxx
@@ -0,0 +1,110 @@
+/* -*- 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 OOX_OLE_OLESTORAGE_HXX
+#define OOX_OLE_OLESTORAGE_HXX
+
+#include "oox/helper/storagebase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+/** Implements stream access for binary OLE storages. */
+class OOX_DLLPUBLIC OleStorage : public StorageBase
+{
+public:
+ explicit OleStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
+ bool bBaseStreamAccess );
+
+ explicit OleStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
+ bool bBaseStreamAccess );
+
+ virtual ~OleStorage();
+
+private:
+ explicit OleStorage(
+ const OleStorage& rParentStorage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxStorage,
+ const OUString& rElementName,
+ bool bReadOnly );
+ explicit OleStorage(
+ const OleStorage& rParentStorage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
+ const OUString& rElementName );
+
+ /** Initializes the API storage object for input. */
+ void initStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream );
+ /** Initializes the API storage object for input/output. */
+ void initStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream );
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage.
+
+ @attention
+ This function is not implemented for binary OLE storages.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ implGetXStorage() const;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const;
+
+ /** Opens and returns the specified sub storage from the storage. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreateMissing );
+
+ /** Opens and returns the specified input stream from the storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName );
+
+ /** Opens and returns the specified output stream from the storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName );
+
+ /** Commits the current storage. */
+ virtual void implCommit() const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxStorage; ///< Access to elements of this sub storage.
+ const OleStorage* mpParentStorage; ///< Parent OLE storage that contains this storage.
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#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 000000000000..0de80153baed
--- /dev/null
+++ b/include/oox/ole/vbacontrol.hxx
@@ -0,0 +1,205 @@
+/* -*- 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 OOX_OLE_VBACONTROL_HXX
+#define OOX_OLE_VBACONTROL_HXX
+
+#include "oox/ole/axcontrol.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox { class StorageBase; }
+
+namespace oox {
+namespace 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
+{
+public:
+ explicit VbaSiteModel();
+ virtual ~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. */
+ inline const OUString& getName() const { return maName; }
+ /** Returns the position of the control in its parent. */
+ inline const AxPairData& getPosition() const { return maPos; }
+ /** Returns the unique identifier of this control. */
+ inline 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. */
+ inline 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;
+
+protected:
+ 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 ::boost::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 ::com::sun::star::uno::Reference< ::com::sun::star::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 ::com::sun::star::uno::Reference< ::com::sun::star::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. */
+ bool 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 : public VbaFormControl
+{
+public:
+ explicit VbaUserForm(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+
+ /** Imports the form and its embedded controls, and inserts the form with
+ all its controls into the passed dialog library. */
+ void importForm(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxDialogLib,
+ StorageBase& rVbaFormStrg,
+ const OUString& rModuleName,
+ rtl_TextEncoding eTextEnc );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
+ ControlConverter maConverter;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#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 000000000000..a8faee21ff6e
--- /dev/null
+++ b/include/oox/ole/vbahelper.hxx
@@ -0,0 +1,98 @@
+/* -*- 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 OOX_OLE_VBAHELPER_HXX
+#define OOX_OLE_VBAHELPER_HXX
+
+#include "oox/helper/binarystreambase.hxx"
+
+namespace oox { class BinaryInputStream; }
+
+namespace oox {
+namespace 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. */
+class VbaHelper
+{
+public:
+ /** 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.
+ */
+ static 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.
+ */
+ static bool extractKeyValue(
+ OUString& rKey,
+ OUString& rValue,
+ const OUString& rKeyValue );
+
+private:
+ VbaHelper();
+ ~VbaHelper();
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#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 000000000000..7e0cd4986bd7
--- /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 OOX_OLE_VBAINPUTSTREAM_HXX
+#define OOX_OLE_VBAINPUTSTREAM_HXX
+
+#include <vector>
+#include "oox/helper/binaryinputstream.hxx"
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+/** A non-seekable input stream that implements run-length decompression. */
+class VbaInputStream : public BinaryInputStream
+{
+public:
+ explicit VbaInputStream( BinaryInputStream& rInStrm );
+
+ /** Returns -1, stream size is not determinable. */
+ virtual sal_Int64 size() const;
+ /** Returns -1, stream position is not tracked. */
+ virtual sal_Int64 tell() const;
+ /** Does nothing, stream is not seekable. */
+ virtual void seek( sal_Int64 nPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
+ /** 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 );
+ /** 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 );
+ /** Seeks the stream forward by the passed number of bytes. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+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 ole
+} // namespace oox
+
+#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 000000000000..70dcd3913b9a
--- /dev/null
+++ b/include/oox/ole/vbamodule.hxx
@@ -0,0 +1,109 @@
+/* -*- 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 OOX_OLE_VBAMODULE_HXX
+#define OOX_OLE_VBAMODULE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com { namespace sun { namespace 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 {
+namespace ole {
+
+// ============================================================================
+
+class VbaModule
+{
+public:
+ explicit VbaModule(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const OUString& rName,
+ rtl_TextEncoding eTextEnc,
+ bool bExecutable );
+
+ /** Returns the module type (com.sun.star.script.ModuleType constant). */
+ inline sal_Int32 getType() const { return mnType; }
+ /** Sets the passed module type. */
+ inline void setType( sal_Int32 nType ) { mnType = nType; }
+
+ /** Returns the name of the module. */
+ inline const OUString& getName() const { return maName; }
+ /** Returns the stream name of the module. */
+ inline 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 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+ /** Creates an empty Basic module in the passed Basic library. */
+ void createEmptyModule(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+
+private:
+ /** Reads and returns the VBA source code from the passed storage. */
+ OUString readSourceCode( StorageBase& rVbaStrg ) const;
+
+ /** Creates a new Basic module and inserts it into the passed Basic library. */
+ void createModule(
+ const OUString& rVBASourceCode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ ::com::sun::star::uno::Reference< ::com::sun::star::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;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#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 000000000000..f742138756b5
--- /dev/null
+++ b/include/oox/ole/vbaproject.hxx
@@ -0,0 +1,206 @@
+/* -*- 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 OOX_OLE_VBAPROJECT_HXX
+#define OOX_OLE_VBAPROJECT_HXX
+
+#include <map>
+#include <com/sun/star/uno/XInterface.hpp>
+#include "oox/helper/refvector.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace document { class XEventsSupplier; }
+ namespace frame { class XModel; }
+ namespace script { class XLibraryContainer; }
+ namespace script { namespace vba { class XVBAMacroResolver; } }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox { class GraphicHelper; }
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC VbaFilterConfig
+{
+public:
+ explicit VbaFilterConfig(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& 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:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ mxConfigAccess;
+};
+
+// ============================================================================
+
+/** Base class for objects that attach a amcro 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( const OUString& rMacroName );
+ virtual ~VbaMacroAttacherBase();
+
+ /** Resolves the internal macro name to the related macro URL, and attaches
+ the macro to the object. */
+ void resolveAndAttachMacro(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::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 ::boost::shared_ptr< VbaMacroAttacherBase > VbaMacroAttacherRef;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC VbaProject : public VbaFilterConfig
+{
+public:
+ explicit VbaProject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const OUString& 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 bDefaultColorBgr = true );
+
+ bool importVbaProject(
+ StorageBase& rVbaPrjStrg );
+
+ /** Registers a macro atatcher object. For details, see description of the
+ VbaMacroAttacherBase class. */
+ void registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher );
+
+ /** Returns true, if the document contains at least one code module. */
+ bool hasModules() const;
+
+ /** Returns true, if the document contains at least one dialog. */
+ bool hasDialogs() const;
+
+ void setOleOverridesSink( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& 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();
+ /** Called when the import process of the VBA project is finished. */
+ virtual void finalizeImport();
+
+private:
+ VbaProject( const VbaProject& );
+ VbaProject& operator=( const VbaProject& );
+
+ /** Returns the Basic or dialog library container. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >
+ getLibraryContainer( sal_Int32 nPropId );
+ /** Opens a Basic or dialog library (creates missing if specified). */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ openLibrary( sal_Int32 nPropId, bool bCreateMissing );
+ /** Creates and returns the Basic library of the document used for import. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ createBasicLibrary();
+ /** Creates and returns the dialog library of the document used for import. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ createDialogLibrary();
+
+ /** Imports the VBA code modules and forms. */
+ void importVba(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr );
+
+ /** Attaches VBA macros to objects registered via registerMacroAttacher(). */
+ void attachMacros();
+
+ /** 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;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ mxDocModel; ///< Document model used to import/export the VBA project.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxBasicLib; ///< The Basic library of the document used for import.
+ ::com::sun::star::uno::Reference< ::com::sun::star::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.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxOleOverridesSink;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/animationspersist.hxx b/include/oox/ppt/animationspersist.hxx
new file mode 100644
index 000000000000..ba63991def2a
--- /dev/null
+++ b/include/oox/ppt/animationspersist.hxx
@@ -0,0 +1,126 @@
+/* -*- 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 OOX_PPT_ANIMATIONPERSIST
+#define OOX_PPT_ANIMATIONPERSIST
+
+#include <list>
+#include <boost/shared_ptr.hpp>
+#include <boost/array.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+namespace oox { namespace ppt {
+
+ enum {
+ NP_TO = 0,
+ NP_FROM, NP_BY, NP_USERDATA, NP_ATTRIBUTENAME,
+ NP_ACCELERATION, NP_AUTOREVERSE, NP_DECELERATE, NP_DURATION, NP_FILL,
+ NP_REPEATCOUNT, NP_REPEATDURATION, NP_RESTART,
+ NP_DIRECTION, NP_COLORINTERPOLATION, NP_CALCMODE, NP_TRANSFORMTYPE,
+ NP_PATH,
+ NP_ENDSYNC, NP_ITERATETYPE, NP_ITERATEINTERVAL,
+ NP_SUBITEM, NP_TARGET, NP_COMMAND, NP_PARAMETER,
+ NP_VALUES, NP_FORMULA, NP_KEYTIMES, NP_DISPLAY,
+ _NP_SIZE
+ };
+
+ typedef boost::array< ::com::sun::star::uno::Any, _NP_SIZE > NodePropertyMap;
+
+
+ /** data for CT_TLShapeTargetElement */
+ struct ShapeTargetElement
+ {
+ ShapeTargetElement()
+ : mnType( 0 )
+ {}
+ void convert( ::com::sun::star::uno::Any & aAny, sal_Int16 & rSubType ) const;
+
+ sal_Int32 mnType;
+ sal_Int32 mnRangeType;
+ drawingml::IndexRange maRange;
+ OUString msSubShapeId;
+ };
+
+
+ /** data for CT_TLTimeTargetElement */
+ struct AnimTargetElement
+ {
+ AnimTargetElement()
+ : mnType( 0 )
+ {}
+ /** convert to a set of properties */
+ ::com::sun::star::uno::Any convert(const SlidePersistPtr & pSlide, sal_Int16 & nSubType) const;
+
+ sal_Int32 mnType;
+ OUString msValue;
+
+ ShapeTargetElement maShapeTarget;
+ };
+
+ typedef boost::shared_ptr< AnimTargetElement > AnimTargetElementPtr;
+
+ struct AnimationCondition;
+
+ typedef ::std::list< AnimationCondition > AnimationConditionList;
+
+ /** data for CT_TLTimeCondition */
+ struct AnimationCondition
+ {
+ AnimationCondition()
+ : mnType( 0 )
+ {}
+
+ ::com::sun::star::uno::Any convert(const SlidePersistPtr & pSlide) const;
+ static ::com::sun::star::uno::Any convertList(const SlidePersistPtr & pSlide, const AnimationConditionList & l);
+
+ AnimTargetElementPtr & getTarget()
+ { if(!mpTarget) mpTarget.reset( new AnimTargetElement ); return mpTarget; }
+ ::com::sun::star::uno::Any maValue;
+ sal_Int32 mnType;
+ private:
+ AnimTargetElementPtr mpTarget;
+ };
+
+
+ struct TimeAnimationValue
+ {
+ OUString msFormula;
+ OUString msTime;
+ ::com::sun::star::uno::Any maValue;
+ };
+
+ typedef ::std::list< TimeAnimationValue > TimeAnimationValueList;
+
+} }
+
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/backgroundproperties.hxx b/include/oox/ppt/backgroundproperties.hxx
new file mode 100644
index 000000000000..05926d44b796
--- /dev/null
+++ b/include/oox/ppt/backgroundproperties.hxx
@@ -0,0 +1,44 @@
+/* -*- 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 OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX
+#define OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class BackgroundPropertiesContext : public ::oox::core::FragmentHandler2
+{
+public:
+ BackgroundPropertiesContext( ::oox::core::FragmentHandler2& rParent, ::oox::drawingml::FillProperties& rFillProperties );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+protected:
+ ::oox::drawingml::FillProperties& mrFillProperties;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/comments.hxx b/include/oox/ppt/comments.hxx
new file mode 100644
index 000000000000..1095cd0223db
--- /dev/null
+++ b/include/oox/ppt/comments.hxx
@@ -0,0 +1,139 @@
+/* -*- 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 OOX_PPT_COMMENTS_HXX
+#define OOX_PPT_COMMENTS_HXX
+
+#include <vector>
+#include <com/sun/star/util/DateTime.hpp>
+
+namespace oox { namespace ppt {
+
+struct CommentAuthor
+{
+ OUString clrIdx;
+ OUString id;
+ OUString initials;
+ OUString lastIdx;
+ OUString name;
+};
+
+class CommentAuthorList
+{
+ private:
+ std::vector<CommentAuthor> cmAuthorLst;
+
+ public:
+ void setValues(const CommentAuthorList& list);
+
+ const std::vector<CommentAuthor>& getCmAuthorLst() const
+ {
+ return cmAuthorLst;
+ }
+
+ void addAuthor(const CommentAuthor& _author)
+ {
+ cmAuthorLst.push_back(_author);
+ }
+
+ friend class Comment;
+};
+
+class Comment
+{
+ private:
+ OUString authorId;
+ OUString dt;
+ OUString idx;
+ OUString x;
+ OUString y;
+ OUString text;
+ ::com::sun::star::util::DateTime aDateTime;
+
+ void setDateTime (OUString datetime);
+
+ public:
+ void setAuthorId(const OUString& _aId)
+ {
+ authorId = _aId;
+ }
+ void setdt(const OUString& _dt)
+ {
+ dt=_dt;
+ setDateTime(_dt);
+ }
+ void setidx(const OUString& _idx)
+ {
+ idx=_idx;
+ }
+ void setPoint(const OUString& _x, const OUString& _y)
+ {
+ x=_x;
+ y=_y;
+ }
+ void setText(const OUString& _text)
+ {
+ text = _text;
+ }
+ OUString getAuthorId()
+ {
+ return authorId;
+ }
+ OUString getdt()
+ {
+ return dt;
+ }
+ OUString getidx()
+ {
+ return idx;
+ }
+ OUString get_X()
+ {
+ return x;
+ }
+ OUString get_Y()
+ {
+ return y;
+ }
+ OUString get_text()
+ {
+ return text;
+ }
+ ::com::sun::star::util::DateTime getDateTime()
+ {
+ return aDateTime;
+ }
+ sal_Int32 getIntX()
+ {
+ return x.toInt32();
+ }
+ sal_Int32 getIntY()
+ {
+ return y.toInt32();
+ }
+ OUString getAuthor ( const CommentAuthorList& list );
+};
+
+class CommentList
+{
+ public:
+ std::vector<Comment> cmLst;
+ int getSize ()
+ {
+ return (int)cmLst.size();
+ }
+ const Comment& getCommentAtIndex (int index);
+};
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/customshowlistcontext.hxx b/include/oox/ppt/customshowlistcontext.hxx
new file mode 100644
index 000000000000..ed913c8bbe2c
--- /dev/null
+++ b/include/oox/ppt/customshowlistcontext.hxx
@@ -0,0 +1,53 @@
+/* -*- 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 OOX_POWERPOINT_CUSTOMSHOWLISTCONTEXT_HXX
+#define OOX_POWERPOINT_CUSTOMSHOWLISTCONTEXT_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include <vector>
+
+namespace oox { namespace ppt {
+
+
+ struct CustomShow
+ {
+ OUString maName;
+ OUString mnId;
+ std::vector< OUString >maSldLst;
+ };
+
+ /** CT_ */
+ class CustomShowListContext : public ::oox::core::FragmentHandler2
+ {
+ std::vector< CustomShow >& mrCustomShowList;
+
+ public:
+ CustomShowListContext( ::oox::core::FragmentHandler2& rParent,
+ std::vector< CustomShow >& rCustomShowList );
+
+ ~CustomShowListContext( );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/dgmimport.hxx b/include/oox/ppt/dgmimport.hxx
new file mode 100644
index 000000000000..f369c5e526b8
--- /dev/null
+++ b/include/oox/ppt/dgmimport.hxx
@@ -0,0 +1,62 @@
+/* -*- 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 OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
+#define OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
+
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <oox/drawingml/theme.hxx>
+#include "oox/ppt/presentationfragmenthandler.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class QuickDiagrammingImport : public oox::core::XmlFilterBase
+{
+public:
+
+ QuickDiagrammingImport( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ // from FilterBase
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
+ virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
+
+ virtual oox::vml::Drawing* getVmlDrawing();
+ virtual oox::drawingml::chart::ChartConverter* getChartConverter();
+
+private:
+ virtual OUString implGetImplementationName() const;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/dgmlayout.hxx b/include/oox/ppt/dgmlayout.hxx
new file mode 100644
index 000000000000..bf964fe5d310
--- /dev/null
+++ b/include/oox/ppt/dgmlayout.hxx
@@ -0,0 +1,63 @@
+/* -*- 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 OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
+#define OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
+
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <oox/drawingml/theme.hxx>
+#include "oox/ppt/presentationfragmenthandler.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class QuickDiagrammingLayout : public oox::core::XmlFilterBase
+{
+public:
+
+ QuickDiagrammingLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ // from FilterBase
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
+ virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
+
+ virtual ::oox::vml::Drawing* getVmlDrawing();
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
+
+private:
+ virtual OUString implGetImplementationName() const;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
+ drawingml::ThemePtr mpThemePtr;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/headerfooter.hxx b/include/oox/ppt/headerfooter.hxx
new file mode 100644
index 000000000000..4d0a3cb65f1d
--- /dev/null
+++ b/include/oox/ppt/headerfooter.hxx
@@ -0,0 +1,45 @@
+/* -*- 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 OOX_PPT_HEADERFOOTER
+#define OOX_PPT_HEADERFOOTER
+
+#include <sal/types.h>
+
+namespace oox { namespace ppt {
+
+ struct HeaderFooter
+ {
+ sal_Bool mbSlideNumber;
+ sal_Bool mbHeader;
+ sal_Bool mbFooter;
+ sal_Bool mbDateTime;
+
+ HeaderFooter()
+ : mbSlideNumber( sal_True )
+ , mbHeader( sal_True )
+ , mbFooter( sal_True )
+ , mbDateTime( sal_True ) {};
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/layoutfragmenthandler.hxx b/include/oox/ppt/layoutfragmenthandler.hxx
new file mode 100644
index 000000000000..80983182b73d
--- /dev/null
+++ b/include/oox/ppt/layoutfragmenthandler.hxx
@@ -0,0 +1,42 @@
+/* -*- 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 OOX_PPT_LAYOUTFRAGMENTHANDLER
+#define OOX_PPT_LAYOUTFRAGMENTHANDLER
+
+#include "oox/ppt/slidefragmenthandler.hxx"
+
+#include <vector>
+
+namespace oox { namespace ppt {
+
+class LayoutFragmentHandler : public SlideFragmentHandler
+{
+public:
+ LayoutFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, SlidePersistPtr pMasterPersistPtr ) throw();
+ virtual ~LayoutFragmentHandler() throw();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+};
+
+} }
+
+#endif // OOX_PPT_LAYOUTFRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptgraphicshapecontext.hxx b/include/oox/ppt/pptgraphicshapecontext.hxx
new file mode 100644
index 000000000000..180098a67166
--- /dev/null
+++ b/include/oox/ppt/pptgraphicshapecontext.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 OOX_PPT_PPTGRAPHICSHAPECONTEXT_HXX
+#define OOX_PPT_PPTGRAPHICSHAPECONTEXT_HXX
+
+#include "oox/drawingml/graphicshapecontext.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTGraphicShapeContext : public ::oox::drawingml::GraphicShapeContext
+{
+ SlidePersistPtr mpSlidePersistPtr;
+
+public:
+ PPTGraphicShapeContext( ::oox::core::ContextHandler& rParent, const SlidePersistPtr pSlidePersistPtr, oox::drawingml::ShapePtr pMasterShapePtr, oox::drawingml::ShapePtr pShapePtr );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} }
+
+#endif // OOX_PPT_PPTGRAPHICSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptimport.hxx b/include/oox/ppt/pptimport.hxx
new file mode 100644
index 000000000000..035ea8cdc5c1
--- /dev/null
+++ b/include/oox/ppt/pptimport.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 OOX_POWERPOINT_POWERPOINTIMPORT_HXX
+#define OOX_POWERPOINT_POWERPOINTIMPORT_HXX
+
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <oox/drawingml/theme.hxx>
+#include "oox/ppt/presentationfragmenthandler.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class PowerPointImport : public oox::core::XmlFilterBase
+{
+public:
+
+ PowerPointImport( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ~PowerPointImport();
+
+ // from FilterBase
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
+ virtual ::oox::vml::Drawing* getVmlDrawing();
+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
+
+ void setActualSlidePersist( SlidePersistPtr pActualSlidePersist ){ mpActualSlidePersist = pActualSlidePersist; };
+ std::map< OUString, oox::drawingml::ThemePtr >& getThemes(){ return maThemes; };
+ std::vector< SlidePersistPtr >& getDrawPages(){ return maDrawPages; };
+ std::vector< SlidePersistPtr >& getMasterPages(){ return maMasterPages; };
+ std::vector< SlidePersistPtr >& getNotesPages(){ return maNotesPages; };
+
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+
+#if OSL_DEBUG_LEVEL > 0
+ static XmlFilterBase* mpDebugFilterBase;
+#endif
+
+private:
+ virtual GraphicHelper* implCreateGraphicHelper() const;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
+ virtual OUString implGetImplementationName() const;
+
+private:
+ OUString maTableStyleListPath;
+ oox::drawingml::table::TableStyleListPtr mpTableStyleList;
+
+ SlidePersistPtr mpActualSlidePersist;
+ std::map< OUString, oox::drawingml::ThemePtr > maThemes;
+
+ std::vector< SlidePersistPtr > maDrawPages;
+ std::vector< SlidePersistPtr > maMasterPages;
+ std::vector< SlidePersistPtr > maNotesPages;
+
+ ::boost::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_POWERPOINTIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx
new file mode 100644
index 000000000000..aa485adf9347
--- /dev/null
+++ b/include/oox/ppt/pptshape.hxx
@@ -0,0 +1,73 @@
+/* -*- 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 OOX_PPT_PRESENTATION_PPTSHAPE_HXX
+#define OOX_PPT_PRESENTATION_PPTSHAPE_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTShape : public oox::drawingml::Shape
+{
+ ShapeLocation meShapeLocation; // placeholdershapes (mnSubType != 0) on Master are never displayed
+ sal_Bool mbReferenced; // placeholdershapes on Layout are displayed only, if they are not referenced
+ // placeholdershapes on Slide are displayed always
+
+public:
+
+ PPTShape( const oox::ppt::ShapeLocation eShapeLocation,
+ const sal_Char* pServiceType = NULL );
+ virtual ~PPTShape();
+
+ using oox::drawingml::Shape::addShape;
+ // addShape is creating and inserting the corresponding XShape.
+ void addShape(
+ oox::core::XmlFilterBase& rFilterBase,
+ SlidePersist& rPersist,
+ const oox::drawingml::Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ basegfx::B2DHomMatrix& aTransformation,
+ const com::sun::star::awt::Rectangle* pShapeRect = 0,
+ ::oox::drawingml::ShapeIdMap* pShapeMap = 0 );
+
+ virtual void applyShapeReference( const oox::drawingml::Shape& rReferencedShape, bool bUseText = true );
+
+ void setShapeLocation( const oox::ppt::ShapeLocation eShapeLocation ) { meShapeLocation = eShapeLocation; };
+ ShapeLocation getShapeLocation() const { return meShapeLocation; };
+ sal_Bool isReferenced() const { return mbReferenced; };
+ void setReferenced( sal_Bool bReferenced ){ mbReferenced = bReferenced; };
+ void setPlaceholder( oox::drawingml::ShapePtr pPlaceholder ) { mpPlaceholder = pPlaceholder; }
+
+ static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly = false );
+ static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly = false );
+
+ static oox::drawingml::TextListStylePtr getSubTypeTextListStyle( const SlidePersist& rSlidePersist, sal_Int32 nSubType );
+
+protected:
+
+ oox::drawingml::ShapePtr mpPlaceholder;
+};
+
+} }
+
+#endif // OOX_PPT_PRESENTATION_PPTSHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshapecontext.hxx b/include/oox/ppt/pptshapecontext.hxx
new file mode 100644
index 000000000000..59e46b3d54b5
--- /dev/null
+++ b/include/oox/ppt/pptshapecontext.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 OOX_PPT_PPTSHAPECONTEXT_HXX
+#define OOX_PPT_PPTSHAPECONTEXT_HXX
+
+#include "oox/drawingml/shapecontext.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTShapeContext : public ::oox::drawingml::ShapeContext
+{
+ SlidePersistPtr mpSlidePersistPtr;
+
+public:
+ PPTShapeContext( ::oox::core::ContextHandler& rParent, const SlidePersistPtr pSlidePersistPtr, oox::drawingml::ShapePtr pMasterShapePtr, oox::drawingml::ShapePtr pShapePtr );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} }
+
+#endif // OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshapegroupcontext.hxx b/include/oox/ppt/pptshapegroupcontext.hxx
new file mode 100644
index 000000000000..c7e60c76e823
--- /dev/null
+++ b/include/oox/ppt/pptshapegroupcontext.hxx
@@ -0,0 +1,56 @@
+/* -*- 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 OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+#define OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+#include "oox/drawingml/shapegroupcontext.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTShapeGroupContext : public ::oox::drawingml::ShapeGroupContext
+{
+ SlidePersistPtr mpSlidePersistPtr;
+ ShapeLocation meShapeLocation;
+ oox::drawingml::ShapePtr pGraphicShape;
+ void importExtDrawings();
+
+public:
+ PPTShapeGroupContext(
+ ::oox::core::ContextHandler& rParent,
+ const oox::ppt::SlidePersistPtr pSlidePersistPtr,
+ const oox::ppt::ShapeLocation eShapeLocation,
+ oox::drawingml::ShapePtr pMasterShapePtr,
+ oox::drawingml::ShapePtr pGroupShapePtr );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+
+};
+
+} }
+
+#endif // OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshapepropertiescontext.hxx b/include/oox/ppt/pptshapepropertiescontext.hxx
new file mode 100644
index 000000000000..f979c6efd3db
--- /dev/null
+++ b/include/oox/ppt/pptshapepropertiescontext.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX
+#define OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX
+
+#include "oox/drawingml/shapepropertiescontext.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTShapePropertiesContext : public ::oox::drawingml::ShapePropertiesContext
+{
+public:
+ PPTShapePropertiesContext( ::oox::core::ContextHandler& rParent, ::oox::drawingml::Shape& rShape );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} }
+
+#endif // OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx
new file mode 100644
index 000000000000..ae26cb233e8c
--- /dev/null
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -0,0 +1,72 @@
+/* -*- 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 OOX_PPT_PRESENTATION_FRAGMENTHANDLER
+#define OOX_PPT_PRESENTATION_FRAGMENTHANDLER
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/core/fragmenthandler.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/core/relations.hxx"
+#include "oox/ppt/customshowlistcontext.hxx"
+#include "oox/ppt/comments.hxx"
+#include <stack>
+#include <vector>
+
+namespace oox { namespace ppt {
+
+class PresentationFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ PresentationFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath ) throw();
+ virtual ~PresentationFragmentHandler() throw();
+ virtual void finalizeImport();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+protected:
+ bool importSlide( const ::oox::core::FragmentHandlerRef& rxSlideFragmentHandler,
+ const oox::ppt::SlidePersistPtr pPersist );
+
+private:
+
+ void importSlide(sal_uInt32 nSlide, sal_Bool bFirstSlide, sal_Bool bImportNotes);
+
+ std::vector< OUString > maSlideMasterVector;
+ std::vector< OUString > maSlidesVector;
+ std::vector< OUString > maNotesMasterVector;
+ ::oox::drawingml::TextListStylePtr mpTextListStyle;
+
+ ::com::sun::star::awt::Size maSlideSize;
+ ::com::sun::star::awt::Size maNotesSize;
+
+ std::vector< CustomShow > maCustomShowList;
+
+ CommentAuthorList maAuthorList;
+ bool mbCommentAuthorsRead; // read commentAuthors.xml only once
+};
+
+} }
+
+#endif // OOX_PPT_PRESENTATION_FRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidefragmenthandler.hxx b/include/oox/ppt/slidefragmenthandler.hxx
new file mode 100644
index 000000000000..045f6ff1ccda
--- /dev/null
+++ b/include/oox/ppt/slidefragmenthandler.hxx
@@ -0,0 +1,60 @@
+/* -*- 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 OOX_PPT_SLIDEFRAGMENTHANDLER
+#define OOX_PPT_SLIDEFRAGMENTHANDLER
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include "oox/helper/propertymap.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+#include <stack>
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+class SlideFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ SlideFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, SlidePersistPtr pPersistPtr, const ShapeLocation eShapeLocation ) throw();
+ virtual ~SlideFragmentHandler() throw();
+
+ virtual void finalizeImport();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+
+ const ::std::vector< OUString>& getCharVector() { return maCharVector; }
+
+protected:
+ SlidePersistPtr mpSlidePersistPtr;
+ ShapeLocation meShapeLocation;
+
+private:
+ OUString maSlideName;
+ PropertyMap maSlideProperties;
+ ::std::vector< OUString> maCharVector; // handle char in OnCharacters
+};
+
+} }
+
+#endif // OOX_PPT_SLIDEFRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidemastertextstylescontext.hxx b/include/oox/ppt/slidemastertextstylescontext.hxx
new file mode 100644
index 000000000000..c1e9c1478ec6
--- /dev/null
+++ b/include/oox/ppt/slidemastertextstylescontext.hxx
@@ -0,0 +1,45 @@
+/* -*- 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 OOX_DRAWINGML_SLIDEMASTERTEXTSTYLESCONTEXT_HXX
+#define OOX_DRAWINGML_SLIDEMASTERTEXTSTYLESCONTEXT_HXX
+
+#include "oox/drawingml/theme.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+namespace oox { namespace ppt {
+
+class SlideMasterTextStylesContext : public oox::core::FragmentHandler2
+{
+public:
+ SlideMasterTextStylesContext( ::oox::core::FragmentHandler2& rParent, SlidePersistPtr pSlidePersistPtr );
+ ~SlideMasterTextStylesContext();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+protected:
+ SlidePersistPtr mpSlidePersistPtr;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SLIDEMASTERTEXTSTYLESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
new file mode 100644
index 000000000000..6f58d81813c3
--- /dev/null
+++ b/include/oox/ppt/slidepersist.hxx
@@ -0,0 +1,161 @@
+/* -*- 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 OOX_POWERPOINT_SLIDEPERSIST_HXX
+#define OOX_POWERPOINT_SLIDEPERSIST_HXX
+
+#include <boost/shared_ptr.hpp>
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/theme.hxx"
+#include "oox/drawingml/clrscheme.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+#include <oox/ppt/headerfooter.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include "oox/core/fragmenthandler.hxx"
+#include "oox/ppt/comments.hxx"
+
+#include <list>
+
+namespace oox { namespace vml { class Drawing; } }
+
+namespace oox { namespace ppt {
+
+enum ShapeLocation
+{
+ Master,
+ Layout,
+ Slide
+};
+
+// ---------------------------------------------------------------------
+class TimeNode;
+class SlidePersist;
+
+typedef boost::shared_ptr< SlidePersist > SlidePersistPtr;
+
+class SlidePersist : public boost::enable_shared_from_this< SlidePersist >
+{
+
+public:
+ SlidePersist( oox::core::XmlFilterBase& rFilter, sal_Bool bMaster, sal_Bool bNotes,
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >&,
+ oox::drawingml::ShapePtr pShapesPtr, const ::oox::drawingml::TextListStylePtr & );
+ ~SlidePersist();
+
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > getPage() const { return mxPage; };
+
+#if OSL_DEBUG_LEVEL > 0
+ static com::sun::star::uno::WeakReference< com::sun::star::drawing::XDrawPage > mxDebugPage;
+#endif
+
+ void setMasterPersist( SlidePersistPtr pMasterPersistPtr ){ mpMasterPagePtr = pMasterPersistPtr; }
+ SlidePersistPtr getMasterPersist() const { return mpMasterPagePtr; }
+
+ void setPath( const OUString& rPath ) { maPath = rPath; }
+ const OUString getPath() const { return maPath; }
+
+ void setLayoutPath( const OUString& rLayoutPath ) { maLayoutPath = rLayoutPath; }
+ const OUString getLayoutPath() const { return maLayoutPath; }
+
+ void setTheme( const oox::drawingml::ThemePtr pThemePtr ){ mpThemePtr = pThemePtr; }
+ oox::drawingml::ThemePtr getTheme() const { return mpThemePtr; }
+
+ void setClrScheme( const oox::drawingml::ClrSchemePtr pClrSchemePtr ){ mpClrSchemePtr = pClrSchemePtr; }
+ oox::drawingml::ClrSchemePtr getClrScheme() const { return mpClrSchemePtr; }
+
+ void setClrMap( const oox::drawingml::ClrMapPtr pClrMapPtr ){ mpClrMapPtr = pClrMapPtr; }
+ oox::drawingml::ClrMapPtr getClrMap() const { return mpClrMapPtr; }
+
+ void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr pFillPropertiesPtr ){ mpBackgroundPropertiesPtr = pFillPropertiesPtr; }
+ oox::drawingml::FillPropertiesPtr getBackgroundProperties() const { return mpBackgroundPropertiesPtr; }
+ oox::drawingml::Color& getBackgroundColor() { return maBackgroundColor; }
+
+ sal_Bool isMasterPage() const { return mbMaster; }
+ sal_Bool isNotesPage() const { return mbNotes; }
+
+ void setLayoutValueToken( sal_Int32 nLayoutValueToken ) { mnLayoutValueToken = nLayoutValueToken; }
+ short getLayoutFromValueToken();
+
+
+ oox::drawingml::TextListStylePtr getDefaultTextStyle() const { return maDefaultTextStylePtr; }
+ oox::drawingml::TextListStylePtr getTitleTextStyle() const { return maTitleTextStylePtr; }
+ oox::drawingml::TextListStylePtr getBodyTextStyle() const { return maBodyTextStylePtr; }
+ oox::drawingml::TextListStylePtr getNotesTextStyle() const { return maNotesTextStylePtr; }
+ oox::drawingml::TextListStylePtr getOtherTextStyle() const { return maOtherTextStylePtr; }
+
+ oox::drawingml::ShapePtr getShapes() { return maShapesPtr; }
+ void hideShapesAsMasterShapes();
+ ::std::list< boost::shared_ptr< TimeNode > >& getTimeNodeList() { return maTimeNodeList; }
+ oox::ppt::HeaderFooter& getHeaderFooter(){ return maHeaderFooter; };
+
+ oox::vml::Drawing* getDrawing() { return mpDrawingPtr.get(); }
+
+ void createXShapes( oox::core::XmlFilterBase& rFilterBase );
+ void createBackground( const oox::core::XmlFilterBase& rFilterBase );
+ void applyTextStyles( const oox::core::XmlFilterBase& rFilterBase );
+
+ std::map< OUString, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > >& getAnimNodesMap() { return maAnimNodesMap; };
+ ::oox::drawingml::ShapePtr getShape( const OUString & id ) { return maShapeMap[ id ]; }
+ ::oox::drawingml::ShapeIdMap& getShapeMap() { return maShapeMap; }
+
+ CommentList& getCommentsList() { return maCommentsList; }
+ CommentAuthorList& getCommentAuthors() { return maCommentAuthors; }
+
+private:
+ OUString maPath;
+ OUString maLayoutPath;
+ ::boost::shared_ptr< oox::vml::Drawing > mpDrawingPtr;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxPage;
+ oox::drawingml::ThemePtr mpThemePtr; // the theme that is used
+ oox::drawingml::ClrSchemePtr mpClrSchemePtr; // the local color scheme (if any)
+ oox::drawingml::ClrMapPtr mpClrMapPtr; // color mapping (if any)
+ SlidePersistPtr mpMasterPagePtr;
+
+ oox::drawingml::ShapePtr maShapesPtr;
+ oox::drawingml::Color maBackgroundColor;
+ oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr;
+ ::std::list< boost::shared_ptr< TimeNode > > maTimeNodeList;
+
+ oox::ppt::HeaderFooter maHeaderFooter;
+ sal_Int32 mnLayoutValueToken;
+ sal_Bool mbMaster;
+ sal_Bool mbNotes;
+
+ oox::drawingml::TextListStylePtr maDefaultTextStylePtr;
+ oox::drawingml::TextListStylePtr maTitleTextStylePtr;
+ oox::drawingml::TextListStylePtr maBodyTextStylePtr;
+ oox::drawingml::TextListStylePtr maNotesTextStylePtr;
+ oox::drawingml::TextListStylePtr maOtherTextStylePtr;
+
+ std::map< OUString, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > > maAnimNodesMap;
+ std::map< OUString, ::oox::drawingml::ShapePtr > maShapeMap;
+
+ // slide comments
+ CommentList maCommentsList;
+ CommentAuthorList maCommentAuthors;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_SLIDEPERSIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidetimingcontext.hxx b/include/oox/ppt/slidetimingcontext.hxx
new file mode 100644
index 000000000000..a50e8be60fd3
--- /dev/null
+++ b/include/oox/ppt/slidetimingcontext.hxx
@@ -0,0 +1,48 @@
+/* -*- 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 OOX_PPT_SLIDETIMINGCONTEXT
+#define OOX_PPT_SLIDETIMINGCONTEXT
+
+#include <com/sun/star/animations/XTimeContainer.hpp>
+#include "oox/ppt/timenode.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+
+#include <stack>
+#include <vector>
+
+namespace oox { namespace ppt {
+
+class SlideTimingContext : public ::oox::core::FragmentHandler2
+{
+public:
+ SlideTimingContext( ::oox::core::FragmentHandler2& rParent, TimeNodePtrList & aTimeNodeList ) throw();
+ virtual ~SlideTimingContext() throw();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+private:
+ TimeNodePtrList & maTimeNodeList;
+};
+
+} }
+
+#endif // OOX_PPT_SLIDETIMINGCONTEXT
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidetransition.hxx b/include/oox/ppt/slidetransition.hxx
new file mode 100644
index 000000000000..01f701d63dfe
--- /dev/null
+++ b/include/oox/ppt/slidetransition.hxx
@@ -0,0 +1,72 @@
+/* -*- 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 OOX_PPT_SLIDETRANSITION
+#define OOX_PPT_SLIDETRANSITION
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+
+namespace oox { class PropertyMap; }
+
+namespace oox { namespace ppt {
+
+ class SlideTransition
+ {
+ public:
+ SlideTransition();
+ explicit SlideTransition(const OUString & );
+
+ void setSlideProperties( PropertyMap& props );
+ void setTransitionFilterProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTransitionFilter > & xFilter );
+
+ void setOoxTransitionSpeed( sal_Int32 nToken );
+ void setFadeColor( sal_Int32 nColor )
+ { mnFadeColor = nColor; }
+ void setMode( sal_Bool bMode )
+ { mbMode = bMode; }
+ void setOoxAdvanceTime( sal_Int32 nAdvanceTime )
+ { mnAdvanceTime = nAdvanceTime; }
+
+ static sal_Int16 ooxToOdpDirection( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpEightDirections( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpCornerDirections( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpBorderDirections( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpSideDirections( ::sal_Int32 nOoxType );
+ static sal_Bool ooxToOdpSideDirectionsDirectionNormal( ::sal_Int32 nOoxType );
+
+ void setOoxTransitionType( ::sal_Int32 OoxType,
+ ::sal_Int32 param1, ::sal_Int32 param2 );
+ private:
+ ::sal_Int16 mnTransitionType;
+ ::sal_Int16 mnTransitionSubType;
+ ::sal_Bool mbTransitionDirectionNormal;
+ ::sal_Int16 mnAnimationSpeed;
+ ::sal_Int32 mnFadeColor;
+ ::sal_Bool mbMode; /**< http://api.libreoffice.org/docs/common/ref/com/sun/star/animations/XTransitionFilter.html Mode property */
+ ::sal_Int32 mnAdvanceTime;
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidetransitioncontext.hxx b/include/oox/ppt/slidetransitioncontext.hxx
new file mode 100644
index 000000000000..077d5a8f5813
--- /dev/null
+++ b/include/oox/ppt/slidetransitioncontext.hxx
@@ -0,0 +1,52 @@
+/* -*- 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 OOX_PPT_SLIDETRANSITIONCONTEXT
+#define OOX_PPT_SLIDETRANSITIONCONTEXT
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/ppt/slidetransition.hxx"
+
+namespace oox { class PropertyMap; }
+
+namespace oox { namespace ppt {
+
+ class SlideTransitionContext : public ::oox::core::FragmentHandler2
+ {
+ public:
+ SlideTransitionContext( ::oox::core::FragmentHandler2& rParent,
+ const AttributeList& rAttributes,
+ PropertyMap & aProperties ) throw();
+ virtual ~SlideTransitionContext() throw();
+
+ virtual void onEndElement();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+
+ private:
+ PropertyMap& maSlideProperties;
+ ::sal_Bool mbHasTransition;
+ SlideTransition maTransition;
+ };
+
+} }
+
+#endif // OOX_PPT_SLIDEFRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/soundactioncontext.hxx b/include/oox/ppt/soundactioncontext.hxx
new file mode 100644
index 000000000000..d1f1040c75ba
--- /dev/null
+++ b/include/oox/ppt/soundactioncontext.hxx
@@ -0,0 +1,55 @@
+/* -*- 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 OOX_PPT_SOUNDACTIONCONTEXT
+#define OOX_PPT_SOUNDACTIONCONTEXT
+
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox { class PropertyMap; }
+
+namespace oox { namespace ppt {
+
+class SoundActionContext : public ::oox::core::FragmentHandler2
+{
+public:
+ SoundActionContext( ::oox::core::FragmentHandler2& rParent, PropertyMap & aProperties ) throw();
+ virtual ~SoundActionContext() throw();
+
+ virtual void onEndElement();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+private:
+ PropertyMap& maSlideProperties;
+ bool mbHasStartSound;
+ bool mbLoopSound;
+ bool mbStopSound;
+ OUString msEmbedded;
+ OUString msLink;
+ OUString msSndName;
+};
+
+} }
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/timenode.hxx b/include/oox/ppt/timenode.hxx
new file mode 100644
index 000000000000..769cc0e03943
--- /dev/null
+++ b/include/oox/ppt/timenode.hxx
@@ -0,0 +1,128 @@
+/* -*- 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 OOX_DRAWINGML_TIMENODE_HXX
+#define OOX_DRAWINGML_TIMENODE_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+#include <list>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include "oox/helper/propertymap.hxx"
+#include "oox/ppt/slidetransition.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include "oox/ppt/animationspersist.hxx"
+#include "oox/ppt/timenode.hxx"
+
+namespace oox { namespace ppt {
+
+ class TimeNode;
+ class SlideTransition;
+
+ typedef boost::shared_ptr< TimeNode > TimeNodePtr;
+ typedef ::std::list< TimeNodePtr > TimeNodePtrList;
+
+ class TimeNode
+ {
+ public:
+ typedef ::std::map< OUString, ::com::sun::star::uno::Any > UserDataMap;
+
+ TimeNode( sal_Int16 nNodeType );
+ virtual ~TimeNode();
+
+ NodePropertyMap & getNodeProperties() { return maNodeProperties; }
+ UserDataMap & getUserData() { return maUserData; }
+ void addChild( const TimeNodePtr & pChildPtr )
+ { maChildren.push_back( pChildPtr ); }
+
+ TimeNodePtrList & getChildren()
+ { return maChildren; }
+
+ void setId( sal_Int32 nId );
+ const OUString & getId() const { return msId; }
+
+ void addNode(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode,
+ const SlidePersistPtr & slide);
+ // data setters
+ void setTo( const ::com::sun::star::uno::Any & aTo );
+ void setFrom( const ::com::sun::star::uno::Any & aFrom );
+ void setBy( const ::com::sun::star::uno::Any & aBy );
+ void setTransitionFilter( const SlideTransition & aTransition)
+ { maTransitionFilter = aTransition; }
+
+ void setNode(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
+ const SlidePersistPtr & pSlide );
+
+ AnimTargetElementPtr getTarget()
+ {
+ if( !mpTarget )
+ mpTarget.reset( new AnimTargetElement );
+ return mpTarget;
+ }
+
+ AnimationConditionList &getStartCondition()
+ { return maStCondList; }
+ AnimationConditionList &getEndCondition()
+ { return maEndCondList; }
+ AnimationConditionList &getNextCondition()
+ { return maNextCondList; }
+ AnimationConditionList &getPrevCondition()
+ { return maPrevCondList; }
+ AnimationCondition & getEndSyncValue()
+ { mbHasEndSyncValue = true; return maEndSyncValue; }
+ protected:
+
+ static OUString getServiceName( sal_Int16 nNodeType );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
+ createAndInsert(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rServiceName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode );
+
+ private:
+ const sal_Int16 mnNodeType;
+
+ TimeNodePtrList maChildren;
+
+ OUString msId;
+ NodePropertyMap maNodeProperties;
+ UserDataMap maUserData; // a sequence to be stored as "UserData" property
+ SlideTransition maTransitionFilter;
+ AnimTargetElementPtr mpTarget;
+ bool mbHasEndSyncValue; // set to true if we try to get the endSync.
+ AnimationCondition maEndSyncValue;
+ AnimationConditionList maStCondList, maEndCondList;
+ AnimationConditionList maPrevCondList, maNextCondList;
+ };
+
+} }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/timenodelistcontext.hxx b/include/oox/ppt/timenodelistcontext.hxx
new file mode 100644
index 000000000000..baacbc94add4
--- /dev/null
+++ b/include/oox/ppt/timenodelistcontext.hxx
@@ -0,0 +1,65 @@
+/* -*- 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 OOX_PPT_TIMENODELISTCONTEXT
+#define OOX_PPT_TIMENODELISTCONTEXT
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/ppt/timenode.hxx"
+
+#include <com/sun/star/animations/XTimeContainer.hpp>
+
+namespace oox { namespace ppt {
+
+
+ class TimeNodeContext : public ::oox::core::FragmentHandler2
+ {
+ public:
+ virtual ~TimeNodeContext() throw();
+
+ static TimeNodeContext * SAL_CALL makeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode );
+
+ protected:
+ TimeNodeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw();
+
+ sal_Int32 mnElement;
+ TimeNodePtr mpNode;
+ };
+
+
+
+/** FastParser context for XML_tnLst, XML_subTnLst and XML_childTnLst */
+class TimeNodeListContext : public ::oox::core::FragmentHandler2
+{
+public:
+ TimeNodeListContext( ::oox::core::FragmentHandler2& rParent, TimeNodePtrList & aList ) throw();
+
+ virtual ~TimeNodeListContext() throw();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+
+private:
+ TimeNodePtrList & maList;
+};
+
+} }
+
+#endif // OOX_PPT_SLIDEFRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/namespacemap.hxx b/include/oox/token/namespacemap.hxx
new file mode 100644
index 000000000000..78eeaa93cc40
--- /dev/null
+++ b/include/oox/token/namespacemap.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 OOX_TOKEN_NAMESPACEMAP_HXX
+#define OOX_TOKEN_NAMESPACEMAP_HXX
+
+#include <map>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
+
+namespace oox {
+
+// ============================================================================
+
+/** A map that contains all XML namespace URLs used in the filters. */
+struct NamespaceMap : public ::std::map< sal_Int32, OUString > { NamespaceMap(); };
+
+/** Thread-save singleton of a map of all supported XML namespace URLs. */
+struct StaticNamespaceMap : public ::rtl::Static< NamespaceMap, StaticNamespaceMap > {};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/propertynames.hxx b/include/oox/token/propertynames.hxx
new file mode 100644
index 000000000000..931eaed0172b
--- /dev/null
+++ b/include/oox/token/propertynames.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 OOX_TOKEN_PROPERTYNAMES_HXX
+#define OOX_TOKEN_PROPERTYNAMES_HXX
+
+#include <vector>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
+
+namespace oox {
+
+// ============================================================================
+
+/** A vector that contains all predefined property names used in the filters. */
+struct PropertyNameVector : public ::std::vector< OUString > { PropertyNameVector(); };
+
+/** Thread-save singleton of a vector of all supported property names. */
+struct StaticPropertyNameVector : public ::rtl::Static< PropertyNameVector, StaticPropertyNameVector > {};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx
new file mode 100644
index 000000000000..84dc70d03fac
--- /dev/null
+++ b/include/oox/token/tokenmap.hxx
@@ -0,0 +1,73 @@
+/* -*- 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 OOX_TOKEN_TOKENMAP_HXX
+#define OOX_TOKEN_TOKENMAP_HXX
+
+#include <vector>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace oox {
+
+// ============================================================================
+
+class TokenMap
+{
+public:
+ explicit TokenMap();
+ ~TokenMap();
+
+ /** Returns the Unicode name of the passed token identifier. */
+ OUString getUnicodeTokenName( sal_Int32 nToken ) const;
+
+ /** Returns the token identifier for the passed Unicode token name. */
+ sal_Int32 getTokenFromUnicode( const OUString& rUnicodeName ) const;
+
+ /** Returns the UTF8 name of the passed token identifier as byte sequence. */
+ ::com::sun::star::uno::Sequence< sal_Int8 >
+ getUtf8TokenName( sal_Int32 nToken ) const;
+
+ /** Returns the token identifier for the passed UTF8 token name. */
+ sal_Int32 getTokenFromUtf8(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rUtf8Name ) const;
+
+private:
+ struct TokenName
+ {
+ OUString maUniName;
+ ::com::sun::star::uno::Sequence< sal_Int8 > maUtf8Name;
+ };
+ typedef ::std::vector< TokenName > TokenNameVector;
+
+ TokenNameVector maTokenNames;
+};
+
+// ============================================================================
+
+struct StaticTokenMap : public ::rtl::Static< TokenMap, StaticTokenMap > {};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmldrawing.hxx b/include/oox/vml/vmldrawing.hxx
new file mode 100644
index 000000000000..ad7790962366
--- /dev/null
+++ b/include/oox/vml/vmldrawing.hxx
@@ -0,0 +1,213 @@
+/* -*- 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 OOX_VML_VMLDRAWING_HXX
+#define OOX_VML_VMLDRAWING_HXX
+
+#include <map>
+#include <memory>
+#include <vector>
+#include <oox/ole/axcontrol.hxx>
+#include <oox/ole/oleobjecthelper.hxx>
+#include <oox/vml/vmlshapecontainer.hxx>
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Rectangle; }
+ namespace awt { class XControlModel; }
+ namespace drawing { class XDrawPage; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox {
+ namespace core { class XmlFilterBase; }
+ namespace ole { class EmbeddedControl; }
+}
+
+namespace oox {
+namespace vml {
+
+class ShapeBase;
+struct ClientData;
+
+// ============================================================================
+
+/** Enumerates different types of VML drawings. */
+enum DrawingType
+{
+ VMLDRAWING_WORD, ///< Word: One shape per drawing.
+ VMLDRAWING_EXCEL, ///< Excel: OLE objects are part of VML.
+ VMLDRAWING_POWERPOINT ///< PowerPoint: OLE objects are part of DrawingML.
+};
+
+// ============================================================================
+
+/** Contains information about an OLE object embedded in a draw page. */
+struct OOX_DLLPUBLIC OleObjectInfo : public ::oox::ole::OleObjectInfo
+{
+ OUString maShapeId; ///< Shape identifier for shape lookup.
+ OUString maName; ///< Programmatical name of the OLE object.
+ bool mbAutoLoad;
+ const bool mbDmlShape; ///< True = DrawingML shape (PowerPoint), false = VML shape (Excel/Word).
+
+ explicit OleObjectInfo( bool bDmlShape = false );
+
+ /** Sets the string representation of the passed numeric shape identifier. */
+ void setShapeId( sal_Int32 nShapeId );
+};
+
+// =========================================/===================================
+
+/** Contains information about a form control embedded in a draw page. */
+struct OOX_DLLPUBLIC ControlInfo
+{
+ OUString maShapeId; ///< Shape identifier for shape lookup.
+ OUString maFragmentPath; ///< Path to the fragment describing the form control properties.
+ OUString maName; ///< Programmatical name of the form control.
+
+ explicit ControlInfo();
+
+ /** Sets the string representation of the passed numeric shape identifier. */
+ void setShapeId( sal_Int32 nShapeId );
+};
+
+// ============================================================================
+
+/** Represents the collection of VML shapes for a complete draw page. */
+class OOX_DLLPUBLIC Drawing
+{
+public:
+ explicit Drawing(
+ ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
+ DrawingType eType );
+
+ virtual ~Drawing();
+
+ /** Returns the filter object that imports/exports this VML drawing. */
+ inline ::oox::core::XmlFilterBase& getFilter() const { return mrFilter; }
+ /** Returns the application type containing the drawing. */
+ inline DrawingType getType() const { return meType; }
+ /** Returns read/write access to the container of shapes and templates. */
+ inline ShapeContainer& getShapes() { return *mxShapes; }
+ /** Returns read access to the container of shapes and templates. */
+ inline const ShapeContainer& getShapes() const { return *mxShapes; }
+ /** Returns the form object used to process ActiveX form controls. */
+ ::oox::ole::EmbeddedForm& getControlForm() const;
+
+ /** Registers a block of shape identifiers reserved by this drawing. Block
+ size is 1024, shape identifiers are one-based (block 1 => 1025-2048). */
+ void registerBlockId( sal_Int32 nBlockId );
+ /** Registers the passed embedded OLE object. The related shape will then
+ load the OLE object data from the specified fragment. */
+ void registerOleObject( const OleObjectInfo& rOleObject );
+ /** Registers the passed embedded form control. The related shape will then
+ load the control properties from the specified fragment. */
+ void registerControl( const ControlInfo& rControl );
+
+ /** Final processing after import of the fragment. */
+ void finalizeFragmentImport();
+
+ /** Creates and inserts all UNO shapes into the draw page. The virtual
+ function notifyXShapeInserted() will be called for each new shape. */
+ void convertAndInsert() const;
+
+ /** Returns the local shape index from the passed global shape identifier. */
+ sal_Int32 getLocalShapeIndex( const OUString& rShapeId ) const;
+ /** Returns the registered info structure for an OLE object, if extant. */
+ const OleObjectInfo* getOleObjectInfo( const OUString& rShapeId ) const;
+ /** Returns the registered info structure for a form control, if extant. */
+ const ControlInfo* getControlInfo( const OUString& rShapeId ) const;
+
+ /** Creates a new UNO shape object, inserts it into the passed UNO shape
+ container, and sets the shape position and size. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertXShape(
+ const OUString& rService,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+ /** Creates a new UNO shape object for a form control, inserts the control
+ model into the form, and the shape into the passed UNO shape container. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertXControlShape(
+ const ::oox::ole::EmbeddedControl& rControl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect,
+ sal_Int32& rnCtrlIndex ) const;
+
+ /** Derived classes may disable conversion of specific shapes. */
+ virtual bool isShapeSupported( const ShapeBase& rShape ) const;
+
+ /** Derived classes may return additional base names for automatic shape
+ name creation. */
+ virtual OUString getShapeBaseName( const ShapeBase& rShape ) const;
+
+ /** Derived classes may calculate the shape rectangle from a non-standard
+ anchor information string. */
+ virtual bool convertClientAnchor(
+ ::com::sun::star::awt::Rectangle& orShapeRect,
+ const OUString& rShapeAnchor ) const;
+
+ /** Derived classes create a UNO shape according to the passed shape model.
+ Called for shape models that specify being under host control. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertClientXShape(
+ const ShapeBase& rShape,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+ /** Derived classes may want to know that a UNO shape has been inserted.
+ Will be called from the convertAndInsert() implementation.
+ @param bGroupChild True = inserted into a group shape,
+ false = inserted directly into this drawing. */
+ virtual void notifyXShapeInserted(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ const ::com::sun::star::awt::Rectangle& rShapeRect,
+ const ShapeBase& rShape, bool bGroupChild );
+
+private:
+ typedef ::std::vector< sal_Int32 > BlockIdVector;
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ typedef ::std::auto_ptr< ::oox::ole::EmbeddedForm > EmbeddedFormPtr;
+ typedef ::std::auto_ptr< ShapeContainer > ShapeContainerPtr;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ typedef ::std::map< OUString, OleObjectInfo > OleObjectInfoMap;
+ typedef ::std::map< OUString, ControlInfo > ControlInfoMap;
+
+ ::oox::core::XmlFilterBase& mrFilter; ///< Filter object that imports/exports the VML drawing.
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
+ mxDrawPage; ///< UNO draw page used to insert the shapes.
+ mutable EmbeddedFormPtr mxCtrlForm; ///< The control form used to process embedded controls.
+ mutable BlockIdVector maBlockIds; ///< Block identifiers used by this drawing.
+ ShapeContainerPtr mxShapes; ///< All shapes and shape templates.
+ OleObjectInfoMap maOleObjects; ///< Info about all embedded OLE objects, mapped by shape id.
+ ControlInfoMap maControls; ///< Info about all embedded form controls, mapped by control name.
+ const DrawingType meType; ///< Application type containing the drawing.
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmldrawingfragment.hxx b/include/oox/vml/vmldrawingfragment.hxx
new file mode 100644
index 000000000000..f0947998a092
--- /dev/null
+++ b/include/oox/vml/vmldrawingfragment.hxx
@@ -0,0 +1,60 @@
+/* -*- 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 OOX_VML_VMLDRAWINGFRAGMENT_HXX
+#define OOX_VML_VMLDRAWINGFRAGMENT_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace vml {
+
+class Drawing;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC DrawingFragment : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit DrawingFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ Drawing& rDrawing );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openFragmentStream() const;
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+ virtual void finalizeImport();
+
+private:
+ Drawing& mrDrawing;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx
new file mode 100644
index 000000000000..79fa38009e4d
--- /dev/null
+++ b/include/oox/vml/vmlformatting.hxx
@@ -0,0 +1,248 @@
+/* -*- 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 OOX_VML_VMLFORMATTING_HXX
+#define OOX_VML_VMLFORMATTING_HXX
+
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+
+#include <vector>
+
+namespace oox {
+ class GraphicHelper;
+ namespace drawingml { class Color; }
+ namespace drawingml { class ShapePropertyMap; }
+}
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+typedef ::std::pair< sal_Int32, sal_Int32 > Int32Pair;
+typedef ::std::pair< double, double > DoublePair;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ConversionHelper
+{
+public:
+ /** Returns two values contained in rValue separated by cSep.
+ */
+ static bool separatePair(
+ OUString& orValue1, OUString& orValue2,
+ const OUString& rValue, sal_Unicode cSep );
+
+ /** Returns the boolean value from the passed string of a VML attribute.
+ Supported values: 'f', 't', 'false', 'true'. False for anything else.
+ */
+ static bool decodeBool( const OUString& rValue );
+
+ /** Converts the passed VML percentage measure string to a normalized
+ floating-point value.
+
+ @param rValue The VML percentage value. This is a floating-point value
+ with optional following '%' or 'f' sign. If the sign is missing, the
+ floating point value will be returned unmodified. If the '%' sign
+ is present, the value will be divided by 100. If the 'f' sign is present,
+ the value will be divided by 65536.
+ */
+ static double decodePercent(
+ const OUString& rValue,
+ double fDefValue );
+
+ /** Converts the passed VML measure string to EMU (English Metric Units).
+
+ @param rGraphicHelper The graphic helper needed to perform pixel
+ conversion according to the current output device.
+
+ @param rValue The VML measure value. This is a floating-point value
+ with optional measure string following the value.
+
+ @param nRefValue Reference value needed for percentage measure.
+
+ @param bPixelX Set to true if the value is oriented horizontally (e.g.
+ X coordinates, widths). Set to false if the value is oriented
+ vertically (e.g. Y coordinates, heights). This is needed because
+ output devices may specify different width and height for a pixel.
+
+ @param bDefaultAsPixel Set to true if omitted measure unit means
+ pixel. Set to false if omitted measure unit means EMU.
+ */
+ static sal_Int64 decodeMeasureToEmu(
+ const GraphicHelper& rGraphicHelper,
+ const OUString& rValue,
+ sal_Int32 nRefValue,
+ bool bPixelX,
+ bool bDefaultAsPixel );
+
+ /** Converts the passed VML measure string to 1/100 mm.
+
+ @param rGraphicHelper See above.
+ @param rValue See above.
+ @param nRefValue See above.
+ @param bPixelX See above.
+ @param bDefaultAsPixel See above.
+ */
+ static sal_Int32 decodeMeasureToHmm(
+ const GraphicHelper& rGraphicHelper,
+ const OUString& rValue,
+ sal_Int32 nRefValue,
+ bool bPixelX,
+ bool bDefaultAsPixel );
+
+ /** Converts VML color attributes to a DrawingML color.
+
+ @param roVmlColor The VML string representation of the color. If
+ existing, this can be a 3-digit or 6-digit hexadecimal RGB value
+ with leading '#' character, a predefined color name (e.g. 'black',
+ 'red', etc.), the index into an application defined color palette
+ in brackets with leading color name (e.g. 'red [9]' or
+ 'windowColor [64]'), or a color modifier used in one-color
+ gradients (e.g. 'fill darken(128)' or 'fill lighten(0)').
+
+ @param roVmlOpacity The opacity of the color. If existing, this should
+ be a floating-point value in the range [0.0;1.0].
+
+ @param nDefaultRgb Deafult RGB color used if the parameter roVmlColor
+ is empty.
+
+ @param nPrimaryRgb If set to something else than API_RGB_TRANSPARENT,
+ specifies the color to be used to resolve the color modifiers used
+ in one-color gradients.
+
+ @return The resulting DrawingML color.
+ */
+ static ::oox::drawingml::Color decodeColor(
+ const GraphicHelper& rGraphicHelper,
+ const OptValue< OUString >& roVmlColor,
+ const OptValue< double >& roVmlOpacity,
+ sal_Int32 nDefaultRgb,
+ sal_Int32 nPrimaryRgb = API_RGB_TRANSPARENT );
+
+ /** Converts VML path string into point and flag vectors.
+
+ @param rPoints The point vector to fill with coordinates.
+
+ @param rFlags The flag vector to fill. PolygonFlags_NORMAL indicates
+ a corresponding plain shape coordinate in rPoints and
+ PolygonFlags_CONTROL indicates a bezier curve control point.
+
+ @param rPath The VML path string.
+
+ @param rGraphicHelper See above.
+ */
+ static void decodeVmlPath(
+ ::std::vector< ::std::vector< ::com::sun::star::awt::Point > >& rPoints,
+ ::std::vector< ::std::vector< ::com::sun::star::drawing::PolygonFlags > >& rFlags,
+ const OUString& rPath );
+
+private:
+ ConversionHelper();
+ ~ConversionHelper();
+};
+
+// ============================================================================
+
+/** The stroke arrow model structure contains all properties for an line end arrow. */
+struct StrokeArrowModel
+{
+ OptValue< sal_Int32 > moArrowType;
+ OptValue< sal_Int32 > moArrowWidth;
+ OptValue< sal_Int32 > moArrowLength;
+
+ void assignUsed( const StrokeArrowModel& rSource );
+};
+
+// ============================================================================
+
+/** The stroke model structure contains all shape border properties. */
+struct StrokeModel
+{
+ OptValue< bool > moStroked; ///< Shape border line on/off.
+ StrokeArrowModel maStartArrow; ///< Start line arrow style.
+ StrokeArrowModel maEndArrow; ///< End line arrow style.
+ OptValue< OUString > moColor; ///< Solid line color.
+ OptValue< double > moOpacity; ///< Solid line color opacity.
+ OptValue< OUString > moWeight; ///< Line width.
+ OptValue< OUString > moDashStyle; ///< Line dash (predefined or manually).
+ OptValue< sal_Int32 > moLineStyle; ///< Line style (single, double, ...).
+ OptValue< sal_Int32 > moEndCap; ///< Type of line end cap.
+ OptValue< sal_Int32 > moJoinStyle; ///< Type of line join.
+
+ void assignUsed( const StrokeModel& rSource );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ::oox::drawingml::ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper ) const;
+};
+
+// ============================================================================
+
+/** The fill model structure contains all shape fill properties. */
+struct OOX_DLLPUBLIC FillModel
+{
+ OptValue< bool > moFilled; ///< Shape fill on/off.
+ OptValue< OUString > moColor; ///< Solid fill color.
+ OptValue< double > moOpacity; ///< Solid fill color opacity.
+ OptValue< OUString > moColor2; ///< End color of gradient.
+ OptValue< double > moOpacity2; ///< End color opacity of gradient.
+ OptValue< sal_Int32 > moType; ///< Fill type.
+ OptValue< sal_Int32 > moAngle; ///< Gradient rotation angle.
+ OptValue< double > moFocus; ///< Linear gradient focus of second color.
+ OptValue< DoublePair > moFocusPos; ///< Rectangular gradient focus position of second color.
+ OptValue< DoublePair > moFocusSize; ///< Rectangular gradient focus size of second color.
+ OptValue< OUString > moBitmapPath; ///< Path to fill bitmap fragment.
+ OptValue< bool > moRotate; ///< True = rotate gradient/bitmap with shape.
+
+ void assignUsed( const FillModel& rSource );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ::oox::drawingml::ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper ) const;
+};
+
+// ============================================================================
+
+/** The shadow model structure contains all shape shadow properties. */
+struct OOX_DLLPUBLIC ShadowModel
+{
+ bool mbHasShadow; ///< Is a v:shadow element seen?
+ OptValue<bool> moShadowOn; ///< Is the element turned on?
+ OptValue<OUString> moColor; ///< Specifies the color of the shadow.
+ OptValue<OUString> moOffset; ///< Specifies the shadow's offset from the shape's location.
+ OptValue<double> moOpacity; ///< Specifies the opacity of the shadow.
+
+ ShadowModel();
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const;
+};
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlinputstream.hxx b/include/oox/vml/vmlinputstream.hxx
new file mode 100644
index 000000000000..7c8e13160722
--- /dev/null
+++ b/include/oox/vml/vmlinputstream.hxx
@@ -0,0 +1,98 @@
+/* -*- 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 OOX_VML_VMLINPUTSTREAM_HXX
+#define OOX_VML_VMLINPUTSTREAM_HXX
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/string.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XTextInputStream2; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper1< ::com::sun::star::io::XInputStream > InputStream_BASE;
+
+/** An input stream class for VML streams, implementing the UNO interface
+ com.sun.star.io.XInputStream needed by the Expat XML parsers.
+
+ This stream reads the data from the input stream passed to the constructor,
+ and parses all XML elements for features unsupported by the current Expat
+ XML parser:
+
+ 1) All elements that have the form '<![inst]>' where 'inst' is any string
+ not containing the characters '<' and '>' are stripped from the input
+ stream.
+
+ 2) Multiple occurences of the same attribute in an element but the last
+ are removed.
+
+ 3) Line breaks represented by a single <br> element (without matching
+ </br> element) are replaced by a literal LF character.
+ */
+class InputStream : public InputStream_BASE
+{
+public:
+ explicit InputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm );
+ virtual ~InputStream();
+
+ virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead )
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead )
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available()
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL closeInput()
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ void updateBuffer() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ OString readToElementBegin() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ OString readToElementEnd() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream2 >
+ mxTextStrm;
+ ::com::sun::star::uno::Sequence< sal_Unicode > maOpeningBracket;
+ ::com::sun::star::uno::Sequence< sal_Unicode > maClosingBracket;
+ const OString maOpeningCData;
+ const OString maClosingCData;
+ OString maBuffer;
+ sal_Int32 mnBufferPos;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
new file mode 100644
index 000000000000..7b6a4a9376c7
--- /dev/null
+++ b/include/oox/vml/vmlshape.hxx
@@ -0,0 +1,439 @@
+/* -*- 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 OOX_VML_VMLSHAPE_HXX
+#define OOX_VML_VMLSHAPE_HXX
+
+#include <memory>
+#include <vector>
+#include <com/sun/star/awt/Point.hpp>
+#include "oox/vml/vmlformatting.hxx"
+#include "oox/vml/vmltextbox.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Rectangle; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox {
+namespace vml {
+
+class Drawing;
+struct ShapeParentAnchor;
+class ShapeContainer;
+
+// ============================================================================
+
+const sal_Int32 VML_CLIENTDATA_UNCHECKED = 0;
+const sal_Int32 VML_CLIENTDATA_CHECKED = 1;
+const sal_Int32 VML_CLIENTDATA_MIXED = 2;
+
+const sal_Int32 VML_CLIENTDATA_TEXT = 0;
+const sal_Int32 VML_CLIENTDATA_INTEGER = 1;
+const sal_Int32 VML_CLIENTDATA_NUMBER = 2;
+const sal_Int32 VML_CLIENTDATA_REFERENCE = 3;
+const sal_Int32 VML_CLIENTDATA_FORMULA = 4;
+
+// ============================================================================
+
+/** The shape model structure contains all properties shared by all types of shapes. */
+struct OOX_DLLPUBLIC ShapeTypeModel
+{
+ OUString maShapeId; ///< Unique identifier of the shape.
+ OUString maShapeName; ///< Name of the shape, if present.
+ OptValue< sal_Int32 > moShapeType; ///< Builtin shape type identifier.
+
+ OptValue< Int32Pair > moCoordPos; ///< Top-left position of coordinate system for children scaling.
+ OptValue< Int32Pair > moCoordSize; ///< Size of coordinate system for children scaling.
+ OUString maPosition; ///< Position type of the shape.
+ OUString maLeft; ///< X position of the shape bounding box (number with unit).
+ OUString maTop; ///< Y position of the shape bounding box (number with unit).
+ OUString maWidth; ///< Width of the shape bounding box (number with unit).
+ OUString maHeight; ///< Height of the shape bounding box (number with unit).
+ OUString maMarginLeft; ///< X position of the shape bounding box to shape anchor (number with unit).
+ OUString maMarginTop; ///< Y position of the shape bounding box to shape anchor (number with unit).
+ OUString maPositionHorizontalRelative; ///< The X position is relative to this.
+ OUString maPositionVerticalRelative; ///< The Y position is relative to this.
+ OUString maPositionHorizontal; ///< The X position orientation (default: absolute).
+ OUString maPositionVertical; ///< The Y position orientation.
+ OUString maWidthPercent; ///< The width in percents of the WidthRelative
+ OUString maHeightPercent; ///< The height in percents of the HeightRelative
+ OUString maWidthRelative; ///< To what the width is relative
+ OUString maHeightRelative; ///< To what the height is relative
+ OUString maRotation; ///< Rotation of the shape, in degrees.
+ OUString maFlip; ///< Flip type of the shape (can be "x" or "y").
+ sal_Bool mbAutoHeight; ///< If true, the height value is a minimum value (mostly used for textboxes)
+ sal_Bool mbVisible; ///< Visible or Hidden
+ OUString maWrapStyle; ///< Wrapping mode for text.
+ OUString maArcsize; ///< round rectangles arc size
+
+ StrokeModel maStrokeModel; ///< Border line formatting.
+ FillModel maFillModel; ///< Shape fill formatting.
+ ShadowModel maShadowModel; ///< Shape shadow formatting.
+
+ OptValue< OUString > moGraphicPath; ///< Path to a graphic for this shape.
+ OptValue< OUString > moGraphicTitle; ///< Title of the graphic.
+ OptValue< OUString > moWrapAnchorX; ///< The base object from which our horizontal positioning should be calculated.
+ OptValue< OUString > moWrapAnchorY; ///< The base object from which our vertical positioning should be calculated.
+
+ explicit ShapeTypeModel();
+
+ void assignUsed( const ShapeTypeModel& rSource );
+};
+
+// ----------------------------------------------------------------------------
+
+/** A shape template contains all formatting properties of shapes and can serve
+ as templates for several shapes in a drawing. */
+class ShapeType
+{
+public:
+ explicit ShapeType( Drawing& rDrawing );
+ virtual ~ShapeType();
+
+ /** Returns read/write access to the shape template model structure. */
+ inline ShapeTypeModel& getTypeModel() { return maTypeModel; }
+ /** Returns read access to the shape template model structure. */
+ inline const ShapeTypeModel& getTypeModel() const { return maTypeModel; }
+
+ /** Returns the shape identifier (which is unique through the containing drawing). */
+ inline const OUString& getShapeId() const { return maTypeModel.maShapeId; }
+ /** Returns the application defined shape type. */
+ sal_Int32 getShapeType() const;
+ /** Returns the fragment path to the embedded graphic used by this shape. */
+ OUString getGraphicPath() const;
+
+ const Drawing& getDrawing() const { return mrDrawing; }
+
+protected:
+ /** Returns the coordinate system of this shape. */
+ ::com::sun::star::awt::Rectangle getCoordSystem() const;
+ /** Returns the absolute shape rectangle according to the passed anchor. */
+ ::com::sun::star::awt::Rectangle getRectangle( const ShapeParentAnchor* pParentAnchor ) const;
+ /** Returns the absolute shape rectangle. */
+ virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const;
+ /** Returns the rectangle relative to the parent coordinate system. */
+ virtual ::com::sun::star::awt::Rectangle getRelRectangle() const;
+
+protected:
+ Drawing& mrDrawing; ///< The VML drawing page that contains this shape.
+ ShapeTypeModel maTypeModel; ///< The model structure containing shape type data.
+};
+
+// ============================================================================
+
+/** Excel specific shape client data (such as cell anchor). */
+struct ClientData
+{
+ OUString maAnchor; ///< Cell anchor as comma-separated string.
+ OUString maFmlaMacro; ///< Link to macro associated to the control.
+ OUString maFmlaPict; ///< Target cell range of picture links.
+ OUString maFmlaLink; ///< Link to value cell associated to the control.
+ OUString maFmlaRange; ///< Link to cell range used as data source for the control.
+ OUString maFmlaGroup; ///< Link to value cell associated to a group of option buttons.
+ sal_Int32 mnObjType; ///< Type of the shape.
+ sal_Int32 mnTextHAlign; ///< Horizontal text alignment.
+ sal_Int32 mnTextVAlign; ///< Vertical text alignment.
+ sal_Int32 mnCol; ///< Column index for spreadsheet cell note.
+ sal_Int32 mnRow; ///< Row index for spreadsheet cell note.
+ sal_Int32 mnChecked; ///< State for checkboxes and option buttons.
+ sal_Int32 mnDropStyle; ///< Drop down box style (read-only or editable).
+ sal_Int32 mnDropLines; ///< Number of lines in drop down box.
+ sal_Int32 mnVal; ///< Current value of spin buttons and scroll bars.
+ sal_Int32 mnMin; ///< Minimum value of spin buttons and scroll bars.
+ sal_Int32 mnMax; ///< Maximum value of spin buttons and scroll bars.
+ sal_Int32 mnInc; ///< Small increment of spin buttons and scroll bars.
+ sal_Int32 mnPage; ///< Large increment of spin buttons and scroll bars.
+ sal_Int32 mnSelType; ///< Listbox selection type.
+ sal_Int32 mnVTEdit; ///< Data type of the textbox.
+ bool mbPrintObject; ///< True = print the object.
+ bool mbVisible; ///< True = cell note is visible.
+ bool mbDde; ///< True = object is linked through DDE.
+ bool mbNo3D; ///< True = flat style, false = 3D style.
+ bool mbNo3D2; ///< True = flat style, false = 3D style (listboxes and dropdowns).
+ bool mbMultiLine; ///< True = textbox allows line breaks.
+ bool mbVScroll; ///< True = textbox has a vertical scrollbar.
+ bool mbSecretEdit; ///< True = textbox is a password edit field.
+
+ explicit ClientData();
+};
+
+// ----------------------------------------------------------------------------
+
+struct ShapeModel
+{
+ typedef ::std::vector< ::com::sun::star::awt::Point > PointVector;
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ typedef ::std::auto_ptr< TextBox > TextBoxPtr;
+ typedef ::std::auto_ptr< ClientData > ClientDataPtr;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ OUString maType; ///< Shape template with default properties.
+ PointVector maPoints; ///< Points for the polyline shape.
+ TextBoxPtr mxTextBox; ///< Text contents and properties.
+ ClientDataPtr mxClientData; ///< Excel specific client data.
+ OUString maLegacyDiagramPath;///< Legacy Diagram Fragment Path
+ OUString maFrom; ///< Start point for line shape.
+ OUString maTo; ///< End point for line shape.
+ OUString maControl1; ///< Bezier control point 1
+ OUString maControl2; ///< Bezier control point 2
+ OUString maVmlPath; ///< VML path for this shape
+
+ explicit ShapeModel();
+ ~ShapeModel();
+
+ /** Creates and returns a new shape textbox structure. */
+ TextBox& createTextBox(ShapeTypeModel& rModel);
+ /** Creates and returns a new shape client data structure. */
+ ClientData& createClientData();
+};
+
+// ----------------------------------------------------------------------------
+
+/** A shape object that is part of a drawing. May inherit properties from a
+ shape template. */
+class OOX_DLLPUBLIC ShapeBase : public ShapeType
+{
+public:
+ /** Returns read/write access to the shape model structure. */
+ inline ShapeModel& getShapeModel() { return maShapeModel; }
+ /** Returns read access to the shape model structure. */
+ inline const ShapeModel& getShapeModel() const { return maShapeModel; }
+
+ /** Returns read access to the shape textbox. */
+ inline const TextBox* getTextBox() const { return maShapeModel.mxTextBox.get(); }
+ /** Returns read access to the shape client data structure. */
+ inline const ClientData* getClientData() const { return maShapeModel.mxClientData.get(); }
+
+ /** Final processing after import of the drawing fragment. */
+ virtual void finalizeFragmentImport();
+
+ /** Returns the real shape name if existing, or a generated shape name. */
+ OUString getShapeName() const;
+
+ /** Returns the shape template with the passed identifier from the child shapes. */
+ virtual const ShapeType* getChildTypeById( const OUString& rShapeId ) const;
+ /** Returns the shape with the passed identifier from the child shapes. */
+ virtual const ShapeBase* getChildById( const OUString& rShapeId ) const;
+
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ convertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ShapeParentAnchor* pParentAnchor = 0 ) const;
+
+ /** Converts position and formatting into the passed existing XShape. */
+ void convertFormatting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ const ShapeParentAnchor* pParentAnchor = 0 ) const;
+
+protected:
+ explicit ShapeBase( Drawing& rDrawing );
+
+ /** Derived classes create the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const = 0;
+
+ /** Calculates the final shape rectangle according to the passed anchor,
+ if present, otherwise according to the own anchor settings. */
+ ::com::sun::star::awt::Rectangle calcShapeRectangle(
+ const ShapeParentAnchor* pParentAnchor ) const;
+
+ /** Converts common shape properties such as formatting attributes. */
+ void convertShapeProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape ) const;
+
+protected:
+ ShapeModel maShapeModel; ///< The model structure containing shape data.
+};
+
+// ============================================================================
+
+/** A simple shape object based on a specific UNO shape service. */
+class SimpleShape : public ShapeBase
+{
+public:
+ explicit SimpleShape( Drawing& rDrawing, const OUString& rService );
+
+ void setService( OUString aService ) { maService = aService; }
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+ /** Used by both RectangleShape and ComplexShape. */
+ com::sun::star::uno::Reference<com::sun::star::drawing::XShape>createPictureObject(
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rxShapes,
+ const com::sun::star::awt::Rectangle& rShapeRect, OUString& rGraphicPath ) const;
+
+private:
+ OUString maService; ///< Name of the UNO shape service.
+};
+
+// ============================================================================
+
+/** A rectangular shape object. */
+class RectangleShape : public SimpleShape
+{
+public:
+ explicit RectangleShape( Drawing& rDrawing );
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual com::sun::star::uno::Reference<com::sun::star::drawing::XShape>
+ implConvertAndInsert(
+ const com::sun::star::uno::Reference<com::sun::star::drawing::XShapes>& rxShapes,
+ const com::sun::star::awt::Rectangle& rShapeRect) const;
+};
+
+// ============================================================================
+
+/** An oval shape object. */
+class EllipseShape : public SimpleShape
+{
+public:
+ explicit EllipseShape( Drawing& rDrawing );
+};
+
+// ============================================================================
+
+/** A polygon shape object. */
+class PolyLineShape : public SimpleShape
+{
+public:
+ explicit PolyLineShape( Drawing& rDrawing );
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+/** A Line shape object. */
+class LineShape : public SimpleShape
+{
+public:
+ explicit LineShape( Drawing& rDrawing );
+
+protected:
+ /** Returns the absolute shape rectangle. */
+ virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const SAL_OVERRIDE;
+ /** Returns the rectangle relative to the parent coordinate system. */
+ virtual ::com::sun::star::awt::Rectangle getRelRectangle() const SAL_OVERRIDE;
+};
+
+/** Bezier shape object that supports to, from, control1 and control2
+ attribute or path attribute specification */
+class BezierShape : public SimpleShape
+{
+public:
+ explicit BezierShape( Drawing& rDrawing );
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+// ============================================================================
+
+/** A shape object with custom geometry. */
+class CustomShape : public SimpleShape
+{
+public:
+ explicit CustomShape( Drawing& rDrawing );
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+// ============================================================================
+
+/** A complex shape object. This can be a picture shape, a custom shape, an OLE
+ object, or an ActiveX form control. */
+class ComplexShape : public CustomShape
+{
+public:
+ explicit ComplexShape( Drawing& rDrawing );
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+// ============================================================================
+
+/** A group shape that extends the basic shape by a container of child shapes. */
+class GroupShape : public ShapeBase
+{
+public:
+ explicit GroupShape( Drawing& rDrawing );
+ virtual ~GroupShape();
+
+ /** Returns read/write access to the container of child shapes and templates. */
+ inline ShapeContainer& getChildren() { return *mxChildren; }
+ /** Returns read access to the container of child shapes and templates. */
+ inline const ShapeContainer& getChildren() const { return *mxChildren; }
+
+ /** Final processing after import of the drawing fragment. */
+ virtual void finalizeFragmentImport();
+
+ /** Returns the shape template with the passed identifier from the child shapes. */
+ virtual const ShapeType* getChildTypeById( const OUString& rShapeId ) const;
+ /** Returns the shape with the passed identifier from the child shapes. */
+ virtual const ShapeBase* getChildById( const OUString& rShapeId ) const;
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+private:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ typedef ::std::auto_ptr< ShapeContainer > ShapeContainerPtr;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ ShapeContainerPtr mxChildren; ///< Shapes and templates that are part of this group.
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlshapecontainer.hxx b/include/oox/vml/vmlshapecontainer.hxx
new file mode 100644
index 000000000000..5e6a2c2a9d75
--- /dev/null
+++ b/include/oox/vml/vmlshapecontainer.hxx
@@ -0,0 +1,153 @@
+/* -*- 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 OOX_VML_VMLSHAPECONTAINER_HXX
+#define OOX_VML_VMLSHAPECONTAINER_HXX
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
+#include <stack>
+
+namespace com { namespace sun { namespace star {
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox {
+namespace vml {
+
+class Drawing;
+class ShapeType;
+class ShapeBase;
+
+// ============================================================================
+
+struct ShapeParentAnchor
+{
+ ::com::sun::star::awt::Rectangle maShapeRect;
+ ::com::sun::star::awt::Rectangle maCoordSys;
+};
+
+// ============================================================================
+
+/** Container that holds a list of shapes and shape templates. */
+class ShapeContainer
+{
+public:
+ explicit ShapeContainer( Drawing& rDrawing );
+ ~ShapeContainer();
+
+ /** Returns the drawing this shape container is part of. */
+ inline Drawing& getDrawing() { return mrDrawing; }
+
+ /** Creates and returns a new shape template object. */
+ ShapeType& createShapeType();
+ /** Creates and returns a new shape object of the specified type. */
+ template< typename ShapeT >
+ ShapeT& createShape();
+
+ /** Final processing after import of the drawing fragment. */
+ void finalizeFragmentImport();
+
+ /** Returns true, if this container does not contain any shapes. */
+ inline bool empty() const { return maShapes.empty(); }
+
+ /** Returns the shape template with the passed identifier.
+ @param bDeep True = searches in all group shapes too. */
+ const ShapeType* getShapeTypeById( const OUString& rShapeId, bool bDeep ) const;
+ /** Returns the shape with the passed identifier.
+ @param bDeep True = searches in all group shapes too. */
+ const ShapeBase* getShapeById( const OUString& rShapeId, bool bDeep ) const;
+
+ /** Searches for a shape type by using the passed functor that takes a
+ constant reference of a ShapeType object. */
+ template< typename Functor >
+ const ShapeType* findShapeType( const Functor& rFunctor ) const;
+ /** Searches for a shape by using the passed functor that takes a constant
+ reference of a ShapeBase object. */
+ template< typename Functor >
+ const ShapeBase* findShape( const Functor& rFunctor ) const;
+
+ /**
+ (Word only) Returns the last shape in the collection, if it is after the last
+ mark from pushMark(), and removes it.
+ */
+ boost::shared_ptr< ShapeBase > takeLastShape();
+ /**
+ Adds a recursion mark to the stack. It is possible that a shape contains <w:txbxContent>
+ which contains another shape, and writerfilter needs to know which shape is from the inner
+ ooxml context and which from the outer ooxml context, while it is necessary to keep
+ at least shape types across such blocks. Therefore this function marks beginning
+ of each shape xml block, and takeLastShape() returns only shapes from this block.
+ */
+ void pushMark();
+ /**
+ Removes a recursion mark.
+ */
+ void popMark();
+
+ /** Creates and inserts all UNO shapes into the passed container. */
+ void convertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ShapeParentAnchor* pParentAnchor = 0 ) const;
+
+private:
+ typedef RefVector< ShapeType > ShapeTypeVector;
+ typedef RefVector< ShapeBase > ShapeVector;
+ typedef RefMap< OUString, ShapeType > ShapeTypeMap;
+ typedef RefMap< OUString, ShapeBase > ShapeMap;
+
+ Drawing& mrDrawing; ///< The VML drawing page that contains this shape.
+ ShapeTypeVector maTypes; ///< All shape templates.
+ ShapeVector maShapes; ///< All shape definitions.
+ ShapeTypeMap maTypesById; ///< All shape templates mapped by identifier.
+ ShapeMap maShapesById; ///< All shape definitions mapped by identifier.
+ std::stack< size_t > markStack; ///< Recursion marks from pushMark()/popMark().
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename ShapeT >
+ShapeT& ShapeContainer::createShape()
+{
+ ::boost::shared_ptr< ShapeT > xShape( new ShapeT( mrDrawing ) );
+ maShapes.push_back( xShape );
+ return *xShape;
+}
+
+template< typename Functor >
+const ShapeType* ShapeContainer::findShapeType( const Functor& rFunctor ) const
+{
+ return maTypes.findIf( rFunctor ).get();
+}
+
+template< typename Functor >
+const ShapeBase* ShapeContainer::findShape( const Functor& rFunctor ) const
+{
+ return maShapes.findIf( rFunctor ).get();
+}
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlshapecontext.hxx b/include/oox/vml/vmlshapecontext.hxx
new file mode 100644
index 000000000000..803674088e37
--- /dev/null
+++ b/include/oox/vml/vmlshapecontext.hxx
@@ -0,0 +1,188 @@
+/* -*- 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 OOX_VML_VMLSHAPECONTEXT_HXX
+#define OOX_VML_VMLSHAPECONTEXT_HXX
+
+#include "oox/core/contexthandler2.hxx"
+
+namespace oox {
+namespace vml {
+
+class Drawing;
+
+struct ShapeTypeModel;
+class ShapeType;
+
+struct ClientData;
+struct ShapeModel;
+class ShapeBase;
+class GroupShape;
+class RectangleShape;
+
+class ShapeContainer;
+
+// ============================================================================
+
+class ShapeLayoutContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit ShapeLayoutContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ Drawing& rDrawing );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ Drawing& mrDrawing;
+};
+
+// ============================================================================
+
+class ClientDataContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit ClientDataContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ ClientData& rClientData,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+private:
+ ClientData& mrClientData;
+ OUString maElementText;
+};
+
+// ============================================================================
+
+class ShapeContextBase : public ::oox::core::ContextHandler2
+{
+public:
+ static ::oox::core::ContextHandlerRef
+ createShapeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ ShapeContainer& rShapes,
+ sal_Int32 nElement,
+ const AttributeList& rAttribs );
+
+protected:
+ explicit ShapeContextBase( ::oox::core::ContextHandler2Helper& rParent );
+};
+
+// ============================================================================
+
+class ShapeTypeContext : public ShapeContextBase
+{
+public:
+ explicit ShapeTypeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ ShapeType& rShapeType,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ /** Processes the 'style' attribute. */
+ void setStyle( const OUString& rStyle );
+
+ /** Resolve a relation identifier to a fragment path. */
+ OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
+
+private:
+ ShapeTypeModel& mrTypeModel;
+};
+
+// ============================================================================
+
+class ShapeContext : public ShapeTypeContext
+{
+public:
+ explicit ShapeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ ShapeBase& rShape,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ /** Processes the 'points' attribute. */
+ void setPoints( const OUString& rPoints );
+ /** Processes the 'from' attribute. */
+ void setFrom( const OUString& rPoints );
+ /** Processes the 'to' attribute. */
+ void setTo( const OUString& rPoints );
+ /** Processes the 'control1' attribute. */
+ void setControl1( const OUString& rPoints );
+ /** Processes the 'control2' attribute. */
+ void setControl2( const OUString& rPoints );
+ /** Processes the 'path' attribute. */
+ void setVmlPath( const OUString& rPath );
+
+protected:
+ ShapeBase& mrShape;
+
+private:
+ ShapeModel& mrShapeModel;
+};
+
+// ============================================================================
+
+class GroupShapeContext : public ShapeContext
+{
+public:
+ explicit GroupShapeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ GroupShape& rShape,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ ShapeContainer& mrShapes;
+};
+
+// ============================================================================
+
+class RectangleShapeContext : public ShapeContext
+{
+public:
+ explicit RectangleShapeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ const AttributeList& rAttribs,
+ RectangleShape& rShape );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx
new file mode 100644
index 000000000000..4975e6bb26b6
--- /dev/null
+++ b/include/oox/vml/vmltextbox.hxx
@@ -0,0 +1,104 @@
+/* -*- 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 OOX_VML_VMLTEXTBOX_HXX
+#define OOX_VML_VMLTEXTBOX_HXX
+
+#include <vector>
+#include <rtl/ustring.hxx>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star {
+ namespace drawing { class XShape; }
+} } }
+
+namespace oox {
+namespace vml {
+
+struct ShapeTypeModel;
+
+// ============================================================================
+
+/** Font settings for a text portion in a textbox. */
+struct OOX_DLLPUBLIC TextFontModel
+{
+ OptValue< OUString > moName; ///< Font name.
+ OptValue< OUString > moColor; ///< Font color, HTML encoded, sort of.
+ OptValue< sal_Int32 > monSize; ///< Font size in twips.
+ OptValue< sal_Int32 > monUnderline; ///< Single or double underline.
+ OptValue< sal_Int32 > monEscapement; ///< Subscript or superscript.
+ OptValue< bool > mobBold;
+ OptValue< bool > mobItalic;
+ OptValue< bool > mobStrikeout;
+
+ explicit TextFontModel();
+};
+
+// ============================================================================
+
+/** A text portion in a textbox with the same formatting for all characters. */
+struct TextPortionModel
+{
+ TextFontModel maFont;
+ OUString maText;
+
+ explicit TextPortionModel( const TextFontModel& rFont, const OUString& rText );
+};
+
+// ============================================================================
+
+/** The textbox contains all text contents and properties. */
+class OOX_DLLPUBLIC TextBox
+{
+public:
+ explicit TextBox(ShapeTypeModel& rTypeModel);
+
+ /** Appends a new text portion to the textbox. */
+ void appendPortion( const TextFontModel& rFont, const OUString& rText );
+
+ /** Returns the current number of text portions. */
+ inline size_t getPortionCount() const { return maPortions.size(); }
+ /** Returns the font settings of the first text portion. */
+ const TextFontModel* getFirstFont() const;
+ /** Returns the entire text of all text portions. */
+ OUString getText() const;
+ void convert(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xShape) const;
+
+ ShapeTypeModel& mrTypeModel;
+ /// Text distance from the border (inset attribute of v:textbox), valid only if set.
+ bool borderDistanceSet;
+ int borderDistanceLeft, borderDistanceTop, borderDistanceRight, borderDistanceBottom;
+ OUString maLayoutFlow;
+
+private:
+ typedef ::std::vector< TextPortionModel > PortionVector;
+
+ PortionVector maPortions;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmltextboxcontext.hxx b/include/oox/vml/vmltextboxcontext.hxx
new file mode 100644
index 000000000000..47d71ac41b41
--- /dev/null
+++ b/include/oox/vml/vmltextboxcontext.hxx
@@ -0,0 +1,78 @@
+/* -*- 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 OOX_VML_VMLTEXTBOXCONTEXT_HXX
+#define OOX_VML_VMLTEXTBOXCONTEXT_HXX
+
+#include "oox/core/contexthandler2.hxx"
+#include "oox/vml/vmltextbox.hxx"
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+class TextPortionContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit TextPortionContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ TextBox& rTextBox,
+ const TextFontModel& rParentFont,
+ sal_Int32 nElement,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onStartElement(const AttributeList& rAttribs);
+ virtual void onEndElement();
+
+private:
+ TextBox& mrTextBox;
+ TextFontModel maFont;
+ size_t mnInitialPortions;
+};
+
+// ============================================================================
+
+class TextBoxContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit TextBoxContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ TextBox& rTextBox,
+ const AttributeList& rAttribs,
+ const GraphicHelper& graphicHelper );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ TextBox& mrTextBox;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */