diff options
Diffstat (limited to 'oox')
57 files changed, 2123 insertions, 695 deletions
diff --git a/oox/inc/oox/drawingml/chart/chartconverter.hxx b/oox/inc/oox/drawingml/chart/chartconverter.hxx index d45a5c95c388..f9d10388ce13 100644 --- a/oox/inc/oox/drawingml/chart/chartconverter.hxx +++ b/oox/inc/oox/drawingml/chart/chartconverter.hxx @@ -32,14 +32,15 @@ #include <oox/dllapi.h> namespace com { namespace sun { namespace star { + namespace awt { struct Point; } + namespace awt { struct Size; } + namespace drawing { class XShapes; } namespace chart2 { class XChartDocument; } namespace chart2 { namespace data { class XDataProvider; } } namespace chart2 { namespace data { class XDataSequence; } } } } } -namespace oox { namespace core { - class XmlFilterBase; -} } +namespace oox { namespace core { class XmlFilterBase; } } namespace oox { namespace drawingml { @@ -56,11 +57,32 @@ public: explicit ChartConverter(); virtual ~ChartConverter(); - /** Converts the passed OOXML chart model to the passed chart2 document. */ + /** Converts the passed OOXML chart model to the passed chart2 document. + + @param rChartModel The filled MSOOXML chart model structure. + + @param rxChartDoc The UNO chart document model to be initialized. + + @param rxExternalPage If null, all embedded shapes will be inserted + into the internal drawing page of the chart document. If not null, + all embedded shapes will be inserted into this shapes collection. + + @param rChartPos The position of the chart shape in its drawing page, + in 1/100 mm. Will be used only, if parameter rxExternalPage is not + null, for correct positioning of the embedded shapes in the + external drawing page. + + @param rChartSize The size of the chart shape in 1/100 mm. Needed for + calculation of position and size of the chart elements (diagram, + titles, legend, etc.) and embedded shapes. + */ void convertFromModel( ::oox::core::XmlFilterBase& rFilter, - ChartSpaceModel& rModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc ); + ChartSpaceModel& rChartModel, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage, + const ::com::sun::star::awt::Point& rChartPos, + const ::com::sun::star::awt::Size& rChartSize ); /** Creates an internal data provider. Derived classes may override this function to create an external data provider. */ diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx new file mode 100644 index 000000000000..e38311394046 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: chartdrawingfragment.hxx,v $ + * + * $Revision: 1.1 $ + * + * 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_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX +#define OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX + +#include "oox/core/fragmenthandler2.hxx" +#include "oox/drawingml/shape.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +/** Relative shape position in a chart object. */ +struct AnchorPosModel +{ + double mfX; /// X coordinate relative to chart object (0.0 to 1.0). + double mfY; /// Y coordinate relative to chart object (0.0 to 1.0). + + inline explicit AnchorPosModel() : mfX( -1.0 ), mfY( -1.0 ) {} + inline bool isValid() const { return (0.0 <= mfX) && (mfX <= 1.0) && (0.0 <= mfY) && (mfY <= 1.0); } +}; + +// ---------------------------------------------------------------------------- + +/** Absolute shape size in a chart object (in EMUs). */ +struct AnchorSizeModel : public EmuSize +{ + inline explicit AnchorSizeModel() : EmuSize( -1, -1 ) {} + inline bool isValid() const { return (Width >= 0) && (Height >= 0); } +}; + +// ============================================================================ + +/** Contains the position of a shape in the chart object. Supports different + shape anchor modes (absolute, relative). + */ +class ShapeAnchor +{ +public: + explicit ShapeAnchor( bool bRelSize ); + + /** Imports the absolute anchor size from the cdr:ext element. */ + void importExt( const AttributeList& rAttribs ); + /** Sets an the relative anchor position from the cdr:from or cdr:to element. */ + void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue ); + + /** Calculates the resulting shape anchor in EMUs. */ + ::com::sun::star::awt::Rectangle + calcEmuLocation( const EmuRectangle& rEmuChartRect ) const; + +private: + AnchorPosModel maFrom; /// Top-left position relative to chart object. + AnchorPosModel maTo; /// Bottom-right position relative to chart object. + AnchorSizeModel maSize; /// Shape size, if anchor has absolute size. + bool mbRelSize; /// True = relative size, false = absolute size. +}; + +typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef; + +// ============================================================================ + +/** Handler for a chart drawing fragment (c:userShapes root element). + */ +class ChartDrawingFragment : public ::oox::core::FragmentHandler2 +{ +public: + explicit ChartDrawingFragment( + ::oox::core::XmlFilterBase& rFilter, + const ::rtl::OUString& rFragmentPath, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxDrawPage, + const ::com::sun::star::awt::Size& rChartSize, + const ::com::sun::star::awt::Point& rShapesOffset, + bool bOleSupport ); + virtual ~ChartDrawingFragment(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onEndElement( const ::rtl::OUString& rChars ); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > + mxDrawPage; /// Drawing page of this sheet. + ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape. + ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape. + EmuRectangle maEmuChartRect; /// Position and size of the chart object for embedded shapes (in EMUs). + bool mbOleSupport; /// True = allow to insert OLE objects into the drawing page. +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx index edeb24f0022f..b4c40015f825 100644 --- a/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx +++ b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx @@ -30,6 +30,10 @@ #include "oox/drawingml/chart/converterbase.hxx" +namespace com { namespace sun { namespace star { + namespace drawing { class XShapes; } +} } } + namespace oox { namespace drawingml { namespace chart { @@ -45,7 +49,9 @@ public: virtual ~ChartSpaceConverter(); /** Converts the contained OOXML chart model to a chart2 document. */ - void convertFromModel(); + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage, + const ::com::sun::star::awt::Point& rChartPos ); }; // ============================================================================ diff --git a/oox/inc/oox/drawingml/chart/chartspacemodel.hxx b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx index 5955dd9aef51..ddfa57fb919c 100644 --- a/oox/inc/oox/drawingml/chart/chartspacemodel.hxx +++ b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx @@ -57,6 +57,7 @@ struct ChartSpaceModel View3DRef mxView3D; /// 3D settings. TitleRef mxTitle; /// Chart main title. LegendRef mxLegend; /// Chart legend. + ::rtl::OUString maDrawingPath; /// Path to drawing fragment with embedded shapes. sal_Int32 mnDispBlanksAs; /// Mode how to display blank values. sal_Int32 mnStyle; /// Index to default formatting. bool mbAutoTitleDel; /// True = automatic title deleted manually. diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx index 683e1cd8f05d..23f5a5ff9266 100644 --- a/oox/inc/oox/drawingml/chart/converterbase.hxx +++ b/oox/inc/oox/drawingml/chart/converterbase.hxx @@ -32,6 +32,7 @@ #include "oox/drawingml/chart/objectformatter.hxx" namespace com { namespace sun { namespace star { + namespace awt { struct Size; } namespace lang { class XMultiServiceFactory; } namespace chart2 { class XChartDocument; } } } } @@ -57,8 +58,9 @@ public: explicit ConverterRoot( ::oox::core::XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ); + const ::com::sun::star::awt::Size& rChartSize ); virtual ~ConverterRoot(); /** Creates an instance for the passed service name, using the passed service factory. */ @@ -79,6 +81,8 @@ protected: /** Returns the API chart document model. */ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > getChartDocument() const; + /** Returns the position and size of the chart shape in 1/100 mm. */ + const ::com::sun::star::awt::Size& getChartSize() const; /** Returns the object formatter. */ ObjectFormatter& getFormatter() const; diff --git a/oox/inc/oox/drawingml/drawingmltypes.hxx b/oox/inc/oox/drawingml/drawingmltypes.hxx index 37d8804bfb62..ed4367e63857 100644 --- a/oox/inc/oox/drawingml/drawingmltypes.hxx +++ b/oox/inc/oox/drawingml/drawingmltypes.hxx @@ -146,6 +146,37 @@ IndexRange GetIndexRange( const ::com::sun::star::uno::Reference< ::com::sun::st // ============================================================================ +struct EmuPoint +{ + sal_Int64 X; + sal_Int64 Y; + + inline explicit EmuPoint() : X( 0 ), Y( 0 ) {} + inline explicit EmuPoint( sal_Int64 nX, sal_Int64 nY ) : X( nX ), Y( nY ) {} +}; + +// ============================================================================ + +struct EmuSize +{ + sal_Int64 Width; + sal_Int64 Height; + + inline explicit EmuSize() : Width( 0 ), Height( 0 ) {} + inline explicit EmuSize( sal_Int64 nWidth, sal_Int64 nHeight ) : Width( nWidth ), Height( nHeight ) {} +}; + +// ============================================================================ + +struct EmuRectangle : public EmuPoint, public EmuSize +{ + inline explicit EmuRectangle() {} + inline explicit EmuRectangle( const EmuPoint& rPos, const EmuSize& rSize ) : EmuPoint( rPos ), EmuSize( rSize ) {} + inline explicit EmuRectangle( sal_Int64 nX, sal_Int64 nY, sal_Int64 nWidth, sal_Int64 nHeight ) : EmuPoint( nX, nY ), EmuSize( nWidth, nHeight ) {} +}; + +// ============================================================================ + } // namespace drawingml } // namespace oox diff --git a/oox/inc/oox/drawingml/graphicshapecontext.hxx b/oox/inc/oox/drawingml/graphicshapecontext.hxx index 0452ed30e895..d515a4553936 100644 --- a/oox/inc/oox/drawingml/graphicshapecontext.hxx +++ b/oox/inc/oox/drawingml/graphicshapecontext.hxx @@ -50,10 +50,12 @@ public: class GraphicalObjectFrameContext : public ShapeContext { public: - GraphicalObjectFrameContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr ); + GraphicalObjectFrameContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart ); virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); +private: + bool mbEmbedShapesInChart; }; // ==================================================================== @@ -95,13 +97,16 @@ class ChartGraphicDataContext : public ShapeContext public: explicit ChartGraphicDataContext( ::oox::core::ContextHandler& rParent, - const ShapePtr& rxShape ); + const ShapePtr& rxShape, bool bEmbedShapes ); virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + bool mbEmbedShapes; }; // ==================================================================== diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx index b6c015f73938..94fb6a4f29fc 100644 --- a/oox/inc/oox/drawingml/shape.hxx +++ b/oox/inc/oox/drawingml/shape.hxx @@ -69,7 +69,8 @@ public: const ::com::sun::star::awt::Rectangle& rShapeRect ); virtual void onXShapeCreated( - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape ) const; + 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; } @@ -124,7 +125,8 @@ public: void setId( const rtl::OUString& rId ) { msId = rId; } void setSubType( sal_uInt32 nSubType ) { mnSubType = nSubType; } sal_Int32 getSubType() const { return mnSubType; } - void setIndex( sal_uInt32 nIndex ) { mnIndex = nIndex; } + void setSubTypeIndex( sal_uInt32 nSubTypeIndex ) { mnSubTypeIndex = nSubTypeIndex; } + sal_Int32 getSubTypeIndex() const { return mnSubTypeIndex; } // setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value) void setDefaults(); @@ -143,7 +145,7 @@ public: // addShape is creating and inserting the corresponding XShape. void addShape( const oox::core::XmlFilterBase& rFilterBase, - const ThemePtr& rxTheme, + const Theme* pTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, const ::com::sun::star::awt::Rectangle* pShapeRect = 0, ShapeIdMap* pShapeMap = 0 ); @@ -161,7 +163,7 @@ protected: createAndInsert( const ::oox::core::XmlFilterBase& rFilterBase, const ::rtl::OUString& rServiceName, - const ThemePtr& rxTheme, + const Theme* pTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, const ::com::sun::star::awt::Rectangle* pShapeRect, sal_Bool bClearText ); @@ -169,7 +171,7 @@ protected: void addChildren( const ::oox::core::XmlFilterBase& rFilterBase, Shape& rMaster, - const ThemePtr& rxTheme, + const Theme* pTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, const ::com::sun::star::awt::Rectangle& rClientRect, ShapeIdMap* pShapeMap ); @@ -185,11 +187,11 @@ protected: TextListStylePtr mpMasterTextListStyle; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape; - rtl::OUString msServiceName; - rtl::OUString msName; - rtl::OUString msId; - sal_uInt32 mnSubType; // if this type is not zero, then the shape is a placeholder - sal_uInt32 mnIndex; + rtl::OUString msServiceName; + rtl::OUString msName; + rtl::OUString msId; + sal_uInt32 mnSubType; // if this type is not zero, then the shape is a placeholder + sal_uInt32 mnSubTypeIndex; ShapeStyleRefMap maShapeStyleRefs; diff --git a/oox/inc/oox/drawingml/textbodyproperties.hxx b/oox/inc/oox/drawingml/textbodyproperties.hxx index 7b17c561e286..6688eea7746c 100644 --- a/oox/inc/oox/drawingml/textbodyproperties.hxx +++ b/oox/inc/oox/drawingml/textbodyproperties.hxx @@ -41,6 +41,10 @@ struct TextBodyProperties PropertyMap maPropertyMap; OptValue< sal_Int32 > moRotation; OptValue< sal_Int32 > moVert; + + explicit TextBodyProperties(); + + void pushToPropMap( PropertyMap& rPropMap ) const; }; // ============================================================================ diff --git a/oox/inc/oox/drawingml/textparagraph.hxx b/oox/inc/oox/drawingml/textparagraph.hxx index e98232477f3b..d8c97cbfa114 100644 --- a/oox/inc/oox/drawingml/textparagraph.hxx +++ b/oox/inc/oox/drawingml/textparagraph.hxx @@ -54,8 +54,8 @@ public: inline TextParagraphProperties& getProperties() { return maProperties; } inline const TextParagraphProperties& getProperties() const { return maProperties; } - inline TextParagraphProperties& getEndProperties() { return maEndProperties; } - inline const TextParagraphProperties& getEndProperties() const { return maEndProperties; } + inline TextCharacterProperties& getEndProperties() { return maEndProperties; } + inline const TextCharacterProperties& getEndProperties() const { return maEndProperties; } //inline void setProperties( TextParagraphPropertiesPtr pProps ) { mpProperties = pProps; } @@ -69,7 +69,7 @@ public: private: TextParagraphProperties maProperties; - TextParagraphProperties maEndProperties; + TextCharacterProperties maEndProperties; TextRunVector maRuns; }; diff --git a/oox/inc/oox/dump/dffdumper.hxx b/oox/inc/oox/dump/dffdumper.hxx index 7a4177cfc104..f229c19eff8c 100644 --- a/oox/inc/oox/dump/dffdumper.hxx +++ b/oox/inc/oox/dump/dffdumper.hxx @@ -59,10 +59,15 @@ protected: private: void constructDffObj(); + sal_uInt32 dumpDffSimpleColor( const String& rName ); + sal_uInt32 dumpDffColor( const String& rName ); + + void dumpDffOpt(); sal_uInt16 dumpDffOptPropHeader(); - void dumpDffOptPropValue( sal_uInt16 nPropId, sal_uInt32 nValue ); private: + ItemFormatMap maSimpleProps; + ItemFormatMap maComplexProps; sal_uInt16 mnInstVer; sal_Int32 mnRealSize; }; diff --git a/oox/inc/oox/dump/dumperbase.hxx b/oox/inc/oox/dump/dumperbase.hxx index b7a46ca71da7..ecca5751c16c 100644 --- a/oox/inc/oox/dump/dumperbase.hxx +++ b/oox/inc/oox/dump/dumperbase.hxx @@ -101,6 +101,9 @@ const sal_Unicode OOX_DUMP_EMPTYVALUE = '~'; const sal_Unicode OOX_DUMP_CMDPROMPT = '?'; const sal_Unicode OOX_DUMP_PLACEHOLDER = '\x01'; +typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > OUStringPair; +typedef ::std::pair< sal_Int64, sal_Int64 > Int64Pair; + typedef ::std::vector< ::rtl::OUString > OUStringVector; typedef ::std::vector< sal_Int64 > Int64Vector; @@ -406,6 +409,7 @@ public: // string conversion ------------------------------------------------------ static ::rtl::OUString trimSpaces( const ::rtl::OUString& rStr ); + static ::rtl::OUString trimTrailingNul( const ::rtl::OUString& rStr ); static ::rtl::OString convertToUtf8( const ::rtl::OUString& rStr ); static DataType convertToDataType( const ::rtl::OUString& rStr ); @@ -418,6 +422,8 @@ public: static bool convertStringToDouble( double& orfData, const ::rtl::OUString& rData ); static bool convertStringToBool( const ::rtl::OUString& rData ); + static OUStringPair convertStringToPair( const ::rtl::OUString& rString, sal_Unicode cSep = '=' ); + // string to list conversion ---------------------------------------------- static void convertStringToStringList( OUStringVector& orVec, const ::rtl::OUString& rData, bool bIgnoreEmpty ); @@ -764,10 +770,10 @@ class FlagsList : public NameListBase public: explicit FlagsList( const SharedConfigData& rCfgData ); + /** Returns the flags to be ignored on output. */ + inline sal_Int64 getIgnoreFlags() const { return mnIgnore; } /** Sets flags to be ignored on output. */ - template< typename Type > - inline void setIgnoreFlags( Type nIgnore ) - { mnIgnore = static_cast< sal_Int64 >( nIgnore ); } + inline void setIgnoreFlags( sal_Int64 nIgnore ) { mnIgnore = nIgnore; } protected: virtual void implProcessConfigItemStr( @@ -804,12 +810,20 @@ protected: virtual void implIncludeList( const NameListBase& rList ); private: + struct ExtItemFormatKey + { + sal_Int64 mnKey; + Int64Pair maFilter; + inline explicit ExtItemFormatKey( sal_Int64 nKey ) : mnKey( nKey ), maFilter( 0, 0 ) {} + bool operator<( const ExtItemFormatKey& rRight ) const; + + }; struct ExtItemFormat : public ItemFormat { bool mbShiftValue; inline explicit ExtItemFormat() : mbShiftValue( true ) {} }; - typedef ::std::map< sal_Int64, ExtItemFormat > ExtItemFormatMap; + typedef ::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap; ExtItemFormatMap maFmtMap; }; @@ -859,6 +873,17 @@ private: static const NameListWrapper NO_LIST; // ============================================================================ + +class ItemFormatMap : public ::std::map< sal_Int64, ItemFormat > +{ +public: + inline explicit ItemFormatMap() {} + inline explicit ItemFormatMap( const NameListRef& rxNameList ) { insertFormats( rxNameList ); } + + void insertFormats( const NameListRef& rxNameList ); +}; + +// ============================================================================ // ============================================================================ class SharedConfigData : public Base, public ConfigItemBase @@ -1582,8 +1607,8 @@ protected: sal_Unicode dumpChar( const String& rName, rtl_TextEncoding eTextEnc ); sal_Unicode dumpUnicode( const String& rName ); - ::rtl::OUString dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc ); - ::rtl::OUString dumpUnicodeArray( const String& rName, sal_Int32 nLen ); + ::rtl::OUString dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul = false ); + ::rtl::OUString dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul = false ); ::rtl::OUString dumpNullCharArray( const String& rName, rtl_TextEncoding eTextEnc ); ::rtl::OUString dumpNullUnicodeArray( const String& rName ); diff --git a/oox/inc/oox/ppt/pptshape.hxx b/oox/inc/oox/ppt/pptshape.hxx index 032e38d1dbbd..59f1beb39677 100644 --- a/oox/inc/oox/ppt/pptshape.hxx +++ b/oox/inc/oox/ppt/pptshape.hxx @@ -50,7 +50,7 @@ public: void addShape( const oox::core::XmlFilterBase& rFilterBase, const SlidePersist& rPersist, - const oox::drawingml::ThemePtr& rxTheme, + const oox::drawingml::Theme* pTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, const com::sun::star::awt::Rectangle* pShapeRect = 0, ::oox::drawingml::ShapeIdMap* pShapeMap = 0 ); diff --git a/oox/inc/oox/xls/drawingfragment.hxx b/oox/inc/oox/xls/drawingfragment.hxx index a75baf41149a..22fddd373a86 100644 --- a/oox/inc/oox/xls/drawingfragment.hxx +++ b/oox/inc/oox/xls/drawingfragment.hxx @@ -41,25 +41,19 @@ namespace xls { // ============================================================================ /** Absolute position in spreadsheet (in EMUs) independent from cells. */ -struct AnchorPosModel +struct AnchorPosModel : public ::oox::drawingml::EmuPoint { - sal_Int64 mnX; /// Absolute X coordinate (EMUs). - sal_Int64 mnY; /// Absolute Y coordinate (EMUs). - - explicit AnchorPosModel(); - inline bool isValid() const { return (mnX >= 0) && (mnY >= 0); } + inline explicit AnchorPosModel() : ::oox::drawingml::EmuPoint( -1, -1 ) {} + inline bool isValid() const { return (X >= 0) && (Y >= 0); } }; // ---------------------------------------------------------------------------- /** Absolute size in spreadsheet (in EMUs). */ -struct AnchorSizeModel +struct AnchorSizeModel : public ::oox::drawingml::EmuSize { - sal_Int64 mnWidth; /// Total width (EMUs). - sal_Int64 mnHeight; /// Total height (EMUs). - - explicit AnchorSizeModel(); - inline bool isValid() const { return (mnWidth >= 0) && (mnHeight >= 0); } + inline explicit AnchorSizeModel() : ::oox::drawingml::EmuSize( -1, -1 ) {} + inline bool isValid() const { return (Width >= 0) && (Height >= 0); } }; // ---------------------------------------------------------------------------- diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx index 8af5127143de..7eb00d4bd57d 100644 --- a/oox/inc/oox/xls/stylesbuffer.hxx +++ b/oox/inc/oox/xls/stylesbuffer.hxx @@ -509,8 +509,13 @@ struct ApiBorderData bool mbDiagUsed; /// True = diagonal line format used. explicit ApiBorderData(); + + /** Returns true, if any of the outer border lines is visible. */ + bool hasAnyOuterBorder() const; }; +bool operator==( const ApiBorderData& rLeft, const ApiBorderData& rRight ); + // ============================================================================ class Border : public WorkbookHelper @@ -544,6 +549,11 @@ public: /** Final processing after import of all style settings. */ void finalizeImport(); + /** Returns the border model structure. */ + inline const BorderModel& getModel() const { return maModel; } + /** Returns the converted API border data struct. */ + inline const ApiBorderData& getApiData() const { return maApiData; } + /** Writes all border attributes to the passed property map. */ void writeToPropertyMap( PropertyMap& rPropMap ) const; @@ -619,6 +629,8 @@ struct ApiSolidFillData explicit ApiSolidFillData(); }; +bool operator==( const ApiSolidFillData& rLeft, const ApiSolidFillData& rRight ); + // ============================================================================ /** Contains cell fill attributes, either a pattern fill or a gradient fill. */ @@ -665,6 +677,13 @@ public: /** Final processing after import of all style settings. */ void finalizeImport(); + /** Returns the fill pattern model structure, if extant. */ + inline const PatternFillModel* getPatternModel() const { return mxPatternModel.get(); } + /** Returns the fill gradient model structure, if extant. */ + inline const GradientFillModel* getGradientModel() const { return mxGradientModel.get(); } + /** Returns the converted API fill data struct. */ + inline const ApiSolidFillData& getApiData() const { return maApiData; } + /** Writes all fill attributes to the passed property map. */ void writeToPropertyMap( PropertyMap& rPropMap ) const; @@ -734,6 +753,9 @@ public: /** Final processing after import of all style settings. */ void finalizeImport(); + /** Returns true, if the XF is a cell XF, and false, if it is a style XF. */ + inline bool isCellXf() const { return maModel.mbCellXf; } + /** Returns the referred font object. */ FontRef getFont() const; /** Returns the alignment data of this style. */ @@ -751,13 +773,13 @@ public: private: /** Sets 'attribute used' flags from the passed BIFF bit field. */ void setBiffUsedFlags( sal_uInt8 nUsedFlags ); - /** Updates own used flags from the passed cell style XF. */ - void updateUsedFlags( const Xf& rStyleXf ); private: XfModel maModel; /// Cell XF or style XF model data. Alignment maAlignment; /// Cell alignment data. Protection maProtection; /// Cell protection data. + ::com::sun::star::table::CellVertJustify + meRotationRef; /// Rotation reference dependent on border. }; typedef ::boost::shared_ptr< Xf > XfRef; @@ -964,6 +986,8 @@ public: sal_Int32 getPaletteColor( sal_Int32 nIndex ) const; /** Returns the specified font object. */ FontRef getFont( sal_Int32 nFontId ) const; + /** Returns the specified border object. */ + BorderRef getBorder( sal_Int32 nBorderId ) const; /** Returns the specified cell format object. */ XfRef getCellXf( sal_Int32 nXfId ) const; /** Returns the specified style format object. */ @@ -978,6 +1002,11 @@ public: /** Returns the model of the default application font (used in the "Normal" cell style). */ const FontModel& getDefaultFontModel() const; + /** Returns true, if the specified borders are equal. */ + bool equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) const; + /** Returns true, if the specified fills are equal. */ + bool equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 ) const; + /** Returns the default style sheet for unused cells. */ ::rtl::OUString getDefaultStyleName() const; /** Creates the style sheet described by the style XF with the passed identifier. */ diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx index 6fa79c629dbc..90c0f33c3c50 100644 --- a/oox/inc/oox/xls/workbookhelper.hxx +++ b/oox/inc/oox/xls/workbookhelper.hxx @@ -302,8 +302,6 @@ public: WorksheetBuffer& getWorksheets() const; /** Returns the office theme object read from the theme substorage. */ ThemeBuffer& getTheme() const; - /** Returns the office theme object reference read from the theme substorage. */ - ::boost::shared_ptr< ::oox::drawingml::Theme > getThemeRef() const; /** Returns all cell formatting objects read from the styles substream. */ StylesBuffer& getStyles() const; /** Returns the shared strings read from the shared strings substream. */ diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 07c31736e9e7..07c31736e9e7 100644..100755 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 9c06caffe0c2..87faadd7a9ce 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -85,13 +85,25 @@ namespace core { // ============================================================================ +namespace { + +bool lclHasSuffix( const OUString& rFragmentPath, const OUString& rSuffix ) +{ + sal_Int32 nSuffixPos = rFragmentPath.getLength() - rSuffix.getLength(); + return (nSuffixPos >= 0) && rFragmentPath.match( rSuffix, nSuffixPos ); +} + +} // namespace + +// ============================================================================ + struct XmlFilterBaseImpl { typedef RefMap< OUString, Relations > RelationsMap; + Reference< XFastParser > mxFastParser; OUString maBinSuffix; - Reference< XFastTokenHandler > - mxTokenHandler; + OUString maVmlSuffix; RelationsMap maRelationsMap; TextFieldStack maTextFieldStack; explicit XmlFilterBaseImpl(); @@ -101,7 +113,7 @@ struct XmlFilterBaseImpl XmlFilterBaseImpl::XmlFilterBaseImpl() : maBinSuffix( CREATE_OUSTRING( ".bin" ) ), - mxTokenHandler( new FastTokenHandler ) + maVmlSuffix( CREATE_OUSTRING( ".vml" ) ) { } @@ -113,6 +125,38 @@ XmlFilterBase::XmlFilterBase( const Reference< XMultiServiceFactory >& rxGlobalF mnRelId( 1 ), mnMaxDocId( 0 ) { + try + { + // create the fast parser + mxImpl->mxFastParser.set( rxGlobalFactory->createInstance( CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW ); + mxImpl->mxFastParser->setTokenHandler( new FastTokenHandler ); + + // register XML namespaces + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://www.w3.org/XML/1998/namespace" ), NMSP_XML ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS ); + + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/main" ), NMSP_DRAWINGML ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" ), NMSP_DIAGRAM ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chart" ), NMSP_CHART ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing" ), NMSP_CDR ); + + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:vml" ), NMSP_VML ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:office" ), NMSP_OFFICE ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:word" ), NMSP_VML_DOC ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:excel" ), NMSP_VML_XLS ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:powerpoint" ), NMSP_VML_PPT ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/activeX" ), NMSP_AX ); + + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/spreadsheetml/2006/main"), NMSP_XLS ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" ), NMSP_XDR ); + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/excel/2006/main" ), NMSP_XM ); + + mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/presentationml/2006/main"), NMSP_PPT ); + } + catch( Exception& ) + { + } } XmlFilterBase::~XmlFilterBase() @@ -140,8 +184,7 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r return false; // try to import binary streams (fragment extension must be '.bin') - sal_Int32 nBinSuffixPos = aFragmentPath.getLength() - mxImpl->maBinSuffix.getLength(); - if( (nBinSuffixPos >= 0) && aFragmentPath.match( mxImpl->maBinSuffix, nBinSuffixPos ) ) + if( lclHasSuffix( aFragmentPath, mxImpl->maBinSuffix ) ) { try { @@ -170,40 +213,16 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r if( !xDocHandler.is() ) return false; + // check that the fast parser exists + if( !mxImpl->mxFastParser.is() ) + return false; + // try to import XML stream try { // try to open the fragment stream (this may fail - do not assert) Reference< XInputStream > xInStrm( rxHandler->openFragmentStream(), UNO_SET_THROW ); - // create the fast parser - Reference< XFastParser > xParser( getGlobalFactory()->createInstance( - CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW ); - xParser->setFastDocumentHandler( xDocHandler ); - xParser->setTokenHandler( mxImpl->mxTokenHandler ); - - // register XML namespaces - xParser->registerNamespace( CREATE_OUSTRING( "http://www.w3.org/XML/1998/namespace" ), NMSP_XML ); - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS ); - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS ); - - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/main" ), NMSP_DRAWINGML ); - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" ), NMSP_DIAGRAM ); - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chart" ), NMSP_CHART ); - - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:vml" ), NMSP_VML ); - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:office" ), NMSP_OFFICE ); - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:word" ), NMSP_VML_DOC ); - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:excel" ), NMSP_VML_XLS ); - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:powerpoint" ), NMSP_VML_PPT ); - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/activeX" ), NMSP_AX ); - - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/spreadsheetml/2006/main"), NMSP_XLS ); - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" ), NMSP_XDR ); - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/excel/2006/main" ), NMSP_XM ); - - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/presentationml/2006/main"), NMSP_PPT ); - // create the input source and parse the stream InputSource aSource; aSource.aInputStream = xInStrm; @@ -211,7 +230,8 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r // own try/catch block for showing parser failure assertion with fragment path try { - xParser->parseStream( aSource ); + mxImpl->mxFastParser->setFastDocumentHandler( xDocHandler ); + mxImpl->mxFastParser->parseStream( aSource ); return true; } catch( Exception& ) diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index f1b592631f2d..efd8e6d021e1 100644 --- a/oox/source/drawingml/chart/chartconverter.cxx +++ b/oox/source/drawingml/chart/chartconverter.cxx @@ -33,6 +33,9 @@ using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Exception; +using ::com::sun::star::awt::Point; +using ::com::sun::star::awt::Size; +using ::com::sun::star::drawing::XShapes; using ::com::sun::star::chart2::XChartDocument; using ::com::sun::star::chart2::data::XDataProvider; using ::com::sun::star::chart2::data::XDataSequence; @@ -53,14 +56,15 @@ ChartConverter::~ChartConverter() } void ChartConverter::convertFromModel( XmlFilterBase& rFilter, - ChartSpaceModel& rModel, const Reference< XChartDocument >& rxChartDoc ) + ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, + const Reference< XShapes >& rxExternalPage, const Point& rChartPos, const Size& rChartSize ) { OSL_ENSURE( rxChartDoc.is(), "ChartConverter::convertFromModel - missing chart document" ); if( rxChartDoc.is() ) { - ConverterRoot aConvBase( rFilter, *this, rxChartDoc, rModel ); - ChartSpaceConverter aSpaceConv( aConvBase, rModel ); - aSpaceConv.convertFromModel(); + ConverterRoot aConvBase( rFilter, *this, rChartModel, rxChartDoc, rChartSize ); + ChartSpaceConverter aSpaceConv( aConvBase, rChartModel ); + aSpaceConv.convertFromModel( rxExternalPage, rChartPos ); } } diff --git a/oox/source/drawingml/chart/chartdrawingfragment.cxx b/oox/source/drawingml/chart/chartdrawingfragment.cxx new file mode 100644 index 000000000000..9df064125457 --- /dev/null +++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx @@ -0,0 +1,239 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: chartdrawingfragment.cxx,v $ + * + * $Revision: 1.1 $ + * + * 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. + * + ************************************************************************/ + +#include "oox/drawingml/chart/chartdrawingfragment.hxx" +#include "oox/core/xmlfilterbase.hxx" +#include "oox/drawingml/connectorshapecontext.hxx" +#include "oox/drawingml/graphicshapecontext.hxx" +#include "oox/drawingml/shapecontext.hxx" +#include "oox/drawingml/shapegroupcontext.hxx" + +using ::rtl::OUString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::awt::Point; +using ::com::sun::star::awt::Rectangle; +using ::com::sun::star::awt::Size; +using ::com::sun::star::drawing::XShapes; +using ::oox::core::ContextHandlerRef; +using ::oox::core::FragmentHandler2; +using ::oox::core::XmlFilterBase; + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +ShapeAnchor::ShapeAnchor( bool bRelSize ) : + mbRelSize( bRelSize ) +{ +} + +void ShapeAnchor::importExt( const AttributeList& rAttribs ) +{ + OSL_ENSURE( !mbRelSize, "ShapeAnchor::importExt - unexpected 'cdr:ext' element" ); + maSize.Width = rAttribs.getHyper( XML_cx, 0 ); + maSize.Height = rAttribs.getHyper( XML_cy, 0 ); +} + +void ShapeAnchor::setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ) +{ + AnchorPosModel* pAnchorPos = 0; + switch( nParentContext ) + { + case CDR_TOKEN( from ): + pAnchorPos = &maFrom; + break; + case CDR_TOKEN( to ): + OSL_ENSURE( mbRelSize, "ShapeAnchor::setPos - unexpected 'cdr:to' element" ); + pAnchorPos = &maTo; + break; + default: + OSL_ENSURE( false, "ShapeAnchor::setPos - unexpected parent element" ); + } + if( pAnchorPos ) switch( nElement ) + { + case CDR_TOKEN( x ): pAnchorPos->mfX = rValue.toDouble(); break; + case CDR_TOKEN( y ): pAnchorPos->mfY = rValue.toDouble(); break; + default: OSL_ENSURE( false, "ShapeAnchor::setPos - unexpected element" ); + } +} + +Rectangle ShapeAnchor::calcEmuLocation( const EmuRectangle& rEmuChartRect ) const +{ + Rectangle aLoc( -1, -1, -1, -1 ); + + OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::calcEmuLocation - invalid from position" ); + OSL_ENSURE( mbRelSize ? maTo.isValid() : maSize.isValid(), "ShapeAnchor::calcEmuLocation - invalid to/size" ); + if( maFrom.isValid() && (mbRelSize ? maTo.isValid() : maSize.isValid()) ) + { + // calculate shape position + aLoc.X = getLimitedValue< sal_Int32, double >( maFrom.mfX * rEmuChartRect.Width, 0, SAL_MAX_INT32 ); + aLoc.Y = getLimitedValue< sal_Int32, double >( maFrom.mfY * rEmuChartRect.Height, 0, SAL_MAX_INT32 ); + + // calculate shape size + if( mbRelSize ) + { + aLoc.Width = getLimitedValue< sal_Int32, double >( maTo.mfX * rEmuChartRect.Width, 0, SAL_MAX_INT32 ) - aLoc.X; + if( aLoc.Width < 0 ) + { + aLoc.X += aLoc.Width; + aLoc.Width *= -1; + } + aLoc.Height = getLimitedValue< sal_Int32, double >( maTo.mfY * rEmuChartRect.Height, 0, SAL_MAX_INT32 ) - aLoc.Y; + if( aLoc.Height < 0 ) + { + aLoc.Y += aLoc.Height; + aLoc.Height *= -1; + } + } + else + { + aLoc.Width = getLimitedValue< sal_Int32, sal_Int64 >( maSize.Width, 0, SAL_MAX_INT32 ); + aLoc.Height = getLimitedValue< sal_Int32, sal_Int64 >( maSize.Height, 0, SAL_MAX_INT32 ); + } + } + + return aLoc; +} +// ============================================================================ + +ChartDrawingFragment::ChartDrawingFragment( XmlFilterBase& rFilter, + const OUString& rFragmentPath, const Reference< XShapes >& rxDrawPage, + const Size& rChartSize, const Point& rShapesOffset, bool bOleSupport ) : + FragmentHandler2( rFilter, rFragmentPath ), + mxDrawPage( rxDrawPage ), + mbOleSupport( bOleSupport ) +{ + maEmuChartRect.X = static_cast< sal_Int64 >( rShapesOffset.X ) * 360; + maEmuChartRect.Y = static_cast< sal_Int64 >( rShapesOffset.Y ) * 360; + maEmuChartRect.Width = static_cast< sal_Int64 >( rChartSize.Width ) * 360; + maEmuChartRect.Height = static_cast< sal_Int64 >( rChartSize.Height ) * 360; +} + +ChartDrawingFragment::~ChartDrawingFragment() +{ +} + +ContextHandlerRef ChartDrawingFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) +{ + switch( getCurrentElement() ) + { + case XML_ROOT_CONTEXT: + if( nElement == C_TOKEN( userShapes ) ) return this; + break; + + case C_TOKEN( userShapes ): + switch( nElement ) + { + case CDR_TOKEN( absSizeAnchor ): + mxAnchor.reset( new ShapeAnchor( false ) ); + return this; + case CDR_TOKEN( relSizeAnchor ): + mxAnchor.reset( new ShapeAnchor( true ) ); + return this; + } + break; + + case CDR_TOKEN( absSizeAnchor ): + case CDR_TOKEN( relSizeAnchor ): + switch( nElement ) + { + case CDR_TOKEN( sp ): + mxShape.reset( new Shape( "com.sun.star.drawing.CustomShape" ) ); + return new ShapeContext( *this, ShapePtr(), mxShape ); + case CDR_TOKEN( cxnSp ): + mxShape.reset( new Shape( "com.sun.star.drawing.ConnectorShape" ) ); + return new ConnectorShapeContext( *this, ShapePtr(), mxShape ); + case CDR_TOKEN( pic ): + mxShape.reset( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ); + return new GraphicShapeContext( *this, ShapePtr(), mxShape ); + case CDR_TOKEN( graphicFrame ): + if( !mbOleSupport ) + return 0; + mxShape.reset( new Shape( "com.sun.star.drawing.OLE2Shape" ) ); + return new GraphicalObjectFrameContext( *this, ShapePtr(), mxShape, true ); + case CDR_TOKEN( grpSp ): + mxShape.reset( new Shape( "com.sun.star.drawing.GroupShape" ) ); + return new ShapeGroupContext( *this, ShapePtr(), mxShape ); + + case CDR_TOKEN( from ): + case CDR_TOKEN( to ): + return this; + + case CDR_TOKEN( ext ): + if( mxAnchor.get() ) mxAnchor->importExt( rAttribs ); + return 0; + } + break; + + case CDR_TOKEN( from ): + case CDR_TOKEN( to ): + switch( nElement ) + { + case CDR_TOKEN( x ): + case CDR_TOKEN( y ): + return this; // collect value in onEndElement() + } + break; + } + return 0; +} + +void ChartDrawingFragment::onEndElement( const OUString& rChars ) +{ + switch( getCurrentElement() ) + { + case CDR_TOKEN( x ): + case CDR_TOKEN( y ): + if( mxAnchor.get() ) mxAnchor->setPos( getCurrentElement(), getPreviousElement(), rChars ); + break; + + case CDR_TOKEN( absSizeAnchor ): + case CDR_TOKEN( relSizeAnchor ): + if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() ) + { + Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuChartRect ); + if( (aLoc.X >= 0) && (aLoc.Y >= 0) && (aLoc.Width >= 0) && (aLoc.Height >= 0) ) + mxShape->addShape( getFilter(), getFilter().getCurrentTheme(), mxDrawPage, &aLoc ); + } + mxShape.reset(); + mxAnchor.reset(); + break; + } +} + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index 390f7ccfe7b9..6460e94a4f3b 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -26,24 +26,29 @@ ************************************************************************/ #include "oox/drawingml/chart/chartspaceconverter.hxx" +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/chart/MissingValueTreatment.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> -#include <com/sun/star/chart/MissingValueTreatment.hpp> #include "oox/core/xmlfilterbase.hxx" #include "oox/drawingml/chart/chartconverter.hxx" +#include "oox/drawingml/chart/chartdrawingfragment.hxx" #include "oox/drawingml/chart/chartspacemodel.hxx" #include "oox/drawingml/chart/plotareaconverter.hxx" #include "oox/drawingml/chart/titleconverter.hxx" #include "properties.hxx" using ::rtl::OUString; +using ::com::sun::star::awt::Point; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::util::XNumberFormatsSupplier; +using ::com::sun::star::drawing::XDrawPageSupplier; +using ::com::sun::star::drawing::XShapes; using ::com::sun::star::chart2::XDiagram; using ::com::sun::star::chart2::XTitled; using ::com::sun::star::chart2::data::XDataReceiver; @@ -63,7 +68,7 @@ ChartSpaceConverter::~ChartSpaceConverter() { } -void ChartSpaceConverter::convertFromModel() +void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExternalPage, const Point& rChartPos ) { /* create data provider (virtual function in the ChartConverter class, derived converters may create an external data provider) */ @@ -81,8 +86,8 @@ void ChartSpaceConverter::convertFromModel() } // formatting of the chart background - PropertySet aPropSet( getChartDocument()->getPageBackground() ); - getFormatter().convertFrameFormatting( aPropSet, mrModel.mxShapeProp, OBJECTTYPE_CHARTSPACE ); + PropertySet aBackPropSet( getChartDocument()->getPageBackground() ); + getFormatter().convertFrameFormatting( aBackPropSet, mrModel.mxShapeProp, OBJECTTYPE_CHARTSPACE ); // convert plot area (container of all chart type groups) PlotAreaConverter aPlotAreaConv( *this, mrModel.mxPlotArea.getOrCreate() ); @@ -121,10 +126,10 @@ void ChartSpaceConverter::convertFromModel() } // legend - if( mrModel.mxLegend.is() ) + if( xDiagram.is() && mrModel.mxLegend.is() ) { LegendConverter aLegendConv( *this, *mrModel.mxLegend ); - aLegendConv.convertFromModel( getChartDocument()->getFirstDiagram() ); + aLegendConv.convertFromModel( xDiagram ); } // treatment of missing values @@ -142,12 +147,48 @@ void ChartSpaceConverter::convertFromModel() aDiaProp.setProperty( PROP_MissingValueTreatment, nMissingValues ); } - // set the IncludeHiddenCells property via the old API as only this ensures that the data provider and al created sequences get this flag correctly - Reference< com::sun::star::chart::XChartDocument > xStandardApiChartDoc( getChartDocument(), UNO_QUERY ); - if( xStandardApiChartDoc.is() ) + Reference< com::sun::star::chart::XChartDocument > xOldChartDoc( getChartDocument(), UNO_QUERY ); + if( xOldChartDoc.is() ) + { + /* Set the IncludeHiddenCells property via the old API as only this + ensures that the data provider and all created sequences get this + flag correctly. */ + PropertySet aOldDiaProp( xOldChartDoc->getDiagram() ); + aOldDiaProp.setProperty( PROP_IncludeHiddenCells, !mrModel.mbPlotVisOnly ); + } + + // embedded drawing shapes + if( mrModel.maDrawingPath.getLength() > 0 ) try + { + /* Get the internal draw page of the chart document, if no external + drawing page has been passed. */ + Reference< XShapes > xShapes; + Point aShapesOffset( 0, 0 ); + if( rxExternalPage.is() ) + { + xShapes = rxExternalPage; + // offset for embedded shapes to move them inside the chart area + aShapesOffset = rChartPos; + } + else + { + Reference< XDrawPageSupplier > xDrawPageSupp( getChartDocument(), UNO_QUERY_THROW ); + xShapes.set( xDrawPageSupp->getDrawPage(), UNO_QUERY_THROW ); + } + + /* If an external drawing page is passed, all embedded shapes will be + inserted there (used e.g. with 'chart sheets' in spreadsheet + documents). In this case, all types of shapes including OLE objects + are supported. If the shapes are inserted into the internal chart + drawing page instead, it is not possible to embed OLE objects. */ + bool bOleSupport = rxExternalPage.is(); + + // now, xShapes is not null anymore + getFilter().importFragment( new ChartDrawingFragment( + getFilter(), mrModel.maDrawingPath, xShapes, getChartSize(), aShapesOffset, bOleSupport ) ); + } + catch( Exception& ) { - PropertySet aStandardApiDiagramProp( xStandardApiChartDoc->getDiagram() ); - aStandardApiDiagramProp.setProperty( PROP_IncludeHiddenCells, !mrModel.mbPlotVisOnly ); } } diff --git a/oox/source/drawingml/chart/chartspacefragment.cxx b/oox/source/drawingml/chart/chartspacefragment.cxx index d041997636a9..75df94e95de7 100644 --- a/oox/source/drawingml/chart/chartspacefragment.cxx +++ b/oox/source/drawingml/chart/chartspacefragment.cxx @@ -75,6 +75,9 @@ ContextHandlerRef ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const return 0; case C_TOKEN( txPr ): return new TextBodyContext( *this, mrModel.mxTextProp.create() ); + case C_TOKEN( userShapes ): + mrModel.maDrawingPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ); + return 0; } break; diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx index 596efcf8b30f..534ce48e0278 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -40,6 +40,7 @@ using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::frame::XModel; +using ::com::sun::star::awt::Size; using ::com::sun::star::chart2::XChartDocument; using ::oox::core::XmlFilterBase; @@ -51,16 +52,18 @@ namespace chart { struct ConverterData { + ObjectFormatter maFormatter; XmlFilterBase& mrFilter; ChartConverter& mrConverter; Reference< XChartDocument > mxDoc; - ObjectFormatter maFormatter; + Size maSize; explicit ConverterData( XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ); + const Size& rChartSize ); ~ConverterData(); }; @@ -69,12 +72,14 @@ struct ConverterData ConverterData::ConverterData( XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ) : + const Size& rChartSize ) : + maFormatter( rFilter, rxChartDoc, rChartModel ), mrFilter( rFilter ), mrConverter( rChartConverter ), mxDoc( rxChartDoc ), - maFormatter( rFilter, rxChartDoc, rChartSpace ) + maSize( rChartSize ) { OSL_ENSURE( mxDoc.is(), "ConverterData::ConverterData - missing chart document" ); // lock the model to suppress internal updates during conversion @@ -106,9 +111,10 @@ ConverterData::~ConverterData() ConverterRoot::ConverterRoot( XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ) : - mxData( new ConverterData( rFilter, rChartConverter, rxChartDoc, rChartSpace ) ) + const Size& rChartSize ) : + mxData( new ConverterData( rFilter, rChartConverter, rChartModel, rxChartDoc, rChartSize ) ) { } @@ -151,6 +157,11 @@ Reference< XChartDocument > ConverterRoot::getChartDocument() const return mxData->mxDoc; } +const Size& ConverterRoot::getChartSize() const +{ + return mxData->maSize; +} + ObjectFormatter& ConverterRoot::getFormatter() const { return mxData->maFormatter; diff --git a/oox/source/drawingml/chart/makefile.mk b/oox/source/drawingml/chart/makefile.mk index 3ba22a30f9e6..84762e6a2540 100644 --- a/oox/source/drawingml/chart/makefile.mk +++ b/oox/source/drawingml/chart/makefile.mk @@ -46,6 +46,7 @@ SLOFILES = \ $(SLO)$/axismodel.obj \ $(SLO)$/chartcontextbase.obj \ $(SLO)$/chartconverter.obj \ + $(SLO)$/chartdrawingfragment.obj \ $(SLO)$/chartspaceconverter.obj \ $(SLO)$/chartspacefragment.obj \ $(SLO)$/chartspacemodel.obj \ diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index bcb562c0118f..a0335fe68ee2 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -106,8 +106,9 @@ Reference< XFastContextHandler > GraphicShapeContext::createFastChildContext( sa // ============================================================================ // CT_GraphicalObjectFrameContext -GraphicalObjectFrameContext::GraphicalObjectFrameContext( ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr ) -: ShapeContext( rParent, pMasterShapePtr, pShapePtr ) +GraphicalObjectFrameContext::GraphicalObjectFrameContext( ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart ) : + ShapeContext( rParent, pMasterShapePtr, pShapePtr ), + mbEmbedShapesInChart( bEmbedShapesInChart ) { } @@ -135,7 +136,7 @@ Reference< XFastContextHandler > GraphicalObjectFrameContext::createFastChildCon else if ( sUri.equalsAscii( "http://schemas.openxmlformats.org/drawingml/2006/diagram" ) ) xRet.set( new DiagramGraphicDataContext( *this, mpShapePtr ) ); else if ( sUri.equalsAscii( "http://schemas.openxmlformats.org/drawingml/2006/chart" ) ) - xRet.set( new ChartGraphicDataContext( *this, mpShapePtr ) ); + xRet.set( new ChartGraphicDataContext( *this, mpShapePtr, mbEmbedShapesInChart ) ); else if ( sUri.compareToAscii( "http://schemas.openxmlformats.org/drawingml/2006/table" ) == 0 ) xRet.set( new table::TableContext( *this, mpShapePtr ) ); else @@ -349,22 +350,24 @@ Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildConte class CreateChartCallback : public CreateShapeCallback { public: - explicit CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath ); - virtual void onXShapeCreated( const Reference< drawing::XShape >& rxShape ) const; + explicit CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath, bool bEmbedShapes ); + virtual void onXShapeCreated( const Reference< drawing::XShape >& rxShape, const Reference< drawing::XShapes >& rxShapes ) const; private: OUString maFragmentPath; + bool mbEmbedShapes; }; // ---------------------------------------------------------------------------- -CreateChartCallback::CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath ) : +CreateChartCallback::CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath, bool bEmbedShapes ) : CreateShapeCallback( rFilter ), - maFragmentPath( rFragmentPath ) + maFragmentPath( rFragmentPath ), + mbEmbedShapes( bEmbedShapes ) { } -void CreateChartCallback::onXShapeCreated( const Reference< drawing::XShape >& rxShape ) const +void CreateChartCallback::onXShapeCreated( const Reference< drawing::XShape >& rxShape, const Reference< drawing::XShapes >& rxShapes ) const { OSL_ENSURE( maFragmentPath.getLength() > 0, "CreateChartCallback::onXShapeCreated - missing chart fragment" ); if( maFragmentPath.getLength() > 0 ) try @@ -376,14 +379,17 @@ void CreateChartCallback::onXShapeCreated( const Reference< drawing::XShape >& r // get the XModel interface of the embedded object from the OLE shape Reference< frame::XModel > xDocModel; aShapeProp.getProperty( xDocModel, PROP_Model ); + Reference< chart2::XChartDocument > xChartDoc( xDocModel, UNO_QUERY_THROW ); // load the chart data from the XML fragment chart::ChartSpaceModel aModel; mrFilter.importFragment( new chart::ChartSpaceFragment( mrFilter, maFragmentPath, aModel ) ); // convert imported chart model to chart document - Reference< chart2::XChartDocument > xChartDoc( xDocModel, UNO_QUERY_THROW ); - mrFilter.getChartConverter().convertFromModel( mrFilter, aModel, xChartDoc ); + Reference< drawing::XShapes > xExternalPage; + if( !mbEmbedShapes ) + xExternalPage = rxShapes; + mrFilter.getChartConverter().convertFromModel( mrFilter, aModel, xChartDoc, xExternalPage, rxShape->getPosition(), rxShape->getSize() ); } catch( Exception& ) { @@ -392,8 +398,9 @@ void CreateChartCallback::onXShapeCreated( const Reference< drawing::XShape >& r // ============================================================================ -ChartGraphicDataContext::ChartGraphicDataContext( ContextHandler& rParent, const ShapePtr& rxShape ) : - ShapeContext( rParent, ShapePtr(), rxShape ) +ChartGraphicDataContext::ChartGraphicDataContext( ContextHandler& rParent, const ShapePtr& rxShape, bool bEmbedShapes ) : + ShapeContext( rParent, ShapePtr(), rxShape ), + mbEmbedShapes( bEmbedShapes ) { rxShape->setServiceName( "com.sun.star.drawing.OLE2Shape" ); } @@ -405,7 +412,7 @@ Reference< XFastContextHandler > ChartGraphicDataContext::createFastChildContext { AttributeList aAttribs( rxAttribs ); OUString aFragmentPath = getFragmentPathFromRelId( aAttribs.getString( R_TOKEN( id ), OUString() ) ); - CreateShapeCallbackRef xCallback( new CreateChartCallback( getFilter(), aFragmentPath ) ); + CreateShapeCallbackRef xCallback( new CreateChartCallback( getFilter(), aFragmentPath, mbEmbedShapes ) ); mpShapePtr->setCreateShapeCallback( xCallback ); } return 0; diff --git a/oox/source/drawingml/makefile.mk b/oox/source/drawingml/makefile.mk index 443c30bb16a9..e2d4ea6b8f3d 100644 --- a/oox/source/drawingml/makefile.mk +++ b/oox/source/drawingml/makefile.mk @@ -66,6 +66,7 @@ SLOFILES = \ $(SLO)$/spdefcontext.obj\ $(SLO)$/textbody.obj\ $(SLO)$/textbodycontext.obj\ + $(SLO)$/textbodyproperties.obj\ $(SLO)$/textbodypropertiescontext.obj\ $(SLO)$/textcharacterproperties.obj\ $(SLO)$/textcharacterpropertiescontext.obj\ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 8bbfc820fca1..dea4a6a51206 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -47,6 +47,7 @@ #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <com/sun/star/document/XActionLockable.hpp> using rtl::OUString; using namespace ::oox::core; @@ -76,7 +77,7 @@ OUString CreateShapeCallback::onCreateXShape( const OUString& rServiceName, cons return rServiceName; } -void CreateShapeCallback::onXShapeCreated( const Reference< XShape >& ) const +void CreateShapeCallback::onXShapeCreated( const Reference< XShape >&, const Reference< XShapes >& ) const { } @@ -89,7 +90,7 @@ Shape::Shape( const sal_Char* pServiceName ) , mpCustomShapePropertiesPtr( new CustomShapeProperties ) , mpMasterTextListStyle( new TextListStyle ) , mnSubType( 0 ) -, mnIndex( 0 ) +, mnSubTypeIndex( -1 ) , mnRotation( 0 ) , mbFlipH( false ) , mbFlipV( false ) @@ -135,7 +136,7 @@ const ShapeStyleRef* Shape::getShapeStyleRef( sal_Int32 nRefType ) const void Shape::addShape( const ::oox::core::XmlFilterBase& rFilterBase, - const ThemePtr& rxTheme, + const Theme* pTheme, const Reference< XShapes >& rxShapes, const awt::Rectangle* pShapeRect, ShapeIdMap* pShapeMap ) @@ -145,7 +146,7 @@ void Shape::addShape( rtl::OUString sServiceName( msServiceName ); if( sServiceName.getLength() ) { - Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, rxTheme, rxShapes, pShapeRect, sal_False ) ); + Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, pTheme, rxShapes, pShapeRect, sal_False ) ); if( pShapeMap && msId.getLength() ) { @@ -155,7 +156,7 @@ void Shape::addShape( // if this is a group shape, we have to add also each child shape Reference< XShapes > xShapes( xShape, UNO_QUERY ); if ( xShapes.is() ) - addChildren( rFilterBase, *this, rxTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap ); + addChildren( rFilterBase, *this, pTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap ); } } catch( const Exception& ) @@ -184,7 +185,7 @@ void Shape::applyShapeReference( const Shape& rReferencedShape ) void Shape::addChildren( const ::oox::core::XmlFilterBase& rFilterBase, Shape& rMaster, - const ThemePtr& rxTheme, + const Theme* pTheme, const Reference< XShapes >& rxShapes, const awt::Rectangle& rClientRect, ShapeIdMap* pShapeMap ) @@ -235,14 +236,14 @@ void Shape::addChildren( pShapeRect = &aShapeRect; } } - (*aIter++)->addShape( rFilterBase, rxTheme, rxShapes, pShapeRect, pShapeMap ); + (*aIter++)->addShape( rFilterBase, pTheme, rxShapes, pShapeRect, pShapeMap ); } } Reference< XShape > Shape::createAndInsert( const ::oox::core::XmlFilterBase& rFilterBase, const rtl::OUString& rServiceName, - const ThemePtr& rxTheme, + const Theme* pTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, const awt::Rectangle* pShapeRect, sal_Bool bClearText ) @@ -365,6 +366,10 @@ Reference< XShape > Shape::createAndInsert( } rxShapes->add( mxShape ); + Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY ); + if( xLockable.is() ) + xLockable->addActionLock(); + // sj: removing default text of placeholder objects such as SlideNumberShape or HeaderShape if ( bClearText ) { @@ -383,23 +388,23 @@ Reference< XShape > Shape::createAndInsert( aFillProperties.moFillType = XML_noFill; sal_Int32 nFillPhClr = -1; - if( rxTheme.get() ) + if( pTheme ) { if( const ShapeStyleRef* pLineRef = getShapeStyleRef( XML_lnRef ) ) { - if( const LineProperties* pLineProps = rxTheme->getLineStyle( pLineRef->mnThemedIdx ) ) + if( const LineProperties* pLineProps = pTheme->getLineStyle( pLineRef->mnThemedIdx ) ) aLineProperties.assignUsed( *pLineProps ); nLinePhClr = pLineRef->maPhClr.getColor( rFilterBase ); } if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) ) { - if( const FillProperties* pFillProps = rxTheme->getFillStyle( pFillRef->mnThemedIdx ) ) + if( const FillProperties* pFillProps = pTheme->getFillStyle( pFillRef->mnThemedIdx ) ) aFillProperties.assignUsed( *pFillProps ); nFillPhClr = pFillRef->maPhClr.getColor( rFilterBase ); } // if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_fillRef ) ) // { -// if( const EffectProperties* pEffectProps = rxTheme->getEffectStyle( pEffectRef->mnThemedIdx ) ) +// if( const EffectProperties* pEffectProps = pTheme->getEffectStyle( pEffectRef->mnThemedIdx ) ) // aEffectProperties.assignUsed( *pEffectProps ); // nEffectPhClr = pEffectRef->maPhClr.getColor( rFilterBase ); // } @@ -409,13 +414,23 @@ Reference< XShape > Shape::createAndInsert( aFillProperties.assignUsed( getFillProperties() ); PropertyMap aShapeProperties; + PropertyMap::const_iterator aShapePropIter; + aShapeProperties.insert( getShapeProperties().begin(), getShapeProperties().end() ); if( mxCreateCallback.get() ) - aShapeProperties.insert( mxCreateCallback->getShapeProperties().begin(), mxCreateCallback->getShapeProperties().end() ); + { + for ( aShapePropIter = mxCreateCallback->getShapeProperties().begin(); + aShapePropIter != mxCreateCallback->getShapeProperties().end(); aShapePropIter++ ) + aShapeProperties[ (*aShapePropIter).first ] = (*aShapePropIter).second; + } // add properties from textbody to shape properties if( mpTextBody.get() ) - aShapeProperties.insert( mpTextBody->getTextProperties().maPropertyMap.begin(), mpTextBody->getTextProperties().maPropertyMap.end() ); + { + for ( aShapePropIter = mpTextBody->getTextProperties().maPropertyMap.begin(); + aShapePropIter != mpTextBody->getTextProperties().maPropertyMap.end(); aShapePropIter++ ) + aShapeProperties[ (*aShapePropIter).first ] = (*aShapePropIter).second; + } // applying properties PropertySet aPropSet( xSet ); @@ -451,8 +466,8 @@ Reference< XShape > Shape::createAndInsert( TextCharacterProperties aCharStyleProperties; if( const ShapeStyleRef* pFontRef = getShapeStyleRef( XML_fontRef ) ) { - if( rxTheme.get() ) - if( const TextCharacterProperties* pCharProps = rxTheme->getFontStyle( pFontRef->mnThemedIdx ) ) + if( pTheme ) + if( const TextCharacterProperties* pCharProps = pTheme->getFontStyle( pFontRef->mnThemedIdx ) ) aCharStyleProperties.assignUsed( *pCharProps ); aCharStyleProperties.maCharColor.assignIfUsed( pFontRef->maPhClr ); } @@ -461,11 +476,13 @@ Reference< XShape > Shape::createAndInsert( getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle ); } } + if( xLockable.is() ) + xLockable->removeActionLock(); } // use a callback for further processing on the XShape (e.g. charts) if( mxShape.is() && mxCreateCallback.get() ) - mxCreateCallback->onXShapeCreated( mxShape ); + mxCreateCallback->onXShapeCreated( mxShape, rxShapes ); return mxShape; } diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx index 4ee664b1c66c..a5a1f16f5935 100644 --- a/oox/source/drawingml/shapecontext.cxx +++ b/oox/source/drawingml/shapecontext.cxx @@ -90,7 +90,7 @@ Reference< XFastContextHandler > ShapeContext::createFastChildContext( sal_Int32 break; case XML_ph: mpShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) ); - mpShapePtr->setIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); + mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); break; // nvSpPr CT_ShapeNonVisual end diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx index 3d93d5866886..56ce53767641 100644 --- a/oox/source/drawingml/shapegroupcontext.cxx +++ b/oox/source/drawingml/shapegroupcontext.cxx @@ -75,7 +75,7 @@ Reference< XFastContextHandler > ShapeGroupContext::createFastChildContext( sal_ break; case XML_ph: mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) ); - mpGroupShapePtr->setIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); + mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); break; // nvSpPr CT_ShapeNonVisual end @@ -103,7 +103,7 @@ Reference< XFastContextHandler > ShapeGroupContext::createFastChildContext( sal_ xRet.set( new GraphicShapeContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ) ) ); break; case XML_graphicFrame: // CT_GraphicalObjectFrame - xRet.set( new GraphicalObjectFrameContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.OLE2Shape" ) ) ) ); + xRet.set( new GraphicalObjectFrameContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.OLE2Shape" ) ), true ) ); break; } if( !xRet.is() ) diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx index 9a197ee691bf..8de730849b24 100644 --- a/oox/source/drawingml/textbodycontext.cxx +++ b/oox/source/drawingml/textbodycontext.cxx @@ -109,7 +109,7 @@ Reference< XFastContextHandler > TextParagraphContext::createFastChildContext( s xRet.set( new TextParagraphPropertiesContext( *this, xAttribs, mrParagraph.getProperties() ) ); break; case NMSP_DRAWINGML|XML_endParaRPr: - xRet.set( new TextParagraphPropertiesContext( *this, xAttribs, mrParagraph.getEndProperties() ) ); + xRet.set( new TextCharacterPropertiesContext( *this, xAttribs, mrParagraph.getEndProperties() ) ); break; } diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx new file mode 100644 index 000000000000..afd4766b0106 --- /dev/null +++ b/oox/source/drawingml/textbodyproperties.cxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textbodyproperties.cxx,v $ + * $Revision: 1.1 $ + * + * 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. + * + ************************************************************************/ + +#include "oox/drawingml/textbodyproperties.hxx" +#include <com/sun/star/text/WritingMode.hpp> +#include "properties.hxx" +#include "tokens.hxx" + +namespace oox { +namespace drawingml { + +// ============================================================================ + +TextBodyProperties::TextBodyProperties() +{ +} + +void TextBodyProperties::pushToPropMap( PropertyMap& rPropMap ) const +{ + rPropMap.insert( maPropertyMap.begin(), maPropertyMap.end() ); + + // #160799# fake different vertical text modes by top-bottom writing mode + if( moVert.get( XML_horz ) != XML_horz ) + rPropMap[ PROP_TextWritingMode ] <<= ::com::sun::star::text::WritingMode_TB_RL; +} + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 291af2687149..ec605a3adadd 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -28,6 +28,8 @@ #include "oox/drawingml/textbodypropertiescontext.hxx" #include <com/sun/star/text/ControlCharacter.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include "oox/drawingml/textbodyproperties.hxx" #include "oox/drawingml/drawingmltypes.hxx" #include "oox/helper/attributelist.hxx" @@ -38,6 +40,7 @@ using ::rtl::OUString; using namespace ::oox::core; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; using namespace ::com::sun::star::xml::sax; @@ -56,7 +59,7 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, // ST_TextWrappingType sal_Int32 nWrappingType = aAttribs.getToken( XML_wrap, XML_square ); - mrTextBodyProp.maPropertyMap[ PROP_TextWordWrap ] <<= (nWrappingType == XML_square); + mrTextBodyProp.maPropertyMap[ PROP_TextWordWrap ] <<= static_cast< sal_Bool >( nWrappingType == XML_square ); // ST_Coordinate OUString sValue; @@ -78,7 +81,17 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, // ST_TextAnchoringType -// sal_Int32 nAnchoringType = xAttributes->getOptionalValueToken( XML_anchor, XML_t ); + drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP ); + switch( xAttributes->getOptionalValueToken( XML_anchor, XML_t ) ) + { + case XML_b : eVA = drawing::TextVerticalAdjust_BOTTOM; break; + case XML_dist : + case XML_just : + case XML_ctr : eVA = drawing::TextVerticalAdjust_CENTER; break; + default: + case XML_t : eVA = drawing::TextVerticalAdjust_TOP; break; + } + mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= eVA; // bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false ); diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index 6797b8336c02..cfba04a7b44b 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -56,13 +56,20 @@ TextCharacterPropertiesContext::TextCharacterPropertiesContext( , mrTextCharacterProperties( rTextCharacterProperties ) { AttributeList aAttribs( rXAttributes ); - mrTextCharacterProperties.moLang = aAttribs.getString( XML_lang ); - mrTextCharacterProperties.moHeight = aAttribs.getInteger( XML_sz ); - mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u ); - mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike ); -// mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap ); - mrTextCharacterProperties.moBold = aAttribs.getBool( XML_b ); - mrTextCharacterProperties.moItalic = aAttribs.getBool( XML_i ); + if ( aAttribs.hasAttribute( XML_lang ) ) + mrTextCharacterProperties.moLang = aAttribs.getString( XML_lang ); + if ( aAttribs.hasAttribute( XML_sz ) ) + mrTextCharacterProperties.moHeight = aAttribs.getInteger( XML_sz ); + if ( aAttribs.hasAttribute( XML_u ) ) + mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u ); + if ( aAttribs.hasAttribute( XML_strike ) ) + mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike ); + +// mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap ); + if ( aAttribs.hasAttribute( XML_b ) ) + mrTextCharacterProperties.moBold = aAttribs.getBool( XML_b ); + if ( aAttribs.hasAttribute( XML_i ) ) + mrTextCharacterProperties.moItalic = aAttribs.getBool( XML_i ); // TODO /* todo: we need to be able to iterate over the XFastAttributes diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx index 1ff78541243e..a4bef1a5013c 100644 --- a/oox/source/drawingml/textparagraph.cxx +++ b/oox/source/drawingml/textparagraph.cxx @@ -29,6 +29,7 @@ #include "oox/drawingml/drawingmltypes.hxx" #include <rtl/ustring.hxx> +#include "oox/helper/propertyset.hxx" #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/XTextCursor.hpp> #include <com/sun/star/text/ControlCharacter.hpp> @@ -78,11 +79,21 @@ void TextParagraph::insertAt( xText->insertControlCharacter( xStart, ControlCharacter::APPEND_PARAGRAPH, sal_False ); xAt->gotoEnd( sal_True ); } + if ( maRuns.begin() == maRuns.end() ) + { + PropertySet aPropSet( xStart ); - for( TextRunVector::const_iterator aIt = maRuns.begin(), aEnd = maRuns.end(); aIt != aEnd; ++aIt ) + TextCharacterProperties aTextCharacterProps( aTextCharacterStyle ); + aTextCharacterProps.assignUsed( maEndProperties ); + aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase ); + } + else { - (*aIt)->insertAt( rFilterBase, xText, xAt, aTextCharacterStyle ); - nParagraphSize += (*aIt)->getText().getLength(); + for( TextRunVector::const_iterator aIt = maRuns.begin(), aEnd = maRuns.end(); aIt != aEnd; ++aIt ) + { + (*aIt)->insertAt( rFilterBase, xText, xAt, aTextCharacterStyle ); + nParagraphSize += (*aIt)->getText().getLength(); + } } xAt->gotoEnd( sal_True ); @@ -94,7 +105,6 @@ void TextParagraph::insertAt( pTextParagraphStyle->pushToPropSet( rFilterBase, xProps, aioBulletList, NULL, sal_False, fCharacterSize ); fCharacterSize = pTextParagraphStyle->getCharHeightPoints( 18 ); } - maProperties.pushToPropSet( rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), sal_True, fCharacterSize ); // empty paragraphs do not have bullets in ppt diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini index 645bb2bb7825..618e89c996e0 100644 --- a/oox/source/dump/biffdumper.ini +++ b/oox/source/dump/biffdumper.ini @@ -358,7 +358,7 @@ multilist=RECORD-NAMES-BIFF5 # chart records exclude=0x1004,0x102D,0x102F,0x1036,0x1037,0x1038,0x103B 0x1040=CHRADARAREA,CHAXESSET,,CHLEGENDENTRY,CHPROPERTIES,CHSERGROUP,CHUSEDAXESSETS, - 0x1048=CHPIVOTREF,,CHSERPARENT,CHSERTRENDLINE,,,CHFORMAT,CHPOS + 0x1048=CHPIVOTREF,,CHSERPARENT,CHSERTRENDLINE,,,CHFORMAT,CHFRAMEPOS 0x1050=CHFORMATRUNS,CHSOURCELINK,,,,,, 0x1058=,,,CHSERERRORBAR,,CHSERIESFORMAT,, end @@ -976,10 +976,11 @@ end shortlist=CHPROPERTIES-EMPTYCELLS,0,do-not-plot,as-zero,interpolated flagslist=CHPROPERTIES-FLAGS - 0x0001=manual-format + 0x0001=manual-series 0x0002=plot-visible-only 0x0004=fixed-size 0x0008=manual-plotarea + 0x0010=apply-plotarea-pos end # CHSCATTER ------------------------------------------------------------------ @@ -1039,7 +1040,7 @@ shortlist=CHTEXT-HORALIGN,1,left,center,right,block,distribute shortlist=CHTEXT-VERALIGN,1,top,center,bottom,block,distribute shortlist=CHTEXT-FILLMODE,1,transparent,opaque -combilist=CHTEXT-FLAGS-BIFF2 +flagslist=CHTEXT-FLAGS-BIFF2 0x0001=auto-color 0x0002=show-symbol 0x0004=show-value diff --git a/oox/source/dump/dffdumper.cxx b/oox/source/dump/dffdumper.cxx index bbd8c78d1a10..599687f5bd50 100644 --- a/oox/source/dump/dffdumper.cxx +++ b/oox/source/dump/dffdumper.cxx @@ -36,6 +36,30 @@ namespace dump { // ============================================================================ +namespace { + +const sal_uInt16 DFF_ID_BSE = 0xF007; /// BLIP store entry. +const sal_uInt16 DFF_ID_BSTORECONTAINER = 0xF001; /// BLIP store container. +const sal_uInt16 DFF_ID_CHILDANCHOR = 0xF00F; /// Child anchor (in groups). +const sal_uInt16 DFF_ID_CLIENTANCHOR = 0xF010; /// Client anchor. +const sal_uInt16 DFF_ID_DG = 0xF008; /// Drawing. +const sal_uInt16 DFF_ID_DGG = 0xF006; /// Drawing group. +const sal_uInt16 DFF_ID_OPT = 0xF00B; /// Property set. +const sal_uInt16 DFF_ID_OPT2 = 0xF121; /// Secondary property set. +const sal_uInt16 DFF_ID_OPT3 = 0xF122; /// Ternary property set. +const sal_uInt16 DFF_ID_SP = 0xF00A; /// Shape. +const sal_uInt16 DFF_ID_SPGR = 0xF009; /// Shape group. +const sal_uInt16 DFF_ID_SPLITMENUCOLORS = 0xF11E; /// Current toolbar colors. + +const sal_uInt16 DFF_OPT_IDMASK = 0x3FFF; +const sal_uInt16 DFF_OPT_PICTURE = 0x4000; +const sal_uInt16 DFF_OPT_COMPLEX = 0x8000; +const sal_uInt16 DFF_OPT_FLAGSMASK = 0x003F; + +} // namespace + +// ============================================================================ + void DffStreamObject::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) { SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, "DFF-RECORD-NAMES" ); @@ -62,10 +86,12 @@ void DffStreamObject::implWriteExtHeader() const sal_Char* pcListName = "DFF-RECORD-INST"; switch( getRecId() ) { - case 0xF001: pcListName = "DFFBSTORECONT-RECORD-INST"; break; // DFFBSTORECONTAINER contains BLIP count - case 0xF007: pcListName = "DFFBSE-RECORD-INST"; break; // DFFBSE contains BLIP type - case 0xF00A: pcListName = "DFFSP-RECORD-INST"; break; // DFFSP contains shape type - case 0xF00B: pcListName = "DFFOPT-RECORD-INST"; break; // DFFOPT contains property count + case DFF_ID_BSE: pcListName = "DFFBSE-RECORD-INST"; break; // BLIP type + case DFF_ID_BSTORECONTAINER: pcListName = "DFFBSTORECONT-RECORD-INST"; break; // BLIP count + case DFF_ID_DG: pcListName = "DFFDG-RECORD-INST"; break; // drawing ID + case DFF_ID_OPT: pcListName = "DFFOPT-RECORD-INST"; break; // property count + case DFF_ID_SP: pcListName = "DFFSP-RECORD-INST"; break; // shape type + case DFF_ID_SPLITMENUCOLORS: pcListName = "DFFSPLITMENUC-RECORD-INST"; break; // number of colors } MultiItemsGuard aMultiGuard( out() ); writeHexItem( "instance", mnInstVer, pcListName ); @@ -76,7 +102,7 @@ void DffStreamObject::implDumpRecordBody() { switch( getRecId() ) { - case 0xF007: // DFFBSE + case DFF_ID_BSE: dumpDec< sal_uInt8 >( "win-type", "DFFBSE-TYPE" ); dumpDec< sal_uInt8 >( "mac-type", "DFFBSE-TYPE" ); dumpGuid( "guid" ); @@ -89,26 +115,63 @@ void DffStreamObject::implDumpRecordBody() dumpUnused( 2 ); break; - case 0xF00A: // DFFSP - dumpHex< sal_uInt32 >( "shape-id", "CONV-DEC" ); - dumpHex< sal_uInt32 >( "shape-flags", "DFFSP-FLAGS" ); + case DFF_ID_CHILDANCHOR: + dumpDec< sal_uInt32 >( "left" ); + dumpDec< sal_uInt32 >( "top" ); + dumpDec< sal_uInt32 >( "right" ); + dumpDec< sal_uInt32 >( "bottom" ); break; - case 0xF00B: // DFFOPT + case DFF_ID_CLIENTANCHOR: + implDumpClientAnchor(); + break; + + case DFF_ID_DG: + dumpDec< sal_uInt32 >( "shape-count" ); + dumpHex< sal_uInt32 >( "max-shape-id", "CONV-DEC" ); + break; + + case DFF_ID_DGG: { - sal_uInt16 nPropCount = getInst(); - out().resetItemIndex(); - for( sal_uInt16 nPropIdx = 0; !in().isEof() && (nPropIdx < nPropCount); ++nPropIdx ) + dumpHex< sal_uInt32 >( "max-shape-id", "CONV-DEC" ); + sal_uInt32 nClusters = dumpDec< sal_uInt32 >( "id-cluster-count" ); + dumpDec< sal_uInt32 >( "shape-count" ); + dumpDec< sal_uInt32 >( "drawing-count" ); + out().resetItemIndex( 1 ); + TableGuard aTabGuard( out(), 15, 16 ); + for( sal_uInt32 nCluster = 1; !in().isEof() && (nCluster < nClusters); ++nCluster ) { - sal_uInt16 nPropId = dumpDffOptPropHeader(); - IndentGuard aIndent( out() ); - dumpDffOptPropValue( nPropId, in().readuInt32() ); + MultiItemsGuard aMultiGuard( out() ); + writeEmptyItem( "#cluster" ); + dumpDec< sal_uInt32 >( "drawing-id" ); + dumpHex< sal_uInt32 >( "next-free-id", "CONV-DEC" ); } } break; - case 0xF010: // DFFCLIENTANCHOR - implDumpClientAnchor(); + case DFF_ID_OPT: + case DFF_ID_OPT2: + case DFF_ID_OPT3: + dumpDffOpt(); + break; + + case DFF_ID_SP: + dumpHex< sal_uInt32 >( "shape-id", "CONV-DEC" ); + dumpHex< sal_uInt32 >( "shape-flags", "DFFSP-FLAGS" ); + break; + + case DFF_ID_SPGR: + dumpDec< sal_uInt32 >( "left" ); + dumpDec< sal_uInt32 >( "top" ); + dumpDec< sal_uInt32 >( "right" ); + dumpDec< sal_uInt32 >( "bottom" ); + break; + + case DFF_ID_SPLITMENUCOLORS: + dumpDffSimpleColor( "fill-color" ); + dumpDffSimpleColor( "line-color" ); + dumpDffSimpleColor( "shadow-color" ); + dumpDffSimpleColor( "3d-color" ); break; } } @@ -121,38 +184,136 @@ void DffStreamObject::constructDffObj() { mnInstVer = 0; mnRealSize = 0; + if( SequenceRecordObjectBase::implIsValid() ) + { + maSimpleProps.insertFormats( cfg().getNameList( "DFFOPT-SIMPLE-PROPERTIES" ) ); + maComplexProps.insertFormats( cfg().getNameList( "DFFOPT-COMPLEX-PROPERTIES" ) ); + } } -sal_uInt16 DffStreamObject::dumpDffOptPropHeader() +sal_uInt32 DffStreamObject::dumpDffSimpleColor( const String& rName ) { - MultiItemsGuard aMultiGuard( out() ); - TableGuard aTabGuard( out(), 11 ); - writeEmptyItem( "#prop" ); - return dumpHex< sal_uInt16 >( "id", "DFFOPT-PROPERTY-ID" ); + return dumpHex< sal_uInt32 >( rName, "DFF-SIMPLE-COLOR" ); +} + +sal_uInt32 DffStreamObject::dumpDffColor( const String& rName ) +{ + return dumpHex< sal_uInt32 >( rName, "DFF-COLOR" ); } -void DffStreamObject::dumpDffOptPropValue( sal_uInt16 nPropId, sal_uInt32 nValue ) +namespace { + +enum PropType { PROPTYPE_BINARY, PROPTYPE_STRING, PROPTYPE_BLIP, PROPTYPE_COLORARRAY }; + +struct PropInfo +{ + OUString maName; + PropType meType; + sal_uInt16 mnId; + sal_uInt32 mnSize; + inline explicit PropInfo( const OUString& rName, PropType eType, sal_uInt16 nId, sal_uInt32 nSize ) : + maName( rName ), meType( eType ), mnId( nId ), mnSize( nSize ) {} +}; + +typedef ::std::vector< PropInfo > PropInfoVector; + +} // namespace + +void DffStreamObject::dumpDffOpt() { - switch( nPropId & 0x3FFF ) + sal_uInt16 nPropCount = getInst(); + PropInfoVector aPropInfos; + out().resetItemIndex(); + for( sal_uInt16 nPropIdx = 0; !in().isEof() && (nPropIdx < nPropCount); ++nPropIdx ) + { + sal_uInt16 nPropId = dumpDffOptPropHeader(); + sal_uInt16 nBaseId = nPropId & DFF_OPT_IDMASK; + sal_uInt32 nValue = in().readuInt32(); + + IndentGuard aIndent( out() ); + if( getFlag( nPropId, DFF_OPT_COMPLEX ) ) + { + writeHexItem( "complex-size", nValue, "CONV-DEC" ); + String aName; + PropType eType = PROPTYPE_BINARY; + ItemFormatMap::const_iterator aIt = maComplexProps.find( nBaseId ); + if( aIt != maComplexProps.end() ) + { + const ItemFormat& rItemFmt = aIt->second; + aName = rItemFmt.maItemName; + if( rItemFmt.maListName.equalsAscii( "binary" ) ) + eType = PROPTYPE_BINARY; + else if( rItemFmt.maListName.equalsAscii( "string" ) ) + eType = PROPTYPE_STRING; + else if( rItemFmt.maListName.equalsAscii( "blip" ) ) + eType = PROPTYPE_BLIP; + else if( rItemFmt.maListName.equalsAscii( "colorarray" ) ) + eType = PROPTYPE_COLORARRAY; + } + aPropInfos.push_back( PropInfo( aName( "property-data" ), eType, nBaseId, nValue ) ); + } + else + { + ItemFormatMap::const_iterator aIt = maSimpleProps.find( nBaseId ); + if( aIt != maSimpleProps.end() ) + { + const ItemFormat& rItemFmt = aIt->second; + // flags always at end of block of 64 properties + if( (nBaseId & DFF_OPT_FLAGSMASK) == DFF_OPT_FLAGSMASK ) + { + FlagsList* pFlagsList = dynamic_cast< FlagsList* >( cfg().getNameList( rItemFmt.maListName ).get() ); + sal_Int64 nOldIgnoreFlags = 0; + if( pFlagsList ) + { + nOldIgnoreFlags = pFlagsList->getIgnoreFlags(); + pFlagsList->setIgnoreFlags( nOldIgnoreFlags | 0xFFFF0000 | ~(nValue >> 16) ); + } + writeValueItem( rItemFmt, nValue ); + if( pFlagsList ) + pFlagsList->setIgnoreFlags( nOldIgnoreFlags ); + } + else + writeValueItem( rItemFmt, nValue ); + } + else + writeHexItem( "value", nValue ); + } + } + + out().resetItemIndex(); + for( PropInfoVector::iterator aIt = aPropInfos.begin(), aEnd = aPropInfos.end(); !in().isEof() && (aIt != aEnd); ++aIt ) { - case 127: writeHexItem( "flags", nValue, "DFFOPT-LOCK-FLAGS" ); break; - case 191: writeHexItem( "flags", nValue, "DFFOPT-TEXT-FLAGS" ); break; - case 255: writeHexItem( "flags", nValue, "DFFOPT-TEXTGEO-FLAGS" ); break; - case 319: writeHexItem( "flags", nValue, "DFFOPT-PICTURE-FLAGS" ); break; - case 383: writeHexItem( "flags", nValue, "DFFOPT-GEO-FLAGS" ); break; - case 447: writeHexItem( "flags", nValue, "DFFOPT-FILL-FLAGS" ); break; - case 511: writeHexItem( "flags", nValue, "DFFOPT-LINE-FLAGS" ); break; - case 575: writeHexItem( "flags", nValue, "DFFOPT-SHADOW-FLAGS" ); break; - case 639: writeHexItem( "flags", nValue, "DFFOPT-PERSP-FLAGS" ); break; - case 703: writeHexItem( "flags", nValue, "DFFOPT-3DOBJ-FLAGS" ); break; - case 767: writeHexItem( "flags", nValue, "DFFOPT-3DSTYLE-FLAGS" ); break; - case 831: writeHexItem( "flags", nValue, "DFFOPT-SHAPE1-FLAGS" ); break; - case 895: writeHexItem( "flags", nValue, "DFFOPT-CALLOUT-FLAGS" ); break; - case 959: writeHexItem( "flags", nValue, "DFFOPT-SHAPE2-FLAGS" ); break; - default: writeHexItem( "value", nValue ); + out().startMultiItems(); + writeEmptyItem( "#complex-data" ); + writeHexItem( "id", aIt->mnId, "DFFOPT-PROPERTY-NAMES" ); + out().endMultiItems(); + IndentGuard aIndent( out() ); + switch( aIt->meType ) + { + case PROPTYPE_BINARY: + dumpBinary( aIt->maName, aIt->mnSize ); + break; + case PROPTYPE_STRING: + dumpUnicodeArray( aIt->maName, aIt->mnSize / 2, true ); + break; + case PROPTYPE_BLIP: + dumpBinary( aIt->maName, aIt->mnSize ); + break; + case PROPTYPE_COLORARRAY: + dumpBinary( aIt->maName, aIt->mnSize ); + break; + } } } +sal_uInt16 DffStreamObject::dumpDffOptPropHeader() +{ + MultiItemsGuard aMultiGuard( out() ); + TableGuard aTabGuard( out(), 11 ); + writeEmptyItem( "#prop" ); + return dumpHex< sal_uInt16 >( "id", "DFFOPT-PROPERTY-ID" ); +} + // ============================================================================ } // namespace dump diff --git a/oox/source/dump/dffdumper.ini b/oox/source/dump/dffdumper.ini index 9c3184b275e5..c33d733c6bd8 100644 --- a/oox/source/dump/dffdumper.ini +++ b/oox/source/dump/dffdumper.ini @@ -12,7 +12,7 @@ multilist=DFF-RECORD-NAMES 0xF010=DFFCLIENTANCHOR,DFFCLIENTDATA,DFFCONNECTORRULE,DFFALIGNRULE,DFFARCRULE,DFFCLIENTRULE,DFFCLASSID,DFFCALLOUTRULE # 0xF018-0xF117 reserved for pictures 0xF118=DFFREGROUPITEM,DFFSELECTION,DFFCOLORMRU,,,DFFDELETEDPSPL,DFFSPLITMENUCOLORS,DFFOLEOBJECT - 0xF120=DFFCOLORSCHEME,,DFFUSERDEFPROP + 0xF120=DFFCOLORSCHEME,DFFOPT2,DFFOPT3 end combilist=DFF-RECORD-INST @@ -25,13 +25,60 @@ constlist=DFF-RECORD-VERSION 15=container end -# DFFBSTORECONTAINER --------------------------------------------------------- +combilist=DFF-SIMPLE-COLOR + 0x000000FF=uint8,dec,red,,filter=0x10000000~0x00000000 + 0x0000FF00=uint8,dec,green,,filter=0x10000000~0x00000000 + 0x00FF0000=uint8,dec,blue,,filter=0x10000000~0x00000000 + 0x000000FF=uint8,dec,scheme-idx,,filter=0x10000000~0x10000000 + 0x10000000=!rgb!scheme + ignore=0x08000000 +end -combilist=DFFBSTORECONT-RECORD-INST - include=DFF-RECORD-INST - 0xFFF0=uint16,dec,blip-count +combilist=DFF-COLOR + 0x0000FFFF=uint16,dec,palette-idx,,filter=0xFF000000~0x01000000 + 0x000000FF=uint8,dec,red,,filter=0xF9000000~0x00000000 + 0x0000FF00=uint8,dec,green,,filter=0xF9000000~0x00000000 + 0x00FF0000=uint8,dec,blue,,filter=0xF9000000~0x00000000 + 0x000000FF=uint8,dec,scheme-idx,,filter=0xFF000000~0x08000000 + 0x0000FFFF=uint16,dec,system-idx,DFF-SYSTEMCOLOR,filter=0xFF000000~0x10000000 + 0x00FF0000=uint16,dec,mod-by,,filter=0xFF000000~0x10000000 + 0x01000000=palette-idx + 0x02000000=palette-rgb + 0x04000000=system-rgb + 0x08000000=scheme-idx + 0x10000000=system-idx +end + +combilist=DFF-SYSTEMCOLOR + 0x00FF=uint8,dec,color-id,DFF-SYSTEMCOLOR-ID + 0x0F00=uint8,dec,mod,DFF-SYSTEMCOLOR-MOD + 0x2000=invert-after + 0x4000=half-invert-after + 0x8000=grey-before +end + +constlist=DFF-SYSTEMCOLOR-ID + include=SYSTEMCOLOR + 0xF0=shape-fill + 0xF1=shape-line-or-fill + 0xF2=shape-line + 0xF3=shape-shadow + 0xF4=current-or-last-used + 0xF5=shape-fill-back + 0xF6=shape-line-back + 0xF7=shape-fill-or-line +end + +shortlist=DFF-SYSTEMCOLOR-MOD,0,none,darken-by,lighten-by,add-grey-by,sub-grey-by,reverse-sub-grey-by,monochrome-by + +combilist=DFF-COLORMOD + 0x00000300=uint8,dec,type,DFF-COLORMOD-TYPE + 0x00FF0000=uint8,dec,level + ignore=0x200000FF end +shortlist=DFF-COLORMOD-TYPE,0,none,shade,tint + # DFFBSE --------------------------------------------------------------------- combilist=DFFBSE-RECORD-INST @@ -46,50 +93,18 @@ end shortlist=DFFBSE-USAGE,0,default,texture -# DFFSP ---------------------------------------------------------------------- +# DFFBSTORECONTAINER --------------------------------------------------------- -combilist=DFFSP-RECORD-INST +combilist=DFFBSTORECONT-RECORD-INST include=DFF-RECORD-INST - 0xFFF0=uint16,dec,shape-type,DFFSP-TYPE + 0xFFF0=uint16,dec,blip-count end -multilist=DFFSP-TYPE - 0=not-primitive,rectangle,round-rectangle,ellipse,diamond,isoceles-triangle,right-triangle,parallelogram,trapezoid,hexagon - 10=octagon,plus,star,arrow,thick-arrow,home-plate,cube,balloon,seal,arc - 20=line,plaque,can,donut,text-simple,text-octagon,text-hexagon,text-curve,text-wave,text-ring - 30=text-on-curve,text-on-ring,straight-connector-1,bent-connector-2,bent-connector-3,bent-connector-4,bent-connector-5,curved-connector-2,curved-connector-3,curved-connector-4 - 40=curved-connector-5,callout-1,callout-2,callout-3,accent-callout-1,accent-callout-2,accent-callout-3,border-callout-1,border-callout-2,border-callout-3 - 50=accent-border-callout-1,accent-border-callout-2,accent-border-callout-3,ribbon,ribbon-2,chevron,pentagon,no-smoking,seal-8,seal-16 - 60=seal-32,wedge-rect-callout,wedge-rrect-callout,wedge-ellipse-callout,wave,folded-corner,left-arrow,down-arrow,up-arrow,left-right-arrow - 70=up-down-arrow,irregular-seal-1,irregular-seal-2,lightning-bolt,heart,picture-frame,quad-arrow,left-arrow-callout,right-arrow-callout,up-arrow-callout - 80=down-arrow-callout,left-right-arrow-callout,up-down-arrow-callout,quad-arrow-callout,bevel,left-bracket,right-bracket,left-brace,right-brace,left-up-arrow - 90=bent-up-arrow,bent-arrow,seal-24,striped-right-arrow,notched-right-arrow,block-arc,smiley-face,vertical-scroll,horizontal-scroll,circular-arrow - 100=notched-circular-arrow,uturn-arrow,curved-right-arrow,curved-left-arrow,curved-up-arrow,curved-down-arrow,cloud-callout,ellipse-ribbon,ellipse-ribbon-2,flow-chart-process - 110=flow-chart-decision,flow-chart-input-output,flow-chart-predefined-process,flow-chart-internal-storage,flow-chart-document,flow-chart-multidocument,flow-chart-terminator,flow-chart-preparation,flow-chart-manual-input,flow-chart-manual-operation - 120=flow-chart-connector,flow-chart-punched-card,flow-chart-punched-tape,flow-chart-summing-junction,flow-chart-or,flow-chart-collate,flow-chart-sort,flow-chart-extract,flow-chart-merge,flow-chart-offline-storage - 130=flow-chart-online-storage,flow-chart-magnetic-tape,flow-chart-magnetic-disk,flow-chart-magnetic-drum,flow-chart-display,flow-chart-delay,text-plain-text,text-stop,text-triangle,text-triangle-inverted - 140=text-chevron,text-chevron-inverted,text-ring-inside,text-ring-outside,text-arch-up-curve,text-arch-down-curve,text-circle-curve,text-button-curve,text-arch-up-pour,text-arch-down-pour - 150=text-circle-pour,text-button-pour,text-curve-up,text-curve-down,text-cascade-up,text-cascade-down,text-wave-1,text-wave-2,text-wave-3,text-wave-4 - 160=text-inflate,text-deflate,text-inflate-bottom,text-deflate-bottom,text-inflate-top,text-deflate-top,text-deflate-inflate,text-deflate-inflate-deflate,text-fade-right,text-fade-left - 170=text-fade-up,text-fade-down,text-slant-up,text-slant-down,text-can-up,text-can-down,flow-chart-alternate-process,flow-chart-offpage-connector,callout-90,accent-callout-90 - 180=border-callout-90,accent-border-callout-90,left-right-up-arrow,sun,moon,bracket-pair,brace-pair,seal-4,double-wave,action-button-blank - 190=action-button-home,action-button-help,action-button-information,action-button-forward-next,action-button-back-previous,action-button-end,action-button-beginning,action-button-return,action-button-document,action-button-sound - 200=action-button-movie,host-control,text-box -end +# DFFDG ---------------------------------------------------------------------- -flagslist=DFFSP-FLAGS - 0x00000001=group - 0x00000002=child - 0x00000004=patriarch - 0x00000008=deleted - 0x00000010=ole - 0x00000020=has-master - 0x00000040=flip-horizontal - 0x00000080=flip-vertical - 0x00000100=connector - 0x00000200=has-anchor - 0x00000400=background - 0x00000800=has-shape-type +combilist=DFFDG-RECORD-INST + include=DFF-RECORD-INST + 0xFFF0=uint16,dec,drawing-id end # DFFOPT --------------------------------------------------------------------- @@ -106,205 +121,530 @@ combilist=DFFOPT-PROPERTY-ID end multilist=DFFOPT-PROPERTY-NAMES - # transform - 0x0004=rotation - # protection - 0x007F=lock-flags - # text + # 0x0000-0x003F: transformation + 0x0000=transf-left,transf-top,transf-right,transf-bottom,transf-rotation,transf-page + 0x003F=transf-flags + # 0x0040-0x007F: protection + 0x007F=prot-flags + # 0x0080-0x00BF: text 0x0080=text-id,text-left,text-top,text-right,text-bottom,text-wrap-mode,text-scale,text-anchor-mode - 0x0088=text-flow,text-font-rotation,text-next-shape,text-bidi + 0x0088=text-flow,text-font-orient,text-next-shape,text-bidi 0x00BF=text-flags - # text geometry - 0x00C0=text-unicode-string,text-rtf-string,text-curve-align,text-def-size,text-spacing,text-font-family - 0x00FF=text-geometry-flags - # picture - 0x0100=pic-crop-top,pic-crop-bottom,pic-crop-left,pic-crop-right,pic-data,pic-file-name,pic-flags,pic-transparency-color - 0x0108=pic-contrast,pic-brightness,pic-gamma,pic-id,pic-double-cr-mod,pic-fill-cr-mod,pic-line-cr-mod,pic-data-print - 0x0110=pic-name-print,pic-flags-print - 0x013F=pic-flags - # geometry + # 0x00C0-0x00FF: text geometry + 0x00C0=textgeo-unicode-string,textgeo-rtf-string,textgeo-curve-align,textgeo-def-size,textgeo-spacing,textgeo-font,textgeo-css-font + 0x00FF=textgeo-flags + # 0x0100-0x013F: picture (BLIP) + 0x0100=blip-crop-top,blip-crop-bottom,blip-crop-left,blip-crop-right,blip-id,blip-name,blip-opt,blip-transparency-color + 0x0108=blip-contrast,blip-brightness,blip-gamma,blip-ole-id,blip-double-cr-mod,blip-fill-cr-mod,blip-line-cr-mod,blip-print-id + 0x0110=blip-print-name,blip-print-opt,blip-movie,,,blip-transparency-color-ext,,blip-transparency-color-ext-mod + 0x0118,,blip-recolor,blip-recolor,blip-recolor-ext,,blip-recolor-ext-mod + 0x013F=blip-flags + # 0x0140-0x017F: shape geometry 0x0140=geo-left,geo-top,geo-right,geo-bottom,geo-shape-path,geo-vertices,geo-segment-info,geo-adjust-1 - 0x0148=geo-adjust-2,geo-adjust-3,geo-adjust-4,geo-adjust-5,geo-adjust-6,geo-adjust-7,geo-adjust-8,geo-adjust-9 - 0x0150=geo-adjust-10,geo-connect-points,geo-stretch-x,geo-stretch-y,geo-handles,geo-formulas,geo-text-recs - 0x0158=geo-connector-type + 0x0148=geo-adjust-2,geo-adjust-3,geo-adjust-4,geo-adjust-5,geo-adjust-6,geo-adjust-7,geo-adjust-8, + 0x0150=,geo-connect-sites,geo-connect-sites-dir,geo-stretch-x,geo-stretch-y,geo-handles,geo-guides,geo-inscribe + 0x0158=geo-connect-points 0x017F=geo-flags - # fill style + # 0x0180-0x01BF: fill style 0x0180=fill-type,fill-color,fill-opacity,fill-back-color,fill-back-opacity,fill-cr-mod,fill-blip,fill-blip-name - 0x0188=fill-blip-flags,fill-width,fill-height,fill-angle,fill-focus,fill-to-left,fill-to-top,fill-to-right + 0x0188=fill-blip-opt,fill-width,fill-height,fill-angle,fill-focus,fill-to-left,fill-to-top,fill-to-right 0x0190=fill-to-bottom,fill-rect-left,fill-rect-top,fill-rect-right,fill-rect-bottom,fill-dz-type,fill-shade-preset,fill-shade-colors - 0x0198=fill-origin-x,fill-origin-y,fill-shape-origin-x,fill-shape-origin-y,fill-shade-type + 0x0198=fill-origin-x,fill-origin-y,fill-shape-origin-x,fill-shape-origin-y,fill-shade-type,,fill-color-ext, + 0x01A0=fill-color-ext-mod,,fill-back-color-ext,,fill-back-color-ext-mod 0x01BF=fill-flags - # line style - 0x01C0=line-color,line-opacity,line-back-color,line-cr-mod,line-type,line-fill-blip,line-fill-blip-name,line-fill-blip-flags + # 0x01C0-0x01FF: line style + 0x01C0=line-color,line-opacity,line-back-color,line-cr-mod,line-type,line-fill-blip,line-fill-blip-name,line-fill-blip-opt 0x01C8=line-fill-width,line-fill-height,line-fill-dz-type,line-width,line-miter-limit,line-style,line-dash,line-dash-style 0x01D0=line-start-arrow-head,line-end-arrow-head,line-start-arrow-width,line-start-arrow-length,line-end-arrow-width,line-end-arrow-length,line-join-style,line-end-cap-style + 0x01D8=,line-color-ext,,line-color-ext-mod,,line-back-color-ext,,line-back-color-ext-mod 0x01FF=line-flags - # shadow style + # 0x0200-0x023F: shadow style 0x0200=shadow-type,shadow-color,shadow-highlight,shadow-cr-mod,shadow-opacity,shadow-offset-x,shadow-offset-y,shadow-2nd-offset-x - 0x0208=shadow-2nd-offset-y,shadow-scale-x-to-x,shadow-scale-y-to-x,shadow-scale-x-to-y,shadow-scale-y-to-y,shadow-persp-x,shadow-persp-y,shadow-weight - 0x0210=shadow-origin-x,shadow-origin-y + 0x0208=shadow-2nd-offset-y,,,,,,, + 0x0210=shadow-origin-x,shadow-origin-y,shadow-color-ext,,shadow-color-ext-mod,,shadow-highlight-ext, + 0x0218=shadow-highlight-ext-mod 0x023F=shadow-flags - # perspective + # 0x0240-0x027F: perspective 0x0240=persp-type,persp-offset-x,persp-offsety,persp-scale-x-to-x,persp-scale-y-to-x,persp-scale-x-to-y,persp-scale-y-to-y,persp-persp-x 0x0248=persp-persp-y,persp-weight,persp-origin-x,persp-origin-y 0x027F=persp-flags - # 3d object + # 0x0280-0x02BF: 3d object 0x0280=3dobj-specular-amt,3dobj-diffuse-amt,3dobj-shininess,3dobj-edge-thickness,3dobj-extrude-forward,3dobj-extrude-backward,3dobj-extrude-plane,3dobj-extrusion-color - 0x0288=3dobj-cr-mod + 0x0288=3dobj-cr-mod,3dobj-extrusion-color-ext,,3dobj-extrusion-color-ext-mod 0x02BF=3dobj-flags - # 3d style + # 0x02C0-0x02FF: 3d style 0x02C0=3dstyle-y-rotation,3dstyle-x-rotation,3dstyle-rotation-axis-x,3dstyle-rotation-axis-y,3dstyle-rotation-axis-z,3dstyle-rotation,3dstyle-rotation-center-x,3dstyle-rotation-center-y 0x02C8=3dstyle-rotation-center-z,3dstyle-render-mode,3dstyle-tolerance,3dstyle-view-point-x,3dstyle-view-point-y,3dstyle-view-point-z,3dstyle-origin-x,3dstyle-origin-y 0x02D0=3dstyle-skew-angle,3dstyle-skew-amount,3dstyle-ambient-intensity,3dstyle-key-light-x,3dstyle-key-light-y,3dstyle-key-light-z,3dstyle-key-light-intensity,3dstyle-fill-light-x 0x02D8=3dstyle-fill-light-y,3dstyle-fill-light-z,3dstyle-fill-light-intensity 0x02FF=3dstyle-flags - # shape 1 - 0x0301=,shape-master,,shape-connect-style,shape-bw-mod,shape-bw-mode-pure-bw,shape-bw-mode-bw - 0x033F=shape1-flags - # callout - 0x0340=callout-type,callout-box-distance,callout-angle,callout-drop-type,callout-drop-distance,callout-length + # 0x0300-0x033F: shape + 0x0300=,shape-master,,shape-connect-style,shape-bw-mod,shape-bw-mode-pure-bw,shape-bw-mode-bw,shape-discuss-anchor-id + 0x0308=,shape-dia-layout,shape-dia-node-kind,shape-dia-layout-mru,shape-equation-xml + 0x033F=shape-flags + # 0x0340-0x037F: callout + 0x0340=callout-type,callout-box-distance,callout-angle,callout-drop-type,callout-drop-pos,callout-length 0x037F=callout-flags - # shape 2 - 0x0380=shape-name,shape-description,shape-hyperlink,shape-wrap-polygon-vertices,shape-wrap-left,shape-wrap-top,shape-wrap-right,shape-wrap-bottom - 0x0388=shape-regroup-id - 0x03BF=shape2-flags + # 0x0380-0x03BF: group or shape + 0x0380=group-name,group-description,group-hyperlink,group-wrap-polygon-vertices,group-wrap-left,group-wrap-top,group-wrap-right,group-wrap-bottom + 0x0388=group-regroup-id,,,,,group-tooltip,group-script,group-pos-h + 0x0390=group-pos-rel-h,group-pos-v,group-pos-rel-v,group-rel-width-hr,group-align-hr,group-height-hr,group-width-hr,group-script-ext-attr + 0x0398=group-script-lang,,group-script-lang-attr,group-border-top-color,group-border-left-color,group-border-bottom-color,group-border-right-color,group-table-props + 0x03A0=group-table-row-props,,,,,group-web-bot,, + 0x03A8=,group-metro-blob,group-rel-z-order, + 0x03BF=group-flags + # 0x03C0-0x03FF: relative transformation + 0x03C0=reltransf-left,reltransf-top,reltransf-right,reltransf-bottom,reltransf-rotation,reltransf-page + 0x03FF=reltransf-flags + # 0x0400-0x043F: unknown HTML + 0x0400=,,uhtml-line-id,uhtml-fill-id,uhtml-pic-id,uhtml-path-id,uhtml-shadow-id,uhtml-persp-id + 0x0408=uhtml-text-path-id,uhtml-formulae-id,uhtml-handles-id,uhtml-callout-id,uhtml-lock-id,uhtml-text-id,uhtml-3d-id + 0x043F=uhtml-flags + # 0x0500-0x053F: diagram + 0x0500=dia-type,dia-style,,,dia-rel-table,dia-scale-x,dia-scale-y,dia-def-fontsize + 0x0508=dia-constrain-bounds,dia-base-text-scale + 0x053F=dia-flags + # 0x0540-0x057F: left line style + 0x0540=lline-color,lline-opacity,lline-back-color,lline-cr-mod,lline-type,lline-fill-blip,lline-fill-blip-name,lline-fill-blip-opt + 0x0548=lline-fill-width,lline-fill-height,lline-fill-dz-type,lline-width,lline-miter-limit,lline-style,lline-dash,lline-dash-style + 0x0550=lline-start-arrow-head,lline-end-arrow-head,lline-start-arrow-width,lline-start-arrow-length,lline-end-arrow-width,lline-end-arrow-length,lline-join-style,lline-end-cap-style + 0x0558=,lline-color-ext,,lline-color-ext-mod,,lline-back-color-ext,,lline-back-color-ext-mod + 0x057F=lline-flags + # 0x0580-0x05BF: top line style + 0x0580=tline-color,tline-opacity,tline-back-color,tline-cr-mod,tline-type,tline-fill-blip,tline-fill-blip-name,tline-fill-blip-opt + 0x0588=tline-fill-width,tline-fill-height,tline-fill-dz-type,tline-width,tline-miter-limit,tline-style,tline-dash,tline-dash-style + 0x0590=tline-start-arrow-head,tline-end-arrow-head,tline-start-arrow-width,tline-start-arrow-length,tline-end-arrow-width,tline-end-arrow-length,tline-join-style,tline-end-cap-style + 0x0598=,tline-color-ext,,tline-color-ext-mod,,tline-back-color-ext,,tline-back-color-ext-mod + 0x05BF=tline-flags + # 0x05C0-0x05FF: right line style + 0x05C0=rline-color,rline-opacity,rline-back-color,rline-cr-mod,rline-type,rline-fill-blip,rline-fill-blip-name,rline-fill-blip-opt + 0x05C8=rline-fill-width,rline-fill-height,rline-fill-dz-type,rline-width,rline-miter-limit,rline-style,rline-dash,rline-dash-style + 0x05D0=rline-start-arrow-head,rline-end-arrow-head,rline-start-arrow-width,rline-start-arrow-length,rline-end-arrow-width,rline-end-arrow-length,rline-join-style,rline-end-cap-style + 0x05D8=,rline-color-ext,,rline-color-ext-mod,,rline-back-color-ext,,rline-back-color-ext-mod + 0x05FF=rline-flags + # 0x0600-0x063F: bottom line style + 0x0600=bline-color,bline-opacity,bline-back-color,bline-cr-mod,bline-type,bline-fill-blip,bline-fill-blip-name,bline-fill-blip-opt + 0x0608=bline-fill-width,bline-fill-height,bline-fill-dz-type,bline-width,bline-miter-limit,bline-style,bline-dash,bline-dash-style + 0x0610=bline-start-arrow-head,bline-end-arrow-head,bline-start-arrow-width,bline-start-arrow-length,bline-end-arrow-width,bline-end-arrow-length,bline-join-style,bline-end-cap-style + 0x0618=,bline-color-ext,,bline-color-ext-mod,,bline-back-color-ext,,bline-back-color-ext-mod + 0x063F=bline-flags + # 0x0680-0x06BF: web component + 0x0680=webcomp-html,webcomp-name,webcomp-url + 0x06BF=webcomp-flags + # 0x0700-0x073F: ink data + 0x0700=ink-data + 0x073F=ink-flags + # 0x0780-0x07BF: signature line + 0x0780=,sigline-guid,sigline-provider-guid,sigline-suggested-signer,sigline-suggested-signer-info,sigline-suggested-signer-email,sigline-sign-instruction,sigline-add-xml + 0x0788=sigline-provider-url + 0x07BF=sigline-flags + # 0x07C0-0x07FF: group or shape #2 + 0x07C0=group2-rel-width,group2-rel-height,group2-rel-pos-x,group2-rel-pos-y,group2-size-rel-h,group2-size-rel-v +end + +constlist=DFFOPT-SIMPLE-PROPERTIES + # transformation + 0x003F=uint32,hex,flags,DFFOPT-TRANSFORM-FLAGS + # protection + 0x007F=uint32,hex,flags,DFFOPT-PROTECTION-FLAGS + # text + 0x00BF=uint32,hex,flags,DFFOPT-TEXT-FLAGS + # text geometry + 0x00FF=uint32,hex,flags,DFFOPT-TEXTGEO-FLAGS + # picture (BLIP) + 0x013F=uint32,hex,flags,DFFOPT-BLIP-FLAGS + # shape geometry + 0x017F=uint32,hex,flags,DFFOPT-GEO-FLAGS + # fill style + 0x0180=uint32,dec,type,DFFOPT-FILL-TYPE + 0x0181=uint32,hex,color,DFF-COLOR + 0x0182=int32,fix,opacity,CONV-FLOAT-TO-PERC + 0x0183=uint32,hex,color,DFF-COLOR + 0x0184=int32,fix,opacity,DFF-OPACITY + 0x0185=uint32,hex,color,DFF-COLOR + 0x0186=uint32,dec,blip-id + 0x0188=uint32,dec,blip-opt,DFFOPT-BLIPOPT + 0x0189=int32,dec,width + 0x018A=int32,dec,height + 0x018B=int32,fix,angle,CONV-DEG + 0x018C=int32,dec,focus,CONV-PERCENT + 0x018D=int32,fix,size,CONV-FLOAT-TO-PERC + 0x018E=int32,fix,size,CONV-FLOAT-TO-PERC + 0x018F=int32,fix,size,CONV-FLOAT-TO-PERC + 0x0190=int32,fix,size,CONV-FLOAT-TO-PERC + 0x0191=int32,fix,size,CONV-EMU-TO-CM + 0x0192=int32,fix,size,CONV-EMU-TO-CM + 0x0193=int32,fix,size,CONV-EMU-TO-CM + 0x0194=int32,fix,size,CONV-EMU-TO-CM + 0x0195=uint32,dec,type,DFFOPT-FILL-DZTYPE + 0x0196=int32,dec,preset + 0x0198=int32,fix,pos,CONV-FLOAT-TO-PERC + 0x0199=int32,fix,pos,CONV-FLOAT-TO-PERC + 0x019A=int32,fix,pos,CONV-FLOAT-TO-PERC + 0x019B=int32,fix,pos,CONV-FLOAT-TO-PERC + 0x019C=uint32,hex,type,DFFOPT-FILL-SHADETYPE + 0x019E=uint32,hex,color,DFF-COLOR + 0x01A0=uint32,hex,color-mod,DFF-COLORMOD + 0x01A2=uint32,hex,color,DFF-COLOR + 0x01A4=uint32,hex,color-mod,DFF-COLORMOD + 0x01BF=uint32,hex,flags,DFFOPT-FILL-FLAGS + # line style + 0x01C0=uint32,hex,color,DFF-COLOR + 0x01C2=uint32,hex,color,DFF-COLOR + 0x01FF=uint32,hex,flags,DFFOPT-LINE-FLAGS + # shadow style + 0x0201=uint32,hex,color,DFF-COLOR + 0x023F=uint32,hex,flags,DFFOPT-SHADOW-FLAGS + # perspective + 0x027F=uint32,hex,flags,DFFOPT-PERSP-FLAGS + # 3d object + 0x02BF=uint32,hex,flags,DFFOPT-3DOBJ-FLAGS + # 3d style + 0x02FF=uint32,hex,flags,DFFOPT-3DSTYLE-FLAGS + # shape + 0x033F=uint32,hex,flags,DFFOPT-SHAPE-FLAGS + # callout + 0x037F=uint32,hex,flags,DFFOPT-CALLOUT-FLAGS + # group or shape + 0x03BF=uint32,hex,flags,DFFOPT-GROUP-FLAGS + # relative transformation + 0x03FF=uint32,hex,flags,DFFOPT-TRANSFORM-FLAGS + # unknown HTML + 0x043F=uint32,hex,flags,DFFOPT-UHTML-FLAGS + # diagram + 0x053F=uint32,hex,flags,DFFOPT-DIAGRAM-FLAGS + # left line style + 0x0540=uint32,hex,color,DFF-COLOR + 0x0542=uint32,hex,color,DFF-COLOR + 0x057F=uint32,hex,flags,DFFOPT-LINE-FLAGS + # top line style + 0x0580=uint32,hex,color,DFF-COLOR + 0x0582=uint32,hex,color,DFF-COLOR + 0x05BF=uint32,hex,flags,DFFOPT-LINE-FLAGS + # right line style + 0x05C0=uint32,hex,color,DFF-COLOR + 0x05C2=uint32,hex,color,DFF-COLOR + 0x05FF=uint32,hex,flags,DFFOPT-LINE-FLAGS + # bottom line style + 0x0600=uint32,hex,color,DFF-COLOR + 0x0602=uint32,hex,color,DFF-COLOR + 0x063F=uint32,hex,flags,DFFOPT-LINE-FLAGS + # web component + 0x06BF=uint32,hex,flags,DFFOPT-WEBCOMP-FLAGS + # ink data + 0x073F=uint32,hex,flags,DFFOPT-INK-FLAGS + # signature line + 0x07BF=uint32,hex,flags,DFFOPT-SIGLINE-FLAGS + # group or shape #2 +end + +constlist=DFFOPT-COMPLEX-PROPERTIES + 0x0186=uint32,hex,blip,blip + 0x0187=uint32,hex,blip-name,string + 0x0197=uint32,hex,shade-colors,colorarray + 0x0380=uint32,hex,shape-name,string +end + +# common + +combilist=DFFOPT-BLIPOPT + 0x00000003=uint8,dec,type,DFFOPT-BLIPOPT-TYPE + 0x00000004=do-not-save + 0x00000008=linked +end + +shortlist=DFFOPT-BLIPOPT-TYPE,0,comment,file,url + +# transformation + +flagslist=DFFOPT-TRANSFORM-FLAGS + 0x0001=:flip-h + 0x0002=:flip-v end -flagslist=DFFOPT-LOCK-FLAGS - 0x00000001=lock-against-grouping - 0x00000002=lock-adjust-handles - 0x00000004=lock-text - 0x00000008=lock-vertices - 0x00000010=lock-cropping - 0x00000020=lock-against-select - 0x00000040=lock-position - 0x00000080=lock-aspect-ratio - 0x00000100=lock-rotation - ignore=0xFFFF0000 +# protection + +flagslist=DFFOPT-PROTECTION-FLAGS + 0x0001=:lock-against-grouping + 0x0002=:lock-adjust-handles + 0x0004=:lock-text + 0x0008=:lock-vertices + 0x0010=:lock-cropping + 0x0020=:lock-against-select + 0x0040=:lock-position + 0x0080=:lock-aspect-ratio + 0x0100=:lock-rotation + 0x0200=:lock-against-ungrouping end +# text + flagslist=DFFOPT-TEXT-FLAGS - 0x00000001=fit-text-to-shape - 0x00000002=fit-shape-to-text - 0x00000004=rotate-text - 0x00000008=auto-text-margin - 0x00000010=select-text - ignore=0xFFFF0000 + 0x0002=:fit-shape-to-text + 0x0008=:auto-text-margin + 0x0010=:select-text + ignore=0x0005 end +# text geometry + flagslist=DFFOPT-TEXTGEO-FLAGS - 0x00000001=strike-through - 0x00000002=small-caps - 0x00000004=shadow - 0x00000008=underline - 0x00000010=italic - 0x00000020=bold - 0x00000040=no-measure-along-path - 0x00000080=stretch-height - 0x00000100=scale-on-path - 0x00000200=shrink-to-fit - 0x00000400=stretch-to-fit - 0x00000800=tightening - 0x00001000=kerning - 0x00002000=vertical - 0x00004000=has-effect - 0x00008000=reverse-rows - ignore=0xFFFF0000 -end - -flagslist=DFFOPT-PICTURE-FLAGS - 0x00000001=ole-alive - 0x00000002=bi-level-display - 0x00000004=grayscale - 0x00000008=no-hit-test - ignore=0xFFFF0000 + 0x0001=:strike-through + 0x0002=:small-caps + 0x0004=:shadow + 0x0008=:underline + 0x0010=:italic + 0x0020=:bold + 0x0040=:no-measure-along-path + 0x0080=:normalize + 0x0100=:best-fit + 0x0200=:shrink-to-fit + 0x0400=:stretch-to-fit + 0x0800=:tightening + 0x1000=:kerning + 0x2000=:vertical + 0x4000=:has-effect + 0x8000=:reverse-rows +end + +# picture (BLIP) + +flagslist=DFFOPT-BLIP-FLAGS + 0x0001=:ole-alive + 0x0002=:bi-level-display + 0x0004=:grayscale + 0x0008=:no-hit-test + 0x0010=:loop-anim + 0x0020=:rewind-anim + 0x0040=:preserve-gray end +# shape geometry + flagslist=DFFOPT-GEO-FLAGS - 0x00000001=fill-support - 0x00000002=fill-shade-shape-support - 0x00000004=fontwork-support - 0x00000008=line-support - 0x00000010=3d-support - 0x00000020=shadow-support - ignore=0xFFFF0000 + 0x0001=:fill-support + 0x0002=:fill-shade-shape-support + 0x0004=:fontwork-support + 0x0008=:line-support + 0x0010=:3d-support + 0x0020=:shadow-support +end + +# fill style + +shortlist=DFFOPT-FILL-TYPE,0,solid,pattern,texture,picture,edge-shade,linear-shade,shape-shade,point-shade,title-shade,background + +combilist=DFFOPT-FILL-DZTYPE + 0x00000003=uint8,dec,unit,DFFOPT-FILL-DZTYPE-UNIT + 0x0000000C=uint8,dec,aspect,DFFOPT-FILL-DZTYPE-ASPECT +end + +shortlist=DFFOPT-FILL-DZTYPE-UNIT,0,unused,emu,pixel,shape-size-rel +shortlist=DFFOPT-FILL-DZTYPE-ASPECT,0,none,fixed,prefer-largest + +flagslist=DFFOPT-FILL-SHADETYPE + 0x00000001=none + 0x00000002=gamma + 0x00000004=sigma-transfer + 0x00000008=flat-band + 0x00000010=one-color end flagslist=DFFOPT-FILL-FLAGS - 0x00000001=no-fill-hit-test - 0x00000002=use-large-rect - 0x00000004=register-pattern - 0x00000008=hit-test-fill - 0x00000010=has-fill - ignore=0xFFFF0000 + 0x0001=:no-fill-hit-test + 0x0002=:fill-to-rect + 0x0004=:fill-rel-to-shape + 0x0008=:hit-test-fill + 0x0010=:has-fill + 0x0020=:shape-anchor + 0x0040=:recolor-as-pic end +# line style + flagslist=DFFOPT-LINE-FLAGS - 0x00000001=draw-dash-for-invisible - 0x00000002=register-pattern - 0x00000004=hit-test-line - 0x00000008=has-line - 0x00000010=arrowhead-support - ignore=0xFFFF0000 + 0x0001=:draw-dash-for-invisible + 0x0002=:fill-rel-to-shape + 0x0004=:hit-test-line + 0x0008=:has-line + 0x0010=:arrowhead-support + 0x0020=:inset-pen-support + 0x0040=:inset-pen + 0x0200=:opaque-back-line end +# shadow style + flagslist=DFFOPT-SHADOW-FLAGS - 0x00000001=excel5-style - 0x00000002=has-shadow - ignore=0xFFFF0000 + 0x0001=:obscured-shadow + 0x0002=:has-shadow end +# perspective + flagslist=DFFOPT-PERSP-FLAGS - 0x00000001=has-perspective - ignore=0xFFFF0000 + 0x0001=:has-perspective end +# 3d object + flagslist=DFFOPT-3DOBJ-FLAGS - 0x00000001=light-face - 0x00000002=extrusion-color - 0x00000004=metallic - 0x00000008=has-3d - ignore=0xFFFF0000 + 0x0001=:light-face + 0x0002=:extrusion-color + 0x0004=:metallic + 0x0008=:has-3d end +# 3d style + flagslist=DFFOPT-3DSTYLE-FLAGS - 0x00000001=fill-color-harsh - 0x00000002=key-color-harsh - 0x00000004=parallel - 0x00000008=rotation-center-auto - 0x00000010=constrain-rotation - ignore=0xFFFF0000 + 0x0001=:fill-color-harsh + 0x0002=:key-color-harsh + 0x0004=:parallel + 0x0008=:rotation-center-auto + 0x0010=:constrain-rotation end -flagslist=DFFOPT-SHAPE1-FLAGS - 0x00000001=background - 0x00000002=delete-attached-object - 0x00000008=lock-shape-type - 0x00000010=prefer-rel-resize - 0x00000020=ole-iconified - ignore=0xFFFF0000 +# shape + +flagslist=DFFOPT-SHAPE-FLAGS + 0x0001=:background + 0x0004=:initiator + 0x0008=:lock-shape-type + 0x0010=:prefer-rel-resize + 0x0020=:ole-iconified + 0x0040=:flip-v-override + 0x0080=:flip-h-override + 0x0100=:policy-barcode + 0x0200=:policy-label end +# callout + flagslist=DFFOPT-CALLOUT-FLAGS - 0x00000001=length-specified - 0x00000002=drop-auto - 0x00000004=minus-y - 0x00000008=minus-x - 0x00000010=has-text-border - 0x00000020=has-accent-bar - 0x00000040=is-callout - ignore=0xFFFF0000 -end - -flagslist=DFFOPT-SHAPE2-FLAGS - 0x00000001=print - 0x00000002=hidden - 0x00000004=1d-adjustment - 0x00000008=action-attached - 0x00000010=notify-double-click - 0x00000020=behind-text - 0x00000040=wrap-edited - ignore=0xFFFF0000 + 0x0001=:length-specified + 0x0002=:drop-auto + 0x0004=:minus-y + 0x0008=:minus-x + 0x0010=:has-text-border + 0x0020=:has-accent-bar + 0x0040=:is-callout +end + +# group or shape + +flagslist=DFFOPT-GROUP-FLAGS + 0x0001=:print + 0x0002=:hidden + 0x0004=:1d-adjustment + 0x0008=:is-button + 0x0010=:notify-double-click + 0x0020=:behind-doc + 0x0040=:wrap-edited + 0x0080=:script-anchor + 0x0100=:really-hidden + 0x0200=:allow-overlap + 0x0400=:user-drawn + 0x0800=:is-hr + 0x1000=:no-shade-hr + 0x2000=:standard-hr + 0x4000=:is-bullet + 0x8000=:layout-in-cell +end + +# unknown HTML + +flagslist=DFFOPT-UHTML-FLAGS + 0x0002=:fake-master + 0x0004=:ole-from-html +end + +# diagram + +flagslist=DFFOPT-DIAGRAM-FLAGS + 0x0001=:pseudo-inline + 0x0002=:do-layout + 0x0004=:reverse + 0x0008=:do-format +end + +# web component + +flagslist=DFFOPT-WEBCOMP-FLAGS + 0x0001=:is-web-component +end + +# ink data + +flagslist=DFFOPT-INK-FLAGS + 0x0001=:render-ink + 0x0002=:render-shape + 0x0004=:hit-test-ink + 0x0008=:ink-annotation +end + +# signature line + +flagslist=DFFOPT-SIGLINE-FLAGS + 0x0001=:is-signature-line + 0x0002=:show-sign-instruction + 0x0004=:show-sign-comment + 0x0008=:show-sign-date +end + +# group or shape #2 + +# DFFSP ---------------------------------------------------------------------- + +combilist=DFFSP-RECORD-INST + include=DFF-RECORD-INST + 0xFFF0=uint16,dec,shape-type,DFFSP-TYPE +end + +multilist=DFFSP-TYPE + 0=not-primitive,rectangle,round-rectangle,ellipse,diamond,isoceles-triangle,right-triangle,parallelogram,trapezoid,hexagon + 10=octagon,plus,star,arrow,thick-arrow,home-plate,cube,balloon,seal,arc + 20=line,plaque,can,donut,text-simple,text-octagon,text-hexagon,text-curve,text-wave,text-ring + 30=text-on-curve,text-on-ring,straight-connector-1,bent-connector-2,bent-connector-3,bent-connector-4,bent-connector-5,curved-connector-2,curved-connector-3,curved-connector-4 + 40=curved-connector-5,callout-1,callout-2,callout-3,accent-callout-1,accent-callout-2,accent-callout-3,border-callout-1,border-callout-2,border-callout-3 + 50=accent-border-callout-1,accent-border-callout-2,accent-border-callout-3,ribbon,ribbon-2,chevron,pentagon,no-smoking,seal-8,seal-16 + 60=seal-32,wedge-rect-callout,wedge-rrect-callout,wedge-ellipse-callout,wave,folded-corner,left-arrow,down-arrow,up-arrow,left-right-arrow + 70=up-down-arrow,irregular-seal-1,irregular-seal-2,lightning-bolt,heart,picture-frame,quad-arrow,left-arrow-callout,right-arrow-callout,up-arrow-callout + 80=down-arrow-callout,left-right-arrow-callout,up-down-arrow-callout,quad-arrow-callout,bevel,left-bracket,right-bracket,left-brace,right-brace,left-up-arrow + 90=bent-up-arrow,bent-arrow,seal-24,striped-right-arrow,notched-right-arrow,block-arc,smiley-face,vertical-scroll,horizontal-scroll,circular-arrow + 100=notched-circular-arrow,uturn-arrow,curved-right-arrow,curved-left-arrow,curved-up-arrow,curved-down-arrow,cloud-callout,ellipse-ribbon,ellipse-ribbon-2,flow-chart-process + 110=flow-chart-decision,flow-chart-input-output,flow-chart-predefined-process,flow-chart-internal-storage,flow-chart-document,flow-chart-multidocument,flow-chart-terminator,flow-chart-preparation,flow-chart-manual-input,flow-chart-manual-operation + 120=flow-chart-connector,flow-chart-punched-card,flow-chart-punched-tape,flow-chart-summing-junction,flow-chart-or,flow-chart-collate,flow-chart-sort,flow-chart-extract,flow-chart-merge,flow-chart-offline-storage + 130=flow-chart-online-storage,flow-chart-magnetic-tape,flow-chart-magnetic-disk,flow-chart-magnetic-drum,flow-chart-display,flow-chart-delay,text-plain-text,text-stop,text-triangle,text-triangle-inverted + 140=text-chevron,text-chevron-inverted,text-ring-inside,text-ring-outside,text-arch-up-curve,text-arch-down-curve,text-circle-curve,text-button-curve,text-arch-up-pour,text-arch-down-pour + 150=text-circle-pour,text-button-pour,text-curve-up,text-curve-down,text-cascade-up,text-cascade-down,text-wave-1,text-wave-2,text-wave-3,text-wave-4 + 160=text-inflate,text-deflate,text-inflate-bottom,text-deflate-bottom,text-inflate-top,text-deflate-top,text-deflate-inflate,text-deflate-inflate-deflate,text-fade-right,text-fade-left + 170=text-fade-up,text-fade-down,text-slant-up,text-slant-down,text-can-up,text-can-down,flow-chart-alternate-process,flow-chart-offpage-connector,callout-90,accent-callout-90 + 180=border-callout-90,accent-border-callout-90,left-right-up-arrow,sun,moon,bracket-pair,brace-pair,seal-4,double-wave,action-button-blank + 190=action-button-home,action-button-help,action-button-information,action-button-forward-next,action-button-back-previous,action-button-end,action-button-beginning,action-button-return,action-button-document,action-button-sound + 200=action-button-movie,host-control,text-box +end + +flagslist=DFFSP-FLAGS + 0x00000001=group + 0x00000002=child + 0x00000004=patriarch + 0x00000008=deleted + 0x00000010=ole + 0x00000020=has-master + 0x00000040=flip-horizontal + 0x00000080=flip-vertical + 0x00000100=connector + 0x00000200=has-anchor + 0x00000400=background + 0x00000800=has-shape-type +end + +# DFFSPLITMENUCOLORS --------------------------------------------------------- + +combilist=DFFSPLITMENUC-RECORD-INST + include=DFF-RECORD-INST + 0xFFF0=uint16,dec,color-count end # ============================================================================ diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index 6d834e04c487..8e0e9a4e1225 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -772,6 +772,14 @@ OUString StringHelper::trimSpaces( const OUString& rStr ) return rStr.copy( nBeg, nEnd - nBeg ); } +OUString StringHelper::trimTrailingNul( const OUString& rStr ) +{ + sal_Int32 nLastPos = rStr.getLength() - 1; + if( (nLastPos >= 0) && (rStr[ nLastPos ] == 0) ) + return rStr.copy( 0, nLastPos ); + return rStr; +} + OString StringHelper::convertToUtf8( const OUString& rStr ) { return OUStringToOString( rStr, RTL_TEXTENCODING_UTF8 ); @@ -888,6 +896,25 @@ bool StringHelper::convertStringToBool( const OUString& rData ) return convertStringToInt( nData, rData ) && (nData != 0); } +OUStringPair StringHelper::convertStringToPair( const OUString& rString, sal_Unicode cSep ) +{ + OUStringPair aPair; + if( rString.getLength() > 0 ) + { + sal_Int32 nEqPos = rString.indexOf( cSep ); + if( nEqPos < 0 ) + { + aPair.first = rString; + } + else + { + aPair.first = StringHelper::trimSpaces( rString.copy( 0, nEqPos ) ); + aPair.second = StringHelper::trimSpaces( rString.copy( nEqPos + 1 ) ); + } + } + return aPair; +} + void StringHelper::convertStringToStringList( OUStringVector& orVec, const OUString& rData, bool bIgnoreEmpty ) { orVec.clear(); @@ -1067,25 +1094,11 @@ ConfigItemBase::LineType ConfigItemBase::readConfigLine( } } - LineType eResult = LINETYPE_END; - if( aLine.getLength() > 0 ) - { - sal_Int32 nEqPos = aLine.indexOf( '=' ); - if( nEqPos < 0 ) - { - orKey = aLine; - } - else - { - orKey = StringHelper::trimSpaces( aLine.copy( 0, nEqPos ) ); - orData = StringHelper::trimSpaces( aLine.copy( nEqPos + 1 ) ); - } - - if( (orKey.getLength() > 0) && ((orData.getLength() > 0) || !orKey.equalsAscii( "end" )) ) - eResult = LINETYPE_DATA; - } - - return eResult; + OUStringPair aPair = StringHelper::convertStringToPair( aLine ); + orKey = aPair.first; + orData = aPair.second; + return ((orKey.getLength() > 0) && ((orData.getLength() > 0) || !orKey.equalsAscii( "end" ))) ? + LINETYPE_DATA : LINETYPE_END; } ConfigItemBase::LineType ConfigItemBase::readConfigLine( const ConfigInputStreamRef& rxStrm ) const @@ -1176,6 +1189,15 @@ void NameListBase::exclude( const OUString& rKeys ) // ============================================================================ +void ItemFormatMap::insertFormats( const NameListRef& rxNameList ) +{ + if( Base::isValid( rxNameList ) ) + for( NameListBase::const_iterator aIt = rxNameList->begin(), aEnd = rxNameList->end(); aIt != aEnd; ++aIt ) + (*this)[ aIt->first ].parse( aIt->second ); +} + +// ============================================================================ + ConstList::ConstList( const SharedConfigData& rCfgData ) : NameListBase( rCfgData ), maDefName( OOX_DUMP_ERR_NONAME ), @@ -1283,46 +1305,57 @@ void FlagsList::implProcessConfigItemStr( void FlagsList::implSetName( sal_Int64 nKey, const OUString& rName ) { - insertRawName( nKey, rName ); + if( (nKey != 0) && ((nKey & (nKey - 1)) == 0) ) // only a single bit set? + insertRawName( nKey, rName ); } OUString FlagsList::implGetName( const Config& /*rCfg*/, sal_Int64 nKey ) const { - sal_Int64 nFlags = nKey; - setFlag( nFlags, mnIgnore, false ); - sal_Int64 nFound = 0; + sal_Int64 nFound = mnIgnore; OUStringBuffer aName; // add known flags for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt ) { sal_Int64 nMask = aIt->first; - const OUString& rFlagName = aIt->second; - bool bNegated = (rFlagName.getLength() > 0) && (rFlagName[ 0 ] == '!'); - sal_Int32 nBothSep = bNegated ? rFlagName.indexOf( '!', 1 ) : -1; - bool bFlag = getFlag( nFlags, nMask ); - if( bFlag ) - { - if( !bNegated ) - StringHelper::appendToken( aName, rFlagName ); - else if( nBothSep > 0 ) - StringHelper::appendToken( aName, rFlagName.copy( nBothSep + 1 ) ); - } - else if( bNegated ) + setFlag( nFound, nMask ); + if( !getFlag( mnIgnore, nMask ) ) { - if( nBothSep > 0 ) - StringHelper::appendToken( aName, rFlagName.copy( 1, nBothSep - 1 ) ); - else + const OUString& rFlagName = aIt->second; + bool bOnOff = (rFlagName.getLength() > 0) && (rFlagName[ 0 ] == ':'); + bool bFlag = getFlag( nKey, nMask ); + if( bOnOff ) + { StringHelper::appendToken( aName, rFlagName.copy( 1 ) ); + aName.appendAscii( bFlag ? ":on" : ":off" ); + } + else + { + bool bNegated = (rFlagName.getLength() > 0) && (rFlagName[ 0 ] == '!'); + sal_Int32 nBothSep = bNegated ? rFlagName.indexOf( '!', 1 ) : -1; + if( bFlag ) + { + if( !bNegated ) + StringHelper::appendToken( aName, rFlagName ); + else if( nBothSep > 0 ) + StringHelper::appendToken( aName, rFlagName.copy( nBothSep + 1 ) ); + } + else if( bNegated ) + { + if( nBothSep > 0 ) + StringHelper::appendToken( aName, rFlagName.copy( 1, nBothSep - 1 ) ); + else + StringHelper::appendToken( aName, rFlagName.copy( 1 ) ); + } + } } - setFlag( nFound, nMask ); } // add unknown flags - setFlag( nFlags, nFound, false ); - if( nFlags != 0 ) + setFlag( nKey, nFound, false ); + if( nKey != 0 ) { OUStringBuffer aUnknown( CREATE_OUSTRING( OOX_DUMP_UNKNOWN ) ); aUnknown.append( OOX_DUMP_ITEMSEP ); - StringHelper::appendShortHex( aUnknown, nFlags, true ); + StringHelper::appendShortHex( aUnknown, nKey, true ); StringHelper::enclose( aUnknown, '(', ')' ); StringHelper::appendToken( aName, aUnknown.makeStringAndClear() ); } @@ -1342,6 +1375,11 @@ void FlagsList::implIncludeList( const NameListBase& rList ) // ============================================================================ +bool CombiList::ExtItemFormatKey::operator<( const ExtItemFormatKey& rRight ) const +{ + return (mnKey < rRight.mnKey) || ((mnKey == rRight.mnKey) && (maFilter < rRight.maFilter)); +} + CombiList::CombiList( const SharedConfigData& rCfgData ) : FlagsList( rCfgData ) { @@ -1351,9 +1389,34 @@ void CombiList::implSetName( sal_Int64 nKey, const OUString& rName ) { if( (nKey & (nKey - 1)) != 0 ) // more than a single bit set? { - ExtItemFormat& rItemFmt = maFmtMap[ nKey ]; - OUStringVector aRemain = rItemFmt.parse( rName ); - rItemFmt.mbShiftValue = aRemain.empty() || !aRemain.front().equalsAscii( "noshift" ); + typedef ::std::set< ExtItemFormatKey > ExtItemFormatKeySet; + ::std::set< ExtItemFormatKey > aItemKeys; + ExtItemFormat aItemFmt; + OUStringVector aRemain = aItemFmt.parse( rName ); + for( OUStringVector::iterator aIt = aRemain.begin(), aEnd = aRemain.end(); aIt != aEnd; ++aIt ) + { + OUStringPair aPair = StringHelper::convertStringToPair( *aIt ); + if( aPair.first.equalsAscii( "noshift" ) ) + { + aItemFmt.mbShiftValue = StringHelper::convertStringToBool( aPair.second ); + } + else if( aPair.first.equalsAscii( "filter" ) ) + { + OUStringPair aFilter = StringHelper::convertStringToPair( aPair.second, '~' ); + ExtItemFormatKey aKey( nKey ); + if( (aFilter.first.getLength() > 0) && StringHelper::convertStringToInt( aKey.maFilter.first, aFilter.first ) && + (aFilter.second.getLength() > 0) && StringHelper::convertStringToInt( aKey.maFilter.second, aFilter.second ) ) + { + if( aKey.maFilter.first == 0 ) + aKey.maFilter.second = 0; + aItemKeys.insert( aKey ); + } + } + } + if( aItemKeys.empty() ) + aItemKeys.insert( ExtItemFormatKey( nKey ) ); + for( ExtItemFormatKeySet::iterator aIt = aItemKeys.begin(), aEnd = aItemKeys.end(); aIt != aEnd; ++aIt ) + maFmtMap[ *aIt ] = aItemFmt; } else { @@ -1363,18 +1426,18 @@ void CombiList::implSetName( sal_Int64 nKey, const OUString& rName ) OUString CombiList::implGetName( const Config& rCfg, sal_Int64 nKey ) const { - sal_Int64 nFlags = nKey; sal_Int64 nFound = 0; OUStringBuffer aName; // add known flag fields for( ExtItemFormatMap::const_iterator aIt = maFmtMap.begin(), aEnd = maFmtMap.end(); aIt != aEnd; ++aIt ) { - sal_Int64 nMask = aIt->first; - if( nMask != 0 ) + const ExtItemFormatKey& rMapKey = aIt->first; + sal_Int64 nMask = rMapKey.mnKey; + if( (nMask != 0) && ((nKey & rMapKey.maFilter.first) == rMapKey.maFilter.second) ) { const ExtItemFormat& rItemFmt = aIt->second; - sal_uInt64 nUFlags = static_cast< sal_uInt64 >( nFlags ); + sal_uInt64 nUFlags = static_cast< sal_uInt64 >( nKey ); sal_uInt64 nUMask = static_cast< sal_uInt64 >( nMask ); if( rItemFmt.mbShiftValue ) while( (nUMask & 1) == 0 ) { nUFlags >>= 1; nUMask >>= 1; } @@ -1411,8 +1474,8 @@ OUString CombiList::implGetName( const Config& rCfg, sal_Int64 nKey ) const setFlag( nFound, nMask ); } } - setFlag( nFlags, nFound, false ); - StringHelper::appendToken( aName, FlagsList::implGetName( rCfg, nFlags ) ); + setFlag( nKey, nFound, false ); + StringHelper::appendToken( aName, FlagsList::implGetName( rCfg, nKey ) ); return aName.makeStringAndClear(); } @@ -2627,7 +2690,7 @@ sal_Unicode InputObjectBase::dumpUnicode( const String& rName ) return cChar; } -OUString InputObjectBase::dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc ) +OUString InputObjectBase::dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul ) { sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->getLength() - mxStrm->tell(), 0, nLen ); OUString aString; @@ -2638,16 +2701,20 @@ OUString InputObjectBase::dumpCharArray( const String& rName, sal_Int32 nLen, rt aBuffer[ nCharsRead ] = 0; aString = OStringToOUString( OString( &aBuffer.front() ), eTextEnc ); } + if( bHideTrailingNul ) + aString = StringHelper::trimTrailingNul( aString ); writeStringItem( rName( "text" ), aString ); return aString; } -OUString InputObjectBase::dumpUnicodeArray( const String& rName, sal_Int32 nLen ) +OUString InputObjectBase::dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul ) { OUStringBuffer aBuffer; for( sal_Int32 nIndex = 0; !mxStrm->isEof() && (nIndex < nLen); ++nIndex ) aBuffer.append( static_cast< sal_Unicode >( mxStrm->readuInt16() ) ); OUString aString = aBuffer.makeStringAndClear(); + if( bHideTrailingNul ) + aString = StringHelper::trimTrailingNul( aString ); writeStringItem( rName( "text" ), aString ); return aString; } @@ -3059,12 +3126,7 @@ bool RecordObjectBase::implIsValid() const void RecordObjectBase::implDump() { NameListRef xRecNames = getRecNames(); - - typedef ::std::map< sal_Int64, ItemFormat > ItemFormatMap; - ItemFormatMap aSimpleRecs; - if( NameListBase* pSimpleRecs = maSimpleRecs.getNameList( cfg() ).get() ) - for( NameListBase::const_iterator aIt = pSimpleRecs->begin(), aEnd = pSimpleRecs->end(); aIt != aEnd; ++aIt ) - aSimpleRecs[ aIt->first ].parse( aIt->second ); + ItemFormatMap aSimpleRecs( maSimpleRecs.getNameList( cfg() ) ); while( implStartRecord( *mxBaseStrm, mnRecPos, mnRecId, mnRecSize ) ) { diff --git a/oox/source/dump/dumperbase.ini b/oox/source/dump/dumperbase.ini index 99603e12e560..84d742c2b35f 100644 --- a/oox/source/dump/dumperbase.ini +++ b/oox/source/dump/dumperbase.ini @@ -164,7 +164,7 @@ show-record-position=0 # include = <LISTNAME>[,<LISTNAME>...] # exclude = <bitfield>[,<bitfield>...] # ignore = <bitfield> -# <bitmask> = <constname> | !<constname> | !<constname0>!<constname1> +# <bitmask> = <cname> | !<cname> | :<cname> | !<cname0>!<cname1> # end # # - include (optional): See constlist above. @@ -173,10 +173,14 @@ show-record-position=0 # name and not set in this declaration will be shown as unknown. Default is # to not ignore a bit. # - <bitmask>: The bit to be named. Must be a value with a single bit set. -# - <constname>: sets a name for the bit that will be shown if it is set. -# - !<constname>: sets a name for the bit that will be shown if it is cleared. -# - !<constname0>!<constname1>: sets a name for the cleared bit (constname0), -# and for the set bit (constname1). +# - <cname> - Sets a name for the bit that will be shown if the bit is set. +# Does not show anything if the bit is cleared. +# - !<cname> - Sets a name for the bit that will be shown if the bit is +# cleared. Does not show anything if the bit is set. +# - :<cname> - Sets a name for the bit that will always be shown together +# with the actual state of the bit, appended as ':on' or ':off'. +# - !<cname0>!<cname1> - Sets a name for both the cleared bit (cname0), and +# for the set bit (cname1). # # ---------------------------------------------------------------------------- # @@ -191,8 +195,8 @@ show-record-position=0 # include = <LISTNAME>[,<LISTNAME>...] # exclude = <bitmask>[,<bitmask>...] # ignore = <bitfield> -# <bitmask> = <constname> | !<constname> | !<constname0>!<constname1> -# <bitfield> = <datatype>,<dataformat>,<bitfieldname>[,<LISTNAME>[,noshift]] +# <bitmask> = <cname> | !<cname> | :<cname> | !<cname0>!<cname1> +# <bitfield> = <datatype>,<dataformat>,<bitfieldname>[,<LISTNAME>[,options...]] # end # # - include (optional): See constlist above. @@ -206,7 +210,17 @@ show-record-position=0 # - <bitfieldname>: The name of the embedded bitfield. # - <LISTAME>: Optional name list with names for the values of the embedded # bitfield. -# - noshift: If set, the extracted value is not shifted to the right. +# - options: Additional options for this bitfield: +# - filter = <filterbitfield>~<filtervalue>: If set, the entire bitfield +# will only be written, if the complete data item currently dumped +# contains exactly the value specified in <filtervalue> in the bitfield +# specified in <filterbitfield>. Otherwise, nothing is written. It is +# possible to specify multiple filter rules for this bitfield. In that +# case, the bitfield will be written, if at least one filter rule +# applies for the current data item. +# - noshift = <bool>: If set to 'true', the extracted value will be +# shifted to the right (normalized). If set to 'false', the value will +# be written unshifted. Default is 'true'. # # ---------------------------------------------------------------------------- # @@ -230,6 +244,7 @@ unitconverter=CONV-PT-TO-CM,/28.346457,cm unitconverter=CONV-PT1616-TO-CM,/1857713.4,cm unitconverter=CONV-TWIP-TO-CM,/566.92913,cm unitconverter=CONV-TWIP-TO-PT,/20,pt +unitconverter=CONV-EMU-TO-CM,/36000,cm constlist=BOOLEAN 0=FALSE @@ -239,7 +254,7 @@ end combilist=RK-FLAGS 0x00000001=div-100 0x00000002=integer - 0xFFFFFFFC=int32,dec,value + 0xFFFFFFFC=int32,dec,value,,filter=0x2~0x2 end constlist=CHARSET @@ -370,5 +385,12 @@ multilist=COUNTRY 980=,iran end +multilist=SYSTEMCOLOR + 0x00=scrollbar,desktop,active-title,inactive-title,menu,window-back,window-frame,menu-text + 0x08=window-text,active-title-text,active-border,inactive-border,app-workspace,highlight,highlight-text,button-face + 0x10=button-shadow,disabled-text,button-text,inactive-title-text,button-highlight,button-dark-shadow,button-light-shadow,tooltip-text + 0x18=tooltip-back,,hot-light,active-title-2,inactive-title-2,menu-highlight,menubar +end + # ============================================================================ diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx index 30b4fb67436b..b7750d4113b8 100644 --- a/oox/source/dump/oledumper.cxx +++ b/oox/source/dump/oledumper.cxx @@ -671,15 +671,7 @@ sal_uInt32 OcxPropertyObjectBase::dumpColorProperty( sal_uInt32 nDefault ) { MultiItemsGuard aMultiGuard( out() ); alignInput< sal_uInt32 >(); - sal_uInt32 nColor = dumpHex< sal_uInt32 >( getPropertyName(), "OCX-COLOR" ); - switch( extractValue< sal_uInt8 >( nColor, 24, 8 ) ) - { - case 0x00: writeColorABGRItem( "rgb", extractValue< sal_Int32 >( nColor, 0, 24 ) ); break; - case 0x01: writeDecItem( "palette-index", extractValue< sal_uInt16 >( nColor, 0, 16 ) ); break; - case 0x02: writeColorABGRItem( "rgb", extractValue< sal_Int32 >( nColor, 0, 24 ) ); break; - case 0x80: writeDecItem( "sys-color", extractValue< sal_uInt16 >( nColor, 0, 16 ), "OCX-SYSTEMCOLOR" ); break; - } - return nColor; + return dumpHex< sal_uInt32 >( getPropertyName(), "OCX-COLOR" ); } return nDefault; } diff --git a/oox/source/dump/oledumper.ini b/oox/source/dump/oledumper.ini index 96433d63c7fa..c398b0c01e51 100644 --- a/oox/source/dump/oledumper.ini +++ b/oox/source/dump/oledumper.ini @@ -115,8 +115,12 @@ end {0713E8D2-850A-101B-AFC0-4210102A8DA7}=COMCTL.ProgCtrl.1 combilist=OCX-COLOR + 0x0000FFFF=uint32,dec,palette-index,,filter=0xFF000000~0x01000000 + 0x000000FF=uint32,dec,red,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000 + 0x0000FF00=uint32,dec,green,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000 + 0x00FF0000=uint32,dec,blue,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000 + 0x0000FFFF=uint32,dec,system-color,SYSTEMCOLOR,filter=0xFF000000~0x80000000 0xFF000000=uint8,dec,type,OCX-COLORTYPE - 0x00FFFFFF=uint32,hex,value end constlist=OCX-COLORTYPE @@ -126,13 +130,6 @@ constlist=OCX-COLORTYPE 0x80=system-color end -multilist=OCX-SYSTEMCOLOR - 0x00=scrollbar,desktop,active-title,inactive-title,menubar,window-back,window-frame,menu-text - 0x08=window-text,active-title-text,active-border,inactive-border,app-workspace,highlight,highlight-text,button-face - 0x10=button-shadow,disabled-text,button-text,inactive-title-text,button-highlight,button-dark-shadow,button-light-shadow,tooltip-text - 0x18=tooltip-back -end - combilist=OCX-STRINGLEN 0x80000000=!unicode!compressed 0x7FFFFFFF=int32,dec,buffer-size @@ -543,16 +540,6 @@ flagslist=OCX-FORMSITE-FLAGS 0x00040000=container end -combilist=OCX-FORMSITE-CLASSIDCACHE - 0x7FFF=uint16,dec,cache-idx,OCX-FORMSITE-CLASSIDCACHEINDEX - 0x8000=!predefined-class-id!class-table-index -end - -constlist=OCX-FORMSITE-CLASSIDCACHEINDEX - default= - 0x7FFF=invalid -end - constlist=OCX-FORMSITE-CLASSNAMES 7=Forms.Form.1 12=Forms.Image.1 @@ -572,6 +559,17 @@ constlist=OCX-FORMSITE-CLASSNAMES 57=Forms.MultiPage.1 end +constlist=OCX-FORMSITE-CLASSIDCACHEINDEX + include=OCX-FORMSITE-CLASSNAMES + 0x7FFF=invalid +end + +combilist=OCX-FORMSITE-CLASSIDCACHE + 0x7FFF=uint16,dec,cache-idx,OCX-FORMSITE-CLASSIDCACHEINDEX,filter=0x8000~0x0000 + 0x7FFF=uint16,dec,class-table-idx,,filter=0x8000~0x8000 + 0x8000=!predefined-class-id!class-table-index +end + # form design extender ------------------------------------------------------ flagslist=OCX-FORMDESIGNEXT-PROPERTIES diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index a49d41ef4759..5aeb56883d2d 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1339,15 +1339,10 @@ void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& rConnectorE // from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, String& rFontName) { - StarSymbolToMSMultiFont *pConvert = 0; - FontFamily eFamily = FAMILY_DECORATIVE; - - if (!pConvert) - { - pConvert = CreateStarSymbolToMSMultiFont(); - } sal_Unicode cChar = rNumStr.GetChar(0); + StarSymbolToMSMultiFont *pConvert = CreateStarSymbolToMSMultiFont(); String sFont = pConvert->ConvertChar(cChar); + delete pConvert; if (sFont.Len()) { rNumStr = static_cast< sal_Unicode >(cChar | 0xF000); @@ -1363,7 +1358,6 @@ static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, Str let words own font substitution kick in */ rChrSet = RTL_TEXTENCODING_UNICODE; - eFamily = FAMILY_SWISS; rFontName = ::GetFontToken(rFontName, 0); } else @@ -1376,7 +1370,6 @@ static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, Str rFontName.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Wingdings")); rNumStr = static_cast< sal_Unicode >(0x6C); } - delete pConvert; } sal_Unicode DrawingML::SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc ) diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 9f99bf625333..96baaab4bb36 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -208,6 +208,16 @@ enum ApiTransparencyMode // ---------------------------------------------------------------------------- +/** Specifies how a form control supports the DefaultState property. */ +enum ApiDefaultStateMode +{ + API_DEFAULTSTATE_BOOLEAN, /// Control does not support tri-state, state is given as boolean. + API_DEFAULTSTATE_SHORT, /// Control does not support tri-state, state is given as short. + API_DEFAULTSTATE_TRISTATE /// Control supports tri-state, state is given as short. +}; + +// ---------------------------------------------------------------------------- + /** Converts the AX background formatting to UNO properties. */ void lclConvertBackground( AxControlHelper& rHelper, PropertyMap& rPropMap, sal_uInt32 nBackColor, sal_uInt32 nFlags, ApiTransparencyMode eTranspMode ) { @@ -318,8 +328,11 @@ void lclConvertPicture( AxControlHelper& rHelper, PropertyMap& rPropMap, const S // ---------------------------------------------------------------------------- /** Converts the AX value for checked/unchecked/dontknow to UNO properties. */ -void lclConvertState( AxControlHelper& /*rHelper*/, PropertyMap& rPropMap, const OUString& rValue, sal_Int32 nMultiSelect, bool bSupportsTriState ) +void lclConvertState( AxControlHelper& /*rHelper*/, PropertyMap& rPropMap, const OUString& rValue, sal_Int32 nMultiSelect, ApiDefaultStateMode eDefStateMode ) { + bool bBooleanState = eDefStateMode == API_DEFAULTSTATE_BOOLEAN; + bool bSupportsTriState = eDefStateMode == API_DEFAULTSTATE_TRISTATE; + // state sal_Int16 nState = bSupportsTriState ? API_STATE_DONTKNOW : API_STATE_UNCHECKED; if( rValue.getLength() == 1 ) switch( rValue[ 0 ] ) @@ -328,7 +341,10 @@ void lclConvertState( AxControlHelper& /*rHelper*/, PropertyMap& rPropMap, const case '1': nState = API_STATE_CHECKED; break; // any other string (also empty) means 'dontknow' } - rPropMap.setProperty( PROP_DefaultState, nState ); + if( bBooleanState ) + rPropMap.setProperty( PROP_DefaultState, nState != API_STATE_UNCHECKED ); + else + rPropMap.setProperty( PROP_DefaultState, nState ); // tristate if( bSupportsTriState ) @@ -808,6 +824,7 @@ void AxToggleButtonModel::convertProperties( AxControlHelper& rHelper, PropertyM rPropMap.setProperty( PROP_Toggle, true ); lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED ); lclConvertPicture( rHelper, rPropMap, maPictureData, mnPicturePos ); + lclConvertState( rHelper, rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_BOOLEAN ); AxMorphDataModel::convertProperties( rHelper, rPropMap ); } @@ -831,7 +848,7 @@ void AxCheckBoxModel::convertProperties( AxControlHelper& rHelper, PropertyMap& lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID ); lclConvertVisualEffect( rHelper, rPropMap, mnSpecialEffect ); lclConvertPicture( rHelper, rPropMap, maPictureData, mnPicturePos ); - lclConvertState( rHelper, rPropMap, maValue, mnMultiSelect, true ); + lclConvertState( rHelper, rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_TRISTATE ); AxMorphDataModel::convertProperties( rHelper, rPropMap ); } @@ -855,7 +872,7 @@ void AxOptionButtonModel::convertProperties( AxControlHelper& rHelper, PropertyM lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID ); lclConvertVisualEffect( rHelper, rPropMap, mnSpecialEffect ); lclConvertPicture( rHelper, rPropMap, maPictureData, mnPicturePos ); - lclConvertState( rHelper, rPropMap, maValue, mnMultiSelect, false ); + lclConvertState( rHelper, rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_SHORT ); AxMorphDataModel::convertProperties( rHelper, rPropMap ); } diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index 534a207a6e58..7b8c1ca95d35 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -64,7 +64,7 @@ PPTShape::~PPTShape() void PPTShape::addShape( const oox::core::XmlFilterBase& rFilterBase, const SlidePersist& rSlidePersist, - const oox::drawingml::ThemePtr& rxTheme, + const oox::drawingml::Theme* pTheme, const Reference< XShapes >& rxShapes, const awt::Rectangle* pShapeRect, ::oox::drawingml::ShapeIdMap* pShapeMap ) @@ -93,6 +93,12 @@ void PPTShape::addShape( aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getTitleTextStyle() : rSlidePersist.getTitleTextStyle(); } break; + case XML_subTitle : + { + if ( ( meShapeLocation == Master ) || ( meShapeLocation == Layout ) ) + sServiceName = rtl::OUString(); + } + break; case XML_obj : { const rtl::OUString sOutlinerShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.OutlinerShape" ) ); @@ -155,37 +161,42 @@ void PPTShape::addShape( break; } } - if ( !aMasterTextListStyle.get() ) - aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getOtherTextStyle() : rSlidePersist.getOtherTextStyle(); - setMasterTextListStyle( aMasterTextListStyle ); - Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, rxTheme, rxShapes, pShapeRect, bClearText ) ); - if ( !rSlidePersist.isMasterPage() && rSlidePersist.getPage().is() && ( (sal_Int32)mnSubType == XML_title ) ) + if ( sServiceName.getLength() ) { - try - { - rtl::OUString aTitleText; - Reference< XTextRange > xText( xShape, UNO_QUERY_THROW ); - aTitleText = xText->getString(); - if ( aTitleText.getLength() && ( aTitleText.getLength() < 64 ) ) // just a magic value, but we don't want to set slide names which are too long + if ( !aMasterTextListStyle.get() ) + aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getOtherTextStyle() : rSlidePersist.getOtherTextStyle(); + setMasterTextListStyle( aMasterTextListStyle ); + + Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, pTheme, rxShapes, pShapeRect, bClearText ) ); + if ( !rSlidePersist.isMasterPage() && rSlidePersist.getPage().is() && ( (sal_Int32)mnSubType == XML_title ) ) + { + try + { + rtl::OUString aTitleText; + Reference< XTextRange > xText( xShape, UNO_QUERY_THROW ); + aTitleText = xText->getString(); + if ( aTitleText.getLength() && ( aTitleText.getLength() < 64 ) ) // just a magic value, but we don't want to set slide names which are too long + { + Reference< container::XNamed > xName( rSlidePersist.getPage(), UNO_QUERY_THROW ); + xName->setName( aTitleText ); + } + } + catch( uno::Exception& ) { - Reference< container::XNamed > xName( rSlidePersist.getPage(), UNO_QUERY_THROW ); - xName->setName( aTitleText ); + } } - catch( uno::Exception& ) + if( pShapeMap && msId.getLength() ) { + (*pShapeMap)[ msId ] = shared_from_this(); } - } - if( pShapeMap && msId.getLength() ) - { - (*pShapeMap)[ msId ] = shared_from_this(); - } - // if this is a group shape, we have to add also each child shape - Reference< XShapes > xShapes( xShape, UNO_QUERY ); - if ( xShapes.is() ) - addChildren( rFilterBase, *this, rxTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap ); + // if this is a group shape, we have to add also each child shape + Reference< XShapes > xShapes( xShape, UNO_QUERY ); + if ( xShapes.is() ) + addChildren( rFilterBase, *this, pTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap ); + } } } catch( const Exception& ) diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx index 472f5292770e..8379a6e95735 100644 --- a/oox/source/ppt/pptshapecontext.cxx +++ b/oox/source/ppt/pptshapecontext.cxx @@ -63,7 +63,7 @@ PPTShapeContext::PPTShapeContext( ContextHandler& rParent, const SlidePersistPtr { } -oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes ) +oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, sal_Int32 nSubTypeIndex, std::vector< oox::drawingml::ShapePtr >& rShapes ) { oox::drawingml::ShapePtr aShapePtr; std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() ); @@ -71,11 +71,14 @@ oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, st { if ( (*aRevIter)->getSubType() == nMasterPlaceholder ) { - aShapePtr = *aRevIter; - break; + if ( ( nSubTypeIndex == -1 ) || ( nSubTypeIndex == (*aRevIter)->getSubTypeIndex() ) ) + { + aShapePtr = *aRevIter; + break; + } } std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren(); - aShapePtr = findPlaceholder( nMasterPlaceholder, rChildren ); + aShapePtr = findPlaceholder( nMasterPlaceholder, nSubTypeIndex, rChildren ); if ( aShapePtr.get() ) break; aRevIter++; @@ -84,10 +87,11 @@ oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, st } // if nFirstPlaceholder can't be found, it will be searched for nSecondPlaceholder -oox::drawingml::ShapePtr findPlaceholder( sal_Int32 nFirstPlaceholder, sal_Int32 nSecondPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes ) +oox::drawingml::ShapePtr findPlaceholder( sal_Int32 nFirstPlaceholder, sal_Int32 nSecondPlaceholder, + sal_Int32 nSubTypeIndex, std::vector< oox::drawingml::ShapePtr >& rShapes ) { - oox::drawingml::ShapePtr pPlaceholder = findPlaceholder( nFirstPlaceholder, rShapes ); - return !nSecondPlaceholder || pPlaceholder.get() ? pPlaceholder : findPlaceholder( nSecondPlaceholder, rShapes ); + oox::drawingml::ShapePtr pPlaceholder = findPlaceholder( nFirstPlaceholder, nSubTypeIndex, rShapes ); + return !nSecondPlaceholder || pPlaceholder.get() ? pPlaceholder : findPlaceholder( nSecondPlaceholder, nSubTypeIndex, rShapes ); } Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) @@ -107,7 +111,7 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In { sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) ); mpShapePtr->setSubType( nSubType ); - mpShapePtr->setIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); + mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); if ( nSubType ) { PPTShape* pPPTShapePtr = dynamic_cast< PPTShape* >( mpShapePtr.get() ); @@ -131,7 +135,8 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In nSecondPlaceholder = XML_title; break; case XML_obj : // slide/layout - nFirstPlaceholder = XML_body; + nFirstPlaceholder = XML_obj; + nSecondPlaceholder = XML_body; break; case XML_dt : // slide/layout/master/notes/notesmaster/handoutmaster case XML_sldNum : // slide/layout/master/notes/notesmaster/handoutmaster @@ -154,12 +159,13 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In { oox::drawingml::ShapePtr pPlaceholder; if ( eShapeLocation == Layout ) // for layout objects the referenced object can be found within the same shape tree - pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, mpSlidePersistPtr->getShapes()->getChildren() ); + pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, -1, mpSlidePersistPtr->getShapes()->getChildren() ); else if ( eShapeLocation == Slide ) // normal slide shapes have to search within the corresponding master tree for referenced objects { SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() ); if ( pMasterPersist.get() ) - pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, pMasterPersist->getShapes()->getChildren() ); + pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, + pPPTShapePtr->getSubTypeIndex(), pMasterPersist->getShapes()->getChildren() ); } if ( pPlaceholder.get() ) { diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index bd9fd5d549b1..ef8dbeedcd6c 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -76,7 +76,7 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s break; case NMSP_PPT|XML_ph: mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) ); - mpGroupShapePtr->setIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); + mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); break; // nvSpPr CT_ShapeNonVisual end @@ -104,7 +104,7 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s xRet.set( new oox::drawingml::GraphicShapeContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GraphicObjectShape" ) ) ) ); break; case NMSP_PPT|XML_graphicFrame: // CT_GraphicalObjectFrame - xRet.set( new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.OLE2Shape" ) ) ) ); + xRet.set( new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.OLE2Shape" ) ), true ) ); break; } diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 227f0b7ce799..d5b3b13c762a 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -67,9 +67,11 @@ SlidePersist::SlidePersist( XmlFilterBase& rFilter, sal_Bool bMaster, sal_Bool b { if ( pDefaultTextStyle ) { + /* maTitleTextStylePtr->apply( *pDefaultTextStyle.get() ); maBodyTextStylePtr->apply( *pDefaultTextStyle.get() ); maNotesTextStylePtr->apply( *pDefaultTextStyle.get() ); + */ maOtherTextStylePtr->apply( *pDefaultTextStyle.get() ); } } @@ -143,9 +145,9 @@ void SlidePersist::createXShapes( const XmlFilterBase& rFilterBase ) { PPTShape* pPPTShape = dynamic_cast< PPTShape* >( (*aChildIter).get() ); if ( pPPTShape ) - pPPTShape->addShape( rFilterBase, *this, getTheme(), xShapes, 0, &getShapeMap() ); + pPPTShape->addShape( rFilterBase, *this, getTheme().get(), xShapes, 0, &getShapeMap() ); else - (*aChildIter)->addShape( rFilterBase, getTheme(), xShapes, 0, &getShapeMap() ); + (*aChildIter)->addShape( rFilterBase, getTheme().get(), xShapes, 0, &getShapeMap() ); aChildIter++; } diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index ef8831b06db3..42efee474d90 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -74,7 +74,7 @@ ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element ) case XML_graphic: mpShape.reset(new Shape("com.sun.star.drawing.OLE2Shape" )); mxGraphicShapeContext.set - (new GraphicalObjectFrameContext(*rFragmentHandler, pMasterShape, mpShape)); + (new GraphicalObjectFrameContext(*rFragmentHandler, pMasterShape, mpShape, true)); break; case XML_pic: mpShape.reset(new Shape("com.sun.star.drawing.GraphicObjectShape" )); @@ -240,7 +240,7 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException) } else if (mpShape.get() != NULL) { - mpShape->addShape(*mxFilterBase, mpThemePtr, xShapes); + mpShape->addShape(*mxFilterBase, mpThemePtr.get(), xShapes); xResult.set(mpShape->getXShape()); } } diff --git a/oox/source/token/gennamespaces.pl b/oox/source/token/gennamespaces.pl index b3d277b85c2f..2a7f2e2423bb 100644 --- a/oox/source/token/gennamespaces.pl +++ b/oox/source/token/gennamespaces.pl @@ -50,6 +50,7 @@ print ( HXX "// defines for tokens with specific namespaces, can be used in swit print ( HXX "#define A_TOKEN( token ) (::oox::NMSP_DRAWINGML | XML_##token)\n" ); print ( HXX "#define AX_TOKEN( token ) (::oox::NMSP_AX | XML_##token)\n" ); print ( HXX "#define C_TOKEN( token ) (::oox::NMSP_CHART | XML_##token)\n" ); +print ( HXX "#define CDR_TOKEN( token ) (::oox::NMSP_CDR | XML_##token)\n" ); print ( HXX "#define O_TOKEN( token ) (::oox::NMSP_OFFICE | XML_##token)\n" ); print ( HXX "#define PPT_TOKEN( token ) (::oox::NMSP_PPT | XML_##token)\n" ); print ( HXX "#define R_TOKEN( token ) (::oox::NMSP_RELATIONSHIPS | XML_##token)\n" ); diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt index 63ca76e95f54..45bb59541b1b 100644 --- a/oox/source/token/namespaces.txt +++ b/oox/source/token/namespaces.txt @@ -14,6 +14,7 @@ DRAWINGML PICTURE DIAGRAM CHART +CDR DOC_DRAWINGML # VML diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 0ecd40ee6595..4d20b8f1c255 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -369,6 +369,7 @@ TextOverlap TextRightDistance TextRotation TextUpperDistance +TextVerticalAdjust TextWordWrap TextWritingMode Toggle diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx index 339ff5c40b44..b5ed8e9a9323 100644 --- a/oox/source/token/tokenmap.cxx +++ b/oox/source/token/tokenmap.cxx @@ -32,6 +32,8 @@ #include "tokens.hxx" #include "oox/helper/containerhelper.hxx" +#include <string.h> + using ::rtl::OString; using ::rtl::OUString; using ::com::sun::star::uno::Sequence; diff --git a/oox/source/xls/biffhelper.cxx b/oox/source/xls/biffhelper.cxx index f69cac731ee7..8ecea303183e 100644 --- a/oox/source/xls/biffhelper.cxx +++ b/oox/source/xls/biffhelper.cxx @@ -119,19 +119,27 @@ struct CodePageEntry_TEPred // ---------------------------------------------------------------------------- -bool lclCalcRkFromDouble( sal_Int32& ornRkValue, double fValue ) +union DecodedDouble +{ + double mfValue; + sal_math_Double maStruct; + + inline explicit DecodedDouble() {} + inline explicit DecodedDouble( double fValue ) : mfValue( fValue ) {} +}; + +bool lclCalcRkFromDouble( sal_Int32& ornRkValue, const DecodedDouble& rDecDbl ) { // double - const sal_math_Double* pValue = reinterpret_cast< const sal_math_Double* >( &fValue ); - if( (pValue->w32_parts.lsw == 0) && ((pValue->w32_parts.msw & 0x3) == 0) ) + if( (rDecDbl.maStruct.w32_parts.lsw == 0) && ((rDecDbl.maStruct.w32_parts.msw & 0x3) == 0) ) { - ornRkValue = static_cast< sal_Int32 >( pValue->w32_parts.msw ); + ornRkValue = static_cast< sal_Int32 >( rDecDbl.maStruct.w32_parts.msw ); return true; } // integer double fInt = 0.0; - double fFrac = modf( fValue, &fInt ); + double fFrac = modf( rDecDbl.mfValue, &fInt ); if( (fFrac == 0.0) && (-536870912.0 <= fInt) && (fInt <= 536870911.0) ) // 2^29 { ornRkValue = static_cast< sal_Int32 >( fInt ); @@ -143,6 +151,22 @@ bool lclCalcRkFromDouble( sal_Int32& ornRkValue, double fValue ) return false; } +bool lclCalcRkFromDouble( sal_Int32& ornRkValue, double fValue ) +{ + DecodedDouble aDecDbl( fValue ); + if( lclCalcRkFromDouble( ornRkValue, aDecDbl ) ) + return true; + + aDecDbl.mfValue *= 100.0; + if( lclCalcRkFromDouble( ornRkValue, aDecDbl ) ) + { + ornRkValue |= BIFF_RK_100FLAG; + return true; + } + + return false; +} + // ---------------------------------------------------------------------------- void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, sal_Int32 nBytes, BiffType eBiff ) @@ -229,23 +253,22 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, /*static*/ double BiffHelper::calcDoubleFromRk( sal_Int32 nRkValue ) { - double fValue = 0.0; + DecodedDouble aDecDbl( 0.0 ); if( getFlag( nRkValue, BIFF_RK_INTFLAG ) ) { sal_Int32 nTemp = nRkValue >> 2; setFlag< sal_Int32 >( nTemp, 0xE0000000, nRkValue < 0 ); - fValue = nTemp; + aDecDbl.mfValue = nTemp; } else { - sal_math_Double* pDouble = reinterpret_cast< sal_math_Double* >( &fValue ); - pDouble->w32_parts.msw = static_cast< sal_uInt32 >( nRkValue & BIFF_RK_VALUEMASK ); + aDecDbl.maStruct.w32_parts.msw = static_cast< sal_uInt32 >( nRkValue & BIFF_RK_VALUEMASK ); } if( getFlag( nRkValue, BIFF_RK_100FLAG ) ) - fValue /= 100.0; + aDecDbl.mfValue /= 100.0; - return fValue; + return aDecDbl.mfValue; } /*static*/ bool BiffHelper::calcRkFromDouble( sal_Int32& ornRkValue, double fValue ) @@ -276,10 +299,10 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, case BIFF_ERR_NA: nApiError = 0x7FFF; break; default: OSL_ENSURE( false, "BiffHelper::calcDoubleFromError - unknown error code" ); } - double fValue; - ::rtl::math::setNan( &fValue ); - reinterpret_cast< sal_math_Double* >( &fValue )->nan_parts.fraction_lo = nApiError; - return fValue; + DecodedDouble aDecDbl; + ::rtl::math::setNan( &aDecDbl.mfValue ); + aDecDbl.maStruct.nan_parts.fraction_lo = nApiError; + return aDecDbl.mfValue; } /*static*/ rtl_TextEncoding BiffHelper::calcTextEncodingFromCodePage( sal_uInt16 nCodePage ) @@ -309,15 +332,14 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, sal_uInt16 nFormat, nEnv; sal_Int32 nBytes; rStrm >> nFormat >> nEnv >> nBytes; - OSL_ENSURE( (nFormat == BIFF_IMGDATA_WMF) || (nFormat == BIFF_IMGDATA_DIB) || (nFormat == BIFF_IMGDATA_NATIVE), "BiffHelper::importImgData - unknown format" ); OSL_ENSURE( nBytes > 0, "BiffHelper::importImgData - invalid data size" ); if( (0 < nBytes) && (nBytes <= rStrm.getRemaining()) ) { switch( nFormat ) { - case BIFF_IMGDATA_WMF: /* TODO */ break; +// case BIFF_IMGDATA_WMF: /* TODO */ break; case BIFF_IMGDATA_DIB: lclImportImgDataDib( orDataSeq, rStrm, nBytes, eBiff ); break; - case BIFF_IMGDATA_NATIVE: /* TODO */ break; +// case BIFF_IMGDATA_NATIVE: /* TODO */ break; default: OSL_ENSURE( false, "BiffHelper::importImgData - unknown image format" ); } } diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index 56e1c888d0a2..28687ba92da7 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -92,22 +92,6 @@ sal_Int64 lclCalcEmu( const UnitConverter& rUnitConv, sal_Int64 nValue, Unit eFr // ============================================================================ -AnchorPosModel::AnchorPosModel() : - mnX( -1 ), - mnY( -1 ) -{ -} - -// ---------------------------------------------------------------------------- - -AnchorSizeModel::AnchorSizeModel() : - mnWidth( -1 ), - mnHeight( -1 ) -{ -} - -// ---------------------------------------------------------------------------- - AnchorCellModel::AnchorCellModel() : mnCol( -1 ), mnRow( -1 ), @@ -155,15 +139,15 @@ void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttrib void ShapeAnchor::importPos( const AttributeList& rAttribs ) { OSL_ENSURE( meType == ANCHOR_ABSOLUTE, "ShapeAnchor::importPos - unexpected 'xdr:pos' element" ); - maPos.mnX = rAttribs.getHyper( XML_x, 0 ); - maPos.mnY = rAttribs.getHyper( XML_y, 0 ); + maPos.X = rAttribs.getHyper( XML_x, 0 ); + maPos.Y = rAttribs.getHyper( XML_y, 0 ); } void ShapeAnchor::importExt( const AttributeList& rAttribs ) { OSL_ENSURE( (meType == ANCHOR_ABSOLUTE) || (meType == ANCHOR_ONECELL), "ShapeAnchor::importExt - unexpected 'xdr:ext' element" ); - maSize.mnWidth = rAttribs.getHyper( XML_cx, 0 ); - maSize.mnHeight = rAttribs.getHyper( XML_cy, 0 ); + maSize.Width = rAttribs.getHyper( XML_cx, 0 ); + maSize.Height = rAttribs.getHyper( XML_cy, 0 ); } void ShapeAnchor::importClientData( const AttributeList& rAttribs ) @@ -229,12 +213,12 @@ bool ShapeAnchor::isValidAnchor() const case ANCHOR_ABSOLUTE: OSL_ENSURE( maPos.isValid(), "ShapeAnchor::isValidAnchor - invalid position" ); OSL_ENSURE( maSize.isValid(), "ShapeAnchor::isValidAnchor - invalid size" ); - bValid = maPos.isValid() && maSize.isValid() && (maSize.mnWidth > 0) && (maSize.mnHeight > 0); + bValid = maPos.isValid() && maSize.isValid() && (maSize.Width > 0) && (maSize.Height > 0); break; case ANCHOR_ONECELL: OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::isValidAnchor - invalid from position" ); OSL_ENSURE( maSize.isValid(), "ShapeAnchor::isValidAnchor - invalid size" ); - bValid = maFrom.isValid() && maSize.isValid() && (maSize.mnWidth > 0) && (maSize.mnHeight > 0); + bValid = maFrom.isValid() && maSize.isValid() && (maSize.Width > 0) && (maSize.Height > 0); break; case ANCHOR_TWOCELL: case ANCHOR_VML: @@ -264,10 +248,10 @@ Rectangle ShapeAnchor::calcApiLocation( const Size& rApiSheetSize, const AnchorS { case ANCHOR_ABSOLUTE: OSL_ENSURE( maPos.isValid(), "ShapeAnchor::calcApiLocation - invalid position" ); - if( maPos.isValid() && (maPos.mnX < rEmuSheetSize.mnWidth) && (maPos.mnY < rEmuSheetSize.mnHeight) ) + if( maPos.isValid() && (maPos.X < rEmuSheetSize.Width) && (maPos.Y < rEmuSheetSize.Height) ) { - aApiLoc.X = rUnitConv.scaleToMm100( static_cast< double >( maPos.mnX ), UNIT_EMU ); - aApiLoc.Y = rUnitConv.scaleToMm100( static_cast< double >( maPos.mnY ), UNIT_EMU ); + aApiLoc.X = rUnitConv.scaleToMm100( static_cast< double >( maPos.X ), UNIT_EMU ); + aApiLoc.Y = rUnitConv.scaleToMm100( static_cast< double >( maPos.Y ), UNIT_EMU ); } break; case ANCHOR_ONECELL: @@ -295,10 +279,10 @@ Rectangle ShapeAnchor::calcApiLocation( const Size& rApiSheetSize, const AnchorS if( maSize.isValid() ) { aApiLoc.Width = ::std::min< sal_Int32 >( - rUnitConv.scaleToMm100( static_cast< double >( maSize.mnWidth ), UNIT_EMU ), + rUnitConv.scaleToMm100( static_cast< double >( maSize.Width ), UNIT_EMU ), rApiSheetSize.Width - aApiLoc.X ); aApiLoc.Height = ::std::min< sal_Int32 >( - rUnitConv.scaleToMm100( static_cast< double >( maSize.mnHeight ), UNIT_EMU ), + rUnitConv.scaleToMm100( static_cast< double >( maSize.Height ), UNIT_EMU ), rApiSheetSize.Height - aApiLoc.Y ); } break; @@ -340,8 +324,8 @@ Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) c UnitConverter& rUnitConv = getUnitConverter(); Size aSheetSize( - getLimitedValue< sal_Int32, sal_Int64 >( rEmuSheetSize.mnWidth, 0, SAL_MAX_INT32 ), - getLimitedValue< sal_Int32, sal_Int64 >( rEmuSheetSize.mnHeight, 0, SAL_MAX_INT32 ) ); + getLimitedValue< sal_Int32, sal_Int64 >( rEmuSheetSize.Width, 0, SAL_MAX_INT32 ), + getLimitedValue< sal_Int32, sal_Int64 >( rEmuSheetSize.Height, 0, SAL_MAX_INT32 ) ); Rectangle aLoc( -1, -1, -1, -1 ); Unit eUnitX = (meType == ANCHOR_VML) ? UNIT_SCREENX : UNIT_EMU; Unit eUnitY = (meType == ANCHOR_VML) ? UNIT_SCREENY : UNIT_EMU; @@ -351,10 +335,10 @@ Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) c { case ANCHOR_ABSOLUTE: OSL_ENSURE( maPos.isValid(), "ShapeAnchor::calcEmuLocation - invalid position" ); - if( maPos.isValid() && (maPos.mnX < aSheetSize.Width) && (maPos.mnY < aSheetSize.Height) ) + if( maPos.isValid() && (maPos.X < aSheetSize.Width) && (maPos.Y < aSheetSize.Height) ) { - aLoc.X = static_cast< sal_Int32 >( maPos.mnX ); - aLoc.Y = static_cast< sal_Int32 >( maPos.mnY ); + aLoc.X = static_cast< sal_Int32 >( maPos.X ); + aLoc.Y = static_cast< sal_Int32 >( maPos.Y ); } break; case ANCHOR_ONECELL: @@ -386,8 +370,8 @@ Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) c OSL_ENSURE( maSize.isValid(), "ShapeAnchor::calcEmuLocation - invalid size" ); if( maSize.isValid() ) { - aLoc.Width = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( maSize.mnWidth, aSheetSize.Width - aLoc.X ) ); - aLoc.Height = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( maSize.mnHeight, aSheetSize.Height - aLoc.Y ) ); + aLoc.Width = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( maSize.Width, aSheetSize.Width - aLoc.X ) ); + aLoc.Height = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( maSize.Height, aSheetSize.Height - aLoc.Y ) ); } break; case ANCHOR_TWOCELL: @@ -439,8 +423,8 @@ OoxDrawingFragment::OoxDrawingFragment( const WorksheetHelper& rHelper, const OU { OSL_ENSURE( mxDrawPage.is(), "OoxDrawingFragment::OoxDrawingFragment - missing drawing page" ); maApiSheetSize = getDrawPageSize(); - maEmuSheetSize.mnWidth = static_cast< sal_Int64 >( getUnitConverter().scaleFromMm100( maApiSheetSize.Width, UNIT_EMU ) ); - maEmuSheetSize.mnHeight = static_cast< sal_Int64 >( getUnitConverter().scaleFromMm100( maApiSheetSize.Height, UNIT_EMU ) ); + maEmuSheetSize.Width = static_cast< sal_Int64 >( getUnitConverter().scaleFromMm100( maApiSheetSize.Width, UNIT_EMU ) ); + maEmuSheetSize.Height = static_cast< sal_Int64 >( getUnitConverter().scaleFromMm100( maApiSheetSize.Height, UNIT_EMU ) ); } // oox.core.ContextHandler2Helper interface ----------------------------------- @@ -481,7 +465,7 @@ ContextHandlerRef OoxDrawingFragment::onCreateContext( sal_Int32 nElement, const return new GraphicShapeContext( *this, ShapePtr(), mxShape ); case XDR_TOKEN( graphicFrame ): mxShape.reset( new Shape( "com.sun.star.drawing.OLE2Shape" ) ); - return new GraphicalObjectFrameContext( *this, ShapePtr(), mxShape ); + return new GraphicalObjectFrameContext( *this, ShapePtr(), mxShape, getSheetType() != SHEETTYPE_CHARTSHEET ); case XDR_TOKEN( grpSp ): mxShape.reset( new Shape( "com.sun.star.drawing.GroupShape" ) ); return new ShapeGroupContext( *this, ShapePtr(), mxShape ); @@ -526,7 +510,7 @@ void OoxDrawingFragment::onEndElement( const OUString& rChars ) { Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuSheetSize ); if( (aLoc.X >= 0) && (aLoc.Y >= 0) && (aLoc.Width >= 0) && (aLoc.Height >= 0) ) - mxShape->addShape( getOoxFilter(), getThemeRef(), mxDrawPage, &aLoc ); + mxShape->addShape( getOoxFilter(), &getTheme(), mxDrawPage, &aLoc ); } mxShape.reset(); mxAnchor.reset(); diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx index b9b9c3d57dcc..b2e5ba0ee931 100644 --- a/oox/source/xls/formulabase.cxx +++ b/oox/source/xls/formulabase.cxx @@ -229,12 +229,13 @@ const size_t FUNCINFO_PARAMINFOCOUNT = 5; /// Number of parameter const sal_uInt16 FUNCFLAG_VOLATILE = 0x0001; /// Result is volatile (e.g. NOW() function). const sal_uInt16 FUNCFLAG_IMPORTONLY = 0x0002; /// Only used in import filter. const sal_uInt16 FUNCFLAG_EXPORTONLY = 0x0004; /// Only used in export filter. -const sal_uInt16 FUNCFLAG_MACROCALL = 0x0008; /// Function is simulated by macro call in Excel. -const sal_uInt16 FUNCFLAG_EXTERNAL = 0x0010; /// Function is external in Calc. -const sal_uInt16 FUNCFLAG_MACROFUNC = 0x0020; /// Function is a macro-sheet function. -const sal_uInt16 FUNCFLAG_MACROCMD = 0x0040; /// Function is a macro-sheet command. -const sal_uInt16 FUNCFLAG_ALWAYSVAR = 0x0080; /// Function is always represented by a tFuncVar token. -const sal_uInt16 FUNCFLAG_PARAMPAIRS = 0x0100; /// Optional parameters are expected to appear in pairs. +const sal_uInt16 FUNCFLAG_MACROCALL = 0x0008; /// Function is stored as macro call in Excel (_xlfn. prefix). OOXML name MUST exist. +const sal_uInt16 FUNCFLAG_MACROCALLODF = 0x0010; /// ODF-only function stored as macro call in Excel (_xlfnodf. prefix). ODF name MUST exist. +const sal_uInt16 FUNCFLAG_EXTERNAL = 0x0020; /// Function is external in Calc. +const sal_uInt16 FUNCFLAG_MACROFUNC = 0x0040; /// Function is a macro-sheet function. +const sal_uInt16 FUNCFLAG_MACROCMD = 0x0080; /// Function is a macro-sheet command. +const sal_uInt16 FUNCFLAG_ALWAYSVAR = 0x0100; /// Function is always represented by a tFuncVar token. +const sal_uInt16 FUNCFLAG_PARAMPAIRS = 0x0200; /// Optional parameters are expected to appear in pairs. const sal_uInt16 FUNCFLAG_FUNCLIBMASK = 0xF000; /// Mask for function library bits. const sal_uInt16 FUNCFLAG_EUROTOOL = 0x1000; /// Function is part of the EuroTool add-in. @@ -346,7 +347,6 @@ static const FunctionData saFuncTableBiff2[] = { "TREND", "TREND", 50, 50, 1, 3, A, { RA, RA, RA, C }, 0 }, { "LOGEST", "LOGEST", 51, 51, 1, 2, A, { RA, RA, C, C }, 0 }, { "GROWTH", "GROWTH", 52, 52, 1, 3, A, { RA, RA, RA, C }, 0 }, - { 0, "RETURN", 55, 55, 0, 1, R, { RO }, FUNCFLAG_MACROFUNC }, { "PV", "PV", 56, 56, 3, 5, V, { VR }, 0 }, { "FV", "FV", 57, 57, 3, 5, V, { VR }, 0 }, { "NPER", "NPER", 58, 58, 3, 5, V, { VR }, 0 }, @@ -370,11 +370,9 @@ static const FunctionData saFuncTableBiff2[] = { "ROWS", "ROWS", 76, 76, 1, 1, V, { RO }, 0 }, { "COLUMNS", "COLUMNS", 77, 77, 1, 1, V, { RO }, 0 }, { "OFFSET", "OFFSET", 78, 78, 3, 5, R, { RO, VR }, FUNCFLAG_VOLATILE }, - { 0, "ABSREF", 79, 79, 2, 2, R, { VR, RO }, FUNCFLAG_MACROFUNC }, { "SEARCH", "SEARCH", 82, 82, 2, 3, V, { VR }, 0 }, { "TRANSPOSE", "TRANSPOSE", 83, 83, 1, 1, A, { VO }, 0 }, { "TYPE", "TYPE", 86, 86, 1, 1, V, { VX }, 0 }, - { 0, "ACTIVE.CELL", 94, 94, 0, 0, R, {}, FUNCFLAG_MACROFUNC }, { "ATAN2", "ATAN2", 97, 97, 2, 2, V, { VR }, 0 }, { "ASIN", "ASIN", 98, 98, 1, 1, V, { VR }, 0 }, { "ACOS", "ACOS", 99, 99, 1, 1, V, { VR }, 0 }, @@ -408,9 +406,6 @@ static const FunctionData saFuncTableBiff2[] = { "SYD", "SYD", 143, 143, 4, 4, V, { VR }, 0 }, { "DDB", "DDB", 144, 144, 4, 5, V, { VR }, 0 }, { "INDIRECT", "INDIRECT", 148, 148, 1, 2, R, { VR }, FUNCFLAG_VOLATILE }, - { 0, "ADD.BAR", 151, 151, 0, 0, V, {}, FUNCFLAG_MACROFUNC | FUNCFLAG_ALWAYSVAR }, - { 0, "ADD.MENU", 152, 152, 2, 2, V, { VR, RO }, FUNCFLAG_MACROFUNC | FUNCFLAG_ALWAYSVAR }, - { 0, "ADD.COMMAND", 153, 153, 3, 3, V, { VR, RO }, FUNCFLAG_MACROFUNC | FUNCFLAG_ALWAYSVAR }, { "CLEAN", "CLEAN", 162, 162, 1, 1, V, { VR }, 0 }, { "MDETERM", "MDETERM", 163, 163, 1, 1, V, { VA }, 0 }, { "MINVERSE", "MINVERSE", 164, 164, 1, 1, A, { VA }, 0 }, @@ -434,10 +429,16 @@ static const FunctionData saFuncTableBiff2[] = // *** macro sheet commands *** { 0, "A1.R1C1", 30, 30, 0, 1, V, { VR }, FUNCFLAG_MACROCMD }, + { 0, "RETURN", 55, 55, 0, 1, R, { RO }, FUNCFLAG_MACROFUNC }, + { 0, "ABSREF", 79, 79, 2, 2, R, { VR, RO }, FUNCFLAG_MACROFUNC }, { 0, "ADD.ARROW", 81, 81, 0, 0, V, {}, FUNCFLAG_MACROCMD }, + { 0, "ACTIVE.CELL", 94, 94, 0, 0, R, {}, FUNCFLAG_MACROFUNC }, { 0, "ACTIVATE", 103, 103, 0, 2, V, { VR }, FUNCFLAG_MACROCMD }, { 0, "ACTIVATE.NEXT", 104, 104, 0, 0, V, {}, FUNCFLAG_MACROCMD }, - { 0, "ACTIVATE.PREV", 105, 105, 0, 0, V, {}, FUNCFLAG_MACROCMD } + { 0, "ACTIVATE.PREV", 105, 105, 0, 0, V, {}, FUNCFLAG_MACROCMD }, + { 0, "ADD.BAR", 151, 151, 0, 0, V, {}, FUNCFLAG_MACROFUNC | FUNCFLAG_ALWAYSVAR }, + { 0, "ADD.MENU", 152, 152, 2, 2, V, { VR, RO }, FUNCFLAG_MACROFUNC | FUNCFLAG_ALWAYSVAR }, + { 0, "ADD.COMMAND", 153, 153, 3, 3, V, { VR, RO }, FUNCFLAG_MACROFUNC | FUNCFLAG_ALWAYSVAR } }; /** Functions new in BIFF3. */ @@ -447,9 +448,6 @@ static const FunctionData saFuncTableBiff3[] = { "TREND", "TREND", 50, 50, 1, 4, A, { RA, RA, RA, VV }, 0 }, // BIFF2: 1-3, BIFF3: 1-4 { "LOGEST", "LOGEST", 51, 51, 1, 4, A, { RA, RA, VV }, 0 }, // BIFF2: 1-2, BIFF3: 1-4 { "GROWTH", "GROWTH", 52, 52, 1, 4, A, { RA, RA, RA, VV }, 0 }, // BIFF2: 1-3, BIFF3: 1-4 - { 0, "ADD.BAR", 151, 151, 0, 1, V, { VR }, FUNCFLAG_MACROFUNC }, // BIFF2: 0, BIFF3: 0-1 - { 0, "ADD.MENU", 152, 152, 2, 3, V, { VR, RO }, FUNCFLAG_MACROFUNC }, // BIFF2: 2, BIFF3: 2-3 - { 0, "ADD.COMMAND", 153, 153, 3, 4, V, { VR, RO }, FUNCFLAG_MACROFUNC }, // BIFF2: 3, BIFF3: 3-4 { "TRUNC", "TRUNC", 197, 197, 1, 2, V, { VR }, 0 }, // BIFF2: 1, BIFF3: 1-2 { "DOLLAR", "USDOLLAR", 204, 204, 1, 2, V, { VR }, FUNCFLAG_IMPORTONLY }, { 0/*"FIND"*/, "FINDB", 205, 205, 2, 3, V, { VR }, 0 }, @@ -478,7 +476,13 @@ static const FunctionData saFuncTableBiff3[] = { "ATANH", "ATANH", 234, 234, 1, 1, V, { VR }, 0 }, { "ACOTH", "ATANH", 234, 234, 1, 1, V, { VR }, FUNCFLAG_EXPORTONLY }, { "DGET", "DGET", 235, 235, 3, 3, V, { RO, RR }, 0 }, - { "INFO", "INFO", 244, 244, 1, 1, V, { VR }, FUNCFLAG_VOLATILE } + { "INFO", "INFO", 244, 244, 1, 1, V, { VR }, FUNCFLAG_VOLATILE }, + + // *** macro sheet commands *** + + { 0, "ADD.BAR", 151, 151, 0, 1, V, { VR }, FUNCFLAG_MACROFUNC }, // BIFF2: 0, BIFF3: 0-1 + { 0, "ADD.MENU", 152, 152, 2, 3, V, { VR, RO }, FUNCFLAG_MACROFUNC }, // BIFF2: 2, BIFF3: 2-3 + { 0, "ADD.COMMAND", 153, 153, 3, 4, V, { VR, RO }, FUNCFLAG_MACROFUNC } // BIFF2: 3, BIFF3: 3-4 }; /** Functions new in BIFF4. */ @@ -662,8 +666,6 @@ static const FunctionData saFuncTableBiff5[] = { "WEEKDAY", "WEEKDAY", 70, 70, 1, 2, V, { VR }, 0 }, // BIFF2-4: 1, BIFF5: 1-2 { "HLOOKUP", "HLOOKUP", 101, 101, 3, 4, V, { VV, RO, RO, VV }, 0 }, // BIFF2-4: 3, BIFF5: 3-4 { "VLOOKUP", "VLOOKUP", 102, 102, 3, 4, V, { VV, RO, RO, VV }, 0 }, // BIFF2-4: 3, BIFF5: 3-4 - { 0, "ADD.MENU", 152, 152, 2, 4, V, { VR, RO, RO, VR }, FUNCFLAG_MACROFUNC }, // BIFF3-4: 2-3, BIFF5: 2-4 - { 0, "ADD.COMMAND", 153, 153, 3, 5, V, { VR, RO, RO, RO, VR }, FUNCFLAG_MACROFUNC }, // BIFF3-4: 3-4, BIFF5: 3-5 { "DAYS360", "DAYS360", 220, 220, 2, 3, V, { VR }, 0 }, // BIFF3-4: 2, BIFF5: 2-3 { 0, "EXTERN.CALL", 255, 255, 1, MX, R, { RO_E, RO }, FUNCFLAG_EXPORTONLY }, // MACRO or EXTERNAL { "CONCATENATE", "CONCATENATE", 336, 336, 0, MX, V, { VR }, 0 }, @@ -686,6 +688,8 @@ static const FunctionData saFuncTableBiff5[] = // *** macro sheet commands *** + { 0, "ADD.MENU", 152, 152, 2, 4, V, { VR, RO, RO, VR }, FUNCFLAG_MACROFUNC }, // BIFF3-4: 2-3, BIFF5: 2-4 + { 0, "ADD.COMMAND", 153, 153, 3, 5, V, { VR, RO, RO, RO, VR }, FUNCFLAG_MACROFUNC }, // BIFF3-4: 3-4, BIFF5: 3-5 { 0, "ADD.CHART.AUTOFORMAT", 390, 390, 0, 2, V, { VR }, FUNCFLAG_MACROCMD }, { 0, "ADD.LIST.ITEM", 451, 451, 0, 2, V, { VR }, FUNCFLAG_MACROCMD }, { 0, "ACTIVE.CELL.FONT", 476, 476, 0, 14, V, { VR }, FUNCFLAG_MACROCMD } @@ -738,41 +742,39 @@ static const FunctionData saFuncTableOox[] = /** Functions defined by OpenFormula, but not supported by Calc or by Excel. */ static const FunctionData saFuncTableOdf[] = { - { "ARABIC", 0, NOID, NOID, 1, 1, V, { VR }, 0 }, - { "B", 0, NOID, NOID, 3, 4, V, { VR }, 0 }, - { "BASE", 0, NOID, NOID, 2, 3, V, { VR }, 0 }, - { "BITAND", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "BITLSHIFT", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "BITOR", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "BITRSHIFT", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "BITXOR", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "CHISQDIST", 0, NOID, NOID, 2, 3, V, { VR }, 0 }, - { "CHISQINV", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "COMBINA", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "DAYS", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "DDE", 0, NOID, NOID, 3, 4, V, { VR }, 0 }, - { "DECIMAL", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "FDIST", 0, NOID, NOID, 3, 4, V, { VR }, 0 }, - { "FINV", 0, NOID, NOID, 3, 3, V, { VR }, 0 }, - { "FORMULA", 0, NOID, NOID, 1, 1, V, { RO }, 0 }, - { "GAMMA", 0, NOID, NOID, 1, 1, V, { VR }, 0 }, - { "GAUSS", 0, NOID, NOID, 1, 1, V, { VR }, 0 }, - { "IFNA", 0, NOID, NOID, 2, 2, V, { VR, RO }, 0 }, - { "ISFORMULA", 0, NOID, NOID, 1, 1, V, { RO }, 0 }, - { "ISOWEEKNUM", 0, NOID, NOID, 1, 2, V, { VR }, 0 }, - { "MULTIPLE.OPERATIONS", 0, NOID, NOID, 3, 5, V, { RO }, 0 }, - { "MUNIT", 0, NOID, NOID, 1, 1, A, { VR }, 0 }, - { "NUMBERVALUE", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "PDURATION", 0, NOID, NOID, 3, 3, V, { VR }, 0 }, - { "PERMUTATIONA", 0, NOID, NOID, 2, 2, V, { VR }, 0 }, - { "PHI", 0, NOID, NOID, 1, 1, V, { VR }, 0 }, - { "RRI", 0, NOID, NOID, 3, 3, V, { VR }, 0 }, - { "SHEET", 0, NOID, NOID, 1, 1, V, { RO }, 0 }, - { "SHEETS", 0, NOID, NOID, 0, 1, V, { RO }, 0 }, - { "SKEWP", 0, NOID, NOID, 1, MX, V, { RX }, 0 }, - { "UNICHAR", 0, NOID, NOID, 1, 1, V, { VR }, 0 }, - { "UNICODE", 0, NOID, NOID, 1, 1, V, { VR }, 0 }, - { "XOR", 0, NOID, NOID, 1, MX, V, { RX }, 0 } + { "ARABIC", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "B", 0, NOID, NOID, 3, 4, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "BASE", 0, NOID, NOID, 2, 3, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "BITAND", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "BITLSHIFT", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "BITOR", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "BITRSHIFT", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "BITXOR", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "CHISQDIST", 0, NOID, NOID, 2, 3, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "CHISQINV", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "COMBINA", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "DAYS", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "DECIMAL", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "FDIST", 0, NOID, NOID, 3, 4, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "FINV", 0, NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "FORMULA", 0, NOID, NOID, 1, 1, V, { RO }, FUNCFLAG_MACROCALLODF }, + { "GAMMA", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "GAUSS", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "IFNA", 0, NOID, NOID, 2, 2, V, { VR, RO }, FUNCFLAG_MACROCALLODF }, + { "ISFORMULA", 0, NOID, NOID, 1, 1, V, { RO }, FUNCFLAG_MACROCALLODF }, + { "ISOWEEKNUM", 0, NOID, NOID, 1, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "MUNIT", 0, NOID, NOID, 1, 1, A, { VR }, FUNCFLAG_MACROCALLODF }, + { "NUMBERVALUE", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "PDURATION", 0, NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "PERMUTATIONA", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "PHI", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "RRI", 0, NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "SHEET", 0, NOID, NOID, 1, 1, V, { RO }, FUNCFLAG_MACROCALLODF }, + { "SHEETS", 0, NOID, NOID, 0, 1, V, { RO }, FUNCFLAG_MACROCALLODF }, + { "SKEWP", 0, NOID, NOID, 1, MX, V, { RX }, FUNCFLAG_MACROCALLODF }, + { "UNICHAR", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "UNICODE", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, + { "XOR", 0, NOID, NOID, 1, MX, V, { RX }, FUNCFLAG_MACROCALLODF } }; // ---------------------------------------------------------------------------- @@ -895,6 +897,7 @@ FunctionProviderImpl::FunctionProviderImpl( FilterType eFilter, BiffType eBiff, initFuncs( saFuncTableBiff8, STATIC_ARRAY_END( saFuncTableBiff8 ), nMaxParam, bImportFilter ); if( eFilter == FILTER_OOX ) initFuncs( saFuncTableOox, STATIC_ARRAY_END( saFuncTableOox ), nMaxParam, bImportFilter ); + initFuncs( saFuncTableOdf, STATIC_ARRAY_END( saFuncTableOdf ), nMaxParam, bImportFilter ); } void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nMaxParam ) @@ -905,13 +908,25 @@ void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nM xFuncInfo->maOdfFuncName = OUString::createFromAscii( rFuncData.mpcOdfFuncName ); if( rFuncData.mpcOoxFuncName ) xFuncInfo->maOoxFuncName = OUString::createFromAscii( rFuncData.mpcOoxFuncName ); + if( getFlag( rFuncData.mnFlags, FUNCFLAG_MACROCALL ) ) + { + OSL_ENSURE( xFuncInfo->maOoxFuncName.getLength() > 0, "FunctionProviderImpl::initFunc - missing OOXML function name" ); + OSL_ENSURE( !getFlag( rFuncData.mnFlags, FUNCFLAG_MACROCALLODF ), "FunctionProviderImpl::initFunc - unexpected flag FUNCFLAG_MACROCALLODF" ); xFuncInfo->maBiffMacroName = CREATE_OUSTRING( "_xlfn." ) + xFuncInfo->maOoxFuncName; + } + else if( getFlag( rFuncData.mnFlags, FUNCFLAG_MACROCALLODF ) ) + { + OSL_ENSURE( xFuncInfo->maOdfFuncName.getLength() > 0, "FunctionProviderImpl::initFunc - missing ODF function name" ); + xFuncInfo->maBiffMacroName = CREATE_OUSTRING( "_xlfnodf." ) + xFuncInfo->maOdfFuncName; + } + switch( rFuncData.mnFlags & FUNCFLAG_FUNCLIBMASK ) { case FUNCFLAG_EUROTOOL: xFuncInfo->meFuncLibType = FUNCLIB_EUROTOOL; break; default: xFuncInfo->meFuncLibType = FUNCLIB_UNKNOWN; } + xFuncInfo->mnApiOpCode = -1; xFuncInfo->mnOobFuncId = rFuncData.mnOobFuncId; xFuncInfo->mnBiffFuncId = rFuncData.mnBiffFuncId; diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx index 3eac90040667..cd914ceae196 100644 --- a/oox/source/xls/stylesbuffer.cxx +++ b/oox/source/xls/stylesbuffer.cxx @@ -69,6 +69,7 @@ using ::com::sun::star::awt::FontDescriptor; using ::com::sun::star::awt::XDevice; using ::com::sun::star::awt::XFont2; using ::com::sun::star::table::BorderLine; +using ::com::sun::star::table::TableBorder; using ::com::sun::star::text::XText; using ::com::sun::star::style::XStyle; using ::oox::core::FilterBase; @@ -1398,7 +1399,6 @@ void Alignment::writeToPropertyMap( PropertyMap& rPropMap ) const rPropMap[ PROP_VertJustify ] <<= maApiData.meVerJustify; rPropMap[ PROP_WritingMode ] <<= maApiData.mnWritingMode; rPropMap[ PROP_RotateAngle ] <<= maApiData.mnRotation; - rPropMap[ PROP_RotateReference ] <<= ::com::sun::star::table::CellVertJustify_STANDARD; // rotation reference rPropMap[ PROP_Orientation ] <<= maApiData.meOrientation; rPropMap[ PROP_ParaIndent ] <<= maApiData.mnIndent; rPropMap[ PROP_IsTextWrapped ] <<= maApiData.mbWrapText; @@ -1517,6 +1517,57 @@ ApiBorderData::ApiBorderData() : { } +bool ApiBorderData::hasAnyOuterBorder() const +{ + return + (maBorder.IsTopLineValid && (maBorder.TopLine.OuterLineWidth > 0)) || + (maBorder.IsBottomLineValid && (maBorder.BottomLine.OuterLineWidth > 0)) || + (maBorder.IsLeftLineValid && (maBorder.LeftLine.OuterLineWidth > 0)) || + (maBorder.IsRightLineValid && (maBorder.RightLine.OuterLineWidth > 0)); +} + +namespace { + +bool operator==( const BorderLine& rLeft, const BorderLine& rRight ) +{ + return + (rLeft.Color == rRight.Color) && + (rLeft.InnerLineWidth == rRight.InnerLineWidth) && + (rLeft.OuterLineWidth == rRight.OuterLineWidth) && + (rLeft.LineDistance == rRight.LineDistance); +} + +bool operator==( const TableBorder& rLeft, const TableBorder& rRight ) +{ + return + (rLeft.TopLine == rRight.TopLine) && + (rLeft.IsTopLineValid == rRight.IsTopLineValid) && + (rLeft.BottomLine == rRight.BottomLine) && + (rLeft.IsBottomLineValid == rRight.IsBottomLineValid) && + (rLeft.LeftLine == rRight.LeftLine) && + (rLeft.IsLeftLineValid == rRight.IsLeftLineValid) && + (rLeft.RightLine == rRight.RightLine) && + (rLeft.IsRightLineValid == rRight.IsRightLineValid) && + (rLeft.HorizontalLine == rRight.HorizontalLine) && + (rLeft.IsHorizontalLineValid == rRight.IsHorizontalLineValid) && + (rLeft.VerticalLine == rRight.VerticalLine) && + (rLeft.IsVerticalLineValid == rRight.IsVerticalLineValid) && + (rLeft.Distance == rRight.Distance) && + (rLeft.IsDistanceValid == rRight.IsDistanceValid); +} + +} // namespace + +bool operator==( const ApiBorderData& rLeft, const ApiBorderData& rRight ) +{ + return + (rLeft.maBorder == rRight.maBorder) && + (rLeft.maTLtoBR == rRight.maTLtoBR) && + (rLeft.maBLtoTR == rRight.maBLtoTR) && + (rLeft.mbBorderUsed == rRight.mbBorderUsed) && + (rLeft.mbDiagUsed == rRight.mbDiagUsed); +} + // ============================================================================ namespace { @@ -1820,6 +1871,14 @@ ApiSolidFillData::ApiSolidFillData() : { } +bool operator==( const ApiSolidFillData& rLeft, const ApiSolidFillData& rRight ) +{ + return + (rLeft.mnColor == rRight.mnColor) && + (rLeft.mbTransparent == rRight.mbTransparent) && + (rLeft.mbUsed == rRight.mbUsed); +} + // ============================================================================ namespace { @@ -2132,7 +2191,8 @@ XfModel::XfModel() : Xf::Xf( const WorkbookHelper& rHelper ) : WorkbookHelper( rHelper ), maAlignment( rHelper ), - maProtection( rHelper ) + maProtection( rHelper ), + meRotationRef( ::com::sun::star::table::CellVertJustify_STANDARD ) { } @@ -2315,13 +2375,46 @@ void Xf::importXf( BiffInputStream& rStrm ) void Xf::finalizeImport() { + StylesBuffer& rStyles = getStyles(); + // alignment and protection maAlignment.finalizeImport(); maProtection.finalizeImport(); - // update used flags from cell style - if( maModel.mbCellXf ) - if( const Xf* pStyleXf = getStyles().getStyleXf( maModel.mnStyleXfId ).get() ) - updateUsedFlags( *pStyleXf ); + + /* Enables the used flags, if the formatting attributes differ from the + style XF. In cell XFs Excel uses the cell attributes, if they differ + from the parent style XF (even if the used flag is switched off). + #109899# ...or if the respective flag is not set in parent style XF. + */ + const Xf* pStyleXf = isCellXf() ? rStyles.getStyleXf( maModel.mnStyleXfId ).get() : 0; + if( pStyleXf ) + { + const XfModel& rStyleData = pStyleXf->maModel; + if( !maModel.mbFontUsed ) + maModel.mbFontUsed = !rStyleData.mbFontUsed || (maModel.mnFontId != rStyleData.mnFontId); + if( !maModel.mbNumFmtUsed ) + maModel.mbNumFmtUsed = !rStyleData.mbNumFmtUsed || (maModel.mnNumFmtId != rStyleData.mnNumFmtId); + if( !maModel.mbAlignUsed ) + maModel.mbAlignUsed = !rStyleData.mbAlignUsed || !(maAlignment.getApiData() == pStyleXf->maAlignment.getApiData()); + if( !maModel.mbProtUsed ) + maModel.mbProtUsed = !rStyleData.mbProtUsed || !(maProtection.getApiData() == pStyleXf->maProtection.getApiData()); + if( !maModel.mbBorderUsed ) + maModel.mbBorderUsed = !rStyleData.mbBorderUsed || !rStyles.equalBorders( maModel.mnBorderId, rStyleData.mnBorderId ); + if( !maModel.mbAreaUsed ) + maModel.mbAreaUsed = !rStyleData.mbAreaUsed || !rStyles.equalFills( maModel.mnFillId, rStyleData.mnFillId ); + } + + /* #i38709# Decide which rotation reference mode to use. If any outer + border line of the cell is set (either explicitly or via cell style), + and the cell contents are rotated, set rotation reference to bottom of + cell. This causes the borders to be painted rotated with the text. */ + if( const Alignment* pAlignment = maModel.mbAlignUsed ? &maAlignment : (pStyleXf ? &pStyleXf->maAlignment : 0) ) + { + sal_Int32 nBorderId = maModel.mbBorderUsed ? maModel.mnBorderId : (pStyleXf ? pStyleXf->maModel.mnBorderId : -1); + if( const Border* pBorder = rStyles.getBorder( nBorderId ).get() ) + if( (pAlignment->getApiData().mnRotation != 0) && pBorder->getApiData().hasAnyOuterBorder() ) + meRotationRef = ::com::sun::star::table::CellVertJustify_BOTTOM; + } } FontRef Xf::getFont() const @@ -2341,7 +2434,7 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const StylesBuffer& rStyles = getStyles(); // create and set cell style - if( maModel.mbCellXf ) + if( isCellXf() ) rPropMap[ PROP_CellStyle ] <<= rStyles.createCellStyle( maModel.mnStyleXfId ); if( maModel.mbFontUsed ) @@ -2356,6 +2449,8 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const rStyles.writeBorderToPropertyMap( rPropMap, maModel.mnBorderId ); if( maModel.mbAreaUsed ) rStyles.writeFillToPropertyMap( rPropMap, maModel.mnFillId ); + if( maModel.mbAlignUsed || maModel.mbBorderUsed ) + rPropMap[ PROP_RotateReference ] <<= meRotationRef; } void Xf::writeToPropertySet( PropertySet& rPropSet ) const @@ -2371,37 +2466,15 @@ void Xf::setBiffUsedFlags( sal_uInt8 nUsedFlags ) - In cell XFs a *set* bit means a used attribute. - In style XFs a *cleared* bit means a used attribute. The boolean flags always store true, if the attribute is used. - The "maModel.mbCellXf == getFlag(...)" construct evaluates to true in - both mentioned cases: cell XF and set bit; or style XF and cleared bit. - */ - maModel.mbFontUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_FONT_USED ); - maModel.mbNumFmtUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_NUMFMT_USED ); - maModel.mbAlignUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_ALIGN_USED ); - maModel.mbProtUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_PROT_USED ); - maModel.mbBorderUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_BORDER_USED ); - maModel.mbAreaUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_AREA_USED ); -} - -void Xf::updateUsedFlags( const Xf& rStyleXf ) -{ - /* Enables the used flags, if the formatting attributes differ from the - passed style XF. In cell XFs Excel uses the cell attributes, if they - differ from the parent style XF. - #109899# ...or if the respective flag is not set in parent style XF. + The "isCellXf() == getFlag(...)" construct evaluates to true in both + mentioned cases: cell XF and set bit; or style XF and cleared bit. */ - const XfModel& rStyleData = rStyleXf.maModel; - if( !maModel.mbFontUsed ) - maModel.mbFontUsed = !rStyleData.mbFontUsed || (maModel.mnFontId != rStyleData.mnFontId); - if( !maModel.mbNumFmtUsed ) - maModel.mbNumFmtUsed = !rStyleData.mbNumFmtUsed || (maModel.mnNumFmtId != rStyleData.mnNumFmtId); - if( !maModel.mbAlignUsed ) - maModel.mbAlignUsed = !rStyleData.mbAlignUsed || !(maAlignment.getApiData() == rStyleXf.maAlignment.getApiData()); - if( !maModel.mbProtUsed ) - maModel.mbProtUsed = !rStyleData.mbProtUsed || !(maProtection.getApiData() == rStyleXf.maProtection.getApiData()); - if( !maModel.mbBorderUsed ) - maModel.mbBorderUsed = !rStyleData.mbBorderUsed || (maModel.mnBorderId != rStyleData.mnBorderId); - if( !maModel.mbAreaUsed ) - maModel.mbAreaUsed = !rStyleData.mbAreaUsed || (maModel.mnFillId != rStyleData.mnFillId); + maModel.mbFontUsed = isCellXf() == getFlag( nUsedFlags, BIFF_XF_FONT_USED ); + maModel.mbNumFmtUsed = isCellXf() == getFlag( nUsedFlags, BIFF_XF_NUMFMT_USED ); + maModel.mbAlignUsed = isCellXf() == getFlag( nUsedFlags, BIFF_XF_ALIGN_USED ); + maModel.mbProtUsed = isCellXf() == getFlag( nUsedFlags, BIFF_XF_PROT_USED ); + maModel.mbBorderUsed = isCellXf() == getFlag( nUsedFlags, BIFF_XF_BORDER_USED ); + maModel.mbAreaUsed = isCellXf() == getFlag( nUsedFlags, BIFF_XF_AREA_USED ); } // ============================================================================ @@ -3133,11 +3206,12 @@ void StylesBuffer::importFormat( BiffInputStream& rStrm ) void StylesBuffer::importXf( BiffInputStream& rStrm ) { XfRef xXf( new Xf( *this ) ); - // store XF in both lists (except BIFF2 which does not support cell styles) - maCellXfs.push_back( xXf ); - if( getBiff() != BIFF2 ) - maStyleXfs.push_back( xXf ); xXf->importXf( rStrm ); + + XfRef xCellXf, xStyleXf; + (xXf->isCellXf() ? xCellXf : xStyleXf) = xXf; + maCellXfs.push_back( xCellXf ); + maStyleXfs.push_back( xStyleXf ); } void StylesBuffer::importStyle( BiffInputStream& rStrm ) @@ -3156,20 +3230,11 @@ void StylesBuffer::finalizeImport() // borders and fills maBorders.forEachMem( &Border::finalizeImport ); maFills.forEachMem( &Fill::finalizeImport ); - - /* Style XFs and cell XFs. The BIFF format stores cell XFs and style XFs - mixed in a single list. The import filter has stored the XFs in both - lists to make the getStyleXf() function working correctly (e.g. for - retrieving the default font, see getDefaultFont() function), except for - BIFF2 which does not support cell styles at all. Therefore, if in BIFF - filter mode, we do not need to finalize the cell styles list. */ - if( getFilterType() == FILTER_OOX ) - maStyleXfs.forEachMem( &Xf::finalizeImport ); + // style XFs and cell XFs + maStyleXfs.forEachMem( &Xf::finalizeImport ); maCellXfs.forEachMem( &Xf::finalizeImport ); - // built-in and user defined cell styles maCellStyles.finalizeImport(); - // differential formatting (for conditional formatting) maDxfs.forEachMem( &Dxf::finalizeImport ); } @@ -3184,6 +3249,11 @@ FontRef StylesBuffer::getFont( sal_Int32 nFontId ) const return maFonts.get( nFontId ); } +BorderRef StylesBuffer::getBorder( sal_Int32 nBorderId ) const +{ + return maBorders.get( nBorderId ); +} + XfRef StylesBuffer::getCellXf( sal_Int32 nXfId ) const { return maCellXfs.get( nXfId ); @@ -3225,6 +3295,56 @@ const FontModel& StylesBuffer::getDefaultFontModel() const return xDefFont.get() ? xDefFont->getModel() : getTheme().getDefaultFontModel(); } +bool StylesBuffer::equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) const +{ + if( nBorderId1 == nBorderId2 ) + return true; + + switch( getFilterType() ) + { + case FILTER_OOX: + // in OOXML, borders are assumed to be unique + return false; + + case FILTER_BIFF: + { + // in BIFF, a new border entry has been created for every XF + const Border* pBorder1 = maBorders.get( nBorderId1 ).get(); + const Border* pBorder2 = maBorders.get( nBorderId2 ).get(); + return pBorder1 && pBorder2 && (pBorder1->getApiData() == pBorder2->getApiData()); + } + + case FILTER_UNKNOWN: + break; + } + return false; +} + +bool StylesBuffer::equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 ) const +{ + if( nFillId1 == nFillId2 ) + return true; + + switch( getFilterType() ) + { + case FILTER_OOX: + // in OOXML, fills are assumed to be unique + return false; + + case FILTER_BIFF: + { + // in BIFF, a new fill entry has been created for every XF + const Fill* pFill1 = maFills.get( nFillId1 ).get(); + const Fill* pFill2 = maFills.get( nFillId2 ).get(); + return pFill1 && pFill2 && (pFill1->getApiData() == pFill2->getApiData()); + } + + case FILTER_UNKNOWN: + break; + } + return false; +} + OUString StylesBuffer::getDefaultStyleName() const { return maCellStyles.getDefaultStyleName(); diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx index 8f6fb872e71e..93ad0a65422f 100644 --- a/oox/source/xls/workbookhelper.cxx +++ b/oox/source/xls/workbookhelper.cxx @@ -317,8 +317,6 @@ public: inline WorksheetBuffer& getWorksheets() const { return *mxWorksheets; } /** Returns the office theme object read from the theme substorage. */ inline ThemeBuffer& getTheme() const { return *mxTheme; } - /** Returns the office theme object reference read from the theme substorage. */ - inline ::boost::shared_ptr< Theme > getThemeRef() const { return mxTheme; } /** Returns all cell formatting objects read from the styles substream. */ inline StylesBuffer& getStyles() const { return *mxStyles; } /** Returns the shared strings read from the shared strings substream. */ @@ -961,11 +959,6 @@ ThemeBuffer& WorkbookHelper::getTheme() const return mrBookData.getTheme(); } -::boost::shared_ptr< Theme > WorkbookHelper::getThemeRef() const -{ - return mrBookData.getThemeRef(); -} - StylesBuffer& WorkbookHelper::getStyles() const { return mrBookData.getStyles(); |