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

okular

  • sources
  • kde-4.12
  • 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 
50  virtual QTextDocument *convert( const QString &fileName ) = 0;
51 
52  Q_SIGNALS:
57  void addAction( Action *link, int cursorBegin, int cursorEnd );
58 
63  void addAnnotation( Annotation *annotation, int cursorBegin, int cursorEnd );
64 
68  void addTitle( int level, const QString &title, const QTextBlock &position );
69 
73  void addMetaData( const QString &key, const QString &value, const QString &title );
74 
80  void addMetaData( DocumentInfo::Key key, const QString &value );
81 
88  void error( const QString &message, int duration );
89 
96  void warning( const QString &message, int duration );
97 
104  void notice( const QString &message, int duration );
105 
106  protected:
113  DocumentViewport calculateViewport( QTextDocument *document, const QTextBlock &block );
114 
122  TextDocumentGenerator* generator() const;
123 
124  private:
125  TextDocumentConverterPrivate *d_ptr;
126  Q_DECLARE_PRIVATE( TextDocumentConverter )
127  Q_DISABLE_COPY( TextDocumentConverter )
128 };
129 
136 class OKULAR_EXPORT TextDocumentGenerator : public Generator, public Okular::ConfigInterface
137 {
139  friend class TextDocumentConverter;
141 
142  Q_OBJECT
143  Q_INTERFACES( Okular::ConfigInterface )
144 
145  public:
155  TextDocumentGenerator( TextDocumentConverter *converter, const QString& configName, QObject *parent, const QVariantList &args );
164  KDE_DEPRECATED TextDocumentGenerator( TextDocumentConverter *converter, QObject *parent, const QVariantList &args );
165  virtual ~TextDocumentGenerator();
166 
167  // [INHERITED] load a document and fill up the pagesVector
168  bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector );
169 
170  // [INHERITED] perform actions on document / pages
171  bool canGeneratePixmap() const;
172  void generatePixmap( Okular::PixmapRequest * request );
173 
174  // [INHERITED] print document using already configured QPrinter
175  bool print( QPrinter& printer );
176 
177  // [INHERITED] text exporting
178  Okular::ExportFormat::List exportFormats() const;
179  bool exportTo( const QString &fileName, const Okular::ExportFormat &format );
180 
181  // [INHERITED] config interface
183  bool reparseConfig();
185  void addPages( KConfigDialog* dlg );
186 
195  TextDocumentSettings* generalSettings();
196 
197  const Okular::DocumentInfo* generateDocumentInfo();
198  const Okular::DocumentSynopsis* generateDocumentSynopsis();
199 
200  protected:
201  bool doCloseDocument();
202  Okular::TextPage* textPage( Okular::Page *page );
203 
204  private:
205  Q_DECLARE_PRIVATE( TextDocumentGenerator )
206  Q_DISABLE_COPY( TextDocumentGenerator )
207 
208  Q_PRIVATE_SLOT( d_func(), void addAction( Action*, int, int ) )
209  Q_PRIVATE_SLOT( d_func(), void addAnnotation( Annotation*, int, int ) )
210  Q_PRIVATE_SLOT( d_func(), void addTitle( int, const QString&, const QTextBlock& ) )
211  Q_PRIVATE_SLOT( d_func(), void addMetaData( const QString&, const QString&, const QString& ) )
212  Q_PRIVATE_SLOT( d_func(), void addMetaData( DocumentInfo::Key, const QString& ) )
213 };
214 
215 }
216 
217 #endif
generator.h
Okular::TextPage
The TextPage class represents the text of a page by providing.
Definition: textpage.h:90
QObject
okular_export.h
Okular::DocumentInfo::Key
Key
The list of predefined keys.
Definition: document.h:1079
Okular::TextDocumentUtils::calculateViewport
static Okular::DocumentViewport calculateViewport(QTextDocument *document, const QTextBlock &block)
Definition: textdocumentgenerator_p.h:82
Okular::ExportFormat::List
QList< ExportFormat > List
Definition: generator.h:78
Okular::ConfigInterface
Abstract interface for configuration control.
Definition: configinterface.h:38
Okular::TextDocumentConverter
Definition: textdocumentgenerator.h:29
Okular::TextDocumentGeneratorPrivate
Definition: textdocumentgenerator_p.h:111
Okular::Page
Collector for all the data belonging to a page.
Definition: page.h:49
document.h
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:1073
Okular::TextDocumentGenerator
QTextDocument-based Generator.
Definition: textdocumentgenerator.h:136
Okular::TextDocumentConverterPrivate
Definition: textdocumentgenerator_p.h:100
textdocumentsettings.h
Okular::ExportFormat
Defines an entry for the export menu.
Definition: generator.h:75
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:1003
Okular::TextDocumentSettings
TextDocumentSettings.
Definition: textdocumentsettings.h:106
Okular::DocumentSynopsis
A DOM tree that describes the Table of Contents.
Definition: document.h:1154
Okular::PixmapRequest
Describes a pixmap type request.
Definition: generator.h:522
Okular::Generator
[Abstract Class] The information generator.
Definition: generator.h:185
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:03 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