diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-06-30 23:34:19 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-08-14 19:37:42 +0200 |
commit | 16fac85be1fdddb1695a29a9b8026cd4f8cfad64 (patch) | |
tree | 7b35c6967b8abc6e89b85ca60bf855ff0dbb5236 | |
parent | e727820149535e6bc99b9342ad826c498d196c7c (diff) |
chart2: add "InsertMenuDataTable" action to menu
Change-Id: Ib60a2b061966eb61834480b63dc0653410a43a14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138248
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
6 files changed, 30 insertions, 0 deletions
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 <ObjectNameProvider.hxx> #include <Legend.hxx> #include <LegendHelper.hxx> +#include <DataTable.hxx> #include <RegressionCurveModel.hxx> #include <com/sun/star/chart2/XRegressionCurve.hpp> @@ -155,6 +156,24 @@ void ChartController::executeDispatch_InsertGrid() } } +void ChartController::executeDispatch_OpenInsertDataTableDialog() +{ + rtl::Reference<Diagram> xDiagram = getFirstDiagram(); + SolarMutexGuard aGuard; + if (xDiagram->getDataTable().is()) + { + xDiagram->setDataTable(uno::Reference<chart2::XDataTable>()); + } + else + { + uno::Reference<chart2::XDataTable> 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 @@ <menu:menuitem menu:id=".uno:InsertMenuLegend"/> <menu:menuitem menu:id=".uno:InsertMenuAxes"/> <menu:menuitem menu:id=".uno:InsertMenuGrids"/> + <menu:menuitem menu:id=".uno:InsertMenuDataTable"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:InsertMenuDataLabels"/> <menu:menuitem menu:id=".uno:InsertMenuTrendlines"/> 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 @@ <value xml:lang="en-US">Y Error ~Bars...</value> </prop> </node> + <node oor:name=".uno:InsertMenuDataTable" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Data Table...</value> + </prop> + </node> <!-- Menu - Format --> <node oor:name=".uno:FormatSelection" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> |