Eneboo - Documentación para desarrolladores
src/flbase/FLObjectFactory.h
Ir a la documentación de este archivo.
00001 /***************************************************************************
00002  FLObjectFactory.h
00003  -------------------
00004  begin                : jue abr 23 2003
00005  copyright            : (C) 2003-2008 by InfoSiAL S.L.
00006  email                : mail@infosial.com
00007  ***************************************************************************/
00008 /***************************************************************************
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; version 2 of the License.               *
00012  ***************************************************************************/
00013 /***************************************************************************
00014  Este  programa es software libre. Puede redistribuirlo y/o modificarlo
00015  bajo  los  términos  de  la  Licencia  Pública General de GNU   en  su
00016  versión 2, publicada  por  la  Free  Software Foundation.
00017  ***************************************************************************/
00018 
00019 #ifndef FLOBJECTFACTORY_H
00020 #define FLOBJECTFACTORY_H
00021 
00022 #include "FLApplication.h"
00023 #include "FLSqlCursor.h"
00024 #include "FLSqlQuery.h"
00025 #include "FLUtil.h"
00026 #include "FLTableMetaData.h"
00027 #include "FLFormDB.h"
00028 #include "FLFormRecordDB.h"
00029 #include "FLFormSearchDB.h"
00030 #include "FLFieldDB.h"
00031 #include "FLTableDB.h"
00032 #include "FLDataTable.h"
00033 #include "FLManager.h"
00034 #include "FLManagerModules.h"
00035 #include "FLReportViewer.h"
00036 #include "FLReportEngine.h"
00037 #include "FLReportPages.h"
00038 #include "FLCodBar.h"
00039 #include "FLScriptEditor.h"
00040 #include "FLAction.h"
00041 #include "FLVar.h"
00042 #include "FLAccessControlLists.h"
00043 #include "FLSqlDatabase.h"
00044 #include "posprinter.h"
00045 #include "FLSqlConnections.h"
00046 #include "FLSmtpClient.h"
00047 #include "FLImageViewer.h"
00048 #include "FLPicture.h"
00049 #include "FLDiskCache.h"
00050 #include "FLNetwork.h"
00051 #include "FLTable.h"
00052 #include "mimecodec.h"
00053 #include "qextserialport.h"
00054 #include "FLDigiDoc.h"
00055 
00056 #include "AQConfig.h"
00057 
00058 #include <qsobjectfactory.h>
00059 #include <qapplication.h>
00060 #include <qdatetime.h>
00061 #include <qtable.h>
00062 #include <qlistview.h>
00063 #include <qdom.h>
00064 #include <qtabwidget.h>
00065 #include <qptrdict.h>
00066 
00067 class FLDomNodeInterface;
00068 class FLDomNodesCache;
00069 class FLSqlQueryInterface;
00070 
00071 #define DN_ ( dn_ ? dn_ : newNode() )
00072 
00073 
00075 
00081 class  FLApplicationInterface : public QObject
00082 {
00083 
00084   Q_OBJECT
00085   Q_ENUMS(FLScaleMode)
00086 
00087 public:
00088 
00089   enum FLScaleMode {
00090     ScaleFree,
00091     ScaleMin,
00092     ScaleMax
00093   };
00094 
00098   FLApplicationInterface(FLApplication *obj) : QObject(obj) {
00099     obj_ = obj;
00100     connect(obj_, SIGNAL(databaseLockDetected()), this, SIGNAL(databaseLockDetected()));
00101   }
00102 
00103 public slots:
00104 
00110   QWidget *mainWidget() const {
00111     return obj_->mainWidget();
00112   }
00113 
00117   QWidget *modMainWidget(const QString &idModulo) const {
00118     return obj_->modMainWidget(idModulo);
00119   }
00120 
00124   void statusHelpMsg(const QString &text) {
00125     obj_->statusHelpMsg(text);
00126   }
00127 
00134   void openMasterForm(const QString &n, const QPixmap &p = QPixmap()) {
00135     obj_->openMasterForm(n, p);
00136   }
00137 
00143   void execMainScript(const QString &n) {
00144     obj_->execMainScript(n);
00145   }
00146 
00150   void processEvents() {
00151     obj_->processEvents();
00152   }
00153 
00162   QString getWidgetList(const QString &wN, const QString &c) {
00163     return obj_->getWidgetList(wN, c);
00164   }
00165 
00174   QString getTabWidgetPages(const QString &wN, const QString &n) {
00175     return obj_->getTabWidgetPages(wN, n);
00176   }
00177 
00183   QString installPrefix() {
00184     return AQ_PREFIX;
00185   }
00186 
00191   QString diskCacheAbsDirPath() {
00192     return AQ_DISKCACHE_DIRPATH;
00193   }
00194 
00200   QString version() {
00201     return AQ_VERSION;
00202   }
00203 
00207   void updateAreas() {
00208     obj_->initToolBox();
00209   }
00210 
00218   bool isLoadedModule(const QString &idM, const QString &connName = "default") {
00219     return FLSqlConnections::database(connName)->managerModules()->listAllIdModules().contains(idM);
00220   }
00221 
00227   bool isDebugEnabled() {
00228 #ifdef FL_DEBUG
00229     return true;
00230 #endif
00231     return false;
00232   }
00233 
00239   bool isTestEnabled() {
00240     return false;
00241   }
00242 
00250   QString versionModule(const QString &idM, const QString &connName = "default") {
00251     return FLSqlConnections::database(connName)->managerModules()->versionModule(idM);
00252   }
00253 
00257   QString nameObjectScript(const QString &nFS) {
00258     qWarning("nameObjectScript: OBSOLETA no usar");
00259     return QString::null;
00260   }
00261 
00267   void showDocPage(const QString &url) {
00268     obj_->showDocPage(url);
00269   }
00270 
00278   QSArgument call(const QString &function, const QSArgumentList &arguments = QSArgumentList(),
00279                   const QString &nameObjectContext = QString::null) {
00280     return obj_->call(function, arguments, nameObjectContext);
00281   }
00282 
00289   QSArgument call(const QString &function, const QString &nameObjectContext) {
00290     return obj_->call(function, QSArgumentList(), nameObjectContext);
00291   }
00292 
00301   void setCaptionMainWidget(const QString &text) {
00302     obj_->setCaptionMainWidget(text);
00303   }
00304 
00308   QString lastTextCaption() const {
00309     return obj_->lastTextCaption();
00310   }
00311 
00318   QString nameDriver(const QString &connName = "default") const {
00319     return FLSqlConnections::database(connName)->driverName();
00320   }
00321 
00328   QString nameUser(const QString &connName = "default") const {
00329     return FLSqlConnections::database(connName)->user();
00330   }
00331 
00338   QString nameBD(const QString &connName = "default") const {
00339     return FLSqlConnections::database(connName)->database();
00340   }
00341 
00348   QString nameHost(const QString &connName = "default") const {
00349     return FLSqlConnections::database(connName)->host();
00350   }
00351 
00358   int portBD(const QString &connName = "default") const {
00359     return FLSqlConnections::database(connName)->port();
00360   }
00361 
00367   void installACL(const QString &idacl) {
00368     FLAccessControlLists *acl = obj_->acl();
00369     if (acl)
00370       acl->installACL(idacl);
00371   }
00372 
00378   QString idSession() {
00379     return aqApp ->timeUser().toString(Qt::ISODate);
00380   }
00381 
00387   void printTextEdit(QTextEdit *editor) {
00388     obj_->printTextEdit(editor);
00389   }
00390 
00397   void reinit() {
00398     QTimer::singleShot(0, obj_, SLOT(reinit()));
00399   }
00400 
00407   void cleanupMetaData(const QString &connName = "default") {
00408     FLSqlConnections::database(connName)->manager()->cleanupMetaData();
00409   }
00410 
00416   void Mr_Proper(const QString &connName = "default") {
00417     FLSqlConnections::database(connName)->Mr_Proper();
00418   }
00419 
00435   bool addDatabase(const QString &driverAlias, const QString &nameDB, const QString &user,
00436                    const QString &password, const QString &host, int port, const QString &connectionName) {
00437     return FLSqlConnections::addDatabase(driverAlias, nameDB, user, password, host, port, connectionName);
00438   }
00439 
00447   bool addDatabase(const QString &newConnName, const QString &sourceConnName = "default") {
00448     FLSqlDatabase *srcDb = FLSqlConnections::database(sourceConnName);
00449     if (!srcDb)
00450       return false;
00451     return FLSqlConnections::addDatabase(srcDb->driverName(), srcDb->database(),
00452                                          srcDb->user(), srcDb->password(), srcDb->host(),
00453                                          srcDb->port(), newConnName);
00454   }
00455 
00464   bool removeDatabase(const QString &connectionName) {
00465     return FLSqlConnections::removeDatabase(connectionName);
00466   }
00467 
00474   QString toUnicode(const QString &text, const QString &codecName) {
00475     QTextCodec *codec = QTextCodec::codecForName(codecName);
00476     if (codec) {
00477       return codec->toUnicode(text);
00478     } else {
00479       return text;
00480     }
00481   }
00482 
00489   QCString fromUnicode(const QString &text, const QString &codecName) {
00490     QTextCodec *codec = QTextCodec::codecForName(codecName);
00491     if (codec)
00492       return codec->fromUnicode(text);
00493     else
00494       return text.utf8();
00495   }
00496 
00498   QCString canonicalForm(const QString &str) {
00499     return MIMECodec::canonicalForm(str.ascii());
00500   }
00501 
00503   QString mimeTranslate(const QString &str) {
00504     return MIMECodec::translate(str.ascii());
00505   }
00506 
00508   QCString fold(const QString &str) {
00509     return MIMECodec::fold(str.ascii());
00510   }
00511 
00513   QCString unfold(const QString &str) {
00514     return MIMECodec::unfold(str.ascii());
00515   }
00516 
00518   QCString encodeEndLine(const QString &str) {
00519     return MIMECodec::encodeEndLine(str.ascii());
00520   }
00521 
00523   QCString decodeEndLine(const QString &str) {
00524     return MIMECodec::decodeEndLine(str.ascii());
00525   }
00526 
00528   QCString encodeQuotedPrintable(const QString &str, bool compat = false) {
00529     return MIMECodec::encodeQuotedPrintable(str.ascii(), compat);
00530   }
00531 
00533   QCString decodeQuotedPrintable(const QString &str) {
00534     return MIMECodec::decodeQuotedPrintable(str.ascii());
00535   }
00536 
00544   QString dialogGetFileImage();
00545 
00549   QPixmap toPixmap(const QVariant &v);
00550   QPixmap toPixmap(const QString &s) {
00551     return toPixmap(QVariant(s));
00552   }
00553 
00557   QVariant fromPixmap(const QPixmap &p);
00558 
00562   QPixmap scalePixmap(const QPixmap &p, int w, int h,
00563                       FLScaleMode mode = FLApplicationInterface::ScaleFree);
00564 
00568   QPixmap pixmapFromMimeSource(const QString &abs_name) {
00569     return QPixmap::fromMimeSource(abs_name);
00570   }
00571 
00575   int transactionLevel() {
00576     return FLSqlCursor::transactionLevel();
00577   }
00578 
00587   bool addSysCode(const QString &code, const QString &scriptEntryFunction = QString::null) {
00588     return obj_->addSysCode(code, scriptEntryFunction);
00589   }
00590 
00594   void setScriptEntryFunction(const QString &scriptEntryFunction) {
00595     obj_->setScriptEntryFunction(scriptEntryFunction);
00596   }
00597 
00618   void setDatabaseLockDetection(bool on = true, int msecLapsus = 30000, int limChecks = -1,
00619                                 bool showWarn = true, const QString &msgWarn = QString::null,
00620                                 const QString &connectionName = "default") {
00621     obj_->setDatabaseLockDetection(on, msecLapsus, limChecks, showWarn, msgWarn, connectionName);
00622   }
00623 
00643   QStringList locksStatus(const QString &connectionName = "default") {
00644     return FLSqlConnections::database(connectionName)->locksStatus();
00645   }
00646 
00655   QStringList detectLocks(const QString &connectionName = "default") {
00656     return FLSqlConnections::database(connectionName)->detectLocks();
00657   }
00658 
00671   QStringList detectRisksLocks(const QString &table = QString::null, const QString &primaryKeyValue = QString::null,
00672                                const QString &connectionName = "default") {
00673     return FLSqlConnections::database(connectionName)->detectRisksLocks(table, primaryKeyValue);
00674   }
00675 
00694   void popupWarn(const QString &msgWarn,
00695                  const QMap<QString, QVariant> &scriptCalls);
00696 
00700   FLDomNodeInterface *toXmlReportData(FLSqlQueryInterface *q);
00701 
00712   QString translate(const QString &contexto, const QString &s) const {
00713     return obj_->translate(contexto, s);
00714   }
00715   QString translate(const QString &s) const {
00716     return obj_->translate("scripts", s);
00717   }
00718 
00726   QString trMulti(const QString &s, const QString &l) {
00727     return obj_->trMulti(s, l);
00728   }
00729 
00741   void setMultiLang(bool enable = true, const QString &langid = QString::null) {
00742     obj_->setMultiLang(enable, langid);
00743   }
00744 
00748   bool multiLangEnabled() const {
00749     return obj_->multiLangEnabled();
00750   }
00751 
00755   QString multiLangId() const {
00756     return obj_->multiLangId();
00757   }
00758 
00762   void openQSWorkbench() {
00763     obj_->openQSWorkbench();
00764   }
00765 
00772   void evaluateProject() {
00773     obj_->evaluateProject();
00774   }
00775 
00776   QString osName() const {
00777     return FLUtil::getOS();
00778   }
00779 
00780   QString localLang() const {
00781     return FLUtil::getIdioma();
00782   }
00783 
00784   QString localEncoding() const {
00785     QTextCodec *codec = QTextCodec::codecForLocale();
00786     return (codec ? codec->mimeName() : "");
00787   }
00788 
00789   bool isQuickBuild() const {
00790 #ifdef AQ_QUICK_BUILD
00791     return true;
00792 #endif
00793     return false;
00794   }
00795 
00796   bool isDebuggerBuild() const {
00797 #ifdef AQ_DEBUGGER_BUILD
00798     return true;
00799 #endif
00800     return false;
00801   }
00802 
00803   bool isNebulaBuild() const {
00804 #ifdef AQ_NEBULA_BUILD
00805     return true;
00806 #endif
00807     return false;
00808   }
00809 
00810   FLApplication *obj() {
00811     return obj_;
00812   }
00813 
00814 signals:
00815 
00819   void databaseLockDetected();
00820 
00821 private:
00822 
00823   FLApplication *obj_;
00824 };
00825 
00826 class FLSqlCursorsCache;
00827 
00829 
00835 class  FLSqlCursorInterface : public QObject
00836 {
00837   Q_OBJECT
00838   Q_ENUMS(Mode)
00839   Q_ENUMS(AcosConditionEval)
00840 
00841 public:
00842 
00843   enum Mode {
00844     Insert = 0,
00845     Edit = 1,
00846     Del = 2,
00847     Browse = 3
00848   };
00849 
00850   enum AcosConditionEval {
00851     Value = 0,
00852     Regexp = 1,
00853     Function = 2
00854   };
00855 
00859   FLSqlCursorInterface(const QString &n = QString::null,
00860                        const QString &connName = "default") :
00861     QObject(0), obj_(0), cursorRelation_(0), cached_(false) {
00862     if (!n.isEmpty()) {
00863       obj_ = new FLSqlCursor(n, true, connName, 0, 0, this);
00864       if (obj_->cursorRelation())
00865         cursorRelation_ = sqlCursorInterface(obj_->cursorRelation());
00866       connects();
00867     }
00868   }
00869 
00873   FLSqlCursorInterface(QObject *obj) :
00874     QObject(obj), obj_(0), cursorRelation_(0), cached_(false) {
00875     setObj(::qt_cast<FLSqlCursor *>(obj));
00876   }
00877 
00881   ~FLSqlCursorInterface() {
00882     if (cached_ && obj_)
00883       removeCache();
00884   }
00885 
00891   void setObj(FLSqlCursor *obj);
00892 
00896   static FLSqlCursorInterface *sqlCursorInterface(FLSqlCursor *c);
00897 
00898 public slots:
00899 
00905   int modeAccess() const {
00906     return (obj_ ? obj_->modeAccess() : 0);
00907   }
00908 
00914   bool setEditMode() {
00915     return (obj_ ? obj_->setEditMode() : false);
00916   }
00917 
00923   QString mainFilter() const {
00924     return (obj_ ? obj_->mainFilter() : QString::null);
00925   }
00926 
00932   void setMainFilter(const QString &f) {
00933     if (obj_)
00934       obj_->setMainFilter(QString(f).replace("NaN", ""));
00935   }
00936 
00942   void setModeAccess(const int m) {
00943     if (obj_)
00944       obj_->setModeAccess(m);
00945   }
00946 
00959   void setAtomicValueBuffer(const QString &fN, const QString &functionName) {
00960     if (obj_)
00961       obj_->setAtomicValueBuffer(fN, functionName);
00962   }
00963 
00970   void setValueBuffer(const QString &fN, const QVariant &v) {
00971     if (obj_) {
00972       if (v.isValid() && !v.isNull()) {
00973         if (v.toString().upper() == "NAN") {
00974           obj_->setValueBuffer(fN, QVariant());
00975           return;
00976         }
00977       }
00978       obj_->setValueBuffer(fN, v);
00979     }
00980   }
00981   void setValueBuffer(const QString &fN, const QString &v) {
00982     setValueBuffer(fN, QVariant(v));
00983   }
00984   void setValueBuffer(const QString &fN, bool v) {
00985     setValueBuffer(fN, QVariant(v));
00986   }
00987   void setValueBuffer(const QString &fN, double v) {
00988     setValueBuffer(fN, QVariant(v));
00989   }
00990   void setValueBuffer(const QString &fN, int v) {
00991     setValueBuffer(fN, QVariant(v));
00992   }
00993 
00999   QVariant valueBuffer(const QString &fN) const {
01000     return (obj_ ? obj_->valueBuffer(fN) : QVariant());
01001   }
01002 
01008   QVariant valueBufferCopy(const QString &fN) const {
01009     return (obj_ ? obj_->valueBufferCopy(fN) : QVariant());
01010   }
01011 
01017   bool isNull(const QString &name) const {
01018     return (obj_ ? obj_->bufferIsNull(name) : false);
01019   }
01020 
01026   void setNull(const QString &name) {
01027     if (obj_)
01028       obj_->bufferSetNull(name);
01029   }
01030 
01036   bool isCopyNull(const QString &name) const {
01037     return (obj_ ? obj_->bufferCopyIsNull(name) : false);
01038   }
01039 
01045   void setCopyNull(const QString &name) {
01046     if (obj_)
01047       obj_->bufferCopySetNull(name);
01048   }
01049 
01055   void setEdition(bool b) {
01056     if (obj_)
01057       obj_->setEdition(b);
01058   }
01059 
01065   void setBrowse(bool b) {
01066     if (obj_)
01067       obj_->setBrowse(b);
01068   }
01069 
01082   bool fieldDisabled(const QString &fN) {
01083     return (obj_ ? obj_->fieldDisabled(fN) : false);
01084   }
01085 
01091   bool inTransaction() {
01092     return (obj_ ? obj_->inTransaction() : false);
01093   }
01094 
01104   bool transaction(bool lock) {
01105     return (obj_ ? obj_->transaction(lock) : false);
01106   }
01107 
01113   bool rollback() {
01114     return (obj_ ? obj_->rollback() : false);
01115   }
01116 
01124   bool commit() {
01125     return (obj_ ? obj_->commit() : false);
01126   }
01127 
01133   void setAskForCancelChanges(bool a) {
01134     if (obj_)
01135       obj_->setAskForCancelChanges(a);
01136   }
01137 
01143   void setActivatedCheckIntegrity(bool a) {
01144     if (obj_)
01145       obj_->setActivatedCheckIntegrity(a);
01146   }
01147 
01153   void setActivatedCommitActions(bool a) {
01154     if (obj_)
01155       obj_->setActivatedCommitActions(a);
01156   }
01157 
01163   QString msgCheckIntegrity() {
01164     return (obj_ ? obj_->msgCheckIntegrity() : QString::null);
01165   }
01166 
01180   bool checkIntegrity(bool showError = true) {
01181     return (obj_ ? obj_->checkIntegrity(showError) : false);
01182   }
01183 
01195   void refresh(const QString &fN = QString::null) {
01196     if (obj_)
01197       obj_->refresh(fN);
01198   }
01199 
01211   bool refreshBuffer() {
01212     return (obj_ ? obj_->refreshBuffer() : false);
01213   }
01214 
01220   int at() {
01221     return (obj_ ? obj_->at() : -1);
01222   }
01223 
01232   bool seek(int i, bool relative = false, bool emite = false) {
01233     return (obj_ ? obj_->seek(i, relative, emite) : false);
01234   }
01235 
01244   bool next(bool emite = true) {
01245     return (obj_ ? obj_->next(emite) : false);
01246   }
01247 
01256   bool prev(bool emite = true) {
01257     return (obj_ ? obj_->prev(emite) : false);
01258   }
01259 
01268   bool first(bool emite = true) {
01269     return (obj_ ? obj_->first(emite) : false);
01270   }
01271 
01280   bool last(bool emite = true) {
01281     return (obj_ ? obj_->last(emite) : false);
01282   }
01283 
01290   int del(bool invalidate = true) {
01291     return (obj_ ? obj_->del(invalidate) : false);
01292   }
01293 
01297   bool select(const QString &filter, const QSqlIndex &sort = QSqlIndex()) {
01298     return (obj_ ? obj_->select(QString(filter).replace("NaN", ""), sort) : false);
01299   }
01300 
01304   bool select() {
01305     if (!obj_)
01306       return false;
01307     obj_->QSqlCursor::setFilter(obj_->curFilter());
01308     return obj_->QSqlCursor::select();
01309   }
01310 
01316   int size() {
01317     return (obj_ ? obj_->size() : 0);
01318   }
01319 
01331   int atFrom() {
01332     return (obj_ ? obj_->atFrom() : -1);
01333   }
01334 
01351   int atFromBinarySearch(const QString &fN, const QString &v, bool orderAsc = true) {
01352     return (obj_ ? obj_->atFromBinarySearch(fN, v, orderAsc) : -1);
01353   }
01354 
01374   bool commitBuffer(bool checkLocks = false) {
01375     return (obj_ ? obj_->commitBuffer(true, checkLocks) : false);
01376   }
01377 
01384   bool commitBufferCursorRelation() {
01385     return (obj_ ? obj_->commitBufferCursorRelation() : false);
01386   }
01387 
01391   FLSqlCursorInterface *cursorRelation() {
01392     return cursorRelation_;
01393   }
01394 
01402   void setContext(QObject *c) {
01403     if (obj_)
01404       obj_->setContext(c);
01405   }
01406 
01414   QObject *context() const {
01415     return (obj_ ? obj_->context() : 0);
01416   }
01417 
01423   QString action() {
01424     if (!obj_)
01425       return QString::null;
01426     if (!obj_->action())
01427       return QString::null;
01428     return obj_->action() ->name();
01429   }
01430 
01436   void setAction(const QString &action) {
01437     if (obj_) {
01438       const FLAction *a = obj_->db()->manager()->action(action);
01439       if (a)
01440         obj_->setAction(a);
01441     }
01442   }
01443 
01450   void setUnLock(const QString &fN, bool v) {
01451     if (obj_)
01452       obj_->setUnLock(fN, v);
01453   }
01454 
01460   bool isLocked() {
01461     return (obj_ ? obj_->isLocked() : false);
01462   }
01463 
01468   void editRecord() {
01469     if (obj_) {
01470       if (obj_->parent() == this) {
01471         removeChild(obj_);
01472         if (qApp->focusWidget())
01473           qApp->focusWidget()->insertChild(obj_);
01474       }
01475       obj_->editRecord();
01476     }
01477   }
01478 
01483   void insertRecord() {
01484     if (obj_) {
01485       if (obj_->parent() == this) {
01486         removeChild(obj_);
01487         if (qApp->focusWidget())
01488           qApp->focusWidget()->insertChild(obj_);
01489       }
01490       obj_->insertRecord();
01491     }
01492   }
01493 
01498   void browseRecord() {
01499     if (obj_) {
01500       if (obj_->parent() == this) {
01501         removeChild(obj_);
01502         if (qApp->focusWidget())
01503           qApp->focusWidget()->insertChild(obj_);
01504       }
01505       obj_->browseRecord();
01506     }
01507   }
01508 
01514   void chooseRecord() {
01515     if (obj_)
01516       obj_->chooseRecord();
01517   }
01518 
01524   QString table() const {
01525     return (obj_ ? (obj_->metadata() ? obj_->metadata() ->name() : QString::null) : QString::null);
01526   }
01527 
01535   const int fieldType(const QString &fN) const {
01536     return (obj_ ? (obj_->metadata() ? obj_->metadata() ->fieldType(fN) : 0) : 0);
01537   }
01538 
01544   QString primaryKey() const {
01545     return (obj_ ? (obj_->metadata() ? obj_->metadata() ->primaryKey() : QString::null) : QString::null);
01546   }
01547 
01551   bool isValid() const {
01552     return (obj_ ? obj_->isValid() : false);
01553   }
01554 
01562   bool isModifiedBuffer() {
01563     return (obj_ ? obj_->isModifiedBuffer() : false);
01564   }
01565 
01569   int transactionLevel() {
01570     return FLSqlCursor::transactionLevel();
01571   }
01572 
01576   QStringList transactionsOpened() {
01577     return (obj_ ? obj_->transactionsOpened() : QStringList());
01578   }
01579 
01587   void rollbackOpened(int count = -1, const QString &msg = QString::null) {
01588     if (obj_)
01589       obj_->rollbackOpened(count, msg);
01590   }
01591 
01599   void commitOpened(int count = -1, const QString &msg = QString::null) {
01600     if (obj_)
01601       obj_->commitOpened(count, msg);
01602   }
01603 
01612   void checkRisksLocks(bool terminate = false) {
01613     if (obj_)
01614       obj_->checkRisksLocks(terminate);
01615   }
01616 
01624   void setAcTable(const QString &ac) {
01625     if (obj_)
01626       obj_->setAcTable(ac);
01627   }
01628 
01640   void setAcosTable(const QStringList &acos) {
01641     if (obj_)
01642       obj_->setAcosTable(acos);
01643   }
01644 
01669   void setAcosCondition(const QString &condName, int cond, const QVariant &condVal) {
01670     if (obj_)
01671       obj_->setAcosCondition(condName, (FLSqlCursor::AcosConditionEval) cond, condVal);
01672   }
01673 
01681   void clearAcosCondition() {
01682     if (obj_)
01683       obj_->setAcosCondition(QString::null, FLSqlCursor::VALUE, QVariant());
01684   }
01685 
01689   void setForwardOnly(bool forward) {
01690     obj_->setForwardOnly(forward);
01691   }
01692 
01698   QStringList concurrencyFields() {
01699     return obj_->concurrencyFields();
01700   }
01701 
01702   FLSqlCursor *obj() {
01703     return obj_;
01704   }
01705 
01709   void emitNewBuffer() {
01710     emit newBuffer();
01711   }
01712   void emitBufferChanged(const QString &v) {
01713     emit bufferChanged(v);
01714   }
01715   void emitCursorUpdated() {
01716     emit cursorUpdated();
01717   }
01718   void emitRecordChoosed() {
01719     emit recordChoosed();
01720   }
01721   void emitCurrentChanged(int v) {
01722     emit currentChanged(v);
01723   }
01724   void emitAutoCommit() {
01725     emit autoCommit();
01726   }
01727   void emitBufferCommited() {
01728     emit bufferCommited();
01729   }
01730 
01731 signals:
01732 
01736   void newBuffer();
01737 
01742   void bufferChanged(const QString &);
01743 
01747   void cursorUpdated();
01748 
01752   void recordChoosed();
01753 
01757   void currentChanged(int);
01758 
01762   void autoCommit();
01763 
01767   void bufferCommited();
01768 
01769 private:
01770 
01771   void connects() const;
01772   void removeCache();
01773 
01774   FLSqlCursor *obj_;
01775   FLSqlCursorInterface *cursorRelation_;
01776   bool cached_;
01777 
01778   static FLSqlCursorsCache *cursorsCache;
01779 
01780   friend class FLObjectFactory;
01781 };
01782 
01784 
01790 class  FLSqlQueryInterface : public QObject
01791 {
01792   Q_OBJECT
01793 
01794 public:
01795 
01799   FLSqlQueryInterface(const QString &n = QString::null, const QString &connName = "default") : QObject(0) {
01800     if (n.isEmpty())
01801       obj_ = new FLSqlQuery(this, connName);
01802     else
01803       obj_ = FLSqlConnections::database(connName)->manager()->query(n, this);
01804   }
01805 
01809   FLSqlQueryInterface(FLSqlQuery *obj) : QObject(obj), obj_(0) {
01810     obj_ = obj;
01811   }
01812 
01813 public slots:
01814 
01818   QString select() const {
01819     return obj_->select();
01820   }
01821 
01825   QString from() const {
01826     return obj_->from();
01827   }
01828 
01832   QString where() const {
01833     return obj_->where();
01834   }
01835 
01839   QString orderBy() const {
01840     return obj_->orderBy();
01841   }
01842 
01854   void setSelect(const QString &s, const QString &sep = QString::fromLatin1(",")) {
01855     obj_->setSelect(s, sep);
01856   }
01857 
01864   void setFrom(const QString &f) {
01865     obj_->setFrom(QString(f).replace("NaN", ""));
01866   }
01867 
01874   void setWhere(const QString &w) {
01875     obj_->setWhere(QString(w).replace("NaN", ""));
01876   }
01877 
01884   void setOrderBy(const QString &oB) {
01885     obj_->setOrderBy(QString(oB).replace("NaN", ""));
01886   }
01887 
01897   QString sql() const {
01898     return obj_->sql();
01899   }
01900 
01904   QVariant value(int i) const {
01905     return obj_->value(i);
01906   }
01907 
01908   QVariant value(const QString &n) const {
01909     return obj_->value(n);
01910   }
01911 
01917   bool isNull(int i) const {
01918     return obj_->isNull(i);
01919   }
01920 
01926   bool isNull(QString n) const {
01927     return obj_->isNull(n);
01928   }
01929 
01930 
01931 
01940   QString posToFieldName(const int p) const {
01941     return obj_->posToFieldName(p);
01942   }
01943 
01950   int fieldNameToPos(const QString &n) const {
01951     return obj_->fieldNameToPos(n);
01952   }
01953 
01960   void setTablesList(const QString &tl) {
01961     obj_->setTablesList(tl);
01962   }
01963 
01969   QVariant valueParam(const QString &name) const {
01970     return obj_->valueParam(name);
01971   }
01972 
01979   void setValueParam(const QString &name, const QVariant &v) {
01980     obj_->setValueParam(name, v);
01981   }
01982 
01988   bool next() {
01989     return obj_->next();
01990   }
01991 
01997   bool prev() {
01998     return obj_->prev();
01999   }
02000 
02006   bool first() {
02007     return obj_->first();
02008   }
02009 
02015   bool last() {
02016     return obj_->last();
02017   }
02018 
02022   bool exec() {
02023     return obj_->exec();
02024   }
02025 
02031   void showDebug() {
02032     obj_->showDebug();
02033   }
02034 
02040   int size() const {
02041     return obj_->size();
02042   }
02043 
02044   void setForwardOnly(bool forward) {
02045     obj_->setForwardOnly(forward);
02046   }
02047 
02048   FLSqlQuery *obj() {
02049     return obj_;
02050   }
02051 
02052 private:
02053 
02054   FLSqlQuery *obj_;
02055 };
02056 
02058 
02064 class  FLFieldDBInterface : public QObject
02065 {
02066   Q_OBJECT
02067 
02068   Q_PROPERTY(QString fieldName READ fieldName WRITE setFieldName)
02069   Q_PROPERTY(QString tableName READ tableName WRITE setTableName)
02070   Q_PROPERTY(QString foreignField READ foreignField WRITE setForeignField)
02071   Q_PROPERTY(QString fieldRelation READ fieldRelation WRITE setFieldRelation)
02072   Q_PROPERTY(QString fieldAlias READ fieldAlias WRITE setFieldAlias)
02073   Q_PROPERTY(QString actionName READ actionName WRITE setActionName)
02074   Q_PROPERTY(bool showAlias READ showAlias WRITE setShowAlias)
02075   Q_PROPERTY(bool showEditor READ showEditor WRITE setShowEditor)
02076   Q_PROPERTY(int textFormat READ textFormat WRITE setTextFormat)
02077 
02078 public:
02079 
02083   FLFieldDBInterface(QWidget *p, const QString &n) : QObject(p) {
02084     obj_ = new FLFieldDB(p, n);
02085     if (obj_)
02086       connects();
02087   }
02088 
02092   FLFieldDBInterface(FLFieldDB *obj) : QObject(obj) {
02093     obj_ = obj;
02094     if (obj_)
02095       connects();
02096   }
02097 
02101   FLFieldDBInterface() : QObject(0) {}
02102 
02103 public slots:
02104 
02110   FLSqlCursorInterface *cursor() {
02111     if (!obj_)
02112       return new FLSqlCursorInterface();
02113     return FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
02114   }
02115 
02121   void setDisabled(const bool b) {
02122     obj_->setDisabled(b);
02123     obj_->setKeepDisabled(b);
02124   }
02125 
02131   QString actionName() const {
02132     return obj_->actionName();
02133   }
02134 
02140   void setActionName(const QString &aN) {
02141     obj_->setActionName(aN);
02142   }
02143 
02149   QString fieldName() const {
02150     return obj_->fieldName();
02151   }
02152 
02158   void setFieldName(const QString &fN) {
02159     obj_->setFieldName(fN);
02160   }
02161 
02167   QString tableName() const {
02168     return obj_->tableName();
02169   }
02170 
02176   void setTableName(const QString &fT) {
02177     obj_->setTableName(fT);
02178   }
02179 
02185   QString foreignField() const {
02186     return obj_->foreignField();
02187   }
02188 
02194   void setForeignField(const QString &fN) {
02195     obj_->setForeignField(fN);
02196   }
02197 
02203   QString fieldRelation() const {
02204     return obj_->fieldRelation();
02205   }
02206 
02210   QString fieldAlias() const {
02211     return obj_->fieldAlias();
02212   }
02213 
02219   QWidget *editor() const {
02220     return obj_->editor();
02221   }
02222 
02227   void setFilter(const QString &f) {
02228     obj_->setFilter(f);
02229   }
02230 
02235   QString filter() const {
02236     return obj_->filter();
02237   }
02238 
02244   void setFieldRelation(const QString &fN) {
02245     obj_->setFieldRelation(fN);
02246   }
02247 
02253   void setFieldAlias(const QString &alias) {
02254     obj_->setFieldAlias(alias);
02255   }
02256 
02262   void setValue(const QVariant &v) {
02263     if (v.isValid() && !v.isNull()) {
02264       if (v.toString().upper() == "NAN") {
02265         obj_->setValue(QVariant());
02266         return;
02267       }
02268     }
02269     obj_->setValue(v);
02270   }
02271   void setValue(const QString &v) {
02272     setValue(QVariant(v));
02273   }
02274   void setValue(bool v) {
02275     setValue(QVariant(v));
02276   }
02277   void setValue(double v) {
02278     setValue(QVariant(v));
02279   }
02280   void setValue(int v) {
02281     setValue(QVariant(v));
02282   }
02283 
02289   void setPixmap(const QString &filename) {
02290     obj_->setPixmap(filename);
02291   }
02292 
02296   void setFocus() {
02297     obj_->setFocus();
02298   }
02299 
02303   void selectAll() {
02304     obj_->selectAll();
02305   }
02306 
02310   QVariant value() {
02311     obj_->showWidget();
02312     return obj_->value();
02313   }
02314 
02318   void close() {
02319     obj_->close();
02320   }
02321 
02328   int insertAccel(const QString &key) {
02329     obj_->insertAccel(key);
02330   }
02331 
02337   void removeAccel(int id) {
02338     obj_->removeAccel(id);
02339   }
02340 
02346   void setTextFormat(const int &f) {
02347     Qt::TextFormat tt;
02348     switch (f) {
02349       case 0: {
02350         tt = Qt::PlainText;
02351         break;
02352       }
02353       case 1: {
02354         tt = Qt::RichText;
02355         break;
02356       }
02357       case 2: {
02358         tt = Qt::AutoText;
02359         break;
02360       }
02361       case 3: {
02362         tt = Qt::LogText;
02363         break;
02364       }
02365       default : {
02366         return;
02367       }
02368     }
02369     obj_->setTextFormat(tt);
02370   }
02371 
02375   int textFormat() const {
02376     return obj_->textFormat();
02377   }
02378 
02383   void emitActivatedAccel(int id) {
02384     emit activatedAccel(id);
02385   }
02386 
02392   bool showAlias() const {
02393     return obj_->showAlias();
02394   }
02395 
02399   void setShowAlias(const bool value) {
02400     obj_->setShowAlias(value);
02401   }
02402 
02406   bool showEditor() const {
02407     return obj_->showEditor();
02408   }
02409 
02413   void setShowEditor(const bool show) {
02414     obj_->setShowEditor(show);
02415   }
02416 
02417   void setPartDecimal(int d) {
02418     obj_->setPartDecimal(d);
02419   }
02420 
02421   FLFieldDB *obj() {
02422     return obj_;
02423   }
02424 
02425 signals:
02426 
02431   void activatedAccel(int);
02432 
02436   void keyF2Pressed();
02437 
02441   void keyF4Pressed();
02442 
02446   void keyReturnPressed();
02447 
02448 private:
02449 
02450   void connects() const;
02451 
02452   FLFieldDB *obj_;
02453 };
02454 
02456 
02462 class  FLTableDBInterface : public QObject
02463 {
02464   Q_OBJECT
02465 
02466   Q_PROPERTY(QString tableName READ tableName WRITE setTableName)
02467   Q_PROPERTY(QString foreignField READ foreignField WRITE setForeignField)
02468   Q_PROPERTY(QString fieldRelation READ fieldRelation WRITE setFieldRelation)
02469   Q_PROPERTY(bool checkColumnEnabled READ checkColumnEnabled WRITE setCheckColumnEnabled)
02470   Q_PROPERTY(QString aliasCheckColumn READ aliasCheckColumn WRITE setAliasCheckColumn)
02471   Q_PROPERTY(bool findHidden READ findHidden WRITE setFindHidden)
02472   Q_PROPERTY(bool filterHidden READ filterHidden WRITE setFilterHidden)
02473   Q_PROPERTY(bool showAllPixmaps READ showAllPixmaps WRITE setShowAllPixmaps)
02474   Q_PROPERTY(QString functionGetColor READ functionGetColor WRITE setFunctionGetColor)
02475 
02476 public:
02477 
02481   FLTableDBInterface(QWidget *p, const QString &n) : QObject(p) {
02482     obj_ = new FLTableDB(p, n);
02483     if (obj_)
02484       connects();
02485   }
02486 
02490   FLTableDBInterface(FLTableDB *obj) : QObject(obj) {
02491     obj_ = obj;
02492     if (obj_)
02493       connects();
02494   }
02495 
02499   FLTableDBInterface() : QObject(0) {}
02500 
02501 public slots:
02502 
02508   QString tableName() const {
02509     return obj_->tableName();
02510   }
02511 
02517   void setTableName(const QString &fT) {
02518     obj_->setTableName(fT);
02519   }
02520 
02526   QString foreignField() const {
02527     return obj_->foreignField();
02528   }
02529 
02535   void setForeignField(const QString &fN) {
02536     obj_->setForeignField(fN);
02537   }
02538 
02544   QString fieldRelation() const {
02545     return obj_->fieldRelation();
02546   }
02547 
02553   void setFieldRelation(const QString &fN) {
02554     obj_->setFieldRelation(fN);
02555   }
02556 
02560   void setReadOnly(const bool mode) {
02561     obj_->setReadOnly(mode);
02562   }
02563 
02567   void setEditOnly(const bool mode) {
02568     obj_->setEditOnly(mode);
02569   }
02570 
02574   void setInsertOnly(const bool mode) {
02575     obj_->setInsertOnly(mode);
02576   }
02577 
02581   void refresh() {
02582     obj_->refresh(false, true);
02583   }
02584 
02585   void refresh(const bool refreshHead, const bool refreshData) {
02586     obj_->refresh(refreshHead, refreshData);
02587   }
02588 
02592   void insertRecord() {
02593     obj_->insertRecord();
02594   }
02595 
02599   void editRecord() {
02600     obj_->editRecord();
02601   }
02602 
02606   void browseRecord() {
02607     obj_->browseRecord();
02608   }
02609 
02613   void deleteRecord() {
02614     obj_->deleteRecord();
02615   }
02616 
02620   void copyRecord() {
02621     obj_->copyRecord();
02622   }
02623 
02627   void show() {
02628     obj_->show();
02629   }
02630 
02634   void setFocus() {
02635     obj_->setFocus();
02636   }
02637 
02642   void setFilter(const QString &f) {
02643     obj_->setFilter(f);
02644   }
02645 
02650   QString filter() {
02651     return obj_->filter();
02652   }
02653 
02658   QString findFilter() const {
02659     return obj_->findFilter();
02660   }
02661 
02665   void setInitSearch(const QString &iS) {
02666     obj_->setInitSearch(iS);
02667   }
02668 
02674   FLSqlCursorInterface *cursor() {
02675     if (!obj_)
02676       return new FLSqlCursorInterface();
02677     return FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
02678   }
02679 
02680   void emitReadOnlyChanged(bool b) {
02681     emit readOnlyChanged(b);
02682   }
02683 
02684   void emitEditOnlyChanged(bool b) {
02685     emit editOnlyChanged(b);
02686   }
02687 
02688   void emitInsertOnlyChanged(bool b) {
02689     emit insertOnlyChanged(b);
02690   }
02691 
02695   void emitCurrentChanged() {
02696     emit currentChanged();
02697   }
02698 
02704   void setCurrentRow(const int r) {
02705     FLDataTable *t = obj_->tableRecords();
02706     if (t) {
02707       obj_->showWidget();
02708       t->selectRow(r);
02709     }
02710   }
02711 
02717   int currentRow(void) {
02718     FLDataTable *t = obj_->tableRecords();
02719     if (t) {
02720       obj_->showWidget();
02721       return t->currentRow();
02722     }
02723     return -1;
02724   }
02725 
02729   void close() {
02730     obj_->close();
02731   }
02732 
02733   FLTableDB *obj() {
02734     return obj_;
02735   }
02736 
02742   void setDisabled(const bool b) {
02743     obj_->setDisabled(b);
02744   }
02745 
02749   void putFirstCol(const QString &c) {
02750     obj_->putFirstCol(c);
02751   }
02752 
02759   void moveCol(const QString &from, const QString &to) {
02760     obj_->moveCol(from, to);
02761   }
02762 
02768   void setOrderCols(QStringList &fields) {
02769     obj_->setOrderCols(fields);
02770   }
02771 
02775   QStringList orderCols() {
02776     return obj_->orderCols();
02777   }
02778 
02782   bool checkColumnEnabled() const {
02783     return obj_->checkColumnEnabled();
02784   }
02785 
02791   void setCheckColumnEnabled(bool b) {
02792     obj_->setCheckColumnEnabled(b);
02793   }
02794 
02798   QString aliasCheckColumn() const {
02799     return obj_->aliasCheckColumn();
02800   }
02801 
02807   void setAliasCheckColumn(const QString &t) {
02808     obj_->setAliasCheckColumn(t);
02809   }
02810 
02814   QStringList primarysKeysChecked();
02815 
02819   void clearChecked() {
02820     FLDataTable *dt = obj_->tableRecords();
02821     if (dt)
02822       dt->clearChecked();
02823   }
02824 
02828   void setPrimaryKeyChecked(const QVariant &primaryKeyValue, bool on) {
02829     FLDataTable *dt = obj_->tableRecords();
02830     if (dt)
02831       dt->setPrimaryKeyChecked(primaryKeyValue, on);
02832   }
02833 
02843   void emitPrimaryKeyToggled(const QVariant &primaryKeyValue, bool on) {
02844     emit primaryKeyToggled(primaryKeyValue, on);
02845   }
02846 
02850   bool findHidden() const {
02851     return obj_->findHidden();
02852   }
02853 
02859   void setFindHidden(bool h) {
02860     obj_->setFindHidden(h);
02861   }
02862 
02866   bool filterHidden() const {
02867     return obj_->filterHidden();
02868   }
02869 
02875   void setFilterHidden(bool h) {
02876     obj_->setFilterHidden(h);
02877   }
02878 
02885   void setColumnWidth(const QString &field, int w) {
02886     obj_->setColumnWidth(field, w);
02887   }
02888 
02892   int columnWidth(int c) {
02893     return obj_->columnWidth(c);
02894   }
02895 
02902   void setRowHeight(int row, int h) {
02903     obj_->setRowHeight(row, h);
02904   }
02905 
02909   int rowHeight(int row) {
02910     return obj_->rowHeight(row);
02911   }
02912 
02916   bool showAllPixmaps() const {
02917     return obj_->showAllPixmaps();
02918   }
02919 
02923   void setShowAllPixmaps(bool s) {
02924     obj_->setShowAllPixmaps(s);
02925   }
02926 
02930   QString functionGetColor() const {
02931     return obj_->functionGetColor();
02932   }
02933 
02937   void setFunctionGetColor(const QString &f) {
02938     obj_->setFunctionGetColor(f);
02939   }
02940 
02941 signals:
02942 
02946   void readOnlyChanged(bool);
02947 
02951   void editOnlyChanged(bool);
02952 
02956   void insertOnlyChanged(bool);
02957 
02961   void currentChanged();
02962 
02972   void primaryKeyToggled(const QVariant &, bool);
02973 
02974 private:
02975 
02976   void connects() const;
02977 
02978   FLTableDB *obj_;
02979 };
02980 
02982 
02988 #define NEW_TABLE if (!obj_) { obj_ = new FLTable(qApp->mainWidget()); connects(); }
02989 
02990 class FLTableInterface : public QObject
02991 {
02992   Q_OBJECT
02993   Q_ENUMS(CellAlignment)
02994 
02995 public:
02996 
03000   FLTableInterface(QWidget *p, const QString &n) : QObject(p) {
03001     obj_ = new FLTable(p, n);
03002     if (obj_)
03003       connects();
03004   }
03005 
03009   FLTableInterface() : QObject(0), obj_(0) {}
03010 
03014   FLTableInterface(QTable *t) : QObject(t), obj_(t) {
03015     connects();
03016   }
03017 
03018   enum CellAlignment {
03019     AlignAuto = Qt::AlignAuto,
03020     AlignLeft = Qt::AlignLeft,
03021     AlignRight = Qt::AlignRight,
03022     AlignHCenter = Qt::AlignHCenter,
03023     AlignJustify = Qt::AlignJustify,
03024     AlignTop = Qt::AlignTop,
03025     AlignBottom = Qt::AlignBottom,
03026     AlignVCenter = Qt::AlignVCenter,
03027     AlignCenter = Qt::AlignCenter
03028   };
03029 
03030 public slots:
03031 
03038   void setRowReadOnly(int row, bool ro) {
03039     NEW_TABLE
03040     obj_->setRowReadOnly(row, ro);
03041   }
03042 
03050   void sortColumn(int col, bool ascending = true, bool wholeRows = false) {
03051     NEW_TABLE
03052     obj_->sortColumn(col, ascending, wholeRows);
03053   }
03054 
03061   void setColumnReadOnly(int col, bool ro) {
03062     NEW_TABLE
03063     obj_->setColumnReadOnly(col, ro);
03064   }
03065 
03071   void removeRow(int row) {
03072     NEW_TABLE
03073     obj_->removeRow(row);
03074   }
03075 
03079   void clear();
03080 
03087   void editCell(int row, int col) {
03088     NEW_TABLE
03089     obj_->editCell(row, col, false);
03090   }
03091 
03097   void hideColumn(int col) {
03098     NEW_TABLE
03099     obj_->hideColumn(col);
03100   }
03101 
03107   void hideRow(int row) {
03108     NEW_TABLE
03109     obj_->hideRow(row);
03110   }
03111 
03117   void showColumn(int col) {
03118     NEW_TABLE
03119     obj_->showColumn(col);
03120   }
03121 
03127   void showRow(int row) {
03128     NEW_TABLE
03129     obj_->showRow(row);
03130   }
03131 
03138   QString text(int row, int col) {
03139     NEW_TABLE
03140     return obj_->text(row, col);
03141   }
03142 
03149   void setColumnLabels(const QString &sep, const QString &str) {
03150     NEW_TABLE
03151     QStringList sL = QStringList::split(sep, str);
03152     obj_->setColumnLabels(sL);
03153   }
03154 
03161   void setRowLabels(const QString &sep, const QString &str) {
03162     NEW_TABLE
03163     QStringList sL = QStringList::split(sep, str);
03164     obj_->setRowLabels(sL);
03165   }
03166 
03172   void setLeftMargin(int m) {
03173     NEW_TABLE
03174     obj_->setLeftMargin(m);
03175   }
03176 
03182   void setTopMargin(int m) {
03183     NEW_TABLE
03184     obj_->setTopMargin(m);
03185   }
03186 
03192   void setNumCols(const int c) {
03193     NEW_TABLE
03194     obj_->setNumCols(c);
03195   }
03196 
03202   void setNumRows(const int r) {
03203     NEW_TABLE
03204     obj_->setNumRows(r);
03205   }
03206 
03212   void setColumnWidth(const int c, const int w) {
03213     NEW_TABLE
03214     obj_->setColumnWidth(c, w);
03215   }
03216 
03220   int columnWidth(int c) {
03221     NEW_TABLE
03222     return obj_->columnWidth(c);
03223   }
03224 
03231   void setRowHeight(int row, int h) {
03232     NEW_TABLE
03233     obj_->setRowHeight(row, h);
03234   }
03235 
03239   int rowHeight(int row) {
03240     NEW_TABLE
03241     return obj_->rowHeight(row);
03242   }
03243 
03249   int currentRow() {
03250     NEW_TABLE
03251     return obj_->currentRow();
03252   }
03253 
03259   int currentColumn() {
03260     NEW_TABLE
03261     return obj_->currentColumn();
03262   }
03263 
03269   void selectRow(int row) {
03270     NEW_TABLE
03271     obj_->selectRow(row);
03272   }
03273 
03279   int numRows() {
03280     NEW_TABLE
03281     return obj_->numRows();
03282   }
03283 
03289   int numCols() {
03290     NEW_TABLE
03291     return obj_->numCols();
03292   }
03293 
03300   void swapRows(int row1, int row2, bool swapHeader = false) {
03301     NEW_TABLE
03302     return obj_->swapRows(row1, row2, swapHeader);
03303   }
03304 
03311   void swapColumns(int col1, int col2, bool swapHeader = false) {
03312     NEW_TABLE
03313     return obj_->swapColumns(col1, col2, swapHeader);
03314   }
03315 
03319   void repaintContents() {
03320     NEW_TABLE
03321     return obj_->repaintContents();
03322   }
03323 
03327   void clearSelection(bool repaint = true) {
03328     NEW_TABLE
03329     return obj_->clearSelection(repaint);
03330   }
03331 
03338   QStringList selectedRows();
03339 
03346   QStringList selectedCols();
03347 
03354   QStringList selectedCells();
03355 
03363   void setText(int row, int col, const QString &text) {
03364     NEW_TABLE
03365     int d = row - obj_->numRows() + 1;
03366     if (d > 0)
03367       insertRows(obj_->numRows() - 1, d);
03368     d = col - obj_->numCols() + 1;
03369     if (d > 0)
03370       insertColumns(obj_->numCols() - 1, d);
03371     obj_->setText(row, col, text);
03372   }
03373 
03380   void insertRows(int row, int count = 1) {
03381     NEW_TABLE
03382     obj_->insertRows(row, count);
03383   }
03384 
03391   void insertColumns(int col, int count = 1) {
03392     NEW_TABLE
03393     obj_->insertColumns(col, count);
03394   }
03395 
03401   void adjustColumn(int col) {
03402     NEW_TABLE
03403     obj_->adjustColumn(col);
03404   }
03405 
03411   void adjustRow(int fil) {
03412     NEW_TABLE
03413     obj_->adjustRow(fil);
03414   }
03415 
03423   void setPixmap(int row, int col, const QPixmap &pix) {
03424     NEW_TABLE
03425     obj_->setPixmap(row, col, pix);
03426   }
03427 
03435   QPixmap pixmap(int row, int col) {
03436     NEW_TABLE
03437     return obj_->pixmap(row, col);
03438   }
03439 
03440   void emitCurrentChanged(int row, int col) {
03441     emit currentChanged(row, col);
03442   }
03443 
03444   void emitClicked(int row, int col, int, const QPoint &) {
03445     emit clicked(row, col);
03446   }
03447 
03448   void emitDoubleClicked(int row, int col, int, const QPoint &) {
03449     emit doubleClicked(row, col);
03450   }
03451 
03452   void emitValueChanged(int row, int col) {
03453     emit valueChanged(row, col);
03454   }
03455 
03456   void emitSelectionChanged() {
03457     emit selectionChanged();
03458   }
03459 
03460 signals:
03461 
03468   void currentChanged(int, int);
03469 
03476   void clicked(int, int);
03477 
03484   void doubleClicked(int, int);
03485 
03492   void valueChanged(int, int);
03493 
03497   void selectionChanged();
03498 
03499 protected:
03500 
03501   void connects() const;
03502 
03503   QTable *obj_;
03504 };
03505 
03506 class  FLTablePlusInterface : public FLTableInterface
03507 {
03508   Q_OBJECT
03509 
03510 public:
03511 
03515   FLTablePlusInterface(QWidget *p, const QString &n) : FLTableInterface(p, n) {
03516   }
03517 
03521   FLTablePlusInterface(FLTable *t) : FLTableInterface(::qt_cast<QTable *>(t)) {
03522   }
03523 
03524 public slots:
03525 
03526   void setCellBackgroundColor(int row, int col, const QColor &color) {
03527     NEW_TABLE
03528     int d = row - obj_->numRows() + 1;
03529     if (d > 0)
03530       insertRows(obj_->numRows() - 1, d);
03531     d = col - obj_->numCols() + 1;
03532     if (d > 0)
03533       insertColumns(obj_->numCols() - 1, d);
03534 
03535     FLTable *t = ::qt_cast<FLTable *>(obj_);
03536     if (t)
03537       t->setCellBackgroundColor(row, col, color);
03538   }
03539 
03540   void setCellAlignment(int row, int col, const int a) {
03541     NEW_TABLE
03542     int d = row - obj_->numRows() + 1;
03543     if (d > 0)
03544       insertRows(obj_->numRows() - 1, d);
03545     d = col - obj_->numCols() + 1;
03546     if (d > 0)
03547       insertColumns(obj_->numCols() - 1, d);
03548 
03549     FLTable *t = ::qt_cast<FLTable *>(obj_);
03550     if (t)
03551       t->setCellAlignment(row, col, a);
03552   }
03553 };
03554 
03556 
03562 #define NEW_VIEW if (!obj_) { obj_ = new QListView(qApp->mainWidget()); connects(); }
03563 
03564 class FLListViewItemInterface;
03565 
03566 class FLListViewItem : public QListViewItem
03567 {
03568 public:
03569 
03570   FLListViewItem(QListView *parent): QListViewItem(parent) {}
03571   FLListViewItem(QListViewItem *parent): QListViewItem(parent) {}
03572   FLListViewItem(FLListViewItem *parent): QListViewItem(parent) {}
03573   void setKey(const QString &k) {
03574     key_ = k;
03575   }
03576   QString key() const {
03577     return key_;
03578   }
03579 
03580 private:
03581 
03582   QString key_;
03583 };
03584 
03585 class  FLListViewInterface : public QObject
03586 {
03587   Q_OBJECT
03588 
03589 public:
03590 
03594   FLListViewInterface(QWidget *p, const QString &n) : QObject(p) {
03595     obj_ = new QListView(p, n);
03596     if (obj_)
03597       connects();
03598   }
03599 
03603   FLListViewInterface() : QObject(0), obj_(0) {}
03604 
03608   FLListViewInterface(QListView *t) : QObject(t), obj_(t) {
03609     connects();
03610   }
03611 
03612 public slots:
03613 
03620   int addColumn(const QString &label, int width = -1) {
03621     NEW_VIEW
03622     obj_->addColumn(label, width);
03623   }
03624 
03631   void setColumnText(int column, const QString &label) {
03632     NEW_VIEW
03633     obj_->setColumnText(column, label);
03634   }
03635 
03642   void setColumnAlignment(int column, int align) {
03643     NEW_VIEW
03644     obj_->setColumnAlignment(column, align);
03645   }
03646 
03647   QListView *obj() {
03648     NEW_VIEW
03649     return obj_;
03650   }
03651 
03652   void clear() {
03653     NEW_VIEW
03654     obj_->clear();
03655   }
03656 
03657   FLListViewItemInterface *firstChild() const;
03658 
03662   void emitDoubleClicked(QListViewItem *lvI);
03663   void emitExpanded(QListViewItem *lvI);
03664   void emitSelectionChanged(QListViewItem *lvI);
03665 
03666 signals:
03667 
03673   void doubleClicked(FLListViewItemInterface *);
03674   void expanded(FLListViewItemInterface *);
03675   void selectionChanged(FLListViewItemInterface *);
03676 
03677 private:
03678 
03679   void connects() const;
03680 
03681   QListView *obj_;
03682 };
03683 
03685 
03691 class  FLListViewItemInterface : public QObject
03692 {
03693   Q_OBJECT
03694 
03695 public:
03696 
03700   FLListViewItemInterface(FLListViewInterface *parent) : QObject(0), obj_(0) {
03701     if (parent)
03702       obj_ = new FLListViewItem(parent->obj());
03703   }
03704 
03708   FLListViewItemInterface(FLListViewItemInterface *parent) : QObject(0), obj_(0) {
03709     if (parent)
03710       obj_ = new FLListViewItem(parent->obj());
03711   }
03712 
03716   FLListViewItemInterface() : QObject(0), obj_(0) {}
03717 
03721   FLListViewItemInterface(FLListViewItem *lvI) : QObject(0), obj_(0) {
03722     if (lvI)
03723       setObj(lvI);
03724   }
03725 
03729   ~FLListViewItemInterface() {}
03730 
03731 public slots:
03732 
03738   void setKey(const QString &k) {
03739     obj_->setKey(k);
03740   }
03741 
03747   QString key() const {
03748     return obj_->key();
03749   }
03750 
03757   void setText(int column, const QString &text) {
03758     obj_->setText(column, text);
03759   }
03760 
03767   QString text(int column) const {
03768     return obj_->text(column);
03769   }
03770 
03771   FLListViewItem *obj() {
03772     return obj_;
03773   }
03774 
03775   void setObj(FLListViewItem *lvI) {
03776     obj_ = lvI;
03777   }
03778 
03779   void setOpen(bool o) {
03780     obj_->setOpen(o);
03781   }
03782 
03783   FLListViewItemInterface *firstChild() const;
03784 
03785   FLListViewItemInterface *nextSibling() const;
03786 
03787   FLListViewItemInterface *parent() const;
03788 
03789   void del() {
03790     delete obj_;
03791   }
03792 
03793   void setExpandable(bool enable) {
03794     obj_->setExpandable(enable);
03795   }
03796 
03797   bool isExpandable() const {
03798     return obj_->isExpandable();
03799   }
03800 
03801   void setPixmap(int column, const QVariant &pm);
03802 
03803 private:
03804 
03805   FLListViewItem *obj_;
03806 };
03807 
03809 
03814 class  FLTabWidgetInterface : public QObject
03815 {
03816   Q_OBJECT
03817 
03818 public:
03819 
03823   FLTabWidgetInterface() {
03824     obj_ = new QTabWidget(qApp->mainWidget());
03825     connects();
03826   }
03827 
03831   FLTabWidgetInterface(QTabWidget *t) : QObject(t), obj_(t) {
03832     if (obj_)
03833       connects();
03834   }
03835 
03836 public slots:
03837 
03844   void setTabEnabled(int index, bool enable) {
03845     obj_->setTabEnabled(obj_->page(index), enable);
03846   }
03847 
03854   void setTabEnabled(const QString &name, bool enable);
03855 
03861   void removePage(int index) {
03862     obj_->removePage(obj_->page(index));
03863   }
03864 
03870   void removePage(const QString &name);
03871 
03877   void showPage(int index) {
03878     obj_->showPage(obj_->page(index));
03879   }
03880 
03886   void showPage(const QString &name);
03887 
03891   void emitCurrentChanged(QWidget *w) {
03892     if (w)
03893       emit currentChanged(QString::fromLatin1(w->name()));
03894   }
03895 
03896 signals:
03897 
03902   void currentChanged(const QString &);
03903 
03904 private:
03905 
03906   void connects() const;
03907 
03908   QTabWidget *obj_;
03909 };
03910 
03912 
03918 class  FLFormDBInterface : public QObject
03919 {
03920   Q_OBJECT
03921 
03922 public:
03923 
03927   FLFormDBInterface(const QString &a, QWidget *p, WFlags f = 0)
03928     : QObject(p), obj_(0), cursor_(0), script_(0) {
03929     setObj(new FLFormDB(a, p ? p : aqApp->mainWidget(), f));
03930   }
03931 
03935   FLFormDBInterface(FLSqlCursorInterface *c, const QString &a, QWidget *p, WFlags f = 0)
03936     : QObject(p), obj_(0), cursor_(0), script_(0) {
03937     setObj(new FLFormDB(c->obj(), a, p ? p : aqApp->mainWidget(), f));
03938   }
03939 
03943   FLFormDBInterface(FLFormDB *obj) : QObject(obj), obj_(0), cursor_(0), script_(0) {
03944     setObj(obj);
03945   }
03946 
03950   FLFormDBInterface() : QObject(0), obj_(0), cursor_(0), script_(0) {}
03951 
03955   ~FLFormDBInterface() {
03956   }
03957 
03963   void setObj(FLFormDB *obj) {
03964     obj_ = obj;
03965     if (obj_) {
03966       setName(obj_->name());
03967       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
03968       connects();
03969     } else
03970       cursor_ = 0;
03971   }
03972 
03978   void setObjCursor(FLSqlCursor *c) {
03979     if (c && obj_)
03980       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
03981   }
03982 
03988   void setScript(QSScript *s) {
03989     script_ = s;
03990   }
03991 
03992   QSScript *script() {
03993     return script_;
03994   }
03995 
03996 public slots:
03997 
04003   void setCursor(FLSqlCursorInterface *c) {
04004     if (c && obj_) {
04005       obj_->setCursor(c->obj());
04006       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04007     }
04008   }
04009 
04015   FLSqlCursorInterface *cursor() {
04016     if (!cursor_ && obj_)
04017       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04018     return (cursor_ ? cursor_ : new FLSqlCursorInterface());
04019   }
04020 
04026   QWidget *mainWidget() const {
04027     return (obj_ ? obj_->mainWidget() : 0);
04028   }
04029 
04042   void setMainWidget(QWidget *w) {
04043     if (obj_)
04044       obj_->setMainWidget(w);
04045   }
04046 
04052   void setMainWidget() {
04053     if (obj_)
04054       obj_->setMainWidget();
04055   }
04056 
04064   void setMainWidget(const QString &uiFileName) {
04065     if (obj_)
04066       obj_->setMainWidget(uiFileName);
04067   }
04068 
04074   QWidget *parentWidget() {
04075     return (obj_ ? obj_->parentWidget() : 0);
04076   }
04077 
04084   QObject *child(const QString &objName) {
04085     if (!obj_)
04086       return 0;
04087     QObject *o = obj_->child(objName, "QWidget");
04088     if (o) {
04089       if (::qt_cast<FLFieldDB *>(o)) {
04090         return new FLFieldDBInterface(static_cast<FLFieldDB *>(o));
04091       }
04092       if (::qt_cast<FLTableDB *>(o)) {
04093         return new FLTableDBInterface(static_cast<FLTableDB *>(o));
04094       }
04095       if (::qt_cast<FLTable *>(o)) {
04096         return new FLTablePlusInterface(static_cast<FLTable *>(o));
04097       }
04098       if (::qt_cast<QTable *>(o)) {
04099         return new FLTableInterface(static_cast<QTable *>(o));
04100       }
04101       if (::qt_cast<QTabWidget *>(o)) {
04102         return new FLTabWidgetInterface(static_cast<QTabWidget *>(o));
04103       }
04104       if (::qt_cast<QListView *>(o)) {
04105         return new FLListViewInterface(static_cast<QListView *>(o));
04106       }
04107     }
04108     return o;
04109   }
04110 
04116   bool close() {
04117     if (obj_) {
04118       bool ret = obj_->close();
04119       obj_ = 0;
04120       return ret;
04121     } else
04122       return false;
04123   }
04124 
04125   FLFormDB *obj() {
04126     return obj_;
04127   }
04128 
04134   void setDisabled(const bool b) {
04135     if (obj_)
04136       obj_->setDisabled(b);
04137   }
04138 
04142   QImage snapShot() {
04143     return (obj_ ? obj_->snapShot() : QImage());
04144   }
04145 
04151   void saveSnapShot(const QString &pathFile) {
04152     if (obj_)
04153       obj_->saveSnapShot(pathFile);
04154   }
04155 
04159   void show() {
04160     if (obj_)
04161       obj_->show();
04162   }
04163 
04168   void showForDocument() {
04169     if (obj_)
04170       obj_->showForDocument();
04171   }
04172 
04176   void setMaximized() {
04177     if (obj_)
04178       obj_->setMaximized();
04179   }
04180 
04181 signals:
04182 
04186   void closed();
04187 
04191   void formReady();
04192 
04193 private:
04194 
04195   void connects() const;
04196 
04197   FLFormDB *obj_;
04198   FLSqlCursorInterface *cursor_;
04199   QSScript *script_;
04200 };
04201 
04203 
04209 class  FLFormRecordDBInterface : public QObject
04210 {
04211   Q_OBJECT
04212 
04213 public:
04214 
04218   FLFormRecordDBInterface(FLSqlCursorInterface *c, const QString &a, QWidget *p, bool sA) : QObject(p), obj_(0),
04219     cursor_(0), script_(0) {
04220     setObj(new FLFormRecordDB(c->obj(), a, aqApp->mainWidget(), sA));
04221   }
04222 
04226   FLFormRecordDBInterface(FLFormRecordDB *obj) : QObject(obj), obj_(0), cursor_(0), script_(0) {
04227     setObj(obj);
04228   }
04229 
04233   FLFormRecordDBInterface() : QObject(0), obj_(0), cursor_(0), script_(0) {}
04234 
04238   ~FLFormRecordDBInterface() {}
04239 
04240   void finish() {}
04241 
04247   void setObj(FLFormRecordDB *obj) {
04248     obj_ = obj;
04249     if (obj_) {
04250       setName(obj_->name());
04251       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04252       connects();
04253     } else
04254       cursor_ = 0;
04255   }
04256 
04262   void setObjCursor(FLSqlCursor *c) {
04263     if (c && obj_)
04264       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04265   }
04266 
04272   void setScript(QSScript *s) {
04273     script_ = s;
04274   }
04275 
04281   QSScript *script() {
04282     return script_;
04283   }
04284 
04285 public slots:
04286 
04292   void setCursor(FLSqlCursorInterface *c) {
04293     if (c) {
04294       if (obj_) {
04295         obj_->setCursor(c->obj());
04296         cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04297       } else
04298         cursor_ = c;
04299     }
04300   }
04301 
04307   FLSqlCursorInterface *cursor() {
04308     if (!cursor_ && obj_)
04309       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04310     return (cursor_ ? cursor_ : new FLSqlCursorInterface());
04311   }
04312 
04318   QWidget *mainWidget() const {
04319     return (obj_ ? obj_->mainWidget() : 0);
04320   }
04321 
04334   void setMainWidget(QWidget *w) {
04335     if (obj_)
04336       obj_->setMainWidget(w);
04337   }
04338 
04344   void setMainWidget() {
04345     if (obj_)
04346       obj_->setMainWidget();
04347   }
04348 
04356   void setMainWidget(const QString &uiFileName) {
04357     if (obj_)
04358       ::qt_cast<FLFormDB *>(obj_)->setMainWidget(uiFileName);
04359   }
04360 
04367   QObject *child(const QString &objName) {
04368     if (!obj_)
04369       return 0;
04370     QObject *o = obj_->child(objName, "QWidget");
04371     if (o) {
04372       if (::qt_cast<FLFieldDB *>(o)) {
04373         return new FLFieldDBInterface(static_cast<FLFieldDB *>(o));
04374       }
04375       if (::qt_cast<FLTableDB *>(o)) {
04376         return new FLTableDBInterface(static_cast<FLTableDB *>(o));
04377       }
04378       if (::qt_cast<FLTable *>(o)) {
04379         return new FLTablePlusInterface(static_cast<FLTable *>(o));
04380       }
04381       if (::qt_cast<QTable *>(o)) {
04382         return new FLTableInterface(static_cast<QTable *>(o));
04383       }
04384       if (::qt_cast<QTabWidget *>(o)) {
04385         return new FLTabWidgetInterface(static_cast<QTabWidget *>(o));
04386       }
04387       if (::qt_cast<QListView *>(o)) {
04388         return new FLListViewInterface(static_cast<QListView *>(o));
04389       }
04390     }
04391     return o;
04392   }
04393 
04399   bool close() {
04400     if (obj_) {
04401       bool ret = obj_->close();
04402       obj_ = 0;
04403       return ret;
04404     } else
04405       return false;
04406   }
04407 
04411   void accept() {
04412     if (obj_)
04413       obj_->accept();
04414   }
04415 
04419   void reject() {
04420     if (obj_)
04421       obj_->reject();
04422   }
04423 
04427   void acceptContinue() {
04428     if (obj_)
04429       obj_->acceptContinue();
04430   }
04431 
04432   FLFormRecordDB *obj() {
04433     return obj_;
04434   }
04435 
04441   void setDisabled(const bool b) {
04442     if (obj_)
04443       obj_->setDisabled(b);
04444   }
04445 
04449   QImage snapShot() {
04450     return (obj_ ? obj_->snapShot() : QImage());
04451   }
04452 
04458   void saveSnapShot(const QString &pathFile) {
04459     if (obj_)
04460       obj_->saveSnapShot(pathFile);
04461   }
04462 
04466   void show() {
04467     if (obj_)
04468       obj_->show();
04469   }
04470 
04475   void showForDocument() {
04476     if (obj_)
04477       obj_->showForDocument();
04478   }
04479 
04483   void setMaximized() {
04484     if (obj_)
04485       obj_->setMaximized();
04486   }
04487 
04488 signals:
04489 
04493   void closed();
04494 
04498   void formReady();
04499 
04500 private:
04501 
04502   void connects() const;
04503 
04504   FLFormRecordDB *obj_;
04505   FLSqlCursorInterface *cursor_;
04506   QSScript *script_;
04507 };
04508 
04510 
04516 class  FLFormSearchDBInterface : public QObject
04517 {
04518   Q_OBJECT
04519 
04520 public:
04521 
04525   FLFormSearchDBInterface(const QString &a) : QObject(0), obj_(0), cursor_(0),
04526     script_(0) {
04527     setObj(new FLFormSearchDB(a));
04528   }
04529 
04533   FLFormSearchDBInterface(FLSqlCursorInterface *c, const QString &a) : QObject(0), obj_(0), cursor_(0),
04534     script_(0) {
04535     setObj(new FLFormSearchDB(c->obj(), a));
04536   }
04537 
04541   FLFormSearchDBInterface(FLFormSearchDB *obj) : QObject(obj), obj_(0), cursor_(0), script_(0) {
04542     setObj(obj);
04543   }
04544 
04548   FLFormSearchDBInterface() : QObject(0), obj_(0), cursor_(0), script_(0) {
04549   }
04550 
04554   ~FLFormSearchDBInterface() {
04555     close();
04556   }
04557 
04558   void finish() {}
04559 
04565   void setObj(FLFormSearchDB *obj) {
04566     obj_ = obj;
04567     if (obj_) {
04568       setName(obj_->name());
04569       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04570       connects();
04571     } else
04572       cursor_ = 0;
04573   }
04574 
04580   void setObjCursor(FLSqlCursor *c) {
04581     if (c && obj_)
04582       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04583   }
04584 
04590   void setScript(QSScript *s) {
04591     script_ = s;
04592   }
04593 
04599   QSScript *script() {
04600     return script_;
04601   }
04602 
04603 public slots:
04604 
04608   void setCursor(FLSqlCursorInterface *c) {
04609     if (c && obj_) {
04610       obj_->setCursor(c->obj());
04611       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04612     }
04613   }
04614 
04620   FLSqlCursorInterface *cursor() {
04621     if (!cursor_ && obj_)
04622       cursor_ = FLSqlCursorInterface::sqlCursorInterface(obj_->cursor());
04623     return (cursor_ ? cursor_ : new FLSqlCursorInterface());
04624   }
04625 
04631   QWidget *mainWidget() const {
04632     return (obj_ ? obj_->mainWidget() : 0);
04633   }
04634 
04647   void setMainWidget(QWidget *w) {
04648     if (obj_)
04649       obj_->setMainWidget(w);
04650   }
04651 
04657   void setMainWidget() {
04658     if (obj_)
04659       obj_->setMainWidget();
04660   }
04661 
04669   void setMainWidget(const QString &uiFileName) {
04670     if (obj_)
04671       ::qt_cast<FLFormDB *>(obj_)->setMainWidget(uiFileName);
04672   }
04673 
04685   QVariant exec(const QString &n = QString::null) {
04686     return (obj_ ? obj_->exec(n) : QVariant());
04687   }
04688   void show() {
04689     if (obj_)
04690       obj_->exec();
04691   }
04692 
04698   bool accepted() {
04699     return (obj_ ? obj_->accepted() : false);
04700   }
04701 
04708   QObject *child(const QString &objName) {
04709     if (!obj_)
04710       return 0;
04711     QObject *o = obj_->child(objName, "QWidget");
04712     if (o) {
04713       if (::qt_cast<FLFieldDB *>(o)) {
04714         return new FLFieldDBInterface(static_cast<FLFieldDB *>(o));
04715       }
04716       if (::qt_cast<FLTableDB *>(o)) {
04717         return new FLTableDBInterface(static_cast<FLTableDB *>(o));
04718       }
04719       if (::qt_cast<FLTable *>(o)) {
04720         return new FLTablePlusInterface(static_cast<FLTable *>(o));
04721       }
04722       if (::qt_cast<QTable *>(o)) {
04723         return new FLTableInterface(static_cast<QTable *>(o));
04724       }
04725       if (::qt_cast<QTabWidget *>(o)) {
04726         return new FLTabWidgetInterface(static_cast<QTabWidget *>(o));
04727       }
04728       if (::qt_cast<QListView *>(o)) {
04729         return new FLListViewInterface(static_cast<QListView *>(o));
04730       }
04731     }
04732     return o;
04733   }
04734 
04740   bool close() {
04741     if (obj_) {
04742       bool ret = obj_->close();
04743       obj_ = 0;
04744       return ret;
04745     } else
04746       return false;
04747   }
04748 
04752   void accept() {
04753     if (obj_)
04754       obj_->accept();
04755   }
04756 
04760   void reject() {
04761     if (obj_)
04762       obj_->reject();
04763   }
04764 
04765   FLFormSearchDB *obj() {
04766     return obj_;
04767   }
04768 
04774   void setDisabled(const bool b) {
04775     if (obj_)
04776       obj_->setDisabled(b);
04777   }
04778 
04782   QImage snapShot() {
04783     return (obj_ ? obj_->snapShot() : QImage());
04784   }
04785 
04791   void saveSnapShot(const QString &pathFile) {
04792     saveSnapShot(pathFile);
04793   }
04794 
04798   void setMaximized() {
04799     if (obj_)
04800       obj_->setMaximized();
04801   }
04802 
04803 signals:
04804 
04808   void closed();
04809 
04813   void formReady();
04814 
04815 private:
04816 
04817   void connects() const;
04818 
04819   FLFormSearchDB *obj_;
04820   FLSqlCursorInterface *cursor_;
04821   QSScript *script_;
04822 };
04823 
04825 
04830 class  FLVarInterface : public QObject
04831 {
04832 
04833   Q_OBJECT
04834 
04835 public:
04836 
04840   FLVarInterface() {}
04841 
04845   ~FLVarInterface() {}
04846 
04847 public slots:
04848 
04856   bool set(const QString &n, const QVariant &v) {
04857     return FLVar::set(n, v);
04858   }
04859 
04866   QVariant get(const QString &n) {
04867     return FLVar::get(n);
04868   }
04869 };
04870 
04872 
04878 class  FLUtilInterface : public QObject
04879 {
04880   Q_OBJECT
04881   Q_ENUMS(specialType)
04882   Q_ENUMS(Type)
04883 
04884 public:
04885 
04886   enum specialType {
04887     Serial = 100,
04888     Unlock = 200,
04889     Check = 300
04890   };
04891 
04892   enum Type {
04893     Invalid,
04894     Map,
04895     List,
04896     String,
04897     StringList,
04898     Font,
04899     Pixmap,
04900     Brush,
04901     Rect,
04902     Size,
04903     Color,
04904     Palette,
04905     ColorGroup,
04906     IconSet,
04907     Point,
04908     Image,
04909     Int,
04910     UInt,
04911     Bool,
04912     Double,
04913     CString,
04914     PointArray,
04915     Region,
04916     Bitmap,
04917     Cursor,
04918     SizePolicy,
04919     Date,
04920     Time,
04921     DateTime,
04922     ByteArray,
04923     BitArray,
04924     KeySequence,
04925     Pen,
04926     LongLong,
04927     ULongLong
04928   };
04929 
04933   FLUtilInterface(QObject *parent = 0) : QObject(parent) {
04934     QObject::setName("FLUtil" + QDateTime::currentDateTime().toString("ddMMyyyyhhmmsszzz"));
04935   }
04936 
04937 public slots:
04947   QVariant partInteger(double n) {
04948     return QVariant((Q_ULLONG) FLUtil::partInteger(n));
04949   }
04950 
04960   QVariant partDecimal(double n) {
04961     return QVariant((Q_ULLONG) FLUtil::partDecimal(n));
04962   }
04963 
04973   QString buildNumber(const QVariant &v, char tipo, int partDecimal) {
04974     return FLUtil::buildNumber(v, tipo, partDecimal);
04975   }
04976   QString buildNumber(double v, char tipo, int partDecimal) {
04977     return buildNumber(QVariant(v), tipo, partDecimal);
04978   }
04979   QString buildNumber(int v, char tipo, int partDecimal) {
04980     return buildNumber(QVariant(v), tipo, partDecimal);
04981   }
04982 
04992   QVariant readSettingEntry(const QString &key, const QString &def = QString::null, bool *ok = 0) {
04993     return FLUtil::readSettingEntry(key, def, ok);
04994   }
04995 
05004   bool writeSettingEntry(const QString &key, const QString &value) {
05005     return FLUtil::writeSettingEntry(key, value);
05006   }
05007 
05015   QVariant readDBSettingEntry(const QString &key) {
05016     return FLUtil::readDBSettingEntry(key);
05017   }
05018 
05027   bool writeDBSettingEntry(const QString &key, const QString &value) {
05028     return FLUtil::writeDBSettingEntry(key, value);
05029   }
05030 
05040   QString roundFieldValue(const QVariant &n, const QString &table, const QString &field) {
05041     return FLUtil::roundFieldValue(n, table, field);
05042   }
05043   QString roundFieldValue(double n, const QString &table, const QString &field) {
05044     return roundFieldValue(QVariant(n), table, field);
05045   }
05046   QString roundFieldValue(int n, const QString &table, const QString &field) {
05047     return roundFieldValue(QVariant(n), table, field);
05048   }
05049 
05055   QString unidades(long n) {
05056     return FLUtil::unidades(n);
05057   }
05058 
05064   QString centenamillar(long n) {
05065     return FLUtil::centenamillar(n);
05066   }
05067 
05073   QString decenas(long n) {
05074     return FLUtil::decenas(n);
05075   }
05076 
05082   QString centenas(long n) {
05083     return FLUtil::centenas(n);
05084   }
05085 
05091   QString unidadesmillar(long n) {
05092     return FLUtil::unidadesmillar(n);
05093   }
05094 
05101   QCString utf8(const QString &s) {
05102     return FLUtil::utf8(s);
05103   }
05104 
05110   QString decenasmillar(long n) {
05111     return FLUtil::decenasmillar(n);
05112   }
05113 
05124   QString enLetra(long n) {
05125     return FLUtil::enLetra(n);
05126   }
05127 
05140   QString enLetraMoneda(double n, const QString &m) {
05141     return FLUtil::enLetraMoneda(n, m);
05142   }
05143 
05155   QString enLetraMonedaEuro(double n) {
05156     return FLUtil::enLetraMonedaEuro(n);
05157   }
05158 
05165   QString letraDni(long n) {
05166     return FLUtil::letraDni(n);
05167   }
05168 
05175   QString calcularDC(const QString &n) {
05176     return FLUtil::calcularDC(n);
05177   }
05178 
05186   QString dateDMAtoAMD(const QString &f) {
05187     return FLUtil::dateDMAtoAMD(f);
05188   }
05189 
05197   QString dateAMDtoDMA(const QString &f) {
05198     return FLUtil::dateAMDtoDMA(f);
05199   }
05200 
05210   QString formatoMiles(const QString &s) {
05211     return FLUtil::formatoMiles(s);
05212   }
05213 
05224   QString translate(const QString &contexto, const QString &s) {
05225     return FLUtil::translate(contexto, s);
05226   }
05227 
05236   bool numCreditCard(const QString &num) {
05237     return FLUtil::numCreditCard(num);
05238   }
05239 
05256   QVariant nextCounter(const QString &name, FLSqlCursorInterface *cursor_) {
05257     return FLUtil::nextCounter(name, cursor_->obj());
05258   }
05259 
05275   QString nextSequence(int nivel, const QString &secuencia, const QString &ultimo) {
05276     return FLUtil::nextSequence(nivel, secuencia, ultimo);
05277   }
05278 
05285   QString serialLettertoNumber(const QString &letter) {
05286     return FLUtil::serialLettertoNumber(letter);
05287   }
05288 
05294   QString serialNumbertoLetter(int number) {
05295     return FLUtil::serialNumbertoLetter(number);
05296   }
05297 
05309   bool isFLDefFile(const QString &head) {
05310     return FLUtil::isFLDefFile(head);
05311   }
05312 
05319   uint length(const QString &str) {
05320     return str.length();
05321   }
05322 
05329   QStringList nombreCampos(const QString &tabla) {
05330     return FLUtil::nombreCampos(tabla);
05331   }
05332 
05340   QString fieldNameToAlias(const QString &fN, const QString &tN, const QString &connName = "default") const;
05341 
05348   QString tableNameToAlias(const QString &tN, const QString &connName = "default") const;
05349 
05357   QString fieldAliasToName(const QString &aN, const QString &tN, const QString &connName = "default") const;
05358 
05366   int fieldType(const QString &fN, const QString &tN, const QString &connName = "default") const;
05367 
05375   int fieldLength(const QString &fN, const QString &tN, const QString &connName = "default") const;
05376 
05384   bool fieldAllowNull(const QString &fN, const QString &tN, const QString &connName = "default") const;
05385 
05393   bool fieldIsPrimaryKey(const QString &fN, const QString &tN, const QString &connName = "default") const;
05394 
05402   bool fieldIsCompoundKey(const QString &fN, const QString &tN, const QString &connName = "default") const;
05403 
05411   QVariant fieldDefaultValue(const QString &fN, const QString &tN, const QString &connName = "default") const;
05412 
05427   QString formatValue(int t, const QVariant &v, const bool upper = false,
05428                       const QString &connName = "default") const;
05429 
05437   QDate addDays(const QDate &d, int nd) {
05438     return FLUtil::addDays(d, nd);
05439   }
05440   QDate addDays(const QString &d, int nd) {
05441     return FLUtil::addDays(QDate::fromString(d, Qt::ISODate), nd);
05442   }
05443 
05451   QDate addMonths(const QDate &d, int nm) {
05452     return FLUtil::addMonths(d, nm);
05453   }
05454   QDate addMonths(const QString &d, int nm) {
05455     return FLUtil::addMonths(QDate::fromString(d, Qt::ISODate), nm);
05456   }
05457 
05465   QDate addYears(const QDate &d, int ny) {
05466     return FLUtil::addYears(d, ny);
05467   }
05468   QDate addYears(const QString &d, int ny) {
05469     return FLUtil::addYears(QDate::fromString(d, Qt::ISODate), ny);
05470   }
05471 
05479   int daysTo(const QDate &d1, const QDate &d2) {
05480     return FLUtil::daysTo(d1, d2);
05481   }
05482   int daysTo(const QString &d1, const QString &d2) {
05483     return FLUtil::daysTo(QDate::fromString(d1, Qt::ISODate),
05484                           QDate::fromString(d2, Qt::ISODate));
05485   }
05486 
05497   QVariant sqlSelect(const QString &f, const QString &s, const QString &w,
05498                      const QString &tL = QString::null,
05499                      const QString &connName = "default") {
05500     return FLUtil::sqlSelect(f, s, w, tL, 0, connName);
05501   }
05502 
05507   QVariant quickSqlSelect(const QString &f, const QString &s, const QString &w,
05508                           const QString &connName = "default") {
05509     return FLUtil::quickSqlSelect(f, s, w, connName);
05510   }
05511 
05521   bool sqlInsert(const QString &t, const QString &fL, const QString &vL, const QString &connName = "default") {
05522     return FLUtil::sqlInsert(t, fL, vL, connName);
05523   }
05524 
05535   bool sqlUpdate(const QString &t, const QString &fL, const QString &vL, const QString &w, const QString &connName = "default") {
05536     return FLUtil::sqlUpdate(t, fL, vL, w, connName);
05537   }
05538 
05547   bool sqlDelete(const QString &t, const QString &w, const QString &connName = "default") {
05548     return FLUtil::sqlDelete(t, w, connName);
05549   }
05550 
05555   bool quickSqlDelete(const QString &t, const QString &w, const QString &connName = "default") {
05556     return FLUtil::quickSqlDelete(t, w, connName);
05557   }
05558 
05565   void createProgressDialog(const QString &l, int tS) {
05566     FLUtil::createProgressDialog(l, tS, QObject::name());
05567   }
05568   void createProgressDialog() {
05569     FLUtil::createProgressDialog(QString::null, 0, QObject::name());
05570   }
05571 
05575   void destroyProgressDialog() {
05576     FLUtil::destroyProgressDialog(QObject::name());
05577   }
05578 
05584   void setProgress(int p) {
05585     FLUtil::setProgress(p, QObject::name());
05586   }
05587 
05593   void setTotalSteps(int tS) {
05594     FLUtil::setTotalSteps(tS, QObject::name());
05595   }
05596 
05602   void setLabelText(const QString &l) {
05603     FLUtil::setLabelText(l, QObject::name());
05604   }
05605 
05612   QString sha1(const QString &str) {
05613     return FLUtil::sha1(str);
05614   }
05615 
05621   QImage snapShotUI(const QString &n) {
05622     return FLUtil::snapShotUI(n);
05623   }
05624 
05631   void saveSnapShotUI(const QString &n, const QString &pathFile) {
05632     FLUtil::saveSnapShotUI(n, pathFile);
05633   }
05634 
05641   void saveIconFile(const QString &data, const QString &pathFile) {
05642     FLUtil::saveIconFile(data, pathFile);
05643   }
05644 
05650   QString getIdioma() {
05651     return FLUtil::getIdioma();
05652   }
05653 
05659   QString getOS() {
05660     return FLUtil::getOS();
05661   }
05662 
05688   QStringList findFiles(const QStringList &paths, const QString &filter = "*",
05689                         bool breakOnFirstMatch = false) {
05690     return FLUtil::findFiles(paths, filter, breakOnFirstMatch);
05691   }
05692 
05693   bool execSql(const QString &sql, const QString &connName = "default") {
05694     return FLUtil::execSql(sql, connName);
05695   }
05696 
05700   void setFastRandSeed(uint seed) {
05701     aq_seed_rand = seed;
05702   }
05703   uint fastRand() const {
05704     uint t;
05705     aq_seed_rand_x ^= aq_seed_rand_x << 16;
05706     aq_seed_rand_x ^= aq_seed_rand_x >> 5;
05707     aq_seed_rand_x ^= aq_seed_rand_x << 1;
05708 
05709     t = aq_seed_rand_x;
05710     aq_seed_rand_x = aq_seed_rand_y;
05711     aq_seed_rand_y = aq_seed_rand_z;
05712     aq_seed_rand_z = t ^ aq_seed_rand_x ^ aq_seed_rand_y;
05713 
05714     return aq_seed_rand_z % aq_seed_rand;
05715   }
05716 
05717 private:
05718   // Ver FLUtilInterface::fastRand()
05719   static uint aq_seed_rand;
05720   static uint aq_seed_rand_x;
05721   static uint aq_seed_rand_y;
05722   static uint aq_seed_rand_z;
05723 };
05724 
05726 
05732 class  FLCodBarInterface : public QObject
05733 {
05734 
05735   Q_OBJECT
05736 
05737 public:
05738 
05742   FLCodBarInterface(const QString &value, int type, int margin, double scale, double cut, int rotation,
05743                     bool text_flag = false, QColor fg = Qt::black, QColor bg = Qt::white, int res = 72) : obj_(0), owner(false) {
05744     obj_ = new FLCodBar(value, type, margin, scale, cut, rotation, text_flag, fg, bg, res);
05745     owner = true;
05746   }
05747 
05751   FLCodBarInterface(FLCodBar *obj) : QObject(obj), obj_(0), owner(false) {
05752     obj_ = obj;
05753     owner = false;
05754   }
05755 
05759   ~FLCodBarInterface() {
05760     if (owner && obj_)
05761       obj_->deleteLater();
05762   }
05763 
05764 public slots:
05765 
05771   QPixmap pixmap() {
05772     return obj_->pixmap();
05773   }
05774 
05778   QPixmap pixmapError() {
05779     return obj_->pixmapError();
05780   }
05781 
05788   QString typeToName(const int t) {
05789     return FLCodBar::typeToName(t);
05790   }
05791 
05797   QString value() {
05798     return obj_->value();
05799   }
05800 
05806   int type() {
05807     return obj_->type();
05808   }
05809 
05815   int margin() {
05816     return obj_->margin();
05817   }
05818 
05824   double scale() {
05825     return obj_->scale();
05826   }
05827 
05830   double cut() {
05831     return obj_->cut();
05832   }
05833 
05836   bool text() {
05837     return obj_->text();
05838   }
05839 
05842   int rotation() {
05843     return obj_->rotation();
05844   }
05845 
05851   QColor fg() {
05852     return obj_->fg();
05853   }
05854 
05860   QColor bg() {
05861     return obj_->bg();
05862   }
05863 
05869   int res() {
05870     return obj_->res();
05871   }
05872 
05878   bool validBarcode() {
05879     return obj_->validBarcode();
05880   }
05881 
05884   void setCaption(const QString &caption) {
05885     obj_->setCaption(caption);
05886   }
05887 
05890   QString caption() {
05891     return obj_->caption();
05892   }
05893 
05899   void setValue(const QString &value) {
05900     obj_->setValue(value);
05901   }
05902 
05908   void setType(const int type) {
05909     obj_->setType(type);
05910   }
05911 
05917   void setMargin(const int margin) {
05918     obj_->setMargin(margin);
05919   }
05920 
05926   void setScale(const double scale) {
05927     obj_->setScale(scale);
05928   }
05929 
05932   void setCut(const double cut) {
05933     obj_->setCut(cut);
05934   }
05935 
05938   void setText(const bool text) {
05939     obj_->setText(text);
05940   }
05941 
05944   void setRotation(const int rotation) {
05945     obj_->setRotation(rotation);
05946   }
05947 
05953   void setFg(const QColor &fg) {
05954     obj_->setFg(fg);
05955   }
05956 
05962   void setBg(const QColor &bg) {
05963     obj_->setBg(bg);
05964   }
05965 
05973   void setRes(const int res) {
05974     obj_->setRes(res);
05975   }
05976 
05983   int nameToType(const QString &n) {
05984     return FLCodBar::nameToType(n);
05985   }
05986 
05990   void cleanUp() {
05991     obj_->cleanUp();
05992   }
05993 
05994   FLCodBar *obj() {
05995     return obj_;
05996   }
05997 
05998 private:
05999 
06000   FLCodBar *obj_;
06001   bool owner;
06002 };
06003 
06005 
06011 class  FLScriptEditorInterface : public QObject
06012 {
06013 
06014   Q_OBJECT
06015 
06016 public:
06017 
06023   FLScriptEditorInterface(const QString &nFS) : obj_(0) {
06024     obj_ = new FLScriptEditor(nFS, qApp->mainWidget());
06025   }
06026 
06030   ~FLScriptEditorInterface() {}
06031 
06032 public slots:
06033 
06037   void setCode(const QString &c) {
06038     obj_->setCode(c);
06039   }
06040 
06044   QString code() const {
06045     return obj_->code();
06046   }
06047 
06053   int exec() {
06054     return obj_->exec();
06055   }
06056 
06057   FLScriptEditor *obj() {
06058     return obj_;
06059   }
06060 
06061 private:
06062 
06063   FLScriptEditor *obj_;
06064 };
06065 
06067 
06072 class  FLDomNodeListInterface : public QObject
06073 {
06074 
06075   Q_OBJECT
06076 
06077 public:
06078 
06082   FLDomNodeListInterface(QObject *parent = 0)
06083     : QObject(parent) {
06084   }
06085 
06089   FLDomNodeListInterface(const QDomNodeList &nl, QObject *parent = 0)
06090     : QObject(parent),
06091       nl_(nl) {
06092   }
06093 
06097   ~FLDomNodeListInterface() {}
06098 
06099 public slots:
06100 
06107   FLDomNodeInterface *item(int index);
06108 
06114   uint length() const {
06115     return nl_.length();
06116   }
06117   uint count() const {
06118     return nl_.count();
06119   }
06120 
06121   QDomNodeList obj() {
06122     return nl_;
06123   }
06124 
06125 private:
06126 
06127   QDomNodeList nl_;
06128 };
06129 
06131 
06137 class  FLDomNodeInterface : public QObject
06138 {
06139   Q_OBJECT
06140 
06141 public:
06142 
06146   FLDomNodeInterface(QObject *parent = 0)
06147     : QObject(parent),
06148       dn_(0),
06149       type_(QDomNode::BaseNode) {
06150     setIdNode();
06151   }
06152   FLDomNodeInterface(QDomNode::NodeType type, QObject *parent = 0)
06153     : QObject(parent),
06154       dn_(0),
06155       type_(type) {
06156     setIdNode();
06157   }
06158   FLDomNodeInterface(const QDomNode &n, QObject *parent = 0)
06159     : QObject(parent),
06160       dn_(n.isNull() ? 0 : new QDomNode(n)),
06161       type_(QDomNode::BaseNode) {
06162     setIdNode();
06163   }
06164   FLDomNodeInterface(const QDomElement &n, QObject *parent = 0)
06165     : QObject(parent),
06166       dn_(n.isNull() ? 0 : new QDomElement(n)),
06167       type_(QDomNode::ElementNode) {
06168     setIdNode();
06169   }
06170   FLDomNodeInterface(const QDomText &n, QObject *parent = 0)
06171     : QObject(parent),
06172       dn_(n.isNull() ? 0 : new QDomText(n)),
06173       type_(QDomNode::TextNode) {
06174     setIdNode();
06175   }
06176   FLDomNodeInterface(const QDomDocument &n, QObject *parent = 0)
06177     : QObject(parent),
06178       dn_(n.isNull() ? 0 : new QDomDocument(n)),
06179       type_(QDomNode::DocumentNode) {
06180     setIdNode();
06181   }
06182 
06186   virtual ~FLDomNodeInterface();
06187 
06188   static FLDomNodeInterface *nodeInterface(const QDomNode &n);
06189   static FLDomNodeInterface *nodeInterface(const QDomElement &n);
06190   static FLDomNodeInterface *nodeInterface(const QDomText &n);
06191   static FLDomNodeInterface *nodeInterface(const QDomDocument &n);
06192 
06193   QDomNode *newNode() {
06194     delete dn_;
06195     dn_ = 0;
06196     switch (type_) {
06197       case QDomNode::ElementNode:
06198         dn_ = new QDomElement();
06199         break;
06200       case QDomNode::TextNode:
06201         dn_ = new QDomText();
06202         break;
06203       case QDomNode::DocumentNode:
06204         dn_ = new QDomDocument();
06205         break;
06206       default:
06207         dn_ = new QDomNode();
06208     }
06209     return dn_;
06210   }
06211 
06212   void updateNode(const QDomNode &n) {
06213     if (dn_)
06214       *dn_ = n;
06215     else
06216       dn_ = new QDomNode(n);
06217   }
06218 
06219   void updateNode(const QDomElement &n) {
06220     if (dn_) {
06221       if (type_ != QDomNode::ElementNode) {
06222         delete dn_;
06223         dn_ = new QDomElement(n);
06224       } else
06225         *dn_ = n;
06226     } else
06227       dn_ = new QDomElement(n);
06228     type_ = QDomNode::ElementNode;
06229   }
06230 
06231   void updateNode(const QDomText &n) {
06232     if (dn_) {
06233       if (type_ != QDomNode::TextNode) {
06234         delete dn_;
06235         dn_ = new QDomText(n);
06236       } else
06237         *dn_ = n;
06238     } else
06239       dn_ = new QDomText(n);
06240     type_ = QDomNode::TextNode;
06241   }
06242 
06243   void updateNode(const QDomDocument &n) {
06244     if (dn_) {
06245       if (type_ != QDomNode::DocumentNode) {
06246         delete dn_;
06247         dn_ = new QDomDocument(n);
06248       } else
06249         *dn_ = n;
06250     } else
06251       dn_ = new QDomDocument(n);
06252     type_ = QDomNode::DocumentNode;
06253   }
06254 
06255   void setIdNode();
06256 
06257   QDomNode::NodeType type() const {
06258     return type_;
06259   }
06260 
06261 public slots:
06262 
06266   QString idNode() const {
06267     return QString::number(idNode_);
06268   }
06269 
06276   FLDomNodeInterface *nodeFromIdNode(const QString &id) const;
06277 
06281   void clear() {
06282     delete dn_;
06283     dn_ = 0;
06284   }
06285 
06291   QString nodeValue() const {
06292     return (dn_ ? dn_->nodeValue() : QString::null);
06293   }
06294 
06300   QString nodeName() const {
06301     return (dn_ ? dn_->nodeName() : QString::null);
06302   }
06303 
06309   FLDomNodeInterface *toElement() {
06310     return (dn_ ? nodeInterface(dn_->toElement()) : 0);
06311   }
06312 
06318   bool isElement() const {
06319     return (dn_ ? dn_->isElement() : false);
06320   }
06321 
06327   bool isText() const {
06328     return (dn_ ? dn_->isText() : false);
06329   }
06330 
06336   bool isComment() const {
06337     return (dn_ ? dn_->isComment() : false);
06338   }
06339 
06345   FLDomNodeInterface *nextSibling() {
06346     return (dn_ ? nodeInterface(dn_->nextSibling()) : 0);
06347   }
06348 
06354   FLDomNodeInterface *previousSibling() {
06355     return (dn_ ? nodeInterface(dn_->previousSibling()) : 0);
06356   }
06357 
06363   FLDomNodeInterface *namedItem(const QString &name) {
06364     return (dn_ ? nodeInterface(dn_->namedItem(name)) : 0);
06365   }
06366 
06373   FLDomNodeInterface *cloneNode(bool deep = true) {
06374     return nodeInterface(DN_->cloneNode(deep));
06375   }
06376 
06383   bool isEqualNode(FLDomNodeInterface *n) {
06384     if (!n)
06385       return false;
06386     QDomDocument d1;
06387     QDomDocument d2;
06388     QString content = "<dd/>";
06389     d1.setContent(content);
06390     d2.setContent(content);
06391     d1.firstChild().appendChild(DN_->cloneNode());
06392     d2.firstChild().appendChild(n->obj().cloneNode());
06393     return (d1.toString() == d2.toString());
06394   }
06395 
06403   FLDomNodeInterface *insertBefore(FLDomNodeInterface *newChild, FLDomNodeInterface *refChild = 0) {
06404     if (!dn_ || !newChild)
06405       return 0;
06406     if (!refChild)
06407       return nodeInterface(dn_->insertBefore(newChild->obj(), QDomNode()));
06408     return nodeInterface(dn_->insertBefore(newChild->obj(), refChild->obj()));
06409   }
06410 
06418   FLDomNodeInterface *insertAfter(FLDomNodeInterface *newChild, FLDomNodeInterface *refChild) {
06419     return ((dn_ && newChild && refChild) ? nodeInterface(dn_->insertAfter(newChild->obj(), refChild->obj())) : 0);
06420   }
06421 
06429   FLDomNodeInterface *removeChild(FLDomNodeInterface *oldChild) {
06430     return ((dn_ && oldChild) ? nodeInterface(dn_->removeChild(oldChild->obj())) : 0);
06431   }
06432 
06438   bool hasAttributes() const {
06439     return (dn_ ? dn_->hasAttributes() : false);
06440   }
06441 
06447   bool hasChildNodes() const {
06448     return (dn_ ? dn_->hasChildNodes() : false);
06449   }
06450 
06457   QString attributeValue(const QString &att) const {
06458     if (!hasAttributes())
06459       return QString::null;
06460     QDomNode n(dn_->attributes().namedItem(att));
06461     return (n.isNull() ? QString::null : n.nodeValue());
06462   }
06463 
06469   QString comment() const {
06470     if (!dn_)
06471       return QString::null;
06472     QDomNodeList nl(dn_->childNodes());
06473     uint ncount = nl.count();
06474     for (uint i = 0; i < ncount; ++i) {
06475       if (nl.item(i).isComment())
06476         return nl.item(i).nodeValue();
06477     }
06478     return QString::null;
06479   }
06480 
06486   void setNodeValue(const QString &v) {
06487     DN_->setNodeValue(v);
06488   }
06489 
06495   FLDomNodeInterface *firstChild() {
06496     return (dn_ ? nodeInterface(dn_->firstChild()) : 0);
06497   }
06498 
06504   FLDomNodeInterface *lastChild() {
06505     return (dn_ ? nodeInterface(dn_->lastChild()) : 0);
06506   }
06507 
06513   FLDomNodeInterface *parentNode() {
06514     return (dn_ ? nodeInterface(dn_->parentNode()) : 0);
06515   }
06516 
06523   FLDomNodeInterface *appendChild(FLDomNodeInterface *newChild) {
06524     return (newChild ? nodeInterface(DN_->appendChild(newChild->obj())) : 0);
06525   }
06526 
06534   FLDomNodeInterface *replaceChild(FLDomNodeInterface *newChild, FLDomNodeInterface *oldChild) {
06535     return ((newChild && oldChild) ? nodeInterface(DN_->replaceChild(newChild->obj() , oldChild->obj())) : 0);
06536   }
06537 
06543   FLDomNodeListInterface *childNodes() const {
06544     return (hasChildNodes() ? new FLDomNodeListInterface(dn_->childNodes()) : 0);
06545   }
06546 
06552   FLDomNodeInterface *ownerDocument() const {
06553     return (dn_ ? nodeInterface(dn_->ownerDocument()) : 0);
06554   }
06555 
06561   bool isNull() const {
06562     return (dn_ ? dn_->isNull() : true);
06563   }
06564 
06568   QDomNode::NodeType nodeType() const {
06569     return (dn_ ? dn_->nodeType() : QDomNode::BaseNode);
06570   }
06571 
06575   QDomNode obj() {
06576     return *DN_;
06577   }
06578   QDomNode *ptroObj() {
06579     return dn_;
06580   }
06581 
06583 
06595   QString text() const {
06596     return ((dn_ && type_ == QDomNode::ElementNode) ?
06597             static_cast<QDomElement *>(dn_)->text() :
06598             QString::null);
06599   }
06600 
06608   QString attribute(const QString &name, const QString &defValue = QString::null) const {
06609     return ((dn_ && type_ == QDomNode::ElementNode) ?
06610             static_cast<QDomElement *>(dn_)->attribute(name, defValue) :
06611             QString::null);
06612   }
06613 
06620   void setAttribute(const QString &name, const QString &value) {
06621     if (type_ == QDomNode::ElementNode)
06622       static_cast<QDomElement *>(DN_)->setAttribute(name, value);
06623   }
06624 
06630   void removeAttribute(const QString &name) {
06631     if (dn_ && type_ == QDomNode::ElementNode)
06632       static_cast<QDomElement *>(dn_)->removeAttribute(name);
06633   }
06634 
06636 
06648   bool setContent(const QString &buffer);
06649 
06656   FLDomNodeInterface *createElement(const QString &tagName) {
06657     if (type_ != QDomNode::DocumentNode)
06658       return 0;
06659     return nodeInterface(static_cast<QDomDocument *>(DN_)->createElement(tagName));
06660   }
06661 
06668   FLDomNodeInterface *createTextNode(const QString &value) {
06669     if (type_ != QDomNode::DocumentNode)
06670       return 0;
06671     return nodeInterface(static_cast<QDomDocument *>(DN_)->createTextNode(value));
06672   }
06673 
06679   QString toString(const int indent = 0) {
06680     return ((dn_ && type_ == QDomNode::DocumentNode) ?
06681             static_cast<QDomDocument *>(dn_)->toString(indent) :
06682             QString::null);
06683   }
06684 
06691   FLDomNodeListInterface *elementsByTagName(const QString &tagName) const {
06692     if (!dn_)
06693       return 0;
06694     QDomNodeList nl;
06695     if (type_ == QDomNode::ElementNode)
06696       nl = QDomNodeList(static_cast<QDomElement *>(dn_)->elementsByTagName(tagName));
06697     else if (type_ == QDomNode::DocumentNode)
06698       nl = QDomNodeList(static_cast<QDomDocument *>(dn_)->elementsByTagName(tagName));
06699     return (nl.count() ? new FLDomNodeListInterface(nl) : 0);
06700   }
06701 
06707   void cleanup();
06708 
06709 public:
06710 
06711   static void cleanupDomNodesCache();
06712 
06713 private:
06714 
06715   QDomNode *dn_;
06716   QDomNode::NodeType type_;
06717   uint idNode_;
06718 
06719   static FLDomNodesCache *nodesCache;
06720   static uint idNodeGlob;
06721 
06722   friend class FLObjectFactory;
06723 };
06724 
06725 inline FLDomNodeInterface *FLDomNodeListInterface::item(int index)
06726 {
06727   return FLDomNodeInterface::nodeInterface(nl_.item(index));
06728 }
06729 
06731 
06744 class  FLReportViewerInterface : public QObject
06745 {
06746 
06747   Q_OBJECT
06748   Q_ENUMS(RenderReportFlags)
06749 
06750 public:
06751 
06752   enum RenderReportFlags {
06753     Append    = 0x00000001,
06754     Display   = 0x00000002,
06755     PageBreak = 0x00000004
06756   };
06757 
06761   FLReportViewerInterface() : QObject(0), obj_(0) {
06762     obj_ = new FLReportViewer();
06763     connects();
06764   }
06765 
06769   FLReportViewerInterface(FLReportViewer *obj) : QObject(obj), obj_(0) {
06770     obj_ = obj;
06771     connects();
06772   }
06773 
06777   FLReportViewerInterface(QWidget *w, bool) : QObject(w) {
06778     obj_ = new FLReportViewer(w, 0, true);
06779     connects();
06780   }
06781 
06785   FLReportViewerInterface(FLReportEngine *r) : QObject(0) {
06786     obj_ = new FLReportViewer(0, 0, false, r);
06787     connects();
06788   }
06789 
06793   ~FLReportViewerInterface() {}
06794 
06795 public slots:
06796 
06806   // Obsoleta
06807   //   bool renderReport(const int initRow = 0, const int initCol = 0, const bool append = false, const bool displayReport = true) {
06808   //     return obj_->renderReport(initRow, initCol, append, displayReport);
06809   //   }
06810   bool renderReport(const int initRow = 0, const int initCol = 0, const uint flags = FLReportViewerInterface::Display) {
06811     return obj_->renderReport(initRow, initCol, flags);
06812   }
06813 
06820   bool setReportData(FLSqlQueryInterface *q) {
06821     return obj_->setReportData(q->obj());
06822   }
06823 
06830   bool setReportData(FLDomNodeInterface *xmlDoc) {
06831     if (xmlDoc)
06832       return obj_->setReportData(xmlDoc->obj());
06833     return false;
06834   }
06835 
06845   bool setReportTemplate(const QString &t, const QString &style = QString::null) {
06846     return obj_->setReportTemplate(t, style);
06847   }
06848 
06858   bool setReportTemplate(FLDomNodeInterface *xmlDoc, const QString &style = QString::null) {
06859     if (!xmlDoc) {
06860       return false;
06861     }
06862     return obj_->setReportTemplate(xmlDoc->obj(), style);
06863   }
06864 
06873   FLDomNodeInterface *reportData() const {
06874     return obj_->rptEngine()->reportData();
06875   }
06876 
06885   FLDomNodeInterface *reportTemplate() const {
06886     return obj_->rptEngine()->reportTemplate();
06887   }
06888 
06892   void exec() {
06893     obj_->exec();
06894   }
06895   void show() {
06896     obj_->exec();
06897   }
06898 
06904   QString csvData() {
06905     return obj_->csvData();
06906   }
06907 
06911   void printReport() {
06912     obj_->slotPrintReport();
06913   }
06914 
06918   void printReportToPS(const QString &outPsFile) {
06919     obj_->slotPrintReportToPS(outPsFile);
06920   }
06921 
06925   void printReportToPDF(const QString &outPdfFile) {
06926     obj_->slotPrintReportToPDF(outPdfFile);
06927   }
06928 
06932   void setNumCopies(const int numCopies) {
06933     obj_->setNumCopies(numCopies);
06934   }
06935 
06939   void setPrintToPos(bool ptp) {
06940     obj_->setPrintToPos(ptp);
06941   }
06942 
06950   void setPrinterName(const QString &pName) {
06951     obj_->setPrinterName(pName);
06952   }
06953 
06957   bool reportPrinted() {
06958     obj_->reportPrinted();
06959   }
06960 
06966   void reparent(QWidget *parentFrame) {
06967     obj_->rptViewerReparent(parentFrame);
06968   }
06969 
06973   void slotFirstPage() {
06974     obj_->slotFirstPage();
06975   }
06976 
06980   void slotLastPage() {
06981     obj_->slotLastPage();
06982   }
06983 
06987   void slotNextPage() {
06988     obj_->slotNextPage();
06989   }
06990 
06994   void slotPrevPage() {
06995     obj_->slotPrevPage();
06996   }
06997 
07001   void slotZoomUp() {
07002     obj_->slotZoomUp();
07003   }
07004 
07008   void slotZoomDown() {
07009     obj_->slotZoomDown();
07010   }
07011 
07015   void exportFileCSVData() {
07016     obj_->exportFileCSVData();
07017   }
07018 
07022   void exportToPDF() {
07023     obj_->exportToPDF();
07024   }
07025 
07029   void sendEMailPDF() {
07030     obj_->sendEMailPDF();
07031   }
07032 
07036   void saveSVGStyle() {
07037     obj_->saveSVGStyle();
07038   }
07039 
07043   void saveSimpleSVGStyle() {
07044     obj_->saveSimpleSVGStyle();
07045   }
07046 
07050   void loadSVGStyle() {
07051     obj_->exportFileCSVData();
07052   }
07053 
07059   void setAutoClose(const bool b) {
07060     obj_->setAutoClose(b);
07061   }
07062 
07068   void setResolution(int dpi) {
07069     obj_->setResolution(dpi);
07070   }
07071   void setPixel(int relDpi) {
07072     obj_->setPixel(relDpi);
07073   }
07074   void setDefaults() {
07075     obj_->setDefaults();
07076   }
07077 
07084   void updateReport() {
07085     obj_->updateReport();
07086   }
07087 
07091   void  updateDisplay() {
07092     obj_->updateDisplay();
07093   }
07094 
07098   void setStyleName(const QString &style) {
07099     obj_->setStyleName(style);
07100   }
07101 
07105   MReportViewer *rptViewer() {
07106     return obj_->rptViewer();
07107   }
07108 
07112   void setReportEngine(FLReportEngine *r) {
07113     obj_->setReportEngine(r);
07114   }
07115 
07119   void rptViewerEmbedInParent(QWidget *parentFrame) {
07120     obj_->rptViewerEmbedInParent(parentFrame);
07121   }
07122 
07132   void setReportPages(FLReportPages *pgs) {
07133     obj_->setReportPages(pgs);
07134   }
07135 
07141   FLPicture *getCurrentPage() {
07142     return obj_->getCurrentPage();
07143   }
07144   FLPicture *getFirstPage() {
07145     return obj_->getFirstPage();
07146   }
07147   FLPicture *getPreviousPage() {
07148     return obj_->getPreviousPage();
07149   }
07150   FLPicture *getNextPage() {
07151     return obj_->getNextPage();
07152   }
07153   FLPicture *getLastPage() {
07154     return obj_->getLastPage();
07155   }
07156   FLPicture *getPageAt(uint i) {
07157     return obj_->getPageAt(i);
07158   }
07159   void clearPages() {
07160     obj_->clearPages();
07161   }
07162   void appendPage() {
07163     obj_->appendPage();
07164   }
07165   int getCurrentIndex() {
07166     return obj_->getCurrentIndex();
07167   }
07168   void setCurrentPage(int idx) {
07169     obj_->setCurrentPage(idx);
07170   }
07171   void setPageSize(int s) {
07172     obj_->setPageSize(s);
07173   }
07174   void setPageOrientation(int o) {
07175     obj_->setPageOrientation(o);
07176   }
07177   void setPageDimensions(QSize dim) {
07178     obj_->setPageDimensions(dim);
07179   }
07180   int pageSize() {
07181     return obj_->pageSize();
07182   }
07183   int pageOrientation() {
07184     return obj_->pageOrientation();
07185   }
07186   QSize pageDimensions() {
07187     return obj_->pageDimensions();
07188   }
07189   int pageCount() {
07190     return obj_->pageCount();
07191   }
07192 
07199   QObject *child(const QString &objName) {
07200     if (!obj_)
07201       return 0;
07202     return obj_->child(objName);
07203   }
07204 
07213   void disableSlotsPrintExports(bool disablePrints = true, bool disableExports = true) {
07214     obj_->disableSlotsPrintExports(disablePrints, disableExports);
07215   }
07216 
07217   void setName(const QString &n) {
07218     obj_->setName(n);
07219   }
07220 
07221   FLReportViewer *obj() {
07222     return obj_;
07223   }
07224 
07225 signals:
07226 
07230   void requestUpdateReport();
07231 
07232 private:
07233 
07234   void connects() const {
07235     connect(obj_, SIGNAL(requestUpdateReport()), this, SIGNAL(requestUpdateReport()));
07236     connect(obj_, SIGNAL(destroyed()), this, SIGNAL(destroyed()));
07237   }
07238 
07239   FLReportViewer *obj_;
07240 };
07241 
07243 
07248 class  FLProcessInterface : public QProcess
07249 {
07250 
07251   Q_OBJECT
07252 
07253 public:
07254 
07258   FLProcessInterface() : obj_(0) {
07259     obj_ = new QProcess();
07260     connects();
07261   };
07262 
07266   FLProcessInterface(const QString &arg0) : obj_(0) {
07267     obj_ = new QProcess(arg0);
07268     connects();
07269   };
07270 
07274   ~FLProcessInterface() {
07275     if (obj_)
07276       obj_->deleteLater();
07277   }
07278 
07279 public slots:
07280 
07286   bool start() {
07287     return obj_->start();
07288   }
07289 
07293   void setWorkingDirectory(const QString &path) {
07294     QDir dir(path);
07295     obj_->setWorkingDirectory(dir);
07296   }
07297 
07303   void setArguments(const QStringList &args) {
07304     obj_->setArguments(args);
07305   }
07306 
07312   void addArgument(const QString &arg) {
07313     obj_->addArgument(arg);
07314   }
07315 
07321   bool isRunning() {
07322     return obj_->isRunning();
07323   }
07324 
07330   QByteArray readStdout() {
07331     return obj_->readStdout();
07332   }
07333 
07334   void emitExited() {
07335     emit exited();
07336   }
07337 
07338 signals:
07339 
07343   void exited();
07344 
07345 private:
07346 
07347   void connects() {
07348     disconnect(obj_, SIGNAL(processExited()), this, SLOT(emitExited()));
07349     connect(obj_, SIGNAL(processExited()), this, SLOT(emitExited()));
07350   }
07351 
07352   QProcess *obj_;
07353 };
07354 
07355 class  FLPosPrinterInterface : public QObject
07356 {
07357 
07358   Q_OBJECT
07359   Q_ENUMS(PaperWidth)
07360 
07361 public:
07362 
07363   enum PaperWidth {P57_5MM, P69_5MM, P76MM, NPaperWidth = P76MM};
07364 
07368   FLPosPrinterInterface() : obj_(0) {
07369     obj_ = new FLPosPrinter();
07370   }
07371 
07375   ~FLPosPrinterInterface() {
07376     if (obj_)
07377       delete obj_;
07378   }
07379 
07380 public slots:
07381 
07382   int paperWidth() {
07383     return obj_->paperWidth();
07384   }
07385 
07386   void setPaperWidth(int pw) {
07387     obj_->setPaperWidth((FLPosPrinter::PaperWidth)pw);
07388   }
07389 
07390   const QString &printerName() {
07391     return obj_->printerName();
07392   }
07393 
07394   void setPrinterName(const QString &pName) {
07395     obj_->setPrinterName(pName);
07396   }
07397 
07398   void cleanup() {
07399     obj_->cleanup();
07400   }
07401 
07402   void flush() {
07403     obj_->flush();
07404   }
07405 
07406   void send(const QString &str, const int col = -1, const int row = -1) {
07407     obj_->send(str, col, row);
07408   }
07409 
07410 private:
07411 
07412   FLPosPrinter *obj_;
07413 };
07414 
07416 
07424 class  FLSmtpClientInterface : public QObject
07425 {
07426   Q_OBJECT
07427 
07428 public:
07429 
07433   FLSmtpClientInterface() : QObject(0) {
07434     obj_ = new FLSmtpClient(this);
07435     connects();
07436   }
07437 
07441   FLSmtpClientInterface(FLSmtpClient *obj) : QObject(obj), obj_(0) {
07442     obj_ = obj;
07443   }
07444 
07448   ~FLSmtpClientInterface() {}
07449 
07450 public slots:
07451 
07457   void setFrom(const QString &from) {
07458     obj_->setFrom(from);
07459   }
07460 
07466   void setTo(const QString &to) {
07467     obj_->setTo(to);
07468   }
07469 
07475   void setSubject(const QString &subject) {
07476     obj_->setSubject(subject);
07477   }
07478 
07484   void setBody(const QString &body) {
07485     obj_->setBody(body);
07486   }
07487 
07494   void addAttachment(const QString &attach, const QString &cid = QString::null) {
07495     obj_->addAttachment(attach, cid);
07496   }
07497 
07504   void addTextPart(const QString &text, const QString &mimeType = "text/plain") {
07505     obj_->addTextPart(text, mimeType);
07506   }
07507 
07516   void setMailServer(const QString &mS) {
07517     obj_->setMailServer(mS);
07518   }
07519 
07527   void setMimeType(const QString &mT) {
07528     obj_->setMimeType(mT);
07529   }
07530 
07534   void startSend() {
07535     obj_->startSend();
07536   }
07537 
07538   void emitStatus(const QString &st) {
07539     emit status(st);
07540   }
07541 
07542   void emitSendStarted() {
07543     emit sendStarted();
07544   }
07545 
07546   void emitSendEnded() {
07547     emit sendEnded();
07548   }
07549 
07550   void emitSendTotalSteps(int ts) {
07551     emit sendTotalSteps(ts);
07552   }
07553 
07554   void emitSendStepNumber(int sn) {
07555     emit sendStepNumber(sn);
07556   }
07557 
07558   FLSmtpClient *obj() {
07559     return obj_;
07560   }
07561 
07562 signals:
07563 
07567   void status(const QString &);
07568 
07572   void sendStarted();
07573 
07577   void sendEnded();
07578 
07582   void sendTotalSteps(int);
07583 
07587   void sendStepNumber(int);
07588 
07589 private:
07590 
07591   void connects() const;
07592 
07593   FLSmtpClient *obj_;
07594 };
07595 
07596 class  FLImageViewerInterface : public QObject
07597 {
07598 
07599   Q_OBJECT
07600 
07601 public:
07602 
07606   FLImageViewerInterface() : QObject(0) {
07607     obj_ = new FLImageViewer();
07608   }
07609 
07613   FLImageViewerInterface(FLImageViewer *obj) : QObject(obj), obj_(0) {
07614     obj_ = obj;
07615   }
07616 
07620   ~FLImageViewerInterface() {}
07621 
07622 public slots:
07623 
07624   bool loadImage(const QString &pathFile) {
07625     obj_->loadImage(pathFile);
07626   }
07627 
07628   void openFile() {
07629     obj_->openFile();
07630   }
07631 
07632   void show() {
07633     obj_->show();
07634   }
07635 
07636   void close() {
07637     obj_->close();
07638   }
07639 
07640   QString fileName() {
07641     return obj_->filename;
07642   }
07643 
07644   void saveImage(int f) {
07645     obj_->saveImage(f);
07646   }
07647 
07648   void savePixmap(int f) {
07649     obj_->savePixmap(f);
07650   }
07651 
07652   void setImage(const QVariant &v) {
07653     obj_->setImage(QImage(v.toCString()));
07654   }
07655 
07656   void setImage(const QPixmap &p) {
07657     obj_->setImage(p.convertToImage());
07658   }
07659 
07660 private:
07661 
07662   FLImageViewer *obj_;
07663 };
07664 
07665 class  FLSerialPortInterface : public QObject
07666 {
07667   Q_OBJECT
07668   Q_ENUMS(BaudRateType DataBitsType ParityType StopBitsType FlowType)
07669 
07670 public:
07671 
07672   enum BaudRateType {
07673     BAUD50, //POSIX ONLY
07674     BAUD75, //POSIX ONLY
07675     BAUD110,
07676     BAUD134, //POSIX ONLY
07677     BAUD150, //POSIX ONLY
07678     BAUD200, //POSIX ONLY
07679     BAUD300,
07680     BAUD600,
07681     BAUD1200,
07682     BAUD1800, //POSIX ONLY
07683     BAUD2400,
07684     BAUD4800,
07685     BAUD9600,
07686     BAUD14400, //WINDOWS ONLY
07687     BAUD19200,
07688     BAUD38400,
07689     BAUD56000, //WINDOWS ONLY
07690     BAUD57600,
07691     BAUD76800, //POSIX ONLY
07692     BAUD115200,
07693     BAUD128000, //WINDOWS ONLY
07694     BAUD256000 //WINDOWS ONLY
07695   };
07696 
07697   enum DataBitsType {
07698     DATA_5, //only for compatibility
07699     DATA_6,
07700     DATA_7,
07701     DATA_8
07702   };
07703 
07704   enum ParityType {
07705     PAR_NONE,
07706     PAR_ODD,
07707     PAR_EVEN,
07708     PAR_MARK, //WINDOWS ONLY
07709     PAR_SPACE //WINDOWS directly, POSIX simulated
07710   };
07711 
07712   enum StopBitsType {
07713     STOP_1,
07714     STOP_1_5, //WINDOWS ONLY
07715     STOP_2
07716   };
07717 
07718   enum FlowType {
07719     FLOW_OFF,
07720     FLOW_HARDWARE,
07721     FLOW_XONXOFF
07722   };
07723 
07724   FLSerialPortInterface(const QString &name = QString::null) : QObject(0) {
07725     obj_ = new QextSerialPort(name);
07726   }
07727 
07728   ~FLSerialPortInterface() {
07729     delete obj_;
07730   }
07731 
07732 public slots:
07733 
07734   bool open(int mode = 0) {
07735     return obj_->open(mode);
07736   }
07737   void close() {
07738     obj_->close();
07739   }
07740   void flush() {
07741     obj_->flush();
07742   }
07743 
07744   QIODevice::Offset size() const {
07745     return obj_->size();
07746   }
07747 
07748   Q_LONG readBlock(char *data, Q_ULONG maxSize) {
07749     return obj_->readBlock(data, maxSize);
07750   }
07751   Q_LONG writeBlock(const QString &data, Q_ULONG size) {
07752     return obj_->writeBlock(data, size);
07753   }
07754   void writeText(const QString &text) {
07755     writeBlock(text.latin1(), text.length());
07756   }
07757 
07758   int getch() {
07759     return obj_->getch();
07760   }
07761   int putch(int ch) {
07762     return obj_->putch(ch);
07763   }
07764   int ungetch(int ch) {
07765     return obj_->ungetch(ch);
07766   }
07767 
07768   Q_ULONG bytesAvailable() const {
07769     return obj_->bytesAvailable();
07770   }
07771 
07772   void setName(const QString &name) {
07773     obj_->setName(name);
07774   }
07775   QString name() {
07776     return obj_->name();
07777   }
07778 
07779   void setBaudRate(BaudRateType b) {
07780     obj_->setBaudRate((QextSerialPort::BaudRateType) b);
07781   }
07782   void setDataBits(DataBitsType d) {
07783     obj_->setDataBits((QextSerialPort::DataBitsType) d);
07784   }
07785   void setParity(ParityType p) {
07786     obj_->setParity((QextSerialPort::ParityType) p);
07787   }
07788   void setStopBits(StopBitsType s) {
07789     obj_->setStopBits((QextSerialPort::StopBitsType) s);
07790   }
07791   void setFlowControl(FlowType f) {
07792     obj_->setFlowControl((QextSerialPort::FlowType) f);
07793   }
07794   void setTimeout(int sec, int msec) {
07795     obj_->setTimeout(sec, msec);
07796   }
07797 
07798   BaudRateType baudRate() const {
07799     return (FLSerialPortInterface::BaudRateType) obj_->baudRate();
07800   }
07801   DataBitsType setDataBits() const {
07802     return (FLSerialPortInterface::DataBitsType) obj_->setDataBits();
07803   }
07804   ParityType setParity() const {
07805     return (FLSerialPortInterface::ParityType) obj_->setParity();
07806   }
07807   StopBitsType setStopBits() const {
07808     return (FLSerialPortInterface::StopBitsType) obj_->setStopBits();
07809   }
07810   FlowType setFlowControl() const {
07811     return (FLSerialPortInterface::FlowType) obj_->setFlowControl();
07812   }
07813 
07814   void setRts(bool set = TRUE) {
07815     obj_->setRts(set);
07816   }
07817   void setDtr(bool set = TRUE) {
07818     obj_->setDtr(set);
07819   }
07820 
07821   bool cts() const {
07822     return obj_->cts();
07823   }
07824   bool dsr() const {
07825     return obj_->dsr();
07826   }
07827   bool dcd() const {
07828     return obj_->dcd();
07829   }
07830   bool ri() const {
07831     return obj_->ri();
07832   }
07833 
07834 private:
07835 
07836   QextSerialPort *obj_;
07837 };
07838 
07840 
07890 class AQSignalMapper : public QSignalMapper
07891 {
07892   Q_OBJECT
07893 
07894 public:
07895 
07896   AQSignalMapper(QObject *parent) :
07897     QSignalMapper(parent) {
07898     QObject::setName("AQSignalMapper" +
07899                      QDateTime::currentDateTime().toString("ddMMyyyyhhmmsszzz"));
07900   }
07901 
07902 public slots:
07903 
07904   void setMapping(QObject *sender, int identifier) {
07905     QSignalMapper::setMapping(sender, identifier);
07906   }
07907   void setMapping(QObject *sender, const QString &identifier) {
07908     QSignalMapper::setMapping(sender, identifier);
07909   }
07910   void removeMappings(QObject *sender) {
07911     QSignalMapper::removeMappings(sender);
07912   }
07913 };
07914 
07916 
07966 class AQObjectQueryList : public QObject
07967 {
07968   Q_OBJECT
07969 
07970 public:
07971 
07972   AQObjectQueryList(QObject *obj,
07973                     const QString &inheritsClass,
07974                     const QString &objName,
07975                     bool regexpMatch,
07976                     bool recursiveSearch) :
07977     QObject(0), l_(0) {
07978     if (obj) {
07979       l_ = obj->queryList(inheritsClass.isEmpty() ? 0 : inheritsClass.latin1(),
07980                           objName.isEmpty() ? 0 : objName.latin1(),
07981                           regexpMatch, recursiveSearch);
07982       l_->first();
07983     }
07984   }
07985 
07986   AQObjectQueryList(QObject *obj) :
07987     QObject(0), l_(0) {
07988     if (obj) {
07989       l_ = obj->queryList();
07990       l_->first();
07991     }
07992   }
07993 
07994   ~AQObjectQueryList() {
07995     delete l_;
07996   }
07997 
07998 public slots:
07999 
08000   QObject *first() const {
08001     if (!l_) return 0;
08002     return l_->first();
08003   }
08004 
08005   QObject *last() const {
08006     if (!l_) return 0;
08007     return l_->last();
08008   }
08009 
08010   QObject *next() const {
08011     if (!l_) return 0;
08012     return l_->next();
08013   }
08014 
08015   QObject *prev() const {
08016     if (!l_) return 0;
08017     return l_->prev();
08018   }
08019 
08020   QObject *current() const {
08021     if (!l_) return 0;
08022     return l_->current();
08023   }
08024 
08025   bool isValid() const {
08026     if (!l_) return false;
08027     return (l_->current() != 0);
08028   }
08029 
08030 private:
08031 
08032   QObjectList *l_;
08033 };
08034 
08036 
08041 class FLObjectFactory : public QSObjectFactory
08042 {
08043 public:
08044 
08048   FLObjectFactory();
08049 
08053   ~FLObjectFactory();
08054 
08061   QObject *create(const QString &className, const QSArgumentList &arguments, QObject *);
08062 
08063 private:
08064 
08065   FLUtilInterface *util_;
08066   QObject *voidObject_;
08067 };
08068 
08069 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'