tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / dbaccess / source / ui / inc / databaseobjectview.hxx
blob46df991816277a393acf85e65c1397a364e2597a
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 #pragma once
22 #include <rtl/ustring.hxx>
23 #include <com/sun/star/sdbc/XConnection.hpp>
24 #include <com/sun/star/sdbc/XDataSource.hpp>
25 #include <com/sun/star/lang/XComponent.hpp>
26 #include <com/sun/star/frame/XComponentLoader.hpp>
27 #include <com/sun/star/frame/XFrame.hpp>
28 #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <comphelper/namedvaluecollection.hxx>
32 namespace dbaui
34 /** encapsulates access to the view of a database object.
36 @todo
37 this is to be merged with the OLinkedDocumentAccess class
39 class DatabaseObjectView
41 private:
42 css::uno::Reference< css::uno::XComponentContext >
43 m_xORB;
44 css::uno::Reference< css::frame::XFrame >
45 m_xParentFrame;
46 css::uno::Reference< css::frame::XComponentLoader >
47 m_xFrameLoader;
48 css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >
49 m_xApplication;
50 OUString m_sComponentURL;
52 private:
53 css::uno::Reference< css::lang::XComponent >
54 doDispatch(
55 const ::comphelper::NamedValueCollection& i_rDispatchArgs
58 protected:
59 /** creates the desired view
61 The default implementation will call <member>fillDispatchArgs</member>, followed
62 by <member>doDispatch</member>.
64 @param _rDataSource
65 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
66 @param _rObjectName
67 the name of the object for which the view is to be opened,
68 or an empty string if a view for a new object should be created.
69 @param _rCreationArgs
70 the arguments for the view's creation
72 virtual css::uno::Reference< css::lang::XComponent > doCreateView(
73 const css::uno::Any& _rDataSource,
74 const OUString& _rObjectName,
75 const ::comphelper::NamedValueCollection& i_rCreationArgs
78 virtual void fillDispatchArgs(
79 ::comphelper::NamedValueCollection& i_rDispatchArgs,
80 const css::uno::Any& _rDataSource,
81 const OUString& _rObjectName
84 const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >&
85 getApplicationUI() const { return m_xApplication; }
86 css::uno::Reference< css::sdbc::XConnection >
87 getConnection() const;
89 public:
90 DatabaseObjectView(
91 const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
92 const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
93 const css::uno::Reference< css::frame::XFrame >& _rxParentFrame,
94 OUString _sComponentURL
96 virtual ~DatabaseObjectView(){}
98 /** sets the target frame into which the view should be loaded.
100 By default, the view is loaded into a top-level frame not being part of the
101 Desktop.
103 void setTargetFrame( const css::uno::Reference< css::frame::XFrame >& _rxFrame )
105 m_xFrameLoader.set( _rxFrame, css::uno::UNO_QUERY );
108 /** opens a view for a to-be-created object
110 @param _xDataSource
111 the data source for which a new object is to be created
112 @return
113 the controller of the newly created document
115 css::uno::Reference< css::lang::XComponent >
116 createNew(
117 const css::uno::Reference< css::sdbc::XDataSource >& _xDataSource,
118 const ::comphelper::NamedValueCollection& i_rDispatchArgs = ::comphelper::NamedValueCollection()
121 /** opens a view for an existent object
123 @param _xDataSource
124 the data source for which a new object is to be created
125 @param _rObjectName
126 the name of the object to be edited
127 @param _rArgs
128 Additional settings which should be forwarded to the frame
129 @return
130 the frame into which the view has been loaded
132 css::uno::Reference< css::lang::XComponent >
133 openExisting(
134 const css::uno::Any& _aDataSource,
135 const OUString& _rName,
136 const ::comphelper::NamedValueCollection& i_rDispatchArgs
140 // QueryDesigner
141 class QueryDesigner final : public DatabaseObjectView
143 sal_Int32 m_nCommandType;
145 virtual void fillDispatchArgs(
146 ::comphelper::NamedValueCollection& i_rDispatchArgs,
147 const css::uno::Any& _aDataSource,
148 const OUString& _rObjectName
149 ) override;
151 public:
152 QueryDesigner(
153 const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
154 const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
155 const css::uno::Reference< css::frame::XFrame >& _rxParentFrame,
156 bool _bCreateView
160 // TableDesigner
161 class TableDesigner : public DatabaseObjectView
163 protected:
164 virtual void fillDispatchArgs(
165 ::comphelper::NamedValueCollection& i_rDispatchArgs,
166 const css::uno::Any& _aDataSource,
167 const OUString& _rObjectName
168 ) override;
170 virtual css::uno::Reference< css::lang::XComponent > doCreateView(
171 const css::uno::Any& _rDataSource,
172 const OUString& _rObjectName,
173 const ::comphelper::NamedValueCollection& i_rCreationArgs
174 ) override;
176 public:
177 TableDesigner(
178 const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
179 const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
180 const css::uno::Reference< css::frame::XFrame >& _rxParentFrame
183 private:
184 /** retrieves the table designer component as provided by the connection, if any
185 @param _rTableName
186 the name of the table for which a designer is to be obtained
187 @return
188 the designer component, as provided by the connection, or <NULL/>, if the connection
189 does not provide a specialized designer.
190 @see css::sdb::application::XTableUIProvider
192 css::uno::Reference< css::uno::XInterface >
193 impl_getConnectionProvidedDesigner_nothrow( const OUString& _rTableName );
196 // ResultSetBrowser
197 class ResultSetBrowser : public DatabaseObjectView
199 private:
200 bool m_bTable;
202 protected:
203 virtual void fillDispatchArgs(
204 ::comphelper::NamedValueCollection& i_rDispatchArgs,
205 const css::uno::Any& _aDataSource,
206 const OUString& _rQualifiedName
207 ) override;
209 public:
210 ResultSetBrowser(
211 const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
212 const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
213 const css::uno::Reference< css::frame::XFrame >& _rxParentFrame,
214 bool _bTable
218 // RelationDesigner
219 class RelationDesigner : public DatabaseObjectView
221 public:
222 RelationDesigner(
223 const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
224 const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
225 const css::uno::Reference< css::frame::XFrame >& _rxParentFrame
228 } // namespace dbaui
230 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */