[Libreoffice-commits] core.git: 2 commits - chart2/Library_chartcore.mk chart2/source

Kohei Yoshida kohei.yoshida at collabora.com
Fri Apr 11 06:36:15 PDT 2014


 chart2/Library_chartcore.mk                              |    1 
 chart2/source/controller/main/ChartController.cxx        |   47 +++++++++++++
 chart2/source/controller/main/ChartController.hxx        |   12 +++
 chart2/source/controller/main/ChartController_Window.cxx |   34 +++++++++
 chart2/source/inc/GL3DHelper.hxx                         |   29 ++++++++
 chart2/source/tools/GL3DHelper.cxx                       |   54 +++++++++++++++
 chart2/source/view/main/ChartView.cxx                    |   27 -------
 7 files changed, 178 insertions(+), 26 deletions(-)

New commits:
commit ba1452c2615604fd1d446dd0f1f55b5501f1b76d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Apr 11 09:27:59 2014 -0400

    Several more Window events to intercept for the GL3D chart.
    
    But not painting or resizing events. Those are generic enough that no
    branching is needed.
    
    Change-Id: I0fb186da61c583c5326d2608b2153aced3fab77b

diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 8786b3f..9c8c490 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1410,6 +1410,19 @@ void ChartController::queryGL3DChart()
     m_bGL3DChart = GL3DHelper::isGL3DDiagram(xDiagram);
 }
 
+void ChartController::executeGL3D_Tracking( const TrackingEvent& /*rTEvt*/ )
+{
+}
+
+void ChartController::executeGL3D_Command( const CommandEvent& /*rCEvt*/ )
+{
+}
+
+bool ChartController::executeGL3D_KeyInput( const KeyEvent& /*rKEvt*/ )
+{
+    return false;
+}
+
 void ChartController::executeGL3D_MouseButtonUp( const MouseEvent& /*rMEvt*/ )
 {
 }
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index e62904a..0698d56 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -433,6 +433,10 @@ private:
 
     void queryGL3DChart();
 
+    void executeGL3D_Tracking( const TrackingEvent& rTEvt );
+    void executeGL3D_Command( const CommandEvent& rCEvt );
+    bool executeGL3D_KeyInput( const KeyEvent& rKEvt );
+
     void executeGL3D_MouseButtonUp( const MouseEvent& rMEvt );
     void executeGL3D_MouseButtonDown( const MouseEvent& rMEvt );
     void executeGL3D_MouseMove( const MouseEvent& rMEvt );
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index e420b3b..66ea74f 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -746,8 +746,13 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
     impl_SetMousePointer( rMEvt );
 }
 
-void ChartController::execute_Tracking( const TrackingEvent& /* rTEvt */ )
+void ChartController::execute_Tracking( const TrackingEvent& rTEvt )
 {
+    if (m_bGL3DChart)
+    {
+        executeGL3D_Tracking(rTEvt);
+        return;
+    }
 }
 
 void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
@@ -988,6 +993,12 @@ void ChartController::execute_LoseFocus()
 
 void ChartController::execute_Command( const CommandEvent& rCEvt )
 {
+    if (m_bGL3DChart)
+    {
+        executeGL3D_Command(rCEvt);
+        return;
+    }
+
     bool bIsAction = false;
     {
         SolarMutexGuard aGuard;
@@ -1303,6 +1314,9 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
 
 bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
 {
+    if (m_bGL3DChart)
+        return executeGL3D_KeyInput(rKEvt);
+
     bool bReturn=false;
 
     DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
commit a3354ecf4fe32e3ec14b40f0c6db17e84392e42f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Apr 10 23:05:54 2014 -0400

    Separate mouse event handlers for GL3D bar chart.
    
    They are just skeletons for now.
    
    Change-Id: I7e5e95ad8a2809125cbcf3affd17e663aafa99b0

diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index af3b6f3..8de07e2 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -199,6 +199,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
     chart2/source/tools/ExponentialRegressionCurveCalculator \
     chart2/source/tools/FillProperties \
     chart2/source/tools/FormattedStringHelper \
+    chart2/source/tools/GL3DHelper \
     chart2/source/tools/ImplOPropertySet \
     chart2/source/tools/InternalData \
     chart2/source/tools/InternalDataProvider \
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 8b45213..8786b3f 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -43,6 +43,7 @@
 #include "DrawCommandDispatch.hxx"
 #include "ShapeController.hxx"
 #include "UndoActions.hxx"
+#include <GL3DHelper.hxx>
 
 #include <comphelper/InlineContainer.hxx>
 
@@ -107,6 +108,7 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const &
     m_bWaitingForDoubleClick(false),
     m_bWaitingForMouseUp(false),
     m_bConnectingToView(false),
+    m_bGL3DChart(false),
     m_xUndoManager( 0 ),
     m_aDispatchContainer( m_xCC, this ),
     m_eDrawMode( CHARTDRAW_SELECT )
@@ -483,6 +485,8 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent
                 }
 
                 m_bConnectingToView = false;
+
+                queryGL3DChart();
             }
         }
     }
@@ -578,6 +582,8 @@ sal_Bool SAL_CALL ChartController::attachModel( const uno::Reference< frame::XMo
     uno::Reference< document::XUndoManagerSupplier > xSuppUndo( getModel(), uno::UNO_QUERY_THROW );
     m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW );
 
+    queryGL3DChart();
+
     return sal_True;
 }
 
@@ -1388,6 +1394,34 @@ DrawViewWrapper* ChartController::GetDrawViewWrapper()
     return m_pDrawViewWrapper;
 }
 
+void ChartController::queryGL3DChart()
+{
+    m_bGL3DChart = false;
+
+    uno::Reference<frame::XModel> xModel = m_aModel->getModel();
+    if (!xModel.is())
+        return;
+
+    uno::Reference<XChartDocument> xChartDoc(xModel, uno::UNO_QUERY);
+    if (!xChartDoc.is())
+        return;
+
+    uno::Reference<chart2::XDiagram> xDiagram = xChartDoc->getFirstDiagram();
+    m_bGL3DChart = GL3DHelper::isGL3DDiagram(xDiagram);
+}
+
+void ChartController::executeGL3D_MouseButtonUp( const MouseEvent& /*rMEvt*/ )
+{
+}
+
+void ChartController::executeGL3D_MouseButtonDown( const MouseEvent& /*rMEvt*/ )
+{
+}
+
+void ChartController::executeGL3D_MouseMove( const MouseEvent& /*rMEvt*/ )
+{
+}
+
 uno::Reference< XAccessible > ChartController::CreateAccessible()
 {
     uno::Reference< XAccessible > xResult = new AccessibleChartView( m_xCC, GetDrawViewWrapper() );
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index d73d151..e62904a 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -431,6 +431,12 @@ private:
     DrawModelWrapper* GetDrawModelWrapper();
     DrawViewWrapper* GetDrawViewWrapper();
 
+    void queryGL3DChart();
+
+    void executeGL3D_MouseButtonUp( const MouseEvent& rMEvt );
+    void executeGL3D_MouseButtonDown( const MouseEvent& rMEvt );
+    void executeGL3D_MouseMove( const MouseEvent& rMEvt );
+
 private:
     class TheModelRef;
     friend class ChartController::TheModelRef;
@@ -517,6 +523,8 @@ private:
 
     bool volatile       m_bConnectingToView;
 
+    bool m_bGL3DChart;
+
     ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager >    m_xUndoManager;
     ::std::auto_ptr< UndoGuard >                                                    m_pTextActionUndoGuard;
     /// needed for dispatching URLs in FeatureStateEvents
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index 7cd99f2..e420b3b 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -568,6 +568,12 @@ IMPL_LINK_NOARG(ChartController, DoubleClickWaitingHdl)
 
 void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
 {
+    if (m_bGL3DChart)
+    {
+        executeGL3D_MouseButtonDown(rMEvt);
+        return;
+    }
+
     SolarMutexGuard aGuard;
 
     m_bWaitingForMouseUp = true;
@@ -714,6 +720,12 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
 
 void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
 {
+    if (m_bGL3DChart)
+    {
+        executeGL3D_MouseMove(rMEvt);
+        return;
+    }
+
     SolarMutexGuard aGuard;
 
     DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
@@ -740,6 +752,12 @@ void ChartController::execute_Tracking( const TrackingEvent& /* rTEvt */ )
 
 void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
 {
+    if (m_bGL3DChart)
+    {
+        executeGL3D_MouseButtonUp(rMEvt);
+        return;
+    }
+
     ControllerLockGuardUNO aCLGuard( getModel() );
     bool bMouseUpWithoutMouseDown = !m_bWaitingForMouseUp;
     m_bWaitingForMouseUp = false;
diff --git a/chart2/source/inc/GL3DHelper.hxx b/chart2/source/inc/GL3DHelper.hxx
new file mode 100644
index 0000000..d7e2464
--- /dev/null
+++ b/chart2/source/inc/GL3DHelper.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef CHART2_GL3DHELPER_HXX
+#define CHART2_GL3DHELPER_HXX
+
+#include <charttoolsdllapi.hxx>
+
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+namespace chart {
+
+class OOO_DLLPUBLIC_CHARTTOOLS GL3DHelper
+{
+public:
+    static bool isGL3DDiagram( const css::uno::Reference<css::chart2::XDiagram>& xDiagram );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/GL3DHelper.cxx b/chart2/source/tools/GL3DHelper.cxx
new file mode 100644
index 0000000..03a2306
--- /dev/null
+++ b/chart2/source/tools/GL3DHelper.cxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <GL3DHelper.hxx>
+
+#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>
+
+using namespace com::sun::star;
+
+namespace chart {
+
+bool GL3DHelper::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;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index da0e30a..c205652 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -49,6 +49,7 @@
 #include "defines.hxx"
 #include <unonames.hxx>
 #include <GL3DBarChart.hxx>
+#include <GL3DHelper.hxx>
 
 #include <rtl/uuid.h>
 #include <comphelper/scopeguard.hxx>
@@ -2405,32 +2406,8 @@ void ChartView::impl_refreshAddIn()
 bool ChartView::isReal3DChart()
 {
     uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
-    uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
-    if( !xCooSysContainer.is())
-        return false;
 
-    uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
-    for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
-    {
-        uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
-        //
-        //iterate through all chart types in the current coordinate system
-        uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
-        OSL_ASSERT( xChartTypeContainer.is());
-        if( !xChartTypeContainer.is() )
-            continue;
-
-        uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
-        for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
-        {
-            uno::Reference< XChartType > xChartType( aChartTypeList[nT] );
-            OUString aChartType = xChartType->getChartType();
-            if( aChartType == "com.sun.star.chart2.GL3DBarChartType" )
-                return true;
-        }
-    }
-
-    return false;
+    return GL3DHelper::isGL3DDiagram(xDiagram);
 }
 
 void ChartView::createShapes()


More information about the Libreoffice-commits mailing list