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 INCLUDED_DBACCESS_SOURCE_UI_INC_DATABASEOBJECTVIEW_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_DATABASEOBJECTVIEW_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>
42 /** encapsulates access to the view of a database object.
45 this is to be merged with the OLinkedDocumentAccess class
47 class DatabaseObjectView
50 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>
52 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>
54 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XComponentLoader
>
56 ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>
58 OUString m_sComponentURL
;
61 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
63 const ::comphelper::NamedValueCollection
& i_rDispatchArgs
67 /** creates the desired view
69 The default implementation will call <member>fillDispatchArgs</member>, followed
70 by <member>doDispatch</member>.
73 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
75 the name of the object for which the view is to be opened,
76 or an empty string if a view for a new object should be created.
78 the arguments for the view's creation
80 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> doCreateView(
81 const ::com::sun::star::uno::Any
& _rDataSource
,
82 const OUString
& _rObjectName
,
83 const ::comphelper::NamedValueCollection
& i_rCreationArgs
86 virtual void fillDispatchArgs(
87 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
88 const ::com::sun::star::uno::Any
& _rDataSource
,
89 const OUString
& _rObjectName
92 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>&
93 getApplicationUI() const { return m_xApplication
; }
94 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>
95 getConnection() const;
99 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
100 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
101 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
,
102 const OUString
& _rComponentURL
104 virtual ~DatabaseObjectView(){}
106 /** sets the target frame into which the view should be loaded.
108 By default, the view is loaded into a top-level frame not being part of the
111 void setTargetFrame( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxFrame
)
113 m_xFrameLoader
.set( _rxFrame
, ::com::sun::star::uno::UNO_QUERY
);
116 /** opens a view for a to-be-created object
119 the data source for which a new object is to be created
121 the controller of the newly created document
123 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
125 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
>& _xDataSource
,
126 const ::comphelper::NamedValueCollection
& i_rDispatchArgs
= ::comphelper::NamedValueCollection()
129 /** opens a view for an existent object
132 the data source for which a new object is to be created
134 the name of the object to be edited
136 Additional settings which should be forwarded to the frame
138 the frame into which the view has been loaded
140 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
142 const ::com::sun::star::uno::Any
& _aDataSource
,
143 const OUString
& _rName
,
144 const ::comphelper::NamedValueCollection
& i_rDispatchArgs
149 class QueryDesigner
: public DatabaseObjectView
152 sal_Int32 m_nCommandType
;
155 virtual void fillDispatchArgs(
156 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
157 const ::com::sun::star::uno::Any
& _aDataSource
,
158 const OUString
& _rObjectName
163 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
164 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
165 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
,
171 class TableDesigner
: public DatabaseObjectView
174 virtual void fillDispatchArgs(
175 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
176 const ::com::sun::star::uno::Any
& _aDataSource
,
177 const OUString
& _rObjectName
180 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> doCreateView(
181 const ::com::sun::star::uno::Any
& _rDataSource
,
182 const OUString
& _rObjectName
,
183 const ::comphelper::NamedValueCollection
& i_rCreationArgs
188 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
189 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
190 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
194 /** retrieves the table designer component as provided by the connection, if any
196 the name of the table for which a designer is to be obtained
198 the designer component, as provided by the connection, or <NULL/>, if the connection
199 does not provide a specialized designer.
200 @see com::sun::star::sdb::application::XTableUIProvider
202 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>
203 impl_getConnectionProvidedDesigner_nothrow( const OUString
& _rTableName
);
207 class ResultSetBrowser
: public DatabaseObjectView
213 virtual void fillDispatchArgs(
214 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
215 const ::com::sun::star::uno::Any
& _aDataSource
,
216 const OUString
& _rQualifiedName
221 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
222 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
223 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
,
229 class RelationDesigner
: public DatabaseObjectView
233 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
,
234 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
235 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxParentFrame
240 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DATABASEOBJECTVIEW_HXX
242 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */