diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-08-26 18:37:44 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-08-26 18:37:44 +0200 |
commit | 04c272eb8396e58376d2b61baee01c4a95f993b4 (patch) | |
tree | 489606116a897ec3c0186161269670b0e8c66146 /oox/inc/oox | |
parent | 4d9f54e9f020c91c7fda048bcf3f7549d58bc2b4 (diff) |
dr77: #i114128# import legacy drawing controls
Diffstat (limited to 'oox/inc/oox')
50 files changed, 867 insertions, 222 deletions
diff --git a/oox/inc/oox/core/binarycodec.hxx b/oox/inc/oox/core/binarycodec.hxx index 8abafffa2481..1e9dba07c388 100644 --- a/oox/inc/oox/core/binarycodec.hxx +++ b/oox/inc/oox/core/binarycodec.hxx @@ -289,4 +289,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/binaryfilterbase.hxx b/oox/inc/oox/core/binaryfilterbase.hxx index bf249cdfab9b..f1cc7b399bce 100644 --- a/oox/inc/oox/core/binaryfilterbase.hxx +++ b/oox/inc/oox/core/binaryfilterbase.hxx @@ -59,4 +59,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..c5c198c34c23 100644 --- a/oox/inc/oox/core/contexthandler.hxx +++ b/oox/inc/oox/core/contexthandler.hxx @@ -29,9 +29,9 @@ #define OOX_CORE_CONTEXTHANDLER_HXX #include <boost/shared_ptr.hpp> -#include <rtl/ref.hxx> -#include <cppuhelper/implbase1.hxx> #include <com/sun/star/xml/sax/XFastContextHandler.hpp> +#include <cppuhelper/implbase1.hxx> +#include <rtl/ref.hxx> namespace com { namespace sun { namespace star { namespace xml { namespace sax { class XLocator; } } @@ -114,4 +114,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/contexthandler2.hxx b/oox/inc/oox/core/contexthandler2.hxx index 48f11c962e38..61c4ad9aa2da 100644 --- a/oox/inc/oox/core/contexthandler2.hxx +++ b/oox/inc/oox/core/contexthandler2.hxx @@ -41,28 +41,30 @@ namespace core { // ============================================================================ -struct ContextInfo; +struct ElementInfo; -/** Helper class that provides a context identifier stack. +/** 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 +73,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 void onEndElement() = 0; + + /** Will be called to create a context handler for the passed record. + + Usually 'this' can be returned to improve performance by reusing the + same instance to process several records. Used by OOBIN import only. */ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ) = 0; - /** Will be called if a new record in a binary stream has been started. + /** 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 OOBIN import only. */ virtual void onStartRecord( RecordInputStream& rStrm ) = 0; - /** Will be called if the current context record is about to be left. + /** Will be called when the current record block is about to be left. - 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 OOBIN 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 +176,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,7 +184,7 @@ 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 ); @@ -177,15 +198,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 +223,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 @@ -237,7 +256,8 @@ public: 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 ); @@ -250,4 +270,3 @@ public: } // namespace oox #endif - diff --git a/oox/inc/oox/core/fasttokenhandler.hxx b/oox/inc/oox/core/fasttokenhandler.hxx index 84baccabdc67..01422aebc3ea 100644 --- a/oox/inc/oox/core/fasttokenhandler.hxx +++ b/oox/inc/oox/core/fasttokenhandler.hxx @@ -62,4 +62,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx index 1757b2be4334..0371768d02a7 100644 --- a/oox/inc/oox/core/filterbase.hxx +++ b/oox/inc/oox/core/filterbase.hxx @@ -29,14 +29,14 @@ #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/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" @@ -44,16 +44,16 @@ #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 XMultiServiceFactory; } + namespace task { class XInteractionHandler; } + namespace task { class XStatusIndicator; } } } } namespace comphelper { @@ -68,6 +68,7 @@ namespace oox { namespace oox { namespace ole { class OleObjectHelper; + class VbaProject; } } namespace oox { @@ -194,6 +195,9 @@ 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 a password from the media descriptor or from the user. On success, the password will be inserted into the media descriptor. */ ::rtl::OUString requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const; @@ -271,6 +275,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( @@ -288,4 +295,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/core/filterdetect.hxx b/oox/inc/oox/core/filterdetect.hxx index 76e46050c24a..70c35ff26076 100644 --- a/oox/inc/oox/core/filterdetect.hxx +++ b/oox/inc/oox/core/filterdetect.hxx @@ -163,4 +163,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..2473b9e91436 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 @@ -94,7 +92,8 @@ public: 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 ); @@ -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 4ca8ca3899e7..6abb48c361a0 100644 --- a/oox/inc/oox/core/relations.hxx +++ b/oox/inc/oox/core/relations.hxx @@ -35,6 +35,8 @@ namespace oox { namespace core { +// ============================================================================ + /** Expands to an OUString containing an officeDocument relation type created from the passed literal(!) ASCII(!) character array. */ #define CREATE_OFFICEDOC_RELATIONSTYPE( ascii ) \ @@ -99,4 +101,3 @@ private: } // namespace oox #endif // OOX_CORE_RELATIONS - diff --git a/oox/inc/oox/core/relationshandler.hxx b/oox/inc/oox/core/relationshandler.hxx index 3211888ecc9f..b2da8d59c39f 100644 --- a/oox/inc/oox/core/relationshandler.hxx +++ b/oox/inc/oox/core/relationshandler.hxx @@ -58,4 +58,3 @@ private: } // namespace oox #endif // OOX_CORE_RELATIONSHANDLER - diff --git a/oox/inc/oox/core/xmlfilterbase.hxx b/oox/inc/oox/core/xmlfilterbase.hxx index 30efeb0e9440..796cd82781c0 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; @@ -222,4 +226,3 @@ typedef ::rtl::Reference< XmlFilterBase > XmlFilterRef; } // namespace oox #endif - diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx index e43dc176c297..3ff545cda295 100644 --- a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx +++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx @@ -101,7 +101,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 > diff --git a/oox/inc/oox/drawingml/chart/datasourcecontext.hxx b/oox/inc/oox/drawingml/chart/datasourcecontext.hxx index e5183e64caa4..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. diff --git a/oox/inc/oox/drawingml/chart/seriescontext.hxx b/oox/inc/oox/drawingml/chart/seriescontext.hxx index 100e7755cdca..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 ); }; // ============================================================================ diff --git a/oox/inc/oox/drawingml/chart/titlecontext.hxx b/oox/inc/oox/drawingml/chart/titlecontext.hxx index e3d274c1744b..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 ); }; // ============================================================================ 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/helper/attributelist.hxx b/oox/inc/oox/helper/attributelist.hxx index ad746771cab8..f2919e889994 100644 --- a/oox/inc/oox/helper/attributelist.hxx +++ b/oox/inc/oox/helper/attributelist.hxx @@ -43,6 +43,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 ); diff --git a/oox/inc/oox/ole/axbinaryreader.hxx b/oox/inc/oox/ole/axbinaryreader.hxx index e3f102716e17..9b3cfae723b8 100755 --- a/oox/inc/oox/ole/axbinaryreader.hxx +++ b/oox/inc/oox/ole/axbinaryreader.hxx @@ -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(); diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx index 8638a4869d72..8bc9cd622b2b 100644 --- a/oox/inc/oox/ole/axcontrol.hxx +++ b/oox/inc/oox/ole/axcontrol.hxx @@ -58,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}"; @@ -79,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; @@ -98,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. */ @@ -109,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, @@ -182,6 +228,11 @@ 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, @@ -289,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. }; @@ -410,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. }; @@ -430,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. }; @@ -454,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. @@ -462,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). }; // ============================================================================ @@ -504,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. @@ -524,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). }; // ============================================================================ @@ -579,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 { @@ -615,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. @@ -641,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. @@ -705,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). @@ -790,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; @@ -811,10 +894,30 @@ 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( @@ -823,20 +926,22 @@ public: 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/olehelper.hxx b/oox/inc/oox/ole/olehelper.hxx index ba46d3baf6df..f19efa835f4e 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). */ diff --git a/oox/inc/oox/ole/vbahelper.hxx b/oox/inc/oox/ole/vbahelper.hxx index 76dc1c736025..a62a6bd06765 100755 --- a/oox/inc/oox/ole/vbahelper.hxx +++ b/oox/inc/oox/ole/vbahelper.hxx @@ -59,6 +59,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/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx index cb4562a2b7c5..6834fa08f252 100755 --- a/oox/inc/oox/ole/vbaproject.hxx +++ b/oox/inc/oox/ole/vbaproject.hxx @@ -37,8 +37,9 @@ namespace com { namespace sun { namespace star { namespace container { class XNameContainer; } namespace document { class XEventsSupplier; } namespace frame { class XModel; } - namespace script { class XLibraryContainer; } namespace lang { class XMultiServiceFactory; } + namespace script { class XLibraryContainer; } + namespace script { namespace vba { class XVBAMacroResolver; } } } } } namespace oox { class GraphicHelper; } @@ -70,6 +71,47 @@ 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: @@ -88,6 +130,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. */ @@ -254,8 +300,10 @@ protected: imported. */ void addDummyModule( const ::rtl::OUString& rName, sal_Int32 nType ); - /** Called when the import process of the VBA code modules starts. */ - virtual void prepareModuleImport(); + /** Called when the import process of the VBA project has been started. */ + virtual void prepareImport(); + /** Called when the import process of the VBA project is finished. */ + virtual void finalizeImport(); private: VbaProject( const VbaProject& ); @@ -280,11 +328,15 @@ private: 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 ::std::map< ::rtl::OUString, sal_Int32 > DummyModuleMap; + 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. @@ -294,8 +346,9 @@ private: 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/ppt/pptimport.hxx b/oox/inc/oox/ppt/pptimport.hxx index c4ee29447c64..cb87d07329e3 100644 --- a/oox/inc/oox/ppt/pptimport.hxx +++ b/oox/inc/oox/ppt/pptimport.hxx @@ -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 31156a56ee84..e8c5d21448ce 100644 --- a/oox/inc/oox/ppt/slidepersist.hxx +++ b/oox/inc/oox/ppt/slidepersist.hxx @@ -111,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/vml/vmldrawing.hxx b/oox/inc/oox/vml/vmldrawing.hxx index 7bbeaef2f50d..0d87dae3138b 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 passed container. 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. diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx index b496fed6d2e0..934be61e5a65 100644 --- a/oox/inc/oox/vml/vmlformatting.hxx +++ b/oox/inc/oox/vml/vmlformatting.hxx @@ -34,6 +34,7 @@ namespace oox { class GraphicHelper; class ModelObjectHelper; class PropertyMap; + namespace drawingml { class Color; } } namespace oox { @@ -112,6 +113,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(); diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx index 76599a787306..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. */ diff --git a/oox/inc/oox/vml/vmlshapecontainer.hxx b/oox/inc/oox/vml/vmlshapecontainer.hxx index d4f9ec7e7f8e..e1df24a9a6f8 100644 --- a/oox/inc/oox/vml/vmlshapecontainer.hxx +++ b/oox/inc/oox/vml/vmlshapecontainer.hxx @@ -59,6 +59,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. */ diff --git a/oox/inc/oox/vml/vmlshapecontext.hxx b/oox/inc/oox/vml/vmlshapecontext.hxx index 92253e461227..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 ); 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/autofiltercontext.hxx b/oox/inc/oox/xls/autofiltercontext.hxx index ccef6972e871..83b1f4ff0ee8 100644 --- a/oox/inc/oox/xls/autofiltercontext.hxx +++ b/oox/inc/oox/xls/autofiltercontext.hxx @@ -85,7 +85,7 @@ protected: 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 onEndElement(); private: /** Initializes data members to prepare for autofilter parsing. Call this diff --git a/oox/inc/oox/xls/chartsheetfragment.hxx b/oox/inc/oox/xls/chartsheetfragment.hxx index dc8e0f85fd13..58a6fdb5b54a 100644 --- a/oox/inc/oox/xls/chartsheetfragment.hxx +++ b/oox/inc/oox/xls/chartsheetfragment.hxx @@ -48,7 +48,7 @@ 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 ); diff --git a/oox/inc/oox/xls/commentsfragment.hxx b/oox/inc/oox/xls/commentsfragment.hxx index 584c6a2bb340..97788d635c15 100644 --- a/oox/inc/oox/xls/commentsfragment.hxx +++ b/oox/inc/oox/xls/commentsfragment.hxx @@ -46,7 +46,8 @@ 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 void onEndRecord(); diff --git a/oox/inc/oox/xls/condformatcontext.hxx b/oox/inc/oox/xls/condformatcontext.hxx index 799e3127b7a3..492c1db1beb7 100644 --- a/oox/inc/oox/xls/condformatcontext.hxx +++ b/oox/inc/oox/xls/condformatcontext.hxx @@ -46,7 +46,7 @@ protected: 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 ); diff --git a/oox/inc/oox/xls/defnamesbuffer.hxx b/oox/inc/oox/xls/defnamesbuffer.hxx index 45208f0ac344..fa9715022c9f 100644 --- a/oox/inc/oox/xls/defnamesbuffer.hxx +++ b/oox/inc/oox/xls/defnamesbuffer.hxx @@ -138,6 +138,8 @@ public: inline bool isBuiltinName() const { return mcBuiltinId != OOX_DEFNAME_UNKNOWN; } /** Returns true, if this defined name is a macro function call. */ inline bool isMacroFunction() const { return maModel.mbMacro && maModel.mbFunction; } + /** Returns true, if this defined name is a reference to a VBA macro. */ + inline bool isVBName() const { return maModel.mbMacro && maModel.mbVBName; } /** Returns true, if this defined name is global in the document. */ inline bool isGlobalName() const { return mnCalcSheet < 0; } @@ -218,4 +220,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/drawingfragment.hxx b/oox/inc/oox/xls/drawingfragment.hxx index 95973e55c655..0b4dba0bbd53 100644 --- a/oox/inc/oox/xls/drawingfragment.hxx +++ b/oox/inc/oox/xls/drawingfragment.hxx @@ -31,15 +31,25 @@ #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/excelhandlers.hxx" +namespace oox { namespace ole { + struct AxFontData; + class AxMorphDataModelBase; +} } + namespace oox { namespace xls { // ============================================================================ +// DrawingML +// ============================================================================ /** Absolute position in spreadsheet (in EMUs) independent from cells. */ struct AnchorPosModel : public ::oox::drawingml::EmuPoint @@ -101,6 +111,7 @@ public: void importClientData( const AttributeList& rAttribs ); /** Sets an attribute of the cell-dependent anchor position from xdr:from and xdr:to elements. */ void setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue ); + /** Imports and converts the VML specific client anchor. */ void importVmlAnchor( const ::rtl::OUString& rAnchor ); /** Returns true, if the anchor contains valid position and size settings. */ @@ -132,6 +143,67 @@ typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef; // ============================================================================ +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 OoxGroupShapeContext : public ::oox::drawingml::ShapeGroupContext, public WorksheetHelper +{ +public: + explicit OoxGroupShapeContext( + ::oox::core::ContextHandler& rParent, + const WorksheetHelper& rHelper, + const ::oox::drawingml::ShapePtr& rxShape ); + + static ::oox::core::ContextHandlerRef + createShapeContext( + ::oox::core::ContextHandler& rParent, + const WorksheetHelper& rHelper, + sal_Int32 nElement, + const AttributeList& rAttribs, + ::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 { @@ -144,7 +216,8 @@ 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: ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > @@ -156,6 +229,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 { @@ -168,24 +262,47 @@ 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; }; // ============================================================================ @@ -207,4 +324,3 @@ protected: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx index b5d7a97f33b5..0b293cf57193 100644 --- a/oox/inc/oox/xls/excelfilter.hxx +++ b/oox/inc/oox/xls/excelfilter.hxx @@ -72,6 +72,7 @@ public: private: virtual GraphicHelper* implCreateGraphicHelper() const; + virtual ::oox::ole::VbaProject* implCreateVbaProject() const; virtual ::rtl::OUString implGetImplementationName() const; }; @@ -89,6 +90,7 @@ public: private: virtual GraphicHelper* implCreateGraphicHelper() const; + virtual ::oox::ole::VbaProject* implCreateVbaProject() const; virtual ::rtl::OUString implGetImplementationName() const; }; @@ -98,4 +100,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/excelvbaproject.hxx b/oox/inc/oox/xls/excelvbaproject.hxx index 9726cbdc923c..f2a9aebd988a 100755 --- a/oox/inc/oox/xls/excelvbaproject.hxx +++ b/oox/inc/oox/xls/excelvbaproject.hxx @@ -41,10 +41,10 @@ namespace xls { // ============================================================================ /** Special implementation of the VBA project for the Excel filters. */ -class OOX_DLLPUBLIC VbaProject : public ::oox::ole::VbaProject +class OOX_DLLPUBLIC ExcelVbaProject : public ::oox::ole::VbaProject { public: - explicit VbaProject( + explicit ExcelVbaProject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory, const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& rxDocument ); @@ -53,7 +53,9 @@ public: protected: /** Adds dummy modules for sheets without imported code name. */ - virtual void prepareModuleImport(); + virtual void prepareImport(); + /** Attaches document and sheet events to macros. */ + virtual void finalizeImport(); private: /** Attaches VBA macros to all supported document events. */ diff --git a/oox/inc/oox/xls/externallinkbuffer.hxx b/oox/inc/oox/xls/externallinkbuffer.hxx index b9980cc21e2f..7a4cf26fecb2 100644 --- a/oox/inc/oox/xls/externallinkbuffer.hxx +++ b/oox/inc/oox/xls/externallinkbuffer.hxx @@ -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. */ @@ -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,6 +389,7 @@ 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. @@ -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..c651f4f2f0a5 100644 --- a/oox/inc/oox/xls/externallinkfragment.hxx +++ b/oox/inc/oox/xls/externallinkfragment.hxx @@ -54,7 +54,7 @@ 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 ); @@ -97,7 +97,8 @@ 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 ); diff --git a/oox/inc/oox/xls/formulaparser.hxx b/oox/inc/oox/xls/formulaparser.hxx index 0227e8efee6d..599a8af7bf46 100644 --- a/oox/inc/oox/xls/formulaparser.hxx +++ b/oox/inc/oox/xls/formulaparser.hxx @@ -157,6 +157,9 @@ public: 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; }; @@ -167,4 +170,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/richstringcontext.hxx b/oox/inc/oox/xls/richstringcontext.hxx index 53882641df7e..7b5992db2871 100644 --- a/oox/inc/oox/xls/richstringcontext.hxx +++ b/oox/inc/oox/xls/richstringcontext.hxx @@ -46,7 +46,7 @@ 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. diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx index a77f4b285fa4..7fd7c9b915b5 100644 --- a/oox/inc/oox/xls/sheetdatacontext.hxx +++ b/oox/inc/oox/xls/sheetdatacontext.hxx @@ -54,7 +54,8 @@ 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 ); diff --git a/oox/inc/oox/xls/workbookfragment.hxx b/oox/inc/oox/xls/workbookfragment.hxx index f9f0bb25c78f..b499704e62cb 100644 --- a/oox/inc/oox/xls/workbookfragment.hxx +++ b/oox/inc/oox/xls/workbookfragment.hxx @@ -49,7 +49,7 @@ 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 ); diff --git a/oox/inc/oox/xls/worksheetfragment.hxx b/oox/inc/oox/xls/worksheetfragment.hxx index 7234153d7dd3..6b3b5357bb44 100644 --- a/oox/inc/oox/xls/worksheetfragment.hxx +++ b/oox/inc/oox/xls/worksheetfragment.hxx @@ -44,7 +44,8 @@ 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 ); @@ -74,7 +75,7 @@ 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 ); |