sc/source/ui/docshell/SheetViewOperationsTester.cxx | 120 ++++++++++---------- sc/source/ui/docshell/dbdocfun.cxx | 16 +- sc/source/ui/docshell/docfunc.cxx | 76 ++++++------ sc/source/ui/inc/SheetViewOperationsTester.hxx | 4 sc/source/ui/inc/dbdocfun.hxx | 4 sc/source/ui/inc/docfunc.hxx | 4 sc/source/ui/inc/viewfunc.hxx | 4 sc/source/ui/view/viewfunc.cxx | 6 - 8 files changed, 119 insertions(+), 115 deletions(-)
New commits: commit f1e2ddfd3094692876aa709050dcf58975a349dd Author: Tomaž Vajngerl <[email protected]> AuthorDate: Tue Jan 27 16:13:03 2026 +0900 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Jan 28 09:03:16 2026 +0100 sc: rename Operation to OperationType As we want to introduce an Operation abstract class and make each operation derive from this one in a followup commit. Change-Id: Ifb9a6c39eab4dadc5968a69d832a3517bd305bf2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198188 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sc/source/ui/docshell/SheetViewOperationsTester.cxx b/sc/source/ui/docshell/SheetViewOperationsTester.cxx index 6b5469159173..91f6cd0e4c11 100644 --- a/sc/source/ui/docshell/SheetViewOperationsTester.cxx +++ b/sc/source/ui/docshell/SheetViewOperationsTester.cxx @@ -18,122 +18,126 @@ namespace sc namespace { /** Return operation as string. */ -constexpr std::string_view getOperationName(Operation eOperation) +constexpr std::string_view getOperationName(OperationType eOperation) { switch (eOperation) { - case Operation::Unknown: + case OperationType::Unknown: return "Unknown"; - case Operation::DeleteContent: + case OperationType::DeleteContent: return "DeleteContent"; - case Operation::DeleteCell: + case OperationType::DeleteCell: return "DeleteCell"; - case Operation::TransliterateText: + case OperationType::TransliterateText: return "TransliterateText"; - case Operation::SetNormalString: + case OperationType::SetNormalString: return "SetNormalString"; - case Operation::SetNoteText: + case OperationType::SetNoteText: return "SetNoteText"; - case Operation::ReplaceNoteText: + case OperationType::ReplaceNoteText: return "ReplaceNoteText"; - case Operation::InsertColumnsBefore: + case OperationType::InsertColumnsBefore: return "InsertColumnsBefore"; - case Operation::InsertColumnsAfter: + case OperationType::InsertColumnsAfter: return "InsertColumnsAfter"; - case Operation::InsertRowsBefore: + case OperationType::InsertRowsBefore: return "InsertRowsBefore"; - case Operation::InsertRowsAfter: + case OperationType::InsertRowsAfter: return "InsertRowsAfter"; - case Operation::InsertCellsDown: + case OperationType::InsertCellsDown: return "InsertCellsDown"; - case Operation::InsertCellsRight: + case OperationType::InsertCellsRight: return "InsertCellsRight"; - case Operation::DeleteColumns: + case OperationType::DeleteColumns: return "DeleteColumns"; - case Operation::DeleteRows: + case OperationType::DeleteRows: return "DeleteRows"; - case Operation::DeleteCellsLeft: + case OperationType::DeleteCellsLeft: return "DeleteCellsLeft"; - case Operation::DeleteCellsUp: + case OperationType::DeleteCellsUp: return "DeleteCellsUp"; - case Operation::MoveBlock: + case OperationType::MoveBlock: return "MoveBlock"; - case Operation::ClearItems: + case OperationType::ClearItems: return "ClearItems"; - case Operation::ChangeIndent: + case OperationType::ChangeIndent: return "ChangeIndent"; - case Operation::AutoFormat: + case OperationType::AutoFormat: return "AutoFormat"; - case Operation::EnterMatrix: + case OperationType::EnterMatrix: return "EnterMatrix"; - case Operation::TabOperation: + case OperationType::TabOperation: return "TabOperation"; - case Operation::FillSimple: + case OperationType::FillSimple: return "FillSimple"; - case Operation::FillSeries: + case OperationType::FillSeries: return "FillSeries"; - case Operation::FillAuto: + case OperationType::FillAuto: return "FillAuto"; - case Operation::MergeCells: + case OperationType::MergeCells: return "MergeCells"; - case Operation::InsertNameList: + case OperationType::InsertNameList: return "InsertNameList"; - case Operation::ConvertFormulaToValue: + case OperationType::ConvertFormulaToValue: return "ConvertFormulaToValue"; - case Operation::Sort: + case OperationType::Sort: return "Sort"; - case Operation::Query: + case OperationType::Query: return "Query"; - case Operation::SubTotals: + case OperationType::SubTotals: return "SubTotals"; - case Operation::PivotTableUpdate: + case OperationType::PivotTableUpdate: return "PivotTableUpdate"; - case Operation::PivotTableRemove: + case OperationType::PivotTableRemove: return "PivotTableRemove"; - case Operation::PivotTableCreate: + case OperationType::PivotTableCreate: return "PivotTableCreate"; - case Operation::SparklineInsert: + case OperationType::SparklineInsert: return "SparklineInsert"; - case Operation::SparklineDelete: + case OperationType::SparklineDelete: return "SparklineDelete"; - case Operation::SparklineChange: + case OperationType::SparklineChange: return "SparklineChange"; - case Operation::SparklineGroup: + case OperationType::SparklineGroup: return "SparklineGroup"; - case Operation::SparklineUngroup: + case OperationType::SparklineUngroup: return "SparklineUngroup"; - case Operation::SparklineGroupDelete: + case OperationType::SparklineGroupDelete: return "SparklineGroupDelete"; - case Operation::SparklineGroupChange: + case OperationType::SparklineGroupChange: return "SparklineGroupChange"; - case Operation::EnterData: + case OperationType::EnterData: return "EnterData"; } return ""; } /** Supported operations by sheet view. */ -constexpr bool isSupported(Operation eOperation) +constexpr bool isSupported(OperationType eOperationType) { - return eOperation == Operation::EnterData || eOperation == Operation::SetNormalString - || eOperation == Operation::Sort; + return eOperationType == OperationType::EnterData + || eOperationType == OperationType::SetNormalString + || eOperationType == OperationType::Sort; } /** Operations on default view that unsync all the sheet views. */ -constexpr bool doesUnsycAllSheetView(Operation eOperation) +constexpr bool doesUnsyncAllSheetView(OperationType eOperationType) { - bool bOperationAllowed - = eOperation == Operation::EnterData || eOperation == Operation::SetNormalString; + bool bOperationAllowed = eOperationType == OperationType::EnterData + || eOperationType == OperationType::SetNormalString; return !bOperationAllowed; } /** Operations that unsync the current sheet view. */ -constexpr bool doesUnsycSheetView(Operation eOperation) { return eOperation == Operation::Sort; } +constexpr bool doesUnsyncSheetView(OperationType eOperationType) +{ + return eOperationType == OperationType::Sort; +} } // end anonymous namespace -bool SheetViewOperationsTester::check(Operation eOperation) const +bool SheetViewOperationsTester::check(OperationType eOperationType) const { if (!mpViewData) return true; @@ -149,28 +153,28 @@ bool SheetViewOperationsTester::check(Operation eOperation) const std::shared_ptr<sc::SheetViewManager> pSheetViewManager = rDocument.GetSheetViewManager(nTab); - if (nSheetViewID == sc::DefaultSheetViewID && doesUnsycAllSheetView(eOperation)) + if (nSheetViewID == sc::DefaultSheetViewID && doesUnsyncAllSheetView(eOperationType)) { // Only unsync if there are sheet views. if (!pSheetViewManager->isEmpty()) { pSheetViewManager->unsyncAllSheetViews(); - SAL_INFO("sc.ui", "Operation '" << getOperationName(eOperation) + SAL_INFO("sc.ui", "Operation '" << getOperationName(eOperationType) << "' unsynced all sheet views for TAB " << nTab); } } else { - bool bSupported = isSupported(eOperation); + bool bSupported = isSupported(eOperationType); SAL_INFO_IF(!bSupported, "sc.ui", - "Operation '" << getOperationName(eOperation) + "Operation '" << getOperationName(eOperationType) << "' not supported on sheet view '" << nSheetViewID << "'"); - if (bSupported && doesUnsycSheetView(eOperation)) + if (bSupported && doesUnsyncSheetView(eOperationType)) { std::shared_ptr<sc::SheetView> pSheetView = pSheetViewManager->get(nSheetViewID); pSheetView->unsync(); - SAL_INFO("sc.ui", "Operation '" << getOperationName(eOperation) + SAL_INFO("sc.ui", "Operation '" << getOperationName(eOperationType) << "' unsynced sheet view '" << nSheetViewID << "'"); } return bSupported; diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 3ce7476563d4..b9baf4131982 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -63,7 +63,7 @@ using namespace ::com::sun::star; -bool ScDBDocFunc::CheckSheetViewProtection(sc::Operation eOperation) +bool ScDBDocFunc::CheckSheetViewProtection(sc::OperationType eOperation) { sc::SheetViewOperationsTester aSheetViewTester(ScDocShell::GetViewData()); return aSheetViewTester.check(eOperation); @@ -658,7 +658,7 @@ bool ScDBDocFunc::SortTab(SCTAB nTab, const ScSortParam& rSortParam, bool bRecor nStartingColToEdit++; } - if (!CheckSheetViewProtection(sc::Operation::Sort)) + if (!CheckSheetViewProtection(sc::OperationType::Sort)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestBlock( @@ -889,7 +889,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, return false; } - if (!CheckSheetViewProtection(sc::Operation::Query)) + if (!CheckSheetViewProtection(sc::OperationType::Query)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestBlock(rDoc, nDestTab, @@ -1213,7 +1213,7 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam, return; } - if (!CheckSheetViewProtection(sc::Operation::SubTotals)) + if (!CheckSheetViewProtection(sc::OperationType::SubTotals)) return; ScEditableTester aTester = ScEditableTester::CreateAndTestBlock(rDoc, nTab, 0, rParam.nRow1 + 1, rDoc.MaxCol(), rDoc.MaxRow()); @@ -1587,7 +1587,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb aRanges.push_back(pOldObj->GetOutRange()); aRanges.push_back(ScRange(pNewObj->GetOutRange().aStart)); // at least one cell in the output position must be editable. - if (!CheckSheetViewProtection(sc::Operation::PivotTableUpdate)) + if (!CheckSheetViewProtection(sc::OperationType::PivotTableUpdate)) return false; if (!isEditable(rDocShell, aRanges, bApi)) @@ -1672,7 +1672,7 @@ bool ScDBDocFunc::RemovePivotTable(const ScDPObject& rDPObj, bool bRecord, bool ScDocShellModificator aModificator(rDocShell); weld::WaitObject aWait(ScDocShell::GetActiveDialogParent()); - if (!CheckSheetViewProtection(sc::Operation::PivotTableRemove)) + if (!CheckSheetViewProtection(sc::OperationType::PivotTableRemove)) return false; if (!isEditable(rDocShell, rDPObj.GetOutRange(), bApi)) @@ -1757,7 +1757,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool ScDocShellModificator aModificator(rDocShell); weld::WaitObject aWait(ScDocShell::GetActiveDialogParent()); - if (!CheckSheetViewProtection(sc::Operation::PivotTableCreate)) + if (!CheckSheetViewProtection(sc::OperationType::PivotTableCreate)) return false; // At least one cell in the output range should be editable. Check in advance. @@ -1872,7 +1872,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) ScDocShellModificator aModificator( rDocShell ); weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); - if (!CheckSheetViewProtection(sc::Operation::PivotTableUpdate)) + if (!CheckSheetViewProtection(sc::OperationType::PivotTableUpdate)) return false; if (!isEditable(rDocShell, rDPObj.GetOutRange(), bApi, sc::EditAction::UpdatePivotTable)) diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 0d2cbb273ba0..08d9c71e5ec0 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -120,7 +120,7 @@ using ::std::vector; #define AUTOFORMAT_WARN_SIZE 0x10ffffUL -bool ScDocFunc::CheckSheetViewProtection(sc::Operation eOperation) +bool ScDocFunc::CheckSheetViewProtection(sc::OperationType eOperation) { sc::SheetViewOperationsTester aSheetViewTester(ScDocShell::GetViewData()); return aSheetViewTester.check(eOperation); @@ -605,7 +605,7 @@ bool ScDocFunc::DeleteContents( if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; - if (!CheckSheetViewProtection(sc::Operation::DeleteContent)) + if (!CheckSheetViewProtection(sc::OperationType::DeleteContent)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestSelection(rDoc, rMark); @@ -711,7 +711,7 @@ bool ScDocFunc::DeleteCell( if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; - if (!CheckSheetViewProtection(sc::Operation::DeleteCell)) + if (!CheckSheetViewProtection(sc::OperationType::DeleteCell)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestSelectedBlock(rDoc, rPos.Col(), rPos.Row(), rPos.Col(), rPos.Row(), rMark); @@ -782,7 +782,7 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, TransliterationFlags if (!rDoc.IsUndoEnabled()) bRecord = false; - if (!CheckSheetViewProtection(sc::Operation::TransliterateText)) + if (!CheckSheetViewProtection(sc::OperationType::TransliterateText)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestSelection(rDoc, rMark); @@ -840,7 +840,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con bool bUndo(rDoc.IsUndoEnabled()); - if (!CheckSheetViewProtection(sc::Operation::SetNormalString)) + if (!CheckSheetViewProtection(sc::OperationType::SetNormalString)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestBlock(rDoc, rPos.Tab(), rPos.Col(), rPos.Row(), rPos.Col(), rPos.Row()); @@ -1362,7 +1362,7 @@ void ScDocFunc::SetNoteText( const ScAddress& rPos, const OUString& rText, bool ScDocument& rDoc = rDocShell.GetDocument(); - if (!CheckSheetViewProtection(sc::Operation::SetNoteText)) + if (!CheckSheetViewProtection(sc::OperationType::SetNoteText)) return; ScEditableTester aTester = ScEditableTester::CreateAndTestBlock(rDoc, rPos.Tab(), rPos.Col(), rPos.Row(), rPos.Col(), rPos.Row()); @@ -1391,7 +1391,7 @@ void ScDocFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, c ScDocShellModificator aModificator( rDocShell ); ScDocument& rDoc = rDocShell.GetDocument(); - if (!CheckSheetViewProtection(sc::Operation::ReplaceNoteText)) + if (!CheckSheetViewProtection(sc::OperationType::ReplaceNoteText)) return; ScEditableTester aTester = ScEditableTester::CreateAndTestBlock(rDoc, rPos.Tab(), rPos.Col(), rPos.Row(), rPos.Col(), rPos.Row()); @@ -1928,34 +1928,34 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, SCROW nEditTestEndRow = (eCmd==INS_INSROWS_BEFORE || eCmd==INS_INSROWS_AFTER) ? rDoc.MaxRow() : nMergeTestEndRow; ScEditableTester aTester; - sc::Operation eOperation = sc::Operation::Unknown; + sc::OperationType eOperation = sc::OperationType::Unknown; switch (eCmd) { case INS_INSCOLS_BEFORE: - eOperation = sc::Operation::InsertColumnsBefore; + eOperation = sc::OperationType::InsertColumnsBefore; aTester = ScEditableTester::CreateAndTestBlockForAction( rDoc, sc::EditAction::InsertColumnsBefore, nMergeTestStartCol, 0, nMergeTestEndCol, rDoc.MaxRow(), aMark); break; case INS_INSCOLS_AFTER: - eOperation = sc::Operation::InsertColumnsBefore; + eOperation = sc::OperationType::InsertColumnsBefore; aTester = ScEditableTester::CreateAndTestBlockForAction( rDoc, sc::EditAction::InsertColumnsAfter, nMergeTestStartCol, 0, nMergeTestEndCol, rDoc.MaxRow(), aMark); break; case INS_INSROWS_BEFORE: - eOperation = sc::Operation::InsertRowsBefore; + eOperation = sc::OperationType::InsertRowsBefore; aTester = ScEditableTester::CreateAndTestBlockForAction( rDoc, sc::EditAction::InsertRowsBefore, 0, nMergeTestStartRow, rDoc.MaxCol(), nMergeTestEndRow, aMark); break; case INS_INSROWS_AFTER: - eOperation = sc::Operation::InsertRowsAfter; + eOperation = sc::OperationType::InsertRowsAfter; aTester = ScEditableTester::CreateAndTestBlockForAction( rDoc, sc::EditAction::InsertRowsAfter, 0, nMergeTestStartRow, rDoc.MaxCol(), nMergeTestEndRow, aMark); break; default: if (eCmd == INS_CELLSDOWN) - eOperation = sc::Operation::InsertCellsDown; + eOperation = sc::OperationType::InsertCellsDown; else if (eCmd == INS_CELLSRIGHT) - eOperation = sc::Operation::InsertCellsRight; + eOperation = sc::OperationType::InsertCellsRight; aTester = ScEditableTester::CreateAndTestSelectedBlock( rDoc, nMergeTestStartCol, nMergeTestStartRow, nEditTestEndCol, nEditTestEndRow, aMark); @@ -2443,24 +2443,24 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, nEditTestEndY = rDoc.MaxRow(); ScEditableTester aTester; - sc::Operation eOperation = sc::Operation::Unknown; + sc::OperationType eOperation = sc::OperationType::Unknown; switch (eCmd) { case DelCellCmd::Cols: - eOperation = sc::Operation::DeleteColumns; + eOperation = sc::OperationType::DeleteColumns; aTester = ScEditableTester::CreateAndTestBlockForAction( rDoc, sc::EditAction::DeleteColumns, nUndoStartCol, 0, nUndoEndCol, rDoc.MaxRow(), aMark); break; case DelCellCmd::Rows: - eOperation = sc::Operation::DeleteRows; + eOperation = sc::OperationType::DeleteRows; aTester = ScEditableTester::CreateAndTestBlockForAction( rDoc, sc::EditAction::DeleteRows, 0, nUndoStartRow, rDoc.MaxCol(), nUndoEndRow, aMark); break; default: if (eCmd == DelCellCmd::CellsLeft) - eOperation = sc::Operation::DeleteCellsLeft; + eOperation = sc::OperationType::DeleteCellsLeft; else if (eCmd == DelCellCmd::CellsUp) - eOperation = sc::Operation::DeleteCellsUp; + eOperation = sc::OperationType::DeleteCellsUp; aTester = ScEditableTester::CreateAndTestSelectedBlock( rDoc, nUndoStartCol, nUndoStartRow, nEditTestEndX, nEditTestEndY, aMark); @@ -3023,7 +3023,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, return false; } - if (!CheckSheetViewProtection(sc::Operation::MoveBlock)) + if (!CheckSheetViewProtection(sc::OperationType::MoveBlock)) return false; // Test for cell protection @@ -4175,7 +4175,7 @@ void ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b ScDocument& rDoc = rDocShell.GetDocument(); bool bUndo (rDoc.IsUndoEnabled()); - if (!CheckSheetViewProtection(sc::Operation::ClearItems)) + if (!CheckSheetViewProtection(sc::OperationType::ClearItems)) return; ScEditableTester aTester = ScEditableTester::CreateAndTestSelection(rDoc, rMark); @@ -4223,7 +4223,7 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp ScDocument& rDoc = rDocShell.GetDocument(); bool bUndo(rDoc.IsUndoEnabled()); - if (!CheckSheetViewProtection(sc::Operation::ChangeIndent)) + if (!CheckSheetViewProtection(sc::OperationType::ChangeIndent)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestSelection(rDoc, rMark); @@ -4316,7 +4316,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark, ScAutoFormat* pAutoFormat = ScGlobal::GetOrCreateAutoFormat(); - if (!CheckSheetViewProtection(sc::Operation::AutoFormat)) + if (!CheckSheetViewProtection(sc::OperationType::AutoFormat)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestSelectedBlock(rDoc, nStartCol, nStartRow, nEndCol, nEndRow, aMark); @@ -4441,7 +4441,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark, aMark.SelectTable( nTab, true ); } - if (!CheckSheetViewProtection(sc::Operation::EnterMatrix)) + if (!CheckSheetViewProtection(sc::OperationType::EnterMatrix)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestSelectedBlock(rDoc, nStartCol, nStartRow, nEndCol, nEndRow, aMark); @@ -4531,7 +4531,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark, aMark.SelectTable( nTab, true ); } - if (!CheckSheetViewProtection(sc::Operation::TabOperation)) + if (!CheckSheetViewProtection(sc::OperationType::TabOperation)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestSelectedBlock(rDoc, nStartCol, nStartRow, nEndCol, nEndRow, aMark); @@ -4678,7 +4678,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark, aMark.SelectTable( nTab, true ); } - if (!CheckSheetViewProtection(sc::Operation::FillSimple)) + if (!CheckSheetViewProtection(sc::OperationType::FillSimple)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestSelectedBlock(rDoc, nStartCol, nStartRow, nEndCol, nEndRow, aMark); @@ -4794,7 +4794,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark, aMark.SelectTable( nTab, true ); } - if (!CheckSheetViewProtection(sc::Operation::FillSeries)) + if (!CheckSheetViewProtection(sc::OperationType::FillSeries)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestSelectedBlock(rDoc, nStartCol, nStartRow, nEndCol, nEndRow, aMark); @@ -4965,7 +4965,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e break; } - if (!CheckSheetViewProtection(sc::Operation::FillAuto)) + if (!CheckSheetViewProtection(sc::OperationType::FillAuto)) return false; // Test for cell protection @@ -5070,7 +5070,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; - if (!CheckSheetViewProtection(sc::Operation::MergeCells)) + if (!CheckSheetViewProtection(sc::OperationType::MergeCells)) return false; for (const auto& rTab : rOption.maTabs) @@ -5515,7 +5515,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi ) SCCOL nEndCol = nStartCol + 1; SCROW nEndRow = nStartRow + static_cast<SCROW>(nValidCount) - 1; - if (!CheckSheetViewProtection(sc::Operation::InsertNameList)) + if (!CheckSheetViewProtection(sc::OperationType::InsertNameList)) return false; ScEditableTester aTester = ScEditableTester::CreateAndTestBlock(rDoc, nTab, nStartCol, nStartRow, nEndCol, nEndRow); @@ -5832,7 +5832,7 @@ void ScDocFunc::ConvertFormulaToValue( const ScRange& rRange, bool bInteraction if (!rDoc.IsUndoEnabled()) bRecord = false; - if (!CheckSheetViewProtection(sc::Operation::ConvertFormulaToValue)) + if (!CheckSheetViewProtection(sc::OperationType::ConvertFormulaToValue)) return; ScEditableTester aTester = ScEditableTester::CreateAndTestRange(rDoc, rRange, sc::EditAction::Unknown); @@ -5877,7 +5877,7 @@ void ScDocFunc::EndListAction() bool ScDocFunc::InsertSparklines(ScRange const& rDataRange, ScRange const& rSparklineRange, const std::shared_ptr<sc::SparklineGroup>& pSparklineGroup) { - if (!CheckSheetViewProtection(sc::Operation::SparklineInsert)) + if (!CheckSheetViewProtection(sc::OperationType::SparklineInsert)) return false; std::vector<sc::SparklineData> aSparklineDataVector; @@ -5963,7 +5963,7 @@ bool ScDocFunc::DeleteSparkline(ScAddress const& rAddress) if (!rDocument.HasSparkline(rAddress)) return false; - if (!CheckSheetViewProtection(sc::Operation::SparklineDelete)) + if (!CheckSheetViewProtection(sc::OperationType::SparklineDelete)) return false; @@ -5985,7 +5985,7 @@ bool ScDocFunc::DeleteSparklineGroup(std::shared_ptr<sc::SparklineGroup> const& if (!rDocument.HasTable(nTab)) return false; - if (!CheckSheetViewProtection(sc::Operation::SparklineGroupDelete)) + if (!CheckSheetViewProtection(sc::OperationType::SparklineGroupDelete)) return false; auto pUndo = std::make_unique<sc::UndoDeleteSparklineGroup>(rDocShell, pSparklineGroup, nTab); @@ -5998,7 +5998,7 @@ bool ScDocFunc::DeleteSparklineGroup(std::shared_ptr<sc::SparklineGroup> const& bool ScDocFunc::ChangeSparklineGroupAttributes(std::shared_ptr<sc::SparklineGroup> const& pExistingSparklineGroup, sc::SparklineAttributes const& rNewAttributes) { - if (!CheckSheetViewProtection(sc::Operation::SparklineGroupChange)) + if (!CheckSheetViewProtection(sc::OperationType::SparklineGroupChange)) return false; @@ -6011,7 +6011,7 @@ bool ScDocFunc::ChangeSparklineGroupAttributes(std::shared_ptr<sc::SparklineGrou bool ScDocFunc::GroupSparklines(ScRange const& rRange, std::shared_ptr<sc::SparklineGroup> const& rpGroup) { - if (!CheckSheetViewProtection(sc::Operation::SparklineGroup)) + if (!CheckSheetViewProtection(sc::OperationType::SparklineGroup)) return false; auto pUndo = std::make_unique<sc::UndoGroupSparklines>(rDocShell, rRange, rpGroup); @@ -6023,7 +6023,7 @@ bool ScDocFunc::GroupSparklines(ScRange const& rRange, std::shared_ptr<sc::Spark bool ScDocFunc::UngroupSparklines(ScRange const& rRange) { - if (!CheckSheetViewProtection(sc::Operation::SparklineUngroup)) + if (!CheckSheetViewProtection(sc::OperationType::SparklineUngroup)) return false; auto pUndo = std::make_unique<sc::UndoUngroupSparklines>(rDocShell, rRange); @@ -6035,7 +6035,7 @@ bool ScDocFunc::UngroupSparklines(ScRange const& rRange) bool ScDocFunc::ChangeSparkline(std::shared_ptr<sc::Sparkline> const& rpSparkline, SCTAB nTab, ScRangeList const& rDataRange) { - if (!CheckSheetViewProtection(sc::Operation::SparklineChange)) + if (!CheckSheetViewProtection(sc::OperationType::SparklineChange)) return false; auto pUndo = std::make_unique<sc::UndoEditSparkline>(rDocShell, rpSparkline, nTab, rDataRange); diff --git a/sc/source/ui/inc/SheetViewOperationsTester.hxx b/sc/source/ui/inc/SheetViewOperationsTester.hxx index 21a1ac00ac34..1c25fba0e2ed 100644 --- a/sc/source/ui/inc/SheetViewOperationsTester.hxx +++ b/sc/source/ui/inc/SheetViewOperationsTester.hxx @@ -16,7 +16,7 @@ class ScViewData; namespace sc { /** Operations that can be performed on a sheet. */ -enum class Operation +enum class OperationType { Unknown, DeleteContent, @@ -77,7 +77,7 @@ public: { } - bool check(Operation eOperation) const; + bool check(OperationType eOperationType) const; }; } diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx index 27e113f9cc89..3639c2d0347c 100644 --- a/sc/source/ui/inc/dbdocfun.hxx +++ b/sc/source/ui/inc/dbdocfun.hxx @@ -41,7 +41,7 @@ namespace svx { } namespace sc { - enum class Operation; + enum class OperationType; } class ScDBDocFunc @@ -50,7 +50,7 @@ friend class ScDBFunc; private: ScDocShell& rDocShell; - static bool CheckSheetViewProtection(sc::Operation eOperation); + static bool CheckSheetViewProtection(sc::OperationType eOperation); public: ScDBDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {} diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index 08f4991e07db..eb3b8d4b2e5a 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -58,7 +58,7 @@ namespace sc class SparklineAttributes; class SparklineGroup; class Sparkline; - enum class Operation; + enum class OperationType; } namespace tools { @@ -68,7 +68,7 @@ namespace tools class ScDocFunc { ScDocShell& rDocShell; - static bool CheckSheetViewProtection(sc::Operation eOperation); + static bool CheckSheetViewProtection(sc::OperationType eOperation); protected: bool AdjustRowHeight( const ScRange& rRange, bool bPaint, bool bApi ); diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 55249ad75ea8..23a3a9eef6f6 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -53,7 +53,7 @@ namespace com::sun::star::embed { class XEmbeddedObject; } namespace sc { struct ColRowSpan; - enum class Operation; + enum class OperationType; } namespace com::sun::star::datatransfer { class XTransferable; } @@ -417,7 +417,7 @@ private: void CopyAutoSpellData( FillDir eDir, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_uLong nCount ); - bool CheckSheetViewProtection(sc::Operation eOperation); + bool CheckSheetViewProtection(sc::OperationType eOperationType); }; extern bool bPasteIsMove; diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index b79d88b420ea..23d4e1b718b3 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -135,7 +135,7 @@ ScViewFunc::~ScViewFunc() { } -bool ScViewFunc::CheckSheetViewProtection(sc::Operation eOperation) +bool ScViewFunc::CheckSheetViewProtection(sc::OperationType eOperation) { sc::SheetViewOperationsTester aSheetViewTester(&GetViewData()); return aSheetViewTester.check(eOperation); @@ -789,7 +789,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, ScDocFunc &rFunc = GetViewData().GetDocFunc(); std::shared_ptr<ScDocShellModificator> xModificator = std::make_shared<ScDocShellModificator>(*pDocSh); - if (!CheckSheetViewProtection(sc::Operation::EnterData)) + if (!CheckSheetViewProtection(sc::OperationType::EnterData)) return; ScEditableTester aTester = ScEditableTester::CreateAndTestSelectedBlock(rDoc, nCol, nRow, nCol, nRow, aMark); @@ -934,7 +934,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, ScDocShellModificator aModificator( *pDocSh ); - if (!CheckSheetViewProtection(sc::Operation::EnterData)) + if (!CheckSheetViewProtection(sc::OperationType::EnterData)) return; ScEditableTester aTester = ScEditableTester::CreateAndTestBlock(rDoc, nTab, nCol, nRow, nCol, nRow);
