summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-02-24 12:25:02 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-02-24 12:27:32 +0100
commit33740b7d5abb8aca34692fbdaa787b26a60652a9 (patch)
treead2574a7850e2aa8ac18eaff89f4a85567896692 /forms
parent43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (diff)
Replace exisiting TriState, AutoState with more generic TriState
Change-Id: Ida05478aae5a379775c671e0c2f2851d820d78be
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/Button.cxx6
-rw-r--r--forms/source/component/CheckBox.cxx12
-rw-r--r--forms/source/component/Filter.cxx20
-rw-r--r--forms/source/component/RadioButton.cxx8
-rw-r--r--forms/source/component/refvaluecomponent.cxx28
-rw-r--r--forms/source/inc/togglestate.hxx2
6 files changed, 38 insertions, 38 deletions
diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx
index 3a6b9534535d..59cdb0e4c5d6 100644
--- a/forms/source/component/Button.cxx
+++ b/forms/source/component/Button.cxx
@@ -63,7 +63,7 @@ OButtonModel::OButtonModel(const Reference<XComponentContext>& _rxFactory)
:OClickableImageBaseModel( _rxFactory, VCL_CONTROLMODEL_COMMANDBUTTON, FRM_SUN_CONTROL_COMMANDBUTTON )
// use the old control name for compatibility reasons
,m_aResetHelper( *this, m_aMutex )
- ,m_eDefaultState( STATE_NOCHECK )
+ ,m_eDefaultState( TRISTATE_FALSE )
{
m_nClassId = FormComponentType::COMMANDBUTTON;
}
@@ -270,7 +270,7 @@ void SAL_CALL OButtonModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle
{
case PROPERTY_ID_DEFAULT_STATE:
{
- sal_Int16 nDefaultState( (sal_Int16)STATE_NOCHECK );
+ sal_Int16 nDefaultState( (sal_Int16)TRISTATE_FALSE );
OSL_VERIFY( _rValue >>= nDefaultState );
m_eDefaultState = (ToggleState)nDefaultState;
impl_resetNoBroadcast_nothrow();
@@ -307,7 +307,7 @@ Any OButtonModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const
switch ( _nHandle )
{
case PROPERTY_ID_DEFAULT_STATE:
- aDefault <<= (sal_Int16)STATE_NOCHECK;
+ aDefault <<= (sal_Int16)TRISTATE_FALSE;
break;
default:
diff --git a/forms/source/component/CheckBox.cxx b/forms/source/component/CheckBox.cxx
index 1a01ab8515d9..c6d712679122 100644
--- a/forms/source/component/CheckBox.cxx
+++ b/forms/source/component/CheckBox.cxx
@@ -233,7 +233,7 @@ Any OCheckBoxModel::translateDbColumnToControlValue()
sal_Bool bTriState = sal_True;
if ( m_xAggregateSet.is() )
m_xAggregateSet->getPropertyValue( PROPERTY_TRISTATE ) >>= bTriState;
- aValue <<= (sal_Int16)( bTriState ? STATE_DONTKNOW : getDefaultChecked() );
+ aValue <<= (sal_Int16)( bTriState ? TRISTATE_INDET : getDefaultChecked() );
}
else if ( !aValue.hasValue() )
{
@@ -241,7 +241,7 @@ Any OCheckBoxModel::translateDbColumnToControlValue()
// bValue cannot be used uninitialised here.
// But GCC does not see/understand that, which breaks -Werror builds,
// so we explicitly default-initialise it.
- aValue <<= (sal_Int16)( bValue ? STATE_CHECK : STATE_NOCHECK );
+ aValue <<= (sal_Int16)( bValue ? TRISTATE_TRUE : TRISTATE_FALSE );
}
return aValue;
@@ -256,20 +256,20 @@ sal_Bool OCheckBoxModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
Any aControlValue( m_xAggregateSet->getPropertyValue( PROPERTY_STATE ) );
try
{
- sal_Int16 nValue = STATE_DONTKNOW;
+ sal_Int16 nValue = TRISTATE_INDET;
aControlValue >>= nValue;
switch (nValue)
{
- case STATE_DONTKNOW:
+ case TRISTATE_INDET:
m_xColumnUpdate->updateNull();
break;
- case STATE_CHECK:
+ case TRISTATE_TRUE:
if (DbUseBool())
m_xColumnUpdate->updateBoolean( sal_True );
else
m_xColumnUpdate->updateString( getReferenceValue() );
break;
- case STATE_NOCHECK:
+ case TRISTATE_FALSE:
if (DbUseBool())
m_xColumnUpdate->updateBoolean( sal_False );
else
diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx
index b54fbb2c3f6a..cbe592cd47c3 100644
--- a/forms/source/component/Filter.cxx
+++ b/forms/source/component/Filter.cxx
@@ -202,7 +202,7 @@ namespace frm
{
// checkboxes always have a tristate-mode
xVclWindow->setProperty( PROPERTY_TRISTATE, makeAny( sal_Bool( sal_True ) ) );
- xVclWindow->setProperty( PROPERTY_STATE, makeAny( sal_Int32( STATE_DONTKNOW ) ) );
+ xVclWindow->setProperty( PROPERTY_STATE, makeAny( sal_Int32( TRISTATE_INDET ) ) );
Reference< XCheckBox > xBox( getPeer(), UNO_QUERY_THROW );
xBox->addItemListener( this );
@@ -212,7 +212,7 @@ namespace frm
case FormComponentType::RADIOBUTTON:
{
- xVclWindow->setProperty( PROPERTY_STATE, makeAny( sal_Int32( STATE_NOCHECK ) ) );
+ xVclWindow->setProperty( PROPERTY_STATE, makeAny( sal_Int32( TRISTATE_FALSE ) ) );
Reference< XRadioButton > xRadio( getPeer(), UNO_QUERY_THROW );
xRadio->addItemListener( this );
@@ -295,11 +295,11 @@ namespace frm
{
case FormComponentType::CHECKBOX:
{
- if ( ( rEvent.Selected == STATE_CHECK ) || ( rEvent.Selected == STATE_NOCHECK ) )
+ if ( ( rEvent.Selected == TRISTATE_TRUE ) || ( rEvent.Selected == TRISTATE_FALSE ) )
{
sal_Int32 nBooleanComparisonMode = ::dbtools::DatabaseMetaData( m_xConnection ).getBooleanComparisonMode();
- bool bSelected = ( rEvent.Selected == STATE_CHECK );
+ bool bSelected = ( rEvent.Selected == TRISTATE_TRUE );
OUString sExpressionMarker( "$expression$" );
::dbtools::getBoleanComparisonPredicate(
@@ -360,7 +360,7 @@ namespace frm
case FormComponentType::RADIOBUTTON:
{
- if ( rEvent.Selected == STATE_CHECK )
+ if ( rEvent.Selected == TRISTATE_TRUE )
aText.append( ::comphelper::getString( Reference< XPropertySet >( getModel(), UNO_QUERY )->getPropertyValue( PROPERTY_REFVALUE ) ) );
}
break;
@@ -585,14 +585,14 @@ namespace frm
|| aText.equalsIgnoreAsciiCase("IS TRUE")
)
{
- aValue <<= (sal_Int32)STATE_CHECK;
+ aValue <<= (sal_Int32)TRISTATE_TRUE;
}
else if ( aText == "0" || aText.equalsIgnoreAsciiCase("FALSE") )
{
- aValue <<= (sal_Int32)STATE_NOCHECK;
+ aValue <<= (sal_Int32)TRISTATE_FALSE;
}
else
- aValue <<= (sal_Int32)STATE_DONTKNOW;
+ aValue <<= (sal_Int32)TRISTATE_INDET;
m_aText = aText;
xVclWindow->setProperty( PROPERTY_STATE, aValue );
@@ -606,9 +606,9 @@ namespace frm
OUString aRefText = ::comphelper::getString(com::sun::star::uno::Reference< XPropertySet > (getModel(), UNO_QUERY)->getPropertyValue(PROPERTY_REFVALUE));
Any aValue;
if (aText == aRefText)
- aValue <<= (sal_Int32)STATE_CHECK;
+ aValue <<= (sal_Int32)TRISTATE_TRUE;
else
- aValue <<= (sal_Int32)STATE_NOCHECK;
+ aValue <<= (sal_Int32)TRISTATE_FALSE;
m_aText = aText;
xVclWindow->setProperty(PROPERTY_STATE, aValue);
}
diff --git a/forms/source/component/RadioButton.cxx b/forms/source/component/RadioButton.cxx
index 991df45662b8..e649403305ec 100644
--- a/forms/source/component/RadioButton.cxx
+++ b/forms/source/component/RadioButton.cxx
@@ -377,7 +377,7 @@ void ORadioButtonModel::_propertyChanged(const PropertyChangeEvent& _rEvent) thr
Any ORadioButtonModel::translateDbColumnToControlValue()
{
return makeAny( (sal_Int16)
- ( ( m_xColumn->getString() == getReferenceValue() ) ? STATE_CHECK : STATE_NOCHECK )
+ ( ( m_xColumn->getString() == getReferenceValue() ) ? TRISTATE_TRUE : TRISTATE_FALSE )
);
}
@@ -385,10 +385,10 @@ Any ORadioButtonModel::translateDbColumnToControlValue()
Any ORadioButtonModel::translateExternalValueToControlValue( const Any& _rExternalValue ) const
{
Any aControlValue = OReferenceValueComponent::translateExternalValueToControlValue( _rExternalValue );
- sal_Int16 nState = STATE_NOCHECK;
- if ( ( aControlValue >>= nState ) && ( nState == STATE_DONTKNOW ) )
+ sal_Int16 nState = TRISTATE_FALSE;
+ if ( ( aControlValue >>= nState ) && ( nState == TRISTATE_INDET ) )
// radio buttons do not have the DONTKNOW state
- aControlValue <<= (sal_Int16)STATE_NOCHECK;
+ aControlValue <<= (sal_Int16)TRISTATE_FALSE;
return aControlValue;
}
diff --git a/forms/source/component/refvaluecomponent.cxx b/forms/source/component/refvaluecomponent.cxx
index 2d051e6d7418..38ebd2cfc308 100644
--- a/forms/source/component/refvaluecomponent.cxx
+++ b/forms/source/component/refvaluecomponent.cxx
@@ -39,7 +39,7 @@ namespace frm
OReferenceValueComponent::OReferenceValueComponent( const Reference< XComponentContext >& _rxFactory, const OUString& _rUnoControlModelTypeName, const OUString& _rDefault, sal_Bool _bSupportNoCheckRefValue )
:OBoundControlModel( _rxFactory, _rUnoControlModelTypeName, _rDefault, sal_False, sal_True, sal_True )
- ,m_eDefaultChecked( STATE_NOCHECK )
+ ,m_eDefaultChecked( TRISTATE_FALSE )
,m_bSupportSecondRefValue( _bSupportNoCheckRefValue )
{
}
@@ -103,7 +103,7 @@ namespace frm
case PROPERTY_ID_DEFAULT_STATE:
{
- sal_Int16 nDefaultChecked( (sal_Int16)STATE_NOCHECK );
+ sal_Int16 nDefaultChecked( (sal_Int16)TRISTATE_FALSE );
OSL_VERIFY( _rValue >>= nDefaultChecked );
m_eDefaultChecked = (ToggleState)nDefaultChecked;
resetNoBroadcast();
@@ -178,29 +178,29 @@ namespace frm
Any OReferenceValueComponent::translateExternalValueToControlValue( const Any& _rExternalValue ) const
{
- sal_Int16 nState = STATE_DONTKNOW;
+ sal_Int16 nState = TRISTATE_INDET;
sal_Bool bExternalState = sal_False;
OUString sExternalValue;
if ( _rExternalValue >>= bExternalState )
{
- nState = ::sal::static_int_cast< sal_Int16 >( bExternalState ? STATE_CHECK : STATE_NOCHECK );
+ nState = ::sal::static_int_cast< sal_Int16 >( bExternalState ? TRISTATE_TRUE : TRISTATE_FALSE );
}
else if ( _rExternalValue >>= sExternalValue )
{
if ( sExternalValue == m_sReferenceValue )
- nState = STATE_CHECK;
+ nState = TRISTATE_TRUE;
else
{
if ( !m_bSupportSecondRefValue || ( sExternalValue == m_sNoCheckReferenceValue ) )
- nState = STATE_NOCHECK;
+ nState = TRISTATE_FALSE;
else
- nState = STATE_DONTKNOW;
+ nState = TRISTATE_INDET;
}
}
else if ( !_rExternalValue.hasValue() )
{
- nState = STATE_DONTKNOW;
+ nState = TRISTATE_INDET;
}
else
{
@@ -218,7 +218,7 @@ namespace frm
try
{
Any aControlValue( m_xAggregateSet->getPropertyValue( PROPERTY_STATE ) );
- sal_Int16 nControlValue = STATE_DONTKNOW;
+ sal_Int16 nControlValue = TRISTATE_INDET;
aControlValue >>= nControlValue;
bool bBooleanExchange = getExternalValueType().getTypeClass() == TypeClass_BOOLEAN;
@@ -228,7 +228,7 @@ namespace frm
switch( nControlValue )
{
- case STATE_CHECK:
+ case TRISTATE_TRUE:
if ( bBooleanExchange )
{
aExternalValue <<= (sal_Bool)sal_True;
@@ -239,7 +239,7 @@ namespace frm
}
break;
- case STATE_NOCHECK:
+ case TRISTATE_FALSE:
if ( bBooleanExchange )
{
aExternalValue <<= (sal_Bool)sal_False;
@@ -266,16 +266,16 @@ namespace frm
return Any();
Any aControlValue( m_xAggregateSet->getPropertyValue( PROPERTY_STATE ) );
- sal_Int16 nControlValue = STATE_DONTKNOW;
+ sal_Int16 nControlValue = TRISTATE_INDET;
aControlValue >>= nControlValue;
Any aValidatableValue;
switch ( nControlValue )
{
- case STATE_CHECK:
+ case TRISTATE_TRUE:
aValidatableValue <<= (sal_Bool)sal_True;
break;
- case STATE_NOCHECK:
+ case TRISTATE_FALSE:
aValidatableValue <<= (sal_Bool)sal_False;
break;
}
diff --git a/forms/source/inc/togglestate.hxx b/forms/source/inc/togglestate.hxx
index 064450dd3e42..aa4798a3c138 100644
--- a/forms/source/inc/togglestate.hxx
+++ b/forms/source/inc/togglestate.hxx
@@ -25,7 +25,7 @@ namespace frm
{
//........................................................................
- enum ToggleState { STATE_NOCHECK = 0, STATE_CHECK = 1, STATE_DONTKNOW = 2 };
+ enum ToggleState { TRISTATE_FALSE = 0, TRISTATE_TRUE = 1, TRISTATE_INDET = 2 };
//........................................................................
} // namespace frm