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>
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index e8c1c4d..97f8575 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;
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index aea72d8..5005a20 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -67,7 +67,7 @@ public:
SvxNumberType & operator =(SvxNumberType const &) = default;
OUString GetNumStr( sal_Int32 nNo ) const;
OUString GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLocale ) const;
OUString GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLocale, bool bIsLegal = false ) const;
void SetNumberingType(SvxNumType nSet) {nNumType = nSet;}
SvxNumType GetNumberingType() const {return nNumType;}
@@ -152,6 +152,8 @@ private:
OUString sCharStyleName; // Character Style
bool mbIsLegal = false; // "Legal" level numbering = all levels use arabic numbering
public:
explicit SvxNumberFormat( SvxNumType nNumberingType );
SvxNumberFormat(const SvxNumberFormat& rFormat);
@@ -223,6 +225,9 @@ public:
static Size GetGraphicSizeMM100(const Graphic* pGraphic);
static OUString CreateRomanString( sal_Int32 nNo, bool bUpper );
bool GetIsLegal() const { return mbIsLegal; }
void SetIsLegal(bool val) { mbIsLegal = val; }
};
//Feature-Flags (only sal_uInt16!)
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index ef372586..1afdf70 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1123,6 +1123,7 @@ namespace xmloff::token {
XML_IS_ACTIVE,
XML_IS_DATA_LAYOUT_FIELD,
XML_IS_HIDDEN,
XML_IS_LEGAL,
XML_IS_SELECTION,
XML_ISBN,
XML_ITALIC,
diff --git a/offapi/com/sun/star/style/NumberingLevel.idl b/offapi/com/sun/star/style/NumberingLevel.idl
index dd4959c..e660e1f 100644
--- a/offapi/com/sun/star/style/NumberingLevel.idl
+++ b/offapi/com/sun/star/style/NumberingLevel.idl
@@ -98,6 +98,12 @@ published service NumberingLevel
@since LibreOffice 7.2
*/
[optional, property] string ListFormat;
/** Specifies if this level should use Arabic numbers for all levels
@since LibreOffice 24.2
*/
[optional, property] boolean IsLegal;
};
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index 65023b2..e927ebb 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -3242,6 +3242,21 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
</rng:define>
<!-- TODO no proposal -->
<rng:define name="text-list-level-style-number-attr" combine="interleave">
<rng:ref name="common-level-attlist"/>
</rng:define>
<rng:define name="text-outline-level-style-attlist" combine="interleave">
<rng:ref name="common-level-attlist"/>
</rng:define>
<rng:define name="common-level-attlist">
<rng:optional>
<rng:attribute name="loext:is-legal">
<rng:ref name="boolean"/>
</rng:attribute>
</rng:optional>
</rng:define>
<!-- TODO no proposal -->
<rng:define name="paragraph-content" combine="choice"
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0">
<rng:element name="text:bibliography-mark">
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index febf6a8..5992860 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -898,6 +898,7 @@ inline constexpr OUStringLiteral UNO_NAME_DOC_INTEROP_GRAB_BAG = u"InteropGrabBa
inline constexpr OUStringLiteral UNO_NAME_FRAME_INTEROP_GRAB_BAG = u"FrameInteropGrabBag";
inline constexpr OUStringLiteral UNO_NAME_CHAR_HIGHLIGHT = u"CharHighlight";
inline constexpr OUStringLiteral UNO_NAME_STYLE_INTEROP_GRAB_BAG = u"StyleInteropGrabBag";
inline constexpr OUStringLiteral UNO_NAME_LEVEL_IS_LEGAL = u"IsLegal";
inline constexpr OUStringLiteral UNO_NAME_CHAR_INTEROP_GRAB_BAG = u"CharInteropGrabBag";
inline constexpr OUStringLiteral UNO_NAME_TEXT_VERT_ADJUST = u"TextVerticalAdjust";
inline constexpr OUStringLiteral UNO_NAME_CELL_INTEROP_GRAB_BAG = u"CellInteropGrabBag";
diff --git a/sw/qa/extras/odfexport/data/IsLegal.fodt b/sw/qa/extras/odfexport/data/IsLegal.fodt
new file mode 100644
index 0000000..a4af751
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/IsLegal.fodt
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:styles>
<style:style style:name="Custom1" style:family="paragraph" style:default-outline-level="1"/>
<style:style style:name="Custom2" style:family="paragraph" style:default-outline-level="2"/>
<text:outline-style style:name="Outline">
<text:outline-level-style text:level="1" loext:num-list-format="CH %1%" style:num-prefix="CH " style:num-format="I">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="nothing"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="2" loext:is-legal="true" loext:num-list-format="Sect %1%.%2%" style:num-prefix="Sect " style:num-format="01, 02, 03, ..." text:display-levels="2">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.81cm" fo:text-indent="1.27cm"/>
</style:list-level-properties>
</text:outline-level-style>
</text:outline-style>
</office:styles>
<office:body>
<office:text>
<text:h text:style-name="Custom1" text:outline-level="1"/>
<text:h text:style-name="Custom2" text:outline-level="2">Foo</text:h>
<text:h text:style-name="Custom1" text:outline-level="1"/>
<text:h text:style-name="Custom2" text:outline-level="2">Bar</text:h>
</office:text>
</office:body>
</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index bf63881..7d9d1a2 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -1100,6 +1100,28 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentStyles)
xCommentText.queryThrow<beans::XPropertyState>()->getPropertyState("CharHeight"));
}
CPPUNIT_TEST_FIXTURE(Test, testTdf150408_IsLegal)
{
loadAndReload("IsLegal.fodt");
// Second level's numbering should use Arabic numbers for first level reference
auto xPara = getParagraph(1);
CPPUNIT_ASSERT_EQUAL(OUString("CH I"), getProperty<OUString>(xPara, "ListLabelString"));
xPara = getParagraph(2);
CPPUNIT_ASSERT_EQUAL(OUString("Sect 1.01"), getProperty<OUString>(xPara, "ListLabelString"));
xPara = getParagraph(3);
CPPUNIT_ASSERT_EQUAL(OUString("CH II"), getProperty<OUString>(xPara, "ListLabelString"));
xPara = getParagraph(4);
CPPUNIT_ASSERT_EQUAL(OUString("Sect 2.01"), getProperty<OUString>(xPara, "ListLabelString"));
// Test that the markup stays at save-and-reload
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
assertXPath(
pXmlDoc,
"/office:document-styles/office:styles/text:outline-style/text:outline-level-style[2]",
"is-legal", "true");
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/data/listWithLgl.docx b/sw/qa/extras/ooxmlexport/data/listWithLgl.docx
new file mode 100644
index 0000000..3bc5c32
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/listWithLgl.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
index a7c4b2c..3292485 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
@@ -1028,6 +1028,26 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133560)
CPPUNIT_ASSERT_EQUAL(12.0f, getProperty<float>(getParagraph(4), "CharHeight"));
}
CPPUNIT_TEST_FIXTURE(Test, testTdf150408_isLvl_RoundTrip)
{
loadAndSave("listWithLgl.docx");
// Second level's numbering should use Arabic numbers for first level reference
auto xPara = getParagraph(1);
CPPUNIT_ASSERT_EQUAL(OUString("CH I"), getProperty<OUString>(xPara, "ListLabelString"));
xPara = getParagraph(2);
CPPUNIT_ASSERT_EQUAL(OUString("Sect 1.01"), getProperty<OUString>(xPara, "ListLabelString"));
xPara = getParagraph(3);
CPPUNIT_ASSERT_EQUAL(OUString("CH II"), getProperty<OUString>(xPara, "ListLabelString"));
xPara = getParagraph(4);
CPPUNIT_ASSERT_EQUAL(OUString("Sect 2.01"), getProperty<OUString>(xPara, "ListLabelString"));
xmlDocUniquePtr pXml = parseExport("word/numbering.xml");
assertXPath(pXml, "/w:numbering/w:abstractNum"); // Only one list
// The second list level must keep the isLgl element
assertXPath(pXml, "/w:numbering/w:abstractNum/w:lvl[2]/w:isLgl");
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index f953a93..3ab36c6 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -711,7 +711,7 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
}
}
else if (rNumVector[i])
sReplacement = Get(i).GetNumStr(rNumVector[i], aLocale);
sReplacement = Get(i).GetNumStr(rNumVector[i], aLocale, rMyNFormat.GetIsLegal());
else
sReplacement = "0"; // all 0 level are a 0
@@ -756,7 +756,7 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
}
if (rNumVector[i])
aStr.append(rNFormat.GetNumStr(rNumVector[i], aLocale));
aStr.append(rNFormat.GetNumStr(rNumVector[i], aLocale, rMyNFormat.GetIsLegal()));
else
aStr.append("0"); // all 0 level are a 0
if (i != nLevel && !aStr.isEmpty())
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 50a5308..7a90e56 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1297,6 +1297,9 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat
aPropertyValues.push_back(comphelper::makePropertyValue("ListFormat", rFormat.GetListFormat()));
}
if (rFormat.GetIsLegal())
aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_LEVEL_IS_LEGAL, true));
//char style name
aUString.clear();
SwStyleNameMapper::FillProgName( rCharFormatName, aUString, SwGetPoolIdFromName::ChrFmt);
@@ -1875,6 +1878,11 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
rProp.Value >>= uTmp;
aFormat.SetListFormat(uTmp);
}
else if (rProp.Name == UNO_NAME_LEVEL_IS_LEGAL)
{
if (bool bVal; rProp.Value >>= bVal)
aFormat.SetIsLegal(bVal);
}
else
{
// Invalid property name
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index faa8b70..d5d9292 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -368,7 +368,8 @@ public:
sal_Int16 nFirstLineIndex,
sal_Int16 nListTabPos,
const OUString &rNumberingString,
const SvxBrushItem* pBrush) = 0; // #i120928 export graphic of bullet
const SvxBrushItem* pBrush, // #i120928 export graphic of bullet
bool isLegal) = 0;
protected:
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 21e7886..cadea4c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7559,7 +7559,8 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel,
sal_Int16 nFirstLineIndex,
sal_Int16 nListTabPos,
const OUString &rNumberingString,
const SvxBrushItem* pBrush)
const SvxBrushItem* pBrush,
bool isLegal)
{
m_pSerializer->startElementNS(XML_w, XML_lvl, FSNS(XML_w, XML_ilvl), OString::number(nLevel));
@@ -7579,6 +7580,10 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel,
m_pSerializer->singleElementNS( XML_w, XML_pStyle ,
FSNS( XML_w, XML_val ), m_rExport.m_pStyles->GetStyleId(nId) );
}
if (isLegal)
m_pSerializer->singleElementNS(XML_w, XML_isLgl);
// format
OString aCustomFormat;
OString aFormat(lcl_ConvertNumberingType(nNumberingType, pOutSet, aCustomFormat, "decimal"));
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 3517150..c0d2c56 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -426,7 +426,8 @@ public:
sal_Int16 nFirstLineIndex,
sal_Int16 nListTabPos,
const OUString &rNumberingString,
const SvxBrushItem* pBrush ) override;
const SvxBrushItem* pBrush,
bool isLegal ) override;
void WriteField_Impl(const SwField* pField, ww::eField eType,
const OUString& rFieldCmd, FieldFlags nMode,
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 59ed71f..fe96f5e 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1615,7 +1615,7 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart,
const wwFont* pFont, const SfxItemSet* pOutSet,
sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex,
sal_Int16 /*nListTabPos*/, const OUString& rNumberingString,
const SvxBrushItem* pBrush)
const SvxBrushItem* pBrush, bool /*isLegal*/)
{
m_rExport.Strm().WriteOString(SAL_NEWLINE_STRING);
if (nLevel > 8) // RTF knows only 9 levels
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 6e5a3c7..5e7e648 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -219,13 +219,13 @@ public:
void EndAbstractNumbering() override;
/// All the numbering level information.
void
NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart, sal_uInt16 nNumberingType,
SvxAdjust eAdjust, const sal_uInt8* pNumLvlPos, sal_uInt8 nFollow,
const wwFont* pFont, const SfxItemSet* pOutSet, sal_Int16 nIndentAt,
sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos,
const OUString& rNumberingString,
const SvxBrushItem* pBrush) override; //For i120928,to export graphic of bullet
void NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart, sal_uInt16 nNumberingType,
SvxAdjust eAdjust, const sal_uInt8* pNumLvlPos, sal_uInt8 nFollow,
const wwFont* pFont, const SfxItemSet* pOutSet, sal_Int16 nIndentAt,
sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos,
const OUString& rNumberingString,
const SvxBrushItem* pBrush, //For i120928,to export graphic of bullet
bool isLegal) override;
void WriteField_Impl(const SwField* pField, ww::eField eType, std::u16string_view rFieldCmd,
FieldFlags nMode);
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 29e93c1..8d59434 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -278,7 +278,8 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/,
sal_Int16 nFirstLineIndex,
sal_Int16 nListTabPos,
const OUString &rNumberingString,
const SvxBrushItem* pBrush //For i120928,to transfer graphic of bullet
const SvxBrushItem* pBrush, //For i120928,to transfer graphic of bullet
bool /*isLegal*/
)
{
// Start value
@@ -566,7 +567,7 @@ void MSWordExportBase::NumberingLevel(
pPseudoFont.get(), pOutSet,
nIndentAt, nFirstLineIndex, nListTabPos,
sNumStr,
rFormat.GetNumberingType()==SVX_NUM_BITMAP ? rFormat.GetBrush() : nullptr);
rFormat.GetNumberingType()==SVX_NUM_BITMAP ? rFormat.GetBrush() : nullptr, rFormat.GetIsLegal());
}
void WW8Export::OutOverrideListTab()
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index c67adba..eb20f52 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -202,7 +202,8 @@ public:
sal_Int16 nFirstLineIndex,
sal_Int16 nListTabPos,
const OUString &rNumberingString,
const SvxBrushItem* pBrush) override; //For i120928,transfer graphic of bullet
const SvxBrushItem* pBrush, //For i120928,transfer graphic of bullet
bool isLegal) override;
protected:
/// Output frames - the implementation.
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 5b5ad07..a3b3883 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 4bae58b..fc3c2f0 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 11ef072..554f7490 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 6708c6d..581378a 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
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 1e3d0b8..a5f3b97 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1136,6 +1136,7 @@ namespace xmloff::token {
TOKEN( "is-active", XML_IS_ACTIVE ),
TOKEN( "is-data-layout-field", XML_IS_DATA_LAYOUT_FIELD ),
TOKEN( "is-hidden", XML_IS_HIDDEN ),
TOKEN( "is-legal", XML_IS_LEGAL ),
TOKEN( "is-selection", XML_IS_SELECTION ),
TOKEN( "isbn", XML_ISBN ),
TOKEN( "italic", XML_ITALIC ),
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index 4c00fab..a5ae61c 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 3e8b6fe..c9149a0 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);
}
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index d4fd4c7..96e88f2 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -1036,6 +1036,7 @@ inverse
is-active
is-data-layout-field
is-hidden
is-legal
is-selection
isbn
italic