diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2011-01-12 13:29:17 +0100 |
---|---|---|
committer | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2011-01-12 13:29:17 +0100 |
commit | 97811e2bbb84b82dbc52619bc70f8ed2eba59ee7 (patch) | |
tree | 45f02699fd4564954300f38338612539e6bcb74c /oox/inc | |
parent | dr78: oox - encapsulate shape property handling in own class ShapePropertyMap (diff) | |
parent | CWS-TOOLING: integrate CWS vcl117 (diff) | |
download | core-97811e2bbb84b82dbc52619bc70f8ed2eba59ee7.tar.gz core-97811e2bbb84b82dbc52619bc70f8ed2eba59ee7.zip |
dr78: rebase to DEV300_m97
Diffstat (limited to 'oox/inc')
152 files changed, 3336 insertions, 2033 deletions
diff --git a/oox/inc/oox/core/binarycodec.hxx b/oox/inc/oox/core/binarycodec.hxx index ce57e190f088..ced63250f3e1 100644 --- a/oox/inc/oox/core/binarycodec.hxx +++ b/oox/inc/oox/core/binarycodec.hxx @@ -319,4 +319,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/binaryfilterbase.hxx b/oox/inc/oox/core/binaryfilterbase.hxx index bf249cdfab9b..4cd9cd1db62f 100644 --- a/oox/inc/oox/core/binaryfilterbase.hxx +++ b/oox/inc/oox/core/binaryfilterbase.hxx @@ -40,7 +40,8 @@ class BinaryFilterBase : public FilterBase { public: explicit BinaryFilterBase( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); virtual ~BinaryFilterBase(); @@ -59,4 +60,3 @@ typedef ::rtl::Reference< BinaryFilterBase > BinaryFilterRef; } // namespace oox #endif - diff --git a/oox/inc/oox/core/contexthandler.hxx b/oox/inc/oox/core/contexthandler.hxx index dd9ac686ff46..b1f24d051c70 100644 --- a/oox/inc/oox/core/contexthandler.hxx +++ b/oox/inc/oox/core/contexthandler.hxx @@ -28,16 +28,18 @@ #ifndef OOX_CORE_CONTEXTHANDLER_HXX #define OOX_CORE_CONTEXTHANDLER_HXX +#include <com/sun/star/xml/sax/XFastContextHandler.hpp> #include <boost/shared_ptr.hpp> -#include <rtl/ref.hxx> #include <cppuhelper/implbase1.hxx> -#include <com/sun/star/xml/sax/XFastContextHandler.hpp> +#include <rtl/ref.hxx> +#include "oox/token/namespaces.hxx" +#include "oox/token/tokens.hxx" namespace com { namespace sun { namespace star { namespace xml { namespace sax { class XLocator; } } } } } -namespace oox { class RecordInputStream; } +namespace oox { class SequenceInputStream; } namespace oox { namespace core { @@ -91,8 +93,8 @@ public: // record context interface ----------------------------------------------- - virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - virtual void startRecord( sal_Int32 nRecId, RecordInputStream& rStrm ); + virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual void endRecord( sal_Int32 nRecId ); protected: @@ -114,4 +116,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/contexthandler2.hxx b/oox/inc/oox/core/contexthandler2.hxx index 48f11c962e38..0c9ac794e94b 100644 --- a/oox/inc/oox/core/contexthandler2.hxx +++ b/oox/inc/oox/core/contexthandler2.hxx @@ -30,39 +30,43 @@ #include <vector> #include <boost/shared_ptr.hpp> -#include "tokens.hxx" #include "oox/helper/attributelist.hxx" -#include "oox/helper/recordinputstream.hxx" +#include "oox/helper/binaryinputstream.hxx" #include "oox/core/contexthandler.hxx" -#include "oox/core/namespaces.hxx" namespace oox { namespace core { // ============================================================================ -struct ContextInfo; +const sal_Int32 XML_ROOT_CONTEXT = SAL_MAX_INT32; -/** Helper class that provides a context identifier stack. +// ============================================================================ + +struct ElementInfo; + +/** Helper class that provides a context stack. Fragment handlers and context handlers derived from this helper class will - track the identifiers of the current context in a stack. The idea is to use - the same instance of a fragment handler or context handler to process + track the identifiers of the visited elements in a stack. The idea is to + use the same instance of a fragment handler or context handler to process several nested elements in an XML stream. For that, the abstract function - onCreateContext() has to return 'true' for the passed element. + onCreateContext() has to return 'this' for the passed element. Derived classes have to implement the createFastChildContext(), startFastElement(), characters(), and endFastElement() functions from the com.sun.star.xml.sax.XFastContextHandler interface by simply forwarding - them to the respective implCreateChildContext(), implStartCurrentContext(), - implCharacters(), and implEndCurrentContext() functions of this helper. The - new abstract functions have to be implemented according to the elements to - be processed. + them to the respective implCreateChildContext(), implStartElement(), + implCharacters(), and implEndElement() functions of this helper. This is + implemented already in the classes ContextHandler2 and FragmentHandler2. + The new abstract functions have to be implemented according to the elements + to be processed. Similarly, for binary import, derived classes have to forward the createRecordContext(), startRecord(), and endRecord() functions from the ContextHandler class to the implCreateRecordContext(), implStartRecord(), - and implEndRecord() functions of this helper. + and implEndRecord() functions of this helper. Again, this is implemented + already in the classes ContextHandler2 and FragmentHandler2. */ class ContextHandler2Helper { @@ -71,78 +75,97 @@ public: explicit ContextHandler2Helper( const ContextHandler2Helper& rParent ); virtual ~ContextHandler2Helper(); + // allow instances to be stored in ::rtl::Reference virtual void SAL_CALL acquire() throw() = 0; virtual void SAL_CALL release() throw() = 0; - virtual ContextHandler& queryContextHandler() = 0; - // interface -------------------------------------------------------------- - /** Will be called if a new context can be created for the passed element. + /** Will be called to create a context handler for the passed element. - Usually 'true' should be returned to improve performance by reusing the + Usually 'this' can be returned to improve performance by reusing the same instance to process several elements. Used by OOXML import only. */ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) = 0; - /** Will be called if a new context element has been started. + /** Will be called when a new element has been started. + + This function is called at the context handler returned from + onCreateContext(), or, for root elements of an XML stream, at the + fragment handler itself. - The current element identifier can be accessed by using - getCurrentContext() or isCurrentContext(). Used by OOXML import only. + The current element identifier can be accessed with getCurrentElement() + or isCurrentElement(). Used by OOXML import only. */ virtual void onStartElement( const AttributeList& rAttribs ) = 0; - /** Will be called if the current context element is about to be left. + /** Will be called before a new child element starts, or if the current + element is about to be left. - The current element identifier can be accessed by using - getCurrentContext() or isCurrentContext(). Used by OOXML import only. + This helper function collects all text fragments received by the + characters() function (such as encoded characters which are passed in + separate calls to the characters() function), and passes the + concatenated and trimmed string. - @param rChars The characters collected in this element. + The current element identifier can be accessed with getCurrentElement() + or isCurrentElement(). Used by OOXML import only. */ - virtual void onEndElement( const ::rtl::OUString& rChars ) = 0; + virtual void onCharacters( const ::rtl::OUString& rChars ) = 0; - /** Will be called if a new context can be created for the passed element. + /** Will be called when the current element is about to be left. - Usually 'true' should be returned to improve performance by reusing the - same instance to process several elements. Used by OOBIN import only. + The current element identifier can be accessed with getCurrentElement() + or isCurrentElement(). Used by OOXML import only. */ - virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ) = 0; + virtual void onEndElement() = 0; - /** Will be called if a new record in a binary stream has been started. + /** Will be called to create a context handler for the passed record. - The current record identifier can be accessed by using - getCurrentContext() or isCurrentContext(). Used by OOBIN import only. + Usually 'this' can be returned to improve performance by reusing the + same instance to process several records. Used by BIFF import only. */ - virtual void onStartRecord( RecordInputStream& rStrm ) = 0; + virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) = 0; - /** Will be called if the current context record is about to be left. + /** Will be called when a new record block in a binary stream has been + started. - The current record identifier can be accessed by using - getCurrentContext() or isCurrentContext(). Used by OOBIN import only. + The current record identifier can be accessed with getCurrentElement() + or isCurrentElement(). Used by BIFF import only. + */ + virtual void onStartRecord( SequenceInputStream& rStrm ) = 0; + + /** Will be called when the current record block is about to be left. + + The current record identifier can be accessed with getCurrentElement() + or isCurrentElement(). Used by BIFF import only. */ virtual void onEndRecord() = 0; // helpers ---------------------------------------------------------------- - /** Returns the element identifier of the current topmost context. */ + /** Returns the identifier of the currently processed element. */ sal_Int32 getCurrentElement() const; - /** Returns true, if nElement contains the current topmost context. */ + /** Returns true, if nElement contains the identifier of the currently + processed element. */ inline bool isCurrentElement( sal_Int32 nElement ) const { return getCurrentElement() == nElement; } - /** Returns true, if either nElement1 or nElement2 contain the current topmost context. */ + /** Returns true, if either nElement1 or nElement2 contain the identifier + of the currently processed element. */ inline bool isCurrentElement( sal_Int32 nElement1, sal_Int32 nElement2 ) const { return isCurrentElement( nElement1 ) || isCurrentElement( nElement2 ); } - /** Returns the element identifier of the specified parent context. */ - sal_Int32 getPreviousElement( sal_Int32 nCountBack = 1 ) const; + /** Returns the identifier of the specified parent element. */ + sal_Int32 getParentElement( sal_Int32 nCountBack = 1 ) const; - /** Returns the element identifier of the specified parent context. */ - inline sal_Int32 isPreviousElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 ) const - { return getPreviousElement( nCountBack ) == nElement; } + /** Returns true, if nElement contains the identifier of the specified + parent element. */ + inline sal_Int32 isParentElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 ) const + { return getParentElement( nCountBack ) == nElement; } - /** Returns true, if the current element is the root element. */ + /** Returns true, if the element currently processed is the root element of + the context or fragment handler. */ bool isRootElement() const; // implementation --------------------------------------------------------- @@ -155,7 +178,7 @@ protected: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ); /** Must be called from startFastElement() in derived classes. */ - void implStartCurrentContext( + void implStartElement( sal_Int32 nElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ); @@ -163,13 +186,13 @@ protected: void implCharacters( const ::rtl::OUString& rChars ); /** Must be called from endFastElement() in derived classes. */ - void implEndCurrentContext( sal_Int32 nElement ); + void implEndElement( sal_Int32 nElement ); /** Must be called from createRecordContext() in derived classes. */ - ContextHandlerRef implCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); + ContextHandlerRef implCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); /** Must be called from startRecord() in derived classes. */ - void implStartRecord( sal_Int32 nRecId, RecordInputStream& rStrm ); + void implStartRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); /** Must be called from endRecord() in derived classes. */ void implEndRecord( sal_Int32 nRecId ); @@ -177,15 +200,15 @@ protected: private: ContextHandler2Helper& operator=( const ContextHandler2Helper& ); - ContextInfo& pushContextInfo( sal_Int32 nElement ); - void popContextInfo(); - void appendCollectedChars(); + ElementInfo& pushElementInfo( sal_Int32 nElement ); + void popElementInfo(); + void processCollectedChars(); private: - typedef ::std::vector< ContextInfo > ContextStack; + typedef ::std::vector< ElementInfo > ContextStack; typedef ::boost::shared_ptr< ContextStack > ContextStackRef; - ContextStackRef mxContextStack; /// Stack of processed contexts. + ContextStackRef mxContextStack; /// Stack of all processed elements. size_t mnRootStackSize; /// Stack size on construction time. bool mbEnableTrimSpace; /// True = trim whitespace in characters(). }; @@ -202,8 +225,6 @@ public: virtual void SAL_CALL acquire() throw() { ContextHandler::acquire(); } virtual void SAL_CALL release() throw() { ContextHandler::release(); } - virtual ContextHandler& queryContextHandler(); - // com.sun.star.xml.sax.XFastContextHandler interface --------------------- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL @@ -229,18 +250,19 @@ public: // oox.core.ContextHandler interface -------------------------------------- - virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - virtual void startRecord( sal_Int32 nRecId, RecordInputStream& rStrm ); + virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual void endRecord( sal_Int32 nRecId ); // oox.core.ContextHandler2Helper interface ------------------------------- virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); virtual void onStartElement( const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); - virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - virtual void onStartRecord( RecordInputStream& rStrm ); + virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); virtual void onEndRecord(); }; @@ -250,4 +272,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/core/fastparser.hxx b/oox/inc/oox/core/fastparser.hxx new file mode 100755 index 000000000000..967c42474dcc --- /dev/null +++ b/oox/inc/oox/core/fastparser.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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_CORE_FASTPARSER_HXX +#define OOX_CORE_FASTPARSER_HXX + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/xml/sax/XFastParser.hpp> + +namespace oox { + struct NamespaceMap; + class StorageBase; +} + +namespace oox { +namespace core { + +// ============================================================================ + +/** Wrapper for a fast SAX parser that works on automatically generated OOXML + token and namespace identifiers. + */ +class FastParser +{ +public: + explicit FastParser( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ~FastParser(); + + /** Registers an OOXML namespace at the parser. */ + void registerNamespace( sal_Int32 nNamespaceId ) + throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + + /** Sets the passed document handler that will receive the SAX parser events. */ + void setDocumentHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& rxDocHandler ) + throw( ::com::sun::star::uno::RuntimeException ); + + /** Parses the passed SAX input source. + @param bCloseStream True = closes the stream in the input source after parsing. */ + void parseStream( const ::com::sun::star::xml::sax::InputSource& rInputSource, bool bCloseStream = false ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException ); + + /** Parses the passed input stream. + @param bCloseStream True = closes the passed stream after parsing. */ + void parseStream( + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream, + const ::rtl::OUString& rStreamName, bool bCloseStream = false ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException ); + + /** Parses a stream from the passed storage with the specified name. + @param bCloseStream True = closes the stream after parsing. */ + void parseStream( StorageBase& rStorage, const ::rtl::OUString& rStreamName, bool bCloseStream = false ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException ); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastParser > + mxParser; + const NamespaceMap& mrNamespaceMap; +}; + +// ============================================================================ + +} // namespace core +} // namespace oox + +#endif diff --git a/oox/inc/oox/core/fasttokenhandler.hxx b/oox/inc/oox/core/fasttokenhandler.hxx index 84baccabdc67..a6c73de9842b 100644 --- a/oox/inc/oox/core/fasttokenhandler.hxx +++ b/oox/inc/oox/core/fasttokenhandler.hxx @@ -28,8 +28,9 @@ #ifndef OOX_CORE_FASTTOKENHANDLER_HXX #define OOX_CORE_FASTTOKENHANDLER_HXX +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/xml/sax/XFastTokenHandler.hpp> -#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> namespace oox { class TokenMap; } @@ -38,15 +39,23 @@ namespace core { // ============================================================================ +typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandlerBase; + /** Wrapper implementing the com.sun.star.xml.sax.XFastTokenHandler API interface that provides access to the tokens generated from the internal token name list. */ -class FastTokenHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastTokenHandler > +class FastTokenHandler : public FastTokenHandlerBase { public: explicit FastTokenHandler(); virtual ~FastTokenHandler(); + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XFastTokenHandler virtual sal_Int32 SAL_CALL getToken( const ::rtl::OUString& rIdentifier ) throw (::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getIdentifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException); @@ -62,4 +71,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx index 9d9b8dcca515..80dc233491d4 100644 --- a/oox/inc/oox/core/filterbase.hxx +++ b/oox/inc/oox/core/filterbase.hxx @@ -29,15 +29,15 @@ #define OOX_CORE_FILTERBASE_HXX #include <memory> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/implbase5.hxx> #include "oox/helper/binarystreambase.hxx" @@ -45,16 +45,18 @@ #include "oox/dllapi.h" namespace com { namespace sun { namespace star { - namespace lang { class XMultiServiceFactory; } namespace awt { struct DeviceInfo; } - namespace frame { class XModel; } - namespace task { class XStatusIndicator; } - namespace task { class XInteractionHandler; } namespace frame { class XFrame; } + namespace frame { class XModel; } + namespace graphic { class XGraphic; } namespace io { class XInputStream; } namespace io { class XOutputStream; } namespace io { class XStream; } - namespace graphic { class XGraphic; } + namespace lang { class XMultiComponentFactory; } + namespace lang { class XMultiServiceFactory; } + namespace task { class XInteractionHandler; } + namespace task { class XStatusIndicator; } + namespace uno { class XComponentContext; } } } } namespace comphelper { @@ -69,6 +71,7 @@ namespace oox { namespace oox { namespace ole { class OleObjectHelper; + class VbaProject; } } namespace oox { @@ -90,7 +93,8 @@ class OOX_DLLPUBLIC FilterBase : public FilterBaseBase, public ::cppu::BaseMutex { public: explicit FilterBase( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); virtual ~FilterBase(); @@ -110,9 +114,17 @@ public: /** Returns the specified argument passed through the XInitialization interface. */ ::com::sun::star::uno::Any getArgument( const ::rtl::OUString& rArgName ) const; - /** Returns the global service factory passed in the filter constructor (always existing). */ + /** Returns the component context passed in the filter constructor (always existing). */ + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& + getComponentContext() const; + + /** Returns the component service factory (always existing). */ + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory >& + getComponentFactory() const; + + /** Returns the multi service factory of the component (always existing). */ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& - getGlobalFactory() const; + getServiceFactory() const; /** Returns the document model (always existing). */ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& @@ -122,7 +134,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getModelFactory() const; - /** Returns the frame that will contain the document model. */ + /** Returns the frame that will contain the document model (may be null). */ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& getTargetFrame() const; @@ -195,9 +207,13 @@ public: /** Returns a helper for the handling of OLE obejcts. */ ::oox::ole::OleObjectHelper& getOleObjectHelper() const; + /** Returns the VBA project manager. */ + ::oox::ole::VbaProject& getVbaProject() const; + /** Requests the encryption data from the media descriptor or from the user. On success, the encryption data will be inserted into the media descriptor. */ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > + requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const; /** Imports the raw binary data from the specified stream. @return True, if the data could be imported from the stream. */ @@ -272,6 +288,9 @@ private: resolving palette colors. */ virtual GraphicHelper* implCreateGraphicHelper() const; + /** Derived classes create a VBA project manager object. */ + virtual ::oox::ole::VbaProject* implCreateVbaProject() const = 0; + virtual ::rtl::OUString implGetImplementationName() const = 0; virtual StorageRef implCreateStorage( @@ -289,4 +308,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/filterdetect.hxx b/oox/inc/oox/core/filterdetect.hxx index 76e46050c24a..7eb283f5056b 100644 --- a/oox/inc/oox/core/filterdetect.hxx +++ b/oox/inc/oox/core/filterdetect.hxx @@ -38,6 +38,7 @@ namespace com { namespace sun { namespace star { namespace io { class XInputStream; } + namespace uno { class XComponentContext; } } } } namespace comphelper { class MediaDescriptor; } @@ -96,7 +97,8 @@ private: class OOX_DLLPUBLIC FilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo > { public: - explicit FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory ); + explicit FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); virtual ~FilterDetect(); /** Tries to extract an unencrypted ZIP package from the passed media @@ -149,12 +151,12 @@ public: interface of the temporary file will be stored in the 'ComponentData' property of the passed media descriptor. */ - virtual ::rtl::OUString SAL_CALL detect( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq ) + virtual ::rtl::OUString SAL_CALL + detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq ) throw( ::com::sun::star::uno::RuntimeException ); private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext; }; // ============================================================================ @@ -163,4 +165,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/fragmenthandler.hxx b/oox/inc/oox/core/fragmenthandler.hxx index 26d2ac540a7a..ba3164a74da8 100644 --- a/oox/inc/oox/core/fragmenthandler.hxx +++ b/oox/inc/oox/core/fragmenthandler.hxx @@ -134,4 +134,3 @@ typedef ::rtl::Reference< FragmentHandler > FragmentHandlerRef; } // namespace oox #endif - diff --git a/oox/inc/oox/core/fragmenthandler2.hxx b/oox/inc/oox/core/fragmenthandler2.hxx index 9b864260b853..51408005ecdd 100644 --- a/oox/inc/oox/core/fragmenthandler2.hxx +++ b/oox/inc/oox/core/fragmenthandler2.hxx @@ -49,8 +49,6 @@ public: virtual void SAL_CALL acquire() throw() { FragmentHandler::acquire(); } virtual void SAL_CALL release() throw() { FragmentHandler::release(); } - virtual ContextHandler& queryContextHandler(); - // com.sun.star.xml.sax.XFastContextHandler interface --------------------- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL @@ -86,18 +84,19 @@ public: // oox.core.ContextHandler interface -------------------------------------- - virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - virtual void startRecord( sal_Int32 nRecId, RecordInputStream& rStrm ); + virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual void endRecord( sal_Int32 nRecId ); // oox.core.ContextHandler2Helper interface ------------------------------- virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); virtual void onStartElement( const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); - virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - virtual void onStartRecord( RecordInputStream& rStrm ); + virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); virtual void onEndRecord(); // oox.core.FragmentHandler2 interface ------------------------------------ @@ -112,4 +111,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/core/recordparser.hxx b/oox/inc/oox/core/recordparser.hxx index e499195c52f8..4600be3ff832 100644 --- a/oox/inc/oox/core/recordparser.hxx +++ b/oox/inc/oox/core/recordparser.hxx @@ -29,7 +29,6 @@ #define OOX_CORE_RECORDPARSER_HXX #include <map> -#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/xml/sax/SAXException.hpp> #include <rtl/ref.hxx> @@ -95,4 +94,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/relations.hxx b/oox/inc/oox/core/relations.hxx index a7c2fbf963b6..8795960bcd9f 100644..100755 --- a/oox/inc/oox/core/relations.hxx +++ b/oox/inc/oox/core/relations.hxx @@ -35,14 +35,21 @@ namespace oox { namespace core { -/** Expands to an OUString containing an officeDocument relation type created +// ============================================================================ + +/** Expands to an OUString containing an 'officeDocument' relation type created from the passed literal(!) ASCII(!) character array. */ -#define CREATE_OFFICEDOC_RELATIONSTYPE( ascii ) \ +#define CREATE_OFFICEDOC_RELATION_TYPE( ascii ) \ CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii ) +/** Expands to an OUString containing a 'package' relation type created from + the passed literal(!) ASCII(!) character array. */ +#define CREATE_PACKAGE_RELATION_TYPE( ascii ) \ + CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships/" ascii ) + /** Expands to an OUString containing an MS Office specific relation type created from the passed literal(!) ASCII(!) character array. */ -#define CREATE_MSOFFICE_RELATIONSTYPE( ascii ) \ +#define CREATE_MSOFFICE_RELATION_TYPE( ascii ) \ CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/relationships/" ascii ) // ============================================================================ @@ -99,4 +106,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/relationshandler.hxx b/oox/inc/oox/core/relationshandler.hxx index b3dbe7557d72..e8191bdddb47 100644 --- a/oox/inc/oox/core/relationshandler.hxx +++ b/oox/inc/oox/core/relationshandler.hxx @@ -58,4 +58,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/xmlfilterbase.hxx b/oox/inc/oox/core/xmlfilterbase.hxx index 30efeb0e9440..11d2d488c8b6 100644 --- a/oox/inc/oox/core/xmlfilterbase.hxx +++ b/oox/inc/oox/core/xmlfilterbase.hxx @@ -28,16 +28,16 @@ #ifndef OOX_CORE_XMLFILTERBASE_HXX #define OOX_CORE_XMLFILTERBASE_HXX +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/text/XTextField.hpp> #include <rtl/ref.hxx> #include <rtl/string.hxx> #include <rtl/ustring.hxx> -#include "oox/drawingml/table/tablestylelist.hxx" #include "oox/core/filterbase.hxx" #include "oox/core/relations.hxx" -#include <oox/dllapi.h> -#include <com/sun/star/text/XTextField.hpp> -#include <com/sun/star/text/XTextCursor.hpp> -#include <com/sun/star/text/XText.hpp> +#include "oox/drawingml/table/tablestylelist.hxx" +#include "oox/dllapi.h" namespace com { namespace sun { namespace star { namespace container { class XNameContainer; } @@ -46,9 +46,11 @@ namespace com { namespace sun { namespace star { namespace xml { namespace sax { class XFastDocumentHandler; } } } } } -namespace oox { namespace drawingml { class Theme; } } -namespace oox { namespace drawingml { namespace chart { class ChartConverter; } } } -namespace oox { namespace vml { class Drawing; } } +namespace oox { + namespace drawingml { class Theme; } + namespace drawingml { namespace chart { class ChartConverter; } } + namespace vml { class Drawing; } +} namespace sax_fastparser { class FastSerializerHelper; @@ -61,6 +63,8 @@ namespace core { class FragmentHandler; +// ============================================================================ + struct TextField { com::sun::star::uno::Reference< com::sun::star::text::XText > xText; com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > xTextCursor; @@ -76,7 +80,8 @@ class OOX_DLLPUBLIC XmlFilterBase : public FilterBase { public: explicit XmlFilterBase( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); virtual ~XmlFilterBase(); @@ -222,4 +227,3 @@ typedef ::rtl::Reference< XmlFilterBase > XmlFilterRef; } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/axiscontext.hxx b/oox/inc/oox/drawingml/chart/axiscontext.hxx index b80dd2e6f9ef..13c550e881d4 100644 --- a/oox/inc/oox/drawingml/chart/axiscontext.hxx +++ b/oox/inc/oox/drawingml/chart/axiscontext.hxx @@ -124,4 +124,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/axisconverter.hxx b/oox/inc/oox/drawingml/chart/axisconverter.hxx index 925fa1fe8b4f..9e083f69d253 100644 --- a/oox/inc/oox/drawingml/chart/axisconverter.hxx +++ b/oox/inc/oox/drawingml/chart/axisconverter.hxx @@ -68,4 +68,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/axismodel.hxx b/oox/inc/oox/drawingml/chart/axismodel.hxx index 8bab84257eee..23dc96037427 100644 --- a/oox/inc/oox/drawingml/chart/axismodel.hxx +++ b/oox/inc/oox/drawingml/chart/axismodel.hxx @@ -109,4 +109,3 @@ struct AxisModel } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx index f034b4b6e6bb..76ddeafddb80 100644 --- a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx +++ b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx @@ -99,4 +99,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/chartconverter.hxx b/oox/inc/oox/drawingml/chart/chartconverter.hxx index f9d10388ce13..de8572ab168b 100644 --- a/oox/inc/oox/drawingml/chart/chartconverter.hxx +++ b/oox/inc/oox/drawingml/chart/chartconverter.hxx @@ -108,4 +108,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx index b685664ad612..9b495c72365a 100644 --- a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx +++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx @@ -100,7 +100,8 @@ public: virtual ~ChartDrawingFragment(); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); private: ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > @@ -118,4 +119,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx index b4c40015f825..91e622552aa7 100644 --- a/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx +++ b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx @@ -61,4 +61,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/chartspacefragment.hxx b/oox/inc/oox/drawingml/chart/chartspacefragment.hxx index 898bc2ea15e8..e51c1c1fcc1b 100644 --- a/oox/inc/oox/drawingml/chart/chartspacefragment.hxx +++ b/oox/inc/oox/drawingml/chart/chartspacefragment.hxx @@ -59,4 +59,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/chartspacemodel.hxx b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx index ddfa57fb919c..37c39e315e3e 100644 --- a/oox/inc/oox/drawingml/chart/chartspacemodel.hxx +++ b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx @@ -75,4 +75,3 @@ struct ChartSpaceModel } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx index c937c6e94900..aec646d4c610 100644 --- a/oox/inc/oox/drawingml/chart/converterbase.hxx +++ b/oox/inc/oox/drawingml/chart/converterbase.hxx @@ -155,4 +155,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/datasourcecontext.hxx b/oox/inc/oox/drawingml/chart/datasourcecontext.hxx index 9b832a0209ab..1cffa32e382a 100644 --- a/oox/inc/oox/drawingml/chart/datasourcecontext.hxx +++ b/oox/inc/oox/drawingml/chart/datasourcecontext.hxx @@ -51,7 +51,7 @@ public: virtual ~DoubleSequenceContext(); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); private: sal_Int32 mnPtIndex; /// Current data point index. @@ -69,7 +69,7 @@ public: virtual ~StringSequenceContext(); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); private: sal_Int32 mnPtIndex; /// Current data point index. @@ -98,4 +98,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/datasourceconverter.hxx b/oox/inc/oox/drawingml/chart/datasourceconverter.hxx index 7cdd6ab4a175..9d16f4e85882 100644 --- a/oox/inc/oox/drawingml/chart/datasourceconverter.hxx +++ b/oox/inc/oox/drawingml/chart/datasourceconverter.hxx @@ -75,4 +75,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/datasourcemodel.hxx b/oox/inc/oox/drawingml/chart/datasourcemodel.hxx index 3de2278e5a71..04e79b831049 100644 --- a/oox/inc/oox/drawingml/chart/datasourcemodel.hxx +++ b/oox/inc/oox/drawingml/chart/datasourcemodel.hxx @@ -69,4 +69,3 @@ struct DataSourceModel } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/modelbase.hxx b/oox/inc/oox/drawingml/chart/modelbase.hxx index d34970025abd..278a8af9fed3 100644 --- a/oox/inc/oox/drawingml/chart/modelbase.hxx +++ b/oox/inc/oox/drawingml/chart/modelbase.hxx @@ -28,9 +28,9 @@ #ifndef OOX_DRAWINGML_CHART_MODELBASE_HXX #define OOX_DRAWINGML_CHART_MODELBASE_HXX -#include "oox/helper/containerhelper.hxx" #include "oox/helper/helper.hxx" -#include "tokens.hxx" +#include "oox/helper/refmap.hxx" +#include "oox/helper/refvector.hxx" namespace oox { class AttributeList; } @@ -138,4 +138,3 @@ struct LayoutModel } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/objectformatter.hxx b/oox/inc/oox/drawingml/chart/objectformatter.hxx index 9f83a6bc0391..c35cd66f65e1 100644 --- a/oox/inc/oox/drawingml/chart/objectformatter.hxx +++ b/oox/inc/oox/drawingml/chart/objectformatter.hxx @@ -28,7 +28,6 @@ #ifndef OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX #define OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX -#include "oox/helper/containerhelper.hxx" #include "oox/helper/propertyset.hxx" #include "oox/drawingml/drawingmltypes.hxx" #include "oox/drawingml/chart/modelbase.hxx" @@ -170,4 +169,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/plotareacontext.hxx b/oox/inc/oox/drawingml/chart/plotareacontext.hxx index 75ebed545956..5d3358c1147c 100644 --- a/oox/inc/oox/drawingml/chart/plotareacontext.hxx +++ b/oox/inc/oox/drawingml/chart/plotareacontext.hxx @@ -87,4 +87,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/plotareaconverter.hxx b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx index e35afb633b92..9089c0180024 100644 --- a/oox/inc/oox/drawingml/chart/plotareaconverter.hxx +++ b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx @@ -107,4 +107,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/plotareamodel.hxx b/oox/inc/oox/drawingml/chart/plotareamodel.hxx index c5793717defc..ef29a72f4b09 100644 --- a/oox/inc/oox/drawingml/chart/plotareamodel.hxx +++ b/oox/inc/oox/drawingml/chart/plotareamodel.hxx @@ -91,4 +91,3 @@ struct PlotAreaModel } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/seriescontext.hxx b/oox/inc/oox/drawingml/chart/seriescontext.hxx index 024e9754781c..ef50bc94866c 100644 --- a/oox/inc/oox/drawingml/chart/seriescontext.hxx +++ b/oox/inc/oox/drawingml/chart/seriescontext.hxx @@ -47,7 +47,7 @@ public: virtual ~DataLabelContext(); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); }; // ============================================================================ @@ -63,7 +63,7 @@ public: virtual ~DataLabelsContext(); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); }; // ============================================================================ @@ -124,7 +124,7 @@ public: virtual ~TrendlineContext(); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); }; // ============================================================================ @@ -270,4 +270,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/seriesconverter.hxx b/oox/inc/oox/drawingml/chart/seriesconverter.hxx index fd3ca207d7c0..6874298487d4 100644 --- a/oox/inc/oox/drawingml/chart/seriesconverter.hxx +++ b/oox/inc/oox/drawingml/chart/seriesconverter.hxx @@ -171,4 +171,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/seriesmodel.hxx b/oox/inc/oox/drawingml/chart/seriesmodel.hxx index 2b72eb0f2bcf..d4b9ab3c9715 100644 --- a/oox/inc/oox/drawingml/chart/seriesmodel.hxx +++ b/oox/inc/oox/drawingml/chart/seriesmodel.hxx @@ -241,4 +241,3 @@ struct SeriesModel } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/titlecontext.hxx b/oox/inc/oox/drawingml/chart/titlecontext.hxx index b3fec5d93203..45969bf150c2 100644 --- a/oox/inc/oox/drawingml/chart/titlecontext.hxx +++ b/oox/inc/oox/drawingml/chart/titlecontext.hxx @@ -47,7 +47,7 @@ public: virtual ~TextContext(); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); }; // ============================================================================ @@ -87,4 +87,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/titleconverter.hxx b/oox/inc/oox/drawingml/chart/titleconverter.hxx index d153e9f3e760..2a452ae6c96b 100644 --- a/oox/inc/oox/drawingml/chart/titleconverter.hxx +++ b/oox/inc/oox/drawingml/chart/titleconverter.hxx @@ -110,4 +110,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/titlemodel.hxx b/oox/inc/oox/drawingml/chart/titlemodel.hxx index f80837249809..fc47d684c6dc 100644 --- a/oox/inc/oox/drawingml/chart/titlemodel.hxx +++ b/oox/inc/oox/drawingml/chart/titlemodel.hxx @@ -93,4 +93,3 @@ struct LegendModel } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/typegroupcontext.hxx b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx index aa5f2a47c4a0..d58cb7e1c4f7 100644 --- a/oox/inc/oox/drawingml/chart/typegroupcontext.hxx +++ b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx @@ -168,4 +168,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/typegroupconverter.hxx b/oox/inc/oox/drawingml/chart/typegroupconverter.hxx index 46018696baef..58375a4c2b1f 100644 --- a/oox/inc/oox/drawingml/chart/typegroupconverter.hxx +++ b/oox/inc/oox/drawingml/chart/typegroupconverter.hxx @@ -202,4 +202,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/typegroupmodel.hxx b/oox/inc/oox/drawingml/chart/typegroupmodel.hxx index b51b8e5d4a7c..9af01210d585 100644 --- a/oox/inc/oox/drawingml/chart/typegroupmodel.hxx +++ b/oox/inc/oox/drawingml/chart/typegroupmodel.hxx @@ -100,4 +100,3 @@ struct TypeGroupModel } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/clrscheme.hxx b/oox/inc/oox/drawingml/clrscheme.hxx index 22eab1a892a1..5f13f54b705d 100644 --- a/oox/inc/oox/drawingml/clrscheme.hxx +++ b/oox/inc/oox/drawingml/clrscheme.hxx @@ -31,7 +31,6 @@ #include <boost/shared_ptr.hpp> #include <map> #include <vector> -#include "oox/core/namespaces.hxx" #include "oox/drawingml/color.hxx" namespace oox { namespace drawingml { diff --git a/oox/inc/oox/drawingml/customshapeproperties.hxx b/oox/inc/oox/drawingml/customshapeproperties.hxx index 282e0c6009b5..985507d22265 100644 --- a/oox/inc/oox/drawingml/customshapeproperties.hxx +++ b/oox/inc/oox/drawingml/customshapeproperties.hxx @@ -28,13 +28,7 @@ #ifndef OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX #define OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX -#include "oox/helper/propertymap.hxx" -#include "oox/drawingml/color.hxx" -#include "oox/core/xmlfilterbase.hxx" -#include <com/sun/star/graphic/XGraphic.hpp> #include <boost/shared_ptr.hpp> -#include "oox/helper/helper.hxx" -#include "tokens.hxx" #include <vector> #include <map> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> @@ -45,11 +39,15 @@ #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp> -#ifndef __com_sun_star_beans_PropertyValues_hpp__ #include <com/sun/star/beans/PropertyValues.hpp> -#endif #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include "oox/core/xmlfilterbase.hxx" +#include "oox/drawingml/color.hxx" +#include "oox/helper/helper.hxx" +#include "oox/helper/propertymap.hxx" +#include "oox/token/tokens.hxx" namespace oox { namespace drawingml { diff --git a/oox/inc/oox/drawingml/graphicshapecontext.hxx b/oox/inc/oox/drawingml/graphicshapecontext.hxx index d515a4553936..5f27efdf15e7 100644 --- a/oox/inc/oox/drawingml/graphicshapecontext.hxx +++ b/oox/inc/oox/drawingml/graphicshapecontext.hxx @@ -68,7 +68,7 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); private: - ::boost::shared_ptr< ::oox::vml::OleObjectInfo > mxOleObjectInfo; + ::oox::vml::OleObjectInfo& mrOleObjectInfo; }; // ==================================================================== @@ -106,7 +106,7 @@ public: throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); private: - bool mbEmbedShapes; + ChartShapeInfo& mrChartShapeInfo; }; // ==================================================================== diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx index d6cab48f6bb5..2114f8d9cf02 100644 --- a/oox/inc/oox/drawingml/shape.hxx +++ b/oox/inc/oox/drawingml/shape.hxx @@ -40,6 +40,10 @@ #include <vector> #include <map> +namespace oox { namespace vml { + struct OleObjectInfo; +} } + namespace oox { namespace drawingml { class CustomShapeProperties; @@ -57,37 +61,15 @@ typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap; // ============================================================================ -/** A callback that will be called before and after the API shape is created - from the imported shape. - - An instance of a derived class of this callback can be set at every - ::oox::drawingml::Shape instance to implement anything that needs a created - and inserted XShape. - */ -class CreateShapeCallback +/** Additional information for a chart embedded in a drawing shape. */ +struct ChartShapeInfo { -public: - virtual ::rtl::OUString onCreateXShape( - const ::rtl::OUString& rServiceName, - const ::com::sun::star::awt::Rectangle& rShapeRect ); + ::rtl::OUString maFragmentPath; /// Path to related XML stream, e.g. for charts. + bool mbEmbedShapes; /// True = load chart shapes into chart, false = load into parent drawpage. - virtual void onXShapeCreated( - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ) const; - - inline const PropertyMap& getShapeProperties() const { return maShapeProps; } - -protected: - explicit CreateShapeCallback( ::oox::core::XmlFilterBase& rFilter ); - virtual ~CreateShapeCallback(); - -protected: - ::oox::core::XmlFilterBase& mrFilter; - PropertyMap maShapeProps; + inline explicit ChartShapeInfo( bool bEmbedShapes ) : mbEmbedShapes( bEmbedShapes ) {} }; -typedef ::boost::shared_ptr< CreateShapeCallback > CreateShapeCallbackRef; - // ============================================================================ class Shape @@ -95,7 +77,7 @@ class Shape { public: - Shape( const sal_Char* pServiceType = NULL ); + explicit Shape( const sal_Char* pServiceType = 0 ); virtual ~Shape(); rtl::OUString& getServiceName(){ return msServiceName; } @@ -136,6 +118,11 @@ public: // setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value) void setDefaults(); + ::oox::vml::OleObjectInfo& setOleObjectType(); + ChartShapeInfo& setChartType( bool bEmbedShapes ); + void setDiagramType(); + void setTableType(); + void setTextBody(const TextBodyPtr & pTextBody); TextBodyPtr getTextBody(); void setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle ); @@ -145,11 +132,9 @@ public: inline const ShapeStyleRefMap& getShapeStyleRefs() const { return maShapeStyleRefs; } const ShapeStyleRef* getShapeStyleRef( sal_Int32 nRefType ) const; - inline void setCreateShapeCallback( CreateShapeCallbackRef xCallback ) { mxCreateCallback = xCallback; } - // addShape is creating and inserting the corresponding XShape. void addShape( - const oox::core::XmlFilterBase& rFilterBase, + ::oox::core::XmlFilterBase& rFilterBase, const Theme* pTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, const ::com::sun::star::awt::Rectangle* pShapeRect = 0, @@ -166,7 +151,7 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > createAndInsert( - const ::oox::core::XmlFilterBase& rFilterBase, + ::oox::core::XmlFilterBase& rFilterBase, const ::rtl::OUString& rServiceName, const Theme* pTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, @@ -174,13 +159,22 @@ protected: sal_Bool bClearText ); void addChildren( - const ::oox::core::XmlFilterBase& rFilterBase, + ::oox::core::XmlFilterBase& rFilterBase, Shape& rMaster, const Theme* pTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, const ::com::sun::star::awt::Rectangle& rClientRect, ShapeIdMap* pShapeMap ); + virtual ::rtl::OUString finalizeServiceName( + ::oox::core::XmlFilterBase& rFilter, + const ::rtl::OUString& rServiceName, + const ::com::sun::star::awt::Rectangle& rShapeRect ); + + virtual void finalizeXShape( + ::oox::core::XmlFilterBase& rFilter, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ); + std::vector< ShapePtr > maChildren; // only used for group shapes TextBodyPtr mpTextBody; LinePropertiesPtr mpLinePropertiesPtr; @@ -204,7 +198,22 @@ protected: com::sun::star::awt::Point maPosition; private: - CreateShapeCallbackRef mxCreateCallback; + enum FrameType + { + FRAMETYPE_GENERIC, /// Generic shape, no special type. + FRAMETYPE_OLEOBJECT, /// OLE object embedded in a shape. + FRAMETYPE_CHART, /// Chart embedded in a shape. + FRAMETYPE_DIAGRAM, /// Complex diagram drawing shape. + FRAMETYPE_TABLE /// A table embedded in a shape. + }; + + typedef ::boost::shared_ptr< ::oox::vml::OleObjectInfo > OleObjectInfoRef; + typedef ::boost::shared_ptr< ChartShapeInfo > ChartShapeInfoRef; + + FrameType meFrameType; /// Type for graphic frame shapes. + OleObjectInfoRef mxOleObjectInfo; /// Additional data for OLE objects. + ChartShapeInfoRef mxChartShapeInfo; /// Additional data for chart shapes. + sal_Int32 mnRotation; sal_Bool mbFlipH; sal_Bool mbFlipV; @@ -213,6 +222,8 @@ private: ::rtl::OUString GetShapeType( sal_Int32 nType ); +// ============================================================================ + } } #endif // OOX_DRAWINGML_SHAPE_HXX diff --git a/oox/inc/oox/drawingml/textbody.hxx b/oox/inc/oox/drawingml/textbody.hxx index a2eb6106e651..ce747c62bdbb 100644 --- a/oox/inc/oox/drawingml/textbody.hxx +++ b/oox/inc/oox/drawingml/textbody.hxx @@ -28,7 +28,6 @@ #ifndef OOX_DRAWINGML_TEXTBODY_HXX #define OOX_DRAWINGML_TEXTBODY_HXX -#include "oox/helper/containerhelper.hxx" #include "oox/drawingml/textbodyproperties.hxx" #include "oox/drawingml/textliststyle.hxx" diff --git a/oox/inc/oox/drawingml/textliststyle.hxx b/oox/inc/oox/drawingml/textliststyle.hxx index 1a8fca45bf25..cafcc951504b 100644 --- a/oox/inc/oox/drawingml/textliststyle.hxx +++ b/oox/inc/oox/drawingml/textliststyle.hxx @@ -28,8 +28,8 @@ #ifndef OOX_DRAWINGML_TEXTLISTSTYLE_HXX #define OOX_DRAWINGML_TEXTLISTSTYLE_HXX -#include "oox/helper/containerhelper.hxx" #include "oox/drawingml/textparagraphproperties.hxx" +#include "oox/helper/refvector.hxx" namespace oox { namespace drawingml { @@ -50,10 +50,6 @@ public: inline const TextParagraphPropertiesVector& getAggregationListStyle() const { return maAggregationListStyle; }; inline TextParagraphPropertiesVector& getAggregationListStyle() { return maAggregationListStyle; }; -#if OSL_DEBUG_LEVEL > 0 - void dump( int nLevels=9 ); -#endif - protected: TextParagraphPropertiesVector maListStyle; diff --git a/oox/inc/oox/drawingml/textparagraph.hxx b/oox/inc/oox/drawingml/textparagraph.hxx index d8c97cbfa114..c059edc73f43 100644 --- a/oox/inc/oox/drawingml/textparagraph.hxx +++ b/oox/inc/oox/drawingml/textparagraph.hxx @@ -31,7 +31,6 @@ #include <com/sun/star/text/XTextCursor.hpp> #include <com/sun/star/text/XText.hpp> -#include "oox/helper/containerhelper.hxx" #include "oox/core/xmlfilterbase.hxx" #include "oox/drawingml/textrun.hxx" #include "oox/drawingml/textliststyle.hxx" diff --git a/oox/inc/oox/drawingml/textparagraphproperties.hxx b/oox/inc/oox/drawingml/textparagraphproperties.hxx index 310df83212a0..ef80af2d1c11 100644 --- a/oox/inc/oox/drawingml/textparagraphproperties.hxx +++ b/oox/inc/oox/drawingml/textparagraphproperties.hxx @@ -112,10 +112,6 @@ public: size can be zero and the default value is returned. */ float getCharHeightPoints( float fDefault ) const; -#if OSL_DEBUG_LEVEL > 0 - void dump() { maTextParagraphPropertyMap.dump(); OSL_TRACE("character height: %f", maTextCharacterProperties.getCharHeightPoints(-1)); } -#endif - protected: TextCharacterProperties maTextCharacterProperties; diff --git a/oox/inc/oox/drawingml/theme.hxx b/oox/inc/oox/drawingml/theme.hxx index 15f5ce82ce12..7f982a1eec71 100644 --- a/oox/inc/oox/drawingml/theme.hxx +++ b/oox/inc/oox/drawingml/theme.hxx @@ -28,7 +28,6 @@ #ifndef OOX_DRAWINGML_THEME_HXX #define OOX_DRAWINGML_THEME_HXX -#include "oox/helper/containerhelper.hxx" #include "oox/drawingml/clrscheme.hxx" #include "oox/drawingml/shape.hxx" #include "oox/drawingml/textfont.hxx" diff --git a/oox/inc/oox/dump/biffdumper.hxx b/oox/inc/oox/dump/biffdumper.hxx index e3e712a52a25..a3bdc4a87c73 100644 --- a/oox/inc/oox/dump/biffdumper.hxx +++ b/oox/inc/oox/dump/biffdumper.hxx @@ -190,6 +190,9 @@ protected: ::oox::xls::BiffStringFlags nUniFlags = ::oox::xls::BIFF_STR_DEFAULT, rtl_TextEncoding eDefaultTextEnc = RTL_TEXTENCODING_DONTKNOW ); + ::rtl::OUString dumpSegmentedUniString( const String& rName ); + void dumpSegmentedUniStringArray( const String& rName ); + sal_uInt8 dumpBoolean( const String& rName = EMPTY_STRING ); sal_uInt8 dumpErrorCode( const String& rName = EMPTY_STRING ); @@ -440,6 +443,8 @@ private: void dumpExtCfColor( const String& rName = EMPTY_STRING ); void dumpExtGradientHead(); + sal_uInt8 dumpFilterColumnOperator( const String& rName ); + ::rtl::OUString dumpPivotString( const String& rName, sal_uInt16 nStrLen ); ::rtl::OUString dumpPivotString( const String& rName ); diff --git a/oox/inc/oox/dump/oledumper.hxx b/oox/inc/oox/dump/oledumper.hxx index a0e9cd55e337..8f706f4c40f1 100644 --- a/oox/inc/oox/dump/oledumper.hxx +++ b/oox/inc/oox/dump/oledumper.hxx @@ -141,15 +141,19 @@ private: void dumpCodePageProperty( sal_uInt32 nStartPos ); void dumpDictionaryProperty( sal_uInt32 nStartPos ); - void dumpPropertyContents( sal_Int32 nPropId ); - void dumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType ); + sal_uInt16 dumpPropertyContents( sal_Int32 nPropId ); + void dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType ); + void dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType ); + void dumpPropertyArray( sal_Int32 nPropId, sal_uInt16 nBaseType ); - sal_Int32 dumpPropertyType(); - void dumpBlob( const String& rName ); + sal_uInt16 dumpPropertyType(); + void dumpBlob( sal_Int32 nPropId, const String& rName ); ::rtl::OUString dumpString8( const String& rName ); ::rtl::OUString dumpCharArray8( const String& rName, sal_Int32 nLen ); ::rtl::OUString dumpString16( const String& rName ); ::rtl::OUString dumpCharArray16( const String& rName, sal_Int32 nLen ); + bool dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType ); + void dumpHlinks( sal_Int32 nSize ); bool startElement( sal_uInt32 nStartPos ); void writeSectionHeader( const ::rtl::OUString& rGuid, sal_uInt32 nStartPos ); diff --git a/oox/inc/oox/dump/xlsbdumper.hxx b/oox/inc/oox/dump/xlsbdumper.hxx index 345202f67a4a..6fa1c9bd7e45 100644 --- a/oox/inc/oox/dump/xlsbdumper.hxx +++ b/oox/inc/oox/dump/xlsbdumper.hxx @@ -29,7 +29,6 @@ #define OOX_DUMP_XLSBDUMPER_HXX #include "oox/dump/dumperbase.hxx" -#include "oox/helper/recordinputstream.hxx" #if OOX_INCLUDE_DUMPER @@ -96,9 +95,9 @@ private: bool readCompressedInt( BinaryInputStream& rStrm, sal_Int32& ornValue ); private: - typedef ::boost::shared_ptr< RecordInputStream > RecordInputStreamRef; + typedef ::boost::shared_ptr< SequenceInputStream > SequenceInputStreamRef; - RecordInputStreamRef mxBiffStrm; + SequenceInputStreamRef mxBiffStrm; NameListRef mxErrCodes; }; diff --git a/oox/inc/oox/helper/attributelist.hxx b/oox/inc/oox/helper/attributelist.hxx index 631d7ec4b66e..87e21e553c2d 100644 --- a/oox/inc/oox/helper/attributelist.hxx +++ b/oox/inc/oox/helper/attributelist.hxx @@ -31,7 +31,8 @@ #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/xml/sax/XFastAttributeList.hpp> #include "oox/helper/helper.hxx" -#include "tokens.hxx" +#include "oox/token/namespaces.hxx" +#include "oox/token/tokens.hxx" namespace oox { @@ -43,6 +44,9 @@ namespace oox { class AttributeConversion { public: + /** Returns the XML token identifier from the passed string. */ + static sal_Int32 decodeToken( const ::rtl::OUString& rValue ); + /** Returns the decoded string value. All characters in the format '_xHHHH_' (H being a hexadecimal digit), will be decoded. */ static ::rtl::OUString decodeXString( const ::rtl::OUString& rValue ); @@ -189,4 +193,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/helper/binaryinputstream.hxx b/oox/inc/oox/helper/binaryinputstream.hxx index 8f58e2de4d9e..52a3a4de9f0f 100644 --- a/oox/inc/oox/helper/binaryinputstream.hxx +++ b/oox/inc/oox/helper/binaryinputstream.hxx @@ -288,4 +288,3 @@ typedef ::boost::shared_ptr< RelativeInputStream > RelativeInputStreamRef; } // namespace oox #endif - diff --git a/oox/inc/oox/helper/binaryoutputstream.hxx b/oox/inc/oox/helper/binaryoutputstream.hxx index d2f0f8b36ffa..e24777c4f296 100644 --- a/oox/inc/oox/helper/binaryoutputstream.hxx +++ b/oox/inc/oox/helper/binaryoutputstream.hxx @@ -158,4 +158,3 @@ typedef ::boost::shared_ptr< SequenceOutputStream > SequenceOutputStreamRef; } // namespace oox #endif - diff --git a/oox/inc/oox/helper/binarystreambase.hxx b/oox/inc/oox/helper/binarystreambase.hxx index abe4c5f1c274..ba0f34b21f40 100644 --- a/oox/inc/oox/helper/binarystreambase.hxx +++ b/oox/inc/oox/helper/binarystreambase.hxx @@ -144,4 +144,3 @@ protected: } // namespace oox #endif - diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx index f4f3717eac3f..96b9feeffe07 100644 --- a/oox/inc/oox/helper/containerhelper.hxx +++ b/oox/inc/oox/helper/containerhelper.hxx @@ -30,8 +30,6 @@ #include <vector> #include <map> -#include <boost/shared_ptr.hpp> -#include <boost/bind.hpp> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Sequence.h> @@ -49,304 +47,6 @@ namespace oox { // ============================================================================ -/** Template for a vector of ref-counted objects with additional accessor functions. - - An instance of the class RefVector< Type > stores elements of the type - ::boost::shared_ptr< Type >. The new accessor functions has() and get() - work correctly for indexes out of the current range, there is no need to - check the passed index before. - */ -template< typename ObjType > -class RefVector : public ::std::vector< ::boost::shared_ptr< ObjType > > -{ -public: - typedef ::std::vector< ::boost::shared_ptr< ObjType > > container_type; - typedef typename container_type::value_type value_type; - typedef typename container_type::size_type size_type; - -public: - /** Returns true, if the object with the passed index exists. Returns - false, if the vector element exists but is an empty reference. */ - inline bool has( sal_Int32 nIndex ) const - { - const value_type* pxRef = getRef( nIndex ); - return pxRef && pxRef->get(); - } - - /** Returns a reference to the object with the passed index, or 0 on error. */ - inline value_type get( sal_Int32 nIndex ) const - { - if( const value_type* pxRef = getRef( nIndex ) ) return *pxRef; - return value_type(); - } - - /** Returns the index of the last element, or -1, if the vector is empty. - Does *not* check whether the last element is an empty reference. */ - inline sal_Int32 getLastIndex() const { return static_cast< sal_Int32 >( this->size() ) - 1; } - - /** Calls the passed functor for every contained object, automatically - skips all elements that are empty references. */ - template< typename FunctorType > - inline void forEach( FunctorType aFunctor ) const - { - ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType > - inline void forEachMem( FuncType pFunc ) const - { - forEach( ::boost::bind( pFunc, _1 ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType > - inline void forEachMem( FuncType pFunc, ParamType aParam ) const - { - forEach( ::boost::bind( pFunc, _1, aParam ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType1, typename ParamType2 > - inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const - { - forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > - inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const - { - forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) ); - } - - /** Calls the passed functor for every contained object. Passes the index as - first argument and the object reference as second argument to rFunctor. */ - template< typename FunctorType > - inline void forEachWithIndex( const FunctorType& rFunctor ) const - { - ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the vector index to the member function. */ - template< typename FuncType > - inline void forEachMemWithIndex( FuncType pFunc ) const - { - forEachWithIndex( ::boost::bind( pFunc, _2, _1 ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the vector index as first argument to the member function. */ - template< typename FuncType, typename ParamType > - inline void forEachMemWithIndex( FuncType pFunc, ParamType aParam ) const - { - forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the vector index as first argument to the member function. */ - template< typename FuncType, typename ParamType1, typename ParamType2 > - inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const - { - forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the vector index as first argument to the member function. */ - template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > - inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const - { - forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) ); - } - - /** Searches for an element by using the passed functor that takes a - constant reference of the object type (const ObjType&). */ - template< typename FunctorType > - inline value_type findIf( const FunctorType& rFunctor ) const - { - typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) ); - return (aIt == this->end()) ? value_type() : *aIt; - } - -private: - template< typename FunctorType > - struct ForEachFunctor - { - FunctorType maFunctor; - inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} - inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); } - }; - - template< typename FunctorType > - struct ForEachFunctorWithIndex - { - FunctorType maFunctor; - sal_Int32 mnIndex; - inline explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {} - inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( mnIndex, *rxValue ); ++mnIndex; } - }; - - template< typename FunctorType > - struct FindFunctor - { - FunctorType maFunctor; - inline explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} - inline bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); } - }; - - inline const value_type* getRef( sal_Int32 nIndex ) const - { - return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ? - &(*this)[ static_cast< size_type >( nIndex ) ] : 0; - } -}; - -// ============================================================================ - -/** Template for a map of ref-counted objects with additional accessor functions. - - An instance of the class RefMap< Type > stores elements of the type - ::boost::shared_ptr< Type >. The new accessor functions has() and get() - work correctly for nonexisting keys, there is no need to check the passed - key before. - */ -template< typename KeyType, typename ObjType, typename CompType = ::std::less< KeyType > > -class RefMap : public ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > -{ -public: - typedef ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > container_type; - typedef typename container_type::key_type key_type; - typedef typename container_type::mapped_type mapped_type; - typedef typename container_type::value_type value_type; - typedef typename container_type::key_compare key_compare; - -public: - /** Returns true, if the object accossiated to the passed key exists. - Returns false, if the key exists but points to an empty reference. */ - inline bool has( key_type nKey ) const - { - const mapped_type* pxRef = getRef( nKey ); - return pxRef && pxRef->get(); - } - - /** Returns a reference to the object accossiated to the passed key, or an - empty reference on error. */ - inline mapped_type get( key_type nKey ) const - { - if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef; - return mapped_type(); - } - - /** Calls the passed functor for every contained object, automatically - skips all elements that are empty references. */ - template< typename FunctorType > - inline void forEach( const FunctorType& rFunctor ) const - { - ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType > - inline void forEachMem( FuncType pFunc ) const - { - forEach( ::boost::bind( pFunc, _1 ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType > - inline void forEachMem( FuncType pFunc, ParamType aParam ) const - { - forEach( ::boost::bind( pFunc, _1, aParam ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType1, typename ParamType2 > - inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const - { - forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > - inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const - { - forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) ); - } - /** Calls the passed functor for every contained object. Passes the key as - first argument and the object reference as second argument to rFunctor. */ - template< typename FunctorType > - inline void forEachWithKey( const FunctorType& rFunctor ) const - { - ::std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the object key as argument to the member function. */ - template< typename FuncType > - inline void forEachMemWithKey( FuncType pFunc ) const - { - forEachWithKey( ::boost::bind( pFunc, _2, _1 ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the object key as first argument to the member function. */ - template< typename FuncType, typename ParamType > - inline void forEachMemWithKey( FuncType pFunc, ParamType aParam ) const - { - forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the object key as first argument to the member function. */ - template< typename FuncType, typename ParamType1, typename ParamType2 > - inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const - { - forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the object key as first argument to the member function. */ - template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > - inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const - { - forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) ); - } - -private: - template< typename FunctorType > - struct ForEachFunctor - { - FunctorType maFunctor; - inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} - inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); } - }; - - template< typename FunctorType > - struct ForEachFunctorWithKey - { - FunctorType maFunctor; - inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} - inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); } - }; - - inline const mapped_type* getRef( key_type nKey ) const - { - typename container_type::const_iterator aIt = find( nKey ); - return (aIt == this->end()) ? 0 : &aIt->second; - } -}; - -// ============================================================================ - /** Template for a 2-dimensional array of objects. This class template provides a similar interface to the ::std::vector @@ -518,45 +218,53 @@ public: /** Returns the pointer to an existing element of the passed vector, or a null pointer, if the passed index is out of bounds. */ - template< typename Type > - static const Type* getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex ); + template< typename VectorType > + static const typename VectorType::value_type* + getVectorElement( const VectorType& rVector, sal_Int32 nIndex ); /** Returns the pointer to an existing element of the passed vector, or a null pointer, if the passed index is out of bounds. */ - template< typename Type > - static Type* getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex ); + template< typename VectorType > + static typename VectorType::value_type* + getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex ); /** Returns the reference to an existing element of the passed vector, or the passed default value, if the passed index is out of bounds. */ - template< typename Type > - static const Type& getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, const Type& rDefault ); + template< typename VectorType > + static const typename VectorType::value_type& + getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault ); /** Returns the reference to an existing element of the passed vector, or the passed default value, if the passed index is out of bounds. */ - template< typename Type > - static Type& getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault ); + template< typename VectorType > + static typename VectorType::value_type& + getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault ); /** Returns the pointer to an existing element of the passed map, or a null pointer, if an element with the passed key does not exist. */ - template< typename Type, typename KeyType > - static const Type* getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey ); + template< typename MapType > + static const typename MapType::mapped_type* + getMapElement( const MapType& rMap, const typename MapType::key_type& rKey ); /** Returns the pointer to an existing element of the passed map, or a null pointer, if an element with the passed key does not exist. */ - template< typename Type, typename KeyType > - static Type* getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey ); + template< typename MapType > + static typename MapType::mapped_type* + getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey ); /** Returns the reference to an existing element of the passed map, or the passed default value, if an element with the passed key does not exist. */ - template< typename Type, typename KeyType > - static const Type& getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey, const Type& rDefault ); + template< typename MapType > + static const typename MapType::mapped_type& + getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault ); /** Returns the reference to an existing element of the passed map, or the passed default value, if an element with the passed key does not exist. */ - template< typename Type, typename KeyType > - static Type& getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey, Type& rDefault ); + template< typename MapType > + static typename MapType::mapped_type& + getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault ); - // vector/matrix to Sequence ---------------------------------------------- + // vector/map/matrix to UNO sequence -------------------------------------- /** Creates a UNO sequence from a std::vector with copies of all elements. @@ -565,9 +273,20 @@ public: @return A com.sun.star.uno.Sequence object with copies of all objects contained in the passed vector. */ - template< typename Type > - static ::com::sun::star::uno::Sequence< Type > - vectorToSequence( const ::std::vector< Type >& rVector ); + template< typename VectorType > + static ::com::sun::star::uno::Sequence< typename VectorType::value_type > + vectorToSequence( const VectorType& rVector ); + + /** Creates a UNO sequence from a std::map with copies of all elements. + + @param rMap The map to be converted to a sequence. + + @return A com.sun.star.uno.Sequence object with copies of all objects + contained in the passed map. + */ + template< typename MapType > + static ::com::sun::star::uno::Sequence< typename MapType::mapped_type > + mapToSequence( const MapType& rMap ); /** Creates a UNO sequence of sequences from a matrix with copies of all elements. @@ -577,126 +296,104 @@ public: com.sun.star.uno.Sequence objects with copies of all objects contained in the passed matrix. */ - template< typename Type > - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Type > > - matrixToSequenceSequence( const Matrix< Type >& rMatrix ); + template< typename MatrixType > + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > > + matrixToSequenceSequence( const MatrixType& rMatrix ); }; // ---------------------------------------------------------------------------- -template< typename Type > -const Type* ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex ) +template< typename VectorType > +/*static*/ const typename VectorType::value_type* ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex ) { return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0; } -template< typename Type > -Type* ContainerHelper::getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex ) +template< typename VectorType > +/*static*/ typename VectorType::value_type* ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex ) { return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0; } -template< typename Type > -const Type& ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, const Type& rDefault ) +template< typename VectorType > +/*static*/ const typename VectorType::value_type& ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault ) { return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault; } -template< typename Type > -Type& ContainerHelper::getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault ) +template< typename VectorType > +/*static*/ typename VectorType::value_type& ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault ) { return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault; } -template< typename Type, typename KeyType > -const Type* ContainerHelper::getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey ) +template< typename MapType > +/*static*/ const typename MapType::mapped_type* ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey ) { - typename ::std::map< KeyType, Type >::const_iterator aIt = rMap.find( nKey ); + typename MapType::const_iterator aIt = rMap.find( rKey ); return (aIt == rMap.end()) ? 0 : &aIt->second; } -template< typename Type, typename KeyType > -Type* ContainerHelper::getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey ) +template< typename MapType > +/*static*/ typename MapType::mapped_type* ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey ) { - typename ::std::map< KeyType, Type >::iterator aIt = rMap.find( nKey ); + typename MapType::iterator aIt = rMap.find( rKey ); return (aIt == rMap.end()) ? 0 : &aIt->second; } -template< typename Type, typename KeyType > -const Type& ContainerHelper::getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey, const Type& rDefault ) +template< typename MapType > +/*static*/ const typename MapType::mapped_type& ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault ) { - typename ::std::map< KeyType, Type >::const_iterator aIt = rMap.find( nKey ); + typename MapType::const_iterator aIt = rMap.find( rKey ); return (aIt == rMap.end()) ? rDefault : aIt->second; } -template< typename Type, typename KeyType > -Type& ContainerHelper::getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey, Type& rDefault ) +template< typename MapType > +/*static*/ typename MapType::mapped_type& ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault ) { - typename ::std::map< KeyType, Type >::iterator aIt = rMap.find( nKey ); + typename MapType::iterator aIt = rMap.find( rKey ); return (aIt == rMap.end()) ? rDefault : aIt->second; } -template< typename Type > -::com::sun::star::uno::Sequence< Type > ContainerHelper::vectorToSequence( const ::std::vector< Type >& rVector ) +template< typename VectorType > +/*static*/ ::com::sun::star::uno::Sequence< typename VectorType::value_type > ContainerHelper::vectorToSequence( const VectorType& rVector ) { + typedef typename VectorType::value_type ValueType; if( rVector.empty() ) - return ::com::sun::star::uno::Sequence< Type >(); - return ::com::sun::star::uno::Sequence< Type >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) ); + return ::com::sun::star::uno::Sequence< ValueType >(); + return ::com::sun::star::uno::Sequence< ValueType >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) ); } -template< typename Type > -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Type > > ContainerHelper::matrixToSequenceSequence( const Matrix< Type >& rMatrix ) +template< typename MapType > +/*static*/ ::com::sun::star::uno::Sequence< typename MapType::mapped_type > ContainerHelper::mapToSequence( const MapType& rMap ) +{ + typedef typename MapType::mapped_type ValueType; + if( rMap.empty() ) + return ::com::sun::star::uno::Sequence< ValueType >(); + ::com::sun::star::uno::Sequence< ValueType > aSeq( static_cast< sal_Int32 >( rMap.size() ) ); + sal_Int32 nIndex = 0; + for( typename MapType::const_iterator aIt = rMap.begin(), aEnd = rMap.end(); aIt != aEnd; ++aIt, ++nIndex ) + aSeq[ nIndex ] = *aIt; + return aSeq; +} + +template< typename MatrixType > +/*static*/ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > > ContainerHelper::matrixToSequenceSequence( const MatrixType& rMatrix ) { - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Type > > aSeq; + typedef typename MatrixType::value_type ValueType; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ValueType > > aSeq; if( !rMatrix.empty() ) { aSeq.realloc( static_cast< sal_Int32 >( rMatrix.height() ) ); for( size_t nRow = 0, nHeight = rMatrix.height(); nRow < nHeight; ++nRow ) aSeq[ static_cast< sal_Int32 >( nRow ) ] = - ::com::sun::star::uno::Sequence< Type >( &rMatrix.row_front( nRow ), static_cast< sal_Int32 >( rMatrix.width() ) ); + ::com::sun::star::uno::Sequence< ValueType >( &rMatrix.row_front( nRow ), static_cast< sal_Int32 >( rMatrix.width() ) ); } return aSeq; } // ============================================================================ -/** This helper manages named objects in a container, which is created on demand. - */ -class ObjectContainer -{ -public: - explicit ObjectContainer( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, - const ::rtl::OUString& rServiceName ); - ~ObjectContainer(); - - /** Returns true, if the object with the passed name exists in the container. */ - bool hasObject( const ::rtl::OUString& rObjName ) const; - - /** Returns the object with the passed name from the container. */ - ::com::sun::star::uno::Any getObject( const ::rtl::OUString& rObjName ) const; - - /** Inserts the passed object into the container, returns its final name. */ - ::rtl::OUString insertObject( - const ::rtl::OUString& rObjName, - const ::com::sun::star::uno::Any& rObj, - bool bInsertByUnusedName ); - -private: - void createContainer() const; - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - mxFactory; /// Factory to create the container. - mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > - mxContainer; /// Container for the objects. - ::rtl::OUString maServiceName; /// Service name to create the container. - sal_Int32 mnIndex; /// Index to create unique identifiers. -}; - -// ============================================================================ - } // namespace oox #endif - diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx index 1c112efcf923..b2b9e1cd133b 100644 --- a/oox/inc/oox/helper/graphichelper.hxx +++ b/oox/inc/oox/helper/graphichelper.hxx @@ -45,7 +45,6 @@ namespace com { namespace sun { namespace star { namespace graphic { class XGraphic; } namespace graphic { class XGraphicObject; } namespace graphic { class XGraphicProvider; } - namespace lang { class XMultiServiceFactory; } namespace uno { class XComponentContext; } } } } @@ -68,7 +67,7 @@ class GraphicHelper { public: explicit GraphicHelper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxTargetFrame, const StorageRef& rxStorage ); virtual ~GraphicHelper(); @@ -176,4 +175,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx index c68fe9ce83f8..84c501fae2e5 100644 --- a/oox/inc/oox/helper/helper.hxx +++ b/oox/inc/oox/helper/helper.hxx @@ -322,4 +322,3 @@ inline void ByteOrderConverter::swap8( sal_uInt8* pnData ) } // namespace oox #endif - diff --git a/oox/inc/oox/helper/modelobjecthelper.hxx b/oox/inc/oox/helper/modelobjecthelper.hxx index 6c0d97960894..a235b402a872 100644 --- a/oox/inc/oox/helper/modelobjecthelper.hxx +++ b/oox/inc/oox/helper/modelobjecthelper.hxx @@ -29,19 +29,55 @@ #define OOX_HELPER_MODELOBJECTHELPER_HXX #include <com/sun/star/uno/Reference.hxx> -#include "oox/helper/containerhelper.hxx" namespace com { namespace sun { namespace star { - namespace lang { class XMultiServiceFactory; } namespace awt { struct Gradient; } + namespace container { class XNameContainer; } namespace drawing { struct LineDash; } namespace drawing { struct PolyPolygonBezierCoords; } + namespace lang { class XMultiServiceFactory; } } } } namespace oox { // ============================================================================ +/** This helper manages named objects in a container, which is created on demand. + */ +class ObjectContainer +{ +public: + explicit ObjectContainer( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::rtl::OUString& rServiceName ); + ~ObjectContainer(); + + /** Returns true, if the object with the passed name exists in the container. */ + bool hasObject( const ::rtl::OUString& rObjName ) const; + + /** Returns the object with the passed name from the container. */ + ::com::sun::star::uno::Any getObject( const ::rtl::OUString& rObjName ) const; + + /** Inserts the passed object into the container, returns its final name. */ + ::rtl::OUString insertObject( + const ::rtl::OUString& rObjName, + const ::com::sun::star::uno::Any& rObj, + bool bInsertByUnusedName ); + +private: + void createContainer() const; + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + mxFactory; /// Factory to create the container. + mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > + mxContainer; /// Container for the objects. + ::rtl::OUString maServiceName; /// Service name to create the container. + sal_Int32 mnIndex; /// Index to create unique identifiers. +}; + +// ============================================================================ + /** Contains tables for named drawing objects for a document model. Contains tables for named line markers, line dashes, fill gradients, and @@ -77,13 +113,13 @@ public: ::rtl::OUString insertFillBitmapUrl( const ::rtl::OUString& rGraphicUrl ); private: - ObjectContainer maMarkerContainer; - ObjectContainer maDashContainer; - ObjectContainer maGradientContainer; - ObjectContainer maBitmapUrlContainer; - const ::rtl::OUString maDashNameBase; - const ::rtl::OUString maGradientNameBase; - const ::rtl::OUString maBitmapUrlNameBase; + ObjectContainer maMarkerContainer; /// Contains all named line markers (line end polygons). + ObjectContainer maDashContainer; /// Contains all named line dsahes. + ObjectContainer maGradientContainer; /// Contains all named fill gradients. + ObjectContainer maBitmapContainer; /// Contains all named fill bitmap URLs. + const ::rtl::OUString maDashNameBase; /// Base name for all named line dashes. + const ::rtl::OUString maGradientNameBase; /// Base name for all named fill gradients. + const ::rtl::OUString maBitmapUrlNameBase; /// Base name for all named fill bitmap URLs. }; // ============================================================================ @@ -91,4 +127,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/helper/progressbar.hxx b/oox/inc/oox/helper/progressbar.hxx index f5ea98816915..847d16ea9231 100644 --- a/oox/inc/oox/helper/progressbar.hxx +++ b/oox/inc/oox/helper/progressbar.hxx @@ -142,4 +142,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/helper/propertymap.hxx b/oox/inc/oox/helper/propertymap.hxx index 7480b8153656..7177a7f95cef 100644 --- a/oox/inc/oox/helper/propertymap.hxx +++ b/oox/inc/oox/helper/propertymap.hxx @@ -30,9 +30,10 @@ #include <vector> #include <map> -#include <rtl/ustring.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ustring.hxx> +#include "oox/token/properties.hxx" namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; @@ -41,7 +42,7 @@ namespace com { namespace sun { namespace star { namespace beans { namespace oox { -struct PropertyList; +struct PropertyNameVector; // ============================================================================ @@ -97,13 +98,8 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > makePropertySet() const; -#if OSL_DEBUG_LEVEL > 0 - static void dump( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet); - void dump(); -#endif - private: - const PropertyList* mpPropNames; + const PropertyNameVector* mpPropNames; }; // ============================================================================ @@ -111,4 +107,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/helper/propertyset.hxx b/oox/inc/oox/helper/propertyset.hxx index c3952e9f6723..c86de41ee4e6 100644 --- a/oox/inc/oox/helper/propertyset.hxx +++ b/oox/inc/oox/helper/propertyset.hxx @@ -30,6 +30,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XMultiPropertySet.hpp> +#include "oox/token/properties.hxx" namespace oox { @@ -126,10 +127,6 @@ public: @param rPropertyMap The property map. */ void setProperties( const PropertyMap& rPropertyMap ); -#if OSL_DEBUG_LEVEL > 0 - void dump(); -#endif - // ------------------------------------------------------------------------ private: /** Gets the specified property from the property set. @@ -151,4 +148,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/helper/refmap.hxx b/oox/inc/oox/helper/refmap.hxx new file mode 100755 index 000000000000..e833e1196c81 --- /dev/null +++ b/oox/inc/oox/helper/refmap.hxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * 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_HELPER_REFMAP_HXX +#define OOX_HELPER_REFMAP_HXX + +#include <map> +#include <boost/bind.hpp> +#include <boost/shared_ptr.hpp> +#include <sal/types.h> + +namespace oox { + +// ============================================================================ + +/** Template for a map of ref-counted objects with additional accessor functions. + + An instance of the class RefMap< Type > stores elements of the type + ::boost::shared_ptr< Type >. The new accessor functions has() and get() + work correctly for nonexisting keys, there is no need to check the passed + key before. + */ +template< typename KeyType, typename ObjType, typename CompType = ::std::less< KeyType > > +class RefMap : public ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > +{ +public: + typedef ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > container_type; + typedef typename container_type::key_type key_type; + typedef typename container_type::mapped_type mapped_type; + typedef typename container_type::value_type value_type; + typedef typename container_type::key_compare key_compare; + +public: + /** Returns true, if the object accossiated to the passed key exists. + Returns false, if the key exists but points to an empty reference. */ + inline bool has( key_type nKey ) const + { + const mapped_type* pxRef = getRef( nKey ); + return pxRef && pxRef->get(); + } + + /** Returns a reference to the object accossiated to the passed key, or an + empty reference on error. */ + inline mapped_type get( key_type nKey ) const + { + if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef; + return mapped_type(); + } + + /** Calls the passed functor for every contained object, automatically + skips all elements that are empty references. */ + template< typename FunctorType > + inline void forEach( const FunctorType& rFunctor ) const + { + ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) ); + } + + /** Calls the passed member function of ObjType on every contained object, + automatically skips all elements that are empty references. */ + template< typename FuncType > + inline void forEachMem( FuncType pFunc ) const + { + forEach( ::boost::bind( pFunc, _1 ) ); + } + + /** Calls the passed member function of ObjType on every contained object, + automatically skips all elements that are empty references. */ + template< typename FuncType, typename ParamType > + inline void forEachMem( FuncType pFunc, ParamType aParam ) const + { + forEach( ::boost::bind( pFunc, _1, aParam ) ); + } + + /** Calls the passed member function of ObjType on every contained object, + automatically skips all elements that are empty references. */ + template< typename FuncType, typename ParamType1, typename ParamType2 > + inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const + { + forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) ); + } + + /** Calls the passed member function of ObjType on every contained object, + automatically skips all elements that are empty references. */ + template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > + inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const + { + forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) ); + } + /** Calls the passed functor for every contained object. Passes the key as + first argument and the object reference as second argument to rFunctor. */ + template< typename FunctorType > + inline void forEachWithKey( const FunctorType& rFunctor ) const + { + ::std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) ); + } + + /** Calls the passed member function of ObjType on every contained object. + Passes the object key as argument to the member function. */ + template< typename FuncType > + inline void forEachMemWithKey( FuncType pFunc ) const + { + forEachWithKey( ::boost::bind( pFunc, _2, _1 ) ); + } + + /** Calls the passed member function of ObjType on every contained object. + Passes the object key as first argument to the member function. */ + template< typename FuncType, typename ParamType > + inline void forEachMemWithKey( FuncType pFunc, ParamType aParam ) const + { + forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam ) ); + } + + /** Calls the passed member function of ObjType on every contained object. + Passes the object key as first argument to the member function. */ + template< typename FuncType, typename ParamType1, typename ParamType2 > + inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const + { + forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) ); + } + + /** Calls the passed member function of ObjType on every contained object. + Passes the object key as first argument to the member function. */ + template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > + inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const + { + forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) ); + } + +private: + template< typename FunctorType > + struct ForEachFunctor + { + FunctorType maFunctor; + inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} + inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); } + }; + + template< typename FunctorType > + struct ForEachFunctorWithKey + { + FunctorType maFunctor; + inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} + inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); } + }; + + inline const mapped_type* getRef( key_type nKey ) const + { + typename container_type::const_iterator aIt = find( nKey ); + return (aIt == this->end()) ? 0 : &aIt->second; + } +}; + +// ============================================================================ + +} // namespace oox + +#endif diff --git a/oox/inc/oox/helper/refvector.hxx b/oox/inc/oox/helper/refvector.hxx new file mode 100755 index 000000000000..0a2d8be62e2f --- /dev/null +++ b/oox/inc/oox/helper/refvector.hxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * 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_HELPER_REFVECTOR_HXX +#define OOX_HELPER_REFVECTOR_HXX + +#include <vector> +#include <boost/bind.hpp> +#include <boost/shared_ptr.hpp> +#include <sal/types.h> + +namespace oox { + +// ============================================================================ + +/** Template for a vector of ref-counted objects with additional accessor functions. + + An instance of the class RefVector< Type > stores elements of the type + ::boost::shared_ptr< Type >. The new accessor functions has() and get() + work correctly for indexes out of the current range, there is no need to + check the passed index before. + */ +template< typename ObjType > +class RefVector : public ::std::vector< ::boost::shared_ptr< ObjType > > +{ +public: + typedef ::std::vector< ::boost::shared_ptr< ObjType > > container_type; + typedef typename container_type::value_type value_type; + typedef typename container_type::size_type size_type; + +public: + /** Returns true, if the object with the passed index exists. Returns + false, if the vector element exists but is an empty reference. */ + inline bool has( sal_Int32 nIndex ) const + { + const value_type* pxRef = getRef( nIndex ); + return pxRef && pxRef->get(); + } + + /** Returns a reference to the object with the passed index, or 0 on error. */ + inline value_type get( sal_Int32 nIndex ) const + { + if( const value_type* pxRef = getRef( nIndex ) ) return *pxRef; + return value_type(); + } + + /** Returns the index of the last element, or -1, if the vector is empty. + Does *not* check whether the last element is an empty reference. */ + inline sal_Int32 getLastIndex() const { return static_cast< sal_Int32 >( this->size() ) - 1; } + + /** Calls the passed functor for every contained object, automatically + skips all elements that are empty references. */ + template< typename FunctorType > + inline void forEach( FunctorType aFunctor ) const + { + ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) ); + } + + /** Calls the passed member function of ObjType on every contained object, + automatically skips all elements that are empty references. */ + template< typename FuncType > + inline void forEachMem( FuncType pFunc ) const + { + forEach( ::boost::bind( pFunc, _1 ) ); + } + + /** Calls the passed member function of ObjType on every contained object, + automatically skips all elements that are empty references. */ + template< typename FuncType, typename ParamType > + inline void forEachMem( FuncType pFunc, ParamType aParam ) const + { + forEach( ::boost::bind( pFunc, _1, aParam ) ); + } + + /** Calls the passed member function of ObjType on every contained object, + automatically skips all elements that are empty references. */ + template< typename FuncType, typename ParamType1, typename ParamType2 > + inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const + { + forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) ); + } + + /** Calls the passed member function of ObjType on every contained object, + automatically skips all elements that are empty references. */ + template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > + inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const + { + forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) ); + } + + /** Calls the passed functor for every contained object. Passes the index as + first argument and the object reference as second argument to rFunctor. */ + template< typename FunctorType > + inline void forEachWithIndex( const FunctorType& rFunctor ) const + { + ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) ); + } + + /** Calls the passed member function of ObjType on every contained object. + Passes the vector index to the member function. */ + template< typename FuncType > + inline void forEachMemWithIndex( FuncType pFunc ) const + { + forEachWithIndex( ::boost::bind( pFunc, _2, _1 ) ); + } + + /** Calls the passed member function of ObjType on every contained object. + Passes the vector index as first argument to the member function. */ + template< typename FuncType, typename ParamType > + inline void forEachMemWithIndex( FuncType pFunc, ParamType aParam ) const + { + forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam ) ); + } + + /** Calls the passed member function of ObjType on every contained object. + Passes the vector index as first argument to the member function. */ + template< typename FuncType, typename ParamType1, typename ParamType2 > + inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const + { + forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) ); + } + + /** Calls the passed member function of ObjType on every contained object. + Passes the vector index as first argument to the member function. */ + template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > + inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const + { + forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) ); + } + + /** Searches for an element by using the passed functor that takes a + constant reference of the object type (const ObjType&). */ + template< typename FunctorType > + inline value_type findIf( const FunctorType& rFunctor ) const + { + typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) ); + return (aIt == this->end()) ? value_type() : *aIt; + } + +private: + template< typename FunctorType > + struct ForEachFunctor + { + FunctorType maFunctor; + inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} + inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); } + }; + + template< typename FunctorType > + struct ForEachFunctorWithIndex + { + FunctorType maFunctor; + sal_Int32 mnIndex; + inline explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {} + inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( mnIndex, *rxValue ); ++mnIndex; } + }; + + template< typename FunctorType > + struct FindFunctor + { + FunctorType maFunctor; + inline explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} + inline bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); } + }; + + inline const value_type* getRef( sal_Int32 nIndex ) const + { + return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ? + &(*this)[ static_cast< size_type >( nIndex ) ] : 0; + } +}; + +// ============================================================================ + +} // namespace oox + +#endif diff --git a/oox/inc/oox/helper/storagebase.hxx b/oox/inc/oox/helper/storagebase.hxx index 5a179e73cf75..d48e5fdd1844 100644 --- a/oox/inc/oox/helper/storagebase.hxx +++ b/oox/inc/oox/helper/storagebase.hxx @@ -28,8 +28,10 @@ #ifndef OOX_HELPER_STORAGEBASE_HXX #define OOX_HELPER_STORAGEBASE_HXX +#include <vector> +#include <com/sun/star/uno/Reference.hxx> +#include "oox/helper/refmap.hxx" #include "oox/dllapi.h" -#include "oox/helper/containerhelper.hxx" namespace com { namespace sun { namespace star { namespace embed { class XStorage; } diff --git a/oox/inc/oox/helper/textinputstream.hxx b/oox/inc/oox/helper/textinputstream.hxx index 1e74825ee713..2e98d3fc8c84 100755..100644 --- a/oox/inc/oox/helper/textinputstream.hxx +++ b/oox/inc/oox/helper/textinputstream.hxx @@ -55,4 +55,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/ole/axbinaryreader.hxx b/oox/inc/oox/ole/axbinaryreader.hxx index e3f102716e17..f26075ff52eb 100755..100644 --- a/oox/inc/oox/ole/axbinaryreader.hxx +++ b/oox/inc/oox/ole/axbinaryreader.hxx @@ -30,7 +30,7 @@ #include <utility> #include "oox/helper/binaryinputstream.hxx" -#include "oox/helper/containerhelper.hxx" +#include "oox/helper/refvector.hxx" namespace oox { namespace ole { @@ -92,6 +92,8 @@ typedef ::std::vector< ::rtl::OUString > AxStringArray; // ============================================================================ +const sal_Char* const AX_GUID_CFONT = "{AFC20920-DA4E-11CE-B943-00AA006887B4}"; + const sal_uInt32 AX_FONTDATA_BOLD = 0x00000001; const sal_uInt32 AX_FONTDATA_ITALIC = 0x00000002; const sal_uInt32 AX_FONTDATA_UNDERLINE = 0x00000004; @@ -111,6 +113,7 @@ struct AxFontData sal_Int32 mnFontHeight; /// Height of the font (not really twips, see code). sal_Int32 mnFontCharSet; /// Windows character set of the font. sal_Int32 mnHorAlign; /// Horizontal text alignment. + bool mbDblUnderline; /// True = double underline style (legacy VML drawing controls only). explicit AxFontData(); @@ -293,4 +296,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx index 8df45ece6065..8bc9cd622b2b 100644 --- a/oox/inc/oox/ole/axcontrol.hxx +++ b/oox/inc/oox/ole/axcontrol.hxx @@ -30,6 +30,7 @@ #include <boost/shared_ptr.hpp> #include "oox/helper/binarystreambase.hxx" +#include "oox/helper/propertyset.hxx" #include "oox/ole/axbinaryreader.hxx" #include "oox/ole/olehelper.hxx" @@ -37,6 +38,7 @@ namespace com { namespace sun { namespace star { namespace awt { class XControlModel; } namespace container { class XIndexContainer; } namespace drawing { class XDrawPage; } + namespace frame { class XModel; } namespace form { class XFormsSupplier; } namespace lang { class XMultiServiceFactory; } } } } @@ -56,6 +58,9 @@ const sal_Char* const COMCTL_GUID_SCROLLBAR_60 = "{FE38753A-44A3-11D1-B5B7- const sal_Char* const COMCTL_GUID_PROGRESSBAR_50 = "{0713E8D2-850A-101B-AFC0-4210102A8DA7}"; const sal_Char* const COMCTL_GUID_PROGRESSBAR_60 = "{35053A22-8589-11D1-B16A-00C0F0283628}"; +const sal_uInt16 COMCTL_VERSION_50 = 5; +const sal_uInt16 COMCTL_VERSION_60 = 6; + // ---------------------------------------------------------------------------- const sal_Char* const AX_GUID_COMMANDBUTTON = "{D7053240-CE69-11CD-A777-00DD01143C57}"; @@ -77,6 +82,28 @@ const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT = 0x80000008; const sal_uInt32 AX_SYSCOLOR_BUTTONFACE = 0x8000000F; const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT = 0x80000012; +const sal_uInt32 AX_FLAGS_ENABLED = 0x00000002; +const sal_uInt32 AX_FLAGS_LOCKED = 0x00000004; +const sal_uInt32 AX_FLAGS_OPAQUE = 0x00000008; +const sal_uInt32 AX_FLAGS_COLUMNHEADS = 0x00000400; +const sal_uInt32 AX_FLAGS_ENTIREROWS = 0x00000800; +const sal_uInt32 AX_FLAGS_EXISTINGENTRIES = 0x00001000; +const sal_uInt32 AX_FLAGS_CAPTIONLEFT = 0x00002000; +const sal_uInt32 AX_FLAGS_EDITABLE = 0x00004000; +const sal_uInt32 AX_FLAGS_IMEMODE_MASK = 0x00078000; +const sal_uInt32 AX_FLAGS_DRAGENABLED = 0x00080000; +const sal_uInt32 AX_FLAGS_ENTERASNEWLINE = 0x00100000; +const sal_uInt32 AX_FLAGS_KEEPSELECTION = 0x00200000; +const sal_uInt32 AX_FLAGS_TABASCHARACTER = 0x00400000; +const sal_uInt32 AX_FLAGS_WORDWRAP = 0x00800000; +const sal_uInt32 AX_FLAGS_BORDERSSUPPRESSED = 0x02000000; +const sal_uInt32 AX_FLAGS_SELECTLINE = 0x04000000; +const sal_uInt32 AX_FLAGS_SINGLECHARSELECT = 0x08000000; +const sal_uInt32 AX_FLAGS_AUTOSIZE = 0x10000000; +const sal_uInt32 AX_FLAGS_HIDESELECTION = 0x20000000; +const sal_uInt32 AX_FLAGS_MAXLENAUTOTAB = 0x40000000; +const sal_uInt32 AX_FLAGS_MULTILINE = 0x80000000; + const sal_Int32 AX_BORDERSTYLE_NONE = 0; const sal_Int32 AX_BORDERSTYLE_SINGLE = 1; @@ -96,6 +123,26 @@ const sal_Int32 AX_PICALIGN_CENTER = 2; const sal_Int32 AX_PICALIGN_BOTTOMLEFT = 3; const sal_Int32 AX_PICALIGN_BOTTOMRIGHT = 4; +const sal_Int32 AX_DISPLAYSTYLE_TEXT = 1; +const sal_Int32 AX_DISPLAYSTYLE_LISTBOX = 2; +const sal_Int32 AX_DISPLAYSTYLE_COMBOBOX = 3; +const sal_Int32 AX_DISPLAYSTYLE_CHECKBOX = 4; +const sal_Int32 AX_DISPLAYSTYLE_OPTBUTTON = 5; +const sal_Int32 AX_DISPLAYSTYLE_TOGGLE = 6; +const sal_Int32 AX_DISPLAYSTYLE_DROPDOWN = 7; + +const sal_Int32 AX_SELCTION_SINGLE = 0; +const sal_Int32 AX_SELCTION_MULTI = 1; +const sal_Int32 AX_SELCTION_EXTENDED = 2; + +const sal_Int32 AX_SHOWDROPBUTTON_NEVER = 0; +const sal_Int32 AX_SHOWDROPBUTTON_FOCUS = 1; +const sal_Int32 AX_SHOWDROPBUTTON_ALWAYS = 2; + +const sal_Int32 AX_SCROLLBAR_NONE = 0x00; +const sal_Int32 AX_SCROLLBAR_HORIZONTAL = 0x01; +const sal_Int32 AX_SCROLLBAR_VERTICAL = 0x02; + // ---------------------------------------------------------------------------- /** Enumerates all UNO API control types supported by these filters. */ @@ -107,6 +154,7 @@ enum ApiControlType API_CONTROL_CHECKBOX, API_CONTROL_RADIOBUTTON, API_CONTROL_EDIT, + API_CONTROL_NUMERIC, API_CONTROL_LISTBOX, API_CONTROL_COMBOBOX, API_CONTROL_SPINBUTTON, @@ -147,6 +195,7 @@ class ControlConverter { public: explicit ControlConverter( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr = true ); virtual ~ControlConverter(); @@ -179,12 +228,25 @@ public: PropertyMap& rPropMap, bool bHorizontal ) const; + /** Converts the vertical alignment to UNO properties. */ + void convertVerticalAlign( + PropertyMap& rPropMap, + sal_Int32 nVerticalAlign ) const; + /** Converts common scrollbar settings to UNO properties. */ void convertScrollBar( PropertyMap& rPropMap, sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition, sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const; + /** Binds the passed control model to the passed data sources. The + implementation will check which source types are supported. */ + void bindToSources( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel, + const ::rtl::OUString& rCtrlSource, + const ::rtl::OUString& rRowSource, + sal_Int32 nRefSheet = 0 ) const; + // ActiveX (Forms 2.0) specific conversion -------------------------------- /** Converts the Forms 2.0 background formatting to UNO properties. */ @@ -238,7 +300,10 @@ public: sal_Int32 nOrientation ) const; private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel; const GraphicHelper& mrGraphicHelper; + mutable PropertySet maAddressConverter; + mutable PropertySet maRangeConverter; bool mbDefaultColorBgr; }; @@ -275,8 +340,10 @@ public: /** Converts the control size to UNO properties. */ void convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const; -protected: +public: // direct access needed for legacy VML drawing controls AxPairData maSize; /// Size of the control in 1/100 mm. + +protected: bool mbAwtModel; /// True = AWT control model, false = form component. }; @@ -396,8 +463,10 @@ public: /** Returns the font height in points. */ inline sal_Int16 getFontHeight() const { return maFontData.getHeightPoints(); } -protected: +public: // direct access needed for legacy VML drawing controls AxFontData maFontData; /// The font settings. + +private: bool mbSupportsAlign; /// True = UNO model supports Align property. }; @@ -416,13 +485,14 @@ public: virtual ApiControlType getControlType() const; virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; -private: +public: // direct access needed for legacy VML drawing controls StreamDataSequence maPictureData; /// Binary picture stream. ::rtl::OUString maCaption; /// Visible caption of the button. sal_uInt32 mnTextColor; /// Text color. sal_uInt32 mnBackColor; /// Fill color. sal_uInt32 mnFlags; /// Various flags. sal_uInt32 mnPicturePos; /// Position of the picture relative to text. + sal_Int32 mnVerticalAlign; /// Vertical alignment (legacy VML drawing controls only). bool mbFocusOnClick; /// True = take focus on click. }; @@ -440,7 +510,7 @@ public: virtual ApiControlType getControlType() const; virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; -private: +public: // direct access needed for legacy VML drawing controls ::rtl::OUString maCaption; /// Visible caption of the button. sal_uInt32 mnTextColor; /// Text color. sal_uInt32 mnBackColor; /// Fill color. @@ -448,6 +518,7 @@ private: sal_uInt32 mnBorderColor; /// Flat border color. sal_Int32 mnBorderStyle; /// Flat border style. sal_Int32 mnSpecialEffect; /// 3D border effect. + sal_Int32 mnVerticalAlign; /// Vertical alignment (legacy VML drawing controls only). }; // ============================================================================ @@ -490,7 +561,7 @@ public: virtual bool importBinaryModel( BinaryInputStream& rInStrm ); virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; -protected: +public: // direct access needed for legacy VML drawing controls StreamDataSequence maPictureData; /// Binary picture stream. ::rtl::OUString maCaption; /// Visible caption of the button. ::rtl::OUString maValue; /// Current value of the control. @@ -510,6 +581,7 @@ protected: sal_Int32 mnMaxLength; /// Maximum character count. sal_Int32 mnPasswordChar; /// Password character in edit fields. sal_Int32 mnListRows; /// Number of rows in dropdown box. + sal_Int32 mnVerticalAlign; /// Vertical alignment (legacy VML drawing controls only). }; // ============================================================================ @@ -565,6 +637,18 @@ public: // ============================================================================ +/** Model for a numeric field (legacy drawing controls only). */ +class AxNumericFieldModel : public AxMorphDataModelBase +{ +public: + explicit AxNumericFieldModel(); + + virtual ApiControlType getControlType() const; + virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; +}; + +// ============================================================================ + /** Model for a Forms 2.0 list box. */ class AxListBoxModel : public AxMorphDataModelBase { @@ -601,7 +685,7 @@ public: virtual ApiControlType getControlType() const; virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; -private: +public: // direct access needed for legacy VML drawing controls sal_uInt32 mnArrowColor; /// Button arrow color. sal_uInt32 mnBackColor; /// Fill color. sal_uInt32 mnFlags; /// Various flags. @@ -627,7 +711,7 @@ public: virtual ApiControlType getControlType() const; virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; -private: +public: // direct access needed for legacy VML drawing controls sal_uInt32 mnArrowColor; /// Button arrow color. sal_uInt32 mnBackColor; /// Fill color. sal_uInt32 mnFlags; /// Various flags. @@ -691,7 +775,7 @@ public: model from the 'f' stream. */ bool importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable ); -protected: +public: // direct access needed for legacy VML drawing controls StreamDataSequence maPictureData; /// Binary picture stream. ::rtl::OUString maCaption; /// Visible caption of the form. AxPairData maLogicalSize; /// Logical form size (scroll area). @@ -776,14 +860,27 @@ class EmbeddedControl { public: explicit EmbeddedControl( const ::rtl::OUString& rName ); - ~EmbeddedControl(); + virtual ~EmbeddedControl(); + + /** Creates and returns the internal control model of the specified type. */ + template< typename ModelType > + inline ModelType& createModel(); + + /** Creates and returns the internal control model of the specified type. */ + template< typename ModelType, typename ParamType > + inline ModelType& createModel( const ParamType& rParam ); /** Creates and returns the internal control model according to the passed MS class identifier. */ - ControlModelRef createModel( const ::rtl::OUString& rClassId ); + ControlModelBase* createModelFromGuid( const ::rtl::OUString& rClassId ); /** Returns true, if the internal control model exists. */ inline bool hasModel() const { return mxModel.get() != 0; } + /** Returns read-only access to the internal control model. */ + inline const ControlModelBase* getModel() const { return mxModel.get(); } + /** Returns read/write access to the internal control model. */ + inline ControlModelBase* getModel() { return mxModel.get(); } + /** Returns the UNO service name needed to construct the control model. */ ::rtl::OUString getServiceName() const; @@ -797,32 +894,54 @@ private: ::rtl::OUString maName; /// Name of the control. }; +// ---------------------------------------------------------------------------- + +template< typename ModelType > +inline ModelType& EmbeddedControl::createModel() +{ + ::boost::shared_ptr< ModelType > xModel( new ModelType ); + mxModel = xModel; + xModel->setFormComponentMode(); + return *xModel; +} + +template< typename ModelType, typename ParamType > +inline ModelType& EmbeddedControl::createModel( const ParamType& rParam ) +{ + ::boost::shared_ptr< ModelType > xModel( new ModelType( rParam ) ); + mxModel = xModel; + xModel->setFormComponentMode(); + return *xModel; +} + // ============================================================================ /** A wrapper for a control form embedded directly in a draw page. */ -class EmbeddedForm : public ControlConverter +class EmbeddedForm { public: explicit EmbeddedForm( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr = true ); - /** Converts the passed ActiveX control and inserts it into the form. + /** Converts the passed control and inserts the control model into the form. @return The API control model, if conversion was successful. */ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > - convertAndInsert( const EmbeddedControl& rControl ); + convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex ); -private: - /** Tries to insert the passed control model into the form. */ - bool insertControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel ); + /** Returns the XIndexContainer interface of the UNO control form, if existing. */ + inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > + getXForm() const { return mxFormIC; } +private: /** Creates the form that will hold the form controls. */ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > - createForm(); + createXForm(); private: + ControlConverter maControlConv; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxModelFactory; ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier > mxFormsSupp; ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxFormIC; diff --git a/oox/inc/oox/ole/axcontrolfragment.hxx b/oox/inc/oox/ole/axcontrolfragment.hxx index 3c9aed61bd3e..a5273070ba8f 100644 --- a/oox/inc/oox/ole/axcontrolfragment.hxx +++ b/oox/inc/oox/ole/axcontrolfragment.hxx @@ -78,4 +78,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/ole/olehelper.hxx b/oox/inc/oox/ole/olehelper.hxx index ba46d3baf6df..98085e66cfd8 100644 --- a/oox/inc/oox/ole/olehelper.hxx +++ b/oox/inc/oox/ole/olehelper.hxx @@ -100,6 +100,10 @@ public: sal_uInt32 nOleColor, bool bDefaultColorBgr = true ); + /** Returns the OLE color from the passed UNO RGB color. + */ + static sal_uInt32 encodeOleColor( sal_Int32 nRgbColor ); + /** Imports a GUID from the passed binary stream and returns its string representation (in uppercase characters). */ @@ -140,4 +144,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/ole/oleobjecthelper.hxx b/oox/inc/oox/ole/oleobjecthelper.hxx index ef3570c4fa20..c3a58213abc9 100644 --- a/oox/inc/oox/ole/oleobjecthelper.hxx +++ b/oox/inc/oox/ole/oleobjecthelper.hxx @@ -32,8 +32,8 @@ namespace com { namespace sun { namespace star { namespace awt { struct Size; } - namespace lang { class XMultiServiceFactory; } namespace document { class XEmbeddedObjectResolver; } + namespace lang { class XMultiServiceFactory; } } } } namespace oox { class PropertyMap; } @@ -83,4 +83,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/ole/olestorage.hxx b/oox/inc/oox/ole/olestorage.hxx index a84fadfadc92..eabcfd4d0f87 100755..100644 --- a/oox/inc/oox/ole/olestorage.hxx +++ b/oox/inc/oox/ole/olestorage.hxx @@ -31,8 +31,8 @@ #include "oox/helper/storagebase.hxx" namespace com { namespace sun { namespace star { - namespace lang { class XMultiServiceFactory; } namespace container { class XNameContainer; } + namespace lang { class XMultiServiceFactory; } } } } namespace oox { diff --git a/oox/inc/oox/ole/vbacontrol.hxx b/oox/inc/oox/ole/vbacontrol.hxx index c2490b3506bf..8c4274ffda7e 100755..100644 --- a/oox/inc/oox/ole/vbacontrol.hxx +++ b/oox/inc/oox/ole/vbacontrol.hxx @@ -32,6 +32,7 @@ namespace com { namespace sun { namespace star { namespace container { class XNameContainer; } + namespace uno { class XComponentContext; } } } } namespace oox { class StorageBase; } @@ -82,12 +83,18 @@ public: ApiControlType eCtrlType, sal_Int32 nCtrlIndex ) const; + /** Binds the passed control model to the data sources. The implementation + will check which source types are supported. */ + void bindToSources( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel, + const ControlConverter& rConv ) const; + protected: ::rtl::OUString maName; /// Name of the control. ::rtl::OUString maTag; /// User defined tag. ::rtl::OUString maToolTip; /// Tool tip for the control. - ::rtl::OUString maLinkedCell; /// Linked cell for the control value in a spreadsheet. - ::rtl::OUString maSourceRange; /// Source data for the control in a spreadsheet. + ::rtl::OUString maControlSource; /// Linked cell for the control value in a spreadsheet. + ::rtl::OUString maRowSource; /// Source data for the control in a spreadsheet. AxPairData maPos; /// Position in parent container. sal_Int32 mnId; /// Control identifier. sal_Int32 mnHelpContextId; /// Help context identifier. @@ -181,11 +188,12 @@ private: // ============================================================================ -class VbaUserForm : public VbaFormControl, public ControlConverter +class VbaUserForm : public VbaFormControl { public: explicit VbaUserForm( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr = true ); @@ -198,7 +206,9 @@ public: rtl_TextEncoding eTextEnc ); private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxGlobalFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCompContext; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel; + ControlConverter maConverter; }; // ============================================================================ diff --git a/oox/inc/oox/ole/vbahelper.hxx b/oox/inc/oox/ole/vbahelper.hxx index c1e7297d0c5b..aa7b3a081c8d 100644 --- a/oox/inc/oox/ole/vbahelper.hxx +++ b/oox/inc/oox/ole/vbahelper.hxx @@ -54,6 +54,7 @@ const sal_uInt16 VBA_ID_MODULETYPEPROCEDURAL = 0x0021; const sal_uInt16 VBA_ID_PROJECTCODEPAGE = 0x0003; const sal_uInt16 VBA_ID_PROJECTEND = 0x0010; const sal_uInt16 VBA_ID_PROJECTMODULES = 0x000F; +const sal_uInt16 VBA_ID_PROJECTNAME = 0x0004; const sal_uInt16 VBA_ID_PROJECTVERSION = 0x0009; // ============================================================================ diff --git a/oox/inc/oox/ole/vbainputstream.hxx b/oox/inc/oox/ole/vbainputstream.hxx index 4de0a91a622f..858698518968 100644 --- a/oox/inc/oox/ole/vbainputstream.hxx +++ b/oox/inc/oox/ole/vbainputstream.hxx @@ -69,4 +69,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/ole/vbamodule.hxx b/oox/inc/oox/ole/vbamodule.hxx index 377c7abc335a..52b2261e55b5 100644 --- a/oox/inc/oox/ole/vbamodule.hxx +++ b/oox/inc/oox/ole/vbamodule.hxx @@ -28,8 +28,8 @@ #ifndef OOX_OLE_VBAMODULE_HXX #define OOX_OLE_VBAMODULE_HXX -#include <rtl/ustring.hxx> #include <com/sun/star/uno/Reference.hxx> +#include <rtl/ustring.hxx> namespace com { namespace sun { namespace star { namespace container { class XNameAccess; } diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx index e8d9aa7c0f5d..40e81c923d25 100644 --- a/oox/inc/oox/ole/vbaproject.hxx +++ b/oox/inc/oox/ole/vbaproject.hxx @@ -28,8 +28,10 @@ #ifndef OOX_OLE_VBAPROJECT_HXX #define OOX_OLE_VBAPROJECT_HXX -#include "oox/helper/storagebase.hxx" +#include <map> #include <com/sun/star/uno/XInterface.hpp> +#include "oox/helper/refvector.hxx" +#include "oox/helper/storagebase.hxx" #include "oox/dllapi.h" namespace com { namespace sun { namespace star { @@ -37,7 +39,8 @@ namespace com { namespace sun { namespace star { namespace document { class XEventsSupplier; } namespace frame { class XModel; } namespace script { class XLibraryContainer; } - namespace lang { class XMultiServiceFactory; } + namespace script { namespace vba { class XVBAMacroResolver; } } + namespace uno { class XComponentContext; } } } } namespace oox { class GraphicHelper; } @@ -51,7 +54,7 @@ class OOX_DLLPUBLIC VbaFilterConfig { public: explicit VbaFilterConfig( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::rtl::OUString& rConfigCompName ); ~VbaFilterConfig(); @@ -69,11 +72,52 @@ private: // ============================================================================ +/** Base class for objects that attach a amcro to a specific action. + + Purpose is to collect objects that need to attach a VBA macro to an action. + The VBA project will be loaded at a very late point of the document import + process, because it depends on an initialized core document model (e.g. + spreadsheet codenames). Some objects that want to attach a VBA macro to an + action (e.g. mouse click action for drawing shapes) are loaded long before + the VBA project. The drawback is that in most cases macros are specified + without module name, or the VBA project name is part of the macro name. + In the former case, all code modules have to be scanned for the macro to be + able to create a valid script URL. + + The import code will register these requests to attach a VBA macro with an + instance of a class derived from this base class. The derived class will + store all information needed to finally attach the macro to the action, + once the VBA project has been imported. + */ +class VbaMacroAttacherBase +{ +public: + explicit VbaMacroAttacherBase( const ::rtl::OUString& rMacroName ); + virtual ~VbaMacroAttacherBase(); + + /** Resolves the internal macro name to the related macro URL, and attaches + the macro to the object. */ + void resolveAndAttachMacro( + const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAMacroResolver >& rxResolver ); + +private: + /** Called after the VBA project has been imported. Derived classes will + attach the passed script to the object represented by this instance. */ + virtual void attachMacro( const ::rtl::OUString& rScriptUrl ) = 0; + +private: + ::rtl::OUString maMacroName; +}; + +typedef ::boost::shared_ptr< VbaMacroAttacherBase > VbaMacroAttacherRef; + +// ============================================================================ + class OOX_DLLPUBLIC VbaProject : public VbaFilterConfig { public: explicit VbaProject( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel, const ::rtl::OUString& rConfigCompName ); virtual ~VbaProject(); @@ -87,6 +131,10 @@ public: const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr = true ); + /** Registers a macro atatcher object. For details, see description of the + VbaMacroAttacherBase class. */ + void registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher ); + /** Returns true, if the document contains at least one code module. */ bool hasModules() const; /** Returns true, if the document contains the specified code module. */ @@ -101,8 +149,6 @@ protected: /** Registers a dummy module that will be created when the VBA project is imported. */ void addDummyModule( const ::rtl::OUString& rName, sal_Int32 nType ); - /** Creates all dummy modules in the document. */ - void createDummyModules(); /** Called when the import process of the VBA project has been started. */ virtual void prepareImport(); @@ -131,22 +177,28 @@ private: StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ); + + /** Attaches VBA macros to objects registered via registerMacroAttacher(). */ + void attachMacros(); + /** Copies the entire VBA project storage to the passed document model. */ void copyStorage( StorageBase& rVbaPrjStrg ); private: + typedef RefVector< VbaMacroAttacherBase > MacroAttacherVector; typedef ::std::map< ::rtl::OUString, sal_Int32 > DummyModuleMap; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - mxGlobalFactory; /// Global service factory. + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + mxCompContext; /// Component context with service manager. ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel; /// Document model used to import/export the VBA project. ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxBasicLib; /// The Basic library of the document used for import. ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxDialogLib; /// The dialog library of the document used for import. + MacroAttacherVector maMacroAttachers; /// Objects that want to attach a VBA macro to an action. DummyModuleMap maDummyModules; /// Additional empty modules created on import. - const ::rtl::OUString maLibName; /// Name for Basic and dialog library used for import. + ::rtl::OUString maPrjName; /// Name of the VBA project. }; // ============================================================================ diff --git a/oox/inc/oox/ole/vbaprojectfilter.hxx b/oox/inc/oox/ole/vbaprojectfilter.hxx new file mode 100755 index 000000000000..c8a0a1b0ce74 --- /dev/null +++ b/oox/inc/oox/ole/vbaprojectfilter.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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_OLE_VBAPROJECTFILTER_HXX +#define OOX_OLE_VBAPROJECTFILTER_HXX + +#include "oox/core/binaryfilterbase.hxx" + +namespace oox { +namespace ole { + +// ============================================================================ + +class VbaProjectFilterBase : public ::oox::core::BinaryFilterBase +{ +public: + explicit VbaProjectFilterBase( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const ::rtl::OUString& rAppName, + const ::rtl::OUString& rStorageName ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual bool importDocument() throw(); + virtual bool exportDocument() throw(); + +private: + virtual VbaProject* implCreateVbaProject() const; + +private: + ::rtl::OUString maAppName; + ::rtl::OUString maStorageName; +}; + +// ============================================================================ + +class WordVbaProjectFilter : public VbaProjectFilterBase +{ +public: + explicit WordVbaProjectFilter( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); + +private: + virtual ::rtl::OUString implGetImplementationName() const; +}; + +// ============================================================================ + +} // namespace ole +} // namespace oox + +#endif diff --git a/oox/inc/oox/ppt/pptimport.hxx b/oox/inc/oox/ppt/pptimport.hxx index c4ee29447c64..158584eeb3f5 100644 --- a/oox/inc/oox/ppt/pptimport.hxx +++ b/oox/inc/oox/ppt/pptimport.hxx @@ -34,7 +34,6 @@ #include <oox/drawingml/theme.hxx> #include "oox/ppt/presentationfragmenthandler.hxx" #include "oox/ppt/slidepersist.hxx" -#include "tokens.hxx" #include <vector> #include <map> @@ -46,7 +45,8 @@ class PowerPointImport : public oox::core::XmlFilterBase { public: - PowerPointImport( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr ); + PowerPointImport( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); virtual ~PowerPointImport(); // from FilterBase @@ -68,6 +68,7 @@ public: private: virtual GraphicHelper* implCreateGraphicHelper() const; + virtual ::oox::ole::VbaProject* implCreateVbaProject() const; virtual ::rtl::OUString implGetImplementationName() const; private: diff --git a/oox/inc/oox/ppt/pptshape.hxx b/oox/inc/oox/ppt/pptshape.hxx index 3376e5bb1ace..be200859c6e6 100644 --- a/oox/inc/oox/ppt/pptshape.hxx +++ b/oox/inc/oox/ppt/pptshape.hxx @@ -48,7 +48,7 @@ public: using oox::drawingml::Shape::addShape; // addShape is creating and inserting the corresponding XShape. void addShape( - const oox::core::XmlFilterBase& rFilterBase, + oox::core::XmlFilterBase& rFilterBase, const SlidePersist& rPersist, const oox::drawingml::Theme* pTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx index 444d12546f12..8bc961e59f00 100644 --- a/oox/inc/oox/ppt/slidepersist.hxx +++ b/oox/inc/oox/ppt/slidepersist.hxx @@ -28,7 +28,6 @@ #ifndef OOX_POWERPOINT_SLIDEPERSIST_HXX #define OOX_POWERPOINT_SLIDEPERSIST_HXX -#include "tokens.hxx" #include <boost/shared_ptr.hpp> #include "oox/drawingml/shape.hxx" #include "oox/drawingml/theme.hxx" @@ -112,7 +111,7 @@ public: oox::vml::Drawing* getDrawing() { return mpDrawingPtr.get(); } - void createXShapes( const oox::core::XmlFilterBase& rFilterBase ); + void createXShapes( oox::core::XmlFilterBase& rFilterBase ); void createBackground( const oox::core::XmlFilterBase& rFilterBase ); void applyTextStyles( const oox::core::XmlFilterBase& rFilterBase ); diff --git a/oox/inc/oox/helper/recordinputstream.hxx b/oox/inc/oox/token/namespacemap.hxx index ee05ce480a75..e4daa18f6b56 100644..100755 --- a/oox/inc/oox/helper/recordinputstream.hxx +++ b/oox/inc/oox/token/namespacemap.hxx @@ -25,34 +25,25 @@ * ************************************************************************/ -#ifndef OOX_HELPER_RECORDINPUTSTREAM_HXX -#define OOX_HELPER_RECORDINPUTSTREAM_HXX +#ifndef OOX_TOKEN_NAMESPACEMAP_HXX +#define OOX_TOKEN_NAMESPACEMAP_HXX -#include "oox/helper/binaryinputstream.hxx" +#include <map> +#include <rtl/instance.hxx> +#include <rtl/ustring.hxx> namespace oox { // ============================================================================ -/** Reads the contents of a record from a binary OOBIN stream. */ -class RecordInputStream : public SequenceInputStream -{ -public: - explicit RecordInputStream( const StreamDataSequence& rData ); +/** A map that contains all XML namespace URLs used in the filters. */ +struct NamespaceMap : public ::std::map< sal_Int32, ::rtl::OUString > { NamespaceMap(); }; - /** Reads a string with leading 16-bit or 32-bit length field. */ - ::rtl::OUString readString( bool b32BitLen = true ); - - /** Stream operator for integral types. */ - template< typename Type > - inline RecordInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; } - /** Stream operator for an ::rtl::OUString, reads 32-bit string length and Unicode array. */ - inline RecordInputStream& operator>>( ::rtl::OUString& orString ) { orString = readString(); return *this; } -}; +/** Thread-save singleton of a map of all supported XML namespace URLs. */ +struct StaticNamespaceMap : public ::rtl::Static< NamespaceMap, StaticNamespaceMap > {}; // ============================================================================ } // namespace oox #endif - diff --git a/oox/inc/oox/token/propertylist.hxx b/oox/inc/oox/token/propertynames.hxx index 5f75b13e10c4..5f94e74c2b96 100644 --- a/oox/inc/oox/token/propertylist.hxx +++ b/oox/inc/oox/token/propertynames.hxx @@ -25,10 +25,11 @@ * ************************************************************************/ -#ifndef OOX_TOKEN_PROPERTYLIST_HXX -#define OOX_TOKEN_PROPERTYLIST_HXX +#ifndef OOX_TOKEN_PROPERTYNAMES_HXX +#define OOX_TOKEN_PROPERTYNAMES_HXX #include <vector> +#include <rtl/instance.hxx> #include <rtl/ustring.hxx> namespace oox { @@ -36,15 +37,13 @@ namespace oox { // ============================================================================ /** A vector that contains all predefined property names used in the filters. */ -struct PropertyList : public ::std::vector< ::rtl::OUString > -{ - explicit PropertyList(); - ~PropertyList(); -}; +struct PropertyNameVector : public ::std::vector< ::rtl::OUString > { PropertyNameVector(); }; + +/** Thread-save singleton of a vector of all supported property names. */ +struct StaticPropertyNameVector : public ::rtl::Static< PropertyNameVector, StaticPropertyNameVector > {}; // ============================================================================ } // namespace oox #endif - diff --git a/oox/inc/oox/token/tokenmap.hxx b/oox/inc/oox/token/tokenmap.hxx index 108feee9a2e8..b197c491ac51 100644 --- a/oox/inc/oox/token/tokenmap.hxx +++ b/oox/inc/oox/token/tokenmap.hxx @@ -66,7 +66,6 @@ private: typedef ::std::vector< TokenName > TokenNameVector; TokenNameVector maTokenNames; - }; // ============================================================================ diff --git a/oox/inc/oox/vml/vmldrawing.hxx b/oox/inc/oox/vml/vmldrawing.hxx index a9c1d3506210..c61c25461aa4 100644 --- a/oox/inc/oox/vml/vmldrawing.hxx +++ b/oox/inc/oox/vml/vmldrawing.hxx @@ -30,6 +30,7 @@ #include <map> #include <memory> +#include <vector> #include "oox/ole/oleobjecthelper.hxx" namespace com { namespace sun { namespace star { @@ -37,17 +38,21 @@ namespace com { namespace sun { namespace star { namespace awt { class XControlModel; } namespace drawing { class XDrawPage; } namespace drawing { class XShape; } + namespace drawing { class XShapes; } } } } -namespace oox { namespace core { class XmlFilterBase; } } -namespace oox { namespace ole { class EmbeddedForm; } } +namespace oox { + namespace core { class XmlFilterBase; } + namespace ole { class EmbeddedControl; } + namespace ole { class EmbeddedForm; } +} namespace oox { namespace vml { class ShapeBase; class ShapeContainer; -struct ShapeClientData; +struct ClientData; // ============================================================================ @@ -114,6 +119,9 @@ public: /** Returns the form object used to process ActiveX form controls. */ ::oox::ole::EmbeddedForm& getControlForm() const; + /** Registers a block of shape identifiers reserved by this drawing. Block + size is 1024, shape identifiers are one-based (block 1 => 1025-2048). */ + void registerBlockId( sal_Int32 nBlockId ); /** Registers the passed embedded OLE object. The related shape will then load the OLE object data from the specified fragment. */ void registerOleObject( const OleObjectInfo& rOleObject ); @@ -125,36 +133,65 @@ public: void finalizeFragmentImport(); /** Creates and inserts all UNO shapes into the draw page. The virtual - function notifyShapeInserted() will be called for each new shape. */ + function notifyXShapeInserted() will be called for each new shape. */ void convertAndInsert() const; + /** Returns the local shape index from the passed global shape identifier. */ + sal_Int32 getLocalShapeIndex( const ::rtl::OUString& rShapeId ) const; /** Returns the registered info structure for an OLE object, if extant. */ const OleObjectInfo* getOleObjectInfo( const ::rtl::OUString& rShapeId ) const; /** Returns the registered info structure for a form control, if extant. */ const ControlInfo* getControlInfo( const ::rtl::OUString& rShapeId ) const; + /** Creates a new UNO shape object, inserts it into the passed UNO shape + container, and sets the shape position and size. */ + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + createAndInsertXShape( + const ::rtl::OUString& rService, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; + + /** Creates a new UNO shape object for a form control, inserts the control + model into the form, and the shape into the passed UNO shape container. */ + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + createAndInsertXControlShape( + const ::oox::ole::EmbeddedControl& rControl, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect, + sal_Int32& rnCtrlIndex ) const; + /** Derived classes may disable conversion of specific shapes. */ virtual bool isShapeSupported( const ShapeBase& rShape ) const; + /** Derived classes may return additional base names for automatic shape + name creation. */ + virtual ::rtl::OUString getShapeBaseName( const ShapeBase& rShape ) const; + /** Derived classes may calculate the shape rectangle from a non-standard anchor information string. */ - virtual bool convertShapeClientAnchor( + virtual bool convertClientAnchor( ::com::sun::star::awt::Rectangle& orShapeRect, const ::rtl::OUString& rShapeAnchor ) const; - /** Derived classes may convert additional form control properties from the - passed VML shape client data. */ - virtual void convertControlClientData( - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel, - const ShapeClientData& rClientData ) const; - - /** Derived classes may want to know that a shape has been inserted. Will - be called from the convertAndInsert() implementation. */ - virtual void notifyShapeInserted( + /** Derived classes create a UNO shape according to the passed shape model. + Called for shape models that specify being under host control. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + createAndInsertClientXShape( + const ShapeBase& rShape, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; + + /** Derived classes may want to know that a UNO shape has been inserted. + Will be called from the convertAndInsert() implementation. + @param bGroupChild True = inserted into a group shape, + false = inserted directly into this drawing. */ + virtual void notifyXShapeInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, - const ::com::sun::star::awt::Rectangle& rShapeRect ); + const ::com::sun::star::awt::Rectangle& rShapeRect, + const ShapeBase& rShape, bool bGroupChild ); private: + typedef ::std::vector< sal_Int32 > BlockIdVector; typedef ::std::auto_ptr< ::oox::ole::EmbeddedForm > EmbeddedFormPtr; typedef ::std::auto_ptr< ShapeContainer > ShapeContainerPtr; typedef ::std::map< ::rtl::OUString, OleObjectInfo > OleObjectInfoMap; @@ -163,7 +200,8 @@ private: ::oox::core::XmlFilterBase& mrFilter; /// Filter object that imports/exports the VML drawing. ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxDrawPage; /// UNO draw page used to insert the shapes. - mutable EmbeddedFormPtr mxCtrlForm; /// The control form used to process ActiveX controls. + mutable EmbeddedFormPtr mxCtrlForm; /// The control form used to process embedded controls. + mutable BlockIdVector maBlockIds; /// Block identifiers used by this drawing. ShapeContainerPtr mxShapes; /// All shapes and shape templates. OleObjectInfoMap maOleObjects; /// Info about all embedded OLE objects, mapped by shape id. ControlInfoMap maControls; /// Info about all embedded form controls, mapped by control name. @@ -176,4 +214,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/vml/vmldrawingfragment.hxx b/oox/inc/oox/vml/vmldrawingfragment.hxx index e0ffcd9c5203..0c961db1aabf 100644 --- a/oox/inc/oox/vml/vmldrawingfragment.hxx +++ b/oox/inc/oox/vml/vmldrawingfragment.hxx @@ -63,4 +63,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx index 7bf4135b3f81..887ab8bb0f22 100644 --- a/oox/inc/oox/vml/vmlformatting.hxx +++ b/oox/inc/oox/vml/vmlformatting.hxx @@ -30,8 +30,11 @@ #include "oox/helper/helper.hxx" -namespace oox { class GraphicHelper; } -namespace oox { namespace drawingml { class ShapePropertyMap; } } +namespace oox { + class GraphicHelper; + namespace drawingml { class Color; } + namespace drawingml { class ShapePropertyMap; } +} namespace oox { namespace vml { @@ -109,6 +112,35 @@ public: bool bPixelX, bool bDefaultAsPixel ); + /** Converts VML color attributes to a DrawingML color. + + @param roVmlColor The VML string representation of the color. If + existing, this can be a 3-digit or 6-digit hexadecimal RGB value + with leading '#' character, a predefined color name (e.g. 'black', + 'red', etc.), the index into an application defined color palette + in brackets with leading color name (e.g. 'red [9]' or + 'windowColor [64]'), or a color modifier used in one-color + gradients (e.g. 'fill darken(128)' or 'fill lighten(0)'). + + @param roVmlOpacity The opacity of the color. If existing, this should + be a floating-point value in the range [0.0;1.0]. + + @param nDefaultRgb Deafult RGB color used if the parameter roVmlColor + is empty. + + @param nPrimaryRgb If set to something else than API_RGB_TRANSPARENT, + specifies the color to be used to resolve the color modifiers used + in one-color gradients. + + @return The resulting DrawingML color. + */ + static ::oox::drawingml::Color decodeColor( + const GraphicHelper& rGraphicHelper, + const OptValue< ::rtl::OUString >& roVmlColor, + const OptValue< double >& roVmlOpacity, + sal_Int32 nDefaultRgb, + sal_Int32 nPrimaryRgb = API_RGB_TRANSPARENT ); + private: ConversionHelper(); ~ConversionHelper(); @@ -182,4 +214,3 @@ struct FillModel } // namespace oox #endif - diff --git a/oox/inc/oox/vml/vmlinputstream.hxx b/oox/inc/oox/vml/vmlinputstream.hxx index 311fc17df960..a425425cd0cb 100644 --- a/oox/inc/oox/vml/vmlinputstream.hxx +++ b/oox/inc/oox/vml/vmlinputstream.hxx @@ -66,4 +66,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx index 7c770df28477..ee95c6b61e29 100644 --- a/oox/inc/oox/vml/vmlshape.hxx +++ b/oox/inc/oox/vml/vmlshape.hxx @@ -45,6 +45,19 @@ namespace vml { class Drawing; struct ShapeParentAnchor; class ShapeContainer; +class TextBox; + +// ============================================================================ + +const sal_Int32 VML_CLIENTDATA_UNCHECKED = 0; +const sal_Int32 VML_CLIENTDATA_CHECKED = 1; +const sal_Int32 VML_CLIENTDATA_MIXED = 2; + +const sal_Int32 VML_CLIENTDATA_TEXT = 0; +const sal_Int32 VML_CLIENTDATA_INTEGER = 1; +const sal_Int32 VML_CLIENTDATA_NUMBER = 2; +const sal_Int32 VML_CLIENTDATA_REFERENCE = 3; +const sal_Int32 VML_CLIENTDATA_FORMULA = 4; // ============================================================================ @@ -52,7 +65,7 @@ class ShapeContainer; struct ShapeTypeModel { ::rtl::OUString maShapeId; /// Unique identifier of the shape. - ::rtl::OUString maName; /// Name of the shape, if present. + ::rtl::OUString maShapeName; /// Name of the shape, if present. OptValue< sal_Int32 > moShapeType; /// Builtin shape type identifier. OptValue< Int32Pair > moCoordPos; /// Top-left position of coordinate system for children scaling. @@ -93,6 +106,8 @@ public: /** Returns the shape identifier (which is unique through the containing drawing). */ inline const ::rtl::OUString& getShapeId() const { return maTypeModel.maShapeId; } + /** Returns the application defined shape type. */ + sal_Int32 getShapeType() const; /** Returns the fragment path to the embedded graphic used by this shape. */ ::rtl::OUString getGraphicPath() const; @@ -116,19 +131,39 @@ protected: // ============================================================================ /** Excel specific shape client data (such as cell anchor). */ -struct ShapeClientData +struct ClientData { ::rtl::OUString maAnchor; /// Cell anchor as comma-separated string. - ::rtl::OUString maPictureLink; /// Target cell range of picture links. - ::rtl::OUString maLinkedCell; /// Link to value cell associated to the control. - ::rtl::OUString maSourceRange; /// Link to cell range used as data source for the control. + ::rtl::OUString maFmlaMacro; /// Link to macro associated to the control. + ::rtl::OUString maFmlaPict; /// Target cell range of picture links. + ::rtl::OUString maFmlaLink; /// Link to value cell associated to the control. + ::rtl::OUString maFmlaRange; /// Link to cell range used as data source for the control. + ::rtl::OUString maFmlaGroup; /// Link to value cell associated to a group of option buttons. sal_Int32 mnObjType; /// Type of the shape. + sal_Int32 mnTextHAlign; /// Horizontal text alignment. + sal_Int32 mnTextVAlign; /// Vertical text alignment. sal_Int32 mnCol; /// Column index for spreadsheet cell note. sal_Int32 mnRow; /// Row index for spreadsheet cell note. + sal_Int32 mnChecked; /// State for checkboxes and option buttons. + sal_Int32 mnDropStyle; /// Drop down box style (read-only or editable). + sal_Int32 mnDropLines; /// Number of lines in drop down box. + sal_Int32 mnVal; /// Current value of spin buttons and scroll bars. + sal_Int32 mnMin; /// Minimum value of spin buttons and scroll bars. + sal_Int32 mnMax; /// Maximum value of spin buttons and scroll bars. + sal_Int32 mnInc; /// Small increment of spin buttons and scroll bars. + sal_Int32 mnPage; /// Large increment of spin buttons and scroll bars. + sal_Int32 mnSelType; /// Listbox selection type. + sal_Int32 mnVTEdit; /// Data type of the textbox. bool mbPrintObject; /// True = print the object. bool mbVisible; /// True = cell note is visible. - - explicit ShapeClientData(); + bool mbDde; /// True = object is linked through DDE. + bool mbNo3D; /// True = flat style, false = 3D style. + bool mbNo3D2; /// True = flat style, false = 3D style (listboxes and dropdowns). + bool mbMultiLine; /// True = textbox allows line breaks. + bool mbVScroll; /// True = textbox has a vertical scrollbar. + bool mbSecretEdit; /// True = textbox is a password edit field. + + explicit ClientData(); }; // ---------------------------------------------------------------------------- @@ -136,16 +171,21 @@ struct ShapeClientData struct ShapeModel { typedef ::std::vector< ::com::sun::star::awt::Point > PointVector; - typedef ::std::auto_ptr< ShapeClientData > ShapeClientDataPtr; + typedef ::std::auto_ptr< TextBox > TextBoxPtr; + typedef ::std::auto_ptr< ClientData > ClientDataPtr; ::rtl::OUString maType; /// Shape template with default properties. PointVector maPoints; /// Points for the polyline shape. - ShapeClientDataPtr mxClientData; /// Excel specific shape client data. + TextBoxPtr mxTextBox; /// Text contents and properties. + ClientDataPtr mxClientData; /// Excel specific client data. explicit ShapeModel(); + ~ShapeModel(); + /** Creates and returns a new shape textbox structure. */ + TextBox& createTextBox(); /** Creates and returns a new shape client data structure. */ - ShapeClientData& createClientData(); + ClientData& createClientData(); }; // ---------------------------------------------------------------------------- @@ -160,9 +200,17 @@ public: /** Returns read access to the shape model structure. */ inline const ShapeModel& getShapeModel() const { return maShapeModel; } + /** Returns read access to the shape textbox. */ + inline const TextBox* getTextBox() const { return maShapeModel.mxTextBox.get(); } + /** Returns read access to the shape client data structure. */ + inline const ClientData* getClientData() const { return maShapeModel.mxClientData.get(); } + /** Final processing after import of the drawing fragment. */ virtual void finalizeFragmentImport(); + /** Returns the real shape name if existing, or a generated shape name. */ + ::rtl::OUString getShapeName() const; + /** Returns the shape template with the passed identifier from the child shapes. */ virtual const ShapeType* getChildTypeById( const ::rtl::OUString& rShapeId ) const; /** Returns the shape with the passed identifier from the child shapes. */ @@ -327,4 +375,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/vml/vmlshapecontainer.hxx b/oox/inc/oox/vml/vmlshapecontainer.hxx index a878fda2b74c..7b13763e0e40 100644 --- a/oox/inc/oox/vml/vmlshapecontainer.hxx +++ b/oox/inc/oox/vml/vmlshapecontainer.hxx @@ -29,7 +29,8 @@ #define OOX_VML_VMLSHAPECONTAINER_HXX #include <com/sun/star/awt/Rectangle.hpp> -#include "oox/helper/containerhelper.hxx" +#include "oox/helper/refmap.hxx" +#include "oox/helper/refvector.hxx" namespace com { namespace sun { namespace star { namespace drawing { class XShapes; } @@ -59,6 +60,9 @@ public: explicit ShapeContainer( Drawing& rDrawing ); ~ShapeContainer(); + /** Returns the drawing this shape container is part of. */ + inline Drawing& getDrawing() { return mrDrawing; } + /** Creates and returns a new shape template object. */ ShapeType& createShapeType(); /** Creates and returns a new shape object of the specified type. */ @@ -136,4 +140,3 @@ const ShapeBase* ShapeContainer::findShape( const Functor& rFunctor ) const } // namespace oox #endif - diff --git a/oox/inc/oox/vml/vmlshapecontext.hxx b/oox/inc/oox/vml/vmlshapecontext.hxx index bda7d90f34e2..7236fe7fef2c 100644 --- a/oox/inc/oox/vml/vmlshapecontext.hxx +++ b/oox/inc/oox/vml/vmlshapecontext.hxx @@ -33,10 +33,12 @@ namespace oox { namespace vml { +class Drawing; + struct ShapeTypeModel; class ShapeType; -struct ShapeClientData; +struct ClientData; struct ShapeModel; class ShapeBase; class GroupShape; @@ -45,20 +47,38 @@ class ShapeContainer; // ============================================================================ -class ShapeClientDataContext : public ::oox::core::ContextHandler2 +class ShapeLayoutContext : public ::oox::core::ContextHandler2 +{ +public: + explicit ShapeLayoutContext( + ::oox::core::ContextHandler2Helper& rParent, + Drawing& rDrawing ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + +private: + Drawing& mrDrawing; +}; + +// ============================================================================ + +class ClientDataContext : public ::oox::core::ContextHandler2 { public: - explicit ShapeClientDataContext( + explicit ClientDataContext( ::oox::core::ContextHandler2Helper& rParent, - const AttributeList& rAttribs, - ShapeClientData& rClientData ); + ClientData& rClientData, + const AttributeList& rAttribs ); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); private: - ShapeClientData& mrClientData; + ClientData& mrClientData; + ::rtl::OUString maElementText; }; // ============================================================================ @@ -69,9 +89,9 @@ public: static ::oox::core::ContextHandlerRef createShapeContext( ::oox::core::ContextHandler2Helper& rParent, + ShapeContainer& rShapes, sal_Int32 nElement, - const AttributeList& rAttribs, - ShapeContainer& rShapes ); + const AttributeList& rAttribs ); protected: explicit ShapeContextBase( ::oox::core::ContextHandler2Helper& rParent ); @@ -84,8 +104,8 @@ class ShapeTypeContext : public ShapeContextBase public: explicit ShapeTypeContext( ::oox::core::ContextHandler2Helper& rParent, - const AttributeList& rAttribs, - ShapeType& rShapeType ); + ShapeType& rShapeType, + const AttributeList& rAttribs ); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); @@ -108,8 +128,8 @@ class ShapeContext : public ShapeTypeContext public: explicit ShapeContext( ::oox::core::ContextHandler2Helper& rParent, - const AttributeList& rAttribs, - ShapeBase& rShape ); + ShapeBase& rShape, + const AttributeList& rAttribs ); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); @@ -129,8 +149,8 @@ class GroupShapeContext : public ShapeContext public: explicit GroupShapeContext( ::oox::core::ContextHandler2Helper& rParent, - const AttributeList& rAttribs, - GroupShape& rShape ); + GroupShape& rShape, + const AttributeList& rAttribs ); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); @@ -145,4 +165,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/vml/vmltextbox.hxx b/oox/inc/oox/vml/vmltextbox.hxx new file mode 100755 index 000000000000..5aedaf86bc74 --- /dev/null +++ b/oox/inc/oox/vml/vmltextbox.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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_VML_VMLTEXTBOX_HXX +#define OOX_VML_VMLTEXTBOX_HXX + +#include <vector> +#include <rtl/ustring.hxx> +#include "oox/helper/helper.hxx" + +namespace oox { +namespace vml { + +// ============================================================================ + +/** Font settings for a text portion in a textbox. */ +struct TextFontModel +{ + OptValue< ::rtl::OUString > moName; /// Font name. + OptValue< ::rtl::OUString > moColor; /// Font color, HTML encoded, sort of. + OptValue< sal_Int32 > monSize; /// Font size in twips. + OptValue< sal_Int32 > monUnderline; /// Single or double underline. + OptValue< sal_Int32 > monEscapement; /// Subscript or superscript. + OptValue< bool > mobBold; + OptValue< bool > mobItalic; + OptValue< bool > mobStrikeout; + + explicit TextFontModel(); +}; + +// ============================================================================ + +/** A text portion in a textbox with the same formatting for all characters. */ +struct TextPortionModel +{ + TextFontModel maFont; + ::rtl::OUString maText; + + explicit TextPortionModel( const TextFontModel& rFont, const ::rtl::OUString& rText ); +}; + +// ============================================================================ + +/** The textbox contains all text contents and properties. */ +class TextBox +{ +public: + explicit TextBox(); + + /** Appends a new text portion to the textbox. */ + void appendPortion( const TextFontModel& rFont, const ::rtl::OUString& rText ); + + /** Returns the current number of text portions. */ + inline size_t getPortionCount() const { return maPortions.size(); } + /** Returns the font settings of the first text portion. */ + const TextFontModel* getFirstFont() const; + /** Returns the entire text of all text portions. */ + ::rtl::OUString getText() const; + +private: + typedef ::std::vector< TextPortionModel > PortionVector; + + PortionVector maPortions; +}; + +// ============================================================================ + +} // namespace vml +} // namespace oox + +#endif diff --git a/oox/inc/oox/vml/vmltextboxcontext.hxx b/oox/inc/oox/vml/vmltextboxcontext.hxx new file mode 100755 index 000000000000..1dc8832f9cc4 --- /dev/null +++ b/oox/inc/oox/vml/vmltextboxcontext.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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_VML_VMLTEXTBOXCONTEXT_HXX +#define OOX_VML_VMLTEXTBOXCONTEXT_HXX + +#include "oox/core/contexthandler2.hxx" +#include "oox/vml/vmltextbox.hxx" + +namespace oox { +namespace vml { + +// ============================================================================ + +class TextPortionContext : public ::oox::core::ContextHandler2 +{ +public: + explicit TextPortionContext( + ::oox::core::ContextHandler2Helper& rParent, + TextBox& rTextBox, + const TextFontModel& rParentFont, + sal_Int32 nElement, + const AttributeList& rAttribs ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); + +private: + TextBox& mrTextBox; + TextFontModel maFont; + size_t mnInitialPortions; +}; + +// ============================================================================ + +class TextBoxContext : public ::oox::core::ContextHandler2 +{ +public: + explicit TextBoxContext( + ::oox::core::ContextHandler2Helper& rParent, + TextBox& rTextBox, + const AttributeList& rAttribs ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + +private: + TextBox& mrTextBox; +}; + +// ============================================================================ + +} // namespace vml +} // namespace oox + +#endif diff --git a/oox/inc/oox/xls/addressconverter.hxx b/oox/inc/oox/xls/addressconverter.hxx index c11bd31bbf22..11b5e74ccd5c 100644 --- a/oox/inc/oox/xls/addressconverter.hxx +++ b/oox/inc/oox/xls/addressconverter.hxx @@ -69,7 +69,7 @@ struct BinAddress 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( RecordInputStream& rStrm ); + 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; }; @@ -86,7 +86,7 @@ inline bool operator<( const BinAddress& rL, const BinAddress& rR ) return (rL.mnCol < rR.mnCol) || ((rL.mnCol == rR.mnCol) && (rL.mnRow < rR.mnRow)); } -inline RecordInputStream& operator>>( RecordInputStream& rStrm, BinAddress& orPos ) +inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinAddress& orPos ) { orPos.read( rStrm ); return rStrm; @@ -134,7 +134,7 @@ struct BinRange inline sal_Int32 getRowCount() const { return maLast.mnRow - maFirst.mnRow + 1; } bool contains( const BinAddress& rAddr ) const; - void read( RecordInputStream& rStrm ); + 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; }; @@ -151,7 +151,7 @@ inline bool operator<( const BinRange& rL, const BinRange& rR ) return (rL.maFirst < rR.maFirst) || ((rL.maFirst == rR.maFirst) && (rL.maLast < rR.maLast)); } -inline RecordInputStream& operator>>( RecordInputStream& rStrm, BinRange& orRange ) +inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRange& orRange ) { orRange.read( rStrm ); return rStrm; @@ -179,7 +179,7 @@ public: BinRange getEnclosingRange() const; - void read( RecordInputStream& rStrm ); + 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, @@ -188,7 +188,7 @@ public: // ---------------------------------------------------------------------------- -inline RecordInputStream& operator>>( RecordInputStream& rStrm, BinRangeList& orRanges ) +inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRangeList& orRanges ) { orRanges.read( rStrm ); return rStrm; @@ -221,7 +221,7 @@ enum BiffTargetType // ============================================================================ // ============================================================================ -/** Converter for cell addresses and cell ranges for OOX and BIFF filters. +/** Converter for cell addresses and cell ranges for OOXML and BIFF filters. */ class AddressConverter : public WorkbookHelper { @@ -689,4 +689,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/autofilterbuffer.hxx b/oox/inc/oox/xls/autofilterbuffer.hxx new file mode 100755 index 000000000000..ddf083c2ea98 --- /dev/null +++ b/oox/inc/oox/xls/autofilterbuffer.hxx @@ -0,0 +1,279 @@ +/************************************************************************* + * + * 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 TableFilterField2; } + namespace sheet { class XDatabaseRange; } + namespace sheet { class XSheetFilterDescriptor2; } +} } } + +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::TableFilterField2 > 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 ); +}; + +// ============================================================================ + +/** 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::XSheetFilterDescriptor2 >& 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 diff --git a/oox/inc/oox/xls/autofiltercontext.hxx b/oox/inc/oox/xls/autofiltercontext.hxx index ccef6972e871..13508bbf5e63 100644 --- a/oox/inc/oox/xls/autofiltercontext.hxx +++ b/oox/inc/oox/xls/autofiltercontext.hxx @@ -28,126 +28,82 @@ #ifndef OOX_XLS_AUTOFILTERCONTEXT_HXX #define OOX_XLS_AUTOFILTERCONTEXT_HXX -#define USE_SC_MULTI_STRING_FILTER_PATCH 0 - #include "oox/xls/excelhandlers.hxx" -#include <com/sun/star/table/CellRangeAddress.hpp> - -#if USE_SC_MULTI_STRING_FILTER_PATCH -#include <com/sun/star/sheet/TableFilterFieldBase.hpp> -#else -#include <com/sun/star/sheet/TableFilterField.hpp> -#endif - -#include <boost/shared_ptr.hpp> -#include <list> - -namespace com { namespace sun { namespace star { namespace sheet { -#if USE_SC_MULTI_STRING_FILTER_PATCH - struct TableFilterFieldBase; -#else - struct TableFilterField; -#endif - struct TableFilterFieldMultiString; -}}}} namespace oox { namespace xls { +class AutoFilter; +class FilterColumn; +class FilterSettingsBase; + // ============================================================================ -struct FilterFieldItem +class FilterSettingsContext : public WorksheetContextBase { -#if USE_SC_MULTI_STRING_FILTER_PATCH - typedef ::boost::shared_ptr< ::com::sun::star::sheet::TableFilterFieldBase > TableFilterFieldRef; -#else - typedef ::boost::shared_ptr< ::com::sun::star::sheet::TableFilterField > TableFilterFieldRef; -#endif +public: + explicit FilterSettingsContext( WorksheetContextBase& rParent, FilterSettingsBase& rFilterSettings ); - enum Type { NORMAL, MULTI_STRING }; +protected: + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onStartElement( const AttributeList& rAttribs ); - TableFilterFieldRef mpField; - Type meType; + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); - FilterFieldItem(); - FilterFieldItem(Type eType); +private: + FilterSettingsBase& mrFilterSettings; }; // ============================================================================ -class OoxAutoFilterContext : public OoxWorksheetContextBase +class FilterColumnContext : public WorksheetContextBase { public: - explicit OoxAutoFilterContext( OoxWorksheetFragmentBase& rFragment ); + explicit FilterColumnContext( WorksheetContextBase& rParent, FilterColumn& rFilterColumn ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); virtual void onStartElement( const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); - -private: - /** Initializes data members to prepare for autofilter parsing. Call this - method when a new autofilter context starts. */ - void initialize(); - - /** Commits the imported autofilter data to Calc. */ - void setAutoFilter(); - - /** Check if the shown blank bit is on, if so, add show blank filter to the - list. */ - void maybeShowBlank(); - - /** Packs the collected filter names into a single regex string. */ - void setFilterNames(); - void importAutoFilter( const AttributeList& rAttribs ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); - void importFilterColumn( const AttributeList& rAttribs ); - - void importTop10( const AttributeList& rAttribs ); - - /** Be sure to check for its 'and' attribute when there are two - customFilter's. If the attribute is not given, assume OR. */ - void importCustomFilters( const AttributeList& rAttribs ); +private: + FilterColumn& mrFilterColumn; +}; - /** Imports custumFilter element. Note that the standard specifies there - can be at most two custom filters specified, but no more than two. When - there are two custom filters, then their relationship (AND or OR) must - be specified by the parent element <customFilters>. */ - void importCustomFilter( const AttributeList& rAttribs ); +// ============================================================================ - void importFilters( const AttributeList& rAttribs ); +class AutoFilterContext : public WorksheetContextBase +{ +public: + explicit AutoFilterContext( WorksheetFragmentBase& rFragment, AutoFilter& rAutoFilter ); - void importFilter( const AttributeList& rAttribs ); +protected: + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onStartElement( const AttributeList& rAttribs ); - void importDynamicFilter( const AttributeList& rAttribs ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); private: - typedef ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > XCellRef; - - ::std::list< FilterFieldItem > maFields; - - ::std::list< ::rtl::OUString > maFilterNames; - ::com::sun::star::table::CellRangeAddress maAutoFilterRange; - sal_Int32 mnCurColID; + AutoFilter& mrAutoFilter; +}; - /** If this is false (i.e. the given cell range address is not valid), then - don't do anything. */ - bool mbValidAddress:1; +// ============================================================================ - /** We use regex to compensate for Calc's lack of filtering by individual - names (i.e. <filter> tag). */ - bool mbUseRegex:1; +class BiffAutoFilterContext : public BiffWorksheetContextBase +{ +public: + explicit BiffAutoFilterContext( const WorksheetHelper& rHelper, AutoFilter& rAutoFilter ); - /** The <filters> tag may have a 'blank' attribute when the blank values - need to be shown. This flag stores that information. */ - bool mbShowBlank:1; +protected: + /** Imports all records related to the current auto filter. */ + virtual void importRecord( BiffInputStream& rStrm ); - /** true if FilterConnection_AND, or false if FilterConnection_OR. This - flag is used to store the relationship of paired customFilter's. */ - bool mbConnectionAnd:1; +private: + AutoFilter& mrAutoFilter; }; // ============================================================================ diff --git a/oox/inc/oox/xls/biffcodec.hxx b/oox/inc/oox/xls/biffcodec.hxx index c1c040de095b..9b9157c7e494 100644 --- a/oox/inc/oox/xls/biffcodec.hxx +++ b/oox/inc/oox/xls/biffcodec.hxx @@ -185,4 +185,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/biffdetector.hxx b/oox/inc/oox/xls/biffdetector.hxx index 9ce5d19af3fe..df372c76d7cc 100644 --- a/oox/inc/oox/xls/biffdetector.hxx +++ b/oox/inc/oox/xls/biffdetector.hxx @@ -28,15 +28,15 @@ #ifndef OOX_XLS_BIFFDETECTOR_HXX #define OOX_XLS_BIFFDETECTOR_HXX -#include <com/sun/star/lang/XServiceInfo.hpp> #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 lang { class XMultiServiceFactory; } namespace beans { struct PropertyValue; } + namespace uno { class XComponentContext; } } } } namespace oox { class BinaryInputStream; } @@ -53,7 +53,8 @@ class BiffDetector : public ::cppu::WeakImplHelper2< { public: explicit BiffDetector( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); virtual ~BiffDetector(); @@ -63,7 +64,7 @@ public: /** Detects the BIFF version and workbook stream name of the passed storage. */ static BiffType detectStorageBiffVersion( ::rtl::OUString& orWorkbookStreamName, - StorageRef xStorage ); + const StorageRef& rxStorage ); // com.sun.star.lang.XServiceInfo interface ------------------------------- @@ -84,8 +85,8 @@ public: throw( ::com::sun::star::uno::RuntimeException ); private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - mxFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + mxContext; }; // ============================================================================ @@ -94,4 +95,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx index f1a732816d52..5a65eb088315 100644 --- a/oox/inc/oox/xls/biffhelper.hxx +++ b/oox/inc/oox/xls/biffhelper.hxx @@ -30,217 +30,229 @@ #include "oox/helper/binarystreambase.hxx" +namespace oox { class SequenceInputStream; } + namespace oox { namespace xls { class BiffInputStream; -// OOBIN record identifiers =================================================== - -const sal_Int32 OOBIN_ID_ARRAY = 0x01AA; -const sal_Int32 OOBIN_ID_AUTOFILTER = 0x00A1; -const sal_Int32 OOBIN_ID_AUTOSORTSCOPE = 0x01CB; -const sal_Int32 OOBIN_ID_BINARYINDEXBLOCK = 0x002A; -const sal_Int32 OOBIN_ID_BINARYINDEXROWS = 0x0028; -const sal_Int32 OOBIN_ID_BOOKVIEWS = 0x0087; -const sal_Int32 OOBIN_ID_BORDER = 0x002E; -const sal_Int32 OOBIN_ID_BORDERS = 0x0265; -const sal_Int32 OOBIN_ID_BRK = 0x018C; -const sal_Int32 OOBIN_ID_CALCPR = 0x009D; -const sal_Int32 OOBIN_ID_CELL_BLANK = 0x0001; -const sal_Int32 OOBIN_ID_CELL_BOOL = 0x0004; -const sal_Int32 OOBIN_ID_CELL_DOUBLE = 0x0005; -const sal_Int32 OOBIN_ID_CELL_ERROR = 0x0003; -const sal_Int32 OOBIN_ID_CELL_RK = 0x0002; -const sal_Int32 OOBIN_ID_CELL_RSTRING = 0x003E; -const sal_Int32 OOBIN_ID_CELL_SI = 0x0007; -const sal_Int32 OOBIN_ID_CELL_STRING = 0x0006; -const sal_Int32 OOBIN_ID_CELLSTYLE = 0x0030; -const sal_Int32 OOBIN_ID_CELLSTYLES = 0x026B; -const sal_Int32 OOBIN_ID_CELLSTYLEXFS = 0x0272; -const sal_Int32 OOBIN_ID_CELLXFS = 0x0269; -const sal_Int32 OOBIN_ID_CFCOLOR = 0x0234; -const sal_Int32 OOBIN_ID_CFRULE = 0x01CF; -const sal_Int32 OOBIN_ID_CHARTPAGESETUP = 0x028C; -const sal_Int32 OOBIN_ID_CHARTPROTECTION = 0x029D; -const sal_Int32 OOBIN_ID_CHARTSHEETPR = 0x028B; -const sal_Int32 OOBIN_ID_CHARTSHEETVIEW = 0x008D; -const sal_Int32 OOBIN_ID_CHARTSHEETVIEWS = 0x008B; -const sal_Int32 OOBIN_ID_COL = 0x003C; -const sal_Int32 OOBIN_ID_COLBREAKS = 0x018A; -const sal_Int32 OOBIN_ID_COLOR = 0x023C; -const sal_Int32 OOBIN_ID_COLORS = 0x01D9; -const sal_Int32 OOBIN_ID_COLORSCALE = 0x01D5; -const sal_Int32 OOBIN_ID_COLS = 0x0186; -const sal_Int32 OOBIN_ID_COMMENT = 0x027B; -const sal_Int32 OOBIN_ID_COMMENTAUTHOR = 0x0278; -const sal_Int32 OOBIN_ID_COMMENTAUTHORS = 0x0276; -const sal_Int32 OOBIN_ID_COMMENTLIST = 0x0279; -const sal_Int32 OOBIN_ID_COMMENTS = 0x0274; -const sal_Int32 OOBIN_ID_COMMENTTEXT = 0x027D; -const sal_Int32 OOBIN_ID_CONDFORMATTING = 0x01CD; -const sal_Int32 OOBIN_ID_CONTROL = 0x0284; -const sal_Int32 OOBIN_ID_CONTROLS = 0x0283; -const sal_Int32 OOBIN_ID_CUSTOMCHARTVIEW = 0x028F; -const sal_Int32 OOBIN_ID_CUSTOMCHARTVIEWS = 0x028D; -const sal_Int32 OOBIN_ID_CUSTOMSHEETVIEW = 0x01A7; -const sal_Int32 OOBIN_ID_CUSTOMSHEETVIEWS = 0x01A6; -const sal_Int32 OOBIN_ID_CUSTOMWORKBOOKVIEW = 0x018D; -const sal_Int32 OOBIN_ID_DATABAR = 0x01D3; -const sal_Int32 OOBIN_ID_DATATABLE = 0x01AC; -const sal_Int32 OOBIN_ID_DATAVALIDATION = 0x0040; -const sal_Int32 OOBIN_ID_DATAVALIDATIONS = 0x023D; -const sal_Int32 OOBIN_ID_DDEITEMVALUES = 0x0242; -const sal_Int32 OOBIN_ID_DDEITEM_BOOL = 0x0248; -const sal_Int32 OOBIN_ID_DDEITEM_DOUBLE = 0x0244; -const sal_Int32 OOBIN_ID_DDEITEM_ERROR = 0x0245; -const sal_Int32 OOBIN_ID_DDEITEM_STRING = 0x0246; -const sal_Int32 OOBIN_ID_DEFINEDNAME = 0x0027; -const sal_Int32 OOBIN_ID_DIMENSION = 0x0094; -const sal_Int32 OOBIN_ID_DRAWING = 0x0226; -const sal_Int32 OOBIN_ID_DXF = 0x01FB; -const sal_Int32 OOBIN_ID_DXFS = 0x01F9; -const sal_Int32 OOBIN_ID_EXTCELL_BLANK = 0x016F; -const sal_Int32 OOBIN_ID_EXTCELL_BOOL = 0x0171; -const sal_Int32 OOBIN_ID_EXTCELL_DOUBLE = 0x0170; -const sal_Int32 OOBIN_ID_EXTCELL_ERROR = 0x0172; -const sal_Int32 OOBIN_ID_EXTCELL_STRING = 0x0173; -const sal_Int32 OOBIN_ID_EXTERNALADDIN = 0x029B; -const sal_Int32 OOBIN_ID_EXTERNALBOOK = 0x0168; -const sal_Int32 OOBIN_ID_EXTERNALNAME = 0x0241; -const sal_Int32 OOBIN_ID_EXTERNALREF = 0x0163; -const sal_Int32 OOBIN_ID_EXTERNALREFS = 0x0161; -const sal_Int32 OOBIN_ID_EXTERNALSELF = 0x0165; -const sal_Int32 OOBIN_ID_EXTERNALSAME = 0x0166; -const sal_Int32 OOBIN_ID_EXTERNALSHEETS = 0x016A; -const sal_Int32 OOBIN_ID_EXTROW = 0x016E; -const sal_Int32 OOBIN_ID_EXTSHEETDATA = 0x016B; -const sal_Int32 OOBIN_ID_EXTERNALNAMEFLAGS = 0x024A; -const sal_Int32 OOBIN_ID_EXTSHEETNAMES = 0x0167; -const sal_Int32 OOBIN_ID_FILESHARING = 0x0224; -const sal_Int32 OOBIN_ID_FILEVERSION = 0x0080; -const sal_Int32 OOBIN_ID_FILL = 0x002D; -const sal_Int32 OOBIN_ID_FILLS = 0x025B; -const sal_Int32 OOBIN_ID_FILTERCOLUMN = 0x00A3; -const sal_Int32 OOBIN_ID_FONT = 0x002B; -const sal_Int32 OOBIN_ID_FONTS = 0x0263; -const sal_Int32 OOBIN_ID_FORMULA_STRING = 0x0008; -const sal_Int32 OOBIN_ID_FORMULA_DOUBLE = 0x0009; -const sal_Int32 OOBIN_ID_FORMULA_BOOL = 0x000A; -const sal_Int32 OOBIN_ID_FORMULA_ERROR = 0x000B; -const sal_Int32 OOBIN_ID_FUNCTIONGROUP = 0x0299; -const sal_Int32 OOBIN_ID_FUNCTIONGROUPS = 0x0298; -const sal_Int32 OOBIN_ID_HEADERFOOTER = 0x01DF; -const sal_Int32 OOBIN_ID_HYPERLINK = 0x01EE; -const sal_Int32 OOBIN_ID_ICONSET = 0x01D1; -const sal_Int32 OOBIN_ID_INDEXEDCOLORS = 0x0235; -const sal_Int32 OOBIN_ID_INPUTCELLS = 0x01F8; -const sal_Int32 OOBIN_ID_LEGACYDRAWING = 0x0227; -const sal_Int32 OOBIN_ID_MERGECELL = 0x00B0; -const sal_Int32 OOBIN_ID_MERGECELLS = 0x00B1; -const sal_Int32 OOBIN_ID_MRUCOLORS = 0x0239; -const sal_Int32 OOBIN_ID_MULTCELL_BLANK = 0x000C; -const sal_Int32 OOBIN_ID_MULTCELL_BOOL = 0x000F; -const sal_Int32 OOBIN_ID_MULTCELL_DOUBLE = 0x0010; -const sal_Int32 OOBIN_ID_MULTCELL_ERROR = 0x000E; -const sal_Int32 OOBIN_ID_MULTCELL_RK = 0x000D; -const sal_Int32 OOBIN_ID_MULTCELL_RSTRING = 0x003D; -const sal_Int32 OOBIN_ID_MULTCELL_SI = 0x0012; -const sal_Int32 OOBIN_ID_MULTCELL_STRING = 0x0011; -const sal_Int32 OOBIN_ID_NUMFMT = 0x002C; -const sal_Int32 OOBIN_ID_NUMFMTS = 0x0267; -const sal_Int32 OOBIN_ID_OLEOBJECT = 0x027F; -const sal_Int32 OOBIN_ID_OLEOBJECTS = 0x027E; -const sal_Int32 OOBIN_ID_OLESIZE = 0x0225; -const sal_Int32 OOBIN_ID_PAGEMARGINS = 0x01DC; -const sal_Int32 OOBIN_ID_PAGESETUP = 0x01DE; -const sal_Int32 OOBIN_ID_PANE = 0x0097; -const sal_Int32 OOBIN_ID_PCDEFINITION = 0x00B3; -const sal_Int32 OOBIN_ID_PCDFDISCRETEPR = 0x00E1; -const sal_Int32 OOBIN_ID_PCDFGROUPITEMS = 0x00DD; -const sal_Int32 OOBIN_ID_PCDFIELD = 0x00B7; -const sal_Int32 OOBIN_ID_PCDFIELDGROUP = 0x00DB; -const sal_Int32 OOBIN_ID_PCDFIELDS = 0x00B5; -const sal_Int32 OOBIN_ID_PCDFRANGEPR = 0x00DF; -const sal_Int32 OOBIN_ID_PCDFSHAREDITEMS = 0x00BD; -const sal_Int32 OOBIN_ID_PCDSHEETSOURCE = 0x00BB; -const sal_Int32 OOBIN_ID_PCDSOURCE = 0x00B9; -const sal_Int32 OOBIN_ID_PCITEM_ARRAY = 0x00BF; -const sal_Int32 OOBIN_ID_PCITEM_BOOL = 0x0016; -const sal_Int32 OOBIN_ID_PCITEM_DATE = 0x0019; -const sal_Int32 OOBIN_ID_PCITEM_DOUBLE = 0x0015; -const sal_Int32 OOBIN_ID_PCITEM_ERROR = 0x0017; -const sal_Int32 OOBIN_ID_PCITEM_INDEX = 0x001A; -const sal_Int32 OOBIN_ID_PCITEM_MISSING = 0x0014; -const sal_Int32 OOBIN_ID_PCITEM_STRING = 0x0018; -const sal_Int32 OOBIN_ID_PCITEMA_BOOL = 0x001D; -const sal_Int32 OOBIN_ID_PCITEMA_DATE = 0x0020; -const sal_Int32 OOBIN_ID_PCITEMA_DOUBLE = 0x001C; -const sal_Int32 OOBIN_ID_PCITEMA_ERROR = 0x001E; -const sal_Int32 OOBIN_ID_PCITEMA_MISSING = 0x001B; -const sal_Int32 OOBIN_ID_PCITEMA_STRING = 0x001F; -const sal_Int32 OOBIN_ID_PCRECORD = 0x0021; -const sal_Int32 OOBIN_ID_PCRECORDDT = 0x0022; -const sal_Int32 OOBIN_ID_PCRECORDS = 0x00C1; -const sal_Int32 OOBIN_ID_PHONETICPR = 0x0219; -const sal_Int32 OOBIN_ID_PICTURE = 0x0232; -const sal_Int32 OOBIN_ID_PIVOTAREA = 0x00F7; -const sal_Int32 OOBIN_ID_PIVOTCACHE = 0x0182; -const sal_Int32 OOBIN_ID_PIVOTCACHES = 0x0180; -const sal_Int32 OOBIN_ID_PRINTOPTIONS = 0x01DD; -const sal_Int32 OOBIN_ID_PTCOLFIELDS = 0x0137; -const sal_Int32 OOBIN_ID_PTDATAFIELD = 0x0125; -const sal_Int32 OOBIN_ID_PTDATAFIELDS = 0x0127; -const sal_Int32 OOBIN_ID_PTDEFINITION = 0x0118; -const sal_Int32 OOBIN_ID_PTFIELD = 0x011D; -const sal_Int32 OOBIN_ID_PTFIELDS = 0x011F; -const sal_Int32 OOBIN_ID_PTFILTER = 0x0259; -const sal_Int32 OOBIN_ID_PTFILTERS = 0x0257; -const sal_Int32 OOBIN_ID_PTFITEM = 0x011A; -const sal_Int32 OOBIN_ID_PTFITEMS = 0x011B; -const sal_Int32 OOBIN_ID_PTLOCATION = 0x013A; -const sal_Int32 OOBIN_ID_PTPAGEFIELD = 0x0121; -const sal_Int32 OOBIN_ID_PTPAGEFIELDS = 0x0123; -const sal_Int32 OOBIN_ID_PTREFERENCE = 0x00FB; -const sal_Int32 OOBIN_ID_PTREFERENCEITEM = 0x017E; -const sal_Int32 OOBIN_ID_PTREFERENCES = 0x00F9; -const sal_Int32 OOBIN_ID_PTROWFIELDS = 0x0135; -const sal_Int32 OOBIN_ID_RGBCOLOR = 0x01DB; -const sal_Int32 OOBIN_ID_ROW = 0x0000; -const sal_Int32 OOBIN_ID_ROWBREAKS = 0x0188; -const sal_Int32 OOBIN_ID_SCENARIO = 0x01F6; -const sal_Int32 OOBIN_ID_SCENARIOS = 0x01F4; -const sal_Int32 OOBIN_ID_SELECTION = 0x0098; -const sal_Int32 OOBIN_ID_SHAREDFMLA = 0x01AB; -const sal_Int32 OOBIN_ID_SHEET = 0x009C; -const sal_Int32 OOBIN_ID_SHEETDATA = 0x0091; -const sal_Int32 OOBIN_ID_SHEETFORMATPR = 0x01E5; -const sal_Int32 OOBIN_ID_SHEETPR = 0x0093; -const sal_Int32 OOBIN_ID_SHEETPROTECTION = 0x0217; -const sal_Int32 OOBIN_ID_SHEETS = 0x008F; -const sal_Int32 OOBIN_ID_SHEETVIEW = 0x0089; -const sal_Int32 OOBIN_ID_SHEETVIEWS = 0x0085; -const sal_Int32 OOBIN_ID_SI = 0x0013; -const sal_Int32 OOBIN_ID_SST = 0x009F; -const sal_Int32 OOBIN_ID_STYLESHEET = 0x0116; -const sal_Int32 OOBIN_ID_TABLE = 0x0157; -const sal_Int32 OOBIN_ID_TABLEPART = 0x0295; -const sal_Int32 OOBIN_ID_TABLEPARTS = 0x0294; -const sal_Int32 OOBIN_ID_TABLESTYLEINFO = 0x0201; -const sal_Int32 OOBIN_ID_TABLESTYLES = 0x01FC; -const sal_Int32 OOBIN_ID_TOP10FILTER = 0x00AA; -const sal_Int32 OOBIN_ID_VOLTYPE = 0x0204; -const sal_Int32 OOBIN_ID_VOLTYPEMAIN = 0x0206; -const sal_Int32 OOBIN_ID_VOLTYPES = 0x0202; -const sal_Int32 OOBIN_ID_VOLTYPESTP = 0x020A; -const sal_Int32 OOBIN_ID_VOLTYPETR = 0x020B; -const sal_Int32 OOBIN_ID_WORKBOOK = 0x0083; -const sal_Int32 OOBIN_ID_WORKBOOKPR = 0x0099; -const sal_Int32 OOBIN_ID_WORKBOOKVIEW = 0x009E; -const sal_Int32 OOBIN_ID_WORKSHEET = 0x0081; -const sal_Int32 OOBIN_ID_XF = 0x002F; +// 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 @@ -260,6 +272,7 @@ const sal_uInt16 BIFF8_MAXRECSIZE = 8224; 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; @@ -352,6 +365,7 @@ 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; @@ -363,6 +377,7 @@ 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; @@ -385,6 +400,8 @@ 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; @@ -435,6 +452,7 @@ 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; @@ -470,6 +488,10 @@ 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; @@ -496,7 +518,6 @@ 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_SXEXT = 0x00DC; const sal_uInt16 BIFF_ID_TABLESTYLES = 0x088E; const sal_uInt16 BIFF_ID_THEME = 0x0896; const sal_uInt16 BIFF_ID_TOPMARGIN = 0x0028; @@ -521,6 +542,8 @@ 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. @@ -563,7 +586,10 @@ const sal_uInt8 BIFF_DATATYPE_STRING = 2; const sal_uInt8 BIFF_DATATYPE_BOOL = 4; const sal_uInt8 BIFF_DATATYPE_ERROR = 16; -// unicode strings ------------------------------------------------------------ +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; @@ -592,6 +618,32 @@ public: /** 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 ); + + // 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 ); @@ -600,10 +652,18 @@ private: ~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 - diff --git a/oox/inc/oox/xls/biffinputstream.hxx b/oox/inc/oox/xls/biffinputstream.hxx index c804d2c9c6e0..003ab28be34f 100644 --- a/oox/inc/oox/xls/biffinputstream.hxx +++ b/oox/inc/oox/xls/biffinputstream.hxx @@ -444,4 +444,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/biffoutputstream.hxx b/oox/inc/oox/xls/biffoutputstream.hxx index 6e36b08d3592..ada646bd879a 100644 --- a/oox/inc/oox/xls/biffoutputstream.hxx +++ b/oox/inc/oox/xls/biffoutputstream.hxx @@ -162,4 +162,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/chartsheetfragment.hxx b/oox/inc/oox/xls/chartsheetfragment.hxx index dc8e0f85fd13..8dfedc5ba48e 100644 --- a/oox/inc/oox/xls/chartsheetfragment.hxx +++ b/oox/inc/oox/xls/chartsheetfragment.hxx @@ -35,24 +35,20 @@ namespace xls { // ============================================================================ -class OoxChartsheetFragment : public OoxWorksheetFragmentBase +class ChartsheetFragment : public WorksheetFragmentBase { public: - explicit OoxChartsheetFragment( + explicit ChartsheetFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rFragmentPath, - ISegmentProgressBarRef xProgressBar, + const ISegmentProgressBarRef& rxProgressBar, sal_Int16 nSheet ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); + virtual void onCharacters( const ::rtl::OUString& rChars ); - // oox.core.FragmentHandler2 interface ------------------------------------ + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; virtual void initializeImport(); @@ -62,7 +58,7 @@ 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( RecordInputStream& rStrm ); + void importDrawing( SequenceInputStream& rStrm ); }; // ============================================================================ @@ -72,7 +68,7 @@ class BiffChartsheetFragment : public BiffWorksheetFragmentBase public: explicit BiffChartsheetFragment( const BiffWorkbookFragmentBase& rParent, - ISegmentProgressBarRef xProgressBar, + const ISegmentProgressBarRef& rxProgressBar, sal_Int16 nSheet ); /** Imports the entire sheet fragment, returns true, if EOF record has been reached. */ @@ -85,4 +81,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/commentsbuffer.hxx b/oox/inc/oox/xls/commentsbuffer.hxx index 203c5103b54b..406a03534584 100644 --- a/oox/inc/oox/xls/commentsbuffer.hxx +++ b/oox/inc/oox/xls/commentsbuffer.hxx @@ -59,7 +59,7 @@ public: /** Imports a cell comment from the passed attributes of the comment element. */ void importComment( const AttributeList& rAttribs ); /** Imports a cell comment from the passed stream of a COMMENT record. */ - void importComment( RecordInputStream& rStrm ); + void importComment( SequenceInputStream& rStrm ); /** Imports a cell comment from the passed stream of a NOTE record. */ void importNote( BiffInputStream& rStrm ); @@ -112,4 +112,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/commentsfragment.hxx b/oox/inc/oox/xls/commentsfragment.hxx index 584c6a2bb340..3751cde764f4 100644 --- a/oox/inc/oox/xls/commentsfragment.hxx +++ b/oox/inc/oox/xls/commentsfragment.hxx @@ -36,30 +36,27 @@ namespace xls { // ============================================================================ -class OoxCommentsFragment : public OoxWorksheetFragmentBase +class CommentsFragment : public WorksheetFragmentBase { public: - explicit OoxCommentsFragment( + explicit CommentsFragment( const WorksheetHelper& rHelper, const ::rtl::OUString& rFragmentPath ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual void onEndRecord(); - // oox.core.FragmentHandler2 interface ------------------------------------ - 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( RecordInputStream& rStrm ); + void importComment( SequenceInputStream& rStrm ); private: CommentRef mxComment; @@ -71,4 +68,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/condformatbuffer.hxx b/oox/inc/oox/xls/condformatbuffer.hxx index 25259ce04295..fae6381f6402 100644 --- a/oox/inc/oox/xls/condformatbuffer.hxx +++ b/oox/inc/oox/xls/condformatbuffer.hxx @@ -29,7 +29,6 @@ #define OOX_XLS_CONDFORMATBUFFER_HXX #include <com/sun/star/sheet/ConditionOperator.hpp> -#include "oox/helper/containerhelper.hxx" #include "oox/xls/formulaparser.hxx" #include "oox/xls/worksheethelper.hxx" @@ -64,11 +63,11 @@ struct CondFormatRuleModel explicit CondFormatRuleModel(); - /** Sets the passed OOBIN or BIFF operator for condition type cellIs. */ - void setBinOperator( sal_Int32 nOperator ); + /** Sets the passed BIFF operator for condition type cellIs. */ + void setBiffOperator( sal_Int32 nOperator ); - /** Sets the passed OOBIN text comparison type and operator. */ - void setOobTextType( sal_Int32 nOperator ); + /** Sets the passed BIFF12 text comparison type and operator. */ + void setBiff12TextType( sal_Int32 nOperator ); }; // ============================================================================ @@ -87,7 +86,7 @@ public: void appendFormula( const ::rtl::OUString& rFormula ); /** Imports rule settings from a CFRULE record. */ - void importCfRule( RecordInputStream& rStrm ); + void importCfRule( SequenceInputStream& rStrm ); /** Imports rule settings from a CFRULE record. */ void importCfRule( BiffInputStream& rStrm, sal_Int32 nPriority ); @@ -131,9 +130,9 @@ public: CondFormatRuleRef importCfRule( const AttributeList& rAttribs ); /** Imports settings from the CONDFORMATTING record. */ - void importCondFormatting( RecordInputStream& rStrm ); + void importCondFormatting( SequenceInputStream& rStrm ); /** Imports a conditional formatting rule from the CFRULE record. */ - void importCfRule( RecordInputStream& rStrm ); + void importCfRule( SequenceInputStream& rStrm ); /** Imports settings from the CFHEADER record. */ void importCfHeader( BiffInputStream& rStrm ); @@ -167,7 +166,7 @@ public: /** Imports settings from the conditionalFormatting element. */ CondFormatRef importConditionalFormatting( const AttributeList& rAttribs ); /** Imports settings from the CONDFORMATTING record. */ - CondFormatRef importCondFormatting( RecordInputStream& rStrm ); + CondFormatRef importCondFormatting( SequenceInputStream& rStrm ); /** Imports settings from the CFHEADER record. */ void importCfHeader( BiffInputStream& rStrm ); @@ -192,4 +191,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/condformatcontext.hxx b/oox/inc/oox/xls/condformatcontext.hxx index 799e3127b7a3..44c9fe592250 100644 --- a/oox/inc/oox/xls/condformatcontext.hxx +++ b/oox/inc/oox/xls/condformatcontext.hxx @@ -36,20 +36,18 @@ namespace xls { // ============================================================================ -class OoxCondFormatContext : public OoxWorksheetContextBase +class CondFormatContext : public WorksheetContextBase { public: - explicit OoxCondFormatContext( OoxWorksheetFragmentBase& rFragment ); + explicit CondFormatContext( WorksheetFragmentBase& rFragment ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); virtual void onStartElement( const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - virtual void onStartRecord( RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); private: CondFormatRef mxCondFmt; @@ -62,4 +60,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/connectionsbuffer.hxx b/oox/inc/oox/xls/connectionsbuffer.hxx new file mode 100755 index 000000000000..98a5bea17bc6 --- /dev/null +++ b/oox/inc/oox/xls/connectionsbuffer.hxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * 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 diff --git a/oox/inc/oox/xls/connectionsfragment.hxx b/oox/inc/oox/xls/connectionsfragment.hxx index 85951a5bbfc7..5a9a9085c6c5 100644 --- a/oox/inc/oox/xls/connectionsfragment.hxx +++ b/oox/inc/oox/xls/connectionsfragment.hxx @@ -29,31 +29,45 @@ #define OOX_XLS_CONNECTIONSFRAGMENT_HXX #include "oox/xls/excelhandlers.hxx" -#include "oox/xls/workbookhelper.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 OoxConnectionsFragment : public OoxWorkbookFragmentBase +class ConnectionsFragment : public WorkbookFragmentBase { public: - explicit OoxConnectionsFragment( + explicit ConnectionsFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rFragmentPath ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); -private: - void importConnection( const AttributeList& rAttribs ); - void importWebPr( const AttributeList& rAttribs ); - void importTables( const AttributeList& rAttribs ); - void importS( const AttributeList& rAttribs ); - void importX( const AttributeList& rAttribs ); + virtual const ::oox::core::RecordInfo* getRecordInfos() const; + virtual void finalizeImport(); }; // ============================================================================ @@ -62,4 +76,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/defnamesbuffer.hxx b/oox/inc/oox/xls/defnamesbuffer.hxx index 45208f0ac344..5374c47f6a07 100644 --- a/oox/inc/oox/xls/defnamesbuffer.hxx +++ b/oox/inc/oox/xls/defnamesbuffer.hxx @@ -28,8 +28,6 @@ #ifndef OOX_XLS_DEFINEDNAMESBUFFER_HXX #define OOX_XLS_DEFINEDNAMESBUFFER_HXX -#include "oox/helper/containerhelper.hxx" -#include "oox/helper/recordinputstream.hxx" #include "oox/xls/formulabase.hxx" namespace com { namespace sun { namespace star { @@ -45,21 +43,21 @@ class BiffInputStreamPos; // ============================================================================ // codes for built-in names -const sal_Unicode OOX_DEFNAME_CONSOLIDATEAREA = '\x00'; -const sal_Unicode OOX_DEFNAME_AUTOOPEN = '\x01'; -const sal_Unicode OOX_DEFNAME_AUTOCLOSE = '\x02'; -const sal_Unicode OOX_DEFNAME_EXTRACT = '\x03'; -const sal_Unicode OOX_DEFNAME_DATABASE = '\x04'; -const sal_Unicode OOX_DEFNAME_CRITERIA = '\x05'; -const sal_Unicode OOX_DEFNAME_PRINTAREA = '\x06'; -const sal_Unicode OOX_DEFNAME_PRINTTITLES = '\x07'; -const sal_Unicode OOX_DEFNAME_RECORDER = '\x08'; -const sal_Unicode OOX_DEFNAME_DATAFORM = '\x09'; -const sal_Unicode OOX_DEFNAME_AUTOACTIVATE = '\x0A'; -const sal_Unicode OOX_DEFNAME_AUTODEACTIVATE = '\x0B'; -const sal_Unicode OOX_DEFNAME_SHEETTITLE = '\x0C'; -const sal_Unicode OOX_DEFNAME_FILTERDATABASE = '\x0D'; -const sal_Unicode OOX_DEFNAME_UNKNOWN = '\x0E'; +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'; // ============================================================================ @@ -69,9 +67,9 @@ struct DefinedNameModel ::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 (VBasic or sheet macro). + bool mbMacro; /// True = Macro name (VBA or sheet macro). bool mbFunction; /// True = function, false = command. - bool mbVBName; /// True = VBasic macro, false = sheet macro. + bool mbVBName; /// True = VBA macro, false = sheet macro. bool mbHidden; /// True = name hidden in UI. explicit DefinedNameModel(); @@ -96,10 +94,10 @@ public: ::com::sun::star::uno::Any getReference( const ::com::sun::star::table::CellAddress& rBaseAddress ) const; protected: - /** Imports the OOX formula string, using the passed formula context. */ + /** Imports the OOXML formula string, using the passed formula context. */ void importOoxFormula( FormulaContext& rContext, sal_Int16 nBaseSheet ); - /** Imports the OOBIN formula, using the passed formula context. */ - void importOobFormula( FormulaContext& rContext, sal_Int16 nBaseSheet, RecordInputStream& rStrm ); + /** Imports the BIFF12 formula, using the passed formula context. */ + void importBiff12Formula( FormulaContext& rContext, sal_Int16 nBaseSheet, SequenceInputStream& rStrm ); /** Imports the BIFF formula, using the passed formula context. */ void importBiffFormula( FormulaContext& rContext, sal_Int16 nBaseSheet, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ); @@ -125,7 +123,7 @@ public: /** 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( RecordInputStream& rStrm ); + void importDefinedName( SequenceInputStream& rStrm ); /** Imports the defined name from a DEFINEDNAME record in the passed BIFF stream. */ void importDefinedName( BiffInputStream& rStrm, sal_Int16 nCalcSheet ); @@ -134,22 +132,26 @@ public: /** 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 != OOX_DEFNAME_UNKNOWN; } + 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 global in the document. */ - inline bool isGlobalName() const { return mnCalcSheet < 0; } + /** Returns true, if this defined name is a reference to a VBA macro. */ + inline bool isVBName() const { return maModel.mbMacro && maModel.mbVBName; } - /** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */ - inline sal_Int32 getTokenIndex() const { return mnTokenIndex; } /** 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 OOX or OOBIN formula, using the passed formula context. */ + /** Imports the OOXML or BIFF12 formula, using the passed formula context. */ void implImportOoxFormula( FormulaContext& rContext ); /** Imports the BIFF formula, using the passed formula context. */ void implImportBiffFormula( FormulaContext& rContext ); @@ -163,7 +165,7 @@ private: 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 OOBIN import. + 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. }; @@ -183,7 +185,7 @@ public: /** 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( RecordInputStream& rStrm ); + void importDefinedName( SequenceInputStream& rStrm ); /** Imports a defined name from a DEFINEDNAME record in the passed BIFF stream. */ void importDefinedName( BiffInputStream& rStrm ); @@ -199,16 +201,27 @@ public: 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< sal_Int32, DefinedName > DefNameMap; + 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. - DefNameMap maDefNameMap; /// Maps all defined names by API token index. + 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). }; @@ -218,4 +231,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/drawingfragment.hxx b/oox/inc/oox/xls/drawingfragment.hxx index a6877edf7cca..d71c1a25b436 100644 --- a/oox/inc/oox/xls/drawingfragment.hxx +++ b/oox/inc/oox/xls/drawingfragment.hxx @@ -31,29 +31,102 @@ #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 OoxDrawingFragment : public OoxWorksheetFragmentBase +class DrawingFragment : public WorksheetFragmentBase { public: - explicit OoxDrawingFragment( + explicit DrawingFragment( const WorksheetHelper& rHelper, const ::rtl::OUString& rFragmentPath ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); private: typedef ::std::auto_ptr< ShapeAnchor > ShapeAnchorRef; @@ -65,6 +138,27 @@ private: }; // ============================================================================ +// 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 { @@ -77,29 +171,55 @@ public: /** 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 convertShapeClientAnchor( + virtual bool convertClientAnchor( ::com::sun::star::awt::Rectangle& orShapeRect, const ::rtl::OUString& rShapeAnchor ) const; - /** Converts additional form control properties from the passed VML shape - client data. */ - virtual void convertControlClientData( - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel, - const ::oox::vml::ShapeClientData& rClientData ) 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 notifyShapeInserted( + virtual void notifyXShapeInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, - const ::com::sun::star::awt::Rectangle& rShapeRect ); + 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 OoxVmlDrawingFragment : public ::oox::vml::DrawingFragment, public WorksheetHelper +class VmlDrawingFragment : public ::oox::vml::DrawingFragment, public WorksheetHelper { public: - explicit OoxVmlDrawingFragment( + explicit VmlDrawingFragment( const WorksheetHelper& rHelper, const ::rtl::OUString& rFragmentPath ); @@ -113,4 +233,3 @@ protected: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/excelchartconverter.hxx b/oox/inc/oox/xls/excelchartconverter.hxx index 08c3398a5718..a46d484f2074 100644 --- a/oox/inc/oox/xls/excelchartconverter.hxx +++ b/oox/inc/oox/xls/excelchartconverter.hxx @@ -59,4 +59,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx index b5d7a97f33b5..789cbc99cb07 100644 --- a/oox/inc/oox/xls/excelfilter.hxx +++ b/oox/inc/oox/xls/excelfilter.hxx @@ -28,8 +28,8 @@ #ifndef OOX_XLS_EXCELFILTER_HXX #define OOX_XLS_EXCELFILTER_HXX -#include "oox/core/xmlfilterbase.hxx" #include "oox/core/binaryfilterbase.hxx" +#include "oox/core/xmlfilterbase.hxx" namespace oox { namespace xls { @@ -59,7 +59,8 @@ class ExcelFilter : public ::oox::core::XmlFilterBase, public ExcelFilterBase { public: explicit ExcelFilter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); virtual ~ExcelFilter(); virtual bool importDocument() throw(); @@ -72,6 +73,7 @@ public: private: virtual GraphicHelper* implCreateGraphicHelper() const; + virtual ::oox::ole::VbaProject* implCreateVbaProject() const; virtual ::rtl::OUString implGetImplementationName() const; }; @@ -81,7 +83,8 @@ class ExcelBiffFilter : public ::oox::core::BinaryFilterBase, public ExcelFilter { public: explicit ExcelBiffFilter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::RuntimeException ); virtual ~ExcelBiffFilter(); virtual bool importDocument() throw(); @@ -89,13 +92,28 @@ public: 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 - diff --git a/oox/inc/oox/xls/excelhandlers.hxx b/oox/inc/oox/xls/excelhandlers.hxx index e25fc994c362..39088204d24d 100644 --- a/oox/inc/oox/xls/excelhandlers.hxx +++ b/oox/inc/oox/xls/excelhandlers.hxx @@ -41,17 +41,17 @@ namespace xls { Used to import contexts in global workbook fragments. */ -class OoxWorkbookContextBase : public ::oox::core::ContextHandler2, public WorkbookHelper +class WorkbookContextBase : public ::oox::core::ContextHandler2, public WorkbookHelper { public: template< typename ParentType > - explicit OoxWorkbookContextBase( ParentType& rParent ); + explicit WorkbookContextBase( ParentType& rParent ); }; // ---------------------------------------------------------------------------- template< typename ParentType > -OoxWorkbookContextBase::OoxWorkbookContextBase( ParentType& rParent ) : +WorkbookContextBase::WorkbookContextBase( ParentType& rParent ) : ::oox::core::ContextHandler2( rParent ), WorkbookHelper( rParent ) { @@ -63,32 +63,32 @@ OoxWorkbookContextBase::OoxWorkbookContextBase( ParentType& rParent ) : Used to import contexts in sheet fragments. */ -class OoxWorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelperRoot +class WorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelperRoot { public: template< typename ParentType > - explicit OoxWorksheetContextBase( + explicit WorksheetContextBase( ParentType& rParent, - ISegmentProgressBarRef xProgressBar, + const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ); template< typename ParentType > - explicit OoxWorksheetContextBase( ParentType& rParent ); + explicit WorksheetContextBase( ParentType& rParent ); }; // ---------------------------------------------------------------------------- template< typename ParentType > -OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent, - ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : +WorksheetContextBase::WorksheetContextBase( ParentType& rParent, + const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : ::oox::core::ContextHandler2( rParent ), - WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet ) + WorksheetHelperRoot( rParent, rxProgressBar, eSheetType, nSheet ) { } template< typename ParentType > -OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent ) : +WorksheetContextBase::WorksheetContextBase( ParentType& rParent ) : ::oox::core::ContextHandler2( rParent ), WorksheetHelperRoot( rParent ) { @@ -100,10 +100,10 @@ OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent ) : Used to import global workbook fragments. */ -class OoxWorkbookFragmentBase : public ::oox::core::FragmentHandler2, public WorkbookHelper +class WorkbookFragmentBase : public ::oox::core::FragmentHandler2, public WorkbookHelper { public: - explicit OoxWorkbookFragmentBase( + explicit WorkbookFragmentBase( const WorkbookHelper& rHelper, const ::rtl::OUString& rFragmentPath ); }; @@ -114,17 +114,17 @@ public: Used to import sheet fragments. */ -class OoxWorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelperRoot +class WorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelperRoot { public: - explicit OoxWorksheetFragmentBase( + explicit WorksheetFragmentBase( const WorkbookHelper& rHelper, const ::rtl::OUString& rFragmentPath, - ISegmentProgressBarRef xProgressBar, + const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ); - explicit OoxWorksheetFragmentBase( + explicit WorksheetFragmentBase( const WorksheetHelper& rHelper, const ::rtl::OUString& rFragmentPath ); }; @@ -132,72 +132,21 @@ public: // ============================================================================ // ============================================================================ -/** 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. -}; - -// ============================================================================ - -/** Base class for all BIFF context handlers and fragment handlers. - - This base class holds a reference to the BIFF input stream which can be - accessed in all derived classes. - */ -class BiffHandlerBase -{ -protected: - inline explicit BiffHandlerBase( BiffInputStream& rStrm ) : mrStrm( rStrm ) {} - virtual ~BiffHandlerBase(); - - /** Skips a block of records up to the specified end record. - - Skips all records until next end record. When this function returns, - stream points to the end record, and the next call of 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. - */ - bool skipRecordBlock( sal_uInt16 nEndRecId ); - - /** @return True = current record identifier is a BOF record. */ - bool isBofRecord() const; - -protected: - BiffInputStream& mrStrm; -}; - -// ============================================================================ - /** Base class for all BIFF context handlers. Derived handlers have to implement the importRecord() function that has to - import the record the BIFF input stream currently points to. + import the record the passed BIFF input stream currently points to. */ -class BiffContextHandler : public BiffHandlerBase +class BiffContextHandler { public: - /** Derived classes have to implement importing the current record. */ - virtual void importRecord() = 0; + virtual ~BiffContextHandler(); -protected: - explicit BiffContextHandler( const BiffHandlerBase& rParent ); + /** Derived classes have to implement importing the current record. */ + virtual void importRecord( BiffInputStream& rStrm ) = 0; }; -// ============================================================================ +// ---------------------------------------------------------------------------- /** Context handler derived from the WorkbookHelper helper class. @@ -206,21 +155,11 @@ protected: class BiffWorkbookContextBase : public BiffContextHandler, public WorkbookHelper { protected: - template< typename ParentType > - explicit BiffWorkbookContextBase( const ParentType& rParent ); + explicit BiffWorkbookContextBase( const WorkbookHelper& rHelper ); }; // ---------------------------------------------------------------------------- -template< typename ParentType > -BiffWorkbookContextBase::BiffWorkbookContextBase( const ParentType& rParent ) : - BiffContextHandler( rParent ), - WorkbookHelper( rParent ) -{ -} - -// ============================================================================ - /** Context handler derived from the WorksheetHelper helper class. Used to import contexts in sheet fragments. @@ -228,68 +167,48 @@ BiffWorkbookContextBase::BiffWorkbookContextBase( const ParentType& rParent ) : class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelperRoot { protected: - template< typename ParentType > explicit BiffWorksheetContextBase( - const ParentType& rParent, - ISegmentProgressBarRef xProgressBar, + const WorkbookHelper& rHelper, + const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ); - template< typename ParentType > - explicit BiffWorksheetContextBase( const ParentType& rParent ); + explicit BiffWorksheetContextBase( const WorksheetHelper& rHelper ); }; -// ---------------------------------------------------------------------------- - -template< typename ParentType > -BiffWorksheetContextBase::BiffWorksheetContextBase( const ParentType& rParent, - ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : - BiffContextHandler( rParent ), - WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet ) -{ -} - -template< typename ParentType > -BiffWorksheetContextBase::BiffWorksheetContextBase( const ParentType& rParent ) : - BiffContextHandler( rParent ), - WorksheetHelperRoot( rParent ) -{ -} - // ============================================================================ -namespace prv { - -struct BiffFragmentStreamOwner +/** An enumeration for all types of fragments in a BIFF workbook stream. */ +enum BiffFragmentType { - typedef ::boost::shared_ptr< BinaryXInputStream > XInputStreamRef; - typedef ::boost::shared_ptr< BiffInputStream > BiffInputStreamRef; - - XInputStreamRef mxXInStrm; - BiffInputStreamRef mxBiffStrm; - - explicit BiffFragmentStreamOwner( const ::oox::core::FilterBase& rFilter, const ::rtl::OUString& rStrmName ); - virtual ~BiffFragmentStreamOwner(); + 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. }; -} // namespace prv - // ---------------------------------------------------------------------------- -class BiffFragmentHandler : private prv::BiffFragmentStreamOwner, public BiffHandlerBase +class BiffFragmentHandler { public: - /** Imports the fragment, returns true, if EOF record has been reached. */ - virtual bool importFragment() = 0; - -protected: /** Opens the stream with the passed full name. */ explicit BiffFragmentHandler( const ::oox::core::FilterBase& rFilter, const ::rtl::OUString& rStrmName ); - /** Reuses the stream of the passed fragment. */ - explicit BiffFragmentHandler( const BiffFragmentHandler& rHandler ); + 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. @@ -313,9 +232,16 @@ protected: @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. @@ -330,7 +256,7 @@ protected: bool bCloneDecoder = false ); }; -// ============================================================================ +// ---------------------------------------------------------------------------- /** Fragment handler derived from the WorksheetHelper helper class. @@ -341,12 +267,12 @@ class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHe protected: explicit BiffWorksheetFragmentBase( const BiffWorkbookFragmentBase& rParent, - ISegmentProgressBarRef xProgressBar, + const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ); }; -// ============================================================================ +// ---------------------------------------------------------------------------- /** Special fragment handler for worksheets that have to be skipped. */ @@ -355,7 +281,7 @@ class BiffSkipWorksheetFragment : public BiffWorksheetFragmentBase public: explicit BiffSkipWorksheetFragment( const BiffWorkbookFragmentBase& rParent, - ISegmentProgressBarRef xProgressBar, + const ISegmentProgressBarRef& rxProgressBar, sal_Int16 nSheet ); virtual bool importFragment(); @@ -368,4 +294,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/excelvbaproject.hxx b/oox/inc/oox/xls/excelvbaproject.hxx index 121e6a1667cd..96dabd08b5d7 100755 --- a/oox/inc/oox/xls/excelvbaproject.hxx +++ b/oox/inc/oox/xls/excelvbaproject.hxx @@ -45,12 +45,9 @@ class OOX_DLLPUBLIC ExcelVbaProject : public ::oox::ole::VbaProject { public: explicit ExcelVbaProject( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& rxDocument ); - /** Generates VBA modules for sheets that do not specify a codename. */ - void createMissingModules(); - protected: /** Adds dummy modules for sheets without imported code name. */ virtual void prepareImport(); diff --git a/oox/inc/oox/xls/externallinkbuffer.hxx b/oox/inc/oox/xls/externallinkbuffer.hxx index b9980cc21e2f..c616a2b97e97 100644 --- a/oox/inc/oox/xls/externallinkbuffer.hxx +++ b/oox/inc/oox/xls/externallinkbuffer.hxx @@ -84,19 +84,19 @@ public: void importOleItem( const AttributeList& rAttribs ); /** Imports the EXTERNALNAME record containing the name (only). */ - void importExternalName( RecordInputStream& rStrm ); + void importExternalName( SequenceInputStream& rStrm ); /** Imports the EXTERNALNAMEFLAGS record containing the settings of an external name. */ - void importExternalNameFlags( RecordInputStream& rStrm ); + void importExternalNameFlags( SequenceInputStream& rStrm ); /** Imports the DDEITEMVALUES record containing the size of the DDE result matrix. */ - void importDdeItemValues( RecordInputStream& rStrm ); + void importDdeItemValues( SequenceInputStream& rStrm ); /** Imports the DDEITEM_BOOL record containing a boolean value in a link result. */ - void importDdeItemBool( RecordInputStream& rStrm ); + void importDdeItemBool( SequenceInputStream& rStrm ); /** Imports the DDEITEM_DOUBLE record containing a double value in a link result. */ - void importDdeItemDouble( RecordInputStream& rStrm ); + void importDdeItemDouble( SequenceInputStream& rStrm ); /** Imports the DDEITEM_ERROR record containing an error code in a link result. */ - void importDdeItemError( RecordInputStream& rStrm ); + void importDdeItemError( SequenceInputStream& rStrm ); /** Imports the DDEITEM_STRING record containing a string in a link result. */ - void importDdeItemString( RecordInputStream& rStrm ); + void importDdeItemString( SequenceInputStream& rStrm ); /** Imports the EXTERNALNAME record from the passed stream. */ void importExternalName( BiffInputStream& rStrm ); @@ -227,19 +227,19 @@ public: 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, RecordInputStream& rStrm ); + void importExternalBook( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm ); /** Imports the EXTSHEETNAMES record containing the sheet names in an externally linked document. */ - void importExtSheetNames( RecordInputStream& rStrm ); + void importExtSheetNames( SequenceInputStream& rStrm ); /** Imports the EXTERNALNAME record describing an external name. */ - ExternalNameRef importExternalName( RecordInputStream& rStrm ); + ExternalNameRef importExternalName( SequenceInputStream& rStrm ); /** Imports the EXTERNALREF record from the passed stream. */ - void importExternalRef( RecordInputStream& rStrm ); + void importExternalRef( SequenceInputStream& rStrm ); /** Imports the EXTERNALSELF record from the passed stream. */ - void importExternalSelf( RecordInputStream& rStrm ); + void importExternalSelf( SequenceInputStream& rStrm ); /** Imports the EXTERNALSAME record from the passed stream. */ - void importExternalSame( RecordInputStream& rStrm ); + void importExternalSame( SequenceInputStream& rStrm ); /** Imports the EXTERNALADDIN record from the passed stream. */ - void importExternalAddin( RecordInputStream& rStrm ); + void importExternalAddin( SequenceInputStream& rStrm ); /** Imports the EXTERNSHEET record from the passed stream. */ void importExternSheet( BiffInputStream& rStrm ); @@ -248,6 +248,9 @@ public: /** 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. */ @@ -314,10 +317,10 @@ typedef ::boost::shared_ptr< ExternalLink > ExternalLinkRef; // ============================================================================ -/** Represents a REF entry in the OOBIN EXTERNALSHEETS or in the BIFF8 +/** 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 (OOBIN: + 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. */ @@ -329,7 +332,7 @@ struct RefSheetsModel explicit RefSheetsModel(); - void readOobData( RecordInputStream& rStrm ); + void readBiff12Data( SequenceInputStream& rStrm ); void readBiff8Data( BiffInputStream& rStrm ); }; @@ -344,15 +347,15 @@ public: ExternalLinkRef importExternalReference( const AttributeList& rAttribs ); /** Imports the EXTERNALREF record from the passed stream. */ - ExternalLinkRef importExternalRef( RecordInputStream& rStrm ); + ExternalLinkRef importExternalRef( SequenceInputStream& rStrm ); /** Imports the EXTERNALSELF record from the passed stream. */ - void importExternalSelf( RecordInputStream& rStrm ); + void importExternalSelf( SequenceInputStream& rStrm ); /** Imports the EXTERNALSAME record from the passed stream. */ - void importExternalSame( RecordInputStream& rStrm ); + void importExternalSame( SequenceInputStream& rStrm ); /** Imports the EXTERNALADDIN record from the passed stream. */ - void importExternalAddin( RecordInputStream& rStrm ); + void importExternalAddin( SequenceInputStream& rStrm ); /** Imports the EXTERNALSHEETS record from the passed stream. */ - void importExternalSheets( RecordInputStream& rStrm ); + void importExternalSheets( SequenceInputStream& rStrm ); /** Imports the EXTERNSHEET record from the passed stream. */ ExternalLinkRef importExternSheet( BiffInputStream& rStrm ); @@ -368,7 +371,7 @@ public: getLinkInfos() const; /** Returns the external link for the passed reference identifier. */ - ExternalLinkRef getExternalLink( sal_Int32 nRefId ) const; + 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; @@ -386,10 +389,11 @@ 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 (OOBIN only). + bool mbUseRefSheets; /// True = use maRefSheets list (BIFF12 only). }; // ============================================================================ @@ -398,4 +402,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/externallinkfragment.hxx b/oox/inc/oox/xls/externallinkfragment.hxx index ec310974818a..0e1f293d2444 100644 --- a/oox/inc/oox/xls/externallinkfragment.hxx +++ b/oox/inc/oox/xls/externallinkfragment.hxx @@ -37,41 +37,40 @@ 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 OoxExternalSheetDataContext : public OoxWorkbookContextBase +class ExternalSheetDataContext : public WorkbookContextBase { public: - explicit OoxExternalSheetDataContext( - OoxWorkbookFragmentBase& rFragment, + explicit ExternalSheetDataContext( + WorkbookFragmentBase& rFragment, const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >& rxSheetCache ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); + 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( RecordInputStream& rStrm ); + void importExtCellBlank( SequenceInputStream& rStrm ); /** Imports the EXTCELL_BOOL from the passed stream. */ - void importExtCellBool( RecordInputStream& rStrm ); + void importExtCellBool( SequenceInputStream& rStrm ); /** Imports the EXTCELL_DOUBLE from the passed stream. */ - void importExtCellDouble( RecordInputStream& rStrm ); + void importExtCellDouble( SequenceInputStream& rStrm ); /** Imports the EXTCELL_ERROR from the passed stream. */ - void importExtCellError( RecordInputStream& rStrm ); + void importExtCellError( SequenceInputStream& rStrm ); /** Imports the EXTCELL_STRING from the passed stream. */ - void importExtCellString( RecordInputStream& rStrm ); + 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 ); @@ -85,23 +84,20 @@ private: // ============================================================================ -class OoxExternalLinkFragment : public OoxWorkbookFragmentBase +class ExternalLinkFragment : public WorkbookFragmentBase { public: - explicit OoxExternalLinkFragment( + explicit ExternalLinkFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rFragmentPath, ExternalLink& rExtLink ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - - // oox.core.FragmentHandler2 interface ------------------------------------ + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; @@ -116,29 +112,24 @@ private: }; // ============================================================================ +// ============================================================================ -class BiffExternalLinkFragment : public BiffWorkbookFragmentBase +class BiffExternalSheetDataContext : public BiffWorkbookContextBase { public: - explicit BiffExternalLinkFragment( const BiffWorkbookFragmentBase& rParent, bool bImportDefNames ); - virtual ~BiffExternalLinkFragment(); - - /** Imports all records related to external links. */ - virtual bool importFragment(); + explicit BiffExternalSheetDataContext( const WorkbookHelper& rHelper, bool bImportDefNames ); + virtual ~BiffExternalSheetDataContext(); /** Tries to import a record related to external links and defined names. */ - void importRecord(); - - /** Finalizes buffers related to external links and defined names. */ - void finalizeImport(); + virtual void importRecord( BiffInputStream& rStrm ); private: - void importExternSheet(); - void importExternalBook(); - void importExternalName(); - void importXct(); - void importCrn(); - void importDefinedName(); + 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 ); @@ -152,8 +143,19 @@ private: // ============================================================================ +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 - diff --git a/oox/inc/oox/xls/formulabase.hxx b/oox/inc/oox/xls/formulabase.hxx index 1c668296cee3..d5336a2d7354 100644 --- a/oox/inc/oox/xls/formulabase.hxx +++ b/oox/inc/oox/xls/formulabase.hxx @@ -28,19 +28,19 @@ #ifndef OOX_XLS_FORMULABASE_HXX #define OOX_XLS_FORMULABASE_HXX -#include <com/sun/star/uno/Sequence.hxx> +#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/sheet/FormulaToken.hpp> -#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp> -#include "oox/helper/containerhelper.hxx" +#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 sheet { class XFormulaTokens; } - namespace sheet { class XFormulaOpCodeMapper; } } } } namespace oox { template< typename Type > class Matrix; } @@ -126,24 +126,14 @@ const sal_uInt8 BIFF_TOKID_AREAERR3D = 0x1D; /// Deleted 3D area // specific token constants --------------------------------------------------- -const sal_uInt8 OOBIN_TOK_ARRAY_DOUBLE = 0; -const sal_uInt8 OOBIN_TOK_ARRAY_STRING = 1; -const sal_uInt8 OOBIN_TOK_ARRAY_BOOL = 2; -const sal_uInt8 OOBIN_TOK_ARRAY_ERROR = 4; +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 OOBIN_TOK_ATTR_VOLATILE = 0x01; /// Volatile function. -const sal_uInt8 OOBIN_TOK_ATTR_IF = 0x02; /// Start of true condition in IF function. -const sal_uInt8 OOBIN_TOK_ATTR_CHOOSE = 0x04; /// Jump array of CHOOSE function. -const sal_uInt8 OOBIN_TOK_ATTR_SKIP = 0x08; /// Skip tokens. -const sal_uInt8 OOBIN_TOK_ATTR_SUM = 0x10; /// SUM function with one parameter. -const sal_uInt8 OOBIN_TOK_ATTR_ASSIGN = 0x20; /// BASIC style assignment. -const sal_uInt8 OOBIN_TOK_ATTR_SPACE = 0x40; /// Spaces in formula representation. -const sal_uInt8 OOBIN_TOK_ATTR_SPACE_VOLATILE = 0x41; /// Leading spaces and volatile formula. -const sal_uInt8 OOBIN_TOK_ATTR_IFERROR = 0x80; /// Start of condition in IFERROR function. - 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. @@ -152,6 +142,7 @@ const sal_uInt8 BIFF_TOK_ATTR_SUM = 0x10; /// SUM function wit 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. @@ -166,27 +157,27 @@ const sal_uInt16 BIFF_TOK_FUNCVAR_FUNCIDMASK = 0x7FFF; /// Mask for functio 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 OOBIN_TOK_REF_COLMASK = 0x3FFF; /// Mask to extract column from reference. -const sal_Int32 OOBIN_TOK_REF_ROWMASK = 0xFFFFF; /// Mask to extract row from reference. -const sal_uInt16 OOBIN_TOK_REF_COLREL = 0x4000; /// True = column is relative. -const sal_uInt16 OOBIN_TOK_REF_ROWREL = 0x8000; /// True = row is relative. +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 OOBIN_TOK_TABLE_COLUMN = 0x0001; /// Table reference: Single column. -const sal_uInt16 OOBIN_TOK_TABLE_COLRANGE = 0x0002; /// Table reference: Range of columns. -const sal_uInt16 OOBIN_TOK_TABLE_ALL = 0x0004; /// Table reference: Special [#All] range. -const sal_uInt16 OOBIN_TOK_TABLE_HEADERS = 0x0008; /// Table reference: Special [#Headers] range. -const sal_uInt16 OOBIN_TOK_TABLE_DATA = 0x0010; /// Table reference: Special [#Data] range. -const sal_uInt16 OOBIN_TOK_TABLE_TOTALS = 0x0020; /// Table reference: Special [#Totals] range. -const sal_uInt16 OOBIN_TOK_TABLE_THISROW = 0x0040; /// Table reference: Special [#This Row] range. -const sal_uInt16 OOBIN_TOK_TABLE_SP_BRACKETS = 0x0080; /// Table reference: Spaces in outer brackets. -const sal_uInt16 OOBIN_TOK_TABLE_SP_SEP = 0x0100; /// Table reference: Spaces after separators. -const sal_uInt16 OOBIN_TOK_TABLE_ROW = 0x0200; /// Table reference: Single row. -const sal_uInt16 OOBIN_TOK_TABLE_CELL = 0x0400; /// Table reference: Single cell. +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. @@ -209,23 +200,21 @@ const sal_uInt32 BIFF_TOK_NLR_ADDMASK = 0x3FFFFFFF; /// Mask for num // function constants --------------------------------------------------------- -const sal_uInt8 OOX_MAX_PARAMCOUNT = 255; /// Maximum parameter count for OOXML/OOBIN files. -const sal_uInt8 BIFF_MAX_PARAMCOUNT = 30; /// Maximum parameter count for BIFF files. - -const sal_uInt16 OOBIN_FUNC_IF = 1; /// OOBIN function id of the IF function. -const sal_uInt16 OOBIN_FUNC_SUM = 4; /// OOBIN function id of the SUM function. -const sal_uInt16 OOBIN_FUNC_TRUE = 34; /// OOBIN function id of the TRUE function. -const sal_uInt16 OOBIN_FUNC_FALSE = 35; /// OOBIN function id of the FALSE function. -const sal_uInt16 OOBIN_FUNC_ROWS = 76; /// OOBIN function id of the ROWS function. -const sal_uInt16 OOBIN_FUNC_COLUMNS = 77; /// OOBIN function id of the COLUMNS function. -const sal_uInt16 OOBIN_FUNC_OFFSET = 78; /// OOBIN function id of the OFFSET function. -const sal_uInt16 OOBIN_FUNC_FLOOR = 285; /// OOBIN function id of the FLOOR function. -const sal_uInt16 OOBIN_FUNC_CEILING = 288; /// OOBIN function id of the CEILING function. -const sal_uInt16 OOBIN_FUNC_HYPERLINK = 359; /// OOBIN function id of the HYPERLINK function. -const sal_uInt16 OOBIN_FUNC_WEEKNUM = 465; /// OOBIN function id of the WEEKNUM function. - -const sal_uInt16 BIFF_FUNC_SUM = 4; /// BIFF function id of the SUM function. +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. // reference helpers ========================================================== @@ -239,11 +228,11 @@ struct BinSingleRef2d explicit BinSingleRef2d(); - void setOobData( sal_uInt16 nCol, sal_Int32 nRow, bool bRelativeAsOffset ); + 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 readOobData( RecordInputStream& rStrm, bool bRelativeAsOffset ); + void readBiff12Data( SequenceInputStream& rStrm, bool bRelativeAsOffset ); void readBiff2Data( BiffInputStream& rStrm, bool bRelativeAsOffset ); void readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffset ); }; @@ -256,7 +245,7 @@ struct BinComplexRef2d BinSingleRef2d maRef1; /// Start (top-left) cell address. BinSingleRef2d maRef2; /// End (bottom-right) cell address. - void readOobData( RecordInputStream& rStrm, bool bRelativeAsOffset ); + void readBiff12Data( SequenceInputStream& rStrm, bool bRelativeAsOffset ); void readBiff2Data( BiffInputStream& rStrm, bool bRelativeAsOffset ); void readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffset ); }; @@ -495,8 +484,8 @@ struct FunctionInfo ::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 mnOobFuncId; /// OOBIN function identifier. - sal_uInt16 mnBiffFuncId; /// BIFF function identifier. + 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. @@ -551,13 +540,13 @@ public: /** Returns the function info for an ODF function name, or 0 on error. */ const FunctionInfo* getFuncInfoFromOdfFuncName( const ::rtl::OUString& rFuncName ) const; - /** Returns the function info for an OOX function name, or 0 on error. */ + /** 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 an OOBIN function index, or 0 on error. */ - const FunctionInfo* getFuncInfoFromOobFuncId( sal_uInt16 nFuncId ) 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 BIFF function index, or 0 on error. */ + /** 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 @@ -599,7 +588,7 @@ public: /** 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 OOX formula parser. */ + /** 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; @@ -933,4 +922,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/formulaparser.hxx b/oox/inc/oox/xls/formulaparser.hxx index fc3fee3ba43c..faf1da3328f8 100644 --- a/oox/inc/oox/xls/formulaparser.hxx +++ b/oox/inc/oox/xls/formulaparser.hxx @@ -101,9 +101,9 @@ private: class FormulaParserImpl; -/** Import formula parser for OOX and BIFF filters. +/** Import formula parser for OOXML and BIFF filters. - This class implements formula import for the OOX and BIFF filter. One + 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. */ @@ -113,17 +113,17 @@ public: explicit FormulaParser( const WorkbookHelper& rHelper ); virtual ~FormulaParser(); - /** Converts an XML formula string. */ + /** Converts an OOXML formula string. */ void importFormula( FormulaContext& rContext, const ::rtl::OUString& rFormulaString ) const; - /** Imports and converts a OOBIN token array from the passed stream. */ + /** Imports and converts a BIFF12 token array from the passed stream. */ void importFormula( FormulaContext& rContext, - RecordInputStream& rStrm ) const; + SequenceInputStream& rStrm ) const; - /** Imports and converts a BIFF token array from the passed stream. + /** 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. */ void importFormula( @@ -151,13 +151,16 @@ public: ::rtl::OUString importOleTargetLink( const ::rtl::OUString& rFormulaString ); /** Imports and converts an OLE link target from the passed stream. */ - ::rtl::OUString importOleTargetLink( RecordInputStream& rStrm ); + ::rtl::OUString importOleTargetLink( SequenceInputStream& rStrm ); /** Imports and converts an OLE link target from the passed stream. */ ::rtl::OUString importOleTargetLink( BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ) const; + /** 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; }; @@ -168,4 +171,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/numberformatsbuffer.hxx b/oox/inc/oox/xls/numberformatsbuffer.hxx index 59a2c4e9324e..768572a5839c 100644 --- a/oox/inc/oox/xls/numberformatsbuffer.hxx +++ b/oox/inc/oox/xls/numberformatsbuffer.hxx @@ -29,7 +29,6 @@ #define OOX_XLS_NUMBERFORMATSBUFFER_HXX #include <com/sun/star/lang/Locale.hpp> -#include "oox/helper/containerhelper.hxx" #include "oox/xls/workbookhelper.hxx" namespace com { namespace sun { namespace star { @@ -109,7 +108,7 @@ public: /** Inserts a new number format code. */ NumberFormatRef importNumFmt( const AttributeList& rAttribs ); /** Inserts a new number format code from a NUMFMT record. */ - void importNumFmt( RecordInputStream& rStrm ); + void importNumFmt( SequenceInputStream& rStrm ); /** Inserts a new number format code from a FORMAT record. */ void importFormat( BiffInputStream& rStrm ); @@ -137,4 +136,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/ooxformulaparser.hxx b/oox/inc/oox/xls/ooxformulaparser.hxx index 1c20febf5f43..7bc1bbdd4909 100644 --- a/oox/inc/oox/xls/ooxformulaparser.hxx +++ b/oox/inc/oox/xls/ooxformulaparser.hxx @@ -109,4 +109,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/pagesettings.hxx b/oox/inc/oox/xls/pagesettings.hxx index eb163daf94c8..6ff896b1bb51 100644 --- a/oox/inc/oox/xls/pagesettings.hxx +++ b/oox/inc/oox/xls/pagesettings.hxx @@ -83,8 +83,8 @@ struct PageSettingsModel explicit PageSettingsModel(); - /** Sets the OOBIN or BIFF print errors mode. */ - void setBinPrintErrors( sal_uInt8 nPrintErrors ); + /** Sets the BIFF print errors mode. */ + void setBiffPrintErrors( sal_uInt8 nPrintErrors ); }; // ============================================================================ @@ -110,17 +110,17 @@ public: void importPicture( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs ); /** Imports the PRINTOPTIONS record from the passed stream. */ - void importPrintOptions( RecordInputStream& rStrm ); + void importPrintOptions( SequenceInputStream& rStrm ); /** Imports the PAGEMARGINS record from the passed stream. */ - void importPageMargins( RecordInputStream& rStrm ); + void importPageMargins( SequenceInputStream& rStrm ); /** Imports the PAGESETUP record from the passed stream. */ - void importPageSetup( const ::oox::core::Relations& rRelations, RecordInputStream& rStrm ); + void importPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm ); /** Imports the CHARTPAGESETUP record from the passed stream. */ - void importChartPageSetup( const ::oox::core::Relations& rRelations, RecordInputStream& rStrm ); + void importChartPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm ); /** Imports the HEADERFOOTER record from the passed stream. */ - void importHeaderFooter( RecordInputStream& rStrm ); + void importHeaderFooter( SequenceInputStream& rStrm ); /** Imports the PICTURE record from the passed stream. */ - void importPicture( const ::oox::core::Relations& rRelations, RecordInputStream& rStrm ); + void importPicture( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm ); /** Imports the LEFTMARGIN record from the passed BIFF stream. */ void importLeftMargin( BiffInputStream& rStrm ); @@ -217,4 +217,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/pivotcachebuffer.hxx b/oox/inc/oox/xls/pivotcachebuffer.hxx index 8f79ab0685b3..2e32d0faa7e5 100644 --- a/oox/inc/oox/xls/pivotcachebuffer.hxx +++ b/oox/inc/oox/xls/pivotcachebuffer.hxx @@ -28,10 +28,10 @@ #ifndef OOX_XLS_PIVOTCACHEBUFFER_HXX #define OOX_XLS_PIVOTCACHEBUFFER_HXX -#include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/helper/containerhelper.hxx" +#include <com/sun/star/util/DateTime.hpp> +#include "oox/helper/refvector.hxx" #include "oox/xls/workbookhelper.hxx" namespace com { namespace sun { namespace star { @@ -66,17 +66,17 @@ public: void readIndex( const AttributeList& rAttribs ); /** Reads the string value from a pivot cache item. */ - void readString( RecordInputStream& rStrm ); + void readString( SequenceInputStream& rStrm ); /** Reads the double value from a pivot cache item. */ - void readDouble( RecordInputStream& rStrm ); + void readDouble( SequenceInputStream& rStrm ); /** Reads the date/time value from a pivot cache item. */ - void readDate( RecordInputStream& rStrm ); + void readDate( SequenceInputStream& rStrm ); /** Reads the boolean value from a pivot cache item. */ - void readBool( RecordInputStream& rStrm ); + void readBool( SequenceInputStream& rStrm ); /** Reads the error code value from a pivot cache item. */ - void readError( RecordInputStream& rStrm ); + void readError( SequenceInputStream& rStrm ); /** Reads the index of a shared item. */ - void readIndex( RecordInputStream& rStrm ); + void readIndex( SequenceInputStream& rStrm ); /** Reads the string value from a pivot cache item. */ void readString( BiffInputStream& rStrm, const WorkbookHelper& rHelper ); @@ -100,7 +100,7 @@ public: private: ::com::sun::star::uno::Any maValue; /// Value of the item. - sal_Int32 mnType; /// Value type (OOX token identifier). + sal_Int32 mnType; /// Value type (OOXML token identifier). }; // ---------------------------------------------------------------------------- @@ -113,7 +113,7 @@ public: /** 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, RecordInputStream& rStrm ); + void importItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); /** Imports a complete item list from the passed stream. */ void importItemList( BiffInputStream& rStrm, sal_uInt16 nCount ); @@ -131,7 +131,7 @@ 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( RecordInputStream& rStrm ); + void importArray( SequenceInputStream& rStrm ); private: typedef ::std::vector< PivotCacheItem > CacheItemVector; @@ -196,8 +196,8 @@ struct PCFieldGroupModel explicit PCFieldGroupModel(); - /** Sets the group-by value for BIFF/OOBIN import. */ - void setBinGroupBy( sal_uInt8 nGroupBy ); + /** Sets the group-by value for BIFF import. */ + void setBiffGroupBy( sal_uInt8 nGroupBy ); }; // ---------------------------------------------------------------------------- @@ -237,19 +237,19 @@ public: void importGroupItem( sal_Int32 nElement, const AttributeList& rAttribs ); /** Imports pivot cache field settings from the PCDFIELD record. */ - void importPCDField( RecordInputStream& rStrm ); + void importPCDField( SequenceInputStream& rStrm ); /** Imports shared items settings from the PCDFSHAREDITEMS record. */ - void importPCDFSharedItems( RecordInputStream& rStrm ); + void importPCDFSharedItems( SequenceInputStream& rStrm ); /** Imports one or more shared items from the passed record. */ - void importPCDFSharedItem( sal_Int32 nRecId, RecordInputStream& rStrm ); + void importPCDFSharedItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); /** Imports grouping settings from the PCDFIELDGROUP record. */ - void importPCDFieldGroup( RecordInputStream& rStrm ); + void importPCDFieldGroup( SequenceInputStream& rStrm ); /** Imports numeric grouping settings from the PCDFRANGEPR record. */ - void importPCDFRangePr( RecordInputStream& rStrm ); + 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, RecordInputStream& rStrm ); + void importPCDFDiscretePrItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); /** Imports one or more group items from the passed record. */ - void importPCDFGroupItem( sal_Int32 nRecId, RecordInputStream& rStrm ); + void importPCDFGroupItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); /** Imports pivot cache field settings from the PCDFIELD record. */ void importPCDField( BiffInputStream& rStrm ); @@ -304,7 +304,7 @@ public: const PivotCacheItem& rItem ) const; /** Reads an item from the PCRECORD record and writes it to the passed sheet. */ - void importPCRecordItem( RecordInputStream& rStrm, + 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, @@ -392,11 +392,11 @@ public: void importWorksheetSource( const AttributeList& rAttribs, const ::oox::core::Relations& rRelations ); /** Reads pivot cache global settings from the PCDEFINITION record. */ - void importPCDefinition( RecordInputStream& rStrm ); + void importPCDefinition( SequenceInputStream& rStrm ); /** Reads cache source settings from the PCDSOURCE record. */ - void importPCDSource( RecordInputStream& rStrm ); + void importPCDSource( SequenceInputStream& rStrm ); /** Reads sheet source settings from the PCDSHEETSOURCE record. */ - void importPCDSheetSource( RecordInputStream& rStrm, const ::oox::core::Relations& rRelations ); + void importPCDSheetSource( SequenceInputStream& rStrm, const ::oox::core::Relations& rRelations ); /** Reads cache source settings from the PCDSOURCE record. */ void importPCDSource( BiffInputStream& rStrm ); @@ -434,7 +434,7 @@ public: const PivotCacheItem& rItem ) const; /** Reads a PCRECORD record and writes all item values to the passed sheet. */ - void importPCRecord( RecordInputStream& rStrm, + void importPCRecord( SequenceInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const; /** Reads a PCITEM_INDEXLIST record and writes all item values to the passed sheet. */ void importPCItemIndexList( BiffInputStream& rStrm, @@ -479,9 +479,9 @@ class PivotCacheBuffer : public WorkbookHelper public: explicit PivotCacheBuffer( const WorkbookHelper& rHelper ); - /** Registers a pivot cache definition fragment. The fragment will be loaded on demand (OOX/OOBIN only). */ + /** 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 (BIFF only). */ + /** 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, @@ -508,4 +508,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/pivotcachefragment.hxx b/oox/inc/oox/xls/pivotcachefragment.hxx index 745208f485e6..34a833e26525 100644 --- a/oox/inc/oox/xls/pivotcachefragment.hxx +++ b/oox/inc/oox/xls/pivotcachefragment.hxx @@ -38,18 +38,18 @@ class PivotCacheField; // ============================================================================ -class OoxPivotCacheFieldContext : public OoxWorkbookContextBase +class PivotCacheFieldContext : public WorkbookContextBase { public: - explicit OoxPivotCacheFieldContext( - OoxWorkbookFragmentBase& rFragment, + 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, RecordInputStream& rStrm ); - virtual void onStartRecord( RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); private: PivotCacheField& mrCacheField; @@ -57,17 +57,17 @@ private: // ============================================================================ -class OoxPivotCacheDefinitionFragment : public OoxWorkbookFragmentBase +class PivotCacheDefinitionFragment : public WorkbookFragmentBase { public: - explicit OoxPivotCacheDefinitionFragment( + 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, RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; virtual void finalizeImport(); @@ -77,23 +77,23 @@ private: // ============================================================================ -class OoxPivotCacheRecordsFragment : public OoxWorksheetFragmentBase +class PivotCacheRecordsFragment : public WorksheetFragmentBase { public: - explicit OoxPivotCacheRecordsFragment( + explicit PivotCacheRecordsFragment( const WorkbookHelper& 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, RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; private: void startCacheRecord(); - void importPCRecord( RecordInputStream& rStrm ); - void importPCRecordItem( sal_Int32 nRecId, RecordInputStream& rStrm ); + void importPCRecord( SequenceInputStream& rStrm ); + void importPCRecordItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); private: const PivotCache& mrPivotCache; @@ -126,12 +126,12 @@ class BiffPivotCacheRecordsContext : public BiffWorksheetContextBase { public: explicit BiffPivotCacheRecordsContext( - const BiffWorkbookFragmentBase& rFragment, + const WorkbookHelper& rHelper, const PivotCache& rPivotCache ); /** Reads the current record from stream and tries to insert a cell into the source data sheet. */ - virtual void importRecord(); + virtual void importRecord( BiffInputStream& rStrm ); private: void startNextRow(); @@ -153,4 +153,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/pivottablebuffer.hxx b/oox/inc/oox/xls/pivottablebuffer.hxx index 6fde212f0018..7732037bd579 100644 --- a/oox/inc/oox/xls/pivottablebuffer.hxx +++ b/oox/inc/oox/xls/pivottablebuffer.hxx @@ -29,9 +29,8 @@ #define OOX_XLS_PIVOTTABLEBUFFER_HXX #include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/helper/containerhelper.hxx" #include "oox/xls/pivotcachebuffer.hxx" -#include "oox/xls/workbookhelper.hxx" +#include "oox/xls/stylesbuffer.hxx" namespace com { namespace sun { namespace star { namespace sheet { class XDataPilotDescriptor; } @@ -54,8 +53,8 @@ struct PTFieldItemModel explicit PTFieldItemModel(); - /** Sets item type for BIFF/OOBIN import. */ - void setBinType( sal_uInt16 nType ); + /** Sets item type for BIFF import. */ + void setBiffType( sal_uInt16 nType ); }; // ---------------------------------------------------------------------------- @@ -93,8 +92,8 @@ struct PTFieldModel explicit PTFieldModel(); - /** Sets axis type for BIFF/OOBIN import. */ - void setBinAxis( sal_uInt8 nAxisFlags ); + /** Sets axis type for BIFF import. */ + void setBiffAxis( sal_uInt8 nAxisFlags ); }; // ---------------------------------------------------------------------------- @@ -122,10 +121,10 @@ struct PTDataFieldModel explicit PTDataFieldModel(); - /** Sets the subtotal aggregation function for BIFF/OOBIN import. */ - void setBinSubtotal( sal_Int32 nSubtotal ); - /** Sets the 'show data as' type for BIFF/OOBIN import. */ - void setBinShowDataAs( sal_Int32 nShowDataAs ); + /** 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 ); }; // ---------------------------------------------------------------------------- @@ -145,13 +144,13 @@ public: void importReferenceItem( const AttributeList& rAttribs ); /** Imports pivot field settings from the PTFIELD record. */ - void importPTField( RecordInputStream& rStrm ); + void importPTField( SequenceInputStream& rStrm ); /** Imports settings of an item in this pivot field from the PTFITEM record. */ - void importPTFItem( RecordInputStream& rStrm ); + void importPTFItem( SequenceInputStream& rStrm ); /** Imports pivot field reference settings from the PTREFERENCE record. */ - void importPTReference( RecordInputStream& rStrm ); + void importPTReference( SequenceInputStream& rStrm ); /** Imports pivot field item reference settings from the PTREFERENCEITEM record. */ - void importPTReferenceItem( RecordInputStream& rStrm ); + void importPTReferenceItem( SequenceInputStream& rStrm ); /** Imports pivot field settings from the PTFIELD and following records. */ void importPTField( BiffInputStream& rStrm ); @@ -235,9 +234,9 @@ public: void importTop10( const AttributeList& rAttribs ); /** Reads the settings of a field filter from the PTFILTER record. */ - void importPTFilter( RecordInputStream& rStrm ); + void importPTFilter( SequenceInputStream& rStrm ); /** Reads additional settings of a field filter from the TOP10FILTER record. */ - void importTop10Filter( RecordInputStream& rStrm ); + void importTop10Filter( SequenceInputStream& rStrm ); /** Applies the filter to the associated pivot table field if possible. */ void finalizeImport(); @@ -249,7 +248,7 @@ private: // ============================================================================ -struct PTDefinitionModel +struct PTDefinitionModel : public AutoFormatModel { ::rtl::OUString maName; ::rtl::OUString maDataCaption; @@ -281,6 +280,7 @@ struct PTDefinitionModel bool mbPrintDrill; bool mbEnableDrill; bool mbPreserveFormatting; + bool mbUseAutoFormat; bool mbPageOverThenDown; bool mbSubtotalHiddenItems; bool mbRowGrandTotals; @@ -333,17 +333,17 @@ public: void importDataField( const AttributeList& rAttribs ); /** Reads global pivot table settings from the PTDEFINITION record. */ - void importPTDefinition( RecordInputStream& rStrm ); + void importPTDefinition( SequenceInputStream& rStrm ); /** Reads the location of the pivot table from the PTLOCATION record. */ - void importPTLocation( RecordInputStream& rStrm, sal_Int16 nSheet ); + void importPTLocation( SequenceInputStream& rStrm, sal_Int16 nSheet ); /** Reads the indexes of all fields located in the row dimension from a PTROWFIELDS record. */ - void importPTRowFields( RecordInputStream& rStrm ); + void importPTRowFields( SequenceInputStream& rStrm ); /** Reads the indexes of all fields located in the column dimension from a PTCOLFIELDS record. */ - void importPTColFields( RecordInputStream& rStrm ); + void importPTColFields( SequenceInputStream& rStrm ); /** Reads the settings of a field located in the page dimension from the PTPAGEFIELD record. */ - void importPTPageField( RecordInputStream& rStrm ); + void importPTPageField( SequenceInputStream& rStrm ); /** Reads the settings of a field located in the data dimension from the PTDATAFIELD record. */ - void importPTDataField( RecordInputStream& rStrm ); + void importPTDataField( SequenceInputStream& rStrm ); /** Reads global pivot table settings from the PTDEFINITION record. */ void importPTDefinition( BiffInputStream& rStrm, sal_Int16 nSheet ); @@ -403,7 +403,7 @@ private: /** 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, RecordInputStream& rStrm ); + 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 ); @@ -446,4 +446,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/pivottablefragment.hxx b/oox/inc/oox/xls/pivottablefragment.hxx index 59c86b4ba3cb..aafae063990c 100644 --- a/oox/inc/oox/xls/pivottablefragment.hxx +++ b/oox/inc/oox/xls/pivottablefragment.hxx @@ -40,18 +40,18 @@ class PivotTableFilter; // ============================================================================ -class OoxPivotTableFieldContext : public OoxWorksheetContextBase +class PivotTableFieldContext : public WorksheetContextBase { public: - explicit OoxPivotTableFieldContext( - OoxWorksheetFragmentBase& rFragment, + 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, RecordInputStream& rStrm ); - virtual void onStartRecord( RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); private: PivotTableField& mrTableField; @@ -59,18 +59,18 @@ private: // ============================================================================ -class OoxPivotTableFilterContext : public OoxWorksheetContextBase +class PivotTableFilterContext : public WorksheetContextBase { public: - explicit OoxPivotTableFilterContext( - OoxWorksheetFragmentBase& rFragment, + 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, RecordInputStream& rStrm ); - virtual void onStartRecord( RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); private: PivotTableFilter& mrTableFilter; @@ -78,16 +78,16 @@ private: // ============================================================================ -class OoxPivotTableFragment : public OoxWorksheetFragmentBase +class PivotTableFragment : public WorksheetFragmentBase { public: - explicit OoxPivotTableFragment( + 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, RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; private: @@ -100,10 +100,10 @@ private: class BiffPivotTableContext : public BiffWorksheetContextBase { public: - explicit BiffPivotTableContext( const BiffWorksheetFragmentBase& rFragment, PivotTable& rPivotTable ); + explicit BiffPivotTableContext( const WorksheetHelper& rHelper ); /** Imports all records related to the current pivot table. */ - virtual void importRecord(); + virtual void importRecord( BiffInputStream& rStrm ); private: PivotTable& mrPivotTable; @@ -115,4 +115,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/querytablebuffer.hxx b/oox/inc/oox/xls/querytablebuffer.hxx new file mode 100644 index 000000000000..fa67ca8874c0 --- /dev/null +++ b/oox/inc/oox/xls/querytablebuffer.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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 diff --git a/oox/inc/oox/xls/querytablefragment.hxx b/oox/inc/oox/xls/querytablefragment.hxx index 3702069b4859..6eb561aa5a5e 100644 --- a/oox/inc/oox/xls/querytablefragment.hxx +++ b/oox/inc/oox/xls/querytablefragment.hxx @@ -33,19 +33,39 @@ namespace oox { namespace xls { +class QueryTable; + // ============================================================================ -class OoxQueryTableFragment : public OoxWorkbookFragmentBase +class QueryTableFragment : public WorksheetFragmentBase { public: - explicit OoxQueryTableFragment( - const WorkbookHelper& rHelper, + explicit QueryTableFragment( + const WorksheetHelper& rHelper, const ::rtl::OUString& rFragmentPath ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - 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; }; // ============================================================================ @@ -54,4 +74,3 @@ protected: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx index 61ce1cbf5481..4c4aecee2ec1 100644 --- a/oox/inc/oox/xls/richstring.hxx +++ b/oox/inc/oox/xls/richstring.hxx @@ -28,7 +28,7 @@ #ifndef OOX_XLS_RICHSTRING_HXX #define OOX_XLS_RICHSTRING_HXX -#include "oox/helper/containerhelper.hxx" +#include "oox/helper/refvector.hxx" #include "oox/xls/stylesbuffer.hxx" namespace com { namespace sun { namespace star { @@ -110,7 +110,7 @@ struct FontPortionModel explicit inline FontPortionModel( sal_Int32 nPos, sal_Int32 nFontId ) : mnPos( nPos ), mnFontId( nFontId ) {} - void read( RecordInputStream& rStrm ); + void read( SequenceInputStream& rStrm ); void read( BiffInputStream& rStrm, BiffFontPortionMode eMode ); }; @@ -125,7 +125,7 @@ public: /** Appends a rich-string font identifier. */ void appendPortion( const FontPortionModel& rPortion ); /** Reads count and font identifiers from the passed stream. */ - void importPortions( RecordInputStream& rStrm ); + 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. */ @@ -143,7 +143,7 @@ struct PhoneticDataModel explicit PhoneticDataModel(); /** Sets the passed data from binary import. */ - void setBinData( sal_Int32 nType, sal_Int32 nAlignment ); + void setBiffData( sal_Int32 nType, sal_Int32 nAlignment ); }; // ---------------------------------------------------------------------------- @@ -156,12 +156,12 @@ public: /** Imports phonetic settings from the phoneticPr element. */ void importPhoneticPr( const AttributeList& rAttribs ); /** Imports phonetic settings from the PHONETICPR record. */ - void importPhoneticPr( RecordInputStream& rStrm ); + void importPhoneticPr( SequenceInputStream& rStrm ); /** Imports phonetic settings from the PHONETICPR record. */ void importPhoneticPr( BiffInputStream& rStrm ); /** Imports phonetic settings from a rich string. */ - void importStringData( RecordInputStream& rStrm ); + void importStringData( SequenceInputStream& rStrm ); /** Imports phonetic settings from a rich string. */ void importStringData( BiffInputStream& rStrm ); @@ -206,7 +206,7 @@ struct PhoneticPortionModel explicit inline PhoneticPortionModel( sal_Int32 nPos, sal_Int32 nBasePos, sal_Int32 nBaseLen ) : mnPos( nPos ), mnBasePos( nBasePos ), mnBaseLen( nBaseLen ) {} - void read( RecordInputStream& rStrm ); + void read( SequenceInputStream& rStrm ); void read( BiffInputStream& rStrm ); }; @@ -221,7 +221,7 @@ public: /** Appends a rich-string phonetic portion. */ void appendPortion( const PhoneticPortionModel& rPortion ); /** Reads all phonetic portions from the passed stream. */ - void importPortions( RecordInputStream& rStrm ); + void importPortions( SequenceInputStream& rStrm ); /** Reads phonetic portion data from the passed stream. */ ::rtl::OUString importPortions( BiffInputStream& rStrm, sal_Int32 nPhoneticSize ); }; @@ -244,7 +244,7 @@ public: void importPhoneticPr( const AttributeList& rAttribs ); /** Imports a Unicode rich-string from the passed record stream. */ - void importString( RecordInputStream& rStrm, bool bRich ); + 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 ); @@ -291,4 +291,3 @@ typedef ::boost::shared_ptr< RichString > RichStringRef; } // namespace oox #endif - diff --git a/oox/inc/oox/xls/richstringcontext.hxx b/oox/inc/oox/xls/richstringcontext.hxx index 53882641df7e..df3f412d87ec 100644 --- a/oox/inc/oox/xls/richstringcontext.hxx +++ b/oox/inc/oox/xls/richstringcontext.hxx @@ -36,17 +36,15 @@ namespace xls { // ============================================================================ -class OoxRichStringContext : public OoxWorkbookContextBase +class RichStringContext : public WorkbookContextBase { public: template< typename ParentType > - explicit OoxRichStringContext( ParentType& rParent, RichStringRef xString ); + explicit RichStringContext( ParentType& rParent, RichStringRef xString ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); private: RichStringRef mxString; /// Processed string. @@ -58,11 +56,11 @@ private: // ---------------------------------------------------------------------------- template< typename ParentType > -OoxRichStringContext::OoxRichStringContext( ParentType& rParent, RichStringRef xString ) : - OoxWorkbookContextBase( rParent ), +RichStringContext::RichStringContext( ParentType& rParent, RichStringRef xString ) : + WorkbookContextBase( rParent ), mxString( xString ) { - OSL_ENSURE( mxString.get(), "OoxRichStringContext::OoxRichStringContext - missing string object" ); + OSL_ENSURE( mxString.get(), "RichStringContext::RichStringContext - missing string object" ); } // ============================================================================ @@ -71,4 +69,3 @@ OoxRichStringContext::OoxRichStringContext( ParentType& rParent, RichStringRef x } // namespace oox #endif - diff --git a/oox/inc/oox/xls/scenariobuffer.hxx b/oox/inc/oox/xls/scenariobuffer.hxx index 8c2e0b0f1065..ed8d4e919bd2 100644 --- a/oox/inc/oox/xls/scenariobuffer.hxx +++ b/oox/inc/oox/xls/scenariobuffer.hxx @@ -29,7 +29,8 @@ #define OOX_XLS_SCENARIOBUFFER_HXX #include <com/sun/star/table/CellAddress.hpp> -#include "oox/helper/containerhelper.hxx" +#include "oox/helper/refmap.hxx" +#include "oox/helper/refvector.hxx" #include "oox/xls/workbookhelper.hxx" namespace oox { @@ -73,9 +74,9 @@ public: void importInputCells( const AttributeList& rAttribs ); /** Imports a scenario definition from a SCENARIO record. */ - void importScenario( RecordInputStream& rStrm ); + void importScenario( SequenceInputStream& rStrm ); /** Imports a new cell for this scenario from a INPUTCELLS record. */ - void importInputCells( RecordInputStream& rStrm ); + void importInputCells( SequenceInputStream& rStrm ); /** Imports a scenario definition from a SCENARIO record. */ void importScenario( BiffInputStream& rStrm ); @@ -111,7 +112,7 @@ public: /** Imports sheet scenario settings from a scenarios element. */ void importScenarios( const AttributeList& rAttribs ); /** Imports sheet scenario settings from a SCENARIOS record. */ - void importScenarios( RecordInputStream& rStrm ); + void importScenarios( SequenceInputStream& rStrm ); /** Imports sheet scenario settings from a SCENARIOS record. */ void importScenarios( BiffInputStream& rStrm ); @@ -152,4 +153,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/scenariocontext.hxx b/oox/inc/oox/xls/scenariocontext.hxx index f3286f144656..3e6ccc5c22d6 100644 --- a/oox/inc/oox/xls/scenariocontext.hxx +++ b/oox/inc/oox/xls/scenariocontext.hxx @@ -38,17 +38,17 @@ class SheetScenarios; // ============================================================================ -class OoxScenarioContext : public OoxWorksheetContextBase +class ScenarioContext : public WorksheetContextBase { public: - explicit OoxScenarioContext( OoxWorksheetContextBase& rParent, SheetScenarios& rSheetScenarios ); + 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, RecordInputStream& rStrm ); - virtual void onStartRecord( RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); private: Scenario& mrScenario; @@ -56,17 +56,17 @@ private: // ============================================================================ -class OoxScenariosContext : public OoxWorksheetContextBase +class ScenariosContext : public WorksheetContextBase { public: - explicit OoxScenariosContext( OoxWorksheetFragmentBase& rFragment ); + 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, RecordInputStream& rStrm ); - virtual void onStartRecord( RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); + virtual void onStartRecord( SequenceInputStream& rStrm ); private: SheetScenarios& mrSheetScenarios; @@ -78,4 +78,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/sharedformulabuffer.hxx b/oox/inc/oox/xls/sharedformulabuffer.hxx index 0f9fb0bb093e..94b7572dcfd9 100644 --- a/oox/inc/oox/xls/sharedformulabuffer.hxx +++ b/oox/inc/oox/xls/sharedformulabuffer.hxx @@ -61,12 +61,12 @@ class SharedFormulaBuffer : public WorksheetHelper public: explicit SharedFormulaBuffer( const WorksheetHelper& rHelper ); - /** Imports a shared formula from a OOX formula string. */ + /** Imports a shared formula from a OOXML formula string. */ void importSharedFmla( const ::rtl::OUString& rFormula, const ::rtl::OUString& rSharedRange, sal_Int32 nId, const ::com::sun::star::table::CellAddress& rBaseAddr ); /** Imports a shared formula from a SHAREDFORMULA record in the passed stream */ - void importSharedFmla( RecordInputStream& rStrm, + void importSharedFmla( SequenceInputStream& rStrm, const ::com::sun::star::table::CellAddress& rBaseAddr ); /** Imports a shared formula from a SHAREDFMLA record in the passed stream. */ void importSharedFmla( BiffInputStream& rStrm, @@ -109,4 +109,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/sharedstringsbuffer.hxx b/oox/inc/oox/xls/sharedstringsbuffer.hxx index 27827ec215ed..eff8ab4e7738 100644 --- a/oox/inc/oox/xls/sharedstringsbuffer.hxx +++ b/oox/inc/oox/xls/sharedstringsbuffer.hxx @@ -28,7 +28,6 @@ #ifndef OOX_XLS_SHAREDSTRINGSBUFFER_HXX #define OOX_XLS_SHAREDSTRINGSBUFFER_HXX -#include "oox/helper/containerhelper.hxx" #include "oox/xls/richstring.hxx" namespace oox { @@ -67,4 +66,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/sharedstringsfragment.hxx b/oox/inc/oox/xls/sharedstringsfragment.hxx index 7294643b7df5..bc3a23122d19 100644 --- a/oox/inc/oox/xls/sharedstringsfragment.hxx +++ b/oox/inc/oox/xls/sharedstringsfragment.hxx @@ -35,21 +35,16 @@ namespace xls { // ============================================================================ -class OoxSharedStringsFragment : public OoxWorkbookFragmentBase +class SharedStringsFragment : public WorkbookFragmentBase { public: - explicit OoxSharedStringsFragment( + explicit SharedStringsFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rFragmentPath ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - - // oox.core.FragmentHandler2 interface ------------------------------------ + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; virtual void finalizeImport(); @@ -61,4 +56,3 @@ protected: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx index fec8b7db89cb..fbf750cdcd72 100644 --- a/oox/inc/oox/xls/sheetdatacontext.hxx +++ b/oox/inc/oox/xls/sheetdatacontext.hxx @@ -45,18 +45,17 @@ namespace xls { The sheetData element contains all row settings and all cells in a single sheet of a spreadsheet document. */ -class OoxSheetDataContext : public OoxWorksheetContextBase +class SheetDataContext : public WorksheetContextBase { public: - explicit OoxSheetDataContext( OoxWorksheetFragmentBase& rFragment ); + explicit SheetDataContext( WorksheetFragmentBase& rFragment ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); private: /** Different types of cell records. */ @@ -70,35 +69,35 @@ private: void importFormula( const AttributeList& rAttribs ); /** Imports a cell address and the following XF identifier. */ - void importCellHeader( RecordInputStream& rStrm, CellType eCellType ); + void importCellHeader( SequenceInputStream& rStrm, CellType eCellType ); /** Imports an empty cell from a CELL_BLANK or MULTCELL_BLANK record. */ - void importCellBlank( RecordInputStream& rStrm, CellType eCellType ); + void importCellBlank( SequenceInputStream& rStrm, CellType eCellType ); /** Imports a boolean cell from a CELL_BOOL, MULTCELL_BOOL, or FORMULA_BOOL record. */ - void importCellBool( RecordInputStream& rStrm, CellType eCellType ); + void importCellBool( SequenceInputStream& rStrm, CellType eCellType ); /** Imports a numeric cell from a CELL_DOUBLE, MULTCELL_DOUBLE, or FORMULA_DOUBLE record. */ - void importCellDouble( RecordInputStream& rStrm, CellType eCellType ); + void importCellDouble( SequenceInputStream& rStrm, CellType eCellType ); /** Imports an error code cell from a CELL_ERROR, MULTCELL_ERROR, or FORMULA_ERROR record. */ - void importCellError( RecordInputStream& rStrm, CellType eCellType ); + void importCellError( SequenceInputStream& rStrm, CellType eCellType ); /** Imports an encoded numeric cell from a CELL_RK or MULTCELL_RK record. */ - void importCellRk( RecordInputStream& rStrm, CellType eCellType ); + void importCellRk( SequenceInputStream& rStrm, CellType eCellType ); /** Imports a rich-string cell from a CELL_RSTRING or MULTCELL_RSTRING record. */ - void importCellRString( RecordInputStream& rStrm, CellType eCellType ); + void importCellRString( SequenceInputStream& rStrm, CellType eCellType ); /** Imports a string cell from a CELL_SI or MULTCELL_SI record. */ - void importCellSi( RecordInputStream& rStrm, CellType eCellType ); + void importCellSi( SequenceInputStream& rStrm, CellType eCellType ); /** Imports a string cell from a CELL_STRING, MULTCELL_STRING, or FORMULA_STRING record. */ - void importCellString( RecordInputStream& rStrm, CellType eCellType ); + void importCellString( SequenceInputStream& rStrm, CellType eCellType ); /** Imports a cell formula for the current cell. */ - void importCellFormula( RecordInputStream& rStrm ); + void importCellFormula( SequenceInputStream& rStrm ); /** Imports row settings from a ROW record. */ - void importRow( RecordInputStream& rStrm ); + void importRow( SequenceInputStream& rStrm ); /** Imports an array formula from an ARRAY record. */ - void importArray( RecordInputStream& rStrm ); + void importArray( SequenceInputStream& rStrm ); /** Imports a shared formula from a SHAREDFORMULA record. */ - void importSharedFmla( RecordInputStream& rStrm ); + void importSharedFmla( SequenceInputStream& rStrm ); /** Imports table operation from a DATATABLE record. */ - void importDataTable( RecordInputStream& rStrm ); + void importDataTable( SequenceInputStream& rStrm ); private: CellModel maCurrCell; /// Position and formatting of current imported cell. @@ -114,49 +113,49 @@ private: class BiffSheetDataContext : public BiffWorksheetContextBase { public: - explicit BiffSheetDataContext( const BiffWorksheetFragmentBase& rParent ); + explicit BiffSheetDataContext( const WorksheetHelper& rHelper ); /** Tries to import a sheet data record. */ - virtual void importRecord(); + virtual void importRecord( BiffInputStream& rStrm ); private: /** Sets current cell according to the passed address. */ void setCurrCell( const BinAddress& rAddr ); /** Imports an XF identifier and sets the mnXfId member. */ - void importXfId( bool bBiff2 ); + void importXfId( BiffInputStream& rStrm, bool bBiff2 ); /** Imports a BIFF cell address and the following XF identifier. */ - void importCellHeader( bool bBiff2 ); + void importCellHeader( BiffInputStream& rStrm, bool bBiff2 ); /** Imports a BLANK record describing a blank but formatted cell. */ - void importBlank(); + void importBlank( BiffInputStream& rStrm ); /** Imports a BOOLERR record describing a boolean or error code cell. */ - void importBoolErr(); + void importBoolErr( BiffInputStream& rStrm ); /** Imports a FORMULA record describing a formula cell. */ - void importFormula(); + void importFormula( BiffInputStream& rStrm ); /** Imports an INTEGER record describing a BIFF2 integer cell. */ - void importInteger(); + void importInteger( BiffInputStream& rStrm ); /** Imports a LABEL record describing an unformatted string cell. */ - void importLabel(); + void importLabel( BiffInputStream& rStrm ); /** Imports a LABELSST record describing a string cell using the shared string list. */ - void importLabelSst(); + void importLabelSst( BiffInputStream& rStrm ); /** Imports a MULTBLANK record describing a range of blank but formatted cells. */ - void importMultBlank(); + void importMultBlank( BiffInputStream& rStrm ); /** Imports a MULTRK record describing a range of numeric cells. */ - void importMultRk(); + void importMultRk( BiffInputStream& rStrm ); /** Imports a NUMBER record describing a floating-point cell. */ - void importNumber(); + void importNumber( BiffInputStream& rStrm ); /** Imports an RK record describing a numeric cell. */ - void importRk(); + void importRk( BiffInputStream& rStrm ); /** Imports row settings from a ROW record. */ - void importRow(); + void importRow( BiffInputStream& rStrm ); /** Imports an ARRAY record describing an array formula of a cell range. */ - void importArray(); + void importArray( BiffInputStream& rStrm ); /** Imports a SHAREDFMLA record describing a shared formula in a cell range. */ - void importSharedFmla(); + void importSharedFmla( BiffInputStream& rStrm ); /** Imports table operation from a DATATABLE or DATATABLE2 record. */ - void importDataTable(); + void importDataTable( BiffInputStream& rStrm ); private: CellModel maCurrCell; /// Position and formatting of current imported cell. @@ -172,4 +171,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx index b597546f8484..468476449cc3 100644 --- a/oox/inc/oox/xls/stylesbuffer.hxx +++ b/oox/inc/oox/xls/stylesbuffer.hxx @@ -29,14 +29,15 @@ #define OOX_XLS_STYLESBUFFER_HXX #include <com/sun/star/awt/FontDescriptor.hpp> -#include <com/sun/star/util/CellProtection.hpp> #include <com/sun/star/table/CellHoriJustify.hpp> #include <com/sun/star/table/CellOrientation.hpp> #include <com/sun/star/table/CellVertJustify.hpp> #include <com/sun/star/table/TableBorder.hpp> -#include "oox/helper/containerhelper.hxx" -#include "oox/helper/graphichelper.hxx" +#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 { @@ -111,11 +112,11 @@ public: void importColor( const AttributeList& rAttribs ); /** Imports a 64-bit color from the passed binary stream. */ - void importColor( RecordInputStream& rStrm ); - /** Imports a 32-bit palette color identifier from the passed OOBIN stream. */ - void importColorId( RecordInputStream& rStrm ); - /** Imports a 32-bit RGBA color value from the passed OOBIN stream. */ - void importColorRgb( RecordInputStream& rStrm ); + void importColor( SequenceInputStream& rStrm ); + /** Imports a 32-bit palette color identifier from the passed BIFF12 stream. */ + void importColorId( SequenceInputStream& rStrm ); + /** Imports a 32-bit RGBA color value from the passed BIFF12 stream. */ + void importColorRgb( SequenceInputStream& rStrm ); /** Imports an 8-bit or 16-bit palette color identifier from the passed BIFF stream. */ void importColorId( BiffInputStream& rStrm, bool b16Bit = true ); @@ -128,7 +129,7 @@ public: // ---------------------------------------------------------------------------- -RecordInputStream& operator>>( RecordInputStream& rStrm, Color& orColor ); +SequenceInputStream& operator>>( SequenceInputStream& rStrm, Color& orColor ); // ============================================================================ @@ -142,9 +143,11 @@ public: /** Appends a new color from the passed attributes. */ void importPaletteColor( const AttributeList& rAttribs ); /** Appends a new color from the passed RGBCOLOR record. */ - void importPaletteColor( RecordInputStream& rStrm ); + 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; @@ -179,7 +182,7 @@ struct FontModel explicit FontModel(); - void setBinScheme( sal_uInt8 nScheme ); + void setBiff12Scheme( sal_uInt8 nScheme ); void setBiffHeight( sal_uInt16 nHeight ); void setBiffWeight( sal_uInt16 nWeight ); void setBiffUnderline( sal_uInt16 nUnderline ); @@ -259,23 +262,23 @@ public: void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs ); /** Imports the FONT record from the passed stream. */ - void importFont( RecordInputStream& rStrm ); + void importFont( SequenceInputStream& rStrm ); /** Imports the font name from a DXF record. */ - void importDxfName( RecordInputStream& rStrm ); + void importDxfName( SequenceInputStream& rStrm ); /** Imports the font color from a DXF record. */ - void importDxfColor( RecordInputStream& rStrm ); + void importDxfColor( SequenceInputStream& rStrm ); /** Imports the font scheme from a DXF record. */ - void importDxfScheme( RecordInputStream& rStrm ); + void importDxfScheme( SequenceInputStream& rStrm ); /** Imports the font height from a DXF record. */ - void importDxfHeight( RecordInputStream& rStrm ); + void importDxfHeight( SequenceInputStream& rStrm ); /** Imports the font weight from a DXF record. */ - void importDxfWeight( RecordInputStream& rStrm ); + void importDxfWeight( SequenceInputStream& rStrm ); /** Imports the font underline style from a DXF record. */ - void importDxfUnderline( RecordInputStream& rStrm ); + void importDxfUnderline( SequenceInputStream& rStrm ); /** Imports the font escapement style from a DXF record. */ - void importDxfEscapement( RecordInputStream& rStrm ); + void importDxfEscapement( SequenceInputStream& rStrm ); /** Imports a font style flag from a DXF record. */ - void importDxfFlag( sal_Int32 nElement, RecordInputStream& rStrm ); + void importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm ); /** Imports the FONT record from the passed stream. */ void importFont( BiffInputStream& rStrm ); @@ -346,12 +349,12 @@ struct AlignmentModel explicit AlignmentModel(); - /** Sets horizontal alignment from the passed OOBIN or BIFF data. */ - void setBinHorAlign( sal_uInt8 nHorAlign ); - /** Sets vertical alignment from the passed OOBIN or BIFF data. */ - void setBinVerAlign( sal_uInt8 nVerAlign ); - /** Sets rotation from the passed OOBIN or BIFF text orientation. */ - void setBinTextOrient( sal_uInt8 nTextOrient ); + /** 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 ); }; // ---------------------------------------------------------------------------- @@ -387,8 +390,8 @@ public: /** Sets all attributes from the alignment element. */ void importAlignment( const AttributeList& rAttribs ); - /** Sets the alignment attributes from the passed OOBIN XF record data. */ - void setBinData( sal_uInt32 nFlags ); + /** 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. */ @@ -453,8 +456,8 @@ public: /** Sets all attributes from the protection element. */ void importProtection( const AttributeList& rAttribs ); - /** Sets the protection attributes from the passed OOBIN XF record data. */ - void setBinData( sal_uInt32 nFlags ); + /** 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. */ @@ -489,7 +492,7 @@ struct BorderLineModel explicit BorderLineModel( bool bDxf ); - /** Sets the passed OOBIN or BIFF line style. */ + /** 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 ); @@ -548,9 +551,9 @@ public: void importColor( sal_Int32 nElement, const AttributeList& rAttribs ); /** Imports the BORDER record from the passed stream. */ - void importBorder( RecordInputStream& rStrm ); + void importBorder( SequenceInputStream& rStrm ); /** Imports a border from a DXF record from the passed stream. */ - void importDxfBorder( sal_Int32 nElement, RecordInputStream& rStrm ); + void importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm ); /** Sets the border attributes from the passed BIFF2 XF record data. */ void setBiff2Data( sal_uInt8 nFlags ); @@ -605,8 +608,8 @@ struct PatternFillModel explicit PatternFillModel( bool bDxf ); - /** Sets the passed OOBIN or BIFF pattern identifier. */ - void setBinPattern( sal_Int32 nPattern ); + /** 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 ); }; @@ -628,10 +631,10 @@ struct GradientFillModel explicit GradientFillModel(); - /** Reads OOBIN gradient settings from a FILL or DXF record. */ - void readGradient( RecordInputStream& rStrm ); - /** Reads OOBIN gradient stop settings from a FILL or DXF record. */ - void readGradientStop( RecordInputStream& rStrm, bool bDxf ); + /** 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 ); }; // ---------------------------------------------------------------------------- @@ -668,17 +671,17 @@ public: void importColor( const AttributeList& rAttribs, double fPosition ); /** Imports the FILL record from the passed stream. */ - void importFill( RecordInputStream& rStrm ); + void importFill( SequenceInputStream& rStrm ); /** Imports the fill pattern from a DXF record. */ - void importDxfPattern( RecordInputStream& rStrm ); + void importDxfPattern( SequenceInputStream& rStrm ); /** Imports the pattern color from a DXF record. */ - void importDxfFgColor( RecordInputStream& rStrm ); + void importDxfFgColor( SequenceInputStream& rStrm ); /** Imports the background color from a DXF record. */ - void importDxfBgColor( RecordInputStream& rStrm ); + void importDxfBgColor( SequenceInputStream& rStrm ); /** Imports gradient settings from a DXF record. */ - void importDxfGradient( RecordInputStream& rStrm ); + void importDxfGradient( SequenceInputStream& rStrm ); /** Imports gradient stop settings from a DXF record. */ - void importDxfStop( RecordInputStream& rStrm ); + void importDxfStop( SequenceInputStream& rStrm ); /** Sets the fill attributes from the passed BIFF2 XF record data. */ void setBiff2Data( sal_uInt8 nFlags ); @@ -762,7 +765,7 @@ public: void importProtection( const AttributeList& rAttribs ); /** Imports the XF record from the passed stream. */ - void importXf( RecordInputStream& rStrm, bool bCellXf ); + void importXf( SequenceInputStream& rStrm, bool bCellXf ); /** Imports the XF record from the passed stream. */ void importXf( BiffInputStream& rStrm ); @@ -828,7 +831,7 @@ public: void importProtection( const AttributeList& rAttribs ); /** Imports the DXF record from the passed stream. */ - void importDxf( RecordInputStream& rStrm ); + void importDxf( SequenceInputStream& rStrm ); /** Imports font, border, and fill settings from the CFRULE record. */ void importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags ); @@ -883,7 +886,7 @@ public: /** Imports passed attributes from the cellStyle element. */ void importCellStyle( const AttributeList& rAttribs ); /** Imports style settings from a CELLSTYLE record. */ - void importCellStyle( RecordInputStream& rStrm ); + void importCellStyle( SequenceInputStream& rStrm ); /** Imports style settings from a STYLE record. */ void importStyle( BiffInputStream& rStrm ); @@ -916,7 +919,7 @@ public: /** Appends and returns a new named cell style object. */ CellStyleRef importCellStyle( const AttributeList& rAttribs ); /** Imports the CELLSTYLE record from the passed stream. */ - CellStyleRef importCellStyle( RecordInputStream& rStrm ); + CellStyleRef importCellStyle( SequenceInputStream& rStrm ); /** Imports the STYLE record from the passed stream. */ CellStyleRef importStyle( BiffInputStream& rStrm ); @@ -948,6 +951,21 @@ private: // ============================================================================ +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: @@ -982,11 +1000,11 @@ public: CellStyleRef importCellStyle( const AttributeList& rAttribs ); /** Appends a new color to the color palette. */ - void importPaletteColor( RecordInputStream& rStrm ); + void importPaletteColor( SequenceInputStream& rStrm ); /** Imports the NUMFMT record from the passed stream. */ - void importNumFmt( RecordInputStream& rStrm ); + void importNumFmt( SequenceInputStream& rStrm ); /** Imports the CELLSTYLE record from the passed stream. */ - void importCellStyle( RecordInputStream& rStrm ); + void importCellStyle( SequenceInputStream& rStrm ); /** Imports the PALETTE record from the passed stream. */ void importPalette( BiffInputStream& rStrm ); @@ -1001,6 +1019,9 @@ public: /** 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(); @@ -1080,4 +1101,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/stylesfragment.hxx b/oox/inc/oox/xls/stylesfragment.hxx index b3dc63fe6e31..eb1af53d9cdb 100644 --- a/oox/inc/oox/xls/stylesfragment.hxx +++ b/oox/inc/oox/xls/stylesfragment.hxx @@ -36,24 +36,24 @@ namespace xls { // ============================================================================ -class OoxIndexedColorsContext : public OoxWorkbookContextBase +class IndexedColorsContext : public WorkbookContextBase { public: - explicit OoxIndexedColorsContext( OoxWorkbookFragmentBase& rFragment ); + explicit IndexedColorsContext( WorkbookFragmentBase& rFragment ); protected: virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); }; // ============================================================================ -class OoxFontContext : public OoxWorkbookContextBase +class FontContext : public WorkbookContextBase { public: template< typename ParentType > - inline explicit OoxFontContext( ParentType& rParent, const FontRef& rxFont ) : - OoxWorkbookContextBase( rParent ), mxFont( rxFont ) {} + inline explicit FontContext( ParentType& rParent, const FontRef& rxFont ) : + WorkbookContextBase( rParent ), mxFont( rxFont ) {} protected: virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); @@ -64,12 +64,12 @@ private: // ============================================================================ -class OoxBorderContext : public OoxWorkbookContextBase +class BorderContext : public WorkbookContextBase { public: template< typename ParentType > - inline explicit OoxBorderContext( ParentType& rParent, const BorderRef& rxBorder ) : - OoxWorkbookContextBase( rParent ), mxBorder( rxBorder ) {} + inline explicit BorderContext( ParentType& rParent, const BorderRef& rxBorder ) : + WorkbookContextBase( rParent ), mxBorder( rxBorder ) {} protected: virtual void onStartElement( const AttributeList& rAttribs ); @@ -81,12 +81,12 @@ private: // ============================================================================ -class OoxFillContext : public OoxWorkbookContextBase +class FillContext : public WorkbookContextBase { public: template< typename ParentType > - inline explicit OoxFillContext( ParentType& rParent, const FillRef& rxFill ) : - OoxWorkbookContextBase( rParent ), mxFill( rxFill ), mfGradPos( -1.0 ) {} + 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 ); @@ -98,12 +98,12 @@ private: // ============================================================================ -class OoxXfContext : public OoxWorkbookContextBase +class XfContext : public WorkbookContextBase { public: template< typename ParentType > - inline explicit OoxXfContext( ParentType& rParent, const XfRef& rxXf, bool bCellXf ) : - OoxWorkbookContextBase( rParent ), mxXf( rxXf ), mbCellXf( bCellXf ) {} + inline explicit XfContext( ParentType& rParent, const XfRef& rxXf, bool bCellXf ) : + WorkbookContextBase( rParent ), mxXf( rxXf ), mbCellXf( bCellXf ) {} protected: virtual void onStartElement( const AttributeList& rAttribs ); @@ -116,12 +116,12 @@ private: // ============================================================================ -class OoxDxfContext : public OoxWorkbookContextBase +class DxfContext : public WorkbookContextBase { public: template< typename ParentType > - inline explicit OoxDxfContext( ParentType& rParent, const DxfRef& rxDxf ) : - OoxWorkbookContextBase( rParent ), mxDxf( rxDxf ) {} + inline explicit DxfContext( ParentType& rParent, const DxfRef& rxDxf ) : + WorkbookContextBase( rParent ), mxDxf( rxDxf ) {} protected: virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); @@ -132,20 +132,16 @@ private: // ============================================================================ -class OoxStylesFragment : public OoxWorkbookFragmentBase +class StylesFragment : public WorkbookFragmentBase { public: - explicit OoxStylesFragment( + explicit StylesFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rFragmentPath ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - - // oox.core.FragmentHandler2 interface ------------------------------------ + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; virtual void finalizeImport(); @@ -157,4 +153,3 @@ protected: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/tablebuffer.hxx b/oox/inc/oox/xls/tablebuffer.hxx index 993b4305d03a..d643fbc40728 100644 --- a/oox/inc/oox/xls/tablebuffer.hxx +++ b/oox/inc/oox/xls/tablebuffer.hxx @@ -29,7 +29,7 @@ #define OOX_XLS_TABLEBUFFER_HXX #include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/helper/containerhelper.hxx" +#include "oox/xls/autofilterbuffer.hxx" #include "oox/xls/workbookhelper.hxx" namespace oox { @@ -61,16 +61,18 @@ public: /** 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( RecordInputStream& rStrm, sal_Int16 nSheet ); + 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 table identifier. */ + /** 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 display name of the table. */ + /** 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. */ @@ -88,6 +90,8 @@ public: 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. @@ -102,10 +106,8 @@ class TableBuffer : public WorkbookHelper public: explicit TableBuffer( const WorkbookHelper& rHelper ); - /** Imports a table definition from the passed attributes. */ - TableRef importTable( const AttributeList& rAttribs, sal_Int16 nSheet ); - /** Imports a table definition from a TABLE record. */ - TableRef importTable( RecordInputStream& rStrm, sal_Int16 nSheet ); + /** Creates a new empty table. */ + Table& createTable(); /** Creates database ranges from all imported tables. */ void finalizeImport(); @@ -116,12 +118,15 @@ public: TableRef getTable( const ::rtl::OUString& rDispName ) const; private: - void insertTable( TableRef xTable ); + /** 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; }; @@ -132,4 +137,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/tablefragment.hxx b/oox/inc/oox/xls/tablefragment.hxx index e30eb1e2f9e8..9c2678405ee5 100644 --- a/oox/inc/oox/xls/tablefragment.hxx +++ b/oox/inc/oox/xls/tablefragment.hxx @@ -29,32 +29,29 @@ #define OOX_XLS_TABLEFRAGMENT_HXX #include "oox/xls/excelhandlers.hxx" -#include "oox/xls/tablebuffer.hxx" namespace oox { namespace xls { +class Table; + // ============================================================================ -class OoxTableFragment : public OoxWorksheetFragmentBase +class TableFragment : public WorksheetFragmentBase { public: - explicit OoxTableFragment( + explicit TableFragment( const WorksheetHelper& rHelper, const ::rtl::OUString& rFragmentPath ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); - - // oox.core.FragmentHandler2 interface ------------------------------------ + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; private: - TableRef mxTable; /// Current table. + Table& mrTable; }; // ============================================================================ @@ -63,4 +60,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/themebuffer.hxx b/oox/inc/oox/xls/themebuffer.hxx index 338837e40427..95d092198b95 100644 --- a/oox/inc/oox/xls/themebuffer.hxx +++ b/oox/inc/oox/xls/themebuffer.hxx @@ -61,4 +61,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/unitconverter.hxx b/oox/inc/oox/xls/unitconverter.hxx index 36a70a7f4067..1ea4180bc6fd 100644 --- a/oox/inc/oox/xls/unitconverter.hxx +++ b/oox/inc/oox/xls/unitconverter.hxx @@ -28,8 +28,8 @@ #ifndef OOX_XLS_UNITCONVERTER_HXX #define OOX_XLS_UNITCONVERTER_HXX -#include <vector> #include <map> +#include <vector> #include "oox/xls/workbookhelper.hxx" namespace com { namespace sun { namespace star { @@ -121,4 +121,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/viewsettings.hxx b/oox/inc/oox/xls/viewsettings.hxx index 1f82aedeef91..c5880bf077fe 100644 --- a/oox/inc/oox/xls/viewsettings.hxx +++ b/oox/inc/oox/xls/viewsettings.hxx @@ -30,7 +30,6 @@ #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/helper/containerhelper.hxx" #include "oox/xls/addressconverter.hxx" #include "oox/xls/stylesbuffer.hxx" #include "oox/xls/worksheethelper.hxx" @@ -119,13 +118,13 @@ public: void importChartSheetView( const AttributeList& rAttribs ); /** Imports the SHEETVIEW record containing sheet view settings. */ - void importSheetView( RecordInputStream& rStrm ); + void importSheetView( SequenceInputStream& rStrm ); /** Imports the PANE record containing sheet pane settings. */ - void importPane( RecordInputStream& rStrm ); + void importPane( SequenceInputStream& rStrm ); /** Imports the SELECTION record containing selection settings for a pane. */ - void importSelection( RecordInputStream& rStrm ); + void importSelection( SequenceInputStream& rStrm ); /** Imports the CHARTSHEETVIEW record containing view settings of a chart sheet. */ - void importChartSheetView( RecordInputStream& rStrm ); + void importChartSheetView( SequenceInputStream& rStrm ); /** Imports the WINDOW2 record containing sheet view settings. */ void importWindow2( BiffInputStream& rStrm ); @@ -139,6 +138,9 @@ public: /** 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(); @@ -182,9 +184,9 @@ public: /** 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( RecordInputStream& rStrm ); + void importWorkbookView( SequenceInputStream& rStrm ); /** Imports the OLESIZE record containing the visible size of the workbook. */ - void importOleSize( RecordInputStream& rStrm ); + 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. */ @@ -228,4 +230,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/webquerybuffer.hxx b/oox/inc/oox/xls/webquerybuffer.hxx deleted file mode 100644 index 22c91bc15d1f..000000000000 --- a/oox/inc/oox/xls/webquerybuffer.hxx +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************* - * - * 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_WEBQUERYBUFFER_HXX -#define OOX_XLS_WEBQUERYBUFFER_HXX - -#include <vector> -#include <hash_map> -#include <boost/shared_ptr.hpp> -#include <com/sun/star/table/CellRangeAddress.hpp> -#include "oox/xls/workbookhelper.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -struct QueryTable -{ - sal_Int32 mnConnectionId; -}; - -// struct WebQuery -// { -// enum WebQueryMode -// { -// xlWQUnknown, /// Not specified. -// xlWQDocument, /// Entire document. -// xlWQAllTables, /// All tables. -// xlWQSpecTables /// Specific tables. -// }; -// -// ::rtl::OUString maURL; /// Source document URL. -// ::rtl::OUString maTables; /// List of source range names. -// ::com::sun::star::table::CellRangeAddress maDestRange; /// Destination range. -// WebQueryMode meMode; /// Current mode of web query. -// sal_uInt16 mnRefresh; /// Refresh time in minutes. -// }; - -struct BaseProperties -{ -}; - -/** Stores web query properties from webPr element. */ -struct WebProperties : public BaseProperties -{ - ::rtl::OUString maURL; -}; - -/** Stores text data source properties from textPr element. */ -struct TextProperties : public BaseProperties -{ - ::rtl::OUString maSourceFile; -}; - -struct Connection -{ - static const sal_Int32 CONNECTION_ODBC_SOURCE; - static const sal_Int32 CONNECTION_DAO_SOURCE; - static const sal_Int32 CONNECTION_FILE_SOURCE; - static const sal_Int32 CONNECTION_WEBQUERY; - static const sal_Int32 CONNECTION_OLEDB_SOURCE; - static const sal_Int32 CONNECTION_TEXT_SOURCE; - static const sal_Int32 CONNECTION_ADO_RECORD_SET; - static const sal_Int32 CONNECTION_DSP; - - ::rtl::OUString maName; /// Connection name (must be unique). - sal_Int32 mnType; - ::boost::shared_ptr< BaseProperties > mpProperties; -}; - -// ============================================================================ - -typedef ::std::hash_map< ::rtl::OUString, QueryTable, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > QueryTableHashMap; - -class WebQueryBuffer : public WorkbookHelper -{ -public: - explicit WebQueryBuffer( const WorkbookHelper& rHelper ); - - void importQueryTable( const AttributeList& rAttribs ); - - void importConnection( const AttributeList& rAttribs ); - - void importWebPr( const AttributeList& rAttribs ); - - /** Dumps content for debug purposes. */ - void dump() const; - -private: - QueryTableHashMap maQueryTableMap; - ::std::vector< Connection > maConnections; - - sal_Int32 mnCurConnId; /// Current connection ID. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif - diff --git a/oox/inc/oox/xls/workbookfragment.hxx b/oox/inc/oox/xls/workbookfragment.hxx index f9f0bb25c78f..d0b0cadd416b 100644 --- a/oox/inc/oox/xls/workbookfragment.hxx +++ b/oox/inc/oox/xls/workbookfragment.hxx @@ -38,22 +38,18 @@ class ExternalLink; // ============================================================================ -class OoxWorkbookFragment : public OoxWorkbookFragmentBase +class WorkbookFragment : public WorkbookFragmentBase { public: - explicit OoxWorkbookFragment( + explicit WorkbookFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rFragmentPath ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); + virtual void onCharacters( const ::rtl::OUString& rChars ); - // oox.core.FragmentHandler2 interface ------------------------------------ + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; virtual void finalizeImport(); @@ -63,8 +59,8 @@ private: void importDefinedName( const AttributeList& rAttribs ); void importPivotCache( const AttributeList& rAttribs ); - void importExternalRef( RecordInputStream& rStrm ); - void importPivotCache( RecordInputStream& rStrm ); + void importExternalRef( SequenceInputStream& rStrm ); + void importPivotCache( SequenceInputStream& rStrm ); void importExternalLinkFragment( ExternalLink& rExtLink ); void importPivotCacheDefFragment( const ::rtl::OUString& rRelId, sal_Int32 nCacheId ); @@ -100,4 +96,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx index 0ff8c0f9d3e5..ecf824076ef5 100644 --- a/oox/inc/oox/xls/workbookhelper.hxx +++ b/oox/inc/oox/xls/workbookhelper.hxx @@ -37,24 +37,21 @@ namespace com { namespace sun { namespace star { namespace container { class XNameAccess; } namespace container { class XNameContainer; } namespace lang { class XMultiServiceFactory; } - namespace awt { class XDevice; } + 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 sheet { class XSpreadsheetDocument; } - namespace sheet { class XSpreadsheet; } - namespace sheet { class XNamedRanges; } - namespace sheet { class XNamedRange; } - namespace sheet { class XDatabaseRanges; } - namespace sheet { class XExternalDocLinks; } - namespace style { class XStyle; } } } } namespace oox { class AttributeList; class SegmentProgressBar; - class RecordInputStream; + class SequenceInputStream; } namespace oox { namespace core { @@ -79,8 +76,8 @@ class ExcelBiffFilter; /** An enumeration for all supported spreadsheet filter types. */ enum FilterType { - FILTER_OOX, /// MS Excel OOXML (Office Open XML) or OOBIN. - FILTER_BIFF, /// MS Excel BIFF (Binary Interchange File Format). + 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. }; @@ -89,31 +86,31 @@ enum FilterType /** Functor for case-insensitive string comparison, usable in maps etc. */ struct IgnoreCaseCompare { - bool operator()( const ::rtl::OUString& rName1, const ::rtl::OUString& rName2 ) const; + bool operator()( const ::rtl::OUString& rName1, const ::rtl::OUString& rName2 ) const; }; // ============================================================================ -class WorkbookData; -class WorkbookSettings; -class ViewSettings; -class WorksheetBuffer; -class ThemeBuffer; -class StylesBuffer; -class SharedStringsBuffer; -class ExternalLinkBuffer; +class AddressConverter; +class BiffCodecHelper; +class ConnectionsBuffer; class DefinedNamesBuffer; -class TableBuffer; -class ScenarioBuffer; -class WebQueryBuffer; +class ExcelChartConverter; +class ExternalLinkBuffer; +class FormulaParser; +class PageSettingsConverter; class PivotCacheBuffer; class PivotTableBuffer; -class FormulaParser; +class ScenarioBuffer; +class SharedStringsBuffer; +class StylesBuffer; +class TableBuffer; +class ThemeBuffer; class UnitConverter; -class AddressConverter; -class ExcelChartConverter; -class PageSettingsConverter; -class BiffCodecHelper; +class ViewSettings; +class WorkbookData; +class WorkbookSettings; +class WorksheetBuffer; /** Helper class to provice access to global workbook data. @@ -163,21 +160,6 @@ public: /** Returns a reference to the service factory of the spreadsheet document model. */ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getDocumentFactory() const; - /** Returns the reference device of the document. */ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > - getReferenceDevice() const; - /** Returns the container for defined names from the Calc document. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRanges > - getNamedRanges() const; - /** Returns the container for database ranges from the Calc document. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDatabaseRanges > - getDatabaseRanges() const; - /** Returns the container for external documents from the Calc document. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLinks > - getExternalDocLinks() const; - /** Returns the container for DDE links from the Calc document. */ - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > - getDdeLinks() const; /** Returns a reference to the specified spreadsheet in the document model. */ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > @@ -203,12 +185,21 @@ public: 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 this defined names buffer. + 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 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 a com.sun.star.style.Style object for cells or pages. */ ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > createStyleObject( @@ -237,8 +228,8 @@ public: TableBuffer& getTables() const; /** Returns the scenarios collection. */ ScenarioBuffer& getScenarios() const; - /** Returns the web queries. */ - WebQueryBuffer& getWebQueries() 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. */ @@ -257,17 +248,17 @@ public: /** Returns the page and print settings converter. */ PageSettingsConverter& getPageSettingsConverter() const; - // OOX specific (MUST NOT be called in BIFF filter) ----------------------- + // OOXML/BIFF12 specific (MUST NOT be called in BIFF filter) -------------- - /** Returns the base OOX filter object. - Must not be called, if current filter is not the OOX 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 ); - // BIFF specific (MUST NOT be called in OOX filter) ----------------------- + // BIFF2-BIFF8 specific (MUST NOT be called in OOXML/BIFF12 filter) ------- /** Returns the base BIFF filter object. */ ::oox::core::BinaryFilterBase& getBiffFilter() const; diff --git a/oox/inc/oox/xls/workbooksettings.hxx b/oox/inc/oox/xls/workbooksettings.hxx index 8ba322103955..858e886df778 100644 --- a/oox/inc/oox/xls/workbooksettings.hxx +++ b/oox/inc/oox/xls/workbooksettings.hxx @@ -61,8 +61,8 @@ struct WorkbookSettingsModel explicit WorkbookSettingsModel(); - /** Sets OOBIN or BIFF object visibility mode. */ - void setBinObjectMode( sal_uInt16 nObjMode ); + /** Sets BIFF object visibility mode. */ + void setBiffObjectMode( sal_uInt16 nObjMode ); }; // ============================================================================ @@ -101,11 +101,11 @@ public: void importCalcPr( const AttributeList& rAttribs ); /** Imports the FILESHARING record containing write protection settings. */ - void importFileSharing( RecordInputStream& rStrm ); + void importFileSharing( SequenceInputStream& rStrm ); /** Imports the WORKBOOKPR record containing global workbook settings. */ - void importWorkbookPr( RecordInputStream& rStrm ); + void importWorkbookPr( SequenceInputStream& rStrm ); /** Imports the CALCPR record containing workbook calculation settings. */ - void importCalcPr( RecordInputStream& rStrm ); + void importCalcPr( SequenceInputStream& rStrm ); /** Sets the save external linked values flag, e.g. from the WSBOOL record. */ void setSaveExtLinkValues( bool bSaveExtLinks ); @@ -162,4 +162,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/worksheetbuffer.hxx b/oox/inc/oox/xls/worksheetbuffer.hxx index 2f9359b38370..7c59cce988dd 100644 --- a/oox/inc/oox/xls/worksheetbuffer.hxx +++ b/oox/inc/oox/xls/worksheetbuffer.hxx @@ -29,7 +29,8 @@ #define OOX_XLS_WORKSHEETBUFFER_HXX #include <utility> -#include "oox/helper/containerhelper.hxx" +#include "oox/helper/refmap.hxx" +#include "oox/helper/refvector.hxx" #include "oox/xls/workbookhelper.hxx" namespace com { namespace sun { namespace star { @@ -58,8 +59,8 @@ struct SheetInfoModel /** Stores information about all sheets in a spreadsheet document. Information about sheets includes the sheet name, the visibility state, and - for the OOX filter, the relation identifier of the sheet used to obtain the - related worksheet fragment. + for the OOXML filter, the relation identifier of the sheet used to obtain + the related worksheet fragment. */ class WorksheetBuffer : public WorkbookHelper { @@ -74,8 +75,8 @@ public: /** Imports the attributes of a sheet element. */ void importSheet( const AttributeList& rAttribs ); - /** Imports the SHEET record from the passed OOBIN stream. */ - void importSheet( RecordInputStream& rStrm ); + /** 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. @@ -84,7 +85,7 @@ public: /** Returns the number of original sheets contained in the workbook. */ sal_Int32 getWorksheetCount() const; - /** Returns the OOX relation identifier of the specified worksheet. */ + /** 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; @@ -130,4 +131,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/worksheetfragment.hxx b/oox/inc/oox/xls/worksheetfragment.hxx index 1e22bd7e4739..5dca396c8908 100644 --- a/oox/inc/oox/xls/worksheetfragment.hxx +++ b/oox/inc/oox/xls/worksheetfragment.hxx @@ -35,24 +35,23 @@ namespace xls { // ============================================================================ -class OoxDataValidationsContext : public OoxWorksheetContextBase +class DataValidationsContext : public WorksheetContextBase { public: - explicit OoxDataValidationsContext( OoxWorksheetFragmentBase& rFragment ); + explicit DataValidationsContext( WorksheetFragmentBase& rFragment ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); + 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( RecordInputStream& rStrm ); + void importDataValidation( SequenceInputStream& rStrm ); private: ::std::auto_ptr< ValidationModel > mxValModel; @@ -60,25 +59,21 @@ private: // ============================================================================ -class OoxWorksheetFragment : public OoxWorksheetFragmentBase +class WorksheetFragment : public WorksheetFragmentBase { public: - explicit OoxWorksheetFragment( + explicit WorksheetFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rFragmentPath, - ISegmentProgressBarRef xProgressBar, + const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ); protected: - // oox.core.ContextHandler2Helper interface ------------------------------- - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); - virtual void onEndElement( const ::rtl::OUString& rChars ); - - virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ); + virtual void onCharacters( const ::rtl::OUString& rChars ); - // oox.core.FragmentHandler2 interface ------------------------------------ + virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); virtual const ::oox::core::RecordInfo* getRecordInfos() const; virtual void initializeImport(); @@ -109,25 +104,25 @@ private: void importControl( const AttributeList& rAttribs ); /** Imports the DIMENSION record containing the used area of the sheet. */ - void importDimension( RecordInputStream& rStrm ); + void importDimension( SequenceInputStream& rStrm ); /** Imports sheet format properties from a SHEETFORMATPR record. */ - void importSheetFormatPr( RecordInputStream& rStrm ); + void importSheetFormatPr( SequenceInputStream& rStrm ); /** Imports column settings from a COL record. */ - void importCol( RecordInputStream& rStrm ); + void importCol( SequenceInputStream& rStrm ); /** Imports a merged cell range from a MERGECELL record. */ - void importMergeCell( RecordInputStream& rStrm ); + void importMergeCell( SequenceInputStream& rStrm ); /** Imports a hyperlink for a cell range from a HYPERLINK record. */ - void importHyperlink( RecordInputStream& rStrm ); + void importHyperlink( SequenceInputStream& rStrm ); /** Imports the BRK record for an individual row or column page break. */ - void importBrk( RecordInputStream& rStrm, bool bRowBreak ); + void importBrk( SequenceInputStream& rStrm, bool bRowBreak ); /** Imports the DRAWING record containing the relation identifier for the DrawingML part. */ - void importDrawing( RecordInputStream& rStrm ); + void importDrawing( SequenceInputStream& rStrm ); /** Imports the LEGACYDRAWING record containing the relation identifier for the VML drawing part. */ - void importLegacyDrawing( RecordInputStream& rStrm ); + void importLegacyDrawing( SequenceInputStream& rStrm ); /** Imports additional data for an OLE object. */ - void importOleObject( RecordInputStream& rStrm ); + void importOleObject( SequenceInputStream& rStrm ); /** Imports additional data for an OCX form control. */ - void importControl( RecordInputStream& rStrm ); + 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 ); @@ -135,14 +130,12 @@ private: // ============================================================================ -class BiffPivotTableContext; - class BiffWorksheetFragment : public BiffWorksheetFragmentBase { public: explicit BiffWorksheetFragment( const BiffWorkbookFragmentBase& rParent, - ISegmentProgressBarRef xProgressBar, + const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ); virtual ~BiffWorksheetFragment(); @@ -151,43 +144,47 @@ public: 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(); + void importColInfo( BiffInputStream& rStrm ); /** Imports the BIFF2 COLUMNDEFAULT record and sets column default formatting. */ - void importColumnDefault(); + void importColumnDefault( BiffInputStream& rStrm ); /** Imports the BIFF2 COLWIDTH record and sets column width. */ - void importColWidth(); + void importColWidth( BiffInputStream& rStrm ); /** Imports the DATAVALIDATION record containing cell ranges with data validation settings. */ - void importDataValidation(); + void importDataValidation( BiffInputStream& rStrm ); /** Imports the DATAVALIDATIONS record containing global data validation settings. */ - void importDataValidations(); + void importDataValidations( BiffInputStream& rStrm ); /** Imports the DEFCOLWIDTH record and sets default column width. */ - void importDefColWidth(); + void importDefColWidth( BiffInputStream& rStrm ); /** Imports the DEFROWHEIGHT record and sets default row height and properties. */ - void importDefRowHeight(); + void importDefRowHeight( BiffInputStream& rStrm ); /** Imports the DIMENSION record containing the used area of the sheet. */ - void importDimension(); + void importDimension( BiffInputStream& rStrm ); /** Imports the HYPERLINK record and sets a cell hyperlink. */ - void importHyperlink(); + void importHyperlink( BiffInputStream& rStrm ); /** Imports the LABELRANGES record and sets the imported label ranges. */ - void importLabelRanges(); + void importLabelRanges( BiffInputStream& rStrm ); /** Imports the MEREDCELLS record and merges all cells in the document. */ - void importMergedCells(); + void importMergedCells( BiffInputStream& rStrm ); /** Imports the NOTE record containing a cell note. */ - void importNote(); + void importNote( BiffInputStream& rStrm ); /** Imports the HORPAGEBREAKS or VERPAGEBREAKS record and inserts page breaks. */ - void importPageBreaks( bool bRowBreak ); + void importPageBreaks( BiffInputStream& rStrm, bool bRowBreak ); /** Imports a pivot table. */ - void importPTDefinition(); + 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(); + void importScenarios( BiffInputStream& rStrm ); /** Imports the SHAREDFEATHEAD record. */ - void importSharedFeatHead(); + void importSharedFeatHead( BiffInputStream& rStrm ); /** Imports the STANDARDWIDTH record and sets standard column width. */ - void importStandardWidth(); + void importStandardWidth( BiffInputStream& rStrm ); private: - ::boost::shared_ptr< BiffPivotTableContext > mxPTContext; + ::boost::shared_ptr< BiffWorksheetContextBase > mxContext; }; // ============================================================================ @@ -196,4 +193,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx index 14a5ca4be888..b566289f5fec 100644 --- a/oox/inc/oox/xls/worksheethelper.hxx +++ b/oox/inc/oox/xls/worksheethelper.hxx @@ -37,30 +37,32 @@ namespace com { namespace sun { namespace star { namespace awt { struct Point; } namespace awt { struct Rectangle; } namespace awt { struct Size; } - namespace util { struct DateTime; } namespace drawing { class XDrawPage; } - namespace table { class XTableColumns; } - namespace table { class XTableRows; } + namespace sheet { class XSheetCellRanges; } + namespace sheet { class XSpreadsheet; } namespace table { class XCell; } namespace table { class XCellRange; } - namespace sheet { class XSpreadsheet; } - namespace sheet { class XSheetCellRanges; } + namespace table { class XTableColumns; } + namespace table { class XTableRows; } + namespace util { struct DateTime; } } } } namespace oox { namespace xls { +class AutoFilterBuffer; struct BinAddress; struct BinRange; class BiffSheetDrawing; class BinRangeList; -class WorksheetSettings; -class SharedFormulaBuffer; -class CondFormatBuffer; class CommentsBuffer; +class CondFormatBuffer; class PageSettings; +class QueryTableBuffer; +class SharedFormulaBuffer; class SheetViewSettings; class VmlDrawing; +class WorksheetSettings; // ============================================================================ // ============================================================================ @@ -203,12 +205,12 @@ struct ValidationModel explicit ValidationModel(); - /** Sets the passed OOBIN or BIFF validation type. */ - void setBinType( sal_uInt8 nType ); - /** Sets the passed OOBIN or BIFF operator. */ - void setBinOperator( sal_uInt8 nOperator ); - /** Sets the passed OOBIN or BIFF error style. */ - void setBinErrorStyle( sal_uInt8 nErrorStyle ); + /** 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 ); }; // ============================================================================ @@ -315,6 +317,10 @@ public: 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 page/print settings for this sheet. */ PageSettings& getPageSettings() const; /** Returns the view settings for this sheet. */ @@ -386,9 +392,8 @@ public: 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. */ - void extendShapeBoundingBox( - const ::com::sun::star::awt::Rectangle& rShapeRect ); + /** 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(). */ @@ -448,7 +453,7 @@ protected: /** Constructs from the passed data, creates and owns a new data object. */ explicit WorksheetHelperRoot( const WorkbookHelper& rHelper, - ISegmentProgressBarRef xProgressBar, + const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ); @@ -471,4 +476,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/worksheetsettings.hxx b/oox/inc/oox/xls/worksheetsettings.hxx index 17e22dc5342c..6d6c8a4912d2 100644 --- a/oox/inc/oox/xls/worksheetsettings.hxx +++ b/oox/inc/oox/xls/worksheetsettings.hxx @@ -28,8 +28,8 @@ #ifndef OOX_XLS_WORKSHEETSETTINGS_HXX #define OOX_XLS_WORKSHEETSETTINGS_HXX -#include "oox/xls/worksheethelper.hxx" #include "oox/xls/richstring.hxx" +#include "oox/xls/worksheethelper.hxx" namespace oox { namespace xls { @@ -98,16 +98,18 @@ public: void importPhoneticPr( const AttributeList& rAttribs ); /** Imports sheet properties from the SHEETPR record. */ - void importSheetPr( RecordInputStream& rStrm ); + void importSheetPr( SequenceInputStream& rStrm ); /** Imports sheet properties from the CHARTSHEETPR record. */ - void importChartSheetPr( RecordInputStream& rStrm ); + void importChartSheetPr( SequenceInputStream& rStrm ); /** Imports sheet protection settings from the SHEETPROTECTION record. */ - void importSheetProtection( RecordInputStream& rStrm ); + void importSheetProtection( SequenceInputStream& rStrm ); /** Imports chart sheet protection settings from the CHARTPROTECTION record. */ - void importChartProtection( RecordInputStream& rStrm ); + void importChartProtection( SequenceInputStream& rStrm ); /** Imports phonetic settings from the PHONETICPR record. */ - void importPhoneticPr( RecordInputStream& rStrm ); + 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. */ @@ -140,4 +142,3 @@ private: } // namespace oox #endif - |