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

okular

Okular::Document

Okular::Document Class Reference

#include <document.h>

Inheritance diagram for Okular::Document:

Inheritance graph
[legend]

List of all members.


Detailed Description

The Document.

Heart of everything. Actions take place here.

The Document is the main object in Okular. All views query the Document to get data/properties or even for accessing pages (in a 'const' way).

It is designed to keep it detached from the document type (pdf, ps, you name it..) so whenever you want to get some data, it asks its internals generator to do the job and return results in a format-indepedent way.

Apart from the generator (the currently running one) the document stores all the Pages ('Page' class) of the current document in a vector and notifies all the registered DocumentObservers when some content changes.

For a better understanding of hieracies

See also:
README.internals.png

DocumentObserver, Page

Definition at line 77 of file document.h.


Public Types

enum  SearchType {
  NextMatch, PreviousMatch, AllDocument, GoogleAll,
  GoogleAny
}
enum  SearchStatus { MatchFound, NoMatchFound, SearchCancelled }
enum  PrintingType { NoPrinting, NativePrinting, PostscriptPrinting }

Public Slots

void setRotation (int rotation)
void setPageSize (const PageSize &size)
void cancelSearch ()

Signals

void close ()
void quit ()
void linkFind ()
void linkGoToPage ()
void linkPresentation ()
void linkEndPresentation ()
void openUrl (const KUrl &url)
void error (const QString &text, int duration)
void warning (const QString &text, int duration)
void notice (const QString &text, int duration)
void gotFont (const Okular::FontInfo &font)
void fontReadingProgress (int page)
void fontReadingEnded ()
void searchFinished (int id, Okular::Document::SearchStatus endStatus)

Public Member Functions

 Document (QWidget *widget)
 ~Document ()
bool openDocument (const QString &docFile, const KUrl &url, const KMimeType::Ptr &mime)
void closeDocument ()
void addObserver (DocumentObserver *observer)
void removeObserver (DocumentObserver *observer)
void reparseConfig ()
QWidget * widget () const
bool isOpened () const
const DocumentInfo * documentInfo () const
const DocumentSynopsis * documentSynopsis () const
void startFontReading ()
void stopFontReading ()
bool canProvideFontInformation () const
const QList< EmbeddedFile * > * embeddedFiles () const
const Page * page (int number) const
const DocumentViewport & viewport () const
void setVisiblePageRects (const QVector< VisiblePageRect * > &visiblePageRects, int excludeId=-1)
const QVector< VisiblePageRect * > & visiblePageRects () const
uint currentPage () const
uint pages () const
KUrl currentDocument () const
bool isAllowed (Permission action) const
bool supportsSearching () const
bool supportsPageSizes () const
PageSize::List pageSizes () const
bool canExportToText () const
bool exportToText (const QString &fileName) const
QList< ExportFormat > exportFormats () const
bool exportTo (const QString &fileName, const ExportFormat &format) const
bool historyAtBegin () const
bool historyAtEnd () const
QVariant metaData (const QString &key, const QVariant &option=QVariant()) const
Rotation rotation () const
QSizeF allPagesSize () const
QString pageSizeString (int page) const
KXMLGUIClient * guiClient ()
void setViewportPage (int page, int excludeId=-1, bool smoothMove=false)
void setViewport (const DocumentViewport &viewport, int excludeId=-1, bool smoothMove=false)
void setPrevViewport ()
void setNextViewport ()
void setNextDocumentViewport (const DocumentViewport &viewport)
void setZoom (int factor, int excludeId=-1)
void requestPixmaps (const QLinkedList< PixmapRequest * > &requests)
void requestTextPage (uint number)
void addPageAnnotation (int page, Annotation *annotation)
void modifyPageAnnotation (int page, Annotation *annotation)
void removePageAnnotation (int page, Annotation *annotation)
void removePageAnnotations (int page, const QList< Annotation * > &annotations)
void setPageTextSelection (int page, RegularAreaRect *rect, const QColor &color)
void searchText (int searchID, const QString &text, bool fromStart, Qt::CaseSensitivity caseSensitivity, SearchType type, bool moveViewport, const QColor &color, bool noDialogs=false)
void continueSearch (int searchID)
void resetSearch (int searchID)
BookmarkManager * bookmarkManager () const
void processAction (const Action *action)
QList< int > bookmarkedPageList () const
QString bookmarkedPageRange () const
void processSourceReference (const SourceReference *reference)
bool canConfigurePrinter () const
PrintingType printingSupport () const
bool supportsPrintToFile () const
bool print (QPrinter &printer)
QWidget * printConfigurationWidget () const
void fillConfigDialog (KConfigDialog *dialog)
int configurableGenerators () const
QStringList supportedMimeTypes () const
const KComponentData * componentData () const

