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

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Tue Mar 13 18:41:10 PDT 2012


 chart2/Library_chartview.mk                      |    1 
 chart2/source/view/charttypes/AreaChart.cxx      |    6 
 chart2/source/view/charttypes/VSeriesPlotter.cxx |   37 +++
 chart2/source/view/inc/DumpHelper.hxx            |   71 ++++++
 chart2/source/view/inc/ShapeFactory.hxx          |   25 --
 chart2/source/view/inc/VSeriesPlotter.hxx        |    4 
 chart2/source/view/main/DumpHelper.cxx           |  137 +++++++++++++
 chart2/source/view/main/ShapeFactory.cxx         |  234 +++++++++--------------
 8 files changed, 352 insertions(+), 163 deletions(-)

New commits:
commit fe01a68eaa55fa1ec32384be4c7b6b1863586dd0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Mar 14 02:38:06 2012 +0100

    refactor the chart test code a bit

diff --git a/chart2/Library_chartview.mk b/chart2/Library_chartview.mk
index e6d524c..f9e9703 100644
--- a/chart2/Library_chartview.mk
+++ b/chart2/Library_chartview.mk
@@ -97,6 +97,7 @@ $(eval $(call gb_Library_add_exception_objects,chartview,\
     chart2/source/view/main/Clipping \
     chart2/source/view/main/DataPointSymbolSupplier \
     chart2/source/view/main/DrawModelWrapper \
+    chart2/source/view/main/DumpHelper \
     chart2/source/view/main/LabelPositionHelper \
     chart2/source/view/main/Linear3DTransformation \
     chart2/source/view/main/PlotterBase \
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 35f7033..8aaaf23 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -598,6 +598,9 @@ void AreaChart::createShapes()
     if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
         return;
 
+    if(mbDump)
+        maDumpHelper.writeElement("AreaChart-Shapes");
+
     //the text labels should be always on top of the other series shapes
     //for area chart the error bars should be always on top of the other series shapes
 
@@ -987,6 +990,9 @@ void AreaChart::createShapes()
     }
     */
 
+    if(mbDump)
+        maDumpHelper.endElement();
+
     //remove and delete series-group-shape if empty
 
     //... todo
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 8dfef2e..901e22a 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -158,6 +158,7 @@ VSeriesPlotter::VSeriesPlotter( const uno::Reference<XChartType>& xChartTypeMode
         , m_xColorScheme()
         , m_pExplicitCategoriesProvider(0)
         , m_bPointsWereSkipped(false)
+        , mbDump(ENABLE_DUMP)
 {
     OSL_POSTCOND(m_xChartTypeModel.is(),"no XChartType available in view, fallback to default values may be wrong");
 }
@@ -431,6 +432,14 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
 {
     uno::Reference< drawing::XShape > xTextShape;
 
+    if(mbDump)
+    {
+        maDumpHelper.writeElement("DataLabel");
+        maDumpHelper.writeAttribute("Value", fValue);
+        maDumpHelper.writeAttribute("SumValue", fSumValue);
+        maDumpHelper.writePointElement(rScreenPosition2D);
+    }
+
     try
     {
         awt::Point aScreenPosition2D(rScreenPosition2D);
@@ -2161,10 +2170,19 @@ Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForSeries(
         default:
             break;
     };
+
+    if(mbDump)
+    {
+        maDumpHelper.writeElement("LegendSymbolForSeries");
+    }
+
     Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
         xTarget, eLegendSymbolStyle, xShapeFactory
             , rSeries.getPropertiesOfSeries(), ePropType, aExplicitSymbol ));
 
+    if(mbDump)
+        maDumpHelper.endElement();
+
     return xShape;
 }
 
@@ -2217,9 +2235,19 @@ Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForPoint(
         }
     }
 
+    if (mbDump)
+    {
+        maDumpHelper.writeElement("LegendSymbolForPoint");
+    }
+
     Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
         xTarget, eLegendSymbolStyle, xShapeFactory, xPointSet, ePropType, aExplicitSymbol ));
 
+    if (mbDump)
+    {
+        maDumpHelper.endElement();
+    }
+
     return xShape;
 }
 
@@ -2237,6 +2265,11 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
     if( ! ( xShapeFactory.is() && xTarget.is() && xContext.is() ) )
         return aResult;
 
+    if(mbDump)
+    {
+        maDumpHelper.writeElement("LegendEntriesForSeries");
+    }
+
     try
     {
         ViewLegendEntry aEntry;
@@ -2353,6 +2386,10 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
     {
         ASSERT_EXCEPTION( ex );
     }
+
+    if(mbDump)
+        maDumpHelper.endElement();
+
     return aResult;
 }
 
diff --git a/chart2/source/view/inc/DumpHelper.hxx b/chart2/source/view/inc/DumpHelper.hxx
new file mode 100644
index 0000000..a083d34
--- /dev/null
+++ b/chart2/source/view/inc/DumpHelper.hxx
@@ -0,0 +1,71 @@
+/* -*- 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 Markus Mohrhard <markus.mohrhard at googlemail.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.
+ */
+
+#ifndef _CHART2_DUMPHELPER_HXX
+#define _CHART2_DUMPHELPER_HXX
+
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/DoubleSequenceSequence.hpp>
+
+#define ENABLE_DUMP 0
+
+namespace chart
+{
+
+class DumpHelper
+{
+private:
+    //XmlTextWriterPtr pWriter;
+
+public:
+   //void writeStripe(const Stripe& rStripe);
+
+   void writeElement(const char*);
+   void writeAttribute(const char* pAttrName, const char* pAttrValue);
+   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::Position3D& rPosition);
+   void writeAttribute(const char* pAttrName, const rtl::OUString& rName);
+   void writeAttribute(const char* pAttrName, const sal_Int32);
+   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::Direction3D& rPosition);
+   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PointSequenceSequence& rPoints);
+   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonShape3D& rPoints);
+   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonBezierCoords& rCoords);
+   void writePointElement(const com::sun::star::awt::Point& rPoint);
+   void writeDoubleSequence(const char* pName, const com::sun::star::drawing::DoubleSequenceSequence& rSequence);
+   void endElement();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index f74d51c..9bcaf9b 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -28,6 +28,7 @@
 #ifndef _CHART2_VIEW_SHAPEFACTORY_HXX
 #define _CHART2_VIEW_SHAPEFACTORY_HXX
 
+#include "DumpHelper.hxx"
 #include "PropertyMapper.hxx"
 #include "VLineProperties.hxx"
 #include "BaseGFXHelper.hxx"
@@ -43,36 +44,12 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 
-#define ENABLE_DUMP 0
 
 //.............................................................................
 namespace chart
 {
 //.............................................................................
 
-class DumpHelper
-{
-private:
-    //XmlTextWriterPtr pWriter;
-
-public:
-   //void writeStripe(const Stripe& rStripe);
-
-   void writeElement(const char*);
-   void writeAttribute(const char* pAttrName, const char* pAttrValue);
-   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::Position3D& rPosition);
-   void writeAttribute(const char* pAttrName, const rtl::OUString& rName);
-   void writeAttribute(const char* pAttrName, const sal_Int32);
-   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::Direction3D& rPosition);
-   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PointSequenceSequence& rPoints);
-   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonShape3D& rPoints);
-   void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonBezierCoords& rCoords);
-   void writePointElement(const com::sun::star::awt::Point& rPoint);
-   void writeDoubleSequence(const char* pName, const com::sun::star::drawing::DoubleSequenceSequence& rSequence);
-   void endElement();
-};
-
-
 class Stripe;
 class ShapeFactory
 {
@@ -278,7 +255,7 @@ private:
         m_xShapeFactory;
 
     bool mbDump;
-    DumpHelper maDumpHerlper;
+    DumpHelper maDumpHelper;
 };
 
 //.............................................................................
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx
index 00996a1..3d3f805 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -28,6 +28,7 @@
 #ifndef _CHART2_VSERIESPLOTTER_HXX
 #define _CHART2_VSERIESPLOTTER_HXX
 
+#include "DumpHelper.hxx"
 #include "PlotterBase.hxx"
 #include "VDataSeries.hxx"
 #include "LabelAlignment.hxx"
@@ -437,6 +438,9 @@ protected: //member
     ::com::sun::star::uno::Sequence< sal_Int32 >    m_aCoordinateSystemResolution;
     bool m_bPointsWereSkipped;
 
+    DumpHelper maDumpHelper;
+    bool mbDump;
+
 private: //member
     typedef std::map< sal_Int32 , ExplicitScaleData > tSecondaryValueScales;
     tSecondaryValueScales   m_aSecondaryValueScales;
diff --git a/chart2/source/view/main/DumpHelper.cxx b/chart2/source/view/main/DumpHelper.cxx
new file mode 100644
index 0000000..2f1b1f8
--- /dev/null
+++ b/chart2/source/view/main/DumpHelper.cxx
@@ -0,0 +1,137 @@
+/* -*- 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 Markus Mohrhard <markus.mohrhard at googlemail.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 "DumpHelper.hxx"
+
+#include <iostream>
+#include <rtl/oustringostreaminserter.hxx>
+
+using namespace com::sun::star;
+
+namespace chart
+{
+/*
+void DumpHelper::writeStripe(const Stripe& rStripe)
+{
+    std::cout << "Stripe" << std::endl;
+}*/
+
+void DumpHelper::writeElement(const char* pName)
+{
+    std::cout << pName << std::endl;
+}
+
+void DumpHelper::writeAttribute(const char* pAttrName, const rtl::OUString& rName)
+{
+    std::cout << pAttrName << " " << rName << std::endl;
+}
+
+void DumpHelper::writeAttribute(const char* pAttrName, const char* pAttrValue)
+{
+    std::cout << pAttrName << " " << pAttrValue << std::endl;
+}
+
+void DumpHelper::writeAttribute(const char* pAttrName, const drawing::Position3D& rPos)
+{
+    std::cout << pAttrName << " " << rPos.PositionX << "," << rPos.PositionY << "," << rPos.PositionZ << std::endl;
+}
+
+void DumpHelper::writeAttribute(const char* pAttrName, const drawing::Direction3D& rDirection)
+{
+    std::cout << pAttrName << " " << rDirection.DirectionX << "," << rDirection.DirectionY << "," << rDirection.DirectionZ << std::endl;
+}
+
+void DumpHelper::writeAttribute(const char* pAttrName, const sal_Int32 nValue)
+{
+    std::cout << pAttrName << " " << nValue << std::endl;
+}
+
+void DumpHelper::writePointElement(const awt::Point& rPoint)
+{
+    std::cout << "Point" << " " << rPoint.X << "," << rPoint.Y << std::endl;
+}
+
+void DumpHelper::writeDoubleSequence(const char* pName, const drawing::DoubleSequenceSequence& rSequence)
+{
+    writeElement(pName);
+    writeElement("OuterSequence");
+    sal_Int32 nLength1 = rSequence.getLength();
+    for (sal_Int32 i = 0; i < nLength1; ++i)
+    {
+        writeElement("InnerSequence");
+        const uno::Sequence<double>& aInnerSequence = rSequence[i];
+        sal_Int32 nLength2 = aInnerSequence.getLength();
+        for( sal_Int32 j = 0; j < nLength2; ++j)
+        {
+            std::cout << "Value: " << aInnerSequence[j];
+        }
+        endElement();
+    }
+    endElement();
+}
+
+void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PointSequenceSequence& rSequence)
+{
+    std::cout << pAttrName << " " << std::endl;
+    sal_Int32 nLength1 = rSequence.getLength();
+    writeElement("OuterSequence");
+    for (sal_Int32 i = 0; i < nLength1; ++i)
+    {
+        writeElement("InnerSequence");
+        const uno::Sequence<awt::Point>& aInnerSequence = rSequence[i];
+        sal_Int32 nLength2 = aInnerSequence.getLength();
+        for( sal_Int32 j = 0; j < nLength2; ++j)
+        {
+            writePointElement(aInnerSequence[j]);
+        }
+        endElement();
+    }
+    endElement();
+}
+
+void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PolyPolygonShape3D& rShape)
+{
+    std::cout << pAttrName << " " << std::endl;
+    writeDoubleSequence("SequenceX", rShape.SequenceX);
+    writeDoubleSequence("SequenceY", rShape.SequenceY);
+    writeDoubleSequence("SequenceZ", rShape.SequenceZ);
+}
+
+void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PolyPolygonBezierCoords& )
+{
+    std::cout << pAttrName << " " << std::endl;
+}
+
+void DumpHelper::endElement()
+{
+    std::cout << "EndElement" << std::endl;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 4e35e17..e62d165 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -68,103 +68,6 @@ using ::com::sun::star::uno::Reference;
 //.............................................................................
 namespace chart
 {
-/*
-void DumpHelper::writeStripe(const Stripe& rStripe)
-{
-    std::cout << "Stripe" << std::endl;
-}*/
-
-void DumpHelper::writeElement(const char* pName)
-{
-    std::cout << pName << std::endl;
-}
-
-void DumpHelper::writeAttribute(const char* pAttrName, const rtl::OUString& rName)
-{
-    std::cout << pAttrName << " " << rName << std::endl;
-}
-
-void DumpHelper::writeAttribute(const char* pAttrName, const char* pAttrValue)
-{
-    std::cout << pAttrName << " " << pAttrValue << std::endl;
-}
-
-void DumpHelper::writeAttribute(const char* pAttrName, const drawing::Position3D& rPos)
-{
-    std::cout << pAttrName << " " << rPos.PositionX << "," << rPos.PositionY << "," << rPos.PositionZ << std::endl;
-}
-
-void DumpHelper::writeAttribute(const char* pAttrName, const drawing::Direction3D& rDirection)
-{
-    std::cout << pAttrName << " " << rDirection.DirectionX << "," << rDirection.DirectionY << "," << rDirection.DirectionZ << std::endl;
-}
-
-void DumpHelper::writeAttribute(const char* pAttrName, const sal_Int32 nValue)
-{
-    std::cout << pAttrName << " " << nValue << std::endl;
-}
-
-void DumpHelper::writePointElement(const awt::Point& rPoint)
-{
-    std::cout << "Point" << " " << rPoint.X << "," << rPoint.Y << std::endl;
-}
-
-void DumpHelper::writeDoubleSequence(const char* pName, const drawing::DoubleSequenceSequence& rSequence)
-{
-    writeElement(pName);
-    writeElement("OuterSequence");
-    sal_Int32 nLength1 = rSequence.getLength();
-    for (sal_Int32 i = 0; i < nLength1; ++i)
-    {
-        writeElement("InnerSequence");
-        const uno::Sequence<double>& aInnerSequence = rSequence[i];
-        sal_Int32 nLength2 = aInnerSequence.getLength();
-        for( sal_Int32 j = 0; j < nLength2; ++j)
-        {
-            std::cout << "Value: " << aInnerSequence[j];
-        }
-        endElement();
-    }
-    endElement();
-}
-
-void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PointSequenceSequence& rSequence)
-{
-    std::cout << pAttrName << " " << std::endl;
-    sal_Int32 nLength1 = rSequence.getLength();
-    writeElement("OuterSequence");
-    for (sal_Int32 i = 0; i < nLength1; ++i)
-    {
-        writeElement("InnerSequence");
-        const uno::Sequence<awt::Point>& aInnerSequence = rSequence[i];
-        sal_Int32 nLength2 = aInnerSequence.getLength();
-        for( sal_Int32 j = 0; j < nLength2; ++j)
-        {
-            writePointElement(aInnerSequence[j]);
-        }
-        endElement();
-    }
-    endElement();
-}
-
-void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PolyPolygonShape3D& rShape)
-{
-    std::cout << pAttrName << " " << std::endl;
-    writeDoubleSequence("SequenceX", rShape.SequenceX);
-    writeDoubleSequence("SequenceY", rShape.SequenceY);
-    writeDoubleSequence("SequenceZ", rShape.SequenceZ);
-}
-
-void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PolyPolygonBezierCoords& )
-{
-    std::cout << pAttrName << " " << std::endl;
-}
-
-void DumpHelper::endElement()
-{
-    std::cout << "EndElement" << std::endl;
-}
-
 //.............................................................................
 
 //-----------------------------------------------------------------------------
@@ -562,7 +465,7 @@ uno::Reference<drawing::XShape>
 
     if(mbDump)
     {
-        maDumpHerlper.writeElement("Cube");
+        maDumpHelper.writeElement("Cube");
     }
 
     uno::Reference<drawing::XShape> xShape = impl_createCube( xTarget, rPosition, rSize, nRotateZAngleHundredthDegree, bRounded );
@@ -570,7 +473,7 @@ uno::Reference<drawing::XShape>
 
     if (mbDump)
     {
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
     }
 
     if( xSourceProp.is())
@@ -633,12 +536,12 @@ uno::Reference<drawing::XShape>
 
             if(mbDump)
             {
-                maDumpHerlper.writeAttribute("depth",static_cast<sal_Int32>(fDepth));
-                maDumpHerlper.writeAttribute("PercentDiagonal",nPercentDiagonal);
+                maDumpHelper.writeAttribute("depth",static_cast<sal_Int32>(fDepth));
+                maDumpHelper.writeAttribute("PercentDiagonal",nPercentDiagonal);
                 drawing::PolyPolygonShape3D aPP;
                 aAny >>= aPP;
-                maDumpHerlper.writeAttribute("Polygon", aPP);
-                maDumpHerlper.writeAttribute("Matrix","");
+                maDumpHelper.writeAttribute("Polygon", aPP);
+                maDumpHelper.writeAttribute("Matrix","");
             }
         }
         catch( const uno::Exception& e )
@@ -813,7 +716,7 @@ uno::Reference<drawing::XShape>
 
     if (mbDump)
     {
-        maDumpHerlper.writeElement("Pyramid");
+        maDumpHelper.writeElement("Pyramid");
     }
 
     ShapeFactory::createStripe( xGroup, aStripe1, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
@@ -824,7 +727,7 @@ uno::Reference<drawing::XShape>
 
     if (mbDump)
     {
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
     }
 
     return Reference< drawing::XShape >( xGroup, uno::UNO_QUERY );
@@ -852,9 +755,9 @@ uno::Reference<drawing::XShape>
     if(mbDump)
     {
         if (bCylinder)
-            maDumpHerlper.writeElement("Cylinder");
+            maDumpHelper.writeElement("Cylinder");
         else
-            maDumpHerlper.writeElement("Cone");
+            maDumpHelper.writeElement("Cone");
     }
 
     //create shape
@@ -912,14 +815,14 @@ uno::Reference<drawing::XShape>
 
             if(mbDump)
             {
-                maDumpHerlper.writeAttribute("PercentDiagonal", nPercentDiagonal);
+                maDumpHelper.writeAttribute("PercentDiagonal", nPercentDiagonal);
                 drawing::PolyPolygonShape3D aPP;
                 aPPolygon >>= aPP;
-                maDumpHerlper.writeAttribute("Polygon", aPP);
-                maDumpHerlper.writeAttribute("Matrix","");
-                maDumpHerlper.writeAttribute("SegmentsHor",CHART_3DOBJECT_SEGMENTCOUNT);
-                maDumpHerlper.writeAttribute("SegmentsVert", static_cast<sal_Int32>(nVerticalSegmentCount));
-                maDumpHerlper.writeAttribute("ReducedLine","true");
+                maDumpHelper.writeAttribute("Polygon", aPP);
+                maDumpHelper.writeAttribute("Matrix","");
+                maDumpHelper.writeAttribute("SegmentsHor",CHART_3DOBJECT_SEGMENTCOUNT);
+                maDumpHelper.writeAttribute("SegmentsVert", static_cast<sal_Int32>(nVerticalSegmentCount));
+                maDumpHelper.writeAttribute("ReducedLine","true");
             }
         }
         catch( const uno::Exception& e )
@@ -929,7 +832,7 @@ uno::Reference<drawing::XShape>
     }
 
     if (mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return xShape;
 }
@@ -1131,7 +1034,7 @@ uno::Reference< drawing::XShape >
 
     if(mbDump)
     {
-        maDumpHerlper.writeElement("PieSegement2D");
+        maDumpHelper.writeElement("PieSegement2D");
     }
 
     //set properties
@@ -1155,7 +1058,7 @@ uno::Reference< drawing::XShape >
 
             if(mbDump)
             {
-                maDumpHerlper.writeAttribute("PolyPolygonBezier", aCoords);
+                maDumpHelper.writeAttribute("PolyPolygonBezier", aCoords);
             }
         }
         catch( const uno::Exception& e )
@@ -1166,7 +1069,7 @@ uno::Reference< drawing::XShape >
 
     if( mbDump )
     {
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
     }
 
     return xShape;
@@ -1193,7 +1096,7 @@ uno::Reference< drawing::XShape >
 
     if(mbDump)
     {
-        maDumpHerlper.writeElement("PieSegment");
+        maDumpHelper.writeElement("PieSegment");
     }
     //create shape
     uno::Reference< drawing::XShape > xShape(
@@ -1253,13 +1156,13 @@ uno::Reference< drawing::XShape >
 
             if (mbDump)
             {
-                maDumpHerlper.writeAttribute("depth",static_cast<sal_Int32>(fDepth));
-                maDumpHerlper.writeAttribute("PercentDiagonal",nPercentDiagonal);
-                maDumpHerlper.writeAttribute("Polygon", aPoly);
-                maDumpHerlper.writeAttribute("DoubleSided", "true");
-                maDumpHerlper.writeAttribute("ReducedLines", "true");
-                maDumpHerlper.writeAttribute("TextureProjectionModeY", drawing::TextureProjectionMode_PARALLEL);
-                maDumpHerlper.writeAttribute("TextureProjectionModeX", drawing::TextureProjectionMode_OBJECTSPECIFIC);
+                maDumpHelper.writeAttribute("depth",static_cast<sal_Int32>(fDepth));
+                maDumpHelper.writeAttribute("PercentDiagonal",nPercentDiagonal);
+                maDumpHelper.writeAttribute("Polygon", aPoly);
+                maDumpHelper.writeAttribute("DoubleSided", "true");
+                maDumpHelper.writeAttribute("ReducedLines", "true");
+                maDumpHelper.writeAttribute("TextureProjectionModeY", drawing::TextureProjectionMode_PARALLEL);
+                maDumpHelper.writeAttribute("TextureProjectionModeX", drawing::TextureProjectionMode_OBJECTSPECIFIC);
             }
         }
         catch( const uno::Exception& e )
@@ -1269,7 +1172,7 @@ uno::Reference< drawing::XShape >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return xShape;
 }
@@ -1291,7 +1194,7 @@ uno::Reference< drawing::XShape >
         return 0;
 
     if (mbDump)
-        maDumpHerlper.writeElement("Stripe");
+        maDumpHelper.writeElement("Stripe");
 
     //create shape
     uno::Reference< drawing::XShape > xShape(
@@ -1334,16 +1237,16 @@ uno::Reference< drawing::XShape >
             {
                 drawing::PolyPolygonShape3D aPP3;
                 rStripe.getPolyPolygonShape3D() >>= aPP3;
-                maDumpHerlper.writeAttribute("Polygon", aPP3);
+                maDumpHelper.writeAttribute("Polygon", aPP3);
                 drawing::PolyPolygonShape3D aPP;
                 rStripe.getTexturePolygon(nRotatedTexture) >>= aPP;
-                maDumpHerlper.writeAttribute("TexturePolygon", aPP);
+                maDumpHelper.writeAttribute("TexturePolygon", aPP);
                 drawing::PolyPolygonShape3D aPP2;
                 rStripe.getNormalsPolygon() >>= aPP2;
-                maDumpHerlper.writeAttribute("NormalsPolygon", aPP2);
-                maDumpHerlper.writeAttribute("NormalsKind", drawing::NormalsKind_FLAT);
-                maDumpHerlper.writeAttribute("LineOnly", "false");
-                maDumpHerlper.writeAttribute("DoubleSided", bDoubleSided);
+                maDumpHelper.writeAttribute("NormalsPolygon", aPP2);
+                maDumpHelper.writeAttribute("NormalsKind", drawing::NormalsKind_FLAT);
+                maDumpHelper.writeAttribute("LineOnly", "false");
+                maDumpHelper.writeAttribute("DoubleSided", bDoubleSided);
             }
 
             if( xSourceProp.is())
@@ -1356,7 +1259,7 @@ uno::Reference< drawing::XShape >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return xShape;
 }
@@ -1373,7 +1276,7 @@ uno::Reference< drawing::XShape >
         return 0;
 
     if(mbDump)
-        maDumpHerlper.writeElement("Area3D");
+        maDumpHelper.writeElement("Area3D");
 
     //create shape
     uno::Reference< drawing::XShape > xShape(
@@ -1422,11 +1325,11 @@ uno::Reference< drawing::XShape >
 
             if (mbDump)
             {
-                maDumpHerlper.writeAttribute("depth", static_cast<sal_Int32>(fDepth));
-                maDumpHerlper.writeAttribute("PercentDiagonal", nPercentDiagonal);
-                maDumpHerlper.writeAttribute("Polygon", rPolyPolygon);
-                maDumpHerlper.writeAttribute("DoubleSided", "true");
-                maDumpHerlper.writeAttribute("Matrix","");
+                maDumpHelper.writeAttribute("depth", static_cast<sal_Int32>(fDepth));
+                maDumpHelper.writeAttribute("PercentDiagonal", nPercentDiagonal);
+                maDumpHelper.writeAttribute("Polygon", rPolyPolygon);
+                maDumpHelper.writeAttribute("DoubleSided", "true");
+                maDumpHelper.writeAttribute("Matrix","");
             }
         }
         catch( const uno::Exception& e )
@@ -1436,7 +1339,7 @@ uno::Reference< drawing::XShape >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return xShape;
 }
@@ -2022,7 +1925,7 @@ uno::Reference< drawing::XShape >
         return 0;
 
     if(mbDump)
-        maDumpHerlper.writeElement("Symbol2D");
+        maDumpHelper.writeElement("Symbol2D");
 
     //create shape
     uno::Reference< drawing::XShape > xShape(
@@ -2054,9 +1957,9 @@ uno::Reference< drawing::XShape >
 
             if(mbDump)
             {
-                maDumpHerlper.writeAttribute("Polygon", aPoints);
-                maDumpHerlper.writeAttribute("LineColor", nBorderColor);
-                maDumpHerlper.writeAttribute("FillColor", nFillColor);
+                maDumpHelper.writeAttribute("Polygon", aPoints);
+                maDumpHelper.writeAttribute("LineColor", nBorderColor);
+                maDumpHelper.writeAttribute("FillColor", nFillColor);
             }
         }
         catch( const uno::Exception& e )
@@ -2066,7 +1969,7 @@ uno::Reference< drawing::XShape >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return xShape;
 }
@@ -2085,7 +1988,7 @@ uno::Reference< drawing::XShape >
     // performance reasons (ask AW, said CL)
 
     if(mbDump)
-        maDumpHerlper.writeElement("Graphic2D");
+        maDumpHelper.writeElement("Graphic2D");
 
     //create shape
     uno::Reference< drawing::XShape > xShape(
@@ -2105,8 +2008,8 @@ uno::Reference< drawing::XShape >
 
         if(mbDump)
         {
-            maDumpHerlper.writeAttribute("Position", aCenterPosition);
-            maDumpHerlper.writeAttribute("Size", rSize);
+            maDumpHelper.writeAttribute("Position", aCenterPosition);
+            maDumpHelper.writeAttribute("Size", rSize);
         }
     }
     catch( const uno::Exception & e )
@@ -2128,7 +2031,7 @@ uno::Reference< drawing::XShape >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return xShape;
 }
@@ -2143,9 +2046,9 @@ uno::Reference< drawing::XShapes >
     {
         if(mbDump)
         {
-            maDumpHerlper.writeElement("Group2D");
+            maDumpHelper.writeElement("Group2D");
             if(!aName.isEmpty())
-                maDumpHerlper.writeAttribute("Name", aName);
+                maDumpHelper.writeAttribute("Name", aName);
         }
 
         //create and add to target
@@ -2165,7 +2068,7 @@ uno::Reference< drawing::XShapes >
 
         //return
         if (mbDump)
-            maDumpHerlper.endElement();
+            maDumpHelper.endElement();
 
         uno::Reference< drawing::XShapes > xShapes =
             uno::Reference<drawing::XShapes>( xShape, uno::UNO_QUERY );
@@ -2177,7 +2080,7 @@ uno::Reference< drawing::XShapes >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return 0;
 }
@@ -2192,9 +2095,9 @@ uno::Reference< drawing::XShapes >
     {
         if(mbDump)
         {
-            maDumpHerlper.writeElement("Group3D");
+            maDumpHelper.writeElement("Group3D");
             if(!aName.isEmpty())
-                maDumpHerlper.writeAttribute("Name", aName);
+                maDumpHelper.writeAttribute("Name", aName);
         }
 
         //create shape
@@ -2220,7 +2123,7 @@ uno::Reference< drawing::XShapes >
                         , uno::makeAny(B3DHomMatrixToHomogenMatrix(aM)) );
 
                     if(mbDump)
-                        maDumpHerlper.writeAttribute("Matrix", "");
+                        maDumpHelper.writeAttribute("Matrix", "");
                 }
                 catch( const uno::Exception& e )
                 {
@@ -2238,7 +2141,7 @@ uno::Reference< drawing::XShapes >
                 uno::Reference<drawing::XShapes>( xShape, uno::UNO_QUERY );
 
         if(mbDump)
-            maDumpHerlper.endElement();
+            maDumpHelper.endElement();
 
         return xShapes;
     }
@@ -2248,7 +2151,7 @@ uno::Reference< drawing::XShapes >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return 0;
 }
@@ -2262,7 +2165,7 @@ uno::Reference< drawing::XShape >
         return 0;
 
     if(mbDump)
-        maDumpHerlper.writeElement("Circle2D");
+        maDumpHelper.writeElement("Circle2D");
 
     //create shape
     uno::Reference< drawing::XShape > xShape(
@@ -2281,8 +2184,8 @@ uno::Reference< drawing::XShape >
 
         if(mbDump)
         {
-            maDumpHerlper.writeAttribute("Position", aCenterPosition);
-            maDumpHerlper.writeAttribute("Size", rSize);
+            maDumpHelper.writeAttribute("Position", aCenterPosition);
+            maDumpHelper.writeAttribute("Size", rSize);
         }
     }
     catch( const uno::Exception & e )
@@ -2302,7 +2205,7 @@ uno::Reference< drawing::XShape >
                 , uno::makeAny( eKind ) );
 
             if(mbDump)
-                maDumpHerlper.writeAttribute("CircleKind", eKind);
+                maDumpHelper.writeAttribute("CircleKind", eKind);
         }
         catch( const uno::Exception& e )
         {
@@ -2311,7 +2214,7 @@ uno::Reference< drawing::XShape >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return xShape;
 }
@@ -2328,7 +2231,7 @@ uno::Reference< drawing::XShape >
         return NULL;
 
     if(mbDump)
-        maDumpHerlper.writeElement("Line3D");
+        maDumpHelper.writeElement("Line3D");
 
     //create shape
     uno::Reference< drawing::XShape > xShape(
@@ -2376,21 +2279,21 @@ uno::Reference< drawing::XShape >
             {
                 sal_Int16 nTransparence = 0;
                 rLineProperties.Transparence >>= nTransparence;
-                maDumpHerlper.writeAttribute("Transparency", nTransparence);
+                maDumpHelper.writeAttribute("Transparency", nTransparence);
                 drawing::LineStyle aLineStyle;
                 rLineProperties.LineStyle >>= aLineStyle;
-                maDumpHerlper.writeAttribute("LineStyle", aLineStyle);
+                maDumpHelper.writeAttribute("LineStyle", aLineStyle);
                 sal_Int32 nWidth = 0;
                 rLineProperties.Width >>= nWidth;
-                maDumpHerlper.writeAttribute("LineWidth", nWidth);
+                maDumpHelper.writeAttribute("LineWidth", nWidth);
                 sal_Int32 nColor = 0;
                 rLineProperties.Color >>= nColor;
-                maDumpHerlper.writeAttribute("LineColor", nColor);
+                maDumpHelper.writeAttribute("LineColor", nColor);
                 rtl::OUString aDashName;
                 rLineProperties.DashName >>= aDashName;
-                maDumpHerlper.writeAttribute("LineDashName", aDashName);
-                maDumpHerlper.writeAttribute("Polygon", rPoints);
-                maDumpHerlper.writeAttribute("LineOnly", "true");
+                maDumpHelper.writeAttribute("LineDashName", aDashName);
+                maDumpHelper.writeAttribute("Polygon", rPoints);
+                maDumpHelper.writeAttribute("LineOnly", "true");
             }
         }
         catch( const uno::Exception& e )
@@ -2400,7 +2303,7 @@ uno::Reference< drawing::XShape >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return xShape;
 }
@@ -2417,7 +2320,7 @@ uno::Reference< drawing::XShape >
         return NULL;
 
     if(mbDump)
-        maDumpHerlper.writeElement("Line2D");
+        maDumpHelper.writeElement("Line2D");
 
     //create shape
     uno::Reference< drawing::XShape > xShape(
@@ -2437,7 +2340,7 @@ uno::Reference< drawing::XShape >
                 , uno::makeAny( rPoints ) );
 
             if(mbDump)
-                maDumpHerlper.writeAttribute("Polygon", rPoints);
+                maDumpHelper.writeAttribute("Polygon", rPoints);
 
             if(pLineProperties)
             {
@@ -2470,19 +2373,19 @@ uno::Reference< drawing::XShape >
                 {
                     sal_Int16 nTransparence = 0;
                     pLineProperties->Transparence >>= nTransparence;
-                    maDumpHerlper.writeAttribute("Transparency", nTransparence);
+                    maDumpHelper.writeAttribute("Transparency", nTransparence);
                     drawing::LineStyle aLineStyle;
                     pLineProperties->LineStyle >>= aLineStyle;
-                    maDumpHerlper.writeAttribute("LineStyle", aLineStyle);
+                    maDumpHelper.writeAttribute("LineStyle", aLineStyle);
                     sal_Int32 nWidth = 0;
                     pLineProperties->Width >>= nWidth;
-                    maDumpHerlper.writeAttribute("LineWidth", nWidth);
+                    maDumpHelper.writeAttribute("LineWidth", nWidth);
                     sal_Int32 nColor = 0;
                     pLineProperties->Color >>= nColor;
-                    maDumpHerlper.writeAttribute("LineColor", nColor);
+                    maDumpHelper.writeAttribute("LineColor", nColor);
                     rtl::OUString aDashName;
                     pLineProperties->DashName >>= aDashName;
-                    maDumpHerlper.writeAttribute("LineDashName", aDashName);
+                    maDumpHelper.writeAttribute("LineDashName", aDashName);
                 }
             }
         }
@@ -2493,7 +2396,7 @@ uno::Reference< drawing::XShape >
     }
 
     if(mbDump)
-        maDumpHerlper.endElement();
+        maDumpHelper.endElement();
 
     return xShape;
 }
@@ -2567,6 +2470,12 @@ uno::Reference< drawing::XShape >
     if(rText.isEmpty())
         return 0;
 
+    if(mbDump)
+    {
+        maDumpHelper.writeElement("Text");
+        maDumpHelper.writeAttribute("TextValue", rText);
+    }
+
     //create shape and add to page
     uno::Reference< drawing::XShape > xShape(
             m_xShapeFactory->createInstance( C2U(
@@ -2595,6 +2504,10 @@ uno::Reference< drawing::XShape >
             ASSERT_EXCEPTION( e );
         }
     }
+
+    if(mbDump)
+        maDumpHelper.endElement();
+
     return xShape;
 }
 
commit 81b4ac4f8c405243db5949ea39f2abf8d77c9bb1
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Mar 13 23:21:33 2012 +0100

    add more code to the chart dumper

diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 8fe7ba0..f74d51c 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -67,6 +67,8 @@ public:
    void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PointSequenceSequence& rPoints);
    void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonShape3D& rPoints);
    void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonBezierCoords& rCoords);
+   void writePointElement(const com::sun::star::awt::Point& rPoint);
+   void writeDoubleSequence(const char* pName, const com::sun::star::drawing::DoubleSequenceSequence& rSequence);
    void endElement();
 };
 
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index f9589c2..4e35e17 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -104,14 +104,55 @@ void DumpHelper::writeAttribute(const char* pAttrName, const sal_Int32 nValue)
     std::cout << pAttrName << " " << nValue << std::endl;
 }
 
-void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PointSequenceSequence& )
+void DumpHelper::writePointElement(const awt::Point& rPoint)
+{
+    std::cout << "Point" << " " << rPoint.X << "," << rPoint.Y << std::endl;
+}
+
+void DumpHelper::writeDoubleSequence(const char* pName, const drawing::DoubleSequenceSequence& rSequence)
+{
+    writeElement(pName);
+    writeElement("OuterSequence");
+    sal_Int32 nLength1 = rSequence.getLength();
+    for (sal_Int32 i = 0; i < nLength1; ++i)
+    {
+        writeElement("InnerSequence");
+        const uno::Sequence<double>& aInnerSequence = rSequence[i];
+        sal_Int32 nLength2 = aInnerSequence.getLength();
+        for( sal_Int32 j = 0; j < nLength2; ++j)
+        {
+            std::cout << "Value: " << aInnerSequence[j];
+        }
+        endElement();
+    }
+    endElement();
+}
+
+void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PointSequenceSequence& rSequence)
 {
     std::cout << pAttrName << " " << std::endl;
+    sal_Int32 nLength1 = rSequence.getLength();
+    writeElement("OuterSequence");
+    for (sal_Int32 i = 0; i < nLength1; ++i)
+    {
+        writeElement("InnerSequence");
+        const uno::Sequence<awt::Point>& aInnerSequence = rSequence[i];
+        sal_Int32 nLength2 = aInnerSequence.getLength();
+        for( sal_Int32 j = 0; j < nLength2; ++j)
+        {
+            writePointElement(aInnerSequence[j]);
+        }
+        endElement();
+    }
+    endElement();
 }
 
-void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PolyPolygonShape3D& )
+void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PolyPolygonShape3D& rShape)
 {
     std::cout << pAttrName << " " << std::endl;
+    writeDoubleSequence("SequenceX", rShape.SequenceX);
+    writeDoubleSequence("SequenceY", rShape.SequenceY);
+    writeDoubleSequence("SequenceZ", rShape.SequenceZ);
 }
 
 void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PolyPolygonBezierCoords& )


More information about the Libreoffice-commits mailing list