Kaydet (Commit) dddcfa00 authored tarafından Balazs Varga's avatar Balazs Varga Kaydeden (comit) Markus Mohrhard

tdf#94231 OOXML Import: Fix disappeared Hatch Background Color

With adding the PROP_FillBackground property to spnCommonPropIds and
spnFilledPropIds the hatch background color imported correctly,
an will not disappear.

Change-Id: I56745179236d2912a2d5c8585098e54acc4e3062
Reviewed-on: https://gerrit.libreoffice.org/63069
Tested-by: Jenkins
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 1baf55c0
...@@ -912,6 +912,7 @@ void Chart2ImportTest::testChartHatchFillXLSX() ...@@ -912,6 +912,7 @@ void Chart2ImportTest::testChartHatchFillXLSX()
uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent); uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
// Check the chart background FillStyle is HATCH
Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground(); Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
CPPUNIT_ASSERT(xPropSet.is()); CPPUNIT_ASSERT(xPropSet.is());
drawing::FillStyle eStyle = xPropSet->getPropertyValue("FillStyle").get<drawing::FillStyle>(); drawing::FillStyle eStyle = xPropSet->getPropertyValue("FillStyle").get<drawing::FillStyle>();
...@@ -919,6 +920,16 @@ void Chart2ImportTest::testChartHatchFillXLSX() ...@@ -919,6 +920,16 @@ void Chart2ImportTest::testChartHatchFillXLSX()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Chart background fill in this xlsx should be loaded as hatch fill.", CPPUNIT_ASSERT_EQUAL_MESSAGE("Chart background fill in this xlsx should be loaded as hatch fill.",
drawing::FillStyle_HATCH, eStyle); drawing::FillStyle_HATCH, eStyle);
// Check the FillBackground of chart background
bool bBackgroundFill = false;
xPropSet->getPropertyValue("FillBackground") >>= bBackgroundFill;
CPPUNIT_ASSERT(bBackgroundFill);
sal_Int32 nBackgroundColor;
xPropSet->getPropertyValue("FillColor") >>= nBackgroundColor;
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xFFFFFF), nBackgroundColor);
// Check the datapoint has HatchName value
uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0)); uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
CPPUNIT_ASSERT(xDataSeries.is()); CPPUNIT_ASSERT(xDataSeries.is());
...@@ -926,6 +937,15 @@ void Chart2ImportTest::testChartHatchFillXLSX() ...@@ -926,6 +937,15 @@ void Chart2ImportTest::testChartHatchFillXLSX()
OUString sHatchName; OUString sHatchName;
xPropertySet->getPropertyValue("HatchName") >>= sHatchName; xPropertySet->getPropertyValue("HatchName") >>= sHatchName;
CPPUNIT_ASSERT(!sHatchName.isEmpty()); CPPUNIT_ASSERT(!sHatchName.isEmpty());
// Check the FillBackground of datapoint
bool bBackgroundFillofDatapoint = false;
xPropertySet->getPropertyValue("FillBackground") >>= bBackgroundFillofDatapoint;
CPPUNIT_ASSERT(bBackgroundFillofDatapoint);
sal_Int32 nBackgroundColorofDatapoint;
xPropertySet->getPropertyValue("FillColor") >>= nBackgroundColorofDatapoint;
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x00B050), nBackgroundColorofDatapoint);
} }
void Chart2ImportTest::testAxisTextRotationXLSX() void Chart2ImportTest::testAxisTextRotationXLSX()
......
...@@ -72,10 +72,10 @@ enum class ShapeProperty ...@@ -72,10 +72,10 @@ enum class ShapeProperty
FillBitmapOffsetY, FillBitmapOffsetY,
FillBitmapRectanglePoint, FillBitmapRectanglePoint,
FillHatch, /// Explicit fill hatch or name of a fill hatch stored in a global container. FillHatch, /// Explicit fill hatch or name of a fill hatch stored in a global container.
ShadowXDistance,
FillBitmapName,
FillBackground, FillBackground,
LAST = FillBackground FillBitmapName,
ShadowXDistance,
LAST = ShadowXDistance
}; };
typedef o3tl::enumarray<ShapeProperty, sal_Int32> ShapePropertyIds; typedef o3tl::enumarray<ShapeProperty, sal_Int32> ShapePropertyIds;
......
...@@ -450,7 +450,7 @@ static const ShapePropertyIds spnCommonPropIds = ...@@ -450,7 +450,7 @@ static const ShapePropertyIds spnCommonPropIds =
PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_INVALID, PROP_FillGradientName, PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_INVALID, PROP_FillGradientName,
PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint, PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
PROP_FillHatchName PROP_FillHatchName, PROP_FillBackground
}; };
static const ShapePropertyIds spnLinearPropIds = static const ShapePropertyIds spnLinearPropIds =
...@@ -460,7 +460,7 @@ static const ShapePropertyIds spnLinearPropIds = ...@@ -460,7 +460,7 @@ static const ShapePropertyIds spnLinearPropIds =
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID PROP_INVALID, PROP_INVALID
}; };
static const ShapePropertyIds spnFilledPropIds = static const ShapePropertyIds spnFilledPropIds =
...@@ -489,7 +489,8 @@ static const ShapePropertyIds spnFilledPropIds = ...@@ -489,7 +489,8 @@ static const ShapePropertyIds spnFilledPropIds =
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetX,
PROP_FillBitmapPositionOffsetY, PROP_FillBitmapPositionOffsetY,
PROP_FillBitmapRectanglePoint, PROP_FillBitmapRectanglePoint,
PROP_HatchName PROP_HatchName,
PROP_FillBackground
}; };
/** Property info for common chart objects, to be used in ShapePropertyMap. */ /** Property info for common chart objects, to be used in ShapePropertyMap. */
......
...@@ -47,9 +47,9 @@ static const ShapePropertyIds spnDefaultShapeIds = ...@@ -47,9 +47,9 @@ static const ShapePropertyIds spnDefaultShapeIds =
PROP_FillBitmap, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, PROP_FillBitmap, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint, PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
PROP_FillHatch, PROP_FillHatch,
PROP_ShadowXDistance, PROP_FillBackground,
PROP_FillBitmapName, PROP_FillBitmapName,
PROP_FillBackground PROP_ShadowXDistance
}; };
} // namespace } // namespace
......
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