merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / app / AppView.hxx
bloba12cc99b917783e5cc3e9f8e1948644c886866eb
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: AppView.hxx,v $
10 * $Revision: 1.17 $
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_APPVIEW_HXX
31 #define DBAUI_APPVIEW_HXX
33 #ifndef DBAUI_DATAVIEW_HXX
34 #include "dataview.hxx"
35 #endif
36 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
37 #include <com/sun/star/container/XNameAccess.hpp>
38 #endif
39 #ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
40 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
41 #endif
42 #ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_
43 #include <com/sun/star/ucb/XContent.hpp>
44 #endif
45 #ifndef _COM_SUN_STAR_SDB_APPLICATION_NAMEDDATABASEOBJECT_HPP_
46 #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
47 #endif
48 #ifndef _SV_FIXED_HXX
49 #include <vcl/fixed.hxx>
50 #endif
51 #ifndef _UNOTOOLS_EVENTLISTENERADAPTER_HXX_
52 #include <unotools/eventlisteneradapter.hxx>
53 #endif
54 #ifndef DBACCESS_TABLEDESIGN_ICLIPBOARDTEST_HXX
55 #include "IClipBoardTest.hxx"
56 #endif
57 #ifndef DBAUI_APPELEMENTTYPE_HXX
58 #include "AppElementType.hxx"
59 #endif
61 namespace com{ namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
63 class Control;
64 class SvLBoxEntry;
65 class MnemonicGenerator;
67 namespace dbaui
69 class IControlActionListener;
70 class IApplicationController;
71 class OApplicationView;
72 class OApplicationDetailView;
73 class OApplicationSwapWindow;
74 class OTitleWindow;
75 //==================================================================
76 class OAppBorderWindow : public Window
78 OTitleWindow* m_pPanel;
79 OApplicationDetailView* m_pDetailView;
80 OApplicationView* m_pView;
82 void ImplInitSettings();
83 protected:
84 // Window
85 virtual void DataChanged( const DataChangedEvent& rDCEvt );
86 public:
87 OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode);
88 virtual ~OAppBorderWindow();
90 // window overloads
91 virtual void GetFocus();
92 virtual void Resize();
94 OApplicationView* getView() const;
95 OApplicationSwapWindow* getPanel() const;
96 OApplicationDetailView* getDetailView() const;
99 //==================================================================
100 class OApplicationView : public ODataView
101 ,public IClipboardTest
102 ,public ::utl::OEventListenerAdapter
104 enum ChildFocusState
106 PANELSWAP,
107 DETAIL,
108 NONE
110 private:
111 ::com::sun::star::lang::Locale m_aLocale;
112 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
113 m_xObject;
114 OAppBorderWindow* m_pWin;
115 IApplicationController& m_rAppController;
116 ChildFocusState m_eChildFocus;
118 IClipboardTest* getActiveChild() const;
120 void ImplInitSettings();
121 protected:
124 // return the Rectangle where I can paint myself
125 virtual void resizeDocumentView(Rectangle& rRect);
127 // OEventListenerAdapter
128 virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
130 // Window
131 virtual void DataChanged( const DataChangedEvent& rDCEvt );
132 public:
133 OApplicationView( Window* pParent
134 ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
135 ,IApplicationController& _rAppController
136 ,PreviewMode _ePreviewMode
138 virtual ~OApplicationView();
140 /// automatically creates mnemonics for the icon/texts in our left hand side panel
141 void createIconAutoMnemonics( MnemonicGenerator& _rMnemonics );
143 /// automatically creates mnemonics for the texts in our task pane
144 void setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics );
146 // window overloads
147 virtual long PreNotify( NotifyEvent& rNEvt );
148 virtual void GetFocus();
150 inline IApplicationController& getAppController() const { return m_rAppController; }
151 inline const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale;}
153 // IClipboardTest
154 virtual sal_Bool isCutAllowed();
155 virtual sal_Bool isCopyAllowed();
156 virtual sal_Bool isPasteAllowed();
157 virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
158 virtual void copy();
159 virtual void cut();
160 virtual void paste();
162 /// get the left panel
163 inline OApplicationSwapWindow* getPanel() const { return m_pWin->getPanel(); }
164 /// get the detail page
165 inline OApplicationDetailView* getDetailView() const { return m_pWin->getDetailView(); }
167 /** return the qualified name.
168 @param _pEntry
169 The entry of a table, or query, form, report to get the qualified name.
170 If the entry is <NULL/>, the first selected is chosen.
171 @return
172 the qualified name
174 ::rtl::OUString getQualifiedName( SvLBoxEntry* _pEntry ) const;
176 /** returns if an entry is a leaf
177 @param _pEntry
178 The entry to check
179 @return
180 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
182 sal_Bool isLeaf(SvLBoxEntry* _pEntry) const;
184 /** returns if one of the selected entries is a leaf
185 @return
186 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
188 sal_Bool isALeafSelected() const;
190 /** select all entries in the detail page
192 void selectAll();
194 /// returns <TRUE/> if it sorts ascending
195 sal_Bool isSortUp() const;
197 /// sort the entries in the detail page down
198 void sortDown();
200 /// sort the entries in the detail page up
201 void sortUp();
203 /// returns <TRUE/> when a detail page was filled
204 sal_Bool isFilled() const;
206 /// return the element of currently select entry
207 ElementType getElementType() const;
209 /// returns the count of entries
210 sal_Int32 getElementCount();
212 /// returns the count of selected entries
213 sal_Int32 getSelectionCount();
215 /** clears the detail page and the selection on the left side.
216 @param _bTaskAlso
217 If <TRUE/> the task window will also be cleared.
219 void clearPages(sal_Bool _bTaskAlso = sal_True);
221 /** returns the element names which are selected
222 @param _rNames
223 The list will be filled.
225 void getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const;
227 /** describes the current selection for the given control
229 void describeCurrentSelectionForControl(
230 const Control& _rControl,
231 ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
234 /** describes the current selection for the given ElementType
236 void describeCurrentSelectionForType(
237 const ElementType _eType,
238 ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
241 /** select all names on the currently selected container. Non existence names where ignored.
243 * \param _aNames the element names
245 void selectElements(const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _aNames);
247 /** adds a new object to the detail page.
248 @param _eType
249 The type where the entry shold be appended.
250 @param _rName
251 The name of the object to be inserted
252 @param _rObject
253 The object to add.
254 @param _rxConn
255 If we insert a table, the connection must be set.
257 SvLBoxEntry* elementAdded(ElementType _eType
258 ,const ::rtl::OUString& _rName
259 ,const ::com::sun::star::uno::Any& _rObject );
261 /** replaces a objects name with a new one
262 @param _eType
263 The type where the entry shold be appended.
264 @param _rOldName
265 The old name of the object to be replaced
266 @param _rNewName
267 The new name of the object to be replaced
268 @param _rxConn
269 If we insert a table, the connection must be set.
270 @param _xObject
271 The object which was replaced
273 void elementReplaced(ElementType eType
274 ,const ::rtl::OUString& _rOldName
275 ,const ::rtl::OUString& _rNewName );
277 /** removes an element from the detail page.
278 @param _eType
279 The type where the entry shold be appended.
280 @param _rName
281 The name of the element to be removed.
282 @param _rxConn
283 If we remove a table, the connection must be set.
285 void elementRemoved(ElementType _eType
286 ,const ::rtl::OUString& _rName );
289 /** changes the container which should be displayed. The select handler will also be called.
290 @param _eType
291 Which container to show.
293 void selectContainer(ElementType _eType);
295 /// returns the preview mode
296 PreviewMode getPreviewMode();
298 /// <TRUE/> if the preview is enabled
299 sal_Bool isPreviewEnabled();
301 /** switches to the given preview mode
302 @param _eMode
303 the mode to set for the preview
305 void switchPreview(PreviewMode _eMode);
307 /** shows the Preview of the content when it is enabled.
308 @param _xContent
309 The content which must support the "preview" command.
311 void showPreview(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xContent);
313 /** shows the Preview of a table or query
314 @param _sDataSourceName
315 the name of the data source
316 @param _xConnection
317 the connection which will be shared
318 @param _sName
319 the name of table or query
320 @param _bTable
321 <TRUE/> if it is a table, otherwise <FALSE/>
322 @return void
324 void showPreview( const ::rtl::OUString& _sDataSourceName,
325 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
326 const ::rtl::OUString& _sName,
327 sal_Bool _bTable);
329 SvLBoxEntry* getEntry( const Point& _aPosPixel ) const;
331 DECL_LINK( SwitchHdl, Accelerator* );
334 #endif // DBAUI_APPVIEW_HXX