src/gui/text/qtextodfwriter.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 30 5dc02b23752f
--- a/src/gui/text/qtextodfwriter.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/text/qtextodfwriter.cpp	Fri Feb 19 23:40:16 2010 +0200
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -484,6 +484,10 @@
         if (format.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter)
             writer.writeAttribute(foNS, QString::fromLatin1("break-after"), QString::fromLatin1("page"));
     }
+    if (format.hasProperty(QTextFormat::BackgroundBrush)) {
+        QBrush brush = format.background();
+        writer.writeAttribute(foNS, QString::fromLatin1("background-color"), brush.color().name());
+    }
     if (format.hasProperty(QTextFormat::BlockNonBreakableLines))
         writer.writeAttribute(foNS, QString::fromLatin1("keep-together"),
                 format.nonBreakableLines() ? QString::fromLatin1("true") : QString::fromLatin1("false"));
@@ -552,8 +556,8 @@
     }
     if (format.hasProperty(QTextFormat::FontLetterSpacing))
         writer.writeAttribute(foNS, QString::fromLatin1("letter-spacing"), pixelToPoint(format.fontLetterSpacing()));
-    if (format.hasProperty(QTextFormat::FontWordSpacing))
-        writer.writeAttribute(foNS, QString::fromLatin1("word-spacing"), pixelToPoint(format.fontWordSpacing()));
+    if (format.hasProperty(QTextFormat::FontWordSpacing) && format.fontWordSpacing() != 0)
+            writer.writeAttribute(foNS, QString::fromLatin1("word-spacing"), pixelToPoint(format.fontWordSpacing()));
     if (format.hasProperty(QTextFormat::FontUnderline))
         writer.writeAttribute(styleNS, QString::fromLatin1("text-underline-type"),
                 format.fontUnderline() ? QString::fromLatin1("single") : QString::fromLatin1("none"));
@@ -610,9 +614,12 @@
     }
     if (format.hasProperty(QTextFormat::ForegroundBrush)) {
         QBrush brush = format.foreground();
-        // TODO
         writer.writeAttribute(foNS, QString::fromLatin1("color"), brush.color().name());
     }
+    if (format.hasProperty(QTextFormat::BackgroundBrush)) {
+        QBrush brush = format.background();
+        writer.writeAttribute(foNS, QString::fromLatin1("background-color"), brush.color().name());
+    }
 
     writer.writeEndElement(); // style
 }