[Libreoffice-commits] .: 2 commits - chart2/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Wed Mar 28 00:33:11 PDT 2012


 chart2/source/view/main/ChartView.cxx |   33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

New commits:
commit bef64b011337fa60b27339a00c30303143b4397d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Mar 28 09:30:00 2012 +0200

    add name attribute to chart's layout dumper

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index bb49dce..77fe6ab 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3070,7 +3070,15 @@ void dumpXShape( uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlW
 
     uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
     uno::Sequence< rtl::OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
-    sal_Int32 nServices = aServiceNames.getLength();
+
+    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);
@@ -3078,19 +3086,20 @@ void dumpXShape( uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlW
         if(!aText.isEmpty())
             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", rtl::OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr());
     }
-    for (sal_Int32 i = 0; i < nServices; ++i)
+    else if(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
     {
-        if (aServiceNames[i].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GroupShape")))
-        {
-            uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW);
-            dumpXShapes(xShapes, xmlWriter);
-        }
+        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
     }
+#endif
 
     xmlTextWriterEndElement( xmlWriter );
 }
commit f084ac6556ab2374e7cbde5c426feeca0c3b9b9d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Mar 28 09:01:56 2012 +0200

    add drawing.Text to chart's dumper

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 250f1c8..bb49dce 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -100,6 +100,7 @@
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/awt/Point.hpp>
 #include <com/sun/star/drawing/XShapeDescriptor.hpp>
+#include <com/sun/star/text/XText.hpp>
 
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
@@ -3027,7 +3028,7 @@ uno::Sequence< ::rtl::OUString > ChartView::getAvailableServiceNames() throw (un
 
 namespace {
 
-#define DEBUG_DUMPER 0
+#define DEBUG_DUMPER 1
 
 int writeCallback(void* pContext, const char* sBuffer, int nLen)
 {
@@ -3070,6 +3071,13 @@ void dumpXShape( uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlW
     uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
     uno::Sequence< rtl::OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
     sal_Int32 nServices = aServiceNames.getLength();
+    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());
+    }
     for (sal_Int32 i = 0; i < nServices; ++i)
     {
         if (aServiceNames[i].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GroupShape")))


More information about the Libreoffice-commits mailing list