summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-02-05 08:10:26 +0000
committerOcke Janssen <oj@openoffice.org>2001-02-05 08:10:26 +0000
commit923fd8112b32d8f4e11a0629a75fb3fe67efccf3 (patch)
tree5c8694b70e0e57312c07b79fbd3f4caf990f49f8
parente66b25aeb267676541974d474e5c6613ac700edf (diff)
querydesign
-rw-r--r--dbaccess/source/ui/inc/JoinTableView.hxx242
-rw-r--r--dbaccess/source/ui/inc/QEnumTypes.hxx104
-rw-r--r--dbaccess/source/ui/inc/QueryDesignView.hxx220
-rw-r--r--dbaccess/source/ui/inc/QueryTableView.hxx177
-rw-r--r--dbaccess/source/ui/inc/QueryViewSwitch.hxx110
-rw-r--r--dbaccess/source/ui/inc/adtabdlg.hxx132
6 files changed, 985 insertions, 0 deletions
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx
new file mode 100644
index 000000000000..ca71dea92815
--- /dev/null
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * $RCSfile: JoinTableView.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-05 09:09:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_JOINTABLEVIEW_HXX
+#define DBAUI_JOINTABLEVIEW_HXX
+
+#ifndef _SV_WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+#ifndef _SV_TIMER_HXX
+#include <vcl/timer.hxx>
+#endif
+#ifndef _SV_SCRBAR_HXX
+#include <vcl/scrbar.hxx>
+#endif
+#ifndef _RTTI_HXX
+#include <tools/rtti.hxx>
+#endif
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#ifndef _COMPHELPER_STLTYPES_HXX_
+#include <comphelper/stl_types.hxx>
+#endif
+
+
+namespace dbaui
+{
+ class OTableConnection;
+ class OTableWindow;
+ struct OJoinExchangeData;
+ class OQueryDesignView;
+
+ ////////////////////////////////////////////////////////////////
+ // Konstanten fuer das Fensterlayout
+ const long TABWIN_SPACING_X = 17;
+ const long TABWIN_SPACING_Y = 17;
+
+ const long TABWIN_WIDTH_STD = 120;
+ const long TABWIN_HEIGHT_STD = 120;
+
+ const long TABWIN_WIDTH_MIN = 90;
+ const long TABWIN_HEIGHT_MIN = 80;
+
+ // this class conatins only the scrollbars to avoid that the tablewindows clip the scrollbars
+ class OJoinTableView;
+ class OScrollWindowHelper : public Window
+ {
+ ScrollBar m_aHScrollBar;
+ ScrollBar m_aVScrollBar;
+ OJoinTableView* m_pTableView;
+ protected:
+ virtual void Resize();
+ public:
+ OScrollWindowHelper( Window* pParent);
+ void setTableView(OJoinTableView* _pTableView);
+
+ // own methods
+ ScrollBar* GetHScrollBar() { return &m_aHScrollBar; }
+ ScrollBar* GetVScrollBar() { return &m_aVScrollBar; }
+ };
+
+
+ class OJoinTableView : public Window
+ {
+ public:
+ DECLARE_STL_USTRINGACCESS_MAP(OTableWindow*,OTableWindowMap);
+ private:
+ OTableWindowMap m_aTableMap;
+ ::std::vector<OTableConnection*> m_vTableConnection;
+
+ Timer m_aDragScrollTimer;
+ Rectangle m_aDragRect;
+ Rectangle m_aSizingRect;
+ Point m_aDragOffset;
+ Point m_aScrollOffset;
+ Point m_ptPrevDraggingPos;
+ Size m_aOutputSize;
+
+
+ OTableWindow* m_pDragWin;
+ OTableWindow* m_pSizingWin;
+ OTableConnection* m_pSelectedConn;
+
+ BOOL m_bTrackingInitiallyMoved;
+
+ DECL_LINK(OnDragScrollTimer, void*);
+
+ protected:
+ OTableWindow* m_pLastFocusTabWin;
+ OQueryDesignView* m_pView;
+
+ public:
+ TYPEINFO();
+ OJoinTableView( Window* pParent, OQueryDesignView* pView );
+ virtual ~OJoinTableView();
+
+ // window override
+ virtual void StateChanged( StateChangedType nStateChange );
+
+ // own methods
+ ScrollBar* GetHScrollBar() { return static_cast<OScrollWindowHelper*>(GetParent())->GetHScrollBar(); }
+ ScrollBar* GetVScrollBar() { return static_cast<OScrollWindowHelper*>(GetParent())->GetVScrollBar(); }
+ DECL_LINK( ScrollHdl, ScrollBar* );
+
+ void DrawConnections( const Rectangle& rRect );
+ void InvalidateConnections();
+
+ void BeginChildMove( OTableWindow* pTabWin, const Point& rMousePos );
+ void BeginChildSizing( OTableWindow* pTabWin, const Pointer& rPointer );
+
+ void NotifyTitleClicked( OTableWindow* pTabWin, const Point rMousePos );
+
+ virtual void AddTabWin(const String& _rComposedName, const String& rWinName, BOOL bNewTable = FALSE);
+ virtual void RemoveTabWin( OTableWindow* pTabWin );
+
+ virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest);
+ virtual BOOL RemoveConnection(OTableConnection* pConn);
+
+ BOOL Scroll( long nDelta, BOOL bHoriz, BOOL bPaintScrollBars );
+ ULONG GetTabWinCount();
+ Point GetScrollOffset() const { return m_aScrollOffset; }
+
+ OQueryDesignView* getDesignView() { return m_pView; }
+ OTableWindow* GetWindow( const String& rName );
+
+ OTableConnection* GetSelectedConn() { return m_pSelectedConn; }
+ void DeselectConn(OTableConnection* pConn); // NULL ist ausdruecklich zugelassen, dann passiert nichts
+ void SelectConn(OTableConnection* pConn);
+
+ OTableWindowMap* GetTabWinMap() { return &m_aTableMap; }
+ const OTableWindowMap* GetTabWinMap() const { return &m_aTableMap; }
+ ::std::vector<OTableConnection*>* GetTabConnList() { return &m_vTableConnection; }
+ // ::std::vector<OTableConnection*>* GetTabConnList() const { return &m_vTableConnection; }
+
+
+ BOOL ExistsAConn(const OTableWindow* pFromWin) const;
+ OTableConnection* GetTabConn(OTableWindow* pLhs,OTableWindow* pRhs, OTableConnection* _rpFirstAfter = NULL);
+
+ // set the focus to that tab win which most recently had it (or to the first available one)
+ void GrabTabWinFocus();
+
+ // ReSync ist dazu gedacht, aus dem Dokument alle WinData und ConnData zu holen und entsprechend Wins und Conns anzulegen
+ virtual void ReSync() { }
+ // ClearAll implementiert ein hartes Loeschen, es werden alle Conns und alle Wins aus ihren jeweiligen Listen geloescht
+ // sowie die entsprechenden Datas aus dem Dokument ausgetragen
+ virtual void ClearAll();
+
+ // wird vom AddTabDlg benutzt, um festzustellen, ob noch Tabellen hinzugefuegt werden duerfen
+ virtual BOOL IsAddAllowed();
+ virtual long PreNotify(NotifyEvent& rNEvt);
+
+ protected:
+ virtual void MouseButtonUp( const MouseEvent& rEvt );
+ virtual void MouseButtonDown( const MouseEvent& rEvt );
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void ConnDoubleClicked( OTableConnection* pConnection );
+ virtual void KeyInput( const KeyEvent& rEvt );
+ virtual void SetDefaultTabWinPosSize( OTableWindow* pTabWin );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual void Resize();
+ virtual BOOL Drop( const DropEvent& rEvt );
+ virtual BOOL QueryDrop( DropEvent& rEvt );
+
+ // wird nach Verschieben/Groessenaenderung der TabWins aufgerufen (die Standardimplementation reicht die neuen Daten einfach
+ // an die Daten des Wins weiter)
+ virtual void TabWinMoved(OTableWindow* ptWhich, const Point& ptOldPosition);
+ // die Position ist "virtuell" : der Container hat sozusagen eine virtuelle Flaeche, von der immer nur ein bestimmter Bereich
+ // - der mittels der Scrollbar veraendert werden kann - zu sehen ist. Insbesondere hat ptOldPosition immer positive Koordinaten,
+ // auch wenn er einen Punkt oberhalb des aktuell sichtbaren Bereichs bezeichnet, dessen physische Ordinate eigentlich
+ // negativ ist.
+ virtual void TabWinSized(OTableWindow* ptWhich, const Point& ptOldPosition, const Size& szOldSize);
+ // hier ist die Position (die sich waehrend des Sizings aendern kann) physisch, da waehrend des Sizens nicht gescrollt wird
+ virtual void Command(const CommandEvent& rEvt);
+
+ virtual void EnsureVisible(const OTableWindow* _pWin);
+
+ private:
+ void InitColors();
+ BOOL ScrollWhileDragging();
+ };
+}
+#endif // DBAUI_JOINTABLEVIEW_HXX
diff --git a/dbaccess/source/ui/inc/QEnumTypes.hxx b/dbaccess/source/ui/inc/QEnumTypes.hxx
new file mode 100644
index 000000000000..21e6a897ca7e
--- /dev/null
+++ b/dbaccess/source/ui/inc/QEnumTypes.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * $RCSfile: QEnumTypes.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-05 09:10:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_ENUMTYPES_HXX
+#define DBAUI_ENUMTYPES_HXX
+
+namespace dbaui
+{
+ enum EOrderDir
+ {
+ ORDER_NONE=0,
+ ORDER_ASC,
+ ORDER_DESC
+ };
+ enum EFunctionType
+ {
+ FKT_AGGREGATE=0,
+ FKT_OTHER ,
+ FKT_NONE ,
+ FKT_CONDITION // wenn dieser Fkt.Typ gesetzt handelt es sich um EXISTS oder UNIQUE, der FieldName enthlt das gesamte Statement
+ };
+
+ enum EConnectionSide
+ {
+ JTCS_FROM=0,
+ JTCS_TO
+ };
+ enum ETableFieldType
+ {
+ TAB_NORMAL_FIELD=0,
+ TAB_PRIMARY_FIELD
+ };
+
+ enum EJoinType
+ {
+ FULL_JOIN=0,
+ LEFT_JOIN,
+ RIGHT_JOIN,
+ NATURAL_JOIN,
+ UNION_JOIN,
+ CROSS_JOIN,
+ INNER_JOIN
+ };
+}
+#endif // DBAUI_ENUMTYPES_HXX
+
+
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx
new file mode 100644
index 000000000000..6f798f16b20a
--- /dev/null
+++ b/dbaccess/source/ui/inc/QueryDesignView.hxx
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * $RCSfile: QueryDesignView.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-05 09:10:20 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_QUERYDESIGNVIEW_HXX
+#define DBAUI_QUERYDESIGNVIEW_HXX
+
+#ifndef DBAUI_QUERYVIEW_HXX
+#include "queryview.hxx"
+#endif
+#ifndef _SV_SPLIT_HXX
+#include <vcl/split.hxx>
+#endif
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef DBAUI_QUERYTABLEVIEW_HXX
+#include "QueryTableView.hxx"
+#endif
+#ifndef DBAUI_ENUMTYPES_HXX
+#include "QEnumTypes.hxx"
+#endif
+
+namespace connectivity
+{
+ class OSQLParseNode;
+}
+
+class ComboBox;
+namespace dbaui
+{
+ class OQueryViewSwitch;
+ class OAddTableDlg;
+ class OQueryTableWindow;
+ class OTableFieldDesc;
+ class OSelectionBrowseBox;
+ class OTableConnection;
+ class OQueryTableConnectionData;
+ class OConnectionLineData;
+
+ class OQueryDesignView : public OQueryView
+ {
+ friend class OQueryViewSwitch;
+
+ Splitter m_aSplitter;
+
+ ::com::sun::star::lang::Locale m_aLocale;
+ ::rtl::OUString m_sDecimalSep;
+
+ OScrollWindowHelper* m_pScrollWindow; // contains only the scrollbars
+ OQueryTableView* m_pTableView; // presents the upper window
+ OAddTableDlg* m_pAddTabDlg; // create by the first execute of the add table slot
+ OSelectionBrowseBox* m_pSelectionBox; // presents the lower window
+
+ ::rtl::OUString QuoteField( const ::rtl::OUString& rValue, sal_Int32 aType );
+ void InitFromParseNode();
+ void GetTable( ::rtl::OUString& rDatabase, ::rtl::OUString& rTable, ::rtl::OUString& rAlias, ::connectivity::OSQLParseNode* pNode );
+
+ void GenerateInnerJoinCriterias(::rtl::OUString& _rJoinCrit,const ::std::vector<OTableConnection*>* _pConnList);
+ // erzeugt das Group Argument, falls vorhanden
+ ::rtl::OUString GenerateGroupBy(::std::vector<OTableFieldDesc*>* pFieldList, sal_Bool bMulti );
+ // erzeugt Where und Having Argument, falls vorhanden
+ sal_Bool GenerateCriterias(::rtl::OUString& aRetStr,::rtl::OUString& rHavingStr/*,::rtl::OUString& rOrderStr*/, ::std::vector<OTableFieldDesc*>* pFieldList, sal_Bool bMulti );
+ ::rtl::OUString GenerateOrder( ::std::vector<OTableFieldDesc*>* pFieldList , sal_Bool bMulti);
+ // Erzeugt die SelectList. bAlias mu"s gesetzt sein, wenn mehr als 1 Tabelle vorhanden ist
+ ::rtl::OUString GenerateSelectList(::std::vector<OTableFieldDesc*>* pFieldList,sal_Bool bAlias);
+ // Erzeugt die Tabellenliste mit Joins aus pConnList, wenn bJoin == True. pConnList kann == NULL wenn bJoin == sal_False
+ ::rtl::OUString GenerateFromClause(const OJoinTableView::OTableWindowMap* pTabMap,::std::vector<OTableConnection*>* pConnList);
+
+ ::rtl::OUString BuildACriteria( const ::rtl::OUString& rVal, sal_Int32 aType );
+ int InstallFields( const ::connectivity::OSQLParseNode* pNode, OJoinTableView::OTableWindowMap* pTabList );
+
+ // nLevel gibt die Zeile an in der die Bedingungen eingetragen werden sollen
+ int GetSelectionCriteria(const ::connectivity::OSQLParseNode* pNode ,int &nLevel, sal_Bool bJoinWhere=sal_False);
+ void GetHavingCriteria(const ::connectivity::OSQLParseNode* pNode ,int &nLevel);
+
+ int GetORCriteria(const ::connectivity::OSQLParseNode * pCondition, int& nLevel, sal_Bool bHaving = sal_False );
+ int GetANDCriteria(const ::connectivity::OSQLParseNode * pCondition, const int nLevel, sal_Bool bHaving);
+ int ComparsionPredicate( const ::connectivity::OSQLParseNode * pCondition, const int nLevel, sal_Bool bHaving );
+
+ void GetOrderCriteria( const ::connectivity::OSQLParseNode* pNode );
+ void GetGroupCriteria( const ::connectivity::OSQLParseNode* pNode );
+
+ sal_Bool GetInnerJoinCriteria(const ::connectivity::OSQLParseNode *pCondition);
+ void FillOuterJoins(const ::connectivity::OSQLParseNode* pParseNode);
+ sal_Bool InsertJoin(const ::connectivity::OSQLParseNode *pNode);
+ sal_Bool InsertJoinConnection(const ::connectivity::OSQLParseNode *pNode, const EJoinType& _eJoinType);
+
+ sal_Bool FillDragInfo(const ::connectivity::OSQLParseNode* pTableRef,OTableFieldDesc& aDragInfo);
+
+ sal_Bool HasFields();
+ ::rtl::OUString BuildTable(const OQueryTableWindow* pEntryTab);
+
+ ::rtl::OUString BuildJoin(OQueryTableWindow* pLh, OQueryTableWindow* pRh, OQueryTableConnectionData* pData);
+ ::rtl::OUString BuildJoin(const ::rtl::OUString &rLh, OQueryTableWindow* pRh, OQueryTableConnectionData* pData);
+ ::rtl::OUString BuildJoin(OQueryTableWindow* pLh, const ::rtl::OUString &rRh, OQueryTableConnectionData* pData);
+ ::rtl::OUString BuildJoin(const ::rtl::OUString& rLh, const ::rtl::OUString& rRh, OQueryTableConnectionData* pData);
+
+ ::rtl::OUString BuildJoinCriteria(::std::vector<OConnectionLineData*>* pLineDataList,OQueryTableConnectionData* pData);
+
+ void GetNextJoin(OQueryTableConnection* pEntryConn,::rtl::OUString &aJoin,OQueryTableWindow* pEntryTabTo);
+ void JoinCycle(OQueryTableConnection* pEntryConn,::rtl::OUString &rJoin,OQueryTableWindow* pEntryTabTo);
+
+ int InsertColumnRef(const ::connectivity::OSQLParseNode * pColumnRef,
+ ::rtl::OUString& aColumnName,const ::rtl::OUString& aColumnAlias,
+ ::rtl::OUString& aTableRange,OTableFieldDesc& aInfo,
+ OJoinTableView::OTableWindowMap* pTabList);
+
+ sal_Int32 GetColumnFormatKey(const ::connectivity::OSQLParseNode* pColumnRef);
+ public:
+ OQueryDesignView(Window* pParent, OQueryController* _pController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+ virtual ~OQueryDesignView();
+
+ virtual sal_Bool isCutAllowed();
+ virtual void copy();
+ virtual void cut();
+ virtual void paste();
+ // clears the whole query
+ virtual void clear();
+ // set the view readonly or not
+ virtual void setReadOnly(sal_Bool _bReadOnly);
+ // set the statement for representation
+ virtual void setStatement(const ::rtl::OUString& _rsStatement);
+ // returns the current sql statement
+ virtual ::rtl::OUString getStatement();
+ /// late construction
+ virtual void Construct(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel);
+ virtual void initialize();
+ // window overloads
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+ // returs the add table dialog from the design view
+ OAddTableDlg* getAddTableDialog() { return m_pAddTabDlg; }
+ BOOL IsAddAllowed();
+ sal_Bool isSlotEnabled(sal_Int32 _nSlotId);
+ void setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable);
+
+ ::com::sun::star::lang::Locale getLocale() const { return m_aLocale;}
+ ::rtl::OUString getDecimalSeparator() const { return m_sDecimalSep;}
+
+ sal_Bool HasTable() const {return m_pTableView->GetTabWinMap()->size() != 0;}
+ sal_Bool InsertField( const OTableFieldDesc& rInfo, sal_Bool bVis=sal_True, sal_Bool bActivate = sal_True);
+ // save the position of the table window and the pos of the splitters
+ void SaveTabWinUIConfig(OQueryTableWindow* pWin);
+ // called when fields are deleted
+ void DeleteFields( const ::rtl::OUString& rAliasName );
+ // called when a table from tabeview was deleted
+ void TableDeleted(const ::rtl::OUString& rAliasName);
+
+ OQueryTableView* getTableView() { return m_pTableView; }
+ BOOL getColWidth( const ::rtl::OUString& rAliasName, const ::rtl::OUString& rFieldName, ULONG& nWidth );
+ void fillValidFields(const ::rtl::OUString& strTableName, ComboBox* pFieldList);
+ void zoomTableView(const Fraction& _rFraction);
+ protected:
+ // return the Rectangle where I can paint myself
+ virtual void resizeControl(Rectangle& rRect);
+ DECL_LINK( SplitHdl, void* );
+ };
+}
+#endif // DBAUI_QUERYDESIGNVIEW_HXX
+
diff --git a/dbaccess/source/ui/inc/QueryTableView.hxx b/dbaccess/source/ui/inc/QueryTableView.hxx
new file mode 100644
index 000000000000..bed808945039
--- /dev/null
+++ b/dbaccess/source/ui/inc/QueryTableView.hxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * $RCSfile: QueryTableView.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-05 09:10:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_QUERYTABLEVIEW_HXX
+#define DBAUI_QUERYTABLEVIEW_HXX
+
+#ifndef DBAUI_JOINTABLEVIEW_HXX
+#include "JoinTableView.hxx"
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+
+
+namespace dbaui
+{
+
+ struct TabWinsChangeNotification
+ {
+ enum ACTION_TYPE { AT_ADDED_WIN, AT_REMOVED_WIN };
+ ACTION_TYPE atActionPerformed;
+ String strAffectedTable;
+
+ TabWinsChangeNotification(ACTION_TYPE at, const String& str) : atActionPerformed(at), strAffectedTable(str) { }
+ };
+
+ //========================================================================
+ class OTableFieldDesc;
+ class OQueryTabWinUndoAct;
+ class OQueryTabConnUndoAction;
+ class OQueryTableConnection;
+ class OQueryTableWindow;
+ class OQueryTableView : public OJoinTableView
+ {
+ Link m_lnkTabWinsChangeHandler;
+
+ void addConnections(const OQueryTableWindow* _pSource,const OQueryTableWindow* _pDest,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _rxForeignKeyColumns);
+ protected:
+ virtual void ConnDoubleClicked(OTableConnection* pConnection);
+ virtual void KeyInput(const KeyEvent& rEvt);
+
+ // wird nach Verschieben/Groessenaenderung der TabWins aufgerufen (die Standardimplementation reicht die neuen Daten einfach
+ // an die Daten des Wins weiter)
+ virtual void TabWinMoved(OTableWindow* pWhich, const Point& ptOldPosition);
+ virtual void TabWinSized(OTableWindow* ptWhich, const Point& ptOldPosition, const Size& szOldSize);
+
+ public:
+ TYPEINFO();
+ OQueryTableView(Window* pParent,OQueryDesignView* pView);
+ virtual ~OQueryTableView();
+
+ // Basisklasse ueberschrieben : Fenster kreieren und loeschen
+ // (eigentlich nicht wirklich LOESCHEN, es geht in die Verantwortung einer UNDO-Action ueber)
+ virtual void AddTabWin(const String& strDatabase, const String& strTableName, BOOL bNewTable = FALSE);
+ virtual void RemoveTabWin(OTableWindow* pTabWin);
+
+ // und ein AddTabWin, das einen Alias vorgibt
+ void AddTabWin(const String& strDatabase, const String& strTableName, const String& strAlias, BOOL bNewTable = FALSE);
+ // Fenster an Hand des AliasNamen loeschen (zieht sich natuerlich auf voriges RemoveTabWin zurueck)
+ BOOL RemoveTabWin(const String& rAliasName);
+
+ // TabWin suchen
+ OQueryTableWindow* FindTable(const String& rAliasName);
+ BOOL FindTableFromField(const String& rFieldName, OTableFieldDesc& rInfo, USHORT& rCnt);
+
+ // Basisklasse ueberschrieben : Connections kreieren und loeschen
+ virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest);
+ virtual BOOL RemoveConnection(OTableConnection* pConn);
+
+ // Transfer von Connections von/zu einer UndoAction
+ void GetConnection(OQueryTableConnection* pConn);
+ // Einfuegen einer Connection in meine Struktur
+ void DropConnection(OQueryTableConnection* pConn);
+ // Entfernen einer Connection aus meiner Struktur
+
+ // alle TabWins verstecken (NICHT loeschen, sie werden in eine Undo-Action gepackt)
+ void HideTabWins();
+ // das resultiert effektiv in einem voelligen Leeren des Abfrageentwurfs, da alle Fenster versteckt werden, und dabei
+ // natuerlich alle Connections an diesen Fenstern und alle Abfrage-Spalten, die auf diesen Tabellen basierten.
+
+ // TabWin anzeigen oder verstecken (NICHT kreieren oder loeschen)
+ BOOL ShowTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction);
+ void HideTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction);
+
+ // Sichbarkeit eines TabWins sicherstellen (+ Invalidieren der Connections)
+ void EnsureVisible(const OTableWindow* _pWin);
+
+ // wieviel Tabellen mit einem bestimmten Namen habe ich schon ?
+ USHORT CountTableAlias(const String& rName, USHORT& rMax);
+
+ // ein Feld einfuegen (wird einfach an das Elter weitergereicht
+ void InsertField(const OTableFieldDesc& rInfo);
+
+ // alles (TabWins, Connections) neu aufbauen (PRECONDITION : vorher wurde ClearAll gerufen)
+ virtual void ReSync();
+ // alles (TabWins, Connections) loeschen, und zwar hart, es erfolgen also keinerlei Notifications
+ virtual void ClearAll();
+
+ // wird vom AddTabDlg benutzt, um festzustellen, ob noch Tabellen hinzugefuegt werden duerfen
+ //virtual BOOL IsAddAllowed();
+
+ // eine neu Connection bekanntgeben und einfuegen lassen, wenn nicht schon existent
+ void NotifyTabConnection(const OQueryTableConnection& rNewConn, BOOL _bCreateUndoAction = TRUE);
+
+ // fuer Droppen von Tabellen
+ BOOL Drop(const DropEvent& rEvt);
+ BOOL QueryDrop(DropEvent& rEvt);
+
+ Link SetTabWinsChangeHandler(const Link& lnk) { Link lnkRet = m_lnkTabWinsChangeHandler; m_lnkTabWinsChangeHandler = lnk; return lnkRet; }
+ // der Handler bekommt einen Zeiger auf eine TabWinsChangeNotification-Struktur
+
+ BOOL ExistsAVisitedConn(const OQueryTableWindow* pFrom) const;
+ };
+}
+#endif // DBAUI_QUERYTABLEVIEW_HXX
+
+
+
+
+
diff --git a/dbaccess/source/ui/inc/QueryViewSwitch.hxx b/dbaccess/source/ui/inc/QueryViewSwitch.hxx
new file mode 100644
index 000000000000..55d949f421ca
--- /dev/null
+++ b/dbaccess/source/ui/inc/QueryViewSwitch.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * $RCSfile: QueryViewSwitch.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-05 09:10:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_QUERYVIEWSWITCH_HXX
+#define DBAUI_QUERYVIEWSWITCH_HXX
+
+#ifndef DBAUI_QUERYVIEW_HXX
+#include "queryview.hxx"
+#endif
+
+namespace dbaui
+{
+ class OQueryDesignView;
+ class OQueryTextView;
+ class OAddTableDlg;
+ class OQueryViewSwitch : public OQueryView
+ {
+ OQueryDesignView* m_pDesignView;
+ OQueryTextView* m_pTextView;
+ public:
+ OQueryViewSwitch(Window* pParent, OQueryController* _pController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+ virtual ~OQueryViewSwitch();
+
+ virtual sal_Bool isCutAllowed();
+ virtual void copy();
+ virtual void cut();
+ virtual void paste();
+ // clears the whole query
+ virtual void clear();
+ // set the view readonly or not
+ virtual void setReadOnly(sal_Bool _bReadOnly);
+ // set the statement for representation
+ virtual void setStatement(const ::rtl::OUString& _rsStatement);
+ // returns the current sql statement
+ virtual ::rtl::OUString getStatement();
+ /// late construction
+ virtual void Construct(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel);
+ virtual void initialize();
+ // show the text or the design view
+ void switchView();
+ sal_Bool isSlotEnabled(sal_Int32 _nSlotId);
+ void setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable);
+ // returs the add table dialog from the design view
+ OAddTableDlg* getAddTableDialog();
+ BOOL IsAddAllowed();
+ void zoomTableView(const Fraction& _rFraction);
+ protected:
+ // return the Rectangle where I can paint myself
+ virtual void resizeControl(Rectangle& rRect);
+ };
+}
+#endif // DBAUI_QUERYVIEWSWITCH_HXX
+
diff --git a/dbaccess/source/ui/inc/adtabdlg.hxx b/dbaccess/source/ui/inc/adtabdlg.hxx
new file mode 100644
index 000000000000..d1c1dd123f52
--- /dev/null
+++ b/dbaccess/source/ui/inc/adtabdlg.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: adtabdlg.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-05 09:09:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_QYDLGTAB_HXX
+#define DBAUI_QYDLGTAB_HXX
+
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _SV_DIALOG_HXX
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+#ifndef _DBAUI_TABLETREE_HXX_
+#include "tabletree.hxx"
+#endif
+
+
+namespace dbaui
+{
+ //========================================================================
+ class OQueryTableView;
+ class OAddTableDlg : public ModelessDialog
+ {
+ FixedText aFTTable;
+ OTableTreeListBox aTableList;
+ PushButton aAddButton;
+ CancelButton aCloseButton;
+ HelpButton aHelpButton;
+ GroupBox aGroupBoxTable;
+
+ String aDefaultString;
+
+ OQueryTableView* m_pTableView;
+
+ BOOL IsAddAllowed();
+ void AddTable();
+
+ DECL_LINK( AddClickHdl, Button* );
+ DECL_LINK( CloseClickHdl, Button* );
+ DECL_LINK( TableListDoubleClickHdl, ListBox* );
+ public:
+ OAddTableDlg(Window* pParent);
+ virtual ~OAddTableDlg();
+
+ virtual BOOL Close();
+
+ void DetermineAddTable() { aAddButton.Enable( IsAddAllowed() ); }
+ void Update();
+ protected:
+ void UpdateTableList(BOOL bViewsAllowed);
+ };
+}
+#endif // DBAUI_QYDLGTAB_HXX
+
+