File: | home/maarten/src/libreoffice/core/include/rtl/ref.hxx |
Warning: | line 113, column 13 Use of memory after it is freed |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | |||
2 | /* | |||
3 | * This file is part of the LibreOffice project. | |||
4 | * | |||
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/. | |||
8 | * | |||
9 | * This file incorporates work covered by the following license notice: | |||
10 | * | |||
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 . | |||
18 | */ | |||
19 | ||||
20 | #include <browserids.hxx> | |||
21 | #include <brwctrlr.hxx> | |||
22 | #include <brwview.hxx> | |||
23 | #include <strings.hrc> | |||
24 | #include <strings.hxx> | |||
25 | #include <core_resource.hxx> | |||
26 | #include <queryfilter.hxx> | |||
27 | #include <queryorder.hxx> | |||
28 | #include <sqlmessage.hxx> | |||
29 | ||||
30 | #include <com/sun/star/container/XNameContainer.hpp> | |||
31 | #include <com/sun/star/form/XBoundControl.hpp> | |||
32 | #include <com/sun/star/form/XDatabaseParameterBroadcaster.hpp> | |||
33 | #include <com/sun/star/form/XLoadable.hpp> | |||
34 | #include <com/sun/star/form/XReset.hpp> | |||
35 | #include <com/sun/star/form/XResetListener.hpp> | |||
36 | #include <com/sun/star/form/runtime/XFormController.hpp> | |||
37 | #include <com/sun/star/form/runtime/FormOperations.hpp> | |||
38 | #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> | |||
39 | #include <com/sun/star/lang/XMultiServiceFactory.hpp> | |||
40 | #include <com/sun/star/lang/NoSupportException.hpp> | |||
41 | #include <com/sun/star/sdb/CommandType.hpp> | |||
42 | #include <com/sun/star/sdb/ErrorCondition.hpp> | |||
43 | #include <com/sun/star/sdb/ParametersRequest.hpp> | |||
44 | #include <com/sun/star/sdb/XInteractionSupplyParameters.hpp> | |||
45 | #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp> | |||
46 | #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> | |||
47 | #include <com/sun/star/sdb/SQLFilterOperator.hpp> | |||
48 | #include <com/sun/star/sdbc/XConnection.hpp> | |||
49 | #include <com/sun/star/sdbc/XResultSetUpdate.hpp> | |||
50 | #include <com/sun/star/sdbc/XWarningsSupplier.hpp> | |||
51 | #include <com/sun/star/sdbcx/Privilege.hpp> | |||
52 | #include <com/sun/star/sdbcx/XRowLocate.hpp> | |||
53 | #include <com/sun/star/task/InteractionHandler.hpp> | |||
54 | #include <com/sun/star/util/NumberFormatter.hpp> | |||
55 | ||||
56 | #include <comphelper/enumhelper.hxx> | |||
57 | #include <comphelper/extract.hxx> | |||
58 | #include <comphelper/interaction.hxx> | |||
59 | #include <comphelper/sequence.hxx> | |||
60 | #include <comphelper/string.hxx> | |||
61 | #include <comphelper/types.hxx> | |||
62 | #include <connectivity/dbexception.hxx> | |||
63 | #include <connectivity/dbtools.hxx> | |||
64 | #include <connectivity/sqlerror.hxx> | |||
65 | #include <cppuhelper/exc_hlp.hxx> | |||
66 | #include <cppuhelper/implbase2.hxx> | |||
67 | #include <osl/mutex.hxx> | |||
68 | #include <sal/log.hxx> | |||
69 | #include <svx/fmsearch.hxx> | |||
70 | #include <svx/svxdlg.hxx> | |||
71 | #include <tools/diagnose_ex.h> | |||
72 | #include <osl/diagnose.h> | |||
73 | #include <vcl/svapp.hxx> | |||
74 | #include <vcl/weld.hxx> | |||
75 | ||||
76 | using namespace ::com::sun::star; | |||
77 | using namespace ::com::sun::star::uno; | |||
78 | using namespace ::com::sun::star::awt; | |||
79 | using namespace ::com::sun::star::sdb; | |||
80 | using namespace ::com::sun::star::sdbc; | |||
81 | using namespace ::com::sun::star::sdbcx; | |||
82 | using namespace ::com::sun::star::task; | |||
83 | using namespace ::com::sun::star::beans; | |||
84 | using namespace ::com::sun::star::frame; | |||
85 | using namespace ::com::sun::star::form::runtime; | |||
86 | using namespace ::com::sun::star::form; | |||
87 | using namespace ::com::sun::star::util; | |||
88 | using namespace ::com::sun::star::lang; | |||
89 | using namespace ::com::sun::star::container; | |||
90 | using namespace ::dbtools; | |||
91 | using namespace ::comphelper; | |||
92 | using namespace ::svt; | |||
93 | ||||
94 | #define HANDLE_SQL_ERRORS( action, successflag, context, message )try { successflag = false; action; successflag = true; } catch (SQLException& e) { SQLException aError = ::dbtools::prependErrorInfo (e, *this, context); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception& ) { DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "94" ": ", "dbaccess" );; } \ | |||
95 | try \ | |||
96 | { \ | |||
97 | successflag = false; \ | |||
98 | action; \ | |||
99 | successflag = true; \ | |||
100 | } \ | |||
101 | catch(SQLException& e) \ | |||
102 | { \ | |||
103 | SQLException aError = ::dbtools::prependErrorInfo(e, *this, context); \ | |||
104 | css::sdb::SQLErrorEvent aEvent; \ | |||
105 | aEvent.Reason <<= aError; \ | |||
106 | errorOccured(aEvent); \ | |||
107 | } \ | |||
108 | catch(Exception&) \ | |||
109 | { \ | |||
110 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "110" ": ", "dbaccess" );; \ | |||
111 | } \ | |||
112 | ||||
113 | #define DO_SAFE( action, message )try { action; } catch(Exception&) { do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN, "dbaccess.ui" )) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << message) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN ), ("dbaccess.ui"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "113" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << message), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << message; ::sal ::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui") , ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "113" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << message) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN ), ("dbaccess.ui"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "113" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << message), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << message; ::sal ::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui") , ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "113" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); } ; try { action; } catch(Exception&) { SAL_WARN("dbaccess.ui",message)do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << message) == 1) { ::sal_detail_log ( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "113" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << message), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << message; ::sal ::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui") , ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "113" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << message) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN ), ("dbaccess.ui"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "113" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << message), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << message; ::sal ::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui") , ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "113" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); } ; | |||
114 | ||||
115 | namespace dbaui | |||
116 | { | |||
117 | ||||
118 | namespace { | |||
119 | ||||
120 | // OParameterContinuation | |||
121 | class OParameterContinuation : public OInteraction< XInteractionSupplyParameters > | |||
122 | { | |||
123 | Sequence< PropertyValue > m_aValues; | |||
124 | ||||
125 | public: | |||
126 | OParameterContinuation() { } | |||
127 | ||||
128 | const Sequence< PropertyValue >& getValues() const { return m_aValues; } | |||
129 | ||||
130 | // XInteractionSupplyParameters | |||
131 | virtual void SAL_CALL setParameters( const Sequence< PropertyValue >& _rValues ) override; | |||
132 | }; | |||
133 | ||||
134 | } | |||
135 | ||||
136 | void SAL_CALL OParameterContinuation::setParameters( const Sequence< PropertyValue >& _rValues ) | |||
137 | { | |||
138 | m_aValues = _rValues; | |||
139 | } | |||
140 | ||||
141 | // a helper class implementing a runtime::XFormController, will be aggregated by SbaXDataBrowserController | |||
142 | // (we can't derive from XFormController as it's base class is XTabController and the XTabController::getModel collides | |||
143 | // with the XController::getModel implemented in our base class SbaXDataBrowserController) | |||
144 | class SbaXDataBrowserController::FormControllerImpl | |||
145 | : public ::cppu::WeakAggImplHelper2< css::form::runtime::XFormController, | |||
146 | css::frame::XFrameActionListener > | |||
147 | { | |||
148 | friend class SbaXDataBrowserController; | |||
149 | ::comphelper::OInterfaceContainerHelper2 m_aActivateListeners; | |||
150 | SbaXDataBrowserController* m_pOwner; | |||
151 | ||||
152 | public: | |||
153 | explicit FormControllerImpl(SbaXDataBrowserController* pOwner); | |||
154 | ||||
155 | // XFormController | |||
156 | virtual css::uno::Reference< css::form::runtime::XFormOperations > SAL_CALL getFormOperations() override; | |||
157 | virtual css::uno::Reference< css::awt::XControl > SAL_CALL getCurrentControl() override; | |||
158 | virtual void SAL_CALL addActivateListener(const css::uno::Reference< css::form::XFormControllerListener > & l) override; | |||
159 | virtual void SAL_CALL removeActivateListener(const css::uno::Reference< css::form::XFormControllerListener > & l) override; | |||
160 | virtual void SAL_CALL addChildController( const css::uno::Reference< css::form::runtime::XFormController >& ChildController ) override; | |||
161 | virtual css::uno::Reference< css::form::runtime::XFormControllerContext > SAL_CALL getContext() override; | |||
162 | virtual void SAL_CALL setContext( const css::uno::Reference< css::form::runtime::XFormControllerContext >& _context ) override; | |||
163 | virtual css::uno::Reference< css::task::XInteractionHandler > SAL_CALL getInteractionHandler() override; | |||
164 | virtual void SAL_CALL setInteractionHandler( const css::uno::Reference< css::task::XInteractionHandler >& _interactionHandler ) override; | |||
165 | ||||
166 | // XChild, base of XFormController | |||
167 | virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; | |||
168 | virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; | |||
169 | ||||
170 | // XComponent, base of XFormController | |||
171 | virtual void SAL_CALL dispose( ) override; | |||
172 | virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; | |||
173 | virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; | |||
174 | ||||
175 | // XIndexAccess, base of XFormController | |||
176 | virtual ::sal_Int32 SAL_CALL getCount( ) override; | |||
177 | virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; | |||
178 | ||||
179 | // XElementAccess, base of XIndexAccess | |||
180 | virtual css::uno::Type SAL_CALL getElementType( ) override; | |||
181 | virtual sal_Bool SAL_CALL hasElements( ) override; | |||
182 | ||||
183 | // XEnumerationAccess, base of XElementAccess | |||
184 | virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override; | |||
185 | ||||
186 | // XModifyBroadcaster, base of XFormController | |||
187 | virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; | |||
188 | virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; | |||
189 | ||||
190 | // XConfirmDeleteBroadcaster, base of XFormController | |||
191 | virtual void SAL_CALL addConfirmDeleteListener( const css::uno::Reference< css::form::XConfirmDeleteListener >& aListener ) override; | |||
192 | virtual void SAL_CALL removeConfirmDeleteListener( const css::uno::Reference< css::form::XConfirmDeleteListener >& aListener ) override; | |||
193 | ||||
194 | // XSQLErrorBroadcaster, base of XFormController | |||
195 | virtual void SAL_CALL addSQLErrorListener( const css::uno::Reference< css::sdb::XSQLErrorListener >& Listener ) override; | |||
196 | virtual void SAL_CALL removeSQLErrorListener( const css::uno::Reference< css::sdb::XSQLErrorListener >& Listener ) override; | |||
197 | ||||
198 | // XRowSetApproveBroadcaster, base of XFormController | |||
199 | virtual void SAL_CALL addRowSetApproveListener( const css::uno::Reference< css::sdb::XRowSetApproveListener >& listener ) override; | |||
200 | virtual void SAL_CALL removeRowSetApproveListener( const css::uno::Reference< css::sdb::XRowSetApproveListener >& listener ) override; | |||
201 | ||||
202 | // XDatabaseParameterBroadcaster2, base of XFormController | |||
203 | virtual void SAL_CALL addDatabaseParameterListener( const css::uno::Reference< css::form::XDatabaseParameterListener >& aListener ) override; | |||
204 | virtual void SAL_CALL removeDatabaseParameterListener( const css::uno::Reference< css::form::XDatabaseParameterListener >& aListener ) override; | |||
205 | ||||
206 | // XDatabaseParameterBroadcaster, base of XDatabaseParameterBroadcaster2 | |||
207 | virtual void SAL_CALL addParameterListener( const css::uno::Reference< css::form::XDatabaseParameterListener >& aListener ) override; | |||
208 | virtual void SAL_CALL removeParameterListener( const css::uno::Reference< css::form::XDatabaseParameterListener >& aListener ) override; | |||
209 | ||||
210 | // XModeSelector, base of XFormController | |||
211 | virtual void SAL_CALL setMode( const OUString& aMode ) override; | |||
212 | virtual OUString SAL_CALL getMode( ) override; | |||
213 | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedModes( ) override; | |||
214 | virtual sal_Bool SAL_CALL supportsMode( const OUString& aMode ) override; | |||
215 | ||||
216 | // XTabController, base of XFormController | |||
217 | virtual void SAL_CALL setModel(const css::uno::Reference< css::awt::XTabControllerModel > & Model) override; | |||
218 | virtual css::uno::Reference< css::awt::XTabControllerModel > SAL_CALL getModel() override; | |||
219 | virtual void SAL_CALL setContainer(const css::uno::Reference< css::awt::XControlContainer > & Container) override; | |||
220 | virtual css::uno::Reference< css::awt::XControlContainer > SAL_CALL getContainer() override; | |||
221 | virtual css::uno::Sequence< css::uno::Reference< css::awt::XControl > > SAL_CALL getControls() override; | |||
222 | virtual void SAL_CALL autoTabOrder() override; | |||
223 | virtual void SAL_CALL activateTabOrder() override; | |||
224 | virtual void SAL_CALL activateFirst() override; | |||
225 | virtual void SAL_CALL activateLast() override; | |||
226 | ||||
227 | // XFrameActionListener | |||
228 | virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override; | |||
229 | ||||
230 | // XEventListener | |||
231 | virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; | |||
232 | ||||
233 | protected: | |||
234 | virtual ~FormControllerImpl() override; | |||
235 | }; | |||
236 | ||||
237 | SbaXDataBrowserController::FormControllerImpl::FormControllerImpl(SbaXDataBrowserController* _pOwner) | |||
238 | :m_aActivateListeners(_pOwner->getMutex()) | |||
239 | ,m_pOwner(_pOwner) | |||
240 | { | |||
241 | ||||
242 | OSL_ENSURE(m_pOwner, "SbaXDataBrowserController::FormControllerImpl::FormControllerImpl : invalid Owner !")do { if (true && (!(m_pOwner))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "242" ": "), "%s", "SbaXDataBrowserController::FormControllerImpl::FormControllerImpl : invalid Owner !" ); } } while (false); | |||
243 | } | |||
244 | ||||
245 | SbaXDataBrowserController::FormControllerImpl::~FormControllerImpl() | |||
246 | { | |||
247 | ||||
248 | } | |||
249 | ||||
250 | Reference< runtime::XFormOperations > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getFormOperations() | |||
251 | { | |||
252 | return FormOperations::createWithFormController( m_pOwner->m_xContext, this ); | |||
253 | } | |||
254 | ||||
255 | Reference< css::awt::XControl > SbaXDataBrowserController::FormControllerImpl::getCurrentControl() | |||
256 | { | |||
257 | return m_pOwner->getBrowserView() ? m_pOwner->getBrowserView()->getGridControl() : Reference< css::awt::XControl > (); | |||
258 | } | |||
259 | ||||
260 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addActivateListener(const Reference< css::form::XFormControllerListener > & l) | |||
261 | { | |||
262 | m_aActivateListeners.addInterface(l); | |||
263 | } | |||
264 | ||||
265 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeActivateListener(const Reference< css::form::XFormControllerListener > & l) | |||
266 | { | |||
267 | m_aActivateListeners.removeInterface(l); | |||
268 | } | |||
269 | ||||
270 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addChildController( const Reference< runtime::XFormController >& ) | |||
271 | { | |||
272 | // not supported | |||
273 | throw IllegalArgumentException( OUString(), *this, 1 ); | |||
274 | } | |||
275 | ||||
276 | Reference< runtime::XFormControllerContext > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getContext() | |||
277 | { | |||
278 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::getContext: no support!!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::getContext: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "278" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::getContext: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::getContext: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "278" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::getContext: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "278" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::getContext: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::getContext: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "278" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
279 | return nullptr; | |||
280 | } | |||
281 | ||||
282 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setContext( const Reference< runtime::XFormControllerContext >& /*_context*/ ) | |||
283 | { | |||
284 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::setContext: no support!!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setContext: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "284" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setContext: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::setContext: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "284" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::setContext: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "284" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setContext: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::setContext: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "284" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
285 | } | |||
286 | ||||
287 | Reference< XInteractionHandler > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getInteractionHandler() | |||
288 | { | |||
289 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::getInteractionHandler: no support!!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::getInteractionHandler: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "289" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::getInteractionHandler: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::getInteractionHandler: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "289" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::getInteractionHandler: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "289" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::getInteractionHandler: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::getInteractionHandler: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "289" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
290 | return nullptr; | |||
291 | } | |||
292 | ||||
293 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setInteractionHandler( const Reference< XInteractionHandler >& /*_interactionHandler*/ ) | |||
294 | { | |||
295 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::setInteractionHandler: no support!!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setInteractionHandler: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "295" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setInteractionHandler: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::setInteractionHandler: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "295" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::setInteractionHandler: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "295" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setInteractionHandler: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::setInteractionHandler: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "295" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
296 | } | |||
297 | ||||
298 | Reference< XInterface > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getParent( ) | |||
299 | { | |||
300 | // don't have any parent form controllers | |||
301 | return nullptr; | |||
302 | } | |||
303 | ||||
304 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setParent( const Reference< XInterface >& /*Parent*/ ) | |||
305 | { | |||
306 | throw NoSupportException( OUString(), *this ); | |||
307 | } | |||
308 | ||||
309 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::dispose( ) | |||
310 | { | |||
311 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::dispose: no, you do *not* want to do this!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::dispose: no, you do *not* want to do this!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "311" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::dispose: no, you do *not* want to do this!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::dispose: no, you do *not* want to do this!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "311" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::dispose: no, you do *not* want to do this!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "311" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::dispose: no, you do *not* want to do this!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::dispose: no, you do *not* want to do this!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "311" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
312 | } | |||
313 | ||||
314 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addEventListener( const Reference< XEventListener >& /*xListener*/ ) | |||
315 | { | |||
316 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::addEventListener: no support!!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addEventListener: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "316" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addEventListener: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addEventListener: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "316" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::addEventListener: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "316" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addEventListener: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addEventListener: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "316" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
317 | } | |||
318 | ||||
319 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeEventListener( const Reference< XEventListener >& /*aListener*/ ) | |||
320 | { | |||
321 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::removeEventListener: no support!!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeEventListener: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "321" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeEventListener: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeEventListener: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "321" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::removeEventListener: no support!!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "321" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeEventListener: no support!!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeEventListener: no support!!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "321" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
322 | } | |||
323 | ||||
324 | ::sal_Int32 SAL_CALL SbaXDataBrowserController::FormControllerImpl::getCount( ) | |||
325 | { | |||
326 | // no sub controllers, never | |||
327 | return 0; | |||
328 | } | |||
329 | ||||
330 | Any SAL_CALL SbaXDataBrowserController::FormControllerImpl::getByIndex( ::sal_Int32 /*Index*/ ) | |||
331 | { | |||
332 | // no sub controllers, never | |||
333 | throw IndexOutOfBoundsException( OUString(), *this ); | |||
334 | } | |||
335 | ||||
336 | Type SAL_CALL SbaXDataBrowserController::FormControllerImpl::getElementType( ) | |||
337 | { | |||
338 | return ::cppu::UnoType< runtime::XFormController >::get(); | |||
339 | } | |||
340 | ||||
341 | sal_Bool SAL_CALL SbaXDataBrowserController::FormControllerImpl::hasElements( ) | |||
342 | { | |||
343 | // no sub controllers, never | |||
344 | return false; | |||
345 | } | |||
346 | ||||
347 | Reference< XEnumeration > SAL_CALL SbaXDataBrowserController::FormControllerImpl::createEnumeration( ) | |||
348 | { | |||
349 | return new ::comphelper::OEnumerationByIndex( this ); | |||
350 | } | |||
351 | ||||
352 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addModifyListener( const Reference< XModifyListener >& /*_Listener*/ ) | |||
353 | { | |||
354 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::addModifyListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addModifyListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "354" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addModifyListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addModifyListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "354" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::addModifyListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "354" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addModifyListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addModifyListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "354" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
355 | } | |||
356 | ||||
357 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeModifyListener( const Reference< XModifyListener >& /*_Listener*/ ) | |||
358 | { | |||
359 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::removeModifyListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeModifyListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "359" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeModifyListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeModifyListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "359" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::removeModifyListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "359" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeModifyListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeModifyListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "359" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
360 | } | |||
361 | ||||
362 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener( const Reference< XConfirmDeleteListener >& /*_Listener*/ ) | |||
363 | { | |||
364 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "364" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "364" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "364" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "364" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
365 | } | |||
366 | ||||
367 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener( const Reference< XConfirmDeleteListener >& /*_Listener*/ ) | |||
368 | { | |||
369 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "369" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "369" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "369" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "369" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
370 | } | |||
371 | ||||
372 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener( const Reference< XSQLErrorListener >& /*_Listener*/ ) | |||
373 | { | |||
374 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "374" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "374" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "374" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "374" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
375 | } | |||
376 | ||||
377 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener( const Reference< XSQLErrorListener >& /*_Listener*/ ) | |||
378 | { | |||
379 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "379" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "379" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "379" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "379" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
380 | } | |||
381 | ||||
382 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener( const Reference< XRowSetApproveListener >& /*_Listener*/ ) | |||
383 | { | |||
384 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "384" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "384" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "384" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "384" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
385 | } | |||
386 | ||||
387 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener( const Reference< XRowSetApproveListener >& /*_Listener*/ ) | |||
388 | { | |||
389 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "389" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "389" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "389" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "389" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
390 | } | |||
391 | ||||
392 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener( const Reference< XDatabaseParameterListener >& /*_Listener*/ ) | |||
393 | { | |||
394 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "394" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "394" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "394" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "394" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
395 | } | |||
396 | ||||
397 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener( const Reference< XDatabaseParameterListener >& /*_Listener*/ ) | |||
398 | { | |||
399 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "399" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "399" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "399" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "399" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
400 | } | |||
401 | ||||
402 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addParameterListener( const Reference< XDatabaseParameterListener >& /*_Listener*/ ) | |||
403 | { | |||
404 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::addParameterListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addParameterListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "404" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addParameterListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addParameterListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "404" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::addParameterListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "404" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::addParameterListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::addParameterListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "404" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
405 | } | |||
406 | ||||
407 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeParameterListener( const Reference< XDatabaseParameterListener >& /*_Listener*/ ) | |||
408 | { | |||
409 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::FormControllerImpl::removeParameterListener: no support!" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeParameterListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "409" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeParameterListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeParameterListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "409" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::removeParameterListener: no support!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "409" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::removeParameterListener: no support!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::removeParameterListener: no support!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "409" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
410 | } | |||
411 | ||||
412 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setMode( const OUString& _rMode ) | |||
413 | { | |||
414 | if ( !supportsMode( _rMode ) ) | |||
415 | throw NoSupportException(); | |||
416 | } | |||
417 | ||||
418 | OUString SAL_CALL SbaXDataBrowserController::FormControllerImpl::getMode( ) | |||
419 | { | |||
420 | return "DataMode"; | |||
421 | } | |||
422 | ||||
423 | Sequence< OUString > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getSupportedModes( ) | |||
424 | { | |||
425 | Sequence< OUString > aModes { "DataMode" }; | |||
426 | return aModes; | |||
427 | } | |||
428 | ||||
429 | sal_Bool SAL_CALL SbaXDataBrowserController::FormControllerImpl::supportsMode( const OUString& aMode ) | |||
430 | { | |||
431 | return aMode == "DataMode"; | |||
432 | } | |||
433 | ||||
434 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setModel(const Reference< css::awt::XTabControllerModel > & /*Model*/) | |||
435 | { | |||
436 | SAL_WARN("dbaccess.ui","SbaXDataBrowserController::FormControllerImpl::setModel : invalid call, can't change my model !")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setModel : invalid call, can't change my model !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "436" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setModel : invalid call, can't change my model !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::setModel : invalid call, can't change my model !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "436" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::setModel : invalid call, can't change my model !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "436" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setModel : invalid call, can't change my model !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::setModel : invalid call, can't change my model !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "436" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
437 | } | |||
438 | ||||
439 | Reference< css::awt::XTabControllerModel > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getModel() | |||
440 | { | |||
441 | return Reference< XTabControllerModel >(m_pOwner->getRowSet(), UNO_QUERY); | |||
442 | } | |||
443 | ||||
444 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setContainer(const Reference< css::awt::XControlContainer > &) | |||
445 | { | |||
446 | SAL_WARN("dbaccess.ui","SbaXDataBrowserController::FormControllerImpl::setContainer : invalid call, can't change my container !")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setContainer : invalid call, can't change my container !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "446" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setContainer : invalid call, can't change my container !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::setContainer : invalid call, can't change my container !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "446" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::setContainer : invalid call, can't change my container !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "446" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::setContainer : invalid call, can't change my container !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::setContainer : invalid call, can't change my container !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "446" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
447 | } | |||
448 | ||||
449 | Reference< css::awt::XControlContainer > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getContainer() | |||
450 | { | |||
451 | if (m_pOwner->getBrowserView()) | |||
452 | return m_pOwner->getBrowserView()->getContainer(); | |||
453 | return Reference< css::awt::XControlContainer > (); | |||
454 | } | |||
455 | ||||
456 | Sequence< Reference< css::awt::XControl > > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getControls() | |||
457 | { | |||
458 | if (m_pOwner->getBrowserView()) | |||
459 | { | |||
460 | Reference< css::awt::XControl > xGrid = m_pOwner->getBrowserView()->getGridControl(); | |||
461 | return Sequence< Reference< css::awt::XControl > >(&xGrid, 1); | |||
462 | } | |||
463 | return Sequence< Reference< css::awt::XControl > >(); | |||
464 | } | |||
465 | ||||
466 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::autoTabOrder() | |||
467 | { | |||
468 | SAL_WARN("dbaccess.ui","SbaXDataBrowserController::FormControllerImpl::autoTabOrder : nothing to do (always have only one control) !")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::autoTabOrder : nothing to do (always have only one control) !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "468" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::autoTabOrder : nothing to do (always have only one control) !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::autoTabOrder : nothing to do (always have only one control) !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "468" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::autoTabOrder : nothing to do (always have only one control) !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "468" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::autoTabOrder : nothing to do (always have only one control) !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::autoTabOrder : nothing to do (always have only one control) !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "468" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
469 | } | |||
470 | ||||
471 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::activateTabOrder() | |||
472 | { | |||
473 | SAL_WARN("dbaccess.ui","SbaXDataBrowserController::FormControllerImpl::activateTabOrder : nothing to do (always have only one control) !")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::FormControllerImpl::activateTabOrder : nothing to do (always have only one control) !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "473" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::activateTabOrder : nothing to do (always have only one control) !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::activateTabOrder : nothing to do (always have only one control) !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "473" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::FormControllerImpl::activateTabOrder : nothing to do (always have only one control) !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "473" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::FormControllerImpl::activateTabOrder : nothing to do (always have only one control) !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::FormControllerImpl::activateTabOrder : nothing to do (always have only one control) !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "473" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
474 | } | |||
475 | ||||
476 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::activateFirst() | |||
477 | { | |||
478 | if (m_pOwner->getBrowserView()) | |||
479 | m_pOwner->getBrowserView()->getVclControl()->ActivateCell(); | |||
480 | } | |||
481 | ||||
482 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::activateLast() | |||
483 | { | |||
484 | if (m_pOwner->getBrowserView()) | |||
485 | m_pOwner->getBrowserView()->getVclControl()->ActivateCell(); | |||
486 | } | |||
487 | ||||
488 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::frameAction(const css::frame::FrameActionEvent& /*aEvent*/) | |||
489 | { | |||
490 | } | |||
491 | ||||
492 | void SAL_CALL SbaXDataBrowserController::FormControllerImpl::disposing(const css::lang::EventObject& /*Source*/) | |||
493 | { | |||
494 | // nothing to do | |||
495 | // we don't add ourself as listener to any broadcasters, so we are not responsible for removing us | |||
496 | } | |||
497 | ||||
498 | // SbaXDataBrowserController | |||
499 | Sequence< Type > SAL_CALL SbaXDataBrowserController::getTypes( ) | |||
500 | { | |||
501 | return ::comphelper::concatSequences( | |||
502 | SbaXDataBrowserController_Base::getTypes(), | |||
503 | m_pFormControllerImpl->getTypes() | |||
504 | ); | |||
505 | } | |||
506 | ||||
507 | Sequence< sal_Int8 > SAL_CALL SbaXDataBrowserController::getImplementationId( ) | |||
508 | { | |||
509 | return css::uno::Sequence<sal_Int8>(); | |||
510 | } | |||
511 | ||||
512 | Any SAL_CALL SbaXDataBrowserController::queryInterface(const Type& _rType) | |||
513 | { | |||
514 | // check for our additional interfaces | |||
515 | Any aRet = SbaXDataBrowserController_Base::queryInterface(_rType); | |||
516 | ||||
517 | // check for our aggregate (implementing the XFormController) | |||
518 | if (!aRet.hasValue()) | |||
519 | aRet = m_xFormControllerImpl->queryAggregation(_rType); | |||
520 | ||||
521 | // no more to offer | |||
522 | return aRet; | |||
523 | } | |||
524 | ||||
525 | SbaXDataBrowserController::SbaXDataBrowserController(const Reference< css::uno::XComponentContext >& _rM) | |||
526 | :SbaXDataBrowserController_Base(_rM) | |||
527 | ,m_nRowSetPrivileges(0) | |||
528 | ,m_aAsyncGetCellFocus(LINK(this, SbaXDataBrowserController, OnAsyncGetCellFocus)::tools::detail::makeLink( ::tools::detail::castTo<SbaXDataBrowserController *>(this), &SbaXDataBrowserController::LinkStubOnAsyncGetCellFocus )) | |||
529 | ,m_aAsyncDisplayError( LINK( this, SbaXDataBrowserController, OnAsyncDisplayError )::tools::detail::makeLink( ::tools::detail::castTo<SbaXDataBrowserController *>(this), &SbaXDataBrowserController::LinkStubOnAsyncDisplayError ) ) | |||
530 | ,m_sStateSaveRecord(DBA_RES(RID_STR_SAVE_CURRENT_RECORD)::dbaccess::ResourceManager::loadString( reinterpret_cast< char const *>("RID_STR_SAVE_CURRENT_RECORD" "\004" u8"Save current record" ) )) | |||
531 | ,m_sStateUndoRecord(DBA_RES(RID_STR_UNDO_MODIFY_RECORD)::dbaccess::ResourceManager::loadString( reinterpret_cast< char const *>("RID_STR_UNDO_MODIFY_RECORD" "\004" u8"Undo: Data Input" ) )) | |||
532 | ,m_sModuleIdentifier( OUString( "com.sun.star.sdb.DataSourceBrowser" ) ) | |||
533 | ,m_pFormControllerImpl(nullptr) | |||
534 | ,m_nFormActionNestingLevel(0) | |||
535 | ,m_bLoadCanceled( false ) | |||
536 | ,m_bCannotSelectUnfiltered( true ) | |||
537 | { | |||
538 | // create the form controller aggregate | |||
539 | osl_atomic_increment(&m_refCount)__sync_add_and_fetch((&m_refCount), 1); | |||
540 | { | |||
541 | m_pFormControllerImpl = new FormControllerImpl(this); | |||
542 | m_xFormControllerImpl = m_pFormControllerImpl; | |||
543 | m_xFormControllerImpl->setDelegator(*this); | |||
544 | } | |||
545 | osl_atomic_decrement(&m_refCount)__sync_sub_and_fetch((&m_refCount), 1); | |||
546 | ||||
547 | m_aInvalidateClipboard.SetDebugName("dbaui::SbaXDataBrowserController m_aInvalidateClipboard"); | |||
548 | m_aInvalidateClipboard.SetInvokeHandler(LINK(this, SbaXDataBrowserController, OnInvalidateClipboard)::tools::detail::makeLink( ::tools::detail::castTo<SbaXDataBrowserController *>(this), &SbaXDataBrowserController::LinkStubOnInvalidateClipboard )); | |||
549 | m_aInvalidateClipboard.SetTimeout(300); | |||
550 | } | |||
551 | ||||
552 | SbaXDataBrowserController::~SbaXDataBrowserController() | |||
553 | { | |||
554 | // deleteView(); | |||
555 | // release the aggregated form controller | |||
556 | if (m_xFormControllerImpl.is()) | |||
557 | { | |||
558 | Reference< XInterface > xEmpty; | |||
559 | m_xFormControllerImpl->setDelegator(xEmpty); | |||
560 | } | |||
561 | ||||
562 | } | |||
563 | ||||
564 | void SbaXDataBrowserController::startFrameListening( const Reference< XFrame >& _rxFrame ) | |||
565 | { | |||
566 | SbaXDataBrowserController_Base::startFrameListening( _rxFrame ); | |||
567 | ||||
568 | Reference< XFrameActionListener > xAggListener; | |||
569 | if ( m_xFormControllerImpl.is() ) | |||
570 | m_xFormControllerImpl->queryAggregation( cppu::UnoType<XFrameActionListener>::get() ) >>= xAggListener; | |||
571 | ||||
572 | if ( _rxFrame.is() && xAggListener.is() ) | |||
573 | _rxFrame->addFrameActionListener( xAggListener ); | |||
574 | } | |||
575 | ||||
576 | void SbaXDataBrowserController::stopFrameListening( const Reference< XFrame >& _rxFrame ) | |||
577 | { | |||
578 | SbaXDataBrowserController_Base::stopFrameListening( _rxFrame ); | |||
579 | ||||
580 | Reference< XFrameActionListener > xAggListener; | |||
581 | if ( m_xFormControllerImpl.is() ) | |||
582 | m_xFormControllerImpl->queryAggregation( cppu::UnoType<XFrameActionListener>::get() ) >>= xAggListener; | |||
583 | ||||
584 | if ( _rxFrame.is() && xAggListener.is() ) | |||
585 | _rxFrame->removeFrameActionListener( xAggListener ); | |||
586 | } | |||
587 | ||||
588 | void SbaXDataBrowserController::onStartLoading( const Reference< XLoadable >& _rxLoadable ) | |||
589 | { | |||
590 | m_bLoadCanceled = false; | |||
591 | m_bCannotSelectUnfiltered = false; | |||
592 | ||||
593 | Reference< XWarningsSupplier > xWarnings( _rxLoadable, UNO_QUERY ); | |||
594 | if ( xWarnings.is() ) | |||
595 | { | |||
596 | try | |||
597 | { | |||
598 | xWarnings->clearWarnings(); | |||
599 | } | |||
600 | catch(const SQLException& ) | |||
601 | { | |||
602 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "602" ": ", "dbaccess" );; | |||
603 | } | |||
604 | } | |||
605 | } | |||
606 | ||||
607 | void SbaXDataBrowserController::impl_checkForCannotSelectUnfiltered( const SQLExceptionInfo& _rError ) | |||
608 | { | |||
609 | ::connectivity::ErrorCode nErrorCode( connectivity::SQLError::getErrorCode( sdb::ErrorCondition::DATA_CANNOT_SELECT_UNFILTERED ) ); | |||
610 | if ( static_cast<const SQLException*>(_rError)->ErrorCode == nErrorCode ) | |||
611 | { | |||
612 | m_bCannotSelectUnfiltered = true; | |||
613 | InvalidateFeature( ID_BROWSER_FILTERCRIT( 10000 + 715 ) ); | |||
614 | } | |||
615 | } | |||
616 | ||||
617 | bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _rxLoadable ) | |||
618 | { | |||
619 | weld::WaitObject aWO(getFrameWeld()); | |||
620 | ||||
621 | onStartLoading( _rxLoadable ); | |||
622 | ||||
623 | FormErrorHelper aReportError(this); | |||
624 | if (_rxLoadable->isLoaded()) | |||
625 | _rxLoadable->reload(); | |||
626 | else | |||
627 | _rxLoadable->load(); | |||
628 | ||||
629 | m_xParser.clear(); | |||
630 | const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
631 | if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING"EscapeProcessing"))) | |||
632 | xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER"SingleSelectQueryComposer") >>= m_xParser; | |||
633 | #if 0 | |||
634 | { | |||
635 | const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY ); | |||
636 | const Reference< XSingleSelectQueryAnalyzer > xAnalyzer( xRowSetProps->getPropertyValue( PROPERTY_SINGLESELECTQUERYCOMPOSER"SingleSelectQueryComposer" ), UNO_QUERY ); | |||
637 | if ( xAnalyzer.is() ) | |||
638 | { | |||
639 | const Reference< XIndexAccess > xOrderColumns( xAnalyzer->getOrderColumns(), UNO_SET_THROW ); | |||
640 | const sal_Int32 nOrderColumns( xOrderColumns->getCount() ); | |||
641 | for ( sal_Int32 c=0; c<nOrderColumns; ++c ) | |||
642 | { | |||
643 | const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW ); | |||
644 | OUString sColumnName; | |||
645 | OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumnName)do { if (!(xOrderColumn->getPropertyValue( "Name" ) >>= sColumnName)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "645" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
646 | OUString sTableName; | |||
647 | OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName)do { if (!(xOrderColumn->getPropertyValue( "TableName" ) >>= sTableName)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "647" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
648 | (void)sColumnName; | |||
649 | (void)sTableName; | |||
650 | } | |||
651 | } | |||
652 | } | |||
653 | #endif | |||
654 | ||||
655 | Reference< XWarningsSupplier > xWarnings( _rxLoadable, UNO_QUERY ); | |||
656 | if ( xWarnings.is() ) | |||
657 | { | |||
658 | try | |||
659 | { | |||
660 | SQLExceptionInfo aInfo( xWarnings->getWarnings() ); | |||
661 | if ( aInfo.isValid() ) | |||
662 | { | |||
663 | showError( aInfo ); | |||
664 | impl_checkForCannotSelectUnfiltered( aInfo ); | |||
665 | } | |||
666 | } | |||
667 | catch(const SQLException& ) | |||
668 | { | |||
669 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "669" ": ", "dbaccess" );; | |||
670 | } | |||
671 | } | |||
672 | ||||
673 | return _rxLoadable->isLoaded(); | |||
674 | } | |||
675 | ||||
676 | void SbaXDataBrowserController::initFormatter() | |||
677 | { | |||
678 | // create a formatter working with the connections format supplier | |||
679 | Reference< css::util::XNumberFormatsSupplier > xSupplier(::dbtools::getNumberFormats(::dbtools::getConnection(m_xRowSet), true, getORB())); | |||
680 | ||||
681 | if(xSupplier.is()) | |||
682 | { | |||
683 | // create a new formatter | |||
684 | m_xFormatter.set(util::NumberFormatter::create(getORB()), UNO_QUERY_THROW); | |||
685 | m_xFormatter->attachNumberFormatsSupplier(xSupplier); | |||
686 | } | |||
687 | else // clear the formatter | |||
688 | m_xFormatter = nullptr; | |||
689 | } | |||
690 | ||||
691 | void SbaXDataBrowserController::describeSupportedFeatures() | |||
692 | { | |||
693 | SbaXDataBrowserController_Base::describeSupportedFeatures(); | |||
694 | implDescribeSupportedFeature( ".uno:FormSlots/undoRecord", ID_BROWSER_UNDORECORD( 10000 + 630 ), CommandGroup::CONTROLS ); | |||
695 | implDescribeSupportedFeature( ".uno:FormController/undoRecord", ID_BROWSER_UNDORECORD( 10000 + 630 ), CommandGroup::CONTROLS ); | |||
696 | implDescribeSupportedFeature( ".uno:RecUndo", ID_BROWSER_UNDORECORD( 10000 + 630 ), CommandGroup::CONTROLS ); | |||
697 | implDescribeSupportedFeature( ".uno:FormSlots/saveRecord", ID_BROWSER_SAVERECORD( 10000 + 627 ), CommandGroup::CONTROLS ); | |||
698 | implDescribeSupportedFeature( ".uno:FormController/saveRecord", ID_BROWSER_SAVERECORD( 10000 + 627 ), CommandGroup::CONTROLS ); | |||
699 | implDescribeSupportedFeature( ".uno:RecSave", ID_BROWSER_SAVERECORD( 10000 + 627 ), CommandGroup::CONTROLS ); | |||
700 | implDescribeSupportedFeature( ".uno:Save", ID_BROWSER_SAVERECORD( 10000 + 627 ), CommandGroup::DOCUMENT ); | |||
701 | implDescribeSupportedFeature( ".uno:RecSearch", SID_FM_SEARCH( 10000 + 725 ), CommandGroup::CONTROLS ); | |||
702 | implDescribeSupportedFeature( ".uno:AutoFilter", SID_FM_AUTOFILTER( 10000 + 716 ), CommandGroup::CONTROLS ); | |||
703 | implDescribeSupportedFeature( ".uno:Refresh", SID_FM_REFRESH( 10000 + 724 ), CommandGroup::CONTROLS ); | |||
704 | implDescribeSupportedFeature( ".uno:OrderCrit", SID_FM_ORDERCRIT( 10000 + 714 ), CommandGroup::CONTROLS ); | |||
705 | implDescribeSupportedFeature( ".uno:RemoveFilterSort", SID_FM_REMOVE_FILTER_SORT( 10000 + 711 ),CommandGroup::CONTROLS ); | |||
706 | implDescribeSupportedFeature( ".uno:FormFiltered", SID_FM_FORM_FILTERED( 10000 + 723 ), CommandGroup::CONTROLS ); | |||
707 | implDescribeSupportedFeature( ".uno:FilterCrit", SID_FM_FILTERCRIT( 10000 + 715 ), CommandGroup::CONTROLS ); | |||
708 | implDescribeSupportedFeature( ".uno:Sortup", ID_BROWSER_SORTUP( 10000 + 712 ), CommandGroup::CONTROLS ); | |||
709 | implDescribeSupportedFeature( ".uno:SortDown", ID_BROWSER_SORTDOWN( 10000 + 713 ), CommandGroup::CONTROLS ); | |||
710 | implDescribeSupportedFeature( ".uno:FormSlots/deleteRecord", SID_FM_DELETEROWS( 10000 + 610 ), CommandGroup::EDIT ); | |||
711 | implDescribeSupportedFeature( ".uno:FormSlots/insertRecord", ID_BROWSER_INSERT_ROW(((((((10000 + 1499) + 1) + 499) + 1) + 100) + 1) + 46), CommandGroup::INSERT ); | |||
712 | } | |||
713 | ||||
714 | bool SbaXDataBrowserController::Construct(vcl::Window* pParent) | |||
715 | { | |||
716 | // create/initialize the form and the grid model | |||
717 | m_xRowSet = CreateForm(); | |||
718 | if (!m_xRowSet.is()) | |||
| ||||
719 | return false; | |||
720 | ||||
721 | m_xColumnsSupplier.set(m_xRowSet,UNO_QUERY); | |||
722 | m_xLoadable.set(m_xRowSet,UNO_QUERY); | |||
723 | ||||
724 | Reference< XPropertySet > xFormProperties( m_xRowSet, UNO_QUERY ); | |||
725 | if ( !InitializeForm( xFormProperties ) ) | |||
726 | return false; | |||
727 | ||||
728 | m_xGridModel = CreateGridModel(); | |||
729 | if (!m_xGridModel.is()) | |||
730 | return false; | |||
731 | ||||
732 | // set the formatter if available | |||
733 | initFormatter(); | |||
734 | ||||
735 | // we want to have a grid with a "flat" border | |||
736 | Reference< XPropertySet > xGridSet(m_xGridModel, UNO_QUERY); | |||
737 | if ( xGridSet.is() ) | |||
738 | xGridSet->setPropertyValue(PROPERTY_BORDER"Border", makeAny(sal_Int16(2))); | |||
739 | ||||
740 | ||||
741 | // marry them | |||
742 | Reference< css::container::XNameContainer > xNameCont(m_xRowSet, UNO_QUERY); | |||
743 | { | |||
744 | OUString sText(DBA_RES(STR_DATASOURCE_GRIDCONTROL_NAME)::dbaccess::ResourceManager::loadString( reinterpret_cast< char const *>("STR_DATASOURCE_GRIDCONTROL_NAME" "\004" u8"Data source table view" ) )); | |||
745 | xNameCont->insertByName(sText, makeAny(m_xGridModel)); | |||
746 | } | |||
747 | ||||
748 | // create the view | |||
749 | setView( VclPtr<UnoDataBrowserView>::Create( pParent, *this, getORB() ) ); | |||
750 | if (!getBrowserView()) | |||
751 | return false; | |||
752 | ||||
753 | // late construction | |||
754 | bool bSuccess = false; | |||
755 | try | |||
756 | { | |||
757 | getBrowserView()->Construct(getControlModel()); | |||
758 | bSuccess = true; | |||
759 | } | |||
760 | catch(SQLException&) | |||
761 | { | |||
762 | } | |||
763 | catch(Exception&) | |||
764 | { | |||
765 | SAL_WARN("dbaccess.ui","SbaXDataBrowserController::Construct : the construction of UnoDataBrowserView failed !")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::Construct : the construction of UnoDataBrowserView failed !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "765" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::Construct : the construction of UnoDataBrowserView failed !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::Construct : the construction of UnoDataBrowserView failed !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "765" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::Construct : the construction of UnoDataBrowserView failed !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "765" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::Construct : the construction of UnoDataBrowserView failed !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::Construct : the construction of UnoDataBrowserView failed !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "765" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
766 | } | |||
767 | ||||
768 | if (!bSuccess) | |||
769 | { | |||
770 | // deleteView(); | |||
771 | return false; | |||
772 | } | |||
773 | ||||
774 | // now that we have a view we can create the clipboard listener | |||
775 | m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() ); | |||
776 | m_aSystemClipboard.StartClipboardListening( ); | |||
777 | ||||
778 | m_pClipboardNotifier = new TransferableClipboardListener( LINK( this, SbaXDataBrowserController, OnClipboardChanged )::tools::detail::makeLink( ::tools::detail::castTo<SbaXDataBrowserController *>(this), &SbaXDataBrowserController::LinkStubOnClipboardChanged ) ); | |||
779 | m_pClipboardNotifier->AddListener( getView() ); | |||
780 | ||||
781 | // this call create the toolbox | |||
782 | SbaXDataBrowserController_Base::Construct(pParent); | |||
783 | ||||
784 | getBrowserView()->Show(); | |||
785 | ||||
786 | // set the callbacks for the grid control | |||
787 | SbaGridControl* pVclGrid = getBrowserView()->getVclControl(); | |||
788 | OSL_ENSURE(pVclGrid, "SbaXDataBrowserController::Construct : have no VCL control !")do { if (true && (!(pVclGrid))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "788" ": "), "%s", "SbaXDataBrowserController::Construct : have no VCL control !" ); } } while (false); | |||
789 | pVclGrid->SetMasterListener(this); | |||
790 | ||||
791 | // add listeners... | |||
792 | ||||
793 | // ... to the form model | |||
794 | Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
795 | if (xFormSet.is()) | |||
796 | { | |||
797 | xFormSet->addPropertyChangeListener(PROPERTY_ISNEW"IsNew", static_cast<XPropertyChangeListener*>(this)); | |||
798 | xFormSet->addPropertyChangeListener(PROPERTY_ISMODIFIED"IsModified", static_cast<XPropertyChangeListener*>(this)); | |||
799 | xFormSet->addPropertyChangeListener(PROPERTY_ROWCOUNT"RowCount", static_cast<XPropertyChangeListener*>(this)); | |||
800 | xFormSet->addPropertyChangeListener(PROPERTY_ACTIVECOMMAND"ActiveCommand", static_cast<XPropertyChangeListener*>(this)); | |||
801 | xFormSet->addPropertyChangeListener(PROPERTY_ORDER"Order", static_cast<XPropertyChangeListener*>(this)); | |||
802 | xFormSet->addPropertyChangeListener(PROPERTY_FILTER"Filter", static_cast<XPropertyChangeListener*>(this)); | |||
803 | xFormSet->addPropertyChangeListener(PROPERTY_HAVING_CLAUSE"HavingClause", static_cast<XPropertyChangeListener*>(this)); | |||
804 | xFormSet->addPropertyChangeListener(PROPERTY_APPLYFILTER"ApplyFilter", static_cast<XPropertyChangeListener*>(this)); | |||
805 | } | |||
806 | Reference< css::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); | |||
807 | if (xFormError.is()) | |||
808 | xFormError->addSQLErrorListener(static_cast<css::sdb::XSQLErrorListener*>(this)); | |||
809 | ||||
810 | if (m_xLoadable.is()) | |||
811 | m_xLoadable->addLoadListener(this); | |||
812 | ||||
813 | Reference< css::form::XDatabaseParameterBroadcaster > xFormParameter(getRowSet(), UNO_QUERY); | |||
814 | if (xFormParameter.is()) | |||
815 | xFormParameter->addParameterListener(static_cast<css::form::XDatabaseParameterListener*>(this)); | |||
816 | ||||
817 | addModelListeners(getControlModel()); | |||
818 | addControlListeners(getBrowserView()->getGridControl()); | |||
819 | ||||
820 | // load the form | |||
821 | return LoadForm(); | |||
822 | } | |||
823 | ||||
824 | bool SbaXDataBrowserController::LoadForm() | |||
825 | { | |||
826 | reloadForm( m_xLoadable ); | |||
827 | return true; | |||
828 | } | |||
829 | ||||
830 | void SbaXDataBrowserController::AddColumnListener(const Reference< XPropertySet > & /*xCol*/) | |||
831 | { | |||
832 | // we're not interested in any column properties... | |||
833 | } | |||
834 | ||||
835 | void SbaXDataBrowserController::RemoveColumnListener(const Reference< XPropertySet > & /*xCol*/) | |||
836 | { | |||
837 | } | |||
838 | ||||
839 | Reference< XRowSet > SbaXDataBrowserController::CreateForm() | |||
840 | { | |||
841 | return Reference< XRowSet > ( | |||
842 | getORB()->getServiceManager()->createInstanceWithContext("com.sun.star.form.component.Form", getORB()), | |||
843 | UNO_QUERY); | |||
844 | } | |||
845 | ||||
846 | Reference< css::form::XFormComponent > SbaXDataBrowserController::CreateGridModel() | |||
847 | { | |||
848 | return Reference< css::form::XFormComponent > ( | |||
849 | getORB()->getServiceManager()->createInstanceWithContext("com.sun.star.form.component.GridControl", getORB()), | |||
850 | UNO_QUERY); | |||
851 | } | |||
852 | ||||
853 | void SbaXDataBrowserController::addModelListeners(const Reference< css::awt::XControlModel > & _xGridControlModel) | |||
854 | { | |||
855 | // ... all the grid columns | |||
856 | addColumnListeners(_xGridControlModel); | |||
857 | ||||
858 | // (we are interested in all columns the grid has (and only in these) so we have to listen to the container, too) | |||
859 | Reference< css::container::XContainer > xColContainer(_xGridControlModel, UNO_QUERY); | |||
860 | if (xColContainer.is()) | |||
861 | xColContainer->addContainerListener(static_cast<css::container::XContainerListener*>(this)); | |||
862 | ||||
863 | Reference< css::form::XReset > xReset(_xGridControlModel, UNO_QUERY); | |||
864 | if (xReset.is()) | |||
865 | xReset->addResetListener(static_cast<css::form::XResetListener*>(this)); | |||
866 | } | |||
867 | ||||
868 | void SbaXDataBrowserController::removeModelListeners(const Reference< XControlModel > & _xGridControlModel) | |||
869 | { | |||
870 | // every single column model | |||
871 | Reference< XIndexContainer > xColumns(_xGridControlModel, UNO_QUERY); | |||
872 | if (xColumns.is()) | |||
873 | { | |||
874 | sal_Int32 nCount = xColumns->getCount(); | |||
875 | for (sal_Int32 i=0; i < nCount; ++i) | |||
876 | { | |||
877 | Reference< XPropertySet > xCol(xColumns->getByIndex(i),UNO_QUERY); | |||
878 | RemoveColumnListener(xCol); | |||
879 | } | |||
880 | } | |||
881 | ||||
882 | Reference< XContainer > xColContainer(_xGridControlModel, UNO_QUERY); | |||
883 | if (xColContainer.is()) | |||
884 | xColContainer->removeContainerListener( this ); | |||
885 | ||||
886 | Reference< XReset > xReset(_xGridControlModel, UNO_QUERY); | |||
887 | if (xReset.is()) | |||
888 | xReset->removeResetListener( this ); | |||
889 | } | |||
890 | ||||
891 | void SbaXDataBrowserController::addControlListeners(const Reference< css::awt::XControl > & _xGridControl) | |||
892 | { | |||
893 | // to ge the 'modified' for the current cell | |||
894 | Reference< XModifyBroadcaster > xBroadcaster(getBrowserView()->getGridControl(), UNO_QUERY); | |||
895 | if (xBroadcaster.is()) | |||
896 | xBroadcaster->addModifyListener(static_cast<XModifyListener*>(this)); | |||
897 | ||||
898 | // introduce ourself as dispatch provider for the grid | |||
899 | Reference< XDispatchProviderInterception > xInterception(getBrowserView()->getGridControl(), UNO_QUERY); | |||
900 | if (xInterception.is()) | |||
901 | xInterception->registerDispatchProviderInterceptor(static_cast<XDispatchProviderInterceptor*>(this)); | |||
902 | ||||
903 | // add as focus listener to the control (needed for the form controller functionality) | |||
904 | Reference< XWindow > xWindow(_xGridControl, UNO_QUERY); | |||
905 | if (xWindow.is()) | |||
906 | xWindow->addFocusListener(this); | |||
907 | } | |||
908 | ||||
909 | void SbaXDataBrowserController::removeControlListeners(const Reference< css::awt::XControl > & _xGridControl) | |||
910 | { | |||
911 | Reference< XModifyBroadcaster > xBroadcaster(_xGridControl, UNO_QUERY); | |||
912 | if (xBroadcaster.is()) | |||
913 | xBroadcaster->removeModifyListener(static_cast<XModifyListener*>(this)); | |||
914 | ||||
915 | Reference< XDispatchProviderInterception > xInterception(_xGridControl, UNO_QUERY); | |||
916 | if (xInterception.is()) | |||
917 | xInterception->releaseDispatchProviderInterceptor(static_cast<XDispatchProviderInterceptor*>(this)); | |||
918 | ||||
919 | Reference< XWindow > xWindow(_xGridControl, UNO_QUERY); | |||
920 | if (xWindow.is()) | |||
921 | xWindow->removeFocusListener(this); | |||
922 | } | |||
923 | ||||
924 | void SAL_CALL SbaXDataBrowserController::focusGained(const FocusEvent& /*e*/) | |||
925 | { | |||
926 | // notify our activate listeners (registered on the form controller aggregate) | |||
927 | EventObject aEvt(*this); | |||
928 | ::comphelper::OInterfaceIteratorHelper2 aIter(m_pFormControllerImpl->m_aActivateListeners); | |||
929 | while (aIter.hasMoreElements()) | |||
930 | static_cast<XFormControllerListener*>(aIter.next())->formActivated(aEvt); | |||
931 | } | |||
932 | ||||
933 | void SAL_CALL SbaXDataBrowserController::focusLost(const FocusEvent& e) | |||
934 | { | |||
935 | // some general checks | |||
936 | if (!getBrowserView() || !getBrowserView()->getGridControl().is()) | |||
937 | return; | |||
938 | Reference< XVclWindowPeer > xMyGridPeer(getBrowserView()->getGridControl()->getPeer(), UNO_QUERY); | |||
939 | if (!xMyGridPeer.is()) | |||
940 | return; | |||
941 | Reference< XWindowPeer > xNextControlPeer(e.NextFocus, UNO_QUERY); | |||
942 | if (!xNextControlPeer.is()) | |||
943 | return; | |||
944 | ||||
945 | // don't do a notification if it remains in the family (i.e. a child of the grid control gets the focus) | |||
946 | if (xMyGridPeer->isChild(xNextControlPeer)) | |||
947 | return; | |||
948 | ||||
949 | if (xMyGridPeer == xNextControlPeer) | |||
950 | return; | |||
951 | ||||
952 | // notify the listeners that the "form" we represent has been deactivated | |||
953 | EventObject aEvt(*this); | |||
954 | ::comphelper::OInterfaceIteratorHelper2 aIter(m_pFormControllerImpl->m_aActivateListeners); | |||
955 | while (aIter.hasMoreElements()) | |||
956 | static_cast<XFormControllerListener*>(aIter.next())->formDeactivated(aEvt); | |||
957 | ||||
958 | // commit the changes of the grid control (as we're deactivated) | |||
959 | Reference< XBoundComponent > xCommitable(getBrowserView()->getGridControl(), UNO_QUERY); | |||
960 | if (xCommitable.is()) | |||
961 | xCommitable->commit(); | |||
962 | else | |||
963 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::focusLost : why is my control not committable?")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::focusLost : why is my control not committable?" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "963" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::focusLost : why is my control not committable?" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::focusLost : why is my control not committable?" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "963" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::focusLost : why is my control not committable?" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "963" ": "), ::sal::detail::unwrapStream( ::sal::detail:: StreamStart() << "SbaXDataBrowserController::focusLost : why is my control not committable?" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::focusLost : why is my control not committable?" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "963" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
964 | } | |||
965 | ||||
966 | void SbaXDataBrowserController::disposingFormModel(const css::lang::EventObject& Source) | |||
967 | { | |||
968 | Reference< XPropertySet > xSourceSet(Source.Source, UNO_QUERY); | |||
969 | if (xSourceSet.is()) | |||
970 | { | |||
971 | xSourceSet->removePropertyChangeListener(PROPERTY_ISNEW"IsNew", static_cast<XPropertyChangeListener*>(this)); | |||
972 | xSourceSet->removePropertyChangeListener(PROPERTY_ISMODIFIED"IsModified", static_cast<XPropertyChangeListener*>(this)); | |||
973 | xSourceSet->removePropertyChangeListener(PROPERTY_ROWCOUNT"RowCount", static_cast<XPropertyChangeListener*>(this)); | |||
974 | xSourceSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND"ActiveCommand", static_cast<XPropertyChangeListener*>(this)); | |||
975 | xSourceSet->removePropertyChangeListener(PROPERTY_ORDER"Order", static_cast<XPropertyChangeListener*>(this)); | |||
976 | xSourceSet->removePropertyChangeListener(PROPERTY_FILTER"Filter", static_cast<XPropertyChangeListener*>(this)); | |||
977 | xSourceSet->removePropertyChangeListener(PROPERTY_HAVING_CLAUSE"HavingClause", static_cast<XPropertyChangeListener*>(this)); | |||
978 | xSourceSet->removePropertyChangeListener(PROPERTY_APPLYFILTER"ApplyFilter", static_cast<XPropertyChangeListener*>(this)); | |||
979 | } | |||
980 | ||||
981 | Reference< css::sdb::XSQLErrorBroadcaster > xFormError(Source.Source, UNO_QUERY); | |||
982 | if (xFormError.is()) | |||
983 | xFormError->removeSQLErrorListener(static_cast<css::sdb::XSQLErrorListener*>(this)); | |||
984 | ||||
985 | if (m_xLoadable.is()) | |||
986 | m_xLoadable->removeLoadListener(this); | |||
987 | ||||
988 | Reference< css::form::XDatabaseParameterBroadcaster > xFormParameter(Source.Source, UNO_QUERY); | |||
989 | if (xFormParameter.is()) | |||
990 | xFormParameter->removeParameterListener(static_cast<css::form::XDatabaseParameterListener*>(this)); | |||
991 | } | |||
992 | ||||
993 | void SbaXDataBrowserController::disposingColumnModel(const css::lang::EventObject& Source) | |||
994 | { | |||
995 | RemoveColumnListener(Reference< XPropertySet > (Source.Source, UNO_QUERY)); | |||
996 | } | |||
997 | ||||
998 | void SbaXDataBrowserController::disposing(const EventObject& Source) | |||
999 | { | |||
1000 | // if it's a component other than our aggregate, forward it to the aggregate | |||
1001 | if ( m_xFormControllerImpl != Source.Source ) | |||
1002 | { | |||
1003 | Reference< XEventListener > xAggListener; | |||
1004 | m_xFormControllerImpl->queryAggregation( cppu::UnoType<decltype(xAggListener)>::get() ) >>= xAggListener; | |||
1005 | if ( xAggListener.is( )) | |||
1006 | xAggListener->disposing( Source ); | |||
1007 | } | |||
1008 | ||||
1009 | // is it the grid control ? | |||
1010 | if (getBrowserView()) | |||
1011 | { | |||
1012 | Reference< css::awt::XControl > xSourceControl(Source.Source, UNO_QUERY); | |||
1013 | if (xSourceControl == getBrowserView()->getGridControl()) | |||
1014 | removeControlListeners(getBrowserView()->getGridControl()); | |||
1015 | } | |||
1016 | ||||
1017 | // its model (the container of the columns) ? | |||
1018 | if (getControlModel() == Source.Source) | |||
1019 | removeModelListeners(getControlModel()); | |||
1020 | ||||
1021 | // the form's model ? | |||
1022 | if (getRowSet() == Source.Source) | |||
1023 | disposingFormModel(Source); | |||
1024 | ||||
1025 | // from a single column model ? | |||
1026 | Reference< XPropertySet > xSourceSet(Source.Source, UNO_QUERY); | |||
1027 | if (xSourceSet.is()) | |||
1028 | { | |||
1029 | Reference< XPropertySetInfo > xInfo = xSourceSet->getPropertySetInfo(); | |||
1030 | // we assume that columns have a Width property and all other sets we are listening to don't have | |||
1031 | if (xInfo->hasPropertyByName(PROPERTY_WIDTH"Width")) | |||
1032 | disposingColumnModel(Source); | |||
1033 | } | |||
1034 | SbaXDataBrowserController_Base::OGenericUnoController::disposing( Source ); | |||
1035 | } | |||
1036 | ||||
1037 | void SAL_CALL SbaXDataBrowserController::setIdentifier( const OUString& Identifier ) | |||
1038 | { | |||
1039 | ::osl::MutexGuard aGuard( getMutex() ); | |||
1040 | m_sModuleIdentifier = Identifier; | |||
1041 | } | |||
1042 | ||||
1043 | OUString SAL_CALL SbaXDataBrowserController::getIdentifier( ) | |||
1044 | { | |||
1045 | ::osl::MutexGuard aGuard( getMutex() ); | |||
1046 | return m_sModuleIdentifier; | |||
1047 | } | |||
1048 | ||||
1049 | void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) | |||
1050 | { | |||
1051 | Reference< XPropertySet > xSource(evt.Source, UNO_QUERY); | |||
1052 | if (!xSource.is()) | |||
1053 | return; | |||
1054 | ||||
1055 | SolarMutexGuard aGuard; | |||
1056 | // the IsModified changed to sal_False ? | |||
1057 | if ( evt.PropertyName == PROPERTY_ISMODIFIED"IsModified" | |||
1058 | && !::comphelper::getBOOL(evt.NewValue) | |||
1059 | ) | |||
1060 | { // -> the current field isn't modified anymore, too | |||
1061 | setCurrentModified( false ); | |||
1062 | } | |||
1063 | ||||
1064 | // switching to a new record ? | |||
1065 | if ( evt.PropertyName == PROPERTY_ISNEW"IsNew" | |||
1066 | && ::comphelper::getBOOL(evt.NewValue) | |||
1067 | ) | |||
1068 | { | |||
1069 | if (::comphelper::getINT32(xSource->getPropertyValue(PROPERTY_ROWCOUNT"RowCount")) == 0) | |||
1070 | // if we're switching to a new record and didn't have any records before we need to invalidate | |||
1071 | // all slots (as the cursor was invalid before the mode change and so the slots were disabled) | |||
1072 | InvalidateAll(); | |||
1073 | } | |||
1074 | ||||
1075 | if (evt.PropertyName == PROPERTY_FILTER"Filter") | |||
1076 | { | |||
1077 | InvalidateFeature(ID_BROWSER_REMOVEFILTER( 10000 + 711 )); | |||
1078 | } | |||
1079 | else if (evt.PropertyName == PROPERTY_HAVING_CLAUSE"HavingClause") | |||
1080 | { | |||
1081 | InvalidateFeature(ID_BROWSER_REMOVEFILTER( 10000 + 711 )); | |||
1082 | } | |||
1083 | else if (evt.PropertyName == PROPERTY_ORDER"Order") | |||
1084 | { | |||
1085 | InvalidateFeature(ID_BROWSER_REMOVEFILTER( 10000 + 711 )); | |||
1086 | } | |||
1087 | ||||
1088 | // a new record count ? -> may be our search availability has changed | |||
1089 | if (evt.PropertyName == PROPERTY_ROWCOUNT"RowCount") | |||
1090 | { | |||
1091 | sal_Int32 nNewValue = 0, nOldValue = 0; | |||
1092 | evt.NewValue >>= nNewValue; | |||
1093 | evt.OldValue >>= nOldValue; | |||
1094 | if((nOldValue == 0 && nNewValue != 0) || (nOldValue != 0 && nNewValue == 0)) | |||
1095 | InvalidateAll(); | |||
1096 | } | |||
1097 | } | |||
1098 | ||||
1099 | void SbaXDataBrowserController::modified(const css::lang::EventObject& /*aEvent*/) | |||
1100 | { | |||
1101 | setCurrentModified( true ); | |||
1102 | } | |||
1103 | ||||
1104 | void SbaXDataBrowserController::elementInserted(const css::container::ContainerEvent& evt) | |||
1105 | { | |||
1106 | OSL_ENSURE(Reference< XInterface >(evt.Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel(), UNO_QUERY).get(),do { if (true && (!(Reference< XInterface >(evt .Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel (), UNO_QUERY).get()))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN ), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1107" ": "), "%s", "SbaXDataBrowserController::elementInserted: where did this come from (not from the grid model)?!" ); } } while (false) | |||
1107 | "SbaXDataBrowserController::elementInserted: where did this come from (not from the grid model)?!")do { if (true && (!(Reference< XInterface >(evt .Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel (), UNO_QUERY).get()))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN ), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1107" ": "), "%s", "SbaXDataBrowserController::elementInserted: where did this come from (not from the grid model)?!" ); } } while (false); | |||
1108 | Reference< XPropertySet > xNewColumn(evt.Element,UNO_QUERY); | |||
1109 | if ( xNewColumn.is() ) | |||
1110 | AddColumnListener(xNewColumn); | |||
1111 | } | |||
1112 | ||||
1113 | void SbaXDataBrowserController::elementRemoved(const css::container::ContainerEvent& evt) | |||
1114 | { | |||
1115 | OSL_ENSURE(Reference< XInterface >(evt.Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel(), UNO_QUERY).get(),do { if (true && (!(Reference< XInterface >(evt .Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel (), UNO_QUERY).get()))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN ), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1116" ": "), "%s", "SbaXDataBrowserController::elementRemoved: where did this come from (not from the grid model)?!" ); } } while (false) | |||
1116 | "SbaXDataBrowserController::elementRemoved: where did this come from (not from the grid model)?!")do { if (true && (!(Reference< XInterface >(evt .Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel (), UNO_QUERY).get()))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN ), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1116" ": "), "%s", "SbaXDataBrowserController::elementRemoved: where did this come from (not from the grid model)?!" ); } } while (false); | |||
1117 | Reference< XPropertySet > xOldColumn(evt.Element,UNO_QUERY); | |||
1118 | if ( xOldColumn.is() ) | |||
1119 | RemoveColumnListener(xOldColumn); | |||
1120 | } | |||
1121 | ||||
1122 | void SbaXDataBrowserController::elementReplaced(const css::container::ContainerEvent& evt) | |||
1123 | { | |||
1124 | OSL_ENSURE(Reference< XInterface >(evt.Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel(), UNO_QUERY).get(),do { if (true && (!(Reference< XInterface >(evt .Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel (), UNO_QUERY).get()))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN ), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1125" ": "), "%s", "SbaXDataBrowserController::elementReplaced: where did this come from (not from the grid model)?!" ); } } while (false) | |||
1125 | "SbaXDataBrowserController::elementReplaced: where did this come from (not from the grid model)?!")do { if (true && (!(Reference< XInterface >(evt .Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel (), UNO_QUERY).get()))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN ), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1125" ": "), "%s", "SbaXDataBrowserController::elementReplaced: where did this come from (not from the grid model)?!" ); } } while (false); | |||
1126 | Reference< XPropertySet > xOldColumn(evt.ReplacedElement,UNO_QUERY); | |||
1127 | if ( xOldColumn.is() ) | |||
1128 | RemoveColumnListener(xOldColumn); | |||
1129 | ||||
1130 | Reference< XPropertySet > xNewColumn(evt.Element,UNO_QUERY); | |||
1131 | if ( xNewColumn.is() ) | |||
1132 | AddColumnListener(xNewColumn); | |||
1133 | } | |||
1134 | ||||
1135 | sal_Bool SbaXDataBrowserController::suspend(sal_Bool /*bSuspend*/) | |||
1136 | { | |||
1137 | m_aAsyncGetCellFocus.CancelCall(); | |||
1138 | m_aAsyncDisplayError.CancelCall(); | |||
1139 | m_aAsyncInvalidateAll.CancelCall(); | |||
1140 | ||||
1141 | bool bSuccess = SaveModified(); | |||
1142 | return bSuccess; | |||
1143 | } | |||
1144 | ||||
1145 | void SbaXDataBrowserController::disposing() | |||
1146 | { | |||
1147 | // the base class | |||
1148 | SbaXDataBrowserController_Base::OGenericUnoController::disposing(); | |||
1149 | ||||
1150 | // the data source | |||
1151 | Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
1152 | if (xFormSet.is()) | |||
1153 | { | |||
1154 | xFormSet->removePropertyChangeListener(PROPERTY_ISNEW"IsNew", static_cast<XPropertyChangeListener*>(this)); | |||
1155 | xFormSet->removePropertyChangeListener(PROPERTY_ISMODIFIED"IsModified", static_cast<XPropertyChangeListener*>(this)); | |||
1156 | xFormSet->removePropertyChangeListener(PROPERTY_ROWCOUNT"RowCount", static_cast<XPropertyChangeListener*>(this)); | |||
1157 | xFormSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND"ActiveCommand", static_cast<XPropertyChangeListener*>(this)); | |||
1158 | xFormSet->removePropertyChangeListener(PROPERTY_ORDER"Order", static_cast<XPropertyChangeListener*>(this)); | |||
1159 | xFormSet->removePropertyChangeListener(PROPERTY_FILTER"Filter", static_cast<XPropertyChangeListener*>(this)); | |||
1160 | xFormSet->removePropertyChangeListener(PROPERTY_HAVING_CLAUSE"HavingClause", static_cast<XPropertyChangeListener*>(this)); | |||
1161 | xFormSet->removePropertyChangeListener(PROPERTY_APPLYFILTER"ApplyFilter", static_cast<XPropertyChangeListener*>(this)); | |||
1162 | } | |||
1163 | ||||
1164 | Reference< css::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); | |||
1165 | if (xFormError.is()) | |||
1166 | xFormError->removeSQLErrorListener(static_cast<css::sdb::XSQLErrorListener*>(this)); | |||
1167 | ||||
1168 | if (m_xLoadable.is()) | |||
1169 | m_xLoadable->removeLoadListener(this); | |||
1170 | ||||
1171 | Reference< css::form::XDatabaseParameterBroadcaster > xFormParameter(getRowSet(), UNO_QUERY); | |||
1172 | if (xFormParameter.is()) | |||
1173 | xFormParameter->removeParameterListener(static_cast<css::form::XDatabaseParameterListener*>(this)); | |||
1174 | ||||
1175 | removeModelListeners(getControlModel()); | |||
1176 | ||||
1177 | if ( getView() && m_pClipboardNotifier.is() ) | |||
1178 | { | |||
1179 | m_pClipboardNotifier->ClearCallbackLink(); | |||
1180 | m_pClipboardNotifier->RemoveListener( getView() ); | |||
1181 | m_pClipboardNotifier.clear(); | |||
1182 | } | |||
1183 | ||||
1184 | if (getBrowserView()) | |||
1185 | { | |||
1186 | removeControlListeners(getBrowserView()->getGridControl()); | |||
1187 | // don't delete explicitly, this is done by the owner (and user) of this controller (me hopes ...) | |||
1188 | clearView(); | |||
1189 | } | |||
1190 | ||||
1191 | if(m_aInvalidateClipboard.IsActive()) | |||
1192 | m_aInvalidateClipboard.Stop(); | |||
1193 | ||||
1194 | // dispose the row set | |||
1195 | try | |||
1196 | { | |||
1197 | ::comphelper::disposeComponent(m_xRowSet); | |||
1198 | ||||
1199 | m_xRowSet = nullptr; | |||
1200 | m_xColumnsSupplier = nullptr; | |||
1201 | m_xLoadable = nullptr; | |||
1202 | } | |||
1203 | catch(Exception&) | |||
1204 | { | |||
1205 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1205" ": ", "dbaccess" );; | |||
1206 | } | |||
1207 | m_xParser.clear(); | |||
1208 | // don't dispose, just reset - it's owned by the RowSet | |||
1209 | } | |||
1210 | ||||
1211 | void SbaXDataBrowserController::frameAction(const css::frame::FrameActionEvent& aEvent) | |||
1212 | { | |||
1213 | ::osl::MutexGuard aGuard( getMutex() ); | |||
1214 | ||||
1215 | SbaXDataBrowserController_Base::frameAction( aEvent ); | |||
1216 | ||||
1217 | if ( aEvent.Source != getFrame() ) | |||
1218 | return; | |||
1219 | ||||
1220 | switch ( aEvent.Action ) | |||
1221 | { | |||
1222 | case FrameAction_FRAME_ACTIVATED: | |||
1223 | case FrameAction_FRAME_UI_ACTIVATED: | |||
1224 | // ensure that the active cell (if any) has the focus | |||
1225 | m_aAsyncGetCellFocus.Call(); | |||
1226 | // start the clipboard timer | |||
1227 | if (getBrowserView() && getBrowserView()->getVclControl() && !m_aInvalidateClipboard.IsActive()) | |||
1228 | { | |||
1229 | m_aInvalidateClipboard.Start(); | |||
1230 | OnInvalidateClipboard( nullptr ); | |||
1231 | } | |||
1232 | break; | |||
1233 | case FrameAction_FRAME_DEACTIVATING: | |||
1234 | case FrameAction_FRAME_UI_DEACTIVATING: | |||
1235 | // stop the clipboard invalidator | |||
1236 | if (getBrowserView() && getBrowserView()->getVclControl() && m_aInvalidateClipboard.IsActive()) | |||
1237 | { | |||
1238 | m_aInvalidateClipboard.Stop(); | |||
1239 | OnInvalidateClipboard( nullptr ); | |||
1240 | } | |||
1241 | // remove the "get cell focus"-event | |||
1242 | m_aAsyncGetCellFocus.CancelCall(); | |||
1243 | break; | |||
1244 | default: | |||
1245 | break; | |||
1246 | } | |||
1247 | } | |||
1248 | ||||
1249 | IMPL_LINK_NOARG( SbaXDataBrowserController, OnAsyncDisplayError, void*, void )void SbaXDataBrowserController::LinkStubOnAsyncDisplayError(void * instance, void* data) { return static_cast<SbaXDataBrowserController *>(instance)->OnAsyncDisplayError(data); } void SbaXDataBrowserController ::OnAsyncDisplayError(__attribute__ ((unused)) void*) | |||
1250 | { | |||
1251 | if ( m_aCurrentError.isValid() ) | |||
1252 | { | |||
1253 | OSQLMessageBox aDlg(getFrameWeld(), m_aCurrentError); | |||
1254 | aDlg.run(); | |||
1255 | } | |||
1256 | } | |||
1257 | ||||
1258 | void SbaXDataBrowserController::errorOccured(const css::sdb::SQLErrorEvent& aEvent) | |||
1259 | { | |||
1260 | ::osl::MutexGuard aGuard( getMutex() ); | |||
1261 | ||||
1262 | SQLExceptionInfo aInfo( aEvent.Reason ); | |||
1263 | if ( !aInfo.isValid() ) | |||
1264 | return; | |||
1265 | ||||
1266 | if ( m_nFormActionNestingLevel ) | |||
1267 | { | |||
1268 | OSL_ENSURE( !m_aCurrentError.isValid(), "SbaXDataBrowserController::errorOccurred: can handle one error per transaction only!" )do { if (true && (!(!m_aCurrentError.isValid()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1268" ": "), "%s", "SbaXDataBrowserController::errorOccurred: can handle one error per transaction only!" ); } } while (false); | |||
1269 | m_aCurrentError = aInfo; | |||
1270 | } | |||
1271 | else | |||
1272 | { | |||
1273 | m_aCurrentError = aInfo; | |||
1274 | m_aAsyncDisplayError.Call(); | |||
1275 | } | |||
1276 | } | |||
1277 | ||||
1278 | sal_Bool SbaXDataBrowserController::approveParameter(const css::form::DatabaseParameterEvent& aEvent) | |||
1279 | { | |||
1280 | if (aEvent.Source != getRowSet()) | |||
1281 | { | |||
1282 | // not my data source -> allow anything | |||
1283 | SAL_WARN("dbaccess.ui","SbaXDataBrowserController::approveParameter : invalid event source !")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::approveParameter : invalid event source !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1283" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::approveParameter : invalid event source !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::approveParameter : invalid event source !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1283" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::approveParameter : invalid event source !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1283" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::approveParameter : invalid event source !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::approveParameter : invalid event source !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1283" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
1284 | return true; | |||
1285 | } | |||
1286 | ||||
1287 | Reference< css::container::XIndexAccess > xParameters = aEvent.Parameters; | |||
1288 | SolarMutexGuard aSolarGuard; | |||
1289 | ||||
1290 | // default handling: instantiate an interaction handler and let it handle the parameter request | |||
1291 | try | |||
1292 | { | |||
1293 | // two continuations allowed: OK and Cancel | |||
1294 | OParameterContinuation* pParamValues = new OParameterContinuation; | |||
1295 | OInteractionAbort* pAbort = new OInteractionAbort; | |||
1296 | // the request | |||
1297 | ParametersRequest aRequest; | |||
1298 | aRequest.Parameters = xParameters; | |||
1299 | aRequest.Connection = getConnection(Reference< XRowSet >(aEvent.Source, UNO_QUERY)); | |||
1300 | OInteractionRequest* pParamRequest = new OInteractionRequest(makeAny(aRequest)); | |||
1301 | Reference< XInteractionRequest > xParamRequest(pParamRequest); | |||
1302 | // some knittings | |||
1303 | pParamRequest->addContinuation(pParamValues); | |||
1304 | pParamRequest->addContinuation(pAbort); | |||
1305 | ||||
1306 | // create the handler, let it handle the request | |||
1307 | Reference< XInteractionHandler2 > xHandler(InteractionHandler::createWithParent(getORB(), getComponentWindow())); | |||
1308 | xHandler->handle(xParamRequest); | |||
1309 | ||||
1310 | if (!pParamValues->wasSelected()) | |||
1311 | { // canceled | |||
1312 | setLoadingCancelled(); | |||
1313 | return false; | |||
1314 | } | |||
1315 | ||||
1316 | // transfer the values into the parameter supplier | |||
1317 | Sequence< PropertyValue > aFinalValues = pParamValues->getValues(); | |||
1318 | if (aFinalValues.getLength() != aRequest.Parameters->getCount()) | |||
1319 | { | |||
1320 | SAL_WARN("dbaccess.ui","SbaXDataBrowserController::approveParameter: the InteractionHandler returned nonsense!")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::approveParameter: the InteractionHandler returned nonsense!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1320" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::approveParameter: the InteractionHandler returned nonsense!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::approveParameter: the InteractionHandler returned nonsense!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1320" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::approveParameter: the InteractionHandler returned nonsense!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1320" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::approveParameter: the InteractionHandler returned nonsense!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::approveParameter: the InteractionHandler returned nonsense!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1320" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
1321 | setLoadingCancelled(); | |||
1322 | return false; | |||
1323 | } | |||
1324 | const PropertyValue* pFinalValues = aFinalValues.getConstArray(); | |||
1325 | for (sal_Int32 i=0; i<aFinalValues.getLength(); ++i, ++pFinalValues) | |||
1326 | { | |||
1327 | Reference< XPropertySet > xParam( | |||
1328 | aRequest.Parameters->getByIndex(i), css::uno::UNO_QUERY); | |||
1329 | OSL_ENSURE(xParam.is(), "SbaXDataBrowserController::approveParameter: one of the parameters is no property set!")do { if (true && (!(xParam.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1329" ": "), "%s", "SbaXDataBrowserController::approveParameter: one of the parameters is no property set!" ); } } while (false); | |||
1330 | if (xParam.is()) | |||
1331 | { | |||
1332 | #ifdef DBG_UTIL | |||
1333 | OUString sName; | |||
1334 | xParam->getPropertyValue(PROPERTY_NAME"Name") >>= sName; | |||
1335 | OSL_ENSURE(sName == pFinalValues->Name, "SbaXDataBrowserController::approveParameter: suspicious value names!")do { if (true && (!(sName == pFinalValues->Name))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1335" ": "), "%s", "SbaXDataBrowserController::approveParameter: suspicious value names!" ); } } while (false); | |||
1336 | #endif | |||
1337 | try { xParam->setPropertyValue(PROPERTY_VALUE"Value", pFinalValues->Value); } | |||
1338 | catch(Exception&) | |||
1339 | { | |||
1340 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::approveParameter: setting one of the properties failed!")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::approveParameter: setting one of the properties failed!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1340" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::approveParameter: setting one of the properties failed!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::approveParameter: setting one of the properties failed!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1340" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::approveParameter: setting one of the properties failed!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1340" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::approveParameter: setting one of the properties failed!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::approveParameter: setting one of the properties failed!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1340" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
1341 | } | |||
1342 | } | |||
1343 | } | |||
1344 | } | |||
1345 | catch( const Exception& ) | |||
1346 | { | |||
1347 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1347" ": ", "dbaccess" );; | |||
1348 | } | |||
1349 | ||||
1350 | return true; | |||
1351 | } | |||
1352 | ||||
1353 | sal_Bool SbaXDataBrowserController::approveReset(const css::lang::EventObject& /*rEvent*/) | |||
1354 | { | |||
1355 | return true; | |||
1356 | } | |||
1357 | ||||
1358 | void SbaXDataBrowserController::resetted(const css::lang::EventObject& rEvent) | |||
1359 | { | |||
1360 | OSL_ENSURE(rEvent.Source == getControlModel(), "SbaXDataBrowserController::resetted : where did this come from ?")do { if (true && (!(rEvent.Source == getControlModel( )))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1360" ": "), "%s", "SbaXDataBrowserController::resetted : where did this come from ?" ); } } while (false); | |||
1361 | setCurrentModified( false ); | |||
1362 | } | |||
1363 | ||||
1364 | sal_Bool SbaXDataBrowserController::confirmDelete(const css::sdb::RowChangeEvent& /*aEvent*/) | |||
1365 | { | |||
1366 | std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(getFrameWeld(), | |||
1367 | VclMessageType::Question, VclButtonsType::YesNo, | |||
1368 | DBA_RES(STR_QUERY_BRW_DELETE_ROWS)::dbaccess::ResourceManager::loadString( reinterpret_cast< char const *>("STR_QUERY_BRW_DELETE_ROWS" "\004" u8"Do you want to delete the selected data?" ) ))); | |||
1369 | if (xQuery->run() != RET_YES) | |||
1370 | return false; | |||
1371 | return true; | |||
1372 | } | |||
1373 | ||||
1374 | FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const | |||
1375 | { | |||
1376 | FeatureState aReturn; | |||
1377 | // (disabled automatically) | |||
1378 | ||||
1379 | try | |||
1380 | { | |||
1381 | // no chance without a view | |||
1382 | if (!getBrowserView() || !getBrowserView()->getVclControl()) | |||
1383 | return aReturn; | |||
1384 | ||||
1385 | switch (nId) | |||
1386 | { | |||
1387 | case ID_BROWSER_REMOVEFILTER( 10000 + 711 ): | |||
1388 | if (!m_xParser.is()) | |||
1389 | { | |||
1390 | aReturn.bEnabled = false; | |||
1391 | return aReturn; | |||
1392 | } | |||
1393 | // any filter or sort order set ? | |||
1394 | aReturn.bEnabled = m_xParser->getFilter().getLength() || m_xParser->getHavingClause().getLength() || m_xParser->getOrder().getLength(); | |||
1395 | return aReturn; | |||
1396 | } | |||
1397 | // no chance without valid models | |||
1398 | if (isValid() && !isValidCursor()) | |||
1399 | return aReturn; | |||
1400 | ||||
1401 | switch (nId) | |||
1402 | { | |||
1403 | case ID_BROWSER_SEARCH( 10000 + 725 ): | |||
1404 | { | |||
1405 | Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
1406 | sal_Int32 nCount = ::comphelper::getINT32(xFormSet->getPropertyValue(PROPERTY_ROWCOUNT"RowCount")); | |||
1407 | aReturn.bEnabled = nCount != 0; | |||
1408 | } | |||
1409 | break; | |||
1410 | case ID_BROWSER_INSERT_ROW(((((((10000 + 1499) + 1) + 499) + 1) + 100) + 1) + 46): | |||
1411 | { | |||
1412 | // check if it is available | |||
1413 | bool bInsertPrivilege = ( m_nRowSetPrivileges & Privilege::INSERT) != 0; | |||
1414 | bool bAllowInsertions = true; | |||
1415 | try | |||
1416 | { | |||
1417 | Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW ); | |||
1418 | OSL_VERIFY( xRowSetProps->getPropertyValue("AllowInserts") >>= bAllowInsertions )do { if (!(xRowSetProps->getPropertyValue("AllowInserts") >>= bAllowInsertions)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1418" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1419 | } | |||
1420 | catch( const Exception& ) | |||
1421 | { | |||
1422 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1422" ": ", "dbaccess" );; | |||
1423 | } | |||
1424 | aReturn.bEnabled = bInsertPrivilege && bAllowInsertions; | |||
1425 | } | |||
1426 | break; | |||
1427 | case SID_FM_DELETEROWS( 10000 + 610 ): | |||
1428 | { | |||
1429 | // check if it is available | |||
1430 | bool bDeletePrivilege = ( m_nRowSetPrivileges & Privilege::INSERT) != 0; | |||
1431 | bool bAllowDeletions = true; | |||
1432 | sal_Int32 nRowCount = 0; | |||
1433 | bool bInsertionRow = false; | |||
1434 | try | |||
1435 | { | |||
1436 | Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW ); | |||
1437 | OSL_VERIFY( xRowSetProps->getPropertyValue("AllowDeletes") >>= bAllowDeletions )do { if (!(xRowSetProps->getPropertyValue("AllowDeletes") >>= bAllowDeletions)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1437" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1438 | OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ROWCOUNT ) >>= nRowCount )do { if (!(xRowSetProps->getPropertyValue( "RowCount" ) >>= nRowCount)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1438" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1439 | OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ISNEW ) >>= bInsertionRow )do { if (!(xRowSetProps->getPropertyValue( "IsNew" ) >>= bInsertionRow)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1439" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1440 | } | |||
1441 | catch( const Exception& ) | |||
1442 | { | |||
1443 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1443" ": ", "dbaccess" );; | |||
1444 | } | |||
1445 | aReturn.bEnabled = bDeletePrivilege && bAllowDeletions && ( nRowCount != 0 ) && !bInsertionRow; | |||
1446 | } | |||
1447 | break; | |||
1448 | ||||
1449 | case ID_BROWSER_COPY(5000 + 711): | |||
1450 | if ( getBrowserView()->getVclControl()->GetSelectRowCount() ) | |||
1451 | { | |||
1452 | aReturn.bEnabled = m_aCurrentFrame.isActive(); | |||
1453 | break; | |||
1454 | } | |||
1455 | [[fallthrough]]; | |||
1456 | case ID_BROWSER_PASTE(5000 + 712): | |||
1457 | case ID_BROWSER_CUT(5000 + 710): | |||
1458 | { | |||
1459 | CellControllerRef xCurrentController = getBrowserView()->getVclControl()->Controller(); | |||
1460 | if (const EditCellController* pController = dynamic_cast<const EditCellController*>(xCurrentController.get())) | |||
1461 | { | |||
1462 | const IEditImplementation* pEditImplementation = pController->GetEditImplementation(); | |||
1463 | bool bHasLen = pEditImplementation->GetSelection().Len() != 0; | |||
1464 | bool bIsReadOnly = pEditImplementation->IsReadOnly(); | |||
1465 | switch (nId) | |||
1466 | { | |||
1467 | case ID_BROWSER_CUT(5000 + 710): aReturn.bEnabled = m_aCurrentFrame.isActive() && bHasLen && !bIsReadOnly; break; | |||
1468 | case SID_COPY(5000 + 711) : aReturn.bEnabled = m_aCurrentFrame.isActive() && bHasLen; break; | |||
1469 | case ID_BROWSER_PASTE(5000 + 712): | |||
1470 | aReturn.bEnabled = m_aCurrentFrame.isActive() && !bIsReadOnly; | |||
1471 | if(aReturn.bEnabled) | |||
1472 | { | |||
1473 | aReturn.bEnabled = IsFormatSupported( m_aSystemClipboard.GetDataFlavorExVector(), SotClipboardFormatId::STRING ); | |||
1474 | } | |||
1475 | break; | |||
1476 | } | |||
1477 | } | |||
1478 | } | |||
1479 | break; | |||
1480 | ||||
1481 | case ID_BROWSER_SORTUP( 10000 + 712 ): | |||
1482 | case ID_BROWSER_SORTDOWN( 10000 + 713 ): | |||
1483 | case ID_BROWSER_AUTOFILTER( 10000 + 716 ): | |||
1484 | { | |||
1485 | // a native statement can't be filtered or sorted | |||
1486 | const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
1487 | if ( !::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING"EscapeProcessing")) || !m_xParser.is() ) | |||
1488 | break; | |||
1489 | ||||
1490 | Reference< XPropertySet > xCurrentField = getBoundField(); | |||
1491 | if (!xCurrentField.is()) | |||
1492 | break; | |||
1493 | ||||
1494 | aReturn.bEnabled = ::comphelper::getBOOL(xCurrentField->getPropertyValue(PROPERTY_ISSEARCHABLE"IsSearchable")); | |||
1495 | const Reference< XRowSet > xRow = getRowSet(); | |||
1496 | aReturn.bEnabled = aReturn.bEnabled | |||
1497 | && xRow.is() | |||
1498 | && !xRow->isBeforeFirst() | |||
1499 | && !xRow->isAfterLast() | |||
1500 | && !xRow->rowDeleted() | |||
1501 | && ( ::comphelper::getINT32( xFormSet->getPropertyValue( PROPERTY_ROWCOUNT"RowCount" ) ) != 0 ); | |||
1502 | } | |||
1503 | break; | |||
1504 | ||||
1505 | case ID_BROWSER_FILTERCRIT( 10000 + 715 ): | |||
1506 | if ( m_bCannotSelectUnfiltered && m_xParser.is() ) | |||
1507 | { | |||
1508 | aReturn.bEnabled = true; | |||
1509 | break; | |||
1510 | } | |||
1511 | [[fallthrough]]; | |||
1512 | case ID_BROWSER_ORDERCRIT( 10000 + 714 ): | |||
1513 | { | |||
1514 | const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
1515 | if ( !::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING"EscapeProcessing")) || !m_xParser.is() ) | |||
1516 | break; | |||
1517 | ||||
1518 | aReturn.bEnabled = getRowSet().is() | |||
1519 | && ( ::comphelper::getINT32( xFormSet->getPropertyValue( PROPERTY_ROWCOUNT"RowCount" ) ) != 0 ); | |||
1520 | } | |||
1521 | break; | |||
1522 | ||||
1523 | case ID_BROWSER_REFRESH( 10000 + 724 ): | |||
1524 | aReturn.bEnabled = true; | |||
1525 | break; | |||
1526 | ||||
1527 | case ID_BROWSER_REDO(5000 + 700): | |||
1528 | aReturn.bEnabled = false; // simply forget it ;). no redo possible. | |||
1529 | break; | |||
1530 | ||||
1531 | case ID_BROWSER_UNDORECORD( 10000 + 630 ): | |||
1532 | case ID_BROWSER_SAVERECORD( 10000 + 627 ): | |||
1533 | { | |||
1534 | if (!m_bCurrentlyModified) | |||
1535 | { | |||
1536 | Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
1537 | if (xFormSet.is()) | |||
1538 | aReturn.bEnabled = ::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ISMODIFIED"IsModified")); | |||
1539 | } | |||
1540 | else | |||
1541 | aReturn.bEnabled = true; | |||
1542 | ||||
1543 | aReturn.sTitle = (ID_BROWSER_UNDORECORD( 10000 + 630 ) == nId) ? m_sStateUndoRecord : m_sStateSaveRecord; | |||
1544 | } | |||
1545 | break; | |||
1546 | case ID_BROWSER_EDITDOC(5000 + 1312): | |||
1547 | { | |||
1548 | // check if it is available | |||
1549 | Reference< XPropertySet > xDataSourceSet(getRowSet(), UNO_QUERY); | |||
1550 | if (!xDataSourceSet.is()) | |||
1551 | break; // no datasource -> no edit mode | |||
1552 | ||||
1553 | sal_Int32 nDataSourcePrivileges = ::comphelper::getINT32(xDataSourceSet->getPropertyValue(PROPERTY_PRIVILEGES"Privileges")); | |||
1554 | bool bInsertAllowedAndPossible = ((nDataSourcePrivileges & css::sdbcx::Privilege::INSERT) != 0) && ::comphelper::getBOOL(xDataSourceSet->getPropertyValue("AllowInserts")); | |||
1555 | bool bUpdateAllowedAndPossible = ((nDataSourcePrivileges & css::sdbcx::Privilege::UPDATE) != 0) && ::comphelper::getBOOL(xDataSourceSet->getPropertyValue("AllowUpdates")); | |||
1556 | bool bDeleteAllowedAndPossible = ((nDataSourcePrivileges & css::sdbcx::Privilege::DELETE) != 0) && ::comphelper::getBOOL(xDataSourceSet->getPropertyValue("AllowDeletes")); | |||
1557 | if (!bInsertAllowedAndPossible && !bUpdateAllowedAndPossible && !bDeleteAllowedAndPossible) | |||
1558 | break; // no insert/update/delete -> no edit mode | |||
1559 | ||||
1560 | if (!isValidCursor() || !isLoaded()) | |||
1561 | break; // no cursor -> no edit mode | |||
1562 | ||||
1563 | aReturn.bEnabled = true; | |||
1564 | ||||
1565 | DbGridControlOptions nGridMode = getBrowserView()->getVclControl()->GetOptions(); | |||
1566 | aReturn.bChecked = nGridMode > DbGridControlOptions::Readonly; | |||
1567 | } | |||
1568 | break; | |||
1569 | case ID_BROWSER_FILTERED( 10000 + 723 ): | |||
1570 | { | |||
1571 | aReturn.bEnabled = false; | |||
1572 | Reference< XPropertySet > xActiveSet(getRowSet(), UNO_QUERY); | |||
1573 | OUString aFilter = ::comphelper::getString(xActiveSet->getPropertyValue(PROPERTY_FILTER"Filter")); | |||
1574 | OUString aHaving = ::comphelper::getString(xActiveSet->getPropertyValue(PROPERTY_HAVING_CLAUSE"HavingClause")); | |||
1575 | if ( !(aFilter.isEmpty() && aHaving.isEmpty()) ) | |||
1576 | { | |||
1577 | xActiveSet->getPropertyValue( PROPERTY_APPLYFILTER"ApplyFilter" ) >>= aReturn.bChecked; | |||
1578 | aReturn.bEnabled = true; | |||
1579 | } | |||
1580 | else | |||
1581 | { | |||
1582 | aReturn.bChecked = false; | |||
1583 | aReturn.bEnabled = false; | |||
1584 | } | |||
1585 | } | |||
1586 | break; | |||
1587 | default: | |||
1588 | return SbaXDataBrowserController_Base::GetState(nId); | |||
1589 | } | |||
1590 | } | |||
1591 | catch(const Exception& ) | |||
1592 | { | |||
1593 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1593" ": ", "dbaccess" );; | |||
1594 | } | |||
1595 | ||||
1596 | return aReturn; | |||
1597 | } | |||
1598 | ||||
1599 | void SbaXDataBrowserController::applyParserOrder(const OUString& _rOldOrder,const Reference< XSingleSelectQueryComposer >& _xParser) | |||
1600 | { | |||
1601 | Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
1602 | if (!m_xLoadable.is()) | |||
1603 | { | |||
1604 | SAL_WARN("dbaccess.ui","SbaXDataBrowserController::applyParserOrder: invalid row set!")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::applyParserOrder: invalid row set!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1604" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::applyParserOrder: invalid row set!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::applyParserOrder: invalid row set!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1604" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::applyParserOrder: invalid row set!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1604" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::applyParserOrder: invalid row set!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::applyParserOrder: invalid row set!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1604" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
1605 | return; | |||
1606 | } | |||
1607 | ||||
1608 | sal_uInt16 nPos = getCurrentColumnPosition(); | |||
1609 | bool bSuccess = false; | |||
1610 | try | |||
1611 | { | |||
1612 | xFormSet->setPropertyValue(PROPERTY_ORDER"Order", makeAny(_xParser->getOrder())); | |||
1613 | bSuccess = reloadForm(m_xLoadable); | |||
1614 | } | |||
1615 | catch(Exception&) | |||
1616 | { | |||
1617 | } | |||
1618 | ||||
1619 | if (!bSuccess) | |||
1620 | { | |||
1621 | xFormSet->setPropertyValue(PROPERTY_ORDER"Order", makeAny(_rOldOrder)); | |||
1622 | ||||
1623 | try | |||
1624 | { | |||
1625 | if (loadingCancelled() || !reloadForm(m_xLoadable)) | |||
1626 | criticalFail(); | |||
1627 | } | |||
1628 | catch(Exception&) | |||
1629 | { | |||
1630 | criticalFail(); | |||
1631 | } | |||
1632 | InvalidateAll(); | |||
1633 | } | |||
1634 | InvalidateFeature(ID_BROWSER_REMOVEFILTER( 10000 + 711 )); | |||
1635 | ||||
1636 | setCurrentColumnPosition(nPos); | |||
1637 | } | |||
1638 | ||||
1639 | void SbaXDataBrowserController::applyParserFilter(const OUString& _rOldFilter, bool _bOldFilterApplied,const ::OUString& _sOldHaving,const Reference< XSingleSelectQueryComposer >& _xParser) | |||
1640 | { | |||
1641 | Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
1642 | if (!m_xLoadable.is()) | |||
1643 | { | |||
1644 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::applyParserFilter: invalid row set!")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::applyParserFilter: invalid row set!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1644" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::applyParserFilter: invalid row set!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::applyParserFilter: invalid row set!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1644" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::applyParserFilter: invalid row set!" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1644" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::applyParserFilter: invalid row set!" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::applyParserFilter: invalid row set!" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1644" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
1645 | return; | |||
1646 | } | |||
1647 | ||||
1648 | sal_uInt16 nPos = getCurrentColumnPosition(); | |||
1649 | ||||
1650 | bool bSuccess = false; | |||
1651 | try | |||
1652 | { | |||
1653 | FormErrorHelper aError(this); | |||
1654 | xFormSet->setPropertyValue(PROPERTY_FILTER"Filter", makeAny(_xParser->getFilter())); | |||
1655 | xFormSet->setPropertyValue(PROPERTY_HAVING_CLAUSE"HavingClause", makeAny(_xParser->getHavingClause())); | |||
1656 | xFormSet->setPropertyValue(PROPERTY_APPLYFILTER"ApplyFilter", css::uno::Any(true)); | |||
1657 | ||||
1658 | bSuccess = reloadForm(m_xLoadable); | |||
1659 | } | |||
1660 | catch(Exception&) | |||
1661 | { | |||
1662 | } | |||
1663 | ||||
1664 | if (!bSuccess) | |||
1665 | { | |||
1666 | xFormSet->setPropertyValue(PROPERTY_FILTER"Filter", makeAny(_rOldFilter)); | |||
1667 | xFormSet->setPropertyValue(PROPERTY_HAVING_CLAUSE"HavingClause", makeAny(_sOldHaving)); | |||
1668 | xFormSet->setPropertyValue(PROPERTY_APPLYFILTER"ApplyFilter", css::uno::Any(_bOldFilterApplied)); | |||
1669 | ||||
1670 | try | |||
1671 | { | |||
1672 | if (loadingCancelled() || !reloadForm(m_xLoadable)) | |||
1673 | criticalFail(); | |||
1674 | } | |||
1675 | catch(Exception&) | |||
1676 | { | |||
1677 | criticalFail(); | |||
1678 | } | |||
1679 | InvalidateAll(); | |||
1680 | } | |||
1681 | InvalidateFeature(ID_BROWSER_REMOVEFILTER( 10000 + 711 )); | |||
1682 | ||||
1683 | setCurrentColumnPosition(nPos); | |||
1684 | } | |||
1685 | ||||
1686 | Reference< XSingleSelectQueryComposer > SbaXDataBrowserController::createParser_nothrow() | |||
1687 | { | |||
1688 | Reference< XSingleSelectQueryComposer > xComposer; | |||
1689 | try | |||
1690 | { | |||
1691 | const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW ); | |||
1692 | const Reference< XMultiServiceFactory > xFactory( | |||
1693 | xRowSetProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION"ActiveConnection" ), UNO_QUERY_THROW ); | |||
1694 | xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER"com.sun.star.sdb.SingleSelectQueryComposer" ), UNO_QUERY_THROW ); | |||
1695 | ||||
1696 | OUString sActiveCommand; | |||
1697 | OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= sActiveCommand )do { if (!(xRowSetProps->getPropertyValue( "ActiveCommand" ) >>= sActiveCommand)) do { if (true && (!(0)) ) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1697" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1698 | if ( !sActiveCommand.isEmpty() ) | |||
1699 | { | |||
1700 | xComposer->setElementaryQuery( sActiveCommand ); | |||
1701 | } | |||
1702 | else | |||
1703 | { | |||
1704 | OUString sCommand; | |||
1705 | OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand )do { if (!(xRowSetProps->getPropertyValue( "Command" ) >>= sCommand)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1705" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1706 | sal_Int32 nCommandType = CommandType::COMMAND; | |||
1707 | OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND_TYPE ) >>= nCommandType )do { if (!(xRowSetProps->getPropertyValue( "CommandType" ) >>= nCommandType)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1707" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1708 | xComposer->setCommand( sCommand, nCommandType ); | |||
1709 | } | |||
1710 | ||||
1711 | OUString sFilter; | |||
1712 | OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_FILTER ) >>= sFilter )do { if (!(xRowSetProps->getPropertyValue( "Filter" ) >>= sFilter)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1712" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1713 | xComposer->setFilter( sFilter ); | |||
1714 | ||||
1715 | OUString sHavingClause; | |||
1716 | OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_HAVING_CLAUSE ) >>= sHavingClause )do { if (!(xRowSetProps->getPropertyValue( "HavingClause" ) >>= sHavingClause)) do { if (true && (!(0))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1716" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1717 | xComposer->setHavingClause( sHavingClause ); | |||
1718 | ||||
1719 | OUString sOrder; | |||
1720 | OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ORDER ) >>= sOrder )do { if (!(xRowSetProps->getPropertyValue( "Order" ) >>= sOrder)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1720" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
1721 | xComposer->setOrder( sOrder ); | |||
1722 | } | |||
1723 | catch ( const Exception& ) | |||
1724 | { | |||
1725 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1725" ": ", "dbaccess" );; | |||
1726 | } | |||
1727 | return xComposer; | |||
1728 | } | |||
1729 | ||||
1730 | void SbaXDataBrowserController::ExecuteFilterSortCrit(bool bFilter) | |||
1731 | { | |||
1732 | if (!SaveModified()) | |||
1733 | return; | |||
1734 | ||||
1735 | Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
1736 | ||||
1737 | const OUString sOldVal = bFilter ? m_xParser->getFilter() : m_xParser->getOrder(); | |||
1738 | const OUString sOldHaving = m_xParser->getHavingClause(); | |||
1739 | Reference< XSingleSelectQueryComposer > xParser = createParser_nothrow(); | |||
1740 | try | |||
1741 | { | |||
1742 | Reference< XConnection> xCon(xFormSet->getPropertyValue(PROPERTY_ACTIVE_CONNECTION"ActiveConnection"),UNO_QUERY); | |||
1743 | if(bFilter) | |||
1744 | { | |||
1745 | DlgFilterCrit aDlg(getFrameWeld(), getORB(), xCon, xParser, m_xColumnsSupplier->getColumns()); | |||
1746 | if (!aDlg.run()) | |||
1747 | return; // if so we don't need to update the grid | |||
1748 | aDlg.BuildWherePart(); | |||
1749 | } | |||
1750 | else | |||
1751 | { | |||
1752 | DlgOrderCrit aDlg(getFrameWeld(), xCon, xParser, m_xColumnsSupplier->getColumns()); | |||
1753 | if (!aDlg.run()) | |||
1754 | { | |||
1755 | return; // if so we don't need to actualize the grid | |||
1756 | } | |||
1757 | aDlg.BuildOrderPart(); | |||
1758 | } | |||
1759 | } | |||
1760 | catch(const SQLException& ) | |||
1761 | { | |||
1762 | SQLExceptionInfo aError( ::cppu::getCaughtException() ); | |||
1763 | showError( aError ); | |||
1764 | return; | |||
1765 | } | |||
1766 | catch(Exception&) | |||
1767 | { | |||
1768 | return; | |||
1769 | } | |||
1770 | ||||
1771 | OUString sNewVal = bFilter ? xParser->getFilter() : xParser->getOrder(); | |||
1772 | bool bOldFilterApplied(false); | |||
1773 | if (bFilter) | |||
1774 | { | |||
1775 | try { bOldFilterApplied = ::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_APPLYFILTER"ApplyFilter")); } catch(Exception&) { } ; | |||
1776 | } | |||
1777 | ||||
1778 | OUString sNewHaving = xParser->getHavingClause(); | |||
1779 | if ( sOldVal == sNewVal && (!bFilter || sOldHaving == sNewHaving) ) | |||
1780 | // nothing to be done | |||
1781 | return; | |||
1782 | ||||
1783 | if (bFilter) | |||
1784 | applyParserFilter(sOldVal, bOldFilterApplied,sOldHaving,xParser); | |||
1785 | else | |||
1786 | applyParserOrder(sOldVal,xParser); | |||
1787 | ||||
1788 | ::comphelper::disposeComponent(xParser); | |||
1789 | } | |||
1790 | ||||
1791 | void SbaXDataBrowserController::ExecuteSearch() | |||
1792 | { | |||
1793 | // calculate the control source of the active field | |||
1794 | Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY); | |||
1795 | OSL_ENSURE(xGrid.is(), "SbaXDataBrowserController::ExecuteSearch : the control should have a css::form::XGrid interface !")do { if (true && (!(xGrid.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1795" ": "), "%s", "SbaXDataBrowserController::ExecuteSearch : the control should have a css::form::XGrid interface !" ); } } while (false); | |||
1796 | ||||
1797 | Reference< css::form::XGridPeer > xGridPeer(getBrowserView()->getGridControl()->getPeer(), UNO_QUERY); | |||
1798 | Reference< css::container::XIndexContainer > xColumns = xGridPeer->getColumns(); | |||
1799 | OSL_ENSURE(xGridPeer.is() && xColumns.is(), "SbaXDataBrowserController::ExecuteSearch : invalid peer !")do { if (true && (!(xGridPeer.is() && xColumns .is()))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ( "legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1799" ": "), "%s", "SbaXDataBrowserController::ExecuteSearch : invalid peer !" ); } } while (false); | |||
1800 | ||||
1801 | sal_Int16 nViewCol = xGrid->getCurrentColumnPosition(); | |||
1802 | sal_Int16 nModelCol = getBrowserView()->View2ModelPos(nViewCol); | |||
1803 | ||||
1804 | Reference< XPropertySet > xCurrentCol(xColumns->getByIndex(nModelCol),UNO_QUERY); | |||
1805 | OUString sActiveField = ::comphelper::getString(xCurrentCol->getPropertyValue(PROPERTY_CONTROLSOURCE"DataField")); | |||
1806 | ||||
1807 | // the text within the current cell | |||
1808 | OUString sInitialText; | |||
1809 | Reference< css::container::XIndexAccess > xColControls(xGridPeer, UNO_QUERY); | |||
1810 | Reference< XInterface > xCurControl(xColControls->getByIndex(nViewCol),UNO_QUERY); | |||
1811 | OUString aInitialText; | |||
1812 | if (IsSearchableControl(xCurControl, &aInitialText)) | |||
1813 | sInitialText = aInitialText; | |||
1814 | ||||
1815 | // prohibit the synchronization of the grid's display with the cursor's position | |||
1816 | Reference< XPropertySet > xModelSet(getControlModel(), UNO_QUERY); | |||
1817 | OSL_ENSURE(xModelSet.is(), "SbaXDataBrowserController::ExecuteSearch : no model set ?!")do { if (true && (!(xModelSet.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1817" ": "), "%s", "SbaXDataBrowserController::ExecuteSearch : no model set ?!" ); } } while (false); | |||
1818 | xModelSet->setPropertyValue("DisplayIsSynchron", css::uno::Any(false)); | |||
1819 | xModelSet->setPropertyValue("AlwaysShowCursor", css::uno::Any(true)); | |||
1820 | xModelSet->setPropertyValue("CursorColor", makeAny(COL_LIGHTRED)); | |||
1821 | ||||
1822 | SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); | |||
1823 | VclPtr<AbstractFmSearchDialog> pDialog; | |||
1824 | std::vector< OUString > aContextNames; | |||
1825 | aContextNames.emplace_back("Standard" ); | |||
1826 | pDialog = pFact->CreateFmSearchDialog(getFrameWeld(), sInitialText, aContextNames, 0, LINK(this, SbaXDataBrowserController, OnSearchContextRequest)::tools::detail::makeLink( ::tools::detail::castTo<SbaXDataBrowserController *>(this), &SbaXDataBrowserController::LinkStubOnSearchContextRequest )); | |||
1827 | pDialog->SetActiveField( sActiveField ); | |||
1828 | pDialog->SetFoundHandler( LINK( this, SbaXDataBrowserController, OnFoundData )::tools::detail::makeLink( ::tools::detail::castTo<SbaXDataBrowserController *>(this), &SbaXDataBrowserController::LinkStubOnFoundData ) ); | |||
1829 | pDialog->SetCanceledNotFoundHdl( LINK( this, SbaXDataBrowserController, OnCanceledNotFound )::tools::detail::makeLink( ::tools::detail::castTo<SbaXDataBrowserController *>(this), &SbaXDataBrowserController::LinkStubOnCanceledNotFound ) ); | |||
1830 | pDialog->Execute(); | |||
1831 | pDialog.disposeAndClear(); | |||
1832 | ||||
1833 | // restore the grid's normal operating state | |||
1834 | xModelSet->setPropertyValue("DisplayIsSynchron", css::uno::Any(true)); | |||
1835 | xModelSet->setPropertyValue("AlwaysShowCursor", css::uno::Any(false)); | |||
1836 | xModelSet->setPropertyValue("CursorColor", Any()); | |||
1837 | } | |||
1838 | ||||
1839 | void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< PropertyValue >& _rArgs) | |||
1840 | { | |||
1841 | bool bSortUp = true; | |||
1842 | ||||
1843 | switch (nId) | |||
1844 | { | |||
1845 | default: | |||
1846 | SbaXDataBrowserController_Base::Execute( nId, _rArgs ); | |||
1847 | return; | |||
1848 | ||||
1849 | case ID_BROWSER_INSERT_ROW(((((((10000 + 1499) + 1) + 499) + 1) + 100) + 1) + 46): | |||
1850 | try | |||
1851 | { | |||
1852 | if (SaveModified()) | |||
1853 | { | |||
1854 | getRowSet()->afterLast(); | |||
1855 | // check if it is available | |||
1856 | Reference< XResultSetUpdate > xUpdateCursor(getRowSet(), UNO_QUERY_THROW); | |||
1857 | xUpdateCursor->moveToInsertRow(); | |||
1858 | } | |||
1859 | } | |||
1860 | catch(Exception&) | |||
1861 | { | |||
1862 | TOOLS_WARN_EXCEPTION("dbaccess.ui", "" )do { css::uno::Any tools_warn_exception( DbgGetCaughtException () ); do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "" << " " << exceptionToString(tools_warn_exception)) == 1) { ::sal_detail_log ( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1862" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "" << " " << exceptionToString (tools_warn_exception)), 0); } else { ::std::ostringstream sal_detail_stream ; sal_detail_stream << "" << " " << exceptionToString (tools_warn_exception); ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN ), ("dbaccess.ui"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1862" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "" << " " << exceptionToString(tools_warn_exception )) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ( "dbaccess.ui"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1862" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "" << " " << exceptionToString (tools_warn_exception)), 0); } else { ::std::ostringstream sal_detail_stream ; sal_detail_stream << "" << " " << exceptionToString (tools_warn_exception); ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN ), ("dbaccess.ui"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1862" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); } while (false); | |||
1863 | } | |||
1864 | break; | |||
1865 | case SID_FM_DELETEROWS( 10000 + 610 ): | |||
1866 | ||||
1867 | if (SaveModified()) | |||
1868 | { | |||
1869 | SbaGridControl* pVclGrid = getBrowserView()->getVclControl(); | |||
1870 | if ( pVclGrid ) | |||
1871 | { | |||
1872 | if( !pVclGrid->GetSelectRowCount() ) | |||
1873 | { | |||
1874 | pVclGrid->DeactivateCell(); | |||
1875 | pVclGrid->SelectRow(pVclGrid->GetCurRow()); | |||
1876 | } | |||
1877 | pVclGrid->DeleteSelectedRows(); | |||
1878 | } | |||
1879 | } | |||
1880 | break; | |||
1881 | ||||
1882 | case ID_BROWSER_FILTERED( 10000 + 723 ): | |||
1883 | if (SaveModified()) | |||
1884 | { | |||
1885 | Reference< XPropertySet > xActiveSet(getRowSet(), UNO_QUERY); | |||
1886 | bool bApplied = ::comphelper::getBOOL(xActiveSet->getPropertyValue(PROPERTY_APPLYFILTER"ApplyFilter")); | |||
1887 | xActiveSet->setPropertyValue(PROPERTY_APPLYFILTER"ApplyFilter", css::uno::Any(!bApplied)); | |||
1888 | reloadForm(m_xLoadable); | |||
1889 | } | |||
1890 | InvalidateFeature(ID_BROWSER_FILTERED( 10000 + 723 )); | |||
1891 | break; | |||
1892 | case ID_BROWSER_EDITDOC(5000 + 1312): | |||
1893 | { | |||
1894 | DbGridControlOptions nGridMode = getBrowserView()->getVclControl()->GetOptions(); | |||
1895 | if (nGridMode == DbGridControlOptions::Readonly) | |||
1896 | getBrowserView()->getVclControl()->SetOptions(DbGridControlOptions::Update | DbGridControlOptions::Insert | DbGridControlOptions::Delete); | |||
1897 | // the options not supported by the data source will be removed automatically | |||
1898 | else | |||
1899 | { | |||
1900 | if ( !SaveModified( ) ) | |||
1901 | // give the user a chance to save the current record (if necessary) | |||
1902 | break; | |||
1903 | ||||
1904 | // maybe the user wanted to reject the modified record ? | |||
1905 | if (GetState(ID_BROWSER_UNDORECORD( 10000 + 630 )).bEnabled) | |||
1906 | Execute(ID_BROWSER_UNDORECORD( 10000 + 630 ),Sequence<PropertyValue>()); | |||
1907 | ||||
1908 | getBrowserView()->getVclControl()->SetOptions(DbGridControlOptions::Readonly); | |||
1909 | } | |||
1910 | InvalidateFeature(ID_BROWSER_EDITDOC(5000 + 1312)); | |||
1911 | } | |||
1912 | break; | |||
1913 | ||||
1914 | case ID_BROWSER_SEARCH( 10000 + 725 ): | |||
1915 | if ( SaveModified( ) ) | |||
1916 | ExecuteSearch(); | |||
1917 | break; | |||
1918 | ||||
1919 | case ID_BROWSER_COPY(5000 + 711): | |||
1920 | if ( getBrowserView()->getVclControl()->GetSelectRowCount() > 0 ) | |||
1921 | { | |||
1922 | getBrowserView()->getVclControl()->CopySelectedRowsToClipboard(); | |||
1923 | break; | |||
1924 | } | |||
1925 | [[fallthrough]]; | |||
1926 | case ID_BROWSER_CUT(5000 + 710): | |||
1927 | case ID_BROWSER_PASTE(5000 + 712): | |||
1928 | { | |||
1929 | CellControllerRef xCurrentController = getBrowserView()->getVclControl()->Controller(); | |||
1930 | if (EditCellController* pController = dynamic_cast<EditCellController*>(xCurrentController.get())) | |||
1931 | { | |||
1932 | IEditImplementation* pEditImplementation = pController->GetEditImplementation(); | |||
1933 | switch (nId) | |||
1934 | { | |||
1935 | case ID_BROWSER_CUT(5000 + 710): | |||
1936 | pEditImplementation->Cut(); | |||
1937 | break; | |||
1938 | case SID_COPY(5000 + 711): | |||
1939 | pEditImplementation->Copy(); | |||
1940 | break; | |||
1941 | case ID_BROWSER_PASTE(5000 + 712): | |||
1942 | pEditImplementation->Paste(); | |||
1943 | break; | |||
1944 | } | |||
1945 | if (ID_BROWSER_CUT(5000 + 710) == nId || ID_BROWSER_PASTE(5000 + 712) == nId) | |||
1946 | pController->Modify(); | |||
1947 | } | |||
1948 | } | |||
1949 | break; | |||
1950 | ||||
1951 | case ID_BROWSER_SORTDOWN( 10000 + 713 ): | |||
1952 | bSortUp = false; | |||
1953 | [[fallthrough]]; | |||
1954 | case ID_BROWSER_SORTUP( 10000 + 712 ): | |||
1955 | { | |||
1956 | if (!SaveModified()) | |||
1957 | break; | |||
1958 | ||||
1959 | if (!isValidCursor()) | |||
1960 | break; | |||
1961 | ||||
1962 | // only one sort order | |||
1963 | Reference< XPropertySet > xField = getBoundField(); | |||
1964 | if (!xField.is()) | |||
1965 | break; | |||
1966 | ||||
1967 | Reference< XSingleSelectQueryComposer > xParser = createParser_nothrow(); | |||
1968 | const OUString sOldSort = xParser->getOrder(); | |||
1969 | bool bParserSuccess = false; | |||
1970 | HANDLE_SQL_ERRORS(try { bParserSuccess = false; xParser->setOrder(OUString() ); xParser->appendOrderByColumn(xField, bSortUp); bParserSuccess = true; } catch(SQLException& e) { SQLException aError = ::dbtools::prependErrorInfo(e, *this, ::dbaccess::ResourceManager ::loadString( reinterpret_cast<char const *>("SBA_BROWSER_SETTING_ORDER" "\004" u8"Error setting the sort criteria") )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent) ; } catch(Exception&) { DbgUnhandledException( DbgGetCaughtException (), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1975" ": ", "dbaccess" );; } | |||
1971 | xParser->setOrder(OUString()); xParser->appendOrderByColumn(xField, bSortUp),try { bParserSuccess = false; xParser->setOrder(OUString() ); xParser->appendOrderByColumn(xField, bSortUp); bParserSuccess = true; } catch(SQLException& e) { SQLException aError = ::dbtools::prependErrorInfo(e, *this, ::dbaccess::ResourceManager ::loadString( reinterpret_cast<char const *>("SBA_BROWSER_SETTING_ORDER" "\004" u8"Error setting the sort criteria") )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent) ; } catch(Exception&) { DbgUnhandledException( DbgGetCaughtException (), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1975" ": ", "dbaccess" );; } | |||
1972 | bParserSuccess,try { bParserSuccess = false; xParser->setOrder(OUString() ); xParser->appendOrderByColumn(xField, bSortUp); bParserSuccess = true; } catch(SQLException& e) { SQLException aError = ::dbtools::prependErrorInfo(e, *this, ::dbaccess::ResourceManager ::loadString( reinterpret_cast<char const *>("SBA_BROWSER_SETTING_ORDER" "\004" u8"Error setting the sort criteria") )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent) ; } catch(Exception&) { DbgUnhandledException( DbgGetCaughtException (), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1975" ": ", "dbaccess" );; } | |||
1973 | DBA_RES(SBA_BROWSER_SETTING_ORDER),try { bParserSuccess = false; xParser->setOrder(OUString() ); xParser->appendOrderByColumn(xField, bSortUp); bParserSuccess = true; } catch(SQLException& e) { SQLException aError = ::dbtools::prependErrorInfo(e, *this, ::dbaccess::ResourceManager ::loadString( reinterpret_cast<char const *>("SBA_BROWSER_SETTING_ORDER" "\004" u8"Error setting the sort criteria") )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent) ; } catch(Exception&) { DbgUnhandledException( DbgGetCaughtException (), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1975" ": ", "dbaccess" );; } | |||
1974 | "SbaXDataBrowserController::Execute : caught an exception while composing the new filter !"try { bParserSuccess = false; xParser->setOrder(OUString() ); xParser->appendOrderByColumn(xField, bSortUp); bParserSuccess = true; } catch(SQLException& e) { SQLException aError = ::dbtools::prependErrorInfo(e, *this, ::dbaccess::ResourceManager ::loadString( reinterpret_cast<char const *>("SBA_BROWSER_SETTING_ORDER" "\004" u8"Error setting the sort criteria") )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent) ; } catch(Exception&) { DbgUnhandledException( DbgGetCaughtException (), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1975" ": ", "dbaccess" );; } | |||
1975 | )try { bParserSuccess = false; xParser->setOrder(OUString() ); xParser->appendOrderByColumn(xField, bSortUp); bParserSuccess = true; } catch(SQLException& e) { SQLException aError = ::dbtools::prependErrorInfo(e, *this, ::dbaccess::ResourceManager ::loadString( reinterpret_cast<char const *>("SBA_BROWSER_SETTING_ORDER" "\004" u8"Error setting the sort criteria") )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent) ; } catch(Exception&) { DbgUnhandledException( DbgGetCaughtException (), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "1975" ": ", "dbaccess" );; } | |||
1976 | ||||
1977 | if (bParserSuccess) | |||
1978 | applyParserOrder(sOldSort,xParser); | |||
1979 | } | |||
1980 | break; | |||
1981 | ||||
1982 | case ID_BROWSER_AUTOFILTER( 10000 + 716 ): | |||
1983 | { | |||
1984 | if (!SaveModified()) | |||
1985 | break; | |||
1986 | ||||
1987 | if (!isValidCursor()) | |||
1988 | break; | |||
1989 | ||||
1990 | Reference< XPropertySet > xField = getBoundField(); | |||
1991 | if (!xField.is()) | |||
1992 | break; | |||
1993 | ||||
1994 | // check if the column is an aggregate function | |||
1995 | const bool bHaving(isAggregateColumn(m_xParser, xField)); | |||
1996 | ||||
1997 | Reference< XSingleSelectQueryComposer > xParser = createParser_nothrow(); | |||
1998 | const OUString sOldFilter = xParser->getFilter(); | |||
1999 | const OUString sOldHaving = xParser->getHavingClause(); | |||
2000 | ||||
2001 | Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
2002 | bool bApplied = ::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_APPLYFILTER"ApplyFilter")); | |||
2003 | // do we have a filter but it's not applied ? | |||
2004 | // -> completely overwrite it, else append one | |||
2005 | if (!bApplied) | |||
2006 | { | |||
2007 | DO_SAFE( xParser->setFilter( OUString()), "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !" )try { xParser->setFilter( OUString()); } catch(Exception& ) { do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2007" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2007" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2007" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2007" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); } ;; | |||
2008 | DO_SAFE( xParser->setHavingClause(OUString()), "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !" )try { xParser->setHavingClause(OUString()); } catch(Exception &) { do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2008" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2008" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2008" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2008" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); } ;; | |||
2009 | } | |||
2010 | ||||
2011 | bool bParserSuccess = false; | |||
2012 | ||||
2013 | const sal_Int32 nOp = SQLFilterOperator::EQUAL; | |||
2014 | ||||
2015 | if ( bHaving ) | |||
2016 | { | |||
2017 | HANDLE_SQL_ERRORS(try { bParserSuccess = false; xParser->appendHavingClauseByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2022" ": ", "dbaccess" );; } | |||
2018 | xParser->appendHavingClauseByColumn(xField,true,nOp),try { bParserSuccess = false; xParser->appendHavingClauseByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2022" ": ", "dbaccess" );; } | |||
2019 | bParserSuccess,try { bParserSuccess = false; xParser->appendHavingClauseByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2022" ": ", "dbaccess" );; } | |||
2020 | DBA_RES(SBA_BROWSER_SETTING_FILTER),try { bParserSuccess = false; xParser->appendHavingClauseByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2022" ": ", "dbaccess" );; } | |||
2021 | "SbaXDataBrowserController::Execute : caught an exception while composing the new filter !"try { bParserSuccess = false; xParser->appendHavingClauseByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2022" ": ", "dbaccess" );; } | |||
2022 | )try { bParserSuccess = false; xParser->appendHavingClauseByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2022" ": ", "dbaccess" );; } | |||
2023 | } | |||
2024 | else | |||
2025 | { | |||
2026 | HANDLE_SQL_ERRORS(try { bParserSuccess = false; xParser->appendFilterByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2031" ": ", "dbaccess" );; } | |||
2027 | xParser->appendFilterByColumn(xField,true,nOp),try { bParserSuccess = false; xParser->appendFilterByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2031" ": ", "dbaccess" );; } | |||
2028 | bParserSuccess,try { bParserSuccess = false; xParser->appendFilterByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2031" ": ", "dbaccess" );; } | |||
2029 | DBA_RES(SBA_BROWSER_SETTING_FILTER),try { bParserSuccess = false; xParser->appendFilterByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2031" ": ", "dbaccess" );; } | |||
2030 | "SbaXDataBrowserController::Execute : caught an exception while composing the new filter !"try { bParserSuccess = false; xParser->appendFilterByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2031" ": ", "dbaccess" );; } | |||
2031 | )try { bParserSuccess = false; xParser->appendFilterByColumn (xField,true,nOp); bParserSuccess = true; } catch(SQLException & e) { SQLException aError = ::dbtools::prependErrorInfo( e, *this, ::dbaccess::ResourceManager::loadString( reinterpret_cast <char const *>("SBA_BROWSER_SETTING_FILTER" "\004" u8"Error setting the filter criteria" ) )); css::sdb::SQLErrorEvent aEvent; aEvent.Reason <<= aError; errorOccured(aEvent); } catch(Exception&) { DbgUnhandledException ( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2031" ": ", "dbaccess" );; } | |||
2032 | } | |||
2033 | ||||
2034 | if (bParserSuccess) | |||
2035 | applyParserFilter(sOldFilter, bApplied,sOldHaving,xParser); | |||
2036 | ||||
2037 | InvalidateFeature(ID_BROWSER_REMOVEFILTER( 10000 + 711 )); | |||
2038 | InvalidateFeature(ID_BROWSER_FILTERED( 10000 + 723 )); | |||
2039 | } | |||
2040 | break; | |||
2041 | ||||
2042 | case ID_BROWSER_ORDERCRIT( 10000 + 714 ): | |||
2043 | ExecuteFilterSortCrit(false); | |||
2044 | break; | |||
2045 | ||||
2046 | case ID_BROWSER_FILTERCRIT( 10000 + 715 ): | |||
2047 | ExecuteFilterSortCrit(true); | |||
2048 | InvalidateFeature(ID_BROWSER_FILTERED( 10000 + 723 )); | |||
2049 | break; | |||
2050 | ||||
2051 | case ID_BROWSER_REMOVEFILTER( 10000 + 711 ): | |||
2052 | { | |||
2053 | if (!SaveModified()) | |||
2054 | break; | |||
2055 | ||||
2056 | bool bNeedPostReload = preReloadForm(); | |||
2057 | // reset the filter and the sort property simultaneously so only _one_ new statement has to be | |||
2058 | // sent | |||
2059 | Reference< XPropertySet > xSet(getRowSet(), UNO_QUERY); | |||
2060 | if ( xSet.is() ) | |||
2061 | { | |||
2062 | xSet->setPropertyValue(PROPERTY_FILTER"Filter",makeAny(OUString())); | |||
2063 | xSet->setPropertyValue(PROPERTY_HAVING_CLAUSE"HavingClause",makeAny(OUString())); | |||
2064 | xSet->setPropertyValue(PROPERTY_ORDER"Order",makeAny(OUString())); | |||
2065 | } | |||
2066 | try | |||
2067 | { | |||
2068 | reloadForm(m_xLoadable); | |||
2069 | if ( bNeedPostReload ) | |||
2070 | postReloadForm(); | |||
2071 | } | |||
2072 | catch(Exception&) | |||
2073 | { | |||
2074 | } | |||
2075 | InvalidateFeature(ID_BROWSER_REMOVEFILTER( 10000 + 711 )); | |||
2076 | InvalidateFeature(ID_BROWSER_FILTERED( 10000 + 723 )); | |||
2077 | } | |||
2078 | break; | |||
2079 | ||||
2080 | case ID_BROWSER_REFRESH( 10000 + 724 ): | |||
2081 | if ( SaveModified( ) ) | |||
2082 | { | |||
2083 | if (!reloadForm(m_xLoadable)) | |||
2084 | criticalFail(); | |||
2085 | } | |||
2086 | break; | |||
2087 | ||||
2088 | case ID_BROWSER_SAVERECORD( 10000 + 627 ): | |||
2089 | if ( SaveModified( false ) ) | |||
2090 | setCurrentModified( false ); | |||
2091 | break; | |||
2092 | ||||
2093 | case ID_BROWSER_UNDORECORD( 10000 + 630 ): | |||
2094 | { | |||
2095 | try | |||
2096 | { | |||
2097 | // restore the cursor state | |||
2098 | Reference< XResultSetUpdate > xCursor(getRowSet(), UNO_QUERY); | |||
2099 | Reference< XPropertySet > xSet(xCursor, UNO_QUERY); | |||
2100 | Any aVal = xSet->getPropertyValue(PROPERTY_ISNEW"IsNew"); | |||
2101 | if (aVal.hasValue() && ::comphelper::getBOOL(aVal)) | |||
2102 | { | |||
2103 | xCursor->moveToInsertRow(); | |||
2104 | // no need to reset the grid model after we moved to the insert row, this is done implicitly by the | |||
2105 | // form | |||
2106 | // (and in some cases it may be deadly to do the reset explicitly after the form did it implicitly, | |||
2107 | // cause the form's reset may be async, and this leads to some nice deadlock scenarios...) | |||
2108 | } | |||
2109 | else | |||
2110 | { | |||
2111 | xCursor->cancelRowUpdates(); | |||
2112 | ||||
2113 | // restore the grids state | |||
2114 | Reference< css::form::XReset > xReset(getControlModel(), UNO_QUERY); | |||
2115 | if (xReset.is()) | |||
2116 | xReset->reset(); | |||
2117 | } | |||
2118 | } | |||
2119 | catch(SQLException&) | |||
2120 | { | |||
2121 | } | |||
2122 | ||||
2123 | setCurrentModified( false ); | |||
2124 | } | |||
2125 | } | |||
2126 | } | |||
2127 | ||||
2128 | bool SbaXDataBrowserController::SaveModified(bool bAskFor) | |||
2129 | { | |||
2130 | if ( bAskFor && GetState(ID_BROWSER_SAVERECORD( 10000 + 627 )).bEnabled ) | |||
2131 | { | |||
2132 | getBrowserView()->getVclControl()->GrabFocus(); | |||
2133 | ||||
2134 | std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/savemodifieddialog.ui")); | |||
2135 | std::unique_ptr<weld::MessageDialog> xQry(xBuilder->weld_message_dialog("SaveModifiedDialog")); | |||
2136 | switch (xQry->run()) | |||
2137 | { | |||
2138 | case RET_NO: | |||
2139 | Execute(ID_BROWSER_UNDORECORD( 10000 + 630 ),Sequence<PropertyValue>()); | |||
2140 | return true; | |||
2141 | case RET_CANCEL: | |||
2142 | return false; | |||
2143 | } | |||
2144 | } | |||
2145 | ||||
2146 | if ( !CommitCurrent() ) // Commit the current control | |||
2147 | return false; | |||
2148 | ||||
2149 | Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
2150 | bool bResult = false; | |||
2151 | try | |||
2152 | { | |||
2153 | if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ISMODIFIED"IsModified"))) | |||
2154 | { | |||
2155 | Reference< XResultSetUpdate > xCursor(getRowSet(), UNO_QUERY); | |||
2156 | if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ISNEW"IsNew"))) | |||
2157 | xCursor->insertRow(); | |||
2158 | else | |||
2159 | xCursor->updateRow(); | |||
2160 | } | |||
2161 | bResult = true; | |||
2162 | } | |||
2163 | catch(SQLException&) | |||
2164 | { | |||
2165 | } | |||
2166 | catch(Exception&) | |||
2167 | { | |||
2168 | SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::SaveModified : could not save the current record !")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN , "dbaccess.ui")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult ( ::sal::detail::StreamStart() << "SbaXDataBrowserController::SaveModified : could not save the current record !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2168" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::SaveModified : could not save the current record !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::SaveModified : could not save the current record !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2168" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL : if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart () << "SbaXDataBrowserController::SaveModified : could not save the current record !" ) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2168" ": "), ::sal::detail::unwrapStream( ::sal::detail ::StreamStart() << "SbaXDataBrowserController::SaveModified : could not save the current record !" ), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream << "SbaXDataBrowserController::SaveModified : could not save the current record !" ; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("dbaccess.ui" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2168" ": "), sal_detail_stream, 0); }; std::abort(); break ; } } } while (false); | |||
2169 | bResult = false; | |||
2170 | } | |||
2171 | ||||
2172 | InvalidateFeature(ID_BROWSER_SAVERECORD( 10000 + 627 )); | |||
2173 | InvalidateFeature(ID_BROWSER_UNDORECORD( 10000 + 630 )); | |||
2174 | return bResult; | |||
2175 | } | |||
2176 | ||||
2177 | bool SbaXDataBrowserController::CommitCurrent() | |||
2178 | { | |||
2179 | if (!getBrowserView()) | |||
2180 | return true; | |||
2181 | ||||
2182 | Reference< css::awt::XControl > xActiveControl(getBrowserView()->getGridControl()); | |||
2183 | Reference< css::form::XBoundControl > xLockingTest(xActiveControl, UNO_QUERY); | |||
2184 | bool bControlIsLocked = xLockingTest.is() && xLockingTest->getLock(); | |||
2185 | if (xActiveControl.is() && !bControlIsLocked) | |||
2186 | { | |||
2187 | // At first check Control if it supports the IFace | |||
2188 | Reference< css::form::XBoundComponent > xBoundControl(xActiveControl, UNO_QUERY); | |||
2189 | if (!xBoundControl.is()) | |||
2190 | xBoundControl.set(xActiveControl->getModel(), UNO_QUERY); | |||
2191 | if (xBoundControl.is() && !xBoundControl->commit()) | |||
2192 | return false; | |||
2193 | } | |||
2194 | return true; | |||
2195 | } | |||
2196 | ||||
2197 | void SbaXDataBrowserController::setCurrentModified( bool _bSet ) | |||
2198 | { | |||
2199 | m_bCurrentlyModified = _bSet; | |||
2200 | InvalidateFeature( ID_BROWSER_SAVERECORD( 10000 + 627 ) ); | |||
2201 | InvalidateFeature( ID_BROWSER_UNDORECORD( 10000 + 630 ) ); | |||
2202 | } | |||
2203 | ||||
2204 | void SbaXDataBrowserController::RowChanged() | |||
2205 | { | |||
2206 | setCurrentModified( false ); | |||
2207 | } | |||
2208 | ||||
2209 | void SbaXDataBrowserController::ColumnChanged() | |||
2210 | { | |||
2211 | InvalidateFeature(ID_BROWSER_SORTUP( 10000 + 712 )); | |||
2212 | InvalidateFeature(ID_BROWSER_SORTDOWN( 10000 + 713 )); | |||
2213 | InvalidateFeature(ID_BROWSER_ORDERCRIT( 10000 + 714 )); | |||
2214 | InvalidateFeature(ID_BROWSER_FILTERCRIT( 10000 + 715 )); | |||
2215 | InvalidateFeature(ID_BROWSER_AUTOFILTER( 10000 + 716 )); | |||
2216 | InvalidateFeature(ID_BROWSER_REMOVEFILTER( 10000 + 711 )); | |||
2217 | ||||
2218 | setCurrentModified( false ); | |||
2219 | } | |||
2220 | ||||
2221 | void SbaXDataBrowserController::SelectionChanged() | |||
2222 | { | |||
2223 | // not interested in | |||
2224 | } | |||
2225 | ||||
2226 | void SbaXDataBrowserController::CellActivated() | |||
2227 | { | |||
2228 | m_aInvalidateClipboard.Start(); | |||
2229 | OnInvalidateClipboard( nullptr ); | |||
2230 | } | |||
2231 | ||||
2232 | void SbaXDataBrowserController::CellDeactivated() | |||
2233 | { | |||
2234 | m_aInvalidateClipboard.Stop(); | |||
2235 | OnInvalidateClipboard( nullptr ); | |||
2236 | } | |||
2237 | ||||
2238 | IMPL_LINK_NOARG(SbaXDataBrowserController, OnClipboardChanged, TransferableDataHelper*, void)void SbaXDataBrowserController::LinkStubOnClipboardChanged(void * instance, TransferableDataHelper* data) { return static_cast <SbaXDataBrowserController *>(instance)->OnClipboardChanged (data); } void SbaXDataBrowserController::OnClipboardChanged( __attribute__ ((unused)) TransferableDataHelper*) | |||
2239 | { | |||
2240 | SolarMutexGuard aGuard; | |||
2241 | OnInvalidateClipboard( nullptr ); | |||
2242 | } | |||
2243 | ||||
2244 | IMPL_LINK(SbaXDataBrowserController, OnInvalidateClipboard, Timer*, _pTimer, void)void SbaXDataBrowserController::LinkStubOnInvalidateClipboard (void * instance, Timer* data) { return static_cast<SbaXDataBrowserController *>(instance)->OnInvalidateClipboard(data); } void SbaXDataBrowserController ::OnInvalidateClipboard(Timer* _pTimer) | |||
2245 | { | |||
2246 | InvalidateFeature(ID_BROWSER_CUT(5000 + 710)); | |||
2247 | InvalidateFeature(ID_BROWSER_COPY(5000 + 711)); | |||
2248 | ||||
2249 | // if the invalidation was triggered by the timer, we do not need to invalidate PASTE. | |||
2250 | // The timer is only for checking the CUT/COPY slots regularly, which depend on the | |||
2251 | // selection state of the active cell | |||
2252 | // TODO: get a callback at the Edit which allows to be notified when the selection | |||
2253 | // changes. This would be much better than this cycle-eating polling mechanism here... | |||
2254 | if ( _pTimer != &m_aInvalidateClipboard ) | |||
2255 | InvalidateFeature(ID_BROWSER_PASTE(5000 + 712)); | |||
2256 | } | |||
2257 | ||||
2258 | Reference< XPropertySet > SbaXDataBrowserController::getBoundField() const | |||
2259 | { | |||
2260 | Reference< XPropertySet > xEmptyReturn; | |||
2261 | ||||
2262 | // get the current column from the grid | |||
2263 | Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY); | |||
2264 | if (!xGrid.is()) | |||
2265 | return xEmptyReturn; | |||
2266 | sal_uInt16 nViewPos = xGrid->getCurrentColumnPosition(); | |||
2267 | sal_uInt16 nCurrentCol = getBrowserView()->View2ModelPos(nViewPos); | |||
2268 | if (nCurrentCol == sal_uInt16(-1)) | |||
2269 | return xEmptyReturn; | |||
2270 | ||||
2271 | // get the according column from the model | |||
2272 | Reference< css::container::XIndexContainer > xCols(getControlModel(), UNO_QUERY); | |||
2273 | Reference< XPropertySet > xCurrentCol(xCols->getByIndex(nCurrentCol),UNO_QUERY); | |||
2274 | if (!xCurrentCol.is()) | |||
2275 | return xEmptyReturn; | |||
2276 | ||||
2277 | xEmptyReturn.set(xCurrentCol->getPropertyValue(PROPERTY_BOUNDFIELD"BoundField") ,UNO_QUERY); | |||
2278 | return xEmptyReturn; | |||
2279 | } | |||
2280 | ||||
2281 | IMPL_LINK(SbaXDataBrowserController, OnSearchContextRequest, FmSearchContext&, rContext, sal_uInt32)sal_uInt32 SbaXDataBrowserController::LinkStubOnSearchContextRequest (void * instance, FmSearchContext& data) { return static_cast <SbaXDataBrowserController *>(instance)->OnSearchContextRequest (data); } sal_uInt32 SbaXDataBrowserController::OnSearchContextRequest (FmSearchContext& rContext) | |||
2282 | { | |||
2283 | Reference< css::container::XIndexAccess > xPeerContainer(getBrowserView()->getGridControl(), UNO_QUERY); | |||
2284 | ||||
2285 | // check all grid columns for their control source | |||
2286 | Reference< css::container::XIndexAccess > xModelColumns(getFormComponent(), UNO_QUERY); | |||
2287 | OSL_ENSURE(xModelColumns.is(), "SbaXDataBrowserController::OnSearchContextRequest : there is a grid control without columns !")do { if (true && (!(xModelColumns.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2287" ": "), "%s", "SbaXDataBrowserController::OnSearchContextRequest : there is a grid control without columns !" ); } } while (false); | |||
2288 | // the case 'no columns' should be indicated with an empty container, I think ... | |||
2289 | OSL_ENSURE(xModelColumns->getCount() >= xPeerContainer->getCount(), "SbaXDataBrowserController::OnSearchContextRequest : impossible : have more view than model columns !")do { if (true && (!(xModelColumns->getCount() >= xPeerContainer->getCount()))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN ), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2289" ": "), "%s", "SbaXDataBrowserController::OnSearchContextRequest : impossible : have more view than model columns !" ); } } while (false); | |||
2290 | ||||
2291 | OUString sFieldList; | |||
2292 | for (sal_Int32 nViewPos=0; nViewPos<xPeerContainer->getCount(); ++nViewPos) | |||
2293 | { | |||
2294 | Reference< XInterface > xCurrentColumn(xPeerContainer->getByIndex(nViewPos),UNO_QUERY); | |||
2295 | if (!xCurrentColumn.is()) | |||
2296 | continue; | |||
2297 | ||||
2298 | // can we use this column control for searching ? | |||
2299 | if (!IsSearchableControl(xCurrentColumn)) | |||
2300 | continue; | |||
2301 | ||||
2302 | sal_uInt16 nModelPos = getBrowserView()->View2ModelPos(static_cast<sal_uInt16>(nViewPos)); | |||
2303 | Reference< XPropertySet > xCurrentColModel(xModelColumns->getByIndex(nModelPos),UNO_QUERY); | |||
2304 | OUString aName = ::comphelper::getString(xCurrentColModel->getPropertyValue(PROPERTY_CONTROLSOURCE"DataField")); | |||
2305 | ||||
2306 | sFieldList += aName + ";"; | |||
2307 | ||||
2308 | rContext.arrFields.push_back(xCurrentColumn); | |||
2309 | } | |||
2310 | sFieldList = comphelper::string::stripEnd(sFieldList, ';'); | |||
2311 | ||||
2312 | rContext.xCursor = getRowSet(); | |||
2313 | rContext.strUsedFields = sFieldList; | |||
2314 | ||||
2315 | // if the cursor is in a mode other than STANDARD -> reset | |||
2316 | Reference< XPropertySet > xCursorSet(rContext.xCursor, UNO_QUERY); | |||
2317 | OSL_ENSURE(xCursorSet.is() && !::comphelper::getBOOL(xCursorSet->getPropertyValue(PROPERTY_ISMODIFIED)),do { if (true && (!(xCursorSet.is() && !::comphelper ::getBOOL(xCursorSet->getPropertyValue("IsModified"))))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2318" ": "), "%s", "SbaXDataBrowserController::OnSearchContextRequest : please do not call for cursors with modified rows !" ); } } while (false) | |||
2318 | "SbaXDataBrowserController::OnSearchContextRequest : please do not call for cursors with modified rows !")do { if (true && (!(xCursorSet.is() && !::comphelper ::getBOOL(xCursorSet->getPropertyValue("IsModified"))))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2318" ": "), "%s", "SbaXDataBrowserController::OnSearchContextRequest : please do not call for cursors with modified rows !" ); } } while (false); | |||
2319 | if (xCursorSet.is() && ::comphelper::getBOOL(xCursorSet->getPropertyValue(PROPERTY_ISNEW"IsNew"))) | |||
2320 | { | |||
2321 | Reference< XResultSetUpdate > xUpdateCursor(rContext.xCursor, UNO_QUERY); | |||
2322 | xUpdateCursor->moveToCurrentRow(); | |||
2323 | } | |||
2324 | return rContext.arrFields.size(); | |||
2325 | } | |||
2326 | ||||
2327 | IMPL_LINK(SbaXDataBrowserController, OnFoundData, FmFoundRecordInformation&, rInfo, void)void SbaXDataBrowserController::LinkStubOnFoundData(void * instance , FmFoundRecordInformation& data) { return static_cast< SbaXDataBrowserController *>(instance)->OnFoundData(data ); } void SbaXDataBrowserController::OnFoundData(FmFoundRecordInformation & rInfo) | |||
2328 | { | |||
2329 | Reference< css::sdbcx::XRowLocate > xCursor(getRowSet(), UNO_QUERY); | |||
2330 | OSL_ENSURE(xCursor.is(), "SbaXDataBrowserController::OnFoundData : xCursor is empty")do { if (true && (!(xCursor.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2330" ": "), "%s", "SbaXDataBrowserController::OnFoundData : xCursor is empty" ); } } while (false); | |||
2331 | ||||
2332 | // move the cursor | |||
2333 | xCursor->moveToBookmark(rInfo.aPosition); | |||
2334 | ||||
2335 | // let the grid sync its display with the cursor | |||
2336 | Reference< XPropertySet > xModelSet(getControlModel(), UNO_QUERY); | |||
2337 | OSL_ENSURE(xModelSet.is(), "SbaXDataBrowserController::OnFoundData : no model set ?!")do { if (true && (!(xModelSet.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2337" ": "), "%s", "SbaXDataBrowserController::OnFoundData : no model set ?!" ); } } while (false); | |||
2338 | Any aOld = xModelSet->getPropertyValue("DisplayIsSynchron"); | |||
2339 | xModelSet->setPropertyValue("DisplayIsSynchron", css::uno::Any(true)); | |||
2340 | xModelSet->setPropertyValue("DisplayIsSynchron", aOld); | |||
2341 | ||||
2342 | // and move to the field | |||
2343 | Reference< css::container::XIndexAccess > aColumnControls(getBrowserView()->getGridControl()->getPeer(), UNO_QUERY); | |||
2344 | sal_Int32 nViewPos; | |||
2345 | ||||
2346 | for ( nViewPos = 0; nViewPos < aColumnControls->getCount(); ++nViewPos ) | |||
2347 | { | |||
2348 | Reference< XInterface > xCurrent(aColumnControls->getByIndex(nViewPos),UNO_QUERY); | |||
2349 | if (IsSearchableControl(xCurrent)) | |||
2350 | { | |||
2351 | if (rInfo.nFieldPos) | |||
2352 | --rInfo.nFieldPos; | |||
2353 | else | |||
2354 | break; | |||
2355 | } | |||
2356 | } | |||
2357 | ||||
2358 | Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY); | |||
2359 | xGrid->setCurrentColumnPosition(nViewPos); //TODO: sal_Int32 -> sal_Int16! | |||
2360 | } | |||
2361 | ||||
2362 | IMPL_LINK(SbaXDataBrowserController, OnCanceledNotFound, FmFoundRecordInformation&, rInfo, void)void SbaXDataBrowserController::LinkStubOnCanceledNotFound(void * instance, FmFoundRecordInformation& data) { return static_cast <SbaXDataBrowserController *>(instance)->OnCanceledNotFound (data); } void SbaXDataBrowserController::OnCanceledNotFound( FmFoundRecordInformation& rInfo) | |||
2363 | { | |||
2364 | Reference< css::sdbcx::XRowLocate > xCursor(getRowSet(), UNO_QUERY); | |||
2365 | ||||
2366 | try | |||
2367 | { | |||
2368 | OSL_ENSURE(xCursor.is(), "SbaXDataBrowserController::OnCanceledNotFound : xCursor is empty")do { if (true && (!(xCursor.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2368" ": "), "%s", "SbaXDataBrowserController::OnCanceledNotFound : xCursor is empty" ); } } while (false); | |||
2369 | // move the cursor | |||
2370 | xCursor->moveToBookmark(rInfo.aPosition); | |||
2371 | } | |||
2372 | catch( const Exception& ) | |||
2373 | { | |||
2374 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2374" ": ", "dbaccess" );; | |||
2375 | } | |||
2376 | ||||
2377 | try | |||
2378 | { | |||
2379 | // let the grid sync its display with the cursor | |||
2380 | Reference< XPropertySet > xModelSet(getControlModel(), UNO_QUERY); | |||
2381 | OSL_ENSURE(xModelSet.is(), "SbaXDataBrowserController::OnCanceledNotFound : no model set ?!")do { if (true && (!(xModelSet.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2381" ": "), "%s", "SbaXDataBrowserController::OnCanceledNotFound : no model set ?!" ); } } while (false); | |||
2382 | Any aOld = xModelSet->getPropertyValue("DisplayIsSynchron"); | |||
2383 | xModelSet->setPropertyValue("DisplayIsSynchron", css::uno::Any(true)); | |||
2384 | xModelSet->setPropertyValue("DisplayIsSynchron", aOld); | |||
2385 | } | |||
2386 | catch( const Exception& ) | |||
2387 | { | |||
2388 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2388" ": ", "dbaccess" );; | |||
2389 | } | |||
2390 | } | |||
2391 | ||||
2392 | IMPL_LINK_NOARG(SbaXDataBrowserController, OnAsyncGetCellFocus, void*, void)void SbaXDataBrowserController::LinkStubOnAsyncGetCellFocus(void * instance, void* data) { return static_cast<SbaXDataBrowserController *>(instance)->OnAsyncGetCellFocus(data); } void SbaXDataBrowserController ::OnAsyncGetCellFocus(__attribute__ ((unused)) void*) | |||
2393 | { | |||
2394 | SbaGridControl* pVclGrid = getBrowserView() ? getBrowserView()->getVclControl() : nullptr; | |||
2395 | // if we have a controller, but the window for the controller doesn't have the focus, we correct this | |||
2396 | if (pVclGrid && pVclGrid->IsEditing() && pVclGrid->HasChildPathFocus()) | |||
2397 | pVclGrid->Controller()->GetWindow().GrabFocus(); | |||
2398 | } | |||
2399 | ||||
2400 | void SbaXDataBrowserController::criticalFail() | |||
2401 | { | |||
2402 | InvalidateAll(); | |||
2403 | m_nRowSetPrivileges = 0; | |||
2404 | } | |||
2405 | ||||
2406 | void SbaXDataBrowserController::LoadFinished(bool /*bWasSynch*/) | |||
2407 | { | |||
2408 | m_nRowSetPrivileges = 0; | |||
2409 | ||||
2410 | if (!isValid() || loadingCancelled()) | |||
2411 | return; | |||
2412 | ||||
2413 | // obtain cached values | |||
2414 | try | |||
2415 | { | |||
2416 | Reference< XPropertySet > xFormProps( m_xLoadable, UNO_QUERY_THROW ); | |||
2417 | OSL_VERIFY( xFormProps->getPropertyValue( PROPERTY_PRIVILEGES ) >>= m_nRowSetPrivileges )do { if (!(xFormProps->getPropertyValue( "Privileges" ) >>= m_nRowSetPrivileges)) do { if (true && (!(0))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2417" ": "), "OSL_ASSERT: %s", "0"); } } while (false); } while (0); | |||
2418 | } | |||
2419 | catch( const Exception& ) | |||
2420 | { | |||
2421 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2421" ": ", "dbaccess" );; | |||
2422 | } | |||
2423 | ||||
2424 | // switch the control to alive mode | |||
2425 | getBrowserView()->getGridControl()->setDesignMode(false); | |||
2426 | ||||
2427 | initializeParser(); | |||
2428 | ||||
2429 | InvalidateAll(); | |||
2430 | ||||
2431 | m_aAsyncGetCellFocus.Call(); | |||
2432 | } | |||
2433 | ||||
2434 | void SbaXDataBrowserController::initializeParser() const | |||
2435 | { | |||
2436 | if ( m_xParser.is() ) | |||
2437 | return; | |||
2438 | ||||
2439 | // create a parser (needed for filtering/sorting) | |||
2440 | try | |||
2441 | { | |||
2442 | const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); | |||
2443 | if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING"EscapeProcessing"))) | |||
2444 | { // (only if the statement isn't native) | |||
2445 | // (it is allowed to use the PROPERTY_ISPASSTHROUGH : _after_ loading a form it is valid) | |||
2446 | xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER"SingleSelectQueryComposer") >>= m_xParser; | |||
2447 | } | |||
2448 | } | |||
2449 | catch(Exception&) | |||
2450 | { | |||
2451 | DBG_UNHANDLED_EXCEPTION("dbaccess")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2451" ": ", "dbaccess" );; | |||
2452 | m_xParser = nullptr; | |||
2453 | // no further handling, we ignore the error | |||
2454 | } | |||
2455 | } | |||
2456 | ||||
2457 | void SbaXDataBrowserController::loaded(const EventObject& /*aEvent*/) | |||
2458 | { | |||
2459 | // not interested in | |||
2460 | // we're loading within a separated thread and have a handling for its "finished event" | |||
2461 | } | |||
2462 | ||||
2463 | void SbaXDataBrowserController::unloading(const EventObject& /*aEvent*/) | |||
2464 | { | |||
2465 | // not interested in | |||
2466 | } | |||
2467 | ||||
2468 | void SbaXDataBrowserController::unloaded(const EventObject& /*aEvent*/) | |||
2469 | { | |||
2470 | m_xParser.clear(); | |||
2471 | InvalidateAll(); | |||
2472 | // do this asynchronously, there are other listeners reacting on this message ... | |||
2473 | // (it's a little hack : the grid columns are listening to this event, too, and their bound field may | |||
2474 | // change as a reaction on that event. as we have no chance to be notified of this change (which is | |||
2475 | // the one we're interested in) we give them time to do what they want to before invalidating our | |||
2476 | // bound-field-dependent slots... | |||
2477 | } | |||
2478 | ||||
2479 | void SbaXDataBrowserController::reloading(const EventObject& /*aEvent*/) | |||
2480 | { | |||
2481 | // not interested in | |||
2482 | } | |||
2483 | ||||
2484 | void SbaXDataBrowserController::reloaded(const EventObject& /*aEvent*/) | |||
2485 | { | |||
2486 | InvalidateAll(); | |||
2487 | // do this asynchronously, there are other listeners reacting on this message ... | |||
2488 | // (it's a little hack : the grid columns are listening to this event, too, and their bound field may | |||
2489 | // change as a reaction on that event. as we have no chance to be notified of this change (which is | |||
2490 | // the one we're interested in) we give them time to do what they want to before invalidating our | |||
2491 | // bound-field-dependent slots... | |||
2492 | } | |||
2493 | ||||
2494 | void SbaXDataBrowserController::enterFormAction() | |||
2495 | { | |||
2496 | if ( !m_nFormActionNestingLevel ) | |||
2497 | // first action -> reset | |||
2498 | m_aCurrentError.clear(); | |||
2499 | ||||
2500 | ++m_nFormActionNestingLevel; | |||
2501 | } | |||
2502 | ||||
2503 | void SbaXDataBrowserController::leaveFormAction() | |||
2504 | { | |||
2505 | OSL_ENSURE( m_nFormActionNestingLevel > 0, "SbaXDataBrowserController::leaveFormAction : invalid call !" )do { if (true && (!(m_nFormActionNestingLevel > 0) )) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl" ), ("/home/maarten/src/libreoffice/core/dbaccess/source/ui/browser/brwctrlr.cxx" ":" "2505" ": "), "%s", "SbaXDataBrowserController::leaveFormAction : invalid call !" ); } } while (false); | |||
2506 | if ( --m_nFormActionNestingLevel > 0 ) | |||
2507 | return; | |||
2508 | ||||
2509 | if ( !m_aCurrentError.isValid() ) | |||
2510 | return; | |||
2511 | ||||
2512 | m_aAsyncDisplayError.Call(); | |||
2513 | } | |||
2514 | ||||
2515 | bool SbaXDataBrowserController::isLoaded() const | |||
2516 | { | |||
2517 | return m_xLoadable.is() && m_xLoadable->isLoaded(); | |||
2518 | } | |||
2519 | ||||
2520 | bool SbaXDataBrowserController::isValidCursor() const | |||
2521 | { | |||
2522 | if (!m_xColumnsSupplier.is()) | |||
2523 | return false; | |||
2524 | Reference< css::container::XNameAccess > xCols = m_xColumnsSupplier->getColumns(); | |||
2525 | if (!xCols.is() || !xCols->hasElements()) | |||
2526 | return false; | |||
2527 | ||||
2528 | bool bIsValid = !(m_xRowSet->isBeforeFirst() || m_xRowSet->isAfterLast()); | |||
2529 | if ( !bIsValid ) | |||
2530 | { | |||
2531 | Reference<XPropertySet> xProp(m_xRowSet,UNO_QUERY); | |||
2532 | bIsValid = ::cppu::any2bool(xProp->getPropertyValue(PROPERTY_ISNEW"IsNew")); | |||
2533 | if ( !bIsValid ) | |||
2534 | { | |||
2535 | bIsValid = m_xParser.is(); | |||
2536 | } | |||
2537 | } | |||
2538 | return bIsValid; | |||
2539 | } | |||
2540 | ||||
2541 | sal_Int16 SbaXDataBrowserController::getCurrentColumnPosition() const | |||
2542 | { | |||
2543 | Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY); | |||
2544 | sal_Int16 nViewPos = -1; | |||
2545 | try | |||
2546 | { | |||
2547 | if ( xGrid.is() ) | |||
2548 | nViewPos = xGrid->getCurrentColumnPosition(); | |||
2549 | } | |||
2550 | catch(Exception&) {} | |||
2551 | return nViewPos; | |||
2552 | } | |||
2553 | ||||
2554 | void SbaXDataBrowserController::setCurrentColumnPosition( sal_Int16 _nPos ) | |||
2555 | { | |||
2556 | Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY); | |||
2557 | try | |||
2558 | { | |||
2559 | if ( -1 != _nPos ) | |||
2560 | xGrid->setCurrentColumnPosition(_nPos); | |||
2561 | } | |||
2562 | catch(Exception&) {} | |||
2563 | } | |||
2564 | ||||
2565 | void SbaXDataBrowserController::BeforeDrop() | |||
2566 | { | |||
2567 | Reference< css::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); | |||
2568 | if (xFormError.is()) | |||
2569 | xFormError->removeSQLErrorListener(static_cast<css::sdb::XSQLErrorListener*>(this)); | |||
2570 | } | |||
2571 | ||||
2572 | void SbaXDataBrowserController::AfterDrop() | |||
2573 | { | |||
2574 | Reference< css::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); | |||
2575 | if (xFormError.is()) | |||
2576 | xFormError->addSQLErrorListener(static_cast<css::sdb::XSQLErrorListener*>(this)); | |||
2577 | } | |||
2578 | ||||
2579 | void SbaXDataBrowserController::addColumnListeners(const Reference< css::awt::XControlModel > & _xGridControlModel) | |||
2580 | { | |||
2581 | // ... all the grid columns | |||
2582 | Reference< css::container::XIndexContainer > xColumns(_xGridControlModel, UNO_QUERY); | |||
2583 | if (xColumns.is()) | |||
2584 | { | |||
2585 | sal_Int32 nCount = xColumns->getCount(); | |||
2586 | for (sal_Int32 i=0; i < nCount; ++i) | |||
2587 | { | |||
2588 | Reference< XPropertySet > xCol(xColumns->getByIndex(i),UNO_QUERY); | |||
2589 | AddColumnListener(xCol); | |||
2590 | } | |||
2591 | } | |||
2592 | } | |||
2593 | ||||
2594 | } // namespace dbaui | |||
2595 | ||||
2596 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | /* |
3 | * This file is part of the LibreOffice project. |
4 | * |
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/. |
8 | * |
9 | * This file incorporates work covered by the following license notice: |
10 | * |
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 . |
18 | */ |
19 | |
20 | #ifndef INCLUDED_VCL_PTR_HXX |
21 | #define INCLUDED_VCL_PTR_HXX |
22 | |
23 | #include <sal/config.h> |
24 | |
25 | #include <rtl/ref.hxx> |
26 | |
27 | #include <utility> |
28 | #include <type_traits> |
29 | |
30 | #ifdef DBG_UTIL |
31 | #ifndef _WIN32 |
32 | #include <vcl/vclmain.hxx> |
33 | #endif |
34 | #endif |
35 | |
36 | class VclReferenceBase; |
37 | |
38 | namespace vcl::detail { |
39 | |
40 | template<typename> |
41 | constexpr bool isIncompleteOrDerivedFromVclReferenceBase(...) { return true; } |
42 | |
43 | template<typename T> constexpr bool isIncompleteOrDerivedFromVclReferenceBase( |
44 | int (*)[sizeof(T)]) |
45 | { return std::is_base_of<VclReferenceBase, T>::value; } |
46 | |
47 | } // namespace vcl::detail |
48 | |
49 | /** |
50 | * A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for references to vcl::Window subclasses. |
51 | * |
52 | * For more details on the design please see vcl/README.lifecycle |
53 | * |
54 | * @param reference_type must be a subclass of vcl::Window |
55 | */ |
56 | template <class reference_type> |
57 | class VclPtr |
58 | { |
59 | static_assert( |
60 | vcl::detail::isIncompleteOrDerivedFromVclReferenceBase<reference_type>( |
61 | nullptr), |
62 | "template argument type must be derived from VclReferenceBase"); |
63 | |
64 | ::rtl::Reference<reference_type> m_rInnerRef; |
65 | |
66 | public: |
67 | /** Constructor... |
68 | */ |
69 | VclPtr() |
70 | : m_rInnerRef() |
71 | {} |
72 | |
73 | /** Constructor... |
74 | */ |
75 | VclPtr (reference_type * pBody) |
76 | : m_rInnerRef(pBody) |
77 | {} |
78 | |
79 | /** Constructor... that doesn't take a ref. |
80 | */ |
81 | VclPtr (reference_type * pBody, __sal_NoAcquire) |
82 | : m_rInnerRef(pBody, SAL_NO_ACQUIRE) |
83 | {} |
84 | |
85 | /** Up-casting conversion constructor: Copies interface reference. |
86 | |
87 | Does not work for up-casts to ambiguous bases. For the special case of |
88 | up-casting to Reference< XInterface >, see the corresponding conversion |
89 | operator. |
90 | |
91 | @param rRef another reference |
92 | */ |
93 | template< class derived_type > |
94 | VclPtr( |
95 | const VclPtr< derived_type > & rRef, |
96 | typename std::enable_if< |
97 | std::is_base_of<reference_type, derived_type>::value, int>::type |
98 | = 0 ) |
99 | : m_rInnerRef( static_cast<reference_type*>(rRef) ) |
100 | { |
101 | } |
102 | |
103 | #if defined(DBG_UTIL) && !defined(_WIN32) |
104 | virtual ~VclPtr() |
105 | { |
106 | assert(m_rInnerRef.get() == nullptr || vclmain::isAlive())(static_cast <bool> (m_rInnerRef.get() == nullptr || vclmain ::isAlive()) ? void (0) : __assert_fail ("m_rInnerRef.get() == nullptr || vclmain::isAlive()" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 106, __extension__ __PRETTY_FUNCTION__)); |
107 | // We can be one of the intermediate counts, but if we are the last |
108 | // VclPtr keeping this object alive, then something forgot to call dispose(). |
109 | assert((!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1)(static_cast <bool> ((!m_rInnerRef.get() || m_rInnerRef ->isDisposed() || m_rInnerRef->getRefCount() > 1) && "someone forgot to call dispose()") ? void (0) : __assert_fail ("(!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1) && \"someone forgot to call dispose()\"" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 110, __extension__ __PRETTY_FUNCTION__)) |
110 | && "someone forgot to call dispose()")(static_cast <bool> ((!m_rInnerRef.get() || m_rInnerRef ->isDisposed() || m_rInnerRef->getRefCount() > 1) && "someone forgot to call dispose()") ? void (0) : __assert_fail ("(!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1) && \"someone forgot to call dispose()\"" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 110, __extension__ __PRETTY_FUNCTION__)); |
111 | } |
112 | VclPtr(VclPtr const &) = default; |
113 | VclPtr(VclPtr &&) = default; |
114 | VclPtr & operator =(VclPtr const &) = default; |
115 | VclPtr & operator =(VclPtr &&) = default; |
116 | #endif |
117 | |
118 | /** |
119 | * A construction helper for VclPtr. Since VclPtr types are created |
120 | * with a reference-count of one - to help fit into the existing |
121 | * code-flow; this helps us to construct them easily. |
122 | * |
123 | * For more details on the design please see vcl/README.lifecycle |
124 | * |
125 | * @tparam reference_type must be a subclass of vcl::Window |
126 | */ |
127 | template<typename... Arg> [[nodiscard]] static VclPtr< reference_type > Create(Arg &&... arg) |
128 | { |
129 | return VclPtr< reference_type >( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ); |
130 | } |
131 | |
132 | /** Probably most common used: handle->someBodyOp(). |
133 | */ |
134 | reference_type * operator->() const |
135 | { |
136 | return m_rInnerRef.get(); |
137 | } |
138 | |
139 | /** Get the body. Can be used instead of operator->(). |
140 | I.e. handle->someBodyOp() and handle.get()->someBodyOp() |
141 | are the same. |
142 | */ |
143 | reference_type * get() const |
144 | { |
145 | return m_rInnerRef.get(); |
146 | } |
147 | |
148 | void set(reference_type *pBody) |
149 | { |
150 | m_rInnerRef.set(pBody); |
151 | } |
152 | |
153 | void reset(reference_type *pBody) |
154 | { |
155 | m_rInnerRef.set(pBody); |
156 | } |
157 | |
158 | /** Up-casting copy assignment operator. |
159 | |
160 | Does not work for up-casts to ambiguous bases. |
161 | |
162 | @param rRef another reference |
163 | */ |
164 | template<typename derived_type> |
165 | typename std::enable_if< |
166 | std::is_base_of<reference_type, derived_type>::value, |
167 | VclPtr &>::type |
168 | operator =(VclPtr<derived_type> const & rRef) |
169 | { |
170 | m_rInnerRef.set(rRef.get()); |
171 | return *this; |
172 | } |
173 | |
174 | VclPtr & operator =(reference_type * pBody) |
175 | { |
176 | m_rInnerRef.set(pBody); |
177 | return *this; |
178 | } |
179 | |
180 | operator reference_type * () const |
181 | { |
182 | return m_rInnerRef.get(); |
183 | } |
184 | |
185 | explicit operator bool () const |
186 | { |
187 | return m_rInnerRef.get() != nullptr; |
188 | } |
189 | |
190 | void clear() |
191 | { |
192 | m_rInnerRef.clear(); |
193 | } |
194 | |
195 | void reset() |
196 | { |
197 | m_rInnerRef.clear(); |
198 | } |
199 | |
200 | void disposeAndClear() |
201 | { |
202 | // hold it alive for the lifetime of this method |
203 | ::rtl::Reference<reference_type> aTmp(m_rInnerRef); |
204 | m_rInnerRef.clear(); // we should use some 'swap' method ideally ;-) |
205 | if (aTmp.get()) { |
206 | aTmp->disposeOnce(); |
207 | } |
208 | } |
209 | |
210 | /** Needed to place VclPtr's into STL collection. |
211 | */ |
212 | bool operator< (const VclPtr<reference_type> & handle) const |
213 | { |
214 | return (m_rInnerRef < handle.m_rInnerRef); |
215 | } |
216 | }; // class VclPtr |
217 | |
218 | template<typename T1, typename T2> |
219 | inline bool operator ==(VclPtr<T1> const & p1, VclPtr<T2> const & p2) { |
220 | return p1.get() == p2.get(); |
221 | } |
222 | |
223 | template<typename T> inline bool operator ==(VclPtr<T> const & p1, T const * p2) |
224 | { |
225 | return p1.get() == p2; |
226 | } |
227 | |
228 | template<typename T> inline bool operator ==(VclPtr<T> const & p1, T * p2) { |
229 | return p1.get() == p2; |
230 | } |
231 | |
232 | template<typename T> inline bool operator ==(T const * p1, VclPtr<T> const & p2) |
233 | { |
234 | return p1 == p2.get(); |
235 | } |
236 | |
237 | template<typename T> inline bool operator ==(T * p1, VclPtr<T> const & p2) { |
238 | return p1 == p2.get(); |
239 | } |
240 | |
241 | template<typename T1, typename T2> |
242 | inline bool operator !=(VclPtr<T1> const & p1, VclPtr<T2> const & p2) { |
243 | return !(p1 == p2); |
244 | } |
245 | |
246 | template<typename T> inline bool operator !=(VclPtr<T> const & p1, T const * p2) |
247 | { |
248 | return !(p1 == p2); |
249 | } |
250 | |
251 | template<typename T> inline bool operator !=(VclPtr<T> const & p1, T * p2) { |
252 | return !(p1 == p2); |
253 | } |
254 | |
255 | template<typename T> inline bool operator !=(T const * p1, VclPtr<T> const & p2) |
256 | { |
257 | return !(p1 == p2); |
258 | } |
259 | |
260 | template<typename T> inline bool operator !=(T * p1, VclPtr<T> const & p2) { |
261 | return !(p1 == p2); |
262 | } |
263 | |
264 | /** |
265 | * A construction helper for a temporary VclPtr. Since VclPtr types |
266 | * are created with a reference-count of one - to help fit into |
267 | * the existing code-flow; this helps us to construct them easily. |
268 | * see also VclPtr::Create and ScopedVclPtr |
269 | * |
270 | * For more details on the design please see vcl/README.lifecycle |
271 | * |
272 | * @param reference_type must be a subclass of vcl::Window |
273 | */ |
274 | template <class reference_type> |
275 | class SAL_WARN_UNUSED__attribute__((warn_unused)) VclPtrInstance final : public VclPtr<reference_type> |
276 | { |
277 | public: |
278 | template<typename... Arg> VclPtrInstance(Arg &&... arg) |
279 | : VclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ) |
280 | { |
281 | } |
282 | |
283 | /** |
284 | * Override and disallow this, to prevent people accidentally calling it and actually |
285 | * getting VclPtr::Create and getting a naked VclPtr<> instance |
286 | */ |
287 | template<typename... Arg> static VclPtrInstance< reference_type > Create(Arg &&... ) = delete; |
288 | }; |
289 | |
290 | template <class reference_type> |
291 | class ScopedVclPtr : public VclPtr<reference_type> |
292 | { |
293 | public: |
294 | /** Constructor... |
295 | */ |
296 | ScopedVclPtr() |
297 | : VclPtr<reference_type>() |
298 | {} |
299 | |
300 | /** Constructor |
301 | */ |
302 | ScopedVclPtr (reference_type * pBody) |
303 | : VclPtr<reference_type>(pBody) |
304 | {} |
305 | |
306 | /** Copy constructor... |
307 | */ |
308 | ScopedVclPtr (const VclPtr<reference_type> & handle) |
309 | : VclPtr<reference_type>(handle) |
310 | {} |
311 | |
312 | /** |
313 | Assignment that releases the last reference. |
314 | */ |
315 | void disposeAndReset(reference_type *pBody) |
316 | { |
317 | if (pBody != this->get()) { |
318 | VclPtr<reference_type>::disposeAndClear(); |
319 | VclPtr<reference_type>::set(pBody); |
320 | } |
321 | } |
322 | |
323 | /** |
324 | Assignment that releases the last reference. |
325 | */ |
326 | ScopedVclPtr<reference_type>& operator = (reference_type * pBody) |
327 | { |
328 | disposeAndReset(pBody); |
329 | return *this; |
330 | } |
331 | |
332 | /** Up-casting conversion constructor: Copies interface reference. |
333 | |
334 | Does not work for up-casts to ambiguous bases. For the special case of |
335 | up-casting to Reference< XInterface >, see the corresponding conversion |
336 | operator. |
337 | |
338 | @param rRef another reference |
339 | */ |
340 | template< class derived_type > |
341 | ScopedVclPtr( |
342 | const VclPtr< derived_type > & rRef, |
343 | typename std::enable_if< |
344 | std::is_base_of<reference_type, derived_type>::value, int>::type |
345 | = 0 ) |
346 | : VclPtr<reference_type>( rRef ) |
347 | { |
348 | } |
349 | |
350 | /** Up-casting assignment operator. |
351 | |
352 | Does not work for up-casts to ambiguous bases. |
353 | |
354 | @param rRef another VclPtr |
355 | */ |
356 | template<typename derived_type> |
357 | typename std::enable_if< |
358 | std::is_base_of<reference_type, derived_type>::value, |
359 | ScopedVclPtr &>::type |
360 | operator =(VclPtr<derived_type> const & rRef) |
361 | { |
362 | disposeAndReset(rRef.get()); |
363 | return *this; |
364 | } |
365 | |
366 | /** |
367 | * Override and disallow this, to prevent people accidentally calling it and actually |
368 | * getting VclPtr::Create and getting a naked VclPtr<> instance |
369 | */ |
370 | template<typename... Arg> static ScopedVclPtr< reference_type > Create(Arg &&... ) = delete; |
371 | |
372 | ~ScopedVclPtr() |
373 | { |
374 | VclPtr<reference_type>::disposeAndClear(); |
375 | assert(VclPtr<reference_type>::get() == nullptr)(static_cast <bool> (VclPtr<reference_type>::get( ) == nullptr) ? void (0) : __assert_fail ("VclPtr<reference_type>::get() == nullptr" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 375, __extension__ __PRETTY_FUNCTION__)); // make sure there are no lingering references |
376 | } |
377 | |
378 | private: |
379 | // Most likely we don't want this default copy-constructor. |
380 | ScopedVclPtr (const ScopedVclPtr<reference_type> &) = delete; |
381 | // And certainly we don't want a default assignment operator. |
382 | ScopedVclPtr<reference_type>& operator = (const ScopedVclPtr<reference_type> &) = delete; |
383 | // And disallow reset as that doesn't call disposeAndClear on the original reference |
384 | void reset() = delete; |
385 | void reset(reference_type *pBody) = delete; |
386 | |
387 | protected: |
388 | ScopedVclPtr (reference_type * pBody, __sal_NoAcquire) |
389 | : VclPtr<reference_type>(pBody, SAL_NO_ACQUIRE) |
390 | {} |
391 | }; |
392 | |
393 | /** |
394 | * A construction helper for ScopedVclPtr. Since VclPtr types are created |
395 | * with a reference-count of one - to help fit into the existing |
396 | * code-flow; this helps us to construct them easily. |
397 | * |
398 | * For more details on the design please see vcl/README.lifecycle |
399 | * |
400 | * @param reference_type must be a subclass of vcl::Window |
401 | */ |
402 | #if defined _MSC_VER |
403 | #pragma warning(push) |
404 | #pragma warning(disable: 4521) // " multiple copy constructors specified" |
405 | #endif |
406 | template <class reference_type> |
407 | class SAL_WARN_UNUSED__attribute__((warn_unused)) ScopedVclPtrInstance final : public ScopedVclPtr<reference_type> |
408 | { |
409 | public: |
410 | template<typename... Arg> ScopedVclPtrInstance(Arg &&... arg) |
411 | : ScopedVclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ) |
412 | { |
413 | } |
414 | |
415 | /** |
416 | * Override and disallow this, to prevent people accidentally calling it and actually |
417 | * getting VclPtr::Create and getting a naked VclPtr<> instance |
418 | */ |
419 | template<typename... Arg> static ScopedVclPtrInstance< reference_type > Create(Arg &&...) = delete; |
420 | |
421 | private: |
422 | // Prevent the above perfect forwarding ctor from hijacking (accidental) |
423 | // attempts at ScopedVclPtrInstance copy construction (where the hijacking |
424 | // would typically lead to somewhat obscure error messages); both non-const |
425 | // and const variants are needed here, as the ScopedVclPtr base class has a |
426 | // const--variant copy ctor, so the implicitly declared copy ctor for |
427 | // ScopedVclPtrInstance would also be the const variant, so non-const copy |
428 | // construction attempts would be hijacked by the perfect forwarding ctor; |
429 | // but if we only declared a non-const variant here, the const variant would |
430 | // no longer be implicitly declared (as there would already be an explicitly |
431 | // declared copy ctor), so const copy construction attempts would then be |
432 | // hijacked by the perfect forwarding ctor: |
433 | ScopedVclPtrInstance(ScopedVclPtrInstance &) = delete; |
434 | ScopedVclPtrInstance(ScopedVclPtrInstance const &) = delete; |
435 | }; |
436 | #if defined _MSC_VER |
437 | #pragma warning(pop) |
438 | #endif |
439 | |
440 | #endif // INCLUDED_VCL_PTR_HXX |
441 | |
442 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||||||||||||||||
2 | /* | ||||||||||||||||
3 | * This file is part of the LibreOffice project. | ||||||||||||||||
4 | * | ||||||||||||||||
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/. | ||||||||||||||||
8 | * | ||||||||||||||||
9 | * This file incorporates work covered by the following license notice: | ||||||||||||||||
10 | * | ||||||||||||||||
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 . | ||||||||||||||||
18 | */ | ||||||||||||||||
19 | |||||||||||||||||
20 | #ifndef INCLUDED_RTL_REF_HXX | ||||||||||||||||
21 | #define INCLUDED_RTL_REF_HXX | ||||||||||||||||
22 | |||||||||||||||||
23 | #include "sal/config.h" | ||||||||||||||||
24 | |||||||||||||||||
25 | #include <cassert> | ||||||||||||||||
26 | #include <cstddef> | ||||||||||||||||
27 | #include <functional> | ||||||||||||||||
28 | #ifdef LIBO_INTERNAL_ONLY1 | ||||||||||||||||
29 | #include <type_traits> | ||||||||||||||||
30 | #endif | ||||||||||||||||
31 | |||||||||||||||||
32 | #include "sal/types.h" | ||||||||||||||||
33 | |||||||||||||||||
34 | namespace rtl | ||||||||||||||||
35 | { | ||||||||||||||||
36 | |||||||||||||||||
37 | /** Template reference class for reference type. | ||||||||||||||||
38 | */ | ||||||||||||||||
39 | template <class reference_type> | ||||||||||||||||
40 | class Reference | ||||||||||||||||
41 | { | ||||||||||||||||
42 | /** The <b>reference_type</b> body pointer. | ||||||||||||||||
43 | */ | ||||||||||||||||
44 | reference_type * m_pBody; | ||||||||||||||||
45 | |||||||||||||||||
46 | |||||||||||||||||
47 | public: | ||||||||||||||||
48 | /** Constructor... | ||||||||||||||||
49 | */ | ||||||||||||||||
50 | Reference() | ||||||||||||||||
51 | : m_pBody (NULL__null) | ||||||||||||||||
52 | {} | ||||||||||||||||
53 | |||||||||||||||||
54 | |||||||||||||||||
55 | /** Constructor... | ||||||||||||||||
56 | */ | ||||||||||||||||
57 | Reference (reference_type * pBody, __sal_NoAcquire) | ||||||||||||||||
58 | : m_pBody (pBody) | ||||||||||||||||
59 | { | ||||||||||||||||
60 | } | ||||||||||||||||
61 | |||||||||||||||||
62 | /** Constructor... | ||||||||||||||||
63 | */ | ||||||||||||||||
64 | Reference (reference_type * pBody) | ||||||||||||||||
65 | : m_pBody (pBody) | ||||||||||||||||
66 | { | ||||||||||||||||
67 | if (m_pBody) | ||||||||||||||||
68 | m_pBody->acquire(); | ||||||||||||||||
69 | } | ||||||||||||||||
70 | |||||||||||||||||
71 | /** Copy constructor... | ||||||||||||||||
72 | */ | ||||||||||||||||
73 | Reference (const Reference<reference_type> & handle) | ||||||||||||||||
74 | : m_pBody (handle.m_pBody) | ||||||||||||||||
75 | { | ||||||||||||||||
76 | if (m_pBody) | ||||||||||||||||
77 | m_pBody->acquire(); | ||||||||||||||||
78 | } | ||||||||||||||||
79 | |||||||||||||||||
80 | #ifdef LIBO_INTERNAL_ONLY1 | ||||||||||||||||
81 | /** Move constructor... | ||||||||||||||||
82 | */ | ||||||||||||||||
83 | Reference (Reference<reference_type> && handle) noexcept | ||||||||||||||||
84 | : m_pBody (handle.m_pBody) | ||||||||||||||||
85 | { | ||||||||||||||||
86 | handle.m_pBody = nullptr; | ||||||||||||||||
87 | } | ||||||||||||||||
88 | #endif | ||||||||||||||||
89 | |||||||||||||||||
90 | #if defined LIBO_INTERNAL_ONLY1 | ||||||||||||||||
91 | /** Up-casting conversion constructor: Copies interface reference. | ||||||||||||||||
92 | |||||||||||||||||
93 | Does not work for up-casts to ambiguous bases. | ||||||||||||||||
94 | |||||||||||||||||
95 | @param rRef another reference | ||||||||||||||||
96 | */ | ||||||||||||||||
97 | template< class derived_type > | ||||||||||||||||
98 | inline Reference( | ||||||||||||||||
99 | const Reference< derived_type > & rRef, | ||||||||||||||||
100 | std::enable_if_t<std::is_base_of_v<reference_type, derived_type>, int> = 0 ) | ||||||||||||||||
101 | : m_pBody (rRef.get()) | ||||||||||||||||
102 | { | ||||||||||||||||
103 | if (m_pBody) | ||||||||||||||||
104 | m_pBody->acquire(); | ||||||||||||||||
105 | } | ||||||||||||||||
106 | #endif | ||||||||||||||||
107 | |||||||||||||||||
108 | /** Destructor... | ||||||||||||||||
109 | */ | ||||||||||||||||
110 | ~Reference() COVERITY_NOEXCEPT_FALSE | ||||||||||||||||
111 | { | ||||||||||||||||
112 | if (m_pBody
| ||||||||||||||||
113 | m_pBody->release(); | ||||||||||||||||
| |||||||||||||||||
114 | } | ||||||||||||||||
115 | |||||||||||||||||
116 | /** Set... | ||||||||||||||||
117 | Similar to assignment. | ||||||||||||||||
118 | */ | ||||||||||||||||
119 | Reference<reference_type> & | ||||||||||||||||
120 | SAL_CALL set (reference_type * pBody) | ||||||||||||||||
121 | { | ||||||||||||||||
122 | if (pBody) | ||||||||||||||||
123 | pBody->acquire(); | ||||||||||||||||
124 | reference_type * const pOld = m_pBody; | ||||||||||||||||
125 | m_pBody = pBody; | ||||||||||||||||
126 | if (pOld) | ||||||||||||||||
127 | pOld->release(); | ||||||||||||||||
128 | return *this; | ||||||||||||||||
129 | } | ||||||||||||||||
130 | |||||||||||||||||
131 | /** Assignment. | ||||||||||||||||
132 | Unbinds this instance from its body (if bound) and | ||||||||||||||||
133 | bind it to the body represented by the handle. | ||||||||||||||||
134 | */ | ||||||||||||||||
135 | Reference<reference_type> & | ||||||||||||||||
136 | SAL_CALL operator= (const Reference<reference_type> & handle) | ||||||||||||||||
137 | { | ||||||||||||||||
138 | return set( handle.m_pBody ); | ||||||||||||||||
139 | } | ||||||||||||||||
140 | |||||||||||||||||
141 | #ifdef LIBO_INTERNAL_ONLY1 | ||||||||||||||||
142 | /** Assignment. | ||||||||||||||||
143 | * Unbinds this instance from its body (if bound), | ||||||||||||||||
144 | * bind it to the body represented by the handle, and | ||||||||||||||||
145 | * set the body represented by the handle to nullptr. | ||||||||||||||||
146 | */ | ||||||||||||||||
147 | Reference<reference_type> & | ||||||||||||||||
148 | operator= (Reference<reference_type> && handle) | ||||||||||||||||
149 | { | ||||||||||||||||
150 | // self-movement guts ourself | ||||||||||||||||
151 | if (m_pBody) | ||||||||||||||||
152 | m_pBody->release(); | ||||||||||||||||
153 | m_pBody = handle.m_pBody; | ||||||||||||||||
154 | handle.m_pBody = nullptr; | ||||||||||||||||
155 | return *this; | ||||||||||||||||
156 | } | ||||||||||||||||
157 | #endif | ||||||||||||||||
158 | |||||||||||||||||
159 | /** Assignment... | ||||||||||||||||
160 | */ | ||||||||||||||||
161 | Reference<reference_type> & | ||||||||||||||||
162 | SAL_CALL operator= (reference_type * pBody) | ||||||||||||||||
163 | { | ||||||||||||||||
164 | return set( pBody ); | ||||||||||||||||
165 | } | ||||||||||||||||
166 | |||||||||||||||||
167 | /** Unbind the body from this handle. | ||||||||||||||||
168 | Note that for a handle representing a large body, | ||||||||||||||||
169 | "handle.clear().set(new body());" _might_ | ||||||||||||||||
170 | perform a little bit better than "handle.set(new body());", | ||||||||||||||||
171 | since in the second case two large objects exist in memory | ||||||||||||||||
172 | (the old body and the new body). | ||||||||||||||||
173 | */ | ||||||||||||||||
174 | Reference<reference_type> & SAL_CALL clear() | ||||||||||||||||
175 | { | ||||||||||||||||
176 | if (m_pBody) | ||||||||||||||||
177 | { | ||||||||||||||||
178 | reference_type * const pOld = m_pBody; | ||||||||||||||||
179 | m_pBody = NULL__null; | ||||||||||||||||
180 | pOld->release(); | ||||||||||||||||
181 | } | ||||||||||||||||
182 | return *this; | ||||||||||||||||
183 | } | ||||||||||||||||
184 | |||||||||||||||||
185 | |||||||||||||||||
186 | /** Get the body. Can be used instead of operator->(). | ||||||||||||||||
187 | I.e. handle->someBodyOp() and handle.get()->someBodyOp() | ||||||||||||||||
188 | are the same. | ||||||||||||||||
189 | */ | ||||||||||||||||
190 | reference_type * SAL_CALL get() const | ||||||||||||||||
191 | { | ||||||||||||||||
192 | return m_pBody; | ||||||||||||||||
193 | } | ||||||||||||||||
194 | |||||||||||||||||
195 | |||||||||||||||||
196 | /** Probably most common used: handle->someBodyOp(). | ||||||||||||||||
197 | */ | ||||||||||||||||
198 | reference_type * SAL_CALL operator->() const | ||||||||||||||||
199 | { | ||||||||||||||||
200 | assert(m_pBody != NULL)(static_cast <bool> (m_pBody != __null) ? void (0) : __assert_fail ("m_pBody != NULL", "/home/maarten/src/libreoffice/core/include/rtl/ref.hxx" , 200, __extension__ __PRETTY_FUNCTION__)); | ||||||||||||||||
201 | return m_pBody; | ||||||||||||||||
202 | } | ||||||||||||||||
203 | |||||||||||||||||
204 | |||||||||||||||||
205 | /** Allows (*handle).someBodyOp(). | ||||||||||||||||
206 | */ | ||||||||||||||||
207 | reference_type & SAL_CALL operator*() const | ||||||||||||||||
208 | { | ||||||||||||||||
209 | assert(m_pBody != NULL)(static_cast <bool> (m_pBody != __null) ? void (0) : __assert_fail ("m_pBody != NULL", "/home/maarten/src/libreoffice/core/include/rtl/ref.hxx" , 209, __extension__ __PRETTY_FUNCTION__)); | ||||||||||||||||
210 | return *m_pBody; | ||||||||||||||||
211 | } | ||||||||||||||||
212 | |||||||||||||||||
213 | |||||||||||||||||
214 | /** Returns True if the handle does point to a valid body. | ||||||||||||||||
215 | */ | ||||||||||||||||
216 | bool SAL_CALL is() const | ||||||||||||||||
217 | { | ||||||||||||||||
218 | return (m_pBody != NULL__null); | ||||||||||||||||
219 | } | ||||||||||||||||
220 | |||||||||||||||||
221 | #if defined LIBO_INTERNAL_ONLY1 | ||||||||||||||||
222 | /** Returns True if the handle does point to a valid body. | ||||||||||||||||
223 | */ | ||||||||||||||||
224 | explicit operator bool() const | ||||||||||||||||
225 | { | ||||||||||||||||
226 | return is(); | ||||||||||||||||
227 | } | ||||||||||||||||
228 | #endif | ||||||||||||||||
229 | |||||||||||||||||
230 | /** Returns True if this points to pBody. | ||||||||||||||||
231 | */ | ||||||||||||||||
232 | bool SAL_CALL operator== (const reference_type * pBody) const | ||||||||||||||||
233 | { | ||||||||||||||||
234 | return (m_pBody == pBody); | ||||||||||||||||
235 | } | ||||||||||||||||
236 | |||||||||||||||||
237 | |||||||||||||||||
238 | /** Returns True if handle points to the same body. | ||||||||||||||||
239 | */ | ||||||||||||||||
240 | bool | ||||||||||||||||
241 | SAL_CALL operator== (const Reference<reference_type> & handle) const | ||||||||||||||||
242 | { | ||||||||||||||||
243 | return (m_pBody == handle.m_pBody); | ||||||||||||||||
244 | } | ||||||||||||||||
245 | |||||||||||||||||
246 | |||||||||||||||||
247 | /** Needed to place References into STL collection. | ||||||||||||||||
248 | */ | ||||||||||||||||
249 | bool | ||||||||||||||||
250 | SAL_CALL operator!= (const Reference<reference_type> & handle) const | ||||||||||||||||
251 | { | ||||||||||||||||
252 | return (m_pBody != handle.m_pBody); | ||||||||||||||||
253 | } | ||||||||||||||||
254 | |||||||||||||||||
255 | |||||||||||||||||
256 | /** Needed to place References into STL collection. | ||||||||||||||||
257 | */ | ||||||||||||||||
258 | bool | ||||||||||||||||
259 | SAL_CALL operator< (const Reference<reference_type> & handle) const | ||||||||||||||||
260 | { | ||||||||||||||||
261 | return (m_pBody < handle.m_pBody); | ||||||||||||||||
262 | } | ||||||||||||||||
263 | |||||||||||||||||
264 | |||||||||||||||||
265 | /** Needed to place References into STL collection. | ||||||||||||||||
266 | */ | ||||||||||||||||
267 | bool | ||||||||||||||||
268 | SAL_CALL operator> (const Reference<reference_type> & handle) const | ||||||||||||||||
269 | { | ||||||||||||||||
270 | return (m_pBody > handle.m_pBody); | ||||||||||||||||
271 | } | ||||||||||||||||
272 | }; | ||||||||||||||||
273 | |||||||||||||||||
274 | } // namespace rtl | ||||||||||||||||
275 | |||||||||||||||||
276 | #if defined LIBO_INTERNAL_ONLY1 | ||||||||||||||||
277 | namespace std | ||||||||||||||||
278 | { | ||||||||||||||||
279 | |||||||||||||||||
280 | /// @cond INTERNAL | ||||||||||||||||
281 | /** | ||||||||||||||||
282 | Make rtl::Reference hashable by default for use in STL containers. | ||||||||||||||||
283 | |||||||||||||||||
284 | @since LibreOffice 6.3 | ||||||||||||||||
285 | */ | ||||||||||||||||
286 | template<typename T> | ||||||||||||||||
287 | struct hash<::rtl::Reference<T>> | ||||||||||||||||
288 | { | ||||||||||||||||
289 | std::size_t operator()(::rtl::Reference<T> const & s) const | ||||||||||||||||
290 | { return std::size_t(s.get()); } | ||||||||||||||||
291 | }; | ||||||||||||||||
292 | /// @endcond | ||||||||||||||||
293 | |||||||||||||||||
294 | } | ||||||||||||||||
295 | |||||||||||||||||
296 | #endif | ||||||||||||||||
297 | |||||||||||||||||
298 | #endif /* ! INCLUDED_RTL_REF_HXX */ | ||||||||||||||||
299 | |||||||||||||||||
300 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | /* |
3 | * This file is part of the LibreOffice project. |
4 | * |
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/. |
8 | * |
9 | * This file incorporates work covered by the following license notice: |
10 | * |
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 . |
18 | */ |
19 | #ifndef INCLUDED_VCL_Reference_HXX |
20 | #define INCLUDED_VCL_Reference_HXX |
21 | |
22 | #include <vcl/dllapi.h> |
23 | #include <osl/interlck.h> |
24 | |
25 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) VclReferenceBase |
26 | { |
27 | mutable oslInterlockedCount mnRefCnt; |
28 | |
29 | template<typename T> friend class VclPtr; |
30 | |
31 | public: |
32 | void acquire() const |
33 | { |
34 | osl_atomic_increment(&mnRefCnt)__sync_add_and_fetch((&mnRefCnt), 1); |
35 | } |
36 | |
37 | void release() const |
38 | { |
39 | if (osl_atomic_decrement(&mnRefCnt)__sync_sub_and_fetch((&mnRefCnt), 1) == 0) |
40 | delete this; |
41 | } |
42 | #ifdef DBG_UTIL |
43 | #ifndef _WIN32 |
44 | sal_Int32 getRefCount() const { return mnRefCnt; } |
45 | #endif |
46 | #endif |
47 | |
48 | |
49 | private: |
50 | VclReferenceBase(const VclReferenceBase&) = delete; |
51 | VclReferenceBase& operator=(const VclReferenceBase&) = delete; |
52 | |
53 | bool mbDisposed : 1; |
54 | |
55 | protected: |
56 | VclReferenceBase(); |
57 | protected: |
58 | virtual ~VclReferenceBase(); |
59 | |
60 | protected: |
61 | virtual void dispose(); |
62 | |
63 | public: |
64 | void disposeOnce(); |
65 | bool isDisposed() const { return mbDisposed; } |
66 | |
67 | }; |
68 | #endif |