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 <qvaluestack.h>
00024 #include <qstring.h>
00025 #include <qstringlist.h>
00026 #include <qvariant.h>
00027 #include <qdict.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 QString& filename );
00043 
00044     bool openUi( const QString& name, const QString& desc, const QString& type );
00045     bool endUi( const QString& name );
00046     bool openGroup( const QString& name, const QString& desc );
00047     bool endGroup( const QString& name );
00048     bool putStatement( const QString& keyword, const QString& name, const QString& desc, const QStringList& values );
00049     bool putStatement2( const QString& keyword, const QString& value );
00050     bool putDefault( const QString& keyword, const QString& value );
00051     bool putConstraint( const QString& opt1, const QString& opt2, const QString& ch1, const QString& ch2 );
00052     bool putFooData( const QString& data );
00053     bool putFooProcessedData( const QVariant& var );
00054     bool putPaperDimension( const QString& name, const QString& s );
00055     bool putImageableArea( const QString& name, const QString& s );
00056 
00057     void setErrorMsg( const QString& msg );
00058     QString errorMsg() const;
00059 
00060     static DrMain* loadDriver( const QString& filename, QString* msg = NULL );
00061 
00062 private:
00063     QValueStack<DrGroup*> m_groups;
00064     DrBase*               m_option;
00065     QDict<PS_private>     m_ps;
00066     QStringList           m_fonts;
00067     QString               m_errormsg;
00068 
00069     friend int kdeprint_ppdparse(void*);
00070     DrGroup* findOrCreateGroupForOption( const QString& );
00071     void processPageSizes( DrMain* );
00072 };
00073 
00074 #endif /* PPDLOADER_H */
KDE Home | KDE Accessibility Home | Description of Access Keys