Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / dbaccess / source / ui / app / AppView.hxx
blob23c450161d220af9db3715816dd831f97790e88c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef DBAUI_APPVIEW_HXX
29 #define DBAUI_APPVIEW_HXX
31 #include "dataview.hxx"
32 #include <com/sun/star/container/XNameAccess.hpp>
33 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
34 #include <com/sun/star/ucb/XContent.hpp>
35 #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
36 #include <vcl/fixed.hxx>
37 #include <unotools/eventlisteneradapter.hxx>
38 #include "IClipBoardTest.hxx"
39 #include "AppElementType.hxx"
41 namespace com{ namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
43 class Control;
44 class SvLBoxEntry;
45 class MnemonicGenerator;
47 namespace dbaui
49 class IControlActionListener;
50 class IApplicationController;
51 class OApplicationView;
52 class OApplicationDetailView;
53 class OApplicationSwapWindow;
54 class OTitleWindow;
55 //==================================================================
56 class OAppBorderWindow : public Window
58 OTitleWindow* m_pPanel;
59 OApplicationDetailView* m_pDetailView;
60 OApplicationView* m_pView;
62 void ImplInitSettings();
63 protected:
64 // Window
65 virtual void DataChanged( const DataChangedEvent& rDCEvt );
66 public:
67 OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode);
68 virtual ~OAppBorderWindow();
70 // window overloads
71 virtual void GetFocus();
72 virtual void Resize();
74 OApplicationView* getView() const;
75 OApplicationSwapWindow* getPanel() const;
76 OApplicationDetailView* getDetailView() const;
79 //==================================================================
80 class OApplicationView : public ODataView
81 ,public IClipboardTest
82 ,public ::utl::OEventListenerAdapter
84 enum ChildFocusState
86 PANELSWAP,
87 DETAIL,
88 NONE
90 private:
91 ::com::sun::star::lang::Locale m_aLocale;
92 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
93 m_xObject;
94 OAppBorderWindow* m_pWin;
95 IApplicationController& m_rAppController;
96 ChildFocusState m_eChildFocus;
98 IClipboardTest* getActiveChild() const;
100 void ImplInitSettings();
101 protected:
104 // return the Rectangle where I can paint myself
105 virtual void resizeDocumentView(Rectangle& rRect);
107 // OEventListenerAdapter
108 virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
110 // Window
111 virtual void DataChanged( const DataChangedEvent& rDCEvt );
112 public:
113 OApplicationView( Window* pParent
114 ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
115 ,IApplicationController& _rAppController
116 ,PreviewMode _ePreviewMode
118 virtual ~OApplicationView();
120 /// automatically creates mnemonics for the icon/texts in our left hand side panel
121 void createIconAutoMnemonics( MnemonicGenerator& _rMnemonics );
123 /// automatically creates mnemonics for the texts in our task pane
124 void setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics );
126 // window overloads
127 virtual long PreNotify( NotifyEvent& rNEvt );
128 virtual void GetFocus();
130 inline IApplicationController& getAppController() const { return m_rAppController; }
131 inline const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale;}
133 // IClipboardTest
134 virtual sal_Bool isCutAllowed();
135 virtual sal_Bool isCopyAllowed();
136 virtual sal_Bool isPasteAllowed();
137 virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
138 virtual void copy();
139 virtual void cut();
140 virtual void paste();
142 /// get the left panel
143 inline OApplicationSwapWindow* getPanel() const { return m_pWin->getPanel(); }
144 /// get the detail page
145 inline OApplicationDetailView* getDetailView() const { return m_pWin->getDetailView(); }
147 /** return the qualified name.
148 @param _pEntry
149 The entry of a table, or query, form, report to get the qualified name.
150 If the entry is <NULL/>, the first selected is chosen.
151 @return
152 the qualified name
154 ::rtl::OUString getQualifiedName( SvLBoxEntry* _pEntry ) const;
156 /** returns if an entry is a leaf
157 @param _pEntry
158 The entry to check
159 @return
160 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
162 sal_Bool isLeaf(SvLBoxEntry* _pEntry) const;
164 /** returns if one of the selected entries is a leaf
165 @return
166 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
168 sal_Bool isALeafSelected() const;
170 /** select all entries in the detail page
172 void selectAll();
174 /// returns <TRUE/> if it sorts ascending
175 sal_Bool isSortUp() const;
177 /// sort the entries in the detail page down
178 void sortDown();
180 /// sort the entries in the detail page up
181 void sortUp();
183 /// returns <TRUE/> when a detail page was filled
184 sal_Bool isFilled() const;
186 /// return the element of currently select entry
187 ElementType getElementType() const;
189 /// returns the count of entries
190 sal_Int32 getElementCount();
192 /// returns the count of selected entries
193 sal_Int32 getSelectionCount();
195 /** clears the detail page and the selection on the left side.
196 @param _bTaskAlso
197 If <TRUE/> the task window will also be cleared.
199 void clearPages(sal_Bool _bTaskAlso = sal_True);
201 /** returns the element names which are selected
202 @param _rNames
203 The list will be filled.
205 void getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const;
207 /** describes the current selection for the given control
209 void describeCurrentSelectionForControl(
210 const Control& _rControl,
211 ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
214 /** describes the current selection for the given ElementType
216 void describeCurrentSelectionForType(
217 const ElementType _eType,
218 ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
221 /** select all names on the currently selected container. Non existence names where ignored.
223 * \param _aNames the element names
225 void selectElements(const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _aNames);
227 /** adds a new object to the detail page.
228 @param _eType
229 The type where the entry shold be appended.
230 @param _rName
231 The name of the object to be inserted
232 @param _rObject
233 The object to add.
234 @param _rxConn
235 If we insert a table, the connection must be set.
237 SvLBoxEntry* elementAdded(ElementType _eType
238 ,const ::rtl::OUString& _rName
239 ,const ::com::sun::star::uno::Any& _rObject );
241 /** replaces a objects name with a new one
242 @param _eType
243 The type where the entry shold be appended.
244 @param _rOldName
245 The old name of the object to be replaced
246 @param _rNewName
247 The new name of the object to be replaced
248 @param _rxConn
249 If we insert a table, the connection must be set.
250 @param _xObject
251 The object which was replaced
253 void elementReplaced(ElementType eType
254 ,const ::rtl::OUString& _rOldName
255 ,const ::rtl::OUString& _rNewName );
257 /** removes an element from the detail page.
258 @param _eType
259 The type where the entry shold be appended.
260 @param _rName
261 The name of the element to be removed.
262 @param _rxConn
263 If we remove a table, the connection must be set.
265 void elementRemoved(ElementType _eType
266 ,const ::rtl::OUString& _rName );
269 /** changes the container which should be displayed. The select handler will also be called.
270 @param _eType
271 Which container to show.
273 void selectContainer(ElementType _eType);
275 /// returns the preview mode
276 PreviewMode getPreviewMode();
278 /// <TRUE/> if the preview is enabled
279 sal_Bool isPreviewEnabled();
281 /** switches to the given preview mode
282 @param _eMode
283 the mode to set for the preview
285 void switchPreview(PreviewMode _eMode);
287 /** shows the Preview of the content when it is enabled.
288 @param _xContent
289 The content which must support the "preview" command.
291 void showPreview(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xContent);
293 /** shows the Preview of a table or query
294 @param _sDataSourceName
295 the name of the data source
296 @param _xConnection
297 the connection which will be shared
298 @param _sName
299 the name of table or query
300 @param _bTable
301 <TRUE/> if it is a table, otherwise <FALSE/>
302 @return void
304 void showPreview( const ::rtl::OUString& _sDataSourceName,
305 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
306 const ::rtl::OUString& _sName,
307 sal_Bool _bTable);
309 SvLBoxEntry* getEntry( const Point& _aPosPixel ) const;
312 #endif // DBAUI_APPVIEW_HXX
314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */