Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / inc / databaseobjectview.hxx
blobed7ec6e4e85e22e7a3795b86bcacf133a87e46d6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
40 namespace dbaui
42 /** encapsulates access to the view of a database object.
44 @todo
45 this is to be merged with the OLinkedDocumentAccess class
47 class DatabaseObjectView
49 private:
50 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
51 m_xORB;
52 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
53 m_xParentFrame;
54 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XComponentLoader >
55 m_xFrameLoader;
56 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >
57 m_xApplication;
58 OUString m_sComponentURL;
60 private:
61 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
62 doDispatch(
63 const ::comphelper::NamedValueCollection& i_rDispatchArgs
66 protected:
67 /** creates the desired view
69 The default implementation will call <member>fillDispatchArgs</member>, followed
70 by <member>doDispatch</member>.
72 @param _rDataSource
73 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
74 @param _rObjectName
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.
77 @param _rCreationArgs
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;
97 public:
98 DatabaseObjectView(
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
109 Desktop.
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
118 @param _xDataSource
119 the data source for which a new object is to be created
120 @return
121 the controller of the newly created document
123 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
124 createNew(
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
131 @param _xDataSource
132 the data source for which a new object is to be created
133 @param _rObjectName
134 the name of the object to be edited
135 @param _rArgs
136 Additional settings which should be forwarded to the frame
137 @return
138 the frame into which the view has been loaded
140 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
141 openExisting(
142 const ::com::sun::star::uno::Any& _aDataSource,
143 const OUString& _rName,
144 const ::comphelper::NamedValueCollection& i_rDispatchArgs
148 // QueryDesigner
149 class QueryDesigner : public DatabaseObjectView
151 protected:
152 sal_Int32 m_nCommandType;
154 protected:
155 virtual void fillDispatchArgs(
156 ::comphelper::NamedValueCollection& i_rDispatchArgs,
157 const ::com::sun::star::uno::Any& _aDataSource,
158 const OUString& _rObjectName
159 ) SAL_OVERRIDE;
161 public:
162 QueryDesigner(
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,
166 bool _bCreateView
170 // TableDesigner
171 class TableDesigner : public DatabaseObjectView
173 protected:
174 virtual void fillDispatchArgs(
175 ::comphelper::NamedValueCollection& i_rDispatchArgs,
176 const ::com::sun::star::uno::Any& _aDataSource,
177 const OUString& _rObjectName
178 ) SAL_OVERRIDE;
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
184 ) SAL_OVERRIDE;
186 public:
187 TableDesigner(
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
193 private:
194 /** retrieves the table designer component as provided by the connection, if any
195 @param _rTableName
196 the name of the table for which a designer is to be obtained
197 @return
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 );
206 // ResultSetBrowser
207 class ResultSetBrowser : public DatabaseObjectView
209 private:
210 bool m_bTable;
212 protected:
213 virtual void fillDispatchArgs(
214 ::comphelper::NamedValueCollection& i_rDispatchArgs,
215 const ::com::sun::star::uno::Any& _aDataSource,
216 const OUString& _rQualifiedName
217 ) SAL_OVERRIDE;
219 public:
220 ResultSetBrowser(
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,
224 bool _bTable
228 // RelationDesigner
229 class RelationDesigner : public DatabaseObjectView
231 public:
232 RelationDesigner(
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
238 } // namespace dbaui
240 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DATABASEOBJECTVIEW_HXX
242 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */