[Libreoffice-commits] core.git: chart2/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Feb 16 04:35:21 CET 2014


 chart2/source/view/inc/DummyXShape.hxx  |    2 -
 chart2/source/view/main/DummyXShape.cxx |   64 +++++++++++++++++++++++++++++++-
 2 files changed, 64 insertions(+), 2 deletions(-)

New commits:
commit 6454bb693413f4fbf5a1d309c67a78e1ea3f59c4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Feb 16 04:30:43 2014 +0100

    fix crash when dumping OpenGL dummy shapes
    
    CTRL + F12 is working now partly for the OpenGL shapes
    
    Change-Id: Ia4d0499d0df683202d9e2f56de96b22abcd9e367

diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index 45f6dc4..4783cf6 100644
--- a/chart2/source/view/inc/DummyXShape.hxx
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -109,7 +109,7 @@ public:
     DummyXShape();
 
     // XNamed
-    virtual OUString SAL_CALL getName(  ) throw(::com::sun::star::uno::RuntimeException);
+    virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
 
     // XShape
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 134d6cc..44f1476 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -27,6 +27,7 @@
 #include <vcl/svapp.hxx>
 #include <tools/gen.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/implbase1.hxx>
 #include <editeng/unoprnms.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 
@@ -35,6 +36,8 @@
 #include <basegfx/point/b2dpoint.hxx>
 #include <basegfx/matrix/b3dhommatrix.hxx>
 
+#include <com/sun/star/beans/Property.hpp>
+
 #define ENABLE_DEBUG_PROPERTIES 0
 
 using namespace com::sun::star;
@@ -45,6 +48,64 @@ namespace chart {
 
 namespace dummy {
 
+class DummyPropertySetInfo : public cppu::WeakImplHelper1<
+                                com::sun::star::beans::XPropertySetInfo >
+{
+public:
+    DummyPropertySetInfo(const std::map<OUString, uno::Any>& rProps ):
+        mrProperties(rProps) {}
+
+    virtual sal_Bool hasPropertyByName( const OUString& rName )
+        throw(uno::RuntimeException);
+
+    virtual beans::Property getPropertyByName( const OUString& rName )
+        throw(uno::RuntimeException, beans::UnknownPropertyException);
+
+    virtual uno::Sequence< beans::Property > getProperties()
+        throw(uno::RuntimeException);
+
+private:
+    const std::map<OUString, uno::Any>& mrProperties;
+};
+
+sal_Bool DummyPropertySetInfo::hasPropertyByName( const OUString& rName )
+    throw(uno::RuntimeException)
+{
+    return mrProperties.find(rName) != mrProperties.end();
+}
+
+beans::Property DummyPropertySetInfo::getPropertyByName( const OUString& rName )
+    throw(uno::RuntimeException, beans::UnknownPropertyException)
+{
+    beans::Property aRet;
+    if(mrProperties.find(rName) == mrProperties.end())
+        throw beans::UnknownPropertyException();
+
+    std::map<OUString, uno::Any>::const_iterator itr = mrProperties.find(rName);
+    aRet.Name = rName;
+    aRet.Type = itr->second.getValueType();
+
+    return aRet;
+}
+
+uno::Sequence< beans::Property > DummyPropertySetInfo::getProperties()
+    throw(uno::RuntimeException)
+{
+    uno::Sequence< beans::Property > aRet(mrProperties.size());
+
+    size_t i = 0;
+    for(std::map<OUString, uno::Any>::const_iterator itr = mrProperties.begin(),
+            itrEnd = mrProperties.end(); itr != itrEnd; ++itr, ++i)
+    {
+        beans::Property aProp;
+
+        aProp.Name = itr->first;
+        aProp.Type = itr->second.getValueType();
+        aRet[i] = aProp;
+    }
+    return aRet;
+}
+
 namespace {
 
 struct PrintProperties
@@ -117,7 +178,7 @@ OUString DummyXShape::getShapeType()
 uno::Reference< beans::XPropertySetInfo > DummyXShape::getPropertySetInfo()
     throw(uno::RuntimeException)
 {
-    return uno::Reference< beans::XPropertySetInfo >();
+    return new DummyPropertySetInfo(maProperties);
 }
 
 void DummyXShape::setPropertyValue( const OUString& rName, const uno::Any& rValue)
@@ -798,6 +859,7 @@ void DummyText::setPropertyValue( const OUString& rName, const uno::Any& rValue)
             uno::RuntimeException)
 {
     SAL_WARN("chart2.opengl", "property value set after image has been created");
+    SAL_WARN("chart2.opengl", rName);
     DummyXShape::setPropertyValue(rName, rValue);
 }
 


More information about the Libreoffice-commits mailing list