summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorAttila Szűcs <attila.szucs@collabora.com>2024-07-25 06:21:35 +0200
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-18 12:49:41 +0200
commit599365d293bb0c0fcc2b5b1183e50fa9b93a8e3f (patch)
tree8d91ace1459c3691f38ad926272dcc44ea49e899 /chart2/source
parent9cb748847f63f73a7a0bbd63d34a5f3ebf789919 (diff)
SW: extract transform charts (using dialog code)
Implemented chart data extraction, and transformation added insert/delete/modify row/column, and the ability to set resize data table setcolumndesc / setrowdesc .. for 1 descriptor, or with multiple descriptor to set set 1 cell value, or set the whole table cells values. it will resize the table, but you can still use partial arrays like "data": [ [ 1,2,3,4 ], [ 2,3,4,5 ], [ 3 ], [ 4,5,6,7 ], [ 2,2,1 ], [ 5,6,7,8 ] ], that means the 3. row 2,3,4th cell will not be overwritten. for insert column, it call codes from DataBrowserModel. (used by dialog code) added tests, fixed a contentcontrol date problem 2. commit (made by Caolan) squashed into 1. commit: WIP hack this to link move stuff from chartcontroller to chartcore and adjust visibility until it links at least Change-Id: I5529f4da33f046eef7e947d755e29486fa966274 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172849 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175121 Tested-by: Jenkins
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx2
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx2
-rw-r--r--chart2/source/controller/dialogs/DialogModel.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard.hxx2
-rw-r--r--chart2/source/controller/inc/res_ErrorBar.hxx2
-rw-r--r--chart2/source/inc/DataBrowserModel.hxx (renamed from chart2/source/controller/dialogs/DataBrowserModel.hxx)6
-rw-r--r--chart2/source/inc/InternalDataProvider.hxx8
-rw-r--r--chart2/source/inc/RangeSelectionHelper.hxx (renamed from chart2/source/controller/inc/RangeSelectionHelper.hxx)4
-rw-r--r--chart2/source/inc/RangeSelectionListener.hxx (renamed from chart2/source/controller/inc/RangeSelectionListener.hxx)4
-rw-r--r--chart2/source/inc/TimerTriggeredControllerLock.hxx (renamed from chart2/source/controller/inc/TimerTriggeredControllerLock.hxx)4
-rw-r--r--chart2/source/model/main/ChartModel.cxx3
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx15
12 files changed, 42 insertions, 12 deletions
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index db25ada7c1ff..b80dcf2043e0 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -20,7 +20,7 @@
#include <svl/zforlist.hxx>
#include "DataBrowser.hxx"
-#include "DataBrowserModel.hxx"
+#include <DataBrowserModel.hxx>
#include <strings.hrc>
#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index 1db3abc60c9a..9f01c68f61fc 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -17,8 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "DataBrowserModel.hxx"
#include "DialogModel.hxx"
+#include <DataBrowserModel.hxx>
#include <ChartModelHelper.hxx>
#include <ChartType.hxx>
#include <ChartTypeManager.hxx>
diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx
index 24b74d6fab3a..88a74c62d403 100644
--- a/chart2/source/controller/dialogs/DialogModel.hxx
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -61,7 +61,7 @@ struct DialogModelTimeBasedInfo
sal_Int32 nEnd;
};
-class DialogModel
+class OOO_DLLPUBLIC_CHARTTOOLS DialogModel
{
public:
explicit DialogModel( rtl::Reference<::chart::ChartModel> xChartDocument );
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
index 1b782632f4d3..556c1ca81bb3 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -19,7 +19,7 @@
#pragma once
-#include "TimerTriggeredControllerLock.hxx"
+#include <TimerTriggeredControllerLock.hxx>
#include "TabPageNotifiable.hxx"
#include <rtl/ref.hxx>
diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx
index c3521d5ba087..2a1f3645a775 100644
--- a/chart2/source/controller/inc/res_ErrorBar.hxx
+++ b/chart2/source/controller/inc/res_ErrorBar.hxx
@@ -22,7 +22,7 @@
#include <tools/link.hxx>
#include <svl/itemset.hxx>
#include <svx/chrtitem.hxx>
-#include "RangeSelectionListener.hxx"
+#include <RangeSelectionListener.hxx>
#include <rtl/ref.hxx>
namespace com::sun::star::chart2 { class XChartDocument; }
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx b/chart2/source/inc/DataBrowserModel.hxx
index e3254851d002..16acb2de0b07 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.hxx
+++ b/chart2/source/inc/DataBrowserModel.hxx
@@ -18,8 +18,8 @@
*/
#pragma once
-#include <DataSeries.hxx>
-#include <ChartType.hxx>
+#include "DataSeries.hxx"
+#include "ChartType.hxx"
#include <com/sun/star/uno/Reference.hxx>
#include <rtl/ref.hxx>
@@ -44,7 +44,7 @@ class ChartModel;
class ChartType;
class DataSeries;
-class DataBrowserModel final
+class OOO_DLLPUBLIC_CHARTTOOLS DataBrowserModel final
{
public:
explicit DataBrowserModel(
diff --git a/chart2/source/inc/InternalDataProvider.hxx b/chart2/source/inc/InternalDataProvider.hxx
index a5032efcdab8..26a759c56865 100644
--- a/chart2/source/inc/InternalDataProvider.hxx
+++ b/chart2/source/inc/InternalDataProvider.hxx
@@ -19,6 +19,7 @@
#pragma once
#include "InternalData.hxx"
+#include <ChartModel.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/chart/XDateCategories.hpp>
@@ -30,6 +31,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
#include <rtl/ref.hxx>
+#include <unotools/weakref.hxx>
#include <map>
@@ -101,6 +103,7 @@ public:
virtual void SAL_CALL swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex ) override;
virtual void SAL_CALL registerDataSequenceForChanges(
const css::uno::Reference< css::chart2::data::XDataSequence >& xSeq ) override;
+ virtual void SAL_CALL insertDataSeries( ::sal_Int32 nAfterIndex ) override;
// ____ XDataProvider (base of XInternalDataProvider) ____
virtual sal_Bool SAL_CALL createDataSourcePossible(
@@ -175,6 +178,8 @@ public:
// css::lang::XInitialization:
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > & aArguments) override;
+ void setChartModel(ChartModel* pChartModel);
+
private:
void addDataSequenceToMap(
const OUString & rRangeRepresentation,
@@ -213,6 +218,9 @@ private:
tSequenceMap m_aSequenceMap;
InternalData m_aInternalData;
bool m_bDataInColumns;
+
+ // keep a weak reference to the owning m_xChartModel for insertDataSeries
+ unotools::WeakReference<ChartModel> m_xChartModel;
};
} // namespace chart
diff --git a/chart2/source/controller/inc/RangeSelectionHelper.hxx b/chart2/source/inc/RangeSelectionHelper.hxx
index 36fe0db99cce..3afc7fcb511a 100644
--- a/chart2/source/controller/inc/RangeSelectionHelper.hxx
+++ b/chart2/source/inc/RangeSelectionHelper.hxx
@@ -23,6 +23,8 @@
#include <rtl/ustring.hxx>
#include <rtl/ref.hxx>
+#include "charttoolsdllapi.hxx"
+
namespace com::sun::star::beans { struct PropertyValue; }
namespace com::sun::star::chart2 { class XChartDocument; }
@@ -38,7 +40,7 @@ namespace chart
class ChartModel;
class RangeSelectionListenerParent;
-class RangeSelectionHelper
+class OOO_DLLPUBLIC_CHARTTOOLS RangeSelectionHelper
{
public:
explicit RangeSelectionHelper(
diff --git a/chart2/source/controller/inc/RangeSelectionListener.hxx b/chart2/source/inc/RangeSelectionListener.hxx
index 0ca4644a96ad..7902ff2263a4 100644
--- a/chart2/source/controller/inc/RangeSelectionListener.hxx
+++ b/chart2/source/inc/RangeSelectionListener.hxx
@@ -18,7 +18,7 @@
*/
#pragma once
-#include <ControllerLockGuard.hxx>
+#include "ControllerLockGuard.hxx"
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/sheet/XRangeSelectionListener.hpp>
#include <rtl/ref.hxx>
@@ -36,7 +36,7 @@ namespace chart
{
class ChartModel;
-class RangeSelectionListenerParent
+class OOO_DLLPUBLIC_CHARTTOOLS RangeSelectionListenerParent
{
public:
virtual void listeningFinished(const OUString& rNewRange) = 0;
diff --git a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx b/chart2/source/inc/TimerTriggeredControllerLock.hxx
index 49541b1552d4..7d56fd94369e 100644
--- a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
+++ b/chart2/source/inc/TimerTriggeredControllerLock.hxx
@@ -24,6 +24,8 @@
#include <memory>
+#include "charttoolsdllapi.hxx"
+
namespace com::sun::star::frame
{
class XModel;
@@ -37,7 +39,7 @@ namespace chart
{
class ChartModel;
-class TimerTriggeredControllerLock final
+class OOO_DLLPUBLIC_CHARTTOOLS TimerTriggeredControllerLock final
{
public:
TimerTriggeredControllerLock(rtl::Reference<::chart::ChartModel> xModel);
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 022446666c2b..bc718c89878d 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -742,7 +742,10 @@ void SAL_CALL ChartModel::createInternalDataProvider( sal_Bool bCloneExistingDat
if( bCloneExistingData )
m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( this, true );
else
+ {
m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( nullptr, true );
+ m_xInternalDataProvider->setChartModel(this);
+ }
m_xDataProvider.set( m_xInternalDataProvider );
}
setModified( true );
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 22f3e84a5802..3e1f8372a7b2 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -32,6 +32,7 @@
#include <Diagram.hxx>
#include <ExplicitCategoriesProvider.hxx>
#include <BaseCoordinateSystem.hxx>
+#include <DataBrowserModel.hxx>
#include <DataSeries.hxx>
#include <com/sun/star/chart2/data/XDataSequence.hpp>
@@ -298,6 +299,7 @@ InternalDataProvider::InternalDataProvider(
{
if (!xModel.is())
return;
+ m_xChartModel = xModel.get();
try
{
rtl::Reference< Diagram > xDiagram( xModel->getFirstChartDiagram() );
@@ -393,6 +395,11 @@ InternalDataProvider::InternalDataProvider( const InternalDataProvider & rOther
InternalDataProvider::~InternalDataProvider()
{}
+void InternalDataProvider::setChartModel(ChartModel* pChartModel)
+{
+ m_xChartModel = pChartModel;
+}
+
void InternalDataProvider::addDataSequenceToMap(
const OUString & rRangeRepresentation,
const Reference< chart2::data::XDataSequence > & xSequence )
@@ -1137,6 +1144,14 @@ void SAL_CALL InternalDataProvider::registerDataSequenceForChanges( const Refere
addDataSequenceToMap( xSeq->getSourceRangeRepresentation(), xSeq );
}
+void SAL_CALL InternalDataProvider::insertDataSeries(::sal_Int32 nAfterIndex)
+{
+ // call the dialog insertion
+ rtl::Reference<ChartModel> xChartModel(m_xChartModel);
+ DataBrowserModel* pDBM = new DataBrowserModel(xChartModel);
+ pDBM->insertDataSeries(nAfterIndex);
+}
+
// ____ XRangeXMLConversion ____
OUString SAL_CALL InternalDataProvider::convertRangeToXML( const OUString& aRangeRepresentation )
{