src/gui/text/qtextodfwriter.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
child 30 5dc02b23752f
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
   482         if (format.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysBefore)
   482         if (format.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysBefore)
   483             writer.writeAttribute(foNS, QString::fromLatin1("break-before"), QString::fromLatin1("page"));
   483             writer.writeAttribute(foNS, QString::fromLatin1("break-before"), QString::fromLatin1("page"));
   484         if (format.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter)
   484         if (format.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter)
   485             writer.writeAttribute(foNS, QString::fromLatin1("break-after"), QString::fromLatin1("page"));
   485             writer.writeAttribute(foNS, QString::fromLatin1("break-after"), QString::fromLatin1("page"));
   486     }
   486     }
       
   487     if (format.hasProperty(QTextFormat::BackgroundBrush)) {
       
   488         QBrush brush = format.background();
       
   489         writer.writeAttribute(foNS, QString::fromLatin1("background-color"), brush.color().name());
       
   490     }
   487     if (format.hasProperty(QTextFormat::BlockNonBreakableLines))
   491     if (format.hasProperty(QTextFormat::BlockNonBreakableLines))
   488         writer.writeAttribute(foNS, QString::fromLatin1("keep-together"),
   492         writer.writeAttribute(foNS, QString::fromLatin1("keep-together"),
   489                 format.nonBreakableLines() ? QString::fromLatin1("true") : QString::fromLatin1("false"));
   493                 format.nonBreakableLines() ? QString::fromLatin1("true") : QString::fromLatin1("false"));
   490     if (format.hasProperty(QTextFormat::TabPositions)) {
   494     if (format.hasProperty(QTextFormat::TabPositions)) {
   491         QList<QTextOption::Tab> tabs = format.tabPositions();
   495         QList<QTextOption::Tab> tabs = format.tabPositions();
   550             writer.writeAttribute(foNS, QString::fromLatin1("font-variant"), QString::fromLatin1("small-caps")); break;
   554             writer.writeAttribute(foNS, QString::fromLatin1("font-variant"), QString::fromLatin1("small-caps")); break;
   551         }
   555         }
   552     }
   556     }
   553     if (format.hasProperty(QTextFormat::FontLetterSpacing))
   557     if (format.hasProperty(QTextFormat::FontLetterSpacing))
   554         writer.writeAttribute(foNS, QString::fromLatin1("letter-spacing"), pixelToPoint(format.fontLetterSpacing()));
   558         writer.writeAttribute(foNS, QString::fromLatin1("letter-spacing"), pixelToPoint(format.fontLetterSpacing()));
   555     if (format.hasProperty(QTextFormat::FontWordSpacing))
   559     if (format.hasProperty(QTextFormat::FontWordSpacing) && format.fontWordSpacing() != 0)
   556         writer.writeAttribute(foNS, QString::fromLatin1("word-spacing"), pixelToPoint(format.fontWordSpacing()));
   560             writer.writeAttribute(foNS, QString::fromLatin1("word-spacing"), pixelToPoint(format.fontWordSpacing()));
   557     if (format.hasProperty(QTextFormat::FontUnderline))
   561     if (format.hasProperty(QTextFormat::FontUnderline))
   558         writer.writeAttribute(styleNS, QString::fromLatin1("text-underline-type"),
   562         writer.writeAttribute(styleNS, QString::fromLatin1("text-underline-type"),
   559                 format.fontUnderline() ? QString::fromLatin1("single") : QString::fromLatin1("none"));
   563                 format.fontUnderline() ? QString::fromLatin1("single") : QString::fromLatin1("none"));
   560     if (format.hasProperty(QTextFormat::FontOverline)) {
   564     if (format.hasProperty(QTextFormat::FontOverline)) {
   561         //   bool   fontOverline () const  TODO
   565         //   bool   fontOverline () const  TODO
   608     if (format.hasProperty(QTextFormat::AnchorName)) {
   612     if (format.hasProperty(QTextFormat::AnchorName)) {
   609         //   QString   anchorName () const  TODO
   613         //   QString   anchorName () const  TODO
   610     }
   614     }
   611     if (format.hasProperty(QTextFormat::ForegroundBrush)) {
   615     if (format.hasProperty(QTextFormat::ForegroundBrush)) {
   612         QBrush brush = format.foreground();
   616         QBrush brush = format.foreground();
   613         // TODO
       
   614         writer.writeAttribute(foNS, QString::fromLatin1("color"), brush.color().name());
   617         writer.writeAttribute(foNS, QString::fromLatin1("color"), brush.color().name());
       
   618     }
       
   619     if (format.hasProperty(QTextFormat::BackgroundBrush)) {
       
   620         QBrush brush = format.background();
       
   621         writer.writeAttribute(foNS, QString::fromLatin1("background-color"), brush.color().name());
   615     }
   622     }
   616 
   623 
   617     writer.writeEndElement(); // style
   624     writer.writeEndElement(); // style
   618 }
   625 }
   619 
   626