diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-06-30 18:19:27 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-07-11 14:02:19 +0200 |
commit | fd64b426bc6175841143714ccc16bad181fd088f (patch) | |
tree | 93b1b666d1636c6b85f9412399093b274c5a5b25 /editeng | |
parent | 6b0684b2c48bcd8fd6ded3817cbe12aa4e02b4dc (diff) |
tdf#150408: Implement "Legal" numbering (all levels using Arabic numbers)
Enabling this feature on a list level makes all numbered sublevels, that
constitute the number of this level, to use Arabic numerals. This doesn't
change the labels of other levels: e.g., if level 1 uses A,B,C; level 2
uses i,ii,iii; level 3 uses a,b,c, and is "Legal"; and level 4 uses 1,2,3;
then a list may look like
A. Something
A.i. Some subitem
A.ii. Another subitem
1.2.1. This is a "Legal" sub-subitem
A.ii.a.1. And its child
This improves interoperability with Word.
This change introduces document model, ODF and OOXML import and export.
In ODF, a new boolean attribute of 'text:outline-level-style' element,
'loext:is-legal', is introduced; its default value is "false".
Change-Id: I5ae9f970864854c7e84c4b2f7ce46634b3ef104e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154288
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/numitem.cxx | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index e8c1c4d9a77c..97f857547029 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -113,7 +113,13 @@ OUString SvxNumberType::GetNumStr( sal_Int32 nNo ) const return GetNumStr( nNo, aLang.getLocale() ); } -OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLocale ) const +static bool isArabicNumberingType(SvxNumType t) +{ + return t == SVX_NUM_ARABIC || t == SVX_NUM_ARABIC_ZERO || t == SVX_NUM_ARABIC_ZERO3 + || t == SVX_NUM_ARABIC_ZERO4 || t == SVX_NUM_ARABIC_ZERO5; +} + +OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLocale, bool bIsLegal ) const { lcl_getFormatter(xFormatter); if(!xFormatter.is()) @@ -133,11 +139,12 @@ OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLoca return OUString('0'); else { + SvxNumType nActType = !bIsLegal || isArabicNumberingType(nNumType) ? nNumType : SVX_NUM_ARABIC; static constexpr OUStringLiteral sNumberingType = u"NumberingType"; static constexpr OUStringLiteral sValue = u"Value"; Sequence< PropertyValue > aProperties { - comphelper::makePropertyValue(sNumberingType, static_cast<sal_uInt16>(nNumType)), + comphelper::makePropertyValue(sNumberingType, static_cast<sal_uInt16>(nActType)), comphelper::makePropertyValue(sValue, nNo) }; @@ -366,6 +373,7 @@ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat ) pBulletFont.reset(); if(rFormat.pBulletFont) pBulletFont = *rFormat.pBulletFont; + mbIsLegal = rFormat.mbIsLegal; return *this; } @@ -392,7 +400,8 @@ bool SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const nBulletColor != rFormat.nBulletColor || nBulletRelSize != rFormat.nBulletRelSize || IsShowSymbol() != rFormat.IsShowSymbol() || - sCharStyleName != rFormat.sCharStyleName + sCharStyleName != rFormat.sCharStyleName || + mbIsLegal != rFormat.mbIsLegal ) return false; if ( @@ -1006,7 +1015,7 @@ OUString SvxNumRule::MakeNumString( const SvxNodeNum& rNum ) const if(SVX_NUM_BITMAP != rNFmt.GetNumberingType()) { const LanguageTag& rLang = Application::GetSettings().GetLanguageTag(); - aStr.append(rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], rLang.getLocale() )); + aStr.append(rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], rLang.getLocale(), rMyNFmt.GetIsLegal() )); } else bDot = false; |