summaryrefslogtreecommitdiffstats
path: root/tools/thumbnail
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /tools/thumbnail
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'tools/thumbnail')
-rw-r--r--tools/thumbnail/Makefile.am16
-rw-r--r--tools/thumbnail/clipartcreator.cpp63
-rw-r--r--tools/thumbnail/clipartcreator.h33
-rw-r--r--tools/thumbnail/clipartthumbnail.desktop45
-rw-r--r--tools/thumbnail/kofficecreator.cpp125
-rw-r--r--tools/thumbnail/kofficecreator.h49
-rw-r--r--tools/thumbnail/kofficethumbnail.desktop70
-rw-r--r--tools/thumbnail/otherofficethumbnail.desktop69
8 files changed, 470 insertions, 0 deletions
diff --git a/tools/thumbnail/Makefile.am b/tools/thumbnail/Makefile.am
new file mode 100644
index 00000000..e4a0ff39
--- /dev/null
+++ b/tools/thumbnail/Makefile.am
@@ -0,0 +1,16 @@
+INCLUDES = $(KOFFICE_INCLUDES) -I../../kword/ -I../../kpresenter -I../../lib/kotext $(all_includes)
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = clipartthumbnail.la kofficethumbnail.la
+
+clipartthumbnail_la_SOURCES = clipartcreator.cpp
+clipartthumbnail_la_LIBADD = $(LIB_KOFFICECORE) # for KoClipartCollection
+clipartthumbnail_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+kofficethumbnail_la_SOURCES = kofficecreator.cpp
+kofficethumbnail_la_LIBADD = $(LIB_KOFFICECORE)
+kofficethumbnail_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+# otherofficethumbnail.desktop is currently not installed, as it gives too many problems
+kde_services_DATA = clipartthumbnail.desktop kofficethumbnail.desktop
+
diff --git a/tools/thumbnail/clipartcreator.cpp b/tools/thumbnail/clipartcreator.cpp
new file mode 100644
index 00000000..73585a97
--- /dev/null
+++ b/tools/thumbnail/clipartcreator.cpp
@@ -0,0 +1,63 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 David Faure <faure@kde.org>
+ Copyright (C) 2002 Nicolas GOUTTE <goutte@kde.org>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <qimage.h>
+#include <qpainter.h>
+#include <qfile.h>
+
+#include <KoPicture.h>
+
+#include "clipartcreator.h"
+#include "koffice_export.h"
+
+extern "C"
+{
+ KOFFICETOOLS_EXPORT ThumbCreator *new_creator()
+ {
+ return new ClipartCreator;
+ }
+}
+
+bool ClipartCreator::create(const QString &path, int width, int height, QImage &img)
+{
+ QPixmap pixmap;
+ KoPicture picture;
+ if (picture.loadFromFile( path ))
+ {
+ pixmap = QPixmap( 200, 200 );
+ pixmap.fill( Qt::white );
+
+ QPainter p;
+ p.begin( &pixmap );
+ p.setBackgroundColor( Qt::white );
+
+ picture.draw(p, 0, 0, pixmap.width(), pixmap.height());
+ p.end();
+ img = pixmap.convertToImage();
+ return true;
+ }
+ else
+ return false;
+}
+
+ThumbCreator::Flags ClipartCreator::flags() const
+{
+ return static_cast<Flags>(DrawFrame);
+}
diff --git a/tools/thumbnail/clipartcreator.h b/tools/thumbnail/clipartcreator.h
new file mode 100644
index 00000000..d9e6e55b
--- /dev/null
+++ b/tools/thumbnail/clipartcreator.h
@@ -0,0 +1,33 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 David Faure <faure@kde.org>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CLIPARTCREATOR_H
+#define CLIPARTCREATOR_H
+
+#include <kio/thumbcreator.h>
+
+class ClipartCreator : public ThumbCreator
+{
+public:
+ ClipartCreator() {};
+ virtual bool create(const QString &path, int, int, QImage &img);
+ virtual Flags flags() const;
+};
+
+#endif // CLIPARTCREATOR_H
diff --git a/tools/thumbnail/clipartthumbnail.desktop b/tools/thumbnail/clipartthumbnail.desktop
new file mode 100644
index 00000000..893eb040
--- /dev/null
+++ b/tools/thumbnail/clipartthumbnail.desktop
@@ -0,0 +1,45 @@
+[Desktop Entry]
+Type=Service
+Name=Clipart
+Name[af]=Kitskuns
+Name[ar]=قُصاصات فنيّة
+Name[az]=Klip Art
+Name[bg]=Илюстрация
+Name[bs]=Sličice
+Name[cs]=Klipart
+Name[cy]=Clipluniau
+Name[el]=Έτοιμες εικόνες
+Name[eo]=Pretdesegnoj
+Name[et]=Lõikepildid
+Name[fi]=Leikekuvat
+Name[ga]=Fáiscealaín
+Name[he]=אוסף תמונות
+Name[hi]=क्लिपआर्ट
+Name[is]=Ýmsar myndir
+Name[ja]=クリップアート
+Name[km]=បន្ទប់​រូបភាព​
+Name[lo]=ຄຣິປອາດຕ
+Name[lt]=Paveikslų kolekcija
+Name[lv]=Daiļrade
+Name[ms]=Lukisan Klip
+Name[nb]=Bildesamling
+Name[ne]=क्लिपआर्ट
+Name[nn]=Utklippsbilete
+Name[pl]=Klipart
+Name[pt]=Gravuras
+Name[pt_BR]=Cliparts
+Name[ru]=Иллюстрация
+Name[se]=Govvačoakkáldat
+Name[sl]=Izrezek
+Name[sr]=Исечци
+Name[sr@Latn]=Isečci
+Name[th]=คลิปอาร์ต
+Name[uk]=Ілюстрації
+Name[uz]=Klipart
+Name[uz@cyrillic]=Клипарт
+Name[zh_CN]=剪贴画
+Name[zh_TW]=剪貼板
+ServiceTypes=ThumbCreator
+MimeTypes=image/wmf
+X-KDE-Library=clipartthumbnail
+CacheThumbnail=true
diff --git a/tools/thumbnail/kofficecreator.cpp b/tools/thumbnail/kofficecreator.cpp
new file mode 100644
index 00000000..b62808d2
--- /dev/null
+++ b/tools/thumbnail/kofficecreator.cpp
@@ -0,0 +1,125 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2002 Simon MacMullen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+// $Id: kofficecreator.cpp 508787 2006-02-12 18:28:12Z ingwa $
+
+#include <time.h>
+
+#include <qpixmap.h>
+#include <qimage.h>
+#include <qpainter.h>
+
+#include <kapplication.h>
+#include <kfileitem.h>
+#include <ktrader.h>
+#include <klibloader.h>
+#include <kparts/part.h>
+#include <kparts/componentfactory.h>
+
+#include "kofficecreator.h"
+#include <KoStore.h>
+#include <KoDocument.h>
+#include "koffice_export.h"
+
+extern "C"
+{
+ KOFFICETOOLS_EXPORT ThumbCreator *new_creator()
+ {
+ return new KOfficeCreator;
+ }
+}
+
+KOfficeCreator::KOfficeCreator()
+ : m_doc(0)
+{
+}
+
+KOfficeCreator::~KOfficeCreator()
+{
+ delete m_doc;
+}
+
+bool KOfficeCreator::create(const QString &path, int width, int height, QImage &img)
+{
+ KoStore* store = KoStore::createStore(path, KoStore::Read);
+
+ if ( store && ( store->open( QString("Thumbnails/thumbnail.png") ) || store->open( QString("preview.png") ) ) )
+ {
+ // Hooray! No long delay for the user...
+ QByteArray bytes = store->read(store->size());
+ store->close();
+ delete store;
+ return img.loadFromData(bytes);
+ }
+ delete store;
+
+ QString mimetype = KMimeType::findByPath( path )->name();
+
+ m_doc = KParts::ComponentFactory::createPartInstanceFromQuery<KoDocument>( mimetype, QString::null);
+
+ if (!m_doc) return false;
+
+ connect(m_doc, SIGNAL(completed()), SLOT(slotCompleted()));
+
+ KURL url;
+ url.setPath( path );
+ m_doc->setCheckAutoSaveFile( false );
+ m_doc->setAutoErrorHandlingEnabled( false ); // don't show message boxes
+ if ( !m_doc->openURL( url ) )
+ return false;
+ m_completed = false;
+ startTimer(5000);
+ while (!m_completed)
+ kapp->processOneEvent();
+ killTimers();
+
+ // render the page on a bigger pixmap and use smoothScale,
+ // looks better than directly scaling with the QPainter (malte)
+ QPixmap pix;
+ if (width > 400)
+ {
+ pix = m_doc->generatePreview(QSize(width, height));
+ }
+ else
+ {
+ pix = m_doc->generatePreview(QSize(400, 400));
+ }
+
+ img = pix.convertToImage();
+ return true;
+}
+
+void KOfficeCreator::timerEvent(QTimerEvent *)
+{
+ m_doc->closeURL();
+ m_completed = true;
+}
+
+void KOfficeCreator::slotCompleted()
+{
+ m_completed = true;
+}
+
+ThumbCreator::Flags KOfficeCreator::flags() const
+{
+ return (Flags)(DrawFrame | BlendIcon);
+}
+
+#include "kofficecreator.moc"
+
diff --git a/tools/thumbnail/kofficecreator.h b/tools/thumbnail/kofficecreator.h
new file mode 100644
index 00000000..3481c2b5
--- /dev/null
+++ b/tools/thumbnail/kofficecreator.h
@@ -0,0 +1,49 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2002 Simon MacMullen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef _KWORDCREATOR_H_
+#define _KWORDCREATOR_H_ "$Id: kofficecreator.h 508787 2006-02-12 18:28:12Z ingwa $"
+
+#include <kio/thumbcreator.h>
+#include <kparts/part.h>
+#include "../../lib/kofficecore/KoDocument.h"
+
+class KoDocument;
+
+class KOfficeCreator : public QObject, public ThumbCreator
+{
+ Q_OBJECT
+public:
+ KOfficeCreator();
+ virtual ~KOfficeCreator();
+ virtual bool create(const QString &path, int width, int height, QImage &img);
+ virtual Flags flags() const;
+
+protected:
+ virtual void timerEvent(QTimerEvent *);
+
+private slots:
+ void slotCompleted();
+
+private:
+ KoDocument *m_doc;
+ bool m_completed;
+};
+
+#endif
diff --git a/tools/thumbnail/kofficethumbnail.desktop b/tools/thumbnail/kofficethumbnail.desktop
new file mode 100644
index 00000000..d15b5986
--- /dev/null
+++ b/tools/thumbnail/kofficethumbnail.desktop
@@ -0,0 +1,70 @@
+[Desktop Entry]
+Type=Service
+Name=KOffice Files
+Name[af]=Koffice Lêers
+Name[ar]=مِلفات KOffice
+Name[bg]=Файлове на KOffice
+Name[br]=Restroù KOffice
+Name[bs]=KOffice datoteke
+Name[ca]=Fitxers KOffice
+Name[cs]=Soubory KOffice
+Name[cy]=Ffeiliau KOffice
+Name[da]=KOffice-filer
+Name[de]=KOffice-Dateien
+Name[el]=Αρχεία KOffice
+Name[eo]=KOffice-dosieroj
+Name[es]=Archivos de KOffice
+Name[et]=KOffice'i failid
+Name[eu]=KOffice-en fitxategiak
+Name[fa]=پرونده‌های KOffice
+Name[fi]=KOffice-tiedostot
+Name[fo]=KSkrivstovu-fílir
+Name[fr]=Fichiers KOffice
+Name[fy]=KOffice-triemmen
+Name[ga]=Comhaid KOffice
+Name[gl]=Ficheiros de KOffice
+Name[he]=קבצי KOffice
+Name[hi]=के-ऑफ़िस फ़ाइलें
+Name[hr]=KOffice datoteke
+Name[hu]=KOffice-fájlok
+Name[is]=KOffice skrár
+Name[it]=File KOffice
+Name[ja]=KOffice ファイル
+Name[km]=​ឯកសារ KOffice
+Name[lo]=ແຟ້ມຂອງໂປຣແກມຊຸດສໍານັກງານ K
+Name[lt]=KOffice bylos
+Name[lv]=KOffice faili
+Name[ms]=Fail KOffice
+Name[mt]=Fajls tal-KOffice
+Name[nb]=KOffice-filer
+Name[nds]=KOffice-Dateien
+Name[ne]=केडीई कार्यालय फाइल
+Name[nl]=KOffice-bestanden
+Name[nn]=KOffice-filer
+Name[pa]=KOffice ਫਾਇਲਾਂ
+Name[pl]=Pliki KOffice
+Name[pt]=Ficheiros do KOffice
+Name[pt_BR]=Arquivos do KOffice
+Name[ro]=Fişiere KOffice
+Name[ru]=Файлы KOffice
+Name[se]=KOffice-fiillat
+Name[sk]=Súbory KOffice
+Name[sl]=Datoteke KOffice
+Name[sr]=KOffice-ови фајлови
+Name[sr@Latn]=KOffice-ovi fajlovi
+Name[sv]=Koffice-filer
+Name[ta]=KOffice கோப்புகள்
+Name[tg]=Файлҳои KOffice
+Name[th]=แฟ้มของโปรแกรมชุดสำนักงาน K
+Name[tr]=KOffice Dosyaları
+Name[uk]=Файли KOffice
+Name[uz]=KOffice fayllari
+Name[uz@cyrillic]=KOffice файллари
+Name[wa]=Fitchîs KOffice
+Name[xh]=Iifayile ze KOffice
+Name[zh_CN]=KOffice 文件
+Name[zh_TW]=KOffice 檔案
+ServiceTypes=ThumbCreator
+MimeTypes=application/x-kword,application/x-kspread,application/x-kpresenter,application/x-karbon,application/x-krita,application/x-kchart,application/vnd.oasis.opendocument.text,application/vnd.oasis.opendocument.text-template,application/vnd.oasis.opendocument.graphics,application/vnd.oasis.opendocument.graphics-template,application/vnd.oasis.opendocument.presentation,application/vnd.oasis.opendocument.presentation-template,application/vnd.oasis.opendocument.spreadsheet,application/vnd.oasis.opendocument.spreadsheet-template,application/vnd.oasis.opendocument.chart,application/vnd.oasis.opendocument.chart-template,application/vnd.oasis.opendocument.formula,application/vnd.oasis.opendocument.formula-template
+X-KDE-Library=kofficethumbnail
+CacheThumbnail=true
diff --git a/tools/thumbnail/otherofficethumbnail.desktop b/tools/thumbnail/otherofficethumbnail.desktop
new file mode 100644
index 00000000..1c515f6f
--- /dev/null
+++ b/tools/thumbnail/otherofficethumbnail.desktop
@@ -0,0 +1,69 @@
+[Desktop Entry]
+Type=Service
+Name=Other Office Files
+Name[af]=Ander Kantoor Lêers
+Name[ar]=مِلفات Office أخرى
+Name[bg]=Други офис файлове
+Name[br]=Restroù burev all
+Name[bs]=Druge Office datoteke
+Name[ca]=Altres fitxers d'oficina
+Name[cs]=Ostatní kancelářské soubory
+Name[cy]=Ffeiliau Eraill KOffice
+Name[da]=Andre office-filer
+Name[de]=Sonstige Office-Dateien
+Name[el]=Άλλα αρχεία γραφείου
+Name[eo]=Aliaj Oficejo-dosieroj
+Name[es]=Otros archivos de Office
+Name[et]=Muude Office'ite failid
+Name[eu]=Beste bulego-fitxategiak
+Name[fa]=‍‍‍‍‍‍دیگر پرونده‌های دفتری
+Name[fi]=Muut toimistotiedostot
+Name[fo]=Aðrar skrivstovufílir
+Name[fr]=Autres documents bureautiques
+Name[fy]=Oare office triemmen
+Name[gl]=Outros Ficheiros de KOffice
+Name[he]=קבצי Office אחרים
+Name[hi]=अन्य ऑफ़िस फ़ाइलें
+Name[hr]=Ostale Office datoteke
+Name[hu]=Egyéb Office-fájlok
+Name[is]=Aðrar skrifstofuskrár
+Name[it]=File di altri programmi Office
+Name[ja]=その他の Office ファイル
+Name[km]=ឯកសារ​ការិយាល័យ​ផ្សេង​ទៀត
+Name[lo]=ແຟ້ມໂປຣແກມຊຸດສໍານັກງານຕົວອື່ນ
+Name[lt]=Kitos ofisų bylos
+Name[lv]=Citi Office faili
+Name[ms]=Fail Office Lain
+Name[mt]=Fajls oħra tal-programmi KOffice
+Name[nb]=Andre Office-filer
+Name[nds]=Anner Kontoor-Dateien
+Name[ne]=अन्य कार्यालय फाइल
+Name[nl]=Overige office-bestanden
+Name[nn]=Andre Office-filer
+Name[pa]=ਹੋਰ ਦਫਤਰੀ ਫਾਇਲਾਂ
+Name[pl]=Inne pliki biurowe
+Name[pt]=Outros Ficheiros de Escritório
+Name[pt_BR]=Outros Arquivos Office
+Name[ro]=Alte fişiere KOffice
+Name[ru]=Другие файлы Office
+Name[se]=Eará Office-fiillat
+Name[sk]=Iné súbory Office
+Name[sl]=Druge pisarniške datoteke
+Name[sr]=Остали Office фајлови
+Name[sr@Latn]=Ostali Office fajlovi
+Name[sv]=Andra office-filer
+Name[ta]=Other Office கோப்புகள்
+Name[tg]=Дигар Office Файлҳо
+Name[th]=แฟ้มโปรแกรมสำนักงานตัวอื่น
+Name[tr]=Diğer Ofis Dosyaları
+Name[uk]=Інші файли KOffice
+Name[uz]=Idora uchun boshqa fayllar
+Name[uz@cyrillic]=Идора учун бошқа файллар
+Name[wa]=Ôtes fitchîs di buro
+Name[xh]=Ezinye Iifayile ze Office
+Name[zh_CN]=其它 Office 文件
+Name[zh_TW]=其他 Office 檔案
+ServiceTypes=ThumbCreator
+MimeTypes=application/illustrator,application/msexcel,application/mspowerpoint,application/msword,application/vnd.palm,application/wordperfect,application/x-abiword,application/x-amipro,application/x-applixgraphics,application/x-applixspread,application/x-applixword,application/x-gnumeric,application/x-quattropro,image/x-msod,text/rtf,text/vnd.wap.wml
+X-KDE-Library=kofficethumbnail
+CacheThumbnail=true