diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-04-14 03:16:45 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-04-15 01:51:27 +0200 |
commit | a3125e805bdc735a00af8dcc5a94b7b6a6a712e9 (patch) | |
tree | 081dcfd76c788600177cf29a4b90ebc825ec51d7 /chart2 | |
parent | 7f6b1560e970ea7b2a7397cc427ea9d996c65d9a (diff) |
switch to IOpenGLRenderer in chart2 2D rendering
Change-Id: If2351186e6e6612a84b1c98c28bbb7f2c3dc49ab
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/main/OpenglShapeFactory.cxx | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx index 7cc420c19ba2..e39a154c0e0b 100644 --- a/chart2/source/view/main/OpenglShapeFactory.cxx +++ b/chart2/source/view/main/OpenglShapeFactory.cxx @@ -47,6 +47,7 @@ #include <rtl/math.hxx> #include <svx/svdocirc.hxx> #include <svx/svdopath.hxx> +#include <vcl/IOpenGLRenderer.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/matrix/b3dhommatrix.hxx> @@ -67,6 +68,24 @@ extern "C" { { return new opengl::OpenglShapeFactory();} } +class OpenGLChartAdapter : public IOpenGLRenderer +{ +public: + OpenGLChartAdapter(uno::Reference<drawing::XShapes> xShapes): + mxShapes(xShapes) {} + + virtual ~OpenGLChartAdapter() {} + virtual void operator()() {} + + uno::Reference<drawing::XShapes> getShapes() + { + return mxShapes; + } + +private: + uno::Reference<drawing::XShapes> mxShapes; // here to fix lifetime +}; + using dummy::DummyXShape; using dummy::DummyXShapes; @@ -92,14 +111,16 @@ uno::Reference< drawing::XShapes > getChartShape( { if( xShapes->getByIndex( nN ) >>= xShape ) { - OUString aRet; uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY ); xProp->getPropertyValue( UNO_NAME_MISC_OBJ_NAME ) >>= aRet; if( aRet.equals("com.sun.star.chart2.shapes") ) { - xRet = dynamic_cast<SvxDummyShapeContainer*>(xShape.get())->getWrappedShape(); + IOpenGLRenderer* pRenderer = dynamic_cast<SvxOpenGLObject*>(xShape.get())->getRenderer(); + OpenGLChartAdapter* pAdapter = dynamic_cast<OpenGLChartAdapter*>(pRenderer); + if(pAdapter) + xRet = pAdapter->getShapes(); break; } } @@ -121,12 +142,17 @@ uno::Reference< drawing::XShapes > OpenglShapeFactory::getOrCreateChartRootShape uno::Reference< drawing::XShape > xTarget (m_xShapeFactory->createInstance( "com.sun.star.drawing.OpenGLObject" ), uno::UNO_QUERY ); - dummy::DummyChart *pChart = new dummy::DummyChart(xTarget); - SvxDummyShapeContainer* pContainer = new SvxDummyShapeContainer(pChart); - pContainer->setSize(awt::Size(0,0)); - xRet = pChart; + uno::Reference<drawing::XShapes> xChart(new dummy::DummyChart(xTarget)); xDrawPage->add(xTarget); - xDrawPage->add(pContainer); + uno::Any aName; + aName <<= OUString("com.sun.star.chart2.shapes"); + uno::Reference<beans::XPropertySet> xPropSet( xTarget, uno::UNO_QUERY_THROW ); + xPropSet->setPropertyValue( UNO_NAME_MISC_OBJ_NAME, aName ); + + SvxOpenGLObject* pObj = dynamic_cast<SvxOpenGLObject*>(xTarget.get()); + pObj->setRenderer(new OpenGLChartAdapter(xChart)); + + xRet = getChartShape( xDrawPage ); } return xRet; } |