43 #include <QtCore/qfile.h> 44 #include <QtCore/qbytearray.h> 45 #include <QtCore/qfileinfo.h> 46 #include <QtCore/qtextcodec.h> 47 #include <QtCore/qtextstream.h> 48 #include <QtCore/qdebug.h> 66 #ifndef QT_NO_TEXTCODEC 262 #ifndef QT_NO_TEXTODFWRITER 263 if (format ==
"odf" || format ==
"opendocumentformat" || format ==
"odt") {
265 #ifndef QT_NO_TEXTCODEC 270 #endif // QT_NO_TEXTODFWRITER 272 #ifndef QT_NO_TEXTHTMLPARSER 273 if (format ==
"html" || format ==
"htm") {
275 qWarning() <<
"QTextDocumentWriter::write: the device can not be opened for writing";
279 #ifndef QT_NO_TEXTCODEC 287 if (format ==
"txt" || format ==
"plaintext") {
289 qWarning() <<
"QTextDocumentWriter::write: the device can not be opened for writing";
293 #ifndef QT_NO_TEXTCODEC 324 #ifndef QT_NO_TEXTCODEC 337 #ifndef QT_NO_TEXTCODEC 361 answer <<
"plaintext";
363 #ifndef QT_NO_TEXTHTMLPARSER 366 #ifndef QT_NO_TEXTODFWRITER 368 #endif // QT_NO_TEXTODFWRITER T qobject_cast(QObject *object)
QString fileName() const
Returns the name set by setFileName() or to the QFile constructors.
QString fileName() const
If the currently assigned device is a QFile, or if setFileName() has been called, this function retur...
QTextCodec * codec() const
Returns the codec that is currently assigned to the writer.
#define QT_END_NAMESPACE
This macro expands to.
bool isWritable() const
Returns true if data can be written to the device; otherwise returns false.
virtual void close()
First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen.
The QByteArray class provides an array of bytes.
void setCodec(QTextCodec *codec)
Sets the codec for this stream to codec.
QTextDocumentFragmentPrivate * d
bool write(const QTextDocument *document)
Writes the given document to the assigned device or file and returns true if successful; otherwise re...
QByteArray toLower() const
Returns a lowercase copy of the byte array.
The QString class provides a Unicode character string.
QString toPlainText() const
Returns the plain text contained in the document.
void setCodec(QTextCodec *codec)
Sets the codec for this stream to codec.
QIODevice * device() const
Returns the device currently assigned, or 0 if no device has been assigned.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_CORE_EXPORT void qWarning(const char *,...)
void setFormat(const QByteArray &format)
Sets the format used to write documents to the format specified.
void qSort(RandomAccessIterator start, RandomAccessIterator end)
QTextDocumentWriterPrivate * d
virtual QByteArray name() const =0
QTextCodec subclasses must reimplement this function.
QByteArray format() const
Returns the format used for writing documents.
The QFile class provides an interface for reading from and writing to files.
The QTextStream class provides a convenient interface for reading and writing text.
QTextDocumentWriter()
Constructs an empty QTextDocumentWriter object.
void setCodec(QTextCodec *codec)
void setDevice(QIODevice *device)
Sets the writer's device to the device specified.
static QTextCodec * codecForName(const QByteArray &name)
Searches all installed QTextCodec objects and returns the one which best matches name; the match is c...
virtual bool open(OpenMode mode)
Opens the device and sets its OpenMode to mode.
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
The QTextDocumentWriter class provides a format-independent interface for writing a QTextDocument to ...
QTextDocumentWriterPrivate(QTextDocumentWriter *qq)
static QList< QByteArray > supportedDocumentFormats()
Returns the list of document formats supported by QTextDocumentWriter.
The QTextCodec class provides conversions between text encodings.
The QFileInfo class provides system-independent file information.
The QIODevice class is the base interface class of all I/O devices in Qt.
void setFileName(const QString &fileName)
Sets the name of the file to be written to fileName.
The QTextDocumentFragment class represents a piece of formatted text from a QTextDocument.
QString toHtml(const QByteArray &encoding=QByteArray()) const
Returns a string containing an HTML representation of the document.
~QTextDocumentWriter()
Destroys the QTextDocumentWriter object.