summaryrefslogtreecommitdiff
path: root/xmloff/source/style
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 /xmloff/source/style
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 'xmloff/source/style')
-rw-r--r--xmloff/source/style/xmlnume.cxx10
-rw-r--r--xmloff/source/style/xmlnumi.cxx8
2 files changed, 18 insertions, 0 deletions
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index 4c00fab10e96..a5ae61c12543 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -84,6 +84,7 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
sal_Int16 eAdjust = HoriOrientation::LEFT;
OUString sPrefix, sSuffix, sListFormat;
OUString sTextStyleName;
+ bool bIsLegal = false;
bool bHasColor = false;
sal_Int32 nColor = 0;
sal_Int32 nSpaceBefore = 0, nMinLabelWidth = 0, nMinLabelDist = 0;
@@ -125,6 +126,10 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
{
rProp.Value >>= sListFormat;
}
+ else if (rProp.Name == "IsLegal")
+ {
+ rProp.Value >>= bIsLegal;
+ }
else if (rProp.Name == "BulletChar")
{
OUString sValue;
@@ -256,6 +261,11 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
GetExport().EncodeStyleName( sTextStyleName ) );
}
+ if (bIsLegal)
+ {
+ if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
+ GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_IS_LEGAL, "true");
+ }
if (!sListFormat.isEmpty())
{
if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 3e8b6fe7253d..c9149a03a255 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -157,6 +157,8 @@ class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext
bool bNum : 1;
bool bHasColor : 1;
+ bool m_bIsLegal = false;
+
void SetRelSize( sal_Int16 nRel ) { nRelSize = nRel; }
void SetColor( Color nColor )
{ m_nColor = nColor; bHasColor = true; }
@@ -305,6 +307,9 @@ SvxXMLListLevelStyleContext_Impl::SvxXMLListLevelStyleContext_Impl(
case XML_ELEMENT(LO_EXT, XML_NUM_LIST_FORMAT):
sListFormat = std::make_optional(aIter.toString());
break;
+ case XML_ELEMENT(LO_EXT, XML_IS_LEGAL):
+ m_bIsLegal = aIter.toBoolean();
+ break;
case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
if( bNum )
sNumLetterSync = aIter.toString();
@@ -522,6 +527,9 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties()
aProperties.push_back(comphelper::makePropertyValue("ListFormat", *sListFormat));
+ if (m_bIsLegal)
+ aProperties.push_back(comphelper::makePropertyValue("IsLegal", true));
+
return comphelper::containerToSequence(aProperties);
}