summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2020-05-15 15:28:14 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2020-05-18 12:47:37 +0200
commitd68c1ad86dc0206f87d504e9d9165bab966ebe5d (patch)
tree1b1cac2e4f0023a04d2960a36ea5de3ee265ff74 /toolkit
parent49b6978d9118f77198fcf2985ff49ebaea9e10d0 (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. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94310 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Conflicts: toolkit/inc/controls/controlmodelcontainerbase.hxx Change-Id: I3a36ac8738a7caae987894ac9dd271d2713c1e09
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 140d9c103db6..3b2fcaa891a7 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -186,9 +186,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 )
@@ -196,7 +196,6 @@ ControlModelContainerBase::ControlModelContainerBase( const ControlModelContaine
, maContainerListeners( *this )
, maChangeListeners ( GetMutex() )
, mbGroupsUpToDate( false )
- , m_bEnabled( rModel.m_bEnabled )
, m_nTabPageId( rModel.m_nTabPageId )
{
}
@@ -752,11 +751,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()
{