diff options
author | Justin Luth <jluth@mail.com> | 2022-08-02 13:30:31 -0400 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2022-08-12 16:27:42 +0200 |
commit | 835cda561217bd8c53af2de927158dd5712b06c0 (patch) | |
tree | 4342021d4381f499eaafa4e31347e53ef007d955 /editeng | |
parent | acf2a2f17942c21b5aca4691c738902a3dd9aa6c (diff) |
related tdf#150197: use SetListFormat or SetPrefix/Suffix
GetListFormat DEPENDS on having managed prefix/suffix itself,
since it uses their getLength to modify the sListFormat.
So any modification via SetPrefix/Suffix
(potentially) invalidates the ListFormat.
I added some code to ensure this doesn't get out of sync.
One place that still uses PREFIX/SUFFIX is old ODT files.
After import they are updated, but during import they use
the old UNO properties, so I didn't add any assert here.
Change-Id: I3bab780fb8e8e985c3573075bc7aac9216d116d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138073
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de>
Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/numitem.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 1239ea529126..e8c1c4d9a77c 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -559,6 +559,24 @@ OUString SvxNumberFormat::CreateRomanString( sal_Int32 nNo, bool bUpper ) : sRet.makeStringAndClear().toAsciiLowerCase(); } +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()) + sListFormat.reset(); + + sPrefix = 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()) + sListFormat.reset(); + + sSuffix = rSet; +} + void SvxNumberFormat::SetListFormat(const OUString& rPrefix, const OUString& rSuffix, int nLevel) { sPrefix = rPrefix; |