diff options
Diffstat (limited to 'sc/source/ui/view/cellsh1.cxx')
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 33 |
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; } } |