kexi

kexiquerydesignerguieditor.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
00003    Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KEXIQUERYDESIGNERGUIEDITOR_H
00022 #define KEXIQUERYDESIGNERGUIEDITOR_H
00023 
00024 #include <qguardedptr.h>
00025 #include <qsplitter.h>
00026 
00027 #include <kexiviewbase.h>
00028 #include "kexiquerypart.h"
00029 
00030 class KexiMainWindow;
00031 class KexiTableViewData;
00032 class KexiDataTable;
00033 class KexiTableItem;
00034 class KexiRelationWidget;
00035 class KexiSectionHeader;
00036 class KexiDataAwarePropertySet;
00037 class KexiRelationViewTableContainer;
00038 class KexiRelationViewConnection;
00039 
00040 namespace KexiPart
00041 {
00042     class Item;
00043 }
00044 
00045 namespace KoProperty {
00046     class Property;
00047     class Set;
00048 }
00049 
00050 namespace KexiDB
00051 {
00052     class Connection;
00053     class QuerySchema;
00054     class TableSchema;
00055     class ResultInfo;
00056 }
00057 
00059 class KexiQueryDesignerGuiEditor : public KexiViewBase
00060 {
00061     Q_OBJECT
00062 
00063     public:
00064         KexiQueryDesignerGuiEditor(KexiMainWindow *mainWin, QWidget *parent, const char *name = 0);
00065         virtual ~KexiQueryDesignerGuiEditor();
00066 
00067 //      KexiDB::QuerySchema *schema();
00068 
00069         KexiRelationWidget *relationView() const;
00070 
00071         virtual QSize sizeHint() const;
00072 
00073     public slots:
00074         virtual void setFocus();
00075 
00076     protected:
00077         void initTableColumns(); 
00078         void initTableRows(); 
00079 //unused        void addRow(const QString &tbl, const QString &field);
00080 //      void            restore();
00081         virtual tristate beforeSwitchTo(int mode, bool &dontStore);
00082         virtual tristate afterSwitchFrom(int mode);
00083 
00084         virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
00085         virtual tristate storeData(bool dontAsk = false);
00086 
00089         void updateColumnsData();
00090 
00093         virtual KoProperty::Set *propertySet();
00094 
00095         KoProperty::Set* createPropertySet( int row,
00096             const QString& tableName, const QString& fieldName, bool newOne = false );
00097 
00102         bool buildSchema(QString *errMsg = 0);
00103 
00104         KexiQueryPart::TempData * tempData() const;
00105 
00109         KexiTableItem* createNewRow(const QString& tableName, const QString& fieldName,
00110             bool visible) const;
00111 
00112         KexiDB::BaseExpr* parseExpressionString(const QString& fullString, int& token,
00113             bool allowRelationalOperator);
00114 
00115         QCString generateUniqueAlias() const;
00116         void updatePropertiesVisibility(KoProperty::Set& buf);
00117 
00118     protected slots:
00119         void slotDragOverTableRow(KexiTableItem *item, int row, QDragMoveEvent* e);
00120         void slotDroppedAtRow(KexiTableItem *item, int row,
00121             QDropEvent *ev, KexiTableItem*& newItem);
00123         void slotNewItemAppendedForAfterDeletingInSpreadSheetMode();
00124         void slotTableAdded(KexiDB::TableSchema &t);
00125         void slotTableHidden(KexiDB::TableSchema &t);
00126 
00128         void slotBeforeCellChanged(KexiTableItem *item, int colnum,
00129             QVariant& newValue, KexiDB::ResultInfo* result);
00130 
00131         void slotRowInserted(KexiTableItem* item, uint row, bool repaint);
00132         void slotTablePositionChanged(KexiRelationViewTableContainer*);
00133         void slotAboutConnectionRemove(KexiRelationViewConnection*);
00134         void slotTableFieldDoubleClicked( KexiDB::TableSchema* table, const QString& fieldName );
00135 
00137         bool loadLayout();
00138 
00140         bool storeLayout();
00141 
00142         void showTablesForQuery(KexiDB::QuerySchema *query);
00144         void showFieldsOrRelationsForQueryInternal(
00145             KexiDB::QuerySchema *query, bool showFields, bool showRelations, KexiDB::ResultInfo& result);
00147         void showFieldsAndRelationsForQuery(KexiDB::QuerySchema *query, KexiDB::ResultInfo& result);
00149         void showFieldsForQuery(KexiDB::QuerySchema *query, KexiDB::ResultInfo& result);
00151         void showRelationsForQuery(KexiDB::QuerySchema *query, KexiDB::ResultInfo& result);
00152 
00153         void addConnection(KexiDB::Field *masterField, KexiDB::Field *detailsField);
00154 
00155         void slotPropertyChanged(KoProperty::Set& list, KoProperty::Property& property);
00156 
00157 //      void slotObjectCreated(const QCString &mime, const QCString& name);
00158         void slotNewItemStored(KexiPart::Item&);
00159         void slotItemRemoved(const KexiPart::Item& item);
00160         void slotItemRenamed(const KexiPart::Item& item, const QCString& oldName);
00161 
00162     private:
00163         class Private;
00164         Private *d;
00165 
00166         friend class KexiQueryView; // for storeNewData() and storeData() only
00167 };
00168 
00169 #endif
00170 
KDE Home | KDE Accessibility Home | Description of Access Keys