[Libreoffice-commits] core.git: Branch 'feature/chart-opengl' - 2 commits - chart2/Library_chartopengl.mk chart2/source include/svx svx/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Fri Dec 13 03:11:04 PST 2013
chart2/Library_chartopengl.mk | 1 +
chart2/source/view/main/DrawModelWrapper.cxx | 4 +++-
chart2/source/view/main/OpenglShapeFactory.cxx | 6 ++++--
include/svx/unoshape.hxx | 23 +++++++++++++++++++++++
svx/source/unodraw/unoshap4.cxx | 8 ++++++++
5 files changed, 39 insertions(+), 3 deletions(-)
New commits:
commit bad134e6bf98bf851ccbc6cf9ef857f6ad8ced2c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Dec 13 12:09:29 2013 +0100
disable this call for now
That one is particular nasty because it creates the chart root shape
before the chart view exists and deletes therefore the uno object
directly.
Change-Id: Idb2318484bac4c2f251f0c51e53b3add3923414c
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx
index dedf65e..48f2bb7 100644
--- a/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -235,7 +235,9 @@ uno::Reference< drawing::XDrawPage > DrawModelWrapper::getMainDrawPage()
}
}
//ensure that additional shapes are in front of the chart objects so create the chart root before
- AbstractShapeFactory::getOrCreateShapeFactory(this->getShapeFactory())->getOrCreateChartRootShape( m_xMainDrawPage );
+ // let us disable this call for now
+ // TODO:moggi
+ // AbstractShapeFactory::getOrCreateShapeFactory(this->getShapeFactory())->getOrCreateChartRootShape( m_xMainDrawPage );
return m_xMainDrawPage;
}
uno::Reference< drawing::XDrawPage > DrawModelWrapper::getHiddenDrawPage()
commit a413f04926f1c5d88f80f54381f933e110c72ab0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Dec 13 12:05:19 2013 +0100
add ugly hack to work around SvxDrawPage::add only accepting SvxShape
Change-Id: I77c292b088a1a1797fba10cc514167a1f3dca917
diff --git a/chart2/Library_chartopengl.mk b/chart2/Library_chartopengl.mk
index 220012e..2532fc3 100644
--- a/chart2/Library_chartopengl.mk
+++ b/chart2/Library_chartopengl.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_Library_use_libraries,chartopengl,\
cppu \
cppuhelper \
sal \
+ svxcore \
vcl \
$(gb_UWINAPI) \
))
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 8e529b8..dc0f776 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -46,6 +46,7 @@
#include <rtl/math.hxx>
#include <svx/svdocirc.hxx>
#include <svx/svdopath.hxx>
+#include <svx/unoshape.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/matrix/b3dhommatrix.hxx>
@@ -95,7 +96,7 @@ uno::Reference< drawing::XShapes > getChartShape(
xProp->getPropertyValue( UNO_NAME_MISC_OBJ_NAME ) >>= aRet;
if( aRet.equals("com.sun.star.chart2.shapes") )
{
- xRet = uno::Reference< drawing::XShapes >( xShape, uno::UNO_QUERY );
+ xRet = dynamic_cast<SvxDummyShapeContainer*>(xShape.get())->getWrappedShape();
break;
}
}
@@ -119,12 +120,13 @@ uno::Reference< drawing::XShapes > OpenglShapeFactory::getOrCreateChartRootShape
"com.sun.star.drawing.GraphicObjectShape" ), uno::UNO_QUERY );
dummy::DummyChart *pChart = new dummy::DummyChart(xTarget);
m_pChart = (void *)pChart;
+ SvxDummyShapeContainer* pContainer = new SvxDummyShapeContainer(pChart);
xRet = pChart;
#if 0
xRet = new dummy::DummyChart();
m_pChart = (void *)((dummy::DummyChart *)xRet);
#endif
- xDrawPage->add(uno::Reference< drawing::XShape >(xRet, uno::UNO_QUERY_THROW));
+ xDrawPage->add(pContainer);
}
return xRet;
}
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index 23cbf88..bcfcf43 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -863,6 +863,29 @@ protected:
virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
};
+/*
+ * This is a really ugly hack for the chart2 OpenGL backend
+ * SvxShapeGroup::add only accepts objects derived from SvxShape and silently drops
+ * other objects. This fixes my life time problems but I will burn for it in hell.
+ *
+ * The object does nothing and should not be painted. It is just there to ensure that the
+ * wrapped object is not deleted prematurely.
+ */
+class SVX_DLLPUBLIC SvxDummyShapeContainer : public SvxShape
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >
+ m_xDummyObject;
+
+public:
+ SvxDummyShapeContainer( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xWrappedObject );
+ virtual ~SvxDummyShapeContainer() throw();
+
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > getWrappedShape()
+ { return m_xDummyObject; }
+
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 768896d..01099f8 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -935,4 +935,12 @@ bool SvxMediaShape::getPropertyValueImpl( const OUString& rName, const SfxItemPr
}
}
+SvxDummyShapeContainer::SvxDummyShapeContainer(uno::Reference< drawing::XShapes > xObject):
+ m_xDummyObject(xObject)
+{
+}
+
+SvxDummyShapeContainer::~SvxDummyShapeContainer() throw()
+{
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list