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