diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2019-03-16 18:05:01 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-03-18 16:38:55 +0100 |
commit | 0dac43445b35da7e554dd4d7574c59611a0d0be1 (patch) | |
tree | 25cac121065fa662701be54cfa4971d4f5e88714 /oox | |
parent | cf89d6dbfd72e60e459b2ffef313a6d8b477857b (diff) |
tdf#81437 XLSX import: fix missing chart border
of MSO 2007/2010 documents with "automatic" chart area
formatting, setting also the default 0.75 pt border width
and light gray border color.
Note: MSO 2007/2010 and MSO 2013/2016 have different
"automatic" border colors. This fix uses the last, light
gray version instead of the dark one.
Change-Id: I579f3745d5fcb2a36e1b4d519320631d20e60fd4
Reviewed-on: https://gerrit.libreoffice.org/69341
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/chart/objectformatter.cxx | 17 | ||||
-rw-r--r-- | oox/source/helper/graphichelper.cxx | 11 |
2 files changed, 24 insertions, 4 deletions
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 5b576d824ba3..f97bd780bf3e 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -600,7 +600,8 @@ class LineFormatter : public DetailFormatterBase public: explicit LineFormatter( ObjectFormatterData& rData, - const AutoFormatEntry* pAutoFormatEntry ); + const AutoFormatEntry* pAutoFormatEntry, + const ObjectType eObjType ); /** Converts line formatting to the passed property set. */ void convertFormatting( @@ -809,8 +810,8 @@ DetailFormatterBase::DetailFormatterBase( ObjectFormatterData& rData, const Auto return aColor.getColor( mrData.mrFilter.getGraphicHelper() ); } -LineFormatter::LineFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) : - DetailFormatterBase( rData, pAutoFormatEntry ) +LineFormatter::LineFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry, const ObjectType eObjType ) : + DetailFormatterBase(rData, pAutoFormatEntry) { if( pAutoFormatEntry ) { @@ -819,6 +820,14 @@ LineFormatter::LineFormatter( ObjectFormatterData& rData, const AutoFormatEntry* if( const Theme* pTheme = mrData.mrFilter.getCurrentTheme() ) if( const LineProperties* pLineProps = pTheme->getLineStyle( pAutoFormatEntry->mnThemedIdx ) ) *mxAutoLine = *pLineProps; + // set automatic border property for chartarea, because of tdf#81437 and tdf#82217 + if ( eObjType == OBJECTTYPE_CHARTSPACE ) + { + mxAutoLine->maLineFill.moFillType = rData.mrFilter.getGraphicHelper().getDefaultChartAreaLineStyle(); + mxAutoLine->moLineWidth = rData.mrFilter.getGraphicHelper().getDefaultChartAreaLineWidth(); + // this value is what MSO 2016 use as a default color for chartspace border + mxAutoLine->maLineFill.maFillColor.setSrgbClr( 0xD9D9D9 ); + } // change line width according to chart auto style if( mxAutoLine->moLineWidth.has() ) mxAutoLine->moLineWidth = mxAutoLine->moLineWidth.get() * pAutoFormatEntry->mnRelLineWidth / 100; @@ -918,7 +927,7 @@ void TextFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Te } ObjectTypeFormatter::ObjectTypeFormatter( ObjectFormatterData& rData, const ObjectTypeFormatEntry& rEntry, const ChartSpaceModel& rChartSpace, const ObjectType eObjType ) : - maLineFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoLines, rChartSpace.mnStyle ) ), + maLineFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoLines, rChartSpace.mnStyle ), eObjType ), maFillFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoFills, rChartSpace.mnStyle ), eObjType ), maTextFormatter( rData, lclGetAutoTextEntry( rEntry.mpAutoTexts, rChartSpace.mnStyle ), rChartSpace.mxTextProp ), mrModelObjHelper( rData.maModelObjHelper ), diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index ee2b44b3b98f..b720aeab8746 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -165,6 +165,17 @@ sal_Int32 GraphicHelper::getDefaultChartAreaFillStyle() const return XML_solidFill; } +sal_Int32 GraphicHelper::getDefaultChartAreaLineStyle() const +{ + return XML_solidFill; +} + +sal_Int16 GraphicHelper::getDefaultChartAreaLineWidth() const +{ + // this value is what MSO 2016 writes fixing incomplete MSO 2010 documents (0.75 pt in emu) + return 9525; +} + // Device info and device dependent unit conversion --------------------------- sal_Int32 GraphicHelper::convertScreenPixelXToHmm( double fPixelX ) const |