summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/rtfimport/data/fdo52989.rtf12
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx11
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx7
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx3
4 files changed, 30 insertions, 3 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo52989.rtf b/sw/qa/extras/rtfimport/data/fdo52989.rtf
new file mode 100644
index 000000000000..513f868e0c5c
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo52989.rtf
@@ -0,0 +1,12 @@
+{\rtf1
+{\*\shppict
+{\pict\picw1\pich2\jpegblip
+89504e470d0a1a0a0000000d4948445200000010000000100802000000909168360000015049444154789c9592c14a02511486bf99714ccb322d7521140541cb
+6a11448b164150fb8a363d41f4083d40cba0655044d0a637a837682fd1a6a2488b10b23475bcb77b671c491dc1cee23077e67cf7fcff39139252f29f08b59e3e
+1dae8b4c45998ff501a82e070f5cbd3366733acb5c6fa609fc0872651236df0deeca7d002a6cc33d1b941a146ab49ca937e37610e0c590c5c92b67f926a07243
+b293613f8b1108a8a84aadb01575c9799edd0c895010a0ae71048e77b99b6a92e53861a387a48a6033c5d208c297a43ca8a3697601d217b010632dd9a9f34be0
+9968021698bea4c76ab72f5dd0d6216c3211e1bec2a0c5e59bce9303baa770c7bd38aca7d729692bcd4d512b53bb3b7cc2f45dd604ab098e67b499366025ce5e
+96a317fd2162e2d76bbbb725bdcd80b12a603aca4581e7aade97e14ec2916ca719ed96e4c54692f5241f755de7019641eacfaff10b469261dc6a800dd30000000049454e44ae426082
+}
+}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 4da71c68b5e3..b0e3ab364673 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -122,6 +122,7 @@ public:
void testLeftmarginDefault();
void testDppolyline();
void testFdo56512();
+ void testFdo52989();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -195,6 +196,7 @@ void Test::run()
{"leftmargin-default.rtf", &Test::testLeftmarginDefault},
{"dppolyline.rtf", &Test::testDppolyline},
{"fdo56512.rtf", &Test::testFdo56512},
+ {"fdo52989.rtf", &Test::testFdo52989},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
@@ -895,6 +897,15 @@ void Test::testFdo56512()
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
+void Test::testFdo52989()
+{
+ // Same as n#192129, but for JPEG files.
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(423), xShape->getSize().Width);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a5ee8f525674..4393aa0bfb3e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -647,9 +647,9 @@ int RTFDocumentImpl::resolvePict(bool bInline)
pExtHeader = 0;
OUString aGraphicUrl = m_pGraphicHelper->importGraphicObject(xInputStream, pExtHeader);
- if (m_aStates.top().aPicture.nStyle == BMPSTYLE_PNG)
+ if (m_aStates.top().aPicture.nStyle != BMPSTYLE_NONE)
{
- // In case of PNG, the real size is known, don't use the values
+ // In case of PNG/JPEG, the real size is known, don't use the values
// provided by picw and pich.
OString aURLBS(OUStringToOString(aGraphicUrl, RTL_TEXTENCODING_UTF8));
const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
@@ -2261,6 +2261,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_PNGBLIP:
m_aStates.top().aPicture.nStyle = BMPSTYLE_PNG;
break;
+ case RTF_JPEGBLIP:
+ m_aStates.top().aPicture.nStyle = BMPSTYLE_JPEG;
+ break;
case RTF_POSYT: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top); break;
case RTF_POSYB: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom); break;
case RTF_POSYC: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center); break;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index c0956f77b520..4942facc0d3e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -222,7 +222,8 @@ namespace writerfilter {
enum RTFBmpStyles
{
BMPSTYLE_NONE,
- BMPSTYLE_PNG
+ BMPSTYLE_PNG,
+ BMPSTYLE_JPEG
};
enum RTFFieldStatus