kscan.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 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 KSCAN_H 00021 #define KSCAN_H 00022 00023 #include <kdialogbase.h> 00024 #include <kinstance.h> 00025 #include <klibloader.h> 00026 00027 class TQImage; 00028 00063 class TDEIO_EXPORT KScanDialog : public KDialogBase 00064 { 00065 Q_OBJECT 00066 00067 public: 00078 static KScanDialog * getScanDialog( TQWidget *parent=0L, 00079 const char *name=0, bool modal=false ); 00083 ~KScanDialog(); 00084 00093 virtual bool setup(); 00094 00095 protected: 00108 KScanDialog( int dialogFace=Tabbed, int buttonMask = Close|Help, 00109 TQWidget *parent=0L, const char *name=0, bool modal=false ); 00110 00122 int id() const { return m_currentId; } 00123 00135 int nextId() { return ++m_currentId; } 00136 00137 signals: 00143 void preview( const TQImage &img, int id ); 00144 00154 void finalImage( const TQImage &img, int id ); 00155 00164 void textRecognized( const TQString &text, int id ); 00165 00166 private: 00167 int m_currentId; 00168 00169 protected: 00170 virtual void virtual_hook( int id, void* data ); 00171 private: 00172 class KScanDialogPrivate; 00173 KScanDialogPrivate *d; 00174 }; 00175 00176 00182 class TDEIO_EXPORT KScanDialogFactory : public KLibFactory 00183 { 00184 public: 00185 virtual ~KScanDialogFactory(); 00186 00194 virtual KScanDialog * createDialog( TQWidget *parent=0, const char *name=0, 00195 bool modal=false ) = 0; 00196 00197 protected: 00203 KScanDialogFactory( TQObject *parent=0, const char *name=0 ); 00204 00205 virtual TQObject* createObject( TQObject* parent = 0, const char* name = 0, 00206 const char* classname = TQOBJECT_OBJECT_NAME_STRING, 00207 const TQStringList &args = TQStringList() ); 00208 00209 00214 void setName( const TQCString& instanceName ) { 00215 delete m_instance; 00216 m_instance = new TDEInstance( instanceName ); 00217 } 00218 00223 TDEInstance *instance() const { return m_instance; } 00224 00225 private: 00226 TDEInstance *m_instance; 00227 protected: 00228 virtual void virtual_hook( int id, void* data ); 00229 private: 00230 class KScanDialogFactoryPrivate* d; 00231 }; 00232 00236 class TDEIO_EXPORT KOCRDialog : public KDialogBase 00237 { 00238 Q_OBJECT 00239 00240 public: 00251 static KOCRDialog * getOCRDialog( TQWidget *parent=0L, 00252 const char *name=0, bool modal=false ); 00253 ~KOCRDialog(); 00254 00255 protected: 00267 KOCRDialog( int dialogFace=Tabbed, int buttonMask = Close|Help, 00268 TQWidget *parent=0L, const char *name=0, bool modal=false ); 00269 00279 int id() const { return m_currentId; } 00280 00289 int nextId() { return ++m_currentId; } 00290 00291 signals: 00300 void textRecognized( const TQString &text, int id ); 00301 00302 private: 00303 int m_currentId; 00304 00305 protected: 00306 virtual void virtual_hook( int id, void* data ); 00307 private: 00308 class KOCRDialogPrivate; 00309 KOCRDialogPrivate *d; 00310 }; 00311 00312 00318 class TDEIO_EXPORT KOCRDialogFactory : public KLibFactory 00319 { 00320 public: 00321 virtual ~KOCRDialogFactory(); 00322 00330 virtual KOCRDialog * createDialog( TQWidget *parent=0, const char *name=0, 00331 bool modal=false ) = 0; 00332 00333 protected: 00339 KOCRDialogFactory( TQObject *parent=0, const char *name=0 ); 00340 00341 virtual TQObject* createObject( TQObject* parent = 0, const char* name = 0, 00342 const char* className = TQOBJECT_OBJECT_NAME_STRING, 00343 const TQStringList &args = TQStringList() ); 00344 00345 00350 void setName( const TQCString& instanceName ) { 00351 delete m_instance; 00352 m_instance = new TDEInstance( instanceName ); 00353 } 00354 00359 TDEInstance *instance() const { return m_instance; } 00360 00361 private: 00362 TDEInstance *m_instance; 00363 protected: 00364 virtual void virtual_hook( int id, void* data ); 00365 private: 00366 class KOCRDialogFactory* d; 00367 }; 00368 00369 00370 #endif // KSCAN_H