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

Artur Dorda adorda at kemper.freedesktop.org
Fri Jun 8 06:02:01 PDT 2012


 drawinglayer/inc/drawinglayer/XShapeDumper.hxx |   10 ++
 drawinglayer/source/dumper/XShapeDumper.cxx    |   89 +++++++++++++++++++++++++
 2 files changed, 99 insertions(+)

New commits:
commit b9bd2bb941a070f3cf8fda729db6c1ccb33d632a
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Fri Jun 8 13:47:49 2012 +0200

    Added dumping [property] LineColor
    
    Change-Id: I5683c722eba00e98543e765fd97dc9426685f459

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index ce44cd4..44f739e 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -82,6 +82,7 @@ private:
     void dumpLineStyleAsAttribute(com::sun::star::drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter);
     void dumpLineDashAsElement(com::sun::star::drawing::LineDash aLineDash, xmlTextWriterPtr xmlWriter);
     void dumpLineDashNameAsAttribute(rtl::OUString sLineDashName, xmlTextWriterPtr xmlWriter);
+    void dumpLineColorAsAttribute(sal_Int32 aLineColor, 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 b8cfbe6..4fe4133 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -384,6 +384,11 @@ namespace {
             rtl::OUStringToOString(sLineDashName, RTL_TEXTENCODING_UTF8).getStr());
     }
 
+    void XShapeDumper::dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineColor"), "%" SAL_PRIdINT32, aLineColor);
+    }
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
@@ -605,6 +610,12 @@ namespace {
                 if(anotherAny >>= sLineDashName)
                     dumpLineDashNameAsAttribute(sLineDashName, xmlWriter);
             }
+            {
+                uno::Any anotherAny = xPropSet->getPropertyValue("LineColor");
+                sal_Int32 aLineColor;
+                if(anotherAny >>= aLineColor)
+                    dumpLineColorAsAttribute(aLineColor, xmlWriter);
+            }
         }
 
         #if DEBUG_DUMPER
commit 18ff3f9483fa54c3175893279ee3083727ed6337
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Fri Jun 8 13:39:48 2012 +0200

    Added dumping [property] LineDashName
    
    Change-Id: I3c267968379cb2e1626e17093d5513d6e2c23d84

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index 92dc06e..ce44cd4 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -81,6 +81,7 @@ private:
     // LineProperties.idl
     void dumpLineStyleAsAttribute(com::sun::star::drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter);
     void dumpLineDashAsElement(com::sun::star::drawing::LineDash aLineDash, xmlTextWriterPtr xmlWriter);
+    void dumpLineDashNameAsAttribute(rtl::OUString sLineDashName, 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 f551b55..b8cfbe6 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -378,6 +378,12 @@ namespace {
         xmlTextWriterEndElement( xmlWriter );
     }
 
+    void XShapeDumper::dumpLineDashNameAsAttribute(rtl::OUString sLineDashName, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineDashName"), "%s",
+            rtl::OUStringToOString(sLineDashName, RTL_TEXTENCODING_UTF8).getStr());
+    }
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
@@ -593,6 +599,12 @@ namespace {
                 if(anotherAny >>= aLineDash)
                     dumpLineDashAsElement(aLineDash, xmlWriter);
             }
+            {
+                uno::Any anotherAny = xPropSet->getPropertyValue("LineDashName");
+                rtl::OUString sLineDashName;
+                if(anotherAny >>= sLineDashName)
+                    dumpLineDashNameAsAttribute(sLineDashName, xmlWriter);
+            }
         }
 
         #if DEBUG_DUMPER
commit 3f246d17e6b31eb6d27ba7c42010072abf204bc1
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Fri Jun 8 13:29:08 2012 +0200

    Added dumping [property] LineDash
    
    Change-Id: I9191ea0c30910b244d13a3b14a0822fa615baada

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index 88c42e9..92dc06e 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -36,7 +36,9 @@
 #include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/drawing/RectanglePoint.hpp>
 #include <com/sun/star/drawing/BitmapMode.hpp>
+
 #include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
 
 #ifndef ChartViewDumper_hxx
 #define ChartViewDumper_hxx
@@ -78,6 +80,7 @@ private:
 
     // LineProperties.idl
     void dumpLineStyleAsAttribute(com::sun::star::drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter);
+    void dumpLineDashAsElement(com::sun::star::drawing::LineDash aLineDash, 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 d79dcfe..f551b55 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -350,6 +350,34 @@ namespace {
         }
     }
 
+    void XShapeDumper::dumpLineDashAsElement(drawing::LineDash aLineDash, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineDash" ));
+        switch(aLineDash.Style)
+        {
+            case drawing::DashStyle_RECT:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECT");
+                break;
+            case drawing::DashStyle_ROUND:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ROUND");
+                break;
+            case drawing::DashStyle_RECTRELATIVE:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECTRELATIVE");
+                break;
+            case drawing::DashStyle_ROUNDRELATIVE:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ROUNDRELATIVE");
+                break;
+            default:
+                break;
+        }
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dots"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.Dots);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dotLen"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.DotLen);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashes"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.Dashes);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashLen"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.DashLen);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.Distance);
+        xmlTextWriterEndElement( xmlWriter );
+    }
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
@@ -559,6 +587,12 @@ namespace {
                 if(anotherAny >>= eLineStyle)
                     dumpLineStyleAsAttribute(eLineStyle, xmlWriter);
             }
+            {
+                uno::Any anotherAny = xPropSet->getPropertyValue("LineDash");
+                drawing::LineDash aLineDash;
+                if(anotherAny >>= aLineDash)
+                    dumpLineDashAsElement(aLineDash, xmlWriter);
+            }
         }
 
         #if DEBUG_DUMPER
commit 2a1f7dc363952e3c0ad27a0336be8c538ae05fc7
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Fri Jun 8 13:24:19 2012 +0200

    Start of dumping LineProperties service. Added [property] LineStyle
    
    Change-Id: I32ad88f0512388dbe0e4c657d894ea189a53a6f0

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index 94f41e0..88c42e9 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/drawing/RectanglePoint.hpp>
 #include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
 
 #ifndef ChartViewDumper_hxx
 #define ChartViewDumper_hxx
@@ -48,6 +49,7 @@ public:
     rtl::OUString dump(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> xPageShapes);
 
 private:
+    // 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);
@@ -74,6 +76,9 @@ private:
     void dumpFillBitmapStretchAsAttribute(sal_Bool bBitmapStretch, xmlTextWriterPtr xmlWriter);
     void dumpFillBitmapTileAsAttribute(sal_Bool bBitmapTile, xmlTextWriterPtr xmlWriter);
 
+    // LineProperties.idl
+    void dumpLineStyleAsAttribute(com::sun::star::drawing::LineStyle eLineStyle, 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 247d5cc..d79dcfe 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -328,6 +328,28 @@ namespace {
             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapTile"), "%s", "false");
     }
 
+    // ----------------------------------------
+    // ---------- LineProperties.idl ----------
+    // ----------------------------------------
+
+    void XShapeDumper::dumpLineStyleAsAttribute(drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter)
+    {
+        switch(eLineStyle)
+        {
+            case drawing::LineStyle_NONE:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "NONE");
+                break;
+            case drawing::LineStyle_SOLID:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "SOLID");
+                break;
+            case drawing::LineStyle_DASH:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "DASH");
+                break;
+            default:
+                break;
+        }
+    }
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
@@ -529,6 +551,16 @@ namespace {
             }
         }
 
+        else if(xServiceInfo->supportsService("com.sun.star.drawing.LineProperties"))
+        {
+            {
+                uno::Any anotherAny = xPropSet->getPropertyValue("LineStyle");
+                drawing::LineStyle eLineStyle;
+                if(anotherAny >>= eLineStyle)
+                    dumpLineStyleAsAttribute(eLineStyle, 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