1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: databaseobjectview.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef DBACCESS_DATABASE_OBJECT_VIEW_HXX
32 #define DBACCESS_DATABASE_OBJECT_VIEW_HXX
34 #ifndef _RTL_USTRING_HXX_
35 #include <rtl/ustring.hxx>
37 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
38 #include <com/sun/star/sdbc/XConnection.hpp>
40 #ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
41 #include <com/sun/star/sdbc/XDataSource.hpp>
43 #ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
44 #include <com/sun/star/frame/XDispatch.hpp>
46 #ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
47 #include <com/sun/star/lang/XComponent.hpp>
49 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
52 #ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
53 #include <com/sun/star/frame/XComponentLoader.hpp>
55 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
56 #include <com/sun/star/frame/XFrame.hpp>
58 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
59 #include <com/sun/star/beans/PropertyValue.hpp>
61 #ifndef _COM_SUN_STAR_UI_DIALOGS_XEXECUTABLEDIALOG_HPP_
62 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
64 #ifndef _COM_SUN_STAR_SDB_APPLICATION_XDATABASEDOCUMENTUI_HPP_
65 #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
67 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
68 #include <com/sun/star/uno/Sequence.hxx>
71 #include <boost/shared_ptr.hpp>
74 // .........................................................................
77 // .........................................................................
78 /** encapsulates access to the view of a database object.
81 this is to be merged with the OLinkedDocumentAccess class
83 class DatabaseObjectView
86 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
88 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>
90 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XComponentLoader
>
92 ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>
94 ::rtl::OUString m_sComponentURL
;
97 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
99 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rDispatchArguments
103 /** creates the desired view
105 The default implementation will call <member>fillDispatchArgs</member>, followed
106 by <member>doDispatch</member>.
109 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
111 the name of the object for which the view is to be opened,
112 or an empty string if a view for a new object should be created.
113 @param _rCreationArgs
114 the arguments for the view's creation
116 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> doCreateView(
117 const ::com::sun::star::uno::Any
& _rDataSource
,
118 const ::rtl::OUString
& _rObjectName
,
119 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rCreationArgs
122 virtual void fillDispatchArgs(
123 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rDispatchArguments
,
124 const ::com::sun::star::uno::Any
& _rDataSource
,
125 const ::rtl::OUString
& _rObjectName
128 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>&
129 getApplicationUI() const { return m_xApplication
; }
130 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>
131 getConnection() const;
135 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
136 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
137 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
,
138 const ::rtl::OUString
& _rComponentURL
140 virtual ~DatabaseObjectView(){}
142 /** sets the target frame into which the view should be loaded.
144 By default, the view is loaded into a top-level frame not being part of the
147 void setTargetFrame( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxFrame
)
149 m_xFrameLoader
.set( _rxFrame
, ::com::sun::star::uno::UNO_QUERY
);
152 /** opens a view for a to-be-created object
155 the data source for which a new object is to be created
157 the controller of the newly created document
159 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
161 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
>& _xDataSource
164 /** opens a view for an existent object
167 the data source for which a new object is to be created
169 the name of the object to be edited
171 Additional settings which should be forwarded to the frame
173 the frame into which the view has been loaded
175 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
177 const ::com::sun::star::uno::Any
& _aDataSource
,
178 const ::rtl::OUString
& _rName
,
179 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rArgs
183 //======================================================================
185 //======================================================================
186 class QueryDesigner
: public DatabaseObjectView
189 sal_Int32 m_nCommandType
;
190 sal_Bool m_bPreferSQLView
;
193 virtual void fillDispatchArgs(
194 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rDispatchArguments
,
195 const ::com::sun::star::uno::Any
& _aDataSource
,
196 const ::rtl::OUString
& _rObjectName
201 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
202 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
203 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
,
205 sal_Bool _bPreferSQLView
209 //======================================================================
211 //======================================================================
212 class TableDesigner
: public DatabaseObjectView
215 virtual void fillDispatchArgs(
216 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rDispatchArguments
,
217 const ::com::sun::star::uno::Any
& _aDataSource
,
218 const ::rtl::OUString
& _rObjectName
221 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> doCreateView(
222 const ::com::sun::star::uno::Any
& _rDataSource
,
223 const ::rtl::OUString
& _rObjectName
,
224 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rCreationArgs
229 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
230 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
231 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
235 /** retrieves the table designer component as provided by the connection, if any
237 the name of the table for which a designer is to be obtained
239 the designer component, as provided by the connection, or <NULL/>, if the connection
240 does not provide a specialized designer.
241 @see com::sun::star::sdb::application::XTableUIProvider
243 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>
244 impl_getConnectionProvidedDesigner_nothrow( const ::rtl::OUString
& _rTableName
);
247 //======================================================================
249 //======================================================================
250 class ResultSetBrowser
: public DatabaseObjectView
256 virtual void fillDispatchArgs(
257 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rDispatchArguments
,
258 const ::com::sun::star::uno::Any
& _aDataSource
,
259 const ::rtl::OUString
& _rQualifiedName
264 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
265 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
266 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
,
271 //======================================================================
273 //======================================================================
274 class RelationDesigner
: public DatabaseObjectView
278 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
279 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
280 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
283 //======================================================================
285 //======================================================================
286 class ReportDesigner
: public DatabaseObjectView
290 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
291 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
292 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
295 // .........................................................................
297 // .........................................................................
299 #endif // DBACCESS_DATABASE_OBJECT_VIEW_HXX