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.extern@allotropia.de>
Tested-by: Jenkins
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
This commit is contained in:
Vasily Melenchuk 2024-04-11 11:10:37 +03:00 committed by Gabor Kelemen
parent 41ab6a5dfa
commit 6c9055aaac
3 changed files with 14 additions and 1 deletions

View file

@ -108,10 +108,10 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken
{ {
auto pShape = std::make_shared<PPTShape>( meShapeLocation, u"com.sun.star.drawing.CustomShape"_ustr ); auto pShape = std::make_shared<PPTShape>( meShapeLocation, u"com.sun.star.drawing.CustomShape"_ustr );
bool bUseBgFill = rAttribs.getBool(XML_useBgFill, false); bool bUseBgFill = rAttribs.getBool(XML_useBgFill, false);
pShape->getFillProperties().moUseBgFill = bUseBgFill;
if (bUseBgFill) if (bUseBgFill)
{ {
pShape->getFillProperties().moFillType = XML_noFill; pShape->getFillProperties().moFillType = XML_noFill;
pShape->getFillProperties().moUseBgFill = true;
} }
pShape->setModelId(rAttribs.getStringDefaulted( XML_modelId )); pShape->setModelId(rAttribs.getStringDefaulted( XML_modelId ));
return new PPTShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, pShape ); return new PPTShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, pShape );

Binary file not shown.

View file

@ -2149,6 +2149,19 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf161430)
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, eXFS); 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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */