More loplugin:cstylecast: forms

Change-Id: Ide91ff51ef5c048272d742547597d6c66fc3abea
This commit is contained in:
Stephan Bergmann
2018-01-15 09:05:33 +01:00
parent bb60b49c3a
commit c6a62b3694
8 changed files with 28 additions and 28 deletions

View File

@@ -143,7 +143,7 @@ void OButtonModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
OStreamSection aSection( _rxOutStream.get() ); OStreamSection aSection( _rxOutStream.get() );
// this will allow readers to skip unknown bytes in their dtor // this will allow readers to skip unknown bytes in their dtor
_rxOutStream->writeShort( (sal_uInt16)m_eButtonType ); _rxOutStream->writeShort( static_cast<sal_uInt16>(m_eButtonType) );
OUString sTmp = INetURLObject::decode( m_sTargetURL, INetURLObject::DecodeMechanism::Unambiguous); OUString sTmp = INetURLObject::decode( m_sTargetURL, INetURLObject::DecodeMechanism::Unambiguous);
_rxOutStream << sTmp; _rxOutStream << sTmp;
@@ -163,7 +163,7 @@ void OButtonModel::read(const Reference<XObjectInputStream>& _rxInStream)
{ {
case 0x0001: case 0x0001:
{ {
m_eButtonType = (FormButtonType)_rxInStream->readShort(); m_eButtonType = static_cast<FormButtonType>(_rxInStream->readShort());
_rxInStream >> m_sTargetURL; _rxInStream >> m_sTargetURL;
_rxInStream >> m_sTargetFrame; _rxInStream >> m_sTargetFrame;
@@ -172,7 +172,7 @@ void OButtonModel::read(const Reference<XObjectInputStream>& _rxInStream)
case 0x0002: case 0x0002:
{ {
m_eButtonType = (FormButtonType)_rxInStream->readShort(); m_eButtonType = static_cast<FormButtonType>(_rxInStream->readShort());
_rxInStream >> m_sTargetURL; _rxInStream >> m_sTargetURL;
_rxInStream >> m_sTargetFrame; _rxInStream >> m_sTargetFrame;
@@ -186,7 +186,7 @@ void OButtonModel::read(const Reference<XObjectInputStream>& _rxInStream)
// this will skip any unknown bytes in its dtor // this will skip any unknown bytes in its dtor
// button type // button type
m_eButtonType = (FormButtonType)_rxInStream->readShort(); m_eButtonType = static_cast<FormButtonType>(_rxInStream->readShort());
// URL // URL
_rxInStream >> m_sTargetURL; _rxInStream >> m_sTargetURL;
@@ -267,7 +267,7 @@ void SAL_CALL OButtonModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle
{ {
sal_Int16 nDefaultState = sal_Int16(TRISTATE_FALSE); sal_Int16 nDefaultState = sal_Int16(TRISTATE_FALSE);
OSL_VERIFY( _rValue >>= nDefaultState ); OSL_VERIFY( _rValue >>= nDefaultState );
m_eDefaultState = (ToggleState)nDefaultState; m_eDefaultState = static_cast<ToggleState>(nDefaultState);
impl_resetNoBroadcast_nothrow(); impl_resetNoBroadcast_nothrow();
} }
break; break;

View File

@@ -351,7 +351,7 @@ void SAL_CALL OComboBoxModel::write(const Reference<css::io::XObjectOutputStream
css::uno::Sequence<OUString> aListSourceSeq(&m_aListSource, 1); css::uno::Sequence<OUString> aListSourceSeq(&m_aListSource, 1);
_rxOutStream << aListSourceSeq; _rxOutStream << aListSourceSeq;
_rxOutStream << (sal_Int16)m_eListSourceType; _rxOutStream << static_cast<sal_Int16>(m_eListSourceType);
if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN) if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN)
{ {
@@ -423,7 +423,7 @@ void SAL_CALL OComboBoxModel::read(const Reference<css::io::XObjectInputStream>&
sal_Int16 nListSourceType; sal_Int16 nListSourceType;
_rxInStream >> nListSourceType; _rxInStream >> nListSourceType;
m_eListSourceType = (ListSourceType)nListSourceType; m_eListSourceType = static_cast<ListSourceType>(nListSourceType);
if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN) if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN)
{ {

View File

@@ -2391,7 +2391,7 @@ sal_Bool SAL_CALL ODatabaseForm::getGroupControl()
{ {
sal_Int32 nCycle = 0; sal_Int32 nCycle = 0;
::cppu::enum2int(nCycle, m_aCycle); ::cppu::enum2int(nCycle, m_aCycle);
return (TabulatorCycle)nCycle != TabulatorCycle_PAGE; return static_cast<TabulatorCycle>(nCycle) != TabulatorCycle_PAGE;
} }
if (isLoaded() && getConnection().is()) if (isLoaded() && getConnection().is())
@@ -3801,7 +3801,7 @@ void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutS
default : OSL_FAIL("ODatabaseForm::write : wrong CommandType !"); default : OSL_FAIL("ODatabaseForm::write : wrong CommandType !");
} }
} }
_rxOutStream->writeShort((sal_Int16)eTranslated); // former DataSelectionType _rxOutStream->writeShort(static_cast<sal_Int16>(eTranslated)); // former DataSelectionType
// very old versions expect a CursorType here // very old versions expect a CursorType here
_rxOutStream->writeShort(2); // DatabaseCursorType_KEYSET _rxOutStream->writeShort(2); // DatabaseCursorType_KEYSET
@@ -3821,22 +3821,22 @@ void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutS
// html form stuff // html form stuff
OUString sTmp = INetURLObject::decode( m_aTargetURL, INetURLObject::DecodeMechanism::Unambiguous); OUString sTmp = INetURLObject::decode( m_aTargetURL, INetURLObject::DecodeMechanism::Unambiguous);
_rxOutStream << sTmp; _rxOutStream << sTmp;
_rxOutStream->writeShort( (sal_Int16)m_eSubmitMethod ); _rxOutStream->writeShort( static_cast<sal_Int16>(m_eSubmitMethod) );
_rxOutStream->writeShort( (sal_Int16)m_eSubmitEncoding ); _rxOutStream->writeShort( static_cast<sal_Int16>(m_eSubmitEncoding) );
_rxOutStream << m_aTargetFrame; _rxOutStream << m_aTargetFrame;
// version 2 didn't know some options and the "default" state // version 2 didn't know some options and the "default" state
sal_Int32 nCycle = (sal_Int32)TabulatorCycle_RECORDS; sal_Int32 nCycle = sal_Int32(TabulatorCycle_RECORDS);
if (m_aCycle.hasValue()) if (m_aCycle.hasValue())
{ {
::cppu::enum2int(nCycle, m_aCycle); ::cppu::enum2int(nCycle, m_aCycle);
if (m_aCycle == TabulatorCycle_PAGE) if (m_aCycle == TabulatorCycle_PAGE)
// unknown in earlier versions // unknown in earlier versions
nCycle = (sal_Int32)TabulatorCycle_RECORDS; nCycle = sal_Int32(TabulatorCycle_RECORDS);
} }
_rxOutStream->writeShort(static_cast<sal_Int16>(nCycle)); _rxOutStream->writeShort(static_cast<sal_Int16>(nCycle));
_rxOutStream->writeShort((sal_Int16)m_eNavigation); _rxOutStream->writeShort(static_cast<sal_Int16>(m_eNavigation));
OUString sFilter; OUString sFilter;
OUString sHaving; OUString sHaving;
@@ -3895,7 +3895,7 @@ void SAL_CALL ODatabaseForm::read(const Reference<XObjectInputStream>& _rxInStre
sal_Int16 nCursorSourceType = _rxInStream->readShort(); sal_Int16 nCursorSourceType = _rxInStream->readShort();
sal_Int32 nCommandType = 0; sal_Int32 nCommandType = 0;
switch ((DataSelectionType)nCursorSourceType) switch (static_cast<DataSelectionType>(nCursorSourceType))
{ {
case DataSelectionType_TABLE : nCommandType = CommandType::TABLE; break; case DataSelectionType_TABLE : nCommandType = CommandType::TABLE; break;
case DataSelectionType_QUERY : nCommandType = CommandType::QUERY; break; case DataSelectionType_QUERY : nCommandType = CommandType::QUERY; break;
@@ -3903,7 +3903,7 @@ void SAL_CALL ODatabaseForm::read(const Reference<XObjectInputStream>& _rxInStre
case DataSelectionType_SQLPASSTHROUGH: case DataSelectionType_SQLPASSTHROUGH:
{ {
nCommandType = CommandType::COMMAND; nCommandType = CommandType::COMMAND;
bool bEscapeProcessing = ((DataSelectionType)nCursorSourceType) != DataSelectionType_SQLPASSTHROUGH; bool bEscapeProcessing = static_cast<DataSelectionType>(nCursorSourceType) != DataSelectionType_SQLPASSTHROUGH;
m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, makeAny(bEscapeProcessing)); m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, makeAny(bEscapeProcessing));
} }
break; break;
@@ -3933,15 +3933,15 @@ void SAL_CALL ODatabaseForm::read(const Reference<XObjectInputStream>& _rxInStre
OUString sTmp; OUString sTmp;
_rxInStream >> sTmp; _rxInStream >> sTmp;
m_aTargetURL = INetURLObject::decode( sTmp, INetURLObject::DecodeMechanism::Unambiguous); m_aTargetURL = INetURLObject::decode( sTmp, INetURLObject::DecodeMechanism::Unambiguous);
m_eSubmitMethod = (FormSubmitMethod)_rxInStream->readShort(); m_eSubmitMethod = static_cast<FormSubmitMethod>(_rxInStream->readShort());
m_eSubmitEncoding = (FormSubmitEncoding)_rxInStream->readShort(); m_eSubmitEncoding = static_cast<FormSubmitEncoding>(_rxInStream->readShort());
_rxInStream >> m_aTargetFrame; _rxInStream >> m_aTargetFrame;
if (nVersion > 1) if (nVersion > 1)
{ {
sal_Int32 nCycle = _rxInStream->readShort(); sal_Int32 nCycle = _rxInStream->readShort();
m_aCycle <<= TabulatorCycle(nCycle); m_aCycle <<= TabulatorCycle(nCycle);
m_eNavigation = (NavigationBarMode)_rxInStream->readShort(); m_eNavigation = static_cast<NavigationBarMode>(_rxInStream->readShort());
_rxInStream >> sAggregateProp; _rxInStream >> sAggregateProp;
setPropertyValue(PROPERTY_FILTER, makeAny(sAggregateProp)); setPropertyValue(PROPERTY_FILTER, makeAny(sAggregateProp));

View File

@@ -929,7 +929,7 @@ void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream)
if ( nAnyMask & FONTATTRIBS ) if ( nAnyMask & FONTATTRIBS )
{ {
aFont.Weight = static_cast<float>(vcl::unohelper::ConvertFontWeight( _rxInStream->readShort() )); aFont.Weight = static_cast<float>(vcl::unohelper::ConvertFontWeight( _rxInStream->readShort() ));
aFont.Slant = (FontSlant)_rxInStream->readShort(); aFont.Slant = static_cast<FontSlant>(_rxInStream->readShort());
aFont.Underline = _rxInStream->readShort(); aFont.Underline = _rxInStream->readShort();
aFont.Strikeout = _rxInStream->readShort(); aFont.Strikeout = _rxInStream->readShort();
aFont.Orientation = static_cast<float>(_rxInStream->readShort()) / 10; aFont.Orientation = static_cast<float>(_rxInStream->readShort()) / 10;

View File

@@ -94,7 +94,7 @@ void OImageButtonModel::write(const Reference<XObjectOutputStream>& _rxOutStream
// Version // Version
_rxOutStream->writeShort(0x0003); _rxOutStream->writeShort(0x0003);
_rxOutStream->writeShort((sal_uInt16)m_eButtonType); _rxOutStream->writeShort(static_cast<sal_uInt16>(m_eButtonType));
OUString sTmp(INetURLObject::decode( m_sTargetURL, INetURLObject::DecodeMechanism::Unambiguous)); OUString sTmp(INetURLObject::decode( m_sTargetURL, INetURLObject::DecodeMechanism::Unambiguous));
_rxOutStream << sTmp; _rxOutStream << sTmp;
@@ -113,19 +113,19 @@ void OImageButtonModel::read(const Reference<XObjectInputStream>& _rxInStream)
{ {
case 0x0001: case 0x0001:
{ {
m_eButtonType = (FormButtonType)_rxInStream->readShort(); m_eButtonType = static_cast<FormButtonType>(_rxInStream->readShort());
} }
break; break;
case 0x0002: case 0x0002:
{ {
m_eButtonType = (FormButtonType)_rxInStream->readShort(); m_eButtonType = static_cast<FormButtonType>(_rxInStream->readShort());
_rxInStream >> m_sTargetURL; _rxInStream >> m_sTargetURL;
_rxInStream >> m_sTargetFrame; _rxInStream >> m_sTargetFrame;
} }
break; break;
case 0x0003: case 0x0003:
{ {
m_eButtonType = (FormButtonType)_rxInStream->readShort(); m_eButtonType = static_cast<FormButtonType>(_rxInStream->readShort());
_rxInStream >> m_sTargetURL; _rxInStream >> m_sTargetURL;
_rxInStream >> m_sTargetFrame; _rxInStream >> m_sTargetFrame;
readHelpTextCompatibly(_rxInStream); readHelpTextCompatibly(_rxInStream);

View File

@@ -571,7 +571,7 @@ namespace frm
_rxOutStream << nAnyMask; _rxOutStream << nAnyMask;
_rxOutStream << lcl_convertToStringSequence( m_aListSourceValues ); _rxOutStream << lcl_convertToStringSequence( m_aListSourceValues );
_rxOutStream << (sal_Int16)m_eListSourceType; _rxOutStream << static_cast<sal_Int16>(m_eListSourceType);
_rxOutStream << aDummySeq; _rxOutStream << aDummySeq;
_rxOutStream << m_aDefaultSelectSeq; _rxOutStream << m_aDefaultSelectSeq;
@@ -657,7 +657,7 @@ namespace frm
sal_Int16 nListSourceType; sal_Int16 nListSourceType;
_rxInStream >> nListSourceType; _rxInStream >> nListSourceType;
m_eListSourceType = (ListSourceType)nListSourceType; m_eListSourceType = static_cast<ListSourceType>(nListSourceType);
Any aListSourceSeqAny; Any aListSourceSeqAny;
aListSourceSeqAny <<= aListSourceSeq; aListSourceSeqAny <<= aListSourceSeq;

View File

@@ -304,7 +304,7 @@ void SAL_CALL ORadioButtonModel::read(const Reference<XObjectInputStream>& _rxIn
} }
setReferenceValue( sReferenceValue ); setReferenceValue( sReferenceValue );
setDefaultChecked( (ToggleState)nDefaultChecked ); setDefaultChecked( static_cast<ToggleState>(nDefaultChecked) );
// Display default values after read // Display default values after read
if ( !getControlSource().isEmpty() ) if ( !getControlSource().isEmpty() )

View File

@@ -108,7 +108,7 @@ namespace frm
" 0--2"), " 0--2"),
css::uno::Reference<css::uno::XInterface>(), -1); css::uno::Reference<css::uno::XInterface>(), -1);
} }
m_eDefaultChecked = (ToggleState)nDefaultChecked; m_eDefaultChecked = static_cast<ToggleState>(nDefaultChecked);
resetNoBroadcast(); resetNoBroadcast();
} }
break; break;