okular
textdocumentgenerator.cpp
Go to the documentation of this file.
53 Document::OpenResult TextDocumentConverter::convertWithPassword( const QString &fileName, const QString & )
70 DocumentViewport TextDocumentConverter::calculateViewport( QTextDocument *document, const QTextBlock &block )
111 textPage->append( text, new Okular::NormalizedRect( rect.left(), rect.top(), rect.right(), rect.bottom() ) );
135 void TextDocumentGeneratorPrivate::addAnnotation( Annotation *annotation, int cursorBegin, int cursorEnd )
150 void TextDocumentGeneratorPrivate::addTitle( int level, const QString &title, const QTextBlock &block )
160 void TextDocumentGeneratorPrivate::addMetaData( const QString &key, const QString &value, const QString &title )
178 TextDocumentUtils::calculateBoundingRect( mDocument, linkPosition.startPosition, linkPosition.endPosition,
194 TextDocumentUtils::calculateBoundingRect( mDocument, annotationPosition.startPosition, annotationPosition.endPosition,
213 Okular::DocumentViewport viewport = TextDocumentUtils::calculateViewport( mDocument, position.block );
275 TextDocumentGenerator::TextDocumentGenerator( TextDocumentConverter *converter, const QString& configName, QObject *parent, const QVariantList &args )
284 TextDocumentGenerator::TextDocumentGenerator( TextDocumentConverter *converter, QObject *parent, const QVariantList &args )
296 Document::OpenResult TextDocumentGenerator::loadDocumentWithPassword( const QString & fileName, QVector<Okular::Page*> & pagesVector, const QString &password )
299 const Document::OpenResult openResult = d->mConverter->convertWithPassword( fileName, password );
312 Q_FOREACH ( const TextDocumentGeneratorPrivate::AnnotationPosition &annPos, d->mAnnotationPositions )
339 objects[ info.page ].append( new Okular::ObjectRect( rect.left(), rect.top(), rect.right(), rect.bottom(), false,
356 QLinkedList<Okular::Annotation*>::ConstIterator annIt = annots.at( i ).begin(), annEnd = annots.at( i ).end();
471 QVariant TextDocumentGeneratorPrivate::metaData( const QString &key, const QVariant &option ) const
489 formats.append( Okular::ExportFormat::standardFormat( Okular::ExportFormat::OpenDocumentText ) );
500 bool TextDocumentGenerator::exportTo( const QString &fileName, const Okular::ExportFormat &format )
527 } else if ( format.mimeType()->name() == QLatin1String( "application/vnd.oasis.opendocument.text" ) ) {
virtual Document::OpenResult convertWithPassword(const QString &fileName, const QString &password)
Returns the generated QTextDocument object.
Definition: textdocumentgenerator.cpp:53
const Okular::DocumentSynopsis * generateDocumentSynopsis()
Returns the 'table of content' object of the document or 0 if no table of content is available...
Definition: textdocumentgenerator.cpp:462
static void calculateBoundingRect(QTextDocument *document, int startPosition, int endPosition, QRectF &rect, int &page)
Definition: textdocumentgenerator_p.h:26
Whether the Generator supports export to PDF & PS through the Print Dialog.
Definition: generator.h:209
Okular::TextPage * createTextPage(int) const
Generic Generator Implementation.
Definition: textdocumentgenerator.cpp:83
static void calculatePositions(QTextDocument *document, int page, int &start, int &end)
Definition: textdocumentgenerator_p.h:69
pageSize
void addMetaData(const QString &key, const QString &value, const QString &title)
Definition: textdocumentgenerator.cpp:160
QRectF boundingRect
Definition: textdocumentgenerator_p.h:174
int width() const
bool end()
QList< AnnotationInfo > mAnnotationInfos
Definition: textdocumentgenerator_p.h:193
Action * link
Definition: textdocumentgenerator_p.h:167
The TextPage class represents the text of a page by providing.
Definition: textpage.h:90
T pop()
QList< LinkPosition > mLinkPositions
Definition: textdocumentgenerator_p.h:169
QTextDocument * mDocument
Definition: textdocumentgenerator_p.h:109
QDomNode appendChild(const QDomNode &newChild)
QRectF boundingRect
Definition: textdocumentgenerator_p.h:190
virtual QTextDocument * convert(const QString &fileName)
Returns the generated QTextDocument object.
Definition: textdocumentgenerator.cpp:48
void setOutputFileName(const QString &fileName)
iterator begin()
virtual bool canGeneratePixmap() const
This method returns whether the generator is ready to handle a new pixmap request.
Definition: generator.cpp:229
void push(const T &t)
int startPosition
Definition: textdocumentgenerator_p.h:181
void scale(qreal sx, qreal sy)
Annotation * annotation
Definition: textdocumentgenerator_p.h:191
QString selectedText() const
void addTitle(int level, const QString &title, const QTextBlock &position)
Definition: textdocumentgenerator.cpp:150
bool doCloseDocument()
This method is called when the document is closed and not used any longer.
Definition: textdocumentgenerator.cpp:365
NormalizedRect is a helper class which stores the coordinates of a normalized rect, which is a rectangle of.
Definition: area.h:105
QList< LinkInfo > mLinkInfos
Definition: textdocumentgenerator_p.h:177
void addAnnotation(Annotation *annotation, int cursorBegin, int cursorEnd)
Definition: textdocumentgenerator.cpp:135
qreal top() const
DocumentViewport calculateViewport(QTextDocument *document, const QTextBlock &block)
This method can be used to calculate the viewport for a given text block.
Definition: textdocumentgenerator.cpp:70
TextDocumentSettings * generalSettings()
Config skeleton for TextDocumentSettingsWidget.
Definition: textdocumentgenerator.cpp:559
qreal left() const
TextDocumentGeneratorPrivate * mParent
Definition: textdocumentgenerator_p.h:108
QVariant metaData(const QString &key, const QVariant &option) const
Definition: textdocumentgenerator.cpp:471
static Okular::DocumentViewport calculateViewport(QTextDocument *document, const QTextBlock &block)
Definition: textdocumentgenerator_p.h:82
Definition: generator.h:202
Okular::TextPage * textPage(Okular::Page *page)
Returns the text page for the given page.
Definition: textdocumentgenerator.cpp:439
qreal bottom() const
int page
Definition: textdocumentgenerator_p.h:173
static ExportFormat standardFormat(StandardExportFormat type)
Builds a standard format for the specified type .
Definition: generator.cpp:624
void append(const T &value)
QString get(const QString &key) const
Returns the value for a given key or an empty string when the key doesn't exist.
Definition: document.cpp:4680
void resize(int size)
void addPages(KConfigDialog *dlg)
Does nothing by default. You need to reimplement it in your generator.
Definition: textdocumentgenerator.cpp:553
void setObjectRects(const QLinkedList< ObjectRect * > &rects)
Sets the list of object rects of the page.
Definition: page.cpp:554
void fill(uint pixelValue)
void setAttribute(const QString &name, const QString &value)
virtual ~TextDocumentGenerator()
Definition: textdocumentgenerator.cpp:292
QTextDocument * mDocument
Definition: textdocumentgenerator_p.h:151
bool isEmpty() const
TextDocumentSettings * mGeneralSettings
Definition: textdocumentgenerator_p.h:195
Definition: document.h:106
QAbstractTextDocumentLayout * documentLayout() const
bool reparseConfig()
By default checks if the default font has changed or not.
Definition: textdocumentgenerator.cpp:540
QList< AnnotationPosition > mAnnotationPositions
Definition: textdocumentgenerator_p.h:185
Annotation * annotation
Definition: textdocumentgenerator_p.h:183
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QTextDocument * document()
Returns the generated QTextDocument object.
Definition: textdocumentgenerator.cpp:60
int endPosition
Definition: textdocumentgenerator_p.h:166
void generateTitleInfos()
Definition: textdocumentgenerator.cpp:202
int page
Definition: textdocumentgenerator_p.h:189
Okular::DocumentInfo mDocumentInfo
Definition: textdocumentgenerator_p.h:152
Action * link
Definition: textdocumentgenerator_p.h:175
void setDefaultFont(const QFont &font)
qreal right() const
int level
Definition: textdocumentgenerator_p.h:157
TextDocumentConverter * mConverter
Definition: textdocumentgenerator_p.h:149
Whether the Generator supports native cross-platform printing (QPainter-based).
Definition: generator.h:207
A DOM tree containing information about the document.
Definition: document.h:1086
TextDocumentGenerator(TextDocumentConverter *converter, const QString &configName, QObject *parent, const QVariantList &args)
Creates a new generator that uses the specified converter.
Definition: textdocumentgenerator.cpp:275
const Okular::DocumentInfo * generateDocumentInfo()
Returns the general information object of the document or 0 if no information are available...
Definition: textdocumentgenerator.cpp:456
void addAction(Action *action, int cursorBegin, int cursorEnd)
Definition: textdocumentgenerator.cpp:122
void set(const QString &key, const QString &value, const QString &title=QString())
Sets a value for a special key.
Definition: document.cpp:4651
void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation)
QList< TitlePosition > mTitlePositions
Definition: textdocumentgenerator_p.h:161
void generateLinkInfos()
Definition: textdocumentgenerator.cpp:170
void setDocument(QTextDocument *document)
Sets the converted QTextDocument object.
Definition: textdocumentgenerator.cpp:65
bool isEmpty() const
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:90
void initializeGenerator()
Definition: textdocumentgenerator.cpp:238
void generateAnnotationInfos()
Definition: textdocumentgenerator.cpp:186
bool write(const QTextDocument *document)
int height() const
int startPosition
Definition: textdocumentgenerator_p.h:165
virtual void generatePixmap(PixmapRequest *request)
This method can be called to trigger the generation of a new pixmap as described by request...
Definition: generator.cpp:235
int length() const
QString title
Definition: textdocumentgenerator_p.h:158
void translate(const QPointF &offset)
virtual void draw(QPainter *painter, const PaintContext &context)=0
int endPosition
Definition: textdocumentgenerator_p.h:182
bool print(QPrinter &printer)
This method is called to print the document to the given printer.
Definition: textdocumentgenerator.cpp:445
Whether the Generator can extract text from the document in the form of TextPage's.
Definition: generator.h:203
bool exportTo(const QString &fileName, const Okular::ExportFormat &format)
This method is called to export the document in the given format and save it under the given fileName...
Definition: textdocumentgenerator.cpp:500
void addAnnotation(Annotation *annotation)
Adds a new annotation to the page.
Definition: page.cpp:631
QDomElement createElement(const QString &tagName)
QTextBlock block
Definition: textdocumentgenerator_p.h:159
Okular::DocumentSynopsis mDocumentSynopsis
Definition: textdocumentgenerator_p.h:153
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setOutputFormat(OutputFormat format)
Definition: document.h:105
bool begin(QPaintDevice *device)
Document::OpenResult loadDocumentWithPassword(const QString &fileName, QVector< Okular::Page * > &pagesVector, const QString &password)
Loads the document with the given fileName and password and fills the pagesVector with the parsed pag...
Definition: textdocumentgenerator.cpp:296
bool supportsThreadedFontRendering()
A DOM tree that describes the Table of Contents.
Definition: document.h:1167
void append(const QString &text, NormalizedRect *area)
Appends the given text with the given area as new TextEntity to the page.
Definition: textpage.cpp:251
Okular::ExportFormat::List exportFormats() const
Returns the list of additional supported export formats.
Definition: textdocumentgenerator.cpp:481
QList< QByteArray > supportedDocumentFormats()
void generatePixmap(Okular::PixmapRequest *request)
This method can be called to trigger the generation of a new pixmap as described by request...
Definition: textdocumentgenerator.cpp:388
TextDocumentGenerator * generator() const
Returns the generator that owns this converter.
Definition: textdocumentgenerator.cpp:75
QImage image(PixmapRequest *)
Definition: textdocumentgenerator.cpp:393
bool canGeneratePixmap() const
This method returns whether the generator is ready to handle a new pixmap request.
Definition: textdocumentgenerator.cpp:383
T & top()
void setPosition(int pos, MoveMode m)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.