1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SVX_FMCTRLER_HXX 24 #define _SVX_FMCTRLER_HXX 25 26 #include "delayedevent.hxx" 27 #include "formdispatchinterceptor.hxx" 28 #include "sqlparserclient.hxx" 29 30 /** === begin UNO includes === **/ 31 #include <com/sun/star/awt/XControl.hpp> 32 #include <com/sun/star/awt/XControlModel.hpp> 33 #include <com/sun/star/awt/XFocusListener.hpp> 34 #include <com/sun/star/awt/XItemListener.hpp> 35 #include <com/sun/star/awt/XMouseListener.hpp> 36 #include <com/sun/star/awt/XTabController.hpp> 37 #include <com/sun/star/awt/XTextComponent.hpp> 38 #include <com/sun/star/container/XContainerListener.hpp> 39 #include <com/sun/star/container/XEnumerationAccess.hpp> 40 #include <com/sun/star/container/XIndexContainer.hpp> 41 #include <com/sun/star/form/DatabaseDeleteEvent.hpp> 42 #include <com/sun/star/form/DatabaseParameterEvent.hpp> 43 #include <com/sun/star/form/ErrorEvent.hpp> 44 #include <com/sun/star/form/validation/XFormComponentValidityListener.hpp> 45 #include <com/sun/star/form/XConfirmDeleteBroadcaster.hpp> 46 #include <com/sun/star/form/XConfirmDeleteListener.hpp> 47 #include <com/sun/star/form/XDatabaseParameterBroadcaster2.hpp> 48 #include <com/sun/star/form/XDatabaseParameterListener.hpp> 49 #include <com/sun/star/form/runtime/XFormController.hpp> 50 #include <com/sun/star/form/runtime/XFilterController.hpp> 51 #include <com/sun/star/form/XFormControllerListener.hpp> 52 #include <com/sun/star/form/XGridControlListener.hpp> 53 #include <com/sun/star/form/XLoadListener.hpp> 54 #include <com/sun/star/form/XResetListener.hpp> 55 #include <com/sun/star/frame/DispatchDescriptor.hpp> 56 #include <com/sun/star/frame/XDispatch.hpp> 57 #include <com/sun/star/frame/XDispatchProvider.hpp> 58 #include <com/sun/star/frame/XDispatchProviderInterception.hpp> 59 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 60 #include <com/sun/star/frame/XModel.hpp> 61 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 62 #include <com/sun/star/lang/XServiceInfo.hpp> 63 #include <com/sun/star/script/XEventAttacherManager.hpp> 64 #include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp> 65 #include <com/sun/star/sdb/XRowSetApproveListener.hpp> 66 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> 67 #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp> 68 #include <com/sun/star/sdb/XSQLErrorListener.hpp> 69 #include <com/sun/star/sdbc/XRowSetListener.hpp> 70 #include <com/sun/star/task/XInteractionHandler.hpp> 71 #include <com/sun/star/util/XModeSelector.hpp> 72 #include <com/sun/star/util/XModifyBroadcaster.hpp> 73 #include <com/sun/star/util/XModifyListener.hpp> 74 /** === end UNO includes === **/ 75 76 #include <comphelper/broadcasthelper.hxx> 77 #include <comphelper/componentcontext.hxx> 78 #include <comphelper/proparrhlp.hxx> 79 #include <comphelper/stl_types.hxx> 80 #include <connectivity/sqlparse.hxx> 81 #include <cppuhelper/propshlp.hxx> 82 #include <tools/debug.hxx> 83 #include <vcl/timer.hxx> 84 85 #if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_22) 86 #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_22 87 #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 22 88 #include <comphelper/implbase_var.hxx> 89 #endif 90 91 struct FmXTextComponentLess : public ::std::binary_function< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent> , sal_Bool> 92 { operator ()FmXTextComponentLess93 sal_Bool operator() (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& x, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& y) const 94 { 95 return reinterpret_cast<sal_Int64>(x.get()) < reinterpret_cast<sal_Int64>(y.get()); 96 } 97 }; 98 99 typedef ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::rtl::OUString, FmXTextComponentLess> FmFilterRow; 100 typedef ::std::vector< FmFilterRow > FmFilterRows; 101 typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > > FmFormControllers; 102 103 class FmFormView; 104 class Window; 105 106 namespace svxform 107 { 108 typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > > FilterComponents; 109 class ControlBorderManager; 110 struct FmFieldInfo; 111 112 typedef ::comphelper::WeakComponentImplHelper22 < ::com::sun::star::form::runtime::XFormController 113 , ::com::sun::star::form::runtime::XFilterController 114 , ::com::sun::star::awt::XFocusListener 115 , ::com::sun::star::form::XLoadListener 116 , ::com::sun::star::beans::XPropertyChangeListener 117 , ::com::sun::star::awt::XTextListener 118 , ::com::sun::star::awt::XItemListener 119 , ::com::sun::star::container::XContainerListener 120 , ::com::sun::star::util::XModifyListener 121 , ::com::sun::star::form::XConfirmDeleteListener 122 , ::com::sun::star::sdb::XSQLErrorListener 123 , ::com::sun::star::sdbc::XRowSetListener 124 , ::com::sun::star::sdb::XRowSetApproveListener 125 , ::com::sun::star::form::XDatabaseParameterListener 126 , ::com::sun::star::lang::XServiceInfo 127 , ::com::sun::star::form::XResetListener 128 , ::com::sun::star::frame::XDispatch 129 , ::com::sun::star::awt::XMouseListener 130 , ::com::sun::star::form::validation::XFormComponentValidityListener 131 , ::com::sun::star::task::XInteractionHandler 132 , ::com::sun::star::form::XGridControlListener 133 , ::com::sun::star::form::runtime::XFeatureInvalidation 134 > FormController_BASE; 135 136 //================================================================== 137 // FormController 138 //================================================================== 139 class ColumnInfoCache; 140 class SAL_DLLPRIVATE FormController :public ::comphelper::OBaseMutex 141 ,public FormController_BASE 142 ,public ::cppu::OPropertySetHelper 143 ,public DispatchInterceptor 144 ,public ::comphelper::OAggregationArrayUsageHelper< FormController > 145 ,public ::svxform::OSQLParserClient 146 { 147 typedef ::std::map < sal_Int16, 148 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > 149 > DispatcherContainer; 150 151 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate; 152 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController> m_xTabController; 153 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> m_xActiveControl, m_xCurrentControl; 154 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xModelAsIndex; 155 ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager> m_xModelAsManager; 156 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xParent; 157 ::comphelper::ComponentContext m_aContext; 158 // Composer used for checking filter conditions 159 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xComposer; 160 ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > m_xInteractionHandler; 161 ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext > m_xContext; 162 163 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> > m_aControls; 164 ::cppu::OInterfaceContainerHelper 165 m_aActivateListeners, 166 m_aModifyListeners, 167 m_aErrorListeners, 168 m_aDeleteListeners, 169 m_aRowSetApproveListeners, 170 m_aParameterListeners, 171 m_aFilterListeners; 172 173 FmFormControllers m_aChilds; 174 FilterComponents m_aFilterComponents; 175 FmFilterRows m_aFilterRows; 176 177 Timer m_aTabActivationTimer; 178 Timer m_aFeatureInvalidationTimer; 179 180 ::svxform::ControlBorderManager* 181 m_pControlBorderManager; 182 183 ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > 184 m_xFormOperations; 185 DispatcherContainer m_aFeatureDispatchers; 186 ::std::set< sal_Int16 > m_aInvalidFeatures; // for asynchronous feature invalidation 187 188 ::rtl::OUString m_aMode; 189 190 ::svxform::DelayedEvent m_aLoadEvent; 191 ::svxform::DelayedEvent m_aToggleEvent; 192 ::svxform::DelayedEvent m_aActivationEvent; 193 ::svxform::DelayedEvent m_aDeactivationEvent; 194 195 ::std::auto_ptr< ColumnInfoCache > 196 m_pColumnInfoCache; 197 198 sal_Int32 m_nCurrentFilterPosition; // current level for filtering (or-criteria) 199 200 sal_Bool m_bCurrentRecordModified : 1; 201 sal_Bool m_bCurrentRecordNew : 1; 202 sal_Bool m_bLocked : 1; 203 sal_Bool m_bDBConnection : 1; // Focuslistener nur fuer Datenbankformulare 204 sal_Bool m_bCycle : 1; 205 sal_Bool m_bCanInsert : 1; 206 sal_Bool m_bCanUpdate : 1; 207 sal_Bool m_bCommitLock : 1; // lock the committing of controls see focusGained 208 sal_Bool m_bModified : 1; // ist der Inhalt eines Controls modifiziert ? 209 sal_Bool m_bControlsSorted : 1; 210 sal_Bool m_bFiltering : 1; 211 sal_Bool m_bAttachEvents : 1; 212 sal_Bool m_bDetachEvents : 1; 213 bool m_bAttemptedHandlerCreation : 1; 214 bool m_bSuspendFilterTextListening; // no bit field, passed around as reference 215 216 // as we want to intercept dispatches of _all_ controls we're responsible for, and an object implementing 217 // the ::com::sun::star::frame::XDispatchProviderInterceptor interface can intercept only _one_ objects dispatches, we need a helper class 218 DECLARE_STL_VECTOR(DispatchInterceptionMultiplexer*, Interceptors); 219 Interceptors m_aControlDispatchInterceptors; 220 221 public: 222 FormController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB ); 223 224 protected: 225 ~FormController(); 226 227 // XInterface 228 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException ); 229 virtual void SAL_CALL acquire() throw (); 230 virtual void SAL_CALL release() throw (); 231 232 // XTypeProvider 233 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); 234 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 235 236 // XDispatch 237 virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& _rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs ) throw (::com::sun::star::uno::RuntimeException); 238 virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException); 239 virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException); 240 241 // ::com::sun::star::container::XChild 242 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL getParent(void) throw( ::com::sun::star::uno::RuntimeException ); 243 virtual void SAL_CALL setParent(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Parent) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException ); 244 245 // ::com::sun::star::lang::XEventListener 246 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); 247 248 // OComponentHelper 249 virtual void SAL_CALL disposing(); 250 251 // OPropertySetHelper 252 virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, 253 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) 254 throw( ::com::sun::star::lang::IllegalArgumentException ); 255 256 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::uno::Exception ); 257 virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; 258 259 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException ); 260 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 261 262 using OPropertySetHelper::getFastPropertyValue; 263 264 // XFilterController 265 virtual ::sal_Int32 SAL_CALL getFilterComponents() throw (::com::sun::star::uno::RuntimeException); 266 virtual ::sal_Int32 SAL_CALL getDisjunctiveTerms() throw (::com::sun::star::uno::RuntimeException); 267 virtual void SAL_CALL addFilterControllerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFilterControllerListener >& _Listener ) throw( ::com::sun::star::uno::RuntimeException ); 268 virtual void SAL_CALL removeFilterControllerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFilterControllerListener >& _Listener ) throw( ::com::sun::star::uno::RuntimeException ); 269 virtual void SAL_CALL setPredicateExpression( ::sal_Int32 _Component, ::sal_Int32 _Term, const ::rtl::OUString& _PredicateExpression ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 270 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getFilterComponent( ::sal_Int32 _Component ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 271 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getPredicateExpressions() throw( ::com::sun::star::uno::RuntimeException ); 272 virtual void SAL_CALL removeDisjunctiveTerm( ::sal_Int32 _Term ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 273 virtual void SAL_CALL appendEmptyDisjunctiveTerm() throw (::com::sun::star::uno::RuntimeException); 274 virtual ::sal_Int32 SAL_CALL getActiveTerm() throw (::com::sun::star::uno::RuntimeException); 275 virtual void SAL_CALL setActiveTerm( ::sal_Int32 _ActiveTerm ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 276 277 // XElementAccess 278 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException ); 279 virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException ); 280 281 // ::com::sun::star::container::XEnumerationAccess 282 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration> SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException ); 283 284 // ::com::sun::star::container::XContainerListener 285 virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 286 virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 287 virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 288 289 // XLoadListener 290 virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 291 virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 292 virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException ); 293 virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException ); 294 virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException ); 295 296 // XModeSelector 297 virtual void SAL_CALL setMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException ); 298 virtual ::rtl::OUString SAL_CALL getMode(void) throw( ::com::sun::star::uno::RuntimeException ); 299 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes(void) throw( ::com::sun::star::uno::RuntimeException ); 300 virtual sal_Bool SAL_CALL supportsMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::uno::RuntimeException ); 301 302 // ::com::sun::star::container::XIndexAccess 303 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException ); 304 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 Index) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); 305 306 // XModifyBroadcaster 307 virtual void SAL_CALL addModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException ); 308 virtual void SAL_CALL removeModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException ); 309 310 // XFocusListener 311 virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException ); 312 virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException ); 313 314 // XMouseListener 315 virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); 316 virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); 317 virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); 318 virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); 319 320 // XFormComponentValidityListener 321 virtual void SAL_CALL componentValidityChanged( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException); 322 323 // XInteractionHandler 324 virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException); 325 326 // XGridControlListener 327 virtual void SAL_CALL columnChanged( const ::com::sun::star::lang::EventObject& _event ) throw (::com::sun::star::uno::RuntimeException); 328 329 // ::com::sun::star::beans::XPropertyChangeListener -> aenderung der stati 330 virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException ); 331 332 // XTextListener -> modify setzen 333 virtual void SAL_CALL textChanged(const ::com::sun::star::awt::TextEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 334 335 // XItemListener -> modify setzen 336 virtual void SAL_CALL itemStateChanged(const ::com::sun::star::awt::ItemEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 337 338 // XModifyListener -> modify setzen 339 virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 340 341 // XFormController 342 virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > SAL_CALL getFormOperations() throw (::com::sun::star::uno::RuntimeException); 343 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> SAL_CALL getCurrentControl(void) throw( ::com::sun::star::uno::RuntimeException ); 344 virtual void SAL_CALL addActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException ); 345 virtual void SAL_CALL removeActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException ); 346 virtual void SAL_CALL addChildController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _ChildController ) throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException ); 347 348 virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext > SAL_CALL getContext() throw (::com::sun::star::uno::RuntimeException); 349 virtual void SAL_CALL setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext >& _context ) throw (::com::sun::star::uno::RuntimeException); 350 virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > SAL_CALL getInteractionHandler() throw (::com::sun::star::uno::RuntimeException); 351 virtual void SAL_CALL setInteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _interactionHandler ) throw (::com::sun::star::uno::RuntimeException); 352 353 // XTabController 354 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> > SAL_CALL getControls(void) throw( ::com::sun::star::uno::RuntimeException ); 355 356 virtual void SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>& Model) throw( ::com::sun::star::uno::RuntimeException ); 357 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel> SAL_CALL getModel() throw( ::com::sun::star::uno::RuntimeException ); 358 359 virtual void SAL_CALL setContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer>& Container) throw( ::com::sun::star::uno::RuntimeException ); 360 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> SAL_CALL getContainer() throw( ::com::sun::star::uno::RuntimeException ); 361 362 virtual void SAL_CALL autoTabOrder() throw( ::com::sun::star::uno::RuntimeException ); 363 virtual void SAL_CALL activateTabOrder() throw( ::com::sun::star::uno::RuntimeException ); 364 365 virtual void SAL_CALL activateFirst() throw( ::com::sun::star::uno::RuntimeException ); 366 virtual void SAL_CALL activateLast() throw( ::com::sun::star::uno::RuntimeException ); 367 368 // com::sun::star::sdbc::XRowSetListener 369 virtual void SAL_CALL cursorMoved(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); 370 virtual void SAL_CALL rowChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); 371 virtual void SAL_CALL rowSetChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); 372 373 // XRowSetApproveListener 374 virtual sal_Bool SAL_CALL approveCursorMove(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); 375 virtual sal_Bool SAL_CALL approveRowChange(const ::com::sun::star::sdb::RowChangeEvent& event) throw( ::com::sun::star::uno::RuntimeException ); 376 virtual sal_Bool SAL_CALL approveRowSetChange(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); 377 378 // XRowSetApproveBroadcaster 379 virtual void SAL_CALL addRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException ); 380 virtual void SAL_CALL removeRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException ); 381 382 // XSQLErrorBroadcaster 383 virtual void SAL_CALL errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException ); 384 385 // XSQLErrorListener 386 virtual void SAL_CALL addSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException ); 387 virtual void SAL_CALL removeSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException ); 388 389 // XDatabaseParameterBroadcaster2 390 virtual void SAL_CALL addDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); 391 virtual void SAL_CALL removeDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); 392 393 // XDatabaseParameterBroadcaster 394 virtual void SAL_CALL addParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); 395 virtual void SAL_CALL removeParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); 396 397 // XDatabaseParameterListener 398 virtual sal_Bool SAL_CALL approveParameter(const ::com::sun::star::form::DatabaseParameterEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException ); 399 400 // XConfirmDeleteBroadcaster 401 virtual void SAL_CALL addConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); 402 virtual void SAL_CALL removeConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); 403 404 // XConfirmDeleteListener 405 virtual sal_Bool SAL_CALL confirmDelete(const ::com::sun::star::sdb::RowChangeEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException ); 406 407 // XServiceInfo 408 virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException); 409 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); 410 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw(::com::sun::star::uno::RuntimeException); 411 412 // XResetListener 413 virtual sal_Bool SAL_CALL approveReset(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 414 virtual void SAL_CALL resetted(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 415 416 // XFeatureInvalidation 417 virtual void SAL_CALL invalidateFeatures( const ::com::sun::star::uno::Sequence< ::sal_Int16 >& Features ) throw (::com::sun::star::uno::RuntimeException); 418 virtual void SAL_CALL invalidateAllFeatures( ) throw (::com::sun::star::uno::RuntimeException); 419 420 // method for registration 421 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void); 422 423 // comphelper::OPropertyArrayUsageHelper 424 virtual void fillProperties( 425 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, 426 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps 427 ) const; 428 429 protected: 430 // DispatchInterceptor 431 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> 432 interceptedQueryDispatch( 433 const ::com::sun::star::util::URL& aURL, 434 const ::rtl::OUString& aTargetFrameName, 435 sal_Int32 nSearchFlags 436 ) throw( ::com::sun::star::uno::RuntimeException ); 437 getInterceptorMutex()438 virtual ::osl::Mutex* getInterceptorMutex() { return &m_aMutex; } 439 440 /// update all our dispatchers 441 void updateAllDispatchers() const; 442 443 /** disposes all dispatchers in m_aFeatureDispatchers, and empties m_aFeatureDispatchers 444 */ 445 void disposeAllFeaturesAndDispatchers() SAL_THROW(()); 446 447 void startFiltering(); 448 void stopFiltering(); 449 void setFilter(::std::vector<FmFieldInfo>&); 450 void startListening(); 451 void stopListening(); 452 453 /** ensures that we have an interaction handler, if possible 454 455 If an interaction handler was provided at creation time (<member>initialize</member>), this 456 one will be used. Else, an attempt is made to create an <type scope="com::sun::star::sdb">InteractionHandler</type> 457 is made. 458 459 @return <TRUE/> 460 if and only if <member>m_xInteractionHandler</member> is valid when the method returns 461 */ 462 bool ensureInteractionHandler(); 463 464 /** replaces one of our controls with another one 465 466 Upon successful replacing, the old control will be disposed. Also, internal members pointing 467 to the current or active control will be adjusted. Yet more, if the replaced control was 468 the active control, the new control will be made active. 469 470 @param _rxExistentControl 471 The control to replace. Must be one of the controls in our ControlContainer. 472 @param _rxNewControl 473 The control which should replace the existent control. 474 @return 475 <TRUE/> if and only if the control was successfully replaced 476 */ 477 bool replaceControl( 478 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxExistentControl, 479 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxNewControl 480 ); 481 482 // we're listening at all bound controls for modifications 483 void startControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); 484 void stopControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); 485 486 void setLocks(); 487 void setControlLock(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); 488 void addToEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); 489 void removeFromEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); 490 void toggleAutoFields(sal_Bool bAutoFields); 491 void unload() throw( ::com::sun::star::uno::RuntimeException ); 492 void removeBoundFieldListener(); 493 494 void startFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly ); 495 void stopFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly ); 496 497 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> findControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> >& rCtrls, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& rxCtrlModel, sal_Bool _bRemove, sal_Bool _bOverWrite ) const; 498 499 void insertControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); 500 void removeControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); 501 502 /// called when a new control is to be handled by the controller 503 void implControlInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bAddToEventAttacher ); 504 /// called when a control is not to be handled by the controller anymore 505 void implControlRemoved( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bRemoveFromEventAttacher ); 506 507 /** sets m_xCurrentControl, plus does administrative tasks depending on it 508 */ 509 void implSetCurrentControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ); 510 511 /** invalidates the FormFeatures which depend on the current control 512 */ 513 void implInvalidateCurrentControlDependentFeatures(); 514 impl_isDisposed_nofail() const515 bool impl_isDisposed_nofail() const { return FormController_BASE::rBHelper.bDisposed; } 516 void impl_checkDisposed_throw() const; 517 518 void impl_onModify(); 519 520 /** adds the given filter row to m_aFilterRows, setting m_nCurrentFilterPosition to 0 if the newly added 521 row is the first one. 522 523 @precond 524 our mutex is locked 525 */ 526 void impl_addFilterRow( const FmFilterRow& _row ); 527 528 /** adds an empty filter row to m_aFilterRows, and notifies our listeners 529 */ 530 void impl_appendEmptyFilterRow( ::osl::ClearableMutexGuard& _rClearBeforeNotify ); 531 isLocked() const532 sal_Bool isLocked() const {return m_bLocked;} 533 sal_Bool determineLockState() const; 534 535 Window* getDialogParentWindow(); 536 // returns the window which should be used as parent window for dialogs 537 538 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor> createInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception); 539 // create a new interceptor, register it on the given object 540 void deleteInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception); 541 // if createInterceptor was called for the given object the according interceptor will be removed 542 // from the objects interceptor chain and released 543 544 /** checks all form controls belonging to our form for validity 545 546 If a form control supports the XValidatableFormComponent interface, this is used to determine 547 the validity of the control. If the interface is not supported, the control is supposed to be 548 valid. 549 550 @param _rFirstInvalidityExplanation 551 if the method returns <FALSE/> (i.e. if there is an invalid control), this string contains 552 the explanation for the invalidity, as obtained from the validator. 553 554 @param _rxFirstInvalidModel 555 if the method returns <FALSE/> (i.e. if there is an invalid control), this contains 556 the control model 557 558 @return 559 <TRUE/> if and only if all controls belonging to our form are valid 560 */ 561 bool checkFormComponentValidity( 562 ::rtl::OUString& /* [out] */ _rFirstInvalidityExplanation, 563 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& /* [out] */ _rxFirstInvalidModel 564 ) SAL_THROW(()); 565 566 /** locates the control which belongs to a given model 567 */ 568 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > 569 locateControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel ) SAL_THROW(()); 570 571 // set the text for all filters 572 void impl_setTextOnAllFilter_throw(); 573 574 // in filter mode we do not listen for changes isListeningForChanges() const575 sal_Bool isListeningForChanges() const {return m_bDBConnection && !m_bFiltering && !isLocked();} 576 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> isInList(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& xPeer) const; 577 578 DECL_LINK( OnActivateTabOrder, void* ); 579 DECL_LINK( OnInvalidateFeatures, void* ); 580 DECL_LINK( OnLoad, void* ); 581 DECL_LINK( OnToggleAutoFields, void* ); 582 DECL_LINK( OnActivated, void* ); 583 DECL_LINK( OnDeactivated, void* ); 584 }; 585 586 } // namespace svxform 587 588 #endif // _SVX_FMCTRLER_HXX 589 590