Replace getTabIndexPropertyName and getStepPropertyName (toolkit)

by constrexp or by using the string directly since used once.
Change-Id: I0d232d5856551bd5dde22ed5075807d20f6f6624

Change-Id: I07d50845ec21998813f3fecb7fb183eaf234f7ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157591
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Julien Nabet
2023-10-05 13:19:58 +02:00
committed by Stephan Bergmann
parent 6947cbca81
commit b20d44d301

View File

@@ -133,19 +133,7 @@ public:
} }
}; };
constexpr OUString aTabIndexPropertyNameStr( u"TabIndex"_ustr );
static OUString getTabIndexPropertyName( )
{
return "TabIndex";
}
static OUString getStepPropertyName( )
{
return "Step";
}
ControlModelContainerBase::ControlModelContainerBase( const Reference< XComponentContext >& rxContext ) ControlModelContainerBase::ControlModelContainerBase( const Reference< XComponentContext >& rxContext )
:ControlModelContainer_IBase( rxContext ) :ControlModelContainer_IBase( rxContext )
@@ -628,8 +616,8 @@ void SAL_CALL ControlModelContainerBase::setControlModels( const Sequence< Refer
Reference< XPropertySetInfo > xPSI; Reference< XPropertySetInfo > xPSI;
if ( xProps.is() ) if ( xProps.is() )
xPSI = xProps->getPropertySetInfo(); xPSI = xProps->getPropertySetInfo();
if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) ) if ( xPSI.is() && xPSI->hasPropertyByName( aTabIndexPropertyNameStr ) )
xProps->setPropertyValue( getTabIndexPropertyName(), Any( nTabIndex++ ) ); xProps->setPropertyValue( aTabIndexPropertyNameStr, Any( nTabIndex++ ) );
} }
mbGroupsUpToDate = false; mbGroupsUpToDate = false;
} }
@@ -660,10 +648,10 @@ Sequence< Reference< XControlModel > > SAL_CALL ControlModelContainerBase::getCo
DBG_ASSERT( xPSI.is(), "ControlModelContainerBase::getControlModels: invalid child model!" ); DBG_ASSERT( xPSI.is(), "ControlModelContainerBase::getControlModels: invalid child model!" );
// has it? // has it?
if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) ) if ( xPSI.is() && xPSI->hasPropertyByName( aTabIndexPropertyNameStr ) )
{ // yes { // yes
sal_Int32 nTabIndex = -1; sal_Int32 nTabIndex = -1;
xControlProps->getPropertyValue( getTabIndexPropertyName() ) >>= nTabIndex; xControlProps->getPropertyValue( aTabIndexPropertyNameStr ) >>= nTabIndex;
aSortedModels.emplace( nTabIndex, xModel ); aSortedModels.emplace( nTabIndex, xModel );
} }
@@ -772,7 +760,7 @@ namespace
try try
{ {
Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY ); Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
xModelProps->getPropertyValue( getStepPropertyName() ) >>= nStep; xModelProps->getPropertyValue( u"Step"_ustr ) >>= nStep;
} }
catch (const Exception&) catch (const Exception&)
{ {
@@ -1001,8 +989,8 @@ void ControlModelContainerBase::startControlListening( const Reference< XControl
if ( xModelProps.is() ) if ( xModelProps.is() )
xPSI = xModelProps->getPropertySetInfo(); xPSI = xModelProps->getPropertySetInfo();
if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) ) if ( xPSI.is() && xPSI->hasPropertyByName( aTabIndexPropertyNameStr ) )
xModelProps->addPropertyChangeListener( getTabIndexPropertyName(), this ); xModelProps->addPropertyChangeListener( aTabIndexPropertyNameStr, this );
} }
@@ -1015,8 +1003,8 @@ void ControlModelContainerBase::stopControlListening( const Reference< XControlM
if ( xModelProps.is() ) if ( xModelProps.is() )
xPSI = xModelProps->getPropertySetInfo(); xPSI = xModelProps->getPropertySetInfo();
if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) ) if ( xPSI.is() && xPSI->hasPropertyByName( aTabIndexPropertyNameStr ) )
xModelProps->removePropertyChangeListener( getTabIndexPropertyName(), this ); xModelProps->removePropertyChangeListener( aTabIndexPropertyNameStr, this );
} }