summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-24 12:35:36 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-24 12:36:48 +0200
commite41c33b376d8b5776e400979eb8544db596c5bbe (patch)
tree745164532fa302662d700b35e55b474932dd05d3
parent2ed32f7afa712992486ad516407d30bce85b3530 (diff)
make sure that OpenGL charts are rendered after import
Change-Id: I3701a7593d7394abc39532a87b9aa50a3c92d457
-rw-r--r--chart2/inc/ChartModel.hxx3
-rw-r--r--chart2/source/model/main/ChartModel.cxx13
-rw-r--r--offapi/com/sun/star/chart2/X3DChartWindowProvider.idl2
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx44
4 files changed, 62 insertions, 0 deletions
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index 9fb24fef2414..3624b4b6a0b3 100644
--- a/chart2/inc/ChartModel.hxx
+++ b/chart2/inc/ChartModel.hxx
@@ -580,6 +580,9 @@ public:
virtual void SAL_CALL setWindow( const sal_uInt64 nWindowPtr )
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ virtual void SAL_CALL update()
+ throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
// XDumper
virtual OUString SAL_CALL dump()
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index c61e83cf4f8b..e4b671892ce6 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1420,6 +1420,19 @@ void ChartModel::setWindow( const sal_uInt64 nWindowPtr )
mpOpenGLWindow = pWindow;
}
+void ChartModel::update()
+ throw (uno::RuntimeException, std::exception)
+{
+ if(!mpChartView)
+ {
+ mpChartView = new ChartView( m_xContext, *this);
+ xChartView = static_cast< ::cppu::OWeakObject* >( mpChartView );
+ }
+
+ mpChartView->setViewDirty();
+ mpChartView->update();
+}
+
OpenGLWindow* ChartModel::getOpenGLWindow()
{
return mpOpenGLWindow;
diff --git a/offapi/com/sun/star/chart2/X3DChartWindowProvider.idl b/offapi/com/sun/star/chart2/X3DChartWindowProvider.idl
index ff67fc323553..604d023b69ed 100644
--- a/offapi/com/sun/star/chart2/X3DChartWindowProvider.idl
+++ b/offapi/com/sun/star/chart2/X3DChartWindowProvider.idl
@@ -24,6 +24,8 @@ module com { module sun { module star { module chart2 {
interface X3DChartWindowProvider
{
void setWindow( [in] unsigned hyper window );
+
+ void update();
};
}; }; }; };
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 7a3a35f42c13..338405a43745 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -93,6 +93,10 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/chart2/X3DChartWindowProvider.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
extern SfxViewShell* pScActiveViewShell; // global.cxx
@@ -532,6 +536,41 @@ void ScTabViewShell::DoReadUserDataSequence( const uno::Sequence < beans::Proper
//! if ViewData has more tables than document, remove tables in ViewData
}
+namespace {
+
+bool isGL3DDiagram( const css::uno::Reference<css::chart2::XDiagram>& xDiagram )
+{
+ uno::Reference<chart2::XCoordinateSystemContainer> xCooSysContainer(xDiagram, uno::UNO_QUERY);
+
+ if (!xCooSysContainer.is())
+ return false;
+
+ uno::Sequence< uno::Reference<chart2::XCoordinateSystem> > aCooSysList = xCooSysContainer->getCoordinateSystems();
+ for (sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS)
+ {
+ uno::Reference<chart2::XCoordinateSystem> xCooSys = aCooSysList[nCS];
+
+ //iterate through all chart types in the current coordinate system
+ uno::Reference<chart2::XChartTypeContainer> xChartTypeContainer(xCooSys, uno::UNO_QUERY);
+ OSL_ASSERT( xChartTypeContainer.is());
+ if( !xChartTypeContainer.is() )
+ continue;
+
+ uno::Sequence< uno::Reference<chart2::XChartType> > aChartTypeList = xChartTypeContainer->getChartTypes();
+ for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
+ {
+ uno::Reference<chart2::XChartType> xChartType = aChartTypeList[nT];
+ OUString aChartType = xChartType->getChartType();
+ if( aChartType == "com.sun.star.chart2.GL3DBarChartType" )
+ return true;
+ }
+ }
+
+ return false;
+}
+
+}
+
void ScTabViewShell::AddOpenGLChartWindows()
{
ScDocument* pDoc = GetViewData()->GetDocument();
@@ -554,6 +593,11 @@ void ScTabViewShell::AddOpenGLChartWindows()
uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider( itr->first, uno::UNO_QUERY_THROW );
sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(pOpenGLWindow);
x3DWindowProvider->setWindow(nWindowPtr);
+
+ if(isGL3DDiagram(itr->first->getFirstDiagram()))
+ {
+ x3DWindowProvider->update();
+ }
}
}