summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-08-17 11:38:45 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-08-18 14:04:12 +0000
commit28771ae622f648a6e424d3d664333e0407df4739 (patch)
tree0c80acd40cad102fba7a5a01846df0795803260e /sw
parentf5475f4f85bc6cae51cbd4424dcc7a35cc2ef2dc (diff)
fdo#44715 RTF import: reset styles in tables on RTF_PARD
Commit 4a507f732d82c188ad81b022cbe3037951e58ac3 added an exception to RTF_PARD (reset paragraph properties) handling: when we're inside a table, it should not reset the fact that we're inside a table (which is a paragraph property). However, instead of just re-adding that property, it disabled resetting for all properties, and we had a growing list of exceptions since then. The next thing to add there would be the paragraph attributes, which contains the style information. Instead of growing that ad-hoc list, reset everything again and just re-add the "in table" SPRM. This makes the second and later paragraphs in the A1 cell of the bugdoc have proper font size. (cherry picked from commit b9c1a9b9aa41dbbb6bed0c77f4370ab6105c7fb1) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx writerfilter/source/rtftok/rtfdocumentimpl.cxx Change-Id: I2de80894fcd5da3bf45d221af9a04a307c70a29b Reviewed-on: https://gerrit.libreoffice.org/5471 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfimport/data/fdo44715.rtf42
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx10
2 files changed, 52 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo44715.rtf b/sw/qa/extras/rtfimport/data/fdo44715.rtf
new file mode 100644
index 000000000000..1b2287f43d74
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo44715.rtf
@@ -0,0 +1,42 @@
+{\rtf1\ansi\ansicpg1251\uc1 \deff0\deflang1033\deflangfe1049
+{\fonttbl
+{\f0\froman\fcharset204\fprq2
+Times New Roman;}
+{\f1\fswiss\fcharset204\fprq2
+Arial;}
+}
+{\stylesheet
+{\nowidctlpar\widctlpar\adjustright \lang1049\cgrid \snext0 style0;}
+{\s1\sb240\sa60\nowidctlpar\widctlpar\adjustright \b\f1\fs32\lang1049\kerning32\cgrid
+\sbasedon0 \snext0 style 1;}
+{\*\cs10 \additive style10;}
+}
+\paperw16838\paperh11906\margl1134\margr1134\margt1701\margb851
+\deftab708\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0\sectd \lndscpsxn\psz9\linex0\headery709\footery709\colsx708\endnhere\sectlinegrid360\sectdefaultcl
+\trowd \trgaph108\trrh105\trleft237\trkeep\trbrdrt\brdrs\brdrw45 \trbrdrl\brdrs\brdrw45 \trbrdrb\brdrs\brdrw45 \trbrdrr\brdrs\brdrw45 \clvmgf\clvertalt\clbrdrt
+\brdrs\brdrw45 \clbrdrl\brdrs\brdrw45 \clbrdrb\brdrs\brdrw45 \clbrdrr\brdrs\brdrw45 \cltxlrtb \cellx3274\clvmgf\clvertalt\clbrdrt\brdrs\brdrw45 \clbrdrl\brdrs\brdrw45 \clbrdrb\brdrs\brdrw15 \cltxlrtb \cellx7187\clvertalt\clbrdrt\brdrs\brdrw45 \cltxlrtb
+\cellx7753\clvmgf\clvertalt\clbrdrt\brdrs\brdrw45 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw45 \cltxlrtb \cellx11026\pard\plain \s1\qc\sb240\sa60\nowidctlpar\widctlpar\intbl\outlinelevel0\adjustright \b\f1\fs32\lang1049\kerning32\cgrid
+{\fs16 first line
+\par }
+\pard\plain \qc\nowidctlpar\widctlpar\intbl\adjustright \lang1049\cgrid
+{
+\par
+\par }
+{\b\fs18 last line\cell }
+\pard \nowidctlpar\widctlpar\intbl\adjustright
+{\fs16
+picture
+}
+{\fs16\lang1033
+\par }
+{\fs16 \cell }
+{\f15\fs16 \cell }
+{\b\i\f15\fs16 last cell}
+{\fs16 )
+\par \cell }
+\pard \nowidctlpar\widctlpar\intbl\adjustright
+{\fs20 \row }
+\pard \nowidctlpar\widctlpar\adjustright
+{
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index fc276f646aa0..07153879f13e 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -156,6 +156,7 @@ public:
void testPoshPosv();
void testFdo53556();
void testFdo63428();
+ void testFdo44715();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -296,6 +297,7 @@ void Test::run()
{"posh-posv.rtf", &Test::testPoshPosv},
{"fdo53556.rtf", &Test::testFdo53556},
{"hello.rtf", &Test::testFdo63428},
+ {"fdo44715.rtf", &Test::testFdo44715},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1432,6 +1434,14 @@ void Test::testFdo63428()
CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty<OUString>(getRun(getParagraph(1), 4), "TextPortionType"));
}
+void Test::testFdo44715()
+{
+ uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ // Style information wasn't reset, which caused character height to be 16.
+ CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getParagraphOfText(2, xCell->getText()), "CharHeight"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();