From 70ec3077ff0b5eef57dfe762fbb3d1af8c85a675 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 26 May 2009 15:17:25 +0000 Subject: [PATCH] backport: implement in

tags svn path=/branches/KDE/4.2/kdegraphics/okular/; revision=973223 --- generators/fictionbook/converter.cpp | 19 +++++++++++++++++++ generators/fictionbook/converter.h | 1 + 2 files changed, 20 insertions(+) diff --git a/generators/fictionbook/converter.cpp b/generators/fictionbook/converter.cpp index a96a6a139..c07487130 100644 --- a/generators/fictionbook/converter.cpp +++ b/generators/fictionbook/converter.cpp @@ -501,6 +501,9 @@ bool Converter::convertParagraph( const QDomElement &element ) } else if ( childElement.tagName() == QLatin1String( "image" ) ) { if ( !convertImage( childElement ) ) return false; + } else if ( childElement.tagName() == QLatin1String( "strikethrough" ) ) { + if ( !convertStrikethrough( childElement ) ) + return false; } } else if ( child.isText() ) { const QDomText childText = child.toText(); @@ -529,6 +532,22 @@ bool Converter::convertEmphasis( const QDomElement &element ) return true; } +bool Converter::convertStrikethrough( const QDomElement &element ) +{ + QTextCharFormat origFormat = mCursor->charFormat(); + + QTextCharFormat strikeoutFormat( origFormat ); + strikeoutFormat.setFontStrikeOut( true ); + mCursor->setCharFormat( strikeoutFormat ); + + if ( !convertParagraph( element ) ) + return false; + + mCursor->setCharFormat( origFormat ); + + return true; +} + bool Converter::convertStrong( const QDomElement &element ) { QTextCharFormat origFormat = mCursor->charFormat(); diff --git a/generators/fictionbook/converter.h b/generators/fictionbook/converter.h index 7dd75866b..ca2494105 100644 --- a/generators/fictionbook/converter.h +++ b/generators/fictionbook/converter.h @@ -42,6 +42,7 @@ class Converter : public Okular::TextDocumentConverter bool convertLink( const QDomElement &element ); bool convertEmphasis( const QDomElement &element ); bool convertStrong( const QDomElement &element ); + bool convertStrikethrough( const QDomElement &element ); bool convertStyle( const QDomElement &element );