ppdloader.h
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2001-2003 Michael Goffioul <kdeprint@swing.be> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 **/ 00019 00020 #ifndef PPDLOADER_H 00021 #define PPDLOADER_H 00022 00023 #include <tqvaluestack.h> 00024 #include <tqstring.h> 00025 #include <tqstringlist.h> 00026 #include <tqvariant.h> 00027 #include <tqdict.h> 00028 00029 #include <kdelibs_export.h> 00030 00031 class DrGroup; 00032 class DrBase; 00033 class DrMain; 00034 struct PS_private; 00035 00036 class KDEPRINT_EXPORT PPDLoader 00037 { 00038 public: 00039 PPDLoader(); 00040 ~PPDLoader(); 00041 00042 DrMain* readFromFile( const TQString& filename ); 00043 00044 bool openUi( const TQString& name, const TQString& desc, const TQString& type ); 00045 bool endUi( const TQString& name ); 00046 bool openGroup( const TQString& name, const TQString& desc ); 00047 bool endGroup( const TQString& name ); 00048 bool putStatement( const TQString& keyword, const TQString& name, const TQString& desc, const TQStringList& values ); 00049 bool putStatement2( const TQString& keyword, const TQString& value ); 00050 bool putDefault( const TQString& keyword, const TQString& value ); 00051 bool putConstraint( const TQString& opt1, const TQString& opt2, const TQString& ch1, const TQString& ch2 ); 00052 bool putFooData( const TQString& data ); 00053 bool putFooProcessedData( const TQVariant& var ); 00054 bool putPaperDimension( const TQString& name, const TQString& s ); 00055 bool putImageableArea( const TQString& name, const TQString& s ); 00056 00057 void setErrorMsg( const TQString& msg ); 00058 TQString errorMsg() const; 00059 00060 static DrMain* loadDriver( const TQString& filename, TQString* msg = NULL ); 00061 00062 private: 00063 TQValueStack<DrGroup*> m_groups; 00064 DrBase* m_option; 00065 TQDict<PS_private> m_ps; 00066 TQStringList m_fonts; 00067 TQString m_errormsg; 00068 00069 friend int kdeprint_ppdparse(void*); 00070 DrGroup* findOrCreateGroupForOption( const TQString& ); 00071 void processPageSizes( DrMain* ); 00072 }; 00073 00074 #endif /* PPDLOADER_H */