summaryrefslogtreecommitdiff
path: root/oox/source/drawingml/graphicshapecontext.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/drawingml/graphicshapecontext.cxx')
-rw-r--r--oox/source/drawingml/graphicshapecontext.cxx38
1 files changed, 21 insertions, 17 deletions
diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index 1d7ebc888cf3..a0335fe68ee2 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: graphicshapecontext.cxx,v $
- * $Revision: 1.8.6.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -109,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 )
{
}
@@ -138,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
@@ -352,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
@@ -379,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& )
{
@@ -395,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" );
}
@@ -408,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;