LibreOffice Module dbaccess (master) 1
TableWindow.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
21#include <com/sun/star/container/XNameAccess.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include "TableWindowTitle.hxx"
24#include <rtl/ref.hxx>
25#include "TableWindowData.hxx"
27#include <vector>
28#include <vcl/window.hxx>
29
33
34// Flags for the size adjustment of SbaJoinTabWins
35enum class SizingFlags {
36 NONE = 0x0000,
37 Top = 0x0001,
38 Bottom = 0x0002,
39 Left = 0x0004,
40 Right = 0x0008,
41};
42namespace o3tl {
43 template<> struct typed_flags<SizingFlags> : is_typed_flags<SizingFlags, 0x0f> {};
44}
45
46
47namespace dbaui
48{
49 class OJoinDesignView;
50 class OJoinTableView;
51 class OTableWindowAccess;
52
55 ,public vcl::Window
56 {
57 friend class OTableWindowTitle;
58 friend class OTableWindowListBox;
59 protected:
60 // and the table itself (needed for me as I want to lock it as long as the window is alive)
63
64 private:
65 TTableWindowData::value_type
69 sal_Int32 m_nMoveCount; // how often the arrow keys was pressed
70 sal_Int32 m_nMoveIncrement; // how many pixel we should move
72
73 // OContainerListener
74 virtual void _elementInserted( const css::container::ContainerEvent& _rEvent ) override;
75 virtual void _elementRemoved( const css::container::ContainerEvent& _rEvent ) override;
76 virtual void _elementReplaced( const css::container::ContainerEvent& _rEvent ) override;
77
78 protected:
79 virtual void Resize() override;
80 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
81 virtual void MouseMove( const MouseEvent& rEvt ) override;
82 virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
83 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
84
85 // called at FIRST Init
86 void FillListBox();
87 // called at EACH Init
88
89 virtual void OnEntryDoubleClicked(weld::TreeIter& /*rEntry*/) { }
90 // called from the DoubleClickHdl of the ListBox
91
97 virtual void deleteUserData(void*& _pUserData);
98
107 virtual void* createUserData(const css::uno::Reference<
108 css::beans::XPropertySet>& _xColumn,
109 bool _bPrimaryKey);
110
113 void impl_updateImage();
114
115 OTableWindow( vcl::Window* pParent, TTableWindowData::value_type aTabWinData );
116
117 public:
118 virtual ~OTableWindow() override;
119 virtual void dispose() override;
120
121 // late Constructor, see also CreateListbox and FillListbox
122 virtual bool Init();
123
125 const OJoinTableView* getTableView() const;
127 void SetPosPixel( const Point& rNewPos ) override;
128 void SetSizePixel( const Size& rNewSize ) override;
129 void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) override;
130
131 OUString getTitle() const;
132 void SetBoldTitle( bool bBold );
133 void setActive(bool _bActive = true);
134
135 void Remove();
136
137 OUString const & GetTableName() const { return m_pData->GetTableName(); }
138 OUString const & GetWinName() const { return m_pData->GetWinName(); }
139 OUString const & GetComposedName() const { return m_pData->GetComposedName(); }
141 const TTableWindowData::value_type& GetData() const { return m_pData; }
143
148 virtual OUString GetName() const = 0;
149
150 css::uno::Reference< css::container::XNameAccess > GetOriginalColumns() const { return m_pData->getColumns(); }
151 css::uno::Reference< css::beans::XPropertySet > GetTable() const { return m_pData->getTable(); }
152
157 void setSizingFlag(const Point& _rPos);
158
161 tools::Rectangle getSizingRect(const Point& _rPos,const Size& _rOutputSize) const;
162
163 // window override
164 virtual void StateChanged( StateChangedType nStateChange ) override;
165 virtual void GetFocus() override;
166 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
167 virtual void Command(const CommandEvent& rEvt) override;
168
169 // Accessibility
170 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
171
172 // do I have connections to the outside?
173 bool ExistsAConn() const;
174
175 void EnumValidFields(std::vector< OUString>& arrstrFields);
176
179 void clearListBox();
180 };
181}
182
183/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SizingFlags
Definition: TableWindow.hxx:35
virtual void OnEntryDoubleClicked(weld::TreeIter &)
Definition: TableWindow.hxx:89
virtual void deleteUserData(void *&_pUserData)
delete the user data with the equal type as created within createUserData
OJoinDesignView * getDesignView()
TTableWindowData::value_type m_pData
Definition: TableWindow.hxx:66
OJoinTableView * getTableView()
bool ExistsAConn() const
css::uno::Reference< css::container::XNameAccess > GetOriginalColumns() const
virtual ~OTableWindow() override
virtual void dispose() override
sal_Int32 m_nMoveCount
Definition: TableWindow.hxx:69
const TTableWindowData::value_type & GetData() const
tools::Rectangle getSizingRect(const Point &_rPos, const Size &_rOutputSize) const
returns the new sizing
void SetPosPixel(const Point &rNewPos) override
OUString const & GetWinName() const
void SetBoldTitle(bool bBold)
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
void clearListBox()
clears the listbox inside.
virtual void Command(const CommandEvent &rEvt) override
virtual void StateChanged(StateChangedType nStateChange) override
virtual void _elementInserted(const css::container::ContainerEvent &_rEvent) override
virtual OUString GetName() const =0
returns the name which should be used when displaying join or relations
void SetSizePixel(const Size &rNewSize) override
sal_Int32 m_nMoveIncrement
Definition: TableWindow.hxx:70
void impl_updateImage()
updates image
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
virtual void * createUserData(const css::uno::Reference< css::beans::XPropertySet > &_xColumn, bool _bPrimaryKey)
creates user information that will be append at the ListBoxentry
virtual bool Init()
virtual void _elementRemoved(const css::container::ContainerEvent &_rEvent) override
virtual void MouseMove(const MouseEvent &rEvt) override
VclPtr< OTableWindowListBox > m_xListBox
Definition: TableWindow.hxx:62
OUString getTitle() const
const VclPtr< OTableWindowListBox > & GetListBox() const
virtual void GetFocus() override
css::uno::Reference< css::beans::XPropertySet > GetTable() const
void setActive(bool _bActive=true)
virtual void _elementReplaced(const css::container::ContainerEvent &_rEvent) override
::rtl::Reference< comphelper::OContainerListenerAdapter > m_pContainerListener
Definition: TableWindow.hxx:68
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
virtual void MouseButtonDown(const MouseEvent &rEvt) override
void EnumValidFields(std::vector< OUString > &arrstrFields)
OUString const & GetTableName() const
virtual void Resize() override
void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize) override
OUString const & GetComposedName() const
const VclPtr< OTableWindowTitle > & GetTitleCtrl() const
OTableWindow(vcl::Window *pParent, TTableWindowData::value_type aTabWinData)
Definition: TableWindow.cxx:90
void setSizingFlag(const Point &_rPos)
set the sizing flag to the direction
VclPtr< OTableWindowTitle > m_xTitle
Definition: TableWindow.hxx:61
virtual bool PreNotify(NotifyEvent &rNEvt) override
SizingFlags m_nSizingFlags
Definition: TableWindow.hxx:71
NONE
Left
Right
StateChangedType