Resolves: tdf#117715 Conditional format takes precedence; reverts tdf#93300
Change-Id: I635ca58961ae5ae315bdd77c4fff9f3f41bebd15
Reviewed-on: https://gerrit.libreoffice.org/81550
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 9d18777..f7e4010 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<const SfxUInt32Item*>(pFormItem)->GetValue();
if (GetItemSet().GetItemState(ATTR_LANGUAGE_FORMAT, false, &pLangItem) == SfxItemState::SET)
eLang = static_cast<const SvxLanguageItem*>(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)