Member Enumeration Documentation

enum Okular::Document::SearchType

Describes the possible search types.

Enumerator:
NextMatch  Search next match.
PreviousMatch  Search previous match.
AllDocument  Search complete document.
GoogleAll  Search all words in google style.
GoogleAny  Search any words in google style.

Definition at line 366 of file document.h.

enum Okular::Document::SearchStatus

Describes how search ended.

Enumerator:
MatchFound  Any match was found.
NoMatchFound  No match was found.
SearchCancelled  The search was cancelled.

Definition at line 378 of file document.h.

enum Okular::Document::PrintingType

What type of printing a document supports.

Enumerator:
NoPrinting  Printing Not Supported.
NativePrinting  Native Cross-Platform Printing.
PostscriptPrinting  Postscript file printing.

Definition at line 442 of file document.h.


Constructor & Destructor Documentation

Document::Document ( QWidget *  widget  )  [explicit]

Creates a new document with the given widget as widget to relay GUI things (messageboxes, .

..).

Definition at line 1034 of file document.cpp.

Document::~Document (  ) 

Destroys the document.

Definition at line 1046 of file document.cpp.


Member Function Documentation

bool Document::openDocument ( const QString &  docFile,
const KUrl &  url,
const KMimeType::Ptr &  mime 
)

Opens the document.

Definition at line 1072 of file document.cpp.

void Document::closeDocument (  ) 

Closes the document.

Definition at line 1292 of file document.cpp.

void Document::addObserver ( DocumentObserver *  observer  ) 

Registers a new observer for the document.

Definition at line 1413 of file document.cpp.

void Document::removeObserver ( DocumentObserver *  observer  ) 

Unregisters the given observer for the document.

Definition at line 1426 of file document.cpp.

void Document::reparseConfig (  ) 

Reparses and applies the configuration.

Definition at line 1457 of file document.cpp.

QWidget * Document::widget (  )  const

Returns the widget to be used for relaying GUI things (messageboxes, .

..)

Definition at line 1494 of file document.cpp.

bool Document::isOpened (  )  const

Returns whether the document is currently opened.

Definition at line 1499 of file document.cpp.

const DocumentInfo * Document::documentInfo (  )  const

Returns the meta data of the document or 0 if no meta data are available.

Definition at line 1515 of file document.cpp.

const DocumentSynopsis * Document::documentSynopsis (  )  const

Returns the table of content of the document or 0 if no table of content is available.

Definition at line 1539 of file document.cpp.

void Document::startFontReading (  ) 

Starts the reading of the information about the fonts in the document, if available.

The results as well the end of the reading is notified using the signals gotFont(), fontReadingProgress() and fontReadingEnded()

Definition at line 1544 of file document.cpp.

void Document::stopFontReading (  ) 

Force the termination of the reading of the information about the fonts in the document, if running.

Definition at line 1570 of file document.cpp.

bool Document::canProvideFontInformation (  )  const

Whether the current document can provide information about the fonts used in it.

Definition at line 1581 of file document.cpp.

const QList< EmbeddedFile * > * Document::embeddedFiles (  )  const

Returns the list of embedded files or 0 if no embedded files are available.

Definition at line 1586 of file document.cpp.

const Page * Document::page ( int  number  )  const

Returns the page object for the given page number or 0 if the number is out of range.

Definition at line 1591 of file document.cpp.

const DocumentViewport & Document::viewport (  )  const

Returns the current viewport of the document.

Definition at line 1596 of file document.cpp.

void Document::setVisiblePageRects ( const QVector< VisiblePageRect * > &  visiblePageRects,
int  excludeId = -1 
)

Sets the list of visible page rectangles.

See also:
VisiblePageRect

Definition at line 1606 of file document.cpp.

const QVector< VisiblePageRect * > & Document::visiblePageRects (  )  const

Returns the list of visible page rectangles.

Definition at line 1601 of file document.cpp.

uint Document::currentPage (  )  const

Returns the number of the current page.

Definition at line 1620 of file document.cpp.

uint Document::pages (  )  const

Returns the number of pages of the document.

Definition at line 1625 of file document.cpp.

KUrl Document::currentDocument (  )  const

Returns the url of the currently opened document.

Definition at line 1630 of file document.cpp.

bool Document::isAllowed ( Permission  action  )  const

Returns whether the given action is allowed in the document.

See also:
Permission

Definition at line 1635 of file document.cpp.

bool Document::supportsSearching (  )  const

Returns whether the document supports searching.

Definition at line 1645 of file document.cpp.

bool Document::supportsPageSizes (  )  const

Returns whether the document supports the listing of page sizes.

Definition at line 1650 of file document.cpp.

PageSize::List Document::pageSizes (  )  const

Returns the list of supported page sizes or an empty list if this feature is not available.

See also:
supportsPageSizes()

Definition at line 1655 of file document.cpp.

bool Document::canExportToText (  )  const

Returns whether the document supports the export to ASCII text.

Definition at line 1666 of file document.cpp.

bool Document::exportToText ( const QString &  fileName  )  const

Exports the document as ASCII text and saves it under fileName.

Definition at line 1675 of file document.cpp.

ExportFormat::List Document::exportFormats (  )  const

Returns the list of supported export formats.

See also:
ExportFormat

Definition at line 1687 of file document.cpp.

bool Document::exportTo ( const QString &  fileName,
const ExportFormat &  format 
) const

Exports the document in the given format and saves it under fileName.

Definition at line 1696 of file document.cpp.

bool Document::historyAtBegin (  )  const

Returns whether the document history is at the begin.

Definition at line 1701 of file document.cpp.

bool Document::historyAtEnd (  )  const

Returns whether the document history is at the end.

Definition at line 1706 of file document.cpp.

QVariant Document::metaData ( const QString &  key,
const QVariant &  option = QVariant() 
) const

Returns the meta data for the given key and option or an empty variant if the key doesn't exists.

Definition at line 1711 of file document.cpp.

Rotation Document::rotation (  )  const

Returns the current rotation of the document.

Definition at line 1716 of file document.cpp.

QSizeF Document::allPagesSize (  )  const

If all pages have the same size this method returns it, if the page sizes differ an empty size object is returned.

Definition at line 1721 of file document.cpp.

QString Document::pageSizeString ( int  page  )  const

Returns the size string for the given page or an empty string if the page is out of range.

Definition at line 1738 of file document.cpp.

KXMLGUIClient * Document::guiClient (  ) 

Returns the gui client of the generator, if it provides one.

Definition at line 1281 of file document.cpp.

void Document::setViewportPage ( int  page,
int  excludeId = -1,
bool  smoothMove = false 
)

Sets the current document viewport to the given page.

Parameters:
excludeId The observer ids which shouldn't be effected by this change.
smoothMove Whether the move shall be animated smoothly.

Definition at line 1942 of file document.cpp.

void Document::setViewport ( const DocumentViewport &  viewport,
int  excludeId = -1,
bool  smoothMove = false 
)

Sets the current document viewport to the given viewport.

Parameters:
excludeId The observer ids which shouldn't be effected by this change.
smoothMove Whether the move shall be animated smoothly.

Definition at line 1954 of file document.cpp.

void Document::setPrevViewport (  ) 

Sets the current document viewport to the next viewport in the viewport history.

Definition at line 2018 of file document.cpp.

void Document::setNextViewport (  ) 

Sets the current document viewport to the previous viewport in the viewport history.

Definition at line 2029 of file document.cpp.

void Document::setNextDocumentViewport ( const DocumentViewport &  viewport  ) 

Sets the next viewport in the viewport history.

Definition at line 2042 of file document.cpp.

void Document::setZoom ( int  factor,
int  excludeId = -1 
)

Sets the zoom for the current document.

Parameters:
excludeId The observer ids which shouldn't be effected by this change.

Definition at line 2009 of file document.cpp.

void Document::requestPixmaps ( const QLinkedList< PixmapRequest * > &  requests  ) 

Sends requests for pixmap generation.

Definition at line 1751 of file document.cpp.

void Document::requestTextPage ( uint  number  ) 

Sends a request for text page generation for the given page number.

Definition at line 1829 of file document.cpp.

void Document::addPageAnnotation ( int  page,
Annotation *  annotation 
)

Adds a new annotation to the given page.

Definition at line 1840 of file document.cpp.

void Document::modifyPageAnnotation ( int  page,
Annotation *  annotation 
)

Modifies the given annotation on the given page.

Definition at line 1858 of file document.cpp.

void Document::removePageAnnotation ( int  page,
Annotation *  annotation 
)

Removes the given annotation from the given page.

Definition at line 1873 of file document.cpp.

void Document::removePageAnnotations ( int  page,
const QList< Annotation * > &  annotations 
)

Removes the given annotations from the given page.

Definition at line 1888 of file document.cpp.

void Document::setPageTextSelection ( int  page,
RegularAreaRect *  rect,
const QColor &  color 
)

Sets the text selection for the given page.

Parameters:
rect The rectangle of the selection.
color The color of the selection.

Definition at line 1911 of file document.cpp.

void Document::searchText ( int  searchID,
const QString &  text,
bool  fromStart,
Qt::CaseSensitivity  caseSensitivity,
SearchType  type,
bool  moveViewport,
const QColor &  color,
bool  noDialogs = false 
)

Searches the given text in the document.

Parameters:
searchID The unique id for this search request.
fromStart Whether the search should be started at begin of the document.
caseSensitivity Whether the search is case sensitive.
type The type of the search. SearchType
moveViewport Whether the viewport shall be moved to the position of the matches.
color The highlighting color of the matches.
noDialogs Whether a search dialog shall be shown.

Definition at line 2047 of file document.cpp.

void Document::continueSearch ( int  searchID  ) 

Continues the search for the given searchID.

Definition at line 2154 of file document.cpp.

void Document::resetSearch ( int  searchID  ) 

Resets the search for the given searchID.

Definition at line 2171 of file document.cpp.

BookmarkManager * Document::bookmarkManager (  )  const

Returns the bookmark manager of the document.

Definition at line 2201 of file document.cpp.

void Document::processAction ( const Action *  action  ) 

Processes the given action.

Definition at line 2268 of file document.cpp.

QList< int > Document::bookmarkedPageList (  )  const

Returns a list of the bookmarked.pages.

Definition at line 2206 of file document.cpp.

QString Document::bookmarkedPageRange (  )  const

Returns the range of the bookmarked.pages.

Definition at line 2222 of file document.cpp.

void Document::processSourceReference ( const SourceReference *  reference  ) 

Processes/Executes the given source reference.

Definition at line 2432 of file document.cpp.

bool Document::canConfigurePrinter (  )  const

Returns whether the document can configure the printer itself.

Definition at line 1504 of file document.cpp.

Document::PrintingType Document::printingSupport (  )  const

Returns what sort of printing the document supports: Native, Postscript, None.

Definition at line 2478 of file document.cpp.

bool Document::supportsPrintToFile (  )  const

Returns whether the document supports printing to both PDF and PS files.

Definition at line 2500 of file document.cpp.

bool Document::print ( QPrinter &  printer  ) 

Prints the document to the given printer.

Definition at line 2505 of file document.cpp.

QWidget * Document::printConfigurationWidget (  )  const

Returns a custom printer configuration page or 0 if no custom printer configuration page is available.

Definition at line 2510 of file document.cpp.

void Document::fillConfigDialog ( KConfigDialog *  dialog  ) 

Fill the KConfigDialog dialog with the setting pages of the generators.

Definition at line 2521 of file document.cpp.

int Document::configurableGenerators (  )  const

Returns the number of generators that have a configuration widget.

Definition at line 2552 of file document.cpp.

QStringList Document::supportedMimeTypes (  )  const

Returns the list with the supported MIME types.

Definition at line 2559 of file document.cpp.

const KComponentData * Document::componentData (  )  const

Returns the component data associated with the generator.

May be null.

Definition at line 2580 of file document.cpp.

void Document::setRotation ( int  rotation  )  [slot]

This slot is called whenever the user changes the rotation of the document.

Definition at line 2661 of file document.cpp.

void Document::setPageSize ( const PageSize &  size  )  [slot]

This slot is called whenever the user changes the page size of the document.

Definition at line 2693 of file document.cpp.

void Document::cancelSearch (  )  [slot]

Cancels the current search.

Definition at line 2196 of file document.cpp.

void Okular::Document::close (  )  [signal]

This signal is emitted whenever an action requests a document close operation.

void Okular::Document::quit (  )  [signal]

This signal is emitted whenever an action requests an application quit operation.

void Okular::Document::linkFind (  )  [signal]

This signal is emitted whenever an action requests a find operation.

void Okular::Document::linkGoToPage (  )  [signal]

This signal is emitted whenever an action requests a goto operation.

void Okular::Document::linkPresentation (  )  [signal]

This signal is emitted whenever an action requests a start presentation operation.

void Okular::Document::linkEndPresentation (  )  [signal]

This signal is emitted whenever an action requests an end presentation operation.

void Okular::Document::openUrl ( const KUrl &  url  )  [signal]

This signal is emitted whenever an action requests an open url operation for the given document url.

void Okular::Document::error ( const QString &  text,
int  duration 
) [signal]

This signal is emitted whenever an error occurred.

Parameters:
text The description of the error.
duration The time in seconds the message should be shown to the user.

void Okular::Document::warning ( const QString &  text,
int  duration 
) [signal]

This signal is emitted to signal a warning.

Parameters:
text The description of the warning.
duration The time in seconds the message should be shown to the user.

void Okular::Document::notice ( const QString &  text,
int  duration 
) [signal]

This signal is emitted to signal a notice.

Parameters:
text The description of the notice.
duration The time in seconds the message should be shown to the user.

void Okular::Document::gotFont ( const Okular::FontInfo &  font  )  [signal]

Emitted when a new font is found during the reading of the fonts of the document.

void Okular::Document::fontReadingProgress ( int  page  )  [signal]

Reports the progress when reading the fonts in the document.

Parameters:
page is the page that was just finished to scan for fonts

void Okular::Document::fontReadingEnded (  )  [signal]

Reports that the reading of the fonts in the document is finished.

void Okular::Document::searchFinished ( int  id,
Okular::Document::SearchStatus  endStatus 
) [signal]

Reports that the current search finished.


The documentation for this class was generated from the following files:
  • document.h
  • document.cpp

okular

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