[Libreoffice-commits] core.git: Branch 'feature/chart-opengl2' - 4 commits - chart2/inc chart2/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Sat Dec 28 00:57:52 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 | 80 +++++++++++++++++++++---
chart2/source/view/main/OpenglShapeFactory.cxx | 7 ++
8 files changed, 121 insertions(+), 28 deletions(-)
New commits:
commit d417f6af35e59d250cc86fe43b1fc2066348aea6
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
commit d1c492db329e324c6c158cfcc786069c3c6c5efc
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Dec 27 21:19:59 2013 +0100
also set line properties to the internal properties
Change-Id: I385fc04853d2da33c2ee6c81833289f75c4176bb
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 7e09cbc..2601a38 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -22,6 +22,7 @@
#include <vcl/window.hxx>
#include <tools/gen.hxx>
+#include <editeng/unoprnms.hxx>
#include <algorithm>
@@ -348,14 +349,49 @@ DummyCircle::DummyCircle(const awt::Point& rPos, const awt::Size& rSize)
setSize(rSize);
}
-DummyLine3D::DummyLine3D(const drawing::PolyPolygonShape3D& rPoints, const VLineProperties& ):
+namespace {
+
+void setProperties( const VLineProperties& rLineProperties, std::map<OUString, uno::Any>& rTargetProps )
+{
+ //Transparency
+ if(rLineProperties.Transparence.hasValue())
+ rTargetProps.insert(std::pair<OUString, uno::Any>(
+ UNO_NAME_LINETRANSPARENCE, rLineProperties.Transparence));
+
+ //LineStyle
+ if(rLineProperties.LineStyle.hasValue())
+ rTargetProps.insert(std::pair<OUString, uno::Any>(
+ UNO_NAME_LINESTYLE, rLineProperties.LineStyle));
+
+ //LineWidth
+ if(rLineProperties.Width.hasValue())
+ rTargetProps.insert(std::pair<OUString, uno::Any>(
+ UNO_NAME_LINEWIDTH, rLineProperties.Width));
+
+ //LineColor
+ if(rLineProperties.Color.hasValue())
+ rTargetProps.insert(std::pair<OUString, uno::Any>(
+ UNO_NAME_LINECOLOR, rLineProperties.Transparence));
+
+ //LineDashName
+ if(rLineProperties.DashName.hasValue())
+ rTargetProps.insert(std::pair<OUString, uno::Any>(
+ "LineDashName", rLineProperties.DashName));
+}
+
+}
+
+DummyLine3D::DummyLine3D(const drawing::PolyPolygonShape3D& rPoints, const VLineProperties& rLineProperties):
maPoints(rPoints)
{
+ setProperties(rLineProperties, maProperties);
}
-DummyLine2D::DummyLine2D(const drawing::PointSequenceSequence& rPoints, const VLineProperties* ):
+DummyLine2D::DummyLine2D(const drawing::PointSequenceSequence& rPoints, const VLineProperties* pLineProperties):
maPoints(rPoints)
{
+ if(pLineProperties)
+ setProperties(*pLineProperties, maProperties);
}
DummyLine2D::DummyLine2D(const awt::Size& rSize, const awt::Point& rPosition)
commit b082e7306a2973b394a48ddece2e07778b94f886
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Dec 27 21:09:49 2013 +0100
set a few more missed properties
Change-Id: I30a606e2bea9c8c8d7861e5b05a6df0e7c00b9a5
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 972f02f..7e09cbc 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -235,6 +235,16 @@ void setProperties( uno::Reference< beans::XPropertySet > xPropSet, const tPrope
}
}
+void setProperties( const tNameSequence& rNames, const tAnySequence& rValues,
+ std::map<OUString, uno::Any>& rTargetMap)
+{
+ sal_Int32 nSize = std::min(rNames.getLength(), rValues.getLength());
+ for(sal_Int32 i = 0; i < nSize; ++i)
+ {
+ rTargetMap[rNames[i]] = rValues[i];
+ }
+}
+
}
DummyCube::DummyCube(const drawing::Position3D &rPos, const drawing::Direction3D& rSize,
@@ -363,18 +373,20 @@ DummyRectangle::DummyRectangle(const awt::Size& rSize)
setSize(rSize);
}
-DummyRectangle::DummyRectangle(const awt::Size& rSize, const awt::Point& rPoint, const tNameSequence& ,
- const tAnySequence& )
+DummyRectangle::DummyRectangle(const awt::Size& rSize, const awt::Point& rPoint, const tNameSequence& rNames,
+ const tAnySequence& rValues)
{
setSize(rSize);
setPosition(rPoint);
+ setProperties(rNames, rValues, maProperties);
}
-DummyText::DummyText(const OUString& rText, const tNameSequence& ,
- const tAnySequence& , const uno::Any& rTrans ):
+DummyText::DummyText(const OUString& rText, const tNameSequence& rNames,
+ const tAnySequence& rValues, const uno::Any& rTrans ):
maText(rText),
maTrans(rTrans)
{
+ setProperties(rNames, rValues, maProperties);
}
DummyGroup3D::DummyGroup3D(const OUString& rName)
commit b51692a2666a1afeaa9d56041a0d415e2ba6484c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Dec 27 21:01:55 2013 +0100
enable that code again
Change-Id: I4314c7062195f0593c34b6a11ba2b3ae81811ff8
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 7372a44..972f02f 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -220,10 +220,9 @@ void DummyXShape::setParent( const uno::Reference< uno::XInterface >& xParent )
namespace {
-void setProperties( uno::Reference< beans::XPropertySet > , const tPropertyNameMap& ,
- std::map<OUString, uno::Any>& )
+void setProperties( uno::Reference< beans::XPropertySet > xPropSet, const tPropertyNameMap& rPropertyNameMap,
+ std::map<OUString, uno::Any>& rTargetMap)
{
-/*
tNameSequence aNames;
tAnySequence aValues;
PropertyMapper::getMultiPropertyLists( aNames, aValues,
@@ -234,7 +233,6 @@ void setProperties( uno::Reference< beans::XPropertySet > , const tPropertyNameM
{
rTargetMap[aNames[i]] = aValues[i];
}
-*/
}
}
More information about the Libreoffice-commits
mailing list