summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/unoprnms.hxx1
-rw-r--r--sw/qa/extras/odfexport/data/IsLegal.fodt28
-rw-r--r--sw/qa/extras/odfexport/odfexport2.cxx22
-rw-r--r--sw/qa/extras/ooxmlexport/data/listWithLgl.docxbin0 -> 3009 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport19.cxx20
-rw-r--r--sw/source/core/doc/number.cxx4
-rw-r--r--sw/source/core/unocore/unosett.cxx8
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx7
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx3
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.hxx14
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx5
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx3
14 files changed, 104 insertions, 16 deletions
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index febf6a8d4ec2..599286022f9a 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 000000000000..a4af751fb16a
--- /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 bf638819a527..7d9d1a26169d 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 000000000000..3bc5c32d2d14
--- /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 a7c4b2c068d1..329248532342 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 f953a93dbde4..3ab36c63c160 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 50a53080bb56..7a90e56c999c 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 faa8b700e31e..d5d92924ba9c 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 21e788665230..cadea4cab043 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 35171507cd38..c0d2c5649710 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 59ed71f198bc..fe96f5ecaffc 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 6e5a3c77cd2c..5e7e648f647e 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 29e93c1b956c..8d59434db652 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 c67adba187a6..eb20f529c52a 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.