2010-10-27 06:33:13 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 11:39:53 -05:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-02-05 02:10:26 -06:00
|
|
|
#ifndef DBAUI_QUERYTABLEVIEW_HXX
|
|
|
|
#define DBAUI_QUERYTABLEVIEW_HXX
|
|
|
|
|
|
|
|
#include "JoinTableView.hxx"
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
2001-10-05 00:49:21 -05:00
|
|
|
#include "querycontroller.hxx"
|
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 OQueryTableConnection;
|
|
|
|
class OQueryTableWindow;
|
2001-02-28 03:11:33 -06:00
|
|
|
class OQueryDesignView;
|
2012-08-12 11:38:58 -05:00
|
|
|
|
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);
|
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/** called when init fails at the tablewindowdata because the m_xTable
|
|
|
|
object could not provide columns, but no exception was thrown.
|
|
|
|
Expected to throw. */
|
2007-11-01 09:16:49 -05:00
|
|
|
virtual void onNoColumns_throw();
|
|
|
|
|
|
|
|
virtual bool supressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const;
|
2012-08-12 11:38:58 -05:00
|
|
|
|
2001-02-05 02:10:26 -06:00
|
|
|
public:
|
|
|
|
OQueryTableView(Window* pParent,OQueryDesignView* pView);
|
|
|
|
virtual ~OQueryTableView();
|
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/// base class overwritten: create and delete windows
|
|
|
|
/// (not really delete, as it becomes an UndoAction)
|
2013-07-02 03:50:18 -05:00
|
|
|
bool ContainsTabWin(const OTableWindow& rTabWin); // #i122589# Allow to check if OTableWindow is registered
|
2013-04-07 05:06:47 -05:00
|
|
|
virtual void AddTabWin( const OUString& _rTableName, const OUString& _rAliasName, sal_Bool bNewTable = sal_False );
|
2001-02-05 02:10:26 -06:00
|
|
|
virtual void RemoveTabWin(OTableWindow* pTabWin);
|
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/// AddTabWin, setting an alias
|
2013-04-07 05:06:47 -05:00
|
|
|
void AddTabWin(const OUString& strDatabase, const OUString& strTableName, const OUString& strAlias, sal_Bool bNewTable = sal_False);
|
2012-08-12 11:02:18 -05:00
|
|
|
/// search TabWin
|
2001-02-05 02:10:26 -06:00
|
|
|
OQueryTableWindow* FindTable(const String& rAliasName);
|
2011-01-14 08:00:11 -06:00
|
|
|
sal_Bool FindTableFromField(const String& rFieldName, OTableFieldDescRef& rInfo, sal_uInt16& rCnt);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/// base class overwritten: create and delete Connections
|
2001-02-05 02:10:26 -06:00
|
|
|
virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest);
|
2002-02-08 01:56:33 -06:00
|
|
|
|
2008-06-25 06:46:41 -05:00
|
|
|
virtual bool RemoveConnection( OTableConnection* _pConn ,sal_Bool _bDelete);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-10 14:24:32 -05:00
|
|
|
// transfer of connections from and to UndoAction
|
2012-08-12 11:22:40 -05:00
|
|
|
|
|
|
|
/// Inserting a Connection the structure
|
2001-02-05 02:10:26 -06:00
|
|
|
void GetConnection(OQueryTableConnection* pConn);
|
2012-08-12 11:22:40 -05:00
|
|
|
/** Removing a Connection from the structure
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
This results effectively in complete reset of request form, as all
|
|
|
|
windows are hidden, as are all Connections to these windows and all
|
|
|
|
request columns based on those tables */
|
|
|
|
void DropConnection(OQueryTableConnection* pConn);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-10 14:24:32 -05:00
|
|
|
// show and hide TabWin (NOT create or delete)
|
2012-08-12 11:48:35 -05:00
|
|
|
sal_Bool ShowTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction,sal_Bool _bAppend);
|
|
|
|
void HideTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/// ensure visibility of TabWins (+ and invalidate connections)
|
2002-05-22 05:16:34 -05:00
|
|
|
virtual void EnsureVisible(const OTableWindow* _pWin);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/// how many tables with a certain alias do I already have?
|
2012-08-12 11:48:35 -05:00
|
|
|
sal_Int32 CountTableAlias(const String& rName, sal_Int32& rMax);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-12 11:02:18 -05:00
|
|
|
/// insert field (simply passed to parents)
|
2001-10-05 00:49:21 -05:00
|
|
|
void InsertField(const OTableFieldDescRef& rInfo);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/// rebuild everything (TabWins, Connections)
|
|
|
|
/// (PRECONDITION: ClearAll was called previously)
|
2001-02-05 02:10:26 -06:00
|
|
|
virtual void ReSync();
|
2012-08-10 14:24:32 -05:00
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/// delete everything hard (TabWins, Connections), without any notifications
|
2001-02-05 02:10:26 -06:00
|
|
|
virtual void ClearAll();
|
|
|
|
|
2012-08-10 14:24:32 -05:00
|
|
|
// used by AddTabDlg to see if tables can still be added
|
2011-01-14 08:00:11 -06:00
|
|
|
//virtual sal_Bool IsAddAllowed();
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/// announce new Connection and insert it, if not existant yet
|
2011-01-14 08:00:11 -06:00
|
|
|
void NotifyTabConnection(const OQueryTableConnection& rNewConn, sal_Bool _bCreateUndoAction = sal_True);
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/// @note the Handler receives a pointer to a TabWinsChangeNotification struct
|
2012-08-12 11:48:35 -05:00
|
|
|
Link SetTabWinsChangeHandler(const Link& lnk) { Link lnkRet = m_lnkTabWinsChangeHandler; m_lnkTabWinsChangeHandler = lnk; return lnkRet; }
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2011-01-14 08:00:11 -06:00
|
|
|
sal_Bool ExistsAVisitedConn(const OQueryTableWindow* pFrom) const;
|
2001-02-28 03:11:33 -06:00
|
|
|
|
2013-04-07 05:06:47 -05:00
|
|
|
virtual OTableWindowData* CreateImpl(const OUString& _rComposedName
|
|
|
|
,const OUString& _sTableName
|
|
|
|
,const OUString& _rWinName);
|
2002-02-06 00:23:39 -06:00
|
|
|
|
2012-08-12 11:22:40 -05:00
|
|
|
/** opens the join dialog and allows to create a new join connection */
|
2002-02-06 00:23:39 -06:00
|
|
|
void createNewConnection();
|
2006-06-19 21:12:43 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
using OJoinTableView::EnsureVisible;
|
2001-02-05 02:10:26 -06:00
|
|
|
};
|
|
|
|
}
|
2012-08-12 11:38:58 -05:00
|
|
|
#endif
|
2001-02-05 02:10:26 -06:00
|
|
|
|
2010-10-27 06:33:13 -05:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|