diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-02-07 14:25:26 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-02-12 22:22:06 +0000 |
commit | 8cc8ffdb04f9915c5b7dddd619ef89762c7a40c2 (patch) | |
tree | 2b2f1ed9fe71cc18ec5c38d7bdf3d63b57c3b9bb /chart2 | |
parent | 614f4b5a32e569051b6ed058fe6369f96fea3b48 (diff) |
[API CHANGE] Add PopupRequest - a callback to open a pop-up win. in calc
Change-Id: Iea600e229deb69d1638a1a649008fc4738a5934a
Reviewed-on: https://gerrit.libreoffice.org/34005
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/Library_chartcore.mk | 1 | ||||
-rw-r--r-- | chart2/inc/ChartModel.hxx | 2 | ||||
-rw-r--r-- | chart2/source/inc/PopupRequest.hxx | 51 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 11 | ||||
-rw-r--r-- | chart2/source/tools/PopupRequest.cxx | 42 |
5 files changed, 107 insertions, 0 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk index 2acc34ff8469..6d1a7215ac63 100644 --- a/chart2/Library_chartcore.mk +++ b/chart2/Library_chartcore.mk @@ -223,6 +223,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\ chart2/source/tools/ObjectIdentifier \ chart2/source/tools/OPropertySet \ chart2/source/tools/PolynomialRegressionCurveCalculator \ + chart2/source/tools/PopupRequest \ chart2/source/tools/PotentialRegressionCurveCalculator \ chart2/source/tools/PropertyHelper \ chart2/source/tools/RangeHighlighter \ diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index da2368351143..5225b80ea600 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -143,6 +143,7 @@ private: css::awt::Size m_aVisualAreaSize; css::uno::Reference< css::frame::XModel > m_xParent; css::uno::Reference< css::chart2::data::XRangeHighlighter > m_xRangeHighlighter; + css::uno::Reference<css::chart2::data::XPopupRequest> m_xPopupRequest; ::std::vector< GraphicObject > m_aGraphicObjectVector; css::uno::Reference< css::chart2::data::XDataProvider > m_xDataProvider; @@ -382,6 +383,7 @@ public: virtual void SAL_CALL attachNumberFormatsSupplier( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier ) override; virtual css::uno::Reference< css::chart2::data::XRangeHighlighter > SAL_CALL getRangeHighlighter() override; + virtual css::uno::Reference< css::chart2::data::XPopupRequest > SAL_CALL getPopupRequest() override; // ____ XTitled ____ virtual css::uno::Reference< css::chart2::XTitle > SAL_CALL getTitleObject() override; diff --git a/chart2/source/inc/PopupRequest.hxx b/chart2/source/inc/PopupRequest.hxx new file mode 100644 index 000000000000..e564003c9e44 --- /dev/null +++ b/chart2/source/inc/PopupRequest.hxx @@ -0,0 +1,51 @@ +/* -*- 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 INCLUDED_CHART2_SOURCE_INC_POPUPREQUEST_HXX +#define INCLUDED_CHART2_SOURCE_INC_POPUPREQUEST_HXX + +#include "MutexContainer.hxx" +#include <cppuhelper/compbase.hxx> +#include <com/sun/star/chart2/data/XPopupRequest.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +namespace chart +{ + +namespace impl +{ + +typedef cppu::WeakComponentImplHelper<css::chart2::data::XPopupRequest> PopupRequest_Base; + +} + +class PopupRequest : public MutexContainer, public impl::PopupRequest_Base +{ +public: + explicit PopupRequest(); + virtual ~PopupRequest() override; + +protected: + // ____ XRequestCallback ____ + virtual void SAL_CALL addCallback(const css::uno::Reference< ::css::awt::XCallback >& xCallback, + const css::uno::Any& aData) override; + + // ____ WeakComponentImplHelperBase ____ + // is called when dispose() is called at this component + virtual void SAL_CALL disposing() override; + +private: + css::uno::Reference<css::awt::XCallback> m_xCallback; +}; + +} // namespace chart + +#endif // INCLUDED_CHART2_SOURCE_INC_POPUPREQUEST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 924e5bee71d9..d502324dec2a 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -32,6 +32,7 @@ #include "NameContainer.hxx" #include "UndoManager.hxx" #include "ChartView.hxx" +#include "PopupRequest.hxx" #include <svx/charthelper.hxx> #include <vcl/openglwin.hxx> @@ -412,6 +413,7 @@ void SAL_CALL ChartModel::disconnectController( const uno::Reference< frame::XCo m_xCurrentController.clear(); DisposeHelper::DisposeAndClear( m_xRangeHighlighter ); + DisposeHelper::DisposeAndClear(m_xPopupRequest); } void SAL_CALL ChartModel::lockControllers() @@ -496,6 +498,7 @@ void SAL_CALL ChartModel::setCurrentController( const uno::Reference< frame::XCo m_xCurrentController = xController; DisposeHelper::DisposeAndClear( m_xRangeHighlighter ); + DisposeHelper::DisposeAndClear(m_xPopupRequest); } uno::Reference< uno::XInterface > SAL_CALL ChartModel::getCurrentSelection() @@ -569,6 +572,7 @@ void SAL_CALL ChartModel::dispose() m_xCurrentController.clear(); DisposeHelper::DisposeAndClear( m_xRangeHighlighter ); + DisposeHelper::DisposeAndClear(m_xPopupRequest); if( m_xOldModelAgg.is()) m_xOldModelAgg->setDelegator( nullptr ); @@ -909,6 +913,13 @@ Reference< chart2::data::XRangeHighlighter > SAL_CALL ChartModel::getRangeHighli return m_xRangeHighlighter; } +Reference<chart2::data::XPopupRequest> SAL_CALL ChartModel::getPopupRequest() +{ + if (!m_xPopupRequest.is()) + m_xPopupRequest.set(new PopupRequest); + return m_xPopupRequest; +} + Reference< chart2::XChartTypeTemplate > ChartModel::impl_createDefaultChartTypeTemplate() { Reference< chart2::XChartTypeTemplate > xTemplate; diff --git a/chart2/source/tools/PopupRequest.cxx b/chart2/source/tools/PopupRequest.cxx new file mode 100644 index 000000000000..5078c6c519be --- /dev/null +++ b/chart2/source/tools/PopupRequest.cxx @@ -0,0 +1,42 @@ +/* -*- 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 "PopupRequest.hxx" + +using namespace css; + +namespace chart +{ + +PopupRequest::PopupRequest() + : impl::PopupRequest_Base(m_aMutex) +{ +} + +PopupRequest::~PopupRequest() +{} + +// ____ XRequestCallback ____ + +void SAL_CALL PopupRequest::addCallback(const uno::Reference<awt::XCallback>& xCallback, + const uno::Any& /*aData*/) +{ + m_xCallback = xCallback; +} + +// ____ WeakComponentImplHelperBase ____ +// is called when dispose() is called at this component +void SAL_CALL PopupRequest::disposing() +{ +} + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |