cid#1640468 Dereference after null check
[LibreOffice.git] / dbaccess / source / ui / inc / QueryTableView.hxx
blob26133d2cca421758091a83faa90e2e86b6927d6c
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 #pragma once
21 #include "JoinTableView.hxx"
22 #include "TableFieldDescription.hxx"
24 namespace dbaui
26 class OQueryTabWinUndoAct;
27 class OQueryTableConnection;
28 class OQueryTableWindow;
29 class OQueryDesignView;
31 class OQueryTableView : public OJoinTableView
33 protected:
34 virtual void ConnDoubleClicked(VclPtr<OTableConnection>& rConnection) override;
36 virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) override;
38 /** called when init fails at the tablewindowdata because the m_xTable
39 object could not provide columns, but no exception was thrown.
40 Expected to throw. */
41 virtual void onNoColumns_throw() override;
43 virtual bool suppressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const override;
45 public:
46 OQueryTableView(vcl::Window* pParent,OQueryDesignView* pView);
48 /// base class overwritten: create and delete windows
49 /// (not really delete, as it becomes an UndoAction)
50 bool ContainsTabWin(const OTableWindow& rTabWin); // #i122589# Allow to check if OTableWindow is registered
51 virtual void AddTabWin( const OUString& _rTableName, const OUString& _rAliasName, bool bNewTable = false ) override;
52 virtual void RemoveTabWin(OTableWindow* pTabWin) override;
54 /// AddTabWin, setting an alias
55 void AddTabWin(const OUString& strDatabase, const OUString& strTableName, const OUString& strAlias, bool bNewTable);
56 /// search TabWin
57 OQueryTableWindow* FindTable(const OUString& rAliasName);
58 bool FindTableFromField(const OUString& rFieldName, OTableFieldDescRef const & rInfo, sal_uInt16& rCnt);
60 /// base class overwritten: create and delete Connections
61 virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest) override;
63 virtual bool RemoveConnection(VclPtr<OTableConnection>& rConn, bool bDelete) override;
65 // transfer of connections from and to UndoAction
67 /// Inserting a Connection the structure
68 void GetConnection(OQueryTableConnection* pConn);
69 /** Removing a Connection from the structure
71 This results effectively in complete reset of request form, as all
72 windows are hidden, as are all Connections to these windows and all
73 request columns based on those tables */
74 void DropConnection(VclPtr<OQueryTableConnection> const & rConn);
76 // show and hide TabWin (NOT create or delete)
77 bool ShowTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction, bool _bAppend);
78 void HideTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction);
80 /// ensure visibility of TabWins (+ and invalidate connections)
81 virtual void EnsureVisible(const OTableWindow* _pWin) override;
83 /// how many tables with a certain alias do I already have?
84 sal_Int32 CountTableAlias(const OUString& rName, sal_Int32& rMax);
86 /// insert field (simply passed to parents)
87 void InsertField(const OTableFieldDescRef& rInfo);
89 /// rebuild everything (TabWins, Connections)
90 /// (PRECONDITION: ClearAll was called previously)
91 virtual void ReSync() override;
93 /// delete everything hard (TabWins, Connections), without any notifications
94 virtual void ClearAll() override;
96 // used by AddTabDlg to see if tables can still be added
97 //virtual sal_Bool IsAddAllowed();
99 /// announce new Connection and insert it, if not existing yet
100 void NotifyTabConnection(const OQueryTableConnection& rNewConn, bool _bCreateUndoAction = true);
102 bool ExistsAVisitedConn(const OQueryTableWindow* pFrom) const;
104 virtual std::shared_ptr<OTableWindowData> CreateImpl(const OUString& _rComposedName
105 ,const OUString& _sTableName
106 ,const OUString& _rWinName) override;
108 /** opens the join dialog and allows to create a new join connection */
109 void createNewConnection();
111 private:
112 using OJoinTableView::EnsureVisible;
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */