diff options
author | Justin Luth <justin_luth@sil.org> | 2021-10-20 18:09:46 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-06-13 16:59:32 +0200 |
commit | b6653e577af8e2902dbe2609d14dbbedbc4441f7 (patch) | |
tree | 3390f1153ad79b69ef16110e00c14aae00d8cf58 /svl/source/numbers | |
parent | eb3310bd31e2e6df8dd9b6081ccce3fc464a0468 (diff) |
tdf#131025 swtable: don't apply number format to non-number text
Applying a numbering style to text causes export to save that
out as a number (valued as zero). That is not good because
the ODF spec says that a number overrides a string.
So don't accept a numbering format on non-number text.
Why is this change good?
-the cell previously had no direct formatting (by definition).
-the cell's previous old format was text (tested).
-any numbering format applied obviously isn't correct (by definition).
-any previous formatting has already been overwritten with numformat.
-the default numbering is appropriate for text.
-empty cells still get the numbering format (tested).
-odd human-designed formats are accepted as intentional (tested).
What are the concerns?
-the scope of this change is HUGE, way beyond this bug.
-on both my dev box and patch box I saw occassional crashes.
-the bug was "fixed" by a different import commit that ensured
different languages were treated consistently.
So this patch is no longer critical, just nice to have
to avoid exporting out-of-spec content.
Change-Id: Id3dc5f803c3cf4875bc0cab52d1019a18679da77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123904
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 546e7d14b397cfd1210b891c8dc4a195c25f3876)
Conflicts:
include/svl/numformat.hxx
svl/source/numbers/zforlist.cxx
sw/source/core/table/swtable.cxx
Change-Id: I94db018babf0323d84809accaaa898a9caf8edbe
(cherry picked from commit 66a6cb0e02e5ea9cb4a75258928103f7ecd07f36)
Diffstat (limited to 'svl/source/numbers')
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 3da7ab43c449..caa07e5002e9 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -3044,6 +3044,14 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, return sString.makeStringAndClear(); } +bool SvNumberFormatter::IsUserDefinedAndNotOverloaded(sal_uInt32 F_Index) const +{ + ::osl::MutexGuard aGuard( GetInstanceMutex() ); + const SvNumberformat* pFormat = GetFormatEntry(F_Index); + + return pFormat && (pFormat->GetType() & SvNumFormatType::DEFINED); +} + bool SvNumberFormatter::IsUserDefined(const OUString& sStr, LanguageType eLnge) { |