merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / inc / TableWindow.hxx
blob03d3b5bf0699682e943fe44590d304411ed4b170
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TableWindow.hxx,v $
10 * $Revision: 1.19.68.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_TABLEWINDOW_HXX
31 #define DBAUI_TABLEWINDOW_HXX
33 #include <com/sun/star/container/XNameAccess.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include "TableWindowTitle.hxx"
36 #include <tools/rtti.hxx>
37 #include <rtl/ref.hxx>
38 #include "TableWindowData.hxx"
39 #include <vector>
40 #include <vcl/window.hxx>
42 #include <comphelper/containermultiplexer.hxx>
43 #include "cppuhelper/basemutex.hxx"
45 class SvLBoxEntry;
46 namespace dbaui
48 //////////////////////////////////////////////////////////////////////////
49 // Flags fuer die Groessenanpassung der SbaJoinTabWins
50 const UINT16 SIZING_NONE = 0x0000;
51 const UINT16 SIZING_TOP = 0x0001;
52 const UINT16 SIZING_BOTTOM = 0x0002;
53 const UINT16 SIZING_LEFT = 0x0004;
54 const UINT16 SIZING_RIGHT = 0x0008;
56 class OTableWindowListBox;
57 class OJoinDesignView;
58 class OJoinTableView;
59 class OTableWindowAccess;
61 class OTableWindow : public ::cppu::BaseMutex
62 ,public ::comphelper::OContainerListener
63 ,public Window
65 friend class OTableWindowTitle;
66 friend class OTableWindowListBox;
67 protected:
68 // und die Tabelle selber (brauche ich, da ich sie locken will, solange das Fenster lebt)
69 FixedImage m_aTypeImage;
70 OTableWindowTitle m_aTitle;
71 OTableWindowListBox* m_pListBox;
72 OTableWindowAccess* m_pAccessible;
74 private:
75 TTableWindowData::value_type
76 m_pData;
77 ::rtl::Reference< comphelper::OContainerListenerAdapter>
78 m_pContainerListener;
79 sal_Int32 m_nMoveCount; // how often the arrow keys was pressed
80 sal_Int32 m_nMoveIncrement; // how many pixel we should move
81 UINT16 m_nSizingFlags;
82 BOOL m_bActive;
84 void Draw3DBorder( const Rectangle& rRect );
85 // OContainerListener
86 virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
87 virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
88 virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
90 protected:
91 virtual void Resize();
92 virtual void Paint( const Rectangle& rRect );
93 virtual void MouseMove( const MouseEvent& rEvt );
94 virtual void MouseButtonDown( const MouseEvent& rEvt );
95 virtual void DataChanged( const DataChangedEvent& rDCEvt );
97 virtual OTableWindowListBox* CreateListBox();
98 // wird im ERSTEN Init aufgerufen
99 BOOL FillListBox();
100 // wird in JEDEM Init aufgerufen
102 virtual void OnEntryDoubleClicked(SvLBoxEntry* /*pEntry*/) { }
103 // wird aus dem DoubleClickHdl der ListBox heraus aufgerufen
105 /** HandleKeyInput triues to handle the KeyEvent. Movement or deletion
106 @param rEvt
107 The KEyEvent
108 @return
109 <TRUE/> when the table could handle the keyevent.
111 BOOL HandleKeyInput( const KeyEvent& rEvt );
113 /** delete the user data with the equal type as created within createUserData
114 @param _pUserData
115 The user data store in the listbox entries. Created with a call to createUserData.
116 _pUserData may be <NULL/>. _pUserData will be set to <NULL/> after call.
118 virtual void deleteUserData(void*& _pUserData);
120 /** creates user information that will be append at the ListBoxentry
121 @param _xColumn
122 The corresponding column, can be <NULL/>.
123 @param _bPrimaryKey
124 <TRUE/> when the column belongs to the primary key
125 @return
126 the user data which will be append at the listbox entry, may be <NULL/>
128 virtual void* createUserData(const ::com::sun::star::uno::Reference<
129 ::com::sun::star::beans::XPropertySet>& _xColumn,
130 bool _bPrimaryKey);
132 /** updates m_aTypeImage
134 void impl_updateImage();
136 OTableWindow( Window* pParent, const TTableWindowData::value_type& pTabWinData );
138 public:
139 virtual ~OTableWindow();
141 // spaeter Constructor, siehe auch CreateListbox und FillListbox
142 virtual BOOL Init();
144 OJoinTableView* getTableView();
145 const OJoinTableView* getTableView() const;
146 OJoinDesignView* getDesignView();
147 void SetPosPixel( const Point& rNewPos );
148 void SetSizePixel( const Size& rNewSize );
149 void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
151 String getTitle() const;
152 void SetBoldTitle( BOOL bBold );
153 void setActive(sal_Bool _bActive = sal_True);
155 void Remove();
156 BOOL IsActiveWindow(){ return m_bActive; }
158 ::rtl::OUString GetTableName() const { return m_pData->GetTableName(); }
159 ::rtl::OUString GetWinName() const { return m_pData->GetWinName(); }
160 ::rtl::OUString GetComposedName() const { return m_pData->GetComposedName(); }
161 OTableWindowListBox* GetListBox() const { return m_pListBox; }
162 TTableWindowData::value_type GetData() const { return m_pData; }
163 OTableWindowTitle* GetTitleCtrl() { return &m_aTitle; }
165 /** returns the name which should be used when displaying join or relations
166 @return
167 The composed name or the window name.
169 virtual ::rtl::OUString GetName() const = 0;
171 inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetOriginalColumns() const { return m_pData->getColumns(); }
172 inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetTable() const { return m_pData->getTable(); }
174 UINT16 GetSizingFlags() const { return m_nSizingFlags; }
175 /** set the sizing flag to the direction
176 @param _rPos
177 The EndPosition after resizing.
179 void setSizingFlag(const Point& _rPos);
180 /** set the rsizing flag to NONE.
182 void resetSizingFlag() { m_nSizingFlags = SIZING_NONE; }
184 /** returns the new sizing
186 Rectangle getSizingRect(const Point& _rPos,const Size& _rOutputSize) const;
188 // window override
189 virtual void StateChanged( StateChangedType nStateChange );
190 virtual void GetFocus();
191 virtual long PreNotify( NotifyEvent& rNEvt );
192 virtual void Command(const CommandEvent& rEvt);
194 // Accessibility
195 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
197 // habe ich Connections nach aussen ?
198 BOOL ExistsAConn() const;
200 void EnumValidFields(::std::vector< ::rtl::OUString>& arrstrFields);
202 /** clears the listbox inside. Must be called be the dtor is called.
204 void clearListBox();
206 protected:
207 using Window::SetPosSizePixel;
210 #endif //DBAUI_TABLEWINDOW_HXX