summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2009-07-21 08:45:37 +0000
committerDaniel Rentz <dr@openoffice.org>2009-07-21 08:45:37 +0000
commit666ab44fc05a32d5d60783b8986fa3c72bb8bb19 (patch)
tree3bae923318ab89e382e15710ecab386327759fd5 /oox/source
parente86f49f5885249ea160cdd16f9866d18f92e4401 (diff)
#i12587# support chart sheets with embedded shapes
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/drawingml/chart/chartconverter.cxx11
-rw-r--r--oox/source/drawingml/chart/chartdrawingfragment.cxx64
-rw-r--r--oox/source/drawingml/chart/chartspaceconverter.cxx32
-rw-r--r--oox/source/drawingml/chart/converterbase.cxx20
-rw-r--r--oox/source/drawingml/graphicshapecontext.cxx31
-rw-r--r--oox/source/drawingml/shape.cxx2
-rw-r--r--oox/source/drawingml/shapegroupcontext.cxx2
-rw-r--r--oox/source/ppt/pptshapegroupcontext.cxx2
-rw-r--r--oox/source/shape/ShapeContextHandler.cxx2
-rw-r--r--oox/source/xls/drawingfragment.cxx58
10 files changed, 112 insertions, 112 deletions
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 );