bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / inc / QueryTableView.hxx
blobf8d32438165da3d5e289f1a856c6912dec121599
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef DBAUI_QUERYTABLEVIEW_HXX
20 #define DBAUI_QUERYTABLEVIEW_HXX
22 #include "JoinTableView.hxx"
23 #include <com/sun/star/container/XNameAccess.hpp>
24 #include "querycontroller.hxx"
26 namespace dbaui
28 struct TabWinsChangeNotification
30 enum ACTION_TYPE { AT_ADDED_WIN, AT_REMOVED_WIN };
31 ACTION_TYPE atActionPerformed;
32 String strAffectedTable;
34 TabWinsChangeNotification(ACTION_TYPE at, const String& str) : atActionPerformed(at), strAffectedTable(str) { }
37 class OQueryTabWinUndoAct;
38 class OQueryTableConnection;
39 class OQueryTableWindow;
40 class OQueryDesignView;
42 class OQueryTableView : public OJoinTableView
44 Link m_lnkTabWinsChangeHandler;
46 protected:
47 virtual void ConnDoubleClicked(OTableConnection* pConnection);
48 virtual void KeyInput(const KeyEvent& rEvt);
50 virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData);
52 /** called when init fails at the tablewindowdata because the m_xTable
53 object could not provide columns, but no exception was thrown.
54 Expected to throw. */
55 virtual void onNoColumns_throw();
57 virtual bool supressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const;
59 public:
60 OQueryTableView(Window* pParent,OQueryDesignView* pView);
61 virtual ~OQueryTableView();
63 /// base class overwritten: create and delete windows
64 /// (not really delete, as it becomes an UndoAction)
65 virtual void AddTabWin( const OUString& _rTableName, const OUString& _rAliasName, sal_Bool bNewTable = sal_False );
66 virtual void RemoveTabWin(OTableWindow* pTabWin);
68 /// AddTabWin, setting an alias
69 void AddTabWin(const OUString& strDatabase, const OUString& strTableName, const OUString& strAlias, sal_Bool bNewTable = sal_False);
70 /// search TabWin
71 OQueryTableWindow* FindTable(const String& rAliasName);
72 sal_Bool FindTableFromField(const String& rFieldName, OTableFieldDescRef& rInfo, sal_uInt16& rCnt);
74 /// base class overwritten: create and delete Connections
75 virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest);
77 virtual bool RemoveConnection( OTableConnection* _pConn ,sal_Bool _bDelete);
79 // transfer of connections from and to UndoAction
81 /// Inserting a Connection the structure
82 void GetConnection(OQueryTableConnection* pConn);
83 /** Removing a Connection from the structure
85 This results effectively in complete reset of request form, as all
86 windows are hidden, as are all Connections to these windows and all
87 request columns based on those tables */
88 void DropConnection(OQueryTableConnection* pConn);
90 // show and hide TabWin (NOT create or delete)
91 sal_Bool ShowTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction,sal_Bool _bAppend);
92 void HideTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction);
94 /// ensure visibility of TabWins (+ and invalidate connections)
95 virtual void EnsureVisible(const OTableWindow* _pWin);
97 /// how many tables with a certain alias do I already have?
98 sal_Int32 CountTableAlias(const String& rName, sal_Int32& rMax);
100 /// insert field (simply passed to parents)
101 void InsertField(const OTableFieldDescRef& rInfo);
103 /// rebuild everything (TabWins, Connections)
104 /// (PRECONDITION: ClearAll was called previously)
105 virtual void ReSync();
107 /// delete everything hard (TabWins, Connections), without any notifications
108 virtual void ClearAll();
110 // used by AddTabDlg to see if tables can still be added
111 //virtual sal_Bool IsAddAllowed();
113 /// announce new Connection and insert it, if not existant yet
114 void NotifyTabConnection(const OQueryTableConnection& rNewConn, sal_Bool _bCreateUndoAction = sal_True);
116 /// @note the Handler receives a pointer to a TabWinsChangeNotification struct
117 Link SetTabWinsChangeHandler(const Link& lnk) { Link lnkRet = m_lnkTabWinsChangeHandler; m_lnkTabWinsChangeHandler = lnk; return lnkRet; }
119 sal_Bool ExistsAVisitedConn(const OQueryTableWindow* pFrom) const;
121 virtual OTableWindowData* CreateImpl(const OUString& _rComposedName
122 ,const OUString& _sTableName
123 ,const OUString& _rWinName);
125 /** opens the join dialog and allows to create a new join connection */
126 void createNewConnection();
128 private:
129 using OJoinTableView::EnsureVisible;
132 #endif
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */