diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:30 +0000 |
commit | a2baea7faff31d26459dab3668a39eae85e4991b (patch) | |
tree | eaa2048ce9c715481f932dcfe20368e252b77d2f /sc/source/ui/view/gridwin.cxx | |
parent | Adding upstream version 4:24.2.0. (diff) | |
download | libreoffice-upstream/4%24.2.1.tar.xz libreoffice-upstream/4%24.2.1.zip |
Adding upstream version 4:24.2.1.upstream/4%24.2.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/source/ui/view/gridwin.cxx')
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 140 |
1 files changed, 82 insertions, 58 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 3f4f6b219c..ddbc8e2507 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1041,8 +1041,8 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) mpAutoFilterPopup->setMemberSize(aFilterEntries.size()); for (auto it = aFilterEntries.begin(); it != aFilterEntries.end(); ++it) { - // tdf#140745 show (empty) entry on top of the checkbox list - if (it->GetString().isEmpty()) + // tdf#140745 show (empty) entry on top of the checkbox list if not hidden by filter + if (it->GetString().isEmpty() && !it->IsHiddenByFilter()) { const OUString& aStringVal = it->GetString(); const double aDoubleVal = it->GetValue(); @@ -1051,7 +1051,8 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) bSelected = aSelectedString.count(aStringVal) > 0; else if (bQueryByNonEmpty) bSelected = false; - mpAutoFilterPopup->addMember(aStringVal, aDoubleVal, bSelected, it->IsHiddenByFilter()); + // it->IsHiddenByFilter() is always false here so no need to evaluate it + mpAutoFilterPopup->addMember(aStringVal, aDoubleVal, bSelected, false); aFilterEntries.maStrData.erase(it); break; } @@ -6168,10 +6169,16 @@ void ScGridWindow::DeleteCopySourceOverlay() void ScGridWindow::UpdateCopySourceOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteCopySourceOverlay(); @@ -6222,9 +6229,6 @@ void ScGridWindow::UpdateCopySourceOverlay() xOverlayManager->add(*pDashedBorder); mpOOSelectionBorder->append(std::move(pDashedBorder)); } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } static std::vector<tools::Rectangle> convertPixelToLogical( @@ -6415,10 +6419,16 @@ void ScGridWindow::UpdateCursorOverlay() { ScDocument& rDoc = mrViewData.GetDocument(); - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); // Existing OverlayObjects may be transformed in later versions. // For now, just re-create them. @@ -6577,9 +6587,6 @@ void ScGridWindow::UpdateCursorOverlay() } } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::GetCellSelection(std::vector<tools::Rectangle>& rLogicRects) @@ -6601,10 +6608,16 @@ void ScGridWindow::DeleteSelectionOverlay() void ScGridWindow::UpdateSelectionOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteSelectionOverlay(); std::vector<tools::Rectangle> aRects; @@ -6676,9 +6689,6 @@ void ScGridWindow::UpdateSelectionOverlay() ScInputHandler::SendReferenceMarks(pViewShell, aReferenceMarks); } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::UpdateHighlightOverlay() @@ -6744,10 +6754,16 @@ void ScGridWindow::DeleteAutoFillOverlay() void ScGridWindow::UpdateAutoFillOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteAutoFillOverlay(); @@ -6826,9 +6842,6 @@ void ScGridWindow::UpdateAutoFillOverlay() mpOOAutoFill.reset(new sdr::overlay::OverlayObjectList); mpOOAutoFill->append(std::move(pOverlay)); } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::DeleteDragRectOverlay() @@ -6841,10 +6854,16 @@ void ScGridWindow::UpdateDragRectOverlay() bool bInPrintTwips = comphelper::LibreOfficeKit::isCompatFlagSet( comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteDragRectOverlay(); @@ -6997,9 +7016,6 @@ void ScGridWindow::UpdateDragRectOverlay() pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectsString); } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::DeleteHeaderOverlay() @@ -7009,10 +7025,16 @@ void ScGridWindow::DeleteHeaderOverlay() void ScGridWindow::UpdateHeaderOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteHeaderOverlay(); @@ -7043,9 +7065,6 @@ void ScGridWindow::UpdateHeaderOverlay() mpOOHeader->append(std::move(pOverlay)); } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::DeleteShrinkOverlay() @@ -7055,10 +7074,16 @@ void ScGridWindow::DeleteShrinkOverlay() void ScGridWindow::UpdateShrinkOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteShrinkOverlay(); @@ -7110,9 +7135,6 @@ void ScGridWindow::UpdateShrinkOverlay() mpOOShrink->append(std::move(pOverlay)); } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::DeleteSparklineGroupOverlay() @@ -7122,9 +7144,14 @@ void ScGridWindow::DeleteSparklineGroupOverlay() void ScGridWindow::UpdateSparklineGroupOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - - MapMode aOldMode = GetMapMode(); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); if (aOldMode != aDrawMode) SetMapMode(aDrawMode); @@ -7173,9 +7200,6 @@ void ScGridWindow::UpdateSparklineGroupOverlay() } } } - - if (aOldMode != aDrawMode) - SetMapMode(aOldMode); } // #i70788# central method to get the OverlayManager safely |