summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-23 09:13:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-03-09 16:19:57 +0000
commitbbab30f26382da83dda75c056e7ff9e51a1db9df (patch)
treeff3ebd6e8e0ef1e8562a43200fdbeaddbbdbcc34 /sw
parentac4560a37dacfa4fee60e36d1b3de7790b81dc20 (diff)
tdf#59699 RTF import: handle INCLUDEPICTURE field
On one hand, don't handle a fieldmark for it in dmapper. On the other hand, handle the field in the RTF tokenizer as it would be {\pict ...hexdump... }, that will result in an inline picture, as wanted. (cherry picked from commit 6f94cab9c43f88624b58a47ad03ad5f87032595d) Change-Id: I554fdf017920350144300fd86617bf74eed8995b Reviewed-on: https://gerrit.libreoffice.org/23085 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/libreoffice.pngbin0 -> 767 bytes
-rw-r--r--sw/qa/extras/rtfimport/data/tdf59699.rtf10
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx9
3 files changed, 19 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/libreoffice.png b/sw/qa/extras/rtfimport/data/libreoffice.png
new file mode 100644
index 000000000000..437f613c178c
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/libreoffice.png
Binary files differ
diff --git a/sw/qa/extras/rtfimport/data/tdf59699.rtf b/sw/qa/extras/rtfimport/data/tdf59699.rtf
new file mode 100644
index 000000000000..94331cc62113
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf59699.rtf
@@ -0,0 +1,10 @@
+{\rtf1
+\pard\plain
+{\field
+{\*\fldinst
+{ INCLUDEPICTURE "libreoffice.png" \\* MERGEFORMAT \\d }
+}
+{\fldrslt}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index e95ada6f7b33..2837bc08087b 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -48,6 +48,7 @@
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
#include <rtl/ustring.hxx>
#include <vcl/outdev.hxx>
@@ -633,6 +634,14 @@ DECLARE_RTFIMPORT_TEST(testFdo49659, "fdo49659.rtf")
CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, getProperty<sal_Int8>(xGraphic, "GraphicType"));
}
+DECLARE_OOXMLIMPORT_TEST(testTdf59699, "tdf59699.rtf")
+{
+ // This resulted in a lang.IndexOutOfBoundsException: the referenced graphic data wasn't imported.
+ uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY);
+ auto xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, "Graphic");
+ CPPUNIT_ASSERT(xGraphic.is());
+}
+
DECLARE_RTFIMPORT_TEST(testFdo46966, "fdo46966.rtf")
{
/*