okular
document.cpp
Go to the documentation of this file.
102 AllocatedPixmap( DocumentObserver *o, int p, qulonglong m ) : observer( o ), page( p ), memory( m ) {}
133 QSet< DocumentObserver * >::const_iterator it=d->m_observers.constBegin(), end=d->m_observers.constEnd();\
137 QSet< DocumentObserver * >::const_iterator it = m_observers.constBegin(), end = m_observers.constEnd();\
167 const QPrinter::Orientation orientation = inchesWidth > inchesHeight ? QPrinter::Landscape : QPrinter::Portrait;
182 if (inchesWidth > definedPaperSize.width() * lowerBoundFactor && inchesWidth < definedPaperSize.width() * upperBoundFactor
183 && inchesHeight > definedPaperSize.height() * lowerBoundFactor && inchesHeight < definedPaperSize.height() * upperBoundFactor)
194 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A0") : i18nc("paper size", "portrait DIN/ISO A0");
196 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A1") : i18nc("paper size", "portrait DIN/ISO A1");
198 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A2") : i18nc("paper size", "portrait DIN/ISO A2");
200 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A3") : i18nc("paper size", "portrait DIN/ISO A3");
202 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A4") : i18nc("paper size", "portrait DIN/ISO A4");
204 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A5") : i18nc("paper size", "portrait DIN/ISO A5");
206 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A6") : i18nc("paper size", "portrait DIN/ISO A6");
208 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A7") : i18nc("paper size", "portrait DIN/ISO A7");
210 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A8") : i18nc("paper size", "portrait DIN/ISO A8");
212 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A9") : i18nc("paper size", "portrait DIN/ISO A9");
214 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B0") : i18nc("paper size", "portrait DIN/ISO B0");
216 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B1") : i18nc("paper size", "portrait DIN/ISO B1");
218 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B2") : i18nc("paper size", "portrait DIN/ISO B2");
220 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B3") : i18nc("paper size", "portrait DIN/ISO B3");
222 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B4") : i18nc("paper size", "portrait DIN/ISO B4");
224 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B5") : i18nc("paper size", "portrait DIN/ISO B5");
226 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B6") : i18nc("paper size", "portrait DIN/ISO B6");
228 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B7") : i18nc("paper size", "portrait DIN/ISO B7");
230 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B8") : i18nc("paper size", "portrait DIN/ISO B8");
232 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B9") : i18nc("paper size", "portrait DIN/ISO B9");
234 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B10") : i18nc("paper size", "portrait DIN/ISO B10");
236 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape letter") : i18nc("paper size", "portrait letter");
238 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape legal") : i18nc("paper size", "portrait legal");
240 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape executive") : i18nc("paper size", "portrait executive");
242 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape C5E") : i18nc("paper size", "portrait C5E");
244 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape Comm10E") : i18nc("paper size", "portrait Comm10E");
246 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DLE") : i18nc("paper size", "portrait DLE");
248 return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape folio") : i18nc("paper size", "portrait folio");
252 return orientation == QPrinter::Landscape ? i18nc("paper size", "ledger") : i18nc("paper size", "tabloid");
254 return orientation == QPrinter::Landscape ? i18nc("paper size", "unknown landscape paper size") : i18nc("paper size", "unknown portrait paper size");
284 return i18nc("%1 is width, %2 is height, %3 is paper size name", "%1 x %2 in (%3)", inchesWidth, inchesHeight, namePaperSize(inchesWidth, inchesHeight));
288 return i18nc("%1 is width, %2 is height, %3 is paper size name", "%1 x %2 mm (%3)", QString::number(inchesWidth * 25.4, 'd', 0), QString::number(inchesHeight * 25.4, 'd', 0), namePaperSize(inchesWidth, inchesHeight));
308 if (m_allocatedPixmapsTotalMemory > thirdTotalMemory) memoryToFree = m_allocatedPixmapsTotalMemory - thirdTotalMemory;
309 if (m_allocatedPixmapsTotalMemory > freeMemory) clipValue = (m_allocatedPixmapsTotalMemory - freeMemory) / 2;
316 if (m_allocatedPixmapsTotalMemory > freeMemory) clipValue = (m_allocatedPixmapsTotalMemory - freeMemory) / 2;
323 const qulonglong memoryLimit = qMin( qMax( freeMemory, getTotalMemory()/2 ), freeMemory+freeSwap );
324 if (m_allocatedPixmapsTotalMemory > memoryLimit) clipValue = (m_allocatedPixmapsTotalMemory - memoryLimit) / 2;
349 QVector< Okular::VisiblePageRect * >::const_iterator vIt = m_pageRects.constBegin(), vEnd = m_pageRects.constEnd();
423 //p--rintf("freeMemory A:[%d -%d = %d] \n", m_allocatedPixmaps.count() + pagesFreed, pagesFreed, m_allocatedPixmaps.count() );
431 AllocatedPixmap * DocumentPrivate::searchLowestPriorityPixmap( bool unloadableOnly, bool thenRemoveIt, DocumentObserver *observer )
751 && ( view->capabilityFlags( View::Zoom ) & ( View::CapabilityRead | View::CapabilitySerializable ) ) )
760 && ( view->capabilityFlags( View::ZoomModality ) & ( View::CapabilityRead | View::CapabilitySerializable ) ) )
773 && ( view->capabilityFlags( View::Zoom ) & ( View::CapabilityRead | View::CapabilitySerializable ) )
775 && ( view->capabilityFlags( View::ZoomModality ) & ( View::CapabilityRead | View::CapabilitySerializable ) ) )
855 QHash< QString, GeneratorInfo >::const_iterator genIt = m_loadedGenerators.constFind( propName );
906 Document::OpenResult DocumentPrivate::openDocumentInternal( const KService::Ptr& offer, bool isstdin, const QString& docFile, const QByteArray& filedata, const QString& password )
909 QHash< QString, GeneratorInfo >::const_iterator genIt = m_loadedGenerators.constFind( propName );
933 QObject::connect( m_generator, SIGNAL(error(QString,int)), m_parent, SIGNAL(error(QString,int)) );
934 QObject::connect( m_generator, SIGNAL(warning(QString,int)), m_parent, SIGNAL(warning(QString,int)) );
935 QObject::connect( m_generator, SIGNAL(notice(QString,int)), m_parent, SIGNAL(notice(QString,int)) );
952 openResult = m_generator->loadDocumentFromDataWithPassword( filedata, m_pagesVector, password );
1011 QVector< Page * >::const_iterator pIt = m_pagesVector.constBegin(), pEnd = m_pagesVector.constEnd();
1030 DocumentViewport vp( m_generator->metaData( "NamedViewport", m_nextDocumentDestination ).toString() );
1049 KMessageBox::information( m_widget, i18n("Your annotation changes will not be saved automatically. Use File -> Save As...\nor your changes will be lost once the document is closed"), QString(), "annotNeedSaveAs" );
1054 KMessageBox::information( m_widget, i18n("Your annotations are saved internally by Okular.\nYou can export the annotated document using File -> Export As -> Document Archive"), QString(), "annotExportAsArchive" );
1129 void DocumentPrivate::performModifyPageAnnotation( int page, Annotation * annotation, bool appearanceChanged )
1173 void DocumentPrivate::performSetAnnotationContents( const QString & newContents, Annotation *annot, int pageNumber )
1239 QVector< Page * >::const_iterator pIt = m_pagesVector.constBegin(), pEnd = m_pagesVector.constEnd();
1253 // <general info><history> ... </history> save history up to OKULAR_HISTORY_SAVEDSTEPS viewports
1334 QRect requestRect = r->isTile() ? r->normalizedRect().geometry( r->width(), r->height() ) : QRect( 0, 0, r->width(), r->height() );
1345 else if ( ( !r->d->mForce && r->page()->hasPixmap( r->observer(), r->width(), r->height(), r->normalizedRect() ) ) || !m_observers.contains(r->observer()) )
1350 else if ( !r->d->mForce && r->preload() && qAbs( r->pageNumber() - currentViewportPage ) >= maxDistance )
1357 else if ( tilesManager && tilesManager->isRequesting( r->normalizedRect(), r->width(), r->height() ) )
1363 else if ( !tilesManager && m_generator->hasFeature( Generator::TiledRendering ) && (long)r->width() * (long)r->height() > 8000000L )
1373 tilesManager = new TilesManager( r->pageNumber(), pixmap->width(), pixmap->height(), r->page()->rotation() );
1380 tilesManager = new TilesManager( r->pageNumber(), r->width(), r->height(), r->page()->rotation() );
1392 const QList<Tile> tiles = tilesManager->tilesAt( r->normalizedRect(), TilesManager::TerminalTile );
1469 QRect requestRect = !request->isTile() ? QRect(0, 0, request->width(), request->height() ) : request->normalizedRect().geometry( request->width(), request->height() );
1470 kDebug(OkularDebug).nospace() << "sending request observer=" << request->observer() << " " <<requestRect.width() << "x" << requestRect.height() << "@" << request->pageNumber() << " async == " << request->asynchronous() << " isTile == " << request->isTile();
1535 QHash< QString, GeneratorInfo >::iterator it = m_loadedGenerators.begin(), itEnd = m_loadedGenerators.end();
1549 QVector<Page*>::const_iterator it = m_pagesVector.constBegin(), end = m_pagesVector.constEnd();
1576 QMap< DocumentObserver*, PagePrivate::PixmapObject >::ConstIterator it = page->d->m_pixmaps.constBegin(), itEnd = page->d->m_pixmaps.constEnd();
1580 PixmapRequest * p = new PixmapRequest( it.key(), pageNumber, size.width(), size.height(), 1, PixmapRequest::Asynchronous );
1592 PixmapRequest * p = new PixmapRequest( observer, pageNumber, tilesManager->width(), tilesManager->height(), 1, PixmapRequest::Asynchronous );
1598 QVector< Okular::VisiblePageRect * >::const_iterator vIt = m_pageRects.constBegin(), vEnd = m_pageRects.constEnd();
1637 void DocumentPrivate::doContinueDirectionMatchSearch(void *doContinueDirectionMatchSearchStruct)
1639 DoContinueDirectionMatchSearchStruct *searchStruct = static_cast<DoContinueDirectionMatchSearchStruct *>(doContinueDirectionMatchSearchStruct);
1684 searchStruct->match = page->findText( searchStruct->searchID, search->cachedString, forward ? FromTop : FromBottom, search->cachedCaseSensitivity );
1697 QMetaObject::invokeMethod(m_parent, "doContinueDirectionMatchSearch", Qt::QueuedConnection, Q_ARG(void *, searchStruct));
1701 doProcessSearchMatch( searchStruct->match, search, searchStruct->pagesToNotify, searchStruct->currentPage, searchStruct->searchID, search->cachedViewportMove, search->cachedColor );
1706 void DocumentPrivate::doProcessSearchMatch( RegularAreaRect *match, RunningSearch *search, QSet< int > *pagesToNotify, int currentPage, int searchID, bool moveViewport, const QColor & color )
1729 // Create a normalized rectangle around the search match that includes a 5% buffer on all sides.
1730 const Okular::NormalizedRect matchRectWithBuffer = Okular::NormalizedRect( match->first().left - 0.05,
1735 const bool matchRectFullyVisible = isNormalizedRectangleFullyVisible( matchRectWithBuffer, currentPage );
1760 void DocumentPrivate::doContinueAllDocumentSearch(void *pagesToNotifySet, void *pageMatchesMap, int currentPage, int searchID)
1762 QMap< Page *, QVector<RegularAreaRect *> > *pageMatches = static_cast< QMap< Page *, QVector<RegularAreaRect *> > * >(pageMatchesMap);
1796 lastMatch = page->findText( searchID, search->cachedString, NextResult, search->cachedCaseSensitivity, lastMatch );
1798 lastMatch = page->findText( searchID, search->cachedString, FromTop, search->cachedCaseSensitivity );
1808 QMetaObject::invokeMethod(m_parent, "doContinueAllDocumentSearch", Qt::QueuedConnection, Q_ARG(void *, pagesToNotifySet), Q_ARG(void *, pageMatches), Q_ARG(int, currentPage + 1), Q_ARG(int, searchID));
1847 void DocumentPrivate::doContinueGooglesDocumentSearch(void *pagesToNotifySet, void *pageMatchesMap, int currentPage, int searchID, const QStringList & words)
1850 QMap< Page *, QVector<MatchColor> > *pageMatches = static_cast< QMap< Page *, QVector<MatchColor> > * >(pageMatchesMap);
1904 lastMatch = page->findText( searchID, word, NextResult, search->cachedCaseSensitivity, lastMatch );
1928 QMetaObject::invokeMethod(m_parent, "doContinueGooglesDocumentSearch", Qt::QueuedConnection, Q_ARG(void *, pagesToNotifySet), Q_ARG(void *, pageMatches), Q_ARG(int, currentPage + 1), Q_ARG(int, searchID), Q_ARG(QStringList, words));
2032 bool DocumentPrivate::isNormalizedRectangleFullyVisible( const Okular::NormalizedRect & rectOfInterest, int rectPage )
2056 d->m_viewportIterator = d->m_viewportHistory.insert( d->m_viewportHistory.end(), DocumentViewport() );
2061 connect( d->m_undoStack, SIGNAL( canRedoChanged(bool) ), this, SIGNAL( canRedoChanged(bool) ) );
2071 QSet< View * >::const_iterator viewIt = d->m_views.constBegin(), viewEnd = d->m_views.constEnd();
2082 QHash< QString, GeneratorInfo >::const_iterator it = d->m_loadedGenerators.constBegin(), itEnd = d->m_loadedGenerators.constEnd();
2128 Document::OpenResult Document::openDocument( const QString & docFile, const KUrl& url, const KMimeType::Ptr &_mime, const QString & password )
2171 KService::List offers = KMimeTypeTrader::self()->query(mime->name(),"okular/Generator",constraint);
2196 emit error( i18n( "Can not find a plugin which is able to handle the document being passed." ), -1 );
2227 OpenResult openResult = d->openDocumentInternal( offer, isstdin, docFile, filedata, password );
2274 d->m_annotationsNeedSaveAs = ( d->canAddAnnotationsNatively() && containsExternalAnnotations );
2322 const QStringList docScripts = d->m_generator->metaData( "DocumentScripts", "JavaScript" ).toStringList();
2415 QHash< QString, GeneratorInfo >::const_iterator genIt = d->m_loadedGenerators.constFind( d->m_generatorName );
2503 QVector<Page*>::const_iterator it = d->m_pagesVector.constBegin(), end = d->m_pagesVector.constEnd();
2540 QVector<Page*>::const_iterator it = d->m_pagesVector.constBegin(), end = d->m_pagesVector.constEnd();
2622 if ( !d->m_generator || !d->m_generator->hasFeature( Generator::FontInfo ) || d->m_fontThread )
2640 connect( d->m_fontThread, SIGNAL(gotFont(Okular::FontInfo)), this, SLOT(fontReadingGotFont(Okular::FontInfo)) );
2682 void Document::setVisiblePageRects( const QVector< VisiblePageRect * > & visiblePageRects, DocumentObserver *excludeObserver )
2839 void Document::requestPixmaps( const QLinkedList< PixmapRequest * > & requests, PixmapRequestFlags reqOptions )
2847 QLinkedList< PixmapRequest * >::const_iterator rIt = requests.constBegin(), rEnd = requests.constEnd();
2855 // FIXME This assumes all requests come from the same observer, that is true atm but not enforced anywhere
2859 QLinkedList< PixmapRequest * >::const_iterator rIt = requests.constBegin(), rEnd = requests.constEnd();
2865 QLinkedList< PixmapRequest * >::iterator sIt = d->m_pixmapRequestsStack.begin(), sEnd = d->m_pixmapRequestsStack.end();
2880 QLinkedList< PixmapRequest * >::const_iterator rIt = requests.constBegin(), rEnd = requests.constEnd();
2885 kDebug(OkularDebug).nospace() << "request observer=" << request->observer() << " " <<request->width() << "x" << request->height() << "@" << request->pageNumber();
2900 const QList<Tile> tiles = request->d->tilesManager()->tilesAt( request->normalizedRect(), TilesManager::TerminalTile );
3007 kError(OkularDebug) << "Error: Document::prepareToModifyAnnotationProperties has already been called since last call to Document::modifyPageAnnotationProperties";
3018 kError(OkularDebug) << "Error: Document::prepareToModifyAnnotationProperties must be called before Annotation is modified";
3031 void Document::translatePageAnnotation(int page, Annotation* annotation, const NormalizedPoint & delta )
3034 QUndoCommand *uc = new Okular::TranslateAnnotationCommand( d, annotation, page, delta, complete );
3046 QUndoCommand *uc = new EditAnnotationContentsCommand( d, annotation, page, newContents, newCursorPos,
3081 d->m_undoStack->beginMacro(i18nc("remove a collection of annotations from the page", "remove annotations"));
3106 iface->annotationProxy() && iface->annotationProxy()->supports(AnnotationProxy::Modification) )
3176 void Document::setViewport( const DocumentViewport & viewport, DocumentObserver *excludeObserver, bool smoothMove )
3285 void Document::searchText( int searchID, const QString & text, bool fromStart, Qt::CaseSensitivity caseSensitivity,
3291 if ( !d->m_generator || !d->m_generator->hasFeature( Generator::TextExtraction ) || d->m_pagesVector.isEmpty() )
3331 QMap< Page *, QVector<RegularAreaRect *> > *pageMatches = new QMap< Page *, QVector<RegularAreaRect *> >;
3334 QMetaObject::invokeMethod(this, "doContinueAllDocumentSearch", Qt::QueuedConnection, Q_ARG(void *, pagesToNotify), Q_ARG(void *, pageMatches), Q_ARG(int, 0), Q_ARG(int, searchID));
3344 int currentPage = fromStart ? fromStartSearchPage : ((s->continueOnPage != -1) ? s->continueOnPage : viewportPage);
3355 match = lastPage->findText( searchID, text, forward ? NextResult : PreviousResult, caseSensitivity, &s->continueOnMatch );
3366 DoContinueDirectionMatchSearchStruct *searchStruct = new DoContinueDirectionMatchSearchStruct();
3372 QMetaObject::invokeMethod(this, "doContinueDirectionMatchSearch", Qt::QueuedConnection, Q_ARG(void *, searchStruct));
3377 QMap< Page *, QVector< QPair<RegularAreaRect *, QColor> > > *pageMatches = new QMap< Page *, QVector<QPair<RegularAreaRect *, QColor> > >;
3381 QMetaObject::invokeMethod(this, "doContinueGooglesDocumentSearch", Qt::QueuedConnection, Q_ARG(void *, pagesToNotify), Q_ARG(void *, pageMatches), Q_ARG(int, 0), Q_ARG(int, searchID), Q_ARG(QStringList, words));
3470 QUndoCommand *uc = new EditFormTextCommand( this->d, form, pageNumber, newContents, newCursorPos, form->text(), prevCursorPos, prevAnchorPos );
3479 QUndoCommand *uc = new EditFormListCommand( this->d, form, pageNumber, newChoices, prevChoices );
3501 QUndoCommand *uc = new EditFormComboCommand( this->d, form, pageNumber, newText, newCursorPos, prevText, prevCursorPos, prevAnchorPos );
3505 void Document::editFormButtons( int pageNumber, const QList< FormFieldButton* >& formButtons, const QList< bool >& newButtonStates )
3507 QUndoCommand *uc = new EditFormButtonsCommand( this->d, pageNumber, formButtons, newButtonStates );
3643 KMessageBox::information( d->m_widget, i18n("The document is trying to execute an external application and, for your safety, Okular does not allow that.") );
3651 KMessageBox::information( d->m_widget, i18n("The document is trying to execute an external application and, for your safety, Okular does not allow that.") );
3664 KMessageBox::information( d->m_widget, i18n( "No application found for opening file of mimetype %1.", mime->name() ) );
3811 QHash< int, QString >::const_iterator it = editors.constFind( SettingsCore::externalEditor() );
3840 const SourceReference * Document::dynamicSourceReference( int pageNr, double absX, double absY )
3845 QMetaObject::invokeMethod( d->m_generator, "dynamicSourceReference", Qt::DirectConnection, Q_RETURN_ARG(const Okular::SourceReference*, ref), Q_ARG(int, pageNr), Q_ARG(double, absX), Q_ARG(double, absY) );
3887 QMetaObject::invokeMethod( d->m_generator, "printError", Qt::DirectConnection, Q_RETURN_ARG(Okular::Generator::PrintError, err) );
3909 return i18n( "Could not find a suitable binary for printing. Make sure CUPS lpr binary is available" );
3938 QString constraint( "([X-KDE-Priority] > 0) and (exist Library) and ([X-KDE-okularHasInternalSettings])" );
3965 QString constraint( "([X-KDE-Priority] > 0) and (exist Library) and ([X-KDE-okularHasInternalSettings])" );
3996 QHash< QString, GeneratorInfo >::const_iterator genIt = d->m_loadedGenerators.constFind( d->m_generatorName );
4013 QHash< QString, GeneratorInfo >::iterator genIt = d->m_loadedGenerators.find( d->m_generatorName );
4051 QHash< QString, GeneratorInfo >::iterator genIt = d->m_loadedGenerators.find( d->m_generatorName );
4098 QMetaObject::invokeMethod(d->m_generator, "requestFontData", Qt::DirectConnection, Q_ARG(Okular::FontInfo, font), Q_ARG(QByteArray *, &result));
4104 Document::OpenResult Document::openDocumentArchive( const QString & docFile, const KUrl & url, const QString & password )
4119 std::auto_ptr< QIODevice > mainEntryDevice( static_cast< const KZipFileEntry * >( mainEntry )->createDevice() );
4162 std::auto_ptr< QIODevice > docEntryDevice( static_cast< const KZipFileEntry * >( docEntry )->createDevice() );
4170 std::auto_ptr< QIODevice > metadataEntryDevice( static_cast< const KZipFileEntry * >( metadataEntry )->createDevice() );
4179 const KMimeType::Ptr docMime = KMimeType::findByPath( tempFileName, 0, true /* local file */ );
4297 if (currentPage->orientation() == Okular::Rotation90 || currentPage->orientation() == Okular::Rotation270) qSwap(width, height);
4310 void Document::walletDataForFile( const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey ) const
4362 AllocatedPixmap * memoryPage = new AllocatedPixmap( req->observer(), req->pageNumber(), memoryBytes );
4401 // TODO: For generators that generate the bbox by pixmap scanning, if the first generated pixmap is very small, the bounding box will forever be inaccurate.
4402 // TODO: Crop computation should also consider annotations, actions, etc. to make sure they're not cropped away.
4403 // TODO: Help compute bounding box for generators that create a QPixmap without a QImage, like text and plucker.
4476 foreachObserverD( notifyContentsCleared( DocumentObserver::Pixmap | DocumentObserver::Highlights | DocumentObserver::Annotations ) );
4507 foreachObserver( notifyContentsCleared( DocumentObserver::Pixmap | DocumentObserver::Highlights ) );
void editFormList(int pageNumber, Okular::FormFieldChoice *form, const QList< int > &newChoices)
Edit the selected list entries in form on page page to be newChoices.
Definition: document.cpp:3474
bool savePageDocumentInfo(KTemporaryFile *infoFile, int what) const
Definition: document.cpp:995
Generator * loadGeneratorLibrary(const KService::Ptr &service)
Definition: document.cpp:816
void setCodec(QTextCodec *codec)
QString execute(ScriptType type, const QString &script)
Definition: scripter.cpp:46
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition: area.h:47
void cleanupPixmapMemory(qulonglong numberOfBytes, const NormalizedRect &visibleRect, int visiblePageNumber)
Removes at least numberOfBytes bytes worth of tiles (least ranked tiles are removed first)...
Definition: tilesmanager.cpp:449
void error(const QString &text, int duration)
This signal is emitted whenever an error occurred.
virtual bool exportTo(const QString &fileName, const ExportFormat &format)
This method is called to export the document in the given format and save it under the given fileName...
Definition: generator.cpp:357
virtual void setCapability(ViewCapability capability, const QVariant &option)
Sets a new value for the specified capability.
Definition: view.cpp:72
void clear()
virtual PageSize::List pageSizes() const
Returns the list of supported page sizes.
Definition: generator.cpp:327
bool isReadable() const
struct Okular::DocumentViewport::@1 autoFit
If 'autoFit.enabled == true' then the page must be autofitted in the viewport.
QDomNodeList elementsByTagName(const QString &tagname) const
Whether the Generator supports export to PDF & PS through the Print Dialog.
Definition: generator.h:209
Definition: page_p.h:44
QList< ExportFormat > exportFormats() const
Returns the list of supported export formats.
Definition: document.cpp:2770
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
static AudioPlayer * instance()
Gets the instance of the audio player.
Definition: audioplayer.cpp:222
void startFontReading()
Starts the reading of the information about the fonts in the document, if available.
Definition: document.cpp:2620
void slotTimedMemoryCheck()
Definition: document.cpp:1298
Definition: generator_p.h:144
virtual void generateTextPage(Page *page)
This method can be called to trigger the generation of a text page for the given page.
Definition: generator.cpp:275
Definition: document_p.h:48
Highlighting information has been changed.
Definition: observer.h:44
QString symLinkTarget() const
void translatePageAnnotation(int page, Annotation *annotation, const Okular::NormalizedPoint &delta)
Translates the position of the given annotation on the given page by a distance delta in normalized c...
Definition: document.cpp:3031
QString & append(QChar ch)
void requestPixmaps(const QLinkedList< PixmapRequest * > &requests)
Sends requests for pixmap generation.
Definition: document.cpp:2834
iterator insert(const Key &key, const T &value)
QDomNode item(int index) const
iterator erase(iterator pos)
QDomProcessingInstruction createProcessingInstruction(const QString &target, const QString &data)
Searching for the next result on the page, earlier result should be located so we search from the las...
Definition: global.h:37
iterator erase(iterator pos)
int width() const
DocumentViewport m_nextDocumentViewport
Definition: document_p.h:207
void performAddPageAnnotation(int page, Annotation *annotation)
Definition: document.cpp:1058
static NormalizedRect fromRotatedRect(const NormalizedRect &rect, Rotation rotation)
Returns a non rotated version of rect, which is rotated by rotation.
Definition: tilesmanager.cpp:581
int width() const
void unregisterView(View *view)
Unregister the specified view from the current document.
Definition: document.cpp:4079
bool contains(const Key &key) const
void linkEndPresentation()
This signal is emitted whenever an action requests an end presentation operation. ...
Page * page() const
Returns a pointer to the page where the pixmap shall be generated for.
Definition: generator.cpp:516
void setPageBoundingBox(int page, const NormalizedRect &boundingBox)
Sets the bounding box of the given page (in terms of upright orientation, i.e., Rotation0).
Definition: document.cpp:4388
void requestTextPage(uint number)
Sends a request for text page generation for the given page number.
Definition: document.cpp:2946
void notifyAnnotationChanges(int page)
Definition: document.cpp:2957
void setViewport(const DocumentViewport &viewport, DocumentObserver *excludeObserver=0, bool smoothMove=false)
Sets the current document viewport to the given viewport.
Definition: document.cpp:3176
void doProcessSearchMatch(RegularAreaRect *match, RunningSearch *search, QSet< int > *pagesToNotify, int currentPage, int searchID, bool moveViewport, const QColor &color)
Definition: document.cpp:1706
void sendGeneratorPixmapRequest()
Definition: document.cpp:1306
Rotation rotation() const
Returns the rotation of the page as defined by the user.
Definition: page.cpp:154
void sourceReferenceActivated(const QString &absFileName, int line, int col, bool *handled)
This signal is emitted whenever a source reference with the given parameters has been activated...
int column() const
Returns the column of the position in the source file.
Definition: sourcereference.cpp:55
QDomNode appendChild(const QDomNode &newChild)
QLinkedList< PixmapRequest * > m_executingPixmapRequests
Definition: document_p.h:213
QString readLine(qint64 maxlen)
virtual void rotationChanged(Rotation orientation, Rotation oldOrientation)
This method is called when the orientation has been changed by the user.
Definition: generator.cpp:323
iterator begin()
virtual bool supportsCapability(ViewCapability capability) const
Query whether the view support the specified capability.
Definition: view.cpp:54
QString attribute(const QString &name, const QString &defValue) const
void modifyPageAnnotationProperties(int page, Annotation *annotation)
Modifies the given annotation on the given page.
Definition: document.cpp:3013
void loadServiceList(const KService::List &offers)
Definition: document.cpp:845
void beginMacro(const QString &text)
bool hasPixmap(DocumentObserver *observer, int width=-1, int height=-1, const NormalizedRect &rect=NormalizedRect()) const
Returns whether the page of size width x height has a pixmap in the region given by rect for the give...
Definition: page.cpp:202
bool m_annotationBeingMoved
Definition: document_p.h:268
virtual const QList< EmbeddedFile * > * embeddedFiles() const
Returns the 'list of embedded files' object of the document or 0 if no list of embedded files is avai...
Definition: generator.cpp:308
void clear()
virtual bool isAllowed(Permission action) const
This method returns whether given action (Permission) is allowed in this document.
Definition: generator.cpp:318
QString toString(int indent) const
const NormalizedRect & normalizedRect() const
Returns the normalized region of the page to request.
Definition: generator.cpp:539
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
bool canConfigurePrinter() const
Returns whether the document can configure the printer itself.
Definition: document.cpp:2566
BookmarkManager * bookmarkManager() const
Returns the bookmark manager of the document.
Definition: document.cpp:3511
iterator begin()
virtual bool canGeneratePixmap() const
This method returns whether the generator is ready to handle a new pixmap request.
Definition: generator.cpp:229
virtual PageSizeMetric pagesSizeMetric() const
This method returns the metric of the page size.
Definition: generator.cpp:313
bool isNormalizedRectangleFullyVisible(const Okular::NormalizedRect &rectOfInterest, int rectPage)
Return whether the normalized rectangle rectOfInterest on page number rectPage is fully visible...
Definition: document.cpp:2032
bool supportsPrintToFile() const
Returns whether the document supports printing to both PDF and PS files.
Definition: document.cpp:3872
Is being moved (mouse drag and drop). If ExternallyDrawn, the generator must not draw it...
Definition: annotations.h:136
bool isElement() const
void loadAllGeneratorLibraries()
Definition: document.cpp:833
void deletePixmap(DocumentObserver *observer)
Deletes the pixmap for the given observer.
Definition: page.cpp:712
const_iterator constBegin() const
const T & at(int i) const
bool exportToText(const QString &fileName) const
Exports the document as ASCII text and saves it under fileName.
Definition: document.cpp:2758
Whether the Generator can read a document directly from its raw data.
Definition: generator.h:204
KUrl currentDocument() const
Returns the url of the currently opened document.
Definition: document.cpp:2705
bool isValid() const
bool showCaption() const
Returns whether the caption shall be shown.
Definition: annotations.cpp:1396
PageSize::List pageSizes() const
Returns the list of supported page sizes or an empty list if this feature is not available.
Definition: document.cpp:2738
bool isSymLink() const
bool isEmpty() const
NormalizedRect is a helper class which stores the coordinates of a normalized rect, which is a rectangle of.
Definition: area.h:105
bool print(QPrinter &printer)
Prints the document to the given printer.
Definition: document.cpp:3877
QLinkedList< DocumentViewport > m_viewportHistory
Definition: document_p.h:205
qulonglong m_allocatedPixmapsTotalMemory
Definition: document_p.h:216
ExportFormat::List m_exportFormats
Definition: document_p.h:231
void close()
This signal is emitted whenever an action requests a document close operation.
Definition: area.h:860
void editPageAnnotationContents(int page, Annotation *annotation, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos)
Edits the plain text contents of the given annotation on the given page.
Definition: document.cpp:3038
virtual QVariant metaData(const QString &key, const QVariant &option) const
This method returns the meta data of the given key with the given option of the document.
Definition: generator.cpp:346
const_iterator constFind(const Key &key) const
int height() const
void saveDocumentInfo() const
Definition: document.cpp:1209
const_iterator constFind(const Key &key) const
QStringList supportedMimeTypes() const
Returns the list with the supported MIME types.
Definition: document.cpp:3970
QDomElement documentElement() const
void unlock()
T & first()
Whether the Generator can provide information about the fonts used in the document.
Definition: generator.h:205
int length() const
bool exists() const
const_iterator insert(const T &value)
static QString getKeyTitle(Key key)
Returns the user visible string for the given key.
Definition: document.cpp:4749
void processRenditionAction(const Okular::RenditionAction *action)
This signal is emitted whenever an rendition action is triggered and the UI should process it...
Whether the Generator supports postscript-based file printing.
Definition: generator.h:208
void clear()
double toDouble(bool *ok) const
bool hasTextPage() const
Returns whether the page provides a text page (TextPage).
Definition: page.cpp:228
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
void setContents(const QString &contents)
Sets the contents of the annotation.
Definition: annotations.cpp:539
QVariant documentMetaData(const QString &key, const QVariant &option) const
Request a particular metadata of the Document itself (ie, not something depending on the document typ...
Definition: document.cpp:1968
iterator end()
TextType textType() const
Returns the text type of the text annotation.
Definition: annotations.cpp:1024
bool copy(const QString &newName)
BookmarkManager * m_bookmarkManager
Definition: document_p.h:235
static OKULAR_EXPORT QString docDataFileName(const KUrl &url, qint64 document_size)
Definition: document.cpp:2108
QTransform inverted(bool *invertible) const
Definition: annotations.h:856
Searching from top of the page, next result is to be found, there was no earlier search result...
Definition: global.h:35
void canUndoChanged(bool undoAvailable)
This signal is emmitted whenever the availability of the undo function changes.
int size() const
void setNextViewport()
Sets the current document viewport to the previous viewport in the viewport history.
Definition: document.cpp:3256
bool isNull() const
void stopFontReading()
Force the termination of the reading of the information about the fonts in the document, if running.
Definition: document.cpp:2646
void setNormalizedRect(const NormalizedRect &rect)
Sets the region of the page to request.
Definition: generator.cpp:531
QDomNode nextSibling() const
QString printError() const
Returns the last print error in case print() failed.
Definition: document.cpp:3882
bool isOpened() const
Returns whether the document is currently opened.
Definition: document.cpp:2561
int indexOf(const T &value, int from) const
QColor fromHsv(int h, int s, int v, int a)
Rotation rotation() const
Returns the current rotation of the document.
Definition: document.cpp:2799
void clear()
qulonglong getFreeMemory(qulonglong *freeSwap=0)
Definition: document.cpp:502
QPointer< FontExtractionThread > m_fontThread
Definition: document_p.h:259
Searching from bottom of the page, next result is to be found, there was no earlier search result...
Definition: global.h:36
void removeObserver(DocumentObserver *observer)
Unregisters the given observer for the document.
Definition: document.cpp:2497
QDomElement toElement() const
bool isFile() const
VisiblePageRect(int pageNumber=-1, const NormalizedRect &rectangle=NormalizedRect())
Creates a new visible page rectangle.
Definition: document.cpp:4830
bool m_annotationEditingEnabled
Definition: document_p.h:266
void canRedoChanged(bool redoAvailable)
This signal is emmitted whenever the availability of the redo function changes.
Definition: generator.h:202
Document(QWidget *widget)
Creates a new document with the given widget as widget to relay GUI things (messageboxes, ...).
Definition: document.cpp:2051
Definition: pagecontroller_p.h:26
bool canProvideFontInformation() const
Whether the current document can provide information about the fonts used in it.
Definition: document.cpp:2657
bool canAddAnnotationsNatively() const
Definition: document.cpp:3090
void linkGoToPage()
This signal is emitted whenever an action requests a goto operation.
QWidget * printConfigurationWidget() const
Returns a custom printer configuration page or 0 if no custom printer configuration page is available...
Definition: document.cpp:3921
virtual void notifyViewportChanged(bool smoothMove)
This method is called whenever the viewport has been changed.
Definition: observer.cpp:27
QMap< int, RunningSearch * > m_searches
Definition: document_p.h:191
Searching for the previous result on the page, earlier result should be located so we search from the...
Definition: global.h:38
const Page * page(int number) const
Returns the page object for the given page number or 0 if the number is out of range.
Definition: document.cpp:2667
bool isExternal() const
Returns whether the goto action points to an external document.
Definition: action.cpp:110
int count() const
QString number(int n, int base)
int count(const T &value) const
virtual ExportFormat::List exportFormats() const
Returns the list of additional supported export formats.
Definition: generator.cpp:352
Set along with Annotations when Save As is needed or annotation changes will be lost.
Definition: observer.h:48
void saveViewsInfo(View *view, QDomElement &e) const
Definition: document.cpp:770
void append(const T &value)
SaveInterface * generatorSave(GeneratorInfo &info)
Definition: document.cpp:896
virtual CapabilityFlags capabilityFlags(ViewCapability capability) const
Query the flags for the specified capability.
Definition: view.cpp:60
QString get(const QString &key) const
Returns the value for a given key or an empty string when the key doesn't exist.
Definition: document.cpp:4680
Abstract interface for configuration control.
Definition: configinterface.h:38
void linkFind()
This signal is emitted whenever an action requests a find operation.
QList< Tile > tilesAt(const NormalizedRect &rect, TileLeaf tileLeaf)
Returns a list of all tiles intersecting with rect.
Definition: tilesmanager.cpp:358
const_iterator constEnd() const
QDomDocument ownerDocument() const
QString text() const
int toInt(bool *ok) const
bool isEmpty() const
Generator can edit native annotations.
Definition: annotations.h:692
void performSetAnnotationContents(const QString &newContents, Annotation *annot, int pageNumber)
Definition: document.cpp:1173
virtual QString editChoice() const
The text entered into an editable combo box choice field.
Definition: form.cpp:242
bool hasAttribute(const QString &name) const
void setBoundingBox(const NormalizedRect &bbox)
Sets the bounding box of the page content in normalized [0,1] coordinates, in terms of the upright or...
Definition: page.cpp:189
void setRequest(const NormalizedRect &rect, int pageWidth, int pageHeight)
Sets a region to be requested so the tiles manager knows which pixmaps to expect and discard those no...
Definition: tilesmanager.cpp:539
bool isAllowed(Permission action) const
Returns whether the given action is allowed in the document.
Definition: document.cpp:2710
int exec(QFlags< QEventLoop::ProcessEventsFlag > flags)
void setVisiblePageRects(const QVector< VisiblePageRect * > &visiblePageRects, DocumentObserver *excludeObserver=0)
Sets the list of visible page rectangles.
Definition: document.cpp:2682
const DocumentInfo * documentInfo() const
Returns the meta data of the document or 0 if no meta data are available.
Definition: document.cpp:2577
virtual SubType subType() const =0
Returns the sub type of the annotation.
QDomNode getAnnotationPropertiesDomNode() const
Retrieve the QDomNode representing this annotation's properties.
Definition: annotations.cpp:801
void push_back(const T &value)
void setAttribute(const QString &name, const QString &value)
DocumentObserver * observer() const
Returns the observer of the request.
Definition: generator.cpp:481
KXMLGUIClient * guiClient()
This method requests the XML GUI Client provided by the interface.
Definition: guiinterface.h:50
void removePageAnnotation(int page, Annotation *annotation)
Removes the given annotation from the given page.
Definition: document.cpp:3073
void setRotation(int rotation)
This slot is called whenever the user changes the rotation of the document.
Definition: document.cpp:4449
int toInt(bool *ok, int base) const
void removePageAnnotations(int page, const QList< Annotation * > &annotations)
Removes the given annotations from the given page.
Definition: document.cpp:3079
bool isEmpty() const
void exit(int returnCode)
bool isEmpty() const
QString pageSizeString(int page) const
Returns the size string for the given page or an empty string if the page is out of range...
Definition: document.cpp:2821
virtual Document::OpenResult loadDocumentWithPassword(const QString &fileName, QVector< Page * > &pagesVector, const QString &password)
Loads the document with the given fileName and password and fills the pagesVector with the parsed pag...
Definition: generator.cpp:189
virtual void notifySetup(const QVector< Okular::Page * > &pages, int setupFlags)
This method is called whenever the document is initialized or reconstructed.
Definition: observer.cpp:23
const_iterator constEnd() const
RegularAreaRect * match
Definition: document_p.h:72
const char * constData() const
QString bookmarkedPageRange() const
Returns the range of the bookmarked.pages.
Definition: document.cpp:3532
iterator begin()
The Goto action changes the viewport to another page or loads an external document.
Definition: action.h:115
Definition: document.h:106
QMap< DocumentObserver *, PixmapObject > m_pixmaps
Definition: page_p.h:123
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
QByteArray readAll()
bool saveDocumentArchive(const QString &fileName)
Saves a document archive.
Definition: document.cpp:4196
NormalizedRect boundingBox() const
Returns the bounding box of the page content in normalized [0,1] coordinates, in terms of the upright...
Definition: page.cpp:179
DocumentViewport destViewport() const
Returns the document viewport the goto action points to.
Definition: action.cpp:122
void fontReadingProgress(int page)
Reports the progress when reading the fonts in the document.
void setOverrideCursor(const QCursor &cursor)
void doContinueAllDocumentSearch(void *pagesToNotifySet, void *pageMatchesMap, int currentPage, int searchID)
Definition: document.cpp:1760
QTime addSecs(int s) const
bool canUndo() const
Returns true if there is an undo command available; otherwise returns false.
Definition: document.cpp:3139
void fontReadingGotFont(const Okular::FontInfo &font)
Definition: document.cpp:1520
void restoreOverrideCursor()
void setZoom(int factor, DocumentObserver *excludeObserver=0)
Sets the zoom for the current document.
Definition: document.cpp:3231
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
Definition: page_p.h:47
virtual QWidget * printConfigurationWidget() const =0
Builds and returns a new printing configuration widget.
void setPageSize(const PageSize &size)
This slot is called whenever the user changes the page size of the document.
Definition: document.cpp:4481
The annotation is located next to the text.
Definition: annotations.h:740
bool openRelativeFile(const QString &fileName)
Definition: document.cpp:804
virtual void notifyVisibleRectsChanged()
This method is called whenever the visible rects have been changed.
Definition: observer.cpp:39
QSet< DocumentObserver * > m_observers
Definition: document_p.h:211
QList< int > bookmarkedPageList() const
Returns a list of the bookmarked.pages.
Definition: document.cpp:3516
bool canModifyExternalAnnotations() const
Definition: document.cpp:3101
QHash< QString, GeneratorInfo > m_loadedGenerators
Definition: document_p.h:241
QDomNode m_prevPropsOfAnnotBeingModified
Definition: document_p.h:272
virtual const DocumentInfo * generateDocumentInfo()
Returns the general information object of the document or 0 if no information are available...
Definition: generator.cpp:293
T & first()
virtual QStringList choices() const =0
The possible choices of the choice field.
bool operator<(const DocumentViewport &other) const
Definition: document.cpp:4622
void setPaperSize(PaperSize newPaperSize)
iterator end()
DocumentViewport(int number=-1)
Creates a new viewport for the given page number.
Definition: document.cpp:4514
qulonglong toULongLong(bool *ok, int base) const
RegularAreaRect * findText(int id, const QString &text, SearchDirection direction, Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect=0) const
Returns the bounding rect of the text which matches the following criteria or 0 if the search is not ...
Definition: page.cpp:288
QString destinationName() const
Returns the document named destination the goto action points to.
Definition: action.cpp:128
bool removeAnnotation(Annotation *annotation)
Removes the annotation from the page.
Definition: page.cpp:651
Whether the Generator can change the size of the document pages.
Definition: generator.h:206
const QVector< VisiblePageRect * > & visiblePageRects() const
Returns the list of visible page rectangles.
Definition: document.cpp:2677
void processMovieAction(const Okular::MovieAction *action)
This signal is emitted whenever an movie action is triggered and the UI should process it...
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QSet< int > * pagesToNotify
Definition: document_p.h:71
QRect geometry(int xScale, int yScale) const
Returns the rectangle that accrues when the normalized rectangle is multiplyed with the scaling xScal...
Definition: area.cpp:239
The end of document was reached without any match.
Definition: document.h:493
TilesManager * tilesManager() const
Definition: generator.cpp:544
bool canModifyPageAnnotation(const Annotation *annotation) const
Tests if the annotation can be modified.
Definition: document.cpp:2977
int pageNumber
The number of the page nearest the center of the viewport.
Definition: document.h:1048
QString right(int n) const
Abstract interface for advanced printing control.
Definition: printinterface.h:39
void setTextSelections(RegularAreaRect *areas, const QColor &color)
Sets the color and areas of text selections.
Definition: page.cpp:581
const KComponentData * componentData() const
Returns the component data associated with the generator.
Definition: document.cpp:3991
struct Okular::DocumentViewport::@0 rePos
If 'rePos.enabled == true' then this structure contains the viewport center or top left depending on ...
Is drawn externally (by the generator which provided it)
Definition: annotations.h:135
void rotationFinished(int page, Okular::Page *okularPage)
Definition: document.cpp:1498
QDomText createTextNode(const QString &value)
PrintingType printingSupport() const
Returns what sort of printing the document supports: Native, Postscript, None.
Definition: document.cpp:3850
bool canUndo() const
void clear()
bool supportsPageSizes() const
Returns whether the document supports the listing of page sizes.
Definition: document.cpp:2728
QLinkedList< Annotation * > annotations() const
Returns the list of annotations of the page.
Definition: page.cpp:482
bool asynchronous() const
Returns whether the generation should be done synchronous or asynchronous.
Definition: generator.cpp:506
qint64 size() const
const T value(const Key &key) const
QString namePaperSize(double inchesWidth, double inchesHeight) const
Definition: document.cpp:160
The keywords which describe the content of the document.
Definition: document.h:1105
iterator find(const Key &key)
void setTilesManager(const DocumentObserver *observer, TilesManager *tm)
Set the tiles manager for the tiled .
Definition: page.cpp:1012
DocumentViewport nextDocumentViewport() const
Definition: document.cpp:1025
const DocumentSynopsis * documentSynopsis() const
Returns the table of content of the document or 0 if no table of content is available.
Definition: document.cpp:2615
void lock()
int height() const
Whether the Generator supports native cross-platform printing (QPainter-based).
Definition: generator.h:207
bool hasFeature(GeneratorFeature feature) const
Query for the specified feature.
Definition: generator.cpp:369
void unloadGenerator(const GeneratorInfo &info)
Definition: document.cpp:864
const DocumentViewport & viewport() const
Returns the current viewport of the document.
Definition: document.cpp:2672
void doContinueGooglesDocumentSearch(void *pagesToNotifySet, void *pageMatchesMap, int currentPage, int searchID, const QStringList &words)
Definition: document.cpp:1847
const_iterator constBegin() const
virtual void notifyCurrentPageChanged(int previous, int current)
This method is called after the current page of the document has been entered.
Definition: observer.cpp:52
bool isRelativePath(const QString &path)
void stop()
virtual void close()
Definition: document_p.h:77
bool preload() const
Returns whether the generation request is for a page that is not important i.e.
Definition: generator.cpp:511
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
bool contains(const T &value) const
A DOM tree containing information about the document.
Definition: document.h:1086
void editFormCombo(int pageNumber, Okular::FormFieldChoice *form, const QString &newText, int newCursorPos, int prevCursorPos, int prevAnchorPos)
Set the active choice in the combo box form on page page to newText The new cursor position (newCurso...
Definition: document.cpp:3483
PaperSize paperSize() const
void playSound(const Sound *sound, const SoundAction *linksound=0)
Enqueue the specified sound for playing, optionally taking more information about the playing from th...
Definition: audioplayer.cpp:228
QVariant 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: document.cpp:2794
bool isNull() const
int priority() const
Returns the priority (less it better, 0 is maximum) of the request.
Definition: generator.cpp:501
const_iterator constEnd() const
virtual void notifyZoom(int factor)
This method is called whenever the zoom of the document has been changed.
Definition: observer.cpp:43
QString localizedSize(const QSizeF &size) const
Definition: document.cpp:261
void searchFinished(int searchID, Okular::Document::SearchStatus endStatus)
Reports that the current search finished.
void setPrevViewport()
Sets the current document viewport to the next viewport in the viewport history.
Definition: document.cpp:3239
bool m_showWarningLimitedAnnotSupport
Definition: document_p.h:269
const Key key(const T &value) const
void editFormText(int pageNumber, Okular::FormFieldText *form, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos)
Edit the text contents of the specified form on page page to be newContents.
Definition: document.cpp:3463
Definition: chooseenginedialog_p.h:20
QVector< VisiblePageRect * > m_pageRects
Definition: document_p.h:246
virtual bool print(QPrinter &printer)
This method is called to print the document to the given printer.
Definition: generator.cpp:336
bool canRemovePageAnnotation(const Annotation *annotation) const
Tests if the annotation can be removed.
Definition: document.cpp:3051
QTime currentTime()
QLinkedList< DocumentViewport >::iterator m_viewportIterator
Definition: document_p.h:206
void set(const QString &key, const QString &value, const QString &title=QString())
Sets a value for a special key.
Definition: document.cpp:4651
virtual AnnotationProxy * annotationProxy() const =0
Returns the annotation proxy.
OpenResult openDocument(const QString &docFile, const KUrl &url, const KMimeType::Ptr &mime, const QString &password=QString())
Opens the document.
Definition: document.cpp:2128
QByteArray fontData(const FontInfo &font) const
Gets the font data for the given font.
Definition: document.cpp:4092
qulonglong totalMemory() const
The total memory consumed by the tiles manager.
Definition: tilesmanager.cpp:444
void setSize(int width, int height)
Inform the new size of the page and mark all tiles to repaint.
Definition: tilesmanager.cpp:136
void linkPresentation()
This signal is emitted whenever an action requests a start presentation operation.
The possibility to save with the current changes to the document.
Definition: saveinterface.h:48
void clear()
void processSourceReference(const SourceReference *reference)
Processes/Executes the given source reference.
Definition: document.cpp:3779
const_iterator constBegin() const
void performRemovePageAnnotation(int page, Annotation *annotation)
Definition: document.cpp:1091
void setNextDocumentViewport(const DocumentViewport &viewport)
Sets the next viewport in the viewport history.
Definition: document.cpp:3275
void setAnnotationEditingEnabled(bool enable)
Control annotation editing (creation, modification and removal), which is enabled by default...
Definition: document.cpp:4304
QDomNode firstChild() const
int width() const
void redo()
QString mid(int position, int n) const
QStringList toStringList() const
QString giveAbsolutePath(const QString &fileName) const
Definition: document.cpp:793
The page size is not defined in a physical metric.
Definition: generator.h:342
KXMLGUIClient * guiClient()
Returns the gui client of the generator, if it provides one.
Definition: document.cpp:2336
void textGenerationDone(Page *page)
Definition: document.cpp:4431
bool historyAtBegin() const
Returns whether the document history is at the begin.
Definition: document.cpp:2784
int configurableGenerators() const
Returns the number of generators that have a configuration widget.
Definition: document.cpp:3963
void calculateMaxTextPages()
Definition: document.cpp:4408
T takeFirst()
bool exportTo(const QString &fileName, const ExportFormat &format) const
Exports the document in the given format and saves it under fileName.
Definition: document.cpp:2779
bool canRemoveExternalAnnotations() const
Definition: document.cpp:3112
virtual void notifyPageChanged(int page, int flags)
This method is called whenever the content on page described by the passed flags has been changed...
Definition: observer.cpp:31
bool isEmpty() const
void endMacro()
The creator of the document (this can be different from the author)
Definition: document.h:1097
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:90
bool isNull() const
Returns whether this normalized rectangle is a null normalized rect.
Definition: area.cpp:151
void searchText(int searchID, const QString &text, bool fromStart, Qt::CaseSensitivity caseSensitivity, SearchType type, bool moveViewport, const QColor &color)
Searches the given text in the document.
Definition: document.cpp:3285
void fontReadingEnded()
Reports that the reading of the fonts in the document is finished.
virtual QList< int > currentChoices() const =0
The currently selected choices.
QTimer * m_saveBookmarksTimer
Definition: document_p.h:239
bool canExportToText() const
Returns whether the document supports the export to ASCII text.
Definition: document.cpp:2749
QLinkedList< AllocatedPixmap * > m_allocatedPixmaps
Definition: document_p.h:215
virtual void pageSizeChanged(const PageSize &pageSize, const PageSize &oldPageSize)
This method is called when the page size has been changed by the user.
Definition: generator.cpp:332
QSizeF allPagesSize() const
If all pages have the same size this method returns it, if the page sizes differ an empty size object...
Definition: document.cpp:2804
void slotGeneratorConfigChanged(const QString &)
Definition: document.cpp:1528
const QChar at(int position) const
The capability is suitable for being serialized/deserialized.
Definition: view.h:57
virtual bool save(const QString &fileName, SaveOptions options, QString *errorText)=0
Save to the specified fileName with the specified options.
void performModifyPageAnnotation(int page, Annotation *annotation, bool appearanceChanged)
Definition: document.cpp:1129
AllocatedPixmap * searchLowestPriorityPixmap(bool unloadableOnly=false, bool thenRemoveIt=false, DocumentObserver *observer=0)
Definition: document.cpp:431
The size of the pages (if all pages have the same size)
Definition: document.h:1108
QString parameters() const
Returns the parameters of the application to execute.
Definition: action.cpp:174
bool historyAtEnd() const
Returns whether the document history is at the end.
Definition: document.cpp:2789
void requestDone(PixmapRequest *request)
This method is used by the generators to signal the finish of the pixmap generation request...
Definition: document.cpp:4317
Okular::Sound * sound() const
Returns the sound object which contains the sound data.
Definition: action.cpp:358
int height() const
void gotFont(const Okular::FontInfo &font)
Emitted when a new font is found during the reading of the fonts of the document. ...
bool canRedo() const
Base class for objects being notified when something changes.
Definition: observer.h:28
virtual void generatePixmap(PixmapRequest *request)
This method can be called to trigger the generation of a new pixmap as described by request...
Definition: generator.cpp:235
void setPixmap(const QPixmap *pixmap, const NormalizedRect &rect)
Sets the pixmap of the tiles covered by rect (which represents the location of pixmap on the page)...
Definition: tilesmanager.cpp:188
void warnLimitedAnnotSupport()
Definition: document.cpp:1039
static QString getKeyString(Key key)
Returns the internal string for the given key.
Definition: document.cpp:4692
bool operator==(const DocumentViewport &other) const
Definition: document.cpp:4604
The Browse action browses an url by opening a web browser or email client, depedning on the url proto...
Definition: action.h:226
bool isTile() const
Returns whether the generator should render just the region given by normalizedRect() or the entire p...
Definition: generator.cpp:526
virtual bool supportsOption(SaveOption option) const =0
Query for the supported saving options.
The DocumentAction action contains an action that is performed on the current document.
Definition: action.h:265
void prepareToModifyAnnotationProperties(Annotation *annotation)
Prepares to modify the properties of the given annotation.
Definition: document.cpp:3002
void setNextDocumentDestination(const QString &namedDestination)
Sets the next namedDestination in the viewport history.
Definition: document.cpp:3280
bool toBool() const
void openUrl(const KUrl &url)
This signal is emitted whenever an action requests an open url operation for the given document url...
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
QMutex m_pixmapRequestsMutex
Definition: document_p.h:214
void undo()
Definition: page_p.h:45
void editFormButtons(int pageNumber, const QList< Okular::FormFieldButton * > &formButtons, const QList< bool > &newButtonStates)
Set the states of the group of form buttons formButtons on page page to newButtonStates.
Definition: document.cpp:3505
bool isRequesting(const NormalizedRect &rect, int pageWidth, int pageHeight) const
Checks whether a given region has already been requested.
Definition: tilesmanager.cpp:534
QString fromLatin1(const char *str, int size)
bool saveChanges(const QString &fileName)
Save the document and the optional changes to it to the specified fileName.
Definition: document.cpp:4039
QString fileName() const
Returns the file name of the application to execute.
Definition: action.cpp:168
ConfigInterface * generatorConfig(GeneratorInfo &info)
Definition: document.cpp:886
void start(int msec)
Whether the Generator can render tiles.
Definition: generator.h:210
bool supportsTiles() const
Returns whether the current document supports tiles.
Definition: document.cpp:2733
void registerView(View *view)
Register the specified view for the current document.
Definition: document.cpp:4060
double toDouble(bool *ok) const
virtual QVariant capability(ViewCapability capability) const
Query the value of the specified capability.
Definition: view.cpp:66
bool canRedo() const
Returns true if there is a redo command available; otherwise returns false.
Definition: document.cpp:3144
virtual void walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const
This method is called to know which wallet data should be used for the given file name...
Definition: generator.cpp:362
iterator insert(const Key &key, const T &value)
Document::OpenResult openDocumentInternal(const KService::Ptr &offer, bool isstdin, const QString &docFile, const QByteArray &filedata, const QString &password)
Definition: document.cpp:906
void addPageAnnotation(int page, Annotation *annotation)
Adds a new annotation to the given page.
Definition: document.cpp:2967
QString pagesSizeString() const
Definition: document.cpp:145
bool extractLilyPondSourceReference(const QString &url, QString *file, int *row, int *col)
Definition: sourcereference.cpp:60
QString tagName() const
void addObserver(DocumentObserver *observer)
Registers a new observer for the document.
Definition: document.cpp:2484
Whether the Generator can extract text from the document in the form of TextPage's.
Definition: generator.h:203
void fillConfigDialog(KConfigDialog *dialog)
Fill the KConfigDialog dialog with the setting pages of the generators.
Definition: document.cpp:3932
The Rendition action executes an operation on a video or executes some JavaScript code on activation...
Definition: action.h:491
Rotation orientation() const
Returns the orientation of the page as defined by the document.
Definition: page.cpp:149
T & first()
void addAnnotation(Annotation *annotation)
Adds a new annotation to the page.
Definition: page.cpp:631
bool supportsSearching() const
Returns whether the document supports searching.
Definition: document.cpp:2723
Generator can create native annotations.
Definition: annotations.h:691
const SourceReference * dynamicSourceReference(int pageNr, double absX, double absY)
Asks the generator to dynamically generate a SourceReference for a given page number and absolute X a...
Definition: document.cpp:3840
iterator end()
const_iterator constEnd() const
QDomElement createElement(const QString &tagName)
const_iterator constBegin() const
virtual bool reparseConfig()=0
This method is called to tell the generator to re-parse its configuration.
QList< int > m_allocatedTextPagesFifo
Definition: document_p.h:217
bool canSaveChanges() const
Returns whether the changes to the document (modified annotations, values in form fields...
Definition: document.cpp:4007
Document * viewDocument() const
Return the document which this view is associated to, or null if it is not associated with any docume...
Definition: view.cpp:44
Relative to the top left corner of the page.
Definition: document.h:1056
void quit()
This signal is emitted whenever an action requests an application quit operation. ...
Definition: annotations.h:731
Generator can remove native annotations.
Definition: annotations.h:693
qreal height() const
Definition: page_p.h:51
PageController * m_pageController
Definition: document_p.h:251
int size() const
QPrinter::Orientation orientation() const
Returns the orientation of the document (for printing purposes).
Definition: document.cpp:4282
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Definition: document.h:105
virtual const DocumentSynopsis * generateDocumentSynopsis()
Returns the 'table of content' object of the document or 0 if no table of content is available...
Definition: generator.cpp:298
bool closeDocument()
This method is called when the document is closed and not used any longer.
Definition: generator.cpp:199
int row() const
Returns the row of the position in the source file.
Definition: sourcereference.cpp:50
void continueSearch(int searchID)
Continues the search for the given searchID.
Definition: document.cpp:3385
TilesManager * tilesManager(const DocumentObserver *observer) const
Get the tiles manager for the tiled .
Definition: page.cpp:1007
Definition: scripter.h:24
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
static QSizeF realDpi(QWidget *widgetOnScreen)
Return the real DPI of the display containing given widget.
Definition: utils.cpp:301
QString toString() const
iterator end()
const QList< EmbeddedFile * > * embeddedFiles() const
Returns the list of embedded files or 0 if no embedded files are available.
Definition: document.cpp:2662
QString m_nextDocumentDestination
Definition: document_p.h:208
int secsTo(const QTime &t) const
int count(const Key &key) const
iterator find(const Key &key)
QStringList m_supportedMimeTypes
Definition: document_p.h:249
void fontReadingProgress(int page)
Definition: document.cpp:1508
DocumentActionType documentActionType() const
Returns the type of action.
Definition: action.cpp:247
qreal width() const
A DOM tree that describes the Table of Contents.
Definition: document.h:1167
void loadViewsInfo(View *view, const QDomElement &e)
Definition: document.cpp:737
void setPageTextSelection(int page, RegularAreaRect *rect, const QColor &color)
Sets the text selection for the given page.
Definition: document.cpp:3123
void doContinueDirectionMatchSearch(void *doContinueDirectionMatchSearchStruct)
Definition: document.cpp:1637
int selectedGenerator() const
Definition: chooseenginedialog.cpp:43
void push(QUndoCommand *cmd)
void resetSearch(int searchID)
Resets the search for the given searchID.
Definition: document.cpp:3419
void append(const T &value)
void setViewportPage(int page, DocumentObserver *excludeObserver=0, bool smoothMove=false)
Sets the current document viewport to the given page.
Definition: document.cpp:3164
void walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const
Returns which wallet data to use to read/write the password for the given fileName.
Definition: document.cpp:4310
QLinkedList< PixmapRequest * > m_pixmapRequestsStack
Definition: document_p.h:212
Remove all the previous requests, even for non requested page pixmaps.
Definition: document.h:357
The date of last modification of the document.
Definition: document.h:1102
virtual Document::OpenResult loadDocumentFromDataWithPassword(const QByteArray &fileData, QVector< Page * > &pagesVector, const QString &password)
Loads the document from the raw data fileData and password and fills the pagesVector with the parsed ...
Definition: generator.cpp:194
QByteArray toByteArray(int indent) const
virtual void addPages(KConfigDialog *dialog)=0
This method allows the generator to add custom configuration pages to the config dialog of okular...
void setTile(bool tile)
Sets whether the generator should render only the given normalized rect or the entire page...
Definition: generator.cpp:521
void clear()
bool setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn)
virtual bool supports(Capability capability) const =0
Query for the supported capabilities.
void setRotationInternal(int r, bool notify)
Definition: document.cpp:4454
bool m_annotationsNeedSaveAs
Definition: document_p.h:267
const T value(const Key &key) const
OpenResult openDocumentArchive(const QString &docFile, const KUrl &url, const QString &password=QString())
Opens a document archive.
Definition: document.cpp:4104
int remove(const Key &key)
singleShot
qulonglong calculateMemoryToFree()
Definition: document.cpp:292
The producer of the document (e.g. some software)
Definition: document.h:1098
int m_maxAllocatedTextPages
Definition: document_p.h:218
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
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.