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

okular

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