11 #ifndef _OKULAR_DOCUMENT_H_
12 #define _OKULAR_DOCUMENT_H_
19 #include <QtCore/QObject>
20 #include <QtCore/QStringList>
21 #include <QtCore/QVector>
22 #include <QtGui/QPrinter>
23 #include <QtXml/QDomDocument>
25 #include <kmimetype.h>
38 class BookmarkManager;
40 class DocumentObserver;
41 class DocumentPrivate;
42 class DocumentSynopsis;
43 class DocumentViewport;
48 class FormFieldButton;
49 class FormFieldChoice;
55 class RenditionAction;
56 class SourceReference;
58 class VisiblePageRect;
61 #define PART_SEARCH_ID 1
62 #define PAGEVIEW_SEARCH_ID 2
63 #define SW_SEARCH_ID 3
64 #define PRESENTATION_SEARCH_ID 4
102 bool openDocument(
const QString & docFile,
const KUrl & url,
const KMimeType::Ptr &mime );
107 void closeDocument();
122 void reparseConfig();
132 bool isOpened()
const;
153 void startFontReading();
159 void stopFontReading();
165 bool canProvideFontInformation()
const;
171 const QList<EmbeddedFile*> *embeddedFiles()
const;
177 const Page * page(
int number )
const;
188 void setVisiblePageRects(
const QVector< VisiblePageRect * > & visiblePageRects,
DocumentObserver *excludeObserver = 0 );
193 const QVector< VisiblePageRect * > & visiblePageRects()
const;
198 uint currentPage()
const;
208 KUrl currentDocument()
const;
219 bool supportsSearching()
const;
224 bool supportsPageSizes()
const;
231 bool supportsTiles()
const;
243 bool canExportToText()
const;
248 bool exportToText(
const QString& fileName )
const;
254 QList<ExportFormat> exportFormats()
const;
259 bool exportTo(
const QString& fileName,
const ExportFormat& format )
const;
264 bool historyAtBegin()
const;
269 bool historyAtEnd()
const;
275 QVariant metaData(
const QString & key,
const QVariant & option = QVariant() )
const;
286 QSizeF allPagesSize()
const;
292 QString pageSizeString(
int page )
const;
305 void setViewportPage(
int page,
DocumentObserver *excludeObserver = 0,
bool smoothMove =
false );
319 void setPrevViewport();
325 void setNextViewport();
337 void setNextDocumentDestination(
const QString &namedDestination );
350 RemoveAllPrevious = 1
352 Q_DECLARE_FLAGS( PixmapRequestFlags, PixmapRequestFlag )
359 void requestPixmaps( const QLinkedList<
PixmapRequest*> &requests );
368 void requestPixmaps( const QLinkedList<
PixmapRequest*> &requests, PixmapRequestFlags reqOptions );
373 void requestTextPage( uint number );
378 void addPageAnnotation(
int page,
Annotation *annotation );
385 bool canModifyPageAnnotation( const
Annotation * annotation ) const;
393 void prepareToModifyAnnotationProperties(
Annotation * annotation );
402 void modifyPageAnnotationProperties(
int page,
Annotation * annotation );
426 void editPageAnnotationContents(
int page,
Annotation* annotation, const QString & newContents,
427 int newCursorPos,
int prevCursorPos,
int prevAnchorPos );
434 bool canRemovePageAnnotation( const
Annotation * annotation ) const;
439 void removePageAnnotation(
int page,
Annotation *annotation );
444 void removePageAnnotations(
int page, const QList<
Annotation*> &annotations );
452 void setPageTextSelection(
int page,
RegularAreaRect * rect, const QColor & color );
458 bool canUndo() const;
464 bool canRedo() const;
499 void searchText(
int searchID,
const QString & text,
bool fromStart, Qt::CaseSensitivity caseSensitivity,
500 SearchType type,
bool moveViewport,
const QColor & color,
bool noDialogs =
false );
505 void continueSearch(
int searchID );
513 void continueSearch(
int searchID, SearchType type );
518 void resetSearch(
int searchID );
528 void processAction(
const Action *action );
533 QList<int> bookmarkedPageList()
const;
538 QString bookmarkedPageRange()
const;
548 bool canConfigurePrinter()
const;
564 PrintingType printingSupport()
const;
569 bool supportsPrintToFile()
const;
574 bool print( QPrinter &printer );
580 QString printError()
const;
586 QWidget* printConfigurationWidget()
const;
592 void fillConfigDialog( KConfigDialog * dialog );
597 int configurableGenerators()
const;
602 QStringList supportedMimeTypes()
const;
607 const KComponentData* componentData()
const;
618 SaveFormsCapability = 1,
619 SaveAnnotationsCapability = 2
628 bool canSaveChanges( SaveCapability cap )
const;
639 bool canSaveChanges()
const;
647 bool saveChanges(
const QString &fileName );
655 bool saveChanges(
const QString &fileName, QString *errorText );
664 void registerView(
View *view );
671 void unregisterView(
View *view );
678 QByteArray fontData(
const FontInfo &font)
const;
685 bool openDocumentArchive(
const QString & docFile,
const KUrl & url );
692 bool saveDocumentArchive(
const QString &fileName );
703 const SourceReference * dynamicSourceReference(
int pageNr,
double absX,
double absY );
712 QPrinter::Orientation orientation()
const;
720 void setAnnotationEditingEnabled(
bool enable );
727 void setRotation(
int rotation );
733 void setPageSize(
const PageSize &size );
758 void editFormText(
int pageNumber,
760 const QString & newContents,
769 void editFormList(
int pageNumber,
771 const QList<int> & newChoices );
782 void editFormCombo(
int pageNumber,
784 const QString & newText,
794 void editFormButtons(
int pageNumber,
795 const QList< Okular::FormFieldButton* > & formButtons,
796 const QList< bool > & newButtonStates );
827 void linkPresentation();
833 void linkEndPresentation();
839 void openUrl(
const KUrl &url );
847 void error(
const QString &text,
int duration );
855 void warning(
const QString &text,
int duration );
863 void notice(
const QString &text,
int duration );
876 void fontReadingProgress(
int page );
881 void fontReadingEnded();
898 void sourceReferenceActivated(
const QString& absFileName,
int line,
int col,
bool *handled);
909 void canUndoChanged(
bool undoAvailable );
915 void canRedoChanged(
bool redoAvailable );
932 void annotationContentsChangedByUndoRedo(
Okular::Annotation* annotation,
const QString & contents,
int cursorPos,
int anchorPos );
942 void formTextChangedByUndoRedo(
int page,
Okular::FormFieldText* form,
const QString & contents,
int cursorPos,
int anchorPos );
956 void formComboChangedByUndoRedo(
int page,
Okular::FormFieldChoice* form,
const QString & text,
int cursorPos,
int anchorPos );
963 void formButtonsChangedByUndoRedo(
int page,
const QList< Okular::FormFieldButton* > & formButtons );
968 friend class ::DocumentItem;
979 Q_PRIVATE_SLOT( d,
void saveDocumentInfo() const )
980 Q_PRIVATE_SLOT( d,
void slotTimedMemoryCheck() )
981 Q_PRIVATE_SLOT( d,
void sendGeneratorPixmapRequest() )
982 Q_PRIVATE_SLOT( d,
void rotationFinished(
int page, Okular::
Page *okularPage ) )
983 Q_PRIVATE_SLOT( d,
void fontReadingProgress(
int page ) )
984 Q_PRIVATE_SLOT( d,
void fontReadingGotFont( const Okular::
FontInfo& font ) )
985 Q_PRIVATE_SLOT( d,
void slotGeneratorConfigChanged( const QString& ) )
986 Q_PRIVATE_SLOT( d,
void refreshPixmaps(
int ) )
987 Q_PRIVATE_SLOT( d,
void _o_configChanged() )
990 Q_PRIVATE_SLOT( d,
void doContinueDirectionMatchSearch(
void *doContinueDirectionMatchSearchStruct) )
991 Q_PRIVATE_SLOT( d,
void doContinueAllDocumentSearch(
void *pagesToNotifySet,
void *pageMatchesMap,
int currentPage,
int searchID, const QString & text,
int caseSensitivity, const QColor & color) )
992 Q_PRIVATE_SLOT( d,
void doContinueGooglesDocumentSearch(
void *pagesToNotifySet,
void *pageMatchesMap,
int currentPage,
int searchID, const QStringList & words,
int caseSensitivity, const QColor & color,
bool matchAll) )
1009 DocumentViewport(
int number = -1 );
1019 QString toString()
const;
1024 bool isValid()
const;
1029 bool operator==(
const DocumentViewport &other )
const;
1030 bool operator<(
const DocumentViewport &other )
const;
1107 void set(
const QString &key,
const QString &value,
1108 const QString &title = QString() );
1114 void set( Key key,
const QString &value );
1120 QString
get(
const QString &key )
const;
1126 static QString getKeyString( Key key );
1132 static QString getKeyTitle( Key key );
1194 virtual QString name()
const = 0;
1205 virtual QByteArray data()
const = 0;
1213 virtual int size()
const = 0;
1219 virtual QDateTime modificationDate()
const = 0;
1225 virtual QDateTime creationDate()
const = 0;
1257 Q_DECLARE_OPERATORS_FOR_FLAGS( Okular::Document::PixmapRequestFlags )
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
The category of the document.
The copyright of the document.
The mime type of the document.
Native Cross-Platform Printing.
The author of the document.
The subject of the document.
Search complete document.
NormalizedRect is a helper class which stores the coordinates of a normalized rect, which is a rectangle of.
SearchType
Describes the possible search types.
SaveCapability
Saving capabilities.
An embedded file into the document.
Key
The list of predefined keys.
Interface of a text form field.
The title of the document.
The Movie action executes an operation on a video on activation.
PrintingType
What type of printing a document supports.
PixmapRequestFlag
Describes the possible options for the pixmap requests.
A small class that represents the information of a font.
The date of creation of the document.
SearchStatus
Describes how search ended.
Search all words in google style.
Collector for all the data belonging to a page.
int pageNumber
The number of the page nearest the center of the viewport.
The keywords which describe the content of the document.
Encapsulates data that describes an action.
A DOM tree containing information about the document.
Defines a source reference.
The number of pages of the document.
The size of the document.
The creator of the document (this can be different from the author)
Annotation struct holds properties shared by all annotations.
A small class that represents the size of a page.
Base class for objects being notified when something changes.
static const char description[]
Permission
Describes the DRM capabilities.
The Rendition action executes an operation on a video or executes some JavaScript code on activation...
Position
Describes the relative position of the viewport.
The description of the document.
A DOM tree that describes the Table of Contents.
Bookmarks manager utility.
Describes a pixmap type request.
The date of last modification of the document.
The producer of the document (e.g. some software)