From f2cf2212a6a9974da558e97be54b97b49ca039f3 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 18 Feb 2015 20:16:43 +0100 Subject: implement fill based on style also for chart area, tdf#89451 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7b488e222cd44e75d1e0ff7f8e545e9399f418b5 better way to set default for chart area fill style, related tdf#89451 Change-Id: Iee7fea0f55cf54d43a349b6cc0ffa25995069e40 no need for that anymore Change-Id: I53002c0b97da66c44429b5ace0fc709b5e8a325f Reviewed-on: https://gerrit.libreoffice.org/14547 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- oox/source/drawingml/chart/chartspaceconverter.cxx | 9 +-------- oox/source/drawingml/chart/objectformatter.cxx | 16 +++++++++++++++- oox/source/helper/graphichelper.cxx | 4 ++-- oox/source/ppt/pptimport.cxx | 6 +++--- 4 files changed, 21 insertions(+), 14 deletions(-) (limited to 'oox') diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index 37de52d23832..56a10ae8796b 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -76,14 +76,7 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern // formatting of the chart background. The default fill style varies with applications. PropertySet aBackPropSet( getChartDocument()->getPageBackground() ); - aBackPropSet.setProperty( - PROP_FillStyle, - uno::makeAny(getFilter().getGraphicHelper().getDefaultChartAreaFillStyle())); - - if( mrModel.mxShapeProp.is() ) - { - getFormatter().convertFrameFormatting( aBackPropSet, mrModel.mxShapeProp, OBJECTTYPE_CHARTSPACE ); - } + getFormatter().convertFrameFormatting( aBackPropSet, mrModel.mxShapeProp, OBJECTTYPE_CHARTSPACE ); // convert plot area (container of all chart type groups) PlotAreaConverter aPlotAreaConv( *this, mrModel.mxPlotArea.getOrCreate() ); diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 3b49a639369a..df0c5c11f378 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -34,6 +34,7 @@ #include "oox/drawingml/theme.hxx" #include "drawingml/chart/chartspacemodel.hxx" #include "oox/helper/modelobjecthelper.hxx" +#include namespace oox { namespace drawingml { @@ -167,6 +168,14 @@ static const AutoFormatEntry spNoFormats[] = AUTOFORMAT_END() }; +static const AutoFormatEntry spChartSpaceFill[] = +{ + AUTOFORMAT_COLOR( 1, 32, THEMED_STYLE_SUBTLE, XML_bg1 ), + AUTOFORMAT_COLOR( 33, 40, THEMED_STYLE_SUBTLE, XML_lt1 ), + AUTOFORMAT_COLOR( 41, 48, THEMED_STYLE_SUBTLE, XML_dk1 ), + AUTOFORMAT_END() +}; + static const AutoFormatEntry spDataTableLines[] = { AUTOFORMAT_COLORMOD( 1, 32, THEMED_STYLE_SUBTLE, XML_tx1, XML_tint, 75000 ), @@ -536,7 +545,7 @@ struct ObjectTypeFormatEntry static const ObjectTypeFormatEntry spObjTypeFormatEntries[] = { // object type property info auto text auto line auto fill auto effect - TYPEFORMAT_FRAME( OBJECTTYPE_CHARTSPACE, &saCommonPropInfo, 0, spNoFormats, spNoFormats, 0 /* eq to Ch2 */ ), + TYPEFORMAT_FRAME( OBJECTTYPE_CHARTSPACE, &saCommonPropInfo, 0, spNoFormats, spChartSpaceFill, 0 /* eq to Ch2 */ ), TYPEFORMAT_FRAME( OBJECTTYPE_CHARTTITLE, &saCommonPropInfo, spChartTitleTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), TYPEFORMAT_FRAME( OBJECTTYPE_LEGEND, &saCommonPropInfo, spOtherTexts, spNoFormats, spNoFormats, 0 /* eq to Ch2 */ ), TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA2D, &saCommonPropInfo, 0, 0 /* eq to Ch2 */, spPlotArea2dFills, 0 /* eq to Ch2 */ ), @@ -869,6 +878,11 @@ FillFormatter::FillFormatter( ObjectFormatterData& rData, const AutoFormatEntry* if( const Theme* pTheme = mrData.mrFilter.getCurrentTheme() ) if( const FillProperties* pFillProps = pTheme->getFillStyle( pAutoFormatEntry->mnThemedIdx ) ) *mxAutoFill = *pFillProps; + + if (eObjType == OBJECTTYPE_CHARTSPACE) + { + mxAutoFill->moFillType = rData.mrFilter.getGraphicHelper().getDefaultChartAreaFillStyle(); + } } } diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index 0638ffe6350b..6687301590c8 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -152,9 +152,9 @@ sal_Int32 GraphicHelper::getPaletteColor( sal_Int32 /*nPaletteIdx*/ ) const return API_RGB_TRANSPARENT; } -drawing::FillStyle GraphicHelper::getDefaultChartAreaFillStyle() const +sal_Int32 GraphicHelper::getDefaultChartAreaFillStyle() const { - return drawing::FillStyle_SOLID; + return XML_solidFill; } // Device info and device dependent unit conversion --------------------------- diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index 328d16a2f47e..fc29c1ce277b 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -193,7 +193,7 @@ class PptGraphicHelper : public GraphicHelper public: explicit PptGraphicHelper( const PowerPointImport& rFilter ); virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const SAL_OVERRIDE; - virtual drawing::FillStyle getDefaultChartAreaFillStyle() const SAL_OVERRIDE; + virtual sal_Int32 getDefaultChartAreaFillStyle() const SAL_OVERRIDE; private: const PowerPointImport& mrFilter; }; @@ -209,9 +209,9 @@ sal_Int32 PptGraphicHelper::getSchemeColor( sal_Int32 nToken ) const return mrFilter.getSchemeColor( nToken ); } -drawing::FillStyle PptGraphicHelper::getDefaultChartAreaFillStyle() const +sal_Int32 PptGraphicHelper::getDefaultChartAreaFillStyle() const { - return drawing::FillStyle_NONE; + return XML_noFill; } } // namespace -- cgit