1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef DBACCESS_DATABASE_OBJECT_VIEW_HXX
21 #define DBACCESS_DATABASE_OBJECT_VIEW_HXX
23 #include <rtl/ustring.hxx>
24 #include <com/sun/star/sdbc/XConnection.hpp>
25 #include <com/sun/star/sdbc/XDataSource.hpp>
26 #include <com/sun/star/frame/XDispatch.hpp>
27 #include <com/sun/star/lang/XComponent.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/frame/XComponentLoader.hpp>
30 #include <com/sun/star/frame/XFrame.hpp>
31 #include <com/sun/star/beans/PropertyValue.hpp>
32 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
33 #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
34 #include <com/sun/star/uno/Sequence.hxx>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <comphelper/namedvaluecollection.hxx>
38 #include <boost/shared_ptr.hpp>
41 // .........................................................................
44 // .........................................................................
45 /** encapsulates access to the view of a database object.
48 this is to be merged with the OLinkedDocumentAccess class
50 class DatabaseObjectView
53 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>
55 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>
57 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XComponentLoader
>
59 ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>
61 OUString m_sComponentURL
;
65 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
67 const ::comphelper::NamedValueCollection
& i_rDispatchArgs
71 /** creates the desired view
73 The default implementation will call <member>fillDispatchArgs</member>, followed
74 by <member>doDispatch</member>.
77 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
79 the name of the object for which the view is to be opened,
80 or an empty string if a view for a new object should be created.
82 the arguments for the view's creation
84 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> doCreateView(
85 const ::com::sun::star::uno::Any
& _rDataSource
,
86 const OUString
& _rObjectName
,
87 const ::comphelper::NamedValueCollection
& i_rCreationArgs
90 virtual void fillDispatchArgs(
91 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
92 const ::com::sun::star::uno::Any
& _rDataSource
,
93 const OUString
& _rObjectName
96 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>&
97 getApplicationUI() const { return m_xApplication
; }
98 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>
99 getConnection() const;
103 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
104 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
105 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
,
106 const OUString
& _rComponentURL
108 virtual ~DatabaseObjectView(){}
110 /** sets the target frame into which the view should be loaded.
112 By default, the view is loaded into a top-level frame not being part of the
115 void setTargetFrame( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxFrame
)
117 m_xFrameLoader
.set( _rxFrame
, ::com::sun::star::uno::UNO_QUERY
);
120 /** opens a view for a to-be-created object
123 the data source for which a new object is to be created
125 the controller of the newly created document
127 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
129 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
>& _xDataSource
,
130 const ::comphelper::NamedValueCollection
& i_rDispatchArgs
= ::comphelper::NamedValueCollection()
133 /** opens a view for an existent object
136 the data source for which a new object is to be created
138 the name of the object to be edited
140 Additional settings which should be forwarded to the frame
142 the frame into which the view has been loaded
144 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
146 const ::com::sun::star::uno::Any
& _aDataSource
,
147 const OUString
& _rName
,
148 const ::comphelper::NamedValueCollection
& i_rDispatchArgs
152 //======================================================================
154 //======================================================================
155 class QueryDesigner
: public DatabaseObjectView
158 sal_Int32 m_nCommandType
;
161 virtual void fillDispatchArgs(
162 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
163 const ::com::sun::star::uno::Any
& _aDataSource
,
164 const OUString
& _rObjectName
169 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
170 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
171 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
,
176 //======================================================================
178 //======================================================================
179 class TableDesigner
: public DatabaseObjectView
182 virtual void fillDispatchArgs(
183 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
184 const ::com::sun::star::uno::Any
& _aDataSource
,
185 const OUString
& _rObjectName
188 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> doCreateView(
189 const ::com::sun::star::uno::Any
& _rDataSource
,
190 const OUString
& _rObjectName
,
191 const ::comphelper::NamedValueCollection
& i_rCreationArgs
196 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
197 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
198 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
202 /** retrieves the table designer component as provided by the connection, if any
204 the name of the table for which a designer is to be obtained
206 the designer component, as provided by the connection, or <NULL/>, if the connection
207 does not provide a specialized designer.
208 @see com::sun::star::sdb::application::XTableUIProvider
210 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>
211 impl_getConnectionProvidedDesigner_nothrow( const OUString
& _rTableName
);
214 //======================================================================
216 //======================================================================
217 class ResultSetBrowser
: public DatabaseObjectView
223 virtual void fillDispatchArgs(
224 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
225 const ::com::sun::star::uno::Any
& _aDataSource
,
226 const OUString
& _rQualifiedName
231 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
232 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
233 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
,
238 //======================================================================
240 //======================================================================
241 class RelationDesigner
: public DatabaseObjectView
245 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
246 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
247 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
250 // .........................................................................
252 // .........................................................................
254 #endif // DBACCESS_DATABASE_OBJECT_VIEW_HXX
256 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */