[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/inc chart2/source offapi/com sc/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sat May 24 03:41:37 PDT 2014


 chart2/inc/ChartModel.hxx                             |    3 +
 chart2/source/model/main/ChartModel.cxx               |   13 +++++
 offapi/com/sun/star/chart2/X3DChartWindowProvider.idl |    2 
 sc/source/ui/view/tabvwsh4.cxx                        |   44 ++++++++++++++++++
 4 files changed, 62 insertions(+)

New commits:
commit d7eb7a66e80f29c6998f996e9688c01f28c08b94
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 24 12:35:36 2014 +0200

    make sure that OpenGL charts are rendered after import
    
    Change-Id: I3701a7593d7394abc39532a87b9aa50a3c92d457

diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index 9fb24fe..3624b4b 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 c61e83c..e4b6718 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 ff67fc3..604d023 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 7a3a35f..338405a 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();
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list