tdf#79553 ww8import: line numbering distance is auto, not zero

sprmSDxaLnn:
An XAS_nonNeg that specifies the distance between line numbers and
the lines of text to which they apply. A value of 0 indicates that the
application MUST automatically determine positioning.
By default, the positioning of line numbers is automatically determined.

Change-Id: I35a440a7fa84f315f4a67e201e1a0066d4e4cf73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92126
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
Justin Luth
2020-04-13 20:14:14 +03:00
committed by Miklos Vajna
parent 9152aed780
commit 803b49a377
3 changed files with 19 additions and 1 deletions

Binary file not shown.

View File

@@ -126,6 +126,22 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote)
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
}
DECLARE_WW8EXPORT_TEST(testdf79553_lineNumbers, "tdf79553_lineNumbers.doc")
{
bool bValue = false;
sal_Int32 nValue = -1;
uno::Reference< text::XTextDocument > xtextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference< text::XLineNumberingProperties > xLineProperties( xtextDocument, uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xPropertySet = xLineProperties->getLineNumberingProperties();
xPropertySet->getPropertyValue("IsOn") >>= bValue;
CPPUNIT_ASSERT_EQUAL(true, bValue);
xPropertySet->getPropertyValue("Distance") >>= nValue;
CPPUNIT_ASSERT_MESSAGE("automatic distance", nValue > 0);
}
DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc")
{
uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles");

View File

@@ -767,7 +767,9 @@ void SwWW8ImplReader::HandleLineNumbering(const wwSection &rSection)
aInfo.SetRestartEachPage(rSection.maSep.lnc == 0);
aInfo.SetPosFromLeft(writer_cast<sal_uInt16>(rSection.maSep.dxaLnn));
// A value of 0 (auto) indicates that the application MUST automatically determine positioning.
if ( rSection.maSep.dxaLnn )
aInfo.SetPosFromLeft(writer_cast<sal_uInt16>(rSection.maSep.dxaLnn));
//Paint only for every n line
aInfo.SetCountBy(rSection.maSep.nLnnMod);