summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/drawingml/fillproperties.cxx2
-rw-r--r--oox/source/export/drawingml.cxx15
-rw-r--r--sw/qa/extras/uiwriter/uiwriter4.cxx10
3 files changed, 20 insertions, 7 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 5d17c321d0f8..2b682bcd1b99 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -812,6 +812,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
{
eFillStyle = FillStyle_HATCH;
rPropMap.setProperty( ShapeProperty::FillHatch, createHatch( maPatternProps.moPattPreset.get(), aColor.getColor( rGraphicHelper, nPhClr ) ) );
+ if( aColor.hasTransparency() )
+ rPropMap.setProperty( ShapeProperty::FillTransparency, aColor.getTransparency() );
// Set background color for hatch
if(maPatternProps.maPattBgColor.isUsed())
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 09ca9c22915a..87bbe81bd88a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1658,12 +1658,19 @@ void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const cs
{
mpFS->startElementNS(XML_a, XML_pattFill, XML_prst, GetHatchPattern(rHatch));
+ sal_Int32 nAlpha = MAX_PERCENT;
+ if (GetProperty(rXPropSet, "FillTransparence"))
+ {
+ sal_Int32 nTransparency = 0;
+ mAny >>= nTransparency;
+ nAlpha = (MAX_PERCENT - (PER_PERCENT * nTransparency));
+ }
+
mpFS->startElementNS(XML_a, XML_fgClr);
- WriteColor(::Color(ColorTransparency, rHatch.Color));
+ WriteColor(::Color(ColorTransparency, rHatch.Color), nAlpha);
mpFS->endElementNS( XML_a , XML_fgClr );
::Color nColor = COL_WHITE;
- sal_Int32 nAlpha = 0;
if ( GetProperty( rXPropSet, "FillBackground" ) )
{
@@ -1671,13 +1678,13 @@ void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const cs
mAny >>= isBackgroundFilled;
if( isBackgroundFilled )
{
- nAlpha = MAX_PERCENT;
-
if( GetProperty( rXPropSet, "FillColor" ) )
{
mAny >>= nColor;
}
}
+ else
+ nAlpha = 0;
}
mpFS->startElementNS(XML_a, XML_bgClr);
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx
index c1635b64ffad..29d31a0940b2 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -3681,7 +3681,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf143760WrapContourToOff)
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getShape(1), "SurroundContour"));
}
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf127989)
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testHatchFill)
{
createSwDoc();
@@ -3695,16 +3695,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf127989)
xShapeProps->setPropertyValue("FillStyle", uno::makeAny(drawing::FillStyle_HATCH));
xShapeProps->setPropertyValue("FillHatchName", uno::makeAny(OUString("Black 0 Degrees")));
xShapeProps->setPropertyValue("FillBackground", uno::makeAny(false));
+ xShapeProps->setPropertyValue("FillTransparence", uno::makeAny(sal_Int32(30)));
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
xDrawPage->add(xShape);
// Save it as DOCX and load it again.
- reload("Office Open XML Text", "tdf127989.docx");
+ reload("Office Open XML Text", "hatchFill.docx");
CPPUNIT_ASSERT_EQUAL(1, getShapes());
- // Without fix this had failed, because the background of the hatch was not set as 'no background'.
+ // tdf#127989 Without fix this had failed, because the background of the hatch was not set as 'no background'.
CPPUNIT_ASSERT(!getProperty<bool>(getShape(1), "FillBackground"));
+
+ // tdf#146822 Without fix this had failed, because the transparency value of the hatch was not exported.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(30), getProperty<sal_Int32>(getShape(1), "FillTransparence"));
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testCaptionShape)