Commit c20faca6 authored by Enrico Ros's avatar Enrico Ros

PDF 1.6 Annotation Parser and DSs: annotations are loaded from PDF file.

 AFAIK the kpdf team is once again the first opensource reader to get
support for a cool feature. All annotations in pdf file are read and
converted to our internal data structures. Then they'll be rendered on
screen and changed/saved to our xml file.

 Annotations completely supported and parsed from PDF:  [markup], popup,
text, freetext, line, polygon, polyline, highlight, underline, squiggly,
strikeout, stamp, ink. Partial support for: [base], geom.

Annotations:
  Added/Changed the passive annotation data structures to contain and
  generalize the attributes of annotation classes. Missing attributes
  (won't be handled by kpdf): base{P,AP,AS,A,AA,StructPar,OC}, geom{RD}.
  Little changes to the PDF1.6 summary in header.

PDFGenerator:
  Internal parser (discussed with Albert) directly in top of xpdf. Read
  object nodes of type 'Annot' and parse the whole set of attributes as
  defined in the PDF1.6 spec (for supported annotations).

svn path=/branches/kpdf_annotations/kdegraphics/kpdf/; revision=396909
parent de460a39
......@@ -9,58 +9,195 @@
// qt/kde includes
#include <qcolor.h>
#include <qapplication.h>
// local includes
#include "annotations.h"
/** Annotation **/
Annotation::Border::Border()
: width( 1 ), xCornerRadius( 0 ), yCornerRadius( 0 ), style( Solid ),
dashMarks( 3 ), dashSpaces( 0 ), effect( NoEffect ), effectIntensity( 0 ) {}
Annotation::Annotation()
: modifyDate( QDateTime::currentDateTime() ), flags( 0 )
{
}
Annotation::Annotation( const QDomElement & /*node*/ )
{
}
void Annotation::store( QDomElement & /*node*/, QDomDocument & /*document*/ )
{
}
/** MarkupAnnotation **/
MarkupAnnotation::InReplyTo::InReplyTo()
: ID( -1 ), scope( Reply ), stateModel( Mark ), state( Unmarked ) {}
MarkupAnnotation::MarkupAnnotation()
: Annotation(), markupOpacity( 1.0 ), markupPopupID( -1 ),
markupCreationDate( QDateTime::currentDateTime() )
{
}
MarkupAnnotation::MarkupAnnotation( const QDomElement & node )
: Annotation( node )
{
// ... load stuff ...
}
void MarkupAnnotation::store( QDomElement & node, QDomDocument & document )
{
// ... save stuff ...
Annotation::store( node, document );
}
/** PopupAnnotation **/
PopupAnnotation::PopupAnnotation()
: Annotation(), popupMarkupParentID( -1 ), popupOpened( false )
{
state = Opened;
flags = 0;
}
Annotation::~Annotation()
PopupAnnotation::PopupAnnotation( const QDomElement & node )
: Annotation( node )
{
// ... load stuff ...
}
void PopupAnnotation::store( QDomElement & node, QDomDocument & document )
{
// ... save stuff ...
Annotation::store( node, document );
}
/** TextAnnotation **/
TextAnnotation::TextAnnotation()
: subType( InPlace ) {}
: MarkupAnnotation(), textType( Popup ), textFont( QApplication::font() ),
popupOpened( false ), popupIcon( "Note" ), inplaceAlign( 0 ),
inplaceIntent( Unknown )
{
}
TextAnnotation::TextAnnotation( const QDomElement & node )
: MarkupAnnotation( node )
{
// ... load stuff ...
}
void TextAnnotation::store( QDomElement & node, QDomDocument & document )
{
// ... save stuff ...
MarkupAnnotation::store( node, document );
}
/** LineAnnotation **/
LineAnnotation::LineAnnotation()
: srcArrow( false ), dstArrow( false ), width( 2 ) {}
: MarkupAnnotation(), lineStartStyle( None ), lineEndStyle( None ),
lineClosed( false ), lineLeadingFwdPt( 0 ), lineLeadingBackPt( 0 ),
lineShowCaption( false ), lineIntent( Unknown )
{
}
LineAnnotation::LineAnnotation( const QDomElement & node )
: MarkupAnnotation( node )
{
// ... load stuff ...
}
void LineAnnotation::store( QDomElement & node, QDomDocument & document )
{
// ... save stuff ...
MarkupAnnotation::store( node, document );
}
/** GeomAnnotation **/
GeomAnnotation::GeomAnnotation()
: subType( Square ) {}
: MarkupAnnotation(), geomType( InscribedSquare ), geomWidthPt( 18 )
{
}
/** PathAnnotation **/
GeomAnnotation::GeomAnnotation( const QDomElement & node )
: MarkupAnnotation( node )
{
// ... load stuff ...
}
PathAnnotation::PathAnnotation()
: subType( Ink ) {}
void GeomAnnotation::store( QDomElement & node, QDomDocument & document )
{
// ... save stuff ...
MarkupAnnotation::store( node, document );
}
/** HighlightAnnotation **/
HighlightAnnotation::HighlightAnnotation()
: subType( Highlight ) {}
: MarkupAnnotation(), highlightType( Highlight )
{
}
HighlightAnnotation::HighlightAnnotation( const QDomElement & node )
: MarkupAnnotation( node )
{
// ... load stuff ...
}
void HighlightAnnotation::store( QDomElement & node, QDomDocument & document )
{
// ... save stuff ...
MarkupAnnotation::store( node, document );
}
/** StampAnnotation **/
StampAnnotation::StampAnnotation() {}
StampAnnotation::StampAnnotation()
: MarkupAnnotation(), stampIconName( "kpdf" )
{
}
StampAnnotation::StampAnnotation( const QDomElement & node )
: MarkupAnnotation( node )
{
// ... load stuff ...
}
void StampAnnotation::store( QDomElement & node, QDomDocument & document )
{
// ... save stuff ...
MarkupAnnotation::store( node, document );
}
/** MediaAnnotation **/
MediaAnnotation::MediaAnnotation()
: subType( URL ) {}
/** InkAnnotation **/
InkAnnotation::InkAnnotation()
: MarkupAnnotation()
{
}
InkAnnotation::InkAnnotation( const QDomElement & node )
: MarkupAnnotation( node )
{
// ... load stuff ...
}
void InkAnnotation::store( QDomElement & node, QDomDocument & document )
{
// ... save stuff ...
MarkupAnnotation::store( node, document );
}
This diff is collapsed.
This diff is collapsed.
......@@ -80,6 +80,8 @@ class PDFGenerator : public Generator
QString getDocumentDate( const QString & data ) const;
// private function for creating the document synopsis hieracy
void addSynopsisChildren( QDomNode * parent, GList * items );
// private function for adding annotations read from the pdf file
void addAnnotations( int pageNumber, KPDFPage * page );
// private function for creating the transition information
void addTransition( int pageNumber, KPDFPage * page );
// (async related) receive data from the generator thread
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment