chart2/qa/extras/chart2import.cxx              |   16 ++++++++++++++++
 chart2/qa/extras/data/pptx/tdf150176.pptx      |binary
 oox/source/drawingml/chart/objectformatter.cxx |    4 ++--
 3 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 57bfc05e9f0b2517e0922d1bb94902e49f6c6faa
Author:     Balazs Varga <[email protected]>
AuthorDate: Mon Aug 8 18:56:04 2022 +0200
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Tue Aug 9 15:37:02 2022 +0200

    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 <[email protected]>
    (cherry picked from commit 071a36e042c76286fedb38f479dac79f29b661f9)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138017
    Reviewed-by: Thorsten Behrens <[email protected]>

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
new file mode 100644
index 000000000000..fa217f92c822
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf150176.pptx differ
diff --git a/oox/source/drawingml/chart/objectformatter.cxx 
b/oox/source/drawingml/chart/objectformatter.cxx
index 44b3d3a3f0ea..c086c0a1e38f 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -826,8 +826,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();

Reply via email to