diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2020-05-15 15:28:14 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2020-05-15 20:48:12 +0200 |
commit | 25c692c2a94ab83c2c859ac5ab334b62ac8b825e (patch) | |
tree | 8c4f22b75684fe7296af4996a81fc4a667ea3339 /toolkit | |
parent | 6193bf1541be95c3679cdc5c4a96d4ab5fc5218c (diff) |
ControlModelContainerBase: Use property for enabled status
Use the property BASEPROPERTY_ENABLED for getting and setting
the status instead of handling it in a custom bool member
variable.
This way, property changes are also automatically propagated
and can be handled by the corresponding listeners.
Change-Id: I3a36ac8738a7caae987894ac9dd271d2713c1e09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94310
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/controls/controlmodelcontainerbase.hxx | 1 | ||||
-rw-r--r-- | toolkit/source/controls/controlmodelcontainerbase.cxx | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/toolkit/inc/controls/controlmodelcontainerbase.hxx b/toolkit/inc/controls/controlmodelcontainerbase.hxx index 31ff2cdb9e73..c2d715dc3b61 100644 --- a/toolkit/inc/controls/controlmodelcontainerbase.hxx +++ b/toolkit/inc/controls/controlmodelcontainerbase.hxx @@ -83,7 +83,6 @@ protected: AllGroups maGroups; bool mbGroupsUpToDate; - bool m_bEnabled; OUString m_sImageURL; OUString m_sTooltip; sal_Int16 m_nTabPageId; diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index bff374628d49..fc5b0e374c1f 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -169,9 +169,9 @@ ControlModelContainerBase::ControlModelContainerBase( const Reference< XComponen ,maContainerListeners( *this ) ,maChangeListeners ( GetMutex() ) ,mbGroupsUpToDate( false ) - ,m_bEnabled( true ) ,m_nTabPageId(0) { + ImplRegisterProperty(BASEPROPERTY_ENABLED); } ControlModelContainerBase::ControlModelContainerBase( const ControlModelContainerBase& rModel ) @@ -179,7 +179,6 @@ ControlModelContainerBase::ControlModelContainerBase( const ControlModelContaine , maContainerListeners( *this ) , maChangeListeners ( GetMutex() ) , mbGroupsUpToDate( false ) - , m_bEnabled( rModel.m_bEnabled ) , m_nTabPageId( rModel.m_nTabPageId ) { } @@ -735,11 +734,17 @@ void SAL_CALL ControlModelContainerBase::initialize (const Sequence<Any>& rArgum } sal_Bool SAL_CALL ControlModelContainerBase::getEnabled() { - return m_bEnabled; + SolarMutexGuard aGuard; + Reference<XPropertySet> xThis(*this, UNO_QUERY); + bool bEnabled; + xThis->getPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED)) >>= bEnabled; + return bEnabled; } void SAL_CALL ControlModelContainerBase::setEnabled( sal_Bool _enabled ) { - m_bEnabled = _enabled; + SolarMutexGuard aGuard; + Reference<XPropertySet> xThis(*this, UNO_QUERY); + xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED), makeAny(_enabled)); } OUString SAL_CALL ControlModelContainerBase::getTitle() { |