diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-10 23:05:54 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-11 09:36:40 -0400 |
commit | a3354ecf4fe32e3ec14b40f0c6db17e84392e42f (patch) | |
tree | e40845fd7f2d2ca18504232025d582d9587be82a /chart2 | |
parent | 999377f113fc8f4af4f08b7285658c8c081f6c0b (diff) |
Separate mouse event handlers for GL3D bar chart.
They are just skeletons for now.
Change-Id: I7e5e95ad8a2809125cbcf3affd17e663aafa99b0
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/Library_chartcore.mk | 1 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController.cxx | 34 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController.hxx | 8 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 18 | ||||
-rw-r--r-- | chart2/source/inc/GL3DHelper.hxx | 29 | ||||
-rw-r--r-- | chart2/source/tools/GL3DHelper.cxx | 54 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 27 |
7 files changed, 146 insertions, 25 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk index af3b6f3b67e1..8de07e2572f6 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 8b45213fc890..8786b3fe66d1 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 d73d151ec507..e62904a49bb6 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 7cd99f22340a..e420b3b08602 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 000000000000..d7e2464d3c6c --- /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 000000000000..03a23062d354 --- /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 da0e30a34e4b..c2056520aa40 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() |