summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2025-01-20 15:59:21 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2025-01-20 18:14:11 +0100
commit26246b2fb202e1fe8045dd69ff771588a845764a (patch)
tree1ae6e4cffd6e25afdbd3b2b56bc5ee9cf25f2ae5 /sc
parent76e0a520d6beb118dd6437889fbe16d2a94c941c (diff)
Simplify a bit
No need to skip the loop explicitly when there's no element in the container. No need to take integers (the elements in the container) by reference. Change-Id: I15f7ccdeaafaa5a766ae36b31e49f41daebf86b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180518 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/cellsh1.cxx33
1 files changed, 14 insertions, 19 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 3c2719e162b9..e45afab83c00 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2242,28 +2242,23 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
// try to find an existing conditional format
const ScPatternAttr* pPattern = rDoc.GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
ScConditionalFormatList* pList = rDoc.GetCondFormList(aPos.Tab());
- const ScCondFormatIndexes& rCondFormats = pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
- bool bContainsCondFormat = !rCondFormats.empty();
+ bool bContainsCondFormat = false;
bool bCondFormatDlg = false;
- if(bContainsCondFormat)
+ for (auto nKey : pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData())
{
- bContainsCondFormat = false; // maybe all nullptrs?
- for (const auto& rCondFormat : rCondFormats)
+ // check if at least one existing conditional format has the same range
+ const ScConditionalFormat* pCondFormat = pList->GetFormat(nKey);
+ if(!pCondFormat)
+ continue;
+
+ bContainsCondFormat = true; // found at least one format
+ const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
+ if(rCondFormatRange == aRangeList)
{
- // check if at least one existing conditional format has the same range
- const ScConditionalFormat* pCondFormat = pList->GetFormat(rCondFormat);
- if(!pCondFormat)
- continue;
-
- bContainsCondFormat = true; // found at least one format
- const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
- if(rCondFormatRange == aRangeList)
- {
- // found a matching range, edit this conditional format
- bCondFormatDlg = true;
- nIndex = pCondFormat->GetKey();
- break;
- }
+ // found a matching range, edit this conditional format
+ bCondFormatDlg = true;
+ nIndex = pCondFormat->GetKey();
+ break;
}
}