Kaydet (Commit) a3125e80 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

switch to IOpenGLRenderer in chart2 2D rendering

Change-Id: If2351186e6e6612a84b1c98c28bbb7f2c3dc49ab
üst 7f6b1560
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <rtl/math.hxx> #include <rtl/math.hxx>
#include <svx/svdocirc.hxx> #include <svx/svdocirc.hxx>
#include <svx/svdopath.hxx> #include <svx/svdopath.hxx>
#include <vcl/IOpenGLRenderer.hxx>
#include <basegfx/point/b2dpoint.hxx> #include <basegfx/point/b2dpoint.hxx>
#include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/matrix/b3dhommatrix.hxx>
...@@ -67,6 +68,24 @@ extern "C" { ...@@ -67,6 +68,24 @@ extern "C" {
{ return new opengl::OpenglShapeFactory();} { 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::DummyXShape;
using dummy::DummyXShapes; using dummy::DummyXShapes;
...@@ -92,14 +111,16 @@ uno::Reference< drawing::XShapes > getChartShape( ...@@ -92,14 +111,16 @@ uno::Reference< drawing::XShapes > getChartShape(
{ {
if( xShapes->getByIndex( nN ) >>= xShape ) if( xShapes->getByIndex( nN ) >>= xShape )
{ {
OUString aRet; OUString aRet;
uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
xProp->getPropertyValue( UNO_NAME_MISC_OBJ_NAME ) >>= aRet; xProp->getPropertyValue( UNO_NAME_MISC_OBJ_NAME ) >>= aRet;
if( aRet.equals("com.sun.star.chart2.shapes") ) 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; break;
} }
} }
...@@ -121,12 +142,17 @@ uno::Reference< drawing::XShapes > OpenglShapeFactory::getOrCreateChartRootShape ...@@ -121,12 +142,17 @@ uno::Reference< drawing::XShapes > OpenglShapeFactory::getOrCreateChartRootShape
uno::Reference< drawing::XShape > xTarget (m_xShapeFactory->createInstance( uno::Reference< drawing::XShape > xTarget (m_xShapeFactory->createInstance(
"com.sun.star.drawing.OpenGLObject" ), uno::UNO_QUERY ); "com.sun.star.drawing.OpenGLObject" ), uno::UNO_QUERY );
dummy::DummyChart *pChart = new dummy::DummyChart(xTarget); uno::Reference<drawing::XShapes> xChart(new dummy::DummyChart(xTarget));
SvxDummyShapeContainer* pContainer = new SvxDummyShapeContainer(pChart);
pContainer->setSize(awt::Size(0,0));
xRet = pChart;
xDrawPage->add(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; return xRet;
} }
......
...@@ -877,7 +877,7 @@ private: ...@@ -877,7 +877,7 @@ private:
OUString referer_; OUString referer_;
}; };
class SvxOpenGLObject : public SvxShape class SVX_DLLPUBLIC SvxOpenGLObject : public SvxShape
{ {
public: public:
SvxOpenGLObject( SdrObject* pObj ) throw() : SvxShape(pObj){} SvxOpenGLObject( SdrObject* pObj ) throw() : SvxShape(pObj){}
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
class IOpenGLRenderer class IOpenGLRenderer
{ {
public: public:
virtual ~IOpenGLRenderer(); virtual ~IOpenGLRenderer() {};
virtual void operator()() = 0; virtual void operator()() = 0;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment