diff options
author | Laurent Alonso <alonso@loria.fr> | 2011-11-03 14:57:48 +0100 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2011-11-03 15:01:20 +0100 |
commit | 3e8dee1a48bd80c52b5adda6bd9358c2136ea764 (patch) | |
tree | d081ccf4408d21550bc322bc48310b6b23bdf4b6 | |
parent | 5d9a23ccec9fc3733786d64b83d768719951b89f (diff) |
Add possibilty to embed ole object and to pass paragraph borders
-rw-r--r-- | writerperfect/source/filter/OdtGenerator.cxx | 9 | ||||
-rw-r--r-- | writerperfect/source/filter/TextRunStyle.cxx | 47 |
2 files changed, 34 insertions, 22 deletions
diff --git a/writerperfect/source/filter/OdtGenerator.cxx b/writerperfect/source/filter/OdtGenerator.cxx index 7c1e19e2357a..9e9ae1068d95 100644 --- a/writerperfect/source/filter/OdtGenerator.cxx +++ b/writerperfect/source/filter/OdtGenerator.cxx @@ -1268,9 +1268,12 @@ void OdtGenerator::insertBinaryObject(const WPXPropertyList &propList, const WPX } } else - // assuming we have a binary image that we can just insert as it is + // assuming we have a binary image or a object_ole that we can just insert as it is { - mpImpl->mpCurrentContentElements->push_back(new TagOpenElement("draw:image")); + 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())); mpImpl->mpCurrentContentElements->push_back(new TagOpenElement("office:binary-data")); @@ -1280,7 +1283,7 @@ void OdtGenerator::insertBinaryObject(const WPXPropertyList &propList, const WPX mpImpl->mpCurrentContentElements->push_back(new TagCloseElement("office:binary-data")); - mpImpl->mpCurrentContentElements->push_back(new TagCloseElement("draw:image")); + mpImpl->mpCurrentContentElements->push_back(new TagCloseElement(dataType.c_str())); } } diff --git a/writerperfect/source/filter/TextRunStyle.cxx b/writerperfect/source/filter/TextRunStyle.cxx index 092d3a2df5a1..6cc73783e460 100644 --- a/writerperfect/source/filter/TextRunStyle.cxx +++ b/writerperfect/source/filter/TextRunStyle.cxx @@ -69,32 +69,41 @@ void ParagraphStyle::write(OdfDocumentHandler *pHandler) const if (strcmp(i.key(), "style:list-style-name") == 0) propList.insert("style:list-style-name", i()->getStr()); #endif - if (strcmp(i.key(), "fo:margin-left") == 0) - propList.insert("fo:margin-left", i()->getStr()); - if (strcmp(i.key(), "fo:margin-right") == 0) - propList.insert("fo:margin-right", i()->getStr()); - if (strcmp(i.key(), "fo:text-indent") == 0) - propList.insert("fo:text-indent", i()->getStr()); - if (strcmp(i.key(), "fo:margin-top") == 0) - propList.insert("fo:margin-top", i()->getStr()); - if (strcmp(i.key(), "fo:margin-bottom") == 0) + if (strncmp(i.key(), "fo:margin-",10) == 0) { - if (i()->getDouble() > 0.0) - propList.insert("fo:margin-bottom", i()->getStr()); - else - propList.insert("fo:margin-bottom", 0.0); + if (strcmp(i.key(), "fo:margin-left") == 0 || + strcmp(i.key(), "fo:margin-right") == 0 || + strcmp(i.key(), "fo:margin-top") == 0) + propList.insert(i.key(), i()->getStr()); + else if (strcmp(i.key(), "fo:margin-bottom") == 0) + { + if (i()->getDouble() > 0.0) + propList.insert("fo:margin-bottom", i()->getStr()); + else + propList.insert("fo:margin-bottom", 0.0); + } } - if (strcmp(i.key(), "fo:line-height") == 0) + else if (strcmp(i.key(), "fo:text-indent") == 0) + propList.insert("fo:text-indent", i()->getStr()); + else if (strcmp(i.key(), "fo:line-height") == 0) propList.insert("fo:line-height", i()->getStr()); - if (strcmp(i.key(), "fo:break-before") == 0) + else if (strcmp(i.key(), "fo:break-before") == 0) propList.insert("fo:break-before", i()->getStr()); - if (strcmp(i.key(), "fo:text-align") == 0) + else if (strcmp(i.key(), "fo:text-align") == 0) propList.insert("fo:text-align", i()->getStr()); - if (strcmp(i.key(), "fo:text-align-last") == 0) + else if (strcmp(i.key(), "fo:text-align-last") == 0) propList.insert("fo:text-align-last", i()->getStr()); - if (strcmp(i.key(), "style:page-number") == 0) + else if (strcmp(i.key(), "style:page-number") == 0) propList.insert("style:page-number", i()->getStr()); - + else if (strncmp(i.key(), "fo:border", 9) == 0) + { + if (strcmp(i.key(), "fo:border") == 0 || + strcmp(i.key(), "fo:border-left") == 0 || + strcmp(i.key(), "fo:border-right") == 0 || + strcmp(i.key(), "fo:border-top") == 0 || + strcmp(i.key(), "fo:border-bottom") == 0) + propList.insert(i.key(), i()->getStr()); + } } propList.insert("style:justify-single-word", "false"); |