diff options
author | Nils Jeisecke <jeisecke@saltation.de> | 2010-08-31 13:39:43 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-08-31 13:39:43 (GMT) |
commit | af1af7a14c7d89a34267d955ca75ddd7abf5a370 (patch) | |
tree | 6d4b1a0bea14c0a9b0902da10d4f6b2d08196f55 /src/gui/text/qtextlist.cpp | |
parent | af2b8878ba7bd153876a5531a8119a4bdbc6b257 (diff) | |
download | Qt-af1af7a14c7d89a34267d955ca75ddd7abf5a370.zip Qt-af1af7a14c7d89a34267d955ca75ddd7abf5a370.tar.gz Qt-af1af7a14c7d89a34267d955ca75ddd7abf5a370.tar.bz2 |
Implemented suffix and prefix strings for the numbering in ordered lists as supported by ODF. Works also with HTML import/export by using Qt CSS properties extensions.
Merge-request: 1642
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/gui/text/qtextlist.cpp')
-rw-r--r-- | src/gui/text/qtextlist.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index a0ff520..c312d89 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -191,6 +191,13 @@ QString QTextList::itemText(const QTextBlock &blockIt) const QString result; const int style = format().style(); + QString numberPrefix; + QString numberSuffix = QLatin1String("."); + + if (format().hasProperty(QTextFormat::ListNumberPrefix)) + numberPrefix = format().numberPrefix(); + if (format().hasProperty(QTextFormat::ListNumberSuffix)) + numberSuffix = format().numberSuffix(); switch (style) { case QTextListFormat::ListDecimal: @@ -232,7 +239,7 @@ QString QTextList::itemText(const QTextBlock &blockIt) const if (q > 0) { int startDigit = i + (i+3)/4; int numDigits; - if (i % 4) { + if (i % 4) { // c[i] == 4|5|9|40|50|90|400|500|900 if ((i-2) % 4) { // c[i] == 4|9|40|90|400|900 => with substraction (IV, IX, XL, XC, ...) @@ -263,8 +270,9 @@ QString QTextList::itemText(const QTextBlock &blockIt) const Q_ASSERT(false); } if (blockIt.textDirection() == Qt::RightToLeft) - return result.prepend(QLatin1Char('.')); - return result + QLatin1Char('.'); + return numberSuffix + result + numberPrefix; + else + return numberPrefix + result + numberSuffix; } /*! |