summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-08-04 12:37:30 +0200
committerCaolán McNamara <caolanm@redhat.com>2016-08-05 07:38:24 +0000
commit100321e9b39687e8021763ee0aec95de856c497c (patch)
tree98fdc035cdd945204f941a9603e7370e45be15ea /sw
parent85badce0b8dce3c1c1cc4b7af2d71ec2ff8da4ef (diff)
tdf#78506 RTF import: fix handling of invalid \levelnumbers
In case ';' is written in \u form in \levelnumbers, then Word ignores the whole \levelnumbers contents, do the same. (cherry picked from commit 428a1da60b88415e7db21353a42bed85b8b76ed9) Change-Id: I93ce5810af2b5ed703e804199c0b236d2c4c36b5 Reviewed-on: https://gerrit.libreoffice.org/27873 Tested-by: Jenkins <ci@libreoffice.org> 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/tdf78506.rtf24
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx17
2 files changed, 41 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf78506.rtf b/sw/qa/extras/rtfimport/data/tdf78506.rtf
new file mode 100644
index 000000000000..2978734137c7
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf78506.rtf
@@ -0,0 +1,24 @@
+{\rtf \ansi \ansicpg0 \deff0 \stshfdbch1 \stshfloch0 \stshfhich0 \deflang1033 \deflangfe1033
+{\*\listtable
+{\list \listtemplateid700648999 \listhybrid
+{\listlevel \levelnfc0 \levelnfcn0 \leveljc0 \leveljcn0 \levelstartat1 \levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0
+{\leveltext
+{\uc1 \u2 ?}
+{\uc1 \u0 ?}
+{\uc1 \u46 ?}
+{\uc1 \u59 ?}
+}
+{\levelnumbers \'01
+{\uc1 \u59 ?}
+}
+\li720 \lin720 \fi-360 }
+{\listname ;}
+\listid697112958 }
+}
+{\*\listoverridetable
+{\listoverride \listid697112958 \listoverridecount0 \ls1 }
+}
+\pard \plain \ls1
+Test.
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 73096c8e705d..1f2a7fb03b48 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2661,6 +2661,23 @@ DECLARE_RTFIMPORT_TEST(testFlip, "flip.rtf")
CPPUNIT_ASSERT(!aMap["MirroredY"].hasValue());
}
+DECLARE_RTFIMPORT_TEST(testTdf78506, "tdf78506.rtf")
+{
+ uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aProps;
+ xLevels->getByIndex(0) >>= aProps; // 1sd level
+
+ for (int i = 0; i < aProps.getLength(); ++i)
+ {
+ const beans::PropertyValue& rProp = aProps[i];
+
+ if (rProp.Name == "Suffix")
+ // This was '0', invalid \levelnumbers wasn't ignored.
+ CPPUNIT_ASSERT_EQUAL(CHAR_ZWSP, rProp.Value.get<OUString>().toChar());
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */