From 16fac85be1fdddb1695a29a9b8026cd4f8cfad64 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Thu, 30 Jun 2022 23:34:19 +0200 Subject: chart2: add "InsertMenuDataTable" action to menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib60a2b061966eb61834480b63dc0653410a43a14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138248 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- chart2/source/controller/inc/ChartController.hxx | 1 + chart2/source/controller/main/ChartController.cxx | 3 +++ .../source/controller/main/ChartController_Insert.cxx | 19 +++++++++++++++++++ .../controller/main/ControllerCommandDispatch.cxx | 1 + chart2/uiconfig/menubar/menubar.xml | 1 + .../data/org/openoffice/Office/UI/ChartCommands.xcu | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index 505b109fdcc7..f0f53c8b8990 100644 --- a/chart2/source/controller/inc/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx @@ -440,6 +440,7 @@ private: void executeDispatch_OpenLegendDialog(); void executeDispatch_InsertAxes(); void executeDispatch_InsertGrid(); + void executeDispatch_OpenInsertDataTableDialog(); void executeDispatch_InsertMenu_DataLabels(); void executeDispatch_InsertMenu_Trendlines(); diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 54c91a6147dd..70b15cf0fd04 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -1169,6 +1169,8 @@ void SAL_CALL ChartController::dispatch( this->executeDispatch_InsertErrorBars(false); else if( aCommand == "InsertMenuYErrorBars" ) this->executeDispatch_InsertErrorBars(true); + else if( aCommand == "InsertMenuDataTable" ) + this->executeDispatch_OpenInsertDataTableDialog(); else if( aCommand == "InsertSymbol" ) this->executeDispatch_InsertSpecialCharacter(); else if( aCommand == "InsertTrendline" ) @@ -1631,6 +1633,7 @@ const o3tl::sorted_vector< OUString >& ChartController::impl_getAvailableCommand "DeleteTrendline", "DeleteMeanValue", "DeleteTrendlineEquation", "DeleteXErrorBars", "DeleteYErrorBars", "DeleteDataLabels", "DeleteDataLabel", + "InsertMenuDataTable", //format objects "FormatSelection", "TransformDialog", "DiagramType", "View3D", diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 4f39f1068cdb..46d00eedb89c 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -155,6 +156,24 @@ void ChartController::executeDispatch_InsertGrid() } } +void ChartController::executeDispatch_OpenInsertDataTableDialog() +{ + rtl::Reference xDiagram = getFirstDiagram(); + SolarMutexGuard aGuard; + if (xDiagram->getDataTable().is()) + { + xDiagram->setDataTable(uno::Reference()); + } + else + { + uno::Reference xDataTable(new DataTable); + if (xDataTable.is()) + { + xDiagram->setDataTable(xDataTable); + } + } +} + void ChartController::executeDispatch_InsertTitles() { UndoGuard aUndoGuard( diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index e5035b4f053c..828d862f4306 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -584,6 +584,7 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[ ".uno:InsertMenuXErrorBars" ] = bIsWritable && m_apModelState->bSupportsStatistics; m_aCommandAvailability[ ".uno:InsertMenuYErrorBars" ] = bIsWritable && m_apModelState->bSupportsStatistics; m_aCommandAvailability[ ".uno:InsertSymbol" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsTextObject; + m_aCommandAvailability[ ".uno:InsertMenuDataTable" ] = bIsWritable; // format objects bool bFormatObjectAvailable = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsFormateableObjectSelected; diff --git a/chart2/uiconfig/menubar/menubar.xml b/chart2/uiconfig/menubar/menubar.xml index 354ebbc1903a..a48cd77d47de 100644 --- a/chart2/uiconfig/menubar/menubar.xml +++ b/chart2/uiconfig/menubar/menubar.xml @@ -56,6 +56,7 @@ + diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu index d3a54a052c8e..cb4a5dc728d0 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu @@ -64,6 +64,11 @@ Y Error ~Bars... + + + Data Table... + + -- cgit