summaryrefslogtreecommitdiff
path: root/chart2
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-09-12 22:14:04 +0200
commitd9338fcf8f15a7e32a9de3e7249c925fd768ffc9 (patch)
tree70abad04b72ca2f540a69b65e3cc883c2c7a1376 /chart2
parent4cb25fa922f21996d9106c8a40e26613d47cb3b4 (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>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/Library_chartcontroller.mk5
-rw-r--r--chart2/Library_chartcore.mk5
-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
14 files changed, 47 insertions, 17 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index ca50d52a1fd9..b2d05298c237 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -100,8 +100,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/dialogs/ChartResourceGroups \
chart2/source/controller/dialogs/ChartTypeDialogController \
chart2/source/controller/dialogs/DataBrowser \
- chart2/source/controller/dialogs/DataBrowserModel \
- chart2/source/controller/dialogs/DialogModel \
chart2/source/controller/dialogs/dlg_ChartType \
chart2/source/controller/dialogs/dlg_ChartType_UNO \
chart2/source/controller/dialogs/dlg_CreationWizard \
@@ -120,8 +118,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/dialogs/dlg_ShapeParagraph \
chart2/source/controller/dialogs/dlg_View3D \
chart2/source/controller/dialogs/ObjectNameProvider \
- chart2/source/controller/dialogs/RangeSelectionHelper \
- chart2/source/controller/dialogs/RangeSelectionListener \
chart2/source/controller/dialogs/res_BarGeometry \
chart2/source/controller/dialogs/res_DataLabel \
chart2/source/controller/dialogs/res_DataTableProperties \
@@ -130,7 +126,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/dialogs/res_Titles \
chart2/source/controller/dialogs/res_Trendline \
chart2/source/controller/dialogs/TextDirectionListBox \
- chart2/source/controller/dialogs/TimerTriggeredControllerLock \
chart2/source/controller/dialogs/TitleDialogData \
chart2/source/controller/dialogs/tp_3D_SceneAppearance \
chart2/source/controller/dialogs/tp_3D_SceneGeometry \
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index b61390ec42ea..ad204c1ef094 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -62,6 +62,11 @@ $(eval $(call gb_Library_set_componentfile,chartcore,chart2/source/chartcore,ser
# view pieces ...
$(eval $(call gb_Library_add_exception_objects,chartcore,\
+ chart2/source/controller/dialogs/DataBrowserModel \
+ chart2/source/controller/dialogs/DialogModel \
+ chart2/source/controller/dialogs/RangeSelectionHelper \
+ chart2/source/controller/dialogs/RangeSelectionListener \
+ chart2/source/controller/dialogs/TimerTriggeredControllerLock \
chart2/source/view/axes/DateHelper \
chart2/source/view/axes/DateScaling \
chart2/source/view/axes/MinimumAndMaximumSupplier \
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 30182b95eeb8..4af7753dcafa 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 63ec6f31fc16..55f483179880 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 325cffe06773..8711185e742e 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 6c4fe2dfa658..5e8b6526e760 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -743,7 +743,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 883920daa9fb..16a24836df0a 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -33,6 +33,7 @@
#include <Diagram.hxx>
#include <ExplicitCategoriesProvider.hxx>
#include <BaseCoordinateSystem.hxx>
+#include <DataBrowserModel.hxx>
#include <DataSeries.hxx>
#include <com/sun/star/chart2/data/XDataSequence.hpp>
@@ -311,6 +312,7 @@ InternalDataProvider::InternalDataProvider(
{
if (!xModel.is())
return;
+ m_xChartModel = xModel.get();
try
{
rtl::Reference< Diagram > xDiagram( xModel->getFirstChartDiagram() );
@@ -406,6 +408,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 )
@@ -1159,6 +1166,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 )
{