Kaydet (Commit) dd1490db authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX export: improve <wp:effectExtent> handling

Change-Id: If8838529817c72f6e6a3730135a00312fe5c2ad3
üst 95c45bc2
...@@ -447,6 +447,15 @@ DECLARE_OOXMLEXPORT_TEST(testCropPixel, "crop-pixel.docx") ...@@ -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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -626,6 +626,29 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS ...@@ -626,6 +626,29 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS
break; 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, m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_effectExtent,
XML_l, aLeftExt, XML_l, aLeftExt,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment