diff options
author | Justin Luth <justin.luth@collabora.com> | 2024-05-18 11:36:24 -0400 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2024-05-20 15:40:58 +0200 |
commit | a94db2e3b6e130fe90de31cbd909ce54f5450601 (patch) | |
tree | 22cf42834987275888dedc49284c9e78290a6816 | |
parent | 65e226aff6a946ae4884b9f5afdccaa1c745bcd4 (diff) |
tdf#156105 sw: make SvxNumberFormat GetPrefix/Suffix more trustworthy
As soon as SetPrefix or SetSuffix are called,
any partially formed sListFormat is invalid (unless nothing changed).
ListFormat creates sPrefix/sSuffix as a convenience/compat item,
and changing it directly is NOT reflected in the sListFormat itself.
Trying to keep them in sync would be very complicated.
Any process that uses these functions OUGHT TO be doing it as
building blocks to eventually call SetListFormat(prefix, suffix, lvl),
at which point a proper sListFormat will be created.
Change-Id: I05f681c812ea5207cb8127b30dafbd543ffea219
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167832
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de>
-rw-r--r-- | editeng/source/items/numitem.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 0d677dfc6696..f0fe0085e157 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -571,7 +571,7 @@ OUString SvxNumberFormat::CreateRomanString( sal_Int32 nNo, bool bUpper ) void SvxNumberFormat::SetPrefix(const OUString& rSet) { // ListFormat manages the prefix. If badly changed via this function, sListFormat is invalidated - if (sListFormat && rSet.getLength() != sPrefix.getLength()) + if (sListFormat) sListFormat.reset(); sPrefix = rSet; @@ -580,7 +580,7 @@ void SvxNumberFormat::SetPrefix(const OUString& rSet) void SvxNumberFormat::SetSuffix(const OUString& rSet) { // ListFormat manages the suffix. If badly changed via this function, sListFormat is invalidated - if (sListFormat && rSet.getLength() != sSuffix.getLength()) + if (sListFormat) sListFormat.reset(); sSuffix = rSet; |