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

okular

document.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004-2005 by Enrico Ros <eros.kde@email.it>             *
00003  *   Copyright (C) 2004-2007 by Albert Astals Cid <aacid@kde.org>          *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #ifndef _OKULAR_DOCUMENT_H_
00012 #define _OKULAR_DOCUMENT_H_
00013 
00014 #include <okular/core/okular_export.h>
00015 #include <okular/core/area.h>
00016 #include <okular/core/global.h>
00017 #include <okular/core/pagesize.h>
00018 
00019 #include <QtCore/QObject>
00020 #include <QtCore/QStringList>
00021 #include <QtCore/QVector>
00022 #include <QtXml/QDomDocument>
00023 
00024 #include <kmimetype.h>
00025 
00026 class QPrinter;
00027 class QPrintDialog;
00028 class KComponentData;
00029 class KBookmark;
00030 class KConfigDialog;
00031 class KXMLGUIClient;
00032 class KUrl;
00033 
00034 namespace Okular {
00035 
00036 class Annotation;
00037 class BookmarkManager;
00038 class DocumentInfo;
00039 class DocumentObserver;
00040 class DocumentPrivate;
00041 class DocumentSynopsis;
00042 class DocumentViewport;
00043 class EmbeddedFile;
00044 class ExportFormat;
00045 class FontInfo;
00046 class Generator;
00047 class Action;
00048 class Page;
00049 class PixmapRequest;
00050 class SourceReference;
00051 class VisiblePageRect;
00052 
00054 #define PART_SEARCH_ID 1
00055 #define PAGEVIEW_SEARCH_ID 2
00056 #define SW_SEARCH_ID 3
00057 #define PRESENTATION_SEARCH_ID 4
00058 
00059 
00077 class OKULAR_EXPORT Document : public QObject
00078 {
00079     Q_OBJECT
00080 
00081     public:
00085         explicit Document( QWidget *widget );
00086 
00090         ~Document();
00091 
00095         bool openDocument( const QString & docFile, const KUrl & url, const KMimeType::Ptr &mime );
00096 
00100         void closeDocument();
00101 
00105         void addObserver( DocumentObserver *observer );
00106 
00110         void removeObserver( DocumentObserver *observer );
00111 
00115         void reparseConfig();
00116 
00120         QWidget *widget() const;
00121 
00125         bool isOpened() const;
00126 
00131         const DocumentInfo * documentInfo() const;
00132 
00137         const DocumentSynopsis * documentSynopsis() const;
00138 
00146         void startFontReading();
00147 
00152         void stopFontReading();
00153 
00158         bool canProvideFontInformation() const;
00159 
00164         const QList<EmbeddedFile*> *embeddedFiles() const;
00165 
00170         const Page * page( int number ) const;
00171 
00175         const DocumentViewport & viewport() const;
00176 
00181         void setVisiblePageRects( const QVector< VisiblePageRect * > & visiblePageRects, int excludeId = -1 );
00182 
00186         const QVector< VisiblePageRect * > & visiblePageRects() const;
00187 
00191         uint currentPage() const;
00192 
00196         uint pages() const;
00197 
00201         KUrl currentDocument() const;
00202 
00207         bool isAllowed( Permission action ) const;
00208 
00212         bool supportsSearching() const;
00213 
00217         bool supportsPageSizes() const;
00218 
00224         PageSize::List pageSizes() const;
00225 
00229         bool canExportToText() const;
00230 
00234         bool exportToText( const QString& fileName ) const;
00235 
00240         QList<ExportFormat> exportFormats() const;
00241 
00245         bool exportTo( const QString& fileName, const ExportFormat& format ) const;
00246 
00250         bool historyAtBegin() const;
00251 
00255         bool historyAtEnd() const;
00256 
00261         QVariant metaData( const QString & key, const QVariant & option = QVariant() ) const;
00262 
00266         Rotation rotation() const;
00267 
00272         QSizeF allPagesSize() const;
00273 
00278         QString pageSizeString( int page ) const;
00279 
00283         KXMLGUIClient* guiClient();
00284 
00291         void setViewportPage( int page, int excludeId = -1, bool smoothMove = false );
00292 
00299         void setViewport( const DocumentViewport &viewport, int excludeId = -1, bool smoothMove = false );
00300 
00305         void setPrevViewport();
00306 
00311         void setNextViewport();
00312 
00316         void setNextDocumentViewport( const DocumentViewport &viewport );
00317 
00323         void setZoom( int factor, int excludeId = -1 );
00324 
00328         void requestPixmaps( const QLinkedList<PixmapRequest*> &requests );
00329 
00333         void requestTextPage( uint number );
00334 
00338         void addPageAnnotation( int page, Annotation *annotation );
00339 
00343         void modifyPageAnnotation( int page, Annotation *annotation );
00344 
00348         void removePageAnnotation( int page, Annotation *annotation );
00349 
00353         void removePageAnnotations( int page, const QList<Annotation*> &annotations );
00354 
00361         void setPageTextSelection( int page, RegularAreaRect * rect, const QColor & color );
00362 
00366         enum SearchType
00367         {
00368             NextMatch,      
00369             PreviousMatch,  
00370             AllDocument,    
00371             GoogleAll,      
00372             GoogleAny       
00373         };
00374 
00378         enum SearchStatus
00379         {
00380             MatchFound,        
00381             NoMatchFound,      
00382             SearchCancelled    
00383         };
00384 
00396         void searchText( int searchID, const QString & text, bool fromStart, Qt::CaseSensitivity caseSensitivity,
00397                          SearchType type, bool moveViewport, const QColor & color, bool noDialogs = false );
00398 
00402         void continueSearch( int searchID );
00403 
00407         void resetSearch( int searchID );
00408 
00412         BookmarkManager * bookmarkManager() const;
00413 
00417         void processAction( const Action *action );
00418 
00422         QList<int> bookmarkedPageList() const;
00423 
00427         QString bookmarkedPageRange() const;
00428 
00432         void processSourceReference( const SourceReference *reference );
00433 
00437         bool canConfigurePrinter() const;
00438 
00442         enum PrintingType
00443         {
00444             NoPrinting,            
00445             NativePrinting,        
00446             PostscriptPrinting     
00447         };
00448 
00453         PrintingType printingSupport() const;
00454 
00458         bool supportsPrintToFile() const;
00459 
00463         bool print( QPrinter &printer );
00464 
00469         QWidget* printConfigurationWidget() const;
00470 
00475         void fillConfigDialog( KConfigDialog * dialog );
00476 
00480         int configurableGenerators() const;
00481 
00485         QStringList supportedMimeTypes() const;
00486 
00490         const KComponentData* componentData() const;
00491 
00492     public Q_SLOTS:
00497         void setRotation( int rotation );
00498 
00503         void setPageSize( const PageSize &size );
00504 
00508         void cancelSearch();
00509 
00510 
00511     Q_SIGNALS:
00516         void close();
00517 
00522         void quit();
00523 
00528         void linkFind();
00529 
00534         void linkGoToPage();
00535 
00540         void linkPresentation();
00541 
00546         void linkEndPresentation();
00547 
00552         void openUrl( const KUrl &url );
00553 
00560         void error( const QString &text, int duration );
00561 
00568         void warning( const QString &text, int duration );
00569 
00576         void notice( const QString &text, int duration );
00577 
00582         void gotFont( const Okular::FontInfo& font );
00583 
00589         void fontReadingProgress( int page );
00590 
00594         void fontReadingEnded();
00595 
00599         void searchFinished( int id, Okular::Document::SearchStatus endStatus );
00600 
00601     private:
00603         friend class DocumentPrivate;
00605         DocumentPrivate *const d;
00606 
00607         Q_DISABLE_COPY( Document )
00608 
00609         Q_PRIVATE_SLOT( d, void saveDocumentInfo() const )
00610         Q_PRIVATE_SLOT( d, void slotTimedMemoryCheck() )
00611         Q_PRIVATE_SLOT( d, void sendGeneratorRequest() )
00612         Q_PRIVATE_SLOT( d, void rotationFinished( int page ) )
00613         Q_PRIVATE_SLOT( d, void fontReadingProgress( int page ) )
00614         Q_PRIVATE_SLOT( d, void fontReadingGotFont( const Okular::FontInfo& font ) )
00615         Q_PRIVATE_SLOT( d, void slotGeneratorConfigChanged( const QString& ) )
00616 
00617         // search thread simulators
00618         Q_PRIVATE_SLOT( d, void doContinueNextMatchSearch(void *pagesToNotifySet, void * match, int currentPage, int searchID, const QString & text, int caseSensitivity, bool moveViewport, const QColor & color, bool noDialogs, int donePages) )
00619         Q_PRIVATE_SLOT( d, void doContinueAllDocumentSearch(void *pagesToNotifySet, void *pageMatchesMap, int currentPage, int searchID, const QString & text, int caseSensitivity, const QColor & color) )
00620         Q_PRIVATE_SLOT( d, void doContinueGooglesDocumentSearch(void *pagesToNotifySet, void *pageMatchesMap, int currentPage, int searchID, const QString & text, int caseSensitivity, const QColor & color, bool matchAll) )
00621 };
00622 
00623 
00631 class OKULAR_EXPORT DocumentViewport
00632 {
00633     public:
00637         DocumentViewport( int number = -1 );
00638 
00642         DocumentViewport( const QString &description );
00643 
00647         QString toString() const;
00648 
00652         bool isValid() const;
00653 
00657         bool operator==( const DocumentViewport &other ) const;
00658 
00662         int pageNumber;
00663 
00667         enum Position
00668         {
00669             Center = 1,  
00670             TopLeft = 2  
00671         };
00672 
00677         struct {
00678             bool enabled;
00679             double normalizedX;
00680             double normalizedY;
00681             Position pos;
00682         } rePos;
00683 
00687         struct {
00688             bool enabled;
00689             bool width;
00690             bool height;
00691         } autoFit;
00692 };
00693 
00700 class OKULAR_EXPORT DocumentInfo : public QDomDocument
00701 {
00702     public:
00706         enum Key {
00707             Title,              
00708             Subject,            
00709             Description,        
00710             Author,             
00711             Creator,            
00712             Producer,           
00713             Copyright,          
00714             Pages,              
00715             CreationDate,       
00716             ModificationDate,   
00717             MimeType,           
00718             Category,           
00719             Keywords            
00720         };
00721 
00725         DocumentInfo();
00726 
00731         void set( const QString &key, const QString &value,
00732                   const QString &title = QString() );
00733 
00738         void set( enum Key, const QString &value );
00739 
00744         QString get( const QString &key ) const;
00745 };
00746 
00761 class OKULAR_EXPORT DocumentSynopsis : public QDomDocument
00762 {
00763     public:
00767         DocumentSynopsis();
00768 
00773         DocumentSynopsis( const QDomDocument &document );
00774 };
00775 
00785 class OKULAR_EXPORT EmbeddedFile
00786 {
00787     public:
00791         EmbeddedFile();
00792 
00796         virtual ~EmbeddedFile();
00797 
00801         virtual QString name() const = 0;
00802 
00807         virtual QString description() const = 0;
00808 
00812         virtual QByteArray data() const = 0;
00813 
00820         virtual int size() const = 0;
00821 
00826         virtual QDateTime modificationDate() const = 0;
00827 
00832         virtual QDateTime creationDate() const = 0;
00833 
00834 };
00835 
00839 class OKULAR_EXPORT VisiblePageRect
00840 {
00841     public:
00848         explicit VisiblePageRect( int pageNumber = -1, const NormalizedRect &rectangle = NormalizedRect() );
00849 
00853         int pageNumber;
00854 
00858         NormalizedRect rect;
00859 };
00860 
00861 }
00862 
00863 #endif

okular

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

kdegraphics

Skip menu "kdegraphics"
  • okular
Generated for kdegraphics by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal