summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-06-12 20:37:47 +0200
committerMichael Stahl <mstahl@redhat.com>2014-06-13 15:29:54 +0200
commite2cf3ef783a824b0a5733040db91e6ca3eb247b2 (patch)
treea720f2bb8bab42f66161fdb4d117c9616f53e122
parentd83ab715a04c166ad0e8962b52c0800fb6f2969c (diff)
fdo#76633: writerfilter RTF import: disappear the rectangle shapes on images
If the shape properties are inside \picprop destination, don't set shapeType. (regression from 9f1f7199736e2ae07b34849ba66f61a1ef5782e8) Actually this does not fix the root cause, this is just a work-around, the extra shape is still inserted but it's invisible now. Change-Id: I6cf093de2a5657533f393863ed8010ae083bec16 (cherry picked from commit b7857e5cfe9d5d007785ae93e5505620fc8ed475)
-rw-r--r--sw/qa/extras/rtfimport/data/fdo76633.rtf32
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx15
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx12
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx6
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.hxx3
5 files changed, 62 insertions, 6 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo76633.rtf b/sw/qa/extras/rtfimport/data/fdo76633.rtf
new file mode 100644
index 000000000000..d339b12e2917
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo76633.rtf
@@ -0,0 +1,32 @@
+{\rtf1\ansi
+{\*\generator LibreOfficeDev/4.4.0.0.alpha0$Linux_X86_64 LibreOffice_project/b534967caca6767cd2100da363b1da2433640ddd}
+{\*\shppict{\pict{\*\picprop{\sp{\sn wzDescription}{\sv }}{\sp{\sn wzName}{\sv }}}\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw64\pich60\picwgoal1280\pichgoal1200\jpegblip
+ffd8ffe000104a46494600010101004800480000ffe101604578696600004d4d002a000000080009010e00020000000100000000010f0002000000060000007a
+011000020000001500000080011200030000000100010000011a00050000000100000096011b0005000000010000009e01280003000000010002000001310002
+0000000c000000a68769000400000001000000b20000000043616e6f6e0043616e6f6e20506f77657253686f7420413531300000000000480000000100000048
+0000000147494d5020322e362e3131000009829a00050000000100000124829d0005000000010000012c88270003000000010000000090000007000000043032
+3130900300020000001400000134920a00050000000100000148928600070000000800000150a00000070000000430313030a001000300000001ffff00000000
+00000051eb85ffffffff0000000400000001323031313a30363a31322031393a32363a3436000000001000000001554e49434f444500ffdb0043000806060706
+05080707070909080a0c140d0c0b0b0c1912130f141d1a1f1e1d1a1c1c20242e2720222c231c1c2837292c30313434341f27393d38323c2e333432ffdb004301
+0909090c0b0c180d0d1832211c213232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232
+ffc0001108003c004003012200021101031101ffc4001a000002030101000000000000000000000004050203060100ffc4003210000201030302050302050500
+000000000102030004110512213151132241617106143242911523a1c1e17281b1d1f0ffc400190101010101010100000000000000000000010200030405ffc4
+001d110002020203010000000000000000000000010211213103225141ffda000c03010002110311003f007e1df6912a2c9e8372f27fdc509731bc571f731065
+8b1b668f180bcf0c3e3d7da99c6ca3cf24783ed5cbd1b6d8c91287232319ea3b7c57cc3d82cbdd5adecf62c9b9e50be6551d3e6975d7d49163f976ec47405985
+461fa6defa797c49e73264332a614007b64e71e993da8a6fa26d9b02459ca8f533e7fe055df1ad93d9e81edbea8831992270c060ed20d7351d76316ea6c9f6cb
+2379ba7007b50b7bf467dabaf812c881f254b9ca8f63eb54e816da6dd4d2e9978a535589cf926fc5d7b2907b7355d2ad076d0136b5746e15da77dcbd8fbf6ada
+0769144858052a0e3b8a51aae876a34b98ac31c4f1a92194739a274f995b4cb7594296f0c0233d7ff62a66d35686298dadc1958a89627e7aa9dbd7d0a9fed5c9
+199565555c323608cf0738ff001553b9824dc5778f6f37a54cb89e4dfbcf9941f4c71dea1942c86ff1acc9340764817c2970bc9c72323f7a7aba84aea4e0678e
+0f18acb5bec3acdeba070e1b1c0e09029c2baf86482aa71fa813fd3d6a65156298d3ee5a67db22a6d230ca4fe5599fa8fe985bb432443c2b98fcd6f32b727d42
+934c22994b30cb021b9214f1c7bfad1e2fa27b6922b91cc433b80f6c8c0ef5a2dc5e0cf3b10e8badaeb7612595f0116ab0a14911b8f1401f97cf7ab6cadd52d8
+44e780be50f80323af3e99a5b7f6f8d5edb53b3c7de6e2bb0ae04a30723fd445398d0f86889e424701b079aa963408b2662a049092c18ed200cd4236731c4f9c
+7246339aba1b83185049f7e7d4f7cd0f730cd736720b6f0dd8e498d9f6ab8edd29fa0cc83eb725bdd4a2d88f348497c641f807a579b59bb698399873fa71c0cf
+b502da16b0d3304b275009e0b00073e849a99d175a4600d8bf27960ca40f9e6bbd44e76c3df57ba38669cee1ea3028cd2f5dbcbabb4b090f8aae0e18e015e339
+f7ff00349a6d1355455678939e021917767f7a23e9bb37fe2c65b872823181b39e4fa1ed44a31a14dd9a2d4d360b62ea1b1386ebedd28a376890659d843fa8c9
+d71ff79a13584630c1b18bb8940c28f53d28a8bc4306638f3819219871f39e95c19d11631324061207dc6762b95cec61dc0f71fd69969f0d9ff0f8e2ba01655d
+d9c291ce4f208e71cd7a3b48597c464cbb1de5ba1cf1daaefb189433465e321b8d871d41a993148b25d26d76f98b0e47490f3f3533a4da642a028e0648ce78a5
+1717973671954999f613867e49c9c609edc554faadda40ec24e9818f91454bd3606efa05a4cd993c49075db9c0c8f8aea68f681b7a0973c91e62c47ef40a5ecc
+d023b90c73b79cf4aaef6e678d86d95c33851bb3c8cf6f4a5a97a6c1ed6ece3b7804b02ac9b86c1c12d93c8c01d7a1a147871a239dc84f250b647b64d4e79a53
+0c71072a646c175fc8704e476e959db6bdb892cd54c9b40214ed00646ec7f7aa8a6d03747fffd9}}
+
+\par }
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 49e9687385bb..e4254e74c1af 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -573,6 +573,21 @@ DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(19)), xShape->getSize().Height);
}
+DECLARE_RTFIMPORT_TEST(testFdo76633, "fdo76633.rtf")
+{
+ // check that there is only a graphic object, not an additional rectangle
+ uno::Reference<lang::XServiceInfo> xShape(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xShape.is());
+#if 0
+ // disabled - fails currently
+ CPPUNIT_ASSERT(xShape->supportsService("com.sun.star.text.TextGraphicObject"));
+ try {
+ uno::Reference<drawing::XShape> xShape2(getShape(2), uno::UNO_QUERY);
+ CPPUNIT_FAIL("exception expected");
+ } catch (lang::IndexOutOfBoundsException const&) { /* expected */ }
+#endif
+}
+
DECLARE_RTFIMPORT_TEST(testFdo48033, "fdo48033.rtf")
{
/*
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b83c74a8a7ad..16b09eaec7b6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1418,7 +1418,8 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer,
else if (boost::get<0>(aTuple) == BUFFER_PAR)
parBreak();
else if (boost::get<0>(aTuple) == BUFFER_STARTSHAPE)
- m_pSdrImport->resolve(boost::get<1>(aTuple)->getShape(), false);
+ m_pSdrImport->resolve(boost::get<1>(aTuple)->getShape(), false,
+ RTFSdrImport::SHAPE);
else if (boost::get<0>(aTuple) == BUFFER_ENDSHAPE)
m_pSdrImport->close();
else
@@ -1704,7 +1705,8 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
if (nKeyword == RTF_SHPTXT)
{
if (!m_aStates.top().pCurrentBuffer)
- m_pSdrImport->resolve(m_aStates.top().aShape, false);
+ m_pSdrImport->resolve(m_aStates.top().aShape, false,
+ RTFSdrImport::SHAPE);
else
{
RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aShape));
@@ -4843,7 +4845,11 @@ int RTFDocumentImpl::popState()
case DESTINATION_SHAPEINSTRUCTION:
// Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself.
if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape))
- m_pSdrImport->resolve(m_aStates.top().aShape, true);
+ {
+ m_pSdrImport->resolve(m_aStates.top().aShape, true,
+ (aState.nDestinationState == DESTINATION_SHAPEINSTRUCTION)
+ ? RTFSdrImport::SHAPE : RTFSdrImport::PICT);
+ }
else if (aState.bInShapeGroup && !aState.bInShape)
{
// End of a groupshape, as we're in shapegroup, but not in a real shape.
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 790fd60f1e29..5d0424ad2619 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -215,7 +215,8 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, const O
}
}
-void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
+void RTFSdrImport::resolve(RTFShape& rShape, bool bClose,
+ ShapeOrPict const shapeOrPict)
{
int nType = -1;
bool bPib = false;
@@ -250,7 +251,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
sal_Int16 nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME;
// The spec doesn't state what is the default for shapeType, Word seems to implement it as a rectangle.
- if (std::find_if(rShape.aProperties.begin(),
+ if (SHAPE == shapeOrPict &&
+ std::find_if(rShape.aProperties.begin(),
rShape.aProperties.end(),
boost::bind(&OUString::equals, boost::bind(&std::pair<OUString, OUString>::first, _1), OUString("shapeType")))
== rShape.aProperties.end())
diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx
index 0d36c2b1ae82..770aff4f1c59 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.hxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.hxx
@@ -25,7 +25,8 @@ public:
RTFSdrImport(RTFDocumentImpl& rImport, css::uno::Reference<css::lang::XComponent> const& xDstDoc);
virtual ~RTFSdrImport();
- void resolve(RTFShape& rShape, bool bClose);
+ enum ShapeOrPict { SHAPE, PICT };
+ void resolve(RTFShape& rShape, bool bClose, ShapeOrPict shapeOrPict);
void close();
void append(const OUString& aKey, const OUString& aValue);
/// Append property on the current parent.