• 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
documentcommands.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2013 Jon Mease <jon.mease@gmail.com> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  ***************************************************************************/
9 
10 #include "documentcommands_p.h"
11 
12 #include "annotations.h"
13 #include "debug_p.h"
14 #include "document_p.h"
15 #include "form.h"
16 #include "utils_p.h"
17 #include "page.h"
18 
19 #include <KLocalizedString>
20 
21 namespace Okular {
22 
23 void moveViewportIfBoundingRectNotFullyVisible( Okular::NormalizedRect boundingRect,
24  DocumentPrivate *docPriv,
25  int pageNumber )
26 {
27  const Rotation pageRotation = docPriv->m_parent->page( pageNumber )->rotation();
28  const QTransform rotationMatrix = Okular::buildRotationMatrix( pageRotation );
29  boundingRect.transform( rotationMatrix );
30  if ( !docPriv->isNormalizedRectangleFullyVisible( boundingRect, pageNumber ) )
31  {
32  DocumentViewport searchViewport( pageNumber );
33  searchViewport.rePos.enabled = true;
34  searchViewport.rePos.normalizedX = ( boundingRect.left + boundingRect.right ) / 2.0;
35  searchViewport.rePos.normalizedY = ( boundingRect.top + boundingRect.bottom ) / 2.0;
36  docPriv->m_parent->setViewport( searchViewport, 0, true );
37  }
38 }
39 
40 Okular::NormalizedRect buildBoundingRectangleForButtons( const QList<Okular::FormFieldButton*> & formButtons )
41 {
42  // Initialize coordinates of the bounding rect
43  double left = 1.0;
44  double top = 1.0;
45  double right = 0.0;
46  double bottom = 0.0;
47 
48  foreach( FormFieldButton* formButton, formButtons )
49  {
50  left = qMin<double>( left, formButton->rect().left );
51  top = qMin<double>( top, formButton->rect().top );
52  right = qMax<double>( right, formButton->rect().right );
53  bottom = qMax<double>( bottom, formButton->rect().bottom );
54  }
55  Okular::NormalizedRect boundingRect( left, top, right, bottom );
56  return boundingRect;
57 }
58 
59 AddAnnotationCommand::AddAnnotationCommand( Okular::DocumentPrivate * docPriv, Okular::Annotation* annotation, int pageNumber )
60  : m_docPriv( docPriv ),
61  m_annotation( annotation ),
62  m_pageNumber( pageNumber ),
63  m_done( false )
64 {
65  setText( i18nc ("Add an annotation to the page", "add annotation" ) );
66 }
67 
68 AddAnnotationCommand::~AddAnnotationCommand()
69 {
70  if ( !m_done )
71  {
72  delete m_annotation;
73  }
74 }
75 
76 void AddAnnotationCommand::undo()
77 {
78  moveViewportIfBoundingRectNotFullyVisible( m_annotation->boundingRectangle(), m_docPriv, m_pageNumber );
79  m_docPriv->performRemovePageAnnotation( m_pageNumber, m_annotation );
80  m_done = false;
81 }
82 
83 void AddAnnotationCommand::redo()
84 {
85  moveViewportIfBoundingRectNotFullyVisible( m_annotation->boundingRectangle(), m_docPriv, m_pageNumber );
86  m_docPriv->performAddPageAnnotation( m_pageNumber, m_annotation );
87  m_done = true;
88 }
89 
90 
91 RemoveAnnotationCommand::RemoveAnnotationCommand(Okular::DocumentPrivate * doc, Okular::Annotation* annotation, int pageNumber)
92  : m_docPriv( doc ),
93  m_annotation( annotation ),
94  m_pageNumber( pageNumber ),
95  m_done( false )
96 {
97  setText( i18nc( "Remove an annotation from the page", "remove annotation" ) );
98 }
99 
100 RemoveAnnotationCommand::~RemoveAnnotationCommand()
101 {
102  if ( m_done )
103  {
104  delete m_annotation;
105  }
106 }
107 
108 void RemoveAnnotationCommand::undo()
109 {
110  moveViewportIfBoundingRectNotFullyVisible( m_annotation->boundingRectangle(), m_docPriv, m_pageNumber );
111  m_docPriv->performAddPageAnnotation( m_pageNumber, m_annotation );
112  m_done = false;
113 }
114 
115 void RemoveAnnotationCommand::redo(){
116  moveViewportIfBoundingRectNotFullyVisible( m_annotation->boundingRectangle(), m_docPriv, m_pageNumber );
117  m_docPriv->performRemovePageAnnotation( m_pageNumber, m_annotation );
118  m_done = true;
119 }
120 
121 
122 ModifyAnnotationPropertiesCommand::ModifyAnnotationPropertiesCommand( DocumentPrivate* docPriv,
123  Annotation* annotation,
124  int pageNumber,
125  QDomNode oldProperties,
126  QDomNode newProperties )
127  : m_docPriv( docPriv ),
128  m_annotation( annotation ),
129  m_pageNumber( pageNumber ),
130  m_prevProperties( oldProperties ),
131  m_newProperties( newProperties )
132 {
133  setText(i18nc("Modify an annotation's internal properties (Color, line-width, etc.)", "modify annotation properties"));
134 }
135 
136 void ModifyAnnotationPropertiesCommand::undo()
137 {
138  moveViewportIfBoundingRectNotFullyVisible( m_annotation->boundingRectangle(), m_docPriv, m_pageNumber );
139  m_annotation->setAnnotationProperties( m_prevProperties );
140  m_docPriv->performModifyPageAnnotation( m_pageNumber, m_annotation, true );
141 }
142 
143 void ModifyAnnotationPropertiesCommand::redo()
144 {
145  moveViewportIfBoundingRectNotFullyVisible( m_annotation->boundingRectangle(), m_docPriv, m_pageNumber );
146  m_annotation->setAnnotationProperties( m_newProperties );
147  m_docPriv->performModifyPageAnnotation( m_pageNumber, m_annotation, true );
148 }
149 
150 TranslateAnnotationCommand::TranslateAnnotationCommand( DocumentPrivate* docPriv,
151  Annotation* annotation,
152  int pageNumber,
153  const Okular::NormalizedPoint & delta,
154  bool completeDrag )
155  : m_docPriv( docPriv ),
156  m_annotation( annotation ),
157  m_pageNumber( pageNumber ),
158  m_delta( delta ),
159  m_completeDrag( completeDrag )
160 {
161  setText( i18nc( "Translate an annotation's position on the page", "translate annotation" ) );
162 }
163 
164 void TranslateAnnotationCommand::undo()
165 {
166  moveViewportIfBoundingRectNotFullyVisible(translateBoundingRectangle( minusDelta() ), m_docPriv, m_pageNumber );
167  m_annotation->translate( minusDelta() );
168  m_docPriv->performModifyPageAnnotation( m_pageNumber, m_annotation, true );
169 }
170 
171 void TranslateAnnotationCommand::redo()
172 {
173  moveViewportIfBoundingRectNotFullyVisible(translateBoundingRectangle( m_delta ), m_docPriv, m_pageNumber );
174  m_annotation->translate( m_delta );
175  m_docPriv->performModifyPageAnnotation( m_pageNumber, m_annotation, true );
176 }
177 
178 int TranslateAnnotationCommand::id() const
179 {
180  return 1;
181 }
182 
183 bool TranslateAnnotationCommand::mergeWith( const QUndoCommand* uc )
184 {
185  TranslateAnnotationCommand *tuc = (TranslateAnnotationCommand*)uc;
186 
187  if ( tuc->m_annotation != m_annotation )
188  return false;
189 
190  if ( m_completeDrag )
191  {
192  return false;
193  }
194  m_delta = Okular::NormalizedPoint( tuc->m_delta.x + m_delta.x, tuc->m_delta.y + m_delta.y );
195  m_completeDrag = tuc->m_completeDrag;
196  return true;
197 }
198 
199 Okular::NormalizedPoint TranslateAnnotationCommand::minusDelta()
200 {
201  return Okular::NormalizedPoint( -m_delta.x, -m_delta.y );
202 }
203 
204 Okular::NormalizedRect TranslateAnnotationCommand::translateBoundingRectangle( const Okular::NormalizedPoint & delta )
205 {
206  Okular::NormalizedRect annotBoundingRect = m_annotation->boundingRectangle();
207  double left = qMin<double>( annotBoundingRect.left, annotBoundingRect.left + delta.x );
208  double right = qMax<double>( annotBoundingRect.right, annotBoundingRect.right + delta.x );
209  double top = qMin<double>( annotBoundingRect.top, annotBoundingRect.top + delta.y );
210  double bottom = qMax<double>( annotBoundingRect.bottom, annotBoundingRect.bottom + delta.y );
211  Okular::NormalizedRect boundingRect( left, top, right, bottom );
212  return boundingRect;
213 }
214 
215 EditTextCommand::EditTextCommand( const QString & newContents,
216  int newCursorPos,
217  const QString & prevContents,
218  int prevCursorPos,
219  int prevAnchorPos )
220  : m_newContents( newContents ),
221  m_newCursorPos( newCursorPos ),
222  m_prevContents( prevContents ),
223  m_prevCursorPos( prevCursorPos ),
224  m_prevAnchorPos( prevAnchorPos )
225 {
226  setText( i18nc( "Generic text edit command", "edit text" ) );
227 
229  // If There was a selection then edit was not a simple single character backspace, delete, or insert
230  if (m_prevCursorPos != m_prevAnchorPos)
231  {
232  kDebug(OkularDebug) << "OtherEdit, selection";
233  m_editType = OtherEdit;
234  }
235  else if ( newContentsRightOfCursor() == oldContentsRightOfCursor() &&
236  newContentsLeftOfCursor() == oldContentsLeftOfCursor().left(oldContentsLeftOfCursor().length() - 1) &&
237  oldContentsLeftOfCursor().right(1) != "\n" )
238  {
239  kDebug(OkularDebug) << "CharBackspace";
240  m_editType = CharBackspace;
241  }
242  else if ( newContentsLeftOfCursor() == oldContentsLeftOfCursor() &&
243  newContentsRightOfCursor() == oldContentsRightOfCursor().right(oldContentsRightOfCursor().length() - 1) &&
244  oldContentsRightOfCursor().left(1) != "\n" )
245  {
246  kDebug(OkularDebug) << "CharDelete";
247  m_editType = CharDelete;
248  }
249  else if ( newContentsRightOfCursor() == oldContentsRightOfCursor() &&
250  newContentsLeftOfCursor().left( newContentsLeftOfCursor().length() - 1) == oldContentsLeftOfCursor() &&
251  newContentsLeftOfCursor().right(1) != "\n" )
252  {
253  kDebug(OkularDebug) << "CharInsert";
254  m_editType = CharInsert;
255  }
256  else
257  {
258  kDebug(OkularDebug) << "OtherEdit";
259  m_editType = OtherEdit;
260  }
261 }
262 
263 bool EditTextCommand::mergeWith(const QUndoCommand* uc)
264 {
265  EditTextCommand *euc = (EditTextCommand*)uc;
266 
267  // Only attempt merge of euc into this if our new state matches euc's old state and
268  // the editTypes match and are not type OtherEdit
269  if ( m_newContents == euc->m_prevContents
270  && m_newCursorPos == euc->m_prevCursorPos
271  && m_editType == euc->m_editType
272  && m_editType != OtherEdit )
273  {
274  m_newContents = euc->m_newContents;
275  m_newCursorPos = euc->m_newCursorPos;
276  return true;
277  }
278  return false;
279 }
280 
281 QString EditTextCommand::oldContentsLeftOfCursor()
282 {
283  return m_prevContents.left(m_prevCursorPos);
284 }
285 
286 QString EditTextCommand::oldContentsRightOfCursor()
287 {
288  return m_prevContents.right(m_prevContents.length() - m_prevCursorPos);
289 }
290 
291 QString EditTextCommand::newContentsLeftOfCursor()
292 {
293  return m_newContents.left(m_newCursorPos);
294 }
295 
296 QString EditTextCommand::newContentsRightOfCursor()
297 {
298  return m_newContents.right(m_newContents.length() - m_newCursorPos);
299 }
300 
301 EditAnnotationContentsCommand::EditAnnotationContentsCommand( DocumentPrivate* docPriv,
302  Annotation* annotation,
303  int pageNumber,
304  const QString & newContents,
305  int newCursorPos,
306  const QString & prevContents,
307  int prevCursorPos,
308  int prevAnchorPos )
309 : EditTextCommand( newContents, newCursorPos, prevContents, prevCursorPos, prevAnchorPos ),
310  m_docPriv( docPriv ),
311  m_annotation( annotation ),
312  m_pageNumber( pageNumber )
313 {
314  setText( i18nc( "Edit an annotation's text contents", "edit annotation contents" ) );
315 }
316 
317 void EditAnnotationContentsCommand::undo()
318 {
319  moveViewportIfBoundingRectNotFullyVisible( m_annotation->boundingRectangle(), m_docPriv, m_pageNumber );
320  m_docPriv->performSetAnnotationContents( m_prevContents, m_annotation, m_pageNumber );
321  emit m_docPriv->m_parent->annotationContentsChangedByUndoRedo( m_annotation, m_prevContents, m_prevCursorPos, m_prevAnchorPos );
322 }
323 
324 void EditAnnotationContentsCommand::redo()
325 {
326  moveViewportIfBoundingRectNotFullyVisible( m_annotation->boundingRectangle(), m_docPriv, m_pageNumber );
327  m_docPriv->performSetAnnotationContents( m_newContents, m_annotation, m_pageNumber );
328  emit m_docPriv->m_parent->annotationContentsChangedByUndoRedo( m_annotation, m_newContents, m_newCursorPos, m_newCursorPos );
329 }
330 
331 int EditAnnotationContentsCommand::id() const
332 {
333  return 2;
334 }
335 
336 bool EditAnnotationContentsCommand::mergeWith(const QUndoCommand* uc)
337 {
338  EditAnnotationContentsCommand *euc = (EditAnnotationContentsCommand*)uc;
339  // Only attempt merge of euc into this if they modify the same annotation
340  if ( m_annotation == euc->m_annotation )
341  {
342  return EditTextCommand::mergeWith( uc );
343  }
344  else
345  {
346  return false;
347  }
348 }
349 
350 EditFormTextCommand::EditFormTextCommand( Okular::DocumentPrivate* docPriv,
351  Okular::FormFieldText* form,
352  int pageNumber,
353  const QString & newContents,
354  int newCursorPos,
355  const QString & prevContents,
356  int prevCursorPos,
357  int prevAnchorPos )
358 : EditTextCommand( newContents, newCursorPos, prevContents, prevCursorPos, prevAnchorPos ),
359  m_docPriv ( docPriv ),
360  m_form( form ),
361  m_pageNumber( pageNumber )
362 {
363  setText( i18nc( "Edit an form's text contents", "edit form contents" ) );
364 }
365 
366 void EditFormTextCommand::undo()
367 {
368  moveViewportIfBoundingRectNotFullyVisible( m_form->rect(), m_docPriv, m_pageNumber );
369  m_form->setText( m_prevContents );
370  emit m_docPriv->m_parent->formTextChangedByUndoRedo( m_pageNumber, m_form, m_prevContents, m_prevCursorPos, m_prevAnchorPos );
371 }
372 
373 void EditFormTextCommand::redo()
374 {
375  moveViewportIfBoundingRectNotFullyVisible( m_form->rect(), m_docPriv, m_pageNumber );
376  m_form->setText( m_newContents );
377  emit m_docPriv->m_parent->formTextChangedByUndoRedo( m_pageNumber, m_form, m_newContents, m_newCursorPos, m_newCursorPos );
378 }
379 
380 int EditFormTextCommand::id() const
381 {
382  return 3;
383 }
384 
385 bool EditFormTextCommand::mergeWith(const QUndoCommand* uc)
386 {
387  EditFormTextCommand *euc = (EditFormTextCommand*)uc;
388  // Only attempt merge of euc into this if they modify the same form
389  if ( m_form == euc->m_form )
390  {
391  return EditTextCommand::mergeWith( uc );
392  }
393  else
394  {
395  return false;
396  }
397 }
398 
399 EditFormListCommand::EditFormListCommand( Okular::DocumentPrivate* docPriv,
400  FormFieldChoice* form,
401  int pageNumber,
402  const QList< int > & newChoices,
403  const QList< int > & prevChoices )
404 : m_docPriv( docPriv ),
405  m_form( form ),
406  m_pageNumber( pageNumber ),
407  m_newChoices( newChoices ),
408  m_prevChoices( prevChoices )
409 {
410  setText( i18nc( "Edit a list form's choices", "edit list form choices" ) );
411 }
412 
413 void EditFormListCommand::undo()
414 {
415  moveViewportIfBoundingRectNotFullyVisible( m_form->rect(), m_docPriv, m_pageNumber );
416  m_form->setCurrentChoices( m_prevChoices );
417  emit m_docPriv->m_parent->formListChangedByUndoRedo( m_pageNumber, m_form, m_prevChoices );
418 }
419 
420 void EditFormListCommand::redo()
421 {
422  moveViewportIfBoundingRectNotFullyVisible( m_form->rect(), m_docPriv, m_pageNumber );
423  m_form->setCurrentChoices( m_newChoices );
424  emit m_docPriv->m_parent->formListChangedByUndoRedo( m_pageNumber, m_form, m_newChoices );
425 }
426 
427 EditFormComboCommand::EditFormComboCommand( Okular::DocumentPrivate* docPriv,
428  FormFieldChoice* form,
429  int pageNumber,
430  const QString & newContents,
431  int newCursorPos,
432  const QString & prevContents,
433  int prevCursorPos,
434  int prevAnchorPos )
435 : EditTextCommand( newContents, newCursorPos, prevContents, prevCursorPos, prevAnchorPos ),
436  m_docPriv( docPriv ),
437  m_form( form ),
438  m_pageNumber( pageNumber ),
439  m_newIndex( -1 ),
440  m_prevIndex( -1 )
441 {
442  setText( i18nc( "Edit a combo form's selection", "edit combo form selection" ) );
443 
444  // Determine new and previous choice indices (if any)
445  for ( int i = 0; i < m_form->choices().size(); i++ )
446  {
447  if ( m_form->choices()[i] == m_prevContents )
448  {
449  m_prevIndex = i;
450  }
451 
452  if ( m_form->choices()[i] == m_newContents )
453  {
454  m_newIndex = i;
455  }
456  }
457 }
458 
459 void EditFormComboCommand::undo()
460 {
461  if ( m_prevIndex != -1 )
462  {
463  m_form->setCurrentChoices( QList<int>() << m_prevIndex );
464  }
465  else
466  {
467  m_form->setEditChoice( m_prevContents );
468  }
469  moveViewportIfBoundingRectNotFullyVisible( m_form->rect(), m_docPriv, m_pageNumber );
470  emit m_docPriv->m_parent->formComboChangedByUndoRedo( m_pageNumber, m_form, m_prevContents, m_prevCursorPos, m_prevAnchorPos );
471 }
472 
473 void EditFormComboCommand::redo()
474 {
475  if ( m_newIndex != -1 )
476  {
477  m_form->setCurrentChoices( QList<int>() << m_newIndex );
478  }
479  else
480  {
481  m_form->setEditChoice( m_newContents );
482  }
483  moveViewportIfBoundingRectNotFullyVisible( m_form->rect(), m_docPriv, m_pageNumber );
484  emit m_docPriv->m_parent->formComboChangedByUndoRedo( m_pageNumber, m_form, m_newContents, m_newCursorPos, m_newCursorPos );
485 }
486 
487 int EditFormComboCommand::id() const
488 {
489  return 4;
490 }
491 
492 bool EditFormComboCommand::mergeWith( const QUndoCommand *uc )
493 {
494  EditFormComboCommand *euc = (EditFormComboCommand*)uc;
495  // Only attempt merge of euc into this if they modify the same form
496  if ( m_form == euc->m_form )
497  {
498  bool shouldMerge = EditTextCommand::mergeWith( uc );
499  if( shouldMerge )
500  {
501  m_newIndex = euc->m_newIndex;
502  }
503  return shouldMerge;
504  }
505  else
506  {
507  return false;
508  }
509 }
510 
511 EditFormButtonsCommand::EditFormButtonsCommand( Okular::DocumentPrivate* docPriv,
512  int pageNumber,
513  const QList< FormFieldButton* > & formButtons,
514  const QList< bool > & newButtonStates )
515 : m_docPriv( docPriv ),
516  m_pageNumber( pageNumber ),
517  m_formButtons( formButtons ),
518  m_newButtonStates( newButtonStates ),
519  m_prevButtonStates( QList< bool >() )
520 {
521  setText( i18nc( "Edit the state of a group of form buttons", "edit form button states" ) );
522  foreach( FormFieldButton* formButton, m_formButtons )
523  {
524  m_prevButtonStates.append( formButton->state() );
525  }
526 }
527 
528 void EditFormButtonsCommand::undo()
529 {
530  clearFormButtonStates();
531  for( int i = 0; i < m_formButtons.size(); i++ )
532  {
533  bool checked = m_prevButtonStates.at( i );
534  if ( checked )
535  m_formButtons.at( i )->setState( checked );
536  }
537 
538  Okular::NormalizedRect boundingRect = buildBoundingRectangleForButtons( m_formButtons );
539  moveViewportIfBoundingRectNotFullyVisible( boundingRect, m_docPriv, m_pageNumber );
540  emit m_docPriv->m_parent->formButtonsChangedByUndoRedo( m_pageNumber, m_formButtons );
541 }
542 
543 void EditFormButtonsCommand::redo()
544 {
545  clearFormButtonStates();
546  for( int i = 0; i < m_formButtons.size(); i++ )
547  {
548  bool checked = m_newButtonStates.at( i );
549  if ( checked )
550  m_formButtons.at( i )->setState( checked );
551  }
552 
553  Okular::NormalizedRect boundingRect = buildBoundingRectangleForButtons( m_formButtons );
554  moveViewportIfBoundingRectNotFullyVisible( boundingRect, m_docPriv, m_pageNumber );
555  emit m_docPriv->m_parent->formButtonsChangedByUndoRedo( m_pageNumber, m_formButtons );
556 }
557 
558 void EditFormButtonsCommand::clearFormButtonStates()
559 {
560  foreach( FormFieldButton* formButton, m_formButtons )
561  {
562  formButton->setState( false );
563  }
564 }
565 
566 }
567 
Okular::FormFieldChoice::setEditChoice
virtual void setEditChoice(const QString &text)
Sets the text entered into an editable combo box choice field.
Definition: form.cpp:247
Okular::NormalizedPoint
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition: area.h:47
QTransform
Okular::EditAnnotationContentsCommand::mergeWith
virtual bool mergeWith(const QUndoCommand *uc)
Definition: documentcommands.cpp:336
Okular::EditFormTextCommand::id
virtual int id() const
Definition: documentcommands.cpp:380
Okular::EditFormComboCommand::EditFormComboCommand
EditFormComboCommand(Okular::DocumentPrivate *docPriv, FormFieldChoice *form, int pageNumber, const QString &newText, int newCursorPos, const QString &prevText, int prevCursorPos, int prevAnchorPos)
Definition: documentcommands.cpp:427
QUndoCommand
Okular::Rotation
Rotation
A rotation.
Definition: global.h:44
Okular::DocumentPrivate::performAddPageAnnotation
void performAddPageAnnotation(int page, Annotation *annotation)
Definition: document.cpp:1058
Okular::Document::setViewport
void setViewport(const DocumentViewport &viewport, DocumentObserver *excludeObserver=0, bool smoothMove=false)
Sets the current document viewport to the given viewport.
Definition: document.cpp:3176
Okular::Page::rotation
Rotation rotation() const
Returns the rotation of the page as defined by the user.
Definition: page.cpp:154
Okular::EditAnnotationContentsCommand::redo
virtual void redo()
Definition: documentcommands.cpp:324
Okular::RemoveAnnotationCommand::redo
virtual void redo()
Definition: documentcommands.cpp:115
Okular::EditFormTextCommand::EditFormTextCommand
EditFormTextCommand(Okular::DocumentPrivate *docPriv, Okular::FormFieldText *form, int pageNumber, const QString &newContents, int newCursorPos, const QString &prevContents, int prevCursorPos, int prevAnchorPos)
Definition: documentcommands.cpp:350
Okular::FormField::rect
virtual NormalizedRect rect() const =0
The bouding rect of the field, in normalized coordinates.
Okular::NormalizedRect::transform
void transform(const QTransform &matrix)
Transforms the normalized rectangle with the operations defined by matrix.
Definition: area.cpp:259
Okular::DocumentPrivate::isNormalizedRectangleFullyVisible
bool isNormalizedRectangleFullyVisible(const Okular::NormalizedRect &rectOfInterest, int rectPage)
Return whether the normalized rectangle rectOfInterest on page number rectPage is fully visible...
Definition: document.cpp:2032
Okular::RemoveAnnotationCommand::RemoveAnnotationCommand
RemoveAnnotationCommand(Okular::DocumentPrivate *doc, Okular::Annotation *annotation, int pageNumber)
Definition: documentcommands.cpp:91
Okular::EditTextCommand::m_prevContents
QString m_prevContents
Definition: documentcommands_p.h:134
QList::at
const T & at(int i) const
Okular::Document::formListChangedByUndoRedo
void formListChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QList< int > &choices)
This signal is emmitted whenever the selected choices for the given list form on the given page are c...
Okular::NormalizedRect::left
double left
The normalized left coordinate.
Definition: area.h:305
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
Okular::TranslateAnnotationCommand::translateBoundingRectangle
Okular::NormalizedRect translateBoundingRectangle(const Okular::NormalizedPoint &delta)
Definition: documentcommands.cpp:204
QUndoCommand::setText
void setText(const QString &text)
Okular::NormalizedPoint::y
double y
The normalized y coordinate.
Definition: area.h:97
QDomNode
Okular::DocumentViewport::enabled
bool enabled
Definition: document.h:1064
Okular::EditTextCommand::m_prevAnchorPos
int m_prevAnchorPos
Definition: documentcommands_p.h:136
Okular::TranslateAnnotationCommand::minusDelta
Okular::NormalizedPoint minusDelta()
Definition: documentcommands.cpp:199
Okular::TranslateAnnotationCommand::TranslateAnnotationCommand
TranslateAnnotationCommand(Okular::DocumentPrivate *docPriv, Okular::Annotation *annotation, int pageNumber, const Okular::NormalizedPoint &delta, bool completeDrag)
Definition: documentcommands.cpp:150
Okular::EditAnnotationContentsCommand::undo
virtual void undo()
Definition: documentcommands.cpp:317
Okular::EditAnnotationContentsCommand
Definition: documentcommands_p.h:141
Okular::AddAnnotationCommand::redo
virtual void redo()
Definition: documentcommands.cpp:83
page.h
Okular::EditFormComboCommand::undo
virtual void undo()
Definition: documentcommands.cpp:459
Okular::EditFormComboCommand::id
virtual int id() const
Definition: documentcommands.cpp:487
QList::size
int size() const
Okular::EditAnnotationContentsCommand::id
virtual int id() const
Definition: documentcommands.cpp:331
Okular::FormFieldText
Interface of a text form field.
Definition: form.h:176
Okular::NormalizedRect::right
double right
The normalized right coordinate.
Definition: area.h:315
Okular::Document::page
const Page * page(int number) const
Returns the page object for the given page number or 0 if the number is out of range.
Definition: document.cpp:2667
Okular::Annotation::translate
void translate(const NormalizedPoint &coord)
Move the annotation by the specified coordinates.
Definition: annotations.cpp:622
Okular::ModifyAnnotationPropertiesCommand::redo
virtual void redo()
Definition: documentcommands.cpp:143
Okular::EditFormTextCommand::redo
virtual void redo()
Definition: documentcommands.cpp:373
QList::append
void append(const T &value)
Okular::TranslateAnnotationCommand::redo
virtual void redo()
Definition: documentcommands.cpp:171
Okular::EditTextCommand::m_editType
EditType m_editType
Definition: documentcommands_p.h:137
Okular::TranslateAnnotationCommand::undo
virtual void undo()
Definition: documentcommands.cpp:164
Okular::TranslateAnnotationCommand
Definition: documentcommands_p.h:79
Okular::EditFormListCommand::EditFormListCommand
EditFormListCommand(Okular::DocumentPrivate *docPriv, FormFieldChoice *form, int pageNumber, const QList< int > &newChoices, const QList< int > &prevChoices)
Definition: documentcommands.cpp:399
Okular::DocumentPrivate::performSetAnnotationContents
void performSetAnnotationContents(const QString &newContents, Annotation *annot, int pageNumber)
Definition: document.cpp:1173
Okular::AddAnnotationCommand::~AddAnnotationCommand
virtual ~AddAnnotationCommand()
Definition: documentcommands.cpp:68
Okular::EditFormTextCommand::undo
virtual void undo()
Definition: documentcommands.cpp:366
Okular::EditAnnotationContentsCommand::EditAnnotationContentsCommand
EditAnnotationContentsCommand(Okular::DocumentPrivate *docPriv, Okular::Annotation *annotation, int pageNumber, const QString &newContents, int newCursorPos, const QString &prevContents, int prevCursorPos, int prevAnchorPos)
Definition: documentcommands.cpp:301
Okular::TranslateAnnotationCommand::id
virtual int id() const
Definition: documentcommands.cpp:178
Okular::Document::annotationContentsChangedByUndoRedo
void annotationContentsChangedByUndoRedo(Okular::Annotation *annotation, const QString &contents, int cursorPos, int anchorPos)
This signal is emmitted whenever the contents of the given annotation are changed by an undo or redo ...
annotations.h
Okular::FormFieldChoice
Interface of a choice form field.
Definition: form.h:258
Okular::moveViewportIfBoundingRectNotFullyVisible
void moveViewportIfBoundingRectNotFullyVisible(Okular::NormalizedRect boundingRect, DocumentPrivate *docPriv, int pageNumber)
Definition: documentcommands.cpp:23
Okular::buildBoundingRectangleForButtons
Okular::NormalizedRect buildBoundingRectangleForButtons(const QList< Okular::FormFieldButton * > &formButtons)
Definition: documentcommands.cpp:40
Okular::FormFieldButton::state
virtual bool state() const =0
The state of the button.
documentcommands_p.h
OkularDebug
#define OkularDebug
Definition: debug_p.h:13
Okular::EditFormButtonsCommand::redo
virtual void redo()
Definition: documentcommands.cpp:543
Okular::ModifyAnnotationPropertiesCommand::ModifyAnnotationPropertiesCommand
ModifyAnnotationPropertiesCommand(Okular::DocumentPrivate *docPriv, Okular::Annotation *annotation, int pageNumber, QDomNode oldProperties, QDomNode newProperties)
Definition: documentcommands.cpp:122
Okular::AddAnnotationCommand::undo
virtual void undo()
Definition: documentcommands.cpp:76
Okular::EditFormComboCommand::redo
virtual void redo()
Definition: documentcommands.cpp:473
form.h
Okular::FormFieldChoice::choices
virtual QStringList choices() const =0
The possible choices of the choice field.
QString
QList< Okular::FormFieldButton * >
QString::right
QString right(int n) const
Okular::DocumentViewport::rePos
struct Okular::DocumentViewport::@0 rePos
If 'rePos.enabled == true' then this structure contains the viewport center or top left depending on ...
Okular::EditTextCommand::m_newCursorPos
int m_newCursorPos
Definition: documentcommands_p.h:133
Okular::FormFieldChoice::setCurrentChoices
virtual void setCurrentChoices(const QList< int > &choices)
Sets the selected choices to choices .
Definition: form.cpp:238
Okular::AddAnnotationCommand::AddAnnotationCommand
AddAnnotationCommand(Okular::DocumentPrivate *docPriv, Okular::Annotation *annotation, int pageNumber)
Definition: documentcommands.cpp:59
Okular::DocumentPrivate
Definition: document_p.h:77
Okular::NormalizedRect::top
double top
The normalized top coordinate.
Definition: area.h:310
Okular::EditTextCommand::mergeWith
virtual bool mergeWith(const QUndoCommand *uc)
Definition: documentcommands.cpp:263
Okular::DocumentViewport::normalizedX
double normalizedX
Definition: document.h:1065
Okular::DocumentPrivate::performRemovePageAnnotation
void performRemovePageAnnotation(int page, Annotation *annotation)
Definition: document.cpp:1091
Okular::NormalizedPoint::x
double x
The normalized x coordinate.
Definition: area.h:92
Okular::buildRotationMatrix
QTransform buildRotationMatrix(Rotation rotation)
Return a rotation matrix corresponding to the rotation enumeration.
Definition: utils.cpp:380
document_p.h
Okular::Document::formComboChangedByUndoRedo
void formComboChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QString &text, int cursorPos, int anchorPos)
This signal is emmitted whenever the active text for the given combo form on the given page is change...
Okular::EditFormComboCommand
Definition: documentcommands_p.h:207
Okular::DocumentViewport::normalizedY
double normalizedY
Definition: document.h:1066
Okular::EditFormButtonsCommand::EditFormButtonsCommand
EditFormButtonsCommand(Okular::DocumentPrivate *docPriv, int pageNumber, const QList< FormFieldButton * > &formButtons, const QList< bool > &newButtonStates)
Definition: documentcommands.cpp:511
Okular::FormFieldButton::setState
virtual void setState(bool state)
Sets the state of the button to the new state .
Definition: form.cpp:110
Okular::Annotation
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:90
Okular::FormFieldText::setText
virtual void setText(const QString &text)
Sets the new text in the text field.
Definition: form.cpp:148
Okular::EditTextCommand::m_newContents
QString m_newContents
Definition: documentcommands_p.h:132
Okular::DocumentPrivate::performModifyPageAnnotation
void performModifyPageAnnotation(int page, Annotation *annotation, bool appearanceChanged)
Definition: document.cpp:1129
Okular::RemoveAnnotationCommand::~RemoveAnnotationCommand
virtual ~RemoveAnnotationCommand()
Definition: documentcommands.cpp:100
utils_p.h
QString::length
int length() const
Okular::EditFormTextCommand
Definition: documentcommands_p.h:165
Okular::EditFormComboCommand::mergeWith
virtual bool mergeWith(const QUndoCommand *uc)
Definition: documentcommands.cpp:492
QString::left
QString left(int n) const
Okular::RemoveAnnotationCommand::undo
virtual void undo()
Definition: documentcommands.cpp:108
Okular::Document::formButtonsChangedByUndoRedo
void formButtonsChangedByUndoRedo(int page, const QList< Okular::FormFieldButton * > &formButtons)
This signal is emmitted whenever the state of the specified group of form buttons (formButtons) on th...
Okular::DocumentViewport
A view on the document.
Definition: document.h:1016
Okular::EditFormTextCommand::mergeWith
virtual bool mergeWith(const QUndoCommand *uc)
Definition: documentcommands.cpp:385
Okular::NormalizedRect::bottom
double bottom
The normalized bottom coordinate.
Definition: area.h:320
Okular::EditFormButtonsCommand::undo
virtual void undo()
Definition: documentcommands.cpp:528
Okular::TranslateAnnotationCommand::mergeWith
virtual bool mergeWith(const QUndoCommand *uc)
Definition: documentcommands.cpp:183
Okular::Document::formTextChangedByUndoRedo
void formTextChangedByUndoRedo(int page, Okular::FormFieldText *form, const QString &contents, int cursorPos, int anchorPos)
This signal is emmitted whenever the text contents of the given text form on the given page are chang...
Okular::EditFormListCommand::redo
virtual void redo()
Definition: documentcommands.cpp:420
Okular::EditTextCommand::m_prevCursorPos
int m_prevCursorPos
Definition: documentcommands_p.h:135
Okular::Annotation::boundingRectangle
NormalizedRect boundingRectangle() const
Returns the bounding rectangle of the annotation.
Definition: annotations.cpp:610
Okular::DocumentPrivate::m_parent
Document * m_parent
Definition: document_p.h:187
Okular::EditFormListCommand::undo
virtual void undo()
Definition: documentcommands.cpp:413
Okular::EditTextCommand::EditTextCommand
EditTextCommand(const QString &newContents, int newCursorPos, const QString &prevContents, int prevCursorPos, int prevAnchorPos)
Definition: documentcommands.cpp:215
Okular::FormFieldButton
Interface of a button form field.
Definition: form.h:118
Okular::ModifyAnnotationPropertiesCommand::undo
virtual void undo()
Definition: documentcommands.cpp:136
Okular::Annotation::setAnnotationProperties
void setAnnotationProperties(const QDomNode &node)
Sets annotations internal properties according to the contents of node.
Definition: annotations.cpp:810
Okular::EditTextCommand
Definition: documentcommands_p.h:103
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