Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_UNODATBR_HXX
21 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_UNODATBR_HXX
22 :
23 : #include "brwctrlr.hxx"
24 : #include <com/sun/star/sdbc/XConnection.hpp>
25 : #include <com/sun/star/frame/XStatusListener.hpp>
26 : #include <com/sun/star/frame/XDispatch.hpp>
27 : #include <com/sun/star/container/XContainerListener.hpp>
28 : #include <com/sun/star/i18n/XCollator.hpp>
29 : #include <com/sun/star/view/XSelectionSupplier.hpp>
30 : #include <com/sun/star/awt/XWindow.hpp>
31 : #include <com/sun/star/document/XScriptInvocationContext.hpp>
32 : #include <com/sun/star/ui/XContextMenuInterception.hpp>
33 : #include <com/sun/star/sdb/application/DatabaseObject.hpp>
34 : #include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
35 : #include <com/sun/star/sdb/XDatabaseRegistrationsListener.hpp>
36 : #include <cppuhelper/implbase5.hxx>
37 : #include "callbacks.hxx"
38 : #include <vcl/timer.hxx>
39 : #include <svtools/transfer.hxx>
40 : #include <svx/dataaccessdescriptor.hxx>
41 : #include <sot/storage.hxx>
42 : #include "TableCopyHelper.hxx"
43 : #include "commontypes.hxx"
44 :
45 : class SvTreeListEntry;
46 : class Splitter;
47 : struct SvSortData;
48 :
49 : namespace com { namespace sun{ namespace star { namespace container { class XNameContainer; } } } }
50 :
51 : class SvTreeList;
52 : namespace dbaui
53 : {
54 :
55 : class DBTreeView;
56 : struct DBTreeEditedEntry;
57 : class ImageProvider;
58 :
59 : typedef ::cppu::ImplHelper5 < ::com::sun::star::frame::XStatusListener
60 : , ::com::sun::star::view::XSelectionSupplier
61 : , ::com::sun::star::document::XScriptInvocationContext
62 : , ::com::sun::star::ui::XContextMenuInterception
63 : , ::com::sun::star::sdb::XDatabaseRegistrationsListener
64 : > SbaTableQueryBrowser_Base;
65 : class SbaTableQueryBrowser
66 : :public SbaXDataBrowserController
67 : ,public SbaTableQueryBrowser_Base
68 : ,public IControlActionListener
69 : ,public IContextMenuProvider
70 : {
71 : protected:
72 :
73 : ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_xCollator;
74 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xCurrentFrameParent;
75 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xMainToolbar;
76 :
77 0 : struct ExternalFeature
78 : {
79 : ::com::sun::star::util::URL aURL;
80 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
81 : xDispatcher;
82 : sal_Bool bEnabled;
83 :
84 0 : ExternalFeature() : bEnabled( sal_False ) { }
85 0 : ExternalFeature( const ::com::sun::star::util::URL& _rURL ) : aURL( _rURL ), bEnabled( sal_False ) { }
86 : };
87 :
88 : typedef ::std::map< sal_uInt16, ExternalFeature, ::std::less< sal_uInt16 > > ExternalFeaturesMap;
89 : ExternalFeaturesMap m_aExternalFeatures;
90 :
91 : ::svx::ODataAccessDescriptor m_aDocumentDataSource;
92 : // if we're part of a document, this is the state of the DocumentDataSource slot
93 :
94 : ::cppu::OInterfaceContainerHelper m_aSelectionListeners;
95 : ::cppu::OInterfaceContainerHelper m_aContextMenuInterceptors;
96 :
97 : OTableCopyHelper::DropDescriptor m_aAsyncDrop;
98 : OTableCopyHelper m_aTableCopyHelper;
99 :
100 : OUString m_sQueryCommand; // the command of the query currently loaded (if any)
101 : //OUString m_sToBeLoaded; // contains the element name which should be loaded if any
102 :
103 : DBTreeView* m_pTreeView;
104 : Splitter* m_pSplitter;
105 : SvTreeList* m_pTreeModel; // contains the datasources of the registry
106 : SvTreeListEntry* m_pCurrentlyDisplayed;
107 : sal_uLong m_nAsyncDrop;
108 :
109 : sal_Int16 m_nBorder; // sal_True when border should be shown
110 :
111 : sal_Bool m_bQueryEscapeProcessing : 1; // the escape processing flag of the query currently loaded (if any)
112 : sal_Bool m_bShowMenu; // if sal_True the menu should be visible otherwise not
113 : sal_Bool m_bInSuspend;
114 : sal_Bool m_bEnableBrowser;
115 : ::boost::optional< bool >
116 : m_aDocScriptSupport; // relevant if and only if we are associated with exactly one DBDoc
117 :
118 : virtual OUString getPrivateTitle( ) const SAL_OVERRIDE;
119 : // attribute access
120 : public:
121 : SbaTableQueryBrowser(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM);
122 : virtual ~SbaTableQueryBrowser();
123 :
124 : enum EntryType
125 : {
126 : // don't change the above definitions! There are places (in particular SbaTableQueryBrowser::getCurrentSelection)
127 : // which rely on the fact that the EntryType values really equal the DatabaseObject(Container) values!
128 : etDatasource = ::com::sun::star::sdb::application::DatabaseObjectContainer::DATA_SOURCE,
129 : etQueryContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer::QUERIES,
130 : etTableContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer::TABLES,
131 : etQuery = ::com::sun::star::sdb::application::DatabaseObject::QUERY,
132 : etTableOrView = ::com::sun::star::sdb::application::DatabaseObject::TABLE,
133 : etUnknown = -1
134 : };
135 :
136 : /** returns a DatabaseObject value corresponding to the given EntryType
137 : @param _eType
138 : the entry type. Must not be etUnknown.
139 : */
140 : static sal_Int32 getDatabaseObjectType( EntryType _eType );
141 :
142 : // need by registration
143 : static OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
144 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
145 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
146 : SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
147 :
148 0 : DECLARE_UNO3_DEFAULTS(SbaTableQueryBrowser,SbaXDataBrowserController)
149 : // late construction
150 : virtual bool Construct(Window* pParent) SAL_OVERRIDE;
151 : // XInterface
152 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
153 :
154 : // XTypeProvider
155 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
157 :
158 : // ::com::sun::star::beans::XPropertyChangeListener
159 : virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
160 :
161 : // ::com::sun::star::frame::XController
162 : virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
163 : virtual void SAL_CALL attachFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
164 :
165 : // ::com::sun::star::lang::XComponent
166 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
167 :
168 : // XStatusListener
169 : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
170 :
171 : // XEventListener
172 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
173 :
174 : // XSelectionSupplier
175 : virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& aSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 : virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
177 : virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
178 : virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 :
180 : // XServiceInfo
181 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 : virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
183 :
184 : // XContainerListener
185 : virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
186 : virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
187 : virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
188 : // ::com::sun::star::frame::XFrameActionListener
189 : virtual void SAL_CALL frameAction(const ::com::sun::star::frame::FrameActionEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
190 :
191 : //IController
192 : virtual void notifyHiContrastChanged() SAL_OVERRIDE;
193 :
194 : // XScriptInvocationContext
195 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > SAL_CALL getScriptContainer() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
196 :
197 : // XContextMenuInterception
198 : virtual void SAL_CALL registerContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
199 : virtual void SAL_CALL releaseContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
200 :
201 : // XDatabaseRegistrationsListener
202 : virtual void SAL_CALL registeredDatabaseLocation( const ::com::sun::star::sdb::DatabaseRegistrationEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
203 : virtual void SAL_CALL revokedDatabaseLocation( const ::com::sun::star::sdb::DatabaseRegistrationEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
204 : virtual void SAL_CALL changedDatabaseLocation( const ::com::sun::star::sdb::DatabaseRegistrationEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
205 :
206 : protected:
207 : // SbaXDataBrowserController overridables
208 : virtual sal_Bool InitializeForm( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_formProperties ) SAL_OVERRIDE;
209 : virtual sal_Bool InitializeGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid) SAL_OVERRIDE;
210 :
211 : virtual sal_Bool preReloadForm() SAL_OVERRIDE;
212 : virtual void postReloadForm() SAL_OVERRIDE;
213 :
214 : virtual void addModelListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel) SAL_OVERRIDE;
215 : virtual void removeModelListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel) SAL_OVERRIDE;
216 :
217 : virtual void AddColumnListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xCol) SAL_OVERRIDE;
218 : virtual void RemoveColumnListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xCol) SAL_OVERRIDE;
219 :
220 : virtual void LoadFinished(sal_Bool _bWasSynch) SAL_OVERRIDE;
221 :
222 : virtual void criticalFail() SAL_OVERRIDE;
223 :
224 : virtual void describeSupportedFeatures() SAL_OVERRIDE;
225 : virtual FeatureState GetState(sal_uInt16 nId) const SAL_OVERRIDE;
226 : virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) SAL_OVERRIDE;
227 :
228 : // IControlActionListener overridables
229 : virtual sal_Bool requestQuickHelp( const SvTreeListEntry* _pEntry, OUString& _rText ) const SAL_OVERRIDE;
230 : virtual sal_Bool requestDrag( sal_Int8 _nAction, const Point& _rPosPixel ) SAL_OVERRIDE;
231 : virtual sal_Int8 queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors ) SAL_OVERRIDE;
232 : virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) SAL_OVERRIDE;
233 :
234 : // IContextMenuProvider
235 : virtual PopupMenu* getContextMenu( Control& _rControl ) const SAL_OVERRIDE;
236 : virtual IController& getCommandController() SAL_OVERRIDE;
237 : virtual ::cppu::OInterfaceContainerHelper*
238 : getContextMenuInterceptors() SAL_OVERRIDE;
239 : virtual ::com::sun::star::uno::Any
240 : getCurrentSelection( Control& _rControl ) const SAL_OVERRIDE;
241 :
242 : virtual void impl_initialize() SAL_OVERRIDE;
243 :
244 : // SbaGridListener overridables
245 : virtual void RowChanged() SAL_OVERRIDE;
246 : virtual void ColumnChanged() SAL_OVERRIDE;
247 : virtual void SelectionChanged() SAL_OVERRIDE;
248 :
249 : // methods for showing/hiding the explorer part
250 : sal_Bool haveExplorer() const;
251 : void hideExplorer();
252 : void showExplorer();
253 0 : void toggleExplorer() { if (haveExplorer()) hideExplorer(); else showExplorer(); }
254 :
255 : // methods for handling the 'selection' (paintin them bold) of SvLBoxEntries
256 : // returns <TRUE/> if the entry is selected (which means it's part of the selected path)
257 : sal_Bool isSelected(SvTreeListEntry* _pEntry) const;
258 : // select the entry (and only the entry, not the whole path)
259 : void select(SvTreeListEntry* _pEntry, sal_Bool _bSelect = sal_True);
260 : // select the path of the entry (which must be an entry without children)
261 : void selectPath(SvTreeListEntry* _pEntry, sal_Bool _bSelect = sal_True);
262 :
263 : virtual void loadMenu(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame) SAL_OVERRIDE;
264 :
265 : private:
266 : // check the state of the external slot given, update any UI elements if necessary
267 : void implCheckExternalSlot( sal_uInt16 _nId );
268 :
269 : // connect to the external dispatchers (if any)
270 : void connectExternalDispatches();
271 :
272 : /** get the state of an external slot
273 : <p>The slot is available if an external dispatcher is responsible for it, _and_ if this dispatcher
274 : told us the slot is available.</p>
275 : */
276 : sal_Bool getExternalSlotState( sal_uInt16 _nId ) const;
277 :
278 : /** add an entry (including the subentries for queries/tables) to the list model
279 :
280 : <p>The given names and images may be empty, in this case they're filled with the correct
281 : values. This way they may be reused for the next call, which saves some resource manager calls.</p>
282 : */
283 : void implAddDatasource(const OUString& _rDbName, Image& _rDbImage,
284 : OUString& _rQueryName, Image& _rQueryImage,
285 : OUString& _rTableName, Image& _rTableImage,
286 : const SharedConnection& _rxConnection
287 : );
288 :
289 : void implAddDatasource( const OUString& _rDataSourceName, const SharedConnection& _rxConnection );
290 :
291 : /// removes (and cleans up) the entry for the given data source
292 : void impl_cleanupDataSourceEntry( const OUString& _rDataSourceName );
293 :
294 : /// clears the tree list box
295 : void clearTreeModel();
296 :
297 : /** unloads the form, empties the grid model, cleans up anything related to the currently displayed object
298 : @param _bDisposeConnection
299 : <TRUE/> if the connection should be disposed
300 : @param _bFlushData
301 : <TRUE/> if the currently displayed object (if any) should be flushed
302 : */
303 : void unloadAndCleanup( sal_Bool _bDisposeConnection = sal_True );
304 :
305 : // disposes the connection associated with the given entry (which must represent a data source)
306 : void disposeConnection( SvTreeListEntry* _pDSEntry );
307 :
308 : /// flushs and disposes the given connection, and de-registers as listener
309 : void impl_releaseConnection( SharedConnection& _rxConnection );
310 :
311 : /** close the connection (and collapse the list entries) of the given list entries
312 : */
313 : void closeConnection(SvTreeListEntry* _pEntry,sal_Bool _bDisposeConnection = sal_True);
314 :
315 : void populateTree(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xNameAccess, SvTreeListEntry* _pParent, EntryType _eEntryType);
316 : void initializeTreeModel();
317 :
318 : /** search in the tree for query- or tablecontainer equal to this interface and return
319 : this container entry
320 : */
321 : SvTreeListEntry* getEntryFromContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _rxNameAccess);
322 : // return true when there is connection available
323 : sal_Bool ensureConnection(SvTreeListEntry* _pDSEntry, void * pDSData, SharedConnection& _rConnection );
324 : sal_Bool ensureConnection(SvTreeListEntry* _pAnyEntry, SharedConnection& _rConnection );
325 :
326 : sal_Bool getExistentConnectionFor( SvTreeListEntry* _pDSEntry, SharedConnection& _rConnection );
327 : /** returns an image provider which works with the connection belonging to the given entry
328 : */
329 : ::std::auto_ptr< ImageProvider >
330 : getImageProviderFor( SvTreeListEntry* _pAnyEntry );
331 :
332 : void implAdministrate( SvTreeListEntry* _pApplyTo );
333 :
334 : TransferableHelper*
335 : implCopyObject( SvTreeListEntry* _pApplyTo, sal_Int32 _nCommandType, sal_Bool _bAllowConnection = sal_True );
336 :
337 : EntryType getEntryType( const SvTreeListEntry* _pEntry ) const;
338 : EntryType getChildType( SvTreeListEntry* _pEntry ) const;
339 0 : sal_Bool isObject( EntryType _eType ) const { return ( etTableOrView== _eType ) || ( etQuery == _eType ); }
340 0 : sal_Bool isContainer( EntryType _eType ) const { return (etTableContainer == _eType) || (etQueryContainer == _eType); }
341 0 : bool isContainer( const SvTreeListEntry* _pEntry ) const { return isContainer( getEntryType( _pEntry ) ); }
342 :
343 : // ensure that the xObject for the given entry is set on the user data
344 : sal_Bool ensureEntryObject( SvTreeListEntry* _pEntry );
345 :
346 : // get the display text of the entry given
347 : OUString GetEntryText( SvTreeListEntry* _pEntry ) const;
348 :
349 : // is called when a table or a query was selected
350 : DECL_LINK( OnSelectionChange, void* );
351 : DECL_LINK( OnExpandEntry, SvTreeListEntry* );
352 :
353 : DECL_LINK( OnCopyEntry, void* );
354 :
355 : DECL_LINK( OnTreeEntryCompare, const SvSortData* );
356 :
357 : DECL_LINK( OnAsyncDrop, void* );
358 :
359 : void implRemoveStatusListeners();
360 :
361 : sal_Bool implSelect(const ::svx::ODataAccessDescriptor& _rDescriptor,sal_Bool _bSelectDirect = sal_False);
362 : bool implSelect( SvTreeListEntry* _pEntry );
363 :
364 : /// selects the entry given and loads the grid control with the object's data
365 : sal_Bool implSelect(
366 : const OUString& _rDataSourceName,
367 : const OUString& _rCommand,
368 : const sal_Int32 _nCommandType,
369 : const sal_Bool _bEscapeProcessing,
370 : const SharedConnection& _rxConnection,
371 : sal_Bool _bSelectDirect = sal_False
372 : );
373 :
374 : SvTreeListEntry* implGetConnectionEntry(SvTreeListEntry* _pEntry) const;
375 : /// inserts an entry into the tree
376 : SvTreeListEntry* implAppendEntry(
377 : SvTreeListEntry* _pParent,
378 : const OUString& _rName,
379 : void* _pUserData,
380 : EntryType _eEntryType
381 : );
382 :
383 : /// loads the grid control with the data object specified (which may be a table, a query or a command)
384 : sal_Bool implLoadAnything(const OUString& _rDataSourceName, const OUString& _rCommand,
385 : const sal_Int32 _nCommandType, const sal_Bool _bEscapeProcessing, const SharedConnection& _rxConnection = SharedConnection() );
386 :
387 : /** retrieves the tree entry for the object described by <arg>_rDescriptor</arg>
388 : @param _rDescriptor
389 : the object descriptor
390 : @param _ppDataSourceEntry
391 : If not <NULL/>, the data source tree entry will be returned here
392 : @param _ppContainerEntry
393 : If not <NULL/>, the object container tree entry will be returned here
394 : @param _bExpandAncestors
395 : If <TRUE/>, all ancestor on the way to the entry will be expanded
396 : */
397 : SvTreeListEntry* getObjectEntry(const ::svx::ODataAccessDescriptor& _rDescriptor,
398 : SvTreeListEntry** _ppDataSourceEntry = NULL, SvTreeListEntry** _ppContainerEntry = NULL,
399 : sal_Bool _bExpandAncestors = sal_True
400 : );
401 : /** retrieves the tree entry for the object described by data source name, command and command type
402 : @param _rDataSource
403 : the data source name
404 : @param _rCommand
405 : the command
406 : @param _nCommandType
407 : the command type
408 : @param _rDescriptor
409 : the object descriptor
410 : @param _ppDataSourceEntry
411 : If not <NULL/>, the data source tree entry will be returned here
412 : @param _ppContainerEntry
413 : If not <NULL/>, the object container tree entry will be returned here
414 : @param _bExpandAncestors
415 : If <TRUE/>, all ancestor on the way to the entry will be expanded
416 : */
417 : SvTreeListEntry* getObjectEntry(
418 : const OUString& _rDataSource, const OUString& _rCommand, sal_Int32 _nCommandType,
419 : SvTreeListEntry** _ppDataSourceEntry = NULL, SvTreeListEntry** _ppContainerEntry = NULL,
420 : sal_Bool _bExpandAncestors = sal_True,
421 : const SharedConnection& _rxConnection = SharedConnection()
422 : );
423 :
424 : /// checks if m_aDocumentDataSource describes a known object
425 : void checkDocumentDataSource();
426 :
427 : void extractDescriptorProps(const ::svx::ODataAccessDescriptor& _rDescriptor,
428 : OUString& _rDataSource, OUString& _rCommand, sal_Int32& _rCommandType, sal_Bool& _rEscapeProcessing);
429 :
430 : void transferChangedControlProperty(const OUString& _rProperty, const ::com::sun::star::uno::Any& _rNewValue);
431 :
432 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > connectWithStatus(
433 : const OUString& _rDataSourceName,
434 : void* _pTreeListUserData // in rela a DBTreeListUserData*, but we do not know this class here ....
435 : );
436 :
437 : #if OSL_DEBUG_LEVEL > 0
438 : // checks whether the given tree entry denotes a data source
439 : bool impl_isDataSourceEntry( SvTreeListEntry* _pEntry ) const;
440 : #endif
441 :
442 : /// retrieves the data source URL/name for the given entry representing a data source
443 : OUString getDataSourceAcessor( SvTreeListEntry* _pDataSourceEntry ) const;
444 :
445 : /** get the signature (command/escape processing) of the query the form is based on
446 : <p>If the for is not based on a query or not even loaded, nothing happens and <FALSE/> is returned.</p>
447 : */
448 : sal_Bool implGetQuerySignature( OUString& _rCommand, sal_Bool& _bEscapeProcessing );
449 :
450 : sal_Bool isEntryCopyAllowed(SvTreeListEntry* _pEntry) const;
451 :
452 : void copyEntry(SvTreeListEntry* _pEntry);
453 :
454 : // remove all grid columns and dispose them
455 : void clearGridColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _xColContainer);
456 :
457 : /** checks if the currently displayed entry changed
458 : @param _sName
459 : Name of the changed entry
460 : @param _pContainer
461 : The container of the displayed entry
462 : @return
463 : <TRUE/> if it is the currently displayed otherwise <FALSE/>
464 : */
465 : sal_Bool isCurrentlyDisplayedChanged(const OUString& _sName,SvTreeListEntry* _pContainer);
466 :
467 : /** called whenever the content of the browser is used for preview, as the very last action
468 : of the load process
469 : */
470 : void initializePreviewMode();
471 :
472 : /** checks whether the Order/Filter clauses set at our row set are valid, removes them if not so
473 : */
474 : void impl_sanitizeRowSetClauses_nothrow();
475 : };
476 :
477 : } // namespace dbaui
478 :
479 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_UNODATBR_HXX
480 :
481 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|