2001-02-05 02:10:26 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 09:14:06 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-02-05 02:10:26 -06:00
|
|
|
*
|
2008-04-10 09:14:06 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2001-02-05 02:10:26 -06:00
|
|
|
*
|
2008-04-10 09:14:06 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-02-05 02:10:26 -06:00
|
|
|
*
|
2008-04-10 09:14:06 -05:00
|
|
|
* $RCSfile: QueryTableView.hxx,v $
|
|
|
|
* $Revision: 1.18 $
|
2001-02-05 02:10:26 -06:00
|
|
|
*
|
2008-04-10 09:14:06 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-02-05 02:10:26 -06:00
|
|
|
*
|
2008-04-10 09:14:06 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-02-05 02:10:26 -06:00
|
|
|
*
|
2008-04-10 09:14:06 -05:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-02-05 02:10:26 -06:00
|
|
|
*
|
2008-04-10 09:14:06 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-02-05 02:10:26 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#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
|
2001-10-05 00:49:21 -05:00
|
|
|
#ifndef DBAUI_QUERYCONTROLLER_HXX
|
|
|
|
#include "querycontroller.hxx"
|
|
|
|
#endif
|
2001-02-05 02:10:26 -06:00
|
|
|
|
|
|
|
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 OQueryTabWinUndoAct;
|
|
|
|
class OQueryTabConnUndoAction;
|
|
|
|
class OQueryTableConnection;
|
|
|
|
class OQueryTableWindow;
|
2001-02-28 03:11:33 -06:00
|
|
|
class OQueryDesignView;
|
2001-02-05 02:10:26 -06:00
|
|
|
class OQueryTableView : public OJoinTableView
|
|
|
|
{
|
|
|
|
Link m_lnkTabWinsChangeHandler;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void ConnDoubleClicked(OTableConnection* pConnection);
|
|
|
|
virtual void KeyInput(const KeyEvent& rEvt);
|
2002-11-08 02:27:59 -06:00
|
|
|
|
2007-11-01 09:16:49 -05:00
|
|
|
virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData);
|
|
|
|
|
|
|
|
/** called when init fails at the tablewindowdata because the m_xTable object could not provide columns, but no
|
|
|
|
exception was thrown. Expected to throw.
|
|
|
|
*/
|
|
|
|
virtual void onNoColumns_throw();
|
|
|
|
|
|
|
|
virtual bool supressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const;
|
2001-02-05 02:10:26 -06:00
|
|
|
public:
|
|
|
|
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)
|
2006-07-10 09:28:36 -05:00
|
|
|
virtual void AddTabWin( const ::rtl::OUString& _rTableName, const ::rtl::OUString& _rAliasName, BOOL bNewTable = FALSE );
|
2001-02-05 02:10:26 -06:00
|
|
|
virtual void RemoveTabWin(OTableWindow* pTabWin);
|
|
|
|
|
|
|
|
// und ein AddTabWin, das einen Alias vorgibt
|
2001-02-05 09:19:35 -06:00
|
|
|
void AddTabWin(const ::rtl::OUString& strDatabase, const ::rtl::OUString& strTableName, const ::rtl::OUString& strAlias, BOOL bNewTable = FALSE);
|
2001-02-05 02:10:26 -06:00
|
|
|
// TabWin suchen
|
|
|
|
OQueryTableWindow* FindTable(const String& rAliasName);
|
2001-10-05 00:49:21 -05:00
|
|
|
BOOL FindTableFromField(const String& rFieldName, OTableFieldDescRef& rInfo, USHORT& rCnt);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
|
|
|
// Basisklasse ueberschrieben : Connections kreieren und loeschen
|
|
|
|
virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest);
|
2002-02-08 01:56:33 -06:00
|
|
|
|
|
|
|
virtual ::std::vector<OTableConnection*>::const_iterator RemoveConnection( OTableConnection* _pConn ,sal_Bool _bDelete);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
// 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)
|
2001-02-05 09:19:35 -06:00
|
|
|
BOOL ShowTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction,sal_Bool _bAppend);
|
2001-02-05 02:10:26 -06:00
|
|
|
void HideTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction);
|
|
|
|
|
|
|
|
// Sichbarkeit eines TabWins sicherstellen (+ Invalidieren der Connections)
|
2002-05-22 05:16:34 -05:00
|
|
|
virtual void EnsureVisible(const OTableWindow* _pWin);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
|
|
|
// wieviel Tabellen mit einem bestimmten Namen habe ich schon ?
|
2001-03-23 02:47:54 -06:00
|
|
|
sal_Int32 CountTableAlias(const String& rName, sal_Int32& rMax);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
|
|
|
// ein Feld einfuegen (wird einfach an das Elter weitergereicht
|
2001-10-05 00:49:21 -05:00
|
|
|
void InsertField(const OTableFieldDescRef& rInfo);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
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;
|
2001-02-28 03:11:33 -06:00
|
|
|
|
2007-11-01 09:16:49 -05:00
|
|
|
virtual OTableWindowData* CreateImpl(const ::rtl::OUString& _rComposedName
|
|
|
|
,const ::rtl::OUString& _sTableName
|
|
|
|
,const ::rtl::OUString& _rWinName);
|
2002-02-06 00:23:39 -06:00
|
|
|
|
|
|
|
/** createNewConnection opens the join dialog and allows to create a new join connection
|
|
|
|
*/
|
|
|
|
void createNewConnection();
|
2006-06-19 21:12:43 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
using OJoinTableView::EnsureVisible;
|
2001-02-05 02:10:26 -06:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // DBAUI_QUERYTABLEVIEW_HXX
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|