diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:23:58 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:23:58 +0100 |
commit | 1099ae1c16cd8323d877e894d8ce213ef8e1c349 (patch) | |
tree | f5eb610a9a27de258415a9ae1d14b2972c7a84cb /forms/source/component | |
parent | 11e93c64c33ed17e2286bf3be7a473df43425012 (diff) |
More loplugin:cstylecast: forms
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: I91065e9ff1c160e5becda1ffa033de7c1b48b7f3
Diffstat (limited to 'forms/source/component')
-rw-r--r-- | forms/source/component/Button.cxx | 8 | ||||
-rw-r--r-- | forms/source/component/CheckBox.cxx | 6 | ||||
-rw-r--r-- | forms/source/component/Columns.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/ComboBox.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/DatabaseForm.cxx | 22 | ||||
-rw-r--r-- | forms/source/component/Edit.cxx | 6 | ||||
-rw-r--r-- | forms/source/component/Filter.cxx | 10 | ||||
-rw-r--r-- | forms/source/component/FormComponent.cxx | 12 | ||||
-rw-r--r-- | forms/source/component/FormattedField.cxx | 10 | ||||
-rw-r--r-- | forms/source/component/Grid.cxx | 14 | ||||
-rw-r--r-- | forms/source/component/GroupManager.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/ListBox.cxx | 10 | ||||
-rw-r--r-- | forms/source/component/RadioButton.cxx | 11 | ||||
-rw-r--r-- | forms/source/component/entrylisthelper.cxx | 12 | ||||
-rw-r--r-- | forms/source/component/formcontrolfont.cxx | 32 | ||||
-rw-r--r-- | forms/source/component/imgprod.cxx | 18 | ||||
-rw-r--r-- | forms/source/component/navigationbar.cxx | 6 | ||||
-rw-r--r-- | forms/source/component/refvaluecomponent.cxx | 6 | ||||
-rw-r--r-- | forms/source/component/scrollbar.cxx | 8 | ||||
-rw-r--r-- | forms/source/component/spinbutton.cxx | 4 |
20 files changed, 100 insertions, 101 deletions
diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index ca452d5e96a9..65d72c9b87a1 100644 --- a/forms/source/component/Button.cxx +++ b/forms/source/component/Button.cxx @@ -249,7 +249,7 @@ void SAL_CALL OButtonModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHand switch ( _nHandle ) { case PROPERTY_ID_DEFAULT_STATE: - _rValue <<= (sal_Int16)m_eDefaultState; + _rValue <<= static_cast<sal_Int16>(m_eDefaultState); break; default: @@ -265,7 +265,7 @@ void SAL_CALL OButtonModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle { case PROPERTY_ID_DEFAULT_STATE: { - sal_Int16 nDefaultState = (sal_Int16)TRISTATE_FALSE; + sal_Int16 nDefaultState = sal_Int16(TRISTATE_FALSE); OSL_VERIFY( _rValue >>= nDefaultState ); m_eDefaultState = (ToggleState)nDefaultState; impl_resetNoBroadcast_nothrow(); @@ -285,7 +285,7 @@ sal_Bool SAL_CALL OButtonModel::convertFastPropertyValue( Any& _rConvertedValue, switch ( _nHandle ) { case PROPERTY_ID_DEFAULT_STATE: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_eDefaultState ); + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_eDefaultState) ); break; default: @@ -302,7 +302,7 @@ Any OButtonModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const switch ( _nHandle ) { case PROPERTY_ID_DEFAULT_STATE: - aDefault <<= (sal_Int16)TRISTATE_FALSE; + aDefault <<= sal_Int16(TRISTATE_FALSE); break; default: diff --git a/forms/source/component/CheckBox.cxx b/forms/source/component/CheckBox.cxx index a0b0e24c82ab..4a3e6487e60a 100644 --- a/forms/source/component/CheckBox.cxx +++ b/forms/source/component/CheckBox.cxx @@ -130,7 +130,7 @@ void SAL_CALL OCheckBoxModel::write(const Reference<css::io::XObjectOutputStream _rxOutStream->writeShort(0x0003); // Properties _rxOutStream << getReferenceValue(); - _rxOutStream << (sal_Int16)getDefaultChecked(); + _rxOutStream << static_cast<sal_Int16>(getDefaultChecked()); writeHelpTextCompatibly(_rxOutStream); // from version 0x0003 : common properties writeCommonProperties(_rxOutStream); @@ -210,7 +210,7 @@ Any OCheckBoxModel::translateDbColumnToControlValue() bool bTriState = true; if ( m_xAggregateSet.is() ) m_xAggregateSet->getPropertyValue( PROPERTY_TRISTATE ) >>= bTriState; - aValue <<= (sal_Int16)( bTriState ? TRISTATE_INDET : getDefaultChecked() ); + aValue <<= static_cast<sal_Int16>( bTriState ? TRISTATE_INDET : getDefaultChecked() ); } else if ( !aValue.hasValue() ) { @@ -218,7 +218,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 ? TRISTATE_TRUE : TRISTATE_FALSE ); + aValue <<= static_cast<sal_Int16>( bValue ? TRISTATE_TRUE : TRISTATE_FALSE ); } return aValue; diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index ed6bfae0daa6..a6cef2d2605d 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -408,7 +408,7 @@ sal_Bool OGridColumn::convertFastPropertyValue( Any& rConvertedValue, Any& rOldV { sal_Int32 nAlign( 0 ); if ( rConvertedValue >>= nAlign ) - rConvertedValue <<= (sal_Int16)nAlign; + rConvertedValue <<= static_cast<sal_Int16>(nAlign); } break; case PROPERTY_ID_HIDDEN: diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx index 615970106d19..11398fdc8305 100644 --- a/forms/source/component/ComboBox.cxx +++ b/forms/source/component/ComboBox.cxx @@ -395,7 +395,7 @@ void SAL_CALL OComboBoxModel::read(const Reference<css::io::XObjectInputStream>& { OSL_FAIL("OComboBoxModel::read : invalid (means unknown) version !"); m_aListSource.clear(); - m_aBoundColumn <<= (sal_Int16)0; + m_aBoundColumn <<= sal_Int16(0); m_aDefaultText.clear(); m_eListSourceType = ListSourceType_TABLE; m_bEmptyIsNull = true; diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 7a026b688e92..70608e16db6a 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -912,13 +912,13 @@ void ODatabaseForm::Encode( OUString& rString ) default: { // Convert to hex - short nHi = ((sal_Int16)nCharCode) / 16; - short nLo = ((sal_Int16)nCharCode) - (nHi*16); - if( nHi > 9 ) nHi += (int)'A'-10; else nHi += (int)'0'; - if( nLo > 9 ) nLo += (int)'A'-10; else nLo += (int)'0'; + short nHi = static_cast<sal_Int16>(nCharCode) / 16; + short nLo = static_cast<sal_Int16>(nCharCode) - (nHi*16); + if( nHi > 9 ) nHi += int('A')-10; else nHi += int('0'); + if( nLo > 9 ) nLo += int('A')-10; else nLo += int('0'); aResult.append('%'); - aResult.append((sal_Unicode)nHi); - aResult.append((sal_Unicode)nLo); + aResult.append(static_cast<sal_Unicode>(nHi)); + aResult.append(static_cast<sal_Unicode>(nLo)); } } } @@ -1153,7 +1153,7 @@ bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNotifie nConcurrency = ResultSetConcurrency::READ_ONLY; m_xAggregateSet->setPropertyValue( PROPERTY_RESULTSET_CONCURRENCY, makeAny( nConcurrency ) ); - m_xAggregateSet->setPropertyValue( PROPERTY_RESULTSET_TYPE, makeAny( (sal_Int32)ResultSetType::SCROLL_SENSITIVE ) ); + m_xAggregateSet->setPropertyValue( PROPERTY_RESULTSET_TYPE, makeAny( sal_Int32(ResultSetType::SCROLL_SENSITIVE) ) ); bool bSuccess = false; try @@ -1509,7 +1509,7 @@ void ODatabaseForm::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const rValue <<= m_bAllowDelete; break; case PROPERTY_ID_PRIVILEGES: - rValue <<= (sal_Int32)m_nPrivileges; + rValue <<= static_cast<sal_Int32>(m_nPrivileges); break; case PROPERTY_ID_DYNAMIC_CONTROL_BORDER: rValue = m_aDynamicControlBorder; @@ -2819,7 +2819,7 @@ void ODatabaseForm::load_impl(bool bCausedByParentForm, bool bMoveToFirst, const // a database form always uses caching // we use starting fetchsize with at least 10 rows if (bConnected) - m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)40)); + m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny(sal_Int32(40))); // if we're loaded as sub form we got a "rowSetChanged" from the parent rowset _before_ we got the "loaded" // so we don't need to execute the statement again, this was already done @@ -3834,7 +3834,7 @@ void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutS // unknown in earlier versions nCycle = (sal_Int32)TabulatorCycle_RECORDS; } - _rxOutStream->writeShort((sal_Int16) nCycle); + _rxOutStream->writeShort(static_cast<sal_Int16>(nCycle)); _rxOutStream->writeShort((sal_Int16)m_eNavigation); @@ -3866,7 +3866,7 @@ void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutS { sal_Int32 nRealCycle = 0; ::cppu::enum2int(nRealCycle, m_aCycle); - _rxOutStream->writeShort((sal_Int16)nRealCycle); + _rxOutStream->writeShort(static_cast<sal_Int16>(nRealCycle)); } } diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index ae7c1fac25e5..5c845a01866e 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -510,7 +510,7 @@ void OEditModel::write(const Reference<XObjectOutputStream>& _rxOutStream) aCurrentText = m_xAggregateSet->getPropertyValue(PROPERTY_TEXT); m_xAggregateSet->getPropertyValue(PROPERTY_MAXTEXTLEN) >>= nOldTextLen; - m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, makeAny((sal_Int16)0)); + m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, makeAny(sal_Int16(0))); } OEditBaseModel::write(_rxOutStream); @@ -579,7 +579,7 @@ void OEditModel::onConnectedDbColumn( const Reference< XInterface >& _rxForm ) if (nFieldLen && nFieldLen <= USHRT_MAX) { Any aVal; - aVal <<= (sal_Int16)nFieldLen; + aVal <<= static_cast<sal_Int16>(nFieldLen); m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, aVal); m_bMaxTextLenModified = true; @@ -601,7 +601,7 @@ void OEditModel::onDisconnectedDbColumn() if ( hasField() && m_bMaxTextLenModified ) { Any aVal; - aVal <<= (sal_Int16)0; // Only if it was 0, I switched it in onConnectedDbColumn + aVal <<= sal_Int16(0); // Only if it was 0, I switched it in onConnectedDbColumn m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, aVal); m_bMaxTextLenModified = false; } diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index 4bca83480512..8cbdff0af0d0 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -577,14 +577,14 @@ namespace frm || aText.equalsIgnoreAsciiCase("IS TRUE") ) { - aValue <<= (sal_Int32)TRISTATE_TRUE; + aValue <<= sal_Int32(TRISTATE_TRUE); } else if ( aText == "0" || aText.equalsIgnoreAsciiCase("FALSE") ) { - aValue <<= (sal_Int32)TRISTATE_FALSE; + aValue <<= sal_Int32(TRISTATE_FALSE); } else - aValue <<= (sal_Int32)TRISTATE_INDET; + aValue <<= sal_Int32(TRISTATE_INDET); m_aText = aText; xVclWindow->setProperty( PROPERTY_STATE, aValue ); @@ -598,9 +598,9 @@ namespace frm OUString aRefText = ::comphelper::getString(css::uno::Reference< XPropertySet > (getModel(), UNO_QUERY)->getPropertyValue(PROPERTY_REFVALUE)); Any aValue; if (aText == aRefText) - aValue <<= (sal_Int32)TRISTATE_TRUE; + aValue <<= sal_Int32(TRISTATE_TRUE); else - aValue <<= (sal_Int32)TRISTATE_FALSE; + aValue <<= sal_Int32(TRISTATE_FALSE); m_aText = aText; xVclWindow->setProperty(PROPERTY_STATE, aValue); } diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 5f970008b50a..0f63b890b208 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -863,10 +863,10 @@ Any OControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const aReturn <<= OUString(); break; case PROPERTY_ID_CLASSID: - aReturn <<= (sal_Int16)FormComponentType::CONTROL; + aReturn <<= sal_Int16(FormComponentType::CONTROL); break; case PROPERTY_ID_TABINDEX: - aReturn <<= (sal_Int16)FRM_DEFAULT_TABINDEX; + aReturn <<= sal_Int16(FRM_DEFAULT_TABINDEX); break; case PROPERTY_ID_NATIVE_LOOK: aReturn <<= true; @@ -876,10 +876,10 @@ Any OControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const break; // added for exporting OCX control case PROPERTY_ID_CONTROL_TYPE_IN_MSO: - aReturn <<= (sal_Int16)0; + aReturn <<= sal_Int16(0); break; case PROPERTY_ID_OBJ_ID_IN_MSO: - aReturn <<= (sal_uInt16)INVALID_OBJ_ID_IN_MSO; + aReturn <<= sal_uInt16(INVALID_OBJ_ID_IN_MSO); break; default: if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) ) @@ -914,10 +914,10 @@ void OControlModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) con break; // added for exporting OCX control case PROPERTY_ID_CONTROL_TYPE_IN_MSO: - _rValue <<= (sal_Int16)m_nControlTypeinMSO; + _rValue <<= static_cast<sal_Int16>(m_nControlTypeinMSO); break; case PROPERTY_ID_OBJ_ID_IN_MSO: - _rValue <<= (sal_uInt16)m_nObjIDinMSO; + _rValue <<= static_cast<sal_uInt16>(m_nObjIDinMSO); break; default: if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) ) diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index acd0ad6ea05d..200748acab22 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -559,9 +559,9 @@ void OFormattedModel::onConnectedDbColumn( const Reference< XInterface >& _rxFor { Locale aApplicationLocale = Application::GetSettings().GetUILanguageTag().getLocale(); if (m_bOriginalNumeric) - aFmtKey <<= (sal_Int32)xTypes->getStandardFormat(NumberFormat::NUMBER, aApplicationLocale); + aFmtKey <<= static_cast<sal_Int32>(xTypes->getStandardFormat(NumberFormat::NUMBER, aApplicationLocale)); else - aFmtKey <<= (sal_Int32)xTypes->getStandardFormat(NumberFormat::TEXT, aApplicationLocale); + aFmtKey <<= static_cast<sal_Int32>(xTypes->getStandardFormat(NumberFormat::TEXT, aApplicationLocale)); } } aSupplier >>= m_xOriginalFormatter; @@ -665,7 +665,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) if (hasProperty(s_aFormatStringProp, xFormat)) xFormat->getPropertyValue(s_aFormatStringProp) >>= sFormatDescription; _rxOutStream->writeUTF(sFormatDescription); - _rxOutStream->writeLong((sal_uInt16)eFormatLanguage); + _rxOutStream->writeLong(static_cast<sal_uInt16>(eFormatLanguage)); } // version 2 : write the properties common to all OEditBaseModels writeCommonEditProperties(_rxOutStream); @@ -731,7 +731,7 @@ void OFormattedModel::read(const Reference<XObjectInputStream>& _rxInStream) { Locale aDescriptionLanguage( LanguageTag::convertToLocale(eDescriptionLanguage)); nKey = xFormats->queryKey(sFormatDescription, aDescriptionLanguage, false); - if (nKey == (sal_Int32)-1) + if (nKey == sal_Int32(-1)) { // does not yet exist in my formatter... nKey = xFormats->addNew(sFormatDescription, aDescriptionLanguage); } @@ -858,7 +858,7 @@ Any OFormattedModel::translateExternalValueToControlValue( const Any& _rExternal { bool bExternalValue = false; _rExternalValue >>= bExternalValue; - aControlValue <<= (double)( bExternalValue ? 1 : 0 ); + aControlValue <<= static_cast<double>( bExternalValue ? 1 : 0 ); } break; default: diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index 2bcce028a6c6..cd956bbfd470 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -462,7 +462,7 @@ void OGridControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle ) co rValue <<= m_bEnableVisible; break; case PROPERTY_ID_BORDER: - rValue <<= (sal_Int16)m_nBorder; + rValue <<= static_cast<sal_Int16>(m_nBorder); break; case PROPERTY_ID_BORDERCOLOR: rValue = m_aBorderColor; @@ -670,7 +670,7 @@ Any OGridControlModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const aReturn <<= OUString(); break; case PROPERTY_ID_BORDER: - aReturn <<= (sal_Int16)1; + aReturn <<= sal_Int16(1); break; case PROPERTY_ID_BORDERCOLOR: case PROPERTY_ID_TABSTOP: @@ -928,19 +928,19 @@ void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream) FontDescriptor aFont( getFont() ); if ( nAnyMask & FONTATTRIBS ) { - aFont.Weight = (float)vcl::unohelper::ConvertFontWeight( _rxInStream->readShort() ); + aFont.Weight = static_cast<float>(vcl::unohelper::ConvertFontWeight( _rxInStream->readShort() )); aFont.Slant = (FontSlant)_rxInStream->readShort(); aFont.Underline = _rxInStream->readShort(); aFont.Strikeout = _rxInStream->readShort(); - aFont.Orientation = ( (float)_rxInStream->readShort() ) / 10; + aFont.Orientation = static_cast<float>(_rxInStream->readShort()) / 10; aFont.Kerning = _rxInStream->readBoolean() != 0; aFont.WordLineMode = _rxInStream->readBoolean() != 0; } if ( nAnyMask & FONTSIZE ) { - aFont.Width = (sal_Int16)_rxInStream->readLong(); - aFont.Height = (sal_Int16)_rxInStream->readLong(); - aFont.CharacterWidth = (float)vcl::unohelper::ConvertFontWidth( _rxInStream->readShort() ); + aFont.Width = static_cast<sal_Int16>(_rxInStream->readLong()); + aFont.Height = static_cast<sal_Int16>(_rxInStream->readLong()); + aFont.CharacterWidth = static_cast<float>(vcl::unohelper::ConvertFontWidth( _rxInStream->readShort() )); } if ( nAnyMask & FONTTYPE ) { diff --git a/forms/source/component/GroupManager.cxx b/forms/source/component/GroupManager.cxx index d801ac6d425e..199b9a3a6c32 100644 --- a/forms/source/component/GroupManager.cxx +++ b/forms/source/component/GroupManager.cxx @@ -324,7 +324,7 @@ sal_Int32 OGroupManager::getGroupCount() void OGroupManager::getGroup(sal_Int32 nGroup, Sequence< Reference<XControlModel> >& _rGroup, OUString& _rName) { - OSL_ENSURE(nGroup >= 0 && (size_t)nGroup < m_aActiveGroupMap.size(),"OGroupManager::getGroup: Invalid group index!"); + OSL_ENSURE(nGroup >= 0 && static_cast<size_t>(nGroup) < m_aActiveGroupMap.size(),"OGroupManager::getGroup: Invalid group index!"); OGroupArr::iterator aGroupPos = m_aActiveGroupMap[nGroup]; _rName = aGroupPos->second.GetGroupName(); _rGroup = aGroupPos->second.GetControlModels(); diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 83b30b5a130b..850028504128 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -162,7 +162,7 @@ namespace frm m_nClassId = FormComponentType::LISTBOX; m_eListSourceType = ListSourceType_VALUELIST; - m_aBoundColumn <<= (sal_Int16)1; + m_aBoundColumn <<= sal_Int16(1); initValueProperty( PROPERTY_SELECT_SEQ, PROPERTY_ID_SELECT_SEQ); init(); @@ -617,7 +617,7 @@ namespace frm { SAL_WARN( "forms.component", "OListBoxModel::read : invalid (means unknown) version !"); ValueList().swap(m_aListSourceValues); - m_aBoundColumn <<= (sal_Int16)0; + m_aBoundColumn <<= sal_Int16(0); clearBoundValues(); m_eListSourceType = ListSourceType_VALUELIST; m_aDefaultSelectSeq.realloc(0); @@ -1406,7 +1406,7 @@ namespace frm { sal_Int32 nSelectIndex = -1; OSL_VERIFY( _rExternalValue >>= nSelectIndex ); - if ( ( nSelectIndex >= 0 ) && ( nSelectIndex < (sal_Int32)getStringItemList().size() ) ) + if ( ( nSelectIndex >= 0 ) && ( nSelectIndex < static_cast<sal_Int32>(getStringItemList().size()) ) ) { aSelectIndexes.realloc( 1 ); aSelectIndexes[ 0 ] = static_cast< sal_Int16 >( nSelectIndex ); @@ -1474,8 +1474,8 @@ namespace frm OUString operator ()( sal_Int16 _nIndex ) { - OSL_ENSURE( _nIndex < (sal_Int32)m_rList.size(), "ExtractStringFromSequence_Safe: inconsistence!" ); - if ( _nIndex < (sal_Int32)m_rList.size() ) + OSL_ENSURE( _nIndex < static_cast<sal_Int32>(m_rList.size()), "ExtractStringFromSequence_Safe: inconsistence!" ); + if ( _nIndex < static_cast<sal_Int32>(m_rList.size()) ) return m_rList[ _nIndex ]; return OUString(); } diff --git a/forms/source/component/RadioButton.cxx b/forms/source/component/RadioButton.cxx index 45cabba88362..64a9693fa182 100644 --- a/forms/source/component/RadioButton.cxx +++ b/forms/source/component/RadioButton.cxx @@ -262,7 +262,7 @@ void SAL_CALL ORadioButtonModel::write(const Reference<XObjectOutputStream>& _rx // Properties _rxOutStream << getReferenceValue(); - _rxOutStream << (sal_Int16)getDefaultChecked(); + _rxOutStream << static_cast<sal_Int16>(getDefaultChecked()); writeHelpTextCompatibly(_rxOutStream); // from version 0x0003 : common properties @@ -317,11 +317,11 @@ void ORadioButtonModel::_propertyChanged(const PropertyChangeEvent& _rEvent) { if ( _rEvent.PropertyName == PROPERTY_STATE ) { - if ( _rEvent.NewValue == (sal_Int16)1 ) + if ( _rEvent.NewValue == sal_Int16(1) ) { // If my status has changed to 'checked', I have to reset all my siblings, which are in the same group as I am Any aZero; - aZero <<= (sal_Int16)0; + aZero <<= sal_Int16(0); SetSiblingPropsTo( PROPERTY_STATE, aZero ); } } @@ -339,8 +339,7 @@ void ORadioButtonModel::_propertyChanged(const PropertyChangeEvent& _rEvent) Any ORadioButtonModel::translateDbColumnToControlValue() { - return makeAny( (sal_Int16) - ( ( m_xColumn->getString() == getReferenceValue() ) ? TRISTATE_TRUE : TRISTATE_FALSE ) + return makeAny( static_cast<sal_Int16>( ( m_xColumn->getString() == getReferenceValue() ) ? TRISTATE_TRUE : TRISTATE_FALSE ) ); } @@ -351,7 +350,7 @@ Any ORadioButtonModel::translateExternalValueToControlValue( const Any& _rExtern sal_Int16 nState = TRISTATE_FALSE; if ( ( aControlValue >>= nState ) && ( nState == TRISTATE_INDET ) ) // radio buttons do not have the DONTKNOW state - aControlValue <<= (sal_Int16)TRISTATE_FALSE; + aControlValue <<= sal_Int16(TRISTATE_FALSE); return aControlValue; } diff --git a/forms/source/component/entrylisthelper.cxx b/forms/source/component/entrylisthelper.cxx index 1ee33f7ef252..0016d65bba31 100644 --- a/forms/source/component/entrylisthelper.cxx +++ b/forms/source/component/entrylisthelper.cxx @@ -82,13 +82,13 @@ namespace frm OSL_ENSURE( _rEvent.Source == m_xListSource, "OEntryListHelper::entryChanged: where did this come from?" ); - OSL_ENSURE( ( _rEvent.Position >= 0 ) && ( _rEvent.Position < (sal_Int32)m_aStringItems.size() ), + OSL_ENSURE( ( _rEvent.Position >= 0 ) && ( _rEvent.Position < static_cast<sal_Int32>(m_aStringItems.size()) ), "OEntryListHelper::entryChanged: invalid index!" ); OSL_ENSURE( _rEvent.Entries.getLength() == 1, "OEntryListHelper::entryChanged: invalid string list!" ); if ( ( _rEvent.Position >= 0 ) - && ( _rEvent.Position < (sal_Int32)m_aStringItems.size() ) + && ( _rEvent.Position < static_cast<sal_Int32>(m_aStringItems.size()) ) && ( _rEvent.Entries.getLength() > 0 ) ) { @@ -106,11 +106,11 @@ namespace frm OSL_ENSURE( _rEvent.Source == m_xListSource, "OEntryListHelper::entryRangeInserted: where did this come from?" ); - OSL_ENSURE( ( _rEvent.Position > 0 ) && ( _rEvent.Position < (sal_Int32)m_aStringItems.size() ) && ( _rEvent.Entries.getLength() > 0 ), + OSL_ENSURE( ( _rEvent.Position > 0 ) && ( _rEvent.Position < static_cast<sal_Int32>(m_aStringItems.size()) ) && ( _rEvent.Entries.getLength() > 0 ), "OEntryListHelper::entryRangeRemoved: invalid count and/or position!" ); if ( ( _rEvent.Position > 0 ) - && ( _rEvent.Position < (sal_Int32)m_aStringItems.size() ) + && ( _rEvent.Position < static_cast<sal_Int32>(m_aStringItems.size()) ) && ( _rEvent.Entries.getLength() > 0 ) ) { @@ -128,12 +128,12 @@ namespace frm OSL_ENSURE( _rEvent.Source == m_xListSource, "OEntryListHelper::entryRangeRemoved: where did this come from?" ); - OSL_ENSURE( ( _rEvent.Position > 0 ) && ( _rEvent.Count > 0 ) && ( _rEvent.Position + _rEvent.Count <= (sal_Int32)m_aStringItems.size() ), + OSL_ENSURE( ( _rEvent.Position > 0 ) && ( _rEvent.Count > 0 ) && ( _rEvent.Position + _rEvent.Count <= static_cast<sal_Int32>(m_aStringItems.size()) ), "OEntryListHelper::entryRangeRemoved: invalid count and/or position!" ); if ( ( _rEvent.Position > 0 ) && ( _rEvent.Count > 0 ) - && ( _rEvent.Position + _rEvent.Count <= (sal_Int32)m_aStringItems.size() ) + && ( _rEvent.Position + _rEvent.Count <= static_cast<sal_Int32>(m_aStringItems.size()) ) ) { m_aStringItems.erase(m_aStringItems.begin() + _rEvent.Position, diff --git a/forms/source/component/formcontrolfont.cxx b/forms/source/component/formcontrolfont.cxx index e65d6b0592f6..d2c63d077193 100644 --- a/forms/source/component/formcontrolfont.cxx +++ b/forms/source/component/formcontrolfont.cxx @@ -56,11 +56,11 @@ namespace frm break; case PROPERTY_ID_FONT_FAMILY: - aValue <<= (sal_Int16)_rFont.Family; + aValue <<= static_cast<sal_Int16>(_rFont.Family); break; case PROPERTY_ID_FONT_CHARSET: - aValue <<= (sal_Int16)_rFont.CharSet; + aValue <<= static_cast<sal_Int16>(_rFont.CharSet); break; case PROPERTY_ID_FONT_CHARWIDTH: @@ -88,7 +88,7 @@ namespace frm break; case PROPERTY_ID_FONT_HEIGHT: - aValue <<= (float)( _rFont.Height ); + aValue <<= static_cast<float>( _rFont.Height ); break; case PROPERTY_ID_FONT_WEIGHT: @@ -100,11 +100,11 @@ namespace frm break; case PROPERTY_ID_FONT_UNDERLINE: - aValue <<= (sal_Int16)_rFont.Underline; + aValue <<= static_cast<sal_Int16>(_rFont.Underline); break; case PROPERTY_ID_FONT_STRIKEOUT: - aValue <<= (sal_Int16)_rFont.Strikeout; + aValue <<= static_cast<sal_Int16>(_rFont.Strikeout); break; case PROPERTY_ID_FONT_WORDLINEMODE: @@ -286,11 +286,11 @@ namespace frm break; case PROPERTY_ID_FONT_FAMILY: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Family ); + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Family) ); break; case PROPERTY_ID_FONT_CHARSET: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.CharSet ); + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.CharSet) ); break; case PROPERTY_ID_FONT_CHARWIDTH: @@ -306,15 +306,15 @@ namespace frm break; case PROPERTY_ID_FONT_PITCH: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Pitch ); + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Pitch) ); break; case PROPERTY_ID_FONT_TYPE: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Type ); + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Type) ); break; case PROPERTY_ID_FONT_WIDTH: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Width ); + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Width) ); break; case PROPERTY_ID_FONT_HEIGHT: @@ -330,11 +330,11 @@ namespace frm break; case PROPERTY_ID_FONT_UNDERLINE: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Underline ); + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Underline) ); break; case PROPERTY_ID_FONT_STRIKEOUT: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Strikeout ); + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Strikeout) ); break; case PROPERTY_ID_FONT_WORDLINEMODE: @@ -398,7 +398,7 @@ namespace frm { float nHeight = 0; rValue >>= nHeight; - rFont.Height = (sal_Int16)nHeight; + rFont.Height = static_cast<sal_Int16>(nHeight); } break; @@ -540,7 +540,7 @@ namespace frm case PROPERTY_ID_FONT_SLANT: case PROPERTY_ID_FONT_UNDERLINE: case PROPERTY_ID_FONT_STRIKEOUT: - aReturn <<= (sal_Int16)1; + aReturn <<= sal_Int16(1); break; case PROPERTY_ID_FONT_KERNING: @@ -550,14 +550,14 @@ namespace frm case PROPERTY_ID_FONT_PITCH: case PROPERTY_ID_FONT_TYPE: case PROPERTY_ID_FONT_WIDTH: - aReturn <<= (sal_Int16)0; + aReturn <<= sal_Int16(0); break; case PROPERTY_ID_FONT_HEIGHT: case PROPERTY_ID_FONT_WEIGHT: case PROPERTY_ID_FONT_CHARWIDTH: case PROPERTY_ID_FONT_ORIENTATION: - aReturn <<= (float)0; + aReturn <<= float(0); break; default: diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx index f322c94403d0..cd5bcb602fb9 100644 --- a/forms/source/component/imgprod.cxx +++ b/forms/source/component/imgprod.cxx @@ -353,18 +353,18 @@ void ImageProducer::ImplInitConsumer( const Graphic& rGraphic ) for( sal_uInt32 i = 0; i < nPalCount; i++, pTmp++ ) { - const BitmapColor& rCol = pBmpAcc->GetPaletteColor( (sal_uInt16) i ); + const BitmapColor& rCol = pBmpAcc->GetPaletteColor( static_cast<sal_uInt16>(i) ); - *pTmp = ( (sal_Int32) rCol.GetRed() ) << (sal_Int32)24; - *pTmp |= ( (sal_Int32) rCol.GetGreen() ) << (sal_Int32)16; - *pTmp |= ( (sal_Int32) rCol.GetBlue() ) << (sal_Int32)8; - *pTmp |= (sal_Int32)0x000000ffL; + *pTmp = static_cast<sal_Int32>(rCol.GetRed()) << sal_Int32(24); + *pTmp |= static_cast<sal_Int32>(rCol.GetGreen()) << sal_Int32(16); + *pTmp |= static_cast<sal_Int32>(rCol.GetBlue()) << sal_Int32(8); + *pTmp |= sal_Int32(0x000000ffL); } if( rGraphic.IsTransparent() ) { // append transparent entry - *pTmp = (sal_Int32)0xffffff00L; + *pTmp = sal_Int32(0xffffff00L); mnTransIndex = nPalCount; nPalCount++; } @@ -484,9 +484,9 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic ) { const BitmapColor aCol( pBmpAcc->GetPixel( nY, nX ) ); - *pTmp = ( (sal_Int32) aCol.GetRed() ) << 24; - *pTmp |= ( (sal_Int32) aCol.GetGreen() ) << 16; - *pTmp |= ( (sal_Int32) aCol.GetBlue() ) << 8; + *pTmp = static_cast<sal_Int32>(aCol.GetRed()) << 24; + *pTmp |= static_cast<sal_Int32>(aCol.GetGreen()) << 16; + *pTmp |= static_cast<sal_Int32>(aCol.GetBlue()) << 8; if( pMskAcc->GetPixel( nY, nX ) != aWhite ) *pTmp |= 0x000000ffUL; diff --git a/forms/source/component/navigationbar.cxx b/forms/source/component/navigationbar.cxx index 66b31fc05835..44133a8da799 100644 --- a/forms/source/component/navigationbar.cxx +++ b/forms/source/component/navigationbar.cxx @@ -396,7 +396,7 @@ namespace frm break; case PROPERTY_ID_ICONSIZE: - aDefault <<= (sal_Int16)0; + aDefault <<= sal_Int16(0); break; case PROPERTY_ID_DEFAULTCONTROL: @@ -409,11 +409,11 @@ namespace frm break; case PROPERTY_ID_BORDER: - aDefault <<= (sal_Int16)0; + aDefault <<= sal_Int16(0); break; case PROPERTY_ID_DELAY: - aDefault <<= (sal_Int32)20; + aDefault <<= sal_Int32(20); break; default: diff --git a/forms/source/component/refvaluecomponent.cxx b/forms/source/component/refvaluecomponent.cxx index c85fa5784503..f045d119e10e 100644 --- a/forms/source/component/refvaluecomponent.cxx +++ b/forms/source/component/refvaluecomponent.cxx @@ -72,7 +72,7 @@ namespace frm switch ( _nHandle ) { case PROPERTY_ID_REFVALUE: _rValue <<= m_sReferenceValue; break; - case PROPERTY_ID_DEFAULT_STATE: _rValue <<= (sal_Int16)m_eDefaultChecked; break; + case PROPERTY_ID_DEFAULT_STATE: _rValue <<= static_cast<sal_Int16>(m_eDefaultChecked); break; case PROPERTY_ID_UNCHECKED_REFVALUE: _rValue <<= m_sNoCheckReferenceValue; @@ -133,7 +133,7 @@ namespace frm break; case PROPERTY_ID_DEFAULT_STATE: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_eDefaultChecked ); + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_eDefaultChecked) ); break; default: @@ -146,7 +146,7 @@ namespace frm Any OReferenceValueComponent::getDefaultForReset() const { - return makeAny( (sal_Int16)m_eDefaultChecked ); + return makeAny( static_cast<sal_Int16>(m_eDefaultChecked) ); } diff --git a/forms/source/component/scrollbar.cxx b/forms/source/component/scrollbar.cxx index 3cacdbdb8ace..957167f83718 100644 --- a/forms/source/component/scrollbar.cxx +++ b/forms/source/component/scrollbar.cxx @@ -57,7 +57,7 @@ namespace frm } else { - nControlValue = (sal_Int32)::rtl::math::round( nExternalValue ); + nControlValue = static_cast<sal_Int32>(::rtl::math::round( nExternalValue )); } } else @@ -75,7 +75,7 @@ namespace frm Any aExternalDoubleValue; sal_Int32 nScrollValue = 0; if ( _rControlIntValue >>= nScrollValue ) - aExternalDoubleValue <<= (double)nScrollValue; + aExternalDoubleValue <<= static_cast<double>(nScrollValue); else { OSL_FAIL( "translateControlIntToExternalDoubleValue: no integer scroll value!" ); @@ -196,7 +196,7 @@ namespace frm switch ( _nHandle ) { case PROPERTY_ID_DEFAULT_SCROLL_VALUE: - aReturn <<= (sal_Int32)0; + aReturn <<= sal_Int32(0); break; default: @@ -224,7 +224,7 @@ namespace frm Any OScrollBarModel::getDefaultForReset() const { - return makeAny( (sal_Int32)m_nDefaultScrollValue ); + return makeAny( static_cast<sal_Int32>(m_nDefaultScrollValue) ); } diff --git a/forms/source/component/spinbutton.cxx b/forms/source/component/spinbutton.cxx index a666ccf88d81..164cce42319e 100644 --- a/forms/source/component/spinbutton.cxx +++ b/forms/source/component/spinbutton.cxx @@ -150,7 +150,7 @@ namespace frm switch ( _nHandle ) { case PROPERTY_ID_DEFAULT_SPIN_VALUE: - aReturn <<= (sal_Int32)0; + aReturn <<= sal_Int32(0); break; default: @@ -178,7 +178,7 @@ namespace frm Any OSpinButtonModel::getDefaultForReset() const { - return makeAny( (sal_Int32)m_nDefaultSpinValue ); + return makeAny( static_cast<sal_Int32>(m_nDefaultSpinValue) ); } |