Add possibilty to embed ole object and to pass paragraph borders

This commit is contained in:
Laurent Alonso
2011-11-03 14:57:48 +01:00
committed by Fridrich Štrba
parent 5d9a23ccec
commit 3e8dee1a48
2 changed files with 34 additions and 22 deletions

View File

@@ -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()));
}
}

View File

@@ -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");