oox/source/ppt/pptshapegroupcontext.cxx |    2 +-
 sd/qa/unit/data/pptx/tdf158512.pptx     |binary
 sd/qa/unit/import-tests2.cxx            |   13 +++++++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 6c9055aaac77323b9446050dafb8dc8d492a6bd6
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Thu Apr 11 11:10:37 2024 +0300
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Mon Dec 9 15:34:03 2024 +0100

    tdf#158512: PPTX import: reset useBgFill flag when it is unused
    
    Even if current fill is not "use background" we should reset useBgFill
    explicitly, since this value could be set from master slide and was
    nested in current shape.
    
    It is somewhat confusing to have fillStyle as none and using slide
    background at the same time. So better to clean it explicitly.
    
    Change-Id: I0d817dc295785be7a6cb8f884d5023d316cd2ebf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165994
    Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
    Tested-by: Jenkins
    Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>

diff --git a/oox/source/ppt/pptshapegroupcontext.cxx 
b/oox/source/ppt/pptshapegroupcontext.cxx
index 26caf62ef67e..66b18c056872 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -108,10 +108,10 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( 
sal_Int32 aElementToken
         {
             auto pShape = std::make_shared<PPTShape>( meShapeLocation, 
u"com.sun.star.drawing.CustomShape"_ustr );
             bool bUseBgFill = rAttribs.getBool(XML_useBgFill, false);
+            pShape->getFillProperties().moUseBgFill = bUseBgFill;
             if (bUseBgFill)
             {
                 pShape->getFillProperties().moFillType = XML_noFill;
-                pShape->getFillProperties().moUseBgFill = true;
             }
             pShape->setModelId(rAttribs.getStringDefaulted( XML_modelId ));
             return new PPTShapeContext( *this, mpSlidePersistPtr, 
mpGroupShapePtr, pShape );
diff --git a/sd/qa/unit/data/pptx/tdf158512.pptx 
b/sd/qa/unit/data/pptx/tdf158512.pptx
new file mode 100644
index 000000000000..96494ddf656a
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf158512.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 2ff83269d682..8e9b7f5f72b9 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -2149,6 +2149,19 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf161430)
     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, eXFS);
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, tdf158512)
+{
+    // First shape on first slide should have no fill to avoid hiding 
background
+    createSdImpressDoc("pptx/tdf158512.pptx");
+
+    const SdrPage* pPage = GetPage(1);
+    CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount());
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE,
+                         
pPage->GetObj(0)->GetMergedItem(XATTR_FILLSTYLE).GetValue());
+    CPPUNIT_ASSERT_EQUAL(false,
+                         
pPage->GetObj(0)->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND).GetValue());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to