xmloff/source/style/xmlnumi.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
New commits: commit e1c0785f6f5e94462293b434e7d1a765d192f624 Author: Caolán McNamara <[email protected]> AuthorDate: Sun Mar 1 20:56:13 2026 +0000 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Mar 5 23:53:44 2026 +0100 ofz#421997573 Timeout clip nNumDisplayLevels import like export does in SvxXMLNumRuleExport::exportLevelStyle Change-Id: I1ddc49a9c70155b9ac6f218cc9d453c36302302f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200732 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit ba2fb4af99f05a8a8a48d8fbc51bd232a91d634e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201056 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index 8019855f6b16..487af94ab5d8 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -61,6 +61,7 @@ #include <xmloff/maptype.hxx> #include <xmloff/xmlnumi.hxx> +#include <algorithm> #include <optional> using namespace ::com::sun::star; @@ -407,12 +408,14 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties() // Generate list format string, based on this sListFormat = std::make_optional(sPrefix); - for (int i = 1; i <= nNumDisplayLevels; i++) + // Can't display more levels than exist + sal_Int32 nDisplayLevels = std::min<sal_Int32>(nNumDisplayLevels, nLevel + 1); + for (int i = 1; i <= nDisplayLevels; i++) { *sListFormat += "%"; - *sListFormat += OUString::number(nLevel - nNumDisplayLevels + i + 1); + *sListFormat += OUString::number(nLevel - nDisplayLevels + i + 1); *sListFormat += "%"; - if (i != nNumDisplayLevels) + if (i != nDisplayLevels) *sListFormat += "."; // Default separator for older ODT }
