summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-07-27 21:20:34 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-07-27 22:23:42 +0200
commit0705b9f75d31c433b9ff263a0f1af06035664219 (patch)
treee51c44ee90637e38d8c20ee4860872c133c3f0c0
parentd6c284e4b146a44ba69a96836c59a98d077bb934 (diff)
fdo#48033 fix RTF import of pictures inside table cells
Change-Id: I2d9ef3b346d4b10b99b67d0934d63d59f6119f97
-rw-r--r--sw/qa/extras/rtfimport/data/fdo48033.rtf22
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx26
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx8
3 files changed, 55 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo48033.rtf b/sw/qa/extras/rtfimport/data/fdo48033.rtf
new file mode 100644
index 000000000000..609a020556d2
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo48033.rtf
@@ -0,0 +1,22 @@
+{\rtf1
+\ltrrow\trowd \cellx4819\cellx9746\pard\plain\intbl
+{A1\cell }
+{
+{\*\shppict
+{\pict
+\picscalex80\picscaley80\piccropl0\piccropr0\piccropt0\piccropb0
+\picw423\pich423\picwgoal240\pichgoal240\pngblip\bliptag-338523043
+{\*\blipuid ebd28c5d3cbcfd4779e8e481da18cc69}
+89504e470d0a1a0a0000000d4948445200000010000000100802000000909168360000015049444154789c9592c14a02511486bf99714ccb322d7521140541cb
+6a11448b164150fb8a363d41f4083d40cba0655044d0a637a837682fd1a6a2488b10b23475bcb77b671c491dc1cee23077e67cf7fcff39139252f29f08b59e3e
+1dae8b4c45998ff501a82e070f5cbd3366733acb5c6fa609fc0872651236df0deeca7d002a6cc33d1b941a146ab49ca937e37610e0c590c5c92b67f926a07243
+b293613f8b1108a8a84aadb01575c9799edd0c895010a0ae71048e77b99b6a92e53861a387a48a6033c5d208c297a43ca8a3697601d217b010632dd9a9f34be0
+9968021698bea4c76ab72f5dd0d6216c3211e1bec2a0c5e59bce9303baa770c7bd38aca7d729692bcd4d512b53bb3b7cc2f45dd604ab098e67b499366025ce5e
+96a317fd2162e2d76bbbb725bdcd80b12a603aca4581e7aade97e14ec2916ca719ed96e4c54692f5241f755de7019641eacfaff10b469261dc6a800dd30000000049454e44ae426082}
+}
+}
+{\cell }
+{\row
+}
+\pard\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 4aa2904fa453..229dec870ff6 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
@@ -98,6 +99,7 @@ public:
void testFdo49659();
void testFdo46966();
void testFdo52066();
+ void testFdo48033();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -139,6 +141,7 @@ public:
CPPUNIT_TEST(testFdo49659);
CPPUNIT_TEST(testFdo46966);
CPPUNIT_TEST(testFdo52066);
+ CPPUNIT_TEST(testFdo48033);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -828,6 +831,29 @@ void Test::testFdo52066()
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(19)), xShape->getSize().Height);
}
+void Test::testFdo48033()
+{
+ /*
+ * The problem was that the picture was in the first cell, instead of the second one.
+ *
+ * oTable = ThisComponent.TextTables(0)
+ * oParas = oTable.getCellByName("B1").Text.createEnumeration
+ * oPara = oParas.nextElement
+ * oRuns = oPara.createEnumeration
+ * oRun = oRuns.nextElement
+ * xray oRun.TextPortionType ' Frame, was Text
+ */
+ load("fdo48033.rtf");
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b63bc3c90724..b03a7bc5d415 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -759,7 +759,13 @@ int RTFDocumentImpl::resolvePict(bool bInline)
}
writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes, aSprms));
checkFirstRun();
- Mapper().props(pProperties);
+ if (!m_pCurrentBuffer)
+ Mapper().props(pProperties);
+ else
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
+ m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
+ }
return 0;
}