Resolves: tdf#128403 Use ScPatternAttr::GetNumberFormat()

... it does or will do the right thing.
See also https://bugs.documentfoundation.org/show_bug.cgi?id=117715#c12

Change-Id: I4ecaa6be8b2358d4ea4d84655cde74dce5319c2a
Reviewed-on: https://gerrit.libreoffice.org/81548
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 6fbb004..41a9760 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -454,15 +454,7 @@ void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxIt
    // number format

    sal_uLong nOld = nValueFormat;
    const SfxPoolItem* pFormItem;
    if ( !pCondSet || pCondSet->GetItemState(ATTR_VALUE_FORMAT,true,&pFormItem) != SfxItemState::SET )
        pFormItem = &pPattern->GetItem(ATTR_VALUE_FORMAT);
    const SfxPoolItem* pLangItem;
    if ( !pCondSet || pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT,true,&pLangItem) != SfxItemState::SET )
        pLangItem = &pPattern->GetItem(ATTR_LANGUAGE_FORMAT);
    nValueFormat = pOutput->mpDoc->GetFormatTable()->GetFormatForLanguageIfBuiltIn(
                    static_cast<const SfxUInt32Item*>(pFormItem)->GetValue(),
                    static_cast<const SvxLanguageItem*>(pLangItem)->GetLanguage() );
    nValueFormat = pPattern->GetNumberFormat( pOutput->mpDoc->GetFormatTable(), pCondSet );

    if (nValueFormat != nOld)
        maLastCell.clear();           // always reformat