LibreOffice Module dbaccess (master) 1
JoinTableView.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
22#include <vcl/window.hxx>
23#include <vcl/timer.hxx>
24#include <vcl/idle.hxx>
25#include <vcl/vclptr.hxx>
26#include <vcl/transfer.hxx>
27
28#include "callbacks.hxx"
30#include "TableWindowData.hxx"
31
32#include <map>
33#include <vector>
34
35struct AcceptDropEvent;
36struct ExecuteDropEvent;
37class SfxUndoAction;
38
39namespace dbaui
40{
41 class OTableConnection;
42 class OTableWindow;
43 struct OJoinExchangeData;
44 class OJoinDesignView;
45 class OTableWindowData;
46 class OJoinDesignViewAccess;
47
48 // this class contains only the scrollbars to avoid that
49 // the tablewindows clip the scrollbars
50 class OJoinTableView;
52 {
56
57 protected:
58 virtual void Resize() override;
59
60 public:
62 virtual ~OScrollWindowHelper() override;
63 virtual void dispose() override;
64
65 void setTableView(OJoinTableView* _pTableView);
66
67 void resetRange(const Point& _aSize);
68
69 // own methods
72 };
73
74
77 public DropTargetHelper
78 {
80
81 public:
82 typedef std::map<OUString, VclPtr<OTableWindow> > OTableWindowMap;
83
84 private:
86 std::vector<VclPtr<OTableConnection> > m_vTableConnection;
87
95
96
100
101
102 DECL_LINK(OnDragScrollTimer, Timer*, void);
103
104 protected:
108
109 public:
110 OJoinTableView( vcl::Window* pParent, OJoinDesignView* pView );
111 virtual ~OJoinTableView() override;
112 virtual void dispose() override;
113
114 // window override
115 virtual void StateChanged( StateChangedType nStateChange ) override;
116 virtual void GetFocus() override;
117 virtual void LoseFocus() override;
118 virtual void KeyInput( const KeyEvent& rEvt ) override;
119 // Accessibility
120 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
121
122 // own methods
125 DECL_LINK(VertScrollHdl, weld::Scrollbar&, void);
126 DECL_LINK(HorzScrollHdl, weld::Scrollbar&, void);
127
128 void DrawConnections(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
130
131 void BeginChildMove( OTableWindow* pTabWin, const Point& rMousePos );
132 void BeginChildSizing( OTableWindow* pTabWin, PointerStyle nPointer );
133
134 void NotifyTitleClicked( OTableWindow* pTabWin, const Point& rMousePos );
135
136 virtual void AddTabWin(const OUString& _rComposedName, const OUString& rWinName, bool bNewTable = false);
137 virtual void RemoveTabWin( OTableWindow* pTabWin );
138
139 // hide all TabWins (does NOT delete them; they are put in an UNDO action)
140 void HideTabWins();
141
142 virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest) = 0;
143
153 virtual bool RemoveConnection(VclPtr<OTableConnection>& rConnection, bool bDelete);
154
163 void addConnection(OTableConnection* _pConnection,bool _bAddData = true);
164
165 bool ScrollPane( tools::Long nDelta, bool bHoriz, bool bPaintScrollBars );
166 sal_Int64 GetTabWinCount() const;
167 const Point& GetScrollOffset() const { return m_aScrollOffset; }
168
170 OTableWindow* GetTabWindow( const OUString& rName );
171
174 void DeselectConn(OTableConnection* pConn);
175 void SelectConn(OTableConnection* pConn);
176
178
181 const std::vector<VclPtr<OTableConnection> >& getTableConnections() const { return m_vTableConnection; }
182
183 bool ExistsAConn(const OTableWindow* pFromWin) const;
184
190 std::vector<VclPtr<OTableConnection> >::const_iterator getTableConnections(const OTableWindow* _pFromWin) const;
191
197 sal_Int32 getConnectionCount(const OTableWindow* _pFromWin) const;
198
199 OTableConnection* GetTabConn(const OTableWindow* pLhs,const OTableWindow* pRhs,bool _bSuppressCrossOrNaturalJoin = false) const;
200
207
210 void GrabTabWinFocus();
211
214 virtual void ReSync() { }
215
220 virtual void ClearAll();
221
223 virtual bool IsAddAllowed();
224 virtual bool PreNotify(NotifyEvent& rNEvt) override;
225
226 // DnD stuff
227 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
228 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
229
231 virtual void lookForUiActivities();
232
243 void TabWinMoved(OTableWindow* ptWhich, const Point& ptOldPosition);
244
245 void TabWinSized(OTableWindow* ptWhich, const Point& ptOldPosition, const Size& szOldSize);
246
247 void modified();
248
255 bool isMovementAllowed(const Point& _rPoint,const Size& _rSize);
256
257 const Size& getRealOutputSize() const { return m_aOutputSize; }
258
259 virtual void EnsureVisible(const OTableWindow* _pWin);
260 void EnsureVisible(const Point& _rPoint,const Size& _rSize);
261
262 TTableWindowData::value_type createTableWindowData(const OUString& _rComposedName
263 ,const OUString& _sTableName
264 ,const OUString& _rWinName);
265
266 protected:
267 virtual void MouseButtonUp( const MouseEvent& rEvt ) override;
268 virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
269 virtual void Tracking( const TrackingEvent& rTEvt ) override;
270 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
271 virtual void ConnDoubleClicked(VclPtr<OTableConnection>& rConnection);
272 void SetDefaultTabWinPosSize( OTableWindow* pTabWin );
273 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
274
275 virtual void Resize() override;
276
277 virtual void dragFinished( ) override;
280 virtual void Command(const CommandEvent& rEvt) override;
281
282 virtual std::shared_ptr<OTableWindowData> CreateImpl(const OUString& _rComposedName
283 ,const OUString& _sTableName
284 ,const OUString& _rWinName);
285
291 virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) = 0;
292
295 virtual bool allowQueries() const;
296
300 virtual void onNoColumns_throw();
301
302 virtual bool suppressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const;
303
304 private:
305 void InitColors();
306 void ScrollWhileDragging();
307
312 void executePopup(const Point& _aPos, VclPtr<OTableConnection>& rSelConnection);
313
318 void invalidateAndModify(std::unique_ptr<SfxUndoAction> _pAction);
319
320 private:
321 using Window::Scroll;
322 };
323}
324
325/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void NotifyTitleClicked(OTableWindow *pTabWin, const Point &rMousePos)
virtual void dispose() override
void BeginChildMove(OTableWindow *pTabWin, const Point &rMousePos)
void TabWinMoved(OTableWindow *ptWhich, const Point &ptOldPosition)
Hook that is called after moving/resizing TabWins.
virtual void KeyInput(const KeyEvent &rEvt) override
virtual void LoseFocus() override
ScrollAdaptor & GetVScrollBar()
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
rtl::Reference< OJoinDesignViewAccess > m_pAccessible
const std::vector< VclPtr< OTableConnection > > & getTableConnections() const
gives a read only access to the connection vector
void executePopup(const Point &_aPos, VclPtr< OTableConnection > &rSelConnection)
opens the context menu to delete a connection
virtual bool RemoveConnection(VclPtr< OTableConnection > &rConnection, bool bDelete)
RemoveConnection allows to remove connections from join table view.
const Point & GetScrollOffset() const
OTableWindow * GetTabWindow(const OUString &rName)
VclPtr< OTableWindow > m_pLastFocusTabWin
VclPtr< OTableWindow > m_pDragWin
void TabWinSized(OTableWindow *ptWhich, const Point &ptOldPosition, const Size &szOldSize)
sal_Int32 getConnectionCount(const OTableWindow *_pFromWin) const
how many connection belongs to single table
tools::Rectangle m_aSizingRect
void clearLayoutInformation()
clear the window map and connection vector without destroying it
virtual VclPtr< OTableWindow > createWindow(const TTableWindowData::value_type &_pData)=0
factory method to create table windows
DECL_LINK(VertScrollHdl, weld::Scrollbar &, void)
virtual void MouseButtonDown(const MouseEvent &rEvt) override
TTableWindowData::value_type createTableWindowData(const OUString &_rComposedName, const OUString &_sTableName, const OUString &_rWinName)
virtual ~OJoinTableView() override
virtual void EnsureVisible(const OTableWindow *_pWin)
virtual void Resize() override
virtual void Command(const CommandEvent &rEvt) override
VclPtr< OTableWindow > m_pSizingWin
bool ExistsAConn(const OTableWindow *pFromWin) const
std::map< OUString, VclPtr< OTableWindow > > OTableWindowMap
void BeginChildSizing(OTableWindow *pTabWin, PointerStyle nPointer)
virtual bool IsAddAllowed()
virtual void ClearAll()
Hard deletion.
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
VclPtr< OTableConnection > m_pSelectedConn
virtual bool allowQueries() const
determines whether the classes Init method should accept a query name, or only table names
void GrabTabWinFocus()
set the focus to that tab win which most recently had it (or to the first available one)
void SelectConn(OTableConnection *pConn)
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
virtual void ReSync()
take all WinData and ConnData from the document and create the corresponding Wins and Conns
virtual bool suppressCrossNaturalJoin(const TTableConnectionData::value_type &_pData) const
virtual std::shared_ptr< OTableWindowData > CreateImpl(const OUString &_rComposedName, const OUString &_sTableName, const OUString &_rWinName)
OJoinDesignView * getDesignView() const
OTableWindowMap m_aTableMap
virtual void GetFocus() override
virtual void Tracking(const TrackingEvent &rTEvt) override
void DeselectConn(OTableConnection *pConn)
std::vector< VclPtr< OTableConnection > > m_vTableConnection
VclPtr< OJoinDesignView > m_pView
virtual void AddConnection(const OJoinExchangeData &jxdSource, const OJoinExchangeData &jxdDest)=0
bool ScrollPane(tools::Long nDelta, bool bHoriz, bool bPaintScrollBars)
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
virtual void ConnDoubleClicked(VclPtr< OTableConnection > &rConnection)
DECL_LINK(OnDragScrollTimer, Timer *, void)
const Size & getRealOutputSize() const
sal_Int64 GetTabWinCount() const
bool isMovementAllowed(const Point &_rPoint, const Size &_rSize)
check if the given window is visible.
VclPtr< OTableConnection > & GetSelectedConn()
virtual void RemoveTabWin(OTableWindow *pTabWin)
void SetDefaultTabWinPosSize(OTableWindow *pTabWin)
virtual bool PreNotify(NotifyEvent &rNEvt) override
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
tools::Rectangle m_aDragRect
void DrawConnections(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
virtual void dragFinished() override
called when a drag operation done with a Transferable has been finished
ScrollAdaptor & GetHScrollBar()
void invalidateAndModify(std::unique_ptr< SfxUndoAction > _pAction)
invalidates this window without children and set the controller modified
OTableConnection * GetTabConn(const OTableWindow *pLhs, const OTableWindow *pRhs, bool _bSuppressCrossOrNaturalJoin=false) const
DECL_LINK(HorzScrollHdl, weld::Scrollbar &, void)
OJoinTableView(vcl::Window *pParent, OJoinDesignView *pView)
void addConnection(OTableConnection *_pConnection, bool _bAddData=true)
allows to add new connections to join table view
virtual void lookForUiActivities()
virtual void StateChanged(StateChangedType nStateChange) override
OTableWindowMap & GetTabWinMap()
virtual void AddTabWin(const OUString &_rComposedName, const OUString &rWinName, bool bNewTable=false)
virtual void onNoColumns_throw()
called when init fails at the tablewindowdata because the m_xTable object could not provide columns,...
virtual void MouseButtonUp(const MouseEvent &rEvt) override
ScrollAdaptor & GetVScrollBar()
virtual void dispose() override
void setTableView(OJoinTableView *_pTableView)
virtual ~OScrollWindowHelper() override
VclPtr< ScrollAdaptor > m_aVScrollBar
ScrollAdaptor & GetHScrollBar()
VclPtr< OJoinTableView > m_pTableView
virtual void Resize() override
OScrollWindowHelper(vcl::Window *pParent)
VclPtr< ScrollAdaptor > m_aHScrollBar
void resetRange(const Point &_aSize)
vcl::Window * GetParent() const
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
long Long
PointerStyle
signed char sal_Int8
StateChangedType