1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYTABLEVIEW_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYTABLEVIEW_HXX
22 #include "JoinTableView.hxx"
23 #include <com/sun/star/container/XNameAccess.hpp>
24 #include "querycontroller.hxx"
28 class OQueryTabWinUndoAct
;
29 class OQueryTableConnection
;
30 class OQueryTableWindow
;
31 class OQueryDesignView
;
33 class OQueryTableView
: public OJoinTableView
36 virtual void ConnDoubleClicked(VclPtr
<OTableConnection
>& rConnection
) override
;
37 virtual void KeyInput(const KeyEvent
& rEvt
) override
;
39 virtual VclPtr
<OTableWindow
> createWindow(const TTableWindowData::value_type
& _pData
) override
;
41 /** called when init fails at the tablewindowdata because the m_xTable
42 object could not provide columns, but no exception was thrown.
44 virtual void onNoColumns_throw() override
;
46 virtual bool supressCrossNaturalJoin(const TTableConnectionData::value_type
& _pData
) const override
;
49 OQueryTableView(vcl::Window
* pParent
,OQueryDesignView
* pView
);
51 /// base class overwritten: create and delete windows
52 /// (not really delete, as it becomes an UndoAction)
53 bool ContainsTabWin(const OTableWindow
& rTabWin
); // #i122589# Allow to check if OTableWindow is registered
54 virtual void AddTabWin( const OUString
& _rTableName
, const OUString
& _rAliasName
, bool bNewTable
= false ) override
;
55 virtual void RemoveTabWin(OTableWindow
* pTabWin
) override
;
57 /// AddTabWin, setting an alias
58 void AddTabWin(const OUString
& strDatabase
, const OUString
& strTableName
, const OUString
& strAlias
, bool bNewTable
= false);
60 OQueryTableWindow
* FindTable(const OUString
& rAliasName
);
61 bool FindTableFromField(const OUString
& rFieldName
, OTableFieldDescRef
& rInfo
, sal_uInt16
& rCnt
);
63 /// base class overwritten: create and delete Connections
64 virtual void AddConnection(const OJoinExchangeData
& jxdSource
, const OJoinExchangeData
& jxdDest
) override
;
66 virtual bool RemoveConnection(VclPtr
<OTableConnection
>& rConn
, bool bDelete
) override
;
68 // transfer of connections from and to UndoAction
70 /// Inserting a Connection the structure
71 void GetConnection(OQueryTableConnection
* pConn
);
72 /** Removing a Connection from the structure
74 This results effectively in complete reset of request form, as all
75 windows are hidden, as are all Connections to these windows and all
76 request columns based on those tables */
77 void DropConnection(VclPtr
<OQueryTableConnection
>& rConn
);
79 // show and hide TabWin (NOT create or delete)
80 bool ShowTabWin(OQueryTableWindow
* pTabWin
, OQueryTabWinUndoAct
* pUndoAction
, bool _bAppend
);
81 void HideTabWin(OQueryTableWindow
* pTabWin
, OQueryTabWinUndoAct
* pUndoAction
);
83 /// ensure visibility of TabWins (+ and invalidate connections)
84 virtual void EnsureVisible(const OTableWindow
* _pWin
) override
;
86 /// how many tables with a certain alias do I already have?
87 sal_Int32
CountTableAlias(const OUString
& rName
, sal_Int32
& rMax
);
89 /// insert field (simply passed to parents)
90 void InsertField(const OTableFieldDescRef
& rInfo
);
92 /// rebuild everything (TabWins, Connections)
93 /// (PRECONDITION: ClearAll was called previously)
94 virtual void ReSync() override
;
96 /// delete everything hard (TabWins, Connections), without any notifications
97 virtual void ClearAll() override
;
99 // used by AddTabDlg to see if tables can still be added
100 //virtual sal_Bool IsAddAllowed();
102 /// announce new Connection and insert it, if not existing yet
103 void NotifyTabConnection(const OQueryTableConnection
& rNewConn
, bool _bCreateUndoAction
= true);
105 bool ExistsAVisitedConn(const OQueryTableWindow
* pFrom
) const;
107 virtual OTableWindowData
* CreateImpl(const OUString
& _rComposedName
108 ,const OUString
& _sTableName
109 ,const OUString
& _rWinName
) override
;
111 /** opens the join dialog and allows to create a new join connection */
112 void createNewConnection();
115 using OJoinTableView::EnsureVisible
;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */