summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-10-10 13:42:06 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-10-10 14:15:59 +0200
commitdd1490db9acea339c8af74d62362109efdb404f8 (patch)
tree5a0611fa938c8a25a60347592ea525937fa98c47
parent95c45bc25dbcb64919334c9f9a59c1132bee6d72 (diff)
DOCX export: improve <wp:effectExtent> handling
Change-Id: If8838529817c72f6e6a3730135a00312fe5c2ad3
-rw-r--r--sw/qa/extras/ooxmlexport/data/effect-extent.docxbin0 -> 14715 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx9
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx23
3 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/effect-extent.docx b/sw/qa/extras/ooxmlexport/data/effect-extent.docx
new file mode 100644
index 000000000000..f35fc3a4ab96
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/effect-extent.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index cf2c5c0a4f58..1277f7b4759a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -447,6 +447,15 @@ DECLARE_OOXMLEXPORT_TEST(testCropPixel, "crop-pixel.docx")
}
}
+DECLARE_OOXMLEXPORT_TEST(testEffectExtent, "effect-extent.docx")
+{
+ // The problem was that in case there were no shadows on the picture, we
+ // wrote a <wp:effectExtent> full or zeros.
+ if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
+ // E.g. this was 0.
+ assertXPath(pXmlDoc, "//wp:effectExtent", "l", "114300");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index e92a2c7347b4..d834c7066fcb 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -626,6 +626,29 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS
break;
}
}
+ else if(const SdrObject* pObject = pFrmFmt->FindRealSdrObject())
+ {
+ // No shadow, but we have an idea what was the original effectExtent.
+ uno::Any aAny;
+ pObject->GetGrabBagItem(aAny);
+ comphelper::SequenceAsHashMap aGrabBag(aAny);
+ comphelper::SequenceAsHashMap::iterator it = aGrabBag.find("CT_EffectExtent");
+ if (it != aGrabBag.end())
+ {
+ comphelper::SequenceAsHashMap aEffectExtent(it->second);
+ for (std::pair<const OUString, uno::Any>& rDirection : aEffectExtent)
+ {
+ if (rDirection.first == "l" && rDirection.second.has<sal_Int32>())
+ aLeftExt = OString::number(rDirection.second.get<sal_Int32>());
+ else if (rDirection.first == "t" && rDirection.second.has<sal_Int32>())
+ aTopExt = OString::number(rDirection.second.get<sal_Int32>());
+ else if (rDirection.first == "r" && rDirection.second.has<sal_Int32>())
+ aRightExt = OString::number(rDirection.second.get<sal_Int32>());
+ else if (rDirection.first == "b" && rDirection.second.has<sal_Int32>())
+ aBottomExt = OString::number(rDirection.second.get<sal_Int32>());
+ }
+ }
+ }
m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_effectExtent,
XML_l, aLeftExt,