diff options
author | Noel Power <noel.power@novell.com> | 2012-03-16 12:28:31 +0000 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-03-16 12:31:01 +0000 |
commit | 8ada1cd2846e5e60ad63250c68ddea3a9356546f (patch) | |
tree | 574efba318e00e132f56b7b800ce04f547d2fa92 /oox/inc | |
parent | 8f29699cd1723bd8b8acc25033708f9777576d6d (diff) |
move excel related oox bits to sc
Diffstat (limited to 'oox/inc')
94 files changed, 107 insertions, 13209 deletions
diff --git a/oox/inc/oox/core/binarycodec.hxx b/oox/inc/oox/core/binarycodec.hxx index c182877e0541..e57868555431 100644 --- a/oox/inc/oox/core/binarycodec.hxx +++ b/oox/inc/oox/core/binarycodec.hxx @@ -34,6 +34,7 @@ #include <rtl/cipher.h> #include <rtl/digest.h> +#include "oox/dllapi.h" namespace oox { class AttributeList; } @@ -42,7 +43,7 @@ namespace core { // ============================================================================ -class CodecHelper +class OOX_DLLPUBLIC CodecHelper { public: /** Returns the password hash if it is in the required 16-bit limit. */ @@ -60,7 +61,7 @@ private: Implements a simple XOR encoding/decoding algorithm used in MS Office versions up to MSO 95. */ -class BinaryCodec_XOR +class OOX_DLLPUBLIC BinaryCodec_XOR { public: /** Enumerates codec types supported by this XOR codec implementation. */ @@ -186,7 +187,7 @@ private: Implementation is based on the wvDecrypt package by Caolan McNamara: http://www.csn.ul.ie/~caolan/docs/wvDecrypt.html */ -class BinaryCodec_RCF +class OOX_DLLPUBLIC BinaryCodec_RCF { public: /** Default constructor. diff --git a/oox/inc/oox/core/binaryfilterbase.hxx b/oox/inc/oox/core/binaryfilterbase.hxx index 77d747bbdd77..566452582a46 100644 --- a/oox/inc/oox/core/binaryfilterbase.hxx +++ b/oox/inc/oox/core/binaryfilterbase.hxx @@ -37,7 +37,7 @@ namespace core { // ============================================================================ -class BinaryFilterBase : public FilterBase +class OOX_DLLPUBLIC BinaryFilterBase : public FilterBase { public: explicit BinaryFilterBase( diff --git a/oox/inc/oox/core/contexthandler.hxx b/oox/inc/oox/core/contexthandler.hxx index 94a095b22c0c..f0562ec2b50d 100644 --- a/oox/inc/oox/core/contexthandler.hxx +++ b/oox/inc/oox/core/contexthandler.hxx @@ -35,6 +35,7 @@ #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; } } @@ -60,7 +61,7 @@ typedef ::boost::shared_ptr< FragmentBaseData > FragmentBaseDataRef; typedef ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler > ContextHandler_BASE; -class ContextHandler : public ContextHandler_BASE +class OOX_DLLPUBLIC ContextHandler : public ContextHandler_BASE { public: explicit ContextHandler( const ContextHandler& rParent ); diff --git a/oox/inc/oox/core/contexthandler2.hxx b/oox/inc/oox/core/contexthandler2.hxx index 96121ebe6bc7..af412c236aea 100644 --- a/oox/inc/oox/core/contexthandler2.hxx +++ b/oox/inc/oox/core/contexthandler2.hxx @@ -34,6 +34,7 @@ #include "oox/helper/attributelist.hxx" #include "oox/helper/binaryinputstream.hxx" #include "oox/core/contexthandler.hxx" +#include "oox/dllapi.h" namespace oox { namespace core { @@ -69,7 +70,7 @@ struct ElementInfo; and implEndRecord() functions of this helper. Again, this is implemented already in the classes ContextHandler2 and FragmentHandler2. */ -class ContextHandler2Helper +class OOX_DLLPUBLIC ContextHandler2Helper { public: explicit ContextHandler2Helper( bool bEnableTrimSpace ); @@ -219,7 +220,7 @@ private: // ============================================================================ -class ContextHandler2 : public ContextHandler, public ContextHandler2Helper +class OOX_DLLPUBLIC ContextHandler2 : public ContextHandler, public ContextHandler2Helper { public: explicit ContextHandler2( ContextHandler2Helper& rParent ); diff --git a/oox/inc/oox/core/fragmenthandler.hxx b/oox/inc/oox/core/fragmenthandler.hxx index 05c645396c84..ca71a308feb2 100644 --- a/oox/inc/oox/core/fragmenthandler.hxx +++ b/oox/inc/oox/core/fragmenthandler.hxx @@ -33,6 +33,7 @@ #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; } @@ -84,7 +85,7 @@ struct RecordInfo typedef ::cppu::ImplInheritanceHelper1< ContextHandler, ::com::sun::star::xml::sax::XFastDocumentHandler > FragmentHandler_BASE; -class FragmentHandler : public FragmentHandler_BASE +class OOX_DLLPUBLIC FragmentHandler : public FragmentHandler_BASE { public: explicit FragmentHandler( XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath ); diff --git a/oox/inc/oox/core/fragmenthandler2.hxx b/oox/inc/oox/core/fragmenthandler2.hxx index f129444453f0..781ed855a282 100644 --- a/oox/inc/oox/core/fragmenthandler2.hxx +++ b/oox/inc/oox/core/fragmenthandler2.hxx @@ -32,13 +32,14 @@ #include "oox/core/contexthandler2.hxx" #include "oox/core/fragmenthandler.hxx" #include <vector> +#include "oox/dllapi.h" namespace oox { namespace core { // ============================================================================ -class FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper +class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper { private: enum MCE_STATE diff --git a/oox/inc/oox/core/relations.hxx b/oox/inc/oox/core/relations.hxx index 1b504f04c949..e7d558b044ed 100644 --- a/oox/inc/oox/core/relations.hxx +++ b/oox/inc/oox/core/relations.hxx @@ -32,6 +32,7 @@ #include <map> #include <boost/shared_ptr.hpp> #include "oox/helper/helper.hxx" +#include "oox/dllapi.h" namespace oox { namespace core { @@ -70,7 +71,7 @@ struct Relation class Relations; typedef ::boost::shared_ptr< Relations > RelationsRef; -class Relations : public ::std::map< ::rtl::OUString, Relation > +class OOX_DLLPUBLIC Relations : public ::std::map< ::rtl::OUString, Relation > { public: explicit Relations( const ::rtl::OUString& rFragmentPath ); diff --git a/oox/inc/oox/drawingml/clrscheme.hxx b/oox/inc/oox/drawingml/clrscheme.hxx index 73af9c1ac351..0c74436adb7b 100644 --- a/oox/inc/oox/drawingml/clrscheme.hxx +++ b/oox/inc/oox/drawingml/clrscheme.hxx @@ -33,6 +33,7 @@ #include <map> #include <vector> #include "oox/drawingml/color.hxx" +#include "oox/dllapi.h" namespace oox { namespace drawingml { @@ -48,7 +49,7 @@ public: typedef boost::shared_ptr< ClrMap > ClrMapPtr; -class ClrScheme +class OOX_DLLPUBLIC ClrScheme { std::map < sal_Int32, sal_Int32 > maClrScheme; diff --git a/oox/inc/oox/drawingml/color.hxx b/oox/inc/oox/drawingml/color.hxx index 62767ad7f803..7021d7a368fd 100644 --- a/oox/inc/oox/drawingml/color.hxx +++ b/oox/inc/oox/drawingml/color.hxx @@ -35,6 +35,7 @@ #include <rtl/instance.hxx> #include <rtl/ustring.hxx> #include "oox/helper/helper.hxx" +#include "oox/dllapi.h" namespace oox { class GraphicHelper; } @@ -43,7 +44,7 @@ namespace drawingml { // ============================================================================ -class Color +class OOX_DLLPUBLIC Color { public: Color(); diff --git a/oox/inc/oox/drawingml/connectorshapecontext.hxx b/oox/inc/oox/drawingml/connectorshapecontext.hxx index e98f1a4d9a38..6cd9c2c58312 100644 --- a/oox/inc/oox/drawingml/connectorshapecontext.hxx +++ b/oox/inc/oox/drawingml/connectorshapecontext.hxx @@ -31,10 +31,11 @@ #include "oox/drawingml/shape.hxx" #include "oox/drawingml/shapecontext.hxx" +#include "oox/dllapi.h" namespace oox { namespace drawingml { -class ConnectorShapeContext : public ShapeContext +class OOX_DLLPUBLIC ConnectorShapeContext : public ShapeContext { public: ConnectorShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr ); diff --git a/oox/inc/oox/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx index b528eaeb4cb5..dd30edf61e64 100644 --- a/oox/inc/oox/drawingml/fillproperties.hxx +++ b/oox/inc/oox/drawingml/fillproperties.hxx @@ -109,7 +109,7 @@ struct BlipFillProperties // ============================================================================ -struct FillProperties +struct OOX_DLLPUBLIC FillProperties { OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token). Color maFillColor; /// Solid fill color and transparence. diff --git a/oox/inc/oox/drawingml/graphicshapecontext.hxx b/oox/inc/oox/drawingml/graphicshapecontext.hxx index 0abfbaa12af6..719dba522857 100644 --- a/oox/inc/oox/drawingml/graphicshapecontext.hxx +++ b/oox/inc/oox/drawingml/graphicshapecontext.hxx @@ -31,12 +31,13 @@ #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 GraphicShapeContext : public ShapeContext +class OOX_DLLPUBLIC GraphicShapeContext : public ShapeContext { public: GraphicShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr ); @@ -47,7 +48,7 @@ public: // ==================================================================== -class GraphicalObjectFrameContext : public ShapeContext +class OOX_DLLPUBLIC GraphicalObjectFrameContext : public ShapeContext { public: GraphicalObjectFrameContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart ); diff --git a/oox/inc/oox/drawingml/lineproperties.hxx b/oox/inc/oox/drawingml/lineproperties.hxx index 8de222d27b40..0aaee3de1b87 100644 --- a/oox/inc/oox/drawingml/lineproperties.hxx +++ b/oox/inc/oox/drawingml/lineproperties.hxx @@ -48,7 +48,7 @@ struct LineArrowProperties // ============================================================================ -struct LineProperties +struct OOX_DLLPUBLIC LineProperties { typedef ::std::pair< sal_Int32, sal_Int32 > DashStop; typedef ::std::vector< DashStop > DashStopVector; diff --git a/oox/inc/oox/drawingml/linepropertiescontext.hxx b/oox/inc/oox/drawingml/linepropertiescontext.hxx index 445c47d7d7a8..b30d63111518 100644 --- a/oox/inc/oox/drawingml/linepropertiescontext.hxx +++ b/oox/inc/oox/drawingml/linepropertiescontext.hxx @@ -30,6 +30,7 @@ #define OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX #include "oox/core/contexthandler.hxx" +#include "oox/dllapi.h" namespace oox { namespace drawingml { @@ -37,7 +38,7 @@ namespace oox { namespace drawingml { struct LineProperties; -class LinePropertiesContext : public ::oox::core::ContextHandler +class OOX_DLLPUBLIC LinePropertiesContext : public ::oox::core::ContextHandler { public: LinePropertiesContext( ::oox::core::ContextHandler& rParent, diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx index 772f6993289d..b360098c6d6f 100644 --- a/oox/inc/oox/drawingml/shape.hxx +++ b/oox/inc/oox/drawingml/shape.hxx @@ -42,6 +42,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <vector> #include <map> +#include "oox/dllapi.h" namespace oox { namespace vml { struct OleObjectInfo; @@ -75,7 +76,7 @@ struct ChartShapeInfo // ============================================================================ -class Shape +class OOX_DLLPUBLIC Shape : public boost::enable_shared_from_this< Shape > { public: diff --git a/oox/inc/oox/drawingml/shapecontext.hxx b/oox/inc/oox/drawingml/shapecontext.hxx index 89298f51055a..ccd5ab4653bc 100644 --- a/oox/inc/oox/drawingml/shapecontext.hxx +++ b/oox/inc/oox/drawingml/shapecontext.hxx @@ -34,10 +34,11 @@ #include "oox/core/contexthandler.hxx" #include "oox/drawingml/shape.hxx" #include "oox/drawingml/shapepropertiescontext.hxx" +#include "oox/dllapi.h" namespace oox { namespace drawingml { -class ShapeContext : public ::oox::core::ContextHandler +class OOX_DLLPUBLIC ShapeContext : public ::oox::core::ContextHandler { public: ShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr ); diff --git a/oox/inc/oox/drawingml/shapegroupcontext.hxx b/oox/inc/oox/drawingml/shapegroupcontext.hxx index 784058f091cf..38d0374a5ef3 100644 --- a/oox/inc/oox/drawingml/shapegroupcontext.hxx +++ b/oox/inc/oox/drawingml/shapegroupcontext.hxx @@ -31,10 +31,11 @@ #include "oox/drawingml/shape.hxx" #include "oox/drawingml/shapecontext.hxx" +#include "oox/dllapi.h" namespace oox { namespace drawingml { -class ShapeGroupContext : public ::oox::core::ContextHandler +class OOX_DLLPUBLIC ShapeGroupContext : public ::oox::core::ContextHandler { public: ShapeGroupContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr ); diff --git a/oox/inc/oox/drawingml/shapepropertymap.hxx b/oox/inc/oox/drawingml/shapepropertymap.hxx index b467288370eb..69b9cfa555ae 100644 --- a/oox/inc/oox/drawingml/shapepropertymap.hxx +++ b/oox/inc/oox/drawingml/shapepropertymap.hxx @@ -30,6 +30,7 @@ #define OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX #include "oox/helper/propertymap.hxx" +#include "oox/dllapi.h" namespace oox { class ModelObjectHelper; } @@ -74,7 +75,7 @@ enum ShapePropertyId // ============================================================================ -struct ShapePropertyInfo +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. @@ -97,7 +98,7 @@ struct ShapePropertyInfo // ============================================================================ -class ShapePropertyMap : public PropertyMap +class OOX_DLLPUBLIC ShapePropertyMap : public PropertyMap { public: explicit ShapePropertyMap( diff --git a/oox/inc/oox/drawingml/theme.hxx b/oox/inc/oox/drawingml/theme.hxx index b2a039d68527..c83c7ed02a22 100644 --- a/oox/inc/oox/drawingml/theme.hxx +++ b/oox/inc/oox/drawingml/theme.hxx @@ -33,6 +33,7 @@ #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 { @@ -50,7 +51,7 @@ typedef RefMap< sal_Int32, TextCharacterProperties > FontScheme; // ============================================================================ -class Theme +class OOX_DLLPUBLIC Theme { public: explicit Theme(); diff --git a/oox/inc/oox/drawingml/themefragmenthandler.hxx b/oox/inc/oox/drawingml/themefragmenthandler.hxx index 177cbd2a1911..c3d32e3de9ee 100644 --- a/oox/inc/oox/drawingml/themefragmenthandler.hxx +++ b/oox/inc/oox/drawingml/themefragmenthandler.hxx @@ -30,6 +30,7 @@ #define OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX #include "oox/core/fragmenthandler2.hxx" +#include "oox/dllapi.h" namespace oox { namespace drawingml { @@ -38,7 +39,7 @@ class Theme; // ============================================================================ -class ThemeFragmentHandler : public ::oox::core::FragmentHandler2 +class OOX_DLLPUBLIC ThemeFragmentHandler : public ::oox::core::FragmentHandler2 { public: explicit ThemeFragmentHandler( diff --git a/oox/inc/oox/helper/attributelist.hxx b/oox/inc/oox/helper/attributelist.hxx index c60c6f8d58cc..db031073d21c 100644 --- a/oox/inc/oox/helper/attributelist.hxx +++ b/oox/inc/oox/helper/attributelist.hxx @@ -34,6 +34,7 @@ #include "oox/helper/helper.hxx" #include "oox/token/namespaces.hxx" #include "oox/token/tokens.hxx" +#include "oox/dllapi.h" namespace oox { @@ -42,7 +43,7 @@ namespace oox { /** Static helpers for conversion of strings to attribute values of various different data types. */ -class AttributeConversion +class OOX_DLLPUBLIC AttributeConversion { public: /** Returns the XML token identifier from the passed string. */ @@ -76,7 +77,7 @@ public: convenience functions that convert the string value of an attribute to various other data types. */ -class AttributeList +class OOX_DLLPUBLIC AttributeList { public: explicit AttributeList( diff --git a/oox/inc/oox/helper/binaryinputstream.hxx b/oox/inc/oox/helper/binaryinputstream.hxx index 6e952a2b6436..deed56723da9 100644 --- a/oox/inc/oox/helper/binaryinputstream.hxx +++ b/oox/inc/oox/helper/binaryinputstream.hxx @@ -47,7 +47,7 @@ class BinaryOutputStream; The binary data in the stream is assumed to be in little-endian format. */ -class BinaryInputStream : public virtual BinaryStreamBase +class OOX_DLLPUBLIC BinaryInputStream : public virtual BinaryStreamBase { public: /** Derived classes implement reading nBytes bytes to the passed sequence. @@ -281,7 +281,7 @@ void BinaryInputStream::skipArray( sal_Int32 nElemCount ) The binary data in the stream is assumed to be in little-endian format. */ -class BinaryXInputStream : public BinaryXSeekableStream, public BinaryInputStream +class OOX_DLLPUBLIC BinaryXInputStream : public BinaryXSeekableStream, public BinaryInputStream { public: /** Constructs the wrapper object for the passed input stream. @@ -333,7 +333,7 @@ private: The binary data in the stream is assumed to be in little-endian format. */ -class SequenceInputStream : public SequenceSeekableStream, public BinaryInputStream +class OOX_DLLPUBLIC SequenceInputStream : public SequenceSeekableStream, public BinaryInputStream { public: /** Constructs the wrapper object for the passed data sequence. diff --git a/oox/inc/oox/helper/binaryoutputstream.hxx b/oox/inc/oox/helper/binaryoutputstream.hxx index b0cc8b259935..773f0d03d51c 100644 --- a/oox/inc/oox/helper/binaryoutputstream.hxx +++ b/oox/inc/oox/helper/binaryoutputstream.hxx @@ -166,7 +166,7 @@ private: construction, the stream points to the beginning of the passed data sequence. The data sequence is expanded automatically while writing to it. */ -class SequenceOutputStream : public SequenceSeekableStream, public BinaryOutputStream +class OOX_DLLPUBLIC SequenceOutputStream : public SequenceSeekableStream, public BinaryOutputStream { public: /** Constructs the wrapper object for the passed data sequence. diff --git a/oox/inc/oox/helper/binarystreambase.hxx b/oox/inc/oox/helper/binarystreambase.hxx index 5d2d3caad6b4..5f7926b601aa 100644 --- a/oox/inc/oox/helper/binarystreambase.hxx +++ b/oox/inc/oox/helper/binarystreambase.hxx @@ -32,6 +32,7 @@ #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; } @@ -45,7 +46,7 @@ typedef ::com::sun::star::uno::Sequence< sal_Int8 > StreamDataSequence; /** Base class for binary stream classes. */ -class BinaryStreamBase +class OOX_DLLPUBLIC BinaryStreamBase { public: virtual ~BinaryStreamBase(); @@ -134,7 +135,7 @@ private: /** Base class for binary input and output streams wrapping a UNO stream, seekable via the com.sun.star.io.XSeekable interface. */ -class BinaryXSeekableStream : public virtual BinaryStreamBase +class OOX_DLLPUBLIC BinaryXSeekableStream : public virtual BinaryStreamBase { public: virtual ~BinaryXSeekableStream(); @@ -166,7 +167,7 @@ private: wrapper. The data sequence MUST NOT be changed from outside as long as this stream wrapper is used to modify it. */ -class SequenceSeekableStream : public virtual BinaryStreamBase +class OOX_DLLPUBLIC SequenceSeekableStream : public virtual BinaryStreamBase { public: /** Returns the size of the wrapped data sequence. */ diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx index eef942986c80..ce71d5216b94 100644 --- a/oox/inc/oox/helper/containerhelper.hxx +++ b/oox/inc/oox/helper/containerhelper.hxx @@ -33,6 +33,7 @@ #include <vector> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Sequence.h> +#include "oox/dllapi.h" namespace rtl { class OUString; } @@ -73,7 +74,7 @@ typedef ::std::vector< ValueRange > ValueRangeVector; /** An ordered list of value ranges. The insertion operation will merge consecutive value ranges. */ -class ValueRangeSet +class OOX_DLLPUBLIC ValueRangeSet { public: inline explicit ValueRangeSet() {} @@ -164,7 +165,7 @@ private: // ============================================================================ /** Static helper functions for improved API container handling. */ -class ContainerHelper +class OOX_DLLPUBLIC ContainerHelper { public: // com.sun.star.container.XIndexContainer --------------------------------- diff --git a/oox/inc/oox/helper/progressbar.hxx b/oox/inc/oox/helper/progressbar.hxx index 898ede10f20b..f0f350a493e0 100644 --- a/oox/inc/oox/helper/progressbar.hxx +++ b/oox/inc/oox/helper/progressbar.hxx @@ -31,6 +31,7 @@ #include <boost/shared_ptr.hpp> #include <com/sun/star/uno/Reference.hxx> +#include "oox/dllapi.h" namespace rtl { class OUString; } @@ -92,7 +93,7 @@ public: /** A simple progress bar. */ -class ProgressBar : public IProgressBar +class OOX_DLLPUBLIC ProgressBar : public IProgressBar { public: explicit ProgressBar( @@ -116,7 +117,7 @@ private: /** A progress bar containing several independent segments. */ -class SegmentProgressBar : public ISegmentProgressBar +class OOX_DLLPUBLIC SegmentProgressBar : public ISegmentProgressBar { public: explicit SegmentProgressBar( diff --git a/oox/inc/oox/helper/propertymap.hxx b/oox/inc/oox/helper/propertymap.hxx index dabd2e470cbf..3cc8e1e16eef 100644 --- a/oox/inc/oox/helper/propertymap.hxx +++ b/oox/inc/oox/helper/propertymap.hxx @@ -35,6 +35,7 @@ #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; @@ -56,7 +57,7 @@ typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > PropertyMapBase; name mapping is done internally while the properties are written to property sets. */ -class PropertyMap : public PropertyMapBase +class OOX_DLLPUBLIC PropertyMap : public PropertyMapBase { public: explicit PropertyMap(); diff --git a/oox/inc/oox/helper/propertyset.hxx b/oox/inc/oox/helper/propertyset.hxx index 14ca79bfc63d..fcdf66cda8fb 100644 --- a/oox/inc/oox/helper/propertyset.hxx +++ b/oox/inc/oox/helper/propertyset.hxx @@ -33,6 +33,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include "oox/token/properties.hxx" +#include "oox/dllapi.h" namespace oox { @@ -55,7 +56,7 @@ class PropertyMap; implementation does not support the XMultiPropertySet interface, all properties are handled separately in a loop. */ -class PropertySet +class OOX_DLLPUBLIC PropertySet { public: inline explicit PropertySet() {} diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx index ee3a9acc5c53..b204b92ec7ad 100644 --- a/oox/inc/oox/ole/axcontrol.hxx +++ b/oox/inc/oox/ole/axcontrol.hxx @@ -34,6 +34,7 @@ #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; } @@ -197,7 +198,7 @@ enum ApiDefaultStateMode /** A base class with useful helper functions for something that is able to convert ActiveX and ComCtl form controls. */ -class ControlConverter +class OOX_DLLPUBLIC ControlConverter { public: explicit ControlConverter( @@ -349,7 +350,7 @@ private: // ============================================================================ /** Base class for all models of form controls. */ -class ControlModelBase +class OOX_DLLPUBLIC ControlModelBase { public: explicit ControlModelBase(); @@ -484,7 +485,7 @@ private: // ============================================================================ /** Base class for all models of Form 2.0 form controls. */ -class AxControlModelBase : public ControlModelBase +class OOX_DLLPUBLIC AxControlModelBase : public ControlModelBase { public: explicit AxControlModelBase(); @@ -495,7 +496,7 @@ public: // ============================================================================ /** Base class for Forms 2.0 controls supporting text formatting. */ -class AxFontDataModel : public AxControlModelBase +class OOX_DLLPUBLIC AxFontDataModel : public AxControlModelBase { public: explicit AxFontDataModel( bool bSupportsAlign = true ); @@ -519,7 +520,7 @@ private: // ============================================================================ /** Model for a Forms 2.0 command button. */ -class AxCommandButtonModel : public AxFontDataModel +class OOX_DLLPUBLIC AxCommandButtonModel : public AxFontDataModel { public: explicit AxCommandButtonModel(); @@ -548,7 +549,7 @@ public: // direct access needed for legacy VML drawing controls // ============================================================================ /** Model for a Forms 2.0 label. */ -class AxLabelModel : public AxFontDataModel +class OOX_DLLPUBLIC AxLabelModel : public AxFontDataModel { public: explicit AxLabelModel(); @@ -576,7 +577,7 @@ public: // direct access needed for legacy VML drawing controls // ============================================================================ /** Model for a Forms 2.0 image. */ -class AxImageModel : public AxControlModelBase +class OOX_DLLPUBLIC AxImageModel : public AxControlModelBase { public: explicit AxImageModel(); @@ -605,7 +606,7 @@ private: // ============================================================================ /** Base class for a Forms 2.0 morph data control. */ -class AxMorphDataModelBase : public AxFontDataModel +class OOX_DLLPUBLIC AxMorphDataModelBase : public AxFontDataModel { public: explicit AxMorphDataModelBase(); @@ -642,7 +643,7 @@ public: // direct access needed for legacy VML drawing controls // ============================================================================ /** Model for a Forms 2.0 toggle button. */ -class AxToggleButtonModel : public AxMorphDataModelBase +class OOX_DLLPUBLIC AxToggleButtonModel : public AxMorphDataModelBase { public: explicit AxToggleButtonModel(); @@ -656,7 +657,7 @@ public: // ============================================================================ /** Model for a Forms 2.0 check box. */ -class AxCheckBoxModel : public AxMorphDataModelBase +class OOX_DLLPUBLIC AxCheckBoxModel : public AxMorphDataModelBase { public: explicit AxCheckBoxModel(); @@ -670,7 +671,7 @@ public: // ============================================================================ /** Model for a Forms 2.0 option button. */ -class AxOptionButtonModel : public AxMorphDataModelBase +class OOX_DLLPUBLIC AxOptionButtonModel : public AxMorphDataModelBase { public: explicit AxOptionButtonModel(); @@ -687,7 +688,7 @@ public: // ============================================================================ /** Model for a Forms 2.0 text box. */ -class AxTextBoxModel : public AxMorphDataModelBase +class OOX_DLLPUBLIC AxTextBoxModel : public AxMorphDataModelBase { public: explicit AxTextBoxModel(); @@ -701,7 +702,7 @@ public: // ============================================================================ /** Model for a numeric field (legacy drawing controls only). */ -class AxNumericFieldModel : public AxMorphDataModelBase +class OOX_DLLPUBLIC AxNumericFieldModel : public AxMorphDataModelBase { public: explicit AxNumericFieldModel(); @@ -715,7 +716,7 @@ public: // ============================================================================ /** Model for a Forms 2.0 list box. */ -class AxListBoxModel : public AxMorphDataModelBase +class OOX_DLLPUBLIC AxListBoxModel : public AxMorphDataModelBase { public: explicit AxListBoxModel(); @@ -729,7 +730,7 @@ public: // ============================================================================ /** Model for a Forms 2.0 combo box. */ -class AxComboBoxModel : public AxMorphDataModelBase +class OOX_DLLPUBLIC AxComboBoxModel : public AxMorphDataModelBase { public: explicit AxComboBoxModel(); @@ -743,7 +744,7 @@ public: // ============================================================================ /** Model for a Forms 2.0 spin button. */ -class AxSpinButtonModel : public AxControlModelBase +class OOX_DLLPUBLIC AxSpinButtonModel : public AxControlModelBase { public: explicit AxSpinButtonModel(); @@ -772,7 +773,7 @@ public: // direct access needed for legacy VML drawing controls // ============================================================================ /** Model for a Forms 2.0 scroll bar. */ -class AxScrollBarModel : public AxControlModelBase +class OOX_DLLPUBLIC AxScrollBarModel : public AxControlModelBase { public: explicit AxScrollBarModel(); @@ -803,7 +804,7 @@ public: // direct access needed for legacy VML drawing controls // ============================================================================ /** Model for a Forms 2.0 tabstrip control. */ -class AxTabStripModel : public AxFontDataModel +class OOX_DLLPUBLIC AxTabStripModel : public AxFontDataModel { public: explicit AxTabStripModel(); @@ -833,7 +834,7 @@ typedef ::boost::shared_ptr< AxTabStripModel > AxTabStripModelRef; typedef ::std::vector< ::rtl::OUString > AxClassTable; /** Base class for ActiveX container controls. */ -class AxContainerModelBase : public AxFontDataModel +class OOX_DLLPUBLIC AxContainerModelBase : public AxFontDataModel { public: explicit AxContainerModelBase( bool bFontSupport = false ); @@ -874,7 +875,7 @@ typedef ::boost::shared_ptr< AxContainerModelBase > AxContainerModelRef; // ============================================================================ /** Model for a Forms 2.0 frame control. */ -class AxFrameModel : public AxContainerModelBase +class OOX_DLLPUBLIC AxFrameModel : public AxContainerModelBase { public: explicit AxFrameModel(); @@ -886,7 +887,7 @@ public: // ============================================================================ /** Model for a Forms 2.0 formpage control (a single page in a multipage control). */ -class AxFormPageModel : public AxContainerModelBase +class OOX_DLLPUBLIC AxFormPageModel : public AxContainerModelBase { public: explicit AxFormPageModel(); @@ -899,7 +900,7 @@ public: /** Model for a Forms 2.0 multipage control. Contains the tabstrip control (class AxTabStripModel) and the single pages (class AxFormPageModel). */ -class AxMultiPageModel : public AxContainerModelBase +class OOX_DLLPUBLIC AxMultiPageModel : public AxContainerModelBase { public: explicit AxMultiPageModel(); @@ -918,7 +919,7 @@ private: // ============================================================================ /** Model for a Forms 2.0 user form. */ -class AxUserFormModel : public AxContainerModelBase +class OOX_DLLPUBLIC AxUserFormModel : public AxContainerModelBase { public: explicit AxUserFormModel(); @@ -947,7 +948,7 @@ public: /** A form control embedded in a document draw page. Contains a specific model structure according to the type of the control. */ -class EmbeddedControl +class OOX_DLLPUBLIC EmbeddedControl { public: explicit EmbeddedControl( const ::rtl::OUString& rName ); diff --git a/oox/inc/oox/ole/axfontdata.hxx b/oox/inc/oox/ole/axfontdata.hxx index 2fba2ed78c00..47a2db1c4277 100644 --- a/oox/inc/oox/ole/axfontdata.hxx +++ b/oox/inc/oox/ole/axfontdata.hxx @@ -32,6 +32,7 @@ #include "oox/helper/binaryinputstream.hxx" #include "oox/helper/binaryoutputstream.hxx" #include "oox/helper/refvector.hxx" +#include "oox/dllapi.h" namespace oox { namespace ole { @@ -52,7 +53,7 @@ const sal_Int32 AX_FONTDATA_RIGHT = 2; const sal_Int32 AX_FONTDATA_CENTER = 3; /** All entries of a font property. */ -struct AxFontData +struct OOX_DLLPUBLIC AxFontData { ::rtl::OUString maFontName; /// Name of the used font. sal_uInt32 mnFontEffects; /// Font effect flags. diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx index f4af24a2eb21..cb1ee4f8f1d4 100644 --- a/oox/inc/oox/ole/vbaproject.hxx +++ b/oox/inc/oox/ole/vbaproject.hxx @@ -33,6 +33,7 @@ #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; } @@ -50,7 +51,7 @@ namespace ole { // ============================================================================ -class VbaFilterConfig +class OOX_DLLPUBLIC VbaFilterConfig { public: explicit VbaFilterConfig( @@ -89,7 +90,7 @@ private: store all information needed to finally attach the macro to the action, once the VBA project has been imported. */ -class VbaMacroAttacherBase +class OOX_DLLPUBLIC VbaMacroAttacherBase { public: explicit VbaMacroAttacherBase( const ::rtl::OUString& rMacroName ); diff --git a/oox/inc/oox/vml/vmldrawing.hxx b/oox/inc/oox/vml/vmldrawing.hxx index 2b6ef0e17fdc..5415deedaf97 100644 --- a/oox/inc/oox/vml/vmldrawing.hxx +++ b/oox/inc/oox/vml/vmldrawing.hxx @@ -33,6 +33,7 @@ #include <memory> #include <vector> #include <oox/ole/oleobjecthelper.hxx> +#include "oox/dllapi.h" namespace com { namespace sun { namespace star { namespace awt { struct Rectangle; } @@ -68,7 +69,7 @@ enum DrawingType // ============================================================================ /** Contains information about an OLE object embedded in a draw page. */ -struct OleObjectInfo : public ::oox::ole::OleObjectInfo +struct OOX_DLLPUBLIC OleObjectInfo : public ::oox::ole::OleObjectInfo { ::rtl::OUString maShapeId; /// Shape identifier for shape lookup. ::rtl::OUString maName; /// Programmatical name of the OLE object. @@ -81,10 +82,10 @@ struct OleObjectInfo : public ::oox::ole::OleObjectInfo void setShapeId( sal_Int32 nShapeId ); }; -// ============================================================================ +// =========================================/=================================== /** Contains information about a form control embedded in a draw page. */ -struct ControlInfo +struct OOX_DLLPUBLIC ControlInfo { ::rtl::OUString maShapeId; /// Shape identifier for shape lookup. ::rtl::OUString maFragmentPath; /// Path to the fragment describing the form control properties. @@ -99,7 +100,7 @@ struct ControlInfo // ============================================================================ /** Represents the collection of VML shapes for a complete draw page. */ -class Drawing +class OOX_DLLPUBLIC Drawing { public: explicit Drawing( diff --git a/oox/inc/oox/vml/vmldrawingfragment.hxx b/oox/inc/oox/vml/vmldrawingfragment.hxx index 2b6be0eac7ff..8d630c7aec03 100644 --- a/oox/inc/oox/vml/vmldrawingfragment.hxx +++ b/oox/inc/oox/vml/vmldrawingfragment.hxx @@ -30,6 +30,7 @@ #define OOX_VML_VMLDRAWINGFRAGMENT_HXX #include "oox/core/fragmenthandler2.hxx" +#include "oox/dllapi.h" namespace oox { namespace vml { @@ -38,7 +39,7 @@ class Drawing; // ============================================================================ -class DrawingFragment : public ::oox::core::FragmentHandler2 +class OOX_DLLPUBLIC DrawingFragment : public ::oox::core::FragmentHandler2 { public: explicit DrawingFragment( diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx index 627da96e987a..25f7a555d94b 100644 --- a/oox/inc/oox/vml/vmlformatting.hxx +++ b/oox/inc/oox/vml/vmlformatting.hxx @@ -30,6 +30,7 @@ #define OOX_VML_VMLFORMATTING_HXX #include "oox/helper/helper.hxx" +#include "oox/dllapi.h" namespace oox { class GraphicHelper; @@ -47,7 +48,7 @@ typedef ::std::pair< double, double > DoublePair; // ============================================================================ -class ConversionHelper +class OOX_DLLPUBLIC ConversionHelper { public: /** Returns two values contained in rValue separated by cSep. diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx index 65683f722716..1998a0271c29 100644 --- a/oox/inc/oox/vml/vmlshape.hxx +++ b/oox/inc/oox/vml/vmlshape.hxx @@ -33,6 +33,7 @@ #include <vector> #include <com/sun/star/awt/Point.hpp> #include "oox/vml/vmlformatting.hxx" +#include "oox/dllapi.h" namespace com { namespace sun { namespace star { namespace awt { struct Rectangle; } @@ -196,7 +197,7 @@ struct ShapeModel /** A shape object that is part of a drawing. May inherit properties from a shape template. */ -class ShapeBase : public ShapeType +class OOX_DLLPUBLIC ShapeBase : public ShapeType { public: /** Returns read/write access to the shape model structure. */ diff --git a/oox/inc/oox/vml/vmltextbox.hxx b/oox/inc/oox/vml/vmltextbox.hxx index 6ba9e124e1b4..cc2e41bdd8ef 100644 --- a/oox/inc/oox/vml/vmltextbox.hxx +++ b/oox/inc/oox/vml/vmltextbox.hxx @@ -32,6 +32,7 @@ #include <vector> #include <rtl/ustring.hxx> #include "oox/helper/helper.hxx" +#include "oox/dllapi.h" namespace oox { namespace vml { @@ -39,7 +40,7 @@ namespace vml { // ============================================================================ /** Font settings for a text portion in a textbox. */ -struct TextFontModel +struct OOX_DLLPUBLIC TextFontModel { OptValue< ::rtl::OUString > moName; /// Font name. OptValue< ::rtl::OUString > moColor; /// Font color, HTML encoded, sort of. @@ -67,7 +68,7 @@ struct TextPortionModel // ============================================================================ /** The textbox contains all text contents and properties. */ -class TextBox +class OOX_DLLPUBLIC TextBox { public: explicit TextBox(); diff --git a/oox/inc/oox/xls/addressconverter.hxx b/oox/inc/oox/xls/addressconverter.hxx deleted file mode 100644 index 47de4bab1a32..000000000000 --- a/oox/inc/oox/xls/addressconverter.hxx +++ /dev/null @@ -1,672 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_ADDRESSCONVERTER_HXX -#define OOX_XLS_ADDRESSCONVERTER_HXX - -#include <vector> -#include <com/sun/star/table/CellAddress.hpp> -#include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/xls/workbookhelper.hxx" - -namespace oox { -namespace xls { - -class BiffInputStream; -class BiffOutputStream; - -// ============================================================================ -// ============================================================================ - -/** A vector of com.sun.star.table.CellRangeAddress elements and additional - functionality. */ -class ApiCellRangeList : public ::std::vector< ::com::sun::star::table::CellRangeAddress > -{ -public: - inline explicit ApiCellRangeList() {} - - /** Returns the base address of this range list (top-left cell of first range). */ - ::com::sun::star::table::CellAddress - getBaseAddress() const; -}; - -// ============================================================================ - -/** A 2D cell address struct for binary filters. */ -struct BinAddress -{ - sal_Int32 mnCol; - sal_Int32 mnRow; - - inline explicit BinAddress() : mnCol( 0 ), mnRow( 0 ) {} - inline explicit BinAddress( sal_Int32 nCol, sal_Int32 nRow ) : mnCol( nCol ), mnRow( nRow ) {} - inline explicit BinAddress( const ::com::sun::star::table::CellAddress& rAddr ) : mnCol( rAddr.Column ), mnRow( rAddr.Row ) {} - - inline void set( sal_Int32 nCol, sal_Int32 nRow ) { mnCol = nCol; mnRow = nRow; } - inline void set( const ::com::sun::star::table::CellAddress& rAddr ) { mnCol = rAddr.Column; mnRow = rAddr.Row; } - - void read( SequenceInputStream& rStrm ); - void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ); - void write( BiffOutputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ) const; -}; - -// ---------------------------------------------------------------------------- - -inline bool operator==( const BinAddress& rL, const BinAddress& rR ) -{ - return (rL.mnCol == rR.mnCol) && (rL.mnRow == rR.mnRow); -} - -inline bool operator<( const BinAddress& rL, const BinAddress& rR ) -{ - return (rL.mnCol < rR.mnCol) || ((rL.mnCol == rR.mnCol) && (rL.mnRow < rR.mnRow)); -} - -inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinAddress& orPos ) -{ - orPos.read( rStrm ); - return rStrm; -} - -inline BiffInputStream& operator>>( BiffInputStream& rStrm, BinAddress& orPos ) -{ - orPos.read( rStrm ); - return rStrm; -} - -inline BiffOutputStream& operator<<( BiffOutputStream& rStrm, const BinAddress& rPos ) -{ - rPos.write( rStrm ); - return rStrm; -} - -// ============================================================================ - -/** A 2D cell range address struct for binary filters. */ -struct BinRange -{ - BinAddress maFirst; - BinAddress maLast; - - inline explicit BinRange() {} - inline explicit BinRange( const BinAddress& rAddr ) : maFirst( rAddr ), maLast( rAddr ) {} - inline explicit BinRange( const BinAddress& rFirst, const BinAddress& rLast ) : maFirst( rFirst ), maLast( rLast ) {} - inline explicit BinRange( sal_Int32 nCol1, sal_Int32 nRow1, sal_Int32 nCol2, sal_Int32 nRow2 ) : - maFirst( nCol1, nRow1 ), maLast( nCol2, nRow2 ) {} - inline explicit BinRange( const ::com::sun::star::table::CellAddress& rAddr ) : maFirst( rAddr ), maLast( rAddr ) {} - inline explicit BinRange( const ::com::sun::star::table::CellAddress& rFirst, const ::com::sun::star::table::CellAddress& rLast ) : maFirst( rFirst ), maLast( rLast ) {} - inline explicit BinRange( const ::com::sun::star::table::CellRangeAddress& rRange ) : maFirst( rRange.StartColumn, rRange.StartRow ), maLast( rRange.EndColumn, rRange.EndRow ) {} - - inline void set( const BinAddress& rFirst, const BinAddress& rLast ) - { maFirst = rFirst; maLast = rLast; } - inline void set( sal_Int32 nCol1, sal_Int32 nRow1, sal_Int32 nCol2, sal_Int32 nRow2 ) - { maFirst.set( nCol1, nRow1 ); maLast.set( nCol2, nRow2 ); } - inline void set( const ::com::sun::star::table::CellAddress& rFirst, const ::com::sun::star::table::CellAddress& rLast ) - { maFirst.set( rFirst ); maLast.set( rLast ); } - inline void set( const ::com::sun::star::table::CellRangeAddress& rRange ) - { maFirst.set( rRange.StartColumn, rRange.StartRow ); maLast.set( rRange.EndColumn, rRange.EndRow ); } - - inline sal_Int32 getColCount() const { return maLast.mnCol - maFirst.mnCol + 1; } - inline sal_Int32 getRowCount() const { return maLast.mnRow - maFirst.mnRow + 1; } - bool contains( const BinAddress& rAddr ) const; - - void read( SequenceInputStream& rStrm ); - void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ); - void write( BiffOutputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ) const; -}; - -// ---------------------------------------------------------------------------- - -inline bool operator==( const BinRange& rL, const BinRange& rR ) -{ - return (rL.maFirst == rR.maFirst) && (rL.maLast == rR.maLast); -} - -inline bool operator<( const BinRange& rL, const BinRange& rR ) -{ - return (rL.maFirst < rR.maFirst) || ((rL.maFirst == rR.maFirst) && (rL.maLast < rR.maLast)); -} - -inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRange& orRange ) -{ - orRange.read( rStrm ); - return rStrm; -} - -inline BiffInputStream& operator>>( BiffInputStream& rStrm, BinRange& orRange ) -{ - orRange.read( rStrm ); - return rStrm; -} - -inline BiffOutputStream& operator<<( BiffOutputStream& rStrm, const BinRange& rRange ) -{ - rRange.write( rStrm ); - return rStrm; -} - -// ============================================================================ - -/** A 2D cell range address list for binary filters. */ -class BinRangeList : public ::std::vector< BinRange > -{ -public: - inline explicit BinRangeList() {} - - void read( SequenceInputStream& rStrm ); - void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ); - void write( BiffOutputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ) const; - void writeSubList( BiffOutputStream& rStrm, - size_t nBegin, size_t nCount, bool bCol16Bit = true, bool bRow32Bit = false ) const; -}; - -// ---------------------------------------------------------------------------- - -inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRangeList& orRanges ) -{ - orRanges.read( rStrm ); - return rStrm; -} - -inline BiffInputStream& operator>>( BiffInputStream& rStrm, BinRangeList& orRanges ) -{ - orRanges.read( rStrm ); - return rStrm; -} - -inline BiffOutputStream& operator<<( BiffOutputStream& rStrm, const BinRangeList& rRanges ) -{ - rRanges.write( rStrm ); - return rStrm; -} - -// ============================================================================ - -/** Different target types that can be encoded in a BIFF URL. */ -enum BiffTargetType -{ - BIFF_TARGETTYPE_URL, /// URL, URL with sheet name, or sheet name. - BIFF_TARGETTYPE_SAMESHEET, /// Target for special '!A1' syntax to refer to current sheet. - BIFF_TARGETTYPE_LIBRARY, /// Library directory in application installation. - BIFF_TARGETTYPE_DDE_OLE, /// DDE server/topic or OLE class/target. - BIFF_TARGETTYPE_UNKNOWN /// Unknown/unsupported target type. -}; - -// ============================================================================ -// ============================================================================ - -/** Converter for cell addresses and cell ranges for OOXML and BIFF filters. - */ -class AddressConverter : public WorkbookHelper -{ -public: - explicit AddressConverter( const WorkbookHelper& rHelper ); - - // ------------------------------------------------------------------------ - - /** Tries to parse the passed string for a 2d cell address in A1 notation. - - This function accepts all strings that match the regular expression - "[a-zA-Z]{1,6}0*[1-9][0-9]{0,8}" (without quotes), i.e. 1 to 6 letters - for the column index (translated to 0-based column indexes from 0 to - 321,272,405), and 1 to 9 digits for the 1-based row index (translated - to 0-based row indexes from 0 to 999,999,998). The row number part may - contain leading zeros, they will be ignored. It is up to the caller to - handle cell addresses outside of a specific valid range (e.g. the - entire spreadsheet). - - @param ornColumn (out-parameter) Returns the converted column index. - @param ornRow (out-parameter) returns the converted row index. - @param rString The string containing the cell address. - @param nStart Start index of string part in rString to be parsed. - @param nLength Length of string part in rString to be parsed. - - @return true = Parsed string was valid, returned values can be used. - */ - static bool parseOoxAddress2d( - sal_Int32& ornColumn, sal_Int32& ornRow, - const ::rtl::OUString& rString, - sal_Int32 nStart = 0, - sal_Int32 nLength = SAL_MAX_INT32 ); - - /** Tries to parse the passed string for a 2d cell range in A1 notation. - - This function accepts all strings that match the regular expression - "ADDR(:ADDR)?" (without quotes), where ADDR is a cell address accepted - by the parseOoxAddress2d() function of this class. It is up to the - caller to handle cell ranges outside of a specific valid range (e.g. - the entire spreadsheet). - - @param ornStartColumn (out-parameter) Returns the converted start column index. - @param ornStartRow (out-parameter) returns the converted start row index. - @param ornEndColumn (out-parameter) Returns the converted end column index. - @param ornEndRow (out-parameter) returns the converted end row index. - @param rString The string containing the cell address. - @param nStart Start index of string part in rString to be parsed. - @param nLength Length of string part in rString to be parsed. - - @return true = Parsed string was valid, returned values can be used. - */ - static bool parseOoxRange2d( - sal_Int32& ornStartColumn, sal_Int32& ornStartRow, - sal_Int32& ornEndColumn, sal_Int32& ornEndRow, - const ::rtl::OUString& rString, - sal_Int32 nStart = 0, - sal_Int32 nLength = SAL_MAX_INT32 ); - - /** Tries to parse an encoded name of an external link target in BIFF - documents, e.g. from EXTERNSHEET or SUPBOOK records. - - @param orClassName (out-parameter) DDE server name or OLE class name. - @param orTargetUrl (out-parameter) Target URL, DDE topic or OLE object name. - @param orSheetName (out-parameter) Sheet name in target document. - @param rBiffEncoded Encoded name of the external link target. - @param bFromDConRec True = path from DCONREF/DCONNAME/DCONBINAME records, false = other records. - - @return Type of the decoded target. - */ - BiffTargetType parseBiffTargetUrl( - ::rtl::OUString& orClassName, - ::rtl::OUString& orTargetUrl, - ::rtl::OUString& orSheetName, - const ::rtl::OUString& rBiffTargetUrl, - bool bFromDConRec = false ); - - // ------------------------------------------------------------------------ - - /** Returns the biggest valid cell address in the own Calc document. */ - inline const ::com::sun::star::table::CellAddress& - getMaxApiAddress() const { return maMaxApiPos; } - - /** Returns the biggest valid cell address in the imported/exported - Excel document. */ - inline const ::com::sun::star::table::CellAddress& - getMaxXlsAddress() const { return maMaxXlsPos; } - - /** Returns the biggest valid cell address in both Calc and the - imported/exported Excel document. */ - inline const ::com::sun::star::table::CellAddress& - getMaxAddress() const { return maMaxPos; } - - /** Returns the column overflow status. */ - inline bool isColOverflow() const { return mbColOverflow; } - /** Returns the row overflow status. */ - inline bool isRowOverflow() const { return mbRowOverflow; } - /** Returns the sheet overflow status. */ - inline bool isTabOverflow() const { return mbTabOverflow; } - - // ------------------------------------------------------------------------ - - /** Checks if the passed column index is valid. - - @param nCol The column index to check. - @param bTrackOverflow true = Update the internal overflow flag, if the - column index is outside of the supported limits. - @return true = Passed column index is valid (no index overflow). - */ - bool checkCol( sal_Int32 nCol, bool bTrackOverflow ); - - /** Checks if the passed row index is valid. - - @param nRow The row index to check. - @param bTrackOverflow true = Update the internal overflow flag, if the - row index is outside of the supported limits. - @return true = Passed row index is valid (no index overflow). - */ - bool checkRow( sal_Int32 nRow, bool bTrackOverflow ); - - /** Checks if the passed sheet index is valid. - - @param nSheet The sheet index to check. - @param bTrackOverflow true = Update the internal overflow flag, if the - sheet index is outside of the supported limits. - @return true = Passed sheet index is valid (no index overflow). - */ - bool checkTab( sal_Int16 nSheet, bool bTrackOverflow ); - - // ------------------------------------------------------------------------ - - /** Checks the passed cell address if it fits into the spreadsheet limits. - - @param rAddress The cell address to be checked. - @param bTrackOverflow true = Update the internal overflow flags, if - the address is outside of the supported sheet limits. - @return true = Passed address is valid (no index overflow). - */ - bool checkCellAddress( - const ::com::sun::star::table::CellAddress& rAddress, - bool bTrackOverflow ); - - /** Converts the passed string to a single cell address, without checking - any sheet limits. - - @param orAddress (out-parameter) Returns the converted cell address. - @param rString Cell address string in A1 notation. - @param nSheet Sheet index to be inserted into orAddress. - @return true = Cell address could be parsed from the passed string. - */ - bool convertToCellAddressUnchecked( - ::com::sun::star::table::CellAddress& orAddress, - const ::rtl::OUString& rString, - sal_Int16 nSheet ); - - /** Tries to convert the passed string to a single cell address. - - @param orAddress (out-parameter) Returns the converted cell address. - @param rString Cell address string in A1 notation. - @param nSheet Sheet index to be inserted into orAddress (will be checked). - @param bTrackOverflow true = Update the internal overflow flags, if - the address is outside of the supported sheet limits. - @return true = Converted address is valid (no index overflow). - */ - bool convertToCellAddress( - ::com::sun::star::table::CellAddress& orAddress, - const ::rtl::OUString& rString, - sal_Int16 nSheet, - bool bTrackOverflow ); - - /** Returns a valid cell address by moving it into allowed dimensions. - - @param rString Cell address string in A1 notation. - @param nSheet Sheet index for the returned address (will be checked). - @param bTrackOverflow true = Update the internal overflow flags, if - the address is outside of the supported sheet limits. - @return A valid API cell address struct. */ - ::com::sun::star::table::CellAddress - createValidCellAddress( - const ::rtl::OUString& rString, - sal_Int16 nSheet, - bool bTrackOverflow ); - - /** Converts the passed address to a single cell address, without checking - any sheet limits. - - @param orAddress (out-parameter) Returns the converted cell address. - @param rBinAddress Binary cell address struct. - @param nSheet Sheet index to be inserted into orAddress. - */ - void convertToCellAddressUnchecked( - ::com::sun::star::table::CellAddress& orAddress, - const BinAddress& rBinAddress, - sal_Int16 nSheet ); - - /** Tries to convert the passed address to a single cell address. - - @param orAddress (out-parameter) Returns the converted cell address. - @param rBinAddress Binary cell address struct. - @param nSheet Sheet index to be inserted into orAddress (will be checked). - @param bTrackOverflow true = Update the internal overflow flags, if - the address is outside of the supported sheet limits. - @return true = Converted address is valid (no index overflow). - */ - bool convertToCellAddress( - ::com::sun::star::table::CellAddress& orAddress, - const BinAddress& rBinAddress, - sal_Int16 nSheet, - bool bTrackOverflow ); - - /** Returns a valid cell address by moving it into allowed dimensions. - - @param rBinAddress Binary cell address struct. - @param nSheet Sheet index for the returned address (will be checked). - @param bTrackOverflow true = Update the internal overflow flags, if - the address is outside of the supported sheet limits. - @return A valid API cell address struct. */ - ::com::sun::star::table::CellAddress - createValidCellAddress( - const BinAddress& rBinAddress, - sal_Int16 nSheet, - bool bTrackOverflow ); - - // ------------------------------------------------------------------------ - - /** Checks the passed cell range if it fits into the spreadsheet limits. - - @param rRange The cell range address to be checked. - @param bAllowOverflow true = Allow ranges that start inside the - supported sheet limits but may end outside of these limits. - false = Do not allow ranges that overflow the supported limits. - @param bTrackOverflow true = Update the internal overflow flags, if - the passed range contains cells outside of the supported sheet - limits. - @return true = Cell range is valid. This function returns also true, - if only parts of the range are outside the current sheet limits and - such an overflow is allowed via parameter bAllowOverflow. Returns - false, if the entire range is outside the sheet limits, or if - overflow is not allowed via parameter bAllowOverflow. - */ - bool checkCellRange( - const ::com::sun::star::table::CellRangeAddress& rRange, - bool bAllowOverflow, bool bTrackOverflow ); - - /** Checks the passed cell range, may try to fit it to current sheet limits. - - First, this function reorders the column and row indexes so that the - starting indexes are less than or equal to the end indexes. Then, - depending on the parameter bAllowOverflow, the range is just checked or - cropped to the current sheet limits. - - @param orRange (in-out-parameter) Converts the passed cell range - into a valid cell range address. If the passed range contains cells - outside the currently supported spreadsheet limits, it will be - cropped to these limits. - @param bAllowOverflow true = Allow ranges that start inside the - supported sheet limits but may end outside of these limits. The - cell range returned in orRange will be cropped to these limits. - false = Do not allow ranges that overflow the supported limits. The - function will return false when the range overflows the sheet limits. - @param bTrackOverflow true = Update the internal overflow flags, if - the original range contains cells outside of the supported sheet - limits. - @return true = Converted range address is valid. This function - returns also true, if overflowing ranges are allowed via parameter - bAllowOverflow and the range has been cropped, but still contains - cells inside the current sheet limits. Returns false, if the entire - range is outside the sheet limits or overflowing ranges are not - allowed via parameter bAllowOverflow. - */ - bool validateCellRange( - ::com::sun::star::table::CellRangeAddress& orRange, - bool bAllowOverflow, bool bTrackOverflow ); - - /** Converts the passed string to a cell range address, without checking - any sheet limits. - - @param orRange (out-parameter) Returns the converted range address. - @param rString Cell range string in A1 notation. - @param nSheet Sheet index to be inserted into orRange. - @return true = Range address could be parsed from the passed string. - */ - bool convertToCellRangeUnchecked( - ::com::sun::star::table::CellRangeAddress& orRange, - const ::rtl::OUString& rString, - sal_Int16 nSheet ); - - /** Tries to convert the passed string to a cell range address. - - @param orRange (out-parameter) Returns the converted cell range - address. If the original range in the passed string contains cells - outside the currently supported spreadsheet limits, and parameter - bAllowOverflow is set to true, the range will be cropped to these - limits. Example: the range string "A1:ZZ100000" may be converted to - the range A1:IV65536. - @param rString Cell range string in A1 notation. - @param nSheet Sheet index to be inserted into orRange (will be checked). - @param bAllowOverflow true = Allow ranges that start inside the - supported sheet limits but may end outside of these limits. The - cell range returned in orRange will be cropped to these limits. - false = Do not allow ranges that overflow the supported limits. - @param bTrackOverflow true = Update the internal overflow flags, if - the original range contains cells outside of the supported sheet - limits. - @return true = Converted and returned range is valid. This function - returns also true, if overflowing ranges are allowed via parameter - bAllowOverflow and the range has been cropped, but still contains - cells inside the current sheet limits. Returns false, if the entire - range is outside the sheet limits or overflowing ranges are not - allowed via parameter bAllowOverflow. - */ - bool convertToCellRange( - ::com::sun::star::table::CellRangeAddress& orRange, - const ::rtl::OUString& rString, - sal_Int16 nSheet, - bool bAllowOverflow, bool bTrackOverflow ); - - /** Converts the passed range to a cell range address, without checking any - sheet limits. - - @param orRange (out-parameter) Returns the converted range address. - @param rBinRange Binary cell range struct. - @param nSheet Sheet index to be inserted into orRange. - */ - void convertToCellRangeUnchecked( - ::com::sun::star::table::CellRangeAddress& orRange, - const BinRange& rBinRange, - sal_Int16 nSheet ); - - /** Tries to convert the passed range to a cell range address. - - @param orRange (out-parameter) Returns the converted cell range - address. If the passed original range contains cells outside the - currently supported spreadsheet limits, and parameter bAllowOverflow - is set to true, the range will be cropped to these limits. - @param rBinRange Binary cell range struct. - @param nSheet Sheet index to be inserted into orRange (will be checked). - @param bAllowOverflow true = Allow ranges that start inside the - supported sheet limits but may end outside of these limits. The - cell range returned in orRange will be cropped to these limits. - false = Do not allow ranges that overflow the supported limits. - @param bTrackOverflow true = Update the internal overflow flags, if - the original range contains cells outside of the supported sheet - limits. - @return true = Converted and returned range is valid. This function - returns also true, if overflowing ranges are allowed via parameter - bAllowOverflow and the range has been cropped, but still contains - cells inside the current sheet limits. Returns false, if the entire - range is outside the sheet limits or if overflowing ranges are not - allowed via parameter bAllowOverflow. - */ - bool convertToCellRange( - ::com::sun::star::table::CellRangeAddress& orRange, - const BinRange& rBinRange, - sal_Int16 nSheet, - bool bAllowOverflow, bool bTrackOverflow ); - - // ------------------------------------------------------------------------ - - /** Tries to restrict the passed cell range list to current sheet limits. - - @param orRanges (in-out-parameter) Restricts the cell range addresses - in the passed list to the current sheet limits and removes invalid - ranges from the list. - @param bTrackOverflow true = Update the internal overflow flags, if - the original ranges contain cells outside of the supported sheet - limits. - */ - void validateCellRangeList( - ApiCellRangeList& orRanges, - bool bTrackOverflow ); - - /** Tries to convert the passed string to a cell range list. - - @param orRanges (out-parameter) Returns the converted cell range - addresses. If a range in the passed string contains cells outside - the currently supported spreadsheet limits, it will be cropped to - these limits. Example: the range string "A1:ZZ100000" may be - converted to the range A1:IV65536. If a range is completely outside - the limits, it will be omitted. - @param rString Cell range list string in A1 notation, space separated. - @param nSheet Sheet index to be inserted into orRanges (will be checked). - @param bTrackOverflow true = Update the internal overflow flags, if - the original ranges contain cells outside of the supported sheet - limits. - */ - void convertToCellRangeList( - ApiCellRangeList& orRanges, - const ::rtl::OUString& rString, - sal_Int16 nSheet, - bool bTrackOverflow ); - - /** Tries to convert the passed range list to a cell range list. - - @param orRanges (out-parameter) Returns the converted cell range - addresses. If a range in the passed string contains cells outside - the currently supported spreadsheet limits, it will be cropped to - these limits. Example: the range string "A1:ZZ100000" may be - converted to the range A1:IV65536. If a range is completely outside - the limits, it will be omitted. - @param rBinRanges List of binary cell range objects. - @param nSheet Sheet index to be inserted into orRanges (will be checked). - @param bTrackOverflow true = Update the internal overflow flags, if - the original ranges contain cells outside of the supported sheet - limits. - */ - void convertToCellRangeList( - ApiCellRangeList& orRanges, - const BinRangeList& rBinRanges, - sal_Int16 nSheet, - bool bTrackOverflow ); - - // ------------------------------------------------------------------------ -private: - void initializeMaxPos( - sal_Int16 nMaxXlsTab, sal_Int32 nMaxXlsCol, sal_Int32 nMaxXlsRow ); - -private: - struct ControlCharacters - { - sal_Unicode mcThisWorkbook; /// Control character: Link to current workbook. - sal_Unicode mcExternal; /// Control character: Link to external workbook/sheet. - sal_Unicode mcThisSheet; /// Control character: Link to current sheet. - sal_Unicode mcInternal; /// Control character: Link to internal sheet. - sal_Unicode mcSameSheet; /// Control character: Link to same sheet (special '!A1' syntax). - - void set( - sal_Unicode cThisWorkbook, sal_Unicode cExternal, - sal_Unicode cThisSheet, sal_Unicode cInternal, - sal_Unicode cSameSheet ); - }; - - ::com::sun::star::table::CellAddress maMaxApiPos; /// Maximum valid cell address in Calc. - ::com::sun::star::table::CellAddress maMaxXlsPos; /// Maximum valid cell address in Excel. - ::com::sun::star::table::CellAddress maMaxPos; /// Maximum valid cell address in Calc/Excel. - ControlCharacters maLinkChars; /// Control characters for external link import (BIFF). - ControlCharacters maDConChars; /// Control characters for DCON* record import (BIFF). - bool mbColOverflow; /// Flag for "columns overflow". - bool mbRowOverflow; /// Flag for "rows overflow". - bool mbTabOverflow; /// Flag for "tables overflow". -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/autofilterbuffer.hxx b/oox/inc/oox/xls/autofilterbuffer.hxx deleted file mode 100644 index 493c512b7b42..000000000000 --- a/oox/inc/oox/xls/autofilterbuffer.hxx +++ /dev/null @@ -1,285 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_AUTOFILTERBUFFER_HXX -#define OOX_XLS_AUTOFILTERBUFFER_HXX - -#include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/helper/refvector.hxx" -#include "oox/xls/workbookhelper.hxx" - -namespace com { namespace sun { namespace star { - namespace sheet { struct TableFilterField3; } - namespace sheet { class XDatabaseRange; } - namespace sheet { class XSheetFilterDescriptor3; } -} } } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Contains UNO API filter settings for a column in a filtered range. */ -struct ApiFilterSettings -{ - typedef ::std::vector<com::sun::star::sheet::TableFilterField3> FilterFieldVector; - - FilterFieldVector maFilterFields; /// List of UNO API filter settings. - OptValue< bool > mobNeedsRegExp; /// If set, requires regular expressions to be enabled/disabled. - - explicit ApiFilterSettings(); - - void appendField( bool bAnd, sal_Int32 nOperator, double fValue ); - void appendField( bool bAnd, sal_Int32 nOperator, const ::rtl::OUString& rValue ); - void appendField( bool bAnd, const std::vector<rtl::OUString>& rValues ); -}; - -// ============================================================================ - -/** Base class for specific filter settings for a column in a filtered range. - */ -class FilterSettingsBase : public WorkbookHelper -{ -public: - explicit FilterSettingsBase( const WorkbookHelper& rHelper ); - - /** Derived classes import filter settings from the passed attribute list. */ - virtual void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Derived classes import filter settings from the passed record. */ - virtual void importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); - /** Derived classes import filter settings from the FILTERCOLUMN record. */ - virtual void importBiffRecord( BiffInputStream& rStrm, sal_uInt16 nFlags ); - - /** Derived classes return converted UNO API filter settings representing all filter settings. */ - virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ); -}; - -typedef ::boost::shared_ptr< FilterSettingsBase > FilterSettingsRef; - -// ============================================================================ - -/** Settings for a discrete filter, specifying a list of values to be shown in - the filtered range. - */ -class DiscreteFilter : public FilterSettingsBase -{ -public: - explicit DiscreteFilter( const WorkbookHelper& rHelper ); - - /** Imports filter settings from the filters and filter elements. */ - virtual void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Imports filter settings from the FILTERS and FILTER records. */ - virtual void importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - /** Returns converted UNO API filter settings representing all filter settings. */ - virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ); - -private: - typedef ::std::vector< ::rtl::OUString > FilterValueVector; - - FilterValueVector maValues; - sal_Int32 mnCalendarType; - bool mbShowBlank; -}; - -// ============================================================================ - -/** Settings for a top-10 filter. */ -class Top10Filter : public FilterSettingsBase -{ -public: - explicit Top10Filter( const WorkbookHelper& rHelper ); - - /** Imports filter settings from the filters and filter elements. */ - virtual void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Imports filter settings from the FILTERS and FILTER records. */ - virtual void importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); - /** Imports filter settings from the FILTERCOLUMN record. */ - virtual void importBiffRecord( BiffInputStream& rStrm, sal_uInt16 nFlags ); - - /** Returns converted UNO API filter settings representing all filter settings. */ - virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ); - -private: - double mfValue; /// Number of items or percentage. - bool mbTop; /// True = show top (greatest) items/percentage. - bool mbPercent; /// True = percentage, false = number of items. -}; - -// ============================================================================ - -/** A filter criterion for a custom filter. */ -struct FilterCriterionModel -{ - ::com::sun::star::uno::Any maValue; /// Comparison operand. - sal_Int32 mnOperator; /// Comparison operator. - sal_uInt8 mnDataType; /// Operand data type (BIFF only). - sal_uInt8 mnStrLen; /// Length of string operand (BIFF5-BIFF8 only). - - explicit FilterCriterionModel(); - - /** Sets the passed BIFF operator constant. */ - void setBiffOperator( sal_uInt8 nOperator ); - - /** Imports the criterion model from the passed BIFF12 stream. */ - void readBiffData( SequenceInputStream& rStrm ); - /** Imports the initial criterion data from the passed BIFF5/BIFF8 stream. */ - void readBiffData( BiffInputStream& rStrm ); - /** Imports the trailing string data from the passed BIFF5/BIFF8 stream. */ - void readString( BiffInputStream& rStrm, BiffType eBiff, rtl_TextEncoding eTextEnc ); -}; - -// ---------------------------------------------------------------------------- - -/** Settings for a custom filter, specifying one or two comparison operators - associated with some values. - */ -class CustomFilter : public FilterSettingsBase -{ -public: - explicit CustomFilter( const WorkbookHelper& rHelper ); - - /** Imports filter settings from the filters and filter elements. */ - virtual void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Imports filter settings from the FILTERS and FILTER records. */ - virtual void importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); - /** Imports filter settings from the FILTERCOLUMN record. */ - virtual void importBiffRecord( BiffInputStream& rStrm, sal_uInt16 nFlags ); - - /** Returns converted UNO API filter settings representing all filter settings. */ - virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ); - -private: - /** Apeends the passed filter criteriom, if it contains valid settings. */ - void appendCriterion( const FilterCriterionModel& rCriterion ); - -private: - typedef ::std::vector< FilterCriterionModel > FilterCriterionVector; - - FilterCriterionVector maCriteria; - bool mbAnd; -}; - -// ============================================================================ - -/** A column in a filtered range. Contains an object with specific filter - settings for the cells in the column. - */ -class FilterColumn : public WorkbookHelper -{ -public: - explicit FilterColumn( const WorkbookHelper& rHelper ); - - /** Imports auto filter column settings from the filterColumn element. */ - void importFilterColumn( const AttributeList& rAttribs ); - /** Imports auto filter column settings from the FILTERCOLUMN record. */ - void importFilterColumn( SequenceInputStream& rStrm ); - /** Imports auto filter column settings from the FILTERCOLUMN record. */ - void importFilterColumn( BiffInputStream& rStrm ); - - /** Creates and returns the specified filter settings object. */ - template< typename FilterSettingsType > - inline FilterSettingsBase& createFilterSettings() - { mxSettings.reset( new FilterSettingsType( *this ) ); return *mxSettings; } - - /** Returns the index of the column in the filtered range this object is related to. */ - inline sal_Int32 getColumnId() const { return mnColId; } - - /** Returns converted UNO API filter settings representing all filter - settings of this column. */ - ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ); - -private: - FilterSettingsRef mxSettings; - sal_Int32 mnColId; - bool mbHiddenButton; - bool mbShowButton; -}; - -// ============================================================================ - -class AutoFilter : public WorkbookHelper -{ -public: - explicit AutoFilter( const WorkbookHelper& rHelper ); - - /** Imports auto filter settings from the autoFilter element. */ - void importAutoFilter( const AttributeList& rAttribs, sal_Int16 nSheet ); - /** Imports auto filter settings from the AUTOFILTER record. */ - void importAutoFilter( SequenceInputStream& rStrm, sal_Int16 nSheet ); - - /** Creates a new auto filter column and stores it internally. */ - FilterColumn& createFilterColumn(); - - /** Applies the filter to the passed filter descriptor. */ - void finalizeImport( - const ::com::sun::star::uno::Reference< - ::com::sun::star::sheet::XSheetFilterDescriptor3>& rxFilterDesc ); - -private: - typedef RefVector< FilterColumn > FilterColumnVector; - - FilterColumnVector maFilterColumns; - ::com::sun::star::table::CellRangeAddress maRange; -}; - -// ============================================================================ - -class AutoFilterBuffer : public WorkbookHelper -{ -public: - explicit AutoFilterBuffer( const WorkbookHelper& rHelper ); - - /** Creates a new auto filter and stores it internally. */ - AutoFilter& createAutoFilter(); - - /** Applies filter settings to a new database range object (used for sheet - autofilter or advanced filter as specified by built-in defined names). */ - void finalizeImport( sal_Int16 nSheet ); - - /** Applies the filters to the passed database range object. - @return True = this buffer contains valid auto filter settings. */ - bool finalizeImport( const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDatabaseRange >& rxDatabaseRange ); - -private: - /** Returns the auto filter object used to perform auto filtering. */ - AutoFilter* getActiveAutoFilter(); - -private: - typedef RefVector< AutoFilter > AutoFilterVector; - AutoFilterVector maAutoFilters; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/autofiltercontext.hxx b/oox/inc/oox/xls/autofiltercontext.hxx deleted file mode 100644 index 7860f6047824..000000000000 --- a/oox/inc/oox/xls/autofiltercontext.hxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_AUTOFILTERCONTEXT_HXX -#define OOX_XLS_AUTOFILTERCONTEXT_HXX - -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -class AutoFilter; -class FilterColumn; -class FilterSettingsBase; - -// ============================================================================ - -class FilterSettingsContext : public WorksheetContextBase -{ -public: - explicit FilterSettingsContext( WorksheetContextBase& rParent, FilterSettingsBase& rFilterSettings ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - FilterSettingsBase& mrFilterSettings; -}; - -// ============================================================================ - -class FilterColumnContext : public WorksheetContextBase -{ -public: - explicit FilterColumnContext( WorksheetContextBase& rParent, FilterColumn& rFilterColumn ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - FilterColumn& mrFilterColumn; -}; - -// ============================================================================ - -class AutoFilterContext : public WorksheetContextBase -{ -public: - explicit AutoFilterContext( WorksheetFragmentBase& rFragment, AutoFilter& rAutoFilter ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - AutoFilter& mrAutoFilter; -}; - -// ============================================================================ - -class BiffAutoFilterContext : public BiffWorksheetContextBase -{ -public: - explicit BiffAutoFilterContext( const WorksheetHelper& rHelper, AutoFilter& rAutoFilter ); - -protected: - /** Imports all records related to the current auto filter. */ - virtual void importRecord( BiffInputStream& rStrm ); - -private: - AutoFilter& mrAutoFilter; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/biffcodec.hxx b/oox/inc/oox/xls/biffcodec.hxx deleted file mode 100644 index d8bf69b7f9c9..000000000000 --- a/oox/inc/oox/xls/biffcodec.hxx +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_BIFFCODEC_HXX -#define OOX_XLS_BIFFCODEC_HXX - -#include <vector> -#include <comphelper/docpasswordhelper.hxx> -#include "oox/core/binarycodec.hxx" -#include "oox/xls/workbookhelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -const sal_Int64 BIFF_RCF_BLOCKSIZE = 1024; - -// ============================================================================ - -/** Base class for BIFF stream decoders. */ -class BiffDecoderBase : public ::comphelper::IDocPasswordVerifier -{ -public: - explicit BiffDecoderBase(); - virtual ~BiffDecoderBase(); - - /** Derived classes return a clone of the decoder for usage in new streams. */ - inline BiffDecoderBase* clone() { return implClone(); } - - /** Implementation of the ::comphelper::IDocPasswordVerifier interface. */ - virtual ::comphelper::DocPasswordVerifierResult verifyPassword( const ::rtl::OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ); - virtual ::comphelper::DocPasswordVerifierResult verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ); - - /** Returns true, if the decoder has been initialized correctly. */ - inline bool isValid() const { return mbValid; } - - /** Decodes nBytes bytes and writes encrypted data into the buffer pnDestData. */ - void decode( - sal_uInt8* pnDestData, - const sal_uInt8* pnSrcData, - sal_Int64 nStreamPos, - sal_uInt16 nBytes ); - -private: - /** Derived classes return a clone of the decoder for usage in new streams. */ - virtual BiffDecoderBase* implClone() = 0; - - /** Derived classes implement password verification and initialization of - the decoder. */ - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > implVerifyPassword( const ::rtl::OUString& rPassword ) = 0; - virtual bool implVerifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ) = 0; - - /** Implementation of decryption of a memory block. */ - virtual void implDecode( - sal_uInt8* pnDestData, - const sal_uInt8* pnSrcData, - sal_Int64 nStreamPos, - sal_uInt16 nBytes ) = 0; - -private: - bool mbValid; /// True = decoder is correctly initialized. -}; - -typedef ::boost::shared_ptr< BiffDecoderBase > BiffDecoderRef; - -// ============================================================================ - -/** Decodes BIFF stream contents that are encoded using the old XOR algorithm. */ -class BiffDecoder_XOR : public BiffDecoderBase -{ -public: - explicit BiffDecoder_XOR( sal_uInt16 nKey, sal_uInt16 nHash ); - -private: - /** Copy constructor for cloning. */ - BiffDecoder_XOR( const BiffDecoder_XOR& rDecoder ); - - /** Returns a clone of the decoder for usage in new streams. */ - virtual BiffDecoder_XOR* implClone(); - - /** Implements password verification and initialization of the decoder. */ - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > implVerifyPassword( const ::rtl::OUString& rPassword ); - virtual bool implVerifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ); - - - /** Implementation of decryption of a memory block. */ - virtual void implDecode( - sal_uInt8* pnDestData, - const sal_uInt8* pnSrcData, - sal_Int64 nStreamPos, - sal_uInt16 nBytes ); - -private: - ::oox::core::BinaryCodec_XOR maCodec; /// Cipher algorithm implementation. - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > maEncryptionData; - sal_uInt16 mnKey; - sal_uInt16 mnHash; -}; - -// ============================================================================ - -/** Decodes BIFF stream contents that are encoded using the RC4 algorithm. */ -class BiffDecoder_RCF : public BiffDecoderBase -{ -public: - explicit BiffDecoder_RCF( - sal_uInt8 pnSalt[ 16 ], - sal_uInt8 pnVerifier[ 16 ], - sal_uInt8 pnVerifierHash[ 16 ] ); - -private: - /** Copy constructor for cloning. */ - BiffDecoder_RCF( const BiffDecoder_RCF& rDecoder ); - - /** Returns a clone of the decoder for usage in new streams. */ - virtual BiffDecoder_RCF* implClone(); - - /** Implements password verification and initialization of the decoder. */ - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > implVerifyPassword( const ::rtl::OUString& rPassword ); - virtual bool implVerifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ); - - /** Implementation of decryption of a memory block. */ - virtual void implDecode( - sal_uInt8* pnDestData, - const sal_uInt8* pnSrcData, - sal_Int64 nStreamPos, - sal_uInt16 nBytes ); - -private: - ::oox::core::BinaryCodec_RCF maCodec; /// Cipher algorithm implementation. - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > maEncryptionData; - ::std::vector< sal_uInt8 > maSalt; - ::std::vector< sal_uInt8 > maVerifier; - ::std::vector< sal_uInt8 > maVerifierHash; -}; - -// ============================================================================ - -/** Helper for BIFF stream codecs. Holds the used codec object. */ -class BiffCodecHelper : public WorkbookHelper -{ -public: - explicit BiffCodecHelper( const WorkbookHelper& rHelper ); - - /** Implementation helper, reads the FILEPASS and returns a decoder object. */ - static BiffDecoderRef implReadFilePass( BiffInputStream& rStrm, BiffType eBiff ); - - /** Imports the FILEPASS record, asks for a password and sets a decoder at the stream. */ - bool importFilePass( BiffInputStream& rStrm ); - /** Clones the contained decoder object if existing and sets it at the passed stream. */ - void cloneDecoder( BiffInputStream& rStrm ); - -private: - BiffDecoderRef mxDecoder; /// The decoder for import filter. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/biffdetector.hxx b/oox/inc/oox/xls/biffdetector.hxx deleted file mode 100644 index 96d195ea2ef5..000000000000 --- a/oox/inc/oox/xls/biffdetector.hxx +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_BIFFDETECTOR_HXX -#define OOX_XLS_BIFFDETECTOR_HXX - -#include <com/sun/star/document/XExtendedFilterDetection.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/implbase2.hxx> -#include "oox/helper/storagebase.hxx" -#include "oox/xls/biffhelper.hxx" - -namespace com { namespace sun { namespace star { - namespace beans { struct PropertyValue; } - namespace uno { class XComponentContext; } -} } } - -namespace oox { class BinaryInputStream; } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Detection service for BIFF streams or storages. */ -class BiffDetector : public ::cppu::WeakImplHelper2< - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::document::XExtendedFilterDetection > -{ -public: - explicit BiffDetector( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) - throw( ::com::sun::star::uno::RuntimeException ); - - virtual ~BiffDetector(); - - /** Detects the BIFF version of the passed stream. */ - static BiffType detectStreamBiffVersion( BinaryInputStream& rInStream ); - - /** Detects the BIFF version and workbook stream name of the passed storage. */ - static BiffType detectStorageBiffVersion( - ::rtl::OUString& orWorkbookStreamName, - const StorageRef& rxStorage ); - - // com.sun.star.lang.XServiceInfo interface ------------------------------- - - virtual ::rtl::OUString SAL_CALL - getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); - - virtual sal_Bool SAL_CALL - supportsService( const ::rtl::OUString& rService ) - throw( ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); - - // com.sun.star.document.XExtendedFilterDetect interface ------------------ - - virtual ::rtl::OUString SAL_CALL - detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& orDescriptor ) - throw( ::com::sun::star::uno::RuntimeException ); - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > - mxContext; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx deleted file mode 100644 index be8303feac54..000000000000 --- a/oox/inc/oox/xls/biffhelper.hxx +++ /dev/null @@ -1,672 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_BIFFHELPER_HXX -#define OOX_XLS_BIFFHELPER_HXX - -#include "oox/helper/binarystreambase.hxx" - -namespace oox { class SequenceInputStream; } - -namespace oox { -namespace xls { - -class BiffInputStream; - -// BIFF12 record identifiers ================================================== - -const sal_Int32 BIFF12_ID_ARRAY = 0x01AA; -const sal_Int32 BIFF12_ID_AUTOFILTER = 0x00A1; -const sal_Int32 BIFF12_ID_AUTOSORTSCOPE = 0x01CB; -const sal_Int32 BIFF12_ID_BINARYINDEXBLOCK = 0x002A; -const sal_Int32 BIFF12_ID_BINARYINDEXROWS = 0x0028; -const sal_Int32 BIFF12_ID_BOOKVIEWS = 0x0087; -const sal_Int32 BIFF12_ID_BORDER = 0x002E; -const sal_Int32 BIFF12_ID_BORDERS = 0x0265; -const sal_Int32 BIFF12_ID_BRK = 0x018C; -const sal_Int32 BIFF12_ID_CALCPR = 0x009D; -const sal_Int32 BIFF12_ID_CELL_BLANK = 0x0001; -const sal_Int32 BIFF12_ID_CELL_BOOL = 0x0004; -const sal_Int32 BIFF12_ID_CELL_DOUBLE = 0x0005; -const sal_Int32 BIFF12_ID_CELL_ERROR = 0x0003; -const sal_Int32 BIFF12_ID_CELL_RK = 0x0002; -const sal_Int32 BIFF12_ID_CELL_RSTRING = 0x003E; -const sal_Int32 BIFF12_ID_CELL_SI = 0x0007; -const sal_Int32 BIFF12_ID_CELL_STRING = 0x0006; -const sal_Int32 BIFF12_ID_CELLSTYLE = 0x0030; -const sal_Int32 BIFF12_ID_CELLSTYLES = 0x026B; -const sal_Int32 BIFF12_ID_CELLSTYLEXFS = 0x0272; -const sal_Int32 BIFF12_ID_CELLXFS = 0x0269; -const sal_Int32 BIFF12_ID_CFCOLOR = 0x0234; -const sal_Int32 BIFF12_ID_CFRULE = 0x01CF; -const sal_Int32 BIFF12_ID_CHARTPAGESETUP = 0x028C; -const sal_Int32 BIFF12_ID_CHARTPROTECTION = 0x029D; -const sal_Int32 BIFF12_ID_CHARTSHEETPR = 0x028B; -const sal_Int32 BIFF12_ID_CHARTSHEETVIEW = 0x008D; -const sal_Int32 BIFF12_ID_CHARTSHEETVIEWS = 0x008B; -const sal_Int32 BIFF12_ID_COL = 0x003C; -const sal_Int32 BIFF12_ID_COLBREAKS = 0x018A; -const sal_Int32 BIFF12_ID_COLOR = 0x023C; -const sal_Int32 BIFF12_ID_COLORS = 0x01D9; -const sal_Int32 BIFF12_ID_COLORSCALE = 0x01D5; -const sal_Int32 BIFF12_ID_COLS = 0x0186; -const sal_Int32 BIFF12_ID_COMMENT = 0x027B; -const sal_Int32 BIFF12_ID_COMMENTAUTHOR = 0x0278; -const sal_Int32 BIFF12_ID_COMMENTAUTHORS = 0x0276; -const sal_Int32 BIFF12_ID_COMMENTLIST = 0x0279; -const sal_Int32 BIFF12_ID_COMMENTS = 0x0274; -const sal_Int32 BIFF12_ID_COMMENTTEXT = 0x027D; -const sal_Int32 BIFF12_ID_CONDFORMATTING = 0x01CD; -const sal_Int32 BIFF12_ID_CONNECTION = 0x00C9; -const sal_Int32 BIFF12_ID_CONNECTIONS = 0x01AD; -const sal_Int32 BIFF12_ID_CONTROL = 0x0284; -const sal_Int32 BIFF12_ID_CONTROLS = 0x0283; -const sal_Int32 BIFF12_ID_CUSTOMCHARTVIEW = 0x028F; -const sal_Int32 BIFF12_ID_CUSTOMCHARTVIEWS = 0x028D; -const sal_Int32 BIFF12_ID_CUSTOMFILTER = 0x00AE; -const sal_Int32 BIFF12_ID_CUSTOMFILTERS = 0x00AC; -const sal_Int32 BIFF12_ID_CUSTOMSHEETVIEW = 0x01A7; -const sal_Int32 BIFF12_ID_CUSTOMSHEETVIEWS = 0x01A6; -const sal_Int32 BIFF12_ID_CUSTOMWORKBOOKVIEW= 0x018D; -const sal_Int32 BIFF12_ID_DATABAR = 0x01D3; -const sal_Int32 BIFF12_ID_DATATABLE = 0x01AC; -const sal_Int32 BIFF12_ID_DATAVALIDATION = 0x0040; -const sal_Int32 BIFF12_ID_DATAVALIDATIONS = 0x023D; -const sal_Int32 BIFF12_ID_DDEITEMVALUES = 0x0242; -const sal_Int32 BIFF12_ID_DDEITEM_BOOL = 0x0248; -const sal_Int32 BIFF12_ID_DDEITEM_DOUBLE = 0x0244; -const sal_Int32 BIFF12_ID_DDEITEM_ERROR = 0x0245; -const sal_Int32 BIFF12_ID_DDEITEM_STRING = 0x0246; -const sal_Int32 BIFF12_ID_DEFINEDNAME = 0x0027; -const sal_Int32 BIFF12_ID_DIMENSION = 0x0094; -const sal_Int32 BIFF12_ID_DISCRETEFILTER = 0x00A7; -const sal_Int32 BIFF12_ID_DISCRETEFILTERS = 0x00A5; -const sal_Int32 BIFF12_ID_DRAWING = 0x0226; -const sal_Int32 BIFF12_ID_DXF = 0x01FB; -const sal_Int32 BIFF12_ID_DXFS = 0x01F9; -const sal_Int32 BIFF12_ID_EXTCELL_BLANK = 0x016F; -const sal_Int32 BIFF12_ID_EXTCELL_BOOL = 0x0171; -const sal_Int32 BIFF12_ID_EXTCELL_DOUBLE = 0x0170; -const sal_Int32 BIFF12_ID_EXTCELL_ERROR = 0x0172; -const sal_Int32 BIFF12_ID_EXTCELL_STRING = 0x0173; -const sal_Int32 BIFF12_ID_EXTERNALADDIN = 0x029B; -const sal_Int32 BIFF12_ID_EXTERNALBOOK = 0x0168; -const sal_Int32 BIFF12_ID_EXTERNALNAME = 0x0241; -const sal_Int32 BIFF12_ID_EXTERNALREF = 0x0163; -const sal_Int32 BIFF12_ID_EXTERNALREFS = 0x0161; -const sal_Int32 BIFF12_ID_EXTERNALSELF = 0x0165; -const sal_Int32 BIFF12_ID_EXTERNALSAME = 0x0166; -const sal_Int32 BIFF12_ID_EXTERNALSHEETS = 0x016A; -const sal_Int32 BIFF12_ID_EXTROW = 0x016E; -const sal_Int32 BIFF12_ID_EXTSHEETDATA = 0x016B; -const sal_Int32 BIFF12_ID_EXTERNALNAMEFLAGS = 0x024A; -const sal_Int32 BIFF12_ID_EXTSHEETNAMES = 0x0167; -const sal_Int32 BIFF12_ID_FILESHARING = 0x0224; -const sal_Int32 BIFF12_ID_FILEVERSION = 0x0080; -const sal_Int32 BIFF12_ID_FILL = 0x002D; -const sal_Int32 BIFF12_ID_FILLS = 0x025B; -const sal_Int32 BIFF12_ID_FILTERCOLUMN = 0x00A3; -const sal_Int32 BIFF12_ID_FONT = 0x002B; -const sal_Int32 BIFF12_ID_FONTS = 0x0263; -const sal_Int32 BIFF12_ID_FORMULA_STRING = 0x0008; -const sal_Int32 BIFF12_ID_FORMULA_DOUBLE = 0x0009; -const sal_Int32 BIFF12_ID_FORMULA_BOOL = 0x000A; -const sal_Int32 BIFF12_ID_FORMULA_ERROR = 0x000B; -const sal_Int32 BIFF12_ID_FUNCTIONGROUP = 0x0299; -const sal_Int32 BIFF12_ID_FUNCTIONGROUPS = 0x0298; -const sal_Int32 BIFF12_ID_HEADERFOOTER = 0x01DF; -const sal_Int32 BIFF12_ID_HYPERLINK = 0x01EE; -const sal_Int32 BIFF12_ID_ICONSET = 0x01D1; -const sal_Int32 BIFF12_ID_INDEXEDCOLORS = 0x0235; -const sal_Int32 BIFF12_ID_INPUTCELLS = 0x01F8; -const sal_Int32 BIFF12_ID_LEGACYDRAWING = 0x0227; -const sal_Int32 BIFF12_ID_MERGECELL = 0x00B0; -const sal_Int32 BIFF12_ID_MERGECELLS = 0x00B1; -const sal_Int32 BIFF12_ID_MRUCOLORS = 0x0239; -const sal_Int32 BIFF12_ID_MULTCELL_BLANK = 0x000C; -const sal_Int32 BIFF12_ID_MULTCELL_BOOL = 0x000F; -const sal_Int32 BIFF12_ID_MULTCELL_DOUBLE = 0x0010; -const sal_Int32 BIFF12_ID_MULTCELL_ERROR = 0x000E; -const sal_Int32 BIFF12_ID_MULTCELL_RK = 0x000D; -const sal_Int32 BIFF12_ID_MULTCELL_RSTRING = 0x003D; -const sal_Int32 BIFF12_ID_MULTCELL_SI = 0x0012; -const sal_Int32 BIFF12_ID_MULTCELL_STRING = 0x0011; -const sal_Int32 BIFF12_ID_NUMFMT = 0x002C; -const sal_Int32 BIFF12_ID_NUMFMTS = 0x0267; -const sal_Int32 BIFF12_ID_OLEOBJECT = 0x027F; -const sal_Int32 BIFF12_ID_OLEOBJECTS = 0x027E; -const sal_Int32 BIFF12_ID_OLESIZE = 0x0225; -const sal_Int32 BIFF12_ID_PAGEMARGINS = 0x01DC; -const sal_Int32 BIFF12_ID_PAGESETUP = 0x01DE; -const sal_Int32 BIFF12_ID_PANE = 0x0097; -const sal_Int32 BIFF12_ID_PCDEFINITION = 0x00B3; -const sal_Int32 BIFF12_ID_PCDFDISCRETEPR = 0x00E1; -const sal_Int32 BIFF12_ID_PCDFGROUPITEMS = 0x00DD; -const sal_Int32 BIFF12_ID_PCDFIELD = 0x00B7; -const sal_Int32 BIFF12_ID_PCDFIELDGROUP = 0x00DB; -const sal_Int32 BIFF12_ID_PCDFIELDS = 0x00B5; -const sal_Int32 BIFF12_ID_PCDFRANGEPR = 0x00DF; -const sal_Int32 BIFF12_ID_PCDFSHAREDITEMS = 0x00BD; -const sal_Int32 BIFF12_ID_PCDSHEETSOURCE = 0x00BB; -const sal_Int32 BIFF12_ID_PCDSOURCE = 0x00B9; -const sal_Int32 BIFF12_ID_PCITEM_ARRAY = 0x00BF; -const sal_Int32 BIFF12_ID_PCITEM_BOOL = 0x0016; -const sal_Int32 BIFF12_ID_PCITEM_DATE = 0x0019; -const sal_Int32 BIFF12_ID_PCITEM_DOUBLE = 0x0015; -const sal_Int32 BIFF12_ID_PCITEM_ERROR = 0x0017; -const sal_Int32 BIFF12_ID_PCITEM_INDEX = 0x001A; -const sal_Int32 BIFF12_ID_PCITEM_MISSING = 0x0014; -const sal_Int32 BIFF12_ID_PCITEM_STRING = 0x0018; -const sal_Int32 BIFF12_ID_PCITEMA_BOOL = 0x001D; -const sal_Int32 BIFF12_ID_PCITEMA_DATE = 0x0020; -const sal_Int32 BIFF12_ID_PCITEMA_DOUBLE = 0x001C; -const sal_Int32 BIFF12_ID_PCITEMA_ERROR = 0x001E; -const sal_Int32 BIFF12_ID_PCITEMA_MISSING = 0x001B; -const sal_Int32 BIFF12_ID_PCITEMA_STRING = 0x001F; -const sal_Int32 BIFF12_ID_PCRECORD = 0x0021; -const sal_Int32 BIFF12_ID_PCRECORDDT = 0x0022; -const sal_Int32 BIFF12_ID_PCRECORDS = 0x00C1; -const sal_Int32 BIFF12_ID_PHONETICPR = 0x0219; -const sal_Int32 BIFF12_ID_PICTURE = 0x0232; -const sal_Int32 BIFF12_ID_PIVOTAREA = 0x00F7; -const sal_Int32 BIFF12_ID_PIVOTCACHE = 0x0182; -const sal_Int32 BIFF12_ID_PIVOTCACHES = 0x0180; -const sal_Int32 BIFF12_ID_PRINTOPTIONS = 0x01DD; -const sal_Int32 BIFF12_ID_PTCOLFIELDS = 0x0137; -const sal_Int32 BIFF12_ID_PTDATAFIELD = 0x0125; -const sal_Int32 BIFF12_ID_PTDATAFIELDS = 0x0127; -const sal_Int32 BIFF12_ID_PTDEFINITION = 0x0118; -const sal_Int32 BIFF12_ID_PTFIELD = 0x011D; -const sal_Int32 BIFF12_ID_PTFIELDS = 0x011F; -const sal_Int32 BIFF12_ID_PTFILTER = 0x0259; -const sal_Int32 BIFF12_ID_PTFILTERS = 0x0257; -const sal_Int32 BIFF12_ID_PTFITEM = 0x011A; -const sal_Int32 BIFF12_ID_PTFITEMS = 0x011B; -const sal_Int32 BIFF12_ID_PTLOCATION = 0x013A; -const sal_Int32 BIFF12_ID_PTPAGEFIELD = 0x0121; -const sal_Int32 BIFF12_ID_PTPAGEFIELDS = 0x0123; -const sal_Int32 BIFF12_ID_PTREFERENCE = 0x00FB; -const sal_Int32 BIFF12_ID_PTREFERENCEITEM = 0x017E; -const sal_Int32 BIFF12_ID_PTREFERENCES = 0x00F9; -const sal_Int32 BIFF12_ID_PTROWFIELDS = 0x0135; -const sal_Int32 BIFF12_ID_QUERYTABLE = 0x01BF; -const sal_Int32 BIFF12_ID_QUERYTABLEREFRESH = 0x01C1; -const sal_Int32 BIFF12_ID_RGBCOLOR = 0x01DB; -const sal_Int32 BIFF12_ID_ROW = 0x0000; -const sal_Int32 BIFF12_ID_ROWBREAKS = 0x0188; -const sal_Int32 BIFF12_ID_SCENARIO = 0x01F6; -const sal_Int32 BIFF12_ID_SCENARIOS = 0x01F4; -const sal_Int32 BIFF12_ID_SELECTION = 0x0098; -const sal_Int32 BIFF12_ID_SHAREDFMLA = 0x01AB; -const sal_Int32 BIFF12_ID_SHEET = 0x009C; -const sal_Int32 BIFF12_ID_SHEETDATA = 0x0091; -const sal_Int32 BIFF12_ID_SHEETFORMATPR = 0x01E5; -const sal_Int32 BIFF12_ID_SHEETPR = 0x0093; -const sal_Int32 BIFF12_ID_SHEETPROTECTION = 0x0217; -const sal_Int32 BIFF12_ID_SHEETS = 0x008F; -const sal_Int32 BIFF12_ID_SHEETVIEW = 0x0089; -const sal_Int32 BIFF12_ID_SHEETVIEWS = 0x0085; -const sal_Int32 BIFF12_ID_SI = 0x0013; -const sal_Int32 BIFF12_ID_SST = 0x009F; -const sal_Int32 BIFF12_ID_STYLESHEET = 0x0116; -const sal_Int32 BIFF12_ID_TABLE = 0x0157; -const sal_Int32 BIFF12_ID_TABLEPART = 0x0295; -const sal_Int32 BIFF12_ID_TABLEPARTS = 0x0294; -const sal_Int32 BIFF12_ID_TABLESTYLEINFO = 0x0201; -const sal_Int32 BIFF12_ID_TABLESTYLES = 0x01FC; -const sal_Int32 BIFF12_ID_TOP10FILTER = 0x00AA; -const sal_Int32 BIFF12_ID_VOLTYPE = 0x0204; -const sal_Int32 BIFF12_ID_VOLTYPEMAIN = 0x0206; -const sal_Int32 BIFF12_ID_VOLTYPES = 0x0202; -const sal_Int32 BIFF12_ID_VOLTYPESTP = 0x020A; -const sal_Int32 BIFF12_ID_VOLTYPETR = 0x020B; -const sal_Int32 BIFF12_ID_WEBPR = 0x0105; -const sal_Int32 BIFF12_ID_WEBPRTABLES = 0x0107; -const sal_Int32 BIFF12_ID_WORKBOOK = 0x0083; -const sal_Int32 BIFF12_ID_WORKBOOKPR = 0x0099; -const sal_Int32 BIFF12_ID_WORKBOOKVIEW = 0x009E; -const sal_Int32 BIFF12_ID_WORKSHEET = 0x0081; -const sal_Int32 BIFF12_ID_XF = 0x002F; - -// BIFF2-BIFF8 record identifiers ============================================= - -/** An enumeration for all binary Excel file format types (BIFF types). */ -enum BiffType -{ - BIFF2 = 0, /// MS Excel 2.1. - BIFF3, /// MS Excel 3.0. - BIFF4, /// MS Excel 4.0. - BIFF5, /// MS Excel 5.0, MS Excel 7.0 (95). - BIFF8, /// MS Excel 8.0 (97), 9.0 (2000), 10.0 (XP), 11.0 (2003). - BIFF_UNKNOWN /// Unknown BIFF version. -}; - -const sal_uInt16 BIFF2_MAXRECSIZE = 2080; -const sal_uInt16 BIFF8_MAXRECSIZE = 8224; - -// record identifiers --------------------------------------------------------- - -const sal_uInt16 BIFF2_ID_ARRAY = 0x0021; -const sal_uInt16 BIFF3_ID_ARRAY = 0x0221; -const sal_uInt16 BIFF_ID_AUTOFILTER = 0x009D; -const sal_uInt16 BIFF2_ID_BLANK = 0x0001; -const sal_uInt16 BIFF3_ID_BLANK = 0x0201; -const sal_uInt16 BIFF2_ID_BOF = 0x0009; -const sal_uInt16 BIFF3_ID_BOF = 0x0209; -const sal_uInt16 BIFF4_ID_BOF = 0x0409; -const sal_uInt16 BIFF5_ID_BOF = 0x0809; -const sal_uInt16 BIFF_ID_BOOKBOOL = 0x00DA; -const sal_uInt16 BIFF_ID_BOOKEXT = 0x0863; -const sal_uInt16 BIFF2_ID_BOOLERR = 0x0005; -const sal_uInt16 BIFF3_ID_BOOLERR = 0x0205; -const sal_uInt16 BIFF_ID_BOTTOMMARGIN = 0x0029; -const sal_uInt16 BIFF_ID_CALCCOUNT = 0x000C; -const sal_uInt16 BIFF_ID_CALCMODE = 0x000D; -const sal_uInt16 BIFF_ID_CFHEADER = 0x01B0; -const sal_uInt16 BIFF_ID_CFRULE = 0x01B1; -const sal_uInt16 BIFF_ID_CFRULE12 = 0x087A; -const sal_uInt16 BIFF_ID_CFRULEEXT = 0x087B; -const sal_uInt16 BIFF_ID_CH3DDATAFORMAT = 0x105F; -const sal_uInt16 BIFF_ID_CHAREA = 0x101A; -const sal_uInt16 BIFF_ID_CHAREAFORMAT = 0x100A; -const sal_uInt16 BIFF_ID_CHATTACHEDLABEL = 0x100C; -const sal_uInt16 BIFF_ID_CHAXESSET = 0x1041; -const sal_uInt16 BIFF_ID_CHAXIS = 0x101D; -const sal_uInt16 BIFF_ID_CHAXISLINE = 0x1021; -const sal_uInt16 BIFF_ID_CHBAR = 0x1017; -const sal_uInt16 BIFF_ID_CHBEGIN = 0x1033; -const sal_uInt16 BIFF_ID_CHCHART = 0x1002; -const sal_uInt16 BIFF_ID_CHCHART3D = 0x103A; -const sal_uInt16 BIFF_ID_CHCHARTLINE = 0x101C; -const sal_uInt16 BIFF_ID_CHDATAFORMAT = 0x1006; -const sal_uInt16 BIFF_ID_CHDATERANGE = 0x1062; -const sal_uInt16 BIFF_ID_CHDEFAULTTEXT = 0x1024; -const sal_uInt16 BIFF_ID_CHDROPBAR = 0x103D; -const sal_uInt16 BIFF_ID_CHECKCOMPAT = 0x088C; -const sal_uInt16 BIFF_ID_CHEND = 0x1034; -const sal_uInt16 BIFF_ID_CHESCHERFORMAT = 0x1066; -const sal_uInt16 BIFF_ID_CHFONT = 0x1026; -const sal_uInt16 BIFF_ID_CHFORMAT = 0x104E; -const sal_uInt16 BIFF_ID_CHFORMATRUNS = 0x1050; -const sal_uInt16 BIFF_ID_CHFRAME = 0x1032; -const sal_uInt16 BIFF_ID_CHFRAMEPOS = 0x104F; -const sal_uInt16 BIFF_ID_CHFRBLOCKBEGIN = 0x0852; -const sal_uInt16 BIFF_ID_CHFRBLOCKEND = 0x0853; -const sal_uInt16 BIFF_ID_CHFRCATEGORYPROPS = 0x0856; -const sal_uInt16 BIFF_ID_CHFREXTPROPS = 0x089E; -const sal_uInt16 BIFF_ID_CHFREXTPROPSCONT = 0x089F; -const sal_uInt16 BIFF_ID_CHFRINFO = 0x0850; -const sal_uInt16 BIFF_ID_CHFRLABELPROPS = 0x086B; -const sal_uInt16 BIFF_ID_CHFRLAYOUT = 0x089D; -const sal_uInt16 BIFF_ID_CHFRPLOTAREALAYOUT = 0x08A7; -const sal_uInt16 BIFF_ID_CHFRSHAPEPROPS = 0x08A4; -const sal_uInt16 BIFF_ID_CHFRTEXTPROPS = 0x08A5; -const sal_uInt16 BIFF_ID_CHFRUNITPROPS = 0x0857; -const sal_uInt16 BIFF_ID_CHFRWRAPPER = 0x0851; -const sal_uInt16 BIFF_ID_CHLABELRANGE = 0x1020; -const sal_uInt16 BIFF_ID_CHLEGEND = 0x1015; -const sal_uInt16 BIFF_ID_CHLINE = 0x1018; -const sal_uInt16 BIFF_ID_CHLINEFORMAT = 0x1007; -const sal_uInt16 BIFF_ID_CHMARKERFORMAT = 0x1009; -const sal_uInt16 BIFF_ID_CHOBJECTLINK = 0x1027; -const sal_uInt16 BIFF_ID_CHPICFORMAT = 0x103C; -const sal_uInt16 BIFF_ID_CHPIE = 0x1019; -const sal_uInt16 BIFF_ID_CHPIEEXT = 0x1061; -const sal_uInt16 BIFF_ID_CHPIEFORMAT = 0x100B; -const sal_uInt16 BIFF_ID_CHPIVOTFLAGS = 0x0859; -const sal_uInt16 BIFF5_ID_CHPIVOTREF = 0x1048; -const sal_uInt16 BIFF8_ID_CHPIVOTREF = 0x0858; -const sal_uInt16 BIFF_ID_CHPLOTFRAME = 0x1035; -const sal_uInt16 BIFF_ID_CHPLOTGROWTH = 0x1064; -const sal_uInt16 BIFF_ID_CHPROPERTIES = 0x1044; -const sal_uInt16 BIFF_ID_CHRADARLINE = 0x103E; -const sal_uInt16 BIFF_ID_CHRADARAREA = 0x1040; -const sal_uInt16 BIFF_ID_CHSCATTER = 0x101B; -const sal_uInt16 BIFF_ID_CHSERERRORBAR = 0x105B; -const sal_uInt16 BIFF_ID_CHSERGROUP = 0x1045; -const sal_uInt16 BIFF_ID_CHSERIES = 0x1003; -const sal_uInt16 BIFF_ID_CHSERIESFORMAT = 0x105D; -const sal_uInt16 BIFF_ID_CHSERPARENT = 0x104A; -const sal_uInt16 BIFF_ID_CHSERTRENDLINE = 0x104B; -const sal_uInt16 BIFF_ID_CHSOURCELINK = 0x1051; -const sal_uInt16 BIFF_ID_CHSTRING = 0x100D; -const sal_uInt16 BIFF_ID_CHSURFACE = 0x103F; -const sal_uInt16 BIFF_ID_CHTEXT = 0x1025; -const sal_uInt16 BIFF_ID_CHTICK = 0x101E; -const sal_uInt16 BIFF_ID_CHTYPEGROUP = 0x1014; -const sal_uInt16 BIFF_ID_CHVALUERANGE = 0x101F; -const sal_uInt16 BIFF_ID_CODENAME = 0x01BA; -const sal_uInt16 BIFF_ID_CODEPAGE = 0x0042; -const sal_uInt16 BIFF_ID_COLINFO = 0x007D; -const sal_uInt16 BIFF_ID_COLUMNDEFAULT = 0x0020; -const sal_uInt16 BIFF_ID_COLWIDTH = 0x0024; -const sal_uInt16 BIFF_ID_COMPRESSPICS = 0x089B; -const sal_uInt16 BIFF_ID_CONNECTION = 0x0876; -const sal_uInt16 BIFF_ID_CONT = 0x003C; -const sal_uInt16 BIFF_ID_COORDLIST = 0x00A9; -const sal_uInt16 BIFF_ID_COUNTRY = 0x008C; -const sal_uInt16 BIFF_ID_CRN = 0x005A; -const sal_uInt16 BIFF2_ID_DATATABLE = 0x0036; -const sal_uInt16 BIFF3_ID_DATATABLE = 0x0236; -const sal_uInt16 BIFF2_ID_DATATABLE2 = 0x0037; -const sal_uInt16 BIFF_ID_DATAVALIDATION = 0x01BE; -const sal_uInt16 BIFF_ID_DATAVALIDATIONS = 0x01B2; -const sal_uInt16 BIFF_ID_DATEMODE = 0x0022; -const sal_uInt16 BIFF_ID_DBCELL = 0x00D7; -const sal_uInt16 BIFF_ID_DBQUERY = 0x00DC; -const sal_uInt16 BIFF_ID_DCONBINAME = 0x01B5; -const sal_uInt16 BIFF_ID_DCONNAME = 0x0052; -const sal_uInt16 BIFF_ID_DCONREF = 0x0051; -const sal_uInt16 BIFF_ID_DEFCOLWIDTH = 0x0055; -const sal_uInt16 BIFF2_ID_DEFINEDNAME = 0x0018; -const sal_uInt16 BIFF3_ID_DEFINEDNAME = 0x0218; -const sal_uInt16 BIFF5_ID_DEFINEDNAME = 0x0018; -const sal_uInt16 BIFF2_ID_DEFROWHEIGHT = 0x0025; -const sal_uInt16 BIFF3_ID_DEFROWHEIGHT = 0x0225; -const sal_uInt16 BIFF_ID_DELTA = 0x0010; -const sal_uInt16 BIFF2_ID_DIMENSION = 0x0000; -const sal_uInt16 BIFF3_ID_DIMENSION = 0x0200; -const sal_uInt16 BIFF_ID_DXF = 0x088D; -const sal_uInt16 BIFF_ID_EOF = 0x000A; -const sal_uInt16 BIFF_ID_EXTERNALBOOK = 0x01AE; -const sal_uInt16 BIFF2_ID_EXTERNALNAME = 0x0023; -const sal_uInt16 BIFF3_ID_EXTERNALNAME = 0x0223; -const sal_uInt16 BIFF5_ID_EXTERNALNAME = 0x0023; -const sal_uInt16 BIFF_ID_EXTERNSHEET = 0x0017; -const sal_uInt16 BIFF_ID_EXTSST = 0x00FF; -const sal_uInt16 BIFF_ID_FILEPASS = 0x002F; -const sal_uInt16 BIFF_ID_FILESHARING = 0x005B; -const sal_uInt16 BIFF_ID_FILTERCOLUMN = 0x009E; -const sal_uInt16 BIFF_ID_FILTERMODE = 0x009B; -const sal_uInt16 BIFF2_ID_FONT = 0x0031; -const sal_uInt16 BIFF3_ID_FONT = 0x0231; -const sal_uInt16 BIFF5_ID_FONT = 0x0031; -const sal_uInt16 BIFF_ID_FONTCOLOR = 0x0045; -const sal_uInt16 BIFF_ID_FOOTER = 0x0015; -const sal_uInt16 BIFF_ID_FORCEFULLCALC = 0x08A3; -const sal_uInt16 BIFF2_ID_FORMAT = 0x001E; -const sal_uInt16 BIFF4_ID_FORMAT = 0x041E; -const sal_uInt16 BIFF2_ID_FORMULA = 0x0006; -const sal_uInt16 BIFF3_ID_FORMULA = 0x0206; -const sal_uInt16 BIFF4_ID_FORMULA = 0x0406; -const sal_uInt16 BIFF5_ID_FORMULA = 0x0006; -const sal_uInt16 BIFF_ID_GUTS = 0x0080; -const sal_uInt16 BIFF_ID_HCENTER = 0x0083; -const sal_uInt16 BIFF_ID_HEADER = 0x0014; -const sal_uInt16 BIFF_ID_HEADERFOOTER = 0x089C; -const sal_uInt16 BIFF_ID_HIDEOBJ = 0x008D; -const sal_uInt16 BIFF_ID_HORPAGEBREAKS = 0x001B; -const sal_uInt16 BIFF_ID_HYPERLINK = 0x01B8; -const sal_uInt16 BIFF3_ID_IMGDATA = 0x007F; -const sal_uInt16 BIFF8_ID_IMGDATA = 0x00E9; -const sal_uInt16 BIFF2_ID_INDEX = 0x000B; -const sal_uInt16 BIFF3_ID_INDEX = 0x020B; -const sal_uInt16 BIFF2_ID_INTEGER = 0x0002; -const sal_uInt16 BIFF_ID_INTERFACEHDR = 0x00E1; -const sal_uInt16 BIFF_ID_ITERATION = 0x0011; -const sal_uInt16 BIFF_ID_IXFE = 0x0044; -const sal_uInt16 BIFF2_ID_LABEL = 0x0004; -const sal_uInt16 BIFF3_ID_LABEL = 0x0204; -const sal_uInt16 BIFF_ID_LABELRANGES = 0x015F; -const sal_uInt16 BIFF_ID_LABELSST = 0x00FD; -const sal_uInt16 BIFF_ID_LEFTMARGIN = 0x0026; -const sal_uInt16 BIFF_ID_MERGEDCELLS = 0x00E5; -const sal_uInt16 BIFF_ID_MSODRAWING = 0x00EC; -const sal_uInt16 BIFF_ID_MSODRAWINGGROUP = 0x00EB; -const sal_uInt16 BIFF_ID_MSODRAWINGSEL = 0x00ED; -const sal_uInt16 BIFF_ID_MTHREADSETTINGS = 0x089A; -const sal_uInt16 BIFF_ID_MULTBLANK = 0x00BE; -const sal_uInt16 BIFF_ID_MULTRK = 0x00BD; -const sal_uInt16 BIFF_ID_NOTE = 0x001C; -const sal_uInt16 BIFF_ID_NOTESOUND = 0x0096; -const sal_uInt16 BIFF2_ID_NUMBER = 0x0003; -const sal_uInt16 BIFF3_ID_NUMBER = 0x0203; -const sal_uInt16 BIFF_ID_OBJ = 0x005D; -const sal_uInt16 BIFF_ID_OBJECTPROTECT = 0x0063; -const sal_uInt16 BIFF_ID_OLESIZE = 0x00DE; -const sal_uInt16 BIFF_ID_PAGELAYOUTVIEW = 0x088B; -const sal_uInt16 BIFF_ID_PAGESETUP = 0x00A1; -const sal_uInt16 BIFF_ID_PALETTE = 0x0092; -const sal_uInt16 BIFF_ID_PANE = 0x0041; -const sal_uInt16 BIFF_ID_PARAMQUERY = 0x00DC; -const sal_uInt16 BIFF_ID_PASSWORD = 0x0013; -const sal_uInt16 BIFF_ID_PCDEFINITION = 0x00C6; -const sal_uInt16 BIFF_ID_PCDEFINITION2 = 0x0122; -const sal_uInt16 BIFF_ID_PCDFDISCRETEPR = 0x00D9; -const sal_uInt16 BIFF_ID_PCDFIELD = 0x00C7; -const sal_uInt16 BIFF_ID_PCDFIELDINDEX = 0x0103; -const sal_uInt16 BIFF_ID_PCDFORMULAFIELD = 0x00F9; -const sal_uInt16 BIFF_ID_PCDFRANGEPR = 0x00D8; -const sal_uInt16 BIFF_ID_PCDFSQLTYPE = 0x01BB; -const sal_uInt16 BIFF_ID_PCDSOURCE = 0x00E3; -const sal_uInt16 BIFF_ID_PCITEM_BOOL = 0x00CA; -const sal_uInt16 BIFF_ID_PCITEM_DATE = 0x00CE; -const sal_uInt16 BIFF_ID_PCITEM_DOUBLE = 0x00C9; -const sal_uInt16 BIFF_ID_PCITEM_ERROR = 0x00CB; -const sal_uInt16 BIFF_ID_PCITEM_INDEXLIST = 0x00C8; -const sal_uInt16 BIFF_ID_PCITEM_INTEGER = 0x00CC; -const sal_uInt16 BIFF_ID_PCITEM_MISSING = 0x00CF; -const sal_uInt16 BIFF_ID_PCITEM_STRING = 0x00CD; -const sal_uInt16 BIFF_ID_PHONETICPR = 0x00EF; -const sal_uInt16 BIFF_ID_PICTURE = 0x00E9; -const sal_uInt16 BIFF_ID_PIVOTCACHE = 0x00D5; -const sal_uInt16 BIFF_ID_PRECISION = 0x000E; -const sal_uInt16 BIFF_ID_PRINTGRIDLINES = 0x002B; -const sal_uInt16 BIFF_ID_PRINTHEADERS = 0x002A; -const sal_uInt16 BIFF_ID_PROJEXTSHEET = 0x00A3; -const sal_uInt16 BIFF_ID_PROTECT = 0x0012; -const sal_uInt16 BIFF_ID_PTDATAFIELD = 0x00C5; -const sal_uInt16 BIFF_ID_PTDEFINITION = 0x00B0; -const sal_uInt16 BIFF_ID_PTDEFINITION2 = 0x00F1; -const sal_uInt16 BIFF_ID_PTFIELD = 0x00B1; -const sal_uInt16 BIFF_ID_PTFIELD2 = 0x0100; -const sal_uInt16 BIFF_ID_PTFITEM = 0x00B2; -const sal_uInt16 BIFF_ID_PTPAGEFIELDS = 0x00B6; -const sal_uInt16 BIFF_ID_PTROWCOLFIELDS = 0x00B4; -const sal_uInt16 BIFF_ID_PTROWCOLITEMS = 0x00B5; -const sal_uInt16 BIFF_ID_QUERYTABLE = 0x01AD; -const sal_uInt16 BIFF_ID_QUERYTABLEREFRESH = 0x0802; -const sal_uInt16 BIFF_ID_QUERYTABLESETTINGS = 0x0803; -const sal_uInt16 BIFF_ID_QUERYTABLESTRING = 0x0804; -const sal_uInt16 BIFF_ID_RECALCID = 0x01C1; -const sal_uInt16 BIFF_ID_REFMODE = 0x000F; -const sal_uInt16 BIFF_ID_RIGHTMARGIN = 0x0027; -const sal_uInt16 BIFF_ID_RK = 0x027E; -const sal_uInt16 BIFF2_ID_ROW = 0x0008; -const sal_uInt16 BIFF3_ID_ROW = 0x0208; -const sal_uInt16 BIFF_ID_RSTRING = 0x00D6; -const sal_uInt16 BIFF_ID_SAVERECALC = 0x005F; -const sal_uInt16 BIFF_ID_SCENARIO = 0x00AF; -const sal_uInt16 BIFF_ID_SCENARIOS = 0x00AE; -const sal_uInt16 BIFF_ID_SCL = 0x00A0; -const sal_uInt16 BIFF_ID_SCENPROTECT = 0x00DD; -const sal_uInt16 BIFF_ID_SCREENTIP = 0x0800; -const sal_uInt16 BIFF_ID_SELECTION = 0x001D; -const sal_uInt16 BIFF_ID_SHAREDFEATHEAD = 0x0867; -const sal_uInt16 BIFF_ID_SHAREDFMLA = 0x04BC; -const sal_uInt16 BIFF_ID_SHEET = 0x0085; -const sal_uInt16 BIFF_ID_SHEETEXT = 0x0862; -const sal_uInt16 BIFF_ID_SHEETHEADER = 0x008F; -const sal_uInt16 BIFF_ID_SHEETPR = 0x0081; -const sal_uInt16 BIFF_ID_SST = 0x00FC; -const sal_uInt16 BIFF_ID_STANDARDWIDTH = 0x0099; -const sal_uInt16 BIFF2_ID_STRING = 0x0007; -const sal_uInt16 BIFF3_ID_STRING = 0x0207; -const sal_uInt16 BIFF_ID_STYLE = 0x0293; -const sal_uInt16 BIFF_ID_STYLEEXT = 0x0892; -const sal_uInt16 BIFF_ID_TABLESTYLES = 0x088E; -const sal_uInt16 BIFF_ID_THEME = 0x0896; -const sal_uInt16 BIFF_ID_TOPMARGIN = 0x0028; -const sal_uInt16 BIFF_ID_TXO = 0x01B6; -const sal_uInt16 BIFF_ID_UNCALCED = 0x005E; -const sal_uInt16 BIFF_ID_USESELFS = 0x0160; -const sal_uInt16 BIFF_ID_VBAPROJECT = 0x00D3; -const sal_uInt16 BIFF_ID_VBAPROJECTEMPTY = 0x01BD; -const sal_uInt16 BIFF_ID_VCENTER = 0x0084; -const sal_uInt16 BIFF_ID_VERPAGEBREAKS = 0x001A; -const sal_uInt16 BIFF_ID_WINDOW1 = 0x003D; -const sal_uInt16 BIFF2_ID_WINDOW2 = 0x003E; -const sal_uInt16 BIFF3_ID_WINDOW2 = 0x023E; -const sal_uInt16 BIFF_ID_WRITEACCESS = 0x005C; -const sal_uInt16 BIFF_ID_XCT = 0x0059; -const sal_uInt16 BIFF2_ID_XF = 0x0043; -const sal_uInt16 BIFF3_ID_XF = 0x0243; -const sal_uInt16 BIFF4_ID_XF = 0x0443; -const sal_uInt16 BIFF5_ID_XF = 0x00E0; -const sal_uInt16 BIFF_ID_XFCRC = 0x087C; -const sal_uInt16 BIFF_ID_XFEXT = 0x087D; - -const sal_uInt16 BIFF_ID_UNKNOWN = SAL_MAX_UINT16; - -// OBJ subrecord identifiers -------------------------------------------------- - -const sal_uInt16 BIFF_ID_OBJEND = 0x0000; /// End of OBJ. -const sal_uInt16 BIFF_ID_OBJMACRO = 0x0004; /// Macro link. -const sal_uInt16 BIFF_ID_OBJBUTTON = 0x0005; /// Button data. -const sal_uInt16 BIFF_ID_OBJGMO = 0x0006; /// Group marker. -const sal_uInt16 BIFF_ID_OBJCF = 0x0007; /// Clipboard format. -const sal_uInt16 BIFF_ID_OBJFLAGS = 0x0008; /// Option flags. -const sal_uInt16 BIFF_ID_OBJPICTFMLA = 0x0009; /// OLE link formula. -const sal_uInt16 BIFF_ID_OBJCBLS = 0x000A; /// Check box/radio button data. -const sal_uInt16 BIFF_ID_OBJRBO = 0x000B; /// Radio button group data. -const sal_uInt16 BIFF_ID_OBJSBS = 0x000C; /// Scroll bar data. -const sal_uInt16 BIFF_ID_OBJNTS = 0x000C; /// Note data. -const sal_uInt16 BIFF_ID_OBJSBSFMLA = 0x000E; /// Scroll bar/list box/combo box cell link. -const sal_uInt16 BIFF_ID_OBJGBODATA = 0x000F; /// Group box data. -const sal_uInt16 BIFF_ID_OBJEDODATA = 0x0010; /// Edit box data. -const sal_uInt16 BIFF_ID_OBJRBODATA = 0x0011; /// Radio button group data. -const sal_uInt16 BIFF_ID_OBJCBLSDATA = 0x0012; /// Check box/radio button data. -const sal_uInt16 BIFF_ID_OBJLBSDATA = 0x0013; /// List box/combo box data. -const sal_uInt16 BIFF_ID_OBJCBLSFMLA = 0x0014; /// Check box/radio button cell link. -const sal_uInt16 BIFF_ID_OBJCMO = 0x0015; /// Common object settings. - -// record constants ----------------------------------------------------------- - -const sal_uInt16 BIFF_BOF_BIFF2 = 0x0200; -const sal_uInt16 BIFF_BOF_BIFF3 = 0x0300; -const sal_uInt16 BIFF_BOF_BIFF4 = 0x0400; -const sal_uInt16 BIFF_BOF_BIFF5 = 0x0500; -const sal_uInt16 BIFF_BOF_BIFF8 = 0x0600; - -const sal_uInt8 BIFF_ERR_NULL = 0x00; -const sal_uInt8 BIFF_ERR_DIV0 = 0x07; -const sal_uInt8 BIFF_ERR_VALUE = 0x0F; -const sal_uInt8 BIFF_ERR_REF = 0x17; -const sal_uInt8 BIFF_ERR_NAME = 0x1D; -const sal_uInt8 BIFF_ERR_NUM = 0x24; -const sal_uInt8 BIFF_ERR_NA = 0x2A; - -const sal_uInt8 BIFF_DATATYPE_EMPTY = 0; -const sal_uInt8 BIFF_DATATYPE_DOUBLE = 1; -const sal_uInt8 BIFF_DATATYPE_STRING = 2; -const sal_uInt8 BIFF_DATATYPE_BOOL = 4; -const sal_uInt8 BIFF_DATATYPE_ERROR = 16; - -const sal_uInt8 BIFF_BOOLERR_BOOL = 0; -const sal_uInt8 BIFF_BOOLERR_ERROR = 1; - -// BIFF8 unicode strings ------------------------------------------------------ - -const sal_uInt8 BIFF_STRF_16BIT = 0x01; -const sal_uInt8 BIFF_STRF_PHONETIC = 0x04; -const sal_uInt8 BIFF_STRF_RICH = 0x08; -const sal_uInt8 BIFF_STRF_UNKNOWN = 0xF2; - -// ============================================================================ - -/** Static helper functions for BIFF filters. */ -class BiffHelper -{ -public: - // conversion ------------------------------------------------------------- - - /** Converts the passed packed number to a double. */ - static double calcDoubleFromRk( sal_Int32 nRkValue ); - /** Converts the passed double to a packed number, returns true on success. */ - static bool calcRkFromDouble( sal_Int32& ornRkValue, double fValue ); - - /** Converts the passed BIFF error to a double containing the respective Calc error code. */ - static double calcDoubleFromError( sal_uInt8 nErrorCode ); - - /** Returns a text encoding from an Windows code page. - @return The corresponding text encoding or RTL_TEXTENCODING_DONTKNOW. */ - static rtl_TextEncoding calcTextEncodingFromCodePage( sal_uInt16 nCodePage ); - /** Returns a Windows code page from a text encoding. */ - static sal_uInt16 calcCodePageFromTextEncoding( rtl_TextEncoding eTextEnc ); - - // BIFF12 import ---------------------------------------------------------- - - /** Reads a BIFF12 string with leading 16-bit or 32-bit length field. */ - static ::rtl::OUString readString( SequenceInputStream& rStrm, bool b32BitLen = true, bool bAllowNulChars = false ); - - // BIFF2-BIFF8 import ----------------------------------------------------- - - /** Returns true, if the current record of the stream is a BOF record. */ - static bool isBofRecord( BiffInputStream& rStrm ); - - /** Skips a block of records up to the specified end record. - - Skips all records until next end record. When this function returns, - the stream points to the end record, and the next call of the function - startNextRecord() at the stream will start the record following the end - record. - - The identifier of the record that is active while this function is - called is used as start record identifier. This identifier is used to - correctly skip embedded record blocks with the same start and end - record identifier. - - @return True = stream points to the end record. - */ - static bool skipRecordBlock( BiffInputStream& rStrm, sal_uInt16 nEndRecId ); - - /** Imports a picture from an IMGDATA record. */ - static void importImgData( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, BiffType eBiff ); - -private: - BiffHelper(); // not implemented - ~BiffHelper(); // not implemented -}; - -// ---------------------------------------------------------------------------- - -/** BIFF12 stream operator for an ::rtl::OUString, reads 32-bit string length and Unicode array. */ -inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, ::rtl::OUString& orString ) -{ - orString = BiffHelper::readString( rStrm ); - return rStrm; -} - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/biffinputstream.hxx b/oox/inc/oox/xls/biffinputstream.hxx deleted file mode 100644 index c05186c0dd6a..000000000000 --- a/oox/inc/oox/xls/biffinputstream.hxx +++ /dev/null @@ -1,411 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_BIFFINPUTSTREAM_HXX -#define OOX_XLS_BIFFINPUTSTREAM_HXX - -#include <vector> -#include "oox/helper/binaryinputstream.hxx" -#include "oox/xls/biffhelper.hxx" -#include "oox/xls/biffcodec.hxx" - -namespace rtl { class OUStringBuffer; } - -namespace oox { -namespace xls { - -// ============================================================================ - -namespace prv { - -/** Buffers the contents of a raw record and encapsulates stream decoding. */ -class BiffInputRecordBuffer -{ -public: - explicit BiffInputRecordBuffer( BinaryInputStream& rInStrm ); - - /** Returns the wrapped binary base stream. */ - inline const BinaryInputStream& getBaseStream() const { return mrInStrm; } - - /** Sets a decoder object and decrypts buffered record data. */ - void setDecoder( const BiffDecoderRef& rxDecoder ); - /** Returns the current decoder object. */ - inline BiffDecoderRef getDecoder() const { return mxDecoder; } - /** Enables/disables usage of current decoder. */ - void enableDecoder( bool bEnable ); - - /** Restarts the stream at the passed position. Buffer is invalid until the - next call of startRecord() or startNextRecord(). */ - void restartAt( sal_Int64 nPos ); - - /** Reads the record header at the passed position. */ - bool startRecord( sal_Int64 nHeaderPos ); - /** Reads the next record header from the stream. */ - bool startNextRecord(); - /** Returns the start position of the record header in the core stream. */ - sal_uInt16 getNextRecId(); - - /** Returns the start position of the record header in the core stream. */ - inline sal_Int64 getRecHeaderPos() const { return mnHeaderPos; } - /** Returns the current record identifier. */ - inline sal_uInt16 getRecId() const { return mnRecId; } - /** Returns the current record size. */ - inline sal_uInt16 getRecSize() const { return mnRecSize; } - /** Returns the current read position in the current record body. */ - inline sal_uInt16 getRecPos() const { return mnRecPos; } - /** Returns the number of remaining bytes in the current record body. */ - inline sal_uInt16 getRecLeft() const { return mnRecSize - mnRecPos; } - - /** Reads nBytes bytes to the existing buffer opData. Must NOT overread the source buffer. */ - void read( void* opData, sal_uInt16 nBytes ); - /** Ignores nBytes bytes. Must NOT overread the buffer. */ - void skip( sal_uInt16 nBytes ); - -private: - /** Updates data buffer from stream, if needed. */ - void updateBuffer(); - /** Updates decoded data from original data. */ - void updateDecoded(); - -private: - typedef ::std::vector< sal_uInt8 > DataBuffer; - - BinaryInputStream& mrInStrm; /// Core input stream. - DataBuffer maOriginalData; /// Original data read from stream. - DataBuffer maDecodedData; /// Decoded data. - DataBuffer* mpCurrentData; /// Points to data buffer currently in use. - BiffDecoderRef mxDecoder; /// Decoder object. - sal_Int64 mnHeaderPos; /// Stream start position of current record header. - sal_Int64 mnBodyPos; /// Stream start position of current record body. - sal_Int64 mnBufferBodyPos; /// Stream start position of buffered data. - sal_Int64 mnNextHeaderPos; /// Stream start position of next record header. - sal_uInt16 mnRecId; /// Current record identifier. - sal_uInt16 mnRecSize; /// Current record size. - sal_uInt16 mnRecPos; /// Current position in record body. - bool mbValidHeader; /// True = valid record header. -}; - -} // namespace prv - -// ============================================================================ - -/** This class is used to read BIFF record streams. - - An instance is constructed with a BinaryInputStream object. The passed - stream is reset to its start while constructing this stream. - - To start reading a record call startNextRecord(). Now it is possible to - read all contents of the record using operator>>() or any of the read***() - functions. If some data exceeds the record size limit, the stream looks for - a following CONTINUE record and jumps automatically to it. It is NOT - allowed that an atomic data type is split into two records (e.g. 4 bytes of - a double in one record and the other 4 bytes in a following CONTINUE). - - Trying to read over the record limits results in a stream error. The - isValid() function indicates that by returning false. From now on the data - returned by the read functions is undefined. The error state will be reset, - if the record is reset (with the function resetRecord()), or if the next - record is started. - - To switch off the automatic lookup of CONTINUE records, use resetRecord() - with false parameter. This is useful e.g. on import of drawing layer data, - where sometimes solely CONTINUE records will occur. The automatic lookup - keeps switched off until the method resetRecord() is called with parameter - true. All other settings done on the stream (e.g. alternative CONTINUE - record identifier, enabled decryption, NUL substitution character) will be - reset to default values, if a new record is started. - - The import stream supports decrypting the stream data. The contents of a - record (not the record header) will be encrypted by Excel if the file has - been stored with password protection. The functions setDecoder() and - enableDecoder() control the usage of the decryption algorithms. - setDecoder() sets a new decryption algorithm and initially enables it. - enableDecoder( false ) may be used to stop the usage of the decryption - temporarily (sometimes record contents are never encrypted, e.g. all BOF - records or the stream position in SHEET records). Decryption will be - reenabled automatically, if a new record is started with the function - startNextRecord(). -*/ -class BiffInputStream : public BinaryInputStream -{ -public: - /** Constructs the BIFF record stream using the passed binary stream. - - @param rInStream - The base input stream. Must be seekable. Will be seeked to its - start position. - - @param bContLookup Automatic CONTINUE lookup on/off. - */ - explicit BiffInputStream( - BinaryInputStream& rInStream, - bool bContLookup = true ); - - // record control --------------------------------------------------------- - - /** Sets stream pointer to the start of the next record content. - - Ignores all CONTINUE records of the current record, if automatic - CONTINUE usage is switched on. - - @return False = no record found (end of stream). - */ - bool startNextRecord(); - - /** Sets stream pointer to the start of the content of the specified record. - - The handle of the current record can be received and stored using the - function getRecHandle() for later usage with this function. The record - handle is equivalent to the position of the underlying binary stream, - thus the function can be used to perform a hard seek to a specific - position, if it is sure that a record starts exactly at this position. - - @return False = no record found (invalid handle passed). - */ - bool startRecordByHandle( sal_Int64 nRecHandle ); - - /** Sets stream pointer to begin of record content. - - @param bContLookup - Automatic CONTINUE lookup on/off. In difference to other stream - settings, this setting is persistent until next call of this - function (because it is wanted to receive the next CONTINUE records - separately). - @param nAltContId - Sets an alternative record identifier for content continuation. - This value is reset automatically when a new record is started with - startNextRecord(). - */ - void resetRecord( - bool bContLookup, - sal_uInt16 nAltContId = BIFF_ID_UNKNOWN ); - - /** Sets stream pointer before current record and invalidates stream. - - The next call to startNextRecord() will start again the current record. - This can be used in situations where a loop or a function leaves on a - specific record, but the parent context expects to start this record by - itself. The stream is invalid as long as the first record has not been - started (it is not allowed to call any other stream operation then). - */ - void rewindRecord(); - - // decoder ---------------------------------------------------------------- - - /** Sets a new decoder object. - - Enables decryption of record contents for the rest of the stream. - */ - void setDecoder( const BiffDecoderRef& rxDecoder ); - - /** Enables/disables usage of current decoder. - - Decryption is reenabled automatically, if a new record is started using - the function startNextRecord(). - */ - void enableDecoder( bool bEnable = true ); - - // stream/record state and info ------------------------------------------- - - /** Returns the current record identifier. */ - inline sal_uInt16 getRecId() const { return mnRecId; } - /** Returns the record identifier of the following record. */ - sal_uInt16 getNextRecId(); - - /** Returns a unique handle for the current record that can be used with - the function startRecordByHandle(). */ - inline sal_Int64 getRecHandle() const { return mnRecHandle; } - - // BinaryStreamBase interface (seeking) ----------------------------------- - - /** Returns the data size of the whole record without record headers. */ - virtual sal_Int64 size() const; - /** Returns the position inside of the whole record content. */ - virtual sal_Int64 tell() const; - /** Seeks in record content to the specified position. */ - virtual void seek( sal_Int64 nRecPos ); - /** Closes the input stream but not the wrapped stream. */ - virtual void close(); - - /** Returns the absolute position in the wrapped binary stream. */ - sal_Int64 tellBase() const; - - // BinaryInputStream interface (stream read access) ----------------------- - - /** 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 and copies them to the passed buffer opMem. - @return Number of bytes really read. */ - virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); - /** Seeks forward inside the current record. */ - virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ); - - /** Stream operator for integral and floating-point types. */ - template< typename Type > - inline BiffInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; } - - // byte strings ----------------------------------------------------------- - - /** Reads 8/16 bit string length and character array, and returns the string. - @param b16BitLen - True = Read 16-bit string length field before the character array. - False = Read 8-bit string length field before the character array. - @param bAllowNulChars - True = NUL characters are inserted into the imported string. - False = NUL characters are replaced by question marks (default). - */ - ::rtl::OString readByteString( bool b16BitLen, bool bAllowNulChars = false ); - - /** Reads 8/16 bit string length and character array, and returns a Unicode string. - @param b16BitLen - True = Read 16-bit string length field before the character array. - False = Read 8-bit string length field before the character array. - @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). - */ - ::rtl::OUString readByteStringUC( bool b16BitLen, rtl_TextEncoding eTextEnc, bool bAllowNulChars = false ); - - // Unicode strings -------------------------------------------------------- - - /** Reads nChars characters of a BIFF8 string, and returns the string. - @param nChars Number of characters to read from the stream. - @param b16BitChars - True = The character array contains 16-bit characters. - False = The character array contains truncated 8-bit characters. - @param bAllowNulChars - True = NUL characters are inserted into the imported string. - False = NUL characters are replaced by question marks (default). - */ - ::rtl::OUString readUniStringChars( sal_uInt16 nChars, bool b16BitChars, bool bAllowNulChars = false ); - - /** Reads 8-bit flags, extended header, nChar characters, extended data of - a BIFF8 string, and returns the string. - @param nChars Number of 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). - */ - ::rtl::OUString readUniStringBody( sal_uInt16 nChars, bool bAllowNulChars = false ); - - /** Reads 16-bit character count, 8-bit flags, extended header, character - array, extended data of a BIFF8 string, and returns the string. - @param bAllowNulChars - True = NUL characters are inserted into the imported string. - False = NUL characters are replaced by question marks (default). - */ - ::rtl::OUString readUniString( bool bAllowNulChars = false ); - - // ------------------------------------------------------------------------ -private: - /** Initializes all members after base stream has been seeked to new record. */ - void setupRecord(); - /** Restarts the current record from the beginning. */ - void restartRecord( bool bInvalidateRecSize ); - /** Sets stream pointer before specified record and invalidates stream. */ - void rewindToRecord( sal_Int64 nRecHandle ); - /** Returns true, if stream was able to start a valid record. */ - inline bool isInRecord() const { return mnRecHandle >= 0; } - - /** Returns true, if the passed ID is real or alternative continuation record ID. */ - bool isContinueId( sal_uInt16 nRecId ) const; - /** Goes to start of the next CONTINUE record. - @descr Stream must be located at the end of a raw record, and handling - of CONTINUE records must be enabled. - @return True if next CONTINUE record has been found and initialized. */ - bool jumpToNextContinue(); - /** Goes to start of the next CONTINUE record while reading strings. - @descr Stream must be located at the end of a raw record. If reading - has been started in a CONTINUE record, jumps to an existing following - CONTINUE record, even if handling of CONTINUE records is disabled (this - is a special handling for TXO string data). Reads additional Unicode - flag byte at start of the new raw record and sets or resets rb16BitChars. - @return True if next CONTINUE record has been found and initialized. */ - bool jumpToNextStringContinue( bool& rb16BitChars ); - /** Calculates the complete length of the current record including CONTINUE - records, stores the length in mnComplRecSize. */ - void calcRecordLength(); - - /** Returns the maximum size of raw data possible to read in one block. */ - sal_uInt16 getMaxRawReadSize( sal_Int32 nBytes, size_t nAtomSize ) const; - - /** Reads the BIFF8 Unicode string header fields. */ - void readUniStringHeader( bool& orb16BitChars, sal_Int32& ornAddSize ); - -private: - prv::BiffInputRecordBuffer maRecBuffer; /// Raw record data buffer. - - sal_Int64 mnRecHandle; /// Handle of current record. - sal_uInt16 mnRecId; /// Identifier of current record (not the CONTINUE ID). - sal_uInt16 mnAltContId; /// Alternative identifier for content continuation records. - - sal_Int64 mnCurrRecSize; /// Helper for record size and position. - sal_Int64 mnComplRecSize; /// Size of complete record data (with CONTINUEs). - bool mbHasComplRec; /// True = mnComplRecSize is valid. - - bool mbCont; /// True = automatic CONTINUE lookup enabled. -}; - -// ============================================================================ - -class BiffInputStreamPos -{ -public: - explicit BiffInputStreamPos( BiffInputStream& rStrm ); - - bool restorePosition(); - - inline BiffInputStream& getStream() { return mrStrm; } - -private: - BiffInputStream& mrStrm; - sal_Int64 mnRecHandle; - sal_Int64 mnRecPos; -}; - -// ============================================================================ - -/** Stores the current position of the passed stream on construction and - restores it automatically on destruction. */ -class BiffInputStreamPosGuard : private BiffInputStreamPos -{ -public: - explicit BiffInputStreamPosGuard( BiffInputStream& rStrm ); - ~BiffInputStreamPosGuard(); -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/biffoutputstream.hxx b/oox/inc/oox/xls/biffoutputstream.hxx deleted file mode 100644 index 2a4ea9d2c20b..000000000000 --- a/oox/inc/oox/xls/biffoutputstream.hxx +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_BIFFOUTPUTSTREAM_HXX -#define OOX_XLS_BIFFOUTPUTSTREAM_HXX - -#include <vector> -#include "oox/helper/binaryoutputstream.hxx" -#include "oox/xls/biffhelper.hxx" - -namespace oox { class BinaryOutputStream; } - -namespace oox { -namespace xls { - -// ============================================================================ - -namespace prv { - -/** Buffers the contents of a raw record. */ -class BiffOutputRecordBuffer -{ -public: - explicit BiffOutputRecordBuffer( - BinaryOutputStream& rOutStrm, - sal_uInt16 nMaxRecSize ); - - /** Returns the wrapped binary base stream. */ - inline const BinaryOutputStream& getBaseStream() const { return mrOutStrm; } - - /** Starts a new record. */ - void startRecord( sal_uInt16 nRecId ); - /** Finishes the current record. Must be called for every started record. */ - void endRecord(); - - /** Returns the number of remaining bytes in the current record body. */ - inline sal_uInt16 getRecLeft() const { return static_cast< sal_uInt16 >( mnMaxRecSize - maData.size() ); } - - /** Writes nBytes bytes from the existing buffer pData. Must NOT overwrite the destination buffer. */ - void write( const void* pData, sal_uInt16 nBytes ); - /** Writes a sequence of nBytes bytes with the passed value. */ - void fill( sal_uInt8 nValue, sal_uInt16 nBytes ); - -private: - typedef ::std::vector< sal_uInt8 > DataBuffer; - - BinaryOutputStream& mrOutStrm; /// Core output stream. - DataBuffer maData; /// Record data buffer. - sal_uInt16 mnMaxRecSize; /// Maximum size of record contents. - sal_uInt16 mnRecId; /// Current record identifier. - bool mbInRec; /// True = currently writing inside of a record. -}; - -} // namespace prv - -// ============================================================================ - -/** This class is used to write BIFF record streams. - - An instance is constructed with a BinaryOutputStream object and the - maximum size of BIFF record contents (e.g. 2080 bytes in BIFF2-BIFF5, or - 8224 bytes in BIFF8). - - To start writing a record, call startRecord() with the record identifier. - Each record must be closed by calling endRecord(). - - If some data exceeds the record size limit, a CONTINUE record will be - started automatically and the new data will be written to this record. If - specific data pieces must not be split into the current and a following - CONTINUE record, use setPortionSize(). Example: To write a sequence of - 16-bit values where 4 values form a unit and cannot be split, call - setPortionSize(8) first (4*2 bytes == 8). -*/ -class BiffOutputStream : public BinaryOutputStream -{ -public: - explicit BiffOutputStream( - BinaryOutputStream& rOutStream, - sal_uInt16 nMaxRecSize ); - - // record control --------------------------------------------------------- - - /** Starts a new record. */ - void startRecord( sal_uInt16 nRecId ); - - /** Finishes the current record. Must be called for every started record. */ - void endRecord(); - - /** Sets size of data portion in bytes. 0 or 1 means no portions are used. */ - void setPortionSize( sal_uInt8 nSize ); - - // BinaryStreamBase interface (seeking) ----------------------------------- - - /** Returns the absolute position in the wrapped binary stream. */ - sal_Int64 tellBase() const; - /** Returns the total size of the wrapped binary stream. */ - sal_Int64 sizeBase() const; - - // BinaryOutputStream interface (stream write access) --------------------- - - /** Writes the passed data sequence. */ - virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ); - /** Writes nBytes bytes from the passed buffer pMem. */ - virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); - - /** Writes a sequence of nBytes bytes with the passed value. */ - void fill( sal_uInt8 nValue, sal_Int32 nBytes, size_t nAtomSize = 1 ); - - /** Stream operator for all data types supported by the writeValue() function. */ - template< typename Type > - inline BiffOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; } - - // ------------------------------------------------------------------------ -private: - /** Checks the remaining size in the current record, creates CONTINUE record if needed. */ - void ensureRawBlock( sal_uInt16 nSize ); - - /** Checks the remaining size in the current record and creates a CONTINUE - record if needed. - @return Maximum size left for writing to current record. */ - sal_uInt16 prepareWriteBlock( sal_Int32 nTotalSize, size_t nAtomSize ); - -private: - prv::BiffOutputRecordBuffer maRecBuffer; /// Raw record data buffer. - sal_uInt8 mnPortionSize; /// Size of data portions. - sal_uInt8 mnPortionPos; /// Position in current portion. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/chartsheetfragment.hxx b/oox/inc/oox/xls/chartsheetfragment.hxx deleted file mode 100644 index 2f2d44c23ffb..000000000000 --- a/oox/inc/oox/xls/chartsheetfragment.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_CHARTSHEETFRAGMENT_HXX -#define OOX_XLS_CHARTSHEETFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -class ChartsheetFragment : public WorksheetFragmentBase -{ -public: - explicit ChartsheetFragment( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - virtual void initializeImport(); - virtual void finalizeImport(); - -private: - /** Imports the the relation identifier for the DrawingML part. */ - void importDrawing( const AttributeList& rAttribs ); - /** Imports the DRAWING record containing the relation identifier for the DrawingML part. */ - void importDrawing( SequenceInputStream& rStrm ); -}; - -// ============================================================================ - -class BiffChartsheetFragment : public BiffWorksheetFragmentBase -{ -public: - explicit BiffChartsheetFragment( - const WorksheetHelper& rHelper, - const BiffWorkbookFragmentBase& rParent ); - - /** Imports the entire sheet fragment, returns true, if EOF record has been reached. */ - virtual bool importFragment(); -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/commentsbuffer.hxx b/oox/inc/oox/xls/commentsbuffer.hxx deleted file mode 100644 index b8731932c0c0..000000000000 --- a/oox/inc/oox/xls/commentsbuffer.hxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_COMMENTSBUFFER_HXX -#define OOX_XLS_COMMENTSBUFFER_HXX - -#include "oox/xls/richstring.hxx" -#include "oox/xls/worksheethelper.hxx" -#include <com/sun/star/awt/Rectangle.hpp> - -namespace oox { -namespace xls { - -// ============================================================================ - -struct CommentModel -{ - ::com::sun::star::table::CellRangeAddress - maRange; /// Position of the comment in the worksheet. - RichStringRef mxText; /// Formatted text of the comment. - ::rtl::OUString maAuthor; /// Comment author (BIFF8 only). - sal_Int32 mnAuthorId; /// Identifier of the comment's author. - sal_uInt16 mnObjId; /// Drawing object identifier (BIFF8 only). - sal_Bool mbAutoFill; /// Auto Selection of comment object's fill style - sal_Bool mbAutoScale; /// Auto Scale comment text - sal_Bool mbColHidden; /// Comment cell's Column is Hidden - sal_Bool mbLocked; /// Comment changes Locked - sal_Bool mbRowHidden; /// Comment cell's Row is Hidden - sal_Int32 mnTHA; /// Horizontal Alignment - sal_Int32 mnTVA; /// Vertical Alignment - ::com::sun::star::awt::Rectangle - maAnchor; /// Anchor parameters - bool mbVisible; /// True = comment is always shown (BIFF2-BIFF8 only). - - explicit CommentModel(); -}; - -// ---------------------------------------------------------------------------- - -class Comment : public WorksheetHelper -{ -public: - explicit Comment( const WorksheetHelper& rHelper ); - - /** Imports a cell comment from the passed attributes of the comment element. */ - void importComment( const AttributeList& rAttribs ); - /** Imports a cell comment Properties from the passed attributes of the comment element. */ - void importCommentPr( const AttributeList& rAttribs ); - /** Imports a cell comment from the passed stream of a COMMENT record. */ - void importComment( SequenceInputStream& rStrm ); - /** Imports a cell comment from the passed stream of a NOTE record. */ - void importNote( BiffInputStream& rStrm ); - - /** Creates and returns a new rich-string object for the comment text. */ - RichStringRef createText(); - - /** Finalizes the formatted string of the comment. */ - void finalizeImport(); - -private: - /** Reads a BIFF2-BIFF5 NOTE record. */ - void importNoteBiff2( BiffInputStream& rStrm ); - /** Reads a BIFF8 NOTE record. */ - void importNoteBiff8( BiffInputStream& rStrm ); - /** Reads a NOTESOUND record. */ - void importNoteSound( BiffInputStream& rStrm ); - -private: - CommentModel maModel; -}; - -typedef ::boost::shared_ptr< Comment > CommentRef; - -// ============================================================================ - -class CommentsBuffer : public WorksheetHelper -{ -public: - explicit CommentsBuffer( const WorksheetHelper& rHelper ); - - /** Appends a new author to the list of comment authors. */ - void appendAuthor( const ::rtl::OUString& rAuthor ); - /** Creates and returns a new comment. */ - CommentRef createComment(); - - /** Finalizes the formatted string of all comments. */ - void finalizeImport(); - -private: - typedef ::std::vector< ::rtl::OUString > OUStringVector; - typedef RefVector< Comment > CommentVector; - - OUStringVector maAuthors; - CommentVector maComments; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/commentsfragment.hxx b/oox/inc/oox/xls/commentsfragment.hxx deleted file mode 100644 index e0a43e8b0904..000000000000 --- a/oox/inc/oox/xls/commentsfragment.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ***********************************************************************/ - -#ifndef OOX_XLS_COMMENTSFRAGMENT_HXX -#define OOX_XLS_COMMENTSFRAGMENT_HXX - -#include "oox/xls/commentsbuffer.hxx" -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -class CommentsFragment : public WorksheetFragmentBase -{ -public: - explicit CommentsFragment( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - virtual void onEndElement(); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onEndRecord(); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - -private: - /** Imports comment data from the comment element. */ - void importComment( const AttributeList& rAttribs ); - /** Imports comment data from the COMMENT record. */ - void importComment( SequenceInputStream& rStrm ); - -private: - CommentRef mxComment; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/condformatbuffer.hxx b/oox/inc/oox/xls/condformatbuffer.hxx deleted file mode 100644 index 43541781d6b1..000000000000 --- a/oox/inc/oox/xls/condformatbuffer.hxx +++ /dev/null @@ -1,195 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_CONDFORMATBUFFER_HXX -#define OOX_XLS_CONDFORMATBUFFER_HXX - -#include <com/sun/star/sheet/ConditionOperator2.hpp> -#include "oox/xls/formulaparser.hxx" -#include "oox/xls/worksheethelper.hxx" - -namespace com { namespace sun { namespace star { - namespace sheet { class XSheetConditionalEntries; } -} } } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Model for a single rule in a conditional formatting. */ -struct CondFormatRuleModel -{ - typedef ::std::vector< ApiTokenSequence > ApiTokenSequenceVector; - - ApiTokenSequenceVector maFormulas; /// Formulas for rule conditions. - ::rtl::OUString maText; /// Text for 'contains' rules. - sal_Int32 mnPriority; /// Priority of this rule. - sal_Int32 mnType; /// Type of the rule. - sal_Int32 mnOperator; /// In cell-is rules: Comparison operator. - sal_Int32 mnTimePeriod; /// In time-period rules: Type of time period. - sal_Int32 mnRank; /// In top-10 rules: True = bottom, false = top. - sal_Int32 mnStdDev; /// In average rules: Number of std deviations. - sal_Int32 mnDxfId; /// Differential formatting identifier. - bool mbStopIfTrue; /// True = stop evaluating rules, if this rule is true. - bool mbBottom; /// In top-10 rules: True = bottom, false = top. - bool mbPercent; /// In top-10 rules: True = percent, false = rank. - bool mbAboveAverage; /// In average rules: True = above average, false = below. - bool mbEqualAverage; /// In average rules: True = include average, false = exclude. - - explicit CondFormatRuleModel(); - - /** Sets the passed BIFF operator for condition type cellIs. */ - void setBiffOperator( sal_Int32 nOperator ); - - /** Sets the passed BIFF12 text comparison type and operator. */ - void setBiff12TextType( sal_Int32 nOperator ); -}; - -// ============================================================================ - -class CondFormat; - -/** Represents a single rule in a conditional formatting. */ -class CondFormatRule : public WorksheetHelper -{ -public: - explicit CondFormatRule( const CondFormat& rCondFormat ); - - /** Imports rule settings from the cfRule element. */ - void importCfRule( const AttributeList& rAttribs ); - /** Appends a new condition formula string. */ - void appendFormula( const ::rtl::OUString& rFormula ); - - /** Imports rule settings from a CFRULE record. */ - void importCfRule( SequenceInputStream& rStrm ); - - /** Imports rule settings from a CFRULE record. */ - void importCfRule( BiffInputStream& rStrm, sal_Int32 nPriority ); - - /** Creates a conditional formatting rule in the Calc document. */ - void finalizeImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetConditionalEntries >& rxEntries ); - - /** Returns the priority of this rule. */ - inline sal_Int32 getPriority() const { return maModel.mnPriority; } - -private: - const CondFormat& mrCondFormat; - CondFormatRuleModel maModel; -}; - -typedef ::boost::shared_ptr< CondFormatRule > CondFormatRuleRef; - -// ============================================================================ - -/** Model for a conditional formatting object. */ -struct CondFormatModel -{ - ApiCellRangeList maRanges; /// Cell ranges for this conditional format. - bool mbPivot; /// Conditional formatting belongs to pivot table. - - explicit CondFormatModel(); -}; - -// ============================================================================ - -/** Represents a conditional formatting object with a list of affected cell ranges. */ -class CondFormat : public WorksheetHelper -{ -public: - explicit CondFormat( const WorksheetHelper& rHelper ); - - /** Imports settings from the conditionalFormatting element. */ - void importConditionalFormatting( const AttributeList& rAttribs ); - /** Imports a conditional formatting rule from the cfRule element. */ - CondFormatRuleRef importCfRule( const AttributeList& rAttribs ); - - /** Imports settings from the CONDFORMATTING record. */ - void importCondFormatting( SequenceInputStream& rStrm ); - /** Imports a conditional formatting rule from the CFRULE record. */ - void importCfRule( SequenceInputStream& rStrm ); - - /** Imports settings from the CFHEADER record. */ - void importCfHeader( BiffInputStream& rStrm ); - - /** Creates the conditional formatting in the Calc document. */ - void finalizeImport(); - - /** Returns the cell ranges this conditional formatting belongs to. */ - inline const ApiCellRangeList& getRanges() const { return maModel.maRanges; } - -private: - CondFormatRuleRef createRule(); - void insertRule( CondFormatRuleRef xRule ); - -private: - typedef RefMap< sal_Int32, CondFormatRule > CondFormatRuleMap; - - CondFormatModel maModel; /// Model of this conditional formatting. - CondFormatRuleMap maRules; /// Maps formatting rules by priority. -}; - -typedef ::boost::shared_ptr< CondFormat > CondFormatRef; - -// ============================================================================ - -class CondFormatBuffer : public WorksheetHelper -{ -public: - explicit CondFormatBuffer( const WorksheetHelper& rHelper ); - - /** Imports settings from the conditionalFormatting element. */ - CondFormatRef importConditionalFormatting( const AttributeList& rAttribs ); - /** Imports settings from the CONDFORMATTING record. */ - CondFormatRef importCondFormatting( SequenceInputStream& rStrm ); - /** Imports settings from the CFHEADER record. */ - void importCfHeader( BiffInputStream& rStrm ); - - /** Creates all conditional formatting in the Calc document. */ - void finalizeImport(); - - /** Converts an OOXML condition operator token to the API constant. */ - static sal_Int32 convertToApiOperator( sal_Int32 nToken ); - -private: - CondFormatRef createCondFormat(); - -private: - typedef RefVector< CondFormat > CondFormatVec; - CondFormatVec maCondFormats; /// All conditional formatting in a sheet. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/condformatcontext.hxx b/oox/inc/oox/xls/condformatcontext.hxx deleted file mode 100644 index 4289c32abe51..000000000000 --- a/oox/inc/oox/xls/condformatcontext.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_CONDFORMATCONTEXT_HXX -#define OOX_XLS_CONDFORMATCONTEXT_HXX - -#include "oox/xls/condformatbuffer.hxx" -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -class CondFormatContext : public WorksheetContextBase -{ -public: - explicit CondFormatContext( WorksheetFragmentBase& rFragment ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - CondFormatRef mxCondFmt; - CondFormatRuleRef mxRule; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/connectionsbuffer.hxx b/oox/inc/oox/xls/connectionsbuffer.hxx deleted file mode 100644 index 0674638f64f2..000000000000 --- a/oox/inc/oox/xls/connectionsbuffer.hxx +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_CONNECTIONSBUFFER_HXX -#define OOX_XLS_CONNECTIONSBUFFER_HXX - -#include "oox/helper/refvector.hxx" -#include "oox/xls/workbookhelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -const sal_Int32 BIFF12_CONNECTION_UNKNOWN = 0; -const sal_Int32 BIFF12_CONNECTION_ODBC = 1; -const sal_Int32 BIFF12_CONNECTION_DAO = 2; -const sal_Int32 BIFF12_CONNECTION_FILE = 3; -const sal_Int32 BIFF12_CONNECTION_HTML = 4; -const sal_Int32 BIFF12_CONNECTION_OLEDB = 5; -const sal_Int32 BIFF12_CONNECTION_TEXT = 6; -const sal_Int32 BIFF12_CONNECTION_ADO = 7; -const sal_Int32 BIFF12_CONNECTION_DSP = 8; - -// ============================================================================ - -/** Special properties for data connections representing web queries. */ -struct WebPrModel -{ - typedef ::std::vector< ::com::sun::star::uno::Any > TablesVector; - - TablesVector maTables; /// Names or indexes of the web query tables. - ::rtl::OUString maUrl; /// Source URL to refresh the data. - ::rtl::OUString maPostMethod; /// POST method to query data. - ::rtl::OUString maEditPage; /// Web page showing query data (for XML queries). - sal_Int32 mnHtmlFormat; /// Plain text, rich text, or HTML. - bool mbXml; /// True = XML query, false = HTML query. - bool mbSourceData; /// True = import XML source data referred by HTML table. - bool mbParsePre; /// True = parse preformatted sections (<pre> tag). - bool mbConsecutive; /// True = join consecutive delimiters. - bool mbFirstRow; /// True = use column withs of first row for entire <pre> tag. - bool mbXl97Created; /// True = web query created with Excel 97. - bool mbTextDates; /// True = read date values as text, false = parse dates. - bool mbXl2000Refreshed; /// True = refreshed with Excel 2000 or newer. - bool mbHtmlTables; /// True = HTML tables, false = entire document. - - explicit WebPrModel(); -}; - -// ---------------------------------------------------------------------------- - -/** Common properties of an external data connection. */ -struct ConnectionModel -{ - typedef ::std::auto_ptr< WebPrModel > WebPrModelPtr; - - WebPrModelPtr mxWebPr; /// Special settings for web queries. - ::rtl::OUString maName; /// Unique name of this connection. - ::rtl::OUString maDescription; /// User description of this connection. - ::rtl::OUString maSourceFile; /// URL of a source data file. - ::rtl::OUString maSourceConnFile; /// URL of a source connection file. - ::rtl::OUString maSsoId; /// Single sign-on identifier. - sal_Int32 mnId; /// Unique connection identifier. - sal_Int32 mnType; /// Data source type. - sal_Int32 mnReconnectMethod; /// Reconnection method. - sal_Int32 mnCredentials; /// Credentials method. - sal_Int32 mnInterval; /// Refresh interval in minutes. - bool mbKeepAlive; /// True = keep connection open after import. - bool mbNew; /// True = new connection, never updated. - bool mbDeleted; /// True = connection has been deleted. - bool mbOnlyUseConnFile; /// True = use maSourceConnFile, ignore mnReconnectMethod. - bool mbBackground; /// True = background refresh enabled. - bool mbRefreshOnLoad; /// True = refresh connection on import. - bool mbSaveData; /// True = save cached data with connection. - bool mbSavePassword; /// True = save password in connection string. - - explicit ConnectionModel(); - - WebPrModel& createWebPr(); -}; - -// ---------------------------------------------------------------------------- - -/** An external data connection (database, web query, etc.). */ -class Connection : public WorkbookHelper -{ -public: - explicit Connection( const WorkbookHelper& rHelper, sal_Int32 nConnId = -1 ); - - /** Imports connection settings from the connection element. */ - void importConnection( const AttributeList& rAttribs ); - /** Imports web query settings from the webPr element. */ - void importWebPr( const AttributeList& rAttribs ); - /** Imports web query table settings from the tables element. */ - void importTables( const AttributeList& rAttribs ); - /** Imports a web query table identifier from the m, s, or x element. */ - void importTable( const AttributeList& rAttribs, sal_Int32 nElement ); - - /** Imports connection settings from the CONNECTION record. */ - void importConnection( SequenceInputStream& rStrm ); - /** Imports web query settings from the WEBPR record. */ - void importWebPr( SequenceInputStream& rStrm ); - /** Imports web query table settings from the WEBPRTABLES record. */ - void importWebPrTables( SequenceInputStream& rStrm ); - /** Imports a web query table identifier from the PCITEM_MISSING, PCITEM_STRING, or PCITEM_INDEX record. */ - void importWebPrTable( SequenceInputStream& rStrm, sal_Int32 nRecId ); - - /** Imports connection settings from the DBQUERY record. */ - void importDbQuery( BiffInputStream& rStrm ); - /** Imports connection settings from the QUERYTABLESETTINGS record. */ - void importQueryTableSettings( BiffInputStream& rStrm ); - - /** Returns the unique connection identifier. */ - inline sal_Int32 getConnectionId() const { return maModel.mnId; } - /** Returns the source data type of the connection. */ - inline sal_Int32 getConnectionType() const { return maModel.mnType; } - /** Returns read-only access to the connection model data. */ - const ConnectionModel& getModel() const { return maModel; } - -private: - ConnectionModel maModel; -}; - -typedef ::boost::shared_ptr< Connection > ConnectionRef; - -// ============================================================================ - -class ConnectionsBuffer : public WorkbookHelper -{ -public: - explicit ConnectionsBuffer( const WorkbookHelper& rHelper ); - - /** Creates a new empty connection. */ - Connection& createConnection(); - /** Creates a new empty connection with a valid but unused identifier. */ - Connection& createConnectionWithId(); - - /** Maps all connections by their identifier. */ - void finalizeImport(); - - /** Returns a data connection by its unique identifier. */ - ConnectionRef getConnection( sal_Int32 nConnId ) const; - -private: - /** Inserts the passed connection into the map according to its identifier. */ - void insertConnectionToMap( const ConnectionRef& rxConnection ); - -private: - typedef RefVector< Connection > ConnectionVector; - typedef RefMap< sal_Int32, Connection > ConnectionMap; - - ConnectionVector maConnections; - ConnectionMap maConnectionsById; - sal_Int32 mnUnusedId; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/connectionsfragment.hxx b/oox/inc/oox/xls/connectionsfragment.hxx deleted file mode 100644 index 0b3e171a10c2..000000000000 --- a/oox/inc/oox/xls/connectionsfragment.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_CONNECTIONSFRAGMENT_HXX -#define OOX_XLS_CONNECTIONSFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -class Connection; - -// ============================================================================ - -class ConnectionContext : public WorkbookContextBase -{ -public: - explicit ConnectionContext( WorkbookFragmentBase& rParent, Connection& rConnection ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - Connection& mrConnection; -}; - -// ============================================================================ - -class ConnectionsFragment : public WorkbookFragmentBase -{ -public: - explicit ConnectionsFragment( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - virtual void finalizeImport(); -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/defnamesbuffer.hxx b/oox/inc/oox/xls/defnamesbuffer.hxx deleted file mode 100644 index a4b9257189fd..000000000000 --- a/oox/inc/oox/xls/defnamesbuffer.hxx +++ /dev/null @@ -1,235 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_DEFINEDNAMESBUFFER_HXX -#define OOX_XLS_DEFINEDNAMESBUFFER_HXX - -#include "oox/xls/formulabase.hxx" - -namespace com { namespace sun { namespace star { - namespace sheet { class XNamedRange; } -} } } - -namespace oox { -namespace xls { - -class BiffInputStreamPos; - -// ============================================================================ - -// codes for built-in names -const sal_Unicode BIFF_DEFNAME_CONSOLIDATEAREA = '\x00'; -const sal_Unicode BIFF_DEFNAME_AUTOOPEN = '\x01'; // Sheet macro executed when workbook is opened. -const sal_Unicode BIFF_DEFNAME_AUTOCLOSE = '\x02'; // Sheet macro executed when workbook is closed. -const sal_Unicode BIFF_DEFNAME_EXTRACT = '\x03'; // Filter output destination for advanced filter. -const sal_Unicode BIFF_DEFNAME_DATABASE = '\x04'; -const sal_Unicode BIFF_DEFNAME_CRITERIA = '\x05'; // Filter criteria source range for advanced filter. -const sal_Unicode BIFF_DEFNAME_PRINTAREA = '\x06'; // Print ranges. -const sal_Unicode BIFF_DEFNAME_PRINTTITLES = '\x07'; // Rows/columns repeated on each page when printing. -const sal_Unicode BIFF_DEFNAME_RECORDER = '\x08'; -const sal_Unicode BIFF_DEFNAME_DATAFORM = '\x09'; -const sal_Unicode BIFF_DEFNAME_AUTOACTIVATE = '\x0A'; // Sheet macro executed when workbook is activated. -const sal_Unicode BIFF_DEFNAME_AUTODEACTIVATE = '\x0B'; // Sheet macro executed when workbook is deactivated. -const sal_Unicode BIFF_DEFNAME_SHEETTITLE = '\x0C'; -const sal_Unicode BIFF_DEFNAME_FILTERDATABASE = '\x0D'; // Sheet range autofilter or advanced filter works on. -const sal_Unicode BIFF_DEFNAME_UNKNOWN = '\x0E'; - -// ============================================================================ - -struct DefinedNameModel -{ - ::rtl::OUString maName; /// The original name. - ::rtl::OUString maFormula; /// The formula string. - sal_Int32 mnSheet; /// Sheet index for local names. - sal_Int32 mnFuncGroupId; /// Function group identifier. - bool mbMacro; /// True = Macro name (VBA or sheet macro). - bool mbFunction; /// True = function, false = command. - bool mbVBName; /// True = VBA macro, false = sheet macro. - bool mbHidden; /// True = name hidden in UI. - - explicit DefinedNameModel(); -}; - -// ============================================================================ - -/** Base class for defined names and external names. */ -class DefinedNameBase : public WorkbookHelper -{ -public: - explicit DefinedNameBase( const WorkbookHelper& rHelper ); - - /** Returns the original name as imported from or exported to the file. */ - inline const ::rtl::OUString& getModelName() const { return maModel.maName; } - /** Returns the name as used in the Calc document. */ - inline const ::rtl::OUString& getCalcName() const { return maCalcName; } - - /** Returns the original name as imported from or exported to the file. */ - const ::rtl::OUString& getUpcaseModelName() const; - /** Returns an Any with a SingleReference or ComplexReference, or an empty Any. */ - ::com::sun::star::uno::Any getReference( const ::com::sun::star::table::CellAddress& rBaseAddr ) const; - -protected: - /** Converts the OOXML formula string stored in the own model. */ - ApiTokenSequence importOoxFormula( sal_Int16 nBaseSheet ); - /** Imports the BIFF12 formula from the passed stream. */ - ApiTokenSequence importBiff12Formula( sal_Int16 nBaseSheet, SequenceInputStream& rStrm ); - /** Imports the BIFF formula from the passed stream. */ - ApiTokenSequence importBiffFormula( sal_Int16 nBaseSheet, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ); - - /** Tries to convert the passed token sequence to a SingleReference or ComplexReference. */ - void extractReference( const ApiTokenSequence& rTokens ); - -protected: - DefinedNameModel maModel; /// Model data for this defined name. - mutable ::rtl::OUString maUpModelName; /// Model name converted to uppercase ASCII. - ::rtl::OUString maCalcName; /// Final name used in the Calc document. - ::com::sun::star::uno::Any maRefAny; /// Single cell/range reference. -}; - -// ============================================================================ - -class DefinedName : public DefinedNameBase -{ -public: - explicit DefinedName( const WorkbookHelper& rHelper ); - - /** Sets the attributes for this defined name from the passed attribute set. */ - void importDefinedName( const AttributeList& rAttribs ); - /** Sets the formula string from the body of the definedName element. */ - void setFormula( const ::rtl::OUString& rFormula ); - /** Imports the defined name from a DEFINEDNAME record in the passed stream. */ - void importDefinedName( SequenceInputStream& rStrm ); - /** Imports the defined name from a DEFINEDNAME record in the passed BIFF stream. */ - void importDefinedName( BiffInputStream& rStrm, sal_Int16 nCalcSheet ); - - /** Creates a defined name in the Calc document. */ - void createNameObject(); - /** Converts the formula string or BIFF token array for this defined name. */ - void convertFormula(); - - /** Returns true, if this defined name is global in the document. */ - inline bool isGlobalName() const { return mnCalcSheet < 0; } - /** Returns true, if this defined name is a special builtin name. */ - inline bool isBuiltinName() const { return mcBuiltinId != BIFF_DEFNAME_UNKNOWN; } - /** Returns true, if this defined name is a macro function call. */ - inline bool isMacroFunction() const { return maModel.mbMacro && maModel.mbFunction; } - /** Returns true, if this defined name is a reference to a VBA macro. */ - inline bool isVBName() const { return maModel.mbMacro && maModel.mbVBName; } - - /** Returns the 0-based sheet index for local names, or -1 for global names. */ - inline sal_Int16 getLocalCalcSheet() const { return mnCalcSheet; } - /** Returns the built-in identifier of the defined name. */ - inline sal_Unicode getBuiltinId() const { return mcBuiltinId; } - /** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */ - inline sal_Int32 getTokenIndex() const { return mnTokenIndex; } - /** Tries to resolve the defined name to an absolute cell range. */ - bool getAbsoluteRange( ::com::sun::star::table::CellRangeAddress& orRange ) const; - -private: - /** Imports the OOXML or BIFF12 definition of the name. */ - void implImportOoxFormula(); - /** Imports the BIFF definition of the name. */ - void implImportBiffFormula(); - -private: - typedef ::std::auto_ptr< StreamDataSequence > StreamDataSeqPtr; - typedef ::std::auto_ptr< BiffInputStreamPos > BiffStreamPosPtr; - - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange > - mxNamedRange; /// XNamedRange interface of the defined name. - sal_Int32 mnTokenIndex; /// Name index used in API token array. - sal_Int16 mnCalcSheet; /// Calc sheet index for sheet-local names. - sal_Unicode mcBuiltinId; /// Identifier for built-in defined names. - StreamDataSeqPtr mxFormula; /// Formula data for BIFF12 import. - BiffStreamPosPtr mxBiffStrm; /// Cached BIFF stream for formula import. - sal_uInt16 mnFmlaSize; /// Cached BIFF formula size for formula import. -}; - -typedef ::boost::shared_ptr< DefinedName > DefinedNameRef; - -// ============================================================================ - -class DefinedNamesBuffer : public WorkbookHelper -{ -public: - explicit DefinedNamesBuffer( const WorkbookHelper& rHelper ); - - /** Sets the sheet index for local names (BIFF2-BIFF4 only). */ - void setLocalCalcSheet( sal_Int16 nCalcSheet ); - - /** Imports a defined name from the passed attribute set. */ - DefinedNameRef importDefinedName( const AttributeList& rAttribs ); - /** Imports a defined name from a DEFINEDNAME record in the passed stream. */ - void importDefinedName( SequenceInputStream& rStrm ); - /** Imports a defined name from a DEFINEDNAME record in the passed BIFF stream. */ - void importDefinedName( BiffInputStream& rStrm ); - - /** Creates all defined names in the document. */ - void finalizeImport(); - - /** Returns a defined name by zero-based index (order of appearance). */ - DefinedNameRef getByIndex( sal_Int32 nIndex ) const; - /** Returns a defined name by token index (index in XDefinedNames container). */ - DefinedNameRef getByTokenIndex( sal_Int32 nIndex ) const; - /** Returns a defined name by its model name. - @param nSheet The sheet index for local names or -1 for global names. - If no local name is found, tries to find a matching global name. - @return Reference to the defined name or empty reference. */ - DefinedNameRef getByModelName( const ::rtl::OUString& rModelName, sal_Int16 nCalcSheet = -1 ) const; - /** Returns a built-in defined name by its built-in identifier. - @param nSheet The sheet index of the built-in name. - @return Reference to the defined name or empty reference. */ - DefinedNameRef getByBuiltinId( sal_Unicode cBuiltinId, sal_Int16 nCalcSheet ) const; - -private: - DefinedNameRef createDefinedName(); - -private: - typedef ::std::pair< sal_Int16, ::rtl::OUString > SheetNameKey; - typedef ::std::pair< sal_Int16, sal_Unicode > BuiltinKey; - - typedef RefVector< DefinedName > DefNameVector; - typedef RefMap< SheetNameKey, DefinedName > DefNameNameMap; - typedef RefMap< BuiltinKey, DefinedName > DefNameBuiltinMap; - typedef RefMap< sal_Int32, DefinedName > DefNameTokenIdMap; - - DefNameVector maDefNames; /// List of all defined names in insertion order. - DefNameNameMap maModelNameMap; /// Maps all defined names by sheet index and model name. - DefNameBuiltinMap maBuiltinMap; /// Maps all defined names by sheet index and built-in identifier. - DefNameTokenIdMap maTokenIdMap; /// Maps all defined names by API token index. - sal_Int16 mnCalcSheet; /// Current sheet index for BIFF2-BIFF4 names (always sheet-local). -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/drawingbase.hxx b/oox/inc/oox/xls/drawingbase.hxx deleted file mode 100644 index d7188b565647..000000000000 --- a/oox/inc/oox/xls/drawingbase.hxx +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_DRAWINGBASE_HXX -#define OOX_XLS_DRAWINGBASE_HXX - -#include "oox/drawingml/drawingmltypes.hxx" -#include "oox/xls/worksheethelper.hxx" - -#include <com/sun/star/drawing/XShape.hpp> -#include <com/sun/star/table/XCell.hpp> - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Absolute position in a spreadsheet (in EMUs) independent from cells. */ -struct AnchorPointModel : public ::oox::drawingml::EmuPoint -{ - inline explicit AnchorPointModel() : ::oox::drawingml::EmuPoint( -1, -1 ) {} - inline bool isValid() const { return (X >= 0) && (Y >= 0); } -}; - -// ---------------------------------------------------------------------------- - -/** Absolute size in a spreadsheet (in EMUs). */ -struct AnchorSizeModel : public ::oox::drawingml::EmuSize -{ - inline explicit AnchorSizeModel() : ::oox::drawingml::EmuSize( -1, -1 ) {} - inline bool isValid() const { return (Width >= 0) && (Height >= 0); } -}; - -// ---------------------------------------------------------------------------- - -/** Position in spreadsheet (cell position and offset inside cell). */ -struct CellAnchorModel -{ - sal_Int32 mnCol; /// Column index. - sal_Int32 mnRow; /// Row index. - sal_Int64 mnColOffset; /// X offset inside the column. - sal_Int64 mnRowOffset; /// Y offset inside the row. - - explicit CellAnchorModel(); - inline bool isValid() const { return (mnCol >= 0) && (mnRow >= 0); } -}; - -// ---------------------------------------------------------------------------- - -/** Application-specific client data of a shape. */ -struct AnchorClientDataModel -{ - bool mbLocksWithSheet; - bool mbPrintsWithSheet; - - explicit AnchorClientDataModel(); -}; - -// ============================================================================ - -/** Contains the position of a shape in the spreadsheet. Supports different - shape anchor modes (absolute, one-cell, two-cell). */ -class ShapeAnchor : public WorksheetHelper -{ -public: - explicit ShapeAnchor( const WorksheetHelper& rHelper ); - - /** Imports the shape anchor (one of the elements xdr:absoluteAnchor, xdr:oneCellAnchor, xdr:twoCellAnchor). */ - void importAnchor( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Imports the absolute anchor position from the xdr:pos element. */ - void importPos( const AttributeList& rAttribs ); - /** Imports the absolute anchor size from the xdr:ext element. */ - void importExt( const AttributeList& rAttribs ); - /** Imports the shape client data from the xdr:clientData element. */ - void importClientData( const AttributeList& rAttribs ); - /** Sets an attribute of the cell-dependent anchor position from xdr:from and xdr:to elements. */ - void setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue ); - /** Imports the client anchor settings from a VML element. */ - void importVmlAnchor( const ::rtl::OUString& rAnchor ); - /** Imports the client anchor settings from a BIFF or DFF stream. */ - void importBiffAnchor( BinaryInputStream& rStrm ); - - /** Calculates the resulting shape anchor in EMUs. */ - ::oox::drawingml::EmuRectangle calcAnchorRectEmu( - const ::com::sun::star::awt::Size& rPageSizeHmm ) const; - /** Calculates the resulting shape anchor in 1/100 mm. */ - ::com::sun::star::awt::Rectangle calcAnchorRectHmm( - const ::com::sun::star::awt::Size& rPageSizeHmm ) const; - /** Returns the 'from' cell if it exists */ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > getFromCell() const; - /** Applies Cell Anchor to an XShape if needed*/ - void applyToXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape ); -private: - /** Converts the passed anchor to an absolute position in EMUs. */ - ::oox::drawingml::EmuPoint calcCellAnchorEmu( const CellAnchorModel& rModel ) const; - -private: - enum AnchorType - { - ANCHOR_INVALID, /// Anchor type is unknown. - ANCHOR_ABSOLUTE, /// Absolute anchor (top-left corner and size in absolute units). - ANCHOR_ONECELL, /// One-cell anchor (top-left corner at cell, size in absolute units). - ANCHOR_TWOCELL, /// Two-cell anchor (top-left and bottom-right corner at cell). - ANCHOR_VML - }; - - /** Specifies how cell positions from CellAnchorModel have to be processed. */ - enum CellAnchorType - { - CELLANCHOR_EMU, /// Offsets are given in EMUs. - CELLANCHOR_PIXEL, /// Offsets are given in screen pixels. - CELLANCHOR_COLROW /// Offsets are given in fractions of column width or row height. - }; - - AnchorType meAnchorType; /// Type of this shape anchor. - CellAnchorType meCellAnchorType; /// Type of the cell anchor models. - AnchorPointModel maPos; /// Top-left position, if anchor is of type absolute. - AnchorSizeModel maSize; /// Anchor size, if anchor is not of type two-cell. - CellAnchorModel maFrom; /// Top-left position, if anchor is not of type absolute. - CellAnchorModel maTo; /// Bottom-right position, if anchor is of type two-cell. - AnchorClientDataModel maClientData; /// Shape client data. - sal_Int32 mnEditAs; /// Anchor mode as shown in the UI. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/drawingfragment.hxx b/oox/inc/oox/xls/drawingfragment.hxx deleted file mode 100644 index 1000845dcac7..000000000000 --- a/oox/inc/oox/xls/drawingfragment.hxx +++ /dev/null @@ -1,238 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_DRAWINGFRAGMENT_HXX -#define OOX_XLS_DRAWINGFRAGMENT_HXX - -#include <com/sun/star/awt/Rectangle.hpp> -#include <com/sun/star/awt/Size.hpp> -#include "oox/drawingml/shape.hxx" -#include "oox/drawingml/shapegroupcontext.hxx" -#include "oox/ole/axcontrol.hxx" -#include "oox/ole/vbaproject.hxx" -#include "oox/vml/vmldrawing.hxx" -#include "oox/vml/vmldrawingfragment.hxx" -#include "oox/vml/vmltextbox.hxx" -#include "oox/xls/drawingbase.hxx" -#include "oox/xls/excelhandlers.hxx" - -namespace oox { namespace ole { - struct AxFontData; - class AxMorphDataModelBase; -} } - -namespace oox { -namespace xls { - -// ============================================================================ -// DrawingML -// ============================================================================ - -class ShapeMacroAttacher : public ::oox::ole::VbaMacroAttacherBase -{ -public: - explicit ShapeMacroAttacher( const ::rtl::OUString& rMacroName, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape ); - -private: - virtual void attachMacro( const ::rtl::OUString& rMacroUrl ); - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape; -}; - -// ============================================================================ - -class Shape : public ::oox::drawingml::Shape, public WorksheetHelper -{ -public: - explicit Shape( - const WorksheetHelper& rHelper, - const AttributeList& rAttribs, - const sal_Char* pcServiceName = 0 ); - -protected: - virtual void finalizeXShape( - ::oox::core::XmlFilterBase& rFilter, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ); - -private: - ::rtl::OUString maMacroName; -}; - -// ============================================================================ - -/** Context handler for creation of shapes embedded in group shapes. */ -class GroupShapeContext : public ::oox::drawingml::ShapeGroupContext, public WorksheetHelper -{ -public: - explicit GroupShapeContext( - ::oox::core::ContextHandler& rParent, - const WorksheetHelper& rHelper, - const ::oox::drawingml::ShapePtr& rxParentShape, - const ::oox::drawingml::ShapePtr& rxShape ); - - static ::oox::core::ContextHandlerRef - createShapeContext( - ::oox::core::ContextHandler& rParent, - const WorksheetHelper& rHelper, - sal_Int32 nElement, - const AttributeList& rAttribs, - const ::oox::drawingml::ShapePtr& rxParentShape, - ::oox::drawingml::ShapePtr* pxShape = 0 ); - -protected: - 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); -}; - -// ============================================================================ - -/** Fragment handler for a complete sheet drawing. */ -class DrawingFragment : public WorksheetFragmentBase -{ -public: - explicit DrawingFragment( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - virtual void onEndElement(); - -private: - typedef ::std::auto_ptr< ShapeAnchor > ShapeAnchorRef; - - ::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. -}; - -// ============================================================================ -// VML -// ============================================================================ - -class VmlControlMacroAttacher : public ::oox::ole::VbaMacroAttacherBase -{ -public: - explicit VmlControlMacroAttacher( const ::rtl::OUString& rMacroName, - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rxCtrlFormIC, - sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle ); - -private: - virtual void attachMacro( const ::rtl::OUString& rMacroUrl ); - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxCtrlFormIC; - sal_Int32 mnCtrlIndex; - sal_Int32 mnCtrlType; - sal_Int32 mnDropStyle; -}; - -// ============================================================================ - -class VmlDrawing : public ::oox::vml::Drawing, public WorksheetHelper -{ -public: - explicit VmlDrawing( const WorksheetHelper& rHelper ); - - /** Returns the drawing shape for a cell note at the specified position. */ - const ::oox::vml::ShapeBase* getNoteShape( const ::com::sun::star::table::CellAddress& rPos ) const; - - /** Filters cell note shapes. */ - virtual bool isShapeSupported( const ::oox::vml::ShapeBase& rShape ) const; - - /** Returns additional base names for automatic shape name creation. */ - virtual ::rtl::OUString getShapeBaseName( const ::oox::vml::ShapeBase& rShape ) const; - - /** Calculates the shape rectangle from a cell anchor string. */ - virtual bool convertClientAnchor( - ::com::sun::star::awt::Rectangle& orShapeRect, - const ::rtl::OUString& rShapeAnchor ) const; - - /** Creates a UNO control shape for legacy drawing controls. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - createAndInsertClientXShape( - const ::oox::vml::ShapeBase& rShape, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const; - - /** Updates the bounding box covering all shapes of 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 ::oox::vml::ShapeBase& rShape, bool bGroupChild ); - -private: - /** Converts the passed VML textbox text color to an OLE color. */ - sal_uInt32 convertControlTextColor( const ::rtl::OUString& rTextColor ) const; - /** Converts the passed VML textbox font to an ActiveX form control font. */ - void convertControlFontData( - ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, - const ::oox::vml::TextFontModel& rFontModel ) const; - /** Converts the caption, the font settings, and the horizontal alignment - from the passed VML textbox to ActiveX form control settings. */ - void convertControlText( - ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, ::rtl::OUString& rCaption, - const ::oox::vml::TextBox* pTextBox, sal_Int32 nTextHAlign ) const; - /** Converts the passed VML shape background formatting to ActiveX control formatting. */ - void convertControlBackground( - ::oox::ole::AxMorphDataModelBase& rAxModel, - const ::oox::vml::ShapeBase& rShape ) const; - -private: - ::oox::ole::ControlConverter maControlConv; - ::oox::vml::TextFontModel maListBoxFont; -}; - -// ============================================================================ - -class VmlDrawingFragment : public ::oox::vml::DrawingFragment, public WorksheetHelper -{ -public: - explicit VmlDrawingFragment( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual void finalizeImport(); -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/drawingmanager.hxx b/oox/inc/oox/xls/drawingmanager.hxx deleted file mode 100644 index 758c60ef301b..000000000000 --- a/oox/inc/oox/xls/drawingmanager.hxx +++ /dev/null @@ -1,491 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_DRAWINGMANAGER_HXX -#define OOX_XLS_DRAWINGMANAGER_HXX - -#include "oox/xls/drawingbase.hxx" - -namespace com { namespace sun { namespace star { - namespace drawing { class XDrawPage; } - namespace drawing { class XShape; } - namespace drawing { class XShapes; } -} } } - -namespace oox { namespace drawingml { class ShapePropertyMap; } } - -namespace oox { -namespace xls { - -// ============================================================================ - -const sal_uInt16 BIFF_OBJ_INVALID_ID = 0; - -// ============================================================================ -// Model structures for BIFF OBJ record data -// ============================================================================ - -/** This structure contains line formatting attributes from an OBJ record. */ -struct BiffObjLineModel -{ - sal_uInt8 mnColorIdx; /// Index into color palette. - sal_uInt8 mnStyle; /// Line dash style. - sal_uInt8 mnWidth; /// Line width. - bool mbAuto; /// True = automatic line format. - - explicit BiffObjLineModel(); -}; - -// ============================================================================ - -/** This structure contains fill formatting attributes from an OBJ record. */ -struct BiffObjFillModel -{ - sal_uInt8 mnBackColorIdx; /// Index to color palette for background color. - sal_uInt8 mnPattColorIdx; /// Index to color palette for pattern foreground color. - sal_uInt8 mnPattern; /// Fill pattern. - bool mbAuto; /// True = automatic fill format. - - explicit BiffObjFillModel(); - - /** Returns true, if the fill formatting is visible (automatic or explicit). */ - bool isFilled() const; -}; - -// ============================================================================ -// BIFF drawing objects -// ============================================================================ - -class BiffDrawingBase; -class BiffDrawingObjectBase; -typedef ::boost::shared_ptr< BiffDrawingObjectBase > BiffDrawingObjectRef; - -// ---------------------------------------------------------------------------- - -class BiffDrawingObjectContainer -{ -public: - explicit BiffDrawingObjectContainer(); - - /** Returns true, if the object list is empty. */ - inline bool empty() const { return maObjects.empty(); } - - /** Appends the passed object to the list of objects. */ - void append( const BiffDrawingObjectRef& rxDrawingObj ); - /** Tries to insert the passed object into the last group or appends it. */ - void insertGrouped( const BiffDrawingObjectRef& rxDrawingObj ); - - /** Creates and inserts all UNO shapes into the passed shape container. */ - void convertAndInsert( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle* pParentRect = 0 ) const; - -private: - typedef RefVector< BiffDrawingObjectBase > BiffDrawingObjectVector; - BiffDrawingObjectVector maObjects; -}; - -// ============================================================================ - -/** Base class for all BIFF drawing objects (OBJ records). */ -class BiffDrawingObjectBase : public WorksheetHelper -{ -public: - explicit BiffDrawingObjectBase( const WorksheetHelper& rHelper ); - virtual ~BiffDrawingObjectBase(); - - /** Reads the BIFF3 OBJ record, returns a new drawing object. */ - static BiffDrawingObjectRef importObjBiff3( const WorksheetHelper& rHelper, BiffInputStream& rStrm ); - /** Reads the BIFF4 OBJ record, returns a new drawing object. */ - static BiffDrawingObjectRef importObjBiff4( const WorksheetHelper& rHelper, BiffInputStream& rStrm ); - /** Reads the BIFF5 OBJ record, returns a new drawing object. */ - static BiffDrawingObjectRef importObjBiff5( const WorksheetHelper& rHelper, BiffInputStream& rStrm ); - /** Reads the BIFF8 OBJ record, returns a new drawing object. */ - static BiffDrawingObjectRef importObjBiff8( const WorksheetHelper& rHelper, BiffInputStream& rStrm ); - - /** Sets whether this is an area object (then its width and height must be greater than 0). */ - inline void setAreaObj( bool bAreaObj ) { mbAreaObj = bAreaObj; } - /** If set to true, the object supports a simple on-click macro and/or hyperlink. */ - inline void setSimpleMacro( bool bMacro ) { mbSimpleMacro = bMacro; } - - /** If set to false, the UNO shape will not be created, processed, or inserted into the draw page. */ - inline void setProcessShape( bool bProcess ) { mbProcessShape = bProcess; } - /** If set to false, the UNO shape will be created or processed, but not be inserted into the draw page. */ - inline void setInsertShape( bool bInsert ) { mbInsertShape = bInsert; } - /** If set to true, a new custom UNO shape will be created while in DFF import (BIFF8 only). */ - inline void setCustomDffObj( bool bCustom ) { mbCustomDff = bCustom; } - - /** Returns the object identifier from the OBJ record. */ - inline sal_uInt16 getObjId() const { return mnObjId; } - /** Returns the object type from the OBJ record. */ - inline sal_uInt16 getObjType() const { return mnObjType; } - - /** Returns true, if the object is hidden. */ - inline bool isHidden() const { return mbHidden; } - /** Returns true, if the object is visible. */ - inline bool isVisible() const { return mbVisible; } - /** Returns true, if the object is printable. */ - inline bool isPrintable() const { return mbPrintable; } - - /** Creates the UNO shape and inserts it into the passed shape container. */ - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - convertAndInsert( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle* pParentRect = 0 ) const; - -protected: - /** Reads the object name in a BIFF5 OBJ record. */ - void readNameBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen ); - /** Reads the macro link in a BIFF3 OBJ record. */ - void readMacroBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the macro link in a BIFF4 OBJ record. */ - void readMacroBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the macro link in a BIFF5 OBJ record. */ - void readMacroBiff5( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the ftMacro sub structure in an OBJ record. */ - void readMacroBiff8( BiffInputStream& rStrm ); - - /** Converts the passed line formatting to the passed property map. */ - void convertLineProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows = 0 ) const; - /** Converts the passed fill formatting to the passed property map. */ - void convertFillProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const; - /** Converts the passed frame flags to the passed property map. */ - void convertFrameProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, sal_uInt16 nFrameFlags ) const; - - /** Derived classes read the contents of the a BIFF3 OBJ record from the passed stream. */ - virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Derived classes read the contents of the a BIFF4 OBJ record from the passed stream. */ - virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Derived classes read the contents of the a BIFF5 OBJ record from the passed stream. */ - virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); - /** Derived classes read the contents of the specified subrecord of a BIFF8 OBJ record from stream. */ - virtual void implReadObjBiff8SubRec( BiffInputStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize ); - - /** 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( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const = 0; - -private: - /** Reads the contents of a BIFF3 OBJ record. */ - void importObjBiff3( BiffInputStream& rStrm ); - /** Reads the contents of a BIFF4 OBJ record. */ - void importObjBiff4( BiffInputStream& rStrm ); - /** Reads the contents of a BIFF5 OBJ record. */ - void importObjBiff5( BiffInputStream& rStrm ); - /** Reads the contents of a BIFF8 OBJ record. */ - void importObjBiff8( BiffInputStream& rStrm ); - -private: - ShapeAnchor maAnchor; /// Position of the drawing object. - ::rtl::OUString maObjName; /// Name of the object. - ::rtl::OUString maMacroName; /// Name of an attached macro. - ::rtl::OUString maHyperlink; /// On-click hyperlink URL. - sal_uInt32 mnDffShapeId; /// Shape identifier from DFF stream (BIFF8 only). - sal_uInt32 mnDffFlags; /// Shape flags from DFF stream. - sal_uInt16 mnObjId; /// The object identifier (unique per drawing). - sal_uInt16 mnObjType; /// The object type from OBJ record. - bool mbHasAnchor; /// True = anchor has been initialized. - bool mbHidden; /// True = object is hidden. - bool mbVisible; /// True = object is visible (form controls). - bool mbPrintable; /// True = object is printable. - bool mbAreaObj; /// True = width and height must be greater than 0. - bool mbAutoMargin; /// True = set automatic text margin. - bool mbSimpleMacro; /// True = create simple macro link and hyperlink. - bool mbProcessShape; /// True = object is valid, do processing and insertion. - bool mbInsertShape; /// True = insert the UNO shape into the draw page. - bool mbCustomDff; /// True = recreate UNO shape in DFF import (BIFF8 only). -}; - -// ============================================================================ - -/** A placeholder object for unknown/unsupported object types. */ -class BiffPlaceholderObject : public BiffDrawingObjectBase -{ -public: - explicit BiffPlaceholderObject( const WorksheetHelper& rHelper ); - -protected: - /** Creates the corresponding XShape and insert it into the passed container. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - implConvertAndInsert( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const; -}; - -// ============================================================================ - -/** A group object that is able to contain other child objects. */ -class BiffGroupObject : public BiffDrawingObjectBase -{ -public: - explicit BiffGroupObject( const WorksheetHelper& rHelper ); - - /** Tries to insert the passed drawing object into this or a nested group. */ - bool tryInsert( const BiffDrawingObjectRef& rxDrawingObj ); - -protected: - /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ - virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ - virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ - virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); - - /** Creates the corresponding XShape and insert it into the passed container. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - implConvertAndInsert( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const; - -protected: - BiffDrawingObjectContainer maChildren; /// All child objects contained in this group object. - sal_uInt16 mnFirstUngrouped; /// Object identfier of first object not grouped into this group. -}; - -// ============================================================================ - -/** A simple line object. */ -class BiffLineObject : public BiffDrawingObjectBase -{ -public: - explicit BiffLineObject( const WorksheetHelper& rHelper ); - -protected: - /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ - virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ - virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ - virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); - - /** Creates the corresponding XShape and insert it into the passed container. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - implConvertAndInsert( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const; - -protected: - BiffObjLineModel maLineModel; /// Line formatting. - sal_uInt16 mnArrows; /// Line arrows. - sal_uInt8 mnStartPoint; /// Starting point. -}; - -// ============================================================================ - -/** A simple rectangle object (used as base class for oval objects). */ -class BiffRectObject : public BiffDrawingObjectBase -{ -public: - explicit BiffRectObject( const WorksheetHelper& rHelper ); - -protected: - /** Reads the fill model, the line model, and frame flags. */ - void readFrameData( BiffInputStream& rStrm ); - - /** Converts fill formatting, line formatting, and frame style. */ - void convertRectProperties( ::oox::drawingml::ShapePropertyMap& rPropMap ) const; - - /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ - virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ - virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ - virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); - - /** Creates the corresponding XShape and insert it into the passed container. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - implConvertAndInsert( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const; - -protected: - BiffObjFillModel maFillModel; /// Fill formatting. - BiffObjLineModel maLineModel; /// Line formatting. - sal_uInt16 mnFrameFlags; /// Additional flags. -}; - -// ============================================================================ - -/** A simple oval object. */ -class BiffOvalObject : public BiffRectObject -{ -public: - explicit BiffOvalObject( const WorksheetHelper& rHelper ); - -protected: - /** Creates the corresponding XShape and insert it into the passed container. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - implConvertAndInsert( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const; -}; - -// ============================================================================ - -/** A simple arc object. */ -class BiffArcObject : public BiffDrawingObjectBase -{ -public: - explicit BiffArcObject( const WorksheetHelper& rHelper ); - -protected: - /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ - virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ - virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ - virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); - - /** Creates the corresponding XShape and insert it into the passed container. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - implConvertAndInsert( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const; - -protected: - BiffObjFillModel maFillModel; /// Fill formatting. - BiffObjLineModel maLineModel; /// Line formatting. - sal_uInt8 mnQuadrant; /// Visible quadrant of the circle. -}; - -// ============================================================================ - -/** A simple polygon object. */ -class BiffPolygonObject : public BiffRectObject -{ -public: - explicit BiffPolygonObject( const WorksheetHelper& rHelper ); - -protected: - /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ - virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); - /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ - virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); - - /** Creates the corresponding XShape and insert it into the passed container. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - implConvertAndInsert( BiffDrawingBase& rDrawing, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const; - -private: - /** Reads the COORDLIST record following the OBJ record. */ - void importCoordList( BiffInputStream& rStrm ); - -protected: - typedef ::std::vector< ::com::sun::star::awt::Point > PointVector; - PointVector maCoords; /// Coordinates relative to bounding rectangle. - sal_uInt16 mnPolyFlags; /// Additional flags. - sal_uInt16 mnPointCount; /// Polygon point count. -}; - -// ============================================================================ -// BIFF drawing page -// ============================================================================ - -/** Base class for a container for all objects on a drawing page (in a - spreadsheet or in an embedded chart object). - - For BIFF import, it is needed to load all drawing objects before converting - them to UNO shapes. There might be some dummy drawing objects (e.g. the - dropdown buttons of autofilters) which have to be skipped. The information, - that a drawing object is a dummy object, may be located after the drawing - objects themselves. - - The BIFF8 format stores drawing objects in the DFF stream (stored - fragmented in MSODRAWING records), and in the OBJ records. The DFF stream - fragments are collected in a single stream, and the complete stream will be - processed afterwards. - */ -class BiffDrawingBase : public WorksheetHelper -{ -public: - explicit BiffDrawingBase( const WorksheetHelper& rHelper, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage ); - - /** Imports a plain OBJ record (without leading DFF data). */ - void importObj( BiffInputStream& rStrm ); - /** Sets the object with the passed identifier to be skipped on import. */ - void setSkipObj( sal_uInt16 nObjId ); - - /** Final processing after import of the all drawing objects. */ - void finalizeImport(); - - /** 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 ::rtl::OUString& rService, - 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 shape has been inserted. Will - be called from the convertAndInsert() implementation. */ - virtual void notifyShapeInserted( - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, - const ::com::sun::star::awt::Rectangle& rShapeRect ) = 0; - -protected: - /** Appends a new drawing object to the list of raw objects (without DFF data). */ - void appendRawObject( const BiffDrawingObjectRef& rxDrawingObj ); - -private: - typedef RefMap< sal_uInt16, BiffDrawingObjectBase > BiffDrawingObjectMapById; - typedef ::std::vector< sal_uInt16 > BiffObjIdVector; - - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > - mxDrawPage; /// UNO draw page used to insert the shapes. - BiffDrawingObjectContainer maRawObjs; /// Drawing objects without DFF data. - BiffDrawingObjectMapById maObjMapId; /// Maps drawing objects by their object identifiers. - BiffObjIdVector maSkipObjs; /// Identifiers of all objects to be skipped. -}; - -// ---------------------------------------------------------------------------- - -/** Drawing manager of a single sheet. */ -class BiffSheetDrawing : public BiffDrawingBase -{ -public: - explicit BiffSheetDrawing( const WorksheetHelper& rHelper ); - - /** Called when a new UNO shape has been inserted into the draw page. */ - virtual void notifyShapeInserted( - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, - const ::com::sun::star::awt::Rectangle& rShapeRect ); -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/excelchartconverter.hxx b/oox/inc/oox/xls/excelchartconverter.hxx deleted file mode 100644 index 9d0562dab7b8..000000000000 --- a/oox/inc/oox/xls/excelchartconverter.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_EXCELCHARTCONVERTER_HXX -#define OOX_XLS_EXCELCHARTCONVERTER_HXX - -#include "oox/drawingml/chart/chartconverter.hxx" -#include "oox/xls/workbookhelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -class ExcelChartConverter : public ::oox::drawingml::chart::ChartConverter, public WorkbookHelper -{ -public: - explicit ExcelChartConverter( const WorkbookHelper& rHelper ); - virtual ~ExcelChartConverter(); - - /** Creates an external data provider that is able to use spreadsheet data. */ - virtual void createDataProvider( - const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc ); - - /** Creates a data sequence from the passed 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 ::oox::drawingml::chart::DataSequenceModel& rDataSeq ); -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx deleted file mode 100644 index c15b6cc542cf..000000000000 --- a/oox/inc/oox/xls/excelfilter.hxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_EXCELFILTER_HXX -#define OOX_XLS_EXCELFILTER_HXX - -#include "oox/core/binaryfilterbase.hxx" -#include "oox/core/xmlfilterbase.hxx" -#include "oox/ole/vbaprojectfilter.hxx" - -namespace oox { -namespace xls { - -class WorkbookGlobals; - -// ============================================================================ - -class ExcelFilterBase -{ -public: - void registerWorkbookGlobals( WorkbookGlobals& rBookGlob ); - WorkbookGlobals& getWorkbookGlobals() const; - void unregisterWorkbookGlobals(); - -protected: - explicit ExcelFilterBase(); - virtual ~ExcelFilterBase(); - -private: - WorkbookGlobals* mpBookGlob; -}; - -// ============================================================================ - -class ExcelFilter : public ::oox::core::XmlFilterBase, public ExcelFilterBase -{ -public: - explicit ExcelFilter( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) - throw( ::com::sun::star::uno::RuntimeException ); - virtual ~ExcelFilter(); - - 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(); - - virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor ) throw( ::com::sun::star::uno::RuntimeException ); - -private: - virtual GraphicHelper* implCreateGraphicHelper() const; - virtual ::oox::ole::VbaProject* implCreateVbaProject() const; - virtual ::rtl::OUString implGetImplementationName() const; -}; - -// ============================================================================ - -class ExcelBiffFilter : public ::oox::core::BinaryFilterBase, public ExcelFilterBase -{ -public: - explicit ExcelBiffFilter( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) - throw( ::com::sun::star::uno::RuntimeException ); - virtual ~ExcelBiffFilter(); - - virtual bool importDocument() throw(); - virtual bool exportDocument() throw(); - -private: - virtual GraphicHelper* implCreateGraphicHelper() const; - virtual ::oox::ole::VbaProject* implCreateVbaProject() const; - virtual ::rtl::OUString implGetImplementationName() const; -}; - -// ============================================================================ - -class ExcelVbaProjectFilter : public ExcelBiffFilter -{ -public: - explicit ExcelVbaProjectFilter( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) - throw( ::com::sun::star::uno::RuntimeException ); - - virtual bool importDocument() throw(); - virtual bool exportDocument() throw(); - -private: - virtual ::rtl::OUString implGetImplementationName() const; -}; - // ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/excelhandlers.hxx b/oox/inc/oox/xls/excelhandlers.hxx deleted file mode 100644 index 41bf788a1ef1..000000000000 --- a/oox/inc/oox/xls/excelhandlers.hxx +++ /dev/null @@ -1,252 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_EXCELHANDLERS_HXX -#define OOX_XLS_EXCELHANDLERS_HXX - -#include "oox/core/fragmenthandler2.hxx" -#include "oox/xls/worksheethelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ -// ============================================================================ - -/** Context handler derived from the WorkbookHelper helper class. - - Used to import contexts in global workbook fragments. - */ -class WorkbookContextBase : public ::oox::core::ContextHandler2, public WorkbookHelper -{ -public: - template< typename ParentType > - inline explicit WorkbookContextBase( ParentType& rParent ) : - ::oox::core::ContextHandler2( rParent ), WorkbookHelper( rParent ) {} -}; - -// ============================================================================ - -/** Context handler derived from the WorksheetHelper helper class. - - Used to import contexts in sheet fragments. - */ -class WorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelper -{ -public: - template< typename ParentType > - inline explicit WorksheetContextBase( ParentType& rParent ) : - ::oox::core::ContextHandler2( rParent ), WorksheetHelper( rParent ) {} -}; - -// ============================================================================ - -/** Fragment handler derived from the WorkbookHelper helper class. - - Used to import global workbook fragments. - */ -class WorkbookFragmentBase : public ::oox::core::FragmentHandler2, public WorkbookHelper -{ -public: - explicit WorkbookFragmentBase( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); -}; - -// ============================================================================ - -/** Fragment handler derived from the WorksheetHelper helper class. - - Used to import sheet fragments. - */ -class WorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelper -{ -public: - explicit WorksheetFragmentBase( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); -}; - -// ============================================================================ -// ============================================================================ - -/** Base class for all BIFF context handlers. - - Derived handlers have to implement the importRecord() function that has to - import the record the passed BIFF input stream currently points to. - */ -class BiffContextHandler -{ -public: - virtual ~BiffContextHandler(); - - /** Derived classes have to implement importing the current record. */ - virtual void importRecord( BiffInputStream& rStrm ) = 0; -}; - -// ---------------------------------------------------------------------------- - -/** Context handler derived from the WorkbookHelper helper class. - - Used to import contexts in global workbook fragments. - */ -class BiffWorkbookContextBase : public BiffContextHandler, public WorkbookHelper -{ -protected: - explicit BiffWorkbookContextBase( const WorkbookHelper& rHelper ); -}; - -// ---------------------------------------------------------------------------- - -/** Context handler derived from the WorksheetHelper helper class. - - Used to import contexts in sheet fragments. - */ -class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelper -{ -protected: - explicit BiffWorksheetContextBase( const WorksheetHelper& rHelper ); -}; - -// ============================================================================ - -/** An enumeration for all types of fragments in a BIFF workbook stream. */ -enum BiffFragmentType -{ - BIFF_FRAGMENT_GLOBALS, /// Workbook globals fragment. - BIFF_FRAGMENT_WORKSHEET, /// Worksheet fragment. - BIFF_FRAGMENT_CHARTSHEET, /// Chart sheet fragment. - BIFF_FRAGMENT_MACROSHEET, /// Macro sheet fragment. - BIFF_FRAGMENT_MODULESHEET, /// BIFF5 VB module fragment. - BIFF_FRAGMENT_EMPTYSHEET, /// Sheet fragment of unsupported type. - BIFF_FRAGMENT_WORKSPACE, /// BIFF4 workspace/workbook globals. - BIFF_FRAGMENT_UNKNOWN /// Unknown fragment/error. -}; - -// ---------------------------------------------------------------------------- - -class BiffFragmentHandler -{ -public: - /** Opens the stream with the passed full name. */ - explicit BiffFragmentHandler( - const ::oox::core::FilterBase& rFilter, - const ::rtl::OUString& rStrmName ); - - virtual ~BiffFragmentHandler(); - - /** Imports the fragment, returns true, if EOF record has been reached. */ - virtual bool importFragment() = 0; - -protected: - /** Returns the BIFF input stream of this fragment. */ - inline BiffInputStream& getInputStream() { return *mxBiffStrm; } - - /** Starts a new fragment in a workbbok stream and returns the fragment type. - - The passed stream must point before a BOF record. The function will - try to start the next record and read the contents of the BOF record, - if extant. - - @return Fragment type according to the imported BOF record. - */ - BiffFragmentType startFragment( BiffType eBiff ); - - /** Skips the current fragment up to its trailing EOF record. - - Skips all records until next EOF record. When this function returns, - stream points to the EOF record, and the next call of startNextRecord() - at the stream will start the record following the EOF record. - - Embedded fragments enclosed in BOF/EOF records (e.g. embedded chart - objects) are skipped correctly. - - @return True = stream points to the EOF record of the current fragment. - */ - bool skipFragment(); - -private: - typedef ::boost::shared_ptr< BinaryXInputStream > XInputStreamRef; - typedef ::boost::shared_ptr< BiffInputStream > BiffInputStreamRef; - - XInputStreamRef mxXInStrm; - BiffInputStreamRef mxBiffStrm; -}; - -// ---------------------------------------------------------------------------- - -/** Fragment handler derived from the WorkbookHelper helper class. - - Used to import global workbook fragments. - */ -class BiffWorkbookFragmentBase : public BiffFragmentHandler, public WorkbookHelper -{ -protected: - explicit BiffWorkbookFragmentBase( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rStrmName, - bool bCloneDecoder = false ); -}; - -// ---------------------------------------------------------------------------- - -/** Fragment handler derived from the WorksheetHelper helper class. - - Used to import sheet fragments. - */ -class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHelper -{ -protected: - explicit BiffWorksheetFragmentBase( - const WorksheetHelper& rHelper, - const BiffWorkbookFragmentBase& rParent ); -}; - -// ---------------------------------------------------------------------------- - -/** Special fragment handler for worksheets that have to be skipped. - */ -class BiffSkipWorksheetFragment : public BiffWorksheetFragmentBase -{ -public: - explicit BiffSkipWorksheetFragment( - const WorksheetHelper& rHelper, - const BiffWorkbookFragmentBase& rParent ); - - virtual bool importFragment(); -}; - -// ============================================================================ -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/excelvbaproject.hxx b/oox/inc/oox/xls/excelvbaproject.hxx deleted file mode 100644 index 39dc37b2ea2b..000000000000 --- a/oox/inc/oox/xls/excelvbaproject.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_EXCELVBAPROJECT_HXX -#define OOX_XLS_EXCELVBAPROJECT_HXX - -#include "oox/ole/vbaproject.hxx" -#include "oox/dllapi.h" - -namespace com { namespace sun { namespace star { - namespace sheet { class XSpreadsheetDocument; } -} } } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Special implementation of the VBA project for the Excel filters. */ -class OOX_DLLPUBLIC ExcelVbaProject : public ::oox::ole::VbaProject -{ -public: - explicit ExcelVbaProject( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& rxDocument ); - -protected: - /** Adds dummy modules for sheets without imported code name. */ - virtual void prepareImport(); - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument > - mxDocument; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/externallinkbuffer.hxx b/oox/inc/oox/xls/externallinkbuffer.hxx deleted file mode 100644 index 071b251a8ba5..000000000000 --- a/oox/inc/oox/xls/externallinkbuffer.hxx +++ /dev/null @@ -1,405 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_EXTERNALLINKBUFFER_HXX -#define OOX_XLS_EXTERNALLINKBUFFER_HXX - -#include <com/sun/star/sheet/ExternalLinkInfo.hpp> -#include "oox/helper/containerhelper.hxx" -#include "oox/xls/defnamesbuffer.hxx" - -namespace com { namespace sun { namespace star { - namespace sheet { struct DDEItemInfo; } - namespace sheet { class XDDELink; } - namespace sheet { class XExternalDocLink; } - namespace sheet { class XExternalSheetCache; } -} } } - -namespace oox { namespace core { - class Relations; -} } - -namespace oox { -namespace xls { - -// ============================================================================ - -struct ExternalNameModel -{ - bool mbBuiltIn; /// Name is a built-in name. - bool mbNotify; /// Notify application on data change. - bool mbPreferPic; /// Picture link. - bool mbStdDocName; /// Name is the StdDocumentName for DDE. - bool mbOleObj; /// Name is an OLE object. - bool mbIconified; /// Iconified object link. - - explicit ExternalNameModel(); -}; - -// ============================================================================ - -class ExternalLink; - -class ExternalName : public DefinedNameBase -{ -public: - explicit ExternalName( const ExternalLink& rParentLink ); - - /** Appends the passed value to the result set. */ - template< typename Type > - inline void appendResultValue( const Type& rValue ) - { if( maCurrIt != maResults.end() ) (*maCurrIt++) <<= rValue; } - - /** Imports the definedName element. */ - void importDefinedName( const AttributeList& rAttribs ); - /** Imports the ddeItem element describing an item of a DDE link. */ - void importDdeItem( const AttributeList& rAttribs ); - /** Imports the values element containing the size of the DDE result matrix. */ - void importValues( const AttributeList& rAttribs ); - /** Imports the oleItem element describing an object of an OLE link. */ - void importOleItem( const AttributeList& rAttribs ); - - /** Imports the EXTERNALNAME record containing the name (only). */ - void importExternalName( SequenceInputStream& rStrm ); - /** Imports the EXTERNALNAMEFLAGS record containing the settings of an external name. */ - void importExternalNameFlags( SequenceInputStream& rStrm ); - /** Imports the DDEITEMVALUES record containing the size of the DDE result matrix. */ - void importDdeItemValues( SequenceInputStream& rStrm ); - /** Imports the DDEITEM_BOOL record containing a boolean value in a link result. */ - void importDdeItemBool( SequenceInputStream& rStrm ); - /** Imports the DDEITEM_DOUBLE record containing a double value in a link result. */ - void importDdeItemDouble( SequenceInputStream& rStrm ); - /** Imports the DDEITEM_ERROR record containing an error code in a link result. */ - void importDdeItemError( SequenceInputStream& rStrm ); - /** Imports the DDEITEM_STRING record containing a string in a link result. */ - void importDdeItemString( SequenceInputStream& rStrm ); - - /** Imports the EXTERNALNAME record from the passed stream. */ - void importExternalName( BiffInputStream& rStrm ); - - /** Returns true, if the name refers to an OLE object. */ - inline bool isOleObject() const { return maExtNameModel.mbOleObj; } - -#if 0 - /** Returns the sheet cache index if this is a sheet-local external name. */ - sal_Int32 getSheetCacheIndex() const; -#endif - - /** Returns the DDE item info needed by the XML formula parser. */ - bool getDdeItemInfo( - ::com::sun::star::sheet::DDEItemInfo& orItemInfo ) const; - - /** Returns the complete DDE link data of this DDE item. */ - bool getDdeLinkData( - ::rtl::OUString& orDdeServer, - ::rtl::OUString& orDdeTopic, - ::rtl::OUString& orDdeItem ); - -private: - /** Tries to convert the passed token sequence to an ExternalReference. */ - void extractExternalReference( const ApiTokenSequence& rTokens ); - /** Sets the size of the result matrix. */ - void setResultSize( sal_Int32 nColumns, sal_Int32 nRows ); - -private: - typedef Matrix< ::com::sun::star::uno::Any > ResultMatrix; - - const ExternalLink& mrParentLink; /// External link this name belongs to. - ExternalNameModel maExtNameModel; /// Additional name data. - ResultMatrix maResults; /// DDE/OLE link results. - ResultMatrix::iterator maCurrIt; /// Current position in result matrix. - sal_uInt32 mnStorageId; /// OLE storage identifier (BIFF). - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDDELink > - mxDdeLink; /// Interface of a DDE link. - bool mbDdeLinkCreated; /// True = already tried to create the DDE link. -}; - -typedef ::boost::shared_ptr< ExternalName > ExternalNameRef; - -// ============================================================================ - -/** Contains indexes for a range of sheets in the spreadsheet document. */ -class LinkSheetRange -{ -public: - inline explicit LinkSheetRange() { setDeleted(); } - inline explicit LinkSheetRange( sal_Int32 nFirst, sal_Int32 nLast ) { setRange( nFirst, nLast ); } - inline explicit LinkSheetRange( sal_Int32 nDocLink, sal_Int32 nFirst, sal_Int32 nLast ) { setExternalRange( nDocLink, nFirst, nLast ); } - - /** Sets this struct to deleted state. */ - void setDeleted(); - /** Sets this struct to "use current sheet" state. */ - void setSameSheet(); - /** Sets the passed absolute sheet range to the members of this struct. */ - void setRange( sal_Int32 nFirst, sal_Int32 nLast ); - /** Sets the passed external sheet cache range to the members of this struct. */ - void setExternalRange( sal_Int32 nDocLink, sal_Int32 nFirst, sal_Int32 nLast ); - - /** Returns true, if the sheet indexes are valid and different. */ - inline bool isDeleted() const { return mnFirst < 0; } - /** Returns true, if the sheet range points to an external document. */ - inline bool isExternal() const { return !isDeleted() && (meType == LINKSHEETRANGE_EXTERNAL); } - /** Returns true, if the sheet indexes are valid and different. */ - inline bool isSameSheet() const { return meType == LINKSHEETRANGE_SAMESHEET; } - /** Returns true, if the sheet indexes are valid and different. */ - inline bool is3dRange() const { return (0 <= mnFirst) && (mnFirst < mnLast); } - - inline sal_Int32 getDocLinkIndex() const { return mnDocLink; } - inline sal_Int32 getFirstSheet() const { return mnFirst; } - inline sal_Int32 getLastSheet() const { return mnLast; } - -private: - enum LinkSheetRangeType - { - LINKSHEETRANGE_INTERNAL, /// Sheet range in the own document. - LINKSHEETRANGE_EXTERNAL, /// Sheet range in an external document. - LINKSHEETRANGE_SAMESHEET /// Current sheet depending on context. - }; - - LinkSheetRangeType meType; /// Link sheet range type. - sal_Int32 mnDocLink; /// Document link token index for external links. - sal_Int32 mnFirst; /// Index of the first sheet or index of first external sheet cache. - sal_Int32 mnLast; /// Index of the last sheet or index of last external sheet cache. -}; - -// ============================================================================ - -enum ExternalLinkType -{ - LINKTYPE_SELF, /// Link refers to the current workbook. - LINKTYPE_SAME, /// Link refers to the current sheet. - LINKTYPE_INTERNAL, /// Link refers to a sheet in the own workbook. - LINKTYPE_EXTERNAL, /// Link refers to an external spreadsheet document. - LINKTYPE_ANALYSIS, /// Link refers to the Analysis add-in. - LINKTYPE_LIBRARY, /// Link refers to an external add-in. - LINKTYPE_DDE, /// DDE link. - LINKTYPE_OLE, /// OLE link. - LINKTYPE_MAYBE_DDE_OLE, /// Could be DDE or OLE link (BIFF only). - LINKTYPE_UNKNOWN /// Unknown or unsupported link type. -}; - -// ---------------------------------------------------------------------------- - -class ExternalLink : public WorkbookHelper -{ -public: - explicit ExternalLink( const WorkbookHelper& rHelper ); - - /** Imports the externalReference element containing the relation identifier. */ - void importExternalReference( const AttributeList& rAttribs ); - /** Imports the externalBook element describing an externally linked document. */ - void importExternalBook( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs ); - /** Imports the sheetName element containing the sheet name in an externally linked document. */ - void importSheetName( const AttributeList& rAttribs ); - /** Imports the definedName element describing an external name. */ - void importDefinedName( const AttributeList& rAttribs ); - /** Imports the ddeLink element describing a DDE link. */ - void importDdeLink( const AttributeList& rAttribs ); - /** Imports the ddeItem element describing an item of a DDE link. */ - ExternalNameRef importDdeItem( const AttributeList& rAttribs ); - /** Imports the oleLink element describing an OLE link. */ - void importOleLink( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs ); - /** Imports the oleItem element describing an object of an OLE link. */ - ExternalNameRef importOleItem( const AttributeList& rAttribs ); - - /** Imports the EXTERNALBOOK record describing an externally linked document, DDE link, or OLE link. */ - void importExternalBook( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm ); - /** Imports the EXTSHEETNAMES record containing the sheet names in an externally linked document. */ - void importExtSheetNames( SequenceInputStream& rStrm ); - /** Imports the EXTERNALNAME record describing an external name. */ - ExternalNameRef importExternalName( SequenceInputStream& rStrm ); - /** Imports the EXTERNALREF record from the passed stream. */ - void importExternalRef( SequenceInputStream& rStrm ); - /** Imports the EXTERNALSELF record from the passed stream. */ - void importExternalSelf( SequenceInputStream& rStrm ); - /** Imports the EXTERNALSAME record from the passed stream. */ - void importExternalSame( SequenceInputStream& rStrm ); - /** Imports the EXTERNALADDIN record from the passed stream. */ - void importExternalAddin( SequenceInputStream& rStrm ); - - /** Imports the EXTERNSHEET record from the passed stream. */ - void importExternSheet( BiffInputStream& rStrm ); - /** Imports the EXTERNALBOOK record from the passed stream. */ - void importExternalBook( BiffInputStream& rStrm ); - /** Imports the EXTERNALNAME record from the passed stream. */ - void importExternalName( BiffInputStream& rStrm ); - - /** Sets the link type to 'self reference'. */ - inline void setSelfLinkType() { meLinkType = LINKTYPE_SELF; } - - /** Returns the type of this external link. */ - inline ExternalLinkType getLinkType() const { return meLinkType; } - /** Returns true, if the link refers to the current workbook. */ - inline bool isInternalLink() const { return (meLinkType == LINKTYPE_SELF) || (meLinkType == LINKTYPE_INTERNAL); } - - /** Returns the relation identifier for the external link fragment. */ - inline const ::rtl::OUString& getRelId() const { return maRelId; } - /** Returns the class name of this external link. */ - inline const ::rtl::OUString& getClassName() const { return maClassName; } - /** Returns the target URL of this external link. */ - inline const ::rtl::OUString& getTargetUrl() const { return maTargetUrl; } - /** Returns the link info needed by the XML formula parser. */ - ::com::sun::star::sheet::ExternalLinkInfo getLinkInfo() const; - - /** Returns the type of the external library if this is a library link. */ - FunctionLibraryType getFuncLibraryType() const; - - /** Returns the internal Calc sheet index or for the passed sheet. */ - sal_Int16 getCalcSheetIndex( sal_Int32 nTabId = 0 ) const; - - /** Returns the token index of the external document. */ - sal_Int32 getDocumentLinkIndex() const; - /** Returns the external sheet cache index or for the passed sheet. */ - sal_Int32 getSheetCacheIndex( sal_Int32 nTabId = 0 ) const; - /** Returns the sheet cache of the external sheet with the passed index. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache > - getSheetCache( sal_Int32 nTabId ) const; - - /** Returns the internal sheet range or range of external sheet caches for the passed sheet range (BIFF only). */ - void getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId1, sal_Int32 nTabId2 ) const; - - /** Returns the external name with the passed zero-based index. */ - ExternalNameRef getNameByIndex( sal_Int32 nIndex ) const; - -private: - void setExternalTargetUrl( const ::rtl::OUString& rTargetUrl, const ::rtl::OUString& rTargetType ); - void setDdeOleTargetUrl( const ::rtl::OUString& rClassName, const ::rtl::OUString& rTargetUrl, ExternalLinkType eLinkType ); - void parseExternalReference( const ::oox::core::Relations& rRelations, const ::rtl::OUString& rRelId ); - ::rtl::OUString parseBiffTargetUrl( const ::rtl::OUString& rBiffTargetUrl ); - - /** Creates an external locument link and the sheet cache for the passed sheet name. */ - void insertExternalSheet( const ::rtl::OUString& rSheetName ); - - ExternalNameRef createExternalName(); - -private: - typedef ::std::vector< sal_Int16 > Int16Vector; - typedef ::std::vector< sal_Int32 > Int32Vector; - typedef RefVector< ExternalName > ExternalNameVector; - - ExternalLinkType meLinkType; /// Type of this link object. - FunctionLibraryType meFuncLibType; /// Type of the function library, if link type is LINKTYPE_LIBRARY. - ::rtl::OUString maRelId; /// Relation identifier for the external link fragment. - ::rtl::OUString maClassName; /// DDE service, OLE class name. - ::rtl::OUString maTargetUrl; /// Target link, DDE topic, OLE target. - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLink > - mxDocLink; /// Interface for an external document. - Int16Vector maCalcSheets; /// Internal sheet indexes. - Int32Vector maSheetCaches; /// External sheet cache indexes. - ExternalNameVector maExtNames; /// Defined names in external document. -}; - -typedef ::boost::shared_ptr< ExternalLink > ExternalLinkRef; - -// ============================================================================ - -/** Represents a REF entry in the BIFF12 EXTERNALSHEETS or in the BIFF8 - EXTERNSHEET record. - - This struct is used to map ref identifiers to external books (BIFF12: - EXTERNALREF records, BIFF8: EXTERNALBOOK records), and provides sheet - indexes into the sheet list of the external document. - */ -struct RefSheetsModel -{ - sal_Int32 mnExtRefId; /// Zero-based index into list of external documents. - sal_Int32 mnTabId1; /// Zero-based index to first sheet in external document. - sal_Int32 mnTabId2; /// Zero-based index to last sheet in external document. - - explicit RefSheetsModel(); - - void readBiff12Data( SequenceInputStream& rStrm ); - void readBiff8Data( BiffInputStream& rStrm ); -}; - -// ---------------------------------------------------------------------------- - -class ExternalLinkBuffer : public WorkbookHelper -{ -public: - explicit ExternalLinkBuffer( const WorkbookHelper& rHelper ); - - /** Imports the externalReference element containing . */ - ExternalLinkRef importExternalReference( const AttributeList& rAttribs ); - - /** Imports the EXTERNALREF record from the passed stream. */ - ExternalLinkRef importExternalRef( SequenceInputStream& rStrm ); - /** Imports the EXTERNALSELF record from the passed stream. */ - void importExternalSelf( SequenceInputStream& rStrm ); - /** Imports the EXTERNALSAME record from the passed stream. */ - void importExternalSame( SequenceInputStream& rStrm ); - /** Imports the EXTERNALADDIN record from the passed stream. */ - void importExternalAddin( SequenceInputStream& rStrm ); - /** Imports the EXTERNALSHEETS record from the passed stream. */ - void importExternalSheets( SequenceInputStream& rStrm ); - - /** Imports the EXTERNSHEET record from the passed stream. */ - ExternalLinkRef importExternSheet( BiffInputStream& rStrm ); - /** Imports the EXTERNALBOOK record from the passed stream. */ - ExternalLinkRef importExternalBook( BiffInputStream& rStrm ); - /** Imports the BIFF8 EXTERNSHEET record from the passed stream. */ - void importExternSheet8( BiffInputStream& rStrm ); - - /** Returns the sequence of link infos needed by the XML formula parser. */ - ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::ExternalLinkInfo > - getLinkInfos() const; - - /** Returns the external link for the passed reference identifier. */ - ExternalLinkRef getExternalLink( sal_Int32 nRefId, bool bUseRefSheets = true ) const; - - /** Returns the sheet range for the specified reference (BIFF2-BIFF5 only). */ - LinkSheetRange getSheetRange( sal_Int32 nRefId, sal_Int16 nTabId1, sal_Int16 nTabId2 ) const; - /** Returns the sheet range for the specified reference (BIFF8 only). */ - LinkSheetRange getSheetRange( sal_Int32 nRefId ) const; - -private: - /** Creates a new external link and inserts it into the list of links. */ - ExternalLinkRef createExternalLink(); - - /** Returns the specified sheet indexes for a reference identifier. */ - const RefSheetsModel* getRefSheets( sal_Int32 nRefId ) const; - -private: - typedef RefVector< ExternalLink > ExternalLinkVec; - typedef ::std::vector< RefSheetsModel > RefSheetsModelVec; - - ExternalLinkRef mxSelfRef; /// Implicit self reference at index 0. - ExternalLinkVec maLinks; /// List of link structures for all kinds of links. - ExternalLinkVec maExtLinks; /// Real external links needed for formula parser. - RefSheetsModelVec maRefSheets; /// Sheet indexes for reference ids. - bool mbUseRefSheets; /// True = use maRefSheets list (BIFF12 only). -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/externallinkfragment.hxx b/oox/inc/oox/xls/externallinkfragment.hxx deleted file mode 100644 index a9dc623eb2c7..000000000000 --- a/oox/inc/oox/xls/externallinkfragment.hxx +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_EXTERNALLINKFRAGMENT_HXX -#define OOX_XLS_EXTERNALLINKFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" -#include "oox/xls/externallinkbuffer.hxx" - -namespace oox { -namespace xls { - -class ExternalLink; - -// ============================================================================ -// ============================================================================ - -/** This class implements importing the sheetData element in external sheets. - - The sheetData element embedded in the externalBook element contains cached - cells from externally linked sheets. - */ -class ExternalSheetDataContext : public WorkbookContextBase -{ -public: - explicit ExternalSheetDataContext( - WorkbookFragmentBase& rFragment, - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >& rxSheetCache ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - -private: - /** Imports cell settings from a c element. */ - void importCell( const AttributeList& rAttribs ); - - /** Imports the EXTCELL_BLANK from the passed stream. */ - void importExtCellBlank( SequenceInputStream& rStrm ); - /** Imports the EXTCELL_BOOL from the passed stream. */ - void importExtCellBool( SequenceInputStream& rStrm ); - /** Imports the EXTCELL_DOUBLE from the passed stream. */ - void importExtCellDouble( SequenceInputStream& rStrm ); - /** Imports the EXTCELL_ERROR from the passed stream. */ - void importExtCellError( SequenceInputStream& rStrm ); - /** Imports the EXTCELL_STRING from the passed stream. */ - void importExtCellString( SequenceInputStream& rStrm ); - - /** Sets the passed cell value to the current position in the sheet cache. */ - void setCellValue( const ::com::sun::star::uno::Any& rValue ); - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache > - mxSheetCache; /// The sheet cache used to store external cell values. - ::com::sun::star::table::CellAddress maCurrPos; /// Position of current cell. - sal_Int32 mnCurrType; /// Data type of current cell. -}; - -// ============================================================================ - -class ExternalLinkFragment : public WorkbookFragmentBase -{ -public: - explicit ExternalLinkFragment( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath, - ExternalLink& rExtLink ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - virtual void onEndElement(); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - -private: - ::oox::core::ContextHandlerRef createSheetDataContext( sal_Int32 nSheetId ); - -private: - ExternalLink& mrExtLink; - ExternalNameRef mxExtName; - ::rtl::OUString maResultValue; - sal_Int32 mnResultType; -}; - -// ============================================================================ -// ============================================================================ - -class BiffExternalSheetDataContext : public BiffWorkbookContextBase -{ -public: - explicit BiffExternalSheetDataContext( const WorkbookHelper& rHelper, bool bImportDefNames ); - virtual ~BiffExternalSheetDataContext(); - - /** Tries to import a record related to external links and defined names. */ - virtual void importRecord( BiffInputStream& rStrm ); - -private: - void importExternSheet( BiffInputStream& rStrm ); - void importExternalBook( BiffInputStream& rStrm ); - void importExternalName( BiffInputStream& rStrm ); - void importXct( BiffInputStream& rStrm ); - void importCrn( BiffInputStream& rStrm ); - void importDefinedName( BiffInputStream& rStrm ); - - /** Sets the passed cell value to the passed position in the sheet cache. */ - void setCellValue( const BinAddress& rBinAddr, const ::com::sun::star::uno::Any& rValue ); - -private: - ExternalLinkRef mxExtLink; /// Current external link. - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache > - mxSheetCache; /// The sheet cache used to store external cell values. - bool mbImportDefNames; -}; - -// ============================================================================ - -class BiffExternalLinkFragment : public BiffWorkbookFragmentBase -{ -public: - explicit BiffExternalLinkFragment( const BiffWorkbookFragmentBase& rParent ); - - /** Imports all records related to external links. */ - virtual bool importFragment(); -}; - -// ============================================================================ -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/formulabase.hxx b/oox/inc/oox/xls/formulabase.hxx deleted file mode 100644 index 1d34343ec6ef..000000000000 --- a/oox/inc/oox/xls/formulabase.hxx +++ /dev/null @@ -1,845 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_FORMULABASE_HXX -#define OOX_XLS_FORMULABASE_HXX - -#include <com/sun/star/beans/Pair.hpp> -#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp> -#include <com/sun/star/sheet/FormulaToken.hpp> -#include <com/sun/star/table/CellAddress.hpp> -#include <com/sun/star/table/CellRangeAddress.hpp> -#include <com/sun/star/uno/Sequence.hxx> -#include "oox/helper/propertyset.hxx" -#include "oox/helper/refvector.hxx" -#include "oox/xls/addressconverter.hxx" - -namespace com { namespace sun { namespace star { - namespace sheet { class XFormulaOpCodeMapper; } - namespace sheet { class XFormulaParser; } -} } } - -namespace oox { template< typename Type > class Matrix; } - -namespace oox { -namespace xls { - -// Constants ================================================================== - -const size_t BIFF_TOKARR_MAXLEN = 4096; /// Maximum size of a token array. - -// token class flags ---------------------------------------------------------- - -const sal_uInt8 BIFF_TOKCLASS_MASK = 0x60; -const sal_uInt8 BIFF_TOKCLASS_NONE = 0x00; /// 00-1F: Base tokens. -const sal_uInt8 BIFF_TOKCLASS_REF = 0x20; /// 20-3F: Reference class tokens. -const sal_uInt8 BIFF_TOKCLASS_VAL = 0x40; /// 40-5F: Value class tokens. -const sal_uInt8 BIFF_TOKCLASS_ARR = 0x60; /// 60-7F: Array class tokens. - -const sal_uInt8 BIFF_TOKFLAG_INVALID = 0x80; /// This bit must be null for a valid token identifier. - -// base token identifiers ----------------------------------------------------- - -const sal_uInt8 BIFF_TOKID_MASK = 0x1F; - -const sal_uInt8 BIFF_TOKID_NONE = 0x00; /// Placeholder for invalid token id. -const sal_uInt8 BIFF_TOKID_EXP = 0x01; /// Array or shared formula reference. -const sal_uInt8 BIFF_TOKID_TBL = 0x02; /// Multiple operation reference. -const sal_uInt8 BIFF_TOKID_ADD = 0x03; /// Addition operator. -const sal_uInt8 BIFF_TOKID_SUB = 0x04; /// Subtraction operator. -const sal_uInt8 BIFF_TOKID_MUL = 0x05; /// Multiplication operator. -const sal_uInt8 BIFF_TOKID_DIV = 0x06; /// Division operator. -const sal_uInt8 BIFF_TOKID_POWER = 0x07; /// Power operator. -const sal_uInt8 BIFF_TOKID_CONCAT = 0x08; /// String concatenation operator. -const sal_uInt8 BIFF_TOKID_LT = 0x09; /// Less than operator. -const sal_uInt8 BIFF_TOKID_LE = 0x0A; /// Less than or equal operator. -const sal_uInt8 BIFF_TOKID_EQ = 0x0B; /// Equal operator. -const sal_uInt8 BIFF_TOKID_GE = 0x0C; /// Greater than or equal operator. -const sal_uInt8 BIFF_TOKID_GT = 0x0D; /// Greater than operator. -const sal_uInt8 BIFF_TOKID_NE = 0x0E; /// Not equal operator. -const sal_uInt8 BIFF_TOKID_ISECT = 0x0F; /// Intersection operator. -const sal_uInt8 BIFF_TOKID_LIST = 0x10; /// List operator. -const sal_uInt8 BIFF_TOKID_RANGE = 0x11; /// Range operator. -const sal_uInt8 BIFF_TOKID_UPLUS = 0x12; /// Unary plus. -const sal_uInt8 BIFF_TOKID_UMINUS = 0x13; /// Unary minus. -const sal_uInt8 BIFF_TOKID_PERCENT = 0x14; /// Percent sign. -const sal_uInt8 BIFF_TOKID_PAREN = 0x15; /// Parentheses. -const sal_uInt8 BIFF_TOKID_MISSARG = 0x16; /// Missing argument. -const sal_uInt8 BIFF_TOKID_STR = 0x17; /// String constant. -const sal_uInt8 BIFF_TOKID_NLR = 0x18; /// Natural language reference (NLR). -const sal_uInt8 BIFF_TOKID_ATTR = 0x19; /// Special attribute. -const sal_uInt8 BIFF_TOKID_SHEET = 0x1A; /// Start of a sheet reference (BIFF2-BIFF4). -const sal_uInt8 BIFF_TOKID_ENDSHEET = 0x1B; /// End of a sheet reference (BIFF2-BIFF4). -const sal_uInt8 BIFF_TOKID_ERR = 0x1C; /// Error constant. -const sal_uInt8 BIFF_TOKID_BOOL = 0x1D; /// Boolean constant. -const sal_uInt8 BIFF_TOKID_INT = 0x1E; /// Integer constant. -const sal_uInt8 BIFF_TOKID_NUM = 0x1F; /// Floating-point constant. - -// base identifiers of classified tokens -------------------------------------- - -const sal_uInt8 BIFF_TOKID_ARRAY = 0x00; /// Array constant. -const sal_uInt8 BIFF_TOKID_FUNC = 0x01; /// Function, fixed number of arguments. -const sal_uInt8 BIFF_TOKID_FUNCVAR = 0x02; /// Function, variable number of arguments. -const sal_uInt8 BIFF_TOKID_NAME = 0x03; /// Defined name. -const sal_uInt8 BIFF_TOKID_REF = 0x04; /// 2D cell reference. -const sal_uInt8 BIFF_TOKID_AREA = 0x05; /// 2D area reference. -const sal_uInt8 BIFF_TOKID_MEMAREA = 0x06; /// Constant reference subexpression. -const sal_uInt8 BIFF_TOKID_MEMERR = 0x07; /// Deleted reference subexpression. -const sal_uInt8 BIFF_TOKID_MEMNOMEM = 0x08; /// Constant reference subexpression without result. -const sal_uInt8 BIFF_TOKID_MEMFUNC = 0x09; /// Variable reference subexpression. -const sal_uInt8 BIFF_TOKID_REFERR = 0x0A; /// Deleted 2D cell reference. -const sal_uInt8 BIFF_TOKID_AREAERR = 0x0B; /// Deleted 2D area reference. -const sal_uInt8 BIFF_TOKID_REFN = 0x0C; /// Relative 2D cell reference (in names). -const sal_uInt8 BIFF_TOKID_AREAN = 0x0D; /// Relative 2D area reference (in names). -const sal_uInt8 BIFF_TOKID_MEMAREAN = 0x0E; /// Reference subexpression (in names). -const sal_uInt8 BIFF_TOKID_MEMNOMEMN = 0x0F; /// Reference subexpression (in names) without result. -const sal_uInt8 BIFF_TOKID_FUNCCE = 0x18; -const sal_uInt8 BIFF_TOKID_NAMEX = 0x19; /// External reference. -const sal_uInt8 BIFF_TOKID_REF3D = 0x1A; /// 3D cell reference. -const sal_uInt8 BIFF_TOKID_AREA3D = 0x1B; /// 3D area reference. -const sal_uInt8 BIFF_TOKID_REFERR3D = 0x1C; /// Deleted 3D cell reference. -const sal_uInt8 BIFF_TOKID_AREAERR3D = 0x1D; /// Deleted 3D area reference - -// specific token constants --------------------------------------------------- - -const sal_uInt8 BIFF_TOK_ARRAY_DOUBLE = 0; /// Double value in an array. -const sal_uInt8 BIFF_TOK_ARRAY_STRING = 1; /// String value in an array. -const sal_uInt8 BIFF_TOK_ARRAY_BOOL = 2; /// Boolean value in an array. -const sal_uInt8 BIFF_TOK_ARRAY_ERROR = 4; /// Error code in an array. - -const sal_uInt8 BIFF_TOK_BOOL_FALSE = 0; /// FALSE value of a tBool token. -const sal_uInt8 BIFF_TOK_BOOL_TRUE = 1; /// TRUE value of a tBool token. - -const sal_uInt8 BIFF_TOK_ATTR_VOLATILE = 0x01; /// Volatile function. -const sal_uInt8 BIFF_TOK_ATTR_IF = 0x02; /// Start of true condition in IF function. -const sal_uInt8 BIFF_TOK_ATTR_CHOOSE = 0x04; /// Jump array of CHOOSE function. -const sal_uInt8 BIFF_TOK_ATTR_SKIP = 0x08; /// Skip tokens. -const sal_uInt8 BIFF_TOK_ATTR_SUM = 0x10; /// SUM function with one parameter. -const sal_uInt8 BIFF_TOK_ATTR_ASSIGN = 0x20; /// BASIC style assignment. -const sal_uInt8 BIFF_TOK_ATTR_SPACE = 0x40; /// Spaces in formula representation. -const sal_uInt8 BIFF_TOK_ATTR_SPACE_VOLATILE = 0x41; /// Leading spaces and volatile formula. -const sal_uInt8 BIFF_TOK_ATTR_IFERROR = 0x80; /// Start of condition in IFERROR function (BIFF12 only). - -const sal_uInt8 BIFF_TOK_ATTR_SPACE_SP = 0x00; /// Spaces before next token. -const sal_uInt8 BIFF_TOK_ATTR_SPACE_BR = 0x01; /// Line breaks before next token. -const sal_uInt8 BIFF_TOK_ATTR_SPACE_SP_OPEN = 0x02; /// Spaces before opening parenthesis. -const sal_uInt8 BIFF_TOK_ATTR_SPACE_BR_OPEN = 0x03; /// Line breaks before opening parenthesis. -const sal_uInt8 BIFF_TOK_ATTR_SPACE_SP_CLOSE = 0x04; /// Spaces before closing parenthesis. -const sal_uInt8 BIFF_TOK_ATTR_SPACE_BR_CLOSE = 0x05; /// Line breaks before closing parenthesis. -const sal_uInt8 BIFF_TOK_ATTR_SPACE_SP_PRE = 0x06; /// Spaces before formula (BIFF3). - -const sal_uInt16 BIFF_TOK_FUNCVAR_CMD = 0x8000; /// Macro command. -const sal_uInt16 BIFF_TOK_FUNCVAR_FUNCIDMASK = 0x7FFF; /// Mask for function/command index. -const sal_uInt8 BIFF_TOK_FUNCVAR_CMDPROMPT = 0x80; /// User prompt for macro commands. -const sal_uInt8 BIFF_TOK_FUNCVAR_COUNTMASK = 0x7F; /// Mask for parameter count. - -const sal_uInt16 BIFF12_TOK_REF_COLMASK = 0x3FFF; /// Mask to extract column from reference (BIFF12). -const sal_Int32 BIFF12_TOK_REF_ROWMASK = 0xFFFFF; /// Mask to extract row from reference (BIFF12). -const sal_uInt16 BIFF12_TOK_REF_COLREL = 0x4000; /// True = column is relative (BIFF12). -const sal_uInt16 BIFF12_TOK_REF_ROWREL = 0x8000; /// True = row is relative (BIFF12). - -const sal_uInt16 BIFF_TOK_REF_COLMASK = 0x00FF; /// Mask to extract BIFF8 column from reference. -const sal_uInt16 BIFF_TOK_REF_ROWMASK = 0x3FFF; /// Mask to extract BIFF2-BIFF5 row from reference. -const sal_uInt16 BIFF_TOK_REF_COLREL = 0x4000; /// True = column is relative. -const sal_uInt16 BIFF_TOK_REF_ROWREL = 0x8000; /// True = row is relative. - -const sal_uInt16 BIFF12_TOK_TABLE_COLUMN = 0x0001; /// Table reference: Single column. -const sal_uInt16 BIFF12_TOK_TABLE_COLRANGE = 0x0002; /// Table reference: Range of columns. -const sal_uInt16 BIFF12_TOK_TABLE_ALL = 0x0004; /// Table reference: Special [#All] range. -const sal_uInt16 BIFF12_TOK_TABLE_HEADERS = 0x0008; /// Table reference: Special [#Headers] range. -const sal_uInt16 BIFF12_TOK_TABLE_DATA = 0x0010; /// Table reference: Special [#Data] range. -const sal_uInt16 BIFF12_TOK_TABLE_TOTALS = 0x0020; /// Table reference: Special [#Totals] range. -const sal_uInt16 BIFF12_TOK_TABLE_THISROW = 0x0040; /// Table reference: Special [#This Row] range. -const sal_uInt16 BIFF12_TOK_TABLE_SP_BRACKETS = 0x0080; /// Table reference: Spaces in outer brackets. -const sal_uInt16 BIFF12_TOK_TABLE_SP_SEP = 0x0100; /// Table reference: Spaces after separators. -const sal_uInt16 BIFF12_TOK_TABLE_ROW = 0x0200; /// Table reference: Single row. -const sal_uInt16 BIFF12_TOK_TABLE_CELL = 0x0400; /// Table reference: Single cell. - -const sal_uInt8 BIFF_TOK_NLR_ERR = 0x01; /// NLR: Invalid/deleted. -const sal_uInt8 BIFF_TOK_NLR_ROWR = 0x02; /// NLR: Row index. -const sal_uInt8 BIFF_TOK_NLR_COLR = 0x03; /// NLR: Column index. -const sal_uInt8 BIFF_TOK_NLR_ROWV = 0x06; /// NLR: Value in row. -const sal_uInt8 BIFF_TOK_NLR_COLV = 0x07; /// NLR: Value in column. -const sal_uInt8 BIFF_TOK_NLR_RANGE = 0x0A; /// NLR: Range. -const sal_uInt8 BIFF_TOK_NLR_SRANGE = 0x0B; /// Stacked NLR: Range. -const sal_uInt8 BIFF_TOK_NLR_SROWR = 0x0C; /// Stacked NLR: Row index. -const sal_uInt8 BIFF_TOK_NLR_SCOLR = 0x0D; /// Stacked NLR: Column index. -const sal_uInt8 BIFF_TOK_NLR_SROWV = 0x0E; /// Stacked NLR: Value in row. -const sal_uInt8 BIFF_TOK_NLR_SCOLV = 0x0F; /// Stacked NLR: Value in column. -const sal_uInt8 BIFF_TOK_NLR_RANGEERR = 0x10; /// NLR: Invalid/deleted range. -const sal_uInt8 BIFF_TOK_NLR_SXNAME = 0x1D; /// NLR: Pivot table name. -const sal_uInt16 BIFF_TOK_NLR_REL = 0x8000; /// True = NLR is relative. -const sal_uInt16 BIFF_TOK_NLR_MASK = 0x3FFF; /// Mask to extract BIFF8 column from NLR. - -const sal_uInt32 BIFF_TOK_NLR_ADDREL = 0x80000000; /// NLR relative (in appended data). -const sal_uInt32 BIFF_TOK_NLR_ADDMASK = 0x3FFFFFFF; /// Mask for number of appended ranges. - -// function constants --------------------------------------------------------- - -const sal_uInt8 OOX_MAX_PARAMCOUNT = 255; /// Maximum parameter count for OOXML/BIFF12 files. -const sal_uInt8 BIFF_MAX_PARAMCOUNT = 30; /// Maximum parameter count for BIFF2-BIFF8 files. - -const sal_uInt16 BIFF_FUNC_IF = 1; /// Function identifier of the IF function. -const sal_uInt16 BIFF_FUNC_SUM = 4; /// Function identifier of the SUM function. -const sal_uInt16 BIFF_FUNC_TRUE = 34; /// Function identifier of the TRUE function. -const sal_uInt16 BIFF_FUNC_FALSE = 35; /// Function identifier of the FALSE function. -const sal_uInt16 BIFF_FUNC_ROWS = 76; /// Function identifier of the ROWS function. -const sal_uInt16 BIFF_FUNC_COLUMNS = 77; /// Function identifier of the COLUMNS function. -const sal_uInt16 BIFF_FUNC_OFFSET = 78; /// Function identifier of the OFFSET function. -const sal_uInt16 BIFF_FUNC_EXTERNCALL = 255; /// BIFF function id of the EXTERN.CALL function. -const sal_uInt16 BIFF_FUNC_FLOOR = 285; /// Function identifier of the FLOOR function. -const sal_uInt16 BIFF_FUNC_CEILING = 288; /// Function identifier of the CEILING function. -const sal_uInt16 BIFF_FUNC_HYPERLINK = 359; /// Function identifier of the HYPERLINK function. -const sal_uInt16 BIFF_FUNC_WEEKNUM = 465; /// Function identifier of the WEEKNUM function. - -// Formula type =============================================================== - -/** Enumerates all possible types of a formula. */ -enum FormulaType -{ - FORMULATYPE_CELL, /// Simple cell formula, or reference to a shared formula name. - FORMULATYPE_ARRAY, /// Array (matrix) formula. - FORMULATYPE_SHAREDFORMULA, /// Shared formula definition. - FORMULATYPE_CONDFORMAT, /// Condition of a conditional format rule. - FORMULATYPE_VALIDATION, /// Condition of a data validation. - FORMULATYPE_DEFINEDNAME /// Definition of a defined name. -}; - -// Reference helpers ========================================================== - -/** A 2D formula cell reference struct with relative flags. */ -struct BinSingleRef2d -{ - sal_Int32 mnCol; /// Column index. - sal_Int32 mnRow; /// Row index. - bool mbColRel; /// True = relative column reference. - bool mbRowRel; /// True = relative row reference. - - explicit BinSingleRef2d(); - - void setBiff12Data( sal_uInt16 nCol, sal_Int32 nRow, bool bRelativeAsOffset ); - void setBiff2Data( sal_uInt8 nCol, sal_uInt16 nRow, bool bRelativeAsOffset ); - void setBiff8Data( sal_uInt16 nCol, sal_uInt16 nRow, bool bRelativeAsOffset ); - - void readBiff12Data( SequenceInputStream& rStrm, bool bRelativeAsOffset ); - void readBiff2Data( BiffInputStream& rStrm, bool bRelativeAsOffset ); - void readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffset ); -}; - -// ---------------------------------------------------------------------------- - -/** A 2D formula cell range reference struct with relative flags. */ -struct BinComplexRef2d -{ - BinSingleRef2d maRef1; /// Start (top-left) cell address. - BinSingleRef2d maRef2; /// End (bottom-right) cell address. - - void readBiff12Data( SequenceInputStream& rStrm, bool bRelativeAsOffset ); - void readBiff2Data( BiffInputStream& rStrm, bool bRelativeAsOffset ); - void readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffset ); -}; - -// Token vector, token sequence =============================================== - -typedef ::com::sun::star::sheet::FormulaToken ApiToken; -typedef ::com::sun::star::uno::Sequence< ApiToken > ApiTokenSequence; - -/** Contains the base address and type of a special token representing an array - formula or a shared formula (sal_False), or a table operation (sal_True). */ -typedef ::com::sun::star::beans::Pair< ::com::sun::star::table::CellAddress, sal_Bool > ApiSpecialTokenInfo; - -/** A vector of formula tokens with additional convenience functions. */ -class ApiTokenVector : public ::std::vector< ApiToken > -{ -public: - explicit ApiTokenVector(); - - /** Appends a new token with the passed op-code, returns its data field. */ - ::com::sun::star::uno::Any& - append( sal_Int32 nOpCode ); - - /** Appends a new token with the passed op-code and data. */ - template< typename Type > - inline void append( sal_Int32 nOpCode, const Type& rData ) { append( nOpCode ) <<= rData; } -}; - -// Token sequence iterator ==================================================== - -/** Token sequence iterator that is able to skip space tokens. */ -class ApiTokenIterator -{ -public: - explicit ApiTokenIterator( const ApiTokenSequence& rTokens, sal_Int32 nSpacesOpCode, bool bSkipSpaces ); - /** Copy constructor that allows to change the skip spaces mode. */ - explicit ApiTokenIterator( const ApiTokenIterator& rIter, bool bSkipSpaces ); - - inline bool is() const { return mpToken != mpTokenEnd; } - inline const ApiToken* get() const { return mpToken; } - inline const ApiToken* operator->() const { return mpToken; } - inline const ApiToken& operator*() const { return *mpToken; } - - ApiTokenIterator& operator++(); - -private: - void skipSpaces(); - -private: - const ApiToken* mpToken; /// Pointer to current token of the token sequence. - const ApiToken* mpTokenEnd; /// Pointer behind last token of the token sequence. - const sal_Int32 mnSpacesOpCode; /// Op-code for whitespace tokens. - const bool mbSkipSpaces; /// true = Skip whitespace tokens. -}; - -// List of API op-codes ======================================================= - -/** Contains all API op-codes needed to build formulas with tokens. */ -struct ApiOpCodes -{ - // special - sal_Int32 OPCODE_UNKNOWN; /// Internal: function name unknown to mapper. - sal_Int32 OPCODE_EXTERNAL; /// External function call (e.g. add-ins). - // formula structure - sal_Int32 OPCODE_PUSH; /// Op-code for common value operands. - sal_Int32 OPCODE_MISSING; /// Placeholder for a missing function parameter. - sal_Int32 OPCODE_SPACES; /// Spaces between other formula tokens. - sal_Int32 OPCODE_NAME; /// Index of a defined name. - sal_Int32 OPCODE_DBAREA; /// Index of a database area. - sal_Int32 OPCODE_NLR; /// Natural language reference. - sal_Int32 OPCODE_DDE; /// DDE link function. - sal_Int32 OPCODE_MACRO; /// Macro function call. - sal_Int32 OPCODE_BAD; /// Bad token (unknown name, formula error). - sal_Int32 OPCODE_NONAME; /// Function style #NAME? error. - // separators - sal_Int32 OPCODE_OPEN; /// Opening parenthesis. - sal_Int32 OPCODE_CLOSE; /// Closing parenthesis. - sal_Int32 OPCODE_SEP; /// Function parameter separator. - // array separators - sal_Int32 OPCODE_ARRAY_OPEN; /// Opening brace for constant arrays. - sal_Int32 OPCODE_ARRAY_CLOSE; /// Closing brace for constant arrays. - sal_Int32 OPCODE_ARRAY_ROWSEP; /// Row separator in constant arrays. - sal_Int32 OPCODE_ARRAY_COLSEP; /// Column separator in constant arrays. - // unary operators - sal_Int32 OPCODE_PLUS_SIGN; /// Unary plus sign. - sal_Int32 OPCODE_MINUS_SIGN; /// Unary minus sign. - sal_Int32 OPCODE_PERCENT; /// Percent sign. - // binary operators - sal_Int32 OPCODE_ADD; /// Addition operator. - sal_Int32 OPCODE_SUB; /// Subtraction operator. - sal_Int32 OPCODE_MULT; /// Multiplication operator. - sal_Int32 OPCODE_DIV; /// Division operator. - sal_Int32 OPCODE_POWER; /// Power operator. - sal_Int32 OPCODE_CONCAT; /// String concatenation operator. - sal_Int32 OPCODE_EQUAL; /// Compare equal operator. - sal_Int32 OPCODE_NOT_EQUAL; /// Compare not equal operator. - sal_Int32 OPCODE_LESS; /// Compare less operator. - sal_Int32 OPCODE_LESS_EQUAL; /// Compare less or equal operator. - sal_Int32 OPCODE_GREATER; /// Compare greater operator. - sal_Int32 OPCODE_GREATER_EQUAL; /// Compare greater or equal operator. - sal_Int32 OPCODE_INTERSECT; /// Range intersection operator. - sal_Int32 OPCODE_LIST; /// Range list operator. - sal_Int32 OPCODE_RANGE; /// Range operator. -}; - -// Function parameter info ==================================================== - -/** Enumerates validity modes for a function parameter. */ -enum FuncParamValidity -{ - FUNC_PARAM_NONE = 0, /// Default for an unspecified entry in a C-array. - FUNC_PARAM_REGULAR, /// Parameter supported by Calc and Excel. - FUNC_PARAM_CALCONLY, /// Parameter supported by Calc only. - FUNC_PARAM_EXCELONLY /// Parameter supported by Excel only. -}; - -/** Enumerates different types of token class conversion in function parameters. */ -enum FuncParamConversion -{ - FUNC_PARAMCONV_ORG, /// Use original class of current token. - FUNC_PARAMCONV_VAL, /// Convert tokens to VAL class. - FUNC_PARAMCONV_ARR, /// Convert tokens to ARR class. - FUNC_PARAMCONV_RPT, /// Repeat parent conversion in VALTYPE parameters. - FUNC_PARAMCONV_RPX, /// Repeat parent conversion in REFTYPE parameters. - FUNC_PARAMCONV_RPO /// Repeat parent conversion in operands of operators. -}; - -/** Structure that contains all needed information for a parameter in a - function. - - The member meValid specifies which application supports the parameter. If - set to CALCONLY, import filters have to insert a default value for this - parameter, and export filters have to skip the parameter. If set to - EXCELONLY, import filters have to skip the parameter, and export filters - have to insert a default value for this parameter. - - The member mbValType specifies whether the parameter requires tokens to be - of value type (VAL or ARR class). - - If set to false, the parameter is called to be REFTYPE. Tokens with REF - default class can be inserted for the parameter (e.g. tAreaR tokens). - - If set to true, the parameter is called to be VALTYPE. Tokens with REF - class need to be converted to VAL tokens first (e.g. tAreaR will be - converted to tAreaV), and further conversion is done according to this - new token class. - - The member meConv specifies how to convert the current token class of the - token inserted for the parameter. If the token class is still REF this - means that the token has default REF class and the parameter is REFTYPE - (see member mbValType), the token will not be converted at all and remains - in REF class. Otherwise, token class conversion is depending on the actual - token class of the return value of the function containing this parameter. - The function may return REF class (tFuncR, tFuncVarR, tFuncCER), or it may - return VAL or ARR class (tFuncV, tFuncA, tFuncVarV, tFuncVarA, tFuncCEV, - tFuncCEA). Even if the function is able to return REF class, it may return - VAL or ARR class instead due to the VALTYPE data type of the parent - function parameter that calls the own function. Example: The INDIRECT - function returns REF class by default. But if called from a VALTYPE - function parameter, e.g. in the formula =ABS(INDIRECT("A1")), it returns - VAL or ARR class instead. Additionally, the repeating conversion types RPT - and RPX rely on the conversion executed for the function token class. - - 1) ORG: - Use the original class of the token (VAL or ARR), regardless of any - conversion done for the function return class. - - 2) VAL: - Convert ARR tokens to VAL class, regardless of any conversion done for - the function return class. - - 3) ARR: - Convert VAL tokens to ARR class, regardless of any conversion done for - the function return class. - - 4) RPT: - If the own function returns REF class (thus it is called from a REFTYPE - parameter, see above), and the parent conversion type (for the function - return class) was ORG, VAL, or ARR, ignore that conversion and always - use VAL conversion for the own token instead. If the parent conversion - type was RPT or RPX, repeat the conversion that would have been used if - the function would return value type. - If the own function returns value type (VAL or ARR class, see above), - and the parent conversion type (for the function return class) was ORG, - VAL, ARR, or RPT, repeat this conversion for the own token. If the - parent conversion type was RPX, always use ORG conversion type for the - own token instead. - - 5) RPX: - This type of conversion only occurs in functions returning VAL class by - default. If the own token is value type, and the VAL return class of - the own function has been changed to ARR class (due to direct ARR - conversion, or due to ARR conversion repeated by RPT or RPX), set the - own token to ARR type. Otherwise use the original token type (VAL - conversion from parent parameter will not be repeated at all). If - nested functions have RPT or value-type RPX parameters, they will not - repeat this conversion type, but will use ORG conversion instead (see - description of RPT above). - - 6) RPO: - This type of conversion is only used for the operands of all operators - (unary and binary arithmetic operators, comparison operators, and range - operators). It is not used for function parameters. On conversion, it - will be replaced by the last conversion type that was not the RPO - conversion. This leads to a slightly different behaviour than the RPT - conversion for operands in conjunction with a parent RPX conversion. - */ -struct FunctionParamInfo -{ - FuncParamValidity meValid; /// Parameter validity. - FuncParamConversion meConv; /// Token class conversion type. - bool mbValType; /// Data type (false = REFTYPE, true = VALTYPE). -}; - -// Function data ============================================================== - -/** This enumeration contains constants for all known external libraries - containing supported sheet functions. */ -enum FunctionLibraryType -{ - FUNCLIB_UNKNOWN = 0, /// Unknown library (must be zero). - FUNCLIB_EUROTOOL /// EuroTool add-in with EUROCONVERT function. -}; - -// ---------------------------------------------------------------------------- - -/** Represents information for a spreadsheet function. - - The member mpParamInfos points to a C-array of type information structures - for all parameters of the function. The last initialized structure - describing a regular parameter (member meValid == FUNC_PARAM_REGULAR) in - this array is used repeatedly for all following parameters supported by a - function. - */ -struct FunctionInfo -{ - ::rtl::OUString maOdfFuncName; /// ODF function name. - ::rtl::OUString maOoxFuncName; /// OOXML function name. - ::rtl::OUString maBiffMacroName; /// Expected macro name in EXTERN.CALL function. - ::rtl::OUString maExtProgName; /// Programmatic function name for external functions. - FunctionLibraryType meFuncLibType; /// The external library this function is part of. - sal_Int32 mnApiOpCode; /// API function opcode. - sal_uInt16 mnBiff12FuncId; /// BIFF12 function identifier. - sal_uInt16 mnBiffFuncId; /// BIFF2-BIFF8 function identifier. - sal_uInt8 mnMinParamCount; /// Minimum number of parameters. - sal_uInt8 mnMaxParamCount; /// Maximum number of parameters. - sal_uInt8 mnRetClass; /// BIFF token class of the return value. - const FunctionParamInfo* mpParamInfos; /// Information about all parameters. - bool mbParamPairs; /// True = optional parameters are expected to appear in pairs. - bool mbVolatile; /// True = volatile function. - bool mbExternal; /// True = external function in Calc. - bool mbMacroFunc; /// True = macro sheet function or command. - bool mbVarParam; /// True = use a tFuncVar token, also if min/max are equal. -}; - -typedef RefVector< FunctionInfo > FunctionInfoVector; - -// Function info parameter class iterator ===================================== - -/** Iterator working on the mpParamInfos member of the FunctionInfo struct. - - This iterator can be used to iterate through the array containing the - token class conversion information of function parameters. This iterator - repeats the last valid structure in the array - it stops automatically - before the first empty array entry or before the end of the array, even for - repeated calls to the increment operator. - */ -class FunctionParamInfoIterator -{ -public: - explicit FunctionParamInfoIterator( const FunctionInfo& rFuncInfo ); - - bool isCalcOnlyParam() const; - bool isExcelOnlyParam() const; - FunctionParamInfoIterator& operator++(); - -private: - const FunctionParamInfo* mpParamInfo; - const FunctionParamInfo* mpParamInfoEnd; - bool mbParamPairs; -}; - -// Base function provider ===================================================== - -struct FunctionProviderImpl; - -/** Provides access to function info structs for all available sheet functions. - */ -class FunctionProvider // not derived from WorkbookHelper to make it usable in file dumpers -{ -public: - explicit FunctionProvider( FilterType eFilter, BiffType eBiff, bool bImportFilter ); - virtual ~FunctionProvider(); - - /** Returns the function info for an OOXML function name, or 0 on error. */ - const FunctionInfo* getFuncInfoFromOoxFuncName( const ::rtl::OUString& rFuncName ) const; - - /** Returns the function info for a BIFF12 function index, or 0 on error. */ - const FunctionInfo* getFuncInfoFromBiff12FuncId( sal_uInt16 nFuncId ) const; - - /** Returns the function info for a BIFF2-BIFF8 function index, or 0 on error. */ - const FunctionInfo* getFuncInfoFromBiffFuncId( sal_uInt16 nFuncId ) const; - - /** Returns the function info for a macro function referred by the - EXTERN.CALL function, or 0 on error. */ - const FunctionInfo* getFuncInfoFromMacroName( const ::rtl::OUString& rFuncName ) const; - - /** Returns the library type associated with the passed URL of a function - library (function add-in). */ - FunctionLibraryType getFuncLibTypeFromLibraryName( const ::rtl::OUString& rLibraryName ) const; - -protected: - /** Returns the list of all function infos. */ - const FunctionInfoVector& getFuncs() const; - -private: - typedef ::boost::shared_ptr< FunctionProviderImpl > FunctionProviderImplRef; - FunctionProviderImplRef mxFuncImpl; /// Shared implementation between all copies of the provider. -}; - -// Op-code and function provider ============================================== - -struct OpCodeProviderImpl; - -/** Provides access to API op-codes for all available formula tokens and to - function info structs for all available sheet functions. - */ -class OpCodeProvider : public FunctionProvider // not derived from WorkbookHelper to make it usable as UNO service -{ -public: - explicit OpCodeProvider( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory, - FilterType eFilter, BiffType eBiff, bool bImportFilter ); - virtual ~OpCodeProvider(); - - /** Returns the structure containing all token op-codes for operators and - special tokens used by the Calc document and its formula parser. */ - const ApiOpCodes& getOpCodes() const; - - /** Returns the function info for an API token, or 0 on error. */ - const FunctionInfo* getFuncInfoFromApiToken( const ApiToken& rToken ) const; - - /** Returns the op-code map that is used by the OOXML formula parser. */ - ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry > - getOoxParserMap() const; - -private: - typedef ::boost::shared_ptr< OpCodeProviderImpl > OpCodeProviderImplRef; - OpCodeProviderImplRef mxOpCodeImpl; /// Shared implementation between all copies of the provider. -}; - -// API formula parser wrapper ================================================= - -/** A wrapper around the FormulaParser service provided by the Calc document. */ -class ApiParserWrapper : public OpCodeProvider -{ -public: - explicit ApiParserWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory, - const OpCodeProvider& rOpCodeProv ); - - /** Returns read/write access to the formula parser property set. */ - inline PropertySet& getParserProperties() { return maParserProps; } - - /** Calls the XFormulaParser::parseFormula() function of the API parser. */ - ApiTokenSequence parseFormula( - const ::rtl::OUString& rFormula, - const ::com::sun::star::table::CellAddress& rRefPos ); - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser > - mxParser; - PropertySet maParserProps; -}; - -// Formula parser/printer base class for filters ============================== - -/** Base class for import formula parsers and export formula compilers. */ -class FormulaProcessorBase : public OpCodeProvider, protected ApiOpCodes, public WorkbookHelper -{ -public: - explicit FormulaProcessorBase( const WorkbookHelper& rHelper ); - - // ------------------------------------------------------------------------ - - /** Generates a cell address string in A1 notation from the passed cell - address. - - @param rAddress The cell address containing column and row index. - @param bAbsolute True = adds dollar signs before column and row. - */ - static ::rtl::OUString generateAddress2dString( - const ::com::sun::star::table::CellAddress& rAddress, - bool bAbsolute ); - - /** Generates a cell address string in A1 notation from the passed binary - cell address. - - @param rAddress The cell address containing column and row index. - @param bAbsolute True = adds dollar signs before column and row. - */ - static ::rtl::OUString generateAddress2dString( - const BinAddress& rAddress, - bool bAbsolute ); - - /** Generates a cell range string in A1:A1 notation from the passed cell - range address. - - @param rRange The cell range address containing column and row indexes. - @param bAbsolute True = adds dollar signs before columns and rows. - */ - static ::rtl::OUString generateRange2dString( - const ::com::sun::star::table::CellRangeAddress& rRange, - bool bAbsolute ); - - /** Generates a cell range string in A1:A1 notation from the passed binary - cell range address. - - @param rRange The cell range address containing column and row indexes. - @param bAbsolute True = adds dollar signs before columns and rows. - */ - static ::rtl::OUString generateRange2dString( - const BinRange& rRange, - bool bAbsolute ); - - /** Generates a cell range list string in A1:A1 notation from the passed - cell range addresses. May enclose multiple ranges into parentheses. - - @param rRanges The list of cell range addresses. - @param bAbsolute True = adds dollar signs before columns and rows. - @param cSeparator Separator character between ranges. - @param bEncloseMultiple True = enclose multiple ranges in parentheses. - */ - static ::rtl::OUString generateRangeList2dString( - const ApiCellRangeList& rRanges, - bool bAbsolute, - sal_Unicode cSeparator, - bool bEncloseMultiple ); - - // ------------------------------------------------------------------------ - - /** Generates a string in Calc formula notation from the passed string. - - @param rString The string value. - - @return The string enclosed in double quotes, where all contained - quote characters are doubled. - */ - static ::rtl::OUString generateApiString( const ::rtl::OUString& rString ); - - /** Generates an array string in Calc formula notation from the passed - matrix with Any's containing double values or strings. - - @param rMatrix The matrix containing double values or strings. - */ - static ::rtl::OUString generateApiArray( const Matrix< ::com::sun::star::uno::Any >& rMatrix ); - - // ------------------------------------------------------------------------ - - /** Tries to extract a single cell reference from a formula token sequence. - - @param rTokens The token sequence to be parsed. Should contain exactly - one address token or cell range address token. The token sequence - may contain whitespace tokens. - - @return If the token sequence is valid, this function returns an Any - containing a com.sun.star.sheet.SingleReference object, or a - com.sun.star.sheet.ComplexReference object. If the token sequence - contains too many, or unexpected tokens, an empty Any is returned. - */ - ::com::sun::star::uno::Any - extractReference( const ApiTokenSequence& rTokens ) const; - - /** Tries to extract a cell range address from a formula token sequence. - - @param orAddress (output parameter) If the token sequence is valid, - this parameter will contain the extracted cell range address. If - the token sequence contains unexpected tokens, nothing meaningful - is inserted, and the function returns false. - - @param rTokens The token sequence to be parsed. Should contain exactly - one cell range address token. The token sequence may contain - whitespace tokens. - - @param bAllowRelative True = it is allowed that rTokens contains - relative references (based on cell A1 of the current sheet). - False = only real absolute references will be accepted. - - @return True, if the token sequence contains a valid cell range - address which has been extracted to orRange, false otherwise. - */ - bool extractCellRange( - ::com::sun::star::table::CellRangeAddress& orRange, - const ApiTokenSequence& rTokens, - bool bAllowRelative ) const; - - /** Tries to extract a cell range list from a formula token sequence. - - @param orRanges (output parameter) If the token sequence is valid, - this parameter will contain the extracted cell range list. Deleted - cells or cell ranges (shown as #REF! error in a formula) will be - skipped. If the token sequence contains unexpected tokens, an empty - list is returned here. - - @param rTokens The token sequence to be parsed. Should contain cell - address tokens or cell range address tokens, separated by the - standard function parameter separator token. The token sequence may - contain parentheses and whitespace tokens. - - @param bAllowRelative True = it is allowed that rTokens contains - relative references (based on cell A1 of the current sheet). - False = only real absolute references will be accepted. - - @param nFilterBySheet If non-negative, this function returns only cell - ranges located in the specified sheet, otherwise returns all cell - ranges contained in the token sequence. - */ - void extractCellRangeList( - ApiCellRangeList& orRanges, - const ApiTokenSequence& rTokens, - bool bAllowRelative, - sal_Int32 nFilterBySheet = -1 ) const; - - /** Tries to extract a string from a formula token sequence. - - @param orString (output parameter) The extracted string. - - @param rTokens The token sequence to be parsed. Should contain exactly - one string token, may contain whitespace tokens. - - @return True = token sequence is valid, output parameter orString - contains the string extracted from the token sequence. - */ - bool extractString( - ::rtl::OUString& orString, - const ApiTokenSequence& rTokens ) const; - - /** Tries to extract information about a special token used for array - formulas, shared formulas, or table operations. - - @param orTokenInfo (output parameter) The extracted information about - the token. Contains the base address and the token type (sal_False - for array or shared formulas, sal_True for table operations). - - @param rTokens The token sequence to be parsed. If it contains exactly - one OPCODE_BAD token with special token information, this - information will be extracted. - - @return True = token sequence is valid, output parameter orTokenInfo - contains the token information extracted from the token sequence. - */ - bool extractSpecialTokenInfo( - ApiSpecialTokenInfo& orTokenInfo, - const ApiTokenSequence& rTokens ) const; - - /** Converts a single string with separators in the passed formula token - sequence to a list of string tokens. - - @param orTokens (input/output parameter) Expects a single string token - in this token sequence (whitespace tokens are allowed). The string - is split into substrings. A list of string tokens separated with - parameter separator tokens is returned in this psrameter. - - @param cStringSep The separator character used to split the input - string. - - @param bTrimLeadingSpaces True = removes leading whitespace from all - substrings inserted into the formula token sequence. - */ - void convertStringToStringList( - ApiTokenSequence& orTokens, - sal_Unicode cStringSep, - bool bTrimLeadingSpaces ) const; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/formulaparser.hxx b/oox/inc/oox/xls/formulaparser.hxx deleted file mode 100644 index 3c5595639aa3..000000000000 --- a/oox/inc/oox/xls/formulaparser.hxx +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_FORMULAPARSER_HXX -#define OOX_XLS_FORMULAPARSER_HXX - -#include "oox/xls/formulabase.hxx" - -namespace oox { -namespace xls { - -// formula finalizer ========================================================== - -/** A generic formula token array finalizer. - - After building a formula token array from alien binary file formats, or - parsing an XML formula string using the com.sun.star.sheet.FormulaParser - service, the token array is still not ready to be put into the spreadsheet - document. There may be functions with a wrong number of parameters (missing - but required parameters, or unsupported parameters) or intermediate tokens - used to encode references to macro functions or add-in functions. This - helper processes a passed token array and builds a new compatible token - array. - - Derived classes may add more functionality by overwriting the virtual - functions. - */ -class FormulaFinalizer : public OpCodeProvider, protected ApiOpCodes -{ -public: - explicit FormulaFinalizer( const OpCodeProvider& rOpCodeProv ); - - /** Finalizes and returns the passed token array. */ - ApiTokenSequence finalizeTokenArray( const ApiTokenSequence& rTokens ); - -protected: - /** Derived classed may try to find a function info struct from the passed - string extracted from an OPCODE_BAD token. - - @param rTokenData The string that has been found in an OPCODE_BAD - token preceding the function parentheses. - */ - virtual const FunctionInfo* resolveBadFuncName( const ::rtl::OUString& rTokenData ) const; - - /** Derived classed may try to find the name of a defined name with the - passed index extracted from an OPCODE_NAME token. - - @param nTokenIndex The index of the defined name that has been found - in an OPCODE_NAME token preceding the function parentheses. - */ - virtual ::rtl::OUString resolveDefinedName( sal_Int32 nTokenIndex ) const; - -private: - typedef ::std::vector< const ApiToken* > ParameterPosVector; - - const FunctionInfo* getFunctionInfo( ApiToken& orFuncToken ); - const FunctionInfo* getExternCallInfo( ApiToken& orFuncToken, const ApiToken& rECToken ); - - void processTokens( const ApiToken* pToken, const ApiToken* pTokenEnd ); - const ApiToken* processParameters( const FunctionInfo& rFuncInfo, const ApiToken* pToken, const ApiToken* pTokenEnd ); - - bool isEmptyParameter( const ApiToken* pToken, const ApiToken* pTokenEnd ) const; - const ApiToken* getSingleToken( const ApiToken* pToken, const ApiToken* pTokenEnd ) const; - const ApiToken* skipParentheses( const ApiToken* pToken, const ApiToken* pTokenEnd ) const; - const ApiToken* findParameters( ParameterPosVector& rParams, const ApiToken* pToken, const ApiToken* pTokenEnd ) const; - void appendEmptyParameter( const FunctionInfo& rFuncInfo, size_t nParam ); - void appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam ); - void appendRequiredParameters( const FunctionInfo& rFuncInfo, size_t nParamCount ); - - bool appendFinalToken( const ApiToken& rToken ); - -private: - ApiTokenVector maTokens; -}; - -// ============================================================================ - -class FormulaParserImpl; - -/** Import formula parser for OOXML and BIFF filters. - - This class implements formula import for the OOXML and BIFF filter. One - instance is contained in the global filter data to prevent construction and - destruction of internal buffers for every imported formula. - */ -class FormulaParser : public FormulaProcessorBase -{ -public: - explicit FormulaParser( const WorkbookHelper& rHelper ); - virtual ~FormulaParser(); - - /** Converts an OOXML formula string. */ - ApiTokenSequence importFormula( - const ::com::sun::star::table::CellAddress& rBaseAddr, - const ::rtl::OUString& rFormulaString ) const; - - /** Imports and converts a BIFF12 token array from the passed stream. */ - ApiTokenSequence importFormula( - const ::com::sun::star::table::CellAddress& rBaseAddr, - FormulaType eType, - SequenceInputStream& rStrm ) const; - - /** Imports and converts a BIFF2-BIFF8 token array from the passed stream. - @param pnFmlaSize Size of the token array. If null is passed, reads - it from stream (1 byte in BIFF2, 2 bytes otherwise) first. */ - ApiTokenSequence importFormula( - const ::com::sun::star::table::CellAddress& rBaseAddr, - FormulaType eType, - BiffInputStream& rStrm, - const sal_uInt16* pnFmlaSize = 0 ) const; - - /** Converts the passed Boolean value to a similar formula. */ - ApiTokenSequence convertBoolToFormula( bool bValue ) const; - - /** Converts the passed BIFF error code to a similar formula. */ - ApiTokenSequence convertErrorToFormula( sal_uInt8 nErrorCode ) const; - - /** Converts the passed token index of a defined name to a formula calling that name. */ - ApiTokenSequence convertNameToFormula( sal_Int32 nTokenIndex ) const; - - /** Converts the passed XML formula to an OLE link target. */ - ::rtl::OUString importOleTargetLink( const ::rtl::OUString& rFormulaString ); - - /** Imports and converts an OLE link target from the passed stream. */ - ::rtl::OUString importOleTargetLink( SequenceInputStream& rStrm ); - - /** Converts the passed formula to a macro name for a drawing shape. */ - ::rtl::OUString importMacroName( const ::rtl::OUString& rFormulaString ); - -private: - ::std::auto_ptr< FormulaParserImpl > mxImpl; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/numberformatsbuffer.hxx b/oox/inc/oox/xls/numberformatsbuffer.hxx deleted file mode 100644 index 17fef04055fc..000000000000 --- a/oox/inc/oox/xls/numberformatsbuffer.hxx +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_NUMBERFORMATSBUFFER_HXX -#define OOX_XLS_NUMBERFORMATSBUFFER_HXX - -#include <com/sun/star/lang/Locale.hpp> -#include "oox/xls/workbookhelper.hxx" - -namespace com { namespace sun { namespace star { - namespace util { class XNumberFormats; } -} } } - -namespace oox { class PropertyMap; } - -namespace oox { -namespace xls { - -// ============================================================================ - -struct NumFmtModel -{ - ::com::sun::star::lang::Locale maLocale; - ::rtl::OUString maFmtCode; - sal_Int16 mnPredefId; - - explicit NumFmtModel(); -}; - -// ---------------------------------------------------------------------------- - -/** Contains all API number format attributes. */ -struct ApiNumFmtData -{ - sal_Int32 mnIndex; /// API number format index. - - explicit ApiNumFmtData(); -}; - -// ---------------------------------------------------------------------------- - -/** Contains all data for a number format code. */ -class NumberFormat : public WorkbookHelper -{ -public: - explicit NumberFormat( const WorkbookHelper& rHelper ); - - /** Sets the passed format code. */ - void setFormatCode( const ::rtl::OUString& rFmtCode ); - /** Sets the passed format code, encoded in UTF-8. */ - void setFormatCode( - const ::com::sun::star::lang::Locale& rLocale, - const sal_Char* pcFmtCode ); - /** Sets the passed predefined format code identifier. */ - void setPredefinedId( - const ::com::sun::star::lang::Locale& rLocale, - sal_Int16 nPredefId ); - - /** Final processing after import of all style settings. Returns the API format index. */ - sal_Int32 finalizeImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& rxNumFmts, - const ::com::sun::star::lang::Locale& rFromLocale ); - - /** Writes the number format to the passed property map. */ - void writeToPropertyMap( PropertyMap& rPropMap ) const; - -private: - NumFmtModel maModel; - ApiNumFmtData maApiData; -}; - -typedef ::boost::shared_ptr< NumberFormat > NumberFormatRef; - -// ============================================================================ - -class NumberFormatsBuffer : public WorkbookHelper -{ -public: - explicit NumberFormatsBuffer( const WorkbookHelper& rHelper ); - - /** Inserts a new number format. */ - NumberFormatRef createNumFmt( sal_Int32 nNumFmtId, const ::rtl::OUString& rFmtCode ); - - /** Inserts a new number format code. */ - NumberFormatRef importNumFmt( const AttributeList& rAttribs ); - /** Inserts a new number format code from a NUMFMT record. */ - void importNumFmt( SequenceInputStream& rStrm ); - /** Inserts a new number format code from a FORMAT record. */ - void importFormat( BiffInputStream& rStrm ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Writes the specified number format to the passed property map. */ - void writeToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const; - -private: - /** Inserts built-in number formats for the current system language. */ - void insertBuiltinFormats(); - -private: - typedef RefMap< sal_Int32, NumberFormat > NumberFormatMap; - - NumberFormatMap maNumFmts; /// List of number formats. - ::rtl::OUString maLocaleStr; /// Current office locale. - sal_Int32 mnNextBiffIndex; /// Format id counter for BIFF2-BIFF4. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/ooxformulaparser.hxx b/oox/inc/oox/xls/ooxformulaparser.hxx deleted file mode 100644 index 757aec615860..000000000000 --- a/oox/inc/oox/xls/ooxformulaparser.hxx +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_OOXFORMULAPARSER_HXX -#define OOX_XLS_OOXFORMULAPARSER_HXX - -#include <boost/shared_ptr.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/sheet/XFilterFormulaParser.hpp> -#include <cppuhelper/implbase3.hxx> - -namespace oox { -namespace xls { - -class OOXMLFormulaParserImpl; - -// ============================================================================ - -typedef ::cppu::WeakImplHelper3< - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::lang::XInitialization, - ::com::sun::star::sheet::XFilterFormulaParser > OOXMLFormulaParser_BASE; - -/** OOXML formula parser/compiler service for usage in ODF filters. */ -class OOXMLFormulaParser : public OOXMLFormulaParser_BASE -{ -public: - explicit OOXMLFormulaParser(); - virtual ~OOXMLFormulaParser(); - - // com.sun.star.lang.XServiceInfo interface ------------------------------- - - virtual ::rtl::OUString SAL_CALL - getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); - - virtual sal_Bool SAL_CALL - supportsService( const ::rtl::OUString& rService ) - throw( ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); - - // com.sun.star.lang.XInitialization interface ---------------------------- - - 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.sheet.XFilterFormulaParser interface ---------------------- - - virtual ::rtl::OUString SAL_CALL - getSupportedNamespace() - throw( ::com::sun::star::uno::RuntimeException ); - - // com.sun.star.sheet.XFormulaParser interface ---------------------------- - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL - parseFormula( - const ::rtl::OUString& rFormula, - const ::com::sun::star::table::CellAddress& rReferencePos ) - throw( ::com::sun::star::uno::RuntimeException ); - - virtual ::rtl::OUString SAL_CALL - printFormula( - const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& rTokens, - const ::com::sun::star::table::CellAddress& rReferencePos ) - throw( ::com::sun::star::uno::RuntimeException ); - -private: - typedef ::boost::shared_ptr< OOXMLFormulaParserImpl > ParserImplRef; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - mxComponent; - ParserImplRef mxParserImpl; /// Implementation of import parser. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/pagesettings.hxx b/oox/inc/oox/xls/pagesettings.hxx deleted file mode 100644 index b73fa350ad47..000000000000 --- a/oox/inc/oox/xls/pagesettings.hxx +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_PAGESETTINGS_HXX -#define OOX_XLS_PAGESETTINGS_HXX - -#include "oox/xls/worksheethelper.hxx" - -namespace oox { class PropertySet; } -namespace oox { namespace core { class Relations; } } - -namespace oox { -namespace xls { - -class HeaderFooterParser; - -// ============================================================================ - -/** Holds page style data for a single sheet. */ -struct PageSettingsModel -{ - ::rtl::OUString maGraphicUrl; /// URL of the graphic object. - ::rtl::OUString maBinSettPath; /// Relation identifier of binary printer settings. - ::rtl::OUString maOddHeader; /// Header string for odd pages. - ::rtl::OUString maOddFooter; /// Footer string for odd pages. - ::rtl::OUString maEvenHeader; /// Header string for even pages. - ::rtl::OUString maEvenFooter; /// Footer string for even pages. - ::rtl::OUString maFirstHeader; /// Header string for first page of the sheet. - ::rtl::OUString maFirstFooter; /// Footer string for first page of the sheet. - double mfLeftMargin; /// Margin between left edge of page and begin of sheet area. - double mfRightMargin; /// Margin between end of sheet area and right edge of page. - double mfTopMargin; /// Margin between top egde of page and begin of sheet area. - double mfBottomMargin; /// Margin between end of sheet area and bottom edge of page. - double mfHeaderMargin; /// Margin between top edge of page and begin of header. - double mfFooterMargin; /// Margin between end of footer and bottom edge of page. - sal_Int32 mnPaperSize; /// Paper size (enumeration). - sal_Int32 mnPaperWidth; /// Paper width in twips - sal_Int32 mnPaperHeight; /// Paper height in twips - sal_Int32 mnCopies; /// Number of copies to print. - sal_Int32 mnScale; /// Page scale (zoom in percent). - sal_Int32 mnFirstPage; /// First page number. - sal_Int32 mnFitToWidth; /// Fit to number of pages in horizontal direction. - sal_Int32 mnFitToHeight; /// Fit to number of pages in vertical direction. - sal_Int32 mnHorPrintRes; /// Horizontal printing resolution in DPI. - sal_Int32 mnVerPrintRes; /// Vertical printing resolution in DPI. - sal_Int32 mnOrientation; /// Landscape or portrait. - sal_Int32 mnPageOrder; /// Page order through sheet area (to left or down). - sal_Int32 mnCellComments; /// Cell comments printing mode. - sal_Int32 mnPrintErrors; /// Cell error printing mode. - bool mbUseEvenHF; /// True = use maEvenHeader/maEvenFooter. - bool mbUseFirstHF; /// True = use maFirstHeader/maFirstFooter. - bool mbValidSettings; /// True = use imported settings. - bool mbUseFirstPage; /// True = start page numbering with mnFirstPage. - bool mbBlackWhite; /// True = print black and white. - bool mbDraftQuality; /// True = print in draft quality. - bool mbFitToPages; /// True = Fit to width/height; false = scale in percent. - bool mbHorCenter; /// True = horizontally centered. - bool mbVerCenter; /// True = vertically centered. - bool mbPrintGrid; /// True = print grid lines. - bool mbPrintHeadings; /// True = print column/row headings. - - explicit PageSettingsModel(); - - /** Sets the BIFF print errors mode. */ - void setBiffPrintErrors( sal_uInt8 nPrintErrors ); -}; - -// ============================================================================ - -class PageSettings : public WorksheetHelper -{ -public: - explicit PageSettings( const WorksheetHelper& rHelper ); - - /** Imports printing options from a printOptions element. */ - void importPrintOptions( const AttributeList& rAttribs ); - /** Imports pageMarings element containing page margins. */ - void importPageMargins( const AttributeList& rAttribs ); - /** Imports pageSetup element for worksheets. */ - void importPageSetup( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs ); - /** Imports pageSetup element for chart sheets. */ - void importChartPageSetup( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs ); - /** Imports header and footer settings from a headerFooter element. */ - void importHeaderFooter( const AttributeList& rAttribs ); - /** Imports header/footer characters from a headerFooter element. */ - void importHeaderFooterCharacters( const ::rtl::OUString& rChars, sal_Int32 nElement ); - /** Imports the picture element. */ - void importPicture( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs ); - - /** Imports the PRINTOPTIONS record from the passed stream. */ - void importPrintOptions( SequenceInputStream& rStrm ); - /** Imports the PAGEMARGINS record from the passed stream. */ - void importPageMargins( SequenceInputStream& rStrm ); - /** Imports the PAGESETUP record from the passed stream. */ - void importPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm ); - /** Imports the CHARTPAGESETUP record from the passed stream. */ - void importChartPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm ); - /** Imports the HEADERFOOTER record from the passed stream. */ - void importHeaderFooter( SequenceInputStream& rStrm ); - /** Imports the PICTURE record from the passed stream. */ - void importPicture( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm ); - - /** Imports the LEFTMARGIN record from the passed BIFF stream. */ - void importLeftMargin( BiffInputStream& rStrm ); - /** Imports the RIGHTMARGIN record from the passed BIFF stream. */ - void importRightMargin( BiffInputStream& rStrm ); - /** Imports the TOPMARGIN record from the passed BIFF stream. */ - void importTopMargin( BiffInputStream& rStrm ); - /** Imports the BOTTOMMARGIN record from the passed BIFF stream. */ - void importBottomMargin( BiffInputStream& rStrm ); - /** Imports the SETUP record from the passed BIFF stream. */ - void importPageSetup( BiffInputStream& rStrm ); - /** Imports the HCENTER record from the passed BIFF stream. */ - void importHorCenter( BiffInputStream& rStrm ); - /** Imports the VCENTER record from the passed BIFF stream. */ - void importVerCenter( BiffInputStream& rStrm ); - /** Imports the PRINTHEADERS record from the passed BIFF stream. */ - void importPrintHeaders( BiffInputStream& rStrm ); - /** Imports the PRINTGRIDLINES record from the passed BIFF stream. */ - void importPrintGridLines( BiffInputStream& rStrm ); - /** Imports the HEADER record from the passed BIFF stream. */ - void importHeader( BiffInputStream& rStrm ); - /** Imports the FOOTER record from the passed BIFF stream. */ - void importFooter( BiffInputStream& rStrm ); - /** Imports the PICTURE record from the passed BIFF stream. */ - void importPicture( BiffInputStream& rStrm ); - - /** Sets whether percentual scaling or fit to width/height scaling is used. */ - void setFitToPagesMode( bool bFitToPages ); - - /** Creates a page style for the spreadsheet and sets all page properties. */ - void finalizeImport(); - -private: - /** Imports the binary picture data from the fragment with the passed identifier. */ - void importPictureData( const ::oox::core::Relations& rRelations, const ::rtl::OUString& rRelId ); - -private: - PageSettingsModel maModel; -}; - -// ============================================================================ - -class PageSettingsConverter : public WorkbookHelper -{ -public: - explicit PageSettingsConverter( const WorkbookHelper& rHelper ); - virtual ~PageSettingsConverter(); - - /** Writes all properties to the passed property set of a page style object. */ - void writePageSettingsProperties( - PropertySet& rPropSet, - const PageSettingsModel& rModel, - WorksheetType eSheetType ); - -private: - struct HFHelperData - { - sal_Int32 mnLeftPropId; - sal_Int32 mnRightPropId; - sal_Int32 mnHeight; - sal_Int32 mnBodyDist; - bool mbHasContent; - bool mbShareOddEven; - bool mbDynamicHeight; - - explicit HFHelperData( sal_Int32 nLeftPropId, sal_Int32 nRightPropId ); - }; - -private: - void convertHeaderFooterData( - PropertySet& rPropSet, - HFHelperData& orHFData, - const ::rtl::OUString rOddContent, - const ::rtl::OUString rEvenContent, - bool bUseEvenContent, - double fPageMargin, - double fContentMargin ); - - sal_Int32 writeHeaderFooter( - PropertySet& rPropSet, - sal_Int32 nPropId, - const ::rtl::OUString& rContent ); - -private: - typedef ::std::auto_ptr< HeaderFooterParser > HeaderFooterParserPtr; - HeaderFooterParserPtr mxHFParser; - HFHelperData maHeaderData; - HFHelperData maFooterData; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/pivotcachebuffer.hxx b/oox/inc/oox/xls/pivotcachebuffer.hxx deleted file mode 100644 index b56de3017516..000000000000 --- a/oox/inc/oox/xls/pivotcachebuffer.hxx +++ /dev/null @@ -1,532 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_PIVOTCACHEBUFFER_HXX -#define OOX_XLS_PIVOTCACHEBUFFER_HXX - -#include <com/sun/star/table/CellAddress.hpp> -#include <com/sun/star/table/CellRangeAddress.hpp> -#include <com/sun/star/util/DateTime.hpp> -#include "oox/helper/containerhelper.hxx" -#include "oox/helper/refvector.hxx" -#include "oox/xls/workbookhelper.hxx" - -namespace com { namespace sun { namespace star { - namespace sheet { class XDataPilotField; } -} } } - -namespace oox { namespace core { class Relations; } } - -namespace oox { -namespace xls { - -class WorksheetHelper; - -// ============================================================================ - -typedef ::std::pair< sal_Int32, rtl::OUString > IdCaptionPair; -typedef ::std::vector< IdCaptionPair > IdCaptionPairList; - -class PivotCacheItem -{ -public: - explicit PivotCacheItem(); - - /** Reads the string value from a pivot cache item. */ - void readString( const AttributeList& rAttribs ); - /** Reads the double value from a pivot cache item. */ - void readNumeric( const AttributeList& rAttribs ); - /** Reads the date/time value from a pivot cache item. */ - void readDate( const AttributeList& rAttribs ); - /** Reads the boolean value from a pivot cache item. */ - void readBool( const AttributeList& rAttribs ); - /** Reads the error code value from a pivot cache item. */ - void readError( const AttributeList& rAttribs, const UnitConverter& rUnitConverter ); - /** Reads the index of a shared item. */ - void readIndex( const AttributeList& rAttribs ); - - /** Reads the string value from a pivot cache item. */ - void readString( SequenceInputStream& rStrm ); - /** Reads the double value from a pivot cache item. */ - void readDouble( SequenceInputStream& rStrm ); - /** Reads the date/time value from a pivot cache item. */ - void readDate( SequenceInputStream& rStrm ); - /** Reads the boolean value from a pivot cache item. */ - void readBool( SequenceInputStream& rStrm ); - /** Reads the error code value from a pivot cache item. */ - void readError( SequenceInputStream& rStrm ); - /** Reads the index of a shared item. */ - void readIndex( SequenceInputStream& rStrm ); - - /** Reads the string value from a pivot cache item. */ - void readString( BiffInputStream& rStrm, const WorkbookHelper& rHelper ); - /** Reads the double value from a pivot cache item. */ - void readDouble( BiffInputStream& rStrm ); - /** Reads the integer value from a pivot cache item. */ - void readInteger( BiffInputStream& rStrm ); - /** Reads the date/time value from a pivot cache item. */ - void readDate( BiffInputStream& rStrm ); - /** Reads the boolean value from a pivot cache item. */ - void readBool( BiffInputStream& rStrm ); - /** Reads the error code value from a pivot cache item. */ - void readError( BiffInputStream& rStrm ); - - /** Returns the type of the item. */ - inline sal_Int32 getType() const { return mnType; } - /** Returns the value of the item. */ - inline const ::com::sun::star::uno::Any& getValue() const { return maValue; } - /** Returns the string representation of the item. */ - ::rtl::OUString getName() const; - /** Returns true if the item is unused. */ - inline bool isUnused() const { return mbUnused; } - -private: -friend class PivotCacheItemList; - // #FIXME hack Sets the value of this item to the given string ( and overwrites type if necessary - void setStringValue( const rtl::OUString& sName ); - ::com::sun::star::uno::Any maValue; /// Value of the item. - sal_Int32 mnType; /// Value type (OOXML token identifier). - bool mbUnused; -}; - -// ---------------------------------------------------------------------------- - -class PivotCacheItemList : public WorkbookHelper -{ -public: - explicit PivotCacheItemList( const WorkbookHelper& rHelper ); - - /** Imports the item from the passed attribute list. */ - void importItem( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Imports the item from the passed stream and record. */ - void importItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); - /** Imports a complete item list from the passed stream. */ - void importItemList( BiffInputStream& rStrm, sal_uInt16 nCount ); - - /** Returns true, if this item list is empty. */ - inline bool empty() const { return maItems.empty(); } - /** Returns the size of the item list. */ - inline size_t size() const { return maItems.size(); } - - /** Returns the specified item. */ - const PivotCacheItem* getCacheItem( sal_Int32 nItemIdx ) const; - /** Returns the names of all items. */ - void getCacheItemNames( ::std::vector< ::rtl::OUString >& orItemNames ) const; - void applyItemCaptions( const IdCaptionPairList& vCaptions ); - -private: - /** Creates and returns a new item at the end of the items list. */ - PivotCacheItem& createItem(); - /** Imports an array of items from the PCITEM_ARRAY record */ - void importArray( SequenceInputStream& rStrm ); - -private: - typedef ::std::vector< PivotCacheItem > CacheItemVector; - CacheItemVector maItems; /// All items of this list. -}; - -// ============================================================================ - -struct PCFieldModel -{ - ::rtl::OUString maName; /// Fixed name of the cache field. - ::rtl::OUString maCaption; /// Caption of the ccahe field. - ::rtl::OUString maPropertyName; /// OLAP property name. - ::rtl::OUString maFormula; /// Formula of a calculated field. - sal_Int32 mnNumFmtId; /// Number format for all items. - sal_Int32 mnSqlType; /// Data type from ODBC data source. - sal_Int32 mnHierarchy; /// Hierarchy this field is part of. - sal_Int32 mnLevel; /// Hierarchy level this field is part of. - sal_Int32 mnMappingCount; /// Number of property mappings. - bool mbDatabaseField; /// True = field from source data; false = calculated field. - bool mbServerField; /// True = ODBC server-based page field. - bool mbUniqueList; /// True = list of unique ODBC items exists. - bool mbMemberPropField; /// True = contains OLAP member properties. - - explicit PCFieldModel(); -}; - -// ---------------------------------------------------------------------------- - -struct PCSharedItemsModel -{ - bool mbHasSemiMixed; /// True = has (blank|string|bool|error) item(s), maybe other types. - bool mbHasNonDate; /// True = has non-date item(s), maybe date items. - bool mbHasDate; /// True = has date item(s), maybe other types. - bool mbHasString; /// True = has (string|bool|error) item(s), maybe other types. - bool mbHasBlank; /// True = has blank item(s), maybe other types. - bool mbHasMixed; /// True = has [(string|bool|error) and (number|date)] or (number and date). - bool mbIsNumeric; /// True = has numeric item(s), maybe other types except date. - bool mbIsInteger; /// True = has numeric item(s) with only integers, maybe other types except date. - bool mbHasLongText; /// True = contains strings with >255 charascters. - bool mbHasLongIndexes; /// True = indexes to shared items are 16-bit (BIFF only). - - explicit PCSharedItemsModel(); -}; - -// ---------------------------------------------------------------------------- - -struct PCFieldGroupModel -{ - ::com::sun::star::util::DateTime maStartDate; /// Manual or calculated start date for range grouping. - ::com::sun::star::util::DateTime maEndDate; /// Manual or calculated end date for range grouping. - double mfStartValue; /// Manual or calculated start value for range grouping. - double mfEndValue; /// Manual or calculated end value for range grouping. - double mfInterval; /// Interval for numeric range grouping. - sal_Int32 mnParentField; /// Index of cache field that contains item groups based on this field. - sal_Int32 mnBaseField; /// Index of cache field this grouped field is based on. - sal_Int32 mnGroupBy; /// Type of numeric or date range grouping. - bool mbRangeGroup; /// True = items are grouped by numeric ranges or date ranges. - bool mbDateGroup; /// True = items are grouped by date ranges or by item names. - bool mbAutoStart; /// True = start value for range groups is calculated from source data. - bool mbAutoEnd; /// True = end value for range groups is calculated from source data. - - explicit PCFieldGroupModel(); - - /** Sets the group-by value for BIFF import. */ - void setBiffGroupBy( sal_uInt8 nGroupBy ); -}; - -// ---------------------------------------------------------------------------- - -/** Helper struct for mapping original item names from/to group item names. */ -struct PivotCacheGroupItem -{ - ::rtl::OUString maOrigName; - ::rtl::OUString maGroupName; - - inline explicit PivotCacheGroupItem( const ::rtl::OUString& rItemName ) : - maOrigName( rItemName ), maGroupName( rItemName ) {} -}; - -typedef ::std::vector< PivotCacheGroupItem > PivotCacheGroupItemVector; - -// ---------------------------------------------------------------------------- - -class PivotCacheField : public WorkbookHelper -{ -public: - explicit PivotCacheField( const WorkbookHelper& rHelper, bool bIsDatabaseField ); - - /** Imports pivot cache field settings from the cacheField element. */ - void importCacheField( const AttributeList& rAttribs ); - /** Imports shared items settings from the sharedItems element. */ - void importSharedItems( const AttributeList& rAttribs ); - /** Imports a shared item from the passed element. */ - void importSharedItem( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Imports grouping settings from the fieldGroup element. */ - void importFieldGroup( const AttributeList& rAttribs ); - /** Imports numeric grouping settings from the rangePr element. */ - void importRangePr( const AttributeList& rAttribs ); - /** Imports an item of the mapping between group items and base items from the passed element. */ - void importDiscretePrItem( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Imports a group item from the passed element. */ - void importGroupItem( sal_Int32 nElement, const AttributeList& rAttribs ); - - /** Imports pivot cache field settings from the PCDFIELD record. */ - void importPCDField( SequenceInputStream& rStrm ); - /** Imports shared items settings from the PCDFSHAREDITEMS record. */ - void importPCDFSharedItems( SequenceInputStream& rStrm ); - /** Imports one or more shared items from the passed record. */ - void importPCDFSharedItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); - /** Imports grouping settings from the PCDFIELDGROUP record. */ - void importPCDFieldGroup( SequenceInputStream& rStrm ); - /** Imports numeric grouping settings from the PCDFRANGEPR record. */ - void importPCDFRangePr( SequenceInputStream& rStrm ); - /** Imports an item of the mapping between group items and base items from the passed record. */ - void importPCDFDiscretePrItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); - /** Imports one or more group items from the passed record. */ - void importPCDFGroupItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - /** Imports pivot cache field settings from the PCDFIELD record. */ - void importPCDField( BiffInputStream& rStrm ); - /** Imports numeric grouping settings from the PCDFRANGEPR record. */ - void importPCDFRangePr( BiffInputStream& rStrm ); - /** Imports the mapping between group items and base items from the PCDFDISCRETEPR record. */ - void importPCDFDiscretePr( BiffInputStream& rStrm ); - /** Apply user Captions to imported group data */ - void applyItemCaptions( const IdCaptionPairList& vCaptions ); - - /** Returns true, if the field is based on source data, or false if it is grouped or calculated. */ - inline bool isDatabaseField() const { return maFieldModel.mbDatabaseField; } - - /** Returns true, if the field contains a list of shared items. */ - inline bool hasSharedItems() const { return !maSharedItems.empty(); } - /** Returns true, if the field contains a list of grouping items. */ - inline bool hasGroupItems() const { return !maGroupItems.empty(); } - /** Returns true, if the field has inplace numeric grouping settings. */ - inline bool hasNumericGrouping() const { return maFieldGroupModel.mbRangeGroup && !maFieldGroupModel.mbDateGroup; } - /** Returns true, if the field has inplace date grouping settings. */ - inline bool hasDateGrouping() const { return maFieldGroupModel.mbRangeGroup && maFieldGroupModel.mbDateGroup; } - /** Returns true, if the field has a parent group field that groups the items of this field. */ - inline bool hasParentGrouping() const { return maFieldGroupModel.mnParentField >= 0; } - - /** Returns the name of the cache field. */ - inline const ::rtl::OUString& getName() const { return maFieldModel.maName; } - /** Returns the index of the parent group field that groups the items of this field. */ - inline sal_Int32 getParentGroupField() const { return maFieldGroupModel.mnParentField; } - /** Returns the index of the base field grouping is based on. */ - inline sal_Int32 getGroupBaseField() const { return maFieldGroupModel.mnBaseField; } - - /** Returns the shared or group item with the specified index. */ - const PivotCacheItem* getCacheItem( sal_Int32 nItemIdx ) const; - /** Returns the names of all shared or group items. */ - void getCacheItemNames( ::std::vector< ::rtl::OUString >& orItemNames ) const; - /** Returns shared or group items. */ - PivotCacheItemList getCacheItems() const; - - /** Creates inplace numeric grouping settings. */ - void convertNumericGrouping( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxDPField ) const; - /** Creates inplace date grouping settings or a new date group field. */ - ::rtl::OUString createDateGroupField( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField ) const; - /** Creates a new grouped DataPilot field and returns its name. */ - ::rtl::OUString createParentGroupField( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField, - const PivotCacheField& rBaseCacheField, - PivotCacheGroupItemVector& orItemNames ) const; - - /** Writes the title of the field into the passed sheet at the passed address. */ - void writeSourceHeaderCell( WorksheetHelper& rSheetHelper, - sal_Int32 nCol, sal_Int32 nRow ) const; - /** Writes a source field item value into the passed sheet. */ - void writeSourceDataCell( WorksheetHelper& rSheetHelper, - sal_Int32 nCol, sal_Int32 nRow, - const PivotCacheItem& rItem ) const; - - /** Reads an item from the PCRECORD record and writes it to the passed sheet. */ - void importPCRecordItem( SequenceInputStream& rStrm, - WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const; - /** Reads an item index from the PCITEM_INDEXLIST record and writes the item to the passed sheet. */ - void importPCItemIndex( BiffInputStream& rStrm, - WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const; - -private: - /** Tries to write the passed value to the passed sheet position. */ - void writeItemToSourceDataCell( WorksheetHelper& rSheetHelper, - sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem& rItem ) const; - /** Tries to write the value of a shared item to the passed sheet position. */ - void writeSharedItemToSourceDataCell( WorksheetHelper& rSheetHelper, - sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nItemIdx ) const; - -private: - typedef ::std::vector< sal_Int32 > IndexVector; - - PivotCacheItemList maSharedItems; /// All shared items of this field. - PivotCacheItemList maGroupItems; /// All group items of this field. - IndexVector maDiscreteItems; /// Mapping between group and base items. - PCFieldModel maFieldModel; /// Settings for this cache field. - PCSharedItemsModel maSharedItemsModel; /// Settings for shared items. - PCFieldGroupModel maFieldGroupModel; /// Settings for item grouping. -}; - -// ============================================================================ - -struct PCDefinitionModel -{ - ::rtl::OUString maRelId; /// Relation identifier for cache records fragment. - ::rtl::OUString maRefreshedBy; /// Name of user who last refreshed the cache. - double mfRefreshedDate; /// Date/time of last refresh. - sal_Int32 mnRecords; /// Number of data records in the cache. - sal_Int32 mnMissItemsLimit; /// Limit for discarding unused items. - sal_uInt16 mnDatabaseFields; /// Number of database (source data) fields (BIFF only). - bool mbInvalid; /// True = cache needs refresh. - bool mbSaveData; /// True = cached item values are present. - bool mbRefreshOnLoad; /// True = try to refresh cache on load. - bool mbOptimizeMemory; /// True = application may optimize memory usage. - bool mbEnableRefresh; /// True = refreshing cache is enabled in UI. - bool mbBackgroundQuery; /// True = application queries data asynchonously. - bool mbUpgradeOnRefresh; /// True = application may upgrade cache version. - bool mbTupleCache; /// True = cache stores OLAP functions. - bool mbSupportSubquery; /// True = data source supports subqueries. - bool mbSupportDrill; /// True = data source supports drilldown. - - explicit PCDefinitionModel(); -}; - -// ---------------------------------------------------------------------------- - -struct PCSourceModel -{ - sal_Int32 mnSourceType; /// Type of the source data (sheet, consolidation, scenario, external). - sal_Int32 mnConnectionId; /// Connection identifier for external data source. - - explicit PCSourceModel(); -}; - -// ---------------------------------------------------------------------------- - -struct PCWorksheetSourceModel -{ - ::rtl::OUString maRelId; /// Relation identifier for an external document URL. - ::rtl::OUString maSheet; /// Sheet name for cell range or sheet-local defined names. - ::rtl::OUString maDefName; /// Defined name containing a cell range if present. - ::com::sun::star::table::CellRangeAddress - maRange; /// Source cell range of the data. - - explicit PCWorksheetSourceModel(); -}; - -// ---------------------------------------------------------------------------- - -class PivotCache : public WorkbookHelper -{ -public: - explicit PivotCache( const WorkbookHelper& rHelper ); - - /** Reads pivot cache global settings from the pivotCacheDefinition element. */ - void importPivotCacheDefinition( const AttributeList& rAttribs ); - /** Reads cache source settings from the cacheSource element. */ - void importCacheSource( const AttributeList& rAttribs ); - /** Reads sheet source settings from the worksheetSource element. */ - void importWorksheetSource( const AttributeList& rAttribs, const ::oox::core::Relations& rRelations ); - - /** Reads pivot cache global settings from the PCDEFINITION record. */ - void importPCDefinition( SequenceInputStream& rStrm ); - /** Reads cache source settings from the PCDSOURCE record. */ - void importPCDSource( SequenceInputStream& rStrm ); - /** Reads sheet source settings from the PCDSHEETSOURCE record. */ - void importPCDSheetSource( SequenceInputStream& rStrm, const ::oox::core::Relations& rRelations ); - - /** Reads cache source settings from the PCDSOURCE record. */ - void importPCDSource( BiffInputStream& rStrm ); - /** Reads pivot cache global settings from the PCDEFINITION record. */ - void importPCDefinition( BiffInputStream& rStrm ); - - /** Creates and returns a new pivot cache field. */ - PivotCacheField& createCacheField( bool bInitDatabaseField = false ); - /** Checks validity of source data and creates a dummy data sheet for external sheet sources. */ - void finalizeImport(); - - /** Returns true, if the pivot cache is based on a valid data source, so - that pivot tables can be created based on this pivot cache. */ - inline bool isValidDataSource() const { return mbValidSource; } - /** Returns true, if the pivot cache is based on a dummy sheet created in finalizeImport. */ - inline bool isBasedOnDummySheet() const { return mbDummySheet; } - /** Returns the internal cell range the cache is based on. */ - inline const ::com::sun::star::table::CellRangeAddress& - getSourceRange() const { return maSheetSrcModel.maRange; } - /** Returns the relation identifier of the pivot cache records fragment. */ - inline const ::rtl::OUString& getRecordsRelId() const { return maDefModel.maRelId; } - - /** Returns the number of pivot cache fields. */ - sal_Int32 getCacheFieldCount() const; - /** Returns the cache field with the specified index. */ - const PivotCacheField* getCacheField( sal_Int32 nFieldIdx ) const; - /** Returns the source column index of the field with the passed index. */ - sal_Int32 getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const; - - /** Writes the titles of all source fields into the passed sheet. */ - void writeSourceHeaderCells( WorksheetHelper& rSheetHelper ) const; - /** Writes a source field item value into the passed sheet. */ - void writeSourceDataCell( WorksheetHelper& rSheetHelper, - sal_Int32 nColIdx, sal_Int32 nRowIdx, - const PivotCacheItem& rItem ) const; - - /** Reads a PCRECORD record and writes all item values to the passed sheet. */ - void importPCRecord( SequenceInputStream& rStrm, - WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const; - /** Reads a PCITEM_INDEXLIST record and writes all item values to the passed sheet. */ - void importPCItemIndexList( BiffInputStream& rStrm, - WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const; - -private: - /** Reads the worksheet source range from the DCONREF record. */ - void importDConRef( BiffInputStream& rStrm ); - /** Reads the defined name used for source data from the DCONNAME record. */ - void importDConName( BiffInputStream& rStrm ); - /** Reads the built-in defined name used for source data from the DCONBINAME record. */ - void importDConBIName( BiffInputStream& rStrm ); - /** Reads the sheet name and URL from the DCONREF, DCONNAME, or DCONBINAME records. */ - void importDConUrl( BiffInputStream& rStrm ); - - /** Finalizes the pivot cache if it is based on internal sheet data. */ - void finalizeInternalSheetSource(); - /** Finalizes the pivot cache if it is based on sheet data of an external spreadsheet document. */ - void finalizeExternalSheetSource(); - /** Creates a dummy sheet that will be filled with the pivot cache data. */ - void prepareSourceDataSheet(); - /** Checks, if the row index has changed since last call, and initializes the sheet data buffer. */ - void updateSourceDataRow( WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const; - -private: - typedef RefVector< PivotCacheField > PivotCacheFieldVector; - typedef ::std::vector< sal_Int32 > IndexVector; - - PivotCacheFieldVector maFields; /// All pivot cache fields. - PivotCacheFieldVector maDatabaseFields; /// All cache fields that are based on source data. - IndexVector maDatabaseIndexes; /// Database field index for all fields. - PCDefinitionModel maDefModel; /// Global pivot cache settings. - PCSourceModel maSourceModel; /// Pivot cache source settings. - PCWorksheetSourceModel maSheetSrcModel; /// Sheet source data if cache type is sheet. - ValueRangeSet maColSpans; /// Column spans used by SheetDataBuffer for optimized cell import. - ::rtl::OUString maTargetUrl; /// URL of an external source document. - mutable sal_Int32 mnCurrRow; /// Current row index in dummy sheet. - bool mbValidSource; /// True = pivot cache is based on supported data source. - bool mbDummySheet; /// True = pivot cache is based on a dummy sheet. -}; - -// ============================================================================ - -class PivotCacheBuffer : public WorkbookHelper -{ -public: - explicit PivotCacheBuffer( const WorkbookHelper& rHelper ); - - /** Registers a pivot cache definition fragment. The fragment will be loaded on demand (OOXML/BIFF12 only). */ - void registerPivotCacheFragment( sal_Int32 nCacheId, const ::rtl::OUString& rFragmentPath ); - /** Reads the reference to a pivot cache stream. The stream will be loaded on demand (BIFF2-BIFF8 only). */ - void importPivotCacheRef( BiffInputStream& rStrm ); - - /** Imports and stores a pivot cache definition fragment on first call, - returns the imported cache on subsequent calls with the same identifier. */ - PivotCache* importPivotCacheFragment( sal_Int32 nCacheId ); - -private: - /** Creates and returns a new pivot cache object with the passed identifier. */ - PivotCache& createPivotCache( sal_Int32 nCacheId ); - -private: - typedef ::std::map< sal_Int32, ::rtl::OUString > FragmentPathMap; - typedef RefMap< sal_Int32, PivotCache > PivotCacheMap; - typedef ::std::vector< sal_Int32 > PivotCacheIdVector; - - FragmentPathMap maFragmentPaths; - PivotCacheMap maCaches; - PivotCacheIdVector maCacheIds; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/pivotcachefragment.hxx b/oox/inc/oox/xls/pivotcachefragment.hxx deleted file mode 100644 index 66a583482cdf..000000000000 --- a/oox/inc/oox/xls/pivotcachefragment.hxx +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_PIVOTCACHEFRAGMENT_HXX -#define OOX_XLS_PIVOTCACHEFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -class PivotCache; -class PivotCacheField; - -// ============================================================================ - -class PivotCacheFieldContext : public WorkbookContextBase -{ -public: - explicit PivotCacheFieldContext( - WorkbookFragmentBase& rFragment, - PivotCacheField& rCacheField ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - PivotCacheField& mrCacheField; -}; - -// ============================================================================ - -class PivotCacheDefinitionFragment : public WorkbookFragmentBase -{ -public: - explicit PivotCacheDefinitionFragment( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath, - PivotCache& rPivotCache ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - virtual void finalizeImport(); - -private: - PivotCache& mrPivotCache; -}; - -// ============================================================================ - -class PivotCacheRecordsFragment : public WorksheetFragmentBase -{ -public: - explicit PivotCacheRecordsFragment( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath, - const PivotCache& rPivotCache ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - -private: - void startCacheRecord(); - void importPCRecord( SequenceInputStream& rStrm ); - void importPCRecordItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); - -private: - const PivotCache& mrPivotCache; - sal_Int32 mnColIdx; /// Relative column index in source data. - sal_Int32 mnRowIdx; /// Relative row index in source data. - bool mbInRecord; -}; - -// ============================================================================ -// ============================================================================ - -class BiffPivotCacheFragment : public BiffWorkbookFragmentBase -{ -public: - explicit BiffPivotCacheFragment( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rStrmName, - PivotCache& rPivotCache ); - - /** Imports the entire fragment, returns true, if EOF record has been reached. */ - virtual bool importFragment(); - -private: - PivotCache& mrPivotCache; -}; - -// ============================================================================ - -class BiffPivotCacheRecordsContext : public BiffWorksheetContextBase -{ -public: - explicit BiffPivotCacheRecordsContext( - const WorksheetHelper& rHelper, - const PivotCache& rPivotCache ); - - /** Reads the current record from stream and tries to insert a cell into - the source data sheet. */ - virtual void importRecord( BiffInputStream& rStrm ); - -private: - void startNextRow(); - -private: - typedef ::std::vector< sal_Int32 > ColumnIndexVector; - - const PivotCache& mrPivotCache; - ColumnIndexVector maUnsharedCols; /// Column indexes of all unshared cache fields. - size_t mnColIdx; /// Current index into maUnsharedCols. - sal_Int32 mnRowIdx; /// Current row in source data (0-based). - bool mbHasShared; /// True = pivot cache contains fields with shared items. - bool mbInRow; /// True = a data row has been started. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/pivottablebuffer.hxx b/oox/inc/oox/xls/pivottablebuffer.hxx deleted file mode 100644 index 1d7c10cafa5e..000000000000 --- a/oox/inc/oox/xls/pivottablebuffer.hxx +++ /dev/null @@ -1,453 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_PIVOTTABLEBUFFER_HXX -#define OOX_XLS_PIVOTTABLEBUFFER_HXX - -#include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/xls/pivotcachebuffer.hxx" -#include "oox/xls/stylesbuffer.hxx" - -namespace com { namespace sun { namespace star { - namespace sheet { class XDataPilotDescriptor; } - namespace sheet { class XDataPilotField; } -} } } - -namespace oox { -namespace xls { - -class PivotTable; - -// ============================================================================ - -struct PTFieldItemModel -{ - sal_Int32 mnCacheItem; /// Index to shared item in pivot cache. - sal_Int32 mnType; /// Type of the item. - rtl::OUString msCaption; /// User caption of the item - bool mbShowDetails; /// True = show item details (items of child fields). - bool mbHidden; /// True = item is hidden. - - explicit PTFieldItemModel(); - - /** Sets item type for BIFF import. */ - void setBiffType( sal_uInt16 nType ); -}; - -// ---------------------------------------------------------------------------- - -struct PTFieldModel -{ - sal_Int32 mnAxis; /// Axis this field is assigned to (none, row, column, page). - sal_Int32 mnNumFmtId; /// Number format for field items. - sal_Int32 mnAutoShowItems; /// Number of items (or percent/sum) to be shown in auto show filter. - sal_Int32 mnAutoShowRankBy; /// Index of the data field auto show filter is based on. - sal_Int32 mnSortType; /// Autosorting type. - sal_Int32 mnSortRefField; /// Reference field for autosorting. - sal_Int32 mnSortRefItem; /// Item in reference field for autosorting. - bool mbDataField; /// True = field appears in data area. - bool mbDefaultSubtotal; /// True = show default subtotals. - bool mbSumSubtotal; /// True = show sum subtotals. - bool mbCountASubtotal; /// True = show count all subtotals. - bool mbAverageSubtotal; /// True = show average subtotals. - bool mbMaxSubtotal; /// True = show maximum subtotals. - bool mbMinSubtotal; /// True = show minimum subtotals. - bool mbProductSubtotal; /// True = show product subtotals. - bool mbCountSubtotal; /// True = show count numbers subtotals. - bool mbStdDevSubtotal; /// True = show standard deviation subtotals. - bool mbStdDevPSubtotal; /// True = show standard deviation of population subtotals. - bool mbVarSubtotal; /// True = show variance subtotals. - bool mbVarPSubtotal; /// True = show variance of population subtotals. - bool mbShowAll; /// True = show items without data. - bool mbOutline; /// True = show in outline view, false = show in tabular view. - bool mbSubtotalTop; /// True = show subtotals on top of items in outline or compact mode. - bool mbInsertBlankRow; /// True = insert blank rows after items. - bool mbInsertPageBreak; /// True = insert page breaks after items. - bool mbAutoShow; /// True = auto show (top 10) filter enabled. - bool mbTopAutoShow; /// True = auto show filter shows top entries, false = bottom. - bool mbMultiPageItems; /// True = multiple items selectable in page diemsion. - - explicit PTFieldModel(); - - /** Sets axis type for BIFF import. */ - void setBiffAxis( sal_uInt8 nAxisFlags ); -}; - -// ---------------------------------------------------------------------------- - -struct PTPageFieldModel -{ - ::rtl::OUString maName; /// Unique name of the page field. - sal_Int32 mnField; /// Base pivot field. - sal_Int32 mnItem; /// Index of field item that is shown by the page field. - - explicit PTPageFieldModel(); -}; - -// ---------------------------------------------------------------------------- - -struct PTDataFieldModel -{ - ::rtl::OUString maName; /// Name of the data field. - sal_Int32 mnField; /// Base pivot field. - sal_Int32 mnSubtotal; /// Subtotal aggregation function. - sal_Int32 mnShowDataAs; /// Show data as, based on another field. - sal_Int32 mnBaseField; /// Base field for 'show data as'. - sal_Int32 mnBaseItem; /// Base item for 'show data as'. - sal_Int32 mnNumFmtId; /// Number format for the result. - - explicit PTDataFieldModel(); - - /** Sets the subtotal aggregation function for BIFF import. */ - void setBiffSubtotal( sal_Int32 nSubtotal ); - /** Sets the 'show data as' type for BIFF import. */ - void setBiffShowDataAs( sal_Int32 nShowDataAs ); -}; - -// ---------------------------------------------------------------------------- - -class PivotTableField : public WorkbookHelper -{ -public: - explicit PivotTableField( PivotTable& rPivotTable, sal_Int32 nFieldIndex ); - - /** Imports pivot field settings from the pivotField element. */ - void importPivotField( const AttributeList& rAttribs ); - /** Imports settings of an item in this pivot field from the item element. */ - void importItem( const AttributeList& rAttribs ); - /** Imports pivot field reference settings from the reference element. */ - void importReference( const AttributeList& rAttribs ); - /** Imports pivot field item reference settings from the x element. */ - void importReferenceItem( const AttributeList& rAttribs ); - - /** Imports pivot field settings from the PTFIELD record. */ - void importPTField( SequenceInputStream& rStrm ); - /** Imports settings of an item in this pivot field from the PTFITEM record. */ - void importPTFItem( SequenceInputStream& rStrm ); - /** Imports pivot field reference settings from the PTREFERENCE record. */ - void importPTReference( SequenceInputStream& rStrm ); - /** Imports pivot field item reference settings from the PTREFERENCEITEM record. */ - void importPTReferenceItem( SequenceInputStream& rStrm ); - - /** Imports pivot field settings from the PTFIELD and following records. */ - void importPTField( BiffInputStream& rStrm ); - /** Imports pivot field settings from the PTFIELD2 record. */ - void importPTField2( BiffInputStream& rStrm ); - /** Imports settings of an item in this pivot field from the PTFITEM record. */ - void importPTFItem( BiffInputStream& rStrm ); - - /** Finalizes the field after import, creates grouping and other settings. */ - void finalizeImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotDescriptor >& rxDPDesc ); - /** Finalizes the grouped date field after import. */ - void finalizeDateGroupingImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField, - sal_Int32 nBaseFieldIdx ); - /** Finalizes the grouped field after import. */ - void finalizeParentGroupingImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField, - const PivotCacheField& rBaseCacheField, - PivotCacheGroupItemVector& orItemNames ); - - /** Returns the name of the DataPilot field in the fields collection. */ - inline const ::rtl::OUString& getDPFieldName() const { return maDPFieldName; } - - /** Converts dimension and other settings for a row field. */ - void convertRowField(); - /** Converts dimension and other settings for a column field. */ - void convertColField(); - /** Converts dimension and other settings for a hidden field. */ - void convertHiddenField(); - /** Converts dimension and other settings for a page field */ - void convertPageField( const PTPageFieldModel& rPageField ); - /** Converts dimension and other settings for a data field. */ - void convertDataField( const PTDataFieldModel& rDataField ); - -private: - /** Converts dimension and other settings for row, column, page, or hidden fields. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField > - convertRowColPageField( sal_Int32 nAxis ); - -private: - typedef ::std::vector< PTFieldItemModel > ItemModelVector; - - PivotTable& mrPivotTable; /// The parent pivot table object. - ItemModelVector maItems; /// All items of this field. - PTFieldModel maModel; /// Pivot field settings. - ::rtl::OUString maDPFieldName; /// Name of the field in DataPilot field collection. - sal_Int32 mnFieldIndex; /// Zero-based index of this field. -}; - -// ============================================================================ - -struct PTFilterModel -{ - ::rtl::OUString maName; /// Name of the field filter. - ::rtl::OUString maDescription; /// Description of the field filter. - ::rtl::OUString maStrValue1; /// First string value for label filter. - ::rtl::OUString maStrValue2; /// Second string value for label filter. - double mfValue; /// Number of items or percent or sum to be shown. - sal_Int32 mnField; /// Base pivot field. - sal_Int32 mnMemPropField; /// Member property field. - sal_Int32 mnType; /// Filter type. - sal_Int32 mnEvalOrder; /// Evaluation order index. - sal_Int32 mnId; /// Unique identifier. - sal_Int32 mnMeasureField; /// Data field for filter calculation. - sal_Int32 mnMeasureHier; /// Hierarchy for filter calculation. - bool mbTopFilter; /// True = filter shows top entries, false = bottom. - - explicit PTFilterModel(); -}; - -// ---------------------------------------------------------------------------- - -class PivotTableFilter : public WorkbookHelper -{ -public: - explicit PivotTableFilter( const PivotTable& rPivotTable ); - - /** Reads the settings of a field filter from the filter element. */ - void importFilter( const AttributeList& rAttribs ); - /** Reads additional settings of a field filter from the top10 element. */ - void importTop10( const AttributeList& rAttribs ); - - /** Reads the settings of a field filter from the PTFILTER record. */ - void importPTFilter( SequenceInputStream& rStrm ); - /** Reads additional settings of a field filter from the TOP10FILTER record. */ - void importTop10Filter( SequenceInputStream& rStrm ); - - /** Applies the filter to the associated pivot table field if possible. */ - void finalizeImport(); - -private: - const PivotTable& mrPivotTable; - PTFilterModel maModel; -}; - -// ============================================================================ - -struct PTDefinitionModel : public AutoFormatModel -{ - ::rtl::OUString maName; - ::rtl::OUString maDataCaption; - ::rtl::OUString maGrandTotalCaption; - ::rtl::OUString maRowHeaderCaption; - ::rtl::OUString maColHeaderCaption; - ::rtl::OUString maErrorCaption; - ::rtl::OUString maMissingCaption; - ::rtl::OUString maPageStyle; - ::rtl::OUString maPivotTableStyle; - ::rtl::OUString maVacatedStyle; - ::rtl::OUString maTag; - sal_Int32 mnCacheId; - sal_Int32 mnDataPosition; - sal_Int32 mnPageWrap; - sal_Int32 mnIndent; - sal_Int32 mnChartFormat; - sal_uInt16 mnRowFields; - sal_uInt16 mnColFields; - bool mbDataOnRows; - bool mbShowError; - bool mbShowMissing; - bool mbShowItems; - bool mbDisableFieldList; - bool mbShowCalcMembers; - bool mbVisualTotals; - bool mbShowDataDropDown; - bool mbShowDrill; - bool mbPrintDrill; - bool mbEnableDrill; - bool mbPreserveFormatting; - bool mbUseAutoFormat; - bool mbPageOverThenDown; - bool mbSubtotalHiddenItems; - bool mbRowGrandTotals; - bool mbColGrandTotals; - bool mbFieldPrintTitles; - bool mbItemPrintTitles; - bool mbMergeItem; - bool mbShowEmptyRow; - bool mbShowEmptyCol; - bool mbShowHeaders; - bool mbFieldListSortAsc; - bool mbCustomListSort; - - explicit PTDefinitionModel(); -}; - -// ---------------------------------------------------------------------------- - -struct PTLocationModel -{ - ::com::sun::star::table::CellRangeAddress - maRange; /// Target cell range for the pivot table. - sal_Int32 mnFirstHeaderRow; /// First row of header cells (relative in pivot table). - sal_Int32 mnFirstDataRow; /// First row of data cells (relative in pivot table). - sal_Int32 mnFirstDataCol; /// First column of data cells (relative in pivot table). - sal_Int32 mnRowPageCount; /// Number of rows in page filter area. - sal_Int32 mnColPageCount; /// Number of columns in page filter area. - - explicit PTLocationModel(); -}; - -// ---------------------------------------------------------------------------- - -class PivotTable : public WorkbookHelper -{ -public: - explicit PivotTable( const WorkbookHelper& rHelper ); - - /** Reads global pivot table settings from the pivotTableDefinition element. */ - void importPivotTableDefinition( const AttributeList& rAttribs ); - /** Reads the location of the pivot table from the location element. */ - void importLocation( const AttributeList& rAttribs, sal_Int16 nSheet ); - /** Reads the index of a field located in the row dimension. */ - void importRowField( const AttributeList& rAttribs ); - /** Reads the index of a field located in the column dimension. */ - void importColField( const AttributeList& rAttribs ); - /** Reads the settings of a field located in the page dimension from the pageField element. */ - void importPageField( const AttributeList& rAttribs ); - /** Reads the settings of a field located in the data dimension from the dataField element. */ - void importDataField( const AttributeList& rAttribs ); - - /** Reads global pivot table settings from the PTDEFINITION record. */ - void importPTDefinition( SequenceInputStream& rStrm ); - /** Reads the location of the pivot table from the PTLOCATION record. */ - void importPTLocation( SequenceInputStream& rStrm, sal_Int16 nSheet ); - /** Reads the indexes of all fields located in the row dimension from a PTROWFIELDS record. */ - void importPTRowFields( SequenceInputStream& rStrm ); - /** Reads the indexes of all fields located in the column dimension from a PTCOLFIELDS record. */ - void importPTColFields( SequenceInputStream& rStrm ); - /** Reads the settings of a field located in the page dimension from the PTPAGEFIELD record. */ - void importPTPageField( SequenceInputStream& rStrm ); - /** Reads the settings of a field located in the data dimension from the PTDATAFIELD record. */ - void importPTDataField( SequenceInputStream& rStrm ); - - /** Reads global pivot table settings from the PTDEFINITION record. */ - void importPTDefinition( BiffInputStream& rStrm, sal_Int16 nSheet ); - /** Reads additional global pivot table settings from the PTDEFINITION2 record. */ - void importPTDefinition2( BiffInputStream& rStrm ); - /** Reads the indexes of all fields located in the row or column dimension from a PTROWCOLFIELDS record. */ - void importPTRowColFields( BiffInputStream& rStrm ); - /** Reads the settings of all fields located in the page dimension from a PTPAGEFIELDS record. */ - void importPTPageFields( BiffInputStream& rStrm ); - /** Reads the settings of a field located in the data dimension from a PTDATAFIELD record. */ - void importPTDataField( BiffInputStream& rStrm ); - - /** Creates and returns a new pivot table field. */ - PivotTableField& createTableField(); - /** Creates and returns a new pivot table filter. */ - PivotTableFilter& createTableFilter(); - /** Inserts the pivot table into the sheet. */ - void finalizeImport(); - /** Creates all date group fields for the specified cache field after import. */ - void finalizeDateGroupingImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField, - sal_Int32 nBaseFieldIdx ); - /** Creates all grouped fields for the specified cache field after import. */ - void finalizeParentGroupingImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField, - const PivotCacheField& rBaseCacheField, - PivotCacheGroupItemVector& orItemNames ); - - /** Returns the associated data pilot field for the specified pivot table field. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField > - getDataPilotField( const ::rtl::OUString& rFieldName ) const; - /** Returns the associated data pilot field for the specified pivot table field. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField > - getDataPilotField( sal_Int32 nFieldIdx ) const; - /** Returns the data layout field used to store all data fields in row/col dimension. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField > - getDataLayoutField() const; - - /** Returns the cache field with the specified index. */ - const PivotCacheField* getCacheField( sal_Int32 nFieldIdx ) const; - /** Returns the base cache field of the data field item with the specified index. */ - const PivotCacheField* getCacheFieldOfDataField( sal_Int32 nDataItemIdx ) const; - /** Returns the source column index of the pivot field with the passed index, or -1. */ - sal_Int32 getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const; - -private: - typedef RefVector< PivotTableField > PivotTableFieldVector; - typedef RefVector< PivotTableFilter > PivotTableFilterVector; - typedef ::std::vector< sal_Int32 > IndexVector; - typedef ::std::vector< PTPageFieldModel > PageFieldVector; - typedef ::std::vector< PTDataFieldModel > DataFieldVector; - -private: - /** Returns a pivot table field by its index. */ - PivotTableField* getTableField( sal_Int32 nFieldIdx ); - - /** Reads a field index for the row or column dimension. */ - static void importField( IndexVector& orFields, const AttributeList& rAttribs ); - /** Reads an array of field indexes for the row or column dimension. */ - static void importFields( IndexVector& orFields, SequenceInputStream& rStrm ); - /** Reads an array of field indexes for the row or column dimension. */ - static void importFields( IndexVector& orFields, BiffInputStream& rStrm, sal_Int32 nCount ); - -private: - PivotTableFieldVector maFields; /// All pivot table fields. - PivotTableField maDataField; /// Data layout field. - IndexVector maRowFields; /// Indexes to fields in row dimension. - IndexVector maColFields; /// Indexes to fields in column dimension. - PageFieldVector maPageFields; /// Settings for all fields in page dimension. - DataFieldVector maDataFields; /// Settings for all fields in data area. - PivotTableFilterVector maFilters; /// All field filters. - PTDefinitionModel maDefModel; /// Global pivot table settings. - PTLocationModel maLocationModel; /// Location settings of the pivot table. - const PivotCache* mpPivotCache; /// The pivot cache this table is based on. - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotDescriptor > - mxDPDescriptor; /// Descriptor of the DataPilot object. -}; - -// ============================================================================ - -class PivotTableBuffer : public WorkbookHelper -{ -public: - explicit PivotTableBuffer( const WorkbookHelper& rHelper ); - - /** Creates and returns a new pivot table. */ - PivotTable& createPivotTable(); - - /** Inserts all pivot tables into the sheet. */ - void finalizeImport(); - -private: - typedef RefVector< PivotTable > PivotTableVector; - PivotTableVector maTables; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/pivottablefragment.hxx b/oox/inc/oox/xls/pivottablefragment.hxx deleted file mode 100644 index 08cf854804cc..000000000000 --- a/oox/inc/oox/xls/pivottablefragment.hxx +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_PIVOTTABLEFRAGMENT_HXX -#define OOX_XLS_PIVOTTABLEFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" -#include "oox/xls/worksheethelper.hxx" - -namespace oox { -namespace xls { - -class PivotTable; -class PivotTableField; -class PivotTableFilter; - -// ============================================================================ - -class PivotTableFieldContext : public WorksheetContextBase -{ -public: - explicit PivotTableFieldContext( - WorksheetFragmentBase& rFragment, - PivotTableField& rTableField ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - PivotTableField& mrTableField; -}; - -// ============================================================================ - -class PivotTableFilterContext : public WorksheetContextBase -{ -public: - explicit PivotTableFilterContext( - WorksheetFragmentBase& rFragment, - PivotTableFilter& rTableFilter ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - PivotTableFilter& mrTableFilter; -}; - -// ============================================================================ - -class PivotTableFragment : public WorksheetFragmentBase -{ -public: - explicit PivotTableFragment( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - -private: - PivotTable& mrPivotTable; -}; - -// ============================================================================ -// ============================================================================ - -class BiffPivotTableContext : public BiffWorksheetContextBase -{ -public: - explicit BiffPivotTableContext( const WorksheetHelper& rHelper ); - - /** Imports all records related to the current pivot table. */ - virtual void importRecord( BiffInputStream& rStrm ); - -private: - PivotTable& mrPivotTable; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/querytablebuffer.hxx b/oox/inc/oox/xls/querytablebuffer.hxx deleted file mode 100644 index ae50bf6211dc..000000000000 --- a/oox/inc/oox/xls/querytablebuffer.hxx +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_QUERYTABLEBUFFER_HXX -#define OOX_XLS_QUERYTABLEBUFFER_HXX - -#include "oox/xls/stylesbuffer.hxx" -#include "oox/xls/worksheethelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -struct QueryTableModel : public AutoFormatModel -{ - ::rtl::OUString maDefName; /// Defined name containing the target cell range. - sal_Int32 mnConnId; /// Identifier of the external connection used to query the data. - sal_Int32 mnGrowShrinkType; /// Behaviour when source data size changes. - bool mbHeaders; /// True = source data contains a header row. - bool mbRowNumbers; /// True = first column contains row numbers. - bool mbDisableRefresh; /// True = refreshing data disabled. - bool mbBackground; /// True = refresh asynchronously. - bool mbFirstBackground; /// True = first background refresh not yet finished. - bool mbRefreshOnLoad; /// True = refresh table after import. - bool mbFillFormulas; /// True = expand formulas next to range when source data grows. - bool mbRemoveDataOnSave; /// True = remove querried data before saving. - bool mbDisableEdit; /// True = connection locked for editing. - bool mbPreserveFormat; /// True = use existing formatting for new rows. - bool mbAdjustColWidth; /// True = adjust column widths after refresh. - bool mbIntermediate; /// True = query table defined but not built yet. - - explicit QueryTableModel(); -}; - -// ---------------------------------------------------------------------------- - -class QueryTable : public WorksheetHelper -{ -public: - explicit QueryTable( const WorksheetHelper& rHelper ); - - /** Imports query table settings from the queryTable element. */ - void importQueryTable( const AttributeList& rAttribs ); - /** Imports query table settings from the QUERYTABLE record. */ - void importQueryTable( SequenceInputStream& rStrm ); - - /** Imports query table settings from the QUERYTABLE record. */ - void importQueryTable( BiffInputStream& rStrm ); - /** Imports query table settings from the QUERYTABLEREFRESH record. */ - void importQueryTableRefresh( BiffInputStream& rStrm ); - /** Imports query table settings from the QUERYTABLESETTINGS record. */ - void importQueryTableSettings( BiffInputStream& rStrm ); - - /** Inserts a web query into the sheet. */ - void finalizeImport(); - -private: - QueryTableModel maModel; -}; - -// ============================================================================ - -class QueryTableBuffer : public WorksheetHelper -{ -public: - explicit QueryTableBuffer( const WorksheetHelper& rHelper ); - - /** Creates a new query table and stores it into the internal vector. */ - QueryTable& createQueryTable(); - - /** Inserts all web queries into the sheet. */ - void finalizeImport(); - -private: - typedef RefVector< QueryTable > QueryTableVector; - QueryTableVector maQueryTables; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/querytablefragment.hxx b/oox/inc/oox/xls/querytablefragment.hxx deleted file mode 100644 index 7c1eaee05778..000000000000 --- a/oox/inc/oox/xls/querytablefragment.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_QUERYTABLEFRAGMENT_HXX -#define OOX_XLS_QUERYTABLEFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -class QueryTable; - -// ============================================================================ - -class QueryTableFragment : public WorksheetFragmentBase -{ -public: - explicit QueryTableFragment( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - -private: - QueryTable& mrQueryTable; -}; - -// ============================================================================ - -class BiffQueryTableContext : public BiffWorksheetContextBase -{ -public: - explicit BiffQueryTableContext( const WorksheetHelper& rHelper ); - - /** Imports all records related to the current query table. */ - virtual void importRecord( BiffInputStream& rStrm ); - -private: - QueryTable& mrQueryTable; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx deleted file mode 100644 index 8efffdf34286..000000000000 --- a/oox/inc/oox/xls/richstring.hxx +++ /dev/null @@ -1,313 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_RICHSTRING_HXX -#define OOX_XLS_RICHSTRING_HXX - -#include "oox/helper/refvector.hxx" -#include "oox/xls/stylesbuffer.hxx" - -namespace com { namespace sun { namespace star { - namespace text { class XText; } -} } } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Flags used to specify import/export mode of strings. */ -typedef sal_Int32 BiffStringFlags; - -const BiffStringFlags BIFF_STR_DEFAULT = 0x0000; /// Default string settings. -const BiffStringFlags BIFF_STR_FORCEUNICODE = 0x0001; /// Always use UCS-2 characters (default: try to compress). BIFF8 export only. -const BiffStringFlags BIFF_STR_8BITLENGTH = 0x0002; /// 8-bit string length field (default: 16-bit). -const BiffStringFlags BIFF_STR_SMARTFLAGS = 0x0004; /// Omit flags on empty string (default: read/write always). BIFF8 only. -const BiffStringFlags BIFF_STR_KEEPFONTS = 0x0008; /// Keep old fonts when reading unformatted string (default: clear fonts). Import only. -const BiffStringFlags BIFF_STR_EXTRAFONTS = 0x0010; /// Read trailing rich-string font array (default: nothing). BIFF2-BIFF5 import only. - -// ============================================================================ - -/** Contains text data and font attributes for a part of a rich formatted string. */ -class RichStringPortion : public WorkbookHelper -{ -public: - explicit RichStringPortion( const WorkbookHelper& rHelper ); - - /** Sets text data for this portion. */ - void setText( const ::rtl::OUString& rText ); - /** Creates and returns a new font formatting object. */ - FontRef createFont(); - /** Links this portion to a font object from the global font list. */ - void setFontId( sal_Int32 nFontId ); - - /** Final processing after import of all strings. */ - void finalizeImport(); - - /** Returns the text data of this portion. */ - inline const ::rtl::OUString& getText() const { return maText; } - /** Returns true, if the portion fontains font formatting. */ - inline bool hasFont() const { return mxFont.get() != 0; } - - /** Converts the portion and replaces or appends to the passed XText. */ - void convert( - const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText, - const Font* pFont, bool bReplace ); - - void writeFontProperties( - const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText, - const Font* pFont ) const; - -private: - ::rtl::OUString maText; /// Portion text. - FontRef mxFont; /// Embedded portion font, may be empty. - sal_Int32 mnFontId; /// Link to global font list. -}; - -typedef ::boost::shared_ptr< RichStringPortion > RichStringPortionRef; - -// ---------------------------------------------------------------------------- - -enum BiffFontPortionMode -{ - BIFF_FONTPORTION_8BIT, /// Font portion with 8-bit values. - BIFF_FONTPORTION_16BIT, /// Font portion with 16-bit values. - BIFF_FONTPORTION_OBJ /// Font portion in OBJ or TXO record. -}; - -// ---------------------------------------------------------------------------- - -/** Represents a position in a rich-string containing current font identifier. - - This object stores the position of a formatted character in a rich-string - and the identifier of a font from the global font list used to format this - and the following characters. Used in binary filters only. - */ -struct FontPortionModel -{ - sal_Int32 mnPos; /// First character in the string. - sal_Int32 mnFontId; /// Font identifier for the next characters. - - explicit inline FontPortionModel() : mnPos( 0 ), mnFontId( -1 ) {} - explicit inline FontPortionModel( sal_Int32 nPos, sal_Int32 nFontId ) : - mnPos( nPos ), mnFontId( nFontId ) {} - - void read( SequenceInputStream& rStrm ); - void read( BiffInputStream& rStrm, BiffFontPortionMode eMode ); -}; - -// ---------------------------------------------------------------------------- - -/** A vector with all font portions in a rich-string. */ -class FontPortionModelList : public ::std::vector< FontPortionModel > -{ -public: - inline explicit FontPortionModelList() {} - - /** Appends a rich-string font identifier. */ - void appendPortion( const FontPortionModel& rPortion ); - /** Reads count and font identifiers from the passed stream. */ - void importPortions( SequenceInputStream& rStrm ); - /** Reads nCount font identifiers from the passed stream. */ - void importPortions( BiffInputStream& rStrm, sal_uInt16 nCount, BiffFontPortionMode eMode ); - /** Reads count and font identifiers from the passed stream. */ - void importPortions( BiffInputStream& rStrm, bool b16Bit ); -}; - -// ============================================================================ - -struct PhoneticDataModel -{ - sal_Int32 mnFontId; /// Font identifier for text formatting. - sal_Int32 mnType; /// Phonetic text type. - sal_Int32 mnAlignment; /// Phonetic portion alignment. - - explicit PhoneticDataModel(); - - /** Sets the passed data from binary import. */ - void setBiffData( sal_Int32 nType, sal_Int32 nAlignment ); -}; - -// ---------------------------------------------------------------------------- - -class PhoneticSettings : public WorkbookHelper -{ -public: - explicit PhoneticSettings( const WorkbookHelper& rHelper ); - - /** Imports phonetic settings from the phoneticPr element. */ - void importPhoneticPr( const AttributeList& rAttribs ); - /** Imports phonetic settings from the PHONETICPR record. */ - void importPhoneticPr( SequenceInputStream& rStrm ); - /** Imports phonetic settings from the PHONETICPR record. */ - void importPhoneticPr( BiffInputStream& rStrm ); - - /** Imports phonetic settings from a rich string. */ - void importStringData( SequenceInputStream& rStrm ); - /** Imports phonetic settings from a rich string. */ - void importStringData( BiffInputStream& rStrm ); - -private: - PhoneticDataModel maModel; -}; - -// ============================================================================ - -/** Contains text data and positioning information for a phonetic text portion. */ -class RichStringPhonetic : public WorkbookHelper -{ -public: - explicit RichStringPhonetic( const WorkbookHelper& rHelper ); - - /** Sets text data for this phonetic portion. */ - void setText( const ::rtl::OUString& rText ); - /** Imports attributes of a phonetic run (rPh element). */ - void importPhoneticRun( const AttributeList& rAttribs ); - /** Sets the associated range in base text for this phonetic portion. */ - void setBaseRange( sal_Int32 nBasePos, sal_Int32 nBaseEnd ); - -private: - ::rtl::OUString maText; /// Portion text. - sal_Int32 mnBasePos; /// Start position in base text. - sal_Int32 mnBaseEnd; /// One-past-end position in base text. -}; - -typedef ::boost::shared_ptr< RichStringPhonetic > RichStringPhoneticRef; - -// ---------------------------------------------------------------------------- - -/** Represents a phonetic text portion in a rich-string with phonetic text. - Used in binary filters only. */ -struct PhoneticPortionModel -{ - sal_Int32 mnPos; /// First character in phonetic text. - sal_Int32 mnBasePos; /// First character in base text. - sal_Int32 mnBaseLen; /// Number of characters in base text. - - explicit inline PhoneticPortionModel() : mnPos( -1 ), mnBasePos( -1 ), mnBaseLen( 0 ) {} - explicit inline PhoneticPortionModel( sal_Int32 nPos, sal_Int32 nBasePos, sal_Int32 nBaseLen ) : - mnPos( nPos ), mnBasePos( nBasePos ), mnBaseLen( nBaseLen ) {} - - void read( SequenceInputStream& rStrm ); - void read( BiffInputStream& rStrm ); -}; - -// ---------------------------------------------------------------------------- - -/** A vector with all phonetic portions in a rich-string. */ -class PhoneticPortionModelList : public ::std::vector< PhoneticPortionModel > -{ -public: - inline explicit PhoneticPortionModelList() {} - - /** Appends a rich-string phonetic portion. */ - void appendPortion( const PhoneticPortionModel& rPortion ); - /** Reads all phonetic portions from the passed stream. */ - void importPortions( SequenceInputStream& rStrm ); - /** Reads phonetic portion data from the passed stream. */ - ::rtl::OUString importPortions( BiffInputStream& rStrm, sal_Int32 nPhoneticSize ); -}; - -// ============================================================================ - -/** Contains string data and a list of formatting runs for a rich formatted string. */ -class RichString : public WorkbookHelper -{ -public: - explicit RichString( const WorkbookHelper& rHelper ); - - /** Appends and returns a portion object for a plain string (t element). */ - RichStringPortionRef importText( const AttributeList& rAttribs ); - /** Appends and returns a portion object for a new formatting run (r element). */ - RichStringPortionRef importRun( const AttributeList& rAttribs ); - /** Appends and returns a phonetic text object for a new phonetic run (rPh element). */ - RichStringPhoneticRef importPhoneticRun( const AttributeList& rAttribs ); - /** Imports phonetic settings from the rPhoneticPr element. */ - void importPhoneticPr( const AttributeList& rAttribs ); - - /** Imports a Unicode rich-string from the passed record stream. */ - void importString( SequenceInputStream& rStrm, bool bRich ); - - /** Imports nChars byte characters from the passed BIFF stream and appends a new text portion. */ - void importCharArray( BiffInputStream& rStrm, sal_uInt16 nChars, rtl_TextEncoding eTextEnc ); - /** Imports a byte string from the passed BIFF stream and appends new text portions. */ - void importByteString( BiffInputStream& rStrm, rtl_TextEncoding eTextEnc, BiffStringFlags nFlags = BIFF_STR_DEFAULT ); - /** Imports a Unicode rich-string from the passed BIFF stream and appends new text portions. */ - void importUniString( BiffInputStream& rStrm, BiffStringFlags nFlags = BIFF_STR_DEFAULT ); - - /** Final processing after import of all strings. */ - void finalizeImport(); - - /** Tries to extract a plain string from this object. Returns the string, - if there is only one unformatted portion. */ - bool extractPlainString( - ::rtl::OUString& orString, - const Font* pFirstPortionFont = 0 ) const; - - /** Converts the string and writes it into the passed XText. - @param rxText The XText interface of the target object. - @param bReplaceOld True = replace old contents of the text object. - @param pFirstPortionFont Optional font providing additional rich-text - formatting for the first text portion, e.g. font escapement. */ - void convert( - const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText, - bool bReplaceOld, - const Font* pFirstPortionFont = 0 ) const; - -private: - /** Creates, appends, and returns a new empty string portion. */ - RichStringPortionRef createPortion(); - /** Creates, appends, and returns a new empty phonetic text portion. */ - RichStringPhoneticRef createPhonetic(); - - /** Create base text portions from the passed string and character formatting. */ - void createTextPortions( const ::rtl::OString& rText, rtl_TextEncoding eTextEnc, FontPortionModelList& rPortions ); - /** Create base text portions from the passed string and character formatting. */ - void createTextPortions( const ::rtl::OUString& rText, FontPortionModelList& rPortions ); - /** Create phonetic text portions from the passed string and portion data. */ - void createPhoneticPortions( const ::rtl::OUString& rText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen ); - -private: - typedef RefVector< RichStringPortion > PortionVector; - typedef RefVector< RichStringPhonetic > PhoneticVector; - - PortionVector maTextPortions; /// String portions with font data. - PhoneticSettings maPhonSettings; /// Phonetic settings for this string. - PhoneticVector maPhonPortions; /// Phonetic text portions. -}; - -typedef ::boost::shared_ptr< RichString > RichStringRef; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/richstringcontext.hxx b/oox/inc/oox/xls/richstringcontext.hxx deleted file mode 100644 index 5f50ccdda243..000000000000 --- a/oox/inc/oox/xls/richstringcontext.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_RICHSTRINGCONTEXT_HXX -#define OOX_XLS_RICHSTRINGCONTEXT_HXX - -#include "oox/xls/excelhandlers.hxx" -#include "oox/xls/richstring.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -class RichStringContext : public WorkbookContextBase -{ -public: - template< typename ParentType > - explicit RichStringContext( ParentType& rParent, RichStringRef xString ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - -private: - RichStringRef mxString; /// Processed string. - RichStringPortionRef mxPortion; /// Processed portion in the string. - RichStringPhoneticRef mxPhonetic; /// Processed phonetic text portion. - FontRef mxFont; /// Processed font of the portion. -}; - -// ---------------------------------------------------------------------------- - -template< typename ParentType > -RichStringContext::RichStringContext( ParentType& rParent, RichStringRef xString ) : - WorkbookContextBase( rParent ), - mxString( xString ) -{ - OSL_ENSURE( mxString.get(), "RichStringContext::RichStringContext - missing string object" ); -} - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/scenariobuffer.hxx b/oox/inc/oox/xls/scenariobuffer.hxx deleted file mode 100644 index e484e418473d..000000000000 --- a/oox/inc/oox/xls/scenariobuffer.hxx +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_SCENARIOBUFFER_HXX -#define OOX_XLS_SCENARIOBUFFER_HXX - -#include <com/sun/star/table/CellAddress.hpp> -#include "oox/helper/refmap.hxx" -#include "oox/helper/refvector.hxx" -#include "oox/xls/workbookhelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -struct ScenarioCellModel -{ - ::com::sun::star::table::CellAddress maPos; - ::rtl::OUString maValue; - sal_Int32 mnNumFmtId; - bool mbDeleted; - - explicit ScenarioCellModel(); -}; - -// ---------------------------------------------------------------------------- - -struct ScenarioModel -{ - ::rtl::OUString maName; /// Name of the scenario. - ::rtl::OUString maComment; /// Comment. - ::rtl::OUString maUser; /// Name of user created the scenario. - bool mbLocked; /// True = input cell values locked. - bool mbHidden; /// True = scenario is hidden. - - explicit ScenarioModel(); -}; - -// ---------------------------------------------------------------------------- - -class Scenario : public WorkbookHelper -{ -public: - explicit Scenario( const WorkbookHelper& rHelper, sal_Int16 nSheet ); - - /** Imports a scenario definition from a scenario element. */ - void importScenario( const AttributeList& rAttribs ); - /** Imports a new cell for this scenario from a inputCells element. */ - void importInputCells( const AttributeList& rAttribs ); - - /** Imports a scenario definition from a SCENARIO record. */ - void importScenario( SequenceInputStream& rStrm ); - /** Imports a new cell for this scenario from a INPUTCELLS record. */ - void importInputCells( SequenceInputStream& rStrm ); - - /** Imports a scenario definition from a SCENARIO record. */ - void importScenario( BiffInputStream& rStrm ); - - /** Creates the scenario in the Calc document. */ - void finalizeImport(); - -private: - typedef ::std::vector< ScenarioCellModel > ScenarioCellVector; - - ScenarioCellVector maCells; /// Scenario cells. - ScenarioModel maModel; /// Scenario model data. - sal_Int16 mnSheet; /// Index of the sheet this scenario is based on. -}; - -// ============================================================================ - -struct SheetScenariosModel -{ - sal_Int32 mnCurrent; /// Selected scenario. - sal_Int32 mnShown; /// Visible scenario. - - explicit SheetScenariosModel(); -}; - -// ---------------------------------------------------------------------------- - -class SheetScenarios : public WorkbookHelper -{ -public: - explicit SheetScenarios( const WorkbookHelper& rHelper, sal_Int16 nSheet ); - - /** Imports sheet scenario settings from a scenarios element. */ - void importScenarios( const AttributeList& rAttribs ); - /** Imports sheet scenario settings from a SCENARIOS record. */ - void importScenarios( SequenceInputStream& rStrm ); - /** Imports sheet scenario settings from a SCENARIOS record. */ - void importScenarios( BiffInputStream& rStrm ); - - /** Creates and returns a new scenario in this collection. */ - Scenario& createScenario(); - - /** Creates all scenarios in the Calc sheet. */ - void finalizeImport(); - -private: - typedef RefVector< Scenario > ScenarioVector; - ScenarioVector maScenarios; - SheetScenariosModel maModel; - sal_Int16 mnSheet; -}; - -// ============================================================================ - -class ScenarioBuffer : public WorkbookHelper -{ -public: - explicit ScenarioBuffer( const WorkbookHelper& rHelper ); - - /** Creates and returns a scenario collection for the passed sheet. */ - SheetScenarios& createSheetScenarios( sal_Int16 nSheet ); - - /** Creates all scenarios in the Calc document. */ - void finalizeImport(); - -private: - typedef RefMap< sal_Int16, SheetScenarios, ::std::greater< sal_Int16 > > SheetScenariosMap; - SheetScenariosMap maSheetScenarios; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/scenariocontext.hxx b/oox/inc/oox/xls/scenariocontext.hxx deleted file mode 100644 index 5a7334ad44eb..000000000000 --- a/oox/inc/oox/xls/scenariocontext.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_SCENARIOCONTEXT_HXX -#define OOX_XLS_SCENARIOCONTEXT_HXX - -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -class Scenario; -class SheetScenarios; - -// ============================================================================ - -class ScenarioContext : public WorksheetContextBase -{ -public: - explicit ScenarioContext( WorksheetContextBase& rParent, SheetScenarios& rSheetScenarios ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - Scenario& mrScenario; -}; - -// ============================================================================ - -class ScenariosContext : public WorksheetContextBase -{ -public: - explicit ScenariosContext( WorksheetFragmentBase& rFragment ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onStartElement( const AttributeList& rAttribs ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - virtual void onStartRecord( SequenceInputStream& rStrm ); - -private: - SheetScenarios& mrSheetScenarios; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/sharedstringsbuffer.hxx b/oox/inc/oox/xls/sharedstringsbuffer.hxx deleted file mode 100644 index cf659aa3ed85..000000000000 --- a/oox/inc/oox/xls/sharedstringsbuffer.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_SHAREDSTRINGSBUFFER_HXX -#define OOX_XLS_SHAREDSTRINGSBUFFER_HXX - -#include "oox/xls/richstring.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Collects all strings from the shared strings substream. */ -class SharedStringsBuffer : public WorkbookHelper -{ -public: - explicit SharedStringsBuffer( const WorkbookHelper& rHelper ); - - /** Creates and returns a new string entry. */ - RichStringRef createRichString(); - /** Imports the complete shared string table from a BIFF file. */ - void importSst( BiffInputStream& rStrm ); - - /** Final processing after import of all strings. */ - void finalizeImport(); - - /** Returns the specified string. */ - RichStringRef getString( sal_Int32 nStringId ) const; - -private: - typedef RefVector< RichString > StringVector; - StringVector maStrings; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/sharedstringsfragment.hxx b/oox/inc/oox/xls/sharedstringsfragment.hxx deleted file mode 100644 index f84b5efb5040..000000000000 --- a/oox/inc/oox/xls/sharedstringsfragment.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_SHAREDSTRINGSFRAGMENT_HXX -#define OOX_XLS_SHAREDSTRINGSFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -class SharedStringsFragment : public WorkbookFragmentBase -{ -public: - explicit SharedStringsFragment( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - virtual void finalizeImport(); -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/sheetdatabuffer.hxx b/oox/inc/oox/xls/sheetdatabuffer.hxx deleted file mode 100644 index d715f07705e3..000000000000 --- a/oox/inc/oox/xls/sheetdatabuffer.hxx +++ /dev/null @@ -1,343 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_SHEETDATABUFFER_HXX -#define OOX_XLS_SHEETDATABUFFER_HXX - -#include <list> -#include <map> -#include "oox/xls/richstring.hxx" -#include "oox/xls/worksheethelper.hxx" - -namespace com { namespace sun { namespace star { - namespace sheet { class XNamedRange; } - namespace util { struct DateTime; } -} } } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Stores basic data about cell values and formatting. */ -struct CellModel -{ - ::com::sun::star::table::CellAddress - maCellAddr; /// The address of the current cell. - sal_Int32 mnCellType; /// Data type of the cell value. - sal_Int32 mnXfId; /// XF (cell formatting) identifier. - bool mbShowPhonetic; /// True = show phonetic text. - - explicit CellModel(); -}; - -// ---------------------------------------------------------------------------- - -/** Stores data about cell formulas. */ -struct CellFormulaModel -{ - ::com::sun::star::table::CellRangeAddress - maFormulaRef; /// Formula range for array/shared formulas and data tables. - sal_Int32 mnFormulaType; /// Type of the formula (regular, array, shared, table). - sal_Int32 mnSharedId; /// Identifier of a shared formula (OOXML only). - - explicit CellFormulaModel(); - - /** Returns true, if the passed cell address is valid for an array formula. */ - bool isValidArrayRef( const ::com::sun::star::table::CellAddress& rCellAddr ); - /** Returns true, if the passed cell address is valid for a shared formula. */ - bool isValidSharedRef( const ::com::sun::star::table::CellAddress& rCellAddr ); -}; - -// ---------------------------------------------------------------------------- - -/** Stores data about table operations. */ -struct DataTableModel -{ - ::rtl::OUString maRef1; /// First reference cell for table operations. - ::rtl::OUString maRef2; /// Second reference cell for table operations. - bool mb2dTable; /// True = 2-dimensional data table. - bool mbRowTable; /// True = row oriented data table. - bool mbRef1Deleted; /// True = first reference cell deleted. - bool mbRef2Deleted; /// True = second reference cell deleted. - - explicit DataTableModel(); -}; - -// ============================================================================ - -/** Stores position and contents of a range of cells for optimized import. */ -class CellBlock : public WorksheetHelper -{ -public: - explicit CellBlock( const WorksheetHelper& rHelper, const ValueRange& rColSpan, sal_Int32 nRow ); - - /** Returns true, if the end index of the passed colspan is greater than - the own column end index, or if the passed range has the same end index - but the start indexes do not match. */ - bool isBefore( const ValueRange& rColSpan ) const; - /** Returns true, if the cell block can be expanded with the passed colspan. */ - bool isExpandable( const ValueRange& rColSpan ) const; - /** Returns true, if the own colspan contains the passed column. */ - bool contains( sal_Int32 nCol ) const; - - /** Returns the specified cell from the last row in the cell buffer array. */ - ::com::sun::star::uno::Any& getCellAny( sal_Int32 nCol ); - /** Inserts a rich-string into the cell block. */ - void insertRichString( - const ::com::sun::star::table::CellAddress& rAddress, - const RichStringRef& rxString, - const Font* pFirstPortionFont ); - - /** Appends a new row to the cell buffer array. */ - void startNextRow(); - /** Writes all buffered cells into the Calc sheet. */ - void finalizeImport(); - -private: - /** Fills unused cells before passed index with empty strings. */ - void fillUnusedCells( sal_Int32 nIndex ); - -private: - /** Stores position and string data of a rich-string cell. */ - struct RichStringCell - { - ::com::sun::star::table::CellAddress - maCellAddr; /// The address of the rich-string cell. - RichStringRef mxString; /// The string with rich formatting. - const Font* mpFirstPortionFont; /// Font information from cell for first text portion. - - explicit RichStringCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - const RichStringRef& rxString, - const Font* pFirstPortionFont ); - }; - typedef ::std::list< RichStringCell > RichStringCellList; - - ::com::sun::star::table::CellRangeAddress - maRange; /// Cell range covered by this cell block. - RichStringCellList maRichStrings; /// Cached rich-string cells. - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > - maCellArray; /// The array of cells of this cell block. - ::com::sun::star::uno::Any* - mpCurrCellRow; /// Pointer to first cell of current row (last row in maCellArray). - const sal_Int32 mnRowLength; /// Number of cells covered by row of this cell block. - sal_Int32 mnFirstFreeIndex; /// Relative index of first unused cell in current row. -}; - -// ============================================================================ - -/** Manages all cell blocks currently in use. */ -class CellBlockBuffer : public WorksheetHelper -{ -public: - explicit CellBlockBuffer( const WorksheetHelper& rHelper ); - - /** Sets column span information for a row. */ - void setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpans ); - - /** Tries to find a cell block. Recalculates the map of cell blocks, if the - passed cell address is located in another row than the last cell. */ - CellBlock* getCellBlock( const ::com::sun::star::table::CellAddress& rCellAddr ); - - /** Inserts all cells of all open cell blocks into the Calc document. */ - void finalizeImport(); - -private: - typedef ::std::map< sal_Int32, ValueRangeVector > ColSpanVectorMap; - typedef RefMap< sal_Int32, CellBlock > CellBlockMap; - - ColSpanVectorMap maColSpans; /// Buffereed column spans, mapped by row index. - CellBlockMap maCellBlocks; /// All open cell blocks, mapped by last (!) column of the block span. - CellBlockMap::iterator maCellBlockIt; /// Pointer to cell block currently in use. - sal_Int32 mnCurrRow; /// Current row index used for buffered cell import. -}; - -// ============================================================================ - -/** Manages the cell contents and cell formatting of a sheet. - */ -class SheetDataBuffer : public WorksheetHelper -{ -public: - explicit SheetDataBuffer( const WorksheetHelper& rHelper ); - - /** Sets column span information for a row. */ - void setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpans ); - - /** Inserts a blank cell (with formatting) into the sheet. */ - void setBlankCell( const CellModel& rModel ); - /** Inserts a value cell into the sheet. */ - void setValueCell( const CellModel& rModel, double fValue ); - /** Inserts a simple string cell into the sheet. */ - void setStringCell( const CellModel& rModel, const ::rtl::OUString& rText ); - /** Inserts a rich-string cell into the sheet. */ - void setStringCell( const CellModel& rModel, const RichStringRef& rxString ); - /** Inserts a shared string cell into the sheet. */ - void setStringCell( const CellModel& rModel, sal_Int32 nStringId ); - /** Inserts a date/time cell into the sheet and adjusts number format. */ - void setDateTimeCell( const CellModel& rModel, const ::com::sun::star::util::DateTime& rDateTime ); - /** Inserts a boolean cell into the sheet and adjusts number format. */ - void setBooleanCell( const CellModel& rModel, bool bValue ); - /** Inserts an error cell from the passed error code into the sheet. */ - void setErrorCell( const CellModel& rModel, const ::rtl::OUString& rErrorCode ); - /** Inserts an error cell from the passed BIFF error code into the sheet. */ - void setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCode ); - /** Inserts a formula cell into the sheet. */ - void setFormulaCell( const CellModel& rModel, const ApiTokenSequence& rTokens ); - /** Inserts a shared formula cell into the sheet (OOXML only). */ - void setFormulaCell( const CellModel& rModel, sal_Int32 nSharedId ); - - /** Inserts the passed token array as array formula. */ - void createArrayFormula( - const ::com::sun::star::table::CellRangeAddress& rRange, - const ApiTokenSequence& rTokens ); - /** Sets a multiple table operation to the passed range. */ - void createTableOperation( - const ::com::sun::star::table::CellRangeAddress& rRange, - const DataTableModel& rModel ); - /** Creates a named range with a special name for a shared formula with the - specified identifier and formula definition (OOXML only). */ - void createSharedFormula( - sal_Int32 nSharedId, - const ApiTokenSequence& rTokens ); - /** Creates a named range with a special name for a shared formula with the - specified base address and formula definition (BIFF only). */ - void createSharedFormula( - const ::com::sun::star::table::CellAddress& rCellAddr, - const ApiTokenSequence& rTokens ); - - /** Sets default cell formatting for the specified range of rows. */ - void setRowFormat( sal_Int32 nRow, sal_Int32 nXfId, bool bCustomFormat ); - /** Merges the cells in the passed cell range. */ - void setMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); - /** Sets a standard number format (constant from com.sun.star.util.NumberFormat) to the specified cell. */ - void setStandardNumFmt( - const ::com::sun::star::table::CellAddress& rCellAddr, - sal_Int16 nStdNumFmt ); - - /** Final processing after the sheet has been imported. */ - void finalizeImport(); - -private: - struct XfIdRowRange; - - /** Sets the passed formula token array into a cell. */ - void setCellFormula( - const ::com::sun::star::table::CellAddress& rCellAddr, - const ApiTokenSequence& rTokens ); - - /** Creates a named range with a special name for a shared formula with the - specified base address and formula definition. */ - void createSharedFormula( const BinAddress& rMapKey, const ApiTokenSequence& rTokens ); - /** Creates a formula token array representing the shared formula with the - passed identifier. */ - ApiTokenSequence resolveSharedFormula( const BinAddress& rMapKey ) const; - - /** Inserts the passed array formula into the sheet. */ - void finalizeArrayFormula( - const ::com::sun::star::table::CellRangeAddress& rRange, - const ApiTokenSequence& rTokens ) const; - /** Inserts the passed table operation into the sheet. */ - void finalizeTableOperation( - const ::com::sun::star::table::CellRangeAddress& rRange, - const DataTableModel& rModel ) const; - - /** Processes the cell formatting data of the passed cell. - @param nNumFmtId If set, overrides number format of the cell XF. */ - void setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtId = -1 ); - - /** Writes all cell formatting attributes to the passed row range. */ - void writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const; - - /** Writes all cell formatting attributes to the passed cell range list. (depreciates writeXfIdRangeProperties) */ - void writeXfIdRangeListProperties( sal_Int32 nXfId, sal_Int32 nNumFmtId, const ApiCellRangeList& rRanges ) const; - - /** Merges the passed merged range and updates right/bottom cell borders. */ - void finalizeMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); - -private: - /** Stores cell range address and formula token array of an array formula. */ - typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, ApiTokenSequence > ArrayFormula; - typedef ::std::list< ArrayFormula > ArrayFormulaList; - - /** Stores cell range address and settings of a table operation. */ - typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, DataTableModel > TableOperation; - typedef ::std::list< TableOperation > TableOperationList; - - typedef ::std::map< BinAddress, sal_Int32 > SharedFormulaMap; - - /** Stores information about a range of rows with equal cell formatting. */ - struct XfIdRowRange - { - ValueRange maRowRange; /// Indexes of first and last row. - sal_Int32 mnXfId; /// XF identifier for the row range. - - explicit XfIdRowRange(); - void set( sal_Int32 nRow, sal_Int32 nXfId ); - bool tryExpand( sal_Int32 nRow, sal_Int32 nXfId ); - }; - - typedef ::std::pair< sal_Int32, sal_Int32 > XfIdNumFmtKey; - typedef ::std::map< XfIdNumFmtKey, ApiCellRangeList > XfIdRangeListMap; - - /** Stores information about a merged cell range. */ - struct MergedRange - { - ::com::sun::star::table::CellRangeAddress - maRange; /// The formatted cell range. - sal_Int32 mnHorAlign; /// Horizontal alignment in the range. - - explicit MergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); - explicit MergedRange( const ::com::sun::star::table::CellAddress& rAddress, sal_Int32 nHorAlign ); - bool tryExpand( const ::com::sun::star::table::CellAddress& rAddress, sal_Int32 nHorAlign ); - }; - typedef ::std::list< MergedRange > MergedRangeList; - - CellBlockBuffer maCellBlocks; /// Manages all open cell blocks. - ArrayFormulaList maArrayFormulas; /// All array formulas in the sheet. - TableOperationList maTableOperations; /// All table operations in the sheet. - SharedFormulaMap maSharedFormulas; /// Maps shared formula base address to defined name token index. - ::com::sun::star::table::CellAddress - maSharedFmlaAddr; /// Address of a cell containing a pending shared formula. - BinAddress maSharedBaseAddr; /// Base address of the pending shared formula. - XfIdRowRange maXfIdRowRange; /// Cached XF identifier for a range of rows. - XfIdRangeListMap maXfIdRangeLists; /// Collected XF identifiers for cell rangelists. - MergedRangeList maMergedRanges; /// Merged cell ranges. - MergedRangeList maCenterFillRanges; /// Merged cell ranges from 'center across' or 'fill' alignment. - bool mbPendingSharedFmla; /// True = maSharedFmlaAddr and maSharedBaseAddr are valid. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx deleted file mode 100644 index 12f542f49273..000000000000 --- a/oox/inc/oox/xls/sheetdatacontext.hxx +++ /dev/null @@ -1,196 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_SHEETDATACONTEXT_HXX -#define OOX_XLS_SHEETDATACONTEXT_HXX - -#include "oox/xls/excelhandlers.hxx" -#include "oox/xls/richstring.hxx" -#include "oox/xls/sheetdatabuffer.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Used as base for sheet data context classes. Provides fast access to often - used converter objects and sheet index, to improve performance. - */ -struct SheetDataContextBase -{ - AddressConverter& mrAddressConv; /// The address converter. - FormulaParser& mrFormulaParser; /// The formula parser. - SheetDataBuffer& mrSheetData; /// The sheet data buffer for cell content and formatting. - CellModel maCellData; /// Position, contents, formatting of current imported cell. - CellFormulaModel maFmlaData; /// Settings for a cell formula. - sal_Int16 mnSheet; /// Index of the current sheet. - - explicit SheetDataContextBase( const WorksheetHelper& rHelper ); - virtual ~SheetDataContextBase(); -}; - -// ============================================================================ - -/** This class implements importing the sheetData element. - - The sheetData element contains all row settings and all cells in a single - sheet of a spreadsheet document. - */ -class SheetDataContext : public WorksheetContextBase, private SheetDataContextBase -{ -public: - explicit SheetDataContext( WorksheetFragmentBase& rFragment ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - virtual void onEndElement(); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - -private: - /** Different types of cell records. */ - enum CellType { CELLTYPE_VALUE, CELLTYPE_MULTI, CELLTYPE_FORMULA }; - - /** Imports row settings from a row element. */ - void importRow( const AttributeList& rAttribs ); - /** Imports cell settings from a c element. */ - bool importCell( const AttributeList& rAttribs ); - /** Imports cell settings from an f element. */ - void importFormula( const AttributeList& rAttribs ); - - /** Imports row settings from a ROW record. */ - void importRow( SequenceInputStream& rStrm ); - - /** Reads a cell address and the following XF identifier. */ - bool readCellHeader( SequenceInputStream& rStrm, CellType eCellType ); - /** Reads a cell formula for the current cell. */ - ApiTokenSequence readCellFormula( SequenceInputStream& rStrm ); - /** Reads the formula range used by shared formulas, arrays, and data tables. */ - bool readFormulaRef( SequenceInputStream& rStrm ); - - /** Imports an empty cell from a CELL_BLANK or MULTCELL_BLANK record. */ - void importCellBlank( SequenceInputStream& rStrm, CellType eCellType ); - /** Imports a boolean cell from a CELL_BOOL, MULTCELL_BOOL, or FORMULA_BOOL record. */ - void importCellBool( SequenceInputStream& rStrm, CellType eCellType ); - /** Imports a numeric cell from a CELL_DOUBLE, MULTCELL_DOUBLE, or FORMULA_DOUBLE record. */ - void importCellDouble( SequenceInputStream& rStrm, CellType eCellType ); - /** Imports an error code cell from a CELL_ERROR, MULTCELL_ERROR, or FORMULA_ERROR record. */ - void importCellError( SequenceInputStream& rStrm, CellType eCellType ); - /** Imports an encoded numeric cell from a CELL_RK or MULTCELL_RK record. */ - void importCellRk( SequenceInputStream& rStrm, CellType eCellType ); - /** Imports a rich-string cell from a CELL_RSTRING or MULTCELL_RSTRING record. */ - void importCellRString( SequenceInputStream& rStrm, CellType eCellType ); - /** Imports a string cell from a CELL_SI or MULTCELL_SI record. */ - void importCellSi( SequenceInputStream& rStrm, CellType eCellType ); - /** Imports a string cell from a CELL_STRING, MULTCELL_STRING, or FORMULA_STRING record. */ - void importCellString( SequenceInputStream& rStrm, CellType eCellType ); - - /** Imports an array formula from an ARRAY record. */ - void importArray( SequenceInputStream& rStrm ); - /** Imports table operation from a DATATABLE record. */ - void importDataTable( SequenceInputStream& rStrm ); - /** Imports a shared formula from a SHAREDFORMULA record. */ - void importSharedFmla( SequenceInputStream& rStrm ); - -private: - ::rtl::OUString maCellValue; /// Cell value string (OOXML only). - RichStringRef mxInlineStr; /// Inline rich string (OOXML only). - ApiTokenSequence maTokens; /// Formula token array (OOXML only). - DataTableModel maTableData; /// Settings for table operations. - BinAddress maCurrPos; /// Current cell position (BIFF12 only). - bool mbHasFormula; /// True = current cell has formula data (OOXML only). - bool mbValidRange; /// True = maFmlaData.maFormulaRef is valid (OOXML only). -}; - -// ============================================================================ - -/** This class implements importing row settings and all cells of a sheet. - */ -class BiffSheetDataContext : public BiffWorksheetContextBase, private SheetDataContextBase -{ -public: - explicit BiffSheetDataContext( const WorksheetHelper& rHelper ); - - /** Tries to import a sheet data record. */ - virtual void importRecord( BiffInputStream& rStrm ); - -private: - /** Imports row settings from a ROW record. */ - void importRow( BiffInputStream& rStrm ); - - /** Reads an XF identifier and initializes a new cell. */ - bool readCellXfId( BiffInputStream& rStrm, const BinAddress& rAddr, bool bBiff2 ); - /** Reads a BIFF cell address and the following XF identifier. */ - bool readCellHeader( BiffInputStream& rStrm, bool bBiff2 ); - /** Reads the formula range used by shared formulas, arrays, and data tables. */ - bool readFormulaRef( BiffInputStream& rStrm ); - - /** Imports a BLANK record describing a blank but formatted cell. */ - void importBlank( BiffInputStream& rStrm ); - /** Imports a BOOLERR record describing a boolean or error code cell. */ - void importBoolErr( BiffInputStream& rStrm ); - /** Imports a FORMULA record describing a formula cell. */ - void importFormula( BiffInputStream& rStrm ); - /** Imports an INTEGER record describing a BIFF2 integer cell. */ - void importInteger( BiffInputStream& rStrm ); - /** Imports a LABEL record describing an unformatted string cell. */ - void importLabel( BiffInputStream& rStrm ); - /** Imports a LABELSST record describing a string cell using the shared string list. */ - void importLabelSst( BiffInputStream& rStrm ); - /** Imports a MULTBLANK record describing a range of blank but formatted cells. */ - void importMultBlank( BiffInputStream& rStrm ); - /** Imports a MULTRK record describing a range of numeric cells. */ - void importMultRk( BiffInputStream& rStrm ); - /** Imports a NUMBER record describing a floating-point cell. */ - void importNumber( BiffInputStream& rStrm ); - /** Imports an RK record describing a numeric cell. */ - void importRk( BiffInputStream& rStrm ); - - /** Imports an ARRAY record describing an array formula of a cell range. */ - void importArray( BiffInputStream& rStrm ); - /** Imports table operation from a DATATABLE or DATATABLE2 record. */ - void importDataTable( BiffInputStream& rStrm ); - /** Imports a SHAREDFMLA record describing a shared formula in a cell range. */ - void importSharedFmla( BiffInputStream& rStrm ); - -private: - sal_uInt32 mnFormulaSkipSize; /// Number of bytes to be ignored in FORMULA record. - sal_uInt32 mnArraySkipSize; /// Number of bytes to be ignored in ARRAY record. - sal_uInt16 mnBiff2XfId; /// Current XF identifier from IXFE record. - OptValue< bool > mobBiff2HasXfs; /// Select XF formatting or direct formatting in BIFF2. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx deleted file mode 100644 index f2099743f60e..000000000000 --- a/oox/inc/oox/xls/stylesbuffer.hxx +++ /dev/null @@ -1,1099 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_STYLESBUFFER_HXX -#define OOX_XLS_STYLESBUFFER_HXX - -#include <com/sun/star/awt/FontDescriptor.hpp> -#include <com/sun/star/table/CellHoriJustify.hpp> -#include <com/sun/star/table/CellOrientation.hpp> -#include <com/sun/star/table/CellVertJustify2.hpp> -#include <com/sun/star/table/BorderLine2.hpp> -#include <com/sun/star/util/CellProtection.hpp> -#include "oox/drawingml/color.hxx" -#include "oox/helper/graphichelper.hxx" -#include "oox/helper/refmap.hxx" -#include "oox/helper/refvector.hxx" -#include "oox/xls/numberformatsbuffer.hxx" - -namespace com { namespace sun { namespace star { - namespace awt { struct FontDescrtiptor; } -} } } - -namespace oox { class PropertySet; } - -namespace oox { -namespace xls { - -// ============================================================================ - -const sal_Int32 OOX_COLOR_WINDOWTEXT3 = 24; /// System window text color (BIFF3-BIFF4). -const sal_Int32 OOX_COLOR_WINDOWBACK3 = 25; /// System window background color (BIFF3-BIFF4). -const sal_Int32 OOX_COLOR_WINDOWTEXT = 64; /// System window text color (BIFF5+). -const sal_Int32 OOX_COLOR_WINDOWBACK = 65; /// System window background color (BIFF5+). -const sal_Int32 OOX_COLOR_BUTTONBACK = 67; /// System button background color (face color). -const sal_Int32 OOX_COLOR_CHWINDOWTEXT = 77; /// System window text color (BIFF8 charts). -const sal_Int32 OOX_COLOR_CHWINDOWBACK = 78; /// System window background color (BIFF8 charts). -const sal_Int32 OOX_COLOR_CHBORDERAUTO = 79; /// Automatic frame border (BIFF8 charts). -const sal_Int32 OOX_COLOR_NOTEBACK = 80; /// Note background color. -const sal_Int32 OOX_COLOR_NOTETEXT = 81; /// Note text color. -const sal_Int32 OOX_COLOR_FONTAUTO = 0x7FFF; /// Font auto color (system window text color). - -// ---------------------------------------------------------------------------- - -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. - -// ============================================================================ - -/** Special implementation of the GraphicHelper for Excel palette and scheme - colors. - */ -class ExcelGraphicHelper : public GraphicHelper, public WorkbookHelper -{ -public: - explicit ExcelGraphicHelper( const WorkbookHelper& rHelper ); - - /** 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; -}; - -// ============================================================================ - -class Color : public ::oox::drawingml::Color -{ -public: - /** Sets the color to automatic. */ - void setAuto(); - /** Sets the color to the passed RGB value. */ - void setRgb( sal_Int32 nRgbValue, double fTint = 0.0 ); - /** Sets the color to the passed theme index. */ - void setTheme( sal_Int32 nThemeIdx, double fTint = 0.0 ); - /** Sets the color to the passed palette index. */ - void setIndexed( sal_Int32 nPaletteIdx, double fTint = 0.0 ); - - /** Imports the color from the passed attribute list. */ - void importColor( const AttributeList& rAttribs ); - - /** Imports a 64-bit color from the passed binary stream. */ - void importColor( SequenceInputStream& rStrm ); - /** Imports a 32-bit palette color identifier from the passed BIFF12 stream. */ - void importColorId( SequenceInputStream& rStrm ); - - /** Imports an 8-bit or 16-bit palette color identifier from the passed BIFF stream. */ - void importColorId( BiffInputStream& rStrm, bool b16Bit = true ); - /** Imports a 32-bit RGBA color value from the passed BIFF stream. */ - void importColorRgb( BiffInputStream& rStrm ); - - /** Returns true, if the color is set to automatic. */ - inline bool isAuto() const { return isPlaceHolder(); } -}; - -// ---------------------------------------------------------------------------- - -SequenceInputStream& operator>>( SequenceInputStream& rStrm, Color& orColor ); - -// ============================================================================ - -/** Stores all colors of the color palette. */ -class ColorPalette : public WorkbookHelper -{ -public: - /** Constructs the color palette with predefined color values. */ - explicit ColorPalette( const WorkbookHelper& rHelper ); - - /** Appends a new color from the passed attributes. */ - void importPaletteColor( const AttributeList& rAttribs ); - /** Appends a new color from the passed RGBCOLOR record. */ - void importPaletteColor( SequenceInputStream& rStrm ); - /** Imports the PALETTE record from the passed stream. */ - void importPalette( BiffInputStream& rStrm ); - /** Imports a color palette from a UNO sequence in the passed any. */ - void importPalette( const ::com::sun::star::uno::Any& rPalette ); - - /** Rturns the RGB value of the color with the passed index. */ - sal_Int32 getColor( sal_Int32 nPaletteIdx ) const; - -private: - /** Appends the passed color. */ - void appendColor( sal_Int32 nRGBValue ); - -private: - ::std::vector< sal_Int32 > maColors; /// List of RGB values. - size_t mnAppendIndex; /// Index to append a new color. -}; - -// ============================================================================ - -/** Contains all XML font attributes, e.g. from a font or rPr element. */ -struct FontModel -{ - ::rtl::OUString maName; /// Font name. - Color maColor; /// Font color. - sal_Int32 mnScheme; /// Major/minor scheme font. - sal_Int32 mnFamily; /// Font family. - sal_Int32 mnCharSet; /// Windows font character set. - double mfHeight; /// Font height in points. - sal_Int32 mnUnderline; /// Underline style. - sal_Int32 mnEscapement; /// Escapement style. - bool mbBold; /// True = bold characters. - bool mbItalic; /// True = italic characters. - bool mbStrikeout; /// True = Strike out characters. - bool mbOutline; /// True = outlined characters. - bool mbShadow; /// True = shadowed chgaracters. - - explicit FontModel(); - - void setBiff12Scheme( sal_uInt8 nScheme ); - void setBiffHeight( sal_uInt16 nHeight ); - void setBiffWeight( sal_uInt16 nWeight ); - void setBiffUnderline( sal_uInt16 nUnderline ); - void setBiffEscapement( sal_uInt16 nEscapement ); -}; - -// ---------------------------------------------------------------------------- - -/** Enumerates different types of API font property sets. */ -enum FontPropertyType -{ - FONT_PROPTYPE_CELL, /// Font properties in a spreadsheet cell (table::Cell service). - FONT_PROPTYPE_TEXT /// Font properties in a text object (text::Text service). -}; - -// ---------------------------------------------------------------------------- - -/** Contains used flags for all API font attributes. */ -struct ApiFontUsedFlags -{ - bool mbNameUsed; /// True = font name/family/char set are used. - bool mbColorUsed; /// True = font color is used. - bool mbSchemeUsed; /// True = font scheme is used. - bool mbHeightUsed; /// True = font height is used. - bool mbUnderlineUsed; /// True = underline style is used. - bool mbEscapementUsed; /// True = escapement style is used. - bool mbWeightUsed; /// True = font weight (boldness) is used. - bool mbPostureUsed; /// True = font posture (italic) is used. - bool mbStrikeoutUsed; /// True = strike out style is used. - bool mbOutlineUsed; /// True = outline style is used. - bool mbShadowUsed; /// True = shadow style is used. - - explicit ApiFontUsedFlags( bool bAllUsed ); -}; - -// ---------------------------------------------------------------------------- - -/** Contains API font name, family, and charset for a script type. */ -struct ApiScriptFontName -{ - ::rtl::OUString maName; /// Font name. - sal_Int16 mnFamily; /// Font family. - sal_Int16 mnTextEnc; /// Font text encoding. - - explicit ApiScriptFontName(); -}; - -// ---------------------------------------------------------------------------- - -/** Contains all API font attributes. */ -struct ApiFontData -{ - typedef ::com::sun::star::awt::FontDescriptor ApiFontDescriptor; - - ApiScriptFontName maLatinFont; /// Font name for latin scripts. - ApiScriptFontName maAsianFont; /// Font name for east-asian scripts. - ApiScriptFontName maCmplxFont; /// Font name for complex scripts. - ApiFontDescriptor maDesc; /// Font descriptor (height in twips, weight in %). - sal_Int32 mnColor; /// Font color. - sal_Int16 mnEscapement; /// Escapement style. - sal_Int8 mnEscapeHeight; /// Escapement font height. - bool mbOutline; /// True = outlined characters. - bool mbShadow; /// True = shadowed chgaracters. - - explicit ApiFontData(); -}; - -// ============================================================================ - -class Font : public WorkbookHelper -{ -public: - explicit Font( const WorkbookHelper& rHelper, bool bDxf ); - explicit Font( const WorkbookHelper& rHelper, const FontModel& rModel ); - - /** Sets font formatting attributes for the passed element. */ - void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs ); - - /** Imports the FONT record from the passed stream. */ - void importFont( SequenceInputStream& rStrm ); - /** Imports the font name from a DXF record. */ - void importDxfName( SequenceInputStream& rStrm ); - /** Imports the font color from a DXF record. */ - void importDxfColor( SequenceInputStream& rStrm ); - /** Imports the font scheme from a DXF record. */ - void importDxfScheme( SequenceInputStream& rStrm ); - /** Imports the font height from a DXF record. */ - void importDxfHeight( SequenceInputStream& rStrm ); - /** Imports the font weight from a DXF record. */ - void importDxfWeight( SequenceInputStream& rStrm ); - /** Imports the font underline style from a DXF record. */ - void importDxfUnderline( SequenceInputStream& rStrm ); - /** Imports the font escapement style from a DXF record. */ - void importDxfEscapement( SequenceInputStream& rStrm ); - /** Imports a font style flag from a DXF record. */ - void importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm ); - - /** Imports the FONT record from the passed stream. */ - void importFont( BiffInputStream& rStrm ); - /** Imports the FONTCOLOR record from the passed stream. */ - void importFontColor( BiffInputStream& rStrm ); - /** Sets the font attributes from the font block of a CFRULE record. */ - void importCfRule( BiffInputStream& rStrm ); - - /** Returns the font model structure. This function can be called before - finalizeImport() has been called. */ - inline const FontModel& getModel() const { return maModel; } - /** Returns the text encoding for strings used with this font. This - function can be called before finalizeImport() has been called. */ - rtl_TextEncoding getFontEncoding() const; - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Returns an API font descriptor with own font information. */ - const ::com::sun::star::awt::FontDescriptor& getFontDescriptor() const; - /** Returns true, if the font requires rich text formatting in Calc. - @descr Example: Font escapement is a cell attribute in Excel, but Calc - needs an rich text cell for this attribute. */ - bool needsRichTextFormat() const; - - /** Writes all font attributes to the passed property map. */ - void writeToPropertyMap( - PropertyMap& rPropMap, - FontPropertyType ePropType ) const; - /** Writes all font attributes to the passed property set. */ - void writeToPropertySet( - PropertySet& rPropSet, - FontPropertyType ePropType ) const; - -private: - /** Reads and sets height and flags. */ - void importFontData2( BiffInputStream& rStrm ); - /** Reads and sets weight, escapement, underline, family, charset (BIFF5+). */ - void importFontData5( BiffInputStream& rStrm ); - - /** Reads and sets a byte string as font name. */ - void importFontName2( BiffInputStream& rStrm ); - /** Reads and sets a Unicode string as font name. */ - void importFontName8( BiffInputStream& rStrm ); - -private: - FontModel maModel; - ApiFontData maApiData; - ApiFontUsedFlags maUsedFlags; - bool mbDxf; -}; - -typedef ::boost::shared_ptr< Font > FontRef; - -// ============================================================================ - -/** Contains all XML cell alignment attributes, e.g. from an alignment element. */ -struct AlignmentModel -{ - sal_Int32 mnHorAlign; /// Horizontal alignment. - sal_Int32 mnVerAlign; /// Vertical alignment. - sal_Int32 mnTextDir; /// CTL text direction. - sal_Int32 mnRotation; /// Text rotation angle. - sal_Int32 mnIndent; /// Indentation. - bool mbWrapText; /// True = multi-line text. - bool mbShrink; /// True = shrink to fit cell size. - bool mbJustLastLine; /// True = justify last line in block text. - - explicit AlignmentModel(); - - /** Sets horizontal alignment from the passed BIFF data. */ - void setBiffHorAlign( sal_uInt8 nHorAlign ); - /** Sets vertical alignment from the passed BIFF data. */ - void setBiffVerAlign( sal_uInt8 nVerAlign ); - /** Sets rotation from the passed BIFF text orientation. */ - void setBiffTextOrient( sal_uInt8 nTextOrient ); -}; - -// ---------------------------------------------------------------------------- - -/** Contains all API cell alignment attributes. */ -struct ApiAlignmentData -{ - typedef ::com::sun::star::table::CellHoriJustify ApiCellHoriJustify; - typedef ::com::sun::star::table::CellOrientation ApiCellOrientation; - - ApiCellHoriJustify meHorJustify; /// Horizontal alignment. - sal_Int32 mnHorJustifyMethod; - sal_Int32 mnVerJustify; /// Vertical alignment. - sal_Int32 mnVerJustifyMethod; - ApiCellOrientation meOrientation; /// Normal or stacked text. - sal_Int32 mnRotation; /// Text rotation angle. - sal_Int16 mnWritingMode; /// CTL text direction. - sal_Int16 mnIndent; /// Indentation. - bool mbWrapText; /// True = multi-line text. - bool mbShrink; /// True = shrink to fit cell size. - - explicit ApiAlignmentData(); -}; - -bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight ); - -// ============================================================================ - -class Alignment : public WorkbookHelper -{ -public: - explicit Alignment( const WorkbookHelper& rHelper ); - - /** Sets all attributes from the alignment element. */ - void importAlignment( const AttributeList& rAttribs ); - - /** Sets the alignment attributes from the passed BIFF12 XF record data. */ - void setBiff12Data( sal_uInt32 nFlags ); - /** Sets the alignment attributes from the passed BIFF2 XF record data. */ - void setBiff2Data( sal_uInt8 nFlags ); - /** Sets the alignment attributes from the passed BIFF3 XF record data. */ - void setBiff3Data( sal_uInt16 nAlign ); - /** Sets the alignment attributes from the passed BIFF4 XF record data. */ - void setBiff4Data( sal_uInt16 nAlign ); - /** Sets the alignment attributes from the passed BIFF5 XF record data. */ - void setBiff5Data( sal_uInt16 nAlign ); - /** Sets the alignment attributes from the passed BIFF8 XF record data. */ - void setBiff8Data( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Returns the alignment model structure. */ - inline const AlignmentModel& getModel() const { return maModel; } - /** Returns the converted API alignment data struct. */ - inline const ApiAlignmentData& getApiData() const { return maApiData; } - - /** Writes all alignment attributes to the passed property map. */ - void writeToPropertyMap( PropertyMap& rPropMap ) const; - -private: - AlignmentModel maModel; /// Alignment model data. - ApiAlignmentData maApiData; /// Alignment data converted to API constants. -}; - -typedef ::boost::shared_ptr< Alignment > AlignmentRef; - -// ============================================================================ - -/** Contains all XML cell protection attributes, e.g. from a protection element. */ -struct ProtectionModel -{ - bool mbLocked; /// True = locked against editing. - bool mbHidden; /// True = formula is hidden. - - explicit ProtectionModel(); -}; - -// ---------------------------------------------------------------------------- - -/** Contains all API cell protection attributes. */ -struct ApiProtectionData -{ - typedef ::com::sun::star::util::CellProtection ApiCellProtection; - - ApiCellProtection maCellProt; - - explicit ApiProtectionData(); -}; - -bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight ); - -// ============================================================================ - -class Protection : public WorkbookHelper -{ -public: - explicit Protection( const WorkbookHelper& rHelper ); - - /** Sets all attributes from the protection element. */ - void importProtection( const AttributeList& rAttribs ); - - /** Sets the protection attributes from the passed BIFF12 XF record data. */ - void setBiff12Data( sal_uInt32 nFlags ); - /** Sets the protection attributes from the passed BIFF2 XF record data. */ - void setBiff2Data( sal_uInt8 nNumFmt ); - /** Sets the protection attributes from the passed BIFF3-BIFF8 XF record data. */ - void setBiff3Data( sal_uInt16 nProt ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Returns the protection model structure. */ - inline const ProtectionModel& getModel() const { return maModel; } - /** Returns the converted API protection data struct. */ - inline const ApiProtectionData& getApiData() const { return maApiData; } - - /** Writes all protection attributes to the passed property map. */ - void writeToPropertyMap( PropertyMap& rPropMap ) const; - -private: - ProtectionModel maModel; /// Protection model data. - ApiProtectionData maApiData; /// Protection data converted to API constants. -}; - -typedef ::boost::shared_ptr< Protection > ProtectionRef; - -// ============================================================================ - -/** Contains XML attributes of a single border line. */ -struct BorderLineModel -{ - Color maColor; /// Borderline color. - sal_Int32 mnStyle; /// Border line style. - bool mbUsed; /// True = line format used. - - explicit BorderLineModel( bool bDxf ); - - /** Sets the passed BIFF line style. */ - void setBiffStyle( sal_Int32 nLineStyle ); - /** Sets line style and line color from the passed BIFF data. */ - void setBiffData( sal_uInt8 nLineStyle, sal_uInt16 nLineColor ); -}; - -// ---------------------------------------------------------------------------- - -/** Contains XML attributes of a complete cell border. */ -struct BorderModel -{ - BorderLineModel maLeft; /// Left line format. - BorderLineModel maRight; /// Right line format. - BorderLineModel maTop; /// Top line format. - BorderLineModel maBottom; /// Bottom line format. - BorderLineModel maDiagonal; /// Diagonal line format. - bool mbDiagTLtoBR; /// True = top-left to bottom-right on. - bool mbDiagBLtoTR; /// True = bottom-left to top-right on. - - explicit BorderModel( bool bDxf ); -}; - -// ---------------------------------------------------------------------------- - -/** Contains API attributes of a complete cell border. */ -struct ApiBorderData -{ - typedef ::com::sun::star::table::BorderLine2 ApiBorderLine; - - ApiBorderLine maLeft; /// Left line format - ApiBorderLine maRight; /// Right line format - ApiBorderLine maTop; /// Top line format - ApiBorderLine maBottom; /// Bottom line format - ApiBorderLine maTLtoBR; /// Diagonal top-left to bottom-right line format. - ApiBorderLine maBLtoTR; /// Diagonal bottom-left to top-right line format. - bool mbBorderUsed; /// True = left/right/top/bottom line format used. - bool mbDiagUsed; /// True = diagonal line format used. - - explicit ApiBorderData(); - - /** Returns true, if any of the outer border lines is visible. */ - bool hasAnyOuterBorder() const; -}; - -bool operator==( const ApiBorderData& rLeft, const ApiBorderData& rRight ); - -// ============================================================================ - -class Border : public WorkbookHelper -{ -public: - explicit Border( const WorkbookHelper& rHelper, bool bDxf ); - - /** Sets global border attributes from the border element. */ - void importBorder( const AttributeList& rAttribs ); - /** Sets border attributes for the border line with the passed element identifier. */ - void importStyle( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Sets color attributes for the border line with the passed element identifier. */ - void importColor( sal_Int32 nElement, const AttributeList& rAttribs ); - - /** Imports the BORDER record from the passed stream. */ - void importBorder( SequenceInputStream& rStrm ); - /** Imports a border from a DXF record from the passed stream. */ - void importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm ); - - /** Sets the border attributes from the passed BIFF2 XF record data. */ - void setBiff2Data( sal_uInt8 nFlags ); - /** Sets the border attributes from the passed BIFF3/BIFF4 XF record data. */ - void setBiff3Data( sal_uInt32 nBorder ); - /** Sets the border attributes from the passed BIFF5 XF record data. */ - void setBiff5Data( sal_uInt32 nBorder, sal_uInt32 nArea ); - /** Sets the border attributes from the passed BIFF8 XF record data. */ - void setBiff8Data( sal_uInt32 nBorder1, sal_uInt32 nBorder2 ); - /** Sets the border attributes from the border block of a CFRULE record. */ - void importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Returns the border model structure. */ - inline const BorderModel& getModel() const { return maModel; } - /** Returns the converted API border data struct. */ - inline const ApiBorderData& getApiData() const { return maApiData; } - - /** Writes all border attributes to the passed property map. */ - void writeToPropertyMap( PropertyMap& rPropMap ) const; - - bool hasBorder() const; - -private: - /** Returns the border line struct specified by the passed XML token identifier. */ - BorderLineModel* getBorderLine( sal_Int32 nElement ); - - /** Converts border line data to an API struct, returns true, if the line is marked as used. */ - bool convertBorderLine( - ::com::sun::star::table::BorderLine2& rBorderLine, - const BorderLineModel& rModel ); - -private: - BorderModel maModel; - ApiBorderData maApiData; - bool mbDxf; -}; - -typedef ::boost::shared_ptr< Border > BorderRef; - -// ============================================================================ - -/** Contains XML pattern fill attributes from the patternFill element. */ -struct PatternFillModel -{ - Color maPatternColor; /// Pattern foreground color. - Color maFillColor; /// Background fill color. - sal_Int32 mnPattern; /// Pattern identifier (e.g. solid). - bool mbPattColorUsed; /// True = pattern foreground color used. - bool mbFillColorUsed; /// True = background fill color used. - bool mbPatternUsed; /// True = pattern used. - - explicit PatternFillModel( bool bDxf ); - - /** Sets the passed BIFF pattern identifier. */ - void setBiffPattern( sal_Int32 nPattern ); - /** Sets the pattern and pattern colors from the passed BIFF data. */ - void setBiffData( sal_uInt16 nPatternColor, sal_uInt16 nFillColor, sal_uInt8 nPattern ); -}; - -// ---------------------------------------------------------------------------- - -/** Contains XML gradient fill attributes from the gradientFill element. */ -struct GradientFillModel -{ - typedef ::std::map< double, Color > ColorMap; - - sal_Int32 mnType; /// Gradient type, linear or path. - double mfAngle; /// Rotation angle for type linear. - double mfLeft; /// Left convergence for type path. - double mfRight; /// Right convergence for type path. - double mfTop; /// Top convergence for type path. - double mfBottom; /// Bottom convergence for type path. - ColorMap maColors; /// Gradient colors. - - explicit GradientFillModel(); - - /** Reads BIFF12 gradient settings from a FILL or DXF record. */ - void readGradient( SequenceInputStream& rStrm ); - /** Reads BIFF12 gradient stop settings from a FILL or DXF record. */ - void readGradientStop( SequenceInputStream& rStrm, bool bDxf ); -}; - -// ---------------------------------------------------------------------------- - -/** Contains API fill attributes. */ -struct ApiSolidFillData -{ - sal_Int32 mnColor; /// Fill color. - bool mbTransparent; /// True = transparent area. - bool mbUsed; /// True = fill data is valid. - - explicit ApiSolidFillData(); -}; - -bool operator==( const ApiSolidFillData& rLeft, const ApiSolidFillData& rRight ); - -// ============================================================================ - -/** Contains cell fill attributes, either a pattern fill or a gradient fill. */ -class Fill : public WorkbookHelper -{ -public: - explicit Fill( const WorkbookHelper& rHelper, bool bDxf ); - - /** Sets attributes of a patternFill element. */ - void importPatternFill( const AttributeList& rAttribs ); - /** Sets the pattern color from the fgColor element. */ - void importFgColor( const AttributeList& rAttribs ); - /** Sets the background color from the bgColor element. */ - void importBgColor( const AttributeList& rAttribs ); - /** Sets attributes of a gradientFill element. */ - void importGradientFill( const AttributeList& rAttribs ); - /** Sets a color from the color element in a gradient fill. */ - void importColor( const AttributeList& rAttribs, double fPosition ); - - /** Imports the FILL record from the passed stream. */ - void importFill( SequenceInputStream& rStrm ); - /** Imports the fill pattern from a DXF record. */ - void importDxfPattern( SequenceInputStream& rStrm ); - /** Imports the pattern color from a DXF record. */ - void importDxfFgColor( SequenceInputStream& rStrm ); - /** Imports the background color from a DXF record. */ - void importDxfBgColor( SequenceInputStream& rStrm ); - /** Imports gradient settings from a DXF record. */ - void importDxfGradient( SequenceInputStream& rStrm ); - /** Imports gradient stop settings from a DXF record. */ - void importDxfStop( SequenceInputStream& rStrm ); - - /** Sets the fill attributes from the passed BIFF2 XF record data. */ - void setBiff2Data( sal_uInt8 nFlags ); - /** Sets the fill attributes from the passed BIFF3/BIFF4 XF record data. */ - void setBiff3Data( sal_uInt16 nArea ); - /** Sets the fill attributes from the passed BIFF5 XF record data. */ - void setBiff5Data( sal_uInt32 nArea ); - /** Sets the fill attributes from the passed BIFF8 XF record data. */ - void setBiff8Data( sal_uInt32 nBorder2, sal_uInt16 nArea ); - /** Sets the fill attributes from the fill block of a CFRULE record. */ - void importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Returns the fill pattern model structure, if extant. */ - inline const PatternFillModel* getPatternModel() const { return mxPatternModel.get(); } - /** Returns the fill gradient model structure, if extant. */ - inline const GradientFillModel* getGradientModel() const { return mxGradientModel.get(); } - /** Returns the converted API fill data struct. */ - inline const ApiSolidFillData& getApiData() const { return maApiData; } - - /** Writes all fill attributes to the passed property map. */ - void writeToPropertyMap( PropertyMap& rPropMap ) const; - -private: - typedef ::boost::shared_ptr< PatternFillModel > PatternModelRef; - typedef ::boost::shared_ptr< GradientFillModel > GradientModelRef; - - PatternModelRef mxPatternModel; - GradientModelRef mxGradientModel; - ApiSolidFillData maApiData; - bool mbDxf; -}; - -typedef ::boost::shared_ptr< Fill > FillRef; - -// ============================================================================ - -/** Contains all data for a cell format or cell style. */ -struct XfModel -{ - sal_Int32 mnStyleXfId; /// Index to parent style XF. - sal_Int32 mnFontId; /// Index to font data list. - sal_Int32 mnNumFmtId; /// Index to number format list. - sal_Int32 mnBorderId; /// Index to list of cell borders. - sal_Int32 mnFillId; /// Index to list of cell areas. - bool mbCellXf; /// True = cell XF, false = style XF. - bool mbFontUsed; /// True = font index used. - bool mbNumFmtUsed; /// True = number format used. - bool mbAlignUsed; /// True = alignment used. - bool mbProtUsed; /// True = cell protection used. - bool mbBorderUsed; /// True = border data used. - bool mbAreaUsed; /// True = area data used. - - explicit XfModel(); -}; - -// ============================================================================ - -/** Represents a cell format or a cell style (called XF, extended format). - - This class stores the type (cell/style), the index to the parent style (if - it is a cell format) and all "attribute used" flags, which reflect the - state of specific attribute groups (true = user has changed the attributes) - and all formatting data. - */ -class Xf : public WorkbookHelper -{ -public: - explicit Xf( const WorkbookHelper& rHelper ); - - /** Sets all "attribute used" flags to the passed state. */ - void setAllUsedFlags( bool bUsed ); - - /** Sets all attributes from the xf element. */ - void importXf( const AttributeList& rAttribs, bool bCellXf ); - /** Sets all attributes from the alignment element. */ - void importAlignment( const AttributeList& rAttribs ); - /** Sets all attributes from the protection element. */ - void importProtection( const AttributeList& rAttribs ); - - /** Imports the XF record from the passed stream. */ - void importXf( SequenceInputStream& rStrm, bool bCellXf ); - - /** Imports the XF record from the passed stream. */ - void importXf( BiffInputStream& rStrm ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Returns true, if the XF is a cell XF, and false, if it is a style XF. */ - inline bool isCellXf() const { return maModel.mbCellXf; } - - /** Returns the referred font object. */ - FontRef getFont() const; - /** Returns the alignment data of this style. */ - inline const Alignment& getAlignment() const { return maAlignment; } - /** Returns the cell protection data of this style. */ - inline const Protection& getProtection() const { return maProtection; } - - /** Writes all formatting attributes to the passed property map. */ - void writeToPropertyMap( PropertyMap& rPropMap ) const; - /** Writes all formatting attributes to the passed property set. */ - void writeToPropertySet( PropertySet& rPropSet ) const; - - /** Converts formatting information from BIFF2 cell record data directly. */ - static void writeBiff2CellFormatToPropertySet( - const WorkbookHelper& rHelper, PropertySet& rPropSet, - sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 ); - -private: - /** Sets 'attribute used' flags from the passed BIFF bit field. */ - void setBiffUsedFlags( sal_uInt8 nUsedFlags ); - -private: - XfModel maModel; /// Cell XF or style XF model data. - Alignment maAlignment; /// Cell alignment data. - Protection maProtection; /// Cell protection data. - sal_Int32 meRotationRef; /// Rotation reference dependent on border. -}; - -typedef ::boost::shared_ptr< Xf > XfRef; - -// ============================================================================ - -class Dxf : public WorkbookHelper -{ -public: - explicit Dxf( const WorkbookHelper& rHelper ); - - /** Creates a new empty font object. */ - FontRef createFont( bool bAlwaysNew = true ); - /** Creates a new empty border object. */ - BorderRef createBorder( bool bAlwaysNew = true ); - /** Creates a new empty fill object. */ - FillRef createFill( bool bAlwaysNew = true ); - - /** Inserts a new number format code. */ - void importNumFmt( const AttributeList& rAttribs ); - - /** Imports the DXF record from the passed stream. */ - void importDxf( SequenceInputStream& rStrm ); - - /** Imports font, border, and fill settings from the CFRULE record. */ - void importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Writes all formatting attributes to the passed property map. */ - void writeToPropertyMap( PropertyMap& rPropMap ) const; - /** Writes all formatting attributes to the passed property set. */ - void writeToPropertySet( PropertySet& rPropSet ) const; - -private: - FontRef mxFont; /// Font data. - NumberFormatRef mxNumFmt; /// Number format data. - AlignmentRef mxAlignment; /// Alignment data. - ProtectionRef mxProtection; /// Protection data. - BorderRef mxBorder; /// Border data. - FillRef mxFill; /// Fill data. -}; - -typedef ::boost::shared_ptr< Dxf > DxfRef; - -// ============================================================================ - -/** Contains attributes of a cell style, e.g. from the cellStyle element. */ -struct CellStyleModel -{ - ::rtl::OUString maName; /// Cell style name. - sal_Int32 mnXfId; /// Formatting for this cell style. - sal_Int32 mnBuiltinId; /// Identifier for builtin styles. - sal_Int32 mnLevel; /// Level for builtin column/row styles. - bool mbBuiltin; /// True = builtin style. - bool mbCustom; /// True = customized builtin style. - bool mbHidden; /// True = style not visible in GUI. - - explicit CellStyleModel(); - - /** Returns true, if this style is a builtin style. */ - bool isBuiltin() const; - /** Returns true, if this style represents the default document cell style. */ - bool isDefaultStyle() const; -}; - -// ============================================================================ - -class CellStyle : public WorkbookHelper -{ -public: - explicit CellStyle( const WorkbookHelper& rHelper ); - - /** Imports passed attributes from the cellStyle element. */ - void importCellStyle( const AttributeList& rAttribs ); - /** Imports style settings from a CELLSTYLE record. */ - void importCellStyle( SequenceInputStream& rStrm ); - /** Imports style settings from a STYLE record. */ - void importStyle( BiffInputStream& rStrm ); - - /** Creates the style sheet in the document described by this cell style object. */ - void createCellStyle(); - /** Stores tha passed final style name and creates the cell style, if it is - user-defined or modified built-in. */ - void finalizeImport( const ::rtl::OUString& rFinalName ); - - /** Returns the cell style model structure. */ - inline const CellStyleModel& getModel() const { return maModel; } - /** Returns the final style name used in the document. */ - inline const ::rtl::OUString& getFinalStyleName() const { return maFinalName; } - -private: - CellStyleModel maModel; - ::rtl::OUString maFinalName; /// Final style name used in API. - bool mbCreated; /// True = style sheet created. -}; - -typedef ::boost::shared_ptr< CellStyle > CellStyleRef; - -// ============================================================================ - -class CellStyleBuffer : public WorkbookHelper -{ -public: - explicit CellStyleBuffer( const WorkbookHelper& rHelper ); - - /** Appends and returns a new named cell style object. */ - CellStyleRef importCellStyle( const AttributeList& rAttribs ); - /** Imports the CELLSTYLE record from the passed stream. */ - CellStyleRef importCellStyle( SequenceInputStream& rStrm ); - /** Imports the STYLE record from the passed stream. */ - CellStyleRef importStyle( BiffInputStream& rStrm ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Returns the XF identifier associated to the default cell style. */ - sal_Int32 getDefaultXfId() const; - /** Returns the default style sheet for unused cells. */ - ::rtl::OUString getDefaultStyleName() const; - /** Creates the style sheet described by the style XF with the passed identifier. */ - ::rtl::OUString createCellStyle( sal_Int32 nXfId ) const; - -private: - /** Inserts the passed cell style object into the internal maps. */ - void insertCellStyle( CellStyleRef xCellStyle ); - /** Creates the style sheet described by the passed cell style object. */ - ::rtl::OUString createCellStyle( const CellStyleRef& rxCellStyle ) const; - -private: - typedef RefVector< CellStyle > CellStyleVector; - typedef RefMap< sal_Int32, CellStyle > CellStyleXfIdMap; - - CellStyleVector maBuiltinStyles; /// All built-in cell styles. - CellStyleVector maUserStyles; /// All user defined cell styles. - CellStyleXfIdMap maStylesByXf; /// All cell styles, mapped by XF identifier. - CellStyleRef mxDefStyle; /// Default cell style. -}; - -// ============================================================================ - -struct AutoFormatModel -{ - sal_Int32 mnAutoFormatId; /// Index of predefined autoformatting. - bool mbApplyNumFmt; /// True = apply number format from autoformatting. - bool mbApplyFont; /// True = apply font from autoformatting. - bool mbApplyAlignment; /// True = apply alignment from autoformatting. - bool mbApplyBorder; /// True = apply border from autoformatting. - bool mbApplyFill; /// True = apply fill from autoformatting. - bool mbApplyProtection; /// True = apply protection from autoformatting. - - explicit AutoFormatModel(); -}; - -// ============================================================================ - -class StylesBuffer : public WorkbookHelper -{ -public: - explicit StylesBuffer( const WorkbookHelper& rHelper ); - - /** Creates a new empty font object. - @param opnFontId (out-param) The identifier of the new font object. */ - FontRef createFont( sal_Int32* opnFontId = 0 ); - /** Creates a number format. */ - NumberFormatRef createNumFmt( sal_Int32 nNumFmtId, const ::rtl::OUString& rFmtCode ); - /** Creates a new empty border object. - @param opnBorderId (out-param) The identifier of the new border object. */ - BorderRef createBorder( sal_Int32* opnBorderId = 0 ); - /** Creates a new empty fill object. - @param opnFillId (out-param) The identifier of the new fill object. */ - FillRef createFill( sal_Int32* opnFillId = 0 ); - /** Creates a new empty cell formatting object. - @param opnXfId (out-param) The identifier of the new XF object. */ - XfRef createCellXf( sal_Int32* opnXfId = 0 ); - /** Creates a new empty style formatting object. - @param opnXfId (out-param) The identifier of the new XF object. */ - XfRef createStyleXf( sal_Int32* opnXfId = 0 ); - /** Creates a new empty differential formatting object. - @param opnDxfId (out-param) The identifier of the new DXF object. */ - DxfRef createDxf( sal_Int32* opnDxfId = 0 ); - - /** Appends a new color to the color palette. */ - void importPaletteColor( const AttributeList& rAttribs ); - /** Inserts a new number format code. */ - NumberFormatRef importNumFmt( const AttributeList& rAttribs ); - /** Appends and returns a new named cell style object. */ - CellStyleRef importCellStyle( const AttributeList& rAttribs ); - - /** Appends a new color to the color palette. */ - void importPaletteColor( SequenceInputStream& rStrm ); - /** Imports the NUMFMT record from the passed stream. */ - void importNumFmt( SequenceInputStream& rStrm ); - /** Imports the CELLSTYLE record from the passed stream. */ - void importCellStyle( SequenceInputStream& rStrm ); - - /** Imports the PALETTE record from the passed stream. */ - void importPalette( BiffInputStream& rStrm ); - /** Imports the FONT record from the passed stream. */ - void importFont( BiffInputStream& rStrm ); - /** Imports the FONTCOLOR record from the passed stream. */ - void importFontColor( BiffInputStream& rStrm ); - /** Imports the FORMAT record from the passed stream. */ - void importFormat( BiffInputStream& rStrm ); - /** Imports the XF record from the passed stream. */ - void importXf( BiffInputStream& rStrm ); - /** Imports the STYLE record from the passed stream. */ - void importStyle( BiffInputStream& rStrm ); - - /** Imports a color palette from a UNO sequence in the passed any. */ - void importPalette( const ::com::sun::star::uno::Any& rPalette ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - - /** Returns the palette color with the specified index. */ - sal_Int32 getPaletteColor( sal_Int32 nIndex ) const; - /** Returns the specified font object. */ - FontRef getFont( sal_Int32 nFontId ) const; - /** Returns the specified border object. */ - BorderRef getBorder( sal_Int32 nBorderId ) const; - /** Returns the specified cell format object. */ - XfRef getCellXf( sal_Int32 nXfId ) const; - /** Returns the specified style format object. */ - XfRef getStyleXf( sal_Int32 nXfId ) const; - - /** Returns the font object of the specified cell XF. */ - FontRef getFontFromCellXf( sal_Int32 nXfId ) const; - /** Returns the default application font (used in the "Normal" cell style). */ - FontRef getDefaultFont() const; - /** Returns the model of the default application font (used in the "Normal" cell style). */ - const FontModel& getDefaultFontModel() const; - - /** Returns true, if the specified borders are equal. */ - bool equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) const; - /** Returns true, if the specified fills are equal. */ - bool equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 ) const; - - /** Returns the default style sheet for unused cells. */ - ::rtl::OUString getDefaultStyleName() const; - /** Creates the style sheet described by the style XF with the passed identifier. */ - ::rtl::OUString createCellStyle( sal_Int32 nXfId ) const; - /** Creates the style sheet described by the DXF with the passed identifier. */ - ::rtl::OUString createDxfStyle( sal_Int32 nDxfId ) const; - - /** Writes the font attributes of the specified font data to the passed property map. */ - void writeFontToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFontId ) const; - /** Writes the specified number format to the passed property map. */ - void writeNumFmtToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const; - /** Writes the border attributes of the specified border data to the passed property map. */ - void writeBorderToPropertyMap( PropertyMap& rPropMap, sal_Int32 nBorderId ) const; - /** Writes the fill attributes of the specified fill data to the passed property map. */ - void writeFillToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFillId ) const; - /** Writes the cell formatting attributes of the specified XF to the passed property map. */ - void writeCellXfToPropertyMap( PropertyMap& rPropMap, sal_Int32 nXfId ) const; - - /** Writes the cell formatting attributes of the specified XF to the passed property set. */ - void writeCellXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const; - /** Writes the cell formatting attributes of the specified style XF to the passed property set. */ - void writeStyleXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const; - - bool hasBorder( sal_Int32 nBorderId ) const; -private: - typedef RefVector< Font > FontVector; - typedef RefVector< Border > BorderVector; - typedef RefVector< Fill > FillVector; - typedef RefVector< Xf > XfVector; - typedef RefVector< Dxf > DxfVector; - typedef ::std::map< sal_Int32, ::rtl::OUString > DxfStyleMap; - - ColorPalette maPalette; /// Color palette. - FontVector maFonts; /// List of font objects. - NumberFormatsBuffer maNumFmts; /// List of all number format codes. - BorderVector maBorders; /// List of cell border objects. - FillVector maFills; /// List of cell area fill objects. - XfVector maCellXfs; /// List of cell formats. - XfVector maStyleXfs; /// List of cell styles. - CellStyleBuffer maCellStyles; /// All built-in and user defined cell styles. - DxfVector maDxfs; /// List of differential cell styles. - mutable DxfStyleMap maDxfStyles; /// Maps DXF identifiers to Calc style sheet names. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/stylesfragment.hxx b/oox/inc/oox/xls/stylesfragment.hxx deleted file mode 100644 index 23b4f04b1feb..000000000000 --- a/oox/inc/oox/xls/stylesfragment.hxx +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ***********************************************************************/ - -#ifndef OOX_XLS_STYLESFRAGMENT_HXX -#define OOX_XLS_STYLESFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" -#include "oox/xls/stylesbuffer.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -class IndexedColorsContext : public WorkbookContextBase -{ -public: - explicit IndexedColorsContext( WorkbookFragmentBase& rFragment ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); -}; - -// ============================================================================ - -class FontContext : public WorkbookContextBase -{ -public: - template< typename ParentType > - inline explicit FontContext( ParentType& rParent, const FontRef& rxFont ) : - WorkbookContextBase( rParent ), mxFont( rxFont ) {} - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - -private: - FontRef mxFont; -}; - -// ============================================================================ - -class BorderContext : public WorkbookContextBase -{ -public: - template< typename ParentType > - inline explicit BorderContext( ParentType& rParent, const BorderRef& rxBorder ) : - WorkbookContextBase( rParent ), mxBorder( rxBorder ) {} - -protected: - virtual void onStartElement( const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - -private: - BorderRef mxBorder; -}; - -// ============================================================================ - -class FillContext : public WorkbookContextBase -{ -public: - template< typename ParentType > - inline explicit FillContext( ParentType& rParent, const FillRef& rxFill ) : - WorkbookContextBase( rParent ), mxFill( rxFill ), mfGradPos( -1.0 ) {} - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - -private: - FillRef mxFill; - double mfGradPos; /// Gradient color position. -}; - -// ============================================================================ - -class XfContext : public WorkbookContextBase -{ -public: - template< typename ParentType > - inline explicit XfContext( ParentType& rParent, const XfRef& rxXf, bool bCellXf ) : - WorkbookContextBase( rParent ), mxXf( rxXf ), mbCellXf( bCellXf ) {} - -protected: - virtual void onStartElement( const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - -private: - XfRef mxXf; - bool mbCellXf; /// True = cell XF, false = style XF. -}; - -// ============================================================================ - -class DxfContext : public WorkbookContextBase -{ -public: - template< typename ParentType > - inline explicit DxfContext( ParentType& rParent, const DxfRef& rxDxf ) : - WorkbookContextBase( rParent ), mxDxf( rxDxf ) {} - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - -private: - DxfRef mxDxf; -}; - -// ============================================================================ - -class StylesFragment : public WorkbookFragmentBase -{ -public: - explicit StylesFragment( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - virtual void finalizeImport(); -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/tablebuffer.hxx b/oox/inc/oox/xls/tablebuffer.hxx deleted file mode 100644 index e5ea4857b615..000000000000 --- a/oox/inc/oox/xls/tablebuffer.hxx +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_TABLEBUFFER_HXX -#define OOX_XLS_TABLEBUFFER_HXX - -#include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/xls/autofilterbuffer.hxx" -#include "oox/xls/workbookhelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -struct TableModel -{ - ::com::sun::star::table::CellRangeAddress - maRange; /// Original (unchecked) range of the table. - ::rtl::OUString maProgName; /// Programmatical name. - ::rtl::OUString maDisplayName; /// Display name. - sal_Int32 mnId; /// Unique table identifier. - sal_Int32 mnType; /// Table type (worksheet, query, etc.). - sal_Int32 mnHeaderRows; /// Number of header rows. - sal_Int32 mnTotalsRows; /// Number of totals rows. - - explicit TableModel(); -}; - -// ---------------------------------------------------------------------------- - -class Table : public WorkbookHelper -{ -public: - explicit Table( const WorkbookHelper& rHelper ); - - /** Imports a table definition from the passed attributes. */ - void importTable( const AttributeList& rAttribs, sal_Int16 nSheet ); - /** Imports a table definition from a TABLE record. */ - void importTable( SequenceInputStream& rStrm, sal_Int16 nSheet ); - /** Creates a new auto filter and stores it internally. */ - inline AutoFilter& createAutoFilter() { return maAutoFilters.createAutoFilter(); } - - /** Creates a database range from this tables. */ - void finalizeImport(); - - /** Returns the unique table identifier. */ - inline sal_Int32 getTableId() const { return maModel.mnId; } - /** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */ - inline sal_Int32 getTokenIndex() const { return mnTokenIndex; } - /** Returns the original display name of the table. */ - inline const ::rtl::OUString& getDisplayName() const { return maModel.maDisplayName; } - - /** Returns the original (unchecked) total range of the table. */ - inline const ::com::sun::star::table::CellRangeAddress& getOriginalRange() const { return maModel.maRange; } - /** Returns the cell range of this table. */ - inline const ::com::sun::star::table::CellRangeAddress& getRange() const { return maDestRange; } - /** Returns the number of columns of this table. */ - inline sal_Int32 getWidth() const { return maDestRange.EndColumn - maDestRange.StartColumn + 1; } - /** Returns the number of rows of this table. */ - inline sal_Int32 getHeight() const { return maDestRange.EndRow - maDestRange.StartRow + 1; } - /** Returns the number of header rows in the table range. */ - inline sal_Int32 getHeaderRows() const { return maModel.mnHeaderRows; } - /** Returns the number of totals rows in the table range. */ - inline sal_Int32 getTotalsRows() const { return maModel.mnTotalsRows; } - -private: - TableModel maModel; - AutoFilterBuffer maAutoFilters; /// Filter settings for this table. - ::rtl::OUString maDBRangeName; /// Name of the databae range in the Calc document. - ::com::sun::star::table::CellRangeAddress - maDestRange; /// Validated range of the table in the worksheet. - sal_Int32 mnTokenIndex; /// Token index used in API token array. -}; - -typedef ::boost::shared_ptr< Table > TableRef; - -// ============================================================================ - -class TableBuffer : public WorkbookHelper -{ -public: - explicit TableBuffer( const WorkbookHelper& rHelper ); - - /** Creates a new empty table. */ - Table& createTable(); - - /** Creates database ranges from all imported tables. */ - void finalizeImport(); - - /** Returns a table by its identifier. */ - TableRef getTable( sal_Int32 nTableId ) const; - /** Returns a table by its display name. */ - TableRef getTable( const ::rtl::OUString& rDispName ) const; - -private: - /** Inserts the passed table into the maps according to its identifier and name. */ - void insertTableToMaps( const TableRef& rxTable ); - -private: - typedef RefVector< Table > TableVector; - typedef RefMap< sal_Int32, Table > TableIdMap; - typedef RefMap< ::rtl::OUString, Table > TableNameMap; - - TableVector maTables; - TableIdMap maIdTables; - TableNameMap maNameTables; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/tablefragment.hxx b/oox/inc/oox/xls/tablefragment.hxx deleted file mode 100644 index de1a28253f20..000000000000 --- a/oox/inc/oox/xls/tablefragment.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_TABLEFRAGMENT_HXX -#define OOX_XLS_TABLEFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -class Table; - -// ============================================================================ - -class TableFragment : public WorksheetFragmentBase -{ -public: - explicit TableFragment( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - -private: - Table& mrTable; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/themebuffer.hxx b/oox/inc/oox/xls/themebuffer.hxx deleted file mode 100644 index e1641e740a71..000000000000 --- a/oox/inc/oox/xls/themebuffer.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_THEMEBUFFER_HXX -#define OOX_XLS_THEMEBUFFER_HXX - -#include "oox/drawingml/theme.hxx" -#include "oox/xls/workbookhelper.hxx" - -namespace oox { -namespace xls { - -struct FontModel; - -// ============================================================================ - -class ThemeBuffer : public ::oox::drawingml::Theme, public WorkbookHelper -{ -public: - explicit ThemeBuffer( const WorkbookHelper& rHelper ); - virtual ~ThemeBuffer(); - - /** Returns the theme color with the specified token identifier. */ - sal_Int32 getColorByToken( sal_Int32 nToken ) const; - - /** Returns the default font data for the current file type. */ - inline const FontModel& getDefaultFontModel() const { return *mxDefFontModel; } - -private: - typedef ::std::auto_ptr< FontModel > FontModelPtr; - FontModelPtr mxDefFontModel; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/unitconverter.hxx b/oox/inc/oox/xls/unitconverter.hxx deleted file mode 100644 index e3cd263fa2bc..000000000000 --- a/oox/inc/oox/xls/unitconverter.hxx +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_UNITCONVERTER_HXX -#define OOX_XLS_UNITCONVERTER_HXX - -#include <map> -#include <vector> -#include "oox/xls/workbookhelper.hxx" - -namespace com { namespace sun { namespace star { - namespace util { struct Date; struct DateTime; } -} } } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Units supported by the UnitConverter class. */ -enum Unit -{ - UNIT_INCH, /// Inches. - UNIT_POINT, /// Points. - UNIT_TWIP, /// Twips (1/20 point). - UNIT_EMU, /// English Metric Unit (1/360,000 cm). - UNIT_SCREENX, /// Horizontal screen pixels. - UNIT_SCREENY, /// Vertical screen pixels. - UNIT_REFDEVX, /// Horizontal pixels in Calc reference device. - UNIT_REFDEVY, /// Vertical pixels in Calc reference device. - UNIT_DIGIT, /// Digit width of document default font. - UNIT_SPACE, /// Space character width of document default font. - - UNIT_ENUM_SIZE -}; - -/** Helper class that provides functions to convert values from and to - different units. - - Provides functions to calculate the width of certain characters of the - default font of the imported/exported document. The default font is always - the first font in the styles font list, and is always referenced by the - default cell style ("Normal" style in Excel) which is used by all empty - unformatted cells in the document. To be able to calculate the charcter - width correctly, the default font must be known, which is the case after - the finalizeImport() or finalizeExport() functions have been called. Caller - must make sure to not call the character width conversion functions before. - */ -class UnitConverter : public WorkbookHelper -{ -public: - explicit UnitConverter( const WorkbookHelper& rHelper ); - - /** Final processing after import of all style settings. */ - void finalizeImport(); - /** Updates internal nulldate for date/serial conversion. */ - void finalizeNullDate( const ::com::sun::star::util::Date& rNullDate ); - - /** Converts the passed value between the passed units. */ - double scaleValue( double fValue, Unit eFromUnit, Unit eToUnit ) const; - - /** Converts the passed value to 1/100 millimeters. */ - sal_Int32 scaleToMm100( double fValue, Unit eUnit ) const; - /** Converts the passed value from 1/100 millimeters to the passed unit. */ - double scaleFromMm100( sal_Int32 nMm100, Unit eUnit ) const; - - /** Returns the serial value of the passed datetime, based on current nulldate. */ - double calcSerialFromDateTime( const ::com::sun::star::util::DateTime& rDateTime ) const; - /** Returns the datetime of the passed serial value, based on current nulldate. */ - ::com::sun::star::util::DateTime calcDateTimeFromSerial( double fSerial ) const; - - /** Returns a BIFF error code from the passed error string. */ - sal_uInt8 calcBiffErrorCode( const ::rtl::OUString& rErrorCode ) const; - -private: - /** Adds an error code to the internal maps. */ - void addErrorCode( sal_uInt8 nErrorCode, const ::rtl::OUString& rErrorCode ); - /** Returns the conversion coefficient for the passed unit. */ - double getCoefficient( Unit eUnit ) const; - -private: - typedef ::std::vector< double > DoubleVector; - typedef ::std::map< ::rtl::OUString, sal_uInt8 > OoxErrorCodeMap; - typedef ::std::map< sal_uInt8, ::rtl::OUString > BiffErrorCodeMap; - - DoubleVector maCoeffs; /// Coefficients for unit conversion. - OoxErrorCodeMap maOoxErrCodes; /// Maps error code strings to BIFF error constants. - sal_Int32 mnNullDate; /// Nulldate of this workbook (number of days since 0000-01-01). -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/viewsettings.hxx b/oox/inc/oox/xls/viewsettings.hxx deleted file mode 100644 index d020616082ff..000000000000 --- a/oox/inc/oox/xls/viewsettings.hxx +++ /dev/null @@ -1,235 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_VIEWSETTINGS_HXX -#define OOX_XLS_VIEWSETTINGS_HXX - -#include <com/sun/star/table/CellAddress.hpp> -#include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/xls/addressconverter.hxx" -#include "oox/xls/stylesbuffer.hxx" -#include "oox/xls/worksheethelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Contains all settings for a selection in a single pane of a sheet. */ -struct PaneSelectionModel -{ - ::com::sun::star::table::CellAddress maActiveCell; /// Position of active cell (cursor). - ApiCellRangeList maSelection; /// Selected cell ranges. - sal_Int32 mnActiveCellId; /// Index of active cell in selection list. - - explicit PaneSelectionModel(); -}; - -// ---------------------------------------------------------------------------- - -/** Contains all view settings for a single sheet. */ -struct SheetViewModel -{ - typedef RefMap< sal_Int32, PaneSelectionModel > PaneSelectionModelMap; - - PaneSelectionModelMap maPaneSelMap; /// Selections of all panes. - Color maGridColor; /// Grid color. - ::com::sun::star::table::CellAddress maFirstPos; /// First visible cell. - ::com::sun::star::table::CellAddress maSecondPos; /// First visible cell in additional panes. - sal_Int32 mnWorkbookViewId; /// Index into list of workbookView elements. - sal_Int32 mnViewType; /// View type (normal, page break, layout). - sal_Int32 mnActivePaneId; /// Active pane (with cell cursor). - sal_Int32 mnPaneState; /// Pane state (frozen, split). - double mfSplitX; /// Split X position (twips), or number of frozen columns. - double mfSplitY; /// Split Y position (twips), or number of frozen rows. - sal_Int32 mnCurrentZoom; /// Zoom factor for current view. - sal_Int32 mnNormalZoom; /// Zoom factor for normal view. - sal_Int32 mnSheetLayoutZoom; /// Zoom factor for pagebreak preview. - sal_Int32 mnPageLayoutZoom; /// Zoom factor for page layout view. - bool mbSelected; /// True = sheet is selected. - bool mbRightToLeft; /// True = sheet in right-to-left mode. - bool mbDefGridColor; /// True = default grid color. - bool mbShowFormulas; /// True = show formulas instead of results. - bool mbShowGrid; /// True = show cell grid. - bool mbShowHeadings; /// True = show column/row headings. - bool mbShowZeros; /// True = show zero value zells. - bool mbShowOutline; /// True = show outlines. - bool mbZoomToFit; /// True = zoom chart sheet to fit window. - - explicit SheetViewModel(); - - /** Returns true, if page break preview is active. */ - bool isPageBreakPreview() const; - /** Returns the zoom in normal view (returns default, if current value is 0). */ - sal_Int32 getNormalZoom() const; - /** Returns the zoom in pagebreak preview (returns default, if current value is 0). */ - sal_Int32 getPageBreakZoom() const; - /** Returns the grid color as RGB value. */ - sal_Int32 getGridColor( const ::oox::core::FilterBase& rFilter ) const; - - /** Returns the selection data, if available, otherwise 0. */ - const PaneSelectionModel* getPaneSelection( sal_Int32 nPaneId ) const; - /** Returns the selection data of the active pane. */ - const PaneSelectionModel* getActiveSelection() const; - /** Returns read/write access to the selection data of the specified pane. */ - PaneSelectionModel& createPaneSelection( sal_Int32 nPaneId ); -}; - -typedef ::boost::shared_ptr< SheetViewModel > SheetViewModelRef; - -// ---------------------------------------------------------------------------- - -class SheetViewSettings : public WorksheetHelper -{ -public: - explicit SheetViewSettings( const WorksheetHelper& rHelper ); - - /** Imports the sheetView element containing sheet view settings. */ - void importSheetView( const AttributeList& rAttribs ); - /** Imports the pane element containing sheet pane settings. */ - void importPane( const AttributeList& rAttribs ); - /** Imports the selection element containing selection settings for a pane. */ - void importSelection( const AttributeList& rAttribs ); - /** Imports the sheetView element containing view settings of a chart sheet. */ - void importChartSheetView( const AttributeList& rAttribs ); - - /** Imports the SHEETVIEW record containing sheet view settings. */ - void importSheetView( SequenceInputStream& rStrm ); - /** Imports the PANE record containing sheet pane settings. */ - void importPane( SequenceInputStream& rStrm ); - /** Imports the SELECTION record containing selection settings for a pane. */ - void importSelection( SequenceInputStream& rStrm ); - /** Imports the CHARTSHEETVIEW record containing view settings of a chart sheet. */ - void importChartSheetView( SequenceInputStream& rStrm ); - - /** Imports the WINDOW2 record containing sheet view settings. */ - void importWindow2( BiffInputStream& rStrm ); - /** Imports the PANE record containing sheet pane settings. */ - void importPane( BiffInputStream& rStrm ); - /** Imports the SCL record containing sheet zoom settings. */ - void importScl( BiffInputStream& rStrm ); - /** Imports the SELECTION record containing selection settings for a pane. */ - void importSelection( BiffInputStream& rStrm ); - - /** Converts all imported sheet view settings. */ - void finalizeImport(); - - /** Returns true, if the sheet layout is set to right-to-left. */ - bool isSheetRightToLeft() const; - -private: - SheetViewModelRef createSheetView(); - -private: - typedef RefVector< SheetViewModel > SheetViewModelVec; - SheetViewModelVec maSheetViews; -}; - -// ============================================================================ - -/** Contains all view settings for the entire document. */ -struct WorkbookViewModel -{ - sal_Int32 mnWinX; /// X position of the workbook window (twips). - sal_Int32 mnWinY; /// Y position of the workbook window (twips). - sal_Int32 mnWinWidth; /// Width of the workbook window (twips). - sal_Int32 mnWinHeight; /// Height of the workbook window (twips). - sal_Int32 mnActiveSheet; /// Displayed (active) sheet. - sal_Int32 mnFirstVisSheet; /// First visible sheet in sheet tabbar. - sal_Int32 mnTabBarWidth; /// Width of sheet tabbar (1/1000 of window width). - sal_Int32 mnVisibility; /// Visibility state of workbook window. - bool mbShowTabBar; /// True = show sheet tabbar. - bool mbShowHorScroll; /// True = show horizontal sheet scrollbars. - bool mbShowVerScroll; /// True = show vertical sheet scrollbars. - bool mbMinimized; /// True = workbook window is minimized. - - explicit WorkbookViewModel(); -}; - -typedef ::boost::shared_ptr< WorkbookViewModel > WorkbookViewModelRef; - -// ---------------------------------------------------------------------------- - -class ViewSettings : public WorkbookHelper -{ -public: - explicit ViewSettings( const WorkbookHelper& rHelper ); - - /** Imports the workbookView element containing workbook view settings. */ - void importWorkbookView( const AttributeList& rAttribs ); - /** Imports the oleSize element containing the visible size of the workbook. */ - void importOleSize( const AttributeList& rAttribs ); - /** Imports the WORKBOOKVIEW record containing workbook view settings. */ - void importWorkbookView( SequenceInputStream& rStrm ); - /** Imports the OLESIZE record containing the visible size of the workbook. */ - void importOleSize( SequenceInputStream& rStrm ); - /** Imports the WINDOW1 record containing workbook view settings. */ - void importWindow1( BiffInputStream& rStrm ); - /** Imports the OLESIZE record containing the visible size of the workbook. */ - void importOleSize( BiffInputStream& rStrm ); - - /** Stores converted view settings for a specific worksheet. */ - void setSheetViewSettings( sal_Int16 nSheet, - const SheetViewModelRef& rxSheetView, - const ::com::sun::star::uno::Any& rProperties ); - /** Stores the used area for a specific worksheet. */ - void setSheetUsedArea( - const ::com::sun::star::table::CellRangeAddress& rUsedArea ); - - /** Converts all imported document view settings. */ - void finalizeImport(); - - /** Returns the Calc index of the active sheet. */ - sal_Int16 getActiveCalcSheet() const; - -private: - WorkbookViewModel& createWorkbookView(); - -private: - typedef RefVector< WorkbookViewModel > WorkbookViewModelVec; - typedef RefMap< sal_Int16, SheetViewModel > SheetViewModelMap; - typedef ::std::map< sal_Int16, ::com::sun::star::uno::Any > SheetPropertiesMap; - typedef ::std::map< sal_Int16, ::com::sun::star::table::CellRangeAddress > SheetUsedAreaMap; - - WorkbookViewModelVec maBookViews; /// Workbook view models. - SheetViewModelMap maSheetViews; /// Active view model for each sheet. - SheetPropertiesMap maSheetProps; /// Converted property sequences for each sheet. - SheetUsedAreaMap maSheetUsedAreas; /// Used area (cell range) of every sheet. - ::com::sun::star::table::CellRangeAddress - maOleSize; /// Visible area if this is an embedded OLE object. - bool mbValidOleSize; /// True = imported OLE size is a valid cell range. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/workbookfragment.hxx b/oox/inc/oox/xls/workbookfragment.hxx deleted file mode 100644 index a67f8d216110..000000000000 --- a/oox/inc/oox/xls/workbookfragment.hxx +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_WORKBOOKFRAGMENT_HXX -#define OOX_XLS_WORKBOOKFRAGMENT_HXX - -#include "oox/xls/defnamesbuffer.hxx" -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -class ExternalLink; - -// ============================================================================ - -class WorkbookFragment : public WorkbookFragmentBase -{ -public: - explicit WorkbookFragment( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - virtual void finalizeImport(); - -private: - void importExternalReference( const AttributeList& rAttribs ); - void importDefinedName( const AttributeList& rAttribs ); - void importPivotCache( const AttributeList& rAttribs ); - - void importExternalRef( SequenceInputStream& rStrm ); - void importPivotCache( SequenceInputStream& rStrm ); - - void importExternalLinkFragment( ExternalLink& rExtLink ); - void importPivotCacheDefFragment( const ::rtl::OUString& rRelId, sal_Int32 nCacheId ); - -private: - DefinedNameRef mxCurrName; -}; - -// ============================================================================ - -class BiffWorkbookFragment : public BiffWorkbookFragmentBase -{ -public: - explicit BiffWorkbookFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rStrmName ); - - /** Imports the entire workbook stream, including all contained worksheets. */ - virtual bool importFragment(); - -private: - /** Imports a complete BIFF4 workspace fragment (with embedded sheets). */ - bool importWorkspaceFragment(); - /** Imports the workbook globals fragment from current stream position. */ - bool importGlobalsFragment( ISegmentProgressBar& rProgressBar ); - /** Imports a sheet fragment with passed type from current stream position. */ - bool importSheetFragment( - ISegmentProgressBar& rProgressBar, - BiffFragmentType eFragment, sal_Int16 nCalcSheet ); -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx deleted file mode 100644 index b7ac389a18e6..000000000000 --- a/oox/inc/oox/xls/workbookhelper.hxx +++ /dev/null @@ -1,302 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_WORKBOOKHELPER_HXX -#define OOX_XLS_WORKBOOKHELPER_HXX - -#include <boost/shared_ptr.hpp> -#include <rtl/ref.hxx> -#include "oox/helper/storagebase.hxx" -#include "oox/xls/biffhelper.hxx" - -namespace com { namespace sun { namespace star { - namespace container { class XNameAccess; } - namespace container { class XNameContainer; } - namespace lang { class XMultiServiceFactory; } - namespace sheet { class XDatabaseRange; } - namespace sheet { class XNamedRange; } - namespace sheet { class XSpreadsheet; } - namespace sheet { class XSpreadsheetDocument; } - namespace style { class XStyle; } - namespace table { struct CellAddress; } - namespace table { struct CellRangeAddress; } - namespace table { class XCell; } - namespace table { class XCellRange; } -} } } - -namespace oox { - class AttributeList; - class SegmentProgressBar; - class SequenceInputStream; -} - -namespace oox { namespace core { - class BinaryFilterBase; - class FilterBase; - class FragmentHandler; - class XmlFilterBase; -} } - -namespace oox { namespace drawingml { - class Theme; -} } - -namespace oox { -namespace xls { - -class ExcelFilter; -class ExcelBiffFilter; - -// ============================================================================ - -/** An enumeration for all supported spreadsheet filter types. */ -enum FilterType -{ - FILTER_OOXML, /// MS Excel OOXML (Office Open XML) or BIFF12. - FILTER_BIFF, /// MS Excel BIFF2-BIFF8 (Binary Interchange File Format). - FILTER_UNKNOWN /// Unknown filter type. -}; - -// ============================================================================ - -/** Functor for case-insensitive string comparison, usable in maps etc. */ -struct IgnoreCaseCompare -{ - bool operator()( const ::rtl::OUString& rName1, const ::rtl::OUString& rName2 ) const; -}; - -// ============================================================================ - -class AddressConverter; -class BiffCodecHelper; -class ConnectionsBuffer; -class DefinedNamesBuffer; -class ExcelChartConverter; -class ExternalLinkBuffer; -class FormulaParser; -class PageSettingsConverter; -class PivotCacheBuffer; -class PivotTableBuffer; -class ScenarioBuffer; -class SharedStringsBuffer; -class StylesBuffer; -class TableBuffer; -class ThemeBuffer; -class UnitConverter; -class ViewSettings; -class WorkbookSettings; -class WorksheetBuffer; - -class WorkbookGlobals; -typedef ::boost::shared_ptr< WorkbookGlobals > WorkbookGlobalsRef; - -/** Helper class to provice access to global workbook data. - - All classes derived from this helper class will have access to a singleton - object of type WorkbookGlobals containing global workbook settings, - buffers, converters, etc. Nearly all classes in this filter implementation - are derived directly or indirectly from this class. - - This class contains just a simple reference to the WorkbookGlobals object - to prevent circular references, as the WorkbookGlobals object contains a - lot of objects derived from this class. - */ -class WorkbookHelper -{ -public: - inline /*implicit*/ WorkbookHelper( WorkbookGlobals& rBookGlob ) : mrBookGlob( rBookGlob ) {} - virtual ~WorkbookHelper(); - - static WorkbookGlobalsRef constructGlobals( ExcelFilter& rFilter ); - static WorkbookGlobalsRef constructGlobals( ExcelBiffFilter& rFilter, BiffType eBiff ); - - // filter ----------------------------------------------------------------- - - /** Returns the base filter object (base class of all filters). */ - ::oox::core::FilterBase& getBaseFilter() const; - /** Returns the file type of the current filter. */ - FilterType getFilterType() const; - /** Returns the filter progress bar. */ - SegmentProgressBar& getProgressBar() const; - /** Returns true, if the file is a multi-sheet document, or false if single-sheet. */ - bool isWorkbookFile() const; - /** Returns the index of the current Calc sheet, if filter currently processes a sheet. */ - sal_Int16 getCurrentSheetIndex() const; - - /** Sets the VBA project storage used to import VBA source code and forms. */ - void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ); - /** Sets the index of the current Calc sheet, if filter currently processes a sheet. */ - void setCurrentSheetIndex( sal_Int16 nSheet ); - /** Final conversion after importing the workbook. */ - void finalizeWorkbookImport(); - - // document model --------------------------------------------------------- - - /** Returns a reference to the source/target spreadsheet document model. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument > - getDocument() const; - - /** Returns a reference to the specified spreadsheet in the document model. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > - getSheetFromDoc( sal_Int16 nSheet ) const; - /** Returns a reference to the specified spreadsheet in the document model. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > - getSheetFromDoc( const ::rtl::OUString& rSheet ) const; - - /** Returns the XCellRange interface for the passed cell range address. */ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > - getCellRangeFromDoc( - const ::com::sun::star::table::CellRangeAddress& rRange ) const; - - /** Returns the cell or page styles container from the Calc document. */ - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > - getStyleFamily( bool bPageStyles ) const; - /** Returns the specified cell or page style from the Calc document. */ - ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > - getStyleObject( const ::rtl::OUString& rStyleName, bool bPageStyle ) const; - - /** Creates and returns a defined name on-the-fly in the Calc document. - The name will not be buffered in the global defined names buffer. - @param orName (in/out-parameter) Returns the resulting used name. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange > - createNamedRangeObject( - ::rtl::OUString& orName, - sal_Int32 nNameFlags = 0 ) const; - - /** Creates and returns a defined name on-the-fly in the sheet. - The name will not be buffered in the global defined names buffer. - @param orName (in/out-parameter) Returns the resulting used name. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange > - createLocalNamedRangeObject( - ::rtl::OUString& orName, - sal_Int32 nNameFlags = 0, sal_Int32 nTab = -1 ) const; - - /** Creates and returns a database range on-the-fly in the Calc document. - The range will not be buffered in the global table buffer. - @param orName (in/out-parameter) Returns the resulting used name. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDatabaseRange > - createDatabaseRangeObject( - ::rtl::OUString& orName, - const ::com::sun::star::table::CellRangeAddress& rRangeAddr ) const; - - /** Creates and returns an unnamed database range on-the-fly in the Calc document. - The range will not be buffered in the global table buffer. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDatabaseRange > - createUnnamedDatabaseRangeObject( - const ::com::sun::star::table::CellRangeAddress& rRangeAddr ) const; - - /** Creates and returns a com.sun.star.style.Style object for cells or pages. */ - ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > - createStyleObject( - ::rtl::OUString& orStyleName, - bool bPageStyle ) const; - - // buffers ---------------------------------------------------------------- - - /** Returns the global workbook settings object. */ - WorkbookSettings& getWorkbookSettings() const; - /** Returns the workbook and sheet view settings object. */ - ViewSettings& getViewSettings() const; - /** Returns the worksheet buffer containing sheet names and properties. */ - WorksheetBuffer& getWorksheets() const; - /** Returns the office theme object read from the theme substorage. */ - ThemeBuffer& getTheme() const; - /** Returns all cell formatting objects read from the styles substream. */ - StylesBuffer& getStyles() const; - /** Returns the shared strings read from the shared strings substream. */ - SharedStringsBuffer& getSharedStrings() const; - /** Returns the external links read from the external links substream. */ - ExternalLinkBuffer& getExternalLinks() const; - /** Returns the defined names read from the workbook globals. */ - DefinedNamesBuffer& getDefinedNames() const; - /** Returns the tables collection (equivalent to Calc's database ranges). */ - TableBuffer& getTables() const; - /** Returns the scenarios collection. */ - ScenarioBuffer& getScenarios() const; - /** Returns the collection of external data connections. */ - ConnectionsBuffer& getConnections() const; - /** Returns the collection of pivot caches. */ - PivotCacheBuffer& getPivotCaches() const; - /** Returns the collection of pivot tables. */ - PivotTableBuffer& getPivotTables() const; - - // converters ------------------------------------------------------------- - - /** Returns the import formula parser (import filter only!). */ - FormulaParser& getFormulaParser() const; - /** Returns the measurement unit converter. */ - UnitConverter& getUnitConverter() const; - /** Returns the converter for string to cell address/range conversion. */ - AddressConverter& getAddressConverter() const; - /** Returns the chart object converter. */ - ExcelChartConverter* getChartConverter() const; - /** Returns the page and print settings converter. */ - PageSettingsConverter& getPageSettingsConverter() const; - - // OOXML/BIFF12 specific (MUST NOT be called in BIFF filter) -------------- - - /** Returns the base OOXML/BIFF12 filter object. - Must not be called, if current filter is not the OOXML/BIFF12 filter. */ - ::oox::core::XmlFilterBase& getOoxFilter() const; - - /** Imports a fragment using the passed fragment handler, which contains - the full path to the fragment stream. */ - bool importOoxFragment( const ::rtl::Reference< ::oox::core::FragmentHandler >& rxHandler ); - - // BIFF2-BIFF8 specific (MUST NOT be called in OOXML/BIFF12 filter) ------- - - /** Returns the BIFF type in binary filter. */ - BiffType getBiff() const; - - /** Returns the text encoding used to import/export byte strings. */ - rtl_TextEncoding getTextEncoding() const; - /** Sets code page read from a CODEPAGE record for byte string import. */ - void setCodePage( sal_uInt16 nCodePage ); - /** Sets text encoding from the default application font, if CODEPAGE record is missing. */ - void setAppFontEncoding( rtl_TextEncoding eAppFontEnc ); - - /** Enables workbook file mode, used for BIFF4 workspace files. */ - void setIsWorkbookFile(); - /** Recreates global buffers that are used per sheet in specific BIFF versions. */ - void createBuffersPerSheet( sal_Int16 nSheet ); - - /** Returns the codec helper that stores the encoder/decoder object. */ - BiffCodecHelper& getCodecHelper() const; - -private: - WorkbookGlobals& mrBookGlob; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/workbooksettings.hxx b/oox/inc/oox/xls/workbooksettings.hxx deleted file mode 100644 index 3a1e1f2f5063..000000000000 --- a/oox/inc/oox/xls/workbooksettings.hxx +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_WORKBOOKSETTINGS_HXX -#define OOX_XLS_WORKBOOKSETTINGS_HXX - -#include "oox/xls/workbookhelper.hxx" - -namespace com { namespace sun { namespace star { namespace util { struct Date; } } } } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Settings for workbook write protection. */ -struct FileSharingModel -{ - ::rtl::OUString maUserName; /// User who added the write protection password. - sal_uInt16 mnPasswordHash; /// Hash value of the write protection password. - bool mbRecommendReadOnly; /// True = recommend read-only mode on opening. - - explicit FileSharingModel(); -}; - -// ============================================================================ - -/** Global workbook settings. */ -struct WorkbookSettingsModel -{ - ::rtl::OUString maCodeName; /// VBA codename for the workbook. - sal_Int32 mnShowObjectMode; /// Specifies how objects are shown. - sal_Int32 mnUpdateLinksMode; /// Specifies how external links are updated. - sal_Int32 mnDefaultThemeVer; /// Default theme version. - bool mbDateMode1904; /// True = null date is 1904-01-01. - bool mbDateCompatibility; /// False = null date is 1899-12-30. - bool mbSaveExtLinkValues; /// True = save cached cell values for external links. - - explicit WorkbookSettingsModel(); - - /** Sets BIFF object visibility mode. */ - void setBiffObjectMode( sal_uInt16 nObjMode ); -}; - -// ============================================================================ - -/** Workbook calculation settings. */ -struct CalcSettingsModel -{ - double mfIterateDelta; /// Minimum change in circular references. - sal_Int32 mnCalcId; /// Calculation engine identifier. - sal_Int32 mnRefMode; /// Cell reference mode: A1 or R1C1. - sal_Int32 mnCalcMode; /// Automatic or manual recalculation. - sal_Int32 mnIterateCount; /// Number of iterations in circular references. - sal_Int32 mnProcCount; /// Number of processors for concurrent calculation. - bool mbCalcOnSave; /// True = always recalculate formulas before save. - bool mbCalcCompleted; /// True = formulas have been recalculated before save. - bool mbFullPrecision; /// True = use full precision on calculation. - bool mbIterate; /// True = allow circular references. - bool mbConcurrent; /// True = concurrent calculation enabled. - bool mbUseNlr; /// True = use natural language references in formulas. - - explicit CalcSettingsModel(); -}; - -// ============================================================================ - -class WorkbookSettings : public WorkbookHelper -{ -public: - explicit WorkbookSettings( const WorkbookHelper& rHelper ); - - /** Imports the fileSharing element containing write protection settings. */ - void importFileSharing( const AttributeList& rAttribs ); - /** Imports the workbookPr element containing global workbook settings. */ - void importWorkbookPr( const AttributeList& rAttribs ); - /** Imports the calcPr element containing workbook calculation settings. */ - void importCalcPr( const AttributeList& rAttribs ); - - /** Imports the FILESHARING record containing write protection settings. */ - void importFileSharing( SequenceInputStream& rStrm ); - /** Imports the WORKBOOKPR record containing global workbook settings. */ - void importWorkbookPr( SequenceInputStream& rStrm ); - /** Imports the CALCPR record containing workbook calculation settings. */ - void importCalcPr( SequenceInputStream& rStrm ); - - /** Sets the save external linked values flag, e.g. from the WSBOOL record. */ - void setSaveExtLinkValues( bool bSaveExtLinks ); - /** Imports the BOOKBOOL record. */ - void importBookBool( BiffInputStream& rStrm ); - /** Imports the CALCCOUNT record. */ - void importCalcCount( BiffInputStream& rStrm ); - /** Imports the CALCMODE record. */ - void importCalcMode( BiffInputStream& rStrm ); - /** Imports the CODENAME record. */ - void importCodeName( BiffInputStream& rStrm ); - /** Imports the DATEMODE record. */ - void importDateMode( BiffInputStream& rStrm ); - /** Imports the DELTA record. */ - void importDelta( BiffInputStream& rStrm ); - /** Imports the FILESHARING record. */ - void importFileSharing( BiffInputStream& rStrm ); - /** Imports the HIDEOBJ record. */ - void importHideObj( BiffInputStream& rStrm ); - /** Imports the ITERATION record. */ - void importIteration( BiffInputStream& rStrm ); - /** Imports the PRECISION record. */ - void importPrecision( BiffInputStream& rStrm ); - /** Imports the REFMODE record. */ - void importRefMode( BiffInputStream& rStrm ); - /** Imports the SAVERECALC record. */ - void importSaveRecalc( BiffInputStream& rStrm ); - /** Imports the UNCALCED record. */ - void importUncalced( BiffInputStream& rStrm ); - /** Imports the USESELFS record. */ - void importUsesElfs( BiffInputStream& rStrm ); - - /** Converts the imported workbook settings. */ - void finalizeImport(); - - /** Returns the show objects mode (considered a view setting in Calc). */ - sal_Int16 getApiShowObjectMode() const; - /** Returns the nulldate of this workbook. */ - ::com::sun::star::util::Date getNullDate() const; - -private: - /** Updates date mode and unit converter nulldate. */ - void setDateMode( bool bDateMode1904, bool bDateCompatibility=true ); - -private: - FileSharingModel maFileSharing; - WorkbookSettingsModel maBookSettings; - CalcSettingsModel maCalcSettings; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/worksheetbuffer.hxx b/oox/inc/oox/xls/worksheetbuffer.hxx deleted file mode 100644 index d524a5e1d909..000000000000 --- a/oox/inc/oox/xls/worksheetbuffer.hxx +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_WORKSHEETBUFFER_HXX -#define OOX_XLS_WORKSHEETBUFFER_HXX - -#include <utility> -#include "oox/helper/refmap.hxx" -#include "oox/helper/refvector.hxx" -#include "oox/xls/workbookhelper.hxx" - -namespace com { namespace sun { namespace star { - namespace i18n { class XCharacterClassification; } -} } } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Contains data from the 'sheet' element describing a sheet in the workbook. */ -struct SheetInfoModel -{ - ::rtl::OUString maRelId; /// Relation identifier for the sheet substream. - ::rtl::OUString maName; /// Original name of the sheet. - sal_Int64 mnBiffHandle; /// BIFF record handle of the sheet substream. - sal_Int32 mnSheetId; /// Sheet identifier. - sal_Int32 mnState; /// Visibility state. - - explicit SheetInfoModel(); -}; - -// ============================================================================ - -/** Stores information about all sheets in a spreadsheet document. - - Information about sheets includes the sheet name, the visibility state, and - for the OOXML filter, the relation identifier of the sheet used to obtain - the related worksheet fragment. - */ -class WorksheetBuffer : public WorkbookHelper -{ -public: - explicit WorksheetBuffer( const WorkbookHelper& rHelper ); - - /** Returns the base file name without path and file extension. */ - static ::rtl::OUString getBaseFileName( const ::rtl::OUString& rUrl ); - - /** Initializes the buffer for single sheet files (BIFF2-BIFF4). */ - void initializeSingleSheet(); - - /** Imports the attributes of a sheet element. */ - void importSheet( const AttributeList& rAttribs ); - /** Imports the SHEET record from the passed BIFF12 stream. */ - void importSheet( SequenceInputStream& rStrm ); - /** Imports the SHEET record from the passed BIFF stream. */ - void importSheet( BiffInputStream& rStrm ); - /** Inserts a new empty sheet into the document. Looks for an unused name. - @return Index of the new sheet in the Calc document. */ - sal_Int16 insertEmptySheet( const ::rtl::OUString& rPreferredName, bool bVisible ); - - /** Returns the number of original sheets contained in the workbook. */ - sal_Int32 getWorksheetCount() const; - /** Returns the OOXML relation identifier of the specified worksheet. */ - ::rtl::OUString getWorksheetRelId( sal_Int32 nWorksheet ) const; - /** Returns the BIFF record handle of the associated sheet substream. */ - sal_Int64 getBiffRecordHandle( sal_Int32 nWorksheet ) const; - - /** Returns the Calc index of the specified worksheet. */ - sal_Int16 getCalcSheetIndex( sal_Int32 nWorksheet ) const; - /** Returns the finalized name of the specified worksheet. */ - ::rtl::OUString getCalcSheetName( sal_Int32 nWorksheet ) const; - - /** Returns the Calc index of the sheet with the passed original worksheet name. */ - sal_Int16 getCalcSheetIndex( const ::rtl::OUString& rWorksheetName ) const; - /** Returns the finalized name of the sheet with the passed worksheet name. */ - ::rtl::OUString getCalcSheetName( const ::rtl::OUString& rWorksheetName ) const; - -private: - struct SheetInfo : public SheetInfoModel - { - ::rtl::OUString maCalcName; - ::rtl::OUString maCalcQuotedName; - sal_Int16 mnCalcSheet; - - explicit SheetInfo( const SheetInfoModel& rModel, sal_Int16 nCalcSheet, const ::rtl::OUString& rCalcName ); - }; - - typedef ::std::pair< sal_Int16, ::rtl::OUString > IndexNamePair; - - /** Creates a new sheet in the Calc document. Does not insert anything in the own lists. */ - IndexNamePair createSheet( const ::rtl::OUString& rPreferredName, sal_Int32 nSheetPos, bool bVisible ); - /** Creates a new sheet in the Calc document and inserts the related SheetInfo. */ - void insertSheet( const SheetInfoModel& rModel ); - -private: - typedef RefVector< SheetInfo > SheetInfoVector; - SheetInfoVector maSheetInfos; - - typedef RefMap< ::rtl::OUString, SheetInfo, IgnoreCaseCompare > SheetInfoMap; - SheetInfoMap maSheetInfosByName; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/worksheetfragment.hxx b/oox/inc/oox/xls/worksheetfragment.hxx deleted file mode 100644 index 73d8fd8df987..000000000000 --- a/oox/inc/oox/xls/worksheetfragment.hxx +++ /dev/null @@ -1,193 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_WORKSHEETFRAGMENT_HXX -#define OOX_XLS_WORKSHEETFRAGMENT_HXX - -#include "oox/xls/excelhandlers.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -class DataValidationsContext : public WorksheetContextBase -{ -public: - explicit DataValidationsContext( WorksheetFragmentBase& rFragment ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - virtual void onEndElement(); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - -private: - /** Imports the dataValidation element containing data validation settings. */ - void importDataValidation( const AttributeList& rAttribs ); - /** Imports the DATAVALIDATION record containing data validation settings. */ - void importDataValidation( SequenceInputStream& rStrm ); - -private: - ::std::auto_ptr< ValidationModel > mxValModel; -}; - -// ============================================================================ - -class WorksheetFragment : public WorksheetFragmentBase -{ -public: - explicit WorksheetFragment( - const WorksheetHelper& rHelper, - const ::rtl::OUString& rFragmentPath ); - -protected: - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onCharacters( const ::rtl::OUString& rChars ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); - - virtual const ::oox::core::RecordInfo* getRecordInfos() const; - virtual void initializeImport(); - virtual void finalizeImport(); - -private: - /** Imports page settings from a pageSetUpPr element. */ - void importPageSetUpPr( const AttributeList& rAttribs ); - /** Imports the dimension element containing the used area of the sheet. */ - void importDimension( const AttributeList& rAttribs ); - /** Imports sheet format properties from a sheetFormatPr element. */ - void importSheetFormatPr( const AttributeList& rAttribs ); - /** Imports column settings from a col element. */ - void importCol( const AttributeList& rAttribs ); - /** Imports a merged cell range from a mergeCell element. */ - void importMergeCell( const AttributeList& rAttribs ); - /** Imports the hyperlink element containing a hyperlink for a cell range. */ - void importHyperlink( const AttributeList& rAttribs ); - /** Imports individual break that is either within row or column break context. */ - void importBrk( const AttributeList& rAttribs, bool bRowBreak ); - /** Imports the the relation identifier for the DrawingML part. */ - void importDrawing( const AttributeList& rAttribs ); - /** Imports the the relation identifier for the legacy VML drawing part. */ - void importLegacyDrawing( const AttributeList& rAttribs ); - /** Imports additional data for an OLE object. */ - void importOleObject( const AttributeList& rAttribs ); - /** Imports additional data for an OCX form control. */ - void importControl( const AttributeList& rAttribs ); - - /** Imports the DIMENSION record containing the used area of the sheet. */ - void importDimension( SequenceInputStream& rStrm ); - /** Imports sheet format properties from a SHEETFORMATPR record. */ - void importSheetFormatPr( SequenceInputStream& rStrm ); - /** Imports column settings from a COL record. */ - void importCol( SequenceInputStream& rStrm ); - /** Imports a merged cell range from a MERGECELL record. */ - void importMergeCell( SequenceInputStream& rStrm ); - /** Imports a hyperlink for a cell range from a HYPERLINK record. */ - void importHyperlink( SequenceInputStream& rStrm ); - /** Imports the BRK record for an individual row or column page break. */ - void importBrk( SequenceInputStream& rStrm, bool bRowBreak ); - /** Imports the DRAWING record containing the relation identifier for the DrawingML part. */ - void importDrawing( SequenceInputStream& rStrm ); - /** Imports the LEGACYDRAWING record containing the relation identifier for the VML drawing part. */ - void importLegacyDrawing( SequenceInputStream& rStrm ); - /** Imports additional data for an OLE object. */ - void importOleObject( SequenceInputStream& rStrm ); - /** Imports additional data for an OCX form control. */ - void importControl( SequenceInputStream& rStrm ); - - /** Imports the binary data of an embedded OLE object from the fragment with the passed ID. */ - void importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const ::rtl::OUString& rRelId ); -}; - -// ============================================================================ - -class BiffWorksheetFragment : public BiffWorksheetFragmentBase -{ -public: - explicit BiffWorksheetFragment( - const WorksheetHelper& rHelper, - const BiffWorkbookFragmentBase& rParent ); - virtual ~BiffWorksheetFragment(); - - /** Imports the entire worksheet fragment, returns true, if EOF record has been reached. */ - virtual bool importFragment(); - -private: - /** Imports the AUTOFILTER and following records with auto filter settings. */ - void importAutoFilter( BiffInputStream& rStrm ); - /** Imports the COLINFO record and sets column properties and formatting. */ - void importColInfo( BiffInputStream& rStrm ); - /** Imports the BIFF2 COLUMNDEFAULT record and sets column default formatting. */ - void importColumnDefault( BiffInputStream& rStrm ); - /** Imports the BIFF2 COLWIDTH record and sets column width. */ - void importColWidth( BiffInputStream& rStrm ); - /** Imports the DATAVALIDATION record containing cell ranges with data validation settings. */ - void importDataValidation( BiffInputStream& rStrm ); - /** Imports the DATAVALIDATIONS record containing global data validation settings. */ - void importDataValidations( BiffInputStream& rStrm ); - /** Imports the DEFCOLWIDTH record and sets default column width. */ - void importDefColWidth( BiffInputStream& rStrm ); - /** Imports the DEFROWHEIGHT record and sets default row height and properties. */ - void importDefRowHeight( BiffInputStream& rStrm ); - /** Imports the DIMENSION record containing the used area of the sheet. */ - void importDimension( BiffInputStream& rStrm ); - /** Imports the HYPERLINK record and sets a cell hyperlink. */ - void importHyperlink( BiffInputStream& rStrm ); - /** Imports the LABELRANGES record and sets the imported label ranges. */ - void importLabelRanges( BiffInputStream& rStrm ); - /** Imports the MEREDCELLS record and merges all cells in the document. */ - void importMergedCells( BiffInputStream& rStrm ); - /** Imports the NOTE record containing a cell note. */ - void importNote( BiffInputStream& rStrm ); - /** Imports the HORPAGEBREAKS or VERPAGEBREAKS record and inserts page breaks. */ - void importPageBreaks( BiffInputStream& rStrm, bool bRowBreak ); - /** Imports a pivot table. */ - void importPTDefinition( BiffInputStream& rStrm ); - /** Imports the QUERYTABLE and following records and inserts a web query. */ - void importQueryTable( BiffInputStream& rStrm ); - /** Imports the SCENARIOS record and the following scenarios. */ - void importScenarios( BiffInputStream& rStrm ); - /** Imports the SHAREDFEATHEAD record. */ - void importSharedFeatHead( BiffInputStream& rStrm ); - /** Imports the STANDARDWIDTH record and sets standard column width. */ - void importStandardWidth( BiffInputStream& rStrm ); - -private: - ::boost::shared_ptr< BiffWorksheetContextBase > mxContext; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx deleted file mode 100644 index 798e5ccac08b..000000000000 --- a/oox/inc/oox/xls/worksheethelper.hxx +++ /dev/null @@ -1,339 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_WORKSHEETHELPER_HXX -#define OOX_XLS_WORKSHEETHELPER_HXX - -#include "oox/helper/containerhelper.hxx" -#include "oox/helper/progressbar.hxx" -#include "oox/ole/olehelper.hxx" -#include "oox/xls/addressconverter.hxx" -#include "oox/xls/formulabase.hxx" - -namespace com { namespace sun { namespace star { - namespace awt { struct Point; } - namespace awt { struct Rectangle; } - namespace awt { struct Size; } - namespace drawing { class XDrawPage; } - namespace sheet { class XSheetCellRanges; } - namespace sheet { class XSpreadsheet; } - namespace table { class XCell; } - namespace table { class XCell2; } - namespace table { class XCellRange; } - namespace table { class XTableColumns; } - namespace table { class XTableRows; } -} } } - -namespace oox { -namespace xls { - -class AutoFilterBuffer; -struct BinAddress; -struct BinRange; -class BiffSheetDrawing; -class BinRangeList; -class CommentsBuffer; -class CondFormatBuffer; -class Font; -class PageSettings; -class QueryTableBuffer; -class RichString; -class SheetDataBuffer; -class SheetViewSettings; -class VmlDrawing; -class WorksheetSettings; - -// ============================================================================ -// ============================================================================ - -/** An enumeration for all types of sheets in a workbook. */ -enum WorksheetType -{ - SHEETTYPE_WORKSHEET, /// Worksheet. - SHEETTYPE_CHARTSHEET, /// Chart sheet. - SHEETTYPE_MACROSHEET, /// Macro sheet. - SHEETTYPE_DIALOGSHEET, /// Dialog sheet (BIFF5+). - SHEETTYPE_MODULESHEET, /// VB module sheet (BIFF5 only). - SHEETTYPE_EMPTYSHEET /// Other (unsupported) sheet type. -}; - -// ============================================================================ - -/** Stores settings and formatting data about a range of sheet columns. */ -struct ColumnModel -{ - ValueRange maRange; /// 1-based (!) range of the described columns. - double mfWidth; /// Column width in number of characters. - sal_Int32 mnXfId; /// Column default formatting. - sal_Int32 mnLevel; /// Column outline level. - bool mbShowPhonetic; /// True = cells in column show phonetic settings. - bool mbHidden; /// True = column is hidden. - bool mbCollapsed; /// True = column outline is collapsed. - - explicit ColumnModel(); - - /** Returns true, if this entry can be merged with the passed column range (column settings are equal). */ - bool isMergeable( const ColumnModel& rModel ) const; -}; - -// ---------------------------------------------------------------------------- - -/** Stores settings and formatting data about a sheet row. */ -struct RowModel -{ - sal_Int32 mnRow; /// 1-based (!) index of the described row. - ValueRangeSet maColSpans; /// 0-based (!) column ranges of used cells. - double mfHeight; /// Row height in points. - sal_Int32 mnXfId; /// Row default formatting (see mbIsFormatted). - sal_Int32 mnLevel; /// Row outline level. - bool mbCustomHeight; /// True = row has custom height. - bool mbCustomFormat; /// True = cells in row have explicit formatting. - bool mbShowPhonetic; /// True = cells in row show phonetic settings. - bool mbHidden; /// True = row is hidden. - bool mbCollapsed; /// True = row outline is collapsed. - bool mbThickTop; /// True = row has extra space above text. - bool mbThickBottom; /// True = row has extra space below text. - - explicit RowModel(); - - /** Inserts the passed column span into the row model. */ - void insertColSpan( const ValueRange& rColSpan ); - /** Returns true, if this entry can be merged with the passed row range (row settings are equal). */ - bool isMergeable( const RowModel& rModel ) const; -}; - -// ---------------------------------------------------------------------------- - -/** Stores formatting data about a page break. */ -struct PageBreakModel -{ - sal_Int32 mnColRow; /// 0-based (!) index of column/row. - sal_Int32 mnMin; /// Start of limited break. - sal_Int32 mnMax; /// End of limited break. - bool mbManual; /// True = manual page break. - - explicit PageBreakModel(); -}; - -// ---------------------------------------------------------------------------- - -/** Stores data about a hyperlink range. */ -struct HyperlinkModel : public ::oox::ole::StdHlinkInfo -{ - ::com::sun::star::table::CellRangeAddress - maRange; /// The cell area containing the hyperlink. - ::rtl::OUString maTooltip; /// Additional tooltip text. - - explicit HyperlinkModel(); -}; - -// ---------------------------------------------------------------------------- - -/** Stores data about ranges with data validation settings. */ -struct ValidationModel -{ - ApiCellRangeList maRanges; - ApiTokenSequence maTokens1; - ApiTokenSequence maTokens2; - ::rtl::OUString maInputTitle; - ::rtl::OUString maInputMessage; - ::rtl::OUString maErrorTitle; - ::rtl::OUString maErrorMessage; - sal_Int32 mnType; - sal_Int32 mnOperator; - sal_Int32 mnErrorStyle; - bool mbShowInputMsg; - bool mbShowErrorMsg; - bool mbNoDropDown; - bool mbAllowBlank; - - explicit ValidationModel(); - - /** Sets the passed BIFF validation type. */ - void setBiffType( sal_uInt8 nType ); - /** Sets the passed BIFF operator. */ - void setBiffOperator( sal_uInt8 nOperator ); - /** Sets the passed BIFF error style. */ - void setBiffErrorStyle( sal_uInt8 nErrorStyle ); -}; - -// ============================================================================ -// ============================================================================ - -class WorksheetGlobals; -typedef ::boost::shared_ptr< WorksheetGlobals > WorksheetGlobalsRef; - -class WorksheetHelper : public WorkbookHelper -{ -public: - /*implicit*/ WorksheetHelper( WorksheetGlobals& rSheetGlob ); - - static WorksheetGlobalsRef constructGlobals( - const WorkbookHelper& rHelper, - const ISegmentProgressBarRef& rxProgressBar, - WorksheetType eSheetType, - sal_Int16 nSheet ); - - // ------------------------------------------------------------------------ - - /** Returns the type of this sheet. */ - WorksheetType getSheetType() const; - /** Returns the index of the current sheet. */ - sal_Int16 getSheetIndex() const; - /** Returns the XSpreadsheet interface of the current sheet. */ - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >& - getSheet() const; - - /** Returns the XCell interface for the passed cell address. */ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > - getCell( const ::com::sun::star::table::CellAddress& rAddress ) const; - /** Returns the XCellRange interface for the passed cell range address. */ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > - getCellRange( const ::com::sun::star::table::CellRangeAddress& rRange ) const; - /** Returns the XSheetCellRanges interface for the passed cell range addresses. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > - getCellRangeList( const ApiCellRangeList& rRanges ) const; - - /** Returns the XDrawPage interface of the draw page of the current sheet. */ - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > - getDrawPage() const; - - /** Returns the absolute cell position in 1/100 mm. */ - ::com::sun::star::awt::Point getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const; - /** Returns the cell size in 1/100 mm. */ - ::com::sun::star::awt::Size getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const; - /** Returns the size of the entire drawing page in 1/100 mm. */ - ::com::sun::star::awt::Size getDrawPageSize() const; - - /** Returns the buffer for cell contents and cell formatting. */ - SheetDataBuffer& getSheetData() const; - /** Returns the conditional formatting in this sheet. */ - CondFormatBuffer& getCondFormats() const; - /** Returns the buffer for all cell comments in this sheet. */ - CommentsBuffer& getComments() const; - /** Returns the auto filters for the sheet. */ - AutoFilterBuffer& getAutoFilters() const; - /** Returns the buffer for all web query tables in this sheet. */ - QueryTableBuffer& getQueryTables() const; - /** Returns the worksheet settings object. */ - WorksheetSettings& getWorksheetSettings() const; - /** Returns the page/print settings for this sheet. */ - PageSettings& getPageSettings() const; - /** Returns the view settings for this sheet. */ - SheetViewSettings& getSheetViewSettings() const; - /** Returns the VML drawing page for this sheet (OOXML/BIFF12 only). */ - VmlDrawing& getVmlDrawing() const; - /** Returns the BIFF drawing page for this sheet (BIFF2-BIFF8 only). */ - BiffSheetDrawing& getBiffDrawing() const; - - /** Changes the current sheet type. */ - void setSheetType( WorksheetType eSheetType ); - /** Sets a column or row page break described in the passed struct. */ - void setPageBreak( const PageBreakModel& rModel, bool bRowBreak ); - /** Inserts the hyperlink URL into the spreadsheet. */ - void setHyperlink( const HyperlinkModel& rModel ); - /** Inserts the data validation settings into the spreadsheet. */ - void setValidation( const ValidationModel& rModel ); - /** Sets the passed label ranges to the current sheet. */ - void setLabelRanges( const ApiCellRangeList& rColRanges, const ApiCellRangeList& rRowRanges ); - /** Sets the path to the DrawingML fragment of this sheet. */ - void setDrawingPath( const ::rtl::OUString& rDrawingPath ); - /** Sets the path to the legacy VML drawing fragment of this sheet. */ - void setVmlDrawingPath( const ::rtl::OUString& rVmlDrawingPath ); - - /** Extends the used area of this sheet by the passed cell position. */ - void extendUsedArea( const ::com::sun::star::table::CellAddress& rAddress ); - /** Extends the used area of this sheet by the passed cell range. */ - void extendUsedArea( const ::com::sun::star::table::CellRangeAddress& rRange ); - /** Extends the shape bounding box by the position and size of the passed rectangle (in 1/100 mm). */ - void extendShapeBoundingBox( const ::com::sun::star::awt::Rectangle& rShapeRect ); - - /** Sets base width for all columns (without padding pixels). This value - is only used, if width has not been set with setDefaultColumnWidth(). */ - void setBaseColumnWidth( sal_Int32 nWidth ); - /** Sets default width for all columns. This function overrides the base - width set with the setBaseColumnWidth() function. */ - void setDefaultColumnWidth( double fWidth ); - /** Converts default cell formatting for a range of columns. */ - void setDefaultColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId ); - /** Sets column settings for a specific range of columns. - @descr Column default formatting is converted directly, other settings - are cached and converted in the finalizeWorksheetImport() call. */ - void setColumnModel( const ColumnModel& rModel ); - - /** Sets default height and hidden state for all unused rows in the sheet. */ - void setDefaultRowSettings( - double fHeight, bool bCustomHeight, - bool bHidden, bool bThickTop, bool bThickBottom ); - /** Sets row settings for a specific range of rows. - @descr Row default formatting is converted directly, other settings - are cached and converted in the finalizeWorksheetImport() call. */ - void setRowModel( const RowModel& rModel ); - /** Specifies that the passed row needs to set its height manually. */ - void setManualRowHeight( sal_Int32 nRow ); - - /** Inserts a value cell directly into the Calc sheet. */ - void putValue( - const ::com::sun::star::table::CellAddress& rAddress, - double fValue ) const; - void putFormulaResult( - const ::com::sun::star::table::CellAddress& rAddress, - double fValue ) const; - - /** Inserts a string cell directly into the Calc sheet. */ - void putString( - const ::com::sun::star::table::CellAddress& rAddress, - const ::rtl::OUString& rText ) const; - /** Inserts a rich-string cell directly into the Calc sheet. */ - void putRichString( - const ::com::sun::star::table::CellAddress& rAddress, - const RichString& rString, - const Font* pFirstPortionFont ) const; - /** Inserts a formula cell directly into the Calc sheet. */ - void putFormulaTokens( - const ::com::sun::star::table::CellAddress& rAddress, - const ApiTokenSequence& rTokens ) const; - - /** Initial conversion before importing the worksheet. */ - void initializeWorksheetImport(); - /** Final conversion after importing the worksheet. */ - void finalizeWorksheetImport(); - -private: - WorksheetGlobals& mrSheetGlob; -}; - -// ============================================================================ -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/oox/xls/worksheetsettings.hxx b/oox/inc/oox/xls/worksheetsettings.hxx deleted file mode 100644 index b733d1432d82..000000000000 --- a/oox/inc/oox/xls/worksheetsettings.hxx +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_WORKSHEETSETTINGS_HXX -#define OOX_XLS_WORKSHEETSETTINGS_HXX - -#include "oox/xls/richstring.hxx" -#include "oox/xls/worksheethelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Sheet and outline settings. */ -struct SheetSettingsModel -{ - ::rtl::OUString maCodeName; /// VBA module codename. - Color maTabColor; /// Sheet tab color. - bool mbFilterMode; /// True = sheet contains active filter. - bool mbApplyStyles; /// True = automatic styles when creating outlines. - bool mbSummaryBelow; /// True = row outline symbols below group. - bool mbSummaryRight; /// True = column outline symbols right of group. - - explicit SheetSettingsModel(); -}; - -// ============================================================================ - -/** Sheet protection settings. */ -struct SheetProtectionModel -{ - sal_uInt16 mnPasswordHash; /// Hash value from sheet protection password. - bool mbSheet; /// True = sheet protection enabled, locked cells are protcted. - bool mbObjects; /// True = objects locked. - bool mbScenarios; /// True = scenarios locked. - bool mbFormatCells; /// True = format cells locked. - bool mbFormatColumns; /// True = format columns locked. - bool mbFormatRows; /// True = format rows locked. - bool mbInsertColumns; /// True = insert columns locked. - bool mbInsertRows; /// True = insert rows locked. - bool mbInsertHyperlinks; /// True = insert hyperlinks locked. - bool mbDeleteColumns; /// True = delete columns locked. - bool mbDeleteRows; /// True = delete rows locked. - bool mbSelectLocked; /// True = select locked cells locked. - bool mbSort; /// True = sorting locked. - bool mbAutoFilter; /// True = autofilters locked. - bool mbPivotTables; /// True = pivot tables locked. - bool mbSelectUnlocked; /// True = select unlocked cells locked. - - explicit SheetProtectionModel(); -}; - -// ============================================================================ - -class WorksheetSettings : public WorksheetHelper -{ -public: - explicit WorksheetSettings( const WorksheetHelper& rHelper ); - - /** Imports sheet settings from the sheetPr element. */ - void importSheetPr( const AttributeList& rAttribs ); - /** Imports chart sheet settings from the sheetPr element. */ - void importChartSheetPr( const AttributeList& rAttribs ); - /** Imports the sheet tab color from the tabColor element. */ - void importTabColor( const AttributeList& rAttribs ); - /** Imports outline settings from the outlinePr element. */ - void importOutlinePr( const AttributeList& rAttribs ); - /** Imports protection settings from the sheetProtection element. */ - void importSheetProtection( const AttributeList& rAttribs ); - /** Imports protection settings from the sheetProtection element of a chart sheet. */ - void importChartProtection( const AttributeList& rAttribs ); - /** Imports phonetic settings from the phoneticPr element. */ - void importPhoneticPr( const AttributeList& rAttribs ); - - /** Imports sheet properties from the SHEETPR record. */ - void importSheetPr( SequenceInputStream& rStrm ); - /** Imports sheet properties from the CHARTSHEETPR record. */ - void importChartSheetPr( SequenceInputStream& rStrm ); - /** Imports sheet protection settings from the SHEETPROTECTION record. */ - void importSheetProtection( SequenceInputStream& rStrm ); - /** Imports chart sheet protection settings from the CHARTPROTECTION record. */ - void importChartProtection( SequenceInputStream& rStrm ); - /** Imports phonetic settings from the PHONETICPR record. */ - void importPhoneticPr( SequenceInputStream& rStrm ); - - /** Imports sheet properties from a SHEETEXT record. */ - void importSheetExt( BiffInputStream& rStrm ); - /** Imports sheet properties from a SHEETPR record. */ - void importSheetPr( BiffInputStream& rStrm ); - /** Imports protection status from the PROTECT record. */ - void importProtect( BiffInputStream& rStrm ); - /** Imports object protection status from the OBJECTPROTECT record. */ - void importObjectProtect( BiffInputStream& rStrm ); - /** Imports scenario protection status from the SCENPROTECT record. */ - void importScenProtect( BiffInputStream& rStrm ); - /** Imports sheet password hash from the PASSWORD record. */ - void importPassword( BiffInputStream& rStrm ); - /** Imports protection settings from the SHEETPROTECTION record. */ - void importSheetProtection( BiffInputStream& rStrm ); - /** Imports the VBA code module name from the CODENAME record. */ - void importCodeName( BiffInputStream& rStrm ); - /** Imports phonetic settings from the PHONETICPR record. */ - void importPhoneticPr( BiffInputStream& rStrm ); - - /** Converts the imported worksheet settings. */ - void finalizeImport(); - -private: - PhoneticSettings maPhoneticSett; - SheetSettingsModel maSheetSettings; - SheetProtectionModel maSheetProt; -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |