diff options
Diffstat (limited to 'sc/source/ui/view/cellsh1.cxx')
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index f529e34b6140..d619b461d6c3 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2768,7 +2768,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; - case SID_SELECT_VISIBLE_CELLS: + case SID_SELECT_VISIBLE_ROWS: { ScViewData& rData = GetViewData(); ScMarkData& rMark = rData.GetMarkData(); @@ -2806,6 +2806,44 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; + case SID_SELECT_VISIBLE_COLUMNS: + { + ScViewData& rData = GetViewData(); + ScMarkData& rMark = rData.GetMarkData(); + ScDocument& rDoc = rData.GetDocument(); + + rMark.MarkToMulti(); + + ScRange aMultiArea; + rMark.GetMultiMarkArea(aMultiArea); + SCCOL nStartCol = aMultiArea.aStart.Col(); + SCROW nStartRow = aMultiArea.aStart.Row(); + SCCOL nEndCol = aMultiArea.aEnd.Col(); + SCROW nEndRow = aMultiArea.aEnd.Row(); + + bool bChanged = false; + for (const SCTAB& nTab : rMark) + { + for (SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol) + { + SCCOL nLastCol = nCol; + if (rDoc.ColHidden(nCol, nTab, nullptr, &nLastCol)) + { + rMark.SetMultiMarkArea( + ScRange(nCol, nStartRow, nTab, nLastCol, nEndRow, nTab), false); + bChanged = true; + nCol = nLastCol; + } + } + } + + if (bChanged && !rMark.HasAnyMultiMarks()) + rMark.ResetMark(); + + rMark.MarkToSimple(); + } + break; + case SID_CURRENT_FORMULA_RANGE: { const SfxInt32Item* param1 = rReq.GetArg<SfxInt32Item>(FN_PARAM_1); |