LibreOffice Module forms (master) 1
Button.cxx
Go to the documentation of this file.
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
21#include "Button.hxx"
22#include <property.hxx>
23#include <services.hxx>
24
25#include <com/sun/star/awt/XVclWindowPeer.hpp>
26#include <com/sun/star/beans/PropertyAttribute.hpp>
27#include <com/sun/star/form/FormComponentType.hpp>
28
32#include <o3tl/any.hxx>
33#include <o3tl/string_view.hxx>
35#include <tools/debug.hxx>
36#include <tools/urlobj.hxx>
37#include <vcl/svapp.hxx>
38#include <osl/mutex.hxx>
39
40namespace frm
41{
42
43
44using namespace ::com::sun::star::uno;
45using namespace ::com::sun::star::sdb;
46using namespace ::com::sun::star::sdbc;
47using namespace ::com::sun::star::beans;
48using namespace ::com::sun::star::container;
49using namespace ::com::sun::star::form;
50using namespace ::com::sun::star::awt;
51using namespace ::com::sun::star::io;
52using namespace ::com::sun::star::lang;
53using namespace ::com::sun::star::util;
54using ::com::sun::star::frame::XDispatchProviderInterceptor;
55
56
57//= OButtonModel
58
59
60OButtonModel::OButtonModel(const Reference<XComponentContext>& _rxFactory)
61 :OClickableImageBaseModel( _rxFactory, VCL_CONTROLMODEL_COMMANDBUTTON, FRM_SUN_CONTROL_COMMANDBUTTON )
62 // use the old control name for compatibility reasons
63 ,m_aResetHelper( *this, m_aMutex )
64 ,m_eDefaultState( TRISTATE_FALSE )
65{
66 m_nClassId = FormComponentType::COMMANDBUTTON;
67}
68
69
70Any SAL_CALL OButtonModel::queryAggregation( const Type& _type )
71{
72 Any aReturn = OClickableImageBaseModel::queryAggregation( _type );
73 if ( !aReturn.hasValue() )
74 aReturn = OButtonModel_Base::queryInterface( _type );
75 return aReturn;
76}
77
78
79Sequence< Type > OButtonModel::_getTypes()
80{
81 return ::comphelper::concatSequences(
82 OClickableImageBaseModel::_getTypes(),
83 OButtonModel_Base::getTypes()
84 );
85}
86
87
88OButtonModel::OButtonModel( const OButtonModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
89 :OClickableImageBaseModel( _pOriginal, _rxFactory )
90 ,m_aResetHelper( *this, m_aMutex )
91 ,m_eDefaultState( _pOriginal->m_eDefaultState )
92{
93 m_nClassId = FormComponentType::COMMANDBUTTON;
94
96}
97
98
100{
101}
102
103
104void OButtonModel::describeFixedProperties( Sequence< Property >& _rProps ) const
105{
107 sal_Int32 nOldCount = _rProps.getLength();
108 _rProps.realloc( nOldCount + 6);
109 css::beans::Property* pProperties = _rProps.getArray() + nOldCount;
110 *pProperties++ = css::beans::Property(PROPERTY_BUTTONTYPE, PROPERTY_ID_BUTTONTYPE, cppu::UnoType<FormButtonType>::get(), css::beans::PropertyAttribute::BOUND);
111 *pProperties++ = css::beans::Property(PROPERTY_DEFAULT_STATE, PROPERTY_ID_DEFAULT_STATE, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND);
112 *pProperties++ = css::beans::Property(PROPERTY_DISPATCHURLINTERNAL, PROPERTY_ID_DISPATCHURLINTERNAL, cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::BOUND);
113 *pProperties++ = css::beans::Property(PROPERTY_TARGET_URL, PROPERTY_ID_TARGET_URL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND);
114 *pProperties++ = css::beans::Property(PROPERTY_TARGET_FRAME, PROPERTY_ID_TARGET_FRAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND);
115 *pProperties++ = css::beans::Property(PROPERTY_TABINDEX, PROPERTY_ID_TABINDEX, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND);
116 DBG_ASSERT( pProperties == _rProps.getArray() + _rProps.getLength(), "<...>::describeFixedProperties/getInfoHelper: forgot to adjust the count ?");
117}
118
119
120css::uno::Reference< css::util::XCloneable > SAL_CALL OButtonModel::createClone()
121{
123 pClone->clonedFrom(this);
124 return pClone;
125}
126
127
128// XServiceInfo
129
130css::uno::Sequence<OUString> OButtonModel::getSupportedServiceNames()
131{
132 css::uno::Sequence<OUString> aSupported = OClickableImageBaseModel::getSupportedServiceNames();
133 aSupported.realloc( aSupported.getLength() + 2 );
134
135 OUString* pArray = aSupported.getArray();
136 pArray[ aSupported.getLength() - 2 ] = FRM_SUN_COMPONENT_COMMANDBUTTON;
137 pArray[ aSupported.getLength() - 1 ] = FRM_COMPONENT_COMMANDBUTTON;
138
139 return aSupported;
140}
141
142
144{
145 return FRM_COMPONENT_COMMANDBUTTON; // old (non-sun) name for compatibility !
146}
147
148
149void OButtonModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
150{
152
153 _rxOutStream->writeShort(0x0003); // Version
154
155 {
156 OStreamSection aSection( _rxOutStream );
157 // this will allow readers to skip unknown bytes in their dtor
158
159 _rxOutStream->writeShort( static_cast<sal_uInt16>(m_eButtonType) );
160
162 _rxOutStream << sTmp;
163 _rxOutStream << m_sTargetFrame;
164 writeHelpTextCompatibly(_rxOutStream);
165 _rxOutStream << isDispatchUrlInternal();
166 }
167}
168
169
170void OButtonModel::read(const Reference<XObjectInputStream>& _rxInStream)
171{
173
174 sal_uInt16 nVersion = _rxInStream->readShort(); // Version
175 switch (nVersion)
176 {
177 case 0x0001:
178 {
179 m_eButtonType = static_cast<FormButtonType>(_rxInStream->readShort());
180
181 _rxInStream >> m_sTargetURL;
182 _rxInStream >> m_sTargetFrame;
183 }
184 break;
185
186 case 0x0002:
187 {
188 m_eButtonType = static_cast<FormButtonType>(_rxInStream->readShort());
189
190 _rxInStream >> m_sTargetURL;
191 _rxInStream >> m_sTargetFrame;
192 readHelpTextCompatibly(_rxInStream);
193 }
194 break;
195
196 case 0x0003:
197 {
198 OStreamSection aSection( _rxInStream );
199 // this will skip any unknown bytes in its dtor
200
201 // button type
202 m_eButtonType = static_cast<FormButtonType>(_rxInStream->readShort());
203
204 // URL
205 _rxInStream >> m_sTargetURL;
206
207 // target frame
208 _rxInStream >> m_sTargetFrame;
209
210 // help text
211 readHelpTextCompatibly(_rxInStream);
212
213 // DispatchInternal
214 bool bDispatch;
215 _rxInStream >> bDispatch;
216 setDispatchUrlInternal(bDispatch);
217 }
218 break;
219
220 default:
221 OSL_FAIL("OButtonModel::read : unknown version !");
222 m_eButtonType = FormButtonType_PUSH;
223 m_sTargetURL.clear();
224 m_sTargetFrame.clear();
225 break;
226 }
227}
228
229
231{
234}
235
236
237void SAL_CALL OButtonModel::reset()
238{
240 return;
241
243
245}
246
247
248void SAL_CALL OButtonModel::addResetListener( const Reference< XResetListener >& _listener )
249{
250 m_aResetHelper.addResetListener( _listener );
251}
252
253
254void SAL_CALL OButtonModel::removeResetListener( const Reference< XResetListener >& _listener )
255{
257}
258
259
260void SAL_CALL OButtonModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
261{
262 switch ( _nHandle )
263 {
265 _rValue <<= static_cast<sal_Int16>(m_eDefaultState);
266 break;
267
268 default:
270 break;
271 }
272}
273
274
275void SAL_CALL OButtonModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )
276{
277 switch ( _nHandle )
278 {
280 {
281 sal_Int16 nDefaultState = sal_Int16(TRISTATE_FALSE);
282 OSL_VERIFY( _rValue >>= nDefaultState );
283 m_eDefaultState = static_cast<ToggleState>(nDefaultState);
285 }
286 break;
287
288 default:
290 break;
291 }
292}
293
294
295sal_Bool SAL_CALL OButtonModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue )
296{
297 bool bModified = false;
298 switch ( _nHandle )
299 {
301 bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_eDefaultState) );
302 break;
303
304 default:
305 bModified = OClickableImageBaseModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
306 break;
307 }
308 return bModified;
309}
310
311
313{
314 Any aDefault;
315 switch ( _nHandle )
316 {
318 aDefault <<= sal_Int16(TRISTATE_FALSE);
319 break;
320
321 default:
323 break;
324 }
325 return aDefault;
326}
327
328
330{
331 try
332 {
334 }
335 catch( const Exception& )
336 {
337 DBG_UNHANDLED_EXCEPTION("forms.component");
338 }
339}
340
341
342// OButtonControl
343
344
346{
347 return ::comphelper::concatSequences(
351 );
352}
353
354
355css::uno::Sequence<OUString> OButtonControl::getSupportedServiceNames()
356{
357 css::uno::Sequence<OUString> aSupported = OClickableImageBaseControl::getSupportedServiceNames();
358 aSupported.realloc(aSupported.getLength() + 2);
359
360 OUString*pArray = aSupported.getArray();
361 pArray[aSupported.getLength()-2] = FRM_SUN_CONTROL_COMMANDBUTTON;
362 pArray[aSupported.getLength()-1] = STARDIV_ONE_FORM_CONTROL_COMMANDBUTTON;
363 return aSupported;
364}
365
366
367OButtonControl::OButtonControl(const Reference<XComponentContext>& _rxFactory)
369 ,OFormNavigationHelper( _rxFactory )
370 ,m_nClickEvent( nullptr )
371 ,m_nTargetUrlFeatureId( -1 )
372 ,m_bEnabledByPropertyValue( false )
373{
374 osl_atomic_increment(&m_refCount);
375 {
376 // Register as ActionListener
377 Reference<XButton> xButton;
379 if (xButton.is())
380 xButton->addActionListener(this);
381 }
382 // For Listener: refcount at one
383 osl_atomic_decrement(&m_refCount);
384}
385
386
388{
389 if (m_nClickEvent)
391}
392
393// UNO binding
394
396{
397 // if asked for the XTypeProvider, don't let OButtonControl_BASE do this
398 Any aReturn;
399 if ( !_rType.equals( cppu::UnoType<XTypeProvider>::get() ) )
400 aReturn = OButtonControl_BASE::queryInterface( _rType );
401
402 if ( !aReturn.hasValue() )
404
405 if ( !aReturn.hasValue() )
406 aReturn = OFormNavigationHelper::queryInterface( _rType );
407
408 return aReturn;
409}
410
411
413{
415
418}
419
420
421void SAL_CALL OButtonControl::disposing( const EventObject& _rSource )
422{
423 OControl::disposing( _rSource );
425}
426
427// ActionListener
428
429void OButtonControl::actionPerformed(const ActionEvent& /*rEvent*/)
430{
431 // Asynchronous for css::util::URL-Button
433 {
434 ::osl::MutexGuard aGuard( m_aMutex );
436 }
437}
438
439
440IMPL_LINK_NOARG(OButtonControl, OnClick, void*, void)
441{
442 ::osl::ClearableMutexGuard aGuard( m_aMutex );
443 m_nClickEvent = nullptr;
444
445 if (m_aApproveActionListeners.getLength())
446 {
447 // if there are listeners, start the action in an own thread, to not allow
448 // them to block us here (we're in the application's main thread)
449 getImageProducerThread()->addEvent();
450 }
451 else
452 {
453 // Else, don't. We then must not notify the Listeners in any case,
454 // not even if added later on.
455 aGuard.clear();
456
457 // recognize the button type
458 Reference<XPropertySet> xSet(getModel(), UNO_QUERY);
459 if (!xSet.is())
460 return;
461
462 if (FormButtonType_PUSH == *o3tl::doAccess<FormButtonType>(xSet->getPropertyValue(PROPERTY_BUTTONTYPE)))
463 {
464 // notify the action listeners for a push button
465 ::comphelper::OInterfaceIteratorHelper3 aIter(m_aActionListeners);
466 ActionEvent aEvt(static_cast<XWeak*>(this), m_aActionCommand);
467 while(aIter.hasMoreElements() )
468 {
469 // catch exceptions
470 // and catch them on a per-listener basis - if one listener fails, the others still need
471 // to get notified
472 try
473 {
474 aIter.next()->actionPerformed(aEvt);
475 }
476#ifdef DBG_UTIL
477 catch( const RuntimeException& )
478 {
479 // silence this
480 }
481#endif
482 catch( const Exception& )
483 {
484 TOOLS_WARN_EXCEPTION( "forms.component", "OButtonControl::OnClick: caught an exception other than RuntimeException!" );
485 }
486 }
487 }
488 else
489 actionPerformed_Impl( false, css::awt::MouseEvent() );
490 }
491}
492
493
494void OButtonControl::actionPerformed_Impl( bool _bNotifyListener, const css::awt::MouseEvent& _rEvt )
495{
496 {
497 sal_Int16 nFeatureId = -1;
498 {
499 ::osl::MutexGuard aGuard( m_aMutex );
500 nFeatureId = m_nTargetUrlFeatureId;
501 }
502
503 if ( nFeatureId != -1 )
504 {
505 if ( !approveAction() )
506 return;
507
508 SolarMutexGuard aGuard;
509 dispatch( nFeatureId );
510 return;
511 }
512 }
513
514 OClickableImageBaseControl::actionPerformed_Impl( _bNotifyListener, _rEvt );
515}
516
517// XButton
518
519void OButtonControl::setLabel(const OUString& Label)
520{
521 Reference<XButton> xButton;
523 if (xButton.is())
524 xButton->setLabel(Label);
525}
526
527
528void SAL_CALL OButtonControl::setActionCommand(const OUString& _rCommand)
529{
530 {
531 ::osl::MutexGuard aGuard( m_aMutex );
532 m_aActionCommand = _rCommand;
533 }
534
535 Reference<XButton> xButton;
537 if (xButton.is())
538 xButton->setActionCommand(_rCommand);
539}
540
541
542void SAL_CALL OButtonControl::addActionListener(const Reference<XActionListener>& _rxListener)
543{
544 m_aActionListeners.addInterface(_rxListener);
545}
546
547
548void SAL_CALL OButtonControl::removeActionListener(const Reference<XActionListener>& _rxListener)
549{
551}
552
553namespace {
554
555class DoPropertyListening
556{
557private:
558 Reference< XPropertySet > m_xProps;
559 Reference< XPropertyChangeListener > m_xListener;
561
562public:
563 DoPropertyListening(
564 const Reference< XInterface >& _rxComponent,
565 const Reference< XPropertyChangeListener >& _rxListener,
566 bool _bStart
567 );
568
569 void handleListening( const OUString& _rPropertyName );
570};
571
572}
573
574DoPropertyListening::DoPropertyListening(
575 const Reference< XInterface >& _rxComponent, const Reference< XPropertyChangeListener >& _rxListener,
576 bool _bStart )
577 :m_xProps( _rxComponent, UNO_QUERY )
578 ,m_xListener( _rxListener )
579 ,m_bStartListening( _bStart )
580{
581 DBG_ASSERT( m_xProps.is() || !_rxComponent.is(), "DoPropertyListening::DoPropertyListening: valid component, but no property set!" );
582 DBG_ASSERT( m_xListener.is(), "DoPropertyListening::DoPropertyListening: invalid listener!" );
583}
584
585
586void DoPropertyListening::handleListening( const OUString& _rPropertyName )
587{
588 if ( m_xProps.is() )
589 {
590 if ( m_bStartListening )
591 m_xProps->addPropertyChangeListener( _rPropertyName, m_xListener );
592 else
593 m_xProps->removePropertyChangeListener( _rPropertyName, m_xListener );
594 }
595}
596
597
598void OButtonControl::startOrStopModelPropertyListening( bool _bStart )
599{
600 DoPropertyListening aListeningHandler( getModel(), this, _bStart );
601 aListeningHandler.handleListening( PROPERTY_TARGET_URL );
602 aListeningHandler.handleListening( PROPERTY_BUTTONTYPE );
603 aListeningHandler.handleListening( PROPERTY_ENABLED );
604}
605
606
607sal_Bool SAL_CALL OButtonControl::setModel( const Reference< XControlModel >& _rxModel )
608{
609 startOrStopModelPropertyListening( false );
610 bool bResult = OClickableImageBaseControl::setModel( _rxModel );
611 startOrStopModelPropertyListening( true );
612
613 m_bEnabledByPropertyValue = true;
614 Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
615 if ( xModelProps.is() )
616 xModelProps->getPropertyValue( PROPERTY_ENABLED ) >>= m_bEnabledByPropertyValue;
617
618 modelFeatureUrlPotentiallyChanged( );
619
620 return bResult;
621}
622
623
624void OButtonControl::modelFeatureUrlPotentiallyChanged( )
625{
626 sal_Int16 nOldUrlFeatureId = m_nTargetUrlFeatureId;
627
628 // Do we have another TargetURL now? If so, we need to update our dispatches
629 m_nTargetUrlFeatureId = getModelUrlFeatureId( );
630 if ( nOldUrlFeatureId != m_nTargetUrlFeatureId )
631 {
632 invalidateSupportedFeaturesSet();
633 if ( !isDesignMode() )
634 updateDispatches( );
635 }
636}
637
638
639void SAL_CALL OButtonControl::propertyChange( const PropertyChangeEvent& _rEvent )
640{
641 if ( _rEvent.PropertyName == PROPERTY_TARGET_URL
642 || _rEvent.PropertyName == PROPERTY_BUTTONTYPE
643 )
644 {
645 modelFeatureUrlPotentiallyChanged( );
646 }
647 else if ( _rEvent.PropertyName == PROPERTY_ENABLED )
648 {
649 _rEvent.NewValue >>= m_bEnabledByPropertyValue;
650 }
651}
652
653
654namespace
655{
656 bool isFormControllerURL( std::u16string_view _rURL )
657 {
658 static constexpr std::u16string_view PREFIX = u".uno:FormController/";
659 return ( _rURL.size() > PREFIX.size() )
660 && ( o3tl::starts_with(_rURL, PREFIX ) );
661 }
662}
663
664
665sal_Int16 OButtonControl::getModelUrlFeatureId( ) const
666{
667 sal_Int16 nFeatureId = -1;
668
669 // some URL related properties of the model
670 OUString sUrl;
671 FormButtonType eButtonType = FormButtonType_PUSH;
672
673 Reference< XPropertySet > xModelProps( const_cast< OButtonControl* >( this )->getModel(), UNO_QUERY );
674 if ( xModelProps.is() )
675 {
676 xModelProps->getPropertyValue( PROPERTY_TARGET_URL ) >>= sUrl;
677 xModelProps->getPropertyValue( PROPERTY_BUTTONTYPE ) >>= eButtonType;
678 }
679
680 // are we a URL button?
681 if ( eButtonType == FormButtonType_URL )
682 {
683 // is it a feature URL?
684 if ( isFormControllerURL( sUrl ) )
685 {
686 nFeatureId = OFormNavigationMapper::getFeatureId( sUrl );
687 }
688 }
689
690 return nFeatureId;
691}
692
693
694void SAL_CALL OButtonControl::setDesignMode( sal_Bool _bOn )
695{
696 OClickableImageBaseControl::setDesignMode( _bOn );
697
698 if ( _bOn )
699 disconnectDispatchers();
700 else
701 connectDispatchers();
702 // this will connect if not already connected and just update else
703}
704
705
706void OButtonControl::getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds )
707{
708 if ( -1 != m_nTargetUrlFeatureId )
709 _rFeatureIds.push_back( m_nTargetUrlFeatureId );
710}
711
712
713void OButtonControl::featureStateChanged( sal_Int16 _nFeatureId, bool _bEnabled )
714{
715 if ( _nFeatureId == m_nTargetUrlFeatureId )
716 {
717 // enable or disable our peer, according to the new state
718 Reference< XVclWindowPeer > xPeer( getPeer(), UNO_QUERY );
719 if ( xPeer.is() )
720 xPeer->setProperty( PROPERTY_ENABLED, Any( m_bEnabledByPropertyValue && _bEnabled ) );
721 // if we're disabled according to our model's property, then
722 // we don't care for the feature state, but *are* disabled.
723 // If the model's property states that we're enabled, then we *do*
724 // care for the feature state
725 }
726
727 // base class
728 OFormNavigationHelper::featureStateChanged( _nFeatureId, _bEnabled );
729}
730
731
732void OButtonControl::allFeatureStatesChanged( )
733{
734 if ( -1 != m_nTargetUrlFeatureId )
735 // we have only one supported feature, so simulate it has changed ...
736 featureStateChanged( m_nTargetUrlFeatureId, isEnabled( m_nTargetUrlFeatureId ) );
737
738 // base class
739 OFormNavigationHelper::allFeatureStatesChanged( );
740}
741
742
743bool OButtonControl::isEnabled( sal_Int16 _nFeatureId ) const
744{
745 if ( const_cast< OButtonControl* >( this )->isDesignMode() )
746 // TODO: the model property?
747 return true;
748
749 return OFormNavigationHelper::isEnabled( _nFeatureId );
750}
751
752
753void SAL_CALL OButtonControl::registerDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& _rxInterceptor )
754{
755 OClickableImageBaseControl::registerDispatchProviderInterceptor( _rxInterceptor );
756 OFormNavigationHelper::registerDispatchProviderInterceptor( _rxInterceptor );
757}
758
759
760void SAL_CALL OButtonControl::releaseDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& _rxInterceptor )
761{
762 OClickableImageBaseControl::releaseDispatchProviderInterceptor( _rxInterceptor );
763 OFormNavigationHelper::releaseDispatchProviderInterceptor( _rxInterceptor );
764}
765
766} // namespace frm
767
768extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
769com_sun_star_form_OButtonModel_get_implementation(css::uno::XComponentContext* component,
770 css::uno::Sequence<css::uno::Any> const &)
771{
772 return cppu::acquire(new frm::OButtonModel(component));
773}
774
775extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
776com_sun_star_form_OButtonControl_get_implementation(css::uno::XComponentContext* component,
777 css::uno::Sequence<css::uno::Any> const &)
778{
779 return cppu::acquire(new frm::OButtonControl(component));
780}
781
782/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_form_OButtonControl_get_implementation(css::uno::XComponentContext *component, css::uno::Sequence< css::uno::Any > const &)
Definition: Button.cxx:776
bool m_bStartListening
Definition: Button.cxx:560
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_form_OButtonModel_get_implementation(css::uno::XComponentContext *component, css::uno::Sequence< css::uno::Any > const &)
Definition: Button.cxx:769
Reference< XPropertySet > m_xProps
Definition: Button.cxx:558
Reference< XPropertyChangeListener > m_xListener
Definition: Button.cxx:559
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
css::uno::Reference< ListenerT > const & next()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
oslInterlockedCount m_refCount
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Button.cxx:355
virtual void SAL_CALL actionPerformed(const css::awt::ActionEvent &rEvent) override
Definition: Button.cxx:429
virtual void SAL_CALL removeActionListener(const css::uno::Reference< css::awt::XActionListener > &_rxListener) override
Definition: Button.cxx:548
OButtonControl(const css::uno::Reference< css::uno::XComponentContext > &_rxFactory)
Definition: Button.cxx:367
virtual void SAL_CALL setLabel(const OUString &Label) override
Definition: Button.cxx:519
virtual void SAL_CALL setActionCommand(const OUString &_rCommand) override
Definition: Button.cxx:528
virtual void SAL_CALL disposing() override
Definition: Button.cxx:412
virtual void SAL_CALL addActionListener(const css::uno::Reference< css::awt::XActionListener > &_rxListener) override
Definition: Button.cxx:542
virtual ~OButtonControl() override
Definition: Button.cxx:387
void startOrStopModelPropertyListening(bool _bStart)
starts or stops listening for changes in model properties we're interested in
Definition: Button.cxx:598
sal_Int16 m_nTargetUrlFeatureId
Definition: Button.hxx:126
ImplSVEvent * m_nClickEvent
Definition: Button.hxx:125
virtual void actionPerformed_Impl(bool bNotifyListener, const css::awt::MouseEvent &_rEvt) override
Definition: Button.cxx:494
virtual css::uno::Sequence< css::uno::Type > _getTypes() override
Definition: Button.cxx:345
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType) override
Definition: Button.cxx:395
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
Definition: Button.cxx:260
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Button.cxx:130
virtual void SAL_CALL reset() override
Definition: Button.cxx:237
virtual void SAL_CALL removeResetListener(const css::uno::Reference< css::form::XResetListener > &aListener) override
Definition: Button.cxx:254
virtual void SAL_CALL disposing() override
Definition: Button.cxx:230
virtual ~OButtonModel() override
Definition: Button.cxx:99
virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const override
Definition: Button.cxx:312
void impl_resetNoBroadcast_nothrow()
Definition: Button.cxx:329
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: Button.cxx:275
virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream) override
Definition: Button.cxx:149
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &_rConvertedValue, css::uno::Any &_rOldValue, sal_Int32 _nHandle, const css::uno::Any &_rValue) override
Definition: Button.cxx:295
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
Definition: Button.cxx:120
virtual void describeFixedProperties(css::uno::Sequence< css::beans::Property > &_rProps) const override
describes the properties provided by this class, or its respective derived class
Definition: Button.cxx:104
virtual void SAL_CALL addResetListener(const css::uno::Reference< css::form::XResetListener > &aListener) override
Definition: Button.cxx:248
ToggleState m_eDefaultState
Definition: Button.hxx:106
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream) override
Definition: Button.cxx:170
OButtonModel(const css::uno::Reference< css::uno::XComponentContext > &_rxFactory)
ResetHelper m_aResetHelper
Definition: Button.hxx:103
virtual OUString SAL_CALL getServiceName() override
Definition: Button.cxx:143
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType) override
bool approveAction()
approves the action by calling the approve listeners
virtual void actionPerformed_Impl(bool bNotifyListener, const css::awt::MouseEvent &rEvt)
::comphelper::OInterfaceContainerHelper3< css::awt::XActionListener > m_aActionListeners
css::uno::Sequence< css::uno::Type > _getTypes() override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
css::form::FormButtonType m_eButtonType
virtual void SAL_CALL disposing() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
void setDispatchUrlInternal(bool _bDispatch)
virtual void describeFixedProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
describes the properties provided by this class, or its respective derived class
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream) override
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
void writeHelpTextCompatibly(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream)
virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream) override
void readHelpTextCompatibly(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream)
css::uno::Reference< css::uno::XAggregation > m_xAggregate
virtual void SAL_CALL disposing() override
::osl::Mutex m_aMutex
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void dispatch(sal_Int16 _nFeatureId) const override
dispatches a feature
void addResetListener(const css::uno::Reference< css::form::XResetListener > &_listener)
Definition: resettable.cxx:37
void notifyResetted()
Definition: resettable.cxx:62
void removeResetListener(const css::uno::Reference< css::form::XResetListener > &_listener)
Definition: resettable.cxx:43
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
float u
sal_Int16 nVersion
constexpr OUStringLiteral PROPERTY_TABINDEX
Definition: frm_strings.hxx:26
constexpr OUStringLiteral PROPERTY_TARGET_URL
Definition: frm_strings.hxx:49
constexpr OUStringLiteral PROPERTY_DISPATCHURLINTERNAL
constexpr OUStringLiteral PROPERTY_STATE
Definition: frm_strings.hxx:58
constexpr OUStringLiteral PROPERTY_TARGET_FRAME
Definition: frm_strings.hxx:50
constexpr OUStringLiteral PROPERTY_DEFAULT_STATE
Definition: frm_strings.hxx:65
constexpr OUStringLiteral PROPERTY_BUTTONTYPE
Definition: frm_strings.hxx:61
constexpr OUStringLiteral PROPERTY_ENABLED
Definition: frm_strings.hxx:39
std::mutex m_aMutex
sal_Int64 n
@ Exception
bool query_aggregation(const css::uno::Reference< css::uno::XAggregation > &_rxAggregate, css::uno::Reference< iface > &_rxOut)
bool tryPropertyValue(Any &_rConvertedValue, Any &_rOldValue, const Any &_rValueToSet, const Any &_rCurrentValue, const Type &_rExpectedType)
Type
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
ToggleState
Definition: togglestate.hxx:27
@ TRISTATE_FALSE
Definition: togglestate.hxx:27
IMPL_LINK_NOARG(OButtonControl, OnClick, void *, void)
Definition: Button.cxx:440
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
#define PROPERTY_ID_DEFAULT_STATE
Definition: property.hxx:112
#define PROPERTY_ID_DISPATCHURLINTERNAL
Definition: property.hxx:248
#define PROPERTY_ID_TARGET_FRAME
Definition: property.hxx:154
#define PROPERTY_ID_TARGET_URL
Definition: property.hxx:153
#define PROPERTY_ID_BUTTONTYPE
Definition: property.hxx:105
#define PROPERTY_ID_TABINDEX
Definition: property.hxx:41
constexpr OUStringLiteral STARDIV_ONE_FORM_CONTROL_COMMANDBUTTON
Definition: services.hxx:89
constexpr OUStringLiteral FRM_SUN_COMPONENT_COMMANDBUTTON
Definition: services.hxx:119
constexpr OUStringLiteral FRM_SUN_CONTROL_COMMANDBUTTON
Definition: services.hxx:155
constexpr OUStringLiteral FRM_COMPONENT_COMMANDBUTTON
Definition: services.hxx:72
constexpr OUStringLiteral VCL_CONTROLMODEL_COMMANDBUTTON
Definition: services.hxx:45
constexpr OUStringLiteral VCL_CONTROL_COMMANDBUTTON
Definition: services.hxx:28
unsigned char sal_Bool