From 2b0626161d3ef7c4a51007018d13ec391d3a2b04 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sat, 26 Oct 2019 23:00:20 +0200 Subject: Resolves: tdf#117715 Conditional format takes precedence; reverts tdf#93300 Change-Id: I635ca58961ae5ae315bdd77c4fff9f3f41bebd15 Reviewed-on: https://gerrit.libreoffice.org/81550 Reviewed-by: Eike Rathke Tested-by: Jenkins --- sc/source/core/data/patattr.cxx | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 9d18777d9c77..f7e4010d5518 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -1254,27 +1254,13 @@ sal_uInt32 ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter, if (!pCondSet) return GetNumberFormat(pFormatter); - /* In the case of a conditional format we need to overwrite a cell style - * but leave a hard cell formatting alone. So check first if the number - * format is set in the cell format, then the conditional format and - * finally in the style. - * - * The style is represented here if the name is empty. - */ + // Conditional format takes precedence over style and even hard format. const SfxPoolItem* pFormItem; sal_uInt32 nFormat; const SfxPoolItem* pLangItem; LanguageType eLang; - if (GetItemSet().GetItemState(ATTR_VALUE_FORMAT, false, &pFormItem) == SfxItemState::SET) - { - nFormat = static_cast(pFormItem)->GetValue(); - if (GetItemSet().GetItemState(ATTR_LANGUAGE_FORMAT, false, &pLangItem) == SfxItemState::SET) - eLang = static_cast(pLangItem)->GetLanguage(); - else - eLang = getLanguageType(GetItemSet()); - } - else if (pCondSet->GetItemState(ATTR_VALUE_FORMAT, true, &pFormItem) == SfxItemState::SET ) + if (pCondSet->GetItemState(ATTR_VALUE_FORMAT, true, &pFormItem) == SfxItemState::SET ) { nFormat = getNumberFormatKey(*pCondSet); if (pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT, true, &pLangItem) == SfxItemState::SET) -- cgit