[Libreoffice-commits] .: Branch 'feature/gsoc_test_improvements' - 5 commits - drawinglayer/inc drawinglayer/source

Artur Dorda adorda at kemper.freedesktop.org
Sat Jun 9 05:47:16 PDT 2012


 drawinglayer/inc/drawinglayer/XShapeDumper.hxx |   14 ++
 drawinglayer/source/dumper/XShapeDumper.cxx    |  120 +++++++++++++++++++++----
 2 files changed, 114 insertions(+), 20 deletions(-)

New commits:
commit 89e69769754d68149b3eeb04ebe79e3e52f35e39
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Sat Jun 9 14:47:01 2012 +0200

    Added dumping [property] Geometry
    
    Change-Id: Ib95aaf19f266358bdc21dd76450b3d88483f92eb

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index 6d423ad..88298d8 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -106,6 +106,7 @@ private:
     // PolyPolygonDescriptor.idl
     void dumpPolygonKindAsAttribute(com::sun::star::drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter);
     void dumpPolyPolygonAsElement(com::sun::star::drawing::PointSequenceSequence aPolyPolygon, xmlTextWriterPtr xmlWriter);
+    void dumpGeometryAsElement(com::sun::star::drawing::PointSequenceSequence aGeometry, xmlTextWriterPtr xmlWriter);
 
     void dumpPositionAsAttribute(const com::sun::star::awt::Point& rPoint, xmlTextWriterPtr xmlWriter);
     void dumpSizeAsAttribute(const com::sun::star::awt::Size& rSize, xmlTextWriterPtr xmlWriter);
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index c3d739f..4682c2e 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -587,6 +587,13 @@ namespace {
         xmlTextWriterEndElement( xmlWriter );
     }
 
+    void XShapeDumper::dumpGeometryAsElement(drawing::PointSequenceSequence aGeometry, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Geometry" ));
+        dumpPointSequenceSequence(aGeometry, xmlWriter);
+        xmlTextWriterEndElement( xmlWriter );
+    }
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
@@ -896,6 +903,12 @@ namespace {
 				if(anotherAny >>= aPolyPolygon)
 					dumpPolyPolygonAsElement(aPolyPolygon, xmlWriter);
 			}
+			{
+				uno::Any anotherAny = xPropSet->getPropertyValue("Geometry");
+				drawing::PointSequenceSequence aGeometry;
+				if(anotherAny >>= aGeometry)
+					dumpGeometryAsElement(aGeometry, xmlWriter);
+			}
         }
 
         #if DEBUG_DUMPER
commit 3025120e777074dd2afa9e4cc85ef17216017cb5
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Sat Jun 9 14:44:45 2012 +0200

    Added dumping [property] PolyPolygon
    
    Change-Id: Id2ccf39cc38200ac693c6949390c248a9df0620b

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index 250795d..6d423ad 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -105,6 +105,7 @@ private:
 
     // PolyPolygonDescriptor.idl
     void dumpPolygonKindAsAttribute(com::sun::star::drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter);
+    void dumpPolyPolygonAsElement(com::sun::star::drawing::PointSequenceSequence aPolyPolygon, xmlTextWriterPtr xmlWriter);
 
     void dumpPositionAsAttribute(const com::sun::star::awt::Point& rPoint, xmlTextWriterPtr xmlWriter);
     void dumpSizeAsAttribute(const com::sun::star::awt::Size& rSize, xmlTextWriterPtr xmlWriter);
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 182cb62..c3d739f 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -580,6 +580,13 @@ namespace {
         }
     }
 
+    void XShapeDumper::dumpPolyPolygonAsElement(drawing::PointSequenceSequence aPolyPolygon, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PolyPolygon" ));
+        dumpPointSequenceSequence(aPolyPolygon, xmlWriter);
+        xmlTextWriterEndElement( xmlWriter );
+    }
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
@@ -883,6 +890,12 @@ namespace {
 				if(anotherAny >>= ePolygonKind)
 					dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
 			}
+			{
+				uno::Any anotherAny = xPropSet->getPropertyValue("PolyPolygon");
+				drawing::PointSequenceSequence aPolyPolygon;
+				if(anotherAny >>= aPolyPolygon)
+					dumpPolyPolygonAsElement(aPolyPolygon, xmlWriter);
+			}
         }
 
         #if DEBUG_DUMPER
commit 21a1b18799e19218cabe6cd86eafb47c2356990c
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Sat Jun 9 14:39:11 2012 +0200

    Restructurization of a dumpPolyPolygonBezierCoords() method, more elegant now
    
    Change-Id: I3cda1a3554837e4e667a42ac292db24d6a8edf37

diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 78b8da8..182cb62 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -437,25 +437,10 @@ namespace {
 
     void XShapeDumper::dumpPolyPolygonBezierCoords(drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter)
     {
-        uno::Sequence<uno::Sequence< awt::Point > > pointSequenceSequence = aPolyPolygonBezierCoords.Coordinates;
-        sal_Int32 nPointsSequence = pointSequenceSequence.getLength();
-        for (sal_Int32 i = 0; i < nPointsSequence; ++i)
-        {
-            uno::Sequence< awt::Point > pointSequence = pointSequenceSequence[i];
-            sal_Int32 nPoints = pointSequence.getLength();
-
-            xmlTextWriterStartElement(xmlWriter, BAD_CAST( "pointSequence" ));
-
-            for(sal_Int32 j = 0; j < nPoints; ++j)
-            {
-                xmlTextWriterStartElement(xmlWriter, BAD_CAST( "point" ));
-                xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, pointSequence[j].X);
-                xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, pointSequence[j].Y);
-                xmlTextWriterEndElement( xmlWriter );
-            }
-            xmlTextWriterEndElement( xmlWriter );
-        }
+        // dumps first field - Coordinates
+        dumpPointSequenceSequence(aPolyPolygonBezierCoords.Coordinates, xmlWriter);
 
+        // dumps second field - Flags
         uno::Sequence<uno::Sequence< drawing::PolygonFlags > > polygonFlagsSequenceSequence = aPolyPolygonBezierCoords.Flags;
         sal_Int32 nFlagsSequence = polygonFlagsSequenceSequence.getLength();
         for (sal_Int32 i = 0; i < nFlagsSequence; ++i)
commit 9a6d519a008ad63e3a8518a1d63240828d342735
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Sat Jun 9 14:32:02 2012 +0200

    Added separate method to dump drawing::PointSequenceSequence properties
    
    Change-Id: Ieb630a4ae2d8e1dcf178d20dca443a022255146f

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index 4cebbcc..250795d 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -55,12 +55,16 @@ public:
     rtl::OUString dump(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> xPageShapes);
 
 private:
+    // auxiliary functions
+    void dumpGradientProperty(com::sun::star::awt::Gradient aGradient, xmlTextWriterPtr xmlWriter);
+    void dumpPolyPolygonBezierCoords(com::sun::star::drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter);
+    void dumpPointSequenceSequence(com::sun::star::drawing::PointSequenceSequence aPointSequenceSequence, xmlTextWriterPtr xmlWriter);
+
     // FillProperties.idl
     void dumpFillStyleAsAttribute(com::sun::star::drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter);
     void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter);
     void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter);
     void dumpFillTransparenceGradientNameAsAttribute(rtl::OUString sTranspGradName, xmlTextWriterPtr xmlWriter);
-    void dumpGradientProperty(com::sun::star::awt::Gradient aGradient, xmlTextWriterPtr xmlWriter);
     void dumpFillTransparenceGradientAsElement(com::sun::star::awt::Gradient aTranspGrad, xmlTextWriterPtr xmlWriter);
     void dumpFillGradientNameAsAttribute(rtl::OUString sGradName, xmlTextWriterPtr xmlWriter);
     void dumpFillGradientAsElement(com::sun::star::awt::Gradient aGradient, xmlTextWriterPtr xmlWriter);
@@ -92,7 +96,6 @@ private:
     void dumpLineJointAsAttribute(com::sun::star::drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter);
     void dumpLineStartNameAsAttribute(rtl::OUString sLineStartName, xmlTextWriterPtr xmlWriter);
     void dumpLineEndNameAsAttribute(rtl::OUString sLineEndName, xmlTextWriterPtr xmlWriter);
-    void dumpPolyPolygonBezierCoords(com::sun::star::drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter);
     void dumpLineStartAsElement(com::sun::star::drawing::PolyPolygonBezierCoords aLineStart, xmlTextWriterPtr xmlWriter);
     void dumpLineEndAsElement(com::sun::star::drawing::PolyPolygonBezierCoords aLineEnd, xmlTextWriterPtr xmlWriter);
     void dumpLineStartCenterAsAttribute(sal_Bool bLineStartCenter, xmlTextWriterPtr xmlWriter);
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 594f7ea..78b8da8 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -572,6 +572,29 @@ namespace {
 		}
 	}
 
+    void XShapeDumper::dumpPointSequenceSequence(drawing::PointSequenceSequence aPointSequenceSequence, xmlTextWriterPtr xmlWriter)
+    {
+        // LibreOffice proudly presents - The Sequenception
+        uno::Sequence<uno::Sequence< awt::Point > > pointSequenceSequence = aPointSequenceSequence;
+        sal_Int32 nPointsSequence = pointSequenceSequence.getLength();
+        for (sal_Int32 i = 0; i < nPointsSequence; ++i)
+        {
+            uno::Sequence< awt::Point > pointSequence = pointSequenceSequence[i];
+            sal_Int32 nPoints = pointSequence.getLength();
+
+            xmlTextWriterStartElement(xmlWriter, BAD_CAST( "pointSequence" ));
+
+            for(sal_Int32 j = 0; j < nPoints; ++j)
+            {
+                xmlTextWriterStartElement(xmlWriter, BAD_CAST( "point" ));
+                xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, pointSequence[j].X);
+                xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, pointSequence[j].Y);
+                xmlTextWriterEndElement( xmlWriter );
+            }
+            xmlTextWriterEndElement( xmlWriter );
+        }
+    }
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
commit 4fcb375163679b1944d0d5e22d7dcf31b4235b61
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Sat Jun 9 14:12:29 2012 +0200

    Start of dumping PolyPolygonDescriptor service. Added [property] PolygonKind
    
    Change-Id: Icf814a06c85bff2f8da1fc7b0181d71ac4e4602a

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index 8244667..4cebbcc 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -42,6 +42,8 @@
 #include <com/sun/star/drawing/LineJoint.hpp>
 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
 
+#include <com/sun/star/drawing/PolygonKind.hpp>
+
 #ifndef ChartViewDumper_hxx
 #define ChartViewDumper_hxx
 
@@ -98,6 +100,9 @@ private:
     void dumpLineEndCenterAsAttribute(sal_Bool bLineEndCenter, xmlTextWriterPtr xmlWriter);
     void dumpLineEndWidthAsAttribute(sal_Int32 aLineEndWidth, xmlTextWriterPtr xmlWriter);
 
+    // PolyPolygonDescriptor.idl
+    void dumpPolygonKindAsAttribute(com::sun::star::drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter);
+
     void dumpPositionAsAttribute(const com::sun::star::awt::Point& rPoint, xmlTextWriterPtr xmlWriter);
     void dumpSizeAsAttribute(const com::sun::star::awt::Size& rSize, xmlTextWriterPtr xmlWriter);
     void dumpShapeDescriptorAsAttribute( com::sun::star::uno::Reference< com::sun::star::drawing::XShapeDescriptor > xDescr, xmlTextWriterPtr xmlWriter );
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 32b2f8d..594f7ea 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -532,6 +532,46 @@ namespace {
 		xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndWidth"), "%" SAL_PRIdINT32, aLineEndWidth);
 	}
 
+    // -----------------------------------------------
+    // ---------- PolyPolygonDescriptor.idl ----------
+    // -----------------------------------------------
+
+    void XShapeDumper::dumpPolygonKindAsAttribute(drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter)
+	{
+		switch(ePolygonKind)
+		{
+			case drawing::PolygonKind_LINE:
+				xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "LINE");
+				break;
+			case drawing::PolygonKind_POLY:
+				xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "POLY");
+				break;
+			case drawing::PolygonKind_PLIN:
+				xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PLIN");
+				break;
+			case drawing::PolygonKind_PATHLINE:
+				xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHLINE");
+				break;
+			case drawing::PolygonKind_PATHFILL:
+				xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHFILL");
+				break;
+			case drawing::PolygonKind_FREELINE:
+				xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "FREELINE");
+				break;
+			case drawing::PolygonKind_FREEFILL:
+				xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "FREEFILL");
+				break;
+			case drawing::PolygonKind_PATHPOLY:
+				xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHPOLY");
+				break;
+			case drawing::PolygonKind_PATHPLIN:
+				xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHPLIN");
+				break;
+			default:
+				break;
+		}
+	}
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
@@ -827,6 +867,16 @@ namespace {
 			}
         }
 
+        else if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonDescriptor"))
+        {
+            {
+				uno::Any anotherAny = xPropSet->getPropertyValue("PolygonKind");
+				drawing::PolygonKind ePolygonKind;
+				if(anotherAny >>= ePolygonKind)
+					dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
+			}
+        }
+
         #if DEBUG_DUMPER
             sal_Int32 nServices = aServiceNames.getLength();
             for (sal_Int32 i = 0; i < nServices; ++i)


More information about the Libreoffice-commits mailing list