bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / inc / TableWindow.hxx
blobae46b51dd00ab1e46a414cd681ec1b74c6cf0e09
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_TABLEWINDOW_HXX
20 #define DBAUI_TABLEWINDOW_HXX
22 #include <com/sun/star/container/XNameAccess.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include "TableWindowTitle.hxx"
25 #include <tools/rtti.hxx>
26 #include <rtl/ref.hxx>
27 #include "TableWindowData.hxx"
28 #include <vector>
29 #include <vcl/window.hxx>
31 #include <comphelper/containermultiplexer.hxx>
32 #include "cppuhelper/basemutex.hxx"
34 class SvTreeListEntry;
35 namespace dbaui
37 //////////////////////////////////////////////////////////////////////////
38 // Flags for the size adjustment of SbaJoinTabWins
39 const sal_uInt16 SIZING_NONE = 0x0000;
40 const sal_uInt16 SIZING_TOP = 0x0001;
41 const sal_uInt16 SIZING_BOTTOM = 0x0002;
42 const sal_uInt16 SIZING_LEFT = 0x0004;
43 const sal_uInt16 SIZING_RIGHT = 0x0008;
45 class OTableWindowListBox;
46 class OJoinDesignView;
47 class OJoinTableView;
48 class OTableWindowAccess;
50 class OTableWindow : public ::cppu::BaseMutex
51 ,public ::comphelper::OContainerListener
52 ,public Window
54 friend class OTableWindowTitle;
55 friend class OTableWindowListBox;
56 protected:
57 // and the table itself (needed for me as I want to lock it as long as the window is alive)
58 FixedImage m_aTypeImage;
59 OTableWindowTitle m_aTitle;
60 OTableWindowListBox* m_pListBox;
61 OTableWindowAccess* m_pAccessible;
63 private:
64 TTableWindowData::value_type
65 m_pData;
66 ::rtl::Reference< comphelper::OContainerListenerAdapter>
67 m_pContainerListener;
68 sal_Int32 m_nMoveCount; // how often the arrow keys was pressed
69 sal_Int32 m_nMoveIncrement; // how many pixel we should move
70 sal_uInt16 m_nSizingFlags;
71 sal_Bool m_bActive;
73 void Draw3DBorder( const Rectangle& rRect );
74 // OContainerListener
75 virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
76 virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
77 virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
79 protected:
80 virtual void Resize();
81 virtual void Paint( const Rectangle& rRect );
82 virtual void MouseMove( const MouseEvent& rEvt );
83 virtual void MouseButtonDown( const MouseEvent& rEvt );
84 virtual void DataChanged( const DataChangedEvent& rDCEvt );
86 virtual OTableWindowListBox* CreateListBox();
87 // called at FIRST Init
88 sal_Bool FillListBox();
89 // called at EACH Init
91 virtual void OnEntryDoubleClicked(SvTreeListEntry* /*pEntry*/) { }
92 // called from the DoubleClickHdl of the ListBox
94 /** HandleKeyInput tries to handle the KeyEvent. Movement or deletion
95 @param rEvt
96 The KEyEvent
97 @return
98 <TRUE/> when the table could handle the keyevent.
100 sal_Bool HandleKeyInput( const KeyEvent& rEvt );
102 /** delete the user data with the equal type as created within createUserData
103 @param _pUserData
104 The user data store in the listbox entries. Created with a call to createUserData.
105 _pUserData may be <NULL/>. _pUserData will be set to <NULL/> after call.
107 virtual void deleteUserData(void*& _pUserData);
109 /** creates user information that will be append at the ListBoxentry
110 @param _xColumn
111 The corresponding column, can be <NULL/>.
112 @param _bPrimaryKey
113 <TRUE/> when the column belongs to the primary key
114 @return
115 the user data which will be append at the listbox entry, may be <NULL/>
117 virtual void* createUserData(const ::com::sun::star::uno::Reference<
118 ::com::sun::star::beans::XPropertySet>& _xColumn,
119 bool _bPrimaryKey);
121 /** updates m_aTypeImage
123 void impl_updateImage();
125 OTableWindow( Window* pParent, const TTableWindowData::value_type& pTabWinData );
127 public:
128 virtual ~OTableWindow();
130 // late Constructor, see also CreateListbox and FillListbox
131 virtual sal_Bool Init();
133 OJoinTableView* getTableView();
134 const OJoinTableView* getTableView() const;
135 OJoinDesignView* getDesignView();
136 void SetPosPixel( const Point& rNewPos );
137 void SetSizePixel( const Size& rNewSize );
138 void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
140 String getTitle() const;
141 void SetBoldTitle( sal_Bool bBold );
142 void setActive(sal_Bool _bActive = sal_True);
144 void Remove();
145 sal_Bool IsActiveWindow(){ return m_bActive; }
147 OUString GetTableName() const { return m_pData->GetTableName(); }
148 OUString GetWinName() const { return m_pData->GetWinName(); }
149 OUString GetComposedName() const { return m_pData->GetComposedName(); }
150 OTableWindowListBox* GetListBox() const { return m_pListBox; }
151 TTableWindowData::value_type GetData() const { return m_pData; }
152 OTableWindowTitle* GetTitleCtrl() { return &m_aTitle; }
154 /** returns the name which should be used when displaying join or relations
155 @return
156 The composed name or the window name.
158 virtual OUString GetName() const = 0;
160 inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetOriginalColumns() const { return m_pData->getColumns(); }
161 inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetTable() const { return m_pData->getTable(); }
163 sal_uInt16 GetSizingFlags() const { return m_nSizingFlags; }
164 /** set the sizing flag to the direction
165 @param _rPos
166 The EndPosition after resizing.
168 void setSizingFlag(const Point& _rPos);
169 /** set the rsizing flag to NONE.
171 void resetSizingFlag() { m_nSizingFlags = SIZING_NONE; }
173 /** returns the new sizing
175 Rectangle getSizingRect(const Point& _rPos,const Size& _rOutputSize) const;
177 // window override
178 virtual void StateChanged( StateChangedType nStateChange );
179 virtual void GetFocus();
180 virtual long PreNotify( NotifyEvent& rNEvt );
181 virtual void Command(const CommandEvent& rEvt);
183 // Accessibility
184 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
186 // do I have connections to the outside?
187 sal_Bool ExistsAConn() const;
189 void EnumValidFields(::std::vector< OUString>& arrstrFields);
191 /** clears the listbox inside. Must be called be the dtor is called.
193 void clearListBox();
196 #endif //DBAUI_TABLEWINDOW_HXX
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */