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/XComponentContext.hpp>
35 #include <comphelper/namedvaluecollection.hxx>
41 /** encapsulates access to the view of a database object.
44 this is to be merged with the OLinkedDocumentAccess class
46 class DatabaseObjectView
49 css::uno::Reference
< css::uno::XComponentContext
>
51 css::uno::Reference
< css::frame::XFrame
>
53 css::uno::Reference
< css::frame::XComponentLoader
>
55 css::uno::Reference
< css::sdb::application::XDatabaseDocumentUI
>
57 OUString m_sComponentURL
;
60 css::uno::Reference
< css::lang::XComponent
>
62 const ::comphelper::NamedValueCollection
& i_rDispatchArgs
66 /** creates the desired view
68 The default implementation will call <member>fillDispatchArgs</member>, followed
69 by <member>doDispatch</member>.
72 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
74 the name of the object for which the view is to be opened,
75 or an empty string if a view for a new object should be created.
77 the arguments for the view's creation
79 virtual css::uno::Reference
< css::lang::XComponent
> doCreateView(
80 const css::uno::Any
& _rDataSource
,
81 const OUString
& _rObjectName
,
82 const ::comphelper::NamedValueCollection
& i_rCreationArgs
85 virtual void fillDispatchArgs(
86 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
87 const css::uno::Any
& _rDataSource
,
88 const OUString
& _rObjectName
91 const css::uno::Reference
< css::sdb::application::XDatabaseDocumentUI
>&
92 getApplicationUI() const { return m_xApplication
; }
93 css::uno::Reference
< css::sdbc::XConnection
>
94 getConnection() const;
98 const css::uno::Reference
< css::uno::XComponentContext
>& _rxORB
,
99 const css::uno::Reference
< css::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
100 const css::uno::Reference
< css::frame::XFrame
>& _rxParentFrame
,
101 const OUString
& _rComponentURL
103 virtual ~DatabaseObjectView(){}
105 /** sets the target frame into which the view should be loaded.
107 By default, the view is loaded into a top-level frame not being part of the
110 void setTargetFrame( const css::uno::Reference
< css::frame::XFrame
>& _rxFrame
)
112 m_xFrameLoader
.set( _rxFrame
, css::uno::UNO_QUERY
);
115 /** opens a view for a to-be-created object
118 the data source for which a new object is to be created
120 the controller of the newly created document
122 css::uno::Reference
< css::lang::XComponent
>
124 const css::uno::Reference
< css::sdbc::XDataSource
>& _xDataSource
,
125 const ::comphelper::NamedValueCollection
& i_rDispatchArgs
= ::comphelper::NamedValueCollection()
128 /** opens a view for an existent object
131 the data source for which a new object is to be created
133 the name of the object to be edited
135 Additional settings which should be forwarded to the frame
137 the frame into which the view has been loaded
139 css::uno::Reference
< css::lang::XComponent
>
141 const css::uno::Any
& _aDataSource
,
142 const OUString
& _rName
,
143 const ::comphelper::NamedValueCollection
& i_rDispatchArgs
148 class QueryDesigner
: public DatabaseObjectView
151 sal_Int32 m_nCommandType
;
154 virtual void fillDispatchArgs(
155 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
156 const css::uno::Any
& _aDataSource
,
157 const OUString
& _rObjectName
162 const css::uno::Reference
< css::uno::XComponentContext
>& _rxORB
,
163 const css::uno::Reference
< css::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
164 const css::uno::Reference
< css::frame::XFrame
>& _rxParentFrame
,
170 class TableDesigner
: public DatabaseObjectView
173 virtual void fillDispatchArgs(
174 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
175 const css::uno::Any
& _aDataSource
,
176 const OUString
& _rObjectName
179 virtual css::uno::Reference
< css::lang::XComponent
> doCreateView(
180 const css::uno::Any
& _rDataSource
,
181 const OUString
& _rObjectName
,
182 const ::comphelper::NamedValueCollection
& i_rCreationArgs
187 const css::uno::Reference
< css::uno::XComponentContext
>& _rxORB
,
188 const css::uno::Reference
< css::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
189 const css::uno::Reference
< css::frame::XFrame
>& _rxParentFrame
193 /** retrieves the table designer component as provided by the connection, if any
195 the name of the table for which a designer is to be obtained
197 the designer component, as provided by the connection, or <NULL/>, if the connection
198 does not provide a specialized designer.
199 @see css::sdb::application::XTableUIProvider
201 css::uno::Reference
< css::uno::XInterface
>
202 impl_getConnectionProvidedDesigner_nothrow( const OUString
& _rTableName
);
206 class ResultSetBrowser
: public DatabaseObjectView
212 virtual void fillDispatchArgs(
213 ::comphelper::NamedValueCollection
& i_rDispatchArgs
,
214 const css::uno::Any
& _aDataSource
,
215 const OUString
& _rQualifiedName
220 const css::uno::Reference
< css::uno::XComponentContext
>& _rxORB
,
221 const css::uno::Reference
< css::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
222 const css::uno::Reference
< css::frame::XFrame
>& _rxParentFrame
,
228 class RelationDesigner
: public DatabaseObjectView
232 const css::uno::Reference
< css::uno::XComponentContext
>& _rxORB
,
233 const css::uno::Reference
< css::sdb::application::XDatabaseDocumentUI
>& _rxApplication
,
234 const css::uno::Reference
< css::frame::XFrame
>& _rxParentFrame
239 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DATABASEOBJECTVIEW_HXX
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */