From fd64b426bc6175841143714ccc16bad181fd088f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 30 Jun 2023 18:19:27 +0300 Subject: 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 --- writerfilter/source/dmapper/NumberingManager.cxx | 6 +++++- writerfilter/source/dmapper/NumberingManager.hxx | 1 + writerfilter/source/dmapper/PropertyIds.cxx | 1 + writerfilter/source/dmapper/PropertyIds.hxx | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) (limited to 'writerfilter') diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 5b5ad07dce14..a3b3883d2dc7 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -55,7 +55,7 @@ namespace writerfilter::dmapper { template static beans::PropertyValue lcl_makePropVal(PropertyIds nNameID, T const & aValue) { - return {getPropertyName(nNameID), 0, uno::Any(aValue), beans::PropertyState_DIRECT_VALUE}; + return comphelper::makePropertyValue(getPropertyName(nNameID), aValue); } static sal_Int32 lcl_findProperty( const uno::Sequence< beans::PropertyValue >& aProps, std::u16string_view sName ) @@ -111,6 +111,7 @@ void ListLevel::SetValue( Id nId, sal_Int32 nValue ) m_nNFC = nValue; break; case NS_ooxml::LN_CT_Lvl_isLgl: + m_bIsLegal = true; break; case NS_ooxml::LN_CT_Lvl_legacy: break; @@ -268,6 +269,9 @@ uno::Sequence ListLevel::GetLevelProperties(bool bDefaults if (aPropFont) aNumberingProperties.emplace_back( getPropertyName(PROP_BULLET_FONT_NAME), 0, aPropFont->second, beans::PropertyState_DIRECT_VALUE ); + if (m_bIsLegal) + aNumberingProperties.push_back(lcl_makePropVal(PROP_LEVEL_IS_LEGAL, true)); + return comphelper::containerToSequence(aNumberingProperties); } diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx index 4bae58b8e51c..fc3c2f05b72f 100644 --- a/writerfilter/source/dmapper/NumberingManager.hxx +++ b/writerfilter/source/dmapper/NumberingManager.hxx @@ -52,6 +52,7 @@ class ListLevel : public PropertyMap std::optional m_nTabstop; tools::SvRef< StyleSheetEntry > m_pParaStyle; bool m_bHasValues = false; + bool m_bIsLegal = false; public: diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 11ef07230fad..554f7490c991 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -224,6 +224,7 @@ namespace { PROP_LEVEL_FOLLOW, u"LabelFollowedBy"}, { PROP_LEVEL_PARAGRAPH_STYLES, u"LevelParagraphStyles"}, { PROP_LEVEL_FORMAT, u"LevelFormat"}, + { PROP_LEVEL_IS_LEGAL, u"IsLegal"}, { PROP_LIST_FORMAT, u"ListFormat"}, { PROP_TOKEN_TYPE, u"TokenType"}, { PROP_TOKEN_HYPERLINK_START, u"TokenHyperlinkStart"}, diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 6708c6dfbf35..581378af895a 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -220,6 +220,7 @@ enum PropertyIds ,PROP_LEVEL_FOLLOW ,PROP_LEVEL_FORMAT ,PROP_LEVEL_PARAGRAPH_STYLES + ,PROP_LEVEL_IS_LEGAL ,PROP_LISTTAB_STOP_POSITION ,PROP_LIST_FORMAT ,PROP_MACRO_NAME -- cgit