summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-02-26 21:17:59 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-02-27 09:10:10 +0100
commit59363e639b67a8acbd6da240635de47921b2c955 (patch)
tree60d08c8f643275cf5fef45b6d0acfbd3de4693ea /sw
parent61e4c00eee8c5d07a29cf7ec97bad653e3e8f8ce (diff)
tdf#115715 RTF import: ignore zero para indents in styles without parents
The only reason the DOCX equivalent of the bugdoc was imported correctly is that these default zero margins are simply missing from the DOCX markup, suggesting Word ignores them. We now do the same, this way the stripped down document's 3 paragraphs all have different margins as expected. (Also rework the testTdf112211_2 testcase to test the original problem better: I verified that the layout is unchanged before/after this patch.) Change-Id: I88d56c27c19e070e983c3392f99bca96597cd56e Reviewed-on: https://gerrit.libreoffice.org/50391 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfimport/data/tdf115715.rtf38
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx17
2 files changed, 50 insertions, 5 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf115715.rtf b/sw/qa/extras/rtfimport/data/tdf115715.rtf
new file mode 100644
index 000000000000..4f8311d8de11
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf115715.rtf
@@ -0,0 +1,38 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch0\stshfloch1\stshfhich1\stshfbi1\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs1025
+\noqfpromote
+{\stylesheet
+{\ql \rin0\lin0 \ltrch\fcs0 \f1\fs24\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}
+{\s55\ql \rin0\lin0 \afs26 \ltrch\fcs0 \f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext55 \slink22 Style 55;}
+{\s56\ql \fi-720\rin0\lin0 \afs26 \ltrch\fcs0 \f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext56 \slink24 Style 56;}
+}
+{\*\listtable
+{\list\listtemplateid-454920584
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'02\'00.;}
+{\levelnumbers\'01;}
+\af0\afs26\ltrch\fcs0
+\fs26\hres0\chhres0}
+{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'02\'01.;}
+{\levelnumbers\'01;}
+\af0\afs26 \ltrch\fcs0 \fs26\hres0\chhres0}
+{\listname;}
+\listid1}
+}
+{\*\listoverridetable
+{\listoverride\listid1\listoverridecount0\ls1}
+}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440
+\pard\plain before
+\par
+\pard\plain\s56\fi-720\li1580
+\ls1\rin0\lin1580 \afs26 \ltrch\fcs0 \f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052
+{\ltrch\fcs0
+\lang1033\langfe1033\langfenp1033 1}
+\par
+\pard\plain\s55\ql \li1580
+\ls1\ilvl1\rin0\lin1580 \afs26 \ltrch\fcs0 \f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052
+{\ltrch\fcs0
+\lang1033\langfe1033\langfenp1033 a}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index fd05a6ce69d7..860fe0712044 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -175,6 +175,14 @@ DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf")
}
}
+DECLARE_RTFIMPORT_TEST(testTdf115715, "tdf115715.rtf")
+{
+ // This was 0, second paragraph was shifted to the right, it had the same
+ // horizontal position as the 3rd paragraph.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1270),
+ getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent"));
+}
+
DECLARE_RTFIMPORT_TEST(testTdf115155, "tdf115155.rtf")
{
auto xLevels
@@ -344,11 +352,10 @@ DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf")
DECLARE_RTFIMPORT_TEST(testTdf112211_2, "tdf112211-2.rtf")
{
- uno::Reference<beans::XPropertyState> xPropertyState(getParagraph(2), uno::UNO_QUERY);
- beans::PropertyState ePropertyState = xPropertyState->getPropertyState("ParaLeftMargin");
- // This was beans::PropertyState_DIRECT_VALUE -> direct formatting
- // prevented inheritance from numbering definition.
- CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, ePropertyState);
+ // Spacing between the bullet and the actual text was too large.
+ // This is now around 269, large old value was 629.
+ int nWidth = parseDump("/root/page/body/txt[2]/Text[@nType='POR_TABLEFT']", "nWidth").toInt32();
+ CPPUNIT_ASSERT_LESS(300, nWidth);
}
DECLARE_RTFIMPORT_TEST(testFdo49892, "fdo49892.rtf")