diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-06-25 13:49:53 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-06-25 13:49:53 (GMT) |
commit | db8f05e257019694f5e8076845626008f2adc3dd (patch) | |
tree | 05d3959403cf15ac5f702091439e028af01f343b /src/gui/text/qtextodfwriter.cpp | |
parent | 8aafaa65a1d16f8b982279f5aceedf1e281ddb5a (diff) | |
parent | 796a5a2c7d8c91a46ac761dde18b7da2ec6c177b (diff) | |
download | Qt-db8f05e257019694f5e8076845626008f2adc3dd.zip Qt-db8f05e257019694f5e8076845626008f2adc3dd.tar.gz Qt-db8f05e257019694f5e8076845626008f2adc3dd.tar.bz2 |
Merge commit 'qt/master-stable' into 4.6-stable
Bring Qt 4.6 into the Qt-S60 repo.
Conflicts:
configure.exe
mkspecs/features/qttest_p4.prf
qmake/generators/makefile.cpp
src/corelib/io/qdir.cpp
src/corelib/io/qprocess.h
src/corelib/kernel/qcoreevent.h
src/corelib/kernel/qobject.cpp
src/corelib/kernel/qsharedmemory_unix.cpp
src/corelib/thread/qthread_p.h
src/corelib/tools/qvector.h
src/gui/dialogs/qdialog.cpp
src/gui/dialogs/qfiledialog.cpp
src/gui/dialogs/qfiledialog_p.h
src/gui/dialogs/qmessagebox.cpp
src/gui/graphicsview/qgraphicsitem.cpp
src/gui/graphicsview/qgraphicsview.cpp
src/gui/image/qpixmapcache.cpp
src/gui/kernel/qapplication.cpp
src/gui/kernel/qapplication_p.h
src/gui/kernel/qwidget.cpp
src/gui/kernel/qwidget_p.h
src/gui/painting/qdrawhelper.cpp
src/gui/painting/qpaintengine_raster.cpp
src/gui/text/qfontengine_qpf.cpp
src/gui/widgets/qmenubar.cpp
src/network/socket/qlocalserver.cpp
src/testlib/qtestcase.cpp
src/testlib/testlib.pro
tests/auto/qimagereader/tst_qimagereader.cpp
tests/auto/qitemdelegate/tst_qitemdelegate.cpp
tests/auto/qnetworkreply/tst_qnetworkreply.cpp
tests/auto/qpixmap/qpixmap.pro
Diffstat (limited to 'src/gui/text/qtextodfwriter.cpp')
-rw-r--r-- | src/gui/text/qtextodfwriter.cpp | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 1edc3b8..bc8ac5b 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -295,28 +295,13 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc writer.writeAttribute(textNS, QString::fromLatin1("style-name"), QString::fromLatin1("c%1") .arg(frag.fragment().charFormatIndex())); bool escapeNextSpace = true; - int precedingSpaces = 0, precedingTabs = 0; + int precedingSpaces = 0; int exportedIndex = 0; for (int i=0; i <= fragmentText.count(); ++i) { - bool isTab = false, isSpace = false; - if (i < fragmentText.count()) { + bool isSpace = false; QChar character = fragmentText[i]; - isTab = character.unicode() == '\t'; isSpace = character.unicode() == ' '; - if (character.unicode() == 0x2028) { // soft-return - writer.writeCharacters(fragmentText.mid(exportedIndex, i)); - writer.writeEmptyElement(textNS, QString::fromLatin1("line-break")); - exportedIndex = i+1; - continue; - } - if (isSpace) { - ++precedingSpaces; - escapeNextSpace = true; - } - else if (isTab) { - precedingTabs++; - } - } + // find more than one space. -> <text:s text:c="2" /> if (!isSpace && escapeNextSpace && precedingSpaces > 1) { const bool startParag = exportedIndex == 0 && i == precedingSpaces; @@ -329,17 +314,27 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc precedingSpaces = 0; exportedIndex = i; } - // find tabs. -> <text:tab text:tab-ref="3" /> or <text:tab/> - if (!isTab && precedingTabs) { - writer.writeCharacters(fragmentText.mid(exportedIndex, i - precedingTabs - exportedIndex)); - writer.writeEmptyElement(textNS, QString::fromLatin1("tab")); - if (precedingTabs > 1) - writer.writeAttribute(textNS, QString::fromLatin1("tab-ref"), QString::number(precedingTabs)); - precedingTabs = 0; - exportedIndex = i; + + if (i < fragmentText.count()) { + if (character.unicode() == 0x2028) { // soft-return + //if (exportedIndex < i) + writer.writeCharacters(fragmentText.mid(exportedIndex, i - exportedIndex)); + writer.writeEmptyElement(textNS, QString::fromLatin1("line-break")); + exportedIndex = i+1; + continue; + } else if (character.unicode() == '\t') { // Tab + //if (exportedIndex < i) + writer.writeCharacters(fragmentText.mid(exportedIndex, i - exportedIndex)); + writer.writeEmptyElement(textNS, QString::fromLatin1("tab")); + exportedIndex = i+1; + precedingSpaces = 0; + } else if (isSpace) { + ++precedingSpaces; + escapeNextSpace = true; + } else if (!isSpace) { + precedingSpaces = 0; + } } - if (!isSpace && !isTab) - precedingSpaces = 0; } writer.writeCharacters(fragmentText.mid(exportedIndex)); @@ -477,7 +472,7 @@ void QTextOdfWriter::writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat if (format.hasProperty(QTextFormat::BlockRightMargin)) writer.writeAttribute(foNS, QString::fromLatin1("margin-right"), pixelToPoint(qMax(qreal(0.), format.rightMargin())) ); if (format.hasProperty(QTextFormat::TextIndent)) - writer.writeAttribute(foNS, QString::fromLatin1("text-indent"), QString::number(format.textIndent())); + writer.writeAttribute(foNS, QString::fromLatin1("text-indent"), pixelToPoint(format.textIndent())); if (format.hasProperty(QTextFormat::PageBreakPolicy)) { if (format.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysBefore) writer.writeAttribute(foNS, QString::fromLatin1("break-before"), QString::fromLatin1("page")); |