kprinterimpl.h
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be> 00004 * 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License version 2 as published by the Free Software Foundation. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 **/ 00020 00021 #ifndef KPRINTERIMPL_H 00022 #define KPRINTERIMPL_H 00023 00024 #include <tqobject.h> 00025 #include <tqstringlist.h> 00026 #include <tqmap.h> 00027 #include <tqptrlist.h> 00028 00029 #include <kdelibs_export.h> 00030 00031 class KPrinter; 00032 class KMPrinter; 00033 00034 class KDEPRINT_EXPORT KPrinterImpl : public TQObject 00035 { 00036 Q_OBJECT 00037 public: 00038 KPrinterImpl(TQObject *parent = 0, const char *name = 0); 00039 virtual ~KPrinterImpl(); 00040 00041 virtual bool setupCommand(TQString& cmd, KPrinter*); 00042 virtual void preparePrinting(KPrinter*); 00043 virtual void broadcastOption(const TQString& key, const TQString& value); 00044 00045 bool printFiles(KPrinter*, const TQStringList&, bool removeflag = false); 00046 // result: 00047 // -1 -> error 00048 // 0 -> nothing happened 00049 // 1 -> files filterd 00050 int filterFiles(KPrinter*, TQStringList&, bool removeflag = false); 00051 int autoConvertFiles(KPrinter*, TQStringList&, bool removeflag = false); 00052 void saveOptions(const TQMap<TQString,TQString>& opts); 00053 const TQMap<TQString,TQString>& loadOptions() const { return m_options; } 00054 TQString tempFile(); 00055 TQString quote(const TQString&); 00056 void statusMessage(const TQString&, KPrinter* = 0); 00057 00058 protected: 00059 bool startPrinting(const TQString& cmd, KPrinter *printer, const TQStringList& files, bool removeflag = false); 00060 int dcopPrint(const TQString& cmd, const TQStringList& files, bool removeflag = false); 00061 bool setupSpecialCommand(TQString&, KPrinter*, const TQStringList&); 00062 int doFilterFiles(KPrinter* pr, TQStringList& files, const TQStringList& flist, const TQMap<TQString,TQString>& opts, bool removeflag = false); 00063 void loadAppOptions(); 00064 void saveAppOptions(); 00065 00066 protected: 00067 TQMap<TQString,TQString> m_options; // use to save current options 00068 }; 00069 00070 #endif