[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - emfio/inc emfio/qa emfio/source

2021-05-15 Thread Bartosz Kosiorek (via logerrit)
 emfio/inc/mtftools.hxx|   17 +
 emfio/qa/cppunit/emf/EmfImportTest.cxx|   39 ++
 emfio/qa/cppunit/wmf/data/TestPalette.wmf |binary
 emfio/source/reader/mtftools.cxx  |   27 ++--
 emfio/source/reader/wmfreader.cxx |   19 +-
 5 files changed, 97 insertions(+), 5 deletions(-)

New commits:
commit acf9f22475fa1d35ccbf3576a1d3da9ac8aea1a2
Author: Bartosz Kosiorek 
AuthorDate: Thu May 13 22:04:56 2021 +0200
Commit: Xisco Fauli 
CommitDate: Sat May 15 18:15:16 2021 +0200

tdf#117957 WMF Add support for selecting colors from palette

Change-Id: I8f995dab566d9fae79d87fe13741b8ea9658b408
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112998
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 
(cherry picked from commit e923f752a3adfe1a941dcbc2fdffc626a569d59e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115520
Reviewed-by: Xisco Fauli 

diff --git a/emfio/inc/mtftools.hxx b/emfio/inc/mtftools.hxx
index 22c0cef99364..eb793baca415 100644
--- a/emfio/inc/mtftools.hxx
+++ b/emfio/inc/mtftools.hxx
@@ -363,6 +363,22 @@ namespace emfio
 }
 };
 
+
+struct WinMtfPalette final : GDIObj
+{
+std::vector< Color > aPaletteColors;
+
+WinMtfPalette()
+: aPaletteColors(std::vector< Color >{})
+{}
+
+WinMtfPalette(const std::vector< Color > rPaletteColors)
+: aPaletteColors(rPaletteColors)
+{}
+
+};
+
+
 struct WinMtfLineStyle final : GDIObj
 {
 Color   aLineColor;
@@ -494,6 +510,7 @@ namespace emfio
 WinMtfFillStyle maLatestFillStyle;
 WinMtfFillStyle maFillStyle;
 WinMtfFillStyle maNopFillStyle;
+WinMtfPalette   maPalette;
 
 vcl::Font   maLatestFont;
 vcl::Font   maFont;
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index fcdf2509f3a9..53be54f34c02 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -56,6 +56,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools, public unotest:
 void TestEllipseXformIntersectClipRect();
 void TestDrawPolyLine16WithClip();
 void TestFillRegion();
+void TestPalette();
 void TestPolylinetoCloseStroke();
 void TestPolyLineWidth();
 void TestRoundRect();
@@ -83,6 +84,7 @@ public:
 CPPUNIT_TEST(TestEllipseXformIntersectClipRect);
 CPPUNIT_TEST(TestDrawPolyLine16WithClip);
 CPPUNIT_TEST(TestFillRegion);
+CPPUNIT_TEST(TestPalette);
 CPPUNIT_TEST(TestPolylinetoCloseStroke);
 CPPUNIT_TEST(TestPolyLineWidth);
 CPPUNIT_TEST(TestRoundRect);
@@ -460,6 +462,43 @@ void Test::TestPolylinetoCloseStroke()
 "color", "#00");
 }
 
+
+void Test::TestPalette()
+{
+// WMF import with records: CREATEPALETTE, SELECTOBJECT, 
CREATEPENINDIRECT, CREATEBRUSHINDIRECT, ELLIPSE.
+Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/wmf/data/TestPalette.wmf");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor", 2);
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor[1]/polypolygon",
+"path", "m2433 1216.5c0 213.540351086756-56.2099207528522 
423.318631225821-162.98009629623 608.25s-260.338534929591 
338.499728160392-445.269903703769 445.26990370377-394.709648913244 
162.98009629623-608.25 
162.98009629623-423.318631225821-56.2099207528518-608.25-162.98009629623-338.499728160392-260.338534929591-445.26990370377-445.26990370377-162.980096296231-394.709648913244-162.980096296231-608.25c-2.70117261891301E-013-213.540351086756
 56.2099207528519-423.318631225821 162.98009629623-608.25 
106.770175543378-184.931368774179 260.338534929591-338.499728160392 
445.269903703769-445.26990370377s394.709648913244-162.980096296231 
608.25-162.980096296231c213.540351086756-5.40234523782601E-013 423.318631225821 
56.2099207528518 608.25 162.98009629623s338.499728160392 260.338534929591 
445.26990370377 445.269903703769c106.770175543379 184.931368774179 
162.980096296231 394.709648913244 162.980096296231 608.25z");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor[1]",
+"color", "#00");
+
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/polypolygoncolor[2]/polypolygon",
+"path", "m5079 3862.5c0 213.540351086756-56.2099207528527 
423.318631225821-162.980096296231 608.25s-260.33853492959 
338.499728160391-445.269903703769 445.269903703769-394.709648913244 
162.980096296231-608.25 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - emfio/inc emfio/qa emfio/source

2021-05-10 Thread Bartosz Kosiorek (via logerrit)
 emfio/inc/mtftools.hxx  |6 -
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   17 +
 emfio/qa/cppunit/emf/data/TestEllipseXformIntersectClipRect.emf |binary
 emfio/source/reader/mtftools.cxx|   34 
+++---
 4 files changed, 45 insertions(+), 12 deletions(-)

New commits:
commit a67a30227ef32ab9fc3026bb19e48d4447df25d1
Author: Bartosz Kosiorek 
AuthorDate: Tue May 4 16:08:35 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon May 10 10:10:23 2021 +0200

tdf#55058 tdf#141982 EMF: Add rotation support for INTERSECTCLIPRECT record

With this commit the rotation support was added
for INTERSECTCLIPRECT.

Before that change rotation was not applied to these CLIP rectangles.

Change-Id: I3da66790e0aeeaaeeb28d2fc30780cba8dbda390
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115102
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 
(cherry picked from commit 1ef26ffe39618a745d3367310565e7eeb184a4c2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115207
Reviewed-by: Xisco Fauli 

diff --git a/emfio/inc/mtftools.hxx b/emfio/inc/mtftools.hxx
index 286442767d3a..22c0cef99364 100644
--- a/emfio/inc/mtftools.hxx
+++ b/emfio/inc/mtftools.hxx
@@ -273,9 +273,9 @@ namespace emfio
 public:
 WinMtfClipPath() : maClip() {};
 
-voidsetClipPath(const tools::PolyPolygon& rPolyPolygon, 
sal_Int32 nClippingMode);
-voidintersectClipRect(const tools::Rectangle& rRect);
-voidexcludeClipRect(const tools::Rectangle& rRect);
+voidsetClipPath(const basegfx::B2DPolyPolygon&, sal_Int32 
nClippingMode);
+voidintersectClip(const basegfx::B2DPolyPolygon& rPolyPolygon);
+voidexcludeClip(const basegfx::B2DPolyPolygon& rPolyPolygon);
 voidmoveClipRegion(const Size& rSize);
 voidsetDefaultClipPath();
 
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 1f1976c0a2a3..8dc864fb657e 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -53,6 +53,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools, public unotest:
 void TestRectangleWithModifyWorldTransform();
 void TestChordWithModifyWorldTransform();
 void TestEllipseWithSelectClipPath();
+void TestEllipseXformIntersectClipRect();
 void TestDrawPolyLine16WithClip();
 void TestFillRegion();
 void TestCreatePen();
@@ -76,6 +77,7 @@ public:
 CPPUNIT_TEST(TestRectangleWithModifyWorldTransform);
 CPPUNIT_TEST(TestChordWithModifyWorldTransform);
 CPPUNIT_TEST(TestEllipseWithSelectClipPath);
+CPPUNIT_TEST(TestEllipseXformIntersectClipRect);
 CPPUNIT_TEST(TestDrawPolyLine16WithClip);
 CPPUNIT_TEST(TestFillRegion);
 CPPUNIT_TEST(TestCreatePen);
@@ -368,6 +370,21 @@ void Test::TestEllipseWithSelectClipPath()
 assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/group/mask/polygonstroke[1]/polygon", "353,353 
2825,353 2825,1410 353,1410");
 }
 
+void Test::TestEllipseXformIntersectClipRect()
+{
+// EMF import test with records: EXTCREATEPEN, CREATEBRUSHINDIRECT, 
MODIFYWORLDTRANSFORM, INTERSECTCLIPRECT, ELLIPSE
+Primitive2DSequence aSequence = 
parseEmf(u"/emfio/qa/cppunit/emf/data/TestEllipseXformIntersectClipRect.emf");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence));
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygon", 
"path", "m0 0h3000v2000h-3000z");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/group/mask/polypolygon", "path", "m370 
152 1128-409 592 1623-1128 410z");
+assertXPath(pDocument, 
"/primitive2D/metafile/transform/mask/group/mask/polypolygoncolor/polypolygon", 
"path", "m3565 155-58-55-205-150-90-42-124-30-392-45-368 21-211 39-598 217-187 
105-21 46-121 81-66 24-87 69-272 287-75 102-42 90-61 247-9 79 97 265 57 54 205 
150 91 42 124 31 392 45 112-3 467-58 597-217 187-105 296-220 271-286 76-103 
42-90 60-247 9-78z");
+assertXPathContent(pDocument, 
"/primitive2D/metafile/transform/mask/group/mask/polygonstroke/polygon", 
"3565,155 3507,100 3302,-50 3212,-92 3088,-122 2696,-167 2328,-146 2117,-107 
1519,110 1332,215 1311,261 1190,342 1124,366 1037,435 765,722 690,824 648,914 
587,1161 578,1240 675,1505 732,1559 937,1709 1028,1751 1152,1782 1544,1827 
1656,1824 2123,1766 2720,1549 2907,1444 3203,1224 3474,938 3550,835 3592,745 
3652,498 3661,420");
+}
+
 void Test::TestDrawPolyLine16WithClip()
 {
 // Check import of EMF image with records:
diff --git a/emfio/qa/cppunit/emf/data/TestEllipseXformIntersectClipRect.emf