diff options
author | Daniel Rentz <dr@openoffice.org> | 2009-07-13 08:56:32 +0000 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2009-07-13 08:56:32 +0000 |
commit | a386089b5304685c37f9cacf107a374b0083c326 (patch) | |
tree | 21a6ad9eb2594aac7739a12d895c8cc588a8b411 /oox | |
parent | f2f5cbfdd200561ca465eadb3526bfdaba3ef58f (diff) |
#i12587# import shapes in charts from MSOOXML
Diffstat (limited to 'oox')
22 files changed, 101 insertions, 59 deletions
diff --git a/oox/inc/oox/core/namespaces.hxx b/oox/inc/oox/core/namespaces.hxx index ccc7d376ffc6..7b4e9c377d16 100644 --- a/oox/inc/oox/core/namespaces.hxx +++ b/oox/inc/oox/core/namespaces.hxx @@ -48,6 +48,7 @@ const sal_Int32 NMSP_ACTIVATION = 12 << 16; const sal_Int32 NMSP_DRAWINGML = 21 << 16; const sal_Int32 NMSP_DIAGRAM = 22 << 16; const sal_Int32 NMSP_CHART = 23 << 16; +const sal_Int32 NMSP_CDR = 24 << 16; // ChartDrawingML // VML const sal_Int32 NMSP_VML = 31 << 16; const sal_Int32 NMSP_OFFICE = 32 << 16; @@ -80,6 +81,23 @@ inline sal_Int32 getToken( sal_Int32 nElement ) { return nElement & TOKEN_MASK; /** Returns the namespace of the passed element without token identifier. */ inline sal_Int32 getNamespace( sal_Int32 nElement ) { return nElement & NMSP_MASK; } +// ---------------------------------------------------------------------------- + +// defines for tokens with specific namespaces, can be used in switch/cases +#define A_TOKEN( token ) (::oox::NMSP_DRAWINGML | XML_##token) +#define AX_TOKEN( token ) (::oox::NMSP_AX | XML_##token) +#define C_TOKEN( token ) (::oox::NMSP_CHART | XML_##token) +#define CDR_TOKEN( token ) (::oox::NMSP_CDR | XML_##token) +#define O_TOKEN( token ) (::oox::NMSP_OFFICE | XML_##token) +#define PPT_TOKEN( token ) (::oox::NMSP_PPT | XML_##token) +#define R_TOKEN( token ) (::oox::NMSP_RELATIONSHIPS | XML_##token) +#define VML_TOKEN( token ) (::oox::NMSP_VML | XML_##token) +#define VMLX_TOKEN( token ) (::oox::NMSP_VML_XLS | XML_##token) +#define XDR_TOKEN( token ) (::oox::NMSP_XDR | XML_##token) +#define XLS_TOKEN( token ) (::oox::NMSP_XLS | XML_##token) +#define XM_TOKEN( token ) (::oox::NMSP_XM | XML_##token) +#define XML_TOKEN( token ) (::oox::NMSP_XML | XML_##token) + // ============================================================================ } // namespace oox diff --git a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx index 0ca7fad9ff74..d1f61bcb3827 100644 --- a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx +++ b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx @@ -33,8 +33,6 @@ #include "oox/core/fragmenthandler2.hxx" -#define C_TOKEN( token ) (::oox::NMSP_CHART | XML_##token) - namespace oox { namespace drawingml { class Shape; } } namespace oox { diff --git a/oox/inc/oox/drawingml/chart/chartconverter.hxx b/oox/inc/oox/drawingml/chart/chartconverter.hxx index 63cae67b8af1..77cea6cc418a 100644 --- a/oox/inc/oox/drawingml/chart/chartconverter.hxx +++ b/oox/inc/oox/drawingml/chart/chartconverter.hxx @@ -36,6 +36,7 @@ #include <oox/dllapi.h> namespace com { namespace sun { namespace star { + namespace awt { struct Size; } namespace chart2 { class XChartDocument; } namespace chart2 { namespace data { class XDataProvider; } } namespace chart2 { namespace data { class XDataSequence; } } @@ -64,7 +65,8 @@ public: void convertFromModel( ::oox::core::XmlFilterBase& rFilter, ChartSpaceModel& rModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc ); + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc, + 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/chartspacemodel.hxx b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx index 6e39aae1480d..53413f2d6d5c 100644 --- a/oox/inc/oox/drawingml/chart/chartspacemodel.hxx +++ b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx @@ -61,6 +61,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 f456d955df5d..45d8c2fdadc6 100644 --- a/oox/inc/oox/drawingml/chart/converterbase.hxx +++ b/oox/inc/oox/drawingml/chart/converterbase.hxx @@ -62,7 +62,8 @@ public: ::oox::core::XmlFilterBase& rFilter, ChartConverter& rChartConverter, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ); + const ::com::sun::star::awt::Size& rChartSize, + const ChartSpaceModel& rChartModel ); virtual ~ConverterRoot(); /** Creates an instance for the passed service name, using the passed service factory. */ @@ -83,6 +84,9 @@ 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 object formatter. */ ObjectFormatter& getFormatter() const; diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx index 553d4cd92a9a..1b832232ca52 100644 --- a/oox/inc/oox/drawingml/shape.hxx +++ b/oox/inc/oox/drawingml/shape.hxx @@ -130,7 +130,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 ); @@ -148,14 +148,14 @@ 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 ); 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 ); diff --git a/oox/inc/oox/ppt/pptshape.hxx b/oox/inc/oox/ppt/pptshape.hxx index bd2ec9292677..47397a00ca76 100644 --- a/oox/inc/oox/ppt/pptshape.hxx +++ b/oox/inc/oox/ppt/pptshape.hxx @@ -53,7 +53,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/excelhandlers.hxx b/oox/inc/oox/xls/excelhandlers.hxx index de5a0ca644a0..3b34a14963ec 100644 --- a/oox/inc/oox/xls/excelhandlers.hxx +++ b/oox/inc/oox/xls/excelhandlers.hxx @@ -34,12 +34,6 @@ #include "oox/core/fragmenthandler2.hxx" #include "oox/xls/worksheethelper.hxx" -#define XML_TOKEN( token ) (::oox::NMSP_XML | XML_##token) -#define R_TOKEN( token ) (::oox::NMSP_RELATIONSHIPS | XML_##token) -#define XLS_TOKEN( token ) (::oox::NMSP_XLS | XML_##token) -#define XDR_TOKEN( token ) (::oox::NMSP_XDR | XML_##token) -#define XM_TOKEN( token ) (::oox::NMSP_XM | XML_##token) - namespace oox { namespace xls { diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx index 9f278a670271..c12ca89ef3ef 100644 --- a/oox/inc/oox/xls/workbookhelper.hxx +++ b/oox/inc/oox/xls/workbookhelper.hxx @@ -286,8 +286,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/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 3e6d72b6322e..12cb8dbe134b 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -190,6 +190,7 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r 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( "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing" ), NMSP_CDR ); xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:vml" ), NMSP_VML ); xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:office" ), NMSP_OFFICE ); diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index f4633e3cad66..6358e6b899e6 100644 --- a/oox/source/drawingml/chart/chartconverter.cxx +++ b/oox/source/drawingml/chart/chartconverter.cxx @@ -37,6 +37,7 @@ using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Exception; +using ::com::sun::star::awt::Size; using ::com::sun::star::chart2::XChartDocument; using ::com::sun::star::chart2::data::XDataProvider; using ::com::sun::star::chart2::data::XDataSequence; @@ -57,12 +58,12 @@ ChartConverter::~ChartConverter() } void ChartConverter::convertFromModel( XmlFilterBase& rFilter, - ChartSpaceModel& rModel, const Reference< XChartDocument >& rxChartDoc ) + ChartSpaceModel& rModel, const Reference< XChartDocument >& rxChartDoc, const Size& rChartSize ) { OSL_ENSURE( rxChartDoc.is(), "ChartConverter::convertFromModel - missing chart document" ); if( rxChartDoc.is() ) { - ConverterRoot aConvBase( rFilter, *this, rxChartDoc, rModel ); + ConverterRoot aConvBase( rFilter, *this, rxChartDoc, rChartSize, rModel ); ChartSpaceConverter aSpaceConv( aConvBase, rModel ); aSpaceConv.convertFromModel(); } diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index e6e62af3b5d2..ccd19a2e73e3 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -30,13 +30,15 @@ ************************************************************************/ #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" @@ -48,6 +50,8 @@ 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; @@ -85,8 +89,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() ); @@ -125,10 +129,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 @@ -146,12 +150,25 @@ 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 + { + Reference< XDrawPageSupplier > xDrawPageSupp( getChartDocument(), UNO_QUERY_THROW ); + Reference< XShapes > xShapes( xDrawPageSupp->getDrawPage(), UNO_QUERY_THROW ); + getFilter().importFragment( new ChartDrawingFragment( getFilter(), mrModel.maDrawingPath, xShapes, getChartSize() ) ); + } + 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 c1d23d5d9dbd..10e3128753e0 100644 --- a/oox/source/drawingml/chart/chartspacefragment.cxx +++ b/oox/source/drawingml/chart/chartspacefragment.cxx @@ -79,6 +79,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 c9b91e308414..950c351278ee 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -44,6 +44,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; @@ -58,12 +59,14 @@ struct ConverterData XmlFilterBase& mrFilter; ChartConverter& mrConverter; Reference< XChartDocument > mxDoc; + Size maSize; ObjectFormatter maFormatter; explicit ConverterData( XmlFilterBase& rFilter, ChartConverter& rChartConverter, const Reference< XChartDocument >& rxChartDoc, + const Size& rChartSize, const ChartSpaceModel& rChartSpace ); ~ConverterData(); }; @@ -74,11 +77,13 @@ ConverterData::ConverterData( XmlFilterBase& rFilter, ChartConverter& rChartConverter, const Reference< XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ) : + const Size& rChartSize, + const ChartSpaceModel& rChartModel ) : mrFilter( rFilter ), mrConverter( rChartConverter ), mxDoc( rxChartDoc ), - maFormatter( rFilter, rxChartDoc, rChartSpace ) + maSize( rChartSize ), + maFormatter( rFilter, rxChartDoc, rChartModel ) { OSL_ENSURE( mxDoc.is(), "ConverterData::ConverterData - missing chart document" ); // lock the model to suppress internal updates during conversion @@ -111,8 +116,9 @@ ConverterRoot::ConverterRoot( XmlFilterBase& rFilter, ChartConverter& rChartConverter, const Reference< XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ) : - mxData( new ConverterData( rFilter, rChartConverter, rxChartDoc, rChartSpace ) ) + const Size& rChartSize, + const ChartSpaceModel& rChartModel ) : + mxData( new ConverterData( rFilter, rChartConverter, rxChartDoc, rChartSize, rChartModel ) ) { } @@ -155,6 +161,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 6cb46853a7ab..a02d0d5cc4bd 100644 --- a/oox/source/drawingml/chart/makefile.mk +++ b/oox/source/drawingml/chart/makefile.mk @@ -50,6 +50,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 6c3edccdbf42..f29d613ed711 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -383,7 +383,7 @@ void CreateChartCallback::onCreateXShape( const Reference< drawing::XShape >& rx // convert imported chart model to chart document Reference< chart2::XChartDocument > xChartDoc( xDocModel, UNO_QUERY_THROW ); - mrFilter.getChartConverter().convertFromModel( mrFilter, aModel, xChartDoc ); + mrFilter.getChartConverter().convertFromModel( mrFilter, aModel, xChartDoc, rxShape->getSize() ); } catch( Exception& ) { diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 7954b08135ba..6791c76612e5 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -124,7 +124,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 ) @@ -134,7 +134,7 @@ void Shape::addShape( rtl::OUString sServiceName( msServiceName ); if( sServiceName.getLength() ) { - Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, rxTheme, rxShapes, pShapeRect ) ); + Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, pTheme, rxShapes, pShapeRect ) ); if( pShapeMap && msId.getLength() ) { @@ -144,7 +144,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& ) @@ -173,7 +173,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 ) @@ -224,14 +224,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 ) { @@ -356,23 +356,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 ); // } @@ -420,8 +420,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 ); } diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index c168b8085894..e4b144e6e55d 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -67,7 +67,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 ) @@ -157,7 +157,7 @@ void PPTShape::addShape( aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getOtherTextStyle() : rSlidePersist.getOtherTextStyle(); setMasterTextListStyle( aMasterTextListStyle ); - Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, rxTheme, rxShapes, pShapeRect ) ); + Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, pTheme, rxShapes, pShapeRect ) ); if( pShapeMap && msId.getLength() ) { @@ -167,7 +167,7 @@ void PPTShape::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& ) diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 2644a5b36ba0..0f083c52a209 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -145,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 c2d98650776b..f67d17ed7bc8 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -231,7 +231,7 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException) } else if (mpShape.get() != NULL) { - mpShape->addShape(*mxFilterBase, mpThemePtr, mxShapes); + mpShape->addShape(*mxFilterBase, mpThemePtr.get(), mxShapes); xResult.set(mpShape->getXShape()); } } diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index 3351ffed784e..51fe0f0e3bce 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -468,7 +468,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/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx index 6697b1d86f85..8d4e02a837b7 100644 --- a/oox/source/xls/workbookhelper.cxx +++ b/oox/source/xls/workbookhelper.cxx @@ -309,8 +309,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. */ @@ -913,11 +911,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(); |