Kaydet (Commit) 232251e1 authored tarafından Tamás Zolnai's avatar Tamás Zolnai

tdf#107608: PPTX: Import pattern fill background color

Change-Id: Ic7e9dc314c961605fc8467eebd465fa286993e17
Reviewed-on: https://gerrit.libreoffice.org/48633Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
üst d999b55e
......@@ -73,7 +73,8 @@ enum class ShapeProperty
FillHatch,
ShadowXDistance,
FillBitmapNameFromUrl,
LAST = FillBitmapNameFromUrl
FillBackground,
LAST = FillBackground
};
typedef o3tl::enumarray<ShapeProperty, sal_Int32> ShapePropertyIds;
......
......@@ -673,10 +673,15 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
Color aColor( maPatternProps.maPattFgColor );
if( aColor.isUsed() && maPatternProps.moPattPreset.has() )
{
// we do not support hatches that have background
// color too, so all this is some best-effort approach
eFillStyle = FillStyle_HATCH;
rPropMap.setProperty( ShapeProperty::FillHatch, createHatch( maPatternProps.moPattPreset.get(), aColor.getColor( rGraphicHelper, nPhClr ) ) );
// Set background color for hatch
if(maPatternProps.maPattBgColor.isUsed())
{
rPropMap.setProperty( ShapeProperty::FillBackground, true );
rPropMap.setProperty( ShapeProperty::FillColor, maPatternProps.maPattBgColor.getColor( rGraphicHelper, nPhClr ) );
}
}
else if ( maPatternProps.maPattBgColor.isUsed() )
{
......
......@@ -45,7 +45,8 @@ static const ShapePropertyIds spnDefaultShapeIds =
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
PROP_FillHatch,
PROP_ShadowXDistance,
PROP_FillBitmapName
PROP_FillBitmapName,
PROP_FillBackground
};
} // namespace
......
......@@ -158,6 +158,7 @@ ExternalLinks
ExtrapolateBackward
ExtrapolateForward
FileFormat
FillBackground
FillBitmapMode
FillBitmapName
FillBitmapPositionOffsetX
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -126,6 +126,7 @@ public:
void testTdf114848();
void testTdf68759();
void testTdf90626();
void testTdf107608();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
......@@ -177,6 +178,7 @@ public:
CPPUNIT_TEST(testTdf114848);
CPPUNIT_TEST(testTdf68759);
CPPUNIT_TEST(testTdf90626);
CPPUNIT_TEST(testTdf107608);
CPPUNIT_TEST_SUITE_END();
......@@ -1353,6 +1355,30 @@ void SdOOXMLExportTest2::testTdf90626()
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[4]/a:pPr/a:buSzPct", "val", "150568");
}
void SdOOXMLExportTest2::testTdf107608()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf107608.pptx"), PPTX);
utl::TempFile tempFile;
xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY_THROW );
drawing::FillStyle aFillStyle( drawing::FillStyle_NONE );
xPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH, aFillStyle);
bool bBackgroundFill = false;
xPropSet->getPropertyValue("FillBackground") >>= bBackgroundFill;
CPPUNIT_ASSERT(bBackgroundFill);
sal_Int32 nBackgroundColor;
xPropSet->getPropertyValue("FillColor") >>= nBackgroundColor;
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x92D050), nBackgroundColor);
xDocShRef->DoClose();
}
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment