summaryrefslogtreecommitdiffstats
path: root/filters/chalk/pdf
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-26 00:41:16 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-26 00:41:16 +0000
commit698569f8428ca088f764d704034a1330517b98c0 (patch)
treebf45be6946ebbbee9cce5a5bcf838f4c952d87e6 /filters/chalk/pdf
parent2785103a6bd4de55bd26d79e34d0fdd4b329a73a (diff)
downloadkoffice-698569f8428ca088f764d704034a1330517b98c0.tar.gz
koffice-698569f8428ca088f764d704034a1330517b98c0.zip
Finish rebranding of Krita as Chalk
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238363 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'filters/chalk/pdf')
-rw-r--r--filters/chalk/pdf/Makefile.am30
-rw-r--r--filters/chalk/pdf/chalk_pdf.desktop63
-rw-r--r--filters/chalk/pdf/chalk_pdf_import.desktop51
-rw-r--r--filters/chalk/pdf/configure.in.bot7
-rw-r--r--filters/chalk/pdf/configure.in.in4
-rw-r--r--filters/chalk/pdf/kis_pdf_import.cpp158
-rw-r--r--filters/chalk/pdf/kis_pdf_import.h35
-rw-r--r--filters/chalk/pdf/kis_pdf_import_widget.cpp147
-rw-r--r--filters/chalk/pdf/kis_pdf_import_widget.h55
-rw-r--r--filters/chalk/pdf/pdfimportwidgetbase.ui321
10 files changed, 871 insertions, 0 deletions
diff --git a/filters/chalk/pdf/Makefile.am b/filters/chalk/pdf/Makefile.am
new file mode 100644
index 000000000..9357a98ad
--- /dev/null
+++ b/filters/chalk/pdf/Makefile.am
@@ -0,0 +1,30 @@
+INCLUDES = \
+ -I$(srcdir) \
+ $(KOFFICE_INCLUDES) \
+ -I$(top_srcdir)/chalk \
+ -I$(top_srcdir)/chalk/core \
+ -I$(top_srcdir)/chalk/sdk \
+ -I$(top_srcdir)/chalk/core/tiles \
+ -I$(top_srcdir)/chalk/chalkcolor \
+ -I$(top_srcdir)/chalk/ui \
+ $(KOFFICE_INCLUDES) -I$(interfacedir) \
+ $(KOPAINTER_INCLUDES) \
+ $(all_includes) $(POPPLER_CFLAGS)
+
+servicedir = $(kde_servicesdir)
+
+kdelnkdir = $(kde_appsdir)/.hidden
+
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libchalkpdfimport.la
+libchalkpdfimport_la_LDFLAGS = -avoid-version -module -no-undefined $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) -lkdecore -lkdeui $(LIB_QT) -lkjs -lkdefx -lkio -lkparts \
+ -L../../../lib/kofficecore/.libs/ -lkofficecore -llcms \
+ -L../../../lib/kofficeui/.libs/ -lkofficeui -L../../../lib/store/.libs/ -lkstore -L../../../chalk/core/.libs/ -lchalkimage -L../../../chalk/ui/.libs/ -lchalkui -L../../../chalk/chalkcolor/.libs/ -lchalkcolor
+libchalkpdfimport_la_LIBADD = $(top_builddir)/chalk/libchalkcommon.la \
+ -lpoppler-qt $(KOFFICE_LIBS) $(POPPLER_LIBS)
+
+noinst_HEADERS = kis_pdf_import.h kis_pdf_import_widget.h
+libchalkpdfimport_la_SOURCES = kis_pdf_import.cpp pdfimportwidgetbase.ui \
+ kis_pdf_import_widget.cpp
+kde_services_DATA = chalk_pdf_import.desktop
+kdelnk_DATA = chalk_pdf.desktop
diff --git a/filters/chalk/pdf/chalk_pdf.desktop b/filters/chalk/pdf/chalk_pdf.desktop
new file mode 100644
index 000000000..b518da84c
--- /dev/null
+++ b/filters/chalk/pdf/chalk_pdf.desktop
@@ -0,0 +1,63 @@
+[Desktop Entry]
+Categories=
+Exec=chalk %u
+GenericName=Painting and Image Editing Application
+GenericName[bg]=Редактор на графични изображения
+GenericName[ca]=Programa de dibuix i manipulació d'imatges
+GenericName[cs]=Malování a úpravy obrázků
+GenericName[cy]=Cymhwysiad Peintio Golygu Delweddau
+GenericName[da]=Male- og billedredigeringsprogram
+GenericName[de]=Mal- und Bildbearbeitungsprogramm
+GenericName[el]=Εφαρμογή επεξεργασίας εικόνων
+GenericName[eo]=Aplikaĵo por Pentrado kaj Bildredaktado
+GenericName[es]=Aplicación de pintura y de edición de imágenes
+GenericName[et]=Joonistamise ja pilditöötluse rakendus
+GenericName[eu]=Irudien marrazketa eta ediziorako aplikazioa
+GenericName[fa]=کاربرد ویرایش تصویر و نقاشی
+GenericName[fi]=Maalaus- ja kuvankäsitelyohjelma
+GenericName[fr]=Application de dessin et de manipulation d'images
+GenericName[fy]=Ofbyldingsmanipulaasje
+GenericName[gl]=Aplicación de Pintura e Manipulación de Imaxes
+GenericName[he]=יישום לציור ועריכת תמונות
+GenericName[hr]=Aplikacija za obradu slika i fotografija
+GenericName[hu]=Képszerkesztő
+GenericName[is]=Málun og myndritill
+GenericName[it]=Applicazione di disegno e di modifica delle immagini
+GenericName[ja]=描画と画像編集のためのアプリケーション
+GenericName[km]=កម្មវិធី​គូរ​គំនូរ និង​កែសម្រួល​រូបភាព
+GenericName[lv]=Zīmēšanas un attēlu apstrādes programma
+GenericName[nb]=Program for tegning og bilderedigering
+GenericName[nds]=Programm för't Malen un Bildbewerken
+GenericName[ne]=पेन्टीङ्ग र छवि सम्पादन अनुप्रयोग
+GenericName[nl]=Afbeeldingsmanipulatie
+GenericName[pl]=Program do edycji zdjęć oraz rysunków
+GenericName[pt]=Aplicação de Pintura e Edição de Imagens
+GenericName[pt_BR]=Aplicação de Pintura e Edição de Imagens
+GenericName[ru]=Растровые изображения
+GenericName[se]=Málen- ja govvagieđahallanprográmma
+GenericName[sk]=Program pre tvorbu a úpravu obrázkov
+GenericName[sl]=Program za risanje in obdelavo slik
+GenericName[sr]=Програм за цртање и уређивање слика
+GenericName[sr@Latn]=Program za crtanje i uređivanje slika
+GenericName[sv]=Målnings- och bildredigeringsprogram
+GenericName[uk]=Програма для малювання і редагування зображень
+GenericName[uz]=Rasmlar bilan ishlaydigan dastur
+GenericName[uz@cyrillic]=Расмлар билан ишлайдиган дастур
+GenericName[zh_CN]=绘图和图像编辑应用程序
+GenericName[zh_TW]=繪圖與影像處理程式
+Icon=chalk
+MimeType=application/pdf
+Name=Chalk
+Name[hi]=के-रिता
+Name[km]= Chalk
+Name[lo]=ກຣິຕາ
+Name[ne]=क्रिता
+Path=
+StartupNotify=true
+Terminal=false
+TerminalOptions=
+Type=Application
+X-DCOP-ServiceType=multi
+X-KDE-StartupNotify=true
+X-KDE-SubstituteUID=false
+X-KDE-Username=
diff --git a/filters/chalk/pdf/chalk_pdf_import.desktop b/filters/chalk/pdf/chalk_pdf_import.desktop
new file mode 100644
index 000000000..cfc6e1eac
--- /dev/null
+++ b/filters/chalk/pdf/chalk_pdf_import.desktop
@@ -0,0 +1,51 @@
+[Desktop Entry]
+Type=Service
+Name=Chalk PDF Import Filter
+Name[bg]=Филтър за импортиране от PDF в Chalk
+Name[br]=Sil enporzh PDF evit Chalk
+Name[ca]=Filtre d'importació PDF per a Chalk
+Name[da]=Chalk PDF-importfilter
+Name[de]=Chalk PDF-Importfilter
+Name[el]=Φίλτρο εισαγωγής PDF του Chalk
+Name[eo]=Chalk PD-importfiltrilo
+Name[es]=Filtro de importación a PDF de Chalk
+Name[et]=Chalk PDF impordifilter
+Name[fa]=پالایۀ واردات Chalk PDF
+Name[fr]=Filtre d'importation PDF de Chalk
+Name[fy]=Chalk PDF Ymportfilter
+Name[ga]=Scagaire Iompórtála PDF Chalk
+Name[gl]=Filtro de Importación de PDF para Chalk
+Name[hr]=Chalk PDF filtar uvoza
+Name[hu]=Chalk PDF importszűrő
+Name[it]=Filtro di importazione PDF per Chalk
+Name[ja]=Chalk PDF インポートフィルタ
+Name[km]=តម្រង​នាំចូល PNG របស់​រាប់ Chalk
+Name[lt]=Chalk PDF importavimo filtras
+Name[lv]=Chalk PDF importa filtrs
+Name[nb]=PDF-importfilter for Chalk
+Name[nds]=PDF-Importfilter för Chalk
+Name[ne]=क्रिता PDF आयात फिल्टर
+Name[nl]=Chalk PDF Importfilter
+Name[pl]=Filtr importu formatu PDF do Chalk
+Name[pt]=Filtro de Importação de PDF para o Chalk
+Name[pt_BR]=Filtro de Importação de PDF para o Chalk
+Name[ru]=Фильтр импорта документов PDF в Chalk
+Name[se]=Chalk PDF-sisafievrridansilli
+Name[sk]=PDF filter pre import do Chalk
+Name[sl]=Uvozni filter PDF za Krito
+Name[sr]=Chalk-ин филтер за увоз из PDF-а
+Name[sr@Latn]=Chalk-in filter za uvoz iz PDF-a
+Name[sv]=Chalk PDF-importfilter
+Name[uk]=Фільтр імпорту PDF для Chalk
+Name[uz]=Chalk uchun PDF import filteri
+Name[uz@cyrillic]=Chalk учун PDF импорт филтери
+Name[zh_TW]=Chalk PDF 匯入過濾程式
+Comment=
+Comment[uz]=PDF-fayllarni Chalk bilan oʻqish vositasi
+Comment[uz@cyrillic]=PDF-файлларни Chalk билан ўқиш воситаси
+ServiceTypes=KOfficeFilter
+X-KDE-Available=
+X-KDE-Export=application/x-chalk
+X-KDE-Import=application/pdf
+X-KDE-Weight=1
+X-KDE-Library=libchalkpdfimport
diff --git a/filters/chalk/pdf/configure.in.bot b/filters/chalk/pdf/configure.in.bot
new file mode 100644
index 000000000..89bd198e0
--- /dev/null
+++ b/filters/chalk/pdf/configure.in.bot
@@ -0,0 +1,7 @@
+if test -z "$POPPLER_LIBS"; then
+ echo ""
+ echo "You're missing libpoppler 0.5.1 or later (binaries and/or headers)."
+ echo "chalk won't be able to import pdf"
+ echo "note that the qt-binding of libpoppler is required"
+ echo ""
+fi
diff --git a/filters/chalk/pdf/configure.in.in b/filters/chalk/pdf/configure.in.in
new file mode 100644
index 000000000..e43432778
--- /dev/null
+++ b/filters/chalk/pdf/configure.in.in
@@ -0,0 +1,4 @@
+# Compile the pdf import filter only if Poppler is available
+PKG_CHECK_MODULES(POPPLER, poppler-qt >= 0.5.1, have_poppler=yes, have_poppler=no)
+
+AM_CONDITIONAL(include_PDF, test "x$have_poppler" = xyes)
diff --git a/filters/chalk/pdf/kis_pdf_import.cpp b/filters/chalk/pdf/kis_pdf_import.cpp
new file mode 100644
index 000000000..2cef93e92
--- /dev/null
+++ b/filters/chalk/pdf/kis_pdf_import.cpp
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_pdf_import.h"
+
+// poppler's headers
+#include <poppler-qt.h>
+
+// TQt's headers
+#include <tqfile.h>
+#include <tqimage.h> // TODO that too
+#include <tqradiobutton.h>
+
+// KDE's headers
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <kgenericfactory.h>
+#include <knuminput.h>
+#include <kpassdlg.h>
+
+#include <kio/netaccess.h>
+
+// koffice's headers
+#include <KoFilterChain.h>
+
+// chalk's headers
+#include <kis_doc.h>
+#include <kis_colorspace.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_group_layer.h>
+#include <kis_image.h>
+#include <kis_meta_registry.h>
+#include <kis_paint_layer.h>
+
+// plugins's headers
+#include "kis_pdf_import_widget.h"
+
+typedef KGenericFactory<KisPDFImport, KoFilter> PDFImportFactory;
+K_EXPORT_COMPONENT_FACTORY(libchalkpdfimport, PDFImportFactory("kofficefilters"))
+
+KisPDFImport::KisPDFImport(KoFilter *, const char *, const TQStringList&) : KoFilter()
+{
+}
+
+KisPDFImport::~KisPDFImport()
+{
+}
+
+KisPDFImport::ConversiontqStatus KisPDFImport::convert(const TQCString& , const TQCString& )
+{
+ TQString filename = m_chain -> inputFile();
+ kdDebug(41008) << "Importing using PDFImport!" << filename << endl;
+
+ if (filename.isEmpty())
+ return KoFilter::FileNotFound;
+
+
+ KURL url;
+ url.setPath(filename);
+
+ if (!KIO::NetAccess::exists(url, false, tqApp -> mainWidget())) {
+ return KoFilter::FileNotFound;
+ }
+
+ // We're not set up to handle asynchronous loading at the moment.
+ TQString tmpFile;
+ if (KIO::NetAccess::download(url, tmpFile, tqApp -> mainWidget())) {
+ url.setPath( tmpFile );
+ }
+
+ Poppler::Document* pdoc = Poppler::Document::load( TQFile::encodeName(url.path() ) );
+
+
+ if ( !pdoc)
+ {
+ kdDebug(41008) << "Error when reading the PDF" << endl;
+ return KoFilter::StorageCreationError;
+ }
+
+
+ while( pdoc->isLocked() )
+ {
+ TQCString password;
+ int result = KPasswordDialog::getPassword(password, i18n("A password is required to read that pdf"));
+ if (result == KPasswordDialog::Accepted)
+ {
+ pdoc->unlock(password);
+ } else {
+ kdDebug(41008) << "Password canceled" << endl;
+ return KoFilter::StorageCreationError;
+ }
+ }
+
+ KDialogBase* kdb = new KDialogBase(0, "", false, i18n("PDF Import Options"), KDialogBase::Ok | KDialogBase::Cancel);
+
+ KisPDFImportWidget* wdg = new KisPDFImportWidget(pdoc, kdb);
+ kdb->setMainWidget(wdg);
+ kapp->restoreOverrideCursor();
+ if(kdb->exec() == TQDialog::Rejected)
+ {
+ delete pdoc;
+ delete kdb;
+ return KoFilter::StorageCreationError; // FIXME Cancel doesn't exist :(
+ }
+
+ // Init kis's doc
+ KisDoc * doc = dynamic_cast<KisDoc*>(m_chain -> outputDocument());
+ if (!doc)
+ {
+ delete pdoc;
+ delete kdb;
+ return KoFilter::CreationError;
+ }
+
+ doc -> prepareForImport();
+ // Create the chalk image
+ KisColorSpace* cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("RGBA"), "");
+ int width = wdg->intWidth->value();
+ int height = wdg->intHeight->value();
+ KisImageSP img = new KisImage(doc->undoAdapter(), width, height, cs, "built image");
+ img->blockSignals(true); // Don't send out signals while we're building the image
+
+ // create a layer
+ TQValueList<int> pages = wdg->pages();
+ for(TQValueList<int>::const_iterator it = pages.begin(); it != pages.end(); ++it)
+ {
+ KisPaintLayer* layer = new KisPaintLayer(img, TQString(i18n("Page %1")).tqarg( TQString::number(*it) + 1), TQ_UINT8_MAX);
+ layer->paintDevice()->convertFromTQImage( pdoc->getPage( *it )->renderToImage(wdg->intHorizontal->value(), wdg->intVertical->value() ), "");
+ img->addLayer(layer, img->rootLayer(), 0);
+ }
+
+ img->blockSignals(false);
+ doc -> setCurrentImage( img);
+
+ KIO::NetAccess::removeTempFile(tmpFile);
+
+ delete pdoc;
+ delete kdb;
+ return KoFilter::OK;
+}
+
diff --git a/filters/chalk/pdf/kis_pdf_import.h b/filters/chalk/pdf/kis_pdf_import.h
new file mode 100644
index 000000000..ab4535b9d
--- /dev/null
+++ b/filters/chalk/pdf/kis_pdf_import.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_PDF_IMPORT_H
+#define KIS_PDF_IMPORT_H
+
+#include <KoFilter.h>
+
+class KisPDFImport : public KoFilter{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ KisPDFImport(KoFilter *tqparent, const char *name, const TQStringList&);
+ virtual ~KisPDFImport();
+ public:
+ virtual KoFilter::ConversiontqStatus convert(const TQCString& from, const TQCString& to);
+};
+
+#endif
diff --git a/filters/chalk/pdf/kis_pdf_import_widget.cpp b/filters/chalk/pdf/kis_pdf_import_widget.cpp
new file mode 100644
index 000000000..6919876f8
--- /dev/null
+++ b/filters/chalk/pdf/kis_pdf_import_widget.cpp
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_pdf_import_widget.h"
+
+// poppler's headers
+#include <poppler-qt.h>
+
+// TQt's headers
+#include <tqradiobutton.h>
+
+// KDE's headers
+#include <kdebug.h>
+#include <klistbox.h>
+#include <knuminput.h>
+
+KisPDFImportWidget::KisPDFImportWidget(Poppler::Document* pdfDoc, TQWidget * tqparent, const char * name)
+ : PDFImportWidgetBase(tqparent, name), m_pdfDoc(pdfDoc)
+{
+ m_pages.push_back(0); // The first page is selected
+ updateMaxCanvasSize();
+
+ for(int i = 1; i <= m_pdfDoc->getNumPages(); i++)
+ {
+ listPages->insertItem(TQString::number( i ) );
+ }
+
+ connect(intWidth, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( updateHRes() ) );
+ connect(intHeight, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( updateHVer() ) );
+ connect(intHorizontal, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( updateWidth() ) );
+ connect(intVertical, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( updateHeight() ) );
+ connect(boolAllPages, TQT_SIGNAL( toggled ( bool ) ), this, TQT_SLOT( selectAllPages( bool ) ) );
+ connect(boolFirstPage, TQT_SIGNAL( toggled ( bool ) ), this, TQT_SLOT( selectFirstPage( bool ) ) );
+ connect(boolSelectionPage, TQT_SIGNAL( toggled ( bool ) ), this, TQT_SLOT( selectSelectionOfPages( bool ) ) );
+ connect(listPages, TQT_SIGNAL(selectionChanged () ), this, TQT_SLOT(updateSelectionOfPages()));
+}
+
+
+KisPDFImportWidget::~KisPDFImportWidget()
+{
+}
+
+void KisPDFImportWidget::selectAllPages(bool v)
+{
+ if(v)
+ {
+ m_pages.clear();
+ for(int i = 0; i < m_pdfDoc->getNumPages(); i++)
+ {
+ m_pages.push_back(i);
+ }
+ updateMaxCanvasSize();
+ }
+}
+void KisPDFImportWidget::selectFirstPage(bool v)
+{
+ if(v)
+ {
+ m_pages.clear();
+ m_pages.push_back(0); // The first page is selected
+ }
+}
+void KisPDFImportWidget::selectSelectionOfPages(bool v)
+{
+ if(v)
+ {
+ updateSelectionOfPages();
+ updateMaxCanvasSize();
+ }
+
+}
+
+void KisPDFImportWidget::updateSelectionOfPages()
+{
+ if(! boolSelectionPage->isChecked ()) boolSelectionPage->toggle();
+ m_pages.clear();
+ for(int i = 0; i < m_pdfDoc->getNumPages(); i++)
+ {
+ if(listPages->isSelected(i)) m_pages.push_back(i);
+ }
+}
+
+
+void KisPDFImportWidget::updateMaxCanvasSize() {
+ m_maxWidthInch = 0., m_maxHeightInch =0.;
+ for(TQValueList<int>::const_iterator it = m_pages.begin(); it != m_pages.end(); ++it)
+ {
+ Poppler::Page *p = m_pdfDoc->getPage(*it );
+ TQSize size = p->pageSize();
+ if(size.width() > m_maxWidthInch)
+ {
+ m_maxWidthInch = size.width();
+ }
+ if(size.height() > m_maxHeightInch)
+ {
+ m_maxHeightInch = size.height();
+ }
+ }
+ m_maxWidthInch /= 72.;
+ m_maxHeightInch /= 72.;
+ kdDebug() << m_maxWidthInch << " " << m_maxHeightInch << endl;
+ updateWidth();
+ updateHeight();
+}
+
+void KisPDFImportWidget::updateWidth()
+{
+ intWidth->blockSignals(true);
+ intWidth->setValue( (int) m_maxWidthInch * intHorizontal->value() + 1 );
+ intWidth->blockSignals(false);
+}
+void KisPDFImportWidget::updateHeight()
+{
+ intHeight->blockSignals(true);
+ intHeight->setValue( (int) m_maxHeightInch * intVertical->value() + 1 );
+ intHeight->blockSignals(false);
+}
+void KisPDFImportWidget::updateHRes()
+{
+ intHorizontal->blockSignals(true);
+ intHorizontal->setValue( (int) (intWidth->value() / m_maxWidthInch ) );
+ intHorizontal->blockSignals(false);
+}
+void KisPDFImportWidget::updateHVer()
+{
+ intVertical->blockSignals(true);
+ intVertical->setValue( (int) (intHeight->value() / m_maxHeightInch ) );
+ intVertical->blockSignals(false);
+}
+
+#include "kis_pdf_import_widget.moc"
diff --git a/filters/chalk/pdf/kis_pdf_import_widget.h b/filters/chalk/pdf/kis_pdf_import_widget.h
new file mode 100644
index 000000000..8fe806a88
--- /dev/null
+++ b/filters/chalk/pdf/kis_pdf_import_widget.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_PDF_IMPORT_WIDGET_H
+#define KIS_PDF_IMPORT_WIDGET_H
+
+#include <pdfimportwidgetbase.h>
+
+namespace Poppler {
+class Document;
+}
+
+class KisPDFImportWidget : public PDFImportWidgetBase
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ KisPDFImportWidget(Poppler::Document* pdfDoc, TQWidget * tqparent, const char * name = "");
+
+ ~KisPDFImportWidget();
+ public:
+ inline TQValueList<int> pages() { return m_pages; }
+ private slots:
+ void selectAllPages(bool v);
+ void selectFirstPage(bool v);
+ void selectSelectionOfPages(bool v);
+ void updateSelectionOfPages();
+ void updateWidth();
+ void updateHeight();
+ void updateHRes();
+ void updateHVer();
+ void updateMaxCanvasSize();
+ private:
+ Poppler::Document* m_pdfDoc;
+ TQValueList<int> m_pages;
+ double m_maxWidthInch, m_maxHeightInch;
+};
+
+#endif
diff --git a/filters/chalk/pdf/pdfimportwidgetbase.ui b/filters/chalk/pdf/pdfimportwidgetbase.ui
new file mode 100644
index 000000000..19da5d155
--- /dev/null
+++ b/filters/chalk/pdf/pdfimportwidgetbase.ui
@@ -0,0 +1,321 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>PDFImportWidgetBase</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>PDFImportWidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>462</width>
+ <height>210</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>PDFImportWidget</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQGroupBox" row="0" column="1">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Dimensions</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Resolution:</string>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>tqlayout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>tqlayout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>intVerticalqsdf</cstring>
+ </property>
+ <property name="text">
+ <string>Vertical:</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="2">
+ <item>
+ <property name="text">
+ <string>Dots/inch</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>kComboBox1</cstring>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>intHorizontal</cstring>
+ </property>
+ <property name="maxValue">
+ <number>999</number>
+ </property>
+ <property name="value">
+ <number>72</number>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>intVertical</cstring>
+ </property>
+ <property name="maxValue">
+ <number>999</number>
+ </property>
+ <property name="value">
+ <number>72</number>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Horizontal:</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="1" column="2">
+ <item>
+ <property name="text">
+ <string>Dots/inch</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>kComboBox2</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>31</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Size:</string>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>tqlayout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>tqlayout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>intHeight</cstring>
+ </property>
+ <property name="maxValue">
+ <number>99999</number>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>intWidthzqffs</cstring>
+ </property>
+ <property name="text">
+ <string>Width:</string>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>intWidth</cstring>
+ </property>
+ <property name="maxValue">
+ <number>99999</number>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>intHeightqsdfq</cstring>
+ </property>
+ <property name="text">
+ <string>Height:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="TQButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Pages</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>boolAllPages</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;All pages</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>boolFirstPage</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;First page</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>boolSelectionPage</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Selection of page</string>
+ </property>
+ </widget>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>listPages</cstring>
+ </property>
+ <property name="selectionMode">
+ <enum>Multi</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<tabstops>
+ <tabstop>boolFirstPage</tabstop>
+ <tabstop>listPages</tabstop>
+ <tabstop>intHorizontal</tabstop>
+ <tabstop>kComboBox1</tabstop>
+ <tabstop>intVertical</tabstop>
+ <tabstop>kComboBox2</tabstop>
+ <tabstop>intWidth</tabstop>
+ <tabstop>intHeight</tabstop>
+</tabstops>
+<tqlayoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>klistbox.h</includehint>
+</includehints>
+</UI>