sc/Library_sc.mk | 1 sc/source/ui/docshell/SheetViewOperationsTester.cxx | 124 +------------------ sc/source/ui/docshell/docfunc.cxx | 1 sc/source/ui/inc/SheetViewOperationsTester.hxx | 56 -------- sc/source/ui/inc/operation/Operation.hxx | 1 sc/source/ui/inc/operation/OperationType.hxx | 74 +++++++++++ sc/source/ui/operation/Operation.cxx | 8 - sc/source/ui/operation/OperationType.cxx | 125 ++++++++++++++++++++ 8 files changed, 214 insertions(+), 176 deletions(-)
New commits: commit d31fab07bb7a741437ad208e135a2a56f52fba65 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Tue Feb 17 17:11:44 2026 +0900 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Feb 18 09:36:28 2026 +0100 sc: Extract OperationType from SheetViewOperationsTester It should be part of operation folder, where it belongs together with other operations. Change-Id: I725b8a161aa83d94e98a9bc1ca2f291768c3bfcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199521 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index cdd5fafec742..bd76aadd9249 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -533,6 +533,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/operation/DeleteCellOperation \ sc/source/ui/operation/DeleteContentOperation \ sc/source/ui/operation/Operation \ + sc/source/ui/operation/OperationType \ sc/source/ui/operation/SetEditTextOperation \ sc/source/ui/operation/SetFormulaOperation \ sc/source/ui/operation/SetNormalStringOperation \ diff --git a/sc/source/ui/docshell/SheetViewOperationsTester.cxx b/sc/source/ui/docshell/SheetViewOperationsTester.cxx index 599d28f1d0e8..5e2ddaa2783c 100644 --- a/sc/source/ui/docshell/SheetViewOperationsTester.cxx +++ b/sc/source/ui/docshell/SheetViewOperationsTester.cxx @@ -8,6 +8,8 @@ */ #include <SheetViewOperationsTester.hxx> +#include <operation/Operation.hxx> +#include <operation/OperationType.hxx> #include <SheetViewManager.hxx> #include <docsh.hxx> #include <viewdata.hxx> @@ -20,115 +22,6 @@ namespace sc { namespace { -/** Return operation as string. */ -constexpr std::string_view getOperationName(OperationType eOperation) -{ - switch (eOperation) - { - case OperationType::Unknown: - return "Unknown"; - case OperationType::ApplyAttributes: - return "ApplyAttributes"; - case OperationType::ApplyAttributesWithChangedRange: - return "ApplyAttributesWithChangedRange"; - case OperationType::ApplyAttributesToCell: - return "ApplyAttributesToCell"; - case OperationType::DeleteContent: - return "DeleteContent"; - case OperationType::DeleteCell: - return "DeleteCell"; - case OperationType::TransliterateText: - return "TransliterateText"; - case OperationType::SetNormalString: - return "SetNormalString"; - case OperationType::SetValue: - return "SetValue"; - case OperationType::SetString: - return "SetString"; - case OperationType::SetTextEdit: - return "SetTextEdit"; - case OperationType::SetFormula: - return "SetFormula"; - case OperationType::SetNoteText: - return "SetNoteText"; - case OperationType::ReplaceNoteText: - return "ReplaceNoteText"; - case OperationType::InsertColumnsBefore: - return "InsertColumnsBefore"; - case OperationType::InsertColumnsAfter: - return "InsertColumnsAfter"; - case OperationType::InsertRowsBefore: - return "InsertRowsBefore"; - case OperationType::InsertRowsAfter: - return "InsertRowsAfter"; - case OperationType::InsertCellsDown: - return "InsertCellsDown"; - case OperationType::InsertCellsRight: - return "InsertCellsRight"; - case OperationType::DeleteColumns: - return "DeleteColumns"; - case OperationType::DeleteRows: - return "DeleteRows"; - case OperationType::DeleteCellsLeft: - return "DeleteCellsLeft"; - case OperationType::DeleteCellsUp: - return "DeleteCellsUp"; - case OperationType::MoveBlock: - return "MoveBlock"; - case OperationType::ClearItems: - return "ClearItems"; - case OperationType::ChangeIndent: - return "ChangeIndent"; - case OperationType::AutoFormat: - return "AutoFormat"; - case OperationType::EnterMatrix: - return "EnterMatrix"; - case OperationType::TabOperation: - return "TabOperation"; - case OperationType::FillSimple: - return "FillSimple"; - case OperationType::FillSeries: - return "FillSeries"; - case OperationType::FillAuto: - return "FillAuto"; - case OperationType::MergeCells: - return "MergeCells"; - case OperationType::InsertNameList: - return "InsertNameList"; - case OperationType::ConvertFormulaToValue: - return "ConvertFormulaToValue"; - case OperationType::Sort: - return "Sort"; - case OperationType::Query: - return "Query"; - case OperationType::SubTotals: - return "SubTotals"; - case OperationType::PivotTableUpdate: - return "PivotTableUpdate"; - case OperationType::PivotTableRemove: - return "PivotTableRemove"; - case OperationType::PivotTableCreate: - return "PivotTableCreate"; - case OperationType::SparklineInsert: - return "SparklineInsert"; - case OperationType::SparklineDelete: - return "SparklineDelete"; - case OperationType::SparklineChange: - return "SparklineChange"; - case OperationType::SparklineGroup: - return "SparklineGroup"; - case OperationType::SparklineUngroup: - return "SparklineUngroup"; - case OperationType::SparklineGroupDelete: - return "SparklineGroupDelete"; - case OperationType::SparklineGroupChange: - return "SparklineGroupChange"; - case OperationType::EnterData: - return "EnterData"; - } - return ""; -} - /** Supported operations by sheet view. */ constexpr bool isSupported(OperationType eOperationType) { @@ -233,7 +126,7 @@ bool SheetViewOperationsTester::check(OperationType eOperationType) const if (!pSheetViewManager->isEmpty()) { pSheetViewManager->unsyncAllSheetViews(); - SAL_INFO("sc.ui", "Operation '" << getOperationName(eOperationType) + SAL_INFO("sc.ui", "Operation '" << operationTypeString(eOperationType) << "' unsynced all sheet views for TAB " << nTab); } } @@ -241,14 +134,14 @@ bool SheetViewOperationsTester::check(OperationType eOperationType) const { bool bSupported = isSupported(eOperationType); SAL_INFO_IF(!bSupported, "sc.ui", - "Operation '" << getOperationName(eOperationType) + "Operation '" << operationTypeString(eOperationType) << "' not supported on sheet view '" << nSheetViewID << "'"); if (bSupported && doesUnsyncSheetView(eOperationType)) { std::shared_ptr<sc::SheetView> pSheetView = pSheetViewManager->get(nSheetViewID); pSheetView->unsync(); - SAL_INFO("sc.ui", "Operation '" << getOperationName(eOperationType) + SAL_INFO("sc.ui", "Operation '" << operationTypeString(eOperationType) << "' unsynced sheet view '" << nSheetViewID << "'"); } return bSupported; @@ -257,9 +150,6 @@ bool SheetViewOperationsTester::check(OperationType eOperationType) const return true; } -std::string_view SheetViewOperationsTester::operationName(OperationType eType) -{ - return getOperationName(eType); -} -} +} // end sc namespace + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index f417f18d0a11..b9c15f10770d 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -110,6 +110,7 @@ #include <config_features.h> #include <memory> +#include <operation/OperationType.hxx> #include <operation/DeleteContentOperation.hxx> #include <operation/DeleteCellOperation.hxx> #include <operation/SetNormalStringOperation.hxx> diff --git a/sc/source/ui/inc/SheetViewOperationsTester.hxx b/sc/source/ui/inc/SheetViewOperationsTester.hxx index 250a6fbf2a9f..df674c73a37a 100644 --- a/sc/source/ui/inc/SheetViewOperationsTester.hxx +++ b/sc/source/ui/inc/SheetViewOperationsTester.hxx @@ -15,60 +15,7 @@ class ScViewData; namespace sc { -/** Operations that can be performed on a sheet. */ -enum class OperationType -{ - Unknown, - ApplyAttributes, - ApplyAttributesWithChangedRange, - ApplyAttributesToCell, - DeleteContent, - DeleteCell, - TransliterateText, - SetNormalString, - SetValue, - SetString, - SetTextEdit, - SetFormula, - SetNoteText, - ReplaceNoteText, - InsertColumnsBefore, - InsertColumnsAfter, - InsertRowsBefore, - InsertRowsAfter, - InsertCellsDown, - InsertCellsRight, - DeleteColumns, - DeleteRows, - DeleteCellsLeft, - DeleteCellsUp, - MoveBlock, - ClearItems, - ChangeIndent, - AutoFormat, - EnterMatrix, - TabOperation, - FillSimple, - FillSeries, - FillAuto, - MergeCells, - InsertNameList, - ConvertFormulaToValue, - Sort, - Query, - SubTotals, - PivotTableUpdate, - PivotTableRemove, - PivotTableCreate, - SparklineInsert, - SparklineDelete, - SparklineChange, - SparklineGroup, - SparklineUngroup, - SparklineGroupDelete, - SparklineGroupChange, - EnterData, -}; +enum class OperationType; /** Tester for operations on sheet views and default views * @@ -85,7 +32,6 @@ public: } static bool doesUnsync(OperationType eOperationType); - static std::string_view operationName(OperationType eType); bool check(OperationType eOperationType) const; void sync(); }; diff --git a/sc/source/ui/inc/operation/Operation.hxx b/sc/source/ui/inc/operation/Operation.hxx index 0d98e1b2048e..351ac9ecceb4 100644 --- a/sc/source/ui/inc/operation/Operation.hxx +++ b/sc/source/ui/inc/operation/Operation.hxx @@ -10,6 +10,7 @@ #pragma once #include <SheetViewOperationsTester.hxx> +#include <operation/OperationType.hxx> class ScMarkData; class ScAddress; diff --git a/sc/source/ui/inc/operation/OperationType.hxx b/sc/source/ui/inc/operation/OperationType.hxx new file mode 100644 index 000000000000..522095acf674 --- /dev/null +++ b/sc/source/ui/inc/operation/OperationType.hxx @@ -0,0 +1,74 @@ +/* -*- 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 <string_view> + +#pragma once + +namespace sc +{ +/** Operations that can be performed on a sheet. */ +enum class OperationType +{ + Unknown, + ApplyAttributes, + ApplyAttributesWithChangedRange, + ApplyAttributesToCell, + DeleteContent, + DeleteCell, + TransliterateText, + SetNormalString, + SetValue, + SetString, + SetTextEdit, + SetFormula, + SetNoteText, + ReplaceNoteText, + InsertColumnsBefore, + InsertColumnsAfter, + InsertRowsBefore, + InsertRowsAfter, + InsertCellsDown, + InsertCellsRight, + DeleteColumns, + DeleteRows, + DeleteCellsLeft, + DeleteCellsUp, + MoveBlock, + ClearItems, + ChangeIndent, + AutoFormat, + EnterMatrix, + TabOperation, + FillSimple, + FillSeries, + FillAuto, + MergeCells, + InsertNameList, + ConvertFormulaToValue, + Sort, + Query, + SubTotals, + PivotTableUpdate, + PivotTableRemove, + PivotTableCreate, + SparklineInsert, + SparklineDelete, + SparklineChange, + SparklineGroup, + SparklineUngroup, + SparklineGroupDelete, + SparklineGroupChange, + EnterData, +}; + +std::string_view operationTypeString(OperationType eType); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/operation/Operation.cxx b/sc/source/ui/operation/Operation.cxx index e843393a50d4..a10877954296 100644 --- a/sc/source/ui/operation/Operation.cxx +++ b/sc/source/ui/operation/Operation.cxx @@ -8,6 +8,7 @@ */ #include <operation/Operation.hxx> +#include <operation/OperationType.hxx> #include <SheetViewOperationsTester.hxx> #include <docsh.hxx> #include <markdata.hxx> @@ -179,11 +180,10 @@ bool Operation::checkSheetViewProtection() bool Operation::run() { - SAL_INFO("sc.op", - "Running operation '" << SheetViewOperationsTester::operationName(meType) << "'."); + SAL_INFO("sc.op", "Running operation '" << operationTypeString(meType) << "'."); bool bResult = runImplementation(); - SAL_INFO("sc.op", "Operation '" << SheetViewOperationsTester::operationName(meType) - << (bResult ? "' succeded." : "' failed.")); + SAL_INFO("sc.op", "Operation '" << operationTypeString(meType) + << (bResult ? "' succeeded." : "' failed.")); return bResult; } } diff --git a/sc/source/ui/operation/OperationType.cxx b/sc/source/ui/operation/OperationType.cxx new file mode 100644 index 000000000000..8dc3b06d629c --- /dev/null +++ b/sc/source/ui/operation/OperationType.cxx @@ -0,0 +1,125 @@ +/* -*- 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 <operation/OperationType.hxx> + +namespace sc +{ +/** Return operation type as string. */ +std::string_view operationTypeString(OperationType eOperation) +{ + switch (eOperation) + { + case OperationType::Unknown: + return "Unknown"; + case OperationType::ApplyAttributes: + return "ApplyAttributes"; + case OperationType::ApplyAttributesWithChangedRange: + return "ApplyAttributesWithChangedRange"; + case OperationType::ApplyAttributesToCell: + return "ApplyAttributesToCell"; + case OperationType::DeleteContent: + return "DeleteContent"; + case OperationType::DeleteCell: + return "DeleteCell"; + case OperationType::TransliterateText: + return "TransliterateText"; + case OperationType::SetNormalString: + return "SetNormalString"; + case OperationType::SetValue: + return "SetValue"; + case OperationType::SetString: + return "SetString"; + case OperationType::SetTextEdit: + return "SetTextEdit"; + case OperationType::SetFormula: + return "SetFormula"; + case OperationType::SetNoteText: + return "SetNoteText"; + case OperationType::ReplaceNoteText: + return "ReplaceNoteText"; + case OperationType::InsertColumnsBefore: + return "InsertColumnsBefore"; + case OperationType::InsertColumnsAfter: + return "InsertColumnsAfter"; + case OperationType::InsertRowsBefore: + return "InsertRowsBefore"; + case OperationType::InsertRowsAfter: + return "InsertRowsAfter"; + case OperationType::InsertCellsDown: + return "InsertCellsDown"; + case OperationType::InsertCellsRight: + return "InsertCellsRight"; + case OperationType::DeleteColumns: + return "DeleteColumns"; + case OperationType::DeleteRows: + return "DeleteRows"; + case OperationType::DeleteCellsLeft: + return "DeleteCellsLeft"; + case OperationType::DeleteCellsUp: + return "DeleteCellsUp"; + case OperationType::MoveBlock: + return "MoveBlock"; + case OperationType::ClearItems: + return "ClearItems"; + case OperationType::ChangeIndent: + return "ChangeIndent"; + case OperationType::AutoFormat: + return "AutoFormat"; + case OperationType::EnterMatrix: + return "EnterMatrix"; + case OperationType::TabOperation: + return "TabOperation"; + case OperationType::FillSimple: + return "FillSimple"; + case OperationType::FillSeries: + return "FillSeries"; + case OperationType::FillAuto: + return "FillAuto"; + case OperationType::MergeCells: + return "MergeCells"; + case OperationType::InsertNameList: + return "InsertNameList"; + case OperationType::ConvertFormulaToValue: + return "ConvertFormulaToValue"; + case OperationType::Sort: + return "Sort"; + case OperationType::Query: + return "Query"; + case OperationType::SubTotals: + return "SubTotals"; + case OperationType::PivotTableUpdate: + return "PivotTableUpdate"; + case OperationType::PivotTableRemove: + return "PivotTableRemove"; + case OperationType::PivotTableCreate: + return "PivotTableCreate"; + case OperationType::SparklineInsert: + return "SparklineInsert"; + case OperationType::SparklineDelete: + return "SparklineDelete"; + case OperationType::SparklineChange: + return "SparklineChange"; + case OperationType::SparklineGroup: + return "SparklineGroup"; + case OperationType::SparklineUngroup: + return "SparklineUngroup"; + case OperationType::SparklineGroupDelete: + return "SparklineGroupDelete"; + case OperationType::SparklineGroupChange: + return "SparklineGroupChange"; + case OperationType::EnterData: + return "EnterData"; + } + return ""; +} + +} // end sc namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
