update dev300-m58
[ooovba.git] / dbaccess / source / ui / inc / databaseobjectview.hxx
blob0e64160e68a3a77ebe24a463bfb0c6ad3f05bf08
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: databaseobjectview.hxx,v $
10 * $Revision: 1.6 $
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>
36 #endif
37 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
38 #include <com/sun/star/sdbc/XConnection.hpp>
39 #endif
40 #ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
41 #include <com/sun/star/sdbc/XDataSource.hpp>
42 #endif
43 #ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
44 #include <com/sun/star/frame/XDispatch.hpp>
45 #endif
46 #ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
47 #include <com/sun/star/lang/XComponent.hpp>
48 #endif
49 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
51 #endif
52 #ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
53 #include <com/sun/star/frame/XComponentLoader.hpp>
54 #endif
55 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
56 #include <com/sun/star/frame/XFrame.hpp>
57 #endif
58 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
59 #include <com/sun/star/beans/PropertyValue.hpp>
60 #endif
61 #ifndef _COM_SUN_STAR_UI_DIALOGS_XEXECUTABLEDIALOG_HPP_
62 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
63 #endif
64 #ifndef _COM_SUN_STAR_SDB_APPLICATION_XDATABASEDOCUMENTUI_HPP_
65 #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
66 #endif
67 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
68 #include <com/sun/star/uno/Sequence.hxx>
69 #endif
71 #include <boost/shared_ptr.hpp>
74 // .........................................................................
75 namespace dbaui
77 // .........................................................................
78 /** encapsulates access to the view of a database object.
80 @todo
81 this is to be merged with the OLinkedDocumentAccess class
83 class DatabaseObjectView
85 private:
86 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
87 m_xORB;
88 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
89 m_xParentFrame;
90 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XComponentLoader >
91 m_xFrameLoader;
92 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >
93 m_xApplication;
94 ::rtl::OUString m_sComponentURL;
96 private:
97 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
98 doDispatch(
99 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments
102 protected:
103 /** creates the desired view
105 The default implementation will call <member>fillDispatchArgs</member>, followed
106 by <member>doDispatch</member>.
108 @param _rDataSource
109 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
110 @param _rObjectName
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;
133 public:
134 DatabaseObjectView(
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
145 Desktop.
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
154 @param _xDataSource
155 the data source for which a new object is to be created
156 @return
157 the controller of the newly created document
159 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
160 createNew(
161 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _xDataSource
164 /** opens a view for an existent object
166 @param _xDataSource
167 the data source for which a new object is to be created
168 @param _rObjectName
169 the name of the object to be edited
170 @param _rArgs
171 Additional settings which should be forwarded to the frame
172 @return
173 the frame into which the view has been loaded
175 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
176 openExisting(
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 //======================================================================
184 //= QueryDesigner
185 //======================================================================
186 class QueryDesigner : public DatabaseObjectView
188 protected:
189 sal_Int32 m_nCommandType;
190 sal_Bool m_bPreferSQLView;
192 protected:
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
199 public:
200 QueryDesigner(
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,
204 bool _bCreateView,
205 sal_Bool _bPreferSQLView
209 //======================================================================
210 //= TableDesigner
211 //======================================================================
212 class TableDesigner : public DatabaseObjectView
214 protected:
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
227 public:
228 TableDesigner(
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
234 private:
235 /** retrieves the table designer component as provided by the connection, if any
236 @param _rTableName
237 the name of the table for which a designer is to be obtained
238 @return
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 //======================================================================
248 //= ResultSetBrowser
249 //======================================================================
250 class ResultSetBrowser : public DatabaseObjectView
252 private:
253 sal_Bool m_bTable;
255 protected:
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
262 public:
263 ResultSetBrowser(
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,
267 sal_Bool _bTable
271 //======================================================================
272 //= RelationDesigner
273 //======================================================================
274 class RelationDesigner : public DatabaseObjectView
276 public:
277 RelationDesigner(
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 //======================================================================
284 //= ReportDesigner
285 //======================================================================
286 class ReportDesigner : public DatabaseObjectView
288 public:
289 ReportDesigner(
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 // .........................................................................
296 } // namespace dbaui
297 // .........................................................................
299 #endif // DBACCESS_DATABASE_OBJECT_VIEW_HXX