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