summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-06-30 18:19:27 +0300
committerMiklos Vajna <vmiklos@collabora.com>2023-07-11 14:02:19 +0200
commitfd64b426bc6175841143714ccc16bad181fd088f (patch)
tree93b1b666d1636c6b85f9412399093b274c5a5b25 /writerfilter
parent6b0684b2c48bcd8fd6ded3817cbe12aa4e02b4dc (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 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx6
-rw-r--r--writerfilter/source/dmapper/NumberingManager.hxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.cxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.hxx1
4 files changed, 8 insertions, 1 deletions
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 <typename T>
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<beans::PropertyValue> 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<sal_Int32> 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