[Libreoffice-commits] core.git: chart2/inc chart2/Library_chartcore.mk chart2/source offapi/com offapi/UnoApi_offapi.mk

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sun Feb 12 22:22:38 UTC 2017


 chart2/Library_chartcore.mk                       |    1 
 chart2/inc/ChartModel.hxx                         |    2 
 chart2/source/inc/PopupRequest.hxx                |   51 ++++++++++++++++++++++
 chart2/source/model/main/ChartModel.cxx           |   11 ++++
 chart2/source/tools/PopupRequest.cxx              |   42 ++++++++++++++++++
 offapi/UnoApi_offapi.mk                           |    2 
 offapi/com/sun/star/chart2/data/PopupRequest.idl  |   44 ++++++++++++++++++
 offapi/com/sun/star/chart2/data/XDataReceiver.idl |    2 
 offapi/com/sun/star/chart2/data/XPopupRequest.idl |   39 ++++++++++++++++
 9 files changed, 194 insertions(+)

New commits:
commit 8cc8ffdb04f9915c5b7dddd619ef89762c7a40c2
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Feb 7 14:25:26 2017 +0100

    [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 at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 2acc34f..6d1a721 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 da23683..5225b80 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 0000000..e564003
--- /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 924e5be..d502324 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 0000000..5078c6c
--- /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: */
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index a76f42a..064a847 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -658,6 +658,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/chart2/data,\
 	DataSequence \
 	DataSink \
 	DataSource \
+	PopupRequest \
 	RangeHighlighter \
 	RangeHighlightListener \
 	TabularDataProviderArguments \
@@ -2057,6 +2058,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/chart2/data,\
 	XLabeledDataSequence \
 	XLabeledDataSequence2 \
 	XNumericalDataSequence \
+	XPopupRequest \
 	XRangeHighlighter \
 	XRangeXMLConversion \
 	XSheetDataProvider \
diff --git a/offapi/com/sun/star/chart2/data/PopupRequest.idl b/offapi/com/sun/star/chart2/data/PopupRequest.idl
new file mode 100644
index 0000000..bd49c69
--- /dev/null
+++ b/offapi/com/sun/star/chart2/data/PopupRequest.idl
@@ -0,0 +1,44 @@
+/* -*- 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 com_sun_star_chart2_data_PopupRequest_idl
+#define com_sun_star_chart2_data_PopupRequest_idl
+
+#include <com/sun/star/chart2/data/XPopupRequest.idl>
+
+module com
+{
+module sun
+{
+module star
+{
+module chart2
+{
+module data
+{
+
+/**
+ */
+service PopupRequest
+{
+    /**
+     */
+    interface XPopupRequest;
+};
+
+} ; // data
+} ; // chart2
+} ; // com
+} ; // sun
+} ; // star
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/chart2/data/XDataReceiver.idl b/offapi/com/sun/star/chart2/data/XDataReceiver.idl
index ae7cf13..2ff7427 100644
--- a/offapi/com/sun/star/chart2/data/XDataReceiver.idl
+++ b/offapi/com/sun/star/chart2/data/XDataReceiver.idl
@@ -87,6 +87,8 @@ interface XDataReceiver : ::com::sun::star::uno::XInterface
         return an empty object.</p>
      */
     XRangeHighlighter getRangeHighlighter();
+
+    XPopupRequest getPopupRequest();
 };
 
 } ; // data
diff --git a/offapi/com/sun/star/chart2/data/XPopupRequest.idl b/offapi/com/sun/star/chart2/data/XPopupRequest.idl
new file mode 100644
index 0000000..e329465
--- /dev/null
+++ b/offapi/com/sun/star/chart2/data/XPopupRequest.idl
@@ -0,0 +1,39 @@
+/* -*- 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 com_sun_star_chart2_data_XPopupRequest_idl
+#define com_sun_star_chart2_data_XPopupRequest_idl
+
+#include <com/sun/star/uno/XInterface.idl>
+
+module com
+{
+module sun
+{
+module star
+{
+module chart2
+{
+module data
+{
+
+interface XPopupRequest : com::sun::star::awt::XRequestCallback
+{
+};
+
+} ; // data
+} ; // chart2
+} ; // com
+} ; // sun
+} ; // star
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list