diff --git a/core/annotations.cpp b/core/annotations.cpp index 72ca8b545..d68c17060 100644 --- a/core/annotations.cpp +++ b/core/annotations.cpp @@ -269,7 +269,6 @@ class Annotation::Window::Private int m_height; QString m_title; QString m_summary; - QString m_text; }; Annotation::Window::Window() @@ -356,17 +355,6 @@ QString Annotation::Window::summary() const return d->m_summary; } -void Annotation::Window::setText( const QString &text ) -{ - d->m_text = text; -} - -QString Annotation::Window::text() const -{ - return d->m_text; -} - - class Annotation::Revision::Private { public: @@ -711,7 +699,7 @@ void Annotation::store( QDomNode & annNode, QDomDocument & document ) const // Sub-Node-4 - window if ( d->m_window.flags() != -1 || !d->m_window.title().isEmpty() || - !d->m_window.summary().isEmpty() || !d->m_window.text().isEmpty() ) + !d->m_window.summary().isEmpty() ) { QDomElement wE = document.createElement( "window" ); e.appendChild( wE ); @@ -722,14 +710,6 @@ void Annotation::store( QDomNode & annNode, QDomDocument & document ) const wE.setAttribute( "height", d->m_window.height() ); wE.setAttribute( "title", d->m_window.title() ); wE.setAttribute( "summary", d->m_window.summary() ); - // store window.text as a subnode, because we need escaped data - if ( !d->m_window.text().isEmpty() ) - { - QDomElement escapedText = document.createElement( "text" ); - wE.appendChild( escapedText ); - QDomCDATASection textCData = document.createCDATASection( d->m_window.text() ); - escapedText.appendChild( textCData ); - } } // create [revision] element of the annotation node (if any) @@ -890,14 +870,6 @@ void AnnotationPrivate::setAnnotationProperties( const QDomNode& node ) m_window.setHeight( ee.attribute( "height" ).toInt() ); m_window.setTitle( ee.attribute( "title" ) ); m_window.setSummary( ee.attribute( "summary" ) ); - // parse window subnodes - QDomNode winNode = ee.firstChild(); - for ( ; winNode.isElement(); winNode = winNode.nextSibling() ) - { - QDomElement winElement = winNode.toElement(); - if ( winElement.tagName() == "text" ) - m_window.setText( winElement.firstChild().toCDATASection().data() ); - } } } @@ -950,7 +922,6 @@ class Okular::TextAnnotationPrivate : public Okular::AnnotationPrivate QString m_textIcon; QFont m_textFont; int m_inplaceAlign; - QString m_inplaceText; NormalizedPoint m_inplaceCallout[3]; NormalizedPoint m_transformedInplaceCallout[3]; TextAnnotation::InplaceIntent m_inplaceIntent; @@ -1021,18 +992,6 @@ int TextAnnotation::inplaceAlignment() const return d->m_inplaceAlign; } -void TextAnnotation::setInplaceText( const QString &text ) -{ - Q_D( TextAnnotation ); - d->m_inplaceText = text; -} - -QString TextAnnotation::inplaceText() const -{ - Q_D( const TextAnnotation ); - return d->m_inplaceText; -} - void TextAnnotation::setInplaceCallout( const NormalizedPoint &point, int index ) { if ( index < 0 || index > 2 ) @@ -1099,16 +1058,7 @@ void TextAnnotation::store( QDomNode & node, QDomDocument & document ) const if ( d->m_inplaceIntent != Unknown ) textElement.setAttribute( "intent", (int)d->m_inplaceIntent ); - // Sub-Node-1 - escapedText - if ( !d->m_inplaceText.isEmpty() ) - { - QDomElement escapedText = document.createElement( "escapedText" ); - textElement.appendChild( escapedText ); - QDomCDATASection textCData = document.createCDATASection( d->m_inplaceText ); - escapedText.appendChild( textCData ); - } - - // Sub-Node-2 - callout + // Sub-Node - callout if ( d->m_inplaceCallout[0].x != 0.0 ) { QDomElement calloutElement = document.createElement( "callout" ); @@ -1203,7 +1153,7 @@ void TextAnnotationPrivate::setAnnotationProperties( const QDomNode& node ) if ( ee.tagName() == "escapedText" ) { - m_inplaceText = ee.firstChild().toCDATASection().data(); + m_contents = ee.firstChild().toCDATASection().data(); } else if ( ee.tagName() == "callout" ) { diff --git a/core/annotations.h b/core/annotations.h index 4e9082eca..79fd96539 100644 --- a/core/annotations.h +++ b/core/annotations.h @@ -512,16 +512,6 @@ class OKULAR_EXPORT Annotation */ QString summary() const; - /** - * Sets the @p text of the window. - */ - void setText( const QString &text ); - - /** - * Returns the text of the window. - */ - QString text() const; - private: class Private; Private* const d; @@ -815,16 +805,6 @@ class OKULAR_EXPORT TextAnnotation : public Annotation */ int inplaceAlignment() const; - /** - * Sets the inplace @p text of the text annotation. - */ - void setInplaceText( const QString &text ); - - /** - * Returns the inplace text of the text annotation. - */ - QString inplaceText() const; - /** * Sets the inplace callout @p point at @p index. * diff --git a/core/document.cpp b/core/document.cpp index 2732441cd..7cf346132 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -1151,14 +1151,7 @@ void DocumentPrivate::performSetAnnotationContents( const QString & newContents, { bool appearanceChanged = false; - // Set window text - if ( !annot->window().text().isEmpty() ) - { - annot->window().setText( newContents ); - return; - } - - // Handle special cases + // Check if appearanceChanged should be true switch ( annot->subType() ) { // If it's an in-place TextAnnotation, set the inplace text @@ -1167,7 +1160,6 @@ void DocumentPrivate::performSetAnnotationContents( const QString & newContents, Okular::TextAnnotation * txtann = static_cast< Okular::TextAnnotation * >( annot ); if ( txtann->textType() == Okular::TextAnnotation::InPlace ) { - txtann->setInplaceText( newContents ); appearanceChanged = true; } break; diff --git a/generators/djvu/generator_djvu.cpp b/generators/djvu/generator_djvu.cpp index bc83ed7ad..c506ce3f0 100644 --- a/generators/djvu/generator_djvu.cpp +++ b/generators/djvu/generator_djvu.cpp @@ -424,7 +424,7 @@ Okular::Annotation* DjVuGenerator::convertKDjVuAnnotation( int w, int h, KDjVu:: newtxtann->setTextType( txtann->inlineText() ? Okular::TextAnnotation::InPlace : Okular::TextAnnotation::Linked ); newtxtann->style().setOpacity( txtann->color().alphaF() ); // FIXME remove once the annotation text handling is fixed - newtxtann->setInplaceText( ann->comment() ); + newtxtann->setContents( ann->comment() ); newann = newtxtann; break; } diff --git a/generators/poppler/annots.cpp b/generators/poppler/annots.cpp index b7fb9f77d..3694188cd 100644 --- a/generators/poppler/annots.cpp +++ b/generators/poppler/annots.cpp @@ -176,8 +176,6 @@ void PopplerAnnotationProxy::notifyModification( const Okular::Annotation *okl_a ppl_txtann->setTextIcon( okl_txtann->textIcon() ); ppl_txtann->setTextFont( okl_txtann->textFont() ); ppl_txtann->setInplaceAlign( okl_txtann->inplaceAlignment() ); - if ( okl_txtann->textType() == Okular::TextAnnotation::InPlace ) - ppl_txtann->setContents( okl_txtann->inplaceText() ); // overrides contents ppl_txtann->setCalloutPoints( QVector() ); ppl_txtann->setInplaceIntent( (Poppler::TextAnnotation::InplaceIntent)okl_txtann->inplaceIntent() ); break; diff --git a/ui/pagepainter.cpp b/ui/pagepainter.cpp index 950be034e..2890b568b 100644 --- a/ui/pagepainter.cpp +++ b/ui/pagepainter.cpp @@ -696,7 +696,7 @@ void PagePainter::paintCroppedPageOnPainter( QPainter * destPainter, const Okula painter.scale( 1.0 * scaledWidth / page->width(), 1.0 * scaledHeight / page->height() ); painter.drawText( 2, 2, image.width() - 2, image.height() - 2, Qt::AlignTop | halign | Qt::TextWordWrap, - text->inplaceText() ); + text->contents() ); painter.resetTransform(); painter.drawRect( 0, 0, image.width() - 1, image.height() - 1 ); painter.end(); diff --git a/ui/pageviewannotator.cpp b/ui/pageviewannotator.cpp index 4615d1cac..035c1f30a 100644 --- a/ui/pageviewannotator.cpp +++ b/ui/pageviewannotator.cpp @@ -164,7 +164,7 @@ class PickPointEngine : public AnnotatorEngine //add note Okular::TextAnnotation * ta = new Okular::TextAnnotation(); ann = ta; - ta->setInplaceText( note ); + ta->setContents( note ); ta->setTextType( Okular::TextAnnotation::InPlace ); //set boundary rect.left = qMin(startpoint.x,point.x); @@ -175,7 +175,7 @@ class PickPointEngine : public AnnotatorEngine static int padding = 2; const QFontMetricsF mf(ta->textFont()); const QRectF rcf = mf.boundingRect( Okular::NormalizedRect( rect.left, rect.top, 1.0, 1.0 ).geometry( (int)pagewidth, (int)pageheight ).adjusted( padding, padding, -padding, -padding ), - Qt::AlignTop | Qt::AlignLeft | Qt::TextWordWrap, ta->inplaceText() ); + Qt::AlignTop | Qt::AlignLeft | Qt::TextWordWrap, ta->contents() ); rect.right = qMax(rect.right, rect.left+(rcf.width()+padding*2)/pagewidth); rect.bottom = qMax(rect.bottom, rect.top+(rcf.height()+padding*2)/pageheight); ta->window().setSummary( i18n( "Inline Note" ) ); @@ -187,7 +187,6 @@ class PickPointEngine : public AnnotatorEngine ann = ta; ta->setTextType( Okular::TextAnnotation::Linked ); ta->setTextIcon( "Note" ); - ta->window().setText( QString() ); //ta->window.flags &= ~(Okular::Annotation::Hidden); const double iconhei=0.03; rect.left = point.x;