From e9e59fc57083f5056a64d3c6c33867b6466af3c8 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Mon, 30 Nov 2009 16:54:56 +0100 Subject: #i100778# #i86609# ooxml import: positioning of legend and plot area --- oox/source/drawingml/chart/chartcontextbase.cxx | 61 +++++++++++ oox/source/drawingml/chart/chartconverter.cxx | 8 +- oox/source/drawingml/chart/chartspaceconverter.cxx | 22 ++-- oox/source/drawingml/chart/converterbase.cxx | 111 ++++++++++++++++++--- oox/source/drawingml/chart/modelbase.cxx | 20 ++++ oox/source/drawingml/chart/objectformatter.cxx | 4 +- oox/source/drawingml/chart/plotareaconverter.cxx | 26 +++++ oox/source/drawingml/chart/titlecontext.cxx | 59 ----------- oox/source/drawingml/chart/titleconverter.cxx | 61 ++++++++++- oox/source/drawingml/chart/titlemodel.cxx | 19 ---- 10 files changed, 280 insertions(+), 111 deletions(-) (limited to 'oox/source/drawingml/chart') diff --git a/oox/source/drawingml/chart/chartcontextbase.cxx b/oox/source/drawingml/chart/chartcontextbase.cxx index a65f56dbfc5f..a1b557f5af83 100644 --- a/oox/source/drawingml/chart/chartcontextbase.cxx +++ b/oox/source/drawingml/chart/chartcontextbase.cxx @@ -31,6 +31,7 @@ #include "oox/drawingml/chart/chartcontextbase.hxx" #include "oox/drawingml/shapepropertiescontext.hxx" +#include "oox/drawingml/chart/modelbase.hxx" using ::oox::core::ContextHandler2Helper; using ::oox::core::ContextHandlerRef; @@ -57,6 +58,66 @@ ContextHandlerRef ShapePrWrapperContext::onCreateContext( sal_Int32 nElement, co // ============================================================================ +LayoutContext::LayoutContext( ContextHandler2Helper& rParent, LayoutModel& rModel ) : + ContextBase< LayoutModel >( rParent, rModel ) +{ +} + +LayoutContext::~LayoutContext() +{ +} + +ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) +{ + switch( getCurrentElement() ) + { + case C_TOKEN( layout ): + switch( nElement ) + { + case C_TOKEN( manualLayout ): + mrModel.mbAutoLayout = false; + return this; + } + break; + + case C_TOKEN( manualLayout ): + switch( nElement ) + { + case C_TOKEN( x ): + mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( y ): + mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( w ): + mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( h ): + mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( xMode ): + mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( yMode ): + mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( wMode ): + mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( hMode ): + mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( layoutTarget ): + mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer ); + return 0; + } + break; + } + return 0; +} + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index f4633e3cad66..59698bb91e45 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,13 +58,14 @@ ChartConverter::~ChartConverter() } void ChartConverter::convertFromModel( XmlFilterBase& rFilter, - ChartSpaceModel& rModel, const Reference< XChartDocument >& rxChartDoc ) + ChartSpaceModel& rChartModel, 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 ); - ChartSpaceConverter aSpaceConv( aConvBase, rModel ); + ConverterRoot aConvBase( rFilter, *this, rChartModel, rxChartDoc, rChartSize ); + ChartSpaceConverter aSpaceConv( aConvBase, rChartModel ); aSpaceConv.convertFromModel(); } } diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index e6e62af3b5d2..ebb5af23a368 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -30,11 +30,11 @@ ************************************************************************/ #include "oox/drawingml/chart/chartspaceconverter.hxx" +#include #include #include #include #include -#include #include "oox/core/xmlfilterbase.hxx" #include "oox/drawingml/chart/chartconverter.hxx" #include "oox/drawingml/chart/chartspacemodel.hxx" @@ -85,8 +85,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 +125,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,13 +146,11 @@ 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() ) - { - PropertySet aStandardApiDiagramProp( xStandardApiChartDoc->getDiagram() ); - aStandardApiDiagramProp.setProperty( PROP_IncludeHiddenCells, !mrModel.mbPlotVisOnly ); - } + /* 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( getChart1Diagram() ); + aOldDiaProp.setProperty( PROP_IncludeHiddenCells, !mrModel.mbPlotVisOnly ); } // ============================================================================ diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx index c9b91e308414..369b71fc6b48 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include "oox/core/xmlfilterbase.hxx" #include "oox/drawingml/theme.hxx" @@ -41,9 +42,12 @@ using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; 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::lang::XMultiServiceFactory; using ::com::sun::star::frame::XModel; +using ::com::sun::star::awt::Rectangle; +using ::com::sun::star::awt::Size; using ::com::sun::star::chart2::XChartDocument; using ::oox::core::XmlFilterBase; @@ -55,16 +59,18 @@ namespace chart { struct ConverterData { + ObjectFormatter maFormatter; XmlFilterBase& mrFilter; ChartConverter& mrConverter; Reference< XChartDocument > mxDoc; - ObjectFormatter maFormatter; + Size maSize; explicit ConverterData( XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ); + const Size& rChartSize ); ~ConverterData(); }; @@ -73,12 +79,14 @@ struct ConverterData ConverterData::ConverterData( XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ) : + const Size& rChartSize ) : + maFormatter( rFilter, rxChartDoc, rChartModel ), mrFilter( rFilter ), mrConverter( rChartConverter ), mxDoc( rxChartDoc ), - maFormatter( rFilter, rxChartDoc, rChartSpace ) + maSize( rChartSize ) { OSL_ENSURE( mxDoc.is(), "ConverterData::ConverterData - missing chart document" ); // lock the model to suppress internal updates during conversion @@ -110,9 +118,10 @@ ConverterData::~ConverterData() ConverterRoot::ConverterRoot( XmlFilterBase& rFilter, ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, const Reference< XChartDocument >& rxChartDoc, - const ChartSpaceModel& rChartSpace ) : - mxData( new ConverterData( rFilter, rChartConverter, rxChartDoc, rChartSpace ) ) + const Size& rChartSize ) : + mxData( new ConverterData( rFilter, rChartConverter, rChartModel, rxChartDoc, rChartSize ) ) { } @@ -120,13 +129,12 @@ ConverterRoot::~ConverterRoot() { } -Reference< XInterface > ConverterRoot::createInstance( - const Reference< XMultiServiceFactory >& rxFactory, const OUString& rServiceName ) +Reference< XInterface > ConverterRoot::createInstance( const OUString& rServiceName ) const { Reference< XInterface > xInt; - if( rxFactory.is() ) try + try { - xInt = rxFactory->createInstance( rServiceName ); + xInt = mxData->mrFilter.getGlobalFactory()->createInstance( rServiceName ); } catch( Exception& ) { @@ -135,11 +143,6 @@ Reference< XInterface > ConverterRoot::createInstance( return xInt; } -Reference< XInterface > ConverterRoot::createInstance( const OUString& rServiceName ) const -{ - return createInstance( mxData->mrFilter.getGlobalFactory(), rServiceName ); -} - XmlFilterBase& ConverterRoot::getFilter() const { return mxData->mrFilter; @@ -155,11 +158,89 @@ Reference< XChartDocument > ConverterRoot::getChartDocument() const return mxData->mxDoc; } +const Size& ConverterRoot::getChartSize() const +{ + return mxData->maSize; +} + ObjectFormatter& ConverterRoot::getFormatter() const { return mxData->maFormatter; } +Reference< ::com::sun::star::chart::XDiagram > ConverterRoot::getChart1Diagram() const +{ + Reference< ::com::sun::star::chart::XDiagram > xDiagram; + Reference< ::com::sun::star::chart::XChartDocument > xChart1Doc( mxData->mxDoc, UNO_QUERY ); + if( xChart1Doc.is() ) + xDiagram = xChart1Doc->getDiagram(); + return xDiagram; +} + +// ============================================================================ + +namespace { + +sal_Int32 lclCalcPosition( sal_Int32 nChartSize, double fPos, sal_Int32 nPosMode ) +{ + switch( nPosMode ) + { + case XML_edge: // absolute start position as factor of chart size + return getLimitedValue< sal_Int32, double >( nChartSize * fPos + 0.5, 0, nChartSize ); + case XML_factor: // position relative to object default position + OSL_ENSURE( false, "lclCalcPosition - relative positioning not supported" ); + return -1; + }; + + OSL_ENSURE( false, "lclCalcPosition - unknown positioning mode" ); + return -1; +} + +sal_Int32 lclCalcSize( sal_Int32 nPos, sal_Int32 nChartSize, double fSize, sal_Int32 nSizeMode ) +{ + sal_Int32 nValue = getLimitedValue< sal_Int32, double >( nChartSize * fSize + 0.5, 0, nChartSize ); + switch( nSizeMode ) + { + case XML_factor: // size as factor of chart size + return nValue; + case XML_edge: // absolute end position as factor of chart size + return nValue - nPos + 1; + }; + + OSL_ENSURE( false, "lclCalcSize - unknown size mode" ); + return -1; +} + +} // namespace + +// ---------------------------------------------------------------------------- + +LayoutConverter::LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel ) : + ConverterBase< LayoutModel >( rParent, rModel ) +{ +} + +LayoutConverter::~LayoutConverter() +{ +} + +bool LayoutConverter::calcAbsRectangle( Rectangle& orRect ) +{ + if( !mrModel.mbAutoLayout ) + { + const Size& rChartSize = getChartSize(); + orRect.X = lclCalcPosition( rChartSize.Width, mrModel.mfX, mrModel.mnXMode ); + orRect.Y = lclCalcPosition( rChartSize.Height, mrModel.mfY, mrModel.mnYMode ); + if( (orRect.X >= 0) && (orRect.Y >= 0) ) + { + orRect.Width = lclCalcSize( orRect.X, rChartSize.Width, mrModel.mfW, mrModel.mnWMode ); + orRect.Height = lclCalcSize( orRect.Y, rChartSize.Height, mrModel.mfH, mrModel.mnHMode ); + return (orRect.Width > 0) && (orRect.Height > 0); + } + } + return false; +} + // ============================================================================ } // namespace chart diff --git a/oox/source/drawingml/chart/modelbase.cxx b/oox/source/drawingml/chart/modelbase.cxx index a7ff9c2641b0..2c71fd0028df 100644 --- a/oox/source/drawingml/chart/modelbase.cxx +++ b/oox/source/drawingml/chart/modelbase.cxx @@ -54,6 +54,26 @@ void NumberFormat::setAttributes( const AttributeList& rAttribs ) // ============================================================================ +LayoutModel::LayoutModel() : + mfX( 0.0 ), + mfY( 0.0 ), + mfW( 0.0 ), + mfH( 0.0 ), + mnXMode( XML_factor ), + mnYMode( XML_factor ), + mnWMode( XML_factor ), + mnHMode( XML_factor ), + mnTarget( XML_outer ), + mbAutoLayout( true ) +{ +} + +LayoutModel::~LayoutModel() +{ +} + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 46253e92dd68..a82f0193f832 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1199,12 +1199,12 @@ void ObjectFormatter::convertAutomaticFill( PropertySet& rPropSet, ObjectType eO pFormat->convertAutomaticFill( rPropSet, nSeriesIdx ); } -bool ObjectFormatter::isAutomaticLine( const ModelRef< Shape >& rxShapeProp ) +/*static*/ bool ObjectFormatter::isAutomaticLine( const ModelRef< Shape >& rxShapeProp ) { return !rxShapeProp || !rxShapeProp->getLineProperties().maLineFill.moFillType.has(); } -bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp ) +/*static*/ bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp ) { return !rxShapeProp || !rxShapeProp->getFillProperties().moFillType.has(); } diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx index b4345af3f088..278de57ef7cb 100644 --- a/oox/source/drawingml/chart/plotareaconverter.cxx +++ b/oox/source/drawingml/chart/plotareaconverter.cxx @@ -32,6 +32,7 @@ #include "oox/drawingml/chart/plotareaconverter.hxx" #include #include +#include #include #include #include @@ -45,6 +46,8 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::awt::Rectangle; +using ::com::sun::star::chart::XDiagramPositioning; using ::com::sun::star::chart2::XCoordinateSystem; using ::com::sun::star::chart2::XCoordinateSystemContainer; using ::com::sun::star::chart2::XDiagram; @@ -408,6 +411,29 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) PropertySet aPropSet( xDiagram->getWall() ); getFormatter().convertFrameFormatting( aPropSet, mrModel.mxShapeProp, OBJECTTYPE_PLOTAREA2D ); } + + // plot area position and size + LayoutModel& rLayout = mrModel.mxLayout.getOrCreate(); + LayoutConverter aLayoutConv( *this, rLayout ); + Rectangle aDiagramRect; + if( aLayoutConv.calcAbsRectangle( aDiagramRect ) ) try + { + Reference< XDiagramPositioning > xPositioning( getChart1Diagram(), UNO_QUERY_THROW ); + switch( rLayout.mnTarget ) + { + case XML_inner: + xPositioning->setDiagramPositionExcludingAxes( aDiagramRect ); + break; + case XML_outer: + xPositioning->setDiagramPositionIncludingAxes( aDiagramRect ); + break; + default: + OSL_ENSURE( false, "PlotAreaConverter::convertFromModel - unknown positioning target" ); + } + } + catch( Exception& ) + { + } } // ============================================================================ diff --git a/oox/source/drawingml/chart/titlecontext.cxx b/oox/source/drawingml/chart/titlecontext.cxx index 05006ce2f8fd..1ab0ee5bb938 100644 --- a/oox/source/drawingml/chart/titlecontext.cxx +++ b/oox/source/drawingml/chart/titlecontext.cxx @@ -45,65 +45,6 @@ namespace chart { // ============================================================================ -LayoutContext::LayoutContext( ContextHandler2Helper& rParent, LayoutModel& rModel ) : - ContextBase< LayoutModel >( rParent, rModel ) -{ -} - -LayoutContext::~LayoutContext() -{ -} - -ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) -{ - switch( getCurrentElement() ) - { - case C_TOKEN( layout ): - switch( nElement ) - { - case C_TOKEN( manualLayout ): - return this; - } - break; - - case C_TOKEN( manualLayout ): - switch( nElement ) - { - case C_TOKEN( x ): - mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( y ): - mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( w ): - mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( h ): - mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( xMode ): - mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( yMode ): - mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( wMode ): - mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( hMode ): - mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( layoutTarget ): - mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer ); - return 0; - } - break; - } - return 0; -} - -// ============================================================================ - TextContext::TextContext( ContextHandler2Helper& rParent, TextModel& rModel ) : ContextBase< TextModel >( rParent, rModel ) { diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx index 7c866666c844..4d7d1d29f423 100644 --- a/oox/source/drawingml/chart/titleconverter.cxx +++ b/oox/source/drawingml/chart/titleconverter.cxx @@ -30,11 +30,15 @@ ************************************************************************/ #include "oox/drawingml/chart/titleconverter.hxx" +#include +#include +#include #include #include #include #include #include +#include "properties.hxx" #include "oox/drawingml/textbody.hxx" #include "oox/drawingml/textparagraph.hxx" #include "oox/drawingml/chart/datasourceconverter.hxx" @@ -45,6 +49,7 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::awt::Rectangle; using ::com::sun::star::chart2::XDiagram; using ::com::sun::star::chart2::XFormattedString; using ::com::sun::star::chart2::XLegend; @@ -198,12 +203,66 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram ) { if( rxDiagram.is() ) try { + namespace cssc2 = ::com::sun::star::chart2; + // create the legend Reference< XLegend > xLegend( createInstance( CREATE_OUSTRING( "com.sun.star.chart2.Legend" ) ), UNO_QUERY_THROW ); rxDiagram->setLegend( xLegend ); + PropertySet aPropSet( xLegend ); + aPropSet.setProperty( PROP_Show, true ); + + // legend position and expansion + LayoutModel& rLayout = mrModel.mxLayout.getOrCreate(); + LayoutConverter aLayoutConv( *this, rLayout ); + Rectangle aLegendRect; + bool bManualLayout = aLayoutConv.calcAbsRectangle( aLegendRect ); + if( bManualLayout ) + { + // relative position + cssc2::RelativePosition aRelPos; + aRelPos.Primary = getLimitedValue< double, double >( rLayout.mfX, 0.0, 1.0 ); + aRelPos.Secondary = getLimitedValue< double, double >( rLayout.mfY, 0.0, 1.0 ); + aRelPos.Anchor = ::com::sun::star::drawing::Alignment_TOP_LEFT; + aPropSet.setProperty( PROP_AnchorPosition, cssc2::LegendPosition_CUSTOM ); + aPropSet.setProperty( PROP_RelativePosition, aRelPos ); + + // #i71697# it is not possible to set the size directly, do some magic here + cssc2::LegendExpansion eLegendExpand = cssc2::LegendExpansion_BALANCED; + double fRatio = static_cast< double >( aLegendRect.Width ) / aLegendRect.Height; + if( fRatio > 1.5 ) + eLegendExpand = cssc2::LegendExpansion_WIDE; + else if( fRatio < 0.75 ) + eLegendExpand = cssc2::LegendExpansion_HIGH; + aPropSet.setProperty( PROP_Expansion, eLegendExpand ); + } + else // automatic layout + { + cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_LINE_END; + cssc2::LegendExpansion eLegendExpand = cssc2::LegendExpansion_HIGH; + switch( mrModel.mnPosition ) + { + case XML_l: + eLegendPos = cssc2::LegendPosition_LINE_START; + eLegendExpand = cssc2::LegendExpansion_HIGH; + break; + case XML_r: + eLegendPos = cssc2::LegendPosition_LINE_END; + eLegendExpand = cssc2::LegendExpansion_HIGH; + break; + case XML_t: + eLegendPos = cssc2::LegendPosition_PAGE_START; + eLegendExpand = cssc2::LegendExpansion_WIDE; + break; + case XML_b: + eLegendPos = cssc2::LegendPosition_PAGE_END; + eLegendExpand = cssc2::LegendExpansion_WIDE; + break; + } + aPropSet.setProperty( PROP_AnchorPosition, eLegendPos ); + aPropSet.setProperty( PROP_Expansion, eLegendExpand ); + } // legend formatting - PropertySet aPropSet( xLegend ); getFormatter().convertFormatting( aPropSet, mrModel.mxShapeProp, mrModel.mxTextProp, OBJECTTYPE_LEGEND ); } catch( Exception& ) diff --git a/oox/source/drawingml/chart/titlemodel.cxx b/oox/source/drawingml/chart/titlemodel.cxx index 0a317396bb0b..95fea2020adc 100644 --- a/oox/source/drawingml/chart/titlemodel.cxx +++ b/oox/source/drawingml/chart/titlemodel.cxx @@ -37,25 +37,6 @@ namespace chart { // ============================================================================ -LayoutModel::LayoutModel() : - mfX( 0.0 ), - mfY( 0.0 ), - mfW( 0.0 ), - mfH( 0.0 ), - mnXMode( XML_factor ), - mnYMode( XML_factor ), - mnWMode( XML_factor ), - mnHMode( XML_factor ), - mnTarget( XML_outer ) -{ -} - -LayoutModel::~LayoutModel() -{ -} - -// ============================================================================ - TextModel::TextModel() { } -- cgit