bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / app / AppView.hxx
blob7c50466b5b33f5a27bde2e47e29d114eff8e7731
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_APPVIEW_HXX
20 #define DBAUI_APPVIEW_HXX
22 #include <dbaccess/dataview.hxx>
23 #include <com/sun/star/container/XNameAccess.hpp>
24 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
25 #include <com/sun/star/ucb/XContent.hpp>
26 #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
27 #include <vcl/fixed.hxx>
28 #include <unotools/eventlisteneradapter.hxx>
29 #include "IClipBoardTest.hxx"
30 #include "AppElementType.hxx"
32 namespace com{ namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
34 class Control;
35 class SvTreeListEntry;
36 class MnemonicGenerator;
38 namespace dbaui
40 class IApplicationController;
41 class OApplicationView;
42 class OApplicationDetailView;
43 class OApplicationSwapWindow;
44 class OTitleWindow;
45 //==================================================================
46 class OAppBorderWindow : public Window
48 OTitleWindow* m_pPanel;
49 OApplicationDetailView* m_pDetailView;
50 OApplicationView* m_pView;
52 void ImplInitSettings();
53 protected:
54 // Window
55 virtual void DataChanged( const DataChangedEvent& rDCEvt );
56 public:
57 OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode);
58 virtual ~OAppBorderWindow();
60 // window overloads
61 virtual void GetFocus();
62 virtual void Resize();
64 OApplicationView* getView() const;
65 OApplicationSwapWindow* getPanel() const;
66 OApplicationDetailView* getDetailView() const;
69 //==================================================================
70 class OApplicationView : public ODataView
71 ,public IClipboardTest
72 ,public ::utl::OEventListenerAdapter
74 enum ChildFocusState
76 PANELSWAP,
77 DETAIL,
78 NONE
80 private:
81 ::com::sun::star::lang::Locale m_aLocale;
82 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
83 m_xObject;
84 OAppBorderWindow* m_pWin;
85 IApplicationController& m_rAppController;
86 ChildFocusState m_eChildFocus;
88 IClipboardTest* getActiveChild() const;
90 void ImplInitSettings();
91 protected:
94 // return the Rectangle where I can paint myself
95 virtual void resizeDocumentView(Rectangle& rRect);
97 // OEventListenerAdapter
98 virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
100 // Window
101 virtual void DataChanged( const DataChangedEvent& rDCEvt );
102 public:
103 OApplicationView( Window* pParent
104 ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
105 ,IApplicationController& _rAppController
106 ,PreviewMode _ePreviewMode
108 virtual ~OApplicationView();
110 /// automatically creates mnemonics for the icon/texts in our left hand side panel
111 void createIconAutoMnemonics( MnemonicGenerator& _rMnemonics );
113 /// automatically creates mnemonics for the texts in our task pane
114 void setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics );
116 // window overloads
117 virtual long PreNotify( NotifyEvent& rNEvt );
118 virtual void GetFocus();
120 inline IApplicationController& getAppController() const { return m_rAppController; }
121 inline const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale;}
123 // IClipboardTest
124 virtual sal_Bool isCutAllowed();
125 virtual sal_Bool isCopyAllowed();
126 virtual sal_Bool isPasteAllowed();
127 virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
128 virtual void copy();
129 virtual void cut();
130 virtual void paste();
132 /// get the left panel
133 inline OApplicationSwapWindow* getPanel() const { return m_pWin->getPanel(); }
134 /// get the detail page
135 inline OApplicationDetailView* getDetailView() const { return m_pWin->getDetailView(); }
137 /** return the qualified name.
138 @param _pEntry
139 The entry of a table, or query, form, report to get the qualified name.
140 If the entry is <NULL/>, the first selected is chosen.
141 @return
142 the qualified name
144 OUString getQualifiedName( SvTreeListEntry* _pEntry ) const;
146 /** returns if an entry is a leaf
147 @param _pEntry
148 The entry to check
149 @return
150 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
152 sal_Bool isLeaf(SvTreeListEntry* _pEntry) const;
154 /** returns if one of the selected entries is a leaf
155 @return
156 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
158 sal_Bool isALeafSelected() const;
160 /** select all entries in the detail page
162 void selectAll();
164 /// returns <TRUE/> if it sorts ascending
165 sal_Bool isSortUp() const;
167 /// sort the entries in the detail page down
168 void sortDown();
170 /// sort the entries in the detail page up
171 void sortUp();
173 /// returns <TRUE/> when a detail page was filled
174 sal_Bool isFilled() const;
176 /// return the element of currently select entry
177 ElementType getElementType() const;
179 /// returns the count of entries
180 sal_Int32 getElementCount();
182 /// returns the count of selected entries
183 sal_Int32 getSelectionCount();
185 /** clears the detail page and the selection on the left side.
186 @param _bTaskAlso
187 If <TRUE/> the task window will also be cleared.
189 void clearPages(sal_Bool _bTaskAlso = sal_True);
191 /** returns the element names which are selected
192 @param _rNames
193 The list will be filled.
195 void getSelectionElementNames( ::std::vector< OUString>& _rNames ) const;
197 /** describes the current selection for the given control
199 void describeCurrentSelectionForControl(
200 const Control& _rControl,
201 ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
204 /** describes the current selection for the given ElementType
206 void describeCurrentSelectionForType(
207 const ElementType _eType,
208 ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
211 /** select all names on the currently selected container. Non existence names where ignored.
213 * \param _aNames the element names
215 void selectElements(const ::com::sun::star::uno::Sequence< OUString>& _aNames);
217 /** adds a new object to the detail page.
218 @param _eType
219 The type where the entry shold be appended.
220 @param _rName
221 The name of the object to be inserted
222 @param _rObject
223 The object to add.
224 @param _rxConn
225 If we insert a table, the connection must be set.
227 SvTreeListEntry* elementAdded(ElementType _eType
228 ,const OUString& _rName
229 ,const ::com::sun::star::uno::Any& _rObject );
231 /** replaces a objects name with a new one
232 @param _eType
233 The type where the entry shold be appended.
234 @param _rOldName
235 The old name of the object to be replaced
236 @param _rNewName
237 The new name of the object to be replaced
238 @param _rxConn
239 If we insert a table, the connection must be set.
240 @param _xObject
241 The object which was replaced
243 void elementReplaced(ElementType eType
244 ,const OUString& _rOldName
245 ,const OUString& _rNewName );
247 /** removes an element from the detail page.
248 @param _eType
249 The type where the entry shold be appended.
250 @param _rName
251 The name of the element to be removed.
252 @param _rxConn
253 If we remove a table, the connection must be set.
255 void elementRemoved(ElementType _eType
256 ,const OUString& _rName );
259 /** changes the container which should be displayed. The select handler will also be called.
260 @param _eType
261 Which container to show.
263 void selectContainer(ElementType _eType);
265 /// returns the preview mode
266 PreviewMode getPreviewMode();
268 /// <TRUE/> if the preview is enabled
269 sal_Bool isPreviewEnabled();
271 /** switches to the given preview mode
272 @param _eMode
273 the mode to set for the preview
275 void switchPreview(PreviewMode _eMode);
277 /** shows the Preview of the content when it is enabled.
278 @param _xContent
279 The content which must support the "preview" command.
281 void showPreview(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xContent);
283 /** shows the Preview of a table or query
284 @param _sDataSourceName
285 the name of the data source
286 @param _xConnection
287 the connection which will be shared
288 @param _sName
289 the name of table or query
290 @param _bTable
291 <TRUE/> if it is a table, otherwise <FALSE/>
292 @return void
294 void showPreview( const OUString& _sDataSourceName,
295 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
296 const OUString& _sName,
297 sal_Bool _bTable);
299 SvTreeListEntry* getEntry( const Point& _aPosPixel ) const;
302 #endif // DBAUI_APPVIEW_HXX
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */