diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2022-08-08 18:56:04 +0200 |
---|---|---|
committer | Balazs Varga <balazs.varga.extern@allotropia.de> | 2022-08-09 11:35:42 +0200 |
commit | 071a36e042c76286fedb38f479dac79f29b661f9 (patch) | |
tree | 870d32a748337201581940ed2514be5bca9d9b31 | |
parent | a28ff6a920492b64095b30cf7800b0678ea84c60 (diff) |
tdf#150176 pptx chart import: fix automatic border style
Do not set the default border style for chart area in case of
pptx charts, if it is came from the MSO as an automtic line style.
regression from commit: 0dac43445b35da7e554dd4d7574c59611a0d0be1
(tdf#81437 XLSX import: fix missing chart border)
Change-Id: Iaaaecc1dffe80c3f1528851e707236f2f7228bee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137993
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 16 | ||||
-rw-r--r-- | chart2/qa/extras/data/pptx/tdf150176.pptx | bin | 0 -> 52342 bytes | |||
-rw-r--r-- | oox/source/drawingml/chart/objectformatter.cxx | 4 |
3 files changed, 18 insertions, 2 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 316520fb5197..4e5b3a83130e 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -85,6 +85,7 @@ public: void testTdf126033(); void testAutoBackgroundXLSX(); void testAutoChartAreaBorderPropXLSX(); + void testAutoChartAreaBorderPropPPTX(); void testChartAreaStyleBackgroundXLSX(); void testChartHatchFillXLSX(); void testAxisTextRotationXLSX(); @@ -178,6 +179,7 @@ public: CPPUNIT_TEST(testTdf126033); CPPUNIT_TEST(testAutoBackgroundXLSX); CPPUNIT_TEST(testAutoChartAreaBorderPropXLSX); + CPPUNIT_TEST(testAutoChartAreaBorderPropPPTX); CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX); CPPUNIT_TEST(testChartHatchFillXLSX); CPPUNIT_TEST(testAxisTextRotationXLSX); @@ -1106,6 +1108,20 @@ void Chart2ImportTest::testAutoChartAreaBorderPropXLSX() sal_Int32(26), nWidth); } +void Chart2ImportTest::testAutoChartAreaBorderPropPPTX() +{ + load(u"/chart2/qa/extras/data/pptx/", u"tdf150176.pptx"); + Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); + + // Test "Automatic" chartarea border style/color/width. + Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground(); + CPPUNIT_ASSERT(xPropSet.is()); + drawing::LineStyle eStyle = xPropSet->getPropertyValue("LineStyle").get<drawing::LineStyle>(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chartarea border should be loaded as none style for pptx.", + drawing::LineStyle_NONE, eStyle); +} + void Chart2ImportTest::testChartAreaStyleBackgroundXLSX() { load(u"/chart2/qa/extras/data/xlsx/", u"chart-area-style-background.xlsx"); diff --git a/chart2/qa/extras/data/pptx/tdf150176.pptx b/chart2/qa/extras/data/pptx/tdf150176.pptx Binary files differnew file mode 100644 index 000000000000..fa217f92c822 --- /dev/null +++ b/chart2/qa/extras/data/pptx/tdf150176.pptx diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 14c96d166a03..5644b9eedf09 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -829,8 +829,8 @@ 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 ) + // set automatic border property for chartarea, because of tdf#81437 and tdf#82217, except for pptx (tdf#150176) + if ( eObjType == OBJECTTYPE_CHARTSPACE && !rData.mrFilter.getFileUrl().endsWithIgnoreAsciiCase(".pptx") ) { mxAutoLine->maLineFill.moFillType = oox::GraphicHelper::getDefaultChartAreaLineStyle(); mxAutoLine->moLineWidth = oox::GraphicHelper::getDefaultChartAreaLineWidth(); |