From fa22c33794245d64056ed0f7b6260ddd60f9dc70 Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Tue, 6 Dec 2011 16:14:12 +0100 Subject: Allow inserting of ole objects into draw documents --- writerperfect/source/filter/OdgGenerator.cxx | 10 ++++++++-- writerperfect/source/filter/OdtGenerator.cxx | 13 ++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx index f4d68dce7913..4d70f8d41ea5 100644 --- a/writerperfect/source/filter/OdgGenerator.cxx +++ b/writerperfect/source/filter/OdgGenerator.cxx @@ -964,7 +964,10 @@ void OdgGenerator::drawGraphicObject(const ::WPXPropertyList &propList, const :: pDrawFrameElement->addAttribute("svg:width", propList["svg:width"]->getStr()); mpImpl->mBodyElements.push_back(pDrawFrameElement); - mpImpl->mBodyElements.push_back(new TagOpenElement("draw:image")); + if (propList["libwpg:mime-type"]->getStr() == "object/ole") + mpImpl->mBodyElements.push_back(new TagOpenElement("draw:object-ole")); + else + mpImpl->mBodyElements.push_back(new TagOpenElement("draw:image")); mpImpl->mBodyElements.push_back(new TagOpenElement("office:binary-data")); @@ -973,7 +976,10 @@ void OdgGenerator::drawGraphicObject(const ::WPXPropertyList &propList, const :: mpImpl->mBodyElements.push_back(new TagCloseElement("office:binary-data")); - mpImpl->mBodyElements.push_back(new TagCloseElement("draw:image")); + if (propList["libwpg:mime-type"]->getStr() == "object/ole") + mpImpl->mBodyElements.push_back(new TagCloseElement("draw:object-ole")); + else + mpImpl->mBodyElements.push_back(new TagCloseElement("draw:image")); mpImpl->mBodyElements.push_back(new TagCloseElement("draw:frame")); } diff --git a/writerperfect/source/filter/OdtGenerator.cxx b/writerperfect/source/filter/OdtGenerator.cxx index b6096786115b..94e46c98447f 100644 --- a/writerperfect/source/filter/OdtGenerator.cxx +++ b/writerperfect/source/filter/OdtGenerator.cxx @@ -1264,10 +1264,10 @@ void OdtGenerator::insertBinaryObject(const WPXPropertyList &propList, const WPX else // assuming we have a binary image or a object_ole that we can just insert as it is { - std::string dataType = "draw:image"; - if (propList["libwpd:mimetype"]->getStr() == "object/ole") - dataType = "draw:object-ole"; - mpImpl->mpCurrentContentElements->push_back(new TagOpenElement(dataType.c_str())); + if (propList["libwpg:mime-type"]->getStr() == "object/ole") + mpImpl->mpCurrentContentElements->push_back(new TagOpenElement("draw:object-ole")); + else + mpImpl->mpCurrentContentElements->push_back(new TagOpenElement("draw:image")); mpImpl->mpCurrentContentElements->push_back(new TagOpenElement("office:binary-data")); @@ -1277,7 +1277,10 @@ void OdtGenerator::insertBinaryObject(const WPXPropertyList &propList, const WPX mpImpl->mpCurrentContentElements->push_back(new TagCloseElement("office:binary-data")); - mpImpl->mpCurrentContentElements->push_back(new TagCloseElement(dataType.c_str())); + if (propList["libwpg:mime-type"]->getStr() == "object/ole") + mpImpl->mpCurrentContentElements->push_back(new TagCloseElement("draw:object-ole")); + else + mpImpl->mpCurrentContentElements->push_back(new TagCloseElement("draw:image")); } } -- cgit