Kaydet (Commit) 81036465 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#116841 RTF import: fix default value of left para margin from numbering

The left mragin value is usually spelled out in RTF and DOCX, but this
bugdoc used the WW6 RTF markup to declare the numbering rules and there
the margin value was missing.

This also allows me to partially revert the changes to testTdf106953
from commit 56a695fd (tdf#112211 RTF
import: fix unwanted direct formatting for left indents, 2017-09-26).

Change-Id: I9902f2f9ada4080cb4d873624ae9824342c6ee77
Reviewed-on: https://gerrit.libreoffice.org/53364Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 46581021
{\rtf1\ansi\ansicpg1252\deff0\deflang1034
{\fonttbl
{\f0\fnil\fcharset0\fprq0\fttruetype Times New Roman;}
{\f1\fnil\fcharset0\fprq0\fttruetype Arial;}
{\f2\fnil\fcharset0\fprq0\fttruetype Courier New;}
}
\kerning0\cf0\viewkind1\paperw11905\paperh16837\margl1440\margr1440\widowctl
\sectd\sbknone\colsx360\headery0\footery0
\pard
{\*\pn\pnql\pnstart0\pnlvlblt
{\pntxtb\bullet}
}
\fi-431\li720
{\f0\fs24\lang1033
This is item one}
\par\pard}
...@@ -1068,10 +1068,11 @@ DECLARE_RTFEXPORT_TEST(testN825305, "n825305.rtf") ...@@ -1068,10 +1068,11 @@ DECLARE_RTFEXPORT_TEST(testN825305, "n825305.rtf")
DECLARE_RTFEXPORT_TEST(testTdf106953, "tdf106953.rtf") DECLARE_RTFEXPORT_TEST(testTdf106953, "tdf106953.rtf")
{ {
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270),
getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
auto xRules = getProperty<uno::Reference<container::XIndexAccess>>( auto xRules = getProperty<uno::Reference<container::XIndexAccess>>(
getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules");
comphelper::SequenceAsHashMap aRule(xRules->getByIndex(0)); comphelper::SequenceAsHashMap aRule(xRules->getByIndex(0));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), aRule["IndentAt"].get<sal_Int32>());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aRule["FirstLineIndent"].get<sal_Int32>()); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aRule["FirstLineIndent"].get<sal_Int32>());
} }
......
...@@ -101,6 +101,14 @@ DECLARE_RTFEXPORT_TEST(testTdf115180, "tdf115180.docx") ...@@ -101,6 +101,14 @@ DECLARE_RTFEXPORT_TEST(testTdf115180, "tdf115180.docx")
CPPUNIT_ASSERT_EQUAL_MESSAGE("First cell width", sal_Int32(218), cell2Width); CPPUNIT_ASSERT_EQUAL_MESSAGE("First cell width", sal_Int32(218), cell2Width);
} }
DECLARE_RTFEXPORT_TEST(testTdf116841, "tdf116841.rtf")
{
// This was 0, left margin was ignored as we assumed the default is already
// fine for us.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270),
getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -305,6 +305,11 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults ...@@ -305,6 +305,11 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults
else if (rReadId == PROP_FIRST_LINE_INDENT && bDefaults) else if (rReadId == PROP_FIRST_LINE_INDENT && bDefaults)
// Writer default is -360 twips, Word default seems to be 0. // Writer default is -360 twips, Word default seems to be 0.
aNumberingProperties.emplace_back("FirstLineIndent", 0, uno::makeAny(static_cast<sal_Int32>(0)), beans::PropertyState_DIRECT_VALUE); aNumberingProperties.emplace_back("FirstLineIndent", 0, uno::makeAny(static_cast<sal_Int32>(0)), beans::PropertyState_DIRECT_VALUE);
else if (rReadId == PROP_INDENT_AT && bDefaults)
// Writer default is 720 twips, Word default seems to be 0.
aNumberingProperties.emplace_back("IndentAt", 0,
uno::makeAny(static_cast<sal_Int32>(0)),
beans::PropertyState_DIRECT_VALUE);
} }
boost::optional<PropertyMap::Property> aPropFont = getProperty(PROP_CHAR_FONT_NAME); boost::optional<PropertyMap::Property> aPropFont = getProperty(PROP_CHAR_FONT_NAME);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment