Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / dbaccess / source / ui / inc / databaseobjectview.hxx
blobbe810b75b1a072365e2e830b5d0ed4465fc391ab
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/XComponentContext.hpp>
35 #include <comphelper/namedvaluecollection.hxx>
37 #include <memory>
39 namespace dbaui
41 /** encapsulates access to the view of a database object.
43 @todo
44 this is to be merged with the OLinkedDocumentAccess class
46 class DatabaseObjectView
48 private:
49 css::uno::Reference< css::uno::XComponentContext >
50 m_xORB;
51 css::uno::Reference< css::frame::XFrame >
52 m_xParentFrame;
53 css::uno::Reference< css::frame::XComponentLoader >
54 m_xFrameLoader;
55 css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >
56 m_xApplication;
57 OUString m_sComponentURL;
59 private:
60 css::uno::Reference< css::lang::XComponent >
61 doDispatch(
62 const ::comphelper::NamedValueCollection& i_rDispatchArgs
65 protected:
66 /** creates the desired view
68 The default implementation will call <member>fillDispatchArgs</member>, followed
69 by <member>doDispatch</member>.
71 @param _rDataSource
72 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
73 @param _rObjectName
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.
76 @param _rCreationArgs
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;
96 public:
97 DatabaseObjectView(
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
108 Desktop.
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
117 @param _xDataSource
118 the data source for which a new object is to be created
119 @return
120 the controller of the newly created document
122 css::uno::Reference< css::lang::XComponent >
123 createNew(
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
130 @param _xDataSource
131 the data source for which a new object is to be created
132 @param _rObjectName
133 the name of the object to be edited
134 @param _rArgs
135 Additional settings which should be forwarded to the frame
136 @return
137 the frame into which the view has been loaded
139 css::uno::Reference< css::lang::XComponent >
140 openExisting(
141 const css::uno::Any& _aDataSource,
142 const OUString& _rName,
143 const ::comphelper::NamedValueCollection& i_rDispatchArgs
147 // QueryDesigner
148 class QueryDesigner : public DatabaseObjectView
150 protected:
151 sal_Int32 m_nCommandType;
153 protected:
154 virtual void fillDispatchArgs(
155 ::comphelper::NamedValueCollection& i_rDispatchArgs,
156 const css::uno::Any& _aDataSource,
157 const OUString& _rObjectName
158 ) override;
160 public:
161 QueryDesigner(
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,
165 bool _bCreateView
169 // TableDesigner
170 class TableDesigner : public DatabaseObjectView
172 protected:
173 virtual void fillDispatchArgs(
174 ::comphelper::NamedValueCollection& i_rDispatchArgs,
175 const css::uno::Any& _aDataSource,
176 const OUString& _rObjectName
177 ) override;
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
183 ) override;
185 public:
186 TableDesigner(
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
192 private:
193 /** retrieves the table designer component as provided by the connection, if any
194 @param _rTableName
195 the name of the table for which a designer is to be obtained
196 @return
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 );
205 // ResultSetBrowser
206 class ResultSetBrowser : public DatabaseObjectView
208 private:
209 bool m_bTable;
211 protected:
212 virtual void fillDispatchArgs(
213 ::comphelper::NamedValueCollection& i_rDispatchArgs,
214 const css::uno::Any& _aDataSource,
215 const OUString& _rQualifiedName
216 ) override;
218 public:
219 ResultSetBrowser(
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,
223 bool _bTable
227 // RelationDesigner
228 class RelationDesigner : public DatabaseObjectView
230 public:
231 RelationDesigner(
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
237 } // namespace dbaui
239 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DATABASEOBJECTVIEW_HXX
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */