diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /filters/karbon/png | |
download | koffice-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 'filters/karbon/png')
-rw-r--r-- | filters/karbon/png/Makefile.am | 27 | ||||
-rw-r--r-- | filters/karbon/png/karbon_png_export.desktop | 67 | ||||
-rw-r--r-- | filters/karbon/png/pngexport.cc | 96 | ||||
-rw-r--r-- | filters/karbon/png/pngexport.h | 39 |
4 files changed, 229 insertions, 0 deletions
diff --git a/filters/karbon/png/Makefile.am b/filters/karbon/png/Makefile.am new file mode 100644 index 00000000..5d8a4efb --- /dev/null +++ b/filters/karbon/png/Makefile.am @@ -0,0 +1,27 @@ +kde_module_LTLIBRARIES = libkarbonpngexport.la + +libkarbonpngexport_la_LDFLAGS = $(KDE_PLUGIN) +libkarbonpngexport_la_LIBADD = \ + $(LIB_KOFFICEUI) \ + ../../../karbon/libkarboncommon.la + +INCLUDES = \ + $(KOFFICE_INCLUDES) $(KOPAINTER_INCLUDES) \ + -I$(top_srcdir)/karbon \ + -I$(top_srcdir)/karbon/core \ + -I$(top_srcdir)/karbon/render \ + -I$(top_srcdir)/karbon/visitors \ + $(all_includes) + +service_DATA = karbon_png_export.desktop +servicedir = $(kde_servicesdir) + +noinst_HEADERS = \ + pngexport.h + +libkarbonpngexport_la_SOURCES = \ + pngexport.cc + +libkarbonpngexport_la_METASOURCES = \ + AUTO + diff --git a/filters/karbon/png/karbon_png_export.desktop b/filters/karbon/png/karbon_png_export.desktop new file mode 100644 index 00000000..e3715bc0 --- /dev/null +++ b/filters/karbon/png/karbon_png_export.desktop @@ -0,0 +1,67 @@ +[Desktop Entry] +Icon= +Name=Karbon14 PNG Export Filter +Name[af]=Karbon14 Png Voer uit Filter +Name[ar]=مِرْشَح تصدير PNG لدى Karbon14 +Name[bg]=Филтър за експортиране от Karbon14 в PNG +Name[br]=Sil ezporzh PNG evit Karbon14 +Name[ca]=Filtre d'exportació PNG per a Karbon14 +Name[cs]=Exportní filtr do formátu PNG pro Karbon14 +Name[cy]=Hidlen Allforio PNG Karbon14 +Name[da]=Karbon14 SVG-eksportfilter +Name[de]=Karbon14 PNG-Exportfilter +Name[el]=Φίλτρο εξαγωγής PNG του Karbon14 +Name[eo]=Karbon-PNG-eksportfiltrilo +Name[es]=Filtro de exportación Karbon14 PNG +Name[et]=Karbon14 PNG ekspordifilter +Name[eu]=Karbon14-en PNG esportaziorako iragazkia +Name[fa]=پالایۀ صادرات Karbon14 PNG +Name[fi]=Karbon14 PNG -vientisuodin +Name[fr]=Filtre d'exportation PNG de Karbon 14 +Name[fy]=PNG-Eksportfilter foar Karbon14 +Name[ga]=Scagaire Easpórtála PNG Karbon14 +Name[gl]=Filtro de Exportación de PNG para Karbon14 +Name[he]=מסנן ייצוא מ־Karbon14 ל־PNG +Name[hr]=Karbon14 SVG filtar izvoza +Name[hu]=Karbon14 PNG exportszűrő +Name[is]=Karbon14 PNG útflutningssía +Name[it]=Filtro di esportazione PNG per Karbon14 +Name[ja]=Karbon14 PNG エクスポートフィルタ +Name[km]=តម្រងនាំចេញ PNG សម្រាប់ Karbon14 +Name[lo]=ຕົວຕອງການສົ່ງອອກ PNG ຂອງ Karbon14 +Name[lt]=Karbon14 PNG eksportavimo filtras +Name[lv]=Karbon14 PNG eksporta filtrs +Name[ms]=Penapis Eksport Karbon14 PNG +Name[mt]=Filtru għall-esportazzjoni ta' PNG minn ġo Karbon14 +Name[nb]=PNG-eksportfilter for Karbon14 +Name[nds]=PNG-Exportfilter för Karbon14 +Name[ne]=कार्बन१४ पीएनजी निर्यात फिल्टर +Name[nl]=PNG-exportfilter voor Karbon14 +Name[nn]=PNG-eksportfilter for Karbon14 +Name[pl]=Filtr eksportu do formatu PNG z Karbon14 +Name[pt]=Filtro de Exportação de PNG para o Karbon14 +Name[pt_BR]=Filtro de Exportação PNG do Karbon14 +Name[ro]=Filtru exportare Karbon14 pentru SVG +Name[ru]=Фильтр экспорта рисунков Karbon в PNG +Name[se]=Karbon14:a PNG-olggosfievrridansilli +Name[sk]=PNG filter pre export z Karbon14 +Name[sl]=Izvozni filter PNG za Karbon14 +Name[sr]=Karbon14-ов филтер за извоз у PNG +Name[sr@Latn]=Karbon14-ov filter za izvoz u PNG +Name[sv]=Karbon14 PNG-exportfilter +Name[ta]=Karbon 14 PNG S ஏற்றுமதி வடிகட்டி +Name[tg]=Karbon14 PNG Филтри Содирот +Name[th]=ตัวกรองการส่งออก PNG ของ Karbon14 +Name[tr]=Karbon14 PNG Aktarma Filtresi +Name[uk]=Фільтр експорту SVG для Karbon14 +Name[uz]=Karbon14 PNG eksport filteri +Name[uz@cyrillic]=Karbon14 PNG экспорт филтери +Name[xh]=Isihluzi Sokurhweba ngaphandle se Karbon14 PNG +Name[zh_CN]=Karbon14 PNG 导出过滤器 +Name[zh_TW]=Karbon14 EPS 匯出過濾程式 +ServiceTypes=KOfficeFilter +Type=Service +X-KDE-Export=image/png +X-KDE-Import=application/x-karbon +X-KDE-Library=libkarbonpngexport +X-KDE-Weight=1 diff --git a/filters/karbon/png/pngexport.cc b/filters/karbon/png/pngexport.cc new file mode 100644 index 00000000..652074e9 --- /dev/null +++ b/filters/karbon/png/pngexport.cc @@ -0,0 +1,96 @@ +/* This file is part of the KDE project + Copyright (C) 2002, The Karbon Developers + + 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. +*/ + +#include <qcstring.h> +#include <qdom.h> +#include <qfile.h> +#include <qstring.h> +#include <qvaluelist.h> +#include <qimage.h> + +#include <kgenericfactory.h> +#include <KoFilter.h> +#include <KoFilterChain.h> +#include <KoStore.h> + +#include "pngexport.h" +#include "vdocument.h" +#include "vselection.h" +#include "vkopainter.h" +#include "vlayer.h" +#include "vcomputeboundingbox.h" + +#include <kdebug.h> + + +typedef KGenericFactory<PngExport, KoFilter> PngExportFactory; +K_EXPORT_COMPONENT_FACTORY( libkarbonpngexport, PngExportFactory( "kofficefilters" ) ) + + +PngExport::PngExport( KoFilter*, const char*, const QStringList& ) + : KoFilter() +{ +} + +KoFilter::ConversionStatus +PngExport::convert( const QCString& from, const QCString& to ) +{ + if ( to != "image/png" || from != "application/x-karbon" ) + { + return KoFilter::NotImplemented; + } + + KoStoreDevice* storeIn = m_chain->storageFile( "root", KoStore::Read ); + if( !storeIn ) + return KoFilter::StupidError; + + QDomDocument domIn; + domIn.setContent( storeIn ); + QDomElement docNode = domIn.documentElement(); + + // load the document and export it: + VDocument doc; + doc.load( docNode ); + + // calculate the documents bounding box + VComputeBoundingBox bbox( true ); + doc.accept( bbox ); + const KoRect &rect = bbox.boundingRect(); + + // create image with correct width and height + QImage img( int( rect.width() ), int( rect.height() ), 32 ); + //img.setAlphaBuffer( true ); + + // Create painter and set up objects to draw + VKoPainter p( img.bits(), rect.width(), rect.height() ); + p.clear( qRgba( 0xFF, 0xFF, 0xFF, 0xFF ) ); + p.setWorldMatrix( QWMatrix().translate( -rect.x(), -rect.y() ) ); + + doc.draw( &p, &rect ); + + QImage image = img.swapRGB(); + QImage mirrored = image.mirror( false, true ); + // save png + mirrored.save( m_chain->outputFile(), "PNG" ); + + return KoFilter::OK; +} + +#include "pngexport.moc" + diff --git a/filters/karbon/png/pngexport.h b/filters/karbon/png/pngexport.h new file mode 100644 index 00000000..a14e81c8 --- /dev/null +++ b/filters/karbon/png/pngexport.h @@ -0,0 +1,39 @@ +/* This file is part of the KDE project + Copyright (C) 2002, The Karbon Developers + + 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 __PNGEXPORT_H__ +#define __PNGEXPORT_H__ + +#include <KoFilter.h> + +#include "vvisitor.h" + +class PngExport : public KoFilter, private VVisitor +{ + Q_OBJECT + +public: + PngExport( KoFilter* parent, const char* name, const QStringList& ); + virtual ~PngExport() {} + + virtual KoFilter::ConversionStatus convert( const QCString& from, const QCString& to ); +}; + +#endif + |