bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / inc / databaseobjectview.hxx
blob95211ca6737517adff8429f115b15a31eade4d87
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 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 // .........................................................................
42 namespace dbaui
44 // .........................................................................
45 /** encapsulates access to the view of a database object.
47 @todo
48 this is to be merged with the OLinkedDocumentAccess class
50 class DatabaseObjectView
52 private:
53 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
54 m_xORB;
55 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
56 m_xParentFrame;
57 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XComponentLoader >
58 m_xFrameLoader;
59 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >
60 m_xApplication;
61 OUString m_sComponentURL;
64 private:
65 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
66 doDispatch(
67 const ::comphelper::NamedValueCollection& i_rDispatchArgs
70 protected:
71 /** creates the desired view
73 The default implementation will call <member>fillDispatchArgs</member>, followed
74 by <member>doDispatch</member>.
76 @param _rDataSource
77 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
78 @param _rObjectName
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.
81 @param _rCreationArgs
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;
101 public:
102 DatabaseObjectView(
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
113 Desktop.
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
122 @param _xDataSource
123 the data source for which a new object is to be created
124 @return
125 the controller of the newly created document
127 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
128 createNew(
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
135 @param _xDataSource
136 the data source for which a new object is to be created
137 @param _rObjectName
138 the name of the object to be edited
139 @param _rArgs
140 Additional settings which should be forwarded to the frame
141 @return
142 the frame into which the view has been loaded
144 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
145 openExisting(
146 const ::com::sun::star::uno::Any& _aDataSource,
147 const OUString& _rName,
148 const ::comphelper::NamedValueCollection& i_rDispatchArgs
152 //======================================================================
153 //= QueryDesigner
154 //======================================================================
155 class QueryDesigner : public DatabaseObjectView
157 protected:
158 sal_Int32 m_nCommandType;
160 protected:
161 virtual void fillDispatchArgs(
162 ::comphelper::NamedValueCollection& i_rDispatchArgs,
163 const ::com::sun::star::uno::Any& _aDataSource,
164 const OUString& _rObjectName
167 public:
168 QueryDesigner(
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,
172 bool _bCreateView
176 //======================================================================
177 //= TableDesigner
178 //======================================================================
179 class TableDesigner : public DatabaseObjectView
181 protected:
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
194 public:
195 TableDesigner(
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
201 private:
202 /** retrieves the table designer component as provided by the connection, if any
203 @param _rTableName
204 the name of the table for which a designer is to be obtained
205 @return
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 //======================================================================
215 //= ResultSetBrowser
216 //======================================================================
217 class ResultSetBrowser : public DatabaseObjectView
219 private:
220 sal_Bool m_bTable;
222 protected:
223 virtual void fillDispatchArgs(
224 ::comphelper::NamedValueCollection& i_rDispatchArgs,
225 const ::com::sun::star::uno::Any& _aDataSource,
226 const OUString& _rQualifiedName
229 public:
230 ResultSetBrowser(
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,
234 sal_Bool _bTable
238 //======================================================================
239 //= RelationDesigner
240 //======================================================================
241 class RelationDesigner : public DatabaseObjectView
243 public:
244 RelationDesigner(
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 // .........................................................................
251 } // namespace dbaui
252 // .........................................................................
254 #endif // DBACCESS_DATABASE_OBJECT_VIEW_HXX
256 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */