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 | |
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')
34 files changed, 140 insertions, 141 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) ); } diff --git a/forms/source/helper/commandimageprovider.cxx b/forms/source/helper/commandimageprovider.cxx index 9a19d9a6fe28..1370b14c8663 100644 --- a/forms/source/helper/commandimageprovider.cxx +++ b/forms/source/helper/commandimageprovider.cxx @@ -129,8 +129,8 @@ namespace frm if ( m_xModuleImageManager.is() ) aModImages = m_xModuleImageManager->getImages( nImageType, _rCommandURLs ); - ENSURE_OR_THROW( (size_t)aDocImages.getLength() == nCommandCount, "illegal array size returned by getImages (document image manager)" ); - ENSURE_OR_THROW( (size_t)aModImages.getLength() == nCommandCount, "illegal array size returned by getImages (module image manager)" ); + ENSURE_OR_THROW( static_cast<size_t>(aDocImages.getLength()) == nCommandCount, "illegal array size returned by getImages (document image manager)" ); + ENSURE_OR_THROW( static_cast<size_t>(aModImages.getLength()) == nCommandCount, "illegal array size returned by getImages (module image manager)" ); for ( size_t i=0; i<nCommandCount; ++i ) { diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index 3d5ffd73083b..402e433363b7 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -718,7 +718,7 @@ sal_Int32 OInterfaceContainer::getCount() Any OInterfaceContainer::getByIndex(sal_Int32 _nIndex) { - if (_nIndex < 0 || (_nIndex >= (sal_Int32)m_aItems.size())) + if (_nIndex < 0 || (_nIndex >= static_cast<sal_Int32>(m_aItems.size()))) throw IndexOutOfBoundsException(); return m_aItems[_nIndex]->queryInterface( m_aElementType ); @@ -791,7 +791,7 @@ void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XProper _rxElement->addPropertyChangeListener(PROPERTY_NAME, this); // insert the object into our internal structures - if (_nIndex > (sal_Int32)m_aItems.size()) // Calculate the actual index + if (_nIndex > static_cast<sal_Int32>(m_aItems.size())) // Calculate the actual index { _nIndex = m_aItems.size(); m_aItems.push_back( pElementMetaData->xInterface ); @@ -912,7 +912,7 @@ void SAL_CALL OInterfaceContainer::insertByIndex( sal_Int32 _nIndex, const Any& void OInterfaceContainer::implReplaceByIndex( const sal_Int32 _nIndex, const Any& _rNewElement, ::osl::ClearableMutexGuard& _rClearBeforeNotify ) { - OSL_PRECOND( ( _nIndex >= 0 ) && ( _nIndex < (sal_Int32)m_aItems.size() ), "OInterfaceContainer::implReplaceByIndex: precondition not met (index)!" ); + OSL_PRECOND( ( _nIndex >= 0 ) && ( _nIndex < static_cast<sal_Int32>(m_aItems.size()) ), "OInterfaceContainer::implReplaceByIndex: precondition not met (index)!" ); // approve the new object std::unique_ptr< ElementDescription > aElementMetaData( createElementMetaData() ); @@ -985,7 +985,7 @@ void OInterfaceContainer::implReplaceByIndex( const sal_Int32 _nIndex, const Any void OInterfaceContainer::implCheckIndex( const sal_Int32 _nIndex ) { - if (_nIndex < 0 || _nIndex >= (sal_Int32)m_aItems.size()) + if (_nIndex < 0 || _nIndex >= static_cast<sal_Int32>(m_aItems.size())) throw IndexOutOfBoundsException(); } @@ -1002,7 +1002,7 @@ void SAL_CALL OInterfaceContainer::replaceByIndex(sal_Int32 _nIndex, const Any& void OInterfaceContainer::implRemoveByIndex( const sal_Int32 _nIndex, ::osl::ClearableMutexGuard& _rClearBeforeNotify ) { - OSL_PRECOND( ( _nIndex >= 0 ) && ( _nIndex < (sal_Int32)m_aItems.size() ), "OInterfaceContainer::implRemoveByIndex: precondition not met (index)!" ); + OSL_PRECOND( ( _nIndex >= 0 ) && ( _nIndex < static_cast<sal_Int32>(m_aItems.size()) ), "OInterfaceContainer::implRemoveByIndex: precondition not met (index)!" ); OInterfaceArray::iterator i = m_aItems.begin() + _nIndex; css::uno::Reference<css::uno::XInterface> xElement(*i); diff --git a/forms/source/misc/limitedformats.cxx b/forms/source/misc/limitedformats.cxx index 6ab1b6378b7e..a0eaf0245105 100644 --- a/forms/source/misc/limitedformats.cxx +++ b/forms/source/misc/limitedformats.cxx @@ -301,7 +301,7 @@ namespace frm bool bModified = false; if (bFoundIt) { - _rConvertedValue <<= (sal_Int16)nTablePosition; + _rConvertedValue <<= static_cast<sal_Int16>(nTablePosition); bModified = nTablePosition != nOldEnumValue; } diff --git a/forms/source/richtext/parametrizedattributedispatcher.cxx b/forms/source/richtext/parametrizedattributedispatcher.cxx index cd3169cf67f1..01ef4f6af300 100644 --- a/forms/source/richtext/parametrizedattributedispatcher.cxx +++ b/forms/source/richtext/parametrizedattributedispatcher.cxx @@ -92,7 +92,7 @@ namespace frm { // get the real slot id. This may differ from our attribute id: for instance, both // SID_ATTR_CHAR_HEIGHT and SID_ATTR_CHAR_LATIN_HEIGHT are mapped to the same which id - SfxSlotId nSlotId = lcl_normalizeLatinScriptSlotId( (SfxSlotId)m_nAttributeId ); + SfxSlotId nSlotId = lcl_normalizeLatinScriptSlotId( static_cast<SfxSlotId>(m_nAttributeId) ); SfxAllItemSet aParameterSet( getEditView()->GetEmptyItemSet() ); TransformParameters( nSlotId, _rArguments, aParameterSet ); diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx index 9d9cf426070b..663e9a3d7965 100644 --- a/forms/source/richtext/richtextimplcontrol.cxx +++ b/forms/source/richtext/richtextimplcontrol.cxx @@ -114,7 +114,7 @@ namespace frm // This is useful in case the observer is for instance a toolbox which contains only // an, e.g., "bold" slot, and thus not interested in the particular script type of the // current selection. - SvxScriptSetItem aNormalizedSet( (WhichId)_pHandler->first, *m_pView->GetAttribs().GetPool() ); + SvxScriptSetItem aNormalizedSet( static_cast<WhichId>(_pHandler->first), *m_pView->GetAttribs().GetPool() ); normalizeScriptDependentAttribute( aNormalizedSet ); implCheckUpdateCache( _pHandler->first, _pHandler->second->getState( aNormalizedSet.GetItemSet() ) ); diff --git a/forms/source/richtext/richtextmodel.cxx b/forms/source/richtext/richtextmodel.cxx index 493338eacbff..cca527d17578 100644 --- a/forms/source/richtext/richtextmodel.cxx +++ b/forms/source/richtext/richtextmodel.cxx @@ -426,13 +426,13 @@ namespace frm break; case PROPERTY_ID_LINEEND_FORMAT: - aDefault <<= (sal_Int16)LineEndFormat::LINE_FEED; + aDefault <<= sal_Int16(LineEndFormat::LINE_FEED); break; case PROPERTY_ID_ECHO_CHAR: case PROPERTY_ID_ALIGN: case PROPERTY_ID_MAXTEXTLEN: - aDefault <<= (sal_Int16)0; + aDefault <<= sal_Int16(0); break; case PROPERTY_ID_TABSTOP: @@ -469,7 +469,7 @@ namespace frm break; case PROPERTY_ID_BORDER: - aDefault <<= (sal_Int16)1; + aDefault <<= sal_Int16(1); break; default: diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx index 41eb8247e0fa..8d0737b7852c 100644 --- a/forms/source/richtext/rtattributehandler.cxx +++ b/forms/source/richtext/rtattributehandler.cxx @@ -68,7 +68,7 @@ namespace frm void AttributeHandler::putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, SvtScriptType _nForScriptType ) const { - SvxScriptSetItem aSetItem( (WhichId)getAttributeId(), *_rAttribs.GetPool() ); + SvxScriptSetItem aSetItem( static_cast<WhichId>(getAttributeId()), *_rAttribs.GetPool() ); aSetItem.PutItemForScriptType( _nForScriptType, _rItem ); _rAttribs.Put( aSetItem.GetItemSet(), false ); } @@ -109,7 +109,7 @@ namespace frm case SID_ATTR_CHAR_LATIN_WEIGHT: nWhich = EE_CHAR_WEIGHT; break; default: - nWhich = _rPool.GetWhich( (SfxSlotId)_nAttributeId ); + nWhich = _rPool.GetWhich( static_cast<SfxSlotId>(_nAttributeId) ); } return nWhich; } @@ -157,7 +157,7 @@ namespace frm break; default: - pReturn = new SlotHandler( (SfxSlotId)_nAttributeId, lcl_implGetWhich( _rEditEnginePool, _nAttributeId ) ); + pReturn = new SlotHandler( static_cast<SfxSlotId>(_nAttributeId), lcl_implGetWhich( _rEditEnginePool, _nAttributeId ) ); break; } @@ -229,7 +229,7 @@ namespace frm if ( 100 == m_nLineSpace ) aLineSpacing.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off ); else - aLineSpacing.SetPropLineSpace( (sal_uInt8)m_nLineSpace ); + aLineSpacing.SetPropLineSpace( static_cast<sal_uInt8>(m_nLineSpace) ); _rNewAttribs.Put( aLineSpacing ); } diff --git a/forms/source/richtext/specialdispatchers.cxx b/forms/source/richtext/specialdispatchers.cxx index 89f3a6e6437c..31a1c6cde092 100644 --- a/forms/source/richtext/specialdispatchers.cxx +++ b/forms/source/richtext/specialdispatchers.cxx @@ -155,8 +155,8 @@ namespace frm bool bEnable = true; OSL_VERIFY( pLookup->Value >>= bEnable ); if ( m_nAttributeId == SID_ATTR_PARA_SCRIPTSPACE ) - return new SvxScriptSpaceItem( bEnable, (WhichId)m_nAttributeId ); - return new SfxBoolItem( (WhichId)m_nAttributeId, bEnable ); + return new SvxScriptSpaceItem( bEnable, static_cast<WhichId>(m_nAttributeId) ); + return new SfxBoolItem( static_cast<WhichId>(m_nAttributeId), bEnable ); } OSL_FAIL( "OAsianFontLayoutDispatcher::convertDispatchArgsToItem: did not find the one and only argument!" ); diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx index 08c225893873..3597486f07ae 100644 --- a/forms/source/runtime/formoperations.cxx +++ b/forms/source/runtime/formoperations.cxx @@ -1327,7 +1327,7 @@ namespace frm sal_Int32 FormOperations::impl_getRowCount_throw() const { - return lcl_safeGetPropertyValue_throw( m_xCursorProperties, PROPERTY_ROWCOUNT, (sal_Int32)0 ); + return lcl_safeGetPropertyValue_throw( m_xCursorProperties, PROPERTY_ROWCOUNT, sal_Int32(0) ); } bool FormOperations::impl_isRowCountFinal_throw() const diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx index 54a88b9bcd1c..9c3d538340cb 100644 --- a/forms/source/solar/component/navbarcontrol.cxx +++ b/forms/source/solar/component/navbarcontrol.cxx @@ -346,11 +346,11 @@ namespace frm if ( _rPropertyName == PROPERTY_BACKGROUNDCOLOR ) { - aReturn <<= (sal_Int32)pNavBar->GetControlBackground().GetColor(); + aReturn <<= static_cast<sal_Int32>(pNavBar->GetControlBackground().GetColor()); } else if ( _rPropertyName == PROPERTY_TEXTLINECOLOR ) { - aReturn <<= (sal_Int32)pNavBar->GetTextLineColor().GetColor(); + aReturn <<= static_cast<sal_Int32>(pNavBar->GetTextLineColor().GetColor()); } else if ( _rPropertyName == PROPERTY_ICONSIZE ) { diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx index 50a84443d3da..7cf16894b710 100644 --- a/forms/source/solar/control/navtoolbar.cxx +++ b/forms/source/solar/control/navtoolbar.cxx @@ -199,32 +199,32 @@ namespace frm void NavigationToolBar::enableFeature( sal_Int16 _nFeatureId, bool _bEnabled ) { - DBG_ASSERT( m_pToolbar->GetItemPos( (sal_uInt16)_nFeatureId ) != ToolBox::ITEM_NOTFOUND, + DBG_ASSERT( m_pToolbar->GetItemPos( static_cast<sal_uInt16>(_nFeatureId) ) != ToolBox::ITEM_NOTFOUND, "NavigationToolBar::enableFeature: invalid id!" ); - implEnableItem( (sal_uInt16)_nFeatureId, _bEnabled ); + implEnableItem( static_cast<sal_uInt16>(_nFeatureId), _bEnabled ); } void NavigationToolBar::checkFeature( sal_Int16 _nFeatureId, bool _bEnabled ) { - DBG_ASSERT( m_pToolbar->GetItemPos( (sal_uInt16)_nFeatureId ) != ToolBox::ITEM_NOTFOUND, + DBG_ASSERT( m_pToolbar->GetItemPos( static_cast<sal_uInt16>(_nFeatureId) ) != ToolBox::ITEM_NOTFOUND, "NavigationToolBar::checkFeature: invalid id!" ); - m_pToolbar->CheckItem( (sal_uInt16)_nFeatureId, _bEnabled ); + m_pToolbar->CheckItem( static_cast<sal_uInt16>(_nFeatureId), _bEnabled ); } void NavigationToolBar::setFeatureText( sal_Int16 _nFeatureId, const OUString& _rText ) { - DBG_ASSERT( m_pToolbar->GetItemPos( (sal_uInt16)_nFeatureId ) != ToolBox::ITEM_NOTFOUND, + DBG_ASSERT( m_pToolbar->GetItemPos( static_cast<sal_uInt16>(_nFeatureId) ) != ToolBox::ITEM_NOTFOUND, "NavigationToolBar::checkFeature: invalid id!" ); - vcl::Window* pItemWindow = m_pToolbar->GetItemWindow( (sal_uInt16)_nFeatureId ); + vcl::Window* pItemWindow = m_pToolbar->GetItemWindow( static_cast<sal_uInt16>(_nFeatureId) ); if ( pItemWindow ) pItemWindow->SetText( _rText ); else - m_pToolbar->SetItemText( (sal_uInt16)_nFeatureId, _rText ); + m_pToolbar->SetItemText( static_cast<sal_uInt16>(_nFeatureId), _rText ); } @@ -678,7 +678,7 @@ namespace frm return; if ( m_pDispatcher ) - m_pDispatcher->dispatchWithArgument( FormFeature::MoveAbsolute, "Position", makeAny( (sal_Int32)nRecord ) ); + m_pDispatcher->dispatchWithArgument( FormFeature::MoveAbsolute, "Position", makeAny( static_cast<sal_Int32>(nRecord) ) ); SaveValue(); } diff --git a/forms/source/xforms/datatypes.cxx b/forms/source/xforms/datatypes.cxx index da3460edb5ea..c0b1a978a3e9 100644 --- a/forms/source/xforms/datatypes.cxx +++ b/forms/source/xforms/datatypes.cxx @@ -868,7 +868,7 @@ namespace xforms bool OShortIntegerType::_getValue( const OUString& value, double& fValue ) { - fValue = (double)(sal_Int16)value.toInt32(); + fValue = static_cast<double>(static_cast<sal_Int16>(value.toInt32())); // TODO/eforms // this does not care for values which do not fit into a sal_Int16, but simply // cuts them down. A better implementation here should probably return <FALSE/> diff --git a/forms/source/xforms/xpathlib/extension.cxx b/forms/source/xforms/xpathlib/extension.cxx index 576d8d957e9e..e2d29e00b948 100644 --- a/forms/source/xforms/xpathlib/extension.cxx +++ b/forms/source/xforms/xpathlib/extension.cxx @@ -35,8 +35,8 @@ Libxml2ExtensionHandle SAL_CALL CLibxml2XFormsExtension::getLibxml2ExtensionHand Libxml2ExtensionHandle aHandle; aHandle.functionLookupFunction = reinterpret_cast< sal_Int64 >( &xforms_lookupFunc ); aHandle.functionData = reinterpret_cast< sal_Int64 >( this ); - aHandle.variableLookupFunction = (sal_Int64)0; - aHandle.variableData = (sal_Int64)0; + aHandle.variableLookupFunction = sal_Int64(0); + aHandle.variableData = sal_Int64(0); return aHandle; } diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx index c60f5bdd10e5..d0d7dba791fc 100644 --- a/forms/source/xforms/xpathlib/xpathlib.cxx +++ b/forms/source/xforms/xpathlib/xpathlib.cxx @@ -232,22 +232,22 @@ void xforms_propertyFunction(xmlXPathParserContextPtr ctxt, int nargs) static OString makeDateTimeString (const DateTime& aDateTime) { OStringBuffer aDateTimeString; - aDateTimeString.append((sal_Int32)aDateTime.GetYear()); + aDateTimeString.append(static_cast<sal_Int32>(aDateTime.GetYear())); aDateTimeString.append("-"); if (aDateTime.GetMonth()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetMonth()); + aDateTimeString.append(static_cast<sal_Int32>(aDateTime.GetMonth())); aDateTimeString.append("-"); if (aDateTime.GetDay()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetDay()); + aDateTimeString.append(static_cast<sal_Int32>(aDateTime.GetDay())); aDateTimeString.append("T"); if (aDateTime.GetHour()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetHour()); + aDateTimeString.append(static_cast<sal_Int32>(aDateTime.GetHour())); aDateTimeString.append(":"); if (aDateTime.GetMin()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetMin()); + aDateTimeString.append(static_cast<sal_Int32>(aDateTime.GetMin())); aDateTimeString.append(":"); if (aDateTime.GetSec()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetSec()); + aDateTimeString.append(static_cast<sal_Int32>(aDateTime.GetSec())); aDateTimeString.append("Z"); return aDateTimeString.makeStringAndClear(); @@ -308,7 +308,7 @@ static bool parseDateTime(const OUString& aString, DateTime& aDateTime) sal_Int32 nMinute = aTimeString.getToken(0, ':', nIndex).toInt32(); sal_Int32 nSecond = aTimeString.getToken(0, ':', nIndex).toInt32(); - Date tmpDate((sal_uInt16)nDay, (sal_uInt16)nMonth, (sal_uInt16)nYear); + Date tmpDate(static_cast<sal_uInt16>(nDay), static_cast<sal_uInt16>(nMonth), static_cast<sal_uInt16>(nYear)); tools::Time tmpTime(nHour, nMinute, nSecond); DateTime tmpDateTime(tmpDate, tmpTime); if (aString.indexOf("Z") < 0) |