svn path=/branches/kpdf/annotations/kdegraphics/kpdf/; revision=428594remotes/origin/kpdf-annotations
parent
e7fadb9ab5
commit
bd81ccaed7
11 changed files with 165 additions and 13 deletions
@ -0,0 +1,6 @@ |
||||
INCLUDES = -I$(srcdir)/../../ $(all_includes)
|
||||
|
||||
libgeneratorkimgio_la_LDFLAGS = $(all_libraries)
|
||||
libgeneratorkimgio_la_SOURCES = generator_kimgio.cpp
|
||||
|
||||
noinst_LTLIBRARIES = libgeneratorkimgio.la
|
||||
@ -0,0 +1,64 @@ |
||||
/***************************************************************************
|
||||
* Copyright (C) 2005 by Albert Astals Cid <tsdgeos@terra.es> * |
||||
* * |
||||
* This program is free software; you can redistribute it and/or modify * |
||||
* it under the terms of the GNU General Public License as published by * |
||||
* the Free Software Foundation; either version 2 of the License, or * |
||||
* (at your option) any later version. * |
||||
***************************************************************************/ |
||||
|
||||
#include <qpainter.h> |
||||
#include <qpixmap.h> |
||||
#include <kprinter.h> |
||||
|
||||
#include "core/page.h" |
||||
#include "generator_kimgio.h" |
||||
|
||||
KIMGIOGenerator::KIMGIOGenerator( KPDFDocument * document ) : Generator( document ) |
||||
{ |
||||
} |
||||
|
||||
KIMGIOGenerator::~KIMGIOGenerator() |
||||
{ |
||||
delete m_pix; |
||||
} |
||||
|
||||
bool KIMGIOGenerator::loadDocument( const QString & fileName, QValueVector<KPDFPage*> & pagesVector ) |
||||
{ |
||||
m_pix = new QPixmap(fileName); |
||||
|
||||
pagesVector.resize( 1 ); |
||||
|
||||
KPDFPage * page = new KPDFPage( 0, m_pix->width(), m_pix->height(), 0 ); |
||||
pagesVector[0] = page; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
bool KIMGIOGenerator::canGeneratePixmap() |
||||
{ |
||||
return true; |
||||
} |
||||
|
||||
void KIMGIOGenerator::generatePixmap( PixmapRequest * request ) |
||||
{ |
||||
QPixmap *p = new QPixmap(*m_pix); |
||||
request->page->setPixmap(request->id, p); |
||||
signalRequestDone(request); |
||||
} |
||||
|
||||
bool KIMGIOGenerator::canGenerateTextPage() |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
void KIMGIOGenerator::generateSyncTextPage( KPDFPage * /*page*/ ) |
||||
{ |
||||
} |
||||
|
||||
bool KIMGIOGenerator::print( KPrinter& printer ) |
||||
{ |
||||
QPainter p(&printer); |
||||
p.drawPixmap(0, 0, *m_pix); |
||||
return true; |
||||
} |
||||
@ -0,0 +1,37 @@ |
||||
/***************************************************************************
|
||||
* Copyright (C) 2005 by Albert Astals Cid <tsdgeos@terra.es> * |
||||
* * |
||||
* This program is free software; you can redistribute it and/or modify * |
||||
* it under the terms of the GNU General Public License as published by * |
||||
* the Free Software Foundation; either version 2 of the License, or * |
||||
* (at your option) any later version. * |
||||
***************************************************************************/ |
||||
|
||||
#ifndef _KPDF_GENERATOR_PNG_H_ |
||||
#define _KPDF_GENERATOR_PNG_H_ |
||||
|
||||
#include "core/generator.h" |
||||
|
||||
class KIMGIOGenerator : public Generator |
||||
{ |
||||
public: |
||||
KIMGIOGenerator( KPDFDocument * document ); |
||||
virtual ~KIMGIOGenerator(); |
||||
|
||||
// [INHERITED] load a document and fill up the pagesVector
|
||||
bool loadDocument( const QString & fileName, QValueVector<KPDFPage*> & pagesVector ); |
||||
|
||||
// [INHERITED] perform actions on document / pages
|
||||
bool canGeneratePixmap(); |
||||
void generatePixmap( PixmapRequest * request ); |
||||
bool canGenerateTextPage(); |
||||
void generateSyncTextPage( KPDFPage * page ); |
||||
|
||||
// [INHERITED] print document using already configured kprinter
|
||||
bool print( KPrinter& printer ); |
||||
|
||||
private: |
||||
QPixmap *m_pix; |
||||
}; |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue