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

tdf#107480 RTF import: fix HTML automatic spacing in styles

\htmautsp changes the meaning of \sbauto and \saauto, but the auto
keywords may appear early in style definitions before \htmautsp arrives.
This wasn't a problem before commit
1be0a3fa (n#825305: writerfilter RTF
import: override style properties like Word, 2014-06-17), as there the
right auto keyword interpretation was repeated as direct formatting.

So fix the regression by not deduplicating these keywords, which brings
back the correct layout. A larger rework is necessary in the future to
delay the parsing of the stylesheet table, that would be a cleaner
approach.

Change-Id: I783d2175483bc80ead0a511ad15c4b75e4ab663c
Reviewed-on: https://gerrit.libreoffice.org/41187Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst c0cb8cb2
{\rtf1
{\fonttbl
{\f0 Times New Roman;}
}
{\stylesheet
{\snext0 Normal;}
{\s3 \sbauto1\saauto1 heading 3;}
}
\paperw11906\paperh16838\margl1701\margr850\margt1134\margb1134
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine
\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
\asianbrkrule\newtblstyruls\nogrowautofit \fet0\sectd \linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj
\htmautsp
\pard\plain \s3 \sbauto1\saauto1
1.\par
}
......@@ -1210,6 +1210,13 @@ DECLARE_RTFEXPORT_TEST(testTdf107620, "tdf107620.docx")
CPPUNIT_ASSERT(!bAddParaTableSpacing);
}
DECLARE_RTFEXPORT_TEST(testTdf107480, "tdf107480.rtf")
{
// These were 176 (100 twips), as \htmautsp was parsed too late.
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
}
DECLARE_RTFEXPORT_TEST(testWatermark, "watermark.rtf")
{
uno::Reference<text::XTextRange> xShape(getShape(1), uno::UNO_QUERY);
......
......@@ -168,6 +168,10 @@ static bool isSPRMDeduplicateBlacklist(Id nId)
// possibly from the numbering.
case NS_ooxml::LN_CT_Ind_left:
case NS_ooxml::LN_CT_Ind_right:
// \htmautsp arrives after the style table, so only the non-style value is
// correct, keep these.
case NS_ooxml::LN_CT_Spacing_beforeAutospacing:
case NS_ooxml::LN_CT_Spacing_afterAutospacing:
return true;
default:
......
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