Kaydet (Commit) e0a0b6e8 authored tarafından Mark Hung's avatar Mark Hung

tdf59046 oox: fix incorrectly combined shapes

1. Store the path of all polygons of a PolyPolygon in
   the same path element so it subtract overlapped area.
2. Set the size of the path as the bounding box of
   PolyPolygon so the points of the polygon scale and
   offset properly.

Change-Id: If6e21d1ac0544b45ef68073cf14bcc08c1d7dbef
Reviewed-on: https://gerrit.libreoffice.org/30982Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMark Hung <marklh9@gmail.com>
üst d881f99c
...@@ -2556,16 +2556,19 @@ void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon ) ...@@ -2556,16 +2556,19 @@ void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon )
mpFS->startElementNS( XML_a, XML_pathLst, FSEND ); mpFS->startElementNS( XML_a, XML_pathLst, FSEND );
const Rectangle aRect( rPolyPolygon.GetBoundRect() );
// Put all polygons of rPolyPolygon in the same path elemnt
// to subtract the overlapped areas.
mpFS->startElementNS( XML_a, XML_path,
XML_w, I64S( aRect.GetWidth() ),
XML_h, I64S( aRect.GetHeight() ),
FSEND );
for( sal_uInt16 i = 0; i < rPolyPolygon.Count(); i ++ ) for( sal_uInt16 i = 0; i < rPolyPolygon.Count(); i ++ )
{ {
const tools::Polygon& rPoly = rPolyPolygon[ i ]; const tools::Polygon& rPoly = rPolyPolygon[ i ];
Rectangle aRect( rPoly.GetBoundRect() );
mpFS->startElementNS( XML_a, XML_path,
XML_w, I64S( aRect.GetWidth() ),
XML_h, I64S( aRect.GetHeight() ),
FSEND );
if( rPoly.GetSize() > 0 ) if( rPoly.GetSize() > 0 )
{ {
...@@ -2611,9 +2614,8 @@ void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon ) ...@@ -2611,9 +2614,8 @@ void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon )
mpFS->endElementNS( XML_a, XML_lnTo ); mpFS->endElementNS( XML_a, XML_lnTo );
} }
} }
mpFS->endElementNS( XML_a, XML_path );
} }
mpFS->endElementNS( XML_a, XML_path );
mpFS->endElementNS( XML_a, XML_pathLst ); mpFS->endElementNS( XML_a, XML_pathLst );
......
...@@ -102,6 +102,7 @@ public: ...@@ -102,6 +102,7 @@ public:
void testAuthorField(); void testAuthorField();
void testTdf99224(); void testTdf99224();
void testTdf92076(); void testTdf92076();
void testTdf59046();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
...@@ -127,6 +128,7 @@ public: ...@@ -127,6 +128,7 @@ public:
CPPUNIT_TEST(testAuthorField); CPPUNIT_TEST(testAuthorField);
CPPUNIT_TEST(testTdf99224); CPPUNIT_TEST(testTdf99224);
CPPUNIT_TEST(testTdf92076); CPPUNIT_TEST(testTdf92076);
CPPUNIT_TEST(testTdf59046);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -747,6 +749,16 @@ void SdOOXMLExportTest2::testTdf92076() ...@@ -747,6 +749,16 @@ void SdOOXMLExportTest2::testTdf92076()
xShell->DoClose(); xShell->DoClose();
} }
void SdOOXMLExportTest2::testTdf59046()
{
sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf59046.odp"), ODP);
utl::TempFile tempFile;
xShell = saveAndReload(xShell.get(), PPTX, &tempFile);
xShell->DoClose();
xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml");
assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", 1);
}
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT(); 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