Changeset 561 for trunk/src/gui/text/qtextdocument.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/text/qtextdocument.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 65 65 #include "qtextdocument_p.h" 66 66 #include <private/qprinter_p.h> 67 #include <private/qabstracttextdocumentlayout_p.h> 67 68 68 69 #include <limits.h> … … 141 142 /*! 142 143 Converts the plain text string \a plain to a HTML string with 143 HTML metacharacters \c{<}, \c{>}, and \c{&} replaced by HTML144 HTML metacharacters \c{<}, \c{>}, \c{&}, and \c{"} replaced by HTML 144 145 entities. 145 146 … … 163 164 else if (plain.at(i) == QLatin1Char('&')) 164 165 rich += QLatin1String("&"); 166 else if (plain.at(i) == QLatin1Char('"')) 167 rich += QLatin1String("""); 165 168 else 166 169 rich += plain.at(i); … … 248 251 viewed and edited using a QTextEdit. 249 252 250 \ingroup text251 \mainclass 253 \ingroup richtext-processing 254 252 255 253 256 QTextDocument is a container for structured rich text documents, providing … … 288 291 system. 289 292 290 \sa QTextCursor QTextEdit \link richtext.html Rich Text Processing\endlink293 \sa QTextCursor, QTextEdit, \link richtext.html Rich Text Processing\endlink , {Text Object Example} 291 294 */ 292 295 … … 957 960 /*! 958 961 Returns true if undo is available; otherwise returns false. 962 963 \sa isRedoAvailable(), availableUndoSteps() 959 964 */ 960 965 bool QTextDocument::isUndoAvailable() const … … 966 971 /*! 967 972 Returns true if redo is available; otherwise returns false. 973 974 \sa isUndoAvailable(), availableRedoSteps() 968 975 */ 969 976 bool QTextDocument::isRedoAvailable() const … … 973 980 } 974 981 982 /*! \since 4.6 983 984 Returns the number of available undo steps. 985 986 \sa isUndoAvailable() 987 */ 988 int QTextDocument::availableUndoSteps() const 989 { 990 Q_D(const QTextDocument); 991 return d->availableUndoSteps(); 992 } 993 994 /*! \since 4.6 995 996 Returns the number of available redo steps. 997 998 \sa isRedoAvailable() 999 */ 1000 int QTextDocument::availableRedoSteps() const 1001 { 1002 Q_D(const QTextDocument); 1003 return d->availableRedoSteps(); 1004 } 975 1005 976 1006 /*! \since 4.4 … … 986 1016 { 987 1017 Q_D(const QTextDocument); 988 return d-> undoState;1018 return d->revision; 989 1019 } 990 1020 … … 1097 1127 bool previousState = d->isUndoRedoEnabled(); 1098 1128 d->enableUndoRedo(false); 1129 d->beginEditBlock(); 1099 1130 d->clear(); 1100 1131 QTextCursor(this).insertText(text); 1132 d->endEditBlock(); 1101 1133 d->enableUndoRedo(previousState); 1102 1134 } … … 1124 1156 bool previousState = d->isUndoRedoEnabled(); 1125 1157 d->enableUndoRedo(false); 1158 d->beginEditBlock(); 1126 1159 d->clear(); 1127 1160 QTextHtmlImporter(this, html, QTextHtmlImporter::ImportToDocument).import(); 1161 d->endEditBlock(); 1128 1162 d->enableUndoRedo(previousState); 1129 1163 } … … 1690 1724 layout->setPaintDevice(p.device()); 1691 1725 1726 // copy the custom object handlers 1727 layout->d_func()->handlers = documentLayout()->d_func()->handlers; 1728 1692 1729 int dpiy = p.device()->logicalDpiY(); 1693 1730 int margin = 0; … … 1730 1767 fromPage = qMax(1, fromPage); 1731 1768 toPage = qMin(doc->pageCount(), toPage); 1769 1770 if (toPage < fromPage) { 1771 // if the user entered a page range outside the actual number 1772 // of printable pages, just return 1773 return; 1774 } 1732 1775 1733 1776 if (printer->pageOrder() == QPrinter::LastPageFirst) { … … 2035 2078 html += QLatin1String(attribute); 2036 2079 html += QLatin1String("=\""); 2037 html += value;2080 html += Qt::escape(value); 2038 2081 html += QLatin1Char('"'); 2039 2082 } … … 2202 2245 html += QLatin1String("%\""); 2203 2246 else 2204 html += QLatin1 String("\"");2247 html += QLatin1Char('\"'); 2205 2248 } 2206 2249 … … 2299 2342 html += QLatin1String(" font-family:"); 2300 2343 2301 QLatin1 Char quote('\'');2302 if (family.contains( quote))2303 quote = QLatin1 Char('\"');2344 QLatin1String quote("\'"); 2345 if (family.contains(QLatin1Char('\''))) 2346 quote = QLatin1String("""); 2304 2347 2305 2348 html += quote; 2306 html += family;2349 html += Qt::escape(family); 2307 2350 html += quote; 2308 2351 html += QLatin1Char(';'); … … 2338 2381 if (!name.isEmpty()) { 2339 2382 html += QLatin1String("<a name=\""); 2340 html += name;2383 html += Qt::escape(name); 2341 2384 html += QLatin1String("\"></a>"); 2342 2385 } … … 2344 2387 if (!href.isEmpty()) { 2345 2388 html += QLatin1String("<a href=\""); 2346 html += href;2389 html += Qt::escape(href); 2347 2390 html += QLatin1String("\">"); 2348 2391 closeAnchor = true; … … 2417 2460 { 2418 2461 return style == QTextListFormat::ListDecimal || style == QTextListFormat::ListLowerAlpha 2419 || style == QTextListFormat::ListUpperAlpha; 2462 || style == QTextListFormat::ListUpperAlpha 2463 || style == QTextListFormat::ListUpperRoman 2464 || style == QTextListFormat::ListLowerRoman 2465 ; 2420 2466 } 2421 2467 … … 2514 2560 case QTextListFormat::ListLowerAlpha: html += QLatin1String("<ol type=\"a\""); break; 2515 2561 case QTextListFormat::ListUpperAlpha: html += QLatin1String("<ol type=\"A\""); break; 2562 case QTextListFormat::ListLowerRoman: html += QLatin1String("<ol type=\"i\""); break; 2563 case QTextListFormat::ListUpperRoman: html += QLatin1String("<ol type=\"I\""); break; 2516 2564 default: html += QLatin1String("<ul"); // ### should not happen 2517 2565 } 2518 2566 2567 html += QLatin1String(" style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;"); 2568 2519 2569 if (format.hasProperty(QTextFormat::ListIndent)) { 2520 html += QLatin1String(" style=\"-qt-list-indent: ");2570 html += QLatin1String(" -qt-list-indent: "); 2521 2571 html += QString::number(format.indent()); 2522 html += QLatin1 String(";\"");2572 html += QLatin1Char(';'); 2523 2573 } 2524 2574 2525 html += QLatin1 Char('>');2575 html += QLatin1String("\">"); 2526 2576 } 2527 2577
Note:
See TracChangeset
for help on using the changeset viewer.