[Libreoffice-commits] .: Branch 'feature/gsoc_test_improvements' - 3 commits - drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/Package_inc.mk drawinglayer/source

Artur Dorda adorda at kemper.freedesktop.org
Wed Jun 27 10:20:36 PDT 2012


 drawinglayer/Library_drawinglayer.mk                  |    1 
 drawinglayer/Package_inc.mk                           |    1 
 drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx |   52 ++++++++++++++++++
 drawinglayer/inc/drawinglayer/XShapeDumper.hxx        |    7 +-
 drawinglayer/source/dumper/EnhancedShapeDumper.cxx    |   48 ++++++++++++++++
 drawinglayer/source/dumper/XShapeDumper.cxx           |   26 ++++++++-
 6 files changed, 132 insertions(+), 3 deletions(-)

New commits:
commit f5ec01eca694fc240cd0e7a102e57bd0c7c807ba
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Tue Jun 26 19:13:22 2012 +0200

    Added service EnhancedCustomShapeExtrusion, properties Extrusion & Brightness
    
    Change-Id: Ie787fb90f2c8192632e0ad8a86c7affbb3315791

diff --git a/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx b/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx
index 71b0fde..777a00b 100644
--- a/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx
@@ -42,6 +42,9 @@ public:
 
     }
 
+    // EnhancedCustomShapeExtrusion.idl
+    void dumpExtrusionAsAttribute(sal_Bool bExtrusion);
+    void dumpBrightnessAsAttribute(double aBrightness);
 
 private:
     xmlTextWriterPtr xmlWriter;
diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
index f68d320..19c60d4 100644
--- a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
+++ b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
@@ -29,5 +29,20 @@
 #include <drawinglayer/EnhancedShapeDumper.hxx>
 #include <rtl/strbuf.hxx>
 
+// ------------------------------------------------------
+// ---------- EnhancedCustomShapeExtrusion.idl ----------
+// ------------------------------------------------------
 
+void EnhancedShapeDumper::dumpExtrusionAsAttribute(sal_Bool bExtrusion)
+{
+    if(bExtrusion)
+        xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusion"), "%s", "true");
+    else
+        xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusion"), "%s", "false");
+}
+
+void EnhancedShapeDumper::dumpBrightnessAsAttribute(double aBrightness)
+{
+    xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("brightness"), "%f", aBrightness);
+}
 
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 990e033..f17c426 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -1620,7 +1620,18 @@ namespace {
 
     void XShapeDumper::dumpEnhancedCustomShapeExtrusionService(uno::Reference< beans::XPropertySet > xPropSet, EnhancedShapeDumper enhancedDumper)
     {
-
+        {
+            uno::Any anotherAny = xPropSet->getPropertyValue("Extrusion");
+            sal_Bool bExtrusion;
+            if(anotherAny >>= bExtrusion)
+                enhancedDumper.dumpExtrusionAsAttribute(bExtrusion);
+        }
+        {
+            uno::Any anotherAny = xPropSet->getPropertyValue("Brightness");
+            double aBrightness;
+            if(anotherAny >>= aBrightness)
+                enhancedDumper.dumpBrightnessAsAttribute(aBrightness);
+        }
     }
 
     void XShapeDumper::dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWriter)
commit 0462d0fb38191b234d095b44602918a7d3c8f16f
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Tue Jun 26 19:07:12 2012 +0200

    Added new class EnhancedShapeDumper handled in XShapeDumper
    
    Change-Id: Ie719eba2579998917cea030fad51f07b0bcacec4

diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index f0d243d..07aaa3b 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -180,6 +180,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/texture/texture3d \
     drawinglayer/source/texture/texture \
     drawinglayer/source/dumper/XShapeDumper \
+    drawinglayer/source/dumper/EnhancedShapeDumper \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/Package_inc.mk b/drawinglayer/Package_inc.mk
index ff9314a..9508f6e 100644
--- a/drawinglayer/Package_inc.mk
+++ b/drawinglayer/Package_inc.mk
@@ -137,5 +137,6 @@ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor3d/
 $(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/XShapeDumper.hxx,drawinglayer/XShapeDumper.hxx))
+$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/XShapeDumper.hxx,drawinglayer/EnhancedShapeDumper.hxx))
 
 # vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx b/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx
new file mode 100644
index 0000000..71b0fde
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx
@@ -0,0 +1,49 @@
+/* -*- 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>
+
+#ifndef EnhancedShapeDumper_hxx
+#define EnhancedShapeDumper_hxx
+
+class DRAWINGLAYER_DLLPUBLIC EnhancedShapeDumper
+{
+public:
+    EnhancedShapeDumper(xmlTextWriterPtr writer)
+    :
+    xmlWriter(writer)
+    {
+
+    }
+
+
+private:
+    xmlTextWriterPtr xmlWriter;
+};
+#endif
diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
index f497e0a..544636e 100644
--- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
+++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx
@@ -28,6 +28,8 @@
 
 #include <libxml/xmlwriter.h>
 #include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/EnhancedShapeDumper.hxx>
+
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
@@ -57,8 +59,8 @@
 
 #include <com/sun/star/beans/PropertyValue.hpp>
 
-#ifndef ChartViewDumper_hxx
-#define ChartViewDumper_hxx
+#ifndef XShapeDumper_hxx
+#define XShapeDumper_hxx
 
 class DRAWINGLAYER_DLLPUBLIC XShapeDumper
 {
@@ -193,6 +195,7 @@ private:
     void dumpShapeService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter);
     void dumpPolyPolygonBezierDescriptorService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter);
     void dumpCustomShapeService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter);
+    void dumpEnhancedCustomShapeExtrusionService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, EnhancedShapeDumper enhancedDumper);
 
 };
 #endif
diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
new file mode 100644
index 0000000..f68d320
--- /dev/null
+++ b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
@@ -0,0 +1,33 @@
+/* -*- 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/EnhancedShapeDumper.hxx>
+#include <rtl/strbuf.hxx>
+
+
+
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 7ed19c0..990e033 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -1618,6 +1618,11 @@ namespace {
         }
     }
 
+    void XShapeDumper::dumpEnhancedCustomShapeExtrusionService(uno::Reference< beans::XPropertySet > xPropSet, EnhancedShapeDumper enhancedDumper)
+    {
+
+    }
+
     void XShapeDumper::dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWriter)
     {
         xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) );
@@ -1677,6 +1682,14 @@ namespace {
         if(xServiceInfo->supportsService("com.sun.star.drawing.CustomShape"))
             dumpCustomShapeService(xPropSet, xmlWriter);
 
+        // EnhancedShapeDumper used
+
+        if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeExtrusion"))
+        {
+            EnhancedShapeDumper enhancedDumper(xmlWriter);
+            dumpEnhancedCustomShapeExtrusionService(xPropSet, enhancedDumper);
+        }
+
         #if DEBUG_DUMPER
             sal_Int32 nServices = aServiceNames.getLength();
             for (sal_Int32 i = 0; i < nServices; ++i)
commit 9a13a6a73cd9837775919afd9853ecf537a836d1
Author: Artur Dorda <artur.dorda+libo at gmail.com>
Date:   Fri Jun 22 12:40:47 2012 +0200

    fixed taking wrong string as a parameter
    
    Change-Id: I30a68a17b14b9867dc2d2ade8b12e7484d68fe9e

diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index dcf3921..7ed19c0 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -1025,7 +1025,7 @@ namespace {
             if(aAny >>= sValue)
             {
                 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s",
-                    rtl::OUStringToOString(aCustomShapeGeometry[i].Name, RTL_TEXTENCODING_UTF8).getStr());
+                    rtl::OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
             }
             switch(aCustomShapeGeometry[i].State)
             {


More information about the Libreoffice-commits mailing list