cleanup coding style

Replace tabs with white spaces and remove trailing white spaces
remotes/origin/KDE/4.9
Tobias Koenig 14 years ago
parent dc2f2d36aa
commit 8bd5deea1f
  1. 180
      generators/poppler/generator_pdf.cpp

@ -171,99 +171,99 @@ Okular::Movie* createMovieFromPopplerScreen( const Poppler::LinkRendition *poppl
Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink)
{
Okular::Action *link = 0;
const Poppler::LinkGoto *popplerLinkGoto;
const Poppler::LinkExecute *popplerLinkExecute;
const Poppler::LinkBrowse *popplerLinkBrowse;
const Poppler::LinkAction *popplerLinkAction;
const Poppler::LinkSound *popplerLinkSound;
const Poppler::LinkJavaScript *popplerLinkJS;
Okular::DocumentViewport viewport;
switch(popplerLink->linkType())
{
case Poppler::Link::None:
break;
case Poppler::Link::Goto:
{
popplerLinkGoto = static_cast<const Poppler::LinkGoto *>(popplerLink);
const Poppler::LinkDestination dest = popplerLinkGoto->destination();
const QString destName = dest.destinationName();
if (destName.isEmpty())
{
fillViewportFromLinkDestination( viewport, dest );
link = new Okular::GotoAction(popplerLinkGoto->fileName(), viewport);
}
else
{
link = new Okular::GotoAction(popplerLinkGoto->fileName(), destName);
}
}
break;
case Poppler::Link::Execute:
popplerLinkExecute = static_cast<const Poppler::LinkExecute *>(popplerLink);
link = new Okular::ExecuteAction( popplerLinkExecute->fileName(), popplerLinkExecute->parameters() );
break;
case Poppler::Link::Browse:
popplerLinkBrowse = static_cast<const Poppler::LinkBrowse *>(popplerLink);
link = new Okular::BrowseAction( popplerLinkBrowse->url() );
break;
case Poppler::Link::Action:
popplerLinkAction = static_cast<const Poppler::LinkAction *>(popplerLink);
link = new Okular::DocumentAction( (Okular::DocumentAction::DocumentActionType)popplerLinkAction->actionType() );
break;
case Poppler::Link::Sound:
{
popplerLinkSound = static_cast<const Poppler::LinkSound *>(popplerLink);
Poppler::SoundObject *popplerSound = popplerLinkSound->sound();
Okular::Sound *sound = createSoundFromPopplerSound( popplerSound );
link = new Okular::SoundAction( popplerLinkSound->volume(), popplerLinkSound->synchronous(), popplerLinkSound->repeat(), popplerLinkSound->mix(), sound );
}
break;
case Poppler::Link::JavaScript:
{
popplerLinkJS = static_cast<const Poppler::LinkJavaScript *>(popplerLink);
link = new Okular::ScriptAction( Okular::JavaScript, popplerLinkJS->script() );
}
break;
Okular::Action *link = 0;
const Poppler::LinkGoto *popplerLinkGoto;
const Poppler::LinkExecute *popplerLinkExecute;
const Poppler::LinkBrowse *popplerLinkBrowse;
const Poppler::LinkAction *popplerLinkAction;
const Poppler::LinkSound *popplerLinkSound;
const Poppler::LinkJavaScript *popplerLinkJS;
Okular::DocumentViewport viewport;
switch(popplerLink->linkType())
{
case Poppler::Link::None:
break;
case Poppler::Link::Goto:
{
popplerLinkGoto = static_cast<const Poppler::LinkGoto *>(popplerLink);
const Poppler::LinkDestination dest = popplerLinkGoto->destination();
const QString destName = dest.destinationName();
if (destName.isEmpty())
{
fillViewportFromLinkDestination( viewport, dest );
link = new Okular::GotoAction(popplerLinkGoto->fileName(), viewport);
}
else
{
link = new Okular::GotoAction(popplerLinkGoto->fileName(), destName);
}
}
break;
case Poppler::Link::Execute:
popplerLinkExecute = static_cast<const Poppler::LinkExecute *>(popplerLink);
link = new Okular::ExecuteAction( popplerLinkExecute->fileName(), popplerLinkExecute->parameters() );
break;
case Poppler::Link::Browse:
popplerLinkBrowse = static_cast<const Poppler::LinkBrowse *>(popplerLink);
link = new Okular::BrowseAction( popplerLinkBrowse->url() );
break;
case Poppler::Link::Action:
popplerLinkAction = static_cast<const Poppler::LinkAction *>(popplerLink);
link = new Okular::DocumentAction( (Okular::DocumentAction::DocumentActionType)popplerLinkAction->actionType() );
break;
case Poppler::Link::Sound:
{
popplerLinkSound = static_cast<const Poppler::LinkSound *>(popplerLink);
Poppler::SoundObject *popplerSound = popplerLinkSound->sound();
Okular::Sound *sound = createSoundFromPopplerSound( popplerSound );
link = new Okular::SoundAction( popplerLinkSound->volume(), popplerLinkSound->synchronous(), popplerLinkSound->repeat(), popplerLinkSound->mix(), sound );
}
break;
case Poppler::Link::JavaScript:
{
popplerLinkJS = static_cast<const Poppler::LinkJavaScript *>(popplerLink);
link = new Okular::ScriptAction( Okular::JavaScript, popplerLinkJS->script() );
}
break;
#ifdef HAVE_POPPLER_0_20
case Poppler::Link::Rendition:
// not implemented
break;
case Poppler::Link::Rendition:
// not implemented
break;
#endif
case Poppler::Link::Movie:
// not implemented
break;
}
case Poppler::Link::Movie:
// not implemented
break;
}
return link;
return link;
}
static QLinkedList<Okular::ObjectRect*> generateLinks( const QList<Poppler::Link*> &popplerLinks )
{
QLinkedList<Okular::ObjectRect*> links;
foreach(const Poppler::Link *popplerLink, popplerLinks)
{
QRectF linkArea = popplerLink->linkArea();
double nl = linkArea.left(),
nt = linkArea.top(),
nr = linkArea.right(),
nb = linkArea.bottom();
// create the rect using normalized coords and attach the Okular::Link to it
Okular::ObjectRect * rect = new Okular::ObjectRect( nl, nt, nr, nb, false, Okular::ObjectRect::Action, createLinkFromPopplerLink(popplerLink) );
// add the ObjectRect to the container
links.push_front( rect );
}
qDeleteAll(popplerLinks);
return links;
QLinkedList<Okular::ObjectRect*> links;
foreach(const Poppler::Link *popplerLink, popplerLinks)
{
QRectF linkArea = popplerLink->linkArea();
double nl = linkArea.left(),
nt = linkArea.top(),
nr = linkArea.right(),
nb = linkArea.bottom();
// create the rect using normalized coords and attach the Okular::Link to it
Okular::ObjectRect * rect = new Okular::ObjectRect( nl, nt, nr, nb, false, Okular::ObjectRect::Action, createLinkFromPopplerLink(popplerLink) );
// add the ObjectRect to the container
links.push_front( rect );
}
qDeleteAll(popplerLinks);
return links;
}
extern Okular::Annotation* createAnnotationFromPopplerAnnotation( Poppler::Annotation *ann, bool * doDelete );
@ -809,7 +809,7 @@ QImage PDFGenerator::image( Okular::PixmapRequest * request )
if ( p && genObjectRects )
{
// TODO previously we extracted Image type rects too, but that needed porting to poppler
// TODO previously we extracted Image type rects too, but that needed porting to poppler
// and as we are not doing anything with Image type rects i did not port it, have a look at
// dead gp_outputdev.cpp on image extraction
page->setObjectRects( generateLinks(p->links()) );
@ -1132,13 +1132,7 @@ inline void append (Okular::TextPage* ktp,
const QString &s, double l, double b, double r, double t)
{
// kWarning(PDFDebug).nospace() << "text: " << s << " at (" << l << "," << t << ")x(" << r <<","<<b<<")";
ktp->append( s ,
new Okular::NormalizedRect(
l,
t,
r,
b
));
ktp->append(s, new Okular::NormalizedRect(l, t, r, b));
}
Okular::TextPage * PDFGenerator::abstractTextPage(const QList<Poppler::TextBox*> &text, double height, double width,int rot)
@ -1230,7 +1224,7 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, QDomNode * parentDest
if (!e.attribute("DestinationURI").isNull()) item.setAttribute("URL", e.attribute("DestinationURI"));
// descend recursively and advance to the next node
if ( e.hasChildNodes() ) addSynopsisChildren( &n, & item );
if ( e.hasChildNodes() ) addSynopsisChildren( &n, & item );
n = n.nextSibling();
}
}

Loading…
Cancel
Save