[Libreoffice-commits] core.git: drawinglayer/source

Bartosz Kosiorek (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 2 17:40:33 UTC 2021


 drawinglayer/source/tools/primitive2dxmldump.cxx |   56 +++++++++++++++++------
 1 file changed, 43 insertions(+), 13 deletions(-)

New commits:
commit 3afac9467936fb3a5ae314878686c0f66ee7784f
Author:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Wed Jun 2 16:47:57 2021 +0200
Commit:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
CommitDate: Wed Jun 2 19:39:55 2021 +0200

    fix: extend the primitive dump, with information about line cap and joint
    
    Change-Id: I5c67d360236ec67c41bc45a9018f0ff0d0ec1d3d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116611
    Tested-by: Jenkins
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx
index ade8cfaed89b..24c390c7e0f3 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -84,6 +84,47 @@ void writePolyPolygon(::tools::XmlWriter& rWriter, const basegfx::B2DPolyPolygon
     rWriter.endElement();
 }
 
+void writeLineAttribute(::tools::XmlWriter& rWriter, const drawinglayer::attribute::LineAttribute& rLineAttribute)
+{
+    rWriter.startElement("line");
+    rWriter.attribute("color", convertColorToString(rLineAttribute.getColor()));
+    rWriter.attribute("width", rLineAttribute.getWidth());
+    switch( rLineAttribute.getLineJoin() )
+    {
+        case basegfx::B2DLineJoin::NONE:
+            rWriter.attribute("linejoin", "NONE");
+        break;
+        case basegfx::B2DLineJoin::Bevel:
+            rWriter.attribute("linejoin", "Bevel");
+        break;
+        case basegfx::B2DLineJoin::Miter:
+            rWriter.attribute("linejoin", "Miter");
+        break;
+        case basegfx::B2DLineJoin::Round:
+            rWriter.attribute("linejoin", "Round");
+        break;
+        default:
+            rWriter.attribute("linejoin", "Unknown");
+        break;
+    }
+    switch( rLineAttribute.getLineCap() )
+    {
+        case css::drawing::LineCap::LineCap_BUTT:
+            rWriter.attribute("linecap", "BUTT");
+        break;
+        case css::drawing::LineCap::LineCap_ROUND:
+            rWriter.attribute("linecap", "ROUND");
+        break;
+        case css::drawing::LineCap::LineCap_SQUARE:
+            rWriter.attribute("linecap", "SQUARE");
+        break;
+        default:
+            rWriter.attribute("linecap", "Unknown");
+        break;
+    }
+    rWriter.endElement();
+}
+
 } // end anonymous namespace
 
 Primitive2dXmlDump::Primitive2dXmlDump() :
@@ -235,12 +276,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
                 rWriter.content(basegfx::utils::exportToSvgPoints(rPolygonStrokePrimitive2D.getB2DPolygon()));
                 rWriter.endElement();
 
-                rWriter.startElement("line");
-                const drawinglayer::attribute::LineAttribute& aLineAttribute = rPolygonStrokePrimitive2D.getLineAttribute();
-                rWriter.attribute("color", convertColorToString(aLineAttribute.getColor()));
-                rWriter.attribute("width", aLineAttribute.getWidth());
-
-                rWriter.endElement();
+                writeLineAttribute(rWriter, rPolygonStrokePrimitive2D.getLineAttribute());
 
                 rWriter.startElement("stroke");
                 const drawinglayer::attribute::StrokeAttribute& aStrokeAttribute = rPolygonStrokePrimitive2D.getStrokeAttribute();
@@ -256,13 +292,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
                 const PolyPolygonStrokePrimitive2D& rPolyPolygonStrokePrimitive2D = dynamic_cast<const PolyPolygonStrokePrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("polypolygonstroke");
 
-                rWriter.startElement("line");
-                const drawinglayer::attribute::LineAttribute& aLineAttribute = rPolyPolygonStrokePrimitive2D.getLineAttribute();
-                rWriter.attribute("color", convertColorToString(aLineAttribute.getColor()));
-                rWriter.attribute("width", aLineAttribute.getWidth());
-                //rWriter.attribute("linejoin", aLineAttribute.getLineJoin());
-                //rWriter.attribute("linecap", aLineAttribute.getLineCap());
-                rWriter.endElement();
+                writeLineAttribute(rWriter, rPolyPolygonStrokePrimitive2D.getLineAttribute());
 
                 //getStrokeAttribute()
 


More information about the Libreoffice-commits mailing list