Kaydet (Commit) e3cad36d authored tarafından Balazs Varga's avatar Balazs Varga Kaydeden (comit) Bartosz Kosiorek

tdf#108078 OOXML Export Chart shapes area fill properties

Verified with color, gradient, bitmap for:
Chart Title in DOCX, XLSX and PPTX.

Also verified with gradient, bitmap for
Chart Legend, Plot Area, Dataseries and Background
in DOCX, XLSX and PPTX.

Change-Id: I15d29f3ca2d75f45f612766b635d50a29d8551ae
Reviewed-on: https://gerrit.libreoffice.org/57880
Tested-by: Jenkins
Reviewed-by: 's avatarBartosz Kosiorek <gang65@poczta.onet.pl>
(cherry picked from commit 05139974)
Reviewed-on: https://gerrit.libreoffice.org/58349Reviewed-by: 's avatarBalazs Varga <balazs.varga991@gmail.com>
üst 089b7c34
...@@ -80,6 +80,9 @@ public: ...@@ -80,6 +80,9 @@ public:
void testDataLabelDoughnutChartDOCX(); void testDataLabelDoughnutChartDOCX();
void testDataLabelAreaChartDOCX(); void testDataLabelAreaChartDOCX();
void testDataLabelDefaultLineChartDOCX(); void testDataLabelDefaultLineChartDOCX();
void testChartTitlePropertiesColorFillDOCX();
void testChartTitlePropertiesGradientFillDOCX();
void testChartTitlePropertiesBitmapFillDOCX();
void testFdo83058dlblPos(); void testFdo83058dlblPos();
void testAutoTitleDelXLSX(); void testAutoTitleDelXLSX();
void testDispBlanksAsXLSX(); void testDispBlanksAsXLSX();
...@@ -94,6 +97,9 @@ public: ...@@ -94,6 +97,9 @@ public:
void testTitleManualLayoutXLSX(); void testTitleManualLayoutXLSX();
void testPlotAreaManualLayoutXLSX(); void testPlotAreaManualLayoutXLSX();
void testLegendManualLayoutXLSX(); void testLegendManualLayoutXLSX();
void testChartTitlePropertiesColorFillXLSX();
void testChartTitlePropertiesGradientFillXLSX();
void testChartTitlePropertiesBitmapFillXLSX();
void testAxisCharacterPropertiesXLSX(); void testAxisCharacterPropertiesXLSX();
void testTitleCharacterPropertiesXLSX(); void testTitleCharacterPropertiesXLSX();
void testPlotVisOnlyXLSX(); void testPlotVisOnlyXLSX();
...@@ -102,6 +108,9 @@ public: ...@@ -102,6 +108,9 @@ public:
void testAxisTitleRotationXLSX(); void testAxisTitleRotationXLSX();
void testAxisCrossBetweenXSLX(); void testAxisCrossBetweenXSLX();
void testNumberFormatExportPPTX(); void testNumberFormatExportPPTX();
void testChartTitlePropertiesColorFillPPTX();
void testChartTitlePropertiesGradientFillPPTX();
void testChartTitlePropertiesBitmapFillPPTX();
void testTdf116163(); void testTdf116163();
CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST_SUITE(Chart2ExportTest);
...@@ -147,6 +156,9 @@ public: ...@@ -147,6 +156,9 @@ public:
CPPUNIT_TEST(testDataLabelDoughnutChartDOCX); CPPUNIT_TEST(testDataLabelDoughnutChartDOCX);
CPPUNIT_TEST(testDataLabelAreaChartDOCX); CPPUNIT_TEST(testDataLabelAreaChartDOCX);
CPPUNIT_TEST(testDataLabelDefaultLineChartDOCX); CPPUNIT_TEST(testDataLabelDefaultLineChartDOCX);
CPPUNIT_TEST(testChartTitlePropertiesColorFillDOCX);
CPPUNIT_TEST(testChartTitlePropertiesGradientFillDOCX);
CPPUNIT_TEST(testChartTitlePropertiesBitmapFillDOCX);
CPPUNIT_TEST(testFdo83058dlblPos); CPPUNIT_TEST(testFdo83058dlblPos);
CPPUNIT_TEST(testAutoTitleDelXLSX); CPPUNIT_TEST(testAutoTitleDelXLSX);
CPPUNIT_TEST(testDispBlanksAsXLSX); CPPUNIT_TEST(testDispBlanksAsXLSX);
...@@ -161,6 +173,9 @@ public: ...@@ -161,6 +173,9 @@ public:
CPPUNIT_TEST(testTitleManualLayoutXLSX); CPPUNIT_TEST(testTitleManualLayoutXLSX);
CPPUNIT_TEST(testPlotAreaManualLayoutXLSX); CPPUNIT_TEST(testPlotAreaManualLayoutXLSX);
CPPUNIT_TEST(testLegendManualLayoutXLSX); CPPUNIT_TEST(testLegendManualLayoutXLSX);
CPPUNIT_TEST(testChartTitlePropertiesColorFillXLSX);
CPPUNIT_TEST(testChartTitlePropertiesGradientFillXLSX);
CPPUNIT_TEST(testChartTitlePropertiesBitmapFillXLSX);
CPPUNIT_TEST(testAxisCharacterPropertiesXLSX); CPPUNIT_TEST(testAxisCharacterPropertiesXLSX);
CPPUNIT_TEST(testTitleCharacterPropertiesXLSX); CPPUNIT_TEST(testTitleCharacterPropertiesXLSX);
CPPUNIT_TEST(testPlotVisOnlyXLSX); CPPUNIT_TEST(testPlotVisOnlyXLSX);
...@@ -169,6 +184,9 @@ public: ...@@ -169,6 +184,9 @@ public:
CPPUNIT_TEST(testAxisTitleRotationXLSX); CPPUNIT_TEST(testAxisTitleRotationXLSX);
CPPUNIT_TEST(testAxisCrossBetweenXSLX); CPPUNIT_TEST(testAxisCrossBetweenXSLX);
CPPUNIT_TEST(testNumberFormatExportPPTX); CPPUNIT_TEST(testNumberFormatExportPPTX);
CPPUNIT_TEST(testChartTitlePropertiesColorFillPPTX);
CPPUNIT_TEST(testChartTitlePropertiesGradientFillPPTX);
CPPUNIT_TEST(testChartTitlePropertiesBitmapFillPPTX);
CPPUNIT_TEST(testTdf116163); CPPUNIT_TEST(testTdf116163);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -1049,6 +1067,34 @@ void Chart2ExportTest::testDataLabelDefaultLineChartDOCX() ...@@ -1049,6 +1067,34 @@ void Chart2ExportTest::testDataLabelDefaultLineChartDOCX()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Line chart's default label placement should be 'right'.", chart::DataLabelPlacement::RIGHT, nLabelPlacement ); CPPUNIT_ASSERT_EQUAL_MESSAGE("Line chart's default label placement should be 'right'.", chart::DataLabelPlacement::RIGHT, nLabelPlacement );
} }
void Chart2ExportTest::testChartTitlePropertiesColorFillDOCX()
{
load("/chart2/qa/extras/data/docx/", "testChartTitlePropertiesColorFill.docx");
xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val", "ff0000");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
}
void Chart2ExportTest::testChartTitlePropertiesGradientFillDOCX()
{
load("/chart2/qa/extras/data/docx/", "testChartTitlePropertiesGradientFill.docx");
xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", "cccccc");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr", "val", "666666");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
}
void Chart2ExportTest::testChartTitlePropertiesBitmapFillDOCX()
{
load("/chart2/qa/extras/data/docx/", "testChartTitlePropertiesBitmapFill.docx");
xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:blipFill/a:blip", "embed", "rId1");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
}
void Chart2ExportTest::testBarChartRotation() void Chart2ExportTest::testBarChartRotation()
{ {
load ("/chart2/qa/extras/data/docx/", "barChartRotation.docx"); load ("/chart2/qa/extras/data/docx/", "barChartRotation.docx");
...@@ -1486,6 +1532,34 @@ void Chart2ExportTest::testLegendManualLayoutXLSX() ...@@ -1486,6 +1532,34 @@ void Chart2ExportTest::testLegendManualLayoutXLSX()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:legend/c:txPr/a:p/a:pPr/a:defRPr", "sz", "900"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:legend/c:txPr/a:p/a:pPr/a:defRPr", "sz", "900");
} }
void Chart2ExportTest::testChartTitlePropertiesColorFillXLSX()
{
load("/chart2/qa/extras/data/xlsx/", "testChartTitlePropertiesColorFill.xlsx");
xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val", "ff0000");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
}
void Chart2ExportTest::testChartTitlePropertiesGradientFillXLSX()
{
load("/chart2/qa/extras/data/xlsx/", "testChartTitlePropertiesGradientFill.xlsx");
xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", "cccccc");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr", "val", "666666");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
}
void Chart2ExportTest::testChartTitlePropertiesBitmapFillXLSX()
{
load("/chart2/qa/extras/data/xlsx/", "testChartTitlePropertiesBitmapFill.xlsx");
xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:blipFill/a:blip", "embed", "rId1");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
}
void Chart2ExportTest::testAxisCharacterPropertiesXLSX() void Chart2ExportTest::testAxisCharacterPropertiesXLSX()
{ {
load("/chart2/qa/extras/data/xlsx/", "axis_character_properties.xlsx"); load("/chart2/qa/extras/data/xlsx/", "axis_character_properties.xlsx");
...@@ -1575,6 +1649,34 @@ void Chart2ExportTest::testNumberFormatExportPPTX() ...@@ -1575,6 +1649,34 @@ void Chart2ExportTest::testNumberFormatExportPPTX()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", "sourceLinked", "0"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", "sourceLinked", "0");
} }
void Chart2ExportTest::testChartTitlePropertiesColorFillPPTX()
{
load("/chart2/qa/extras/data/pptx/", "testChartTitlePropertiesColorFill.pptx");
xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val", "ff0000");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
}
void Chart2ExportTest::testChartTitlePropertiesGradientFillPPTX()
{
load("/chart2/qa/extras/data/pptx/", "testChartTitlePropertiesGradientFill.pptx");
xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", "f6f8fc");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr", "val", "c7d5ed");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
}
void Chart2ExportTest::testChartTitlePropertiesBitmapFillPPTX()
{
load("/chart2/qa/extras/data/pptx/", "testChartTitlePropertiesBitmapFill.pptx");
xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:blipFill/a:blip", "embed", "rId1");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
}
void Chart2ExportTest::testTdf116163() void Chart2ExportTest::testTdf116163()
{ {
load("/chart2/qa/extras/data/pptx/", "tdf116163.pptx"); load("/chart2/qa/extras/data/pptx/", "tdf116163.pptx");
......
...@@ -136,7 +136,6 @@ private: ...@@ -136,7 +136,6 @@ private:
css::drawing::XShape >& xShape ); css::drawing::XShape >& xShape );
void exportPlotArea( const css::uno::Reference< void exportPlotArea( const css::uno::Reference<
css::chart::XChartDocument >& rChartDoc ); css::chart::XChartDocument >& rChartDoc );
void exportPlotAreaShapeProps( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
void exportFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet ); void exportFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
void exportGradientFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet ); void exportGradientFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
void exportBitmapFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet ); void exportBitmapFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
......
...@@ -1035,6 +1035,12 @@ void ChartExport::exportTitle( const Reference< XShape >& xShape ) ...@@ -1035,6 +1035,12 @@ void ChartExport::exportTitle( const Reference< XShape >& xShape )
XML_val, "0", XML_val, "0",
FSEND); FSEND);
// shape properties
if( xPropSet.is() )
{
exportShapeProps( xPropSet );
}
pFS->endElement( FSNS( XML_c, XML_title ) ); pFS->endElement( FSNS( XML_c, XML_title ) );
} }
...@@ -1168,7 +1174,7 @@ void ChartExport::exportPlotArea( const Reference< css::chart::XChartDocument >& ...@@ -1168,7 +1174,7 @@ void ChartExport::exportPlotArea( const Reference< css::chart::XChartDocument >&
Reference< beans::XPropertySet > xWallPropSet( xWallFloorSupplier->getWall(), uno::UNO_QUERY ); Reference< beans::XPropertySet > xWallPropSet( xWallFloorSupplier->getWall(), uno::UNO_QUERY );
if( xWallPropSet.is() ) if( xWallPropSet.is() )
{ {
exportPlotAreaShapeProps( xWallPropSet ); exportShapeProps( xWallPropSet );
} }
} }
...@@ -1258,18 +1264,6 @@ void ChartExport::exportManualLayout(const css::chart2::RelativePosition& rPos, ...@@ -1258,18 +1264,6 @@ void ChartExport::exportManualLayout(const css::chart2::RelativePosition& rPos,
pFS->endElement(FSNS(XML_c, XML_layout)); pFS->endElement(FSNS(XML_c, XML_layout));
} }
void ChartExport::exportPlotAreaShapeProps( const Reference< XPropertySet >& xPropSet )
{
FSHelperPtr pFS = GetFS();
pFS->startElement( FSNS( XML_c, XML_spPr ),
FSEND );
exportFill( xPropSet );
WriteOutline( xPropSet );
pFS->endElement( FSNS( XML_c, XML_spPr ) );
}
void ChartExport::exportFill( const Reference< XPropertySet >& xPropSet ) void ChartExport::exportFill( const Reference< XPropertySet >& xPropSet )
{ {
if ( !GetProperty( xPropSet, "FillStyle" ) ) if ( !GetProperty( xPropSet, "FillStyle" ) )
...@@ -2274,7 +2268,7 @@ void ChartExport::exportShapeProps( const Reference< XPropertySet >& xPropSet ) ...@@ -2274,7 +2268,7 @@ void ChartExport::exportShapeProps( const Reference< XPropertySet >& xPropSet )
pFS->startElement( FSNS( XML_c, XML_spPr ), pFS->startElement( FSNS( XML_c, XML_spPr ),
FSEND ); FSEND );
WriteFill( xPropSet ); exportFill( xPropSet );
WriteOutline( xPropSet ); WriteOutline( xPropSet );
pFS->endElement( FSNS( XML_c, XML_spPr ) ); pFS->endElement( FSNS( XML_c, XML_spPr ) );
......
...@@ -939,13 +939,16 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) ...@@ -939,13 +939,16 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia )
xOutStream->writeBytes( Sequence< sal_Int8 >( static_cast<const sal_Int8*>(aData), nDataSize ) ); xOutStream->writeBytes( Sequence< sal_Int8 >( static_cast<const sal_Int8*>(aData), nDataSize ) );
xOutStream->closeOutput(); xOutStream->closeOutput();
OString sRelPathToMedia = "media/image"; const OString sRelPathToMedia = "media/image";
OString sRelationCompPrefix;
if ( bRelPathToMedia ) if ( bRelPathToMedia )
sRelPathToMedia = "../" + sRelPathToMedia; sRelationCompPrefix = "../";
else
sRelationCompPrefix = GetRelationCompPrefix();
sRelId = mpFB->addRelation( mpFS->getOutputStream(), sRelId = mpFB->addRelation( mpFS->getOutputStream(),
oox::getRelationship(Relationship::IMAGE), oox::getRelationship(Relationship::IMAGE),
OUStringBuffer() OUStringBuffer()
.appendAscii( GetRelationCompPrefix() ) .appendAscii( sRelationCompPrefix.getStr() )
.appendAscii( sRelPathToMedia.getStr() ) .appendAscii( sRelPathToMedia.getStr() )
.append( (sal_Int32) mnImageCounter ++ ) .append( (sal_Int32) mnImageCounter ++ )
.appendAscii( pExtension ) .appendAscii( pExtension )
......
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