[Libreoffice-commits] .: writerperfect/source

Fridrich Strba fridrich at kemper.freedesktop.org
Thu Nov 3 07:01:28 PDT 2011


 writerperfect/source/filter/OdtGenerator.cxx |    9 +++--
 writerperfect/source/filter/TextRunStyle.cxx |   47 ++++++++++++++++-----------
 2 files changed, 34 insertions(+), 22 deletions(-)

New commits:
commit 3e8dee1a48bd80c52b5adda6bd9358c2136ea764
Author: Laurent Alonso <alonso at loria.fr>
Date:   Thu Nov 3 14:57:48 2011 +0100

    Add possibilty to embed ole object and to pass paragraph borders

diff --git a/writerperfect/source/filter/OdtGenerator.cxx b/writerperfect/source/filter/OdtGenerator.cxx
index 7c1e19e..9e9ae10 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 092d3a2..6cc7378 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");


More information about the Libreoffice-commits mailing list