[Libreoffice-commits] .: Branch 'feature/gsoc_test_improvements' - 7 commits - chart2/Library_chartview.mk chart2/source drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/Package_inc.mk drawinglayer/source .gitignore

Artur Dorda adorda at kemper.freedesktop.org
Tue Jun 5 14:19:51 PDT 2012


 .gitignore                                     |    3 
 chart2/Library_chartview.mk                    |    1 
 chart2/source/view/main/ChartView.cxx          |   26 +-
 drawinglayer/Library_drawinglayer.mk           |    6 
 drawinglayer/Package_inc.mk                    |    1 
 drawinglayer/inc/drawinglayer/XShapeDumper.hxx |   57 ++++++
 drawinglayer/source/dumper/XShapeDumper.cxx    |  229 +++++++++++++++++++++++++
 7 files changed, 308 insertions(+), 15 deletions(-)

New commits:
commit 80caec227b57958f87a0f2be21c0dd99a7a4c123
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Tue Jun 5 02:35:35 2012 +0200

    Added dumping [property] FillTransparenceGradientName + corrected method calls
    
    Change-Id: I882d1d4ebe0bef6ac23eb25117d52e460223bb29

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index 744b462..4b77fb7 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -46,6 +46,7 @@ private:
     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 aTranspGradName, 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 22c5873..55bfc6f 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -67,19 +67,19 @@ namespace {
         switch(eFillStyle)
         {
             case drawing::FillStyle_NONE:
-                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "NONE");
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "NONE");
                 break;
             case drawing::FillStyle_SOLID:
-                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "SOLID");
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "SOLID");
                 break;
             case drawing::FillStyle_GRADIENT:
-                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "GRADIENT");
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "GRADIENT");
                 break;
             case drawing::FillStyle_HATCH:
-                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "HATCH");
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "HATCH");
                 break;
             case drawing::FillStyle_BITMAP:
-                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "BITMAP");
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "BITMAP");
                 break;
             default:
                 break;
@@ -88,12 +88,18 @@ namespace {
 
     void XShapeDumper::dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter)
     {
-        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, aColor);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillColor"), "%" SAL_PRIdINT32, aColor);
     }
 
     void XShapeDumper::dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter)
     {
-        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, aTransparence);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparence"), "%" SAL_PRIdINT32, aTransparence);
+    }
+
+    void XShapeDumper::dumpFillTransparenceGradientNameAsAttribute(rtl::OUString aTranspGradName, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparenceGradientName"), "%s",
+            rtl::OUStringToOString(aTranspGradName, RTL_TEXTENCODING_UTF8).getStr());
     }
 
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
@@ -166,7 +172,13 @@ namespace {
                 uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparence");
                 sal_Int32 aTransparence;
                 if(anotherAny >>= aTransparence)
-                    dumpFillColorAsAttribute(aTransparence, xmlWriter);
+                    dumpFillTransparenceAsAttribute(aTransparence, xmlWriter);
+            }
+            {
+                uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparenceGradientName");
+                rtl::OUString aTranspGradName;
+                if(anotherAny >>= aTranspGradName)
+                    dumpFillTransparenceGradientNameAsAttribute(aTranspGradName, xmlWriter);
             }
         }
 
commit 31d022015150f7e86b6caa40e30c0a66b1fda89f
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Tue Jun 5 02:20:21 2012 +0200

    Added dumping [property] FillTransparence and ignoring .patch files
    
    Change-Id: I676a811a618b381f4a99010e40fdf1627cea7067

diff --git a/.gitignore b/.gitignore
index c1aef58..45d72d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -130,3 +130,6 @@ test/user-template/user/psprint/pspfontcache
 # Somepeople love debugging
 gdbtrace.log
 valgrind.log
+
+#patches
+*.patch
diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index d316a45..744b462 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -45,6 +45,7 @@ public:
 private:
     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 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 5844c0e..22c5873 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -91,6 +91,11 @@ namespace {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, aColor);
     }
 
+    void XShapeDumper::dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, aTransparence);
+    }
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
@@ -151,13 +156,18 @@ namespace {
                 if(anotherAny >>= eFillStyle)
                     dumpFillStyleAsAttribute(eFillStyle, xmlWriter);
             }
-
             {
                 uno::Any anotherAny = xPropSet->getPropertyValue("FillColor");
                 sal_Int32 aColor;
                 if(anotherAny >>= aColor)
                     dumpFillColorAsAttribute(aColor, xmlWriter);
             }
+            {
+                uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparence");
+                sal_Int32 aTransparence;
+                if(anotherAny >>= aTransparence)
+                    dumpFillColorAsAttribute(aTransparence, xmlWriter);
+            }
         }
 
         #if DEBUG_DUMPER
commit ced310ec97317aa6d227db6b478859a2ef618b79
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Tue Jun 5 02:05:32 2012 +0200

    Way of dumping properties corrected
    
    Change-Id: I48e269547f4ee06c5cc7ea2407997a70c6d21044

diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 6a3b8d9..5844c0e 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -143,20 +143,20 @@ namespace {
             uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW);
             dumpXShapes(xShapes, xmlWriter);
         }
-        else if(xServiceInfo->supportsService("com.sun.star.drawing.FillStyle"))
+        else if(xServiceInfo->supportsService("com.sun.star.drawing.FillProperties"))
         {
-            uno::Any anotherAny = xPropSet->getPropertyValue("FillStyle");
-            drawing::FillStyle eFillStyle;
-            if( anotherAny >>= eFillStyle)
+            {
+                uno::Any anotherAny = xPropSet->getPropertyValue("FillStyle");
+                drawing::FillStyle eFillStyle;
+                if(anotherAny >>= eFillStyle)
                     dumpFillStyleAsAttribute(eFillStyle, xmlWriter);
-        }
-        else if(xServiceInfo->supportsService("com.sun.star.util.Color"))
-        {
-            uno::Any anotherAny = xPropSet->getPropertyValue("FillColor");
-            sal_Int32 aColor;
-            if(anotherAny >>= aColor)
+            }
+
             {
-                dumpFillColorAsAttribute(aColor, xmlWriter);
+                uno::Any anotherAny = xPropSet->getPropertyValue("FillColor");
+                sal_Int32 aColor;
+                if(anotherAny >>= aColor)
+                    dumpFillColorAsAttribute(aColor, xmlWriter);
             }
         }
 
commit 6beaa857bd81503a7be63855690dbb18da0c7d84
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Mon Jun 4 22:02:15 2012 +0200

    Added dumping [property] FillColor
    
    Change-Id: I5c5edfaac3540af0c99dd034e511688b3bedd26f

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index 9e3bcf6..d316a45 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -44,6 +44,7 @@ public:
 
 private:
     void dumpFillStyleAsAttribute(com::sun::star::drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter);
+    void dumpFillColorAsAttribute(sal_Int32 aColor, 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 92e12d1..6a3b8d9 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -86,6 +86,11 @@ namespace {
         }
     }
 
+    void XShapeDumper::dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, aColor);
+    }
+
     void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
@@ -106,18 +111,21 @@ namespace {
     void XShapeDumper::dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) );
+        uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
+        uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo();
+        rtl::OUString aName;
 
         dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
         dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
         uno::Reference< drawing::XShapeDescriptor > xDescr(xShape, uno::UNO_QUERY_THROW);
         dumpShapeDescriptorAsAttribute(xDescr, xmlWriter);
 
+        // uno::Sequence<beans::Property> aProperties = xPropSetInfo->getProperties();
+
         uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
         uno::Sequence< rtl::OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
 
-        uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
         uno::Any aAny = xPropSet->getPropertyValue("Name");
-        rtl::OUString aName;
         if (aAny >>= aName)
         {
             if (!aName.isEmpty())
@@ -140,8 +148,15 @@ namespace {
             uno::Any anotherAny = xPropSet->getPropertyValue("FillStyle");
             drawing::FillStyle eFillStyle;
             if( anotherAny >>= eFillStyle)
-            {
                     dumpFillStyleAsAttribute(eFillStyle, xmlWriter);
+        }
+        else if(xServiceInfo->supportsService("com.sun.star.util.Color"))
+        {
+            uno::Any anotherAny = xPropSet->getPropertyValue("FillColor");
+            sal_Int32 aColor;
+            if(anotherAny >>= aColor)
+            {
+                dumpFillColorAsAttribute(aColor, xmlWriter);
             }
         }
 
commit 55b5ba98e2c02714c730f1c1b3ece5564566d69a
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Mon Jun 4 16:49:51 2012 +0200

    Start of dumping FillProperties service. Added [property] FillStyle
    
    Change-Id: Ie49170eb6e2226fb94b5ea50e365cd70b2c43c5a

diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
new file mode 100644
index 0000000..9e3bcf6
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Artur Dorda <artur.dorda+libo at gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <libxml/xmlwriter.h>
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#ifndef ChartViewDumper_hxx
+#define ChartViewDumper_hxx
+
+class DRAWINGLAYER_DLLPUBLIC XShapeDumper
+{
+
+public:
+    XShapeDumper();
+    rtl::OUString dump(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> xPageShapes);
+
+private:
+    void dumpFillStyleAsAttribute(com::sun::star::drawing::FillStyle eFillStyle, 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 );
+    void dumpXShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape, xmlTextWriterPtr xmlWriter);
+    void dumpXShapes( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter );
+
+};
+#endif
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
new file mode 100644
index 0000000..92e12d1
--- /dev/null
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Artur Dorda <artur.dorda+libo at gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <drawinglayer/XShapeDumper.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <rtl/strbuf.hxx>
+
+
+#define DEBUG_DUMPER 0
+
+using namespace com::sun::star;
+//class XShapeDumper
+
+namespace {
+
+    int writeCallback(void* pContext, const char* sBuffer, int nLen)
+    {
+        rtl::OStringBuffer* pBuffer = static_cast<rtl::OStringBuffer*>(pContext);
+        pBuffer->append(sBuffer);
+        return nLen;
+    }
+
+    int closeCallback(void* )
+    {
+        return 0;
+    }
+} //end of namespace
+
+    XShapeDumper::XShapeDumper()
+    {
+
+    }
+    // ----------------------------------------
+    // ---------- FillProperties.idl ----------
+    // ----------------------------------------
+    void XShapeDumper::dumpFillStyleAsAttribute(drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter)
+    {
+        switch(eFillStyle)
+        {
+            case drawing::FillStyle_NONE:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "NONE");
+                break;
+            case drawing::FillStyle_SOLID:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "SOLID");
+                break;
+            case drawing::FillStyle_GRADIENT:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "GRADIENT");
+                break;
+            case drawing::FillStyle_HATCH:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "HATCH");
+                break;
+            case drawing::FillStyle_BITMAP:
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("FillStyle"), "%s", "BITMAP");
+                break;
+            default:
+                break;
+        }
+    }
+
+    void XShapeDumper::dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, rPoint.Y);
+    }
+
+    void XShapeDumper::dumpSizeAsAttribute(const awt::Size& rSize, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeX"), "%" SAL_PRIdINT32, rSize.Width);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeY"), "%" SAL_PRIdINT32, rSize.Height);
+    }
+
+    void XShapeDumper::dumpShapeDescriptorAsAttribute( uno::Reference< drawing::XShapeDescriptor > xDescr, xmlTextWriterPtr xmlWriter )
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s", rtl::OUStringToOString(xDescr->getShapeType(), RTL_TEXTENCODING_UTF8).getStr());
+    }
+
+    void XShapeDumper::dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) );
+
+        dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
+        dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
+        uno::Reference< drawing::XShapeDescriptor > xDescr(xShape, uno::UNO_QUERY_THROW);
+        dumpShapeDescriptorAsAttribute(xDescr, xmlWriter);
+
+        uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
+        uno::Sequence< rtl::OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
+
+        uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
+        uno::Any aAny = xPropSet->getPropertyValue("Name");
+        rtl::OUString aName;
+        if (aAny >>= aName)
+        {
+            if (!aName.isEmpty())
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
+        }
+        if (xServiceInfo->supportsService("com.sun.star.drawing.Text"))
+        {
+            uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY_THROW);
+            rtl::OUString aText = xText->getString();
+            if(!aText.isEmpty())
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", rtl::OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr());
+        }
+        else if(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
+        {
+            uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW);
+            dumpXShapes(xShapes, xmlWriter);
+        }
+        else if(xServiceInfo->supportsService("com.sun.star.drawing.FillStyle"))
+        {
+            uno::Any anotherAny = xPropSet->getPropertyValue("FillStyle");
+            drawing::FillStyle eFillStyle;
+            if( anotherAny >>= eFillStyle)
+            {
+                    dumpFillStyleAsAttribute(eFillStyle, xmlWriter);
+            }
+        }
+
+        #if DEBUG_DUMPER
+            sal_Int32 nServices = aServiceNames.getLength();
+            for (sal_Int32 i = 0; i < nServices; ++i)
+            {
+                xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ServiceName" ));
+                xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST( "name" ), "%s", rtl::OUStringToOString(aServiceNames[i], RTL_TEXTENCODING_UTF8).getStr());
+                xmlTextWriterEndElement( xmlWriter );
+            }
+        #endif
+
+        xmlTextWriterEndElement( xmlWriter );
+    }
+
+    void XShapeDumper::dumpXShapes( uno::Reference< drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter )
+    {
+        xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShapes" ) );
+        uno::Reference< container::XIndexAccess > xIA( xShapes, uno::UNO_QUERY_THROW);
+        sal_Int32 nLength = xIA->getCount();
+        for (sal_Int32 i = 0; i < nLength; ++i)
+        {
+            uno::Reference< drawing::XShape > xShape( xIA->getByIndex( i ), uno::UNO_QUERY_THROW );
+            dumpXShape( xShape, xmlWriter );
+        }
+
+        xmlTextWriterEndElement( xmlWriter );
+    }
+
+    rtl::OUString XShapeDumper::dump(uno::Reference<drawing::XShapes> xPageShapes)
+    {
+
+        rtl::OStringBuffer aString;
+        xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, NULL );
+        xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
+        xmlTextWriterSetIndent( xmlWriter, 1 );
+
+        xmlTextWriterStartDocument( xmlWriter, NULL, NULL, NULL );
+
+        dumpXShapes( xPageShapes, xmlWriter );
+
+        xmlTextWriterEndDocument( xmlWriter );
+        xmlFreeTextWriter( xmlWriter );
+
+        return OStringToOUString(aString.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
+    }
+
commit 75aaa0eff4f0b6e9c4e16e9942e188b98bd80517
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Fri Jun 1 19:54:53 2012 +0200

    Working version of XShapeDumper
    
    Change-Id: I4f4d37abdb1865d0bc05f01518d854872235121f

diff --git a/chart2/Library_chartview.mk b/chart2/Library_chartview.mk
index ab3952e..18b0548 100644
--- a/chart2/Library_chartview.mk
+++ b/chart2/Library_chartview.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Library_use_libraries,chartview,\
     tl \
     utl \
     vcl \
+    drawinglayer \
     $(gb_STDLIBS) \
 ))
 
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index d4d48c6..e21214f 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -75,6 +75,8 @@
 #include <osl/mutex.hxx>
 #include <svx/unofill.hxx>
 
+#include <drawinglayer/XShapeDumper.hxx>
+
 #include <time.h>
 
 #include <com/sun/star/chart/ChartAxisPosition.hpp>
@@ -3027,7 +3029,7 @@ uno::Sequence< ::rtl::OUString > ChartView::getAvailableServiceNames() throw (un
 }
 
 /* ----------------------
-    goes to drawinglayer/
+    goes to drawinglayer/XShapeDumper.cxx
     ----------------------
 namespace {
 
@@ -3133,21 +3135,12 @@ rtl::OUString ChartView::dump() throw (uno::RuntimeException)
 
     if (!xPageShapes.is())
         return rtl::OUString();
+    else
+    {
+        XShapeDumper dumper;
+        return dumper.dump(xPageShapes);
+    }
 
-    rtl::OStringBuffer aString;
-    xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, NULL );
-    xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
-    xmlTextWriterSetIndent( xmlWriter, 1 );
-
-    xmlTextWriterStartDocument( xmlWriter, NULL, NULL, NULL );
-
-    dumpXShapes( xPageShapes, xmlWriter );
-
-    xmlTextWriterEndDocument( xmlWriter );
-    xmlFreeTextWriter( xmlWriter );
-
-
-    return OStringToOUString(aString.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
 }
 
 //.............................................................................
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 0181da2..f0d243d 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -43,6 +43,10 @@ $(eval $(call gb_Library_use_api,drawinglayer,\
     udkapi \
 ))
 
+$(eval $(call gb_Library_use_externals,drawinglayer,\
+	libxml2 \
+))
+
 $(eval $(call gb_Library_use_libraries,drawinglayer,\
     avmedia \
     basegfx \
@@ -175,7 +179,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/processor3d/zbufferprocessor3d \
     drawinglayer/source/texture/texture3d \
     drawinglayer/source/texture/texture \
-    drawinglayer/source/dumper/ChartViewDumper \
+    drawinglayer/source/dumper/XShapeDumper \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/Package_inc.mk b/drawinglayer/Package_inc.mk
index e28a5b3..ff9314a 100644
--- a/drawinglayer/Package_inc.mk
+++ b/drawinglayer/Package_inc.mk
@@ -136,6 +136,6 @@ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor3d/
 $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor3d/zbufferprocessor3d.hxx,drawinglayer/processor3d/zbufferprocessor3d.hxx))
 $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/texture/texture3d.hxx,drawinglayer/texture/texture3d.hxx))
 $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/texture/texture.hxx,drawinglayer/texture/texture.hxx))
-$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/ChartViewDumper.hxx,drawinglayer/ChartViewDumper.hxx))
+$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/XShapeDumper.hxx,drawinglayer/XShapeDumper.hxx))
 
 # vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/inc/drawinglayer/ChartViewDumper.hxx b/drawinglayer/inc/drawinglayer/ChartViewDumper.hxx
deleted file mode 100644
index b7f3552..0000000
--- a/drawinglayer/inc/drawinglayer/ChartViewDumper.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- * Copyright (C) 2012 Artur Dorda <artur.dorda+libo at gmail.com> (initial developer)
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#include <libxml/xmlwriter.h>
-#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
-
-#ifndef ChartViewDumper_hxx
-#define ChartViewDumper_hxx
-
-class ChartViewDumper
-{
-
-public:
-    ChartViewDumper();
-    int writeCallback(void* pContext, const char* sBuffer, int nLen);
-    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 );
-    void dumpXShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape, xmlTextWriterPtr xmlWriter);
-    void dumpXShapes( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter );
-    rtl::OUString dump();
-
-};
-#endif
diff --git a/drawinglayer/source/dumper/ChartViewDumper.cxx b/drawinglayer/source/dumper/ChartViewDumper.cxx
deleted file mode 100644
index 5d3c037..0000000
--- a/drawinglayer/source/dumper/ChartViewDumper.cxx
+++ /dev/null
@@ -1,159 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- * Copyright (C) 2012 Artur Dorda <artur.dorda+libo at gmail.com> (initial developer)
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#include <drawinglayer/ChartViewDumper.hxx>
-#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <rtl/strbuf.hxx>
-
-
-#define DEBUG_DUMPER 0
-
-using namespace com::sun::star;
-//class ChartViewDumper
-namespace
-{
-    void dumpXShapes( uno::Reference< drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter );
-
-    int writeCallback(void* pContext, const char* sBuffer, int nLen)
-    {
-        rtl::OStringBuffer* pBuffer = static_cast<rtl::OStringBuffer*>(pContext);
-        pBuffer->append(sBuffer);
-        return nLen;
-    }
-
-    int closeCallback(void* )
-    {
-        return 0;
-    }
-
-    void dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
-    {
-        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
-        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, rPoint.Y);
-    }
-
-    void dumpSizeAsAttribute(const awt::Size& rSize, xmlTextWriterPtr xmlWriter)
-    {
-        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeX"), "%" SAL_PRIdINT32, rSize.Width);
-        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeY"), "%" SAL_PRIdINT32, rSize.Height);
-    }
-
-    void dumpShapeDescriptorAsAttribute( uno::Reference< drawing::XShapeDescriptor > xDescr, xmlTextWriterPtr xmlWriter )
-    {
-        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s", rtl::OUStringToOString(xDescr->getShapeType(), RTL_TEXTENCODING_UTF8).getStr());
-    }
-
-    void dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWriter)
-    {
-        xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) );
-
-        dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
-        dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
-        uno::Reference< drawing::XShapeDescriptor > xDescr(xShape, uno::UNO_QUERY_THROW);
-        dumpShapeDescriptorAsAttribute(xDescr, xmlWriter);
-
-        uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
-        uno::Sequence< rtl::OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
-
-        uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
-        uno::Any aAny = xPropSet->getPropertyValue("Name");
-        rtl::OUString aName;
-        if (aAny >>= aName)
-        {
-            if (!aName.isEmpty())
-                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
-        }
-        if (xServiceInfo->supportsService("com.sun.star.drawing.Text"))
-        {
-            uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY_THROW);
-            rtl::OUString aText = xText->getString();
-            if(!aText.isEmpty())
-                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", rtl::OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr());
-        }
-        else if(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
-        {
-            uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW);
-            dumpXShapes(xShapes, xmlWriter);
-        }
-
-        #if DEBUG_DUMPER
-            sal_Int32 nServices = aServiceNames.getLength();
-            for (sal_Int32 i = 0; i < nServices; ++i)
-            {
-                xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ServiceName" ));
-                xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST( "name" ), "%s", rtl::OUStringToOString(aServiceNames[i], RTL_TEXTENCODING_UTF8).getStr());
-                xmlTextWriterEndElement( xmlWriter );
-            }
-        #endif
-
-        xmlTextWriterEndElement( xmlWriter );
-    }
-
-    void dumpXShapes( uno::Reference< drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter )
-    {
-        xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShapes" ) );
-        uno::Reference< container::XIndexAccess > xIA( xShapes, uno::UNO_QUERY_THROW);
-        sal_Int32 nLength = xIA->getCount();
-        for (sal_Int32 i = 0; i < nLength; ++i)
-        {
-            uno::Reference< drawing::XShape > xShape( xIA->getByIndex( i ), uno::UNO_QUERY_THROW );
-            dumpXShape( xShape, xmlWriter );
-        }
-
-        xmlTextWriterEndElement( xmlWriter );
-    }
-
-    rtl::OUString dump() throw (uno::RuntimeException)
-    {
-        impl_updateView();
-        uno::Reference<drawing::XShapes> xPageShapes( ShapeFactory(m_xShapeFactory)
-            .getOrCreateChartRootShape( m_xDrawPage ) );
-
-        if (!xPageShapes.is())
-            return rtl::OUString();
-
-        rtl::OStringBuffer aString;
-        xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, NULL );
-        xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
-        xmlTextWriterSetIndent( xmlWriter, 1 );
-
-        xmlTextWriterStartDocument( xmlWriter, NULL, NULL, NULL );
-
-        dumpXShapes( xPageShapes, xmlWriter );
-
-        xmlTextWriterEndDocument( xmlWriter );
-        xmlFreeTextWriter( xmlWriter );
-
-        return OStringToOUString(aString.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
-    }
-
-} //end of namespace
commit 202fd25012f2301cc773623e87146438e530620b
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Sat May 26 01:11:53 2012 +0200

    Unfinished dumper code
    
    Change-Id: I353c93498c2e0cc8fd4450f0348dfceedb763b51

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 9020d7b..d4d48c6 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3026,6 +3026,9 @@ uno::Sequence< ::rtl::OUString > ChartView::getAvailableServiceNames() throw (un
     return aServiceNames;
 }
 
+/* ----------------------
+    goes to drawinglayer/
+    ----------------------
 namespace {
 
 #define DEBUG_DUMPER 0
@@ -3121,7 +3124,7 @@ void dumpXShapes( uno::Reference< drawing::XShapes > xShapes, xmlTextWriterPtr x
 }
 
 }
-
+*/
 rtl::OUString ChartView::dump() throw (uno::RuntimeException)
 {
     impl_updateView();
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index b59bd12..0181da2 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_Library_use_package,drawinglayer,drawinglayer_inc))
 
 $(eval $(call gb_Library_set_include,drawinglayer,\
     $$(INCLUDE) \
+    -I$(SRCDIR)/drawinglayer/inc \
 ))
 
 $(eval $(call gb_Library_add_defs,drawinglayer,\
@@ -174,6 +175,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/processor3d/zbufferprocessor3d \
     drawinglayer/source/texture/texture3d \
     drawinglayer/source/texture/texture \
+    drawinglayer/source/dumper/ChartViewDumper \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/Package_inc.mk b/drawinglayer/Package_inc.mk
index 246a91f..e28a5b3 100644
--- a/drawinglayer/Package_inc.mk
+++ b/drawinglayer/Package_inc.mk
@@ -136,5 +136,6 @@ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor3d/
 $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor3d/zbufferprocessor3d.hxx,drawinglayer/processor3d/zbufferprocessor3d.hxx))
 $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/texture/texture3d.hxx,drawinglayer/texture/texture3d.hxx))
 $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/texture/texture.hxx,drawinglayer/texture/texture.hxx))
+$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/ChartViewDumper.hxx,drawinglayer/ChartViewDumper.hxx))
 
 # vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/inc/drawinglayer/ChartViewDumper.hxx b/drawinglayer/inc/drawinglayer/ChartViewDumper.hxx
new file mode 100644
index 0000000..b7f3552
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/ChartViewDumper.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Artur Dorda <artur.dorda+libo at gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <libxml/xmlwriter.h>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+
+#ifndef ChartViewDumper_hxx
+#define ChartViewDumper_hxx
+
+class ChartViewDumper
+{
+
+public:
+    ChartViewDumper();
+    int writeCallback(void* pContext, const char* sBuffer, int nLen);
+    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 );
+    void dumpXShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape, xmlTextWriterPtr xmlWriter);
+    void dumpXShapes( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter );
+    rtl::OUString dump();
+
+};
+#endif
diff --git a/drawinglayer/source/dumper/ChartViewDumper.cxx b/drawinglayer/source/dumper/ChartViewDumper.cxx
new file mode 100644
index 0000000..5d3c037
--- /dev/null
+++ b/drawinglayer/source/dumper/ChartViewDumper.cxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Artur Dorda <artur.dorda+libo at gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <drawinglayer/ChartViewDumper.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <rtl/strbuf.hxx>
+
+
+#define DEBUG_DUMPER 0
+
+using namespace com::sun::star;
+//class ChartViewDumper
+namespace
+{
+    void dumpXShapes( uno::Reference< drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter );
+
+    int writeCallback(void* pContext, const char* sBuffer, int nLen)
+    {
+        rtl::OStringBuffer* pBuffer = static_cast<rtl::OStringBuffer*>(pContext);
+        pBuffer->append(sBuffer);
+        return nLen;
+    }
+
+    int closeCallback(void* )
+    {
+        return 0;
+    }
+
+    void dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, rPoint.Y);
+    }
+
+    void dumpSizeAsAttribute(const awt::Size& rSize, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeX"), "%" SAL_PRIdINT32, rSize.Width);
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeY"), "%" SAL_PRIdINT32, rSize.Height);
+    }
+
+    void dumpShapeDescriptorAsAttribute( uno::Reference< drawing::XShapeDescriptor > xDescr, xmlTextWriterPtr xmlWriter )
+    {
+        xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s", rtl::OUStringToOString(xDescr->getShapeType(), RTL_TEXTENCODING_UTF8).getStr());
+    }
+
+    void dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWriter)
+    {
+        xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) );
+
+        dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
+        dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
+        uno::Reference< drawing::XShapeDescriptor > xDescr(xShape, uno::UNO_QUERY_THROW);
+        dumpShapeDescriptorAsAttribute(xDescr, xmlWriter);
+
+        uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
+        uno::Sequence< rtl::OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
+
+        uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
+        uno::Any aAny = xPropSet->getPropertyValue("Name");
+        rtl::OUString aName;
+        if (aAny >>= aName)
+        {
+            if (!aName.isEmpty())
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
+        }
+        if (xServiceInfo->supportsService("com.sun.star.drawing.Text"))
+        {
+            uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY_THROW);
+            rtl::OUString aText = xText->getString();
+            if(!aText.isEmpty())
+                xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", rtl::OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr());
+        }
+        else if(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
+        {
+            uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW);
+            dumpXShapes(xShapes, xmlWriter);
+        }
+
+        #if DEBUG_DUMPER
+            sal_Int32 nServices = aServiceNames.getLength();
+            for (sal_Int32 i = 0; i < nServices; ++i)
+            {
+                xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ServiceName" ));
+                xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST( "name" ), "%s", rtl::OUStringToOString(aServiceNames[i], RTL_TEXTENCODING_UTF8).getStr());
+                xmlTextWriterEndElement( xmlWriter );
+            }
+        #endif
+
+        xmlTextWriterEndElement( xmlWriter );
+    }
+
+    void dumpXShapes( uno::Reference< drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter )
+    {
+        xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShapes" ) );
+        uno::Reference< container::XIndexAccess > xIA( xShapes, uno::UNO_QUERY_THROW);
+        sal_Int32 nLength = xIA->getCount();
+        for (sal_Int32 i = 0; i < nLength; ++i)
+        {
+            uno::Reference< drawing::XShape > xShape( xIA->getByIndex( i ), uno::UNO_QUERY_THROW );
+            dumpXShape( xShape, xmlWriter );
+        }
+
+        xmlTextWriterEndElement( xmlWriter );
+    }
+
+    rtl::OUString dump() throw (uno::RuntimeException)
+    {
+        impl_updateView();
+        uno::Reference<drawing::XShapes> xPageShapes( ShapeFactory(m_xShapeFactory)
+            .getOrCreateChartRootShape( m_xDrawPage ) );
+
+        if (!xPageShapes.is())
+            return rtl::OUString();
+
+        rtl::OStringBuffer aString;
+        xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, NULL );
+        xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
+        xmlTextWriterSetIndent( xmlWriter, 1 );
+
+        xmlTextWriterStartDocument( xmlWriter, NULL, NULL, NULL );
+
+        dumpXShapes( xPageShapes, xmlWriter );
+
+        xmlTextWriterEndDocument( xmlWriter );
+        xmlFreeTextWriter( xmlWriter );
+
+        return OStringToOUString(aString.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
+    }
+
+} //end of namespace


More information about the Libreoffice-commits mailing list