diff options
author | Daniel Rentz <dr@openoffice.org> | 2009-07-21 08:45:37 +0000 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2009-07-21 08:45:37 +0000 |
commit | 666ab44fc05a32d5d60783b8986fa3c72bb8bb19 (patch) | |
tree | 3bae923318ab89e382e15710ecab386327759fd5 /oox | |
parent | e86f49f5885249ea160cdd16f9866d18f92e4401 (diff) |
#i12587# support chart sheets with embedded shapes
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/drawingml/chart/chartconverter.hxx | 30 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx | 22 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/chartspaceconverter.hxx | 8 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/converterbase.hxx | 10 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/drawingmltypes.hxx | 31 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/graphicshapecontext.hxx | 9 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/shape.hxx | 3 | ||||
-rw-r--r-- | oox/inc/oox/xls/drawingfragment.hxx | 18 | ||||
-rw-r--r-- | oox/source/drawingml/chart/chartconverter.cxx | 11 | ||||
-rw-r--r-- | oox/source/drawingml/chart/chartdrawingfragment.cxx | 64 | ||||
-rw-r--r-- | oox/source/drawingml/chart/chartspaceconverter.cxx | 32 | ||||
-rw-r--r-- | oox/source/drawingml/chart/converterbase.cxx | 20 | ||||
-rw-r--r-- | oox/source/drawingml/graphicshapecontext.cxx | 31 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/shapegroupcontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/ppt/pptshapegroupcontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/shape/ShapeContextHandler.cxx | 2 | ||||
-rw-r--r-- | oox/source/xls/drawingfragment.cxx | 58 |
18 files changed, 206 insertions, 149 deletions
diff --git a/oox/inc/oox/drawingml/chart/chartconverter.hxx b/oox/inc/oox/drawingml/chart/chartconverter.hxx index 77cea6cc418a..6ff165216d23 100644 --- a/oox/inc/oox/drawingml/chart/chartconverter.hxx +++ b/oox/inc/oox/drawingml/chart/chartconverter.hxx @@ -36,15 +36,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 { @@ -61,11 +61,31 @@ 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, + 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 diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx index e8ae69a600e5..e38311394046 100644 --- a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx +++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx @@ -47,20 +47,17 @@ 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). - explicit AnchorPosModel(); - bool isValid() const; + 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 +struct AnchorSizeModel : public EmuSize { - sal_Int64 mnWidth; /// Width in EMUs. - sal_Int64 mnHeight; /// Height in EMUs. - - explicit AnchorSizeModel(); - bool isValid() const; + inline explicit AnchorSizeModel() : EmuSize( -1, -1 ) {} + inline bool isValid() const { return (Width >= 0) && (Height >= 0); } }; // ============================================================================ @@ -80,7 +77,7 @@ public: /** Calculates the resulting shape anchor in EMUs. */ ::com::sun::star::awt::Rectangle - calcEmuLocation( const AnchorSizeModel& rEmuChartSize ) const; + calcEmuLocation( const EmuRectangle& rEmuChartRect ) const; private: AnchorPosModel maFrom; /// Top-left position relative to chart object. @@ -102,7 +99,9 @@ public: ::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::Size& rChartSize, + const ::com::sun::star::awt::Point& rShapesOffset, + bool bOleSupport ); virtual ~ChartDrawingFragment(); virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); @@ -111,9 +110,10 @@ public: private: ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxDrawPage; /// Drawing page of this sheet. - AnchorSizeModel maEmuChartSize; /// Chart size in EMUs. ::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. }; // ============================================================================ diff --git a/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx index 6b632dd819ea..f7b357382142 100644 --- a/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx +++ b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx @@ -34,6 +34,10 @@ #include "oox/drawingml/chart/converterbase.hxx" +namespace com { namespace sun { namespace star { + namespace drawing { class XShapes; } +} } } + namespace oox { namespace drawingml { namespace chart { @@ -49,7 +53,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/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx index 45d8c2fdadc6..c63d1010e166 100644 --- a/oox/inc/oox/drawingml/chart/converterbase.hxx +++ b/oox/inc/oox/drawingml/chart/converterbase.hxx @@ -36,6 +36,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; } } } } @@ -61,9 +62,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 ::com::sun::star::awt::Size& rChartSize, - const ChartSpaceModel& rChartModel ); + const ::com::sun::star::awt::Size& rChartSize ); virtual ~ConverterRoot(); /** Creates an instance for the passed service name, using the passed service factory. */ @@ -84,9 +85,8 @@ protected: /** Returns the API chart document model. */ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > getChartDocument() const; - /** Returns the total size of the chart shape in 1/100 mm. */ - const ::com::sun::star::awt::Size& - getChartSize() 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 eb7c68b18888..cfc09c3aadda 100644 --- a/oox/inc/oox/drawingml/drawingmltypes.hxx +++ b/oox/inc/oox/drawingml/drawingmltypes.hxx @@ -138,6 +138,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 4d3856385b61..e656d224d403 100644 --- a/oox/inc/oox/drawingml/graphicshapecontext.hxx +++ b/oox/inc/oox/drawingml/graphicshapecontext.hxx @@ -51,10 +51,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; }; // ==================================================================== @@ -102,13 +104,16 @@ class ChartGraphicDataContext : public ShapeContext public: explicit ChartGraphicDataContext( ::oox::core::ContextHandler& rParent, - ShapePtr pShapePtr ); + ShapePtr pShapePtr, 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 1b832232ca52..dfd33acf1d27 100644 --- a/oox/inc/oox/drawingml/shape.hxx +++ b/oox/inc/oox/drawingml/shape.hxx @@ -69,7 +69,8 @@ class CreateShapeCallback public: virtual ~CreateShapeCallback(); virtual void onCreateXShape( - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape ) = 0; + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ) = 0; }; typedef ::boost::shared_ptr< CreateShapeCallback > CreateShapeCallbackRef; diff --git a/oox/inc/oox/xls/drawingfragment.hxx b/oox/inc/oox/xls/drawingfragment.hxx index d081192aec00..8921cebd230e 100644 --- a/oox/inc/oox/xls/drawingfragment.hxx +++ b/oox/inc/oox/xls/drawingfragment.hxx @@ -42,25 +42,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/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index 6358e6b899e6..53c301dab7f8 100644 --- a/oox/source/drawingml/chart/chartconverter.cxx +++ b/oox/source/drawingml/chart/chartconverter.cxx @@ -37,7 +37,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; @@ -58,14 +60,15 @@ ChartConverter::~ChartConverter() } void ChartConverter::convertFromModel( XmlFilterBase& rFilter, - ChartSpaceModel& rModel, const Reference< XChartDocument >& rxChartDoc, const Size& rChartSize ) + 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, rChartSize, 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 index ea034fd9418e..eb584c6aa9d9 100644 --- a/oox/source/drawingml/chart/chartdrawingfragment.cxx +++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx @@ -38,6 +38,7 @@ 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; @@ -51,32 +52,6 @@ namespace chart { // ============================================================================ -AnchorPosModel::AnchorPosModel() : - mfX( -1.0 ), - mfY( -1.0 ) -{ -} - -bool AnchorPosModel::isValid() const -{ - return (0.0 <= mfX) && (mfX <= 1.0) && (0.0 <= mfY) && (mfY <= 1.0); -} - -// ---------------------------------------------------------------------------- - -AnchorSizeModel::AnchorSizeModel() : - mnWidth( -1 ), - mnHeight( -1 ) -{ -} - -bool AnchorSizeModel::isValid() const -{ - return (mnWidth >= 0) && (mnHeight >= 0); -} - -// ============================================================================ - ShapeAnchor::ShapeAnchor( bool bRelSize ) : mbRelSize( bRelSize ) { @@ -85,8 +60,8 @@ ShapeAnchor::ShapeAnchor( bool bRelSize ) : void ShapeAnchor::importExt( const AttributeList& rAttribs ) { OSL_ENSURE( !mbRelSize, "ShapeAnchor::importExt - unexpected 'cdr:ext' element" ); - maSize.mnWidth = rAttribs.getInteger64( XML_cx, 0 ); - maSize.mnHeight = rAttribs.getInteger64( XML_cy, 0 ); + maSize.Width = rAttribs.getInteger64( XML_cx, 0 ); + maSize.Height = rAttribs.getInteger64( XML_cy, 0 ); } void ShapeAnchor::setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ) @@ -112,7 +87,7 @@ void ShapeAnchor::setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OU } } -Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuChartSize ) const +Rectangle ShapeAnchor::calcEmuLocation( const EmuRectangle& rEmuChartRect ) const { Rectangle aLoc( -1, -1, -1, -1 ); @@ -121,19 +96,19 @@ Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuChartSize ) c if( maFrom.isValid() && (mbRelSize ? maTo.isValid() : maSize.isValid()) ) { // calculate shape position - aLoc.X = getLimitedValue< sal_Int32, double >( maFrom.mfX * rEmuChartSize.mnWidth, 0, SAL_MAX_INT32 ); - aLoc.Y = getLimitedValue< sal_Int32, double >( maFrom.mfY * rEmuChartSize.mnHeight, 0, SAL_MAX_INT32 ); + 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 * rEmuChartSize.mnWidth, 0, SAL_MAX_INT32 ) - aLoc.X; + 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 * rEmuChartSize.mnHeight, 0, SAL_MAX_INT32 ) - aLoc.Y; + aLoc.Height = getLimitedValue< sal_Int32, double >( maTo.mfY * rEmuChartRect.Height, 0, SAL_MAX_INT32 ) - aLoc.Y; if( aLoc.Height < 0 ) { aLoc.Y += aLoc.Height; @@ -142,8 +117,8 @@ Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuChartSize ) c } else { - aLoc.Width = getLimitedValue< sal_Int32, sal_Int64 >( maSize.mnWidth, 0, SAL_MAX_INT32 ); - aLoc.Height = getLimitedValue< sal_Int32, sal_Int64 >( maSize.mnHeight, 0, SAL_MAX_INT32 ); + 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 ); } } @@ -152,12 +127,16 @@ Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuChartSize ) c // ============================================================================ ChartDrawingFragment::ChartDrawingFragment( XmlFilterBase& rFilter, - const OUString& rFragmentPath, const Reference< XShapes >& rxDrawPage, const Size& rChartSize ) : + const OUString& rFragmentPath, const Reference< XShapes >& rxDrawPage, + const Size& rChartSize, const Point& rShapesOffset, bool bOleSupport ) : FragmentHandler2( rFilter, rFragmentPath ), - mxDrawPage( rxDrawPage ) + mxDrawPage( rxDrawPage ), + mbOleSupport( bOleSupport ) { - maEmuChartSize.mnWidth = static_cast< sal_Int64 >( rChartSize.Width ) * 360; - maEmuChartSize.mnHeight = static_cast< sal_Int64 >( rChartSize.Height ) * 360; + 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() @@ -198,8 +177,11 @@ ContextHandlerRef ChartDrawingFragment::onCreateContext( sal_Int32 nElement, con 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 ); + return new GraphicalObjectFrameContext( *this, ShapePtr(), mxShape, true ); + break; case CDR_TOKEN( grpSp ): mxShape.reset( new Shape( "com.sun.star.drawing.GroupShape" ) ); return new ShapeGroupContext( *this, ShapePtr(), mxShape ); @@ -240,7 +222,7 @@ void ChartDrawingFragment::onEndElement( const OUString& rChars ) case CDR_TOKEN( relSizeAnchor ): if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() ) { - Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuChartSize ); + 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 ); } diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index ccd19a2e73e3..100a503674f1 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -45,6 +45,7 @@ #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; @@ -71,7 +72,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) */ @@ -163,9 +164,32 @@ void ChartSpaceConverter::convertFromModel() // embedded drawing shapes if( mrModel.maDrawingPath.getLength() > 0 ) try { - Reference< XDrawPageSupplier > xDrawPageSupp( getChartDocument(), UNO_QUERY_THROW ); - Reference< XShapes > xShapes( xDrawPageSupp->getDrawPage(), UNO_QUERY_THROW ); - getFilter().importFragment( new ChartDrawingFragment( getFilter(), mrModel.maDrawingPath, xShapes, getChartSize() ) ); + /* 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& ) { diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx index 950c351278ee..82297611fe2b 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -56,18 +56,18 @@ namespace chart { struct ConverterData { + ObjectFormatter maFormatter; XmlFilterBase& mrFilter; ChartConverter& mrConverter; Reference< XChartDocument > mxDoc; Size maSize; - ObjectFormatter maFormatter; explicit ConverterData( XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, - const Size& rChartSize, - const ChartSpaceModel& rChartSpace ); + const Size& rChartSize ); ~ConverterData(); }; @@ -76,14 +76,14 @@ struct ConverterData ConverterData::ConverterData( XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, - const Size& rChartSize, - const ChartSpaceModel& rChartModel ) : + const Size& rChartSize ) : + maFormatter( rFilter, rxChartDoc, rChartModel ), mrFilter( rFilter ), mrConverter( rChartConverter ), mxDoc( rxChartDoc ), - maSize( rChartSize ), - maFormatter( rFilter, rxChartDoc, rChartModel ) + maSize( rChartSize ) { OSL_ENSURE( mxDoc.is(), "ConverterData::ConverterData - missing chart document" ); // lock the model to suppress internal updates during conversion @@ -115,10 +115,10 @@ ConverterData::~ConverterData() ConverterRoot::ConverterRoot( XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, - const Size& rChartSize, - const ChartSpaceModel& rChartModel ) : - mxData( new ConverterData( rFilter, rChartConverter, rxChartDoc, rChartSize, rChartModel ) ) + const Size& rChartSize ) : + mxData( new ConverterData( rFilter, rChartConverter, rChartModel, rxChartDoc, rChartSize ) ) { } diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index f29d613ed711..0a15f8a0ffc8 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 ) +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 @@ -348,23 +349,25 @@ Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildConte class CreateChartCallback : public CreateShapeCallback { public: - explicit CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath ); - virtual void onCreateXShape( const Reference< drawing::XShape >& rxShape ); + explicit CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath, bool bEmbedShapes ); + virtual void onCreateXShape( const Reference< drawing::XShape >& rxShape, const Reference< drawing::XShapes >& rxShapes ); private: XmlFilterBase& mrFilter; OUString maFragmentPath; + bool mbEmbedShapes; }; // -------------------------------------------------------------------- -CreateChartCallback::CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath ) : +CreateChartCallback::CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath, bool bEmbedShapes ) : mrFilter( rFilter ), - maFragmentPath( rFragmentPath ) + maFragmentPath( rFragmentPath ), + mbEmbedShapes( bEmbedShapes ) { } -void CreateChartCallback::onCreateXShape( const Reference< drawing::XShape >& rxShape ) +void CreateChartCallback::onCreateXShape( const Reference< drawing::XShape >& rxShape, const Reference< drawing::XShapes >& rxShapes ) { OSL_ENSURE( maFragmentPath.getLength() > 0, "CreateChartCallback::onCreateXShape - missing chart fragment" ); if( maFragmentPath.getLength() > 0 ) try @@ -376,14 +379,17 @@ void CreateChartCallback::onCreateXShape( const Reference< drawing::XShape >& rx // 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, rxShape->getSize() ); + 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::onCreateXShape( const Reference< drawing::XShape >& rx // ==================================================================== -ChartGraphicDataContext::ChartGraphicDataContext( ContextHandler& rParent, ShapePtr pShapePtr ) : - ShapeContext( rParent, ShapePtr(), pShapePtr ) +ChartGraphicDataContext::ChartGraphicDataContext( ContextHandler& rParent, ShapePtr pShapePtr, bool bEmbedShapes ) : + ShapeContext( rParent, ShapePtr(), pShapePtr ), + mbEmbedShapes( bEmbedShapes ) { pShapePtr->setServiceName( "com.sun.star.drawing.OLE2Shape" ); } @@ -405,7 +412,7 @@ Reference< XFastContextHandler > ChartGraphicDataContext::createFastChildContext { AttributeList aAttribs( rxAttribs ); OUString aFragmentPath = getFragmentPathFromRelId( aAttribs.getString( NMSP_RELATIONSHIPS | XML_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/shape.cxx b/oox/source/drawingml/shape.cxx index 6791c76612e5..cbb84136fccc 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -434,7 +434,7 @@ Reference< XShape > Shape::createAndInsert( // use a callback for further processing on the XShape (e.g. charts) if( mxShape.is() && mxCreateCallback.get() ) - mxCreateCallback->onCreateXShape( mxShape ); + mxCreateCallback->onCreateXShape( mxShape, rxShapes ); return mxShape; } diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx index bd3d93d9fca0..290d2b3f2958 100644 --- a/oox/source/drawingml/shapegroupcontext.cxx +++ b/oox/source/drawingml/shapegroupcontext.cxx @@ -106,7 +106,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/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index 067aaacc262e..761d8529f1cb 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -107,7 +107,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/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index f67d17ed7bc8..6d1da1e74da3 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -70,7 +70,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" )); diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index 51fe0f0e3bce..9de5d6f29033 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -61,22 +61,6 @@ namespace xls { // ============================================================================ -AnchorPosModel::AnchorPosModel() : - mnX( -1 ), - mnY( -1 ) -{ -} - -// ---------------------------------------------------------------------------- - -AnchorSizeModel::AnchorSizeModel() : - mnWidth( -1 ), - mnHeight( -1 ) -{ -} - -// ---------------------------------------------------------------------------- - AnchorCellModel::AnchorCellModel() : mnCol( -1 ), mnRow( -1 ), @@ -124,15 +108,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.getInteger64( XML_x, 0 ); - maPos.mnY = rAttribs.getInteger64( XML_y, 0 ); + maPos.X = rAttribs.getInteger64( XML_x, 0 ); + maPos.Y = rAttribs.getInteger64( 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.getInteger64( XML_cx, 0 ); - maSize.mnHeight = rAttribs.getInteger64( XML_cy, 0 ); + maSize.Width = rAttribs.getInteger64( XML_cx, 0 ); + maSize.Height = rAttribs.getInteger64( XML_cy, 0 ); } void ShapeAnchor::importClientData( const AttributeList& rAttribs ) @@ -175,12 +159,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: OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::isValidAnchor - invalid from position" ); @@ -208,10 +192,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: @@ -238,10 +222,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; @@ -283,8 +267,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 ); // calculate shape position @@ -292,10 +276,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: @@ -326,8 +310,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: @@ -381,8 +365,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 ----------------------------------- @@ -423,7 +407,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 ); |