[Libreoffice-commits] core.git: Branch 'private/moggi/chart-opengl2' - chart2/inc chart2/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Fri Dec 27 20:24:19 PST 2013
chart2/inc/ChartView.hxx | 2 +
chart2/source/view/inc/AbstractShapeFactory.hxx | 5 +++
chart2/source/view/inc/DummyXShape.hxx | 9 +++++
chart2/source/view/inc/OpenglShapeFactory.hxx | 2 +
chart2/source/view/inc/ShapeFactory.hxx | 5 +++
chart2/source/view/main/ChartView.cxx | 39 ++++++++++++------------
chart2/source/view/main/DummyXShape.cxx | 14 ++++++++
chart2/source/view/main/OpenglShapeFactory.cxx | 7 ++++
8 files changed, 65 insertions(+), 18 deletions(-)
New commits:
commit 857d8e91e714e03a4c6de7757462fb8a206ae664
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Dec 28 07:21:34 2013 +0100
make it easier to draw with all properties
Change-Id: Ia563f703d5bc622f9577fee177b4f558c100be87
diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx
index 2731d2d..80ef459 100644
--- a/chart2/inc/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -202,6 +202,8 @@ private: //member
m_xShapeFactory;
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage>
m_xDrawPage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ mxRootShape;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xDashTable;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xGradientTable;
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
index e9726c2..b0bf8f4 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -236,6 +236,11 @@ public:
virtual void setPageSize( com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > xChartShapes, const com::sun::star::awt::Size& rSize ) = 0;
+ /**
+ * Only necessary for stateless implementations
+ */
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) = 0;
+
virtual void createSeries( const com::sun::star::uno::Reference<
com::sun::star::drawing::XShapes> & xTarget,
diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index e68c5b8..915b5aa 100644
--- a/chart2/source/view/inc/DummyXShape.hxx
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -174,7 +174,13 @@ public:
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ // normal non UNO methods
+
virtual DummyChart* getRootShape();
+ /**
+ * Implement this method for all subclasses that should be rendered
+ */
+ virtual void render();
protected:
@@ -393,6 +399,9 @@ public:
virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ // normal methods
+ virtual void render();
+
private:
std::vector<com::sun::star::uno::Reference< com::sun::star::drawing::XShape > > maUNOShapes;
std::vector<DummyXShape*> maShapes;
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx b/chart2/source/view/inc/OpenglShapeFactory.hxx
index be4d01d..f4f6160 100644
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ b/chart2/source/view/inc/OpenglShapeFactory.hxx
@@ -190,6 +190,8 @@ public:
::com::sun::star::drawing::XDrawPage>& xPage );
virtual void setPageSize( com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > xChartShapes, const com::sun::star::awt::Size& rSize );
+
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) SAL_OVERRIDE;
private:
void *m_pChart;
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index c23e13e..614b13f 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -205,6 +205,11 @@ public:
virtual void setPageSize( com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > xChartShapes, const com::sun::star::awt::Size& rSize );
+ /**
+ * not necessary right now
+ */
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > ) SAL_OVERRIDE {}
+
private:
ShapeFactory();
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index f501aa9..9a2a949 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2390,8 +2390,8 @@ void ChartView::createShapes()
awt::Size aPageSize = mrChartModel.getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
- uno::Reference<drawing::XShapes> xPageShapes(
- pShapeFactory->getOrCreateChartRootShape( m_xDrawPage ) );
+ if(!mxRootShape.is())
+ mxRootShape = pShapeFactory->getOrCreateChartRootShape( m_xDrawPage );
SdrPage* pPage = ChartView::getSdrPage();
if(pPage) //it is necessary to use the implementation here as the uno page does not provide a propertyset
@@ -2400,14 +2400,14 @@ void ChartView::createShapes()
{
OSL_FAIL("could not set page size correctly");
}
- pShapeFactory->setPageSize(xPageShapes, aPageSize);
+ pShapeFactory->setPageSize(mxRootShape, aPageSize);
{
SolarMutexGuard aSolarGuard;
// todo: it would be nicer to just pass the page m_xDrawPage and format it,
// but the draw page does not support XPropertySet
- formatPage( mrChartModel, aPageSize, xPageShapes, m_xShapeFactory );
+ formatPage( mrChartModel, aPageSize, mxRootShape, m_xShapeFactory );
//sal_Int32 nYDistance = static_cast<sal_Int32>(aPageSize.Height*lcl_getPageLayoutDistancePercentage());
awt::Rectangle aRemainingSpace( 0, 0, aPageSize.Width, aPageSize.Height );
@@ -2416,7 +2416,7 @@ void ChartView::createShapes()
uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
OUString aDiagramCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) ) );//todo: other index if more than one diagram is possible
uno::Reference< drawing::XShapes > xDiagramPlusAxesPlusMarkHandlesGroup_Shapes(
- pShapeFactory->createGroup2D(xPageShapes,aDiagramCID) );
+ pShapeFactory->createGroup2D(mxRootShape,aDiagramCID) );
uno::Reference< drawing::XShape > xDiagram_MarkHandles( pShapeFactory->createInvisibleRectangle(
xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) );
@@ -2430,12 +2430,12 @@ void ChartView::createShapes()
bool bAutoPositionDummy = true;
- lcl_createTitle( TitleHelper::MAIN_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
+ lcl_createTitle( TitleHelper::MAIN_TITLE, mxRootShape, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_TOP, bAutoPositionDummy );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
- lcl_createTitle( TitleHelper::SUB_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
+ lcl_createTitle( TitleHelper::SUB_TITLE, mxRootShape, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_TOP, bAutoPositionDummy );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2443,7 +2443,7 @@ void ChartView::createShapes()
SeriesPlotterContainer aSeriesPlotterContainer( m_aVCooSysList );
aSeriesPlotterContainer.initializeCooSysAndSeriesPlotter( mrChartModel );
- lcl_createLegend( LegendHelper::getLegend( mrChartModel ), xPageShapes, m_xShapeFactory, m_xCC
+ lcl_createLegend( LegendHelper::getLegend( mrChartModel ), mxRootShape, m_xShapeFactory, m_xCC
, aRemainingSpace, aPageSize, mrChartModel, aSeriesPlotterContainer.getLegendEntryProviderList()
, lcl_getDefaultWritingModeFromPool( m_pDrawModelWrapper ) );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
@@ -2455,7 +2455,7 @@ void ChartView::createShapes()
bool bAutoPosition_XTitle = true;
boost::shared_ptr<VTitle> apVTitle_X;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 0 ) )
- apVTitle_X = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xPageShapes, m_xShapeFactory, mrChartModel
+ apVTitle_X = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, mxRootShape, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_BOTTOM, bAutoPosition_XTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2463,7 +2463,7 @@ void ChartView::createShapes()
bool bAutoPosition_YTitle = true;
boost::shared_ptr<VTitle> apVTitle_Y;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 1 ) )
- apVTitle_Y = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xPageShapes, m_xShapeFactory, mrChartModel
+ apVTitle_Y = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, mxRootShape, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_LEFT, bAutoPosition_YTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2471,7 +2471,7 @@ void ChartView::createShapes()
bool bAutoPosition_ZTitle = true;
boost::shared_ptr<VTitle> apVTitle_Z;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 2 ) )
- apVTitle_Z = lcl_createTitle( TitleHelper::Z_AXIS_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
+ apVTitle_Z = lcl_createTitle( TitleHelper::Z_AXIS_TITLE, mxRootShape, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_RIGHT, bAutoPosition_ZTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2482,7 +2482,7 @@ void ChartView::createShapes()
bool bAutoPosition_SecondXTitle = true;
boost::shared_ptr<VTitle> apVTitle_SecondX;
if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension, 0 ) )
- apVTitle_SecondX = lcl_createTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
+ apVTitle_SecondX = lcl_createTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, mxRootShape, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, bIsVertical? ALIGN_RIGHT : ALIGN_TOP, bAutoPosition_SecondXTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2490,7 +2490,7 @@ void ChartView::createShapes()
bool bAutoPosition_SecondYTitle = true;
boost::shared_ptr<VTitle> apVTitle_SecondY;
if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension, 1 ) )
- apVTitle_SecondY = lcl_createTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
+ apVTitle_SecondY = lcl_createTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, mxRootShape, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, bIsVertical? ALIGN_TOP : ALIGN_RIGHT, bAutoPosition_SecondYTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2526,7 +2526,7 @@ void ChartView::createShapes()
}
//cleanup: remove all empty group shapes to avoid grey border lines:
- lcl_removeEmptyGroupShapes( xPageShapes );
+ lcl_removeEmptyGroupShapes( mxRootShape );
}
// #i12587# support for shapes in chart
@@ -2536,6 +2536,8 @@ void ChartView::createShapes()
m_pDrawModelWrapper->getSdrModel().EnableUndo( true );
}
+ pShapeFactory->render( mxRootShape );
+
#if OSL_DEBUG_LEVEL > 0
clock_t nEnd = clock();
double fDuration =(double(nEnd-nStart)*1000.0)/double(CLOCKS_PER_SEC);
@@ -2940,15 +2942,16 @@ uno::Sequence< OUString > ChartView::getAvailableServiceNames() throw (uno::Runt
OUString ChartView::dump() throw (uno::RuntimeException)
{
impl_updateView();
- uno::Reference<drawing::XShapes> xPageShapes( AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)
- ->getOrCreateChartRootShape( m_xDrawPage ) );
+ if(!mxRootShape.is())
+ mxRootShape = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)
+ ->getOrCreateChartRootShape( m_xDrawPage );
- if (!xPageShapes.is())
+ if (!mxRootShape.is())
return OUString();
else
{
XShapeDumper dumper;
- return dumper.dump(xPageShapes);
+ return dumper.dump(mxRootShape);
}
}
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 2601a38..261604c 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -219,6 +219,11 @@ void DummyXShape::setParent( const uno::Reference< uno::XInterface >& xParent )
mxParent = xParent;
}
+void DummyXShape::render()
+{
+ SAL_WARN("chart2.opengl", "maybe a missing implementation in a subclass?");
+}
+
namespace {
void setProperties( uno::Reference< beans::XPropertySet > xPropSet, const tPropertyNameMap& rPropertyNameMap,
@@ -542,6 +547,15 @@ uno::Any DummyXShapes::getByIndex(sal_Int32 nIndex)
return aShape;
}
+void DummyXShapes::render()
+{
+ for(std::vector<DummyXShape*>::iterator itr = maShapes.begin(),
+ itrEnd = maShapes.end(); itr != itrEnd; ++itr)
+ {
+ (*itr)->render();
+ }
+}
+
bool DummyChart::initWindow()
{
const SystemEnvData* sysData(mpWindow->GetSystemData());
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 70bc1b5..0ec9feb 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -529,6 +529,13 @@ void OpenglShapeFactory::renderSeries( const uno::Reference<
SAL_WARN("chart2.opengl", "OpenglShapeFactory::renderSeries()-----test:");
}
+void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape)
+{
+ dummy::DummyChart* pChart = dynamic_cast<dummy::DummyChart*>(xRootShape.get());
+ assert(pChart);
+ pChart->render();
+}
+
} //namespace dummy
} //namespace chart
More information about the Libreoffice-commits
mailing list