• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

okular

  • sources
  • kde-4.14
  • kdegraphics
  • okular
  • core
textdocumentgenerator.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2007 by Tobias Koenig <tokoe@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  ***************************************************************************/
9 
10 #ifndef _OKULAR_TEXTDOCUMENTGENERATOR_H_
11 #define _OKULAR_TEXTDOCUMENTGENERATOR_H_
12 
13 #include "okular_export.h"
14 
15 #include "document.h"
16 #include "generator.h"
17 #include "textdocumentsettings.h"
18 #include "../interfaces/configinterface.h"
19 
20 class QTextBlock;
21 class QTextDocument;
22 
23 namespace Okular {
24 
25 class TextDocumentConverterPrivate;
26 class TextDocumentGenerator;
27 class TextDocumentGeneratorPrivate;
28 
29 class OKULAR_EXPORT TextDocumentConverter : public QObject
30 {
31  Q_OBJECT
32 
33  friend class TextDocumentGenerator;
34  friend class TextDocumentGeneratorPrivate;
35 
36  public:
40  TextDocumentConverter();
41 
45  ~TextDocumentConverter();
46 
52  virtual QTextDocument *convert( const QString &fileName );
53 
57  virtual Document::OpenResult convertWithPassword( const QString &fileName, const QString &password );
58 
62  QTextDocument *document();
63 
64  Q_SIGNALS:
69  void addAction( Action *link, int cursorBegin, int cursorEnd );
70 
75  void addAnnotation( Annotation *annotation, int cursorBegin, int cursorEnd );
76 
80  void addTitle( int level, const QString &title, const QTextBlock &position );
81 
85  void addMetaData( const QString &key, const QString &value, const QString &title );
86 
92  void addMetaData( DocumentInfo::Key key, const QString &value );
93 
100  void error( const QString &message, int duration );
101 
108  void warning( const QString &message, int duration );
109 
116  void notice( const QString &message, int duration );
117 
118  protected:
122  void setDocument( QTextDocument *document );
123 
130  DocumentViewport calculateViewport( QTextDocument *document, const QTextBlock &block );
131 
139  TextDocumentGenerator* generator() const;
140 
141  private:
142  TextDocumentConverterPrivate *d_ptr;
143  Q_DECLARE_PRIVATE( TextDocumentConverter )
144  Q_DISABLE_COPY( TextDocumentConverter )
145 };
146 
153 class OKULAR_EXPORT TextDocumentGenerator : public Generator, public Okular::ConfigInterface
154 {
156  friend class TextDocumentConverter;
158 
159  Q_OBJECT
160  Q_INTERFACES( Okular::ConfigInterface )
161 
162  public:
172  TextDocumentGenerator( TextDocumentConverter *converter, const QString& configName, QObject *parent, const QVariantList &args );
181  KDE_DEPRECATED TextDocumentGenerator( TextDocumentConverter *converter, QObject *parent, const QVariantList &args );
182  virtual ~TextDocumentGenerator();
183 
184  // [INHERITED] load a document and fill up the pagesVector
185  Document::OpenResult loadDocumentWithPassword( const QString & fileName, QVector<Okular::Page*> & pagesVector, const QString &password );
186 
187  // [INHERITED] perform actions on document / pages
188  bool canGeneratePixmap() const;
189  void generatePixmap( Okular::PixmapRequest * request );
190 
191  // [INHERITED] print document using already configured QPrinter
192  bool print( QPrinter& printer );
193 
194  // [INHERITED] text exporting
195  Okular::ExportFormat::List exportFormats() const;
196  bool exportTo( const QString &fileName, const Okular::ExportFormat &format );
197 
198  // [INHERITED] config interface
200  bool reparseConfig();
202  void addPages( KConfigDialog* dlg );
203 
212  TextDocumentSettings* generalSettings();
213 
214  const Okular::DocumentInfo* generateDocumentInfo();
215  const Okular::DocumentSynopsis* generateDocumentSynopsis();
216 
217  protected:
218  bool doCloseDocument();
219  Okular::TextPage* textPage( Okular::Page *page );
220 
221  private:
222  Q_DECLARE_PRIVATE( TextDocumentGenerator )
223  Q_DISABLE_COPY( TextDocumentGenerator )
224 
225  Q_PRIVATE_SLOT( d_func(), void addAction( Action*, int, int ) )
226  Q_PRIVATE_SLOT( d_func(), void addAnnotation( Annotation*, int, int ) )
227  Q_PRIVATE_SLOT( d_func(), void addTitle( int, const QString&, const QTextBlock& ) )
228  Q_PRIVATE_SLOT( d_func(), void addMetaData( const QString&, const QString&, const QString& ) )
229  Q_PRIVATE_SLOT( d_func(), void addMetaData( DocumentInfo::Key, const QString& ) )
230 };
231 
232 }
233 
234 #endif
generator.h
Okular::TextPage
The TextPage class represents the text of a page by providing.
Definition: textpage.h:90
QPrinter
okular_export.h
Okular::DocumentInfo::Key
Key
The list of predefined keys.
Definition: document.h:1092
Okular::Document::OpenResult
OpenResult
Describes the result of an open document operation.
Definition: document.h:103
Okular::TextDocumentUtils::calculateViewport
static Okular::DocumentViewport calculateViewport(QTextDocument *document, const QTextBlock &block)
Definition: textdocumentgenerator_p.h:82
Okular::ConfigInterface
Abstract interface for configuration control.
Definition: configinterface.h:38
QObject
Okular::TextDocumentConverter
Definition: textdocumentgenerator.h:29
Okular::TextDocumentGeneratorPrivate
Definition: textdocumentgenerator_p.h:112
Okular::Page
Collector for all the data belonging to a page.
Definition: page.h:49
document.h
QString
QList
Okular::Action
Encapsulates data that describes an action.
Definition: action.h:43
Okular::DocumentInfo
A DOM tree containing information about the document.
Definition: document.h:1086
Okular::TextDocumentGenerator
QTextDocument-based Generator.
Definition: textdocumentgenerator.h:153
Okular::TextDocumentConverterPrivate
Definition: textdocumentgenerator_p.h:100
QVector< Okular::Page * >
textdocumentsettings.h
QTextBlock
QTextDocument
Okular::ExportFormat
Defines an entry for the export menu.
Definition: generator.h:76
Okular::Annotation
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:90
OKULAR_EXPORT
#define OKULAR_EXPORT
Definition: okular_export.h:30
Okular::DocumentViewport
A view on the document.
Definition: document.h:1016
Okular::TextDocumentSettings
TextDocumentSettings.
Definition: textdocumentsettings.h:106
Okular::DocumentSynopsis
A DOM tree that describes the Table of Contents.
Definition: document.h:1167
Okular::PixmapRequest
Describes a pixmap type request.
Definition: generator.h:575
Okular::Generator
[Abstract Class] The information generator.
Definition: generator.h:186
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

KDE's Doxygen guidelines are available online.

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal