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

okular

  • sources
  • kde-4.14
  • kdegraphics
  • okular
  • core
page.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Enrico Ros <eros.kde@email.it> *
3  * This program is free software; you can redistribute it and/or modify *
4  * it under the terms of the GNU General Public License as published by *
5  * the Free Software Foundation; either version 2 of the License, or *
6  * (at your option) any later version. *
7  ***************************************************************************/
8 
9 #include "page.h"
10 #include "page_p.h"
11 
12 // qt/kde includes
13 #include <QtCore/QHash>
14 #include <QtCore/QSet>
15 #include <QtCore/QString>
16 #include <QtCore/QVariant>
17 #include <QtCore/QUuid>
18 #include <QtGui/QPixmap>
19 #include <QtXml/QDomDocument>
20 #include <QtXml/QDomElement>
21 
22 #include <kdebug.h>
23 
24 // local includes
25 #include "action.h"
26 #include "annotations.h"
27 #include "annotations_p.h"
28 #include "area.h"
29 #include "debug_p.h"
30 #include "document.h"
31 #include "document_p.h"
32 #include "form.h"
33 #include "form_p.h"
34 #include "observer.h"
35 #include "pagecontroller_p.h"
36 #include "pagesize.h"
37 #include "pagetransition.h"
38 #include "rotationjob_p.h"
39 #include "textpage.h"
40 #include "textpage_p.h"
41 #include "tile.h"
42 #include "tilesmanager_p.h"
43 #include "utils_p.h"
44 
45 #include <limits>
46 
47 #ifdef PAGE_PROFILE
48 #include <QtCore/QTime>
49 #endif
50 
51 using namespace Okular;
52 
53 static const double distanceConsideredEqual = 25; // 5px
54 
55 static void deleteObjectRects( QLinkedList< ObjectRect * >& rects, const QSet<ObjectRect::ObjectType>& which )
56 {
57  QLinkedList< ObjectRect * >::iterator it = rects.begin(), end = rects.end();
58  for ( ; it != end; )
59  if ( which.contains( (*it)->objectType() ) )
60  {
61  delete *it;
62  it = rects.erase( it );
63  }
64  else
65  ++it;
66 }
67 
68 PagePrivate::PagePrivate( Page *page, uint n, double w, double h, Rotation o )
69  : m_page( page ), m_number( n ), m_orientation( o ),
70  m_width( w ), m_height( h ), m_doc( 0 ), m_boundingBox( 0, 0, 1, 1 ),
71  m_rotation( Rotation0 ),
72  m_text( 0 ), m_transition( 0 ), m_textSelections( 0 ),
73  m_openingAction( 0 ), m_closingAction( 0 ), m_duration( -1 ),
74  m_isBoundingBoxKnown( false )
75 {
76  // avoid Division-By-Zero problems in the program
77  if ( m_width <= 0 )
78  m_width = 1;
79 
80  if ( m_height <= 0 )
81  m_height = 1;
82 }
83 
84 PagePrivate::~PagePrivate()
85 {
86  qDeleteAll( formfields );
87  delete m_openingAction;
88  delete m_closingAction;
89  delete m_text;
90  delete m_transition;
91 }
92 
93 
94 void PagePrivate::imageRotationDone( RotationJob * job )
95 {
96  TilesManager *tm = tilesManager( job->observer() );
97  if ( tm )
98  {
99  QPixmap *pixmap = new QPixmap( QPixmap::fromImage( job->image() ) );
100  tm->setPixmap( pixmap, job->rect() );
101  delete pixmap;
102  return;
103  }
104 
105  QMap< DocumentObserver*, PixmapObject >::iterator it = m_pixmaps.find( job->observer() );
106  if ( it != m_pixmaps.end() )
107  {
108  PixmapObject &object = it.value();
109  (*object.m_pixmap) = QPixmap::fromImage( job->image() );
110  object.m_rotation = job->rotation();
111  } else {
112  PixmapObject object;
113  object.m_pixmap = new QPixmap( QPixmap::fromImage( job->image() ) );
114  object.m_rotation = job->rotation();
115 
116  m_pixmaps.insert( job->observer(), object );
117  }
118 }
119 
120 QTransform PagePrivate::rotationMatrix() const
121 {
122  return Okular::buildRotationMatrix( m_rotation );
123 }
124 
127 Page::Page( uint page, double w, double h, Rotation o )
128  : d( new PagePrivate( this, page, w, h, o ) )
129 {
130 }
131 
132 Page::~Page()
133 {
134  deletePixmaps();
135  deleteRects();
136  d->deleteHighlights();
137  deleteAnnotations();
138  d->deleteTextSelections();
139  deleteSourceReferences();
140 
141  delete d;
142 }
143 
144 int Page::number() const
145 {
146  return d->m_number;
147 }
148 
149 Rotation Page::orientation() const
150 {
151  return d->m_orientation;
152 }
153 
154 Rotation Page::rotation() const
155 {
156  return d->m_rotation;
157 }
158 
159 Rotation Page::totalOrientation() const
160 {
161  return (Rotation)( ( (int)d->m_orientation + (int)d->m_rotation ) % 4 );
162 }
163 
164 double Page::width() const
165 {
166  return d->m_width;
167 }
168 
169 double Page::height() const
170 {
171  return d->m_height;
172 }
173 
174 double Page::ratio() const
175 {
176  return d->m_height / d->m_width;
177 }
178 
179 NormalizedRect Page::boundingBox() const
180 {
181  return d->m_boundingBox;
182 }
183 
184 bool Page::isBoundingBoxKnown() const
185 {
186  return d->m_isBoundingBoxKnown;
187 }
188 
189 void Page::setBoundingBox( const NormalizedRect& bbox )
190 {
191  if ( d->m_isBoundingBoxKnown && d->m_boundingBox == bbox )
192  return;
193 
194  // Allow tiny rounding errors (happens during rotation)
195  static const double epsilon = 0.00001;
196  Q_ASSERT( bbox.left >= -epsilon && bbox.top >= -epsilon && bbox.right <= 1 + epsilon && bbox.bottom <= 1 + epsilon );
197 
198  d->m_boundingBox = bbox & NormalizedRect( 0., 0., 1., 1. );
199  d->m_isBoundingBoxKnown = true;
200 }
201 
202 bool Page::hasPixmap( DocumentObserver *observer, int width, int height, const NormalizedRect &rect ) const
203 {
204  TilesManager *tm = d->tilesManager( observer );
205  if ( tm )
206  {
207  if ( width != tm->width() || height != tm->height() )
208  {
209  tm->setSize( width, height );
210  return false;
211  }
212 
213  return tm->hasPixmap( rect );
214  }
215 
216  QMap< DocumentObserver*, PagePrivate::PixmapObject >::const_iterator it = d->m_pixmaps.constFind( observer );
217  if ( it == d->m_pixmaps.constEnd() )
218  return false;
219 
220  if ( width == -1 || height == -1 )
221  return true;
222 
223  const QPixmap *pixmap = it.value().m_pixmap;
224 
225  return (pixmap->width() == width && pixmap->height() == height);
226 }
227 
228 bool Page::hasTextPage() const
229 {
230  return d->m_text != 0;
231 }
232 
233 RegularAreaRect * Page::wordAt( const NormalizedPoint &p, QString *word ) const
234 {
235  if ( d->m_text )
236  return d->m_text->wordAt( p, word );
237 
238  return 0;
239 }
240 
241 RegularAreaRect * Page::textArea ( TextSelection * selection ) const
242 {
243  if ( d->m_text )
244  return d->m_text->textArea( selection );
245 
246  return 0;
247 }
248 
249 bool Page::hasObjectRect( double x, double y, double xScale, double yScale ) const
250 {
251  if ( m_rects.isEmpty() )
252  return false;
253 
254  QLinkedList< ObjectRect * >::const_iterator it = m_rects.begin(), end = m_rects.end();
255  for ( ; it != end; ++it )
256  if ( (*it)->distanceSqr( x, y, xScale, yScale ) < distanceConsideredEqual )
257  return true;
258 
259  return false;
260 }
261 
262 bool Page::hasHighlights( int s_id ) const
263 {
264  // simple case: have no highlights
265  if ( m_highlights.isEmpty() )
266  return false;
267  // simple case: we have highlights and no id to match
268  if ( s_id == -1 )
269  return true;
270  // iterate on the highlights list to find an entry by id
271  QLinkedList< HighlightAreaRect * >::const_iterator it = m_highlights.begin(), end = m_highlights.end();
272  for ( ; it != end; ++it )
273  if ( (*it)->s_id == s_id )
274  return true;
275  return false;
276 }
277 
278 bool Page::hasTransition() const
279 {
280  return d->m_transition != 0;
281 }
282 
283 bool Page::hasAnnotations() const
284 {
285  return !m_annotations.isEmpty();
286 }
287 
288 RegularAreaRect * Page::findText( int id, const QString & text, SearchDirection direction,
289  Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect ) const
290 {
291  RegularAreaRect* rect = 0;
292  if ( text.isEmpty() || !d->m_text )
293  return rect;
294 
295  rect = d->m_text->findText( id, text, direction, caseSensitivity, lastRect );
296  return rect;
297 }
298 
299 QString Page::text( const RegularAreaRect * area ) const
300 {
301  return text( area, TextPage::AnyPixelTextAreaInclusionBehaviour );
302 }
303 
304 QString Page::text( const RegularAreaRect * area, TextPage::TextAreaInclusionBehaviour b ) const
305 {
306  QString ret;
307 
308  if ( !d->m_text )
309  return ret;
310 
311  if ( area )
312  {
313  RegularAreaRect rotatedArea = *area;
314  rotatedArea.transform( d->rotationMatrix().inverted() );
315 
316  ret = d->m_text->text( &rotatedArea, b );
317  }
318  else
319  ret = d->m_text->text( 0, b );
320 
321  return ret;
322 }
323 
324 TextEntity::List Page::words( const RegularAreaRect * area, TextPage::TextAreaInclusionBehaviour b ) const
325 {
326  TextEntity::List ret;
327 
328  if ( !d->m_text )
329  return ret;
330 
331  if ( area )
332  {
333  RegularAreaRect rotatedArea = *area;
334  rotatedArea.transform( d->rotationMatrix().inverted() );
335 
336  ret = d->m_text->words( &rotatedArea, b );
337  }
338  else
339  ret = d->m_text->words( 0, b );
340 
341  for (int i = 0; i < ret.length(); ++i)
342  {
343  const TextEntity * orig = ret[i];
344  ret[i] = new TextEntity( orig->text(), new Okular::NormalizedRect(orig->transformedArea ( d->rotationMatrix() )) );
345  delete orig;
346  }
347 
348  return ret;
349 }
350 
351 void PagePrivate::rotateAt( Rotation orientation )
352 {
353  if ( orientation == m_rotation )
354  return;
355 
356  deleteHighlights();
357  deleteTextSelections();
358 
359  if ( ( (int)m_orientation + (int)m_rotation ) % 2 != ( (int)m_orientation + (int)orientation ) % 2 )
360  qSwap( m_width, m_height );
361 
362  Rotation oldRotation = m_rotation;
363  m_rotation = orientation;
364 
368  QMapIterator< DocumentObserver*, PagePrivate::PixmapObject > it( m_pixmaps );
369  while ( it.hasNext() ) {
370  it.next();
371 
372  const PagePrivate::PixmapObject &object = it.value();
373 
374  RotationJob *job = new RotationJob( object.m_pixmap->toImage(), object.m_rotation, m_rotation, it.key() );
375  job->setPage( this );
376  m_doc->m_pageController->addRotationJob(job);
377  }
378 
382  QMapIterator<const DocumentObserver *, TilesManager *> i(m_tilesManagers);
383  while (i.hasNext()) {
384  i.next();
385 
386  TilesManager *tm = i.value();
387  if ( tm )
388  tm->setRotation( m_rotation );
389  }
390 
394  const QTransform matrix = rotationMatrix();
395  QLinkedList< ObjectRect * >::const_iterator objectIt = m_page->m_rects.begin(), end = m_page->m_rects.end();
396  for ( ; objectIt != end; ++objectIt )
397  (*objectIt)->transform( matrix );
398 
399  QLinkedList< HighlightAreaRect* >::const_iterator hlIt = m_page->m_highlights.begin(), hlItEnd = m_page->m_highlights.end();
400  for ( ; hlIt != hlItEnd; ++hlIt )
401  {
402  (*hlIt)->transform( RotationJob::rotationMatrix( oldRotation, m_rotation ) );
403  }
404 }
405 
406 void PagePrivate::changeSize( const PageSize &size )
407 {
408  if ( size.isNull() || ( size.width() == m_width && size.height() == m_height ) )
409  return;
410 
411  m_page->deletePixmaps();
412 // deleteHighlights();
413 // deleteTextSelections();
414 
415  m_width = size.width();
416  m_height = size.height();
417  if ( m_rotation % 2 )
418  qSwap( m_width, m_height );
419 }
420 
421 const ObjectRect * Page::objectRect( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale ) const
422 {
423  // Walk list in reverse order so that annotations in the foreground are preferred
424  QLinkedListIterator< ObjectRect * > it( m_rects );
425  it.toBack();
426  while ( it.hasPrevious() )
427  {
428  const ObjectRect *objrect = it.previous();
429  if ( ( objrect->objectType() == type ) && objrect->distanceSqr( x, y, xScale, yScale ) < distanceConsideredEqual )
430  return objrect;
431  }
432 
433  return 0;
434 }
435 
436 QLinkedList< const ObjectRect * > Page::objectRects( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale ) const
437 {
438  QLinkedList< const ObjectRect * > result;
439 
440  QLinkedListIterator< ObjectRect * > it( m_rects );
441  it.toBack();
442  while ( it.hasPrevious() )
443  {
444  const ObjectRect *objrect = it.previous();
445  if ( ( objrect->objectType() == type ) && objrect->distanceSqr( x, y, xScale, yScale ) < distanceConsideredEqual )
446  result.append( objrect );
447  }
448 
449  return result;
450 }
451 
452 
453 const ObjectRect* Page::nearestObjectRect( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale, double * distance ) const
454 {
455  ObjectRect * res = 0;
456  double minDistance = std::numeric_limits<double>::max();
457 
458  QLinkedList< ObjectRect * >::const_iterator it = m_rects.constBegin(), end = m_rects.constEnd();
459  for ( ; it != end; ++it )
460  {
461  if ( (*it)->objectType() == type )
462  {
463  double d = (*it)->distanceSqr( x, y, xScale, yScale );
464  if ( d < minDistance )
465  {
466  res = (*it);
467  minDistance = d;
468  }
469  }
470  }
471 
472  if ( distance )
473  *distance = minDistance;
474  return res;
475 }
476 
477 const PageTransition * Page::transition() const
478 {
479  return d->m_transition;
480 }
481 
482 QLinkedList< Annotation* > Page::annotations() const
483 {
484  return m_annotations;
485 }
486 
487 const Action * Page::pageAction( PageAction action ) const
488 {
489  switch ( action )
490  {
491  case Page::Opening:
492  return d->m_openingAction;
493  break;
494  case Page::Closing:
495  return d->m_closingAction;
496  break;
497  }
498 
499  return 0;
500 }
501 
502 QLinkedList< FormField * > Page::formFields() const
503 {
504  return d->formfields;
505 }
506 
507 void Page::setPixmap( DocumentObserver *observer, QPixmap *pixmap, const NormalizedRect &rect )
508 {
509  if ( d->m_rotation == Rotation0 ) {
510  TilesManager *tm = d->tilesManager( observer );
511  if ( tm )
512  {
513  tm->setPixmap( pixmap, rect );
514  delete pixmap;
515  return;
516  }
517 
518  QMap< DocumentObserver*, PagePrivate::PixmapObject >::iterator it = d->m_pixmaps.find( observer );
519  if ( it != d->m_pixmaps.end() )
520  {
521  delete it.value().m_pixmap;
522  }
523  else
524  {
525  it = d->m_pixmaps.insert( observer, PagePrivate::PixmapObject() );
526  }
527  it.value().m_pixmap = pixmap;
528  it.value().m_rotation = d->m_rotation;
529  } else {
530  RotationJob *job = new RotationJob( pixmap->toImage(), Rotation0, d->m_rotation, observer );
531  job->setPage( d );
532  job->setRect( TilesManager::toRotatedRect( rect, d->m_rotation ) );
533  d->m_doc->m_pageController->addRotationJob(job);
534 
535  delete pixmap;
536  }
537 }
538 
539 void Page::setTextPage( TextPage * textPage )
540 {
541  delete d->m_text;
542 
543  d->m_text = textPage;
544  if ( d->m_text )
545  {
546  d->m_text->d->m_page = d;
550  d->m_text->d->correctTextOrder();
551  }
552 }
553 
554 void Page::setObjectRects( const QLinkedList< ObjectRect * > & rects )
555 {
556  QSet<ObjectRect::ObjectType> which;
557  which << ObjectRect::Action << ObjectRect::Image;
558  deleteObjectRects( m_rects, which );
559 
563  const QTransform matrix = d->rotationMatrix();
564 
565  QLinkedList< ObjectRect * >::const_iterator objectIt = rects.begin(), end = rects.end();
566  for ( ; objectIt != end; ++objectIt )
567  (*objectIt)->transform( matrix );
568 
569  m_rects << rects;
570 }
571 
572 void PagePrivate::setHighlight( int s_id, RegularAreaRect *rect, const QColor & color )
573 {
574  HighlightAreaRect * hr = new HighlightAreaRect(rect);
575  hr->s_id = s_id;
576  hr->color = color;
577 
578  m_page->m_highlights.append( hr );
579 }
580 
581 void PagePrivate::setTextSelections( RegularAreaRect *r, const QColor & color )
582 {
583  deleteTextSelections();
584  if ( r )
585  {
586  HighlightAreaRect * hr = new HighlightAreaRect( r );
587  hr->s_id = -1;
588  hr->color = color;
589  m_textSelections = hr;
590  delete r;
591  }
592 }
593 
594 void Page::setSourceReferences( const QLinkedList< SourceRefObjectRect * > & refRects )
595 {
596  deleteSourceReferences();
597  foreach( SourceRefObjectRect * rect, refRects )
598  m_rects << rect;
599 }
600 
601 void Page::setDuration( double seconds )
602 {
603  d->m_duration = seconds;
604 }
605 
606 double Page::duration() const
607 {
608  return d->m_duration;
609 }
610 
611 void Page::setLabel( const QString& label )
612 {
613  d->m_label = label;
614 }
615 
616 QString Page::label() const
617 {
618  return d->m_label;
619 }
620 
621 const RegularAreaRect * Page::textSelection() const
622 {
623  return d->m_textSelections;
624 }
625 
626 QColor Page::textSelectionColor() const
627 {
628  return d->m_textSelections ? d->m_textSelections->color : QColor();
629 }
630 
631 void Page::addAnnotation( Annotation * annotation )
632 {
633  // Generate uniqueName: okular-{UUID}
634  if(annotation->uniqueName().isEmpty())
635  {
636  QString uniqueName = "okular-" + QUuid::createUuid().toString();
637  annotation->setUniqueName( uniqueName );
638  }
639  annotation->d_ptr->m_page = d;
640  m_annotations.append( annotation );
641 
642  AnnotationObjectRect *rect = new AnnotationObjectRect( annotation );
643 
644  // Rotate the annotation on the page.
645  const QTransform matrix = d->rotationMatrix();
646  annotation->d_ptr->annotationTransform( matrix );
647 
648  m_rects.append( rect );
649 }
650 
651 bool Page::removeAnnotation( Annotation * annotation )
652 {
653  if ( !d->m_doc->m_parent->canRemovePageAnnotation(annotation) )
654  return false;
655 
656  QLinkedList< Annotation * >::iterator aIt = m_annotations.begin(), aEnd = m_annotations.end();
657  for ( ; aIt != aEnd; ++aIt )
658  {
659  if((*aIt) && (*aIt)->uniqueName()==annotation->uniqueName())
660  {
661  int rectfound = false;
662  QLinkedList< ObjectRect * >::iterator it = m_rects.begin(), end = m_rects.end();
663  for ( ; it != end && !rectfound; ++it )
664  if ( ( (*it)->objectType() == ObjectRect::OAnnotation ) && ( (*it)->object() == (*aIt) ) )
665  {
666  delete *it;
667  it = m_rects.erase( it );
668  rectfound = true;
669  }
670  kDebug(OkularDebug) << "removed annotation:" << annotation->uniqueName();
671  annotation->d_ptr->m_page = 0;
672  m_annotations.erase( aIt );
673  break;
674  }
675  }
676 
677  return true;
678 }
679 
680 void Page::setTransition( PageTransition * transition )
681 {
682  delete d->m_transition;
683  d->m_transition = transition;
684 }
685 
686 void Page::setPageAction( PageAction action, Action * link )
687 {
688  switch ( action )
689  {
690  case Page::Opening:
691  delete d->m_openingAction;
692  d->m_openingAction = link;
693  break;
694  case Page::Closing:
695  delete d->m_closingAction;
696  d->m_closingAction = link;
697  break;
698  }
699 }
700 
701 void Page::setFormFields( const QLinkedList< FormField * >& fields )
702 {
703  qDeleteAll( d->formfields );
704  d->formfields = fields;
705  QLinkedList< FormField * >::const_iterator it = d->formfields.begin(), itEnd = d->formfields.end();
706  for ( ; it != itEnd; ++it )
707  {
708  (*it)->d_ptr->setDefault();
709  }
710 }
711 
712 void Page::deletePixmap( DocumentObserver *observer )
713 {
714  TilesManager *tm = d->tilesManager( observer );
715  if ( tm )
716  {
717  delete tm;
718  d->m_tilesManagers.remove(observer);
719  }
720  else
721  {
722  PagePrivate::PixmapObject object = d->m_pixmaps.take( observer );
723  delete object.m_pixmap;
724  }
725 }
726 
727 void Page::deletePixmaps()
728 {
729  QMapIterator< DocumentObserver*, PagePrivate::PixmapObject > it( d->m_pixmaps );
730  while ( it.hasNext() ) {
731  it.next();
732  delete it.value().m_pixmap;
733  }
734 
735  d->m_pixmaps.clear();
736 
737  qDeleteAll(d->m_tilesManagers);
738  d->m_tilesManagers.clear();
739 }
740 
741 void Page::deleteRects()
742 {
743  // delete ObjectRects of type Link and Image
744  QSet<ObjectRect::ObjectType> which;
745  which << ObjectRect::Action << ObjectRect::Image;
746  deleteObjectRects( m_rects, which );
747 }
748 
749 void PagePrivate::deleteHighlights( int s_id )
750 {
751  // delete highlights by ID
752  QLinkedList< HighlightAreaRect* >::iterator it = m_page->m_highlights.begin(), end = m_page->m_highlights.end();
753  while ( it != end )
754  {
755  HighlightAreaRect* highlight = *it;
756  if ( s_id == -1 || highlight->s_id == s_id )
757  {
758  it = m_page->m_highlights.erase( it );
759  delete highlight;
760  }
761  else
762  ++it;
763  }
764 }
765 
766 void PagePrivate::deleteTextSelections()
767 {
768  delete m_textSelections;
769  m_textSelections = 0;
770 }
771 
772 void Page::deleteSourceReferences()
773 {
774  deleteObjectRects( m_rects, QSet<ObjectRect::ObjectType>() << ObjectRect::SourceRef );
775 }
776 
777 void Page::deleteAnnotations()
778 {
779  // delete ObjectRects of type Annotation
780  deleteObjectRects( m_rects, QSet<ObjectRect::ObjectType>() << ObjectRect::OAnnotation );
781  // delete all stored annotations
782  QLinkedList< Annotation * >::const_iterator aIt = m_annotations.begin(), aEnd = m_annotations.end();
783  for ( ; aIt != aEnd; ++aIt )
784  delete *aIt;
785  m_annotations.clear();
786 }
787 
788 void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
789 {
790  // iterate over all chilren (annotationList, ...)
791  QDomNode childNode = pageNode.firstChild();
792  while ( childNode.isElement() )
793  {
794  QDomElement childElement = childNode.toElement();
795  childNode = childNode.nextSibling();
796 
797  // parse annotationList child element
798  if ( childElement.tagName() == "annotationList" )
799  {
800 #ifdef PAGE_PROFILE
801  QTime time;
802  time.start();
803 #endif
804  // Clone annotationList as root node in restoredLocalAnnotationList
805  const QDomNode clonedNode = restoredLocalAnnotationList.importNode( childElement, true );
806  restoredLocalAnnotationList.appendChild( clonedNode );
807 
808  // iterate over all annotations
809  QDomNode annotationNode = childElement.firstChild();
810  while( annotationNode.isElement() )
811  {
812  // get annotation element and advance to next annot
813  QDomElement annotElement = annotationNode.toElement();
814  annotationNode = annotationNode.nextSibling();
815 
816  // get annotation from the dom element
817  Annotation * annotation = AnnotationUtils::createAnnotation( annotElement );
818 
819  // append annotation to the list or show warning
820  if ( annotation )
821  {
822  m_doc->performAddPageAnnotation(m_number, annotation);
823  kDebug(OkularDebug) << "restored annot:" << annotation->uniqueName();
824  }
825  else
826  kWarning(OkularDebug).nospace() << "page (" << m_number << "): can't restore an annotation from XML.";
827  }
828 #ifdef PAGE_PROFILE
829  kDebug(OkularDebug).nospace() << "annots: XML Load time: " << time.elapsed() << "ms";
830 #endif
831  }
832  // parse formList child element
833  else if ( childElement.tagName() == "forms" )
834  {
835  if ( formfields.isEmpty() )
836  continue;
837 
838  QHash<int, FormField*> hashedforms;
839  QLinkedList< FormField * >::const_iterator fIt = formfields.begin(), fItEnd = formfields.end();
840  for ( ; fIt != fItEnd; ++fIt )
841  {
842  hashedforms[(*fIt)->id()] = (*fIt);
843  }
844 
845  // iterate over all forms
846  QDomNode formsNode = childElement.firstChild();
847  while( formsNode.isElement() )
848  {
849  // get annotation element and advance to next annot
850  QDomElement formElement = formsNode.toElement();
851  formsNode = formsNode.nextSibling();
852 
853  if ( formElement.tagName() != "form" )
854  continue;
855 
856  bool ok = true;
857  int index = formElement.attribute( "id" ).toInt( &ok );
858  if ( !ok )
859  continue;
860 
861  QHash<int, FormField*>::const_iterator wantedIt = hashedforms.constFind( index );
862  if ( wantedIt == hashedforms.constEnd() )
863  continue;
864 
865  QString value = formElement.attribute( "value" );
866  (*wantedIt)->d_ptr->setValue( value );
867  }
868  }
869  }
870 }
871 
872 void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & document, PageItems what ) const
873 {
874  // create the page node and set the 'number' attribute
875  QDomElement pageElement = document.createElement( "page" );
876  pageElement.setAttribute( "number", m_number );
877 
878 #if 0
879  // add bookmark info if is bookmarked
880  if ( d->m_bookmarked )
881  {
882  // create the pageElement's 'bookmark' child
883  QDomElement bookmarkElement = document.createElement( "bookmark" );
884  pageElement.appendChild( bookmarkElement );
885 
886  // add attributes to the element
887  //bookmarkElement.setAttribute( "name", bookmark name );
888  }
889 #endif
890 
891  // add annotations info if has got any
892  if ( ( what & AnnotationPageItems ) && ( what & OriginalAnnotationPageItems ) )
893  {
894  const QDomElement savedDocRoot = restoredLocalAnnotationList.documentElement();
895  if ( !savedDocRoot.isNull() )
896  {
897  // Import and append node in target document
898  const QDomNode importedNode = document.importNode( savedDocRoot, true );
899  pageElement.appendChild( importedNode );
900  }
901  }
902  else if ( ( what & AnnotationPageItems ) && !m_page->m_annotations.isEmpty() )
903  {
904  // create the annotationList
905  QDomElement annotListElement = document.createElement( "annotationList" );
906 
907  // add every annotation to the annotationList
908  QLinkedList< Annotation * >::const_iterator aIt = m_page->m_annotations.constBegin(), aEnd = m_page->m_annotations.constEnd();
909  for ( ; aIt != aEnd; ++aIt )
910  {
911  // get annotation
912  const Annotation * a = *aIt;
913  // only save okular annotations (not the embedded in file ones)
914  if ( !(a->flags() & Annotation::External) )
915  {
916  // append an filled-up element called 'annotation' to the list
917  QDomElement annElement = document.createElement( "annotation" );
918  AnnotationUtils::storeAnnotation( a, annElement, document );
919  annotListElement.appendChild( annElement );
920  kDebug(OkularDebug) << "save annotation:" << a->uniqueName();
921  }
922  }
923 
924  // append the annotationList element if annotations have been set
925  if ( annotListElement.hasChildNodes() )
926  pageElement.appendChild( annotListElement );
927  }
928 
929  // add forms info if has got any
930  if ( ( what & FormFieldPageItems ) && !formfields.isEmpty() )
931  {
932  // create the formList
933  QDomElement formListElement = document.createElement( "forms" );
934 
935  // add every form data to the formList
936  QLinkedList< FormField * >::const_iterator fIt = formfields.constBegin(), fItEnd = formfields.constEnd();
937  for ( ; fIt != fItEnd; ++fIt )
938  {
939  // get the form field
940  const FormField * f = *fIt;
941 
942  QString newvalue = f->d_ptr->value();
943  if ( f->d_ptr->m_default == newvalue )
944  continue;
945 
946  // append an filled-up element called 'annotation' to the list
947  QDomElement formElement = document.createElement( "form" );
948  formElement.setAttribute( "id", f->id() );
949  formElement.setAttribute( "value", newvalue );
950  formListElement.appendChild( formElement );
951  }
952 
953  // append the annotationList element if annotations have been set
954  if ( formListElement.hasChildNodes() )
955  pageElement.appendChild( formListElement );
956  }
957 
958  // append the page element only if has children
959  if ( pageElement.hasChildNodes() )
960  parentNode.appendChild( pageElement );
961 }
962 
963 const QPixmap * Page::_o_nearestPixmap( DocumentObserver *observer, int w, int h ) const
964 {
965  Q_UNUSED( h )
966 
967  const QPixmap * pixmap = 0;
968 
969  // if a pixmap is present for given id, use it
970  QMap< DocumentObserver*, PagePrivate::PixmapObject >::const_iterator itPixmap = d->m_pixmaps.constFind( observer );
971  if ( itPixmap != d->m_pixmaps.constEnd() )
972  pixmap = itPixmap.value().m_pixmap;
973  // else find the closest match using pixmaps of other IDs (great optim!)
974  else if ( !d->m_pixmaps.isEmpty() )
975  {
976  int minDistance = -1;
977  QMap< DocumentObserver*, PagePrivate::PixmapObject >::const_iterator it = d->m_pixmaps.constBegin(), end = d->m_pixmaps.constEnd();
978  for ( ; it != end; ++it )
979  {
980  int pixWidth = (*it).m_pixmap->width(),
981  distance = pixWidth > w ? pixWidth - w : w - pixWidth;
982  if ( minDistance == -1 || distance < minDistance )
983  {
984  pixmap = (*it).m_pixmap;
985  minDistance = distance;
986  }
987  }
988  }
989 
990  return pixmap;
991 }
992 
993 bool Page::hasTilesManager( const DocumentObserver *observer ) const
994 {
995  return d->tilesManager( observer ) != 0;
996 }
997 
998 QList<Tile> Page::tilesAt( const DocumentObserver *observer, const NormalizedRect &rect ) const
999 {
1000  TilesManager *tm = d->m_tilesManagers.value( observer );
1001  if ( tm )
1002  return tm->tilesAt( rect, TilesManager::PixmapTile );
1003  else
1004  return QList<Tile>();
1005 }
1006 
1007 TilesManager *PagePrivate::tilesManager( const DocumentObserver *observer ) const
1008 {
1009  return m_tilesManagers.value( observer );
1010 }
1011 
1012 void PagePrivate::setTilesManager( const DocumentObserver *observer, TilesManager *tm )
1013 {
1014  TilesManager *old = m_tilesManagers.value( observer );
1015  delete old;
1016 
1017  m_tilesManagers.insert(observer, tm);
1018 }
Okular::FormFieldPageItems
Definition: page_p.h:46
Okular::SearchDirection
SearchDirection
Describes the direction of searching.
Definition: global.h:33
Okular::PagePrivate::PixmapObject::m_pixmap
QPixmap * m_pixmap
Definition: page_p.h:120
Okular::PagePrivate::m_duration
double m_duration
Definition: page_p.h:140
Okular::TilesManager::setRotation
void setRotation(Rotation rotation)
Inform the new rotation of the page.
Definition: tilesmanager.cpp:157
Okular::NormalizedPoint
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition: area.h:47
Okular::Annotation::setUniqueName
void setUniqueName(const QString &name)
Sets the unique name of the annotation.
Definition: annotations.cpp:551
QTransform
Okular::ObjectRect::OAnnotation
An annotation.
Definition: area.h:347
Okular::PagePrivate::deleteHighlights
void deleteHighlights(int id=-1)
Deletes all highlight objects for the observer with the given id.
Definition: page.cpp:749
Okular::PagePrivate::m_label
QString m_label
Definition: page_p.h:141
Okular::Rotation
Rotation
A rotation.
Definition: global.h:44
Okular::FormField::id
virtual int id() const =0
The ID of the field.
QLinkedList::erase
iterator erase(iterator pos)
Okular::TilesManager::height
int height() const
Gets the height of the page in tiles manager.
Definition: tilesmanager.cpp:152
Okular::PagePrivate::PagePrivate
PagePrivate(Page *page, uint n, double w, double h, Rotation o)
Definition: page.cpp:68
Okular::PagePrivate
Definition: page_p.h:55
pagecontroller_p.h
Okular::RotationJob::rotationMatrix
static QTransform rotationMatrix(Rotation from, Rotation to)
Definition: rotationjob.cpp:69
Okular::DocumentPrivate::performAddPageAnnotation
void performAddPageAnnotation(int page, Annotation *annotation)
Definition: document.cpp:1058
QPixmap::width
int width() const
tilesmanager_p.h
Okular::TextPage
The TextPage class represents the text of a page by providing.
Definition: textpage.h:90
Okular::Page::rotation
Rotation rotation() const
Returns the rotation of the page as defined by the user.
Definition: page.cpp:154
QDomNode::appendChild
QDomNode appendChild(const QDomNode &newChild)
Okular::PagePrivate::m_transition
PageTransition * m_transition
Definition: page_p.h:135
Okular::TextPagePrivate::m_page
PagePrivate * m_page
Definition: textpage_p.h:71
Okular::PagePrivate::m_page
Page * m_page
Definition: page_p.h:126
Okular::TextPagePrivate::correctTextOrder
void correctTextOrder()
Make necessary modifications in the TextList to make the text order correct, so that textselection wo...
Definition: textpage.cpp:1876
Okular::Page::textArea
RegularAreaRect * textArea(TextSelection *selection) const
Returns the rectangular area of the given selection.
Definition: page.cpp:241
QDomElement::attribute
QString attribute(const QString &name, const QString &defValue) const
QList::length
int length() const
Okular::SourceRefObjectRect
This class describes the object rectangle for a source reference.
Definition: area.h:474
Okular::TextEntity::text
QString text() const
Returns the text of the text entity.
Definition: textpage.cpp:198
Okular::Page::hasPixmap
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
Okular::PagePrivate::formfields
QLinkedList< FormField * > formfields
Definition: page_p.h:137
Okular::PagePrivate::setHighlight
void setHighlight(int id, RegularAreaRect *area, const QColor &color)
Sets the color and area of the highlight for the observer with the given id.
Definition: page.cpp:572
Okular::Page::totalOrientation
Rotation totalOrientation() const
Returns the total orientation which is the original orientation plus the user defined rotation...
Definition: page.cpp:159
QLinkedList::begin
iterator begin()
Okular::Page::nearestObjectRect
const ObjectRect * nearestObjectRect(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale, double *distance) const
Returns the object rect of the given type which is nearest to the point (x, y) at scale (xScale...
Definition: page.cpp:453
QDomNode::isElement
bool isElement() const
Okular::Page::textSelectionColor
QColor textSelectionColor() const
Returns the color of the current text selection, or an invalid color if no text selection has been se...
Definition: page.cpp:626
Okular::Page::deletePixmap
void deletePixmap(DocumentObserver *observer)
Deletes the pixmap for the given observer.
Definition: page.cpp:712
QMap
Okular::Page::number
int number() const
Returns the number of the page in the document.
Definition: page.cpp:144
Okular::Page::setFormFields
void setFormFields(const QLinkedList< FormField * > &fields)
Sets fields as list of FormField of the page.
Definition: page.cpp:701
Okular::RotationJob::setPage
void setPage(PagePrivate *pd)
Definition: rotationjob.cpp:22
Okular::NormalizedRect::left
double left
The normalized left coordinate.
Definition: area.h:305
Okular::Page::isBoundingBoxKnown
bool isBoundingBoxKnown() const
Returns whether the bounding box of the page has been computed.
Definition: page.cpp:184
Okular::NormalizedRect
NormalizedRect is a helper class which stores the coordinates of a normalized rect, which is a rectangle of.
Definition: area.h:105
QLinkedListIterator::toBack
void toBack()
debug_p.h
area.h
QPixmap::fromImage
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
Okular::RegularAreaRect
Definition: area.h:860
annotations_p.h
Okular::Page::ratio
double ratio() const
Returns the ration (height / width) of the page.
Definition: page.cpp:174
QHash::constFind
const_iterator constFind(const Key &key) const
Okular::ObjectRect::objectType
ObjectType objectType() const
Returns the object type of the object rectangle.
Definition: area.cpp:346
Okular::ObjectRect::Image
An image.
Definition: area.h:346
Okular::Page::words
TextEntity::List words(const RegularAreaRect *rect, TextPage::TextAreaInclusionBehaviour b) const
Returns the page text (or part of it) including the bounding rectangles.
Definition: page.cpp:324
QDomDocument::documentElement
QDomElement documentElement() const
QDomNode
page_p.h
Okular::Page::setLabel
void setLabel(const QString &label)
Sets the labels for the page to label .
Definition: page.cpp:611
Okular::Page::deleteSourceReferences
void deleteSourceReferences()
Deletes all source reference objects of the page.
Definition: page.cpp:772
QLinkedListIterator::hasPrevious
bool hasPrevious() const
Okular::PagePrivate::m_height
double m_height
Definition: page_p.h:129
Okular::RotationJob::setRect
void setRect(const NormalizedRect &rect)
Definition: rotationjob.cpp:27
Okular::Page::hasTextPage
bool hasTextPage() const
Returns whether the page provides a text page (TextPage).
Definition: page.cpp:228
Okular::Rotation0
Not rotated.
Definition: global.h:46
QTime
QLinkedList::end
iterator end()
page.h
QTransform::inverted
QTransform inverted(bool *invertible) const
Okular::Page::hasAnnotations
bool hasAnnotations() const
Returns whether the page provides annotations.
Definition: page.cpp:283
observer.h
QDomNode::nextSibling
QDomNode nextSibling() const
QDomDocument::importNode
QDomNode importNode(const QDomNode &importedNode, bool deep)
pagesize.h
Okular::PagePrivate::m_rotation
Rotation m_rotation
Definition: page_p.h:132
QDomNode::toElement
QDomElement toElement() const
Okular::TextEntity
Abstract textentity of Okular.
Definition: textpage.h:44
Okular::AnnotationObjectRect
This class describes the object rectangle for an annotation.
Definition: area.h:431
Okular::TextEntity::transformedArea
NormalizedRect transformedArea(const QTransform &matrix) const
Returns the transformed area of the text entity.
Definition: textpage.cpp:208
QLinkedList
Okular::Page::height
double height() const
Returns the height of the page.
Definition: page.cpp:169
Okular::PageController::addRotationJob
void addRotationJob(RotationJob *job)
Definition: pagecontroller.cpp:31
Okular::NormalizedRect::right
double right
The normalized right coordinate.
Definition: area.h:315
Okular::PagePrivate::m_text
TextPage * m_text
Definition: page_p.h:134
Okular::PagePrivate::restoredLocalAnnotationList
QDomDocument restoredLocalAnnotationList
Definition: page_p.h:144
Okular::Page::objectRect
const ObjectRect * objectRect(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale) const
Returns the object rect of the given type which is at point (x, y) at scale (xScale, yScale).
Definition: page.cpp:421
QTime::elapsed
int elapsed() const
Okular::Page::hasObjectRect
bool hasObjectRect(double x, double y, double xScale, double yScale) const
Returns whether the page has an object rect which includes the point (x, y) at scale (xScale...
Definition: page.cpp:249
Okular::RotationJob::rect
NormalizedRect rect() const
Definition: rotationjob.cpp:52
Okular::PagePrivate::m_openingAction
Action * m_openingAction
Definition: page_p.h:138
Okular::PagePrivate::restoreLocalContents
void restoreLocalContents(const QDomNode &pageNode)
Loads the local contents (e.g.
Definition: page.cpp:788
Okular::Page::pageAction
const Action * pageAction(PageAction action) const
Returns the Action object which is associated with the given page action or 0 if no page action is se...
Definition: page.cpp:487
Okular::PagePrivate::m_isBoundingBoxKnown
bool m_isBoundingBoxKnown
Definition: page_p.h:143
QMapIterator
Okular::HighlightAreaRect::color
QColor color
The color of the highlight.
Definition: area.h:895
Okular::TilesManager::tilesAt
QList< Tile > tilesAt(const NormalizedRect &rect, TileLeaf tileLeaf)
Returns a list of all tiles intersecting with rect.
Definition: tilesmanager.cpp:358
QHash::constEnd
const_iterator constEnd() const
Okular::TextPage::words
TextEntity::List words(const RegularAreaRect *rect, TextAreaInclusionBehaviour b) const
Text entity extraction function.
Definition: textpage.cpp:1920
Okular::Page::setObjectRects
void setObjectRects(const QLinkedList< ObjectRect * > &rects)
Sets the list of object rects of the page.
Definition: page.cpp:554
Okular::PageSize::height
double height() const
Returns the height of the page size.
Definition: pagesize.cpp:66
Okular::Page::setBoundingBox
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
QHash
distanceConsideredEqual
static const double distanceConsideredEqual
Definition: page.cpp:53
Okular::ObjectRect
NormalizedRect that contains a reference to an object.
Definition: area.h:337
QMapIterator::next
Item next()
Okular::TilesManager
Tiles management.
Definition: tilesmanager_p.h:98
QDomElement::setAttribute
void setAttribute(const QString &name, const QString &value)
Okular::Page::PageAction
PageAction
An action to be executed when particular events happen.
Definition: page.h:55
Okular::HighlightAreaRect::s_id
int s_id
The search ID of the highlight owner.
Definition: area.h:890
action.h
annotations.h
QString::toInt
int toInt(bool *ok, int base) const
Okular::Annotation::External
Is stored external.
Definition: annotations.h:134
QString::isEmpty
bool isEmpty() const
Okular::Annotation::flags
int flags() const
Returns the flags of the annotation.
Definition: annotations.cpp:593
Okular::RotationJob::image
QImage image() const
Definition: rotationjob.cpp:32
OkularDebug
#define OkularDebug
Definition: debug_p.h:13
Okular::TilesManager::PixmapTile
Return only tiles with pixmap.
Definition: tilesmanager_p.h:104
Okular::PagePrivate::m_pixmaps
QMap< DocumentObserver *, PixmapObject > m_pixmaps
Definition: page_p.h:123
Okular::Page::boundingBox
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
Okular::Page::text
QString text(const RegularAreaRect *rect=0) const
Returns the page text (or part of it).
Definition: page.cpp:299
Okular::Page::wordAt
RegularAreaRect * wordAt(const NormalizedPoint &p, QString *word=0) const
Returns the area and text of the word at the given point Note that ownership of the returned area bel...
Definition: page.cpp:233
Okular::PagePrivate::m_tilesManagers
QMap< const DocumentObserver *, TilesManager * > m_tilesManagers
Definition: page_p.h:124
Okular::AnnotationUtils::storeAnnotation
static void storeAnnotation(const Annotation *annotation, QDomElement &element, QDomDocument &document)
Saves the annotation as a child of element taking care of saving all revisions if it has any...
Definition: annotations.cpp:128
QMap::const_iterator
Okular::Page::Closing
An action to be executed when the page is "closed".
Definition: page.h:58
Okular::RotationJob::rotation
Rotation rotation() const
Definition: rotationjob.cpp:37
QLinkedListIterator
Okular::Page
Collector for all the data belonging to a page.
Definition: page.h:49
Okular::Page::width
double width() const
Returns the width of the page.
Definition: page.cpp:164
form.h
Okular::PagePrivate::rotationMatrix
QTransform rotationMatrix() const
Definition: page.cpp:120
document.h
Okular::Page::setPixmap
void setPixmap(DocumentObserver *observer, QPixmap *pixmap, const NormalizedRect &rect=NormalizedRect())
Sets the region described by rect with pixmap for the given observer.
Definition: page.cpp:507
QSet
Okular::Page::~Page
~Page()
Destroys the page.
Definition: page.cpp:132
tile.h
QString
Okular::PagePrivate::m_doc
DocumentPrivate * m_doc
Definition: page_p.h:130
QList
QColor
Okular::PagePrivate::m_textSelections
HighlightAreaRect * m_textSelections
Definition: page_p.h:136
textpage.h
Okular::Page::findText
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
QMapIterator::key
const Key & key() const
Okular::Page::removeAnnotation
bool removeAnnotation(Annotation *annotation)
Removes the annotation from the page.
Definition: page.cpp:651
QMapIterator::value
const T & value() const
deleteObjectRects
static void deleteObjectRects(QLinkedList< ObjectRect * > &rects, const QSet< ObjectRect::ObjectType > &which)
Definition: page.cpp:55
Okular::PagePrivate::m_number
int m_number
Definition: page_p.h:127
QDomNode::hasChildNodes
bool hasChildNodes() const
Okular::Page::setDuration
void setDuration(double seconds)
Sets the duration of the page to seconds when displayed in presentation mode.
Definition: page.cpp:601
pagetransition.h
Okular::PagePrivate::setTextSelections
void setTextSelections(RegularAreaRect *areas, const QColor &color)
Sets the color and areas of text selections.
Definition: page.cpp:581
QPixmap
Okular::Page::annotations
QLinkedList< Annotation * > annotations() const
Returns the list of annotations of the page.
Definition: page.cpp:482
Okular::PageSize::width
double width() const
Returns the width of the page size.
Definition: pagesize.cpp:58
Okular::ObjectRect::Action
An action.
Definition: area.h:345
QLinkedList::const_iterator
Okular::PagePrivate::setTilesManager
void setTilesManager(const DocumentObserver *observer, TilesManager *tm)
Set the tiles manager for the tiled .
Definition: page.cpp:1012
Okular::RegularArea::transform
void transform(const QTransform &matrix)
Transforms the regular area with the operations defined by matrix.
Definition: area.h:848
QPixmap::height
int height() const
Okular::TilesManager::toRotatedRect
static NormalizedRect toRotatedRect(const NormalizedRect &rect, Rotation rotation)
Returns a rotated NormalizedRect given a rotation.
Definition: tilesmanager.cpp:606
Okular::TilesManager::width
int width() const
Gets the width of the page in tiles manager.
Definition: tilesmanager.cpp:147
QDomDocument
Okular::NormalizedRect::top
double top
The normalized top coordinate.
Definition: area.h:310
Okular::Action
Encapsulates data that describes an action.
Definition: action.h:43
QSet::contains
bool contains(const T &value) const
QDomNode::isNull
bool isNull() const
Okular::PagePrivate::saveLocalContents
void saveLocalContents(QDomNode &parentNode, QDomDocument &document, PageItems what=AllPageItems) const
Saves the local contents (e.g.
Definition: page.cpp:872
Okular::PagePrivate::~PagePrivate
~PagePrivate()
Definition: page.cpp:84
Okular::PagePrivate::m_width
double m_width
Definition: page_p.h:129
QHash::const_iterator
Okular::Document::canRemovePageAnnotation
bool canRemovePageAnnotation(const Annotation *annotation) const
Tests if the annotation can be removed.
Definition: document.cpp:3051
Okular::ObjectRect::ObjectType
ObjectType
Describes the type of storable object.
Definition: area.h:343
Okular::TextPage::text
QString text(const RegularAreaRect *rect=0) const
Text extraction function.
Definition: textpage.cpp:1068
Okular::Page::deletePixmaps
void deletePixmaps()
Deletes all pixmaps of the page.
Definition: page.cpp:727
Okular::PageSize::isNull
bool isNull() const
Whether the page size is null.
Definition: pagesize.cpp:82
Okular::TilesManager::setSize
void setSize(int width, int height)
Inform the new size of the page and mark all tiles to repaint.
Definition: tilesmanager.cpp:136
Okular::Page::Opening
An action to be executed when the page is "opened".
Definition: page.h:57
Okular::AnnotationUtils::createAnnotation
static Annotation * createAnnotation(const QDomElement &element)
Restore an annotation (with revisions if needed) from the dom element.
Definition: annotations.cpp:90
Okular::PagePrivate::changeSize
void changeSize(const PageSize &size)
Changes the size of the page to the given size.
Definition: page.cpp:406
Okular::TextPage::textArea
RegularAreaRect * textArea(TextSelection *selection) const
Returns the rectangular area of the given selection.
Definition: textpage.cpp:331
Okular::TextPage::wordAt
RegularAreaRect * wordAt(const NormalizedPoint &p, QString *word=0) const
Returns the area and text of the word at the given point Note that ownership of the returned area bel...
Definition: textpage.cpp:1957
Okular::Page::duration
double duration() const
Returns the duration in seconds of the page when displayed in presentation mode.
Definition: page.cpp:606
Okular::buildRotationMatrix
QTransform buildRotationMatrix(Rotation rotation)
Return a rotation matrix corresponding to the rotation enumeration.
Definition: utils.cpp:380
document_p.h
QDomNode::firstChild
QDomNode firstChild() const
textpage_p.h
Okular::PagePrivate::imageRotationDone
void imageRotationDone(RotationJob *job)
Definition: page.cpp:94
Okular::TextPage::AnyPixelTextAreaInclusionBehaviour
A character is included into text() result if any pixel of his bounding box is in the given area...
Definition: textpage.h:104
Okular::PagePrivate::m_boundingBox
NormalizedRect m_boundingBox
Definition: page_p.h:131
Okular::ObjectRect::SourceRef
A source reference.
Definition: area.h:348
Okular::TextPage::TextAreaInclusionBehaviour
TextAreaInclusionBehaviour
Defines the behaviour of adding characters to text() result.
Definition: textpage.h:102
Okular::ObjectRect::distanceSqr
double distanceSqr(double x, double y, double xScale, double yScale) const
Returns the square of the distance between the object and the point x, y for the scaling factor xScal...
Definition: area.cpp:379
Okular::Page::deleteRects
void deleteRects()
Deletes all object rects of the page.
Definition: page.cpp:741
Okular::Page::hasHighlights
bool hasHighlights(int id=-1) const
Returns whether the page provides highlighting for the observer with the given id.
Definition: page.cpp:262
Okular::Annotation
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:90
QLinkedListIterator::previous
const T & previous()
Okular::PageSize
A small class that represents the size of a page.
Definition: pagesize.h:26
Okular::Page::objectRects
QLinkedList< const ObjectRect * > objectRects(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale) const
Returns all object rects of the given type which are at point (x, y) at scale (xScale, yScale).
Definition: page.cpp:436
Okular::DocumentObserver
Base class for objects being notified when something changes.
Definition: observer.h:28
Okular::TilesManager::setPixmap
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
utils_p.h
Okular::TextPage::findText
RegularAreaRect * findText(int id, const QString &text, SearchDirection direction, Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect)
Returns the bounding rect of the text which matches the following criteria or 0 if the search is not ...
Definition: textpage.cpp:715
Okular::Annotation::uniqueName
QString uniqueName() const
Returns the unique name of the annotation.
Definition: annotations.cpp:557
Okular::AnnotationPageItems
Definition: page_p.h:45
Okular::Page::transition
const PageTransition * transition() const
Returns the transition effect of the page or 0 if no transition effect is set (see hasTransition())...
Definition: page.cpp:477
QLinkedList::iterator
QTime::start
void start()
Okular::Page::tilesAt
QList< Tile > tilesAt(const DocumentObserver *observer, const NormalizedRect &rect) const
Returns a list of all tiles intersecting with rect.
Definition: page.cpp:998
Okular::RotationJob
Definition: rotationjob_p.h:26
rotationjob_p.h
Okular::Page::setTextPage
void setTextPage(TextPage *text)
Sets the text page.
Definition: page.cpp:539
Okular::Page::label
QString label() const
Returns the label of the page, or a null string if not set.
Definition: page.cpp:616
QDomElement::tagName
QString tagName() const
form_p.h
Okular::NormalizedRect::bottom
double bottom
The normalized bottom coordinate.
Definition: area.h:320
Okular::Page::orientation
Rotation orientation() const
Returns the orientation of the page as defined by the document.
Definition: page.cpp:149
Okular::PagePrivate::m_closingAction
Action * m_closingAction
Definition: page_p.h:139
Okular::Page::addAnnotation
void addAnnotation(Annotation *annotation)
Adds a new annotation to the page.
Definition: page.cpp:631
QPixmap::toImage
QImage toImage() const
Okular::Page::deleteAnnotations
void deleteAnnotations()
Deletes all annotations of the page.
Definition: page.cpp:777
QDomDocument::createElement
QDomElement createElement(const QString &tagName)
Okular::HighlightAreaRect
This class stores the coordinates of a highlighting area together with the id of the highlight owner ...
Definition: area.h:878
Okular::Page::hasTransition
bool hasTransition() const
Returns whether the page provides a transition effect.
Definition: page.cpp:278
Okular::RotationJob::observer
DocumentObserver * observer() const
Definition: rotationjob.cpp:42
Okular::Page::formFields
QLinkedList< FormField * > formFields() const
Returns the list of FormField of the page.
Definition: page.cpp:502
Okular::TilesManager::hasPixmap
bool hasPixmap(const NormalizedRect &rect)
Checks whether all tiles intersecting with rect are available.
Definition: tilesmanager.cpp:325
Okular::OriginalAnnotationPageItems
Definition: page_p.h:51
Okular::DocumentPrivate::m_pageController
PageController * m_pageController
Definition: document_p.h:251
Okular::Page::setSourceReferences
void setSourceReferences(const QLinkedList< SourceRefObjectRect * > &rects)
Sets the list of source reference objects rects.
Definition: page.cpp:594
QDomElement
Okular::Page::hasTilesManager
bool hasTilesManager(const DocumentObserver *observer) const
Returns whether pixmaps for the tiled observer are handled by a tile manager.
Definition: page.cpp:993
Okular::PageTransition
Information object for the transition effect of a page.
Definition: pagetransition.h:24
Okular::PagePrivate::tilesManager
TilesManager * tilesManager(const DocumentObserver *observer) const
Get the tiles manager for the tiled .
Definition: page.cpp:1007
QUuid::toString
QString toString() const
Okular::DocumentPrivate::m_parent
Document * m_parent
Definition: document_p.h:187
Okular::TextSelection
Wrapper around the information needed to generate the selection area There are two assumptions inside...
Definition: misc.h:36
Okular::PagePrivate::rotateAt
void rotateAt(Rotation orientation)
Rotates the image and object rects of the page to the given orientation.
Definition: page.cpp:351
QMap::iterator
Okular::Page::setPageAction
void setPageAction(PageAction action, Action *link)
Sets the link object for the given page action.
Definition: page.cpp:686
QUuid::createUuid
QUuid createUuid()
QMapIterator::hasNext
bool hasNext() const
QLinkedList::append
void append(const T &value)
Okular::PagePrivate::m_orientation
Rotation m_orientation
Definition: page_p.h:128
Okular::Page::textSelection
const RegularAreaRect * textSelection() const
Returns the current text selection.
Definition: page.cpp:621
Okular::PagePrivate::PixmapObject
Definition: page_p.h:117
Okular::Page::Page
Page(uint number, double width, double height, Rotation orientation)
Creates a new page.
Definition: page.cpp:127
Okular::PagePrivate::deleteTextSelections
void deleteTextSelections()
Deletes all text selection objects of the page.
Definition: page.cpp:766
Okular::FormField
The base interface of a form field.
Definition: form.h:36
Okular::Page::setTransition
void setTransition(PageTransition *transition)
Sets the page transition effect.
Definition: page.cpp:680
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

KDE's Doxygen guidelines are available online.

okular

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

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal