diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:16:14 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:16:14 +0100 |
commit | 48db069fd7341ad8128d0e9a5fbcc5b092fe9860 (patch) | |
tree | 1e7e14069f35086928b11f48c0a67dedec8730bc /sfx2 | |
parent | 5e7e3c3bd7bd10a9f7216d4d9fa8f2c61bf2db3e (diff) |
More loplugin:cstylecast: sfx2
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: Ia3bed56999f3d684f706ce0bd5be8a2269b06d22
Diffstat (limited to 'sfx2')
43 files changed, 114 insertions, 114 deletions
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index fcf76696ced2..ebdcce8b53af 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -197,7 +197,7 @@ void SfxApplication::GetOptions( SfxItemSet& rSet ) { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::AutoSaveTime)) - if (!rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_AUTOSAVEMINUTE ), (sal_uInt16)aSaveOptions.GetAutoSaveTime()))) + if (!rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_AUTOSAVEMINUTE ), static_cast<sal_uInt16>(aSaveOptions.GetAutoSaveTime())))) bRet = false; } break; @@ -735,7 +735,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) OUString aNoChangeStr( ' ' ); for( sal_uInt32 nPath=0; nPath<nCount; ++nPath ) { - OUString sValue = pEnumItem->GetValueTextByPos((sal_uInt16)nPath); + OUString sValue = pEnumItem->GetValueTextByPos(static_cast<sal_uInt16>(nPath)); if ( sValue != aNoChangeStr ) { switch( nPath ) diff --git a/sfx2/source/appl/appdispatchprovider.cxx b/sfx2/source/appl/appdispatchprovider.cxx index 3c36486e3b7a..a13cb5312bf6 100644 --- a/sfx2/source/appl/appdispatchprovider.cxx +++ b/sfx2/source/appl/appdispatchprovider.cxx @@ -132,7 +132,7 @@ Reference < XDispatch > SAL_CALL SfxAppDispatchProvider::queryDispatch( SfxDispatcher* pAppDisp = SfxGetpApp()->GetAppDispatcher_Impl(); if ( aURL.Protocol == "slot:" || aURL.Protocol == "commandId:" ) { - nId = (sal_uInt16) aURL.Path.toInt32(); + nId = static_cast<sal_uInt16>(aURL.Path.toInt32()); SfxShell* pShell; pAppDisp->GetShellAndSlot_Impl( nId, &pShell, &pSlot, true, true ); } diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 0ae86d85f9b4..0c6c9fd4df10 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -584,7 +584,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { if ( aCommand.startsWith("slot:") ) { - sal_uInt16 nSlotId = (sal_uInt16) aCommand.copy(5).toInt32(); + sal_uInt16 nSlotId = static_cast<sal_uInt16>(aCommand.copy(5).toInt32()); if ( nSlotId == SID_OPENDOC ) pFileNameItem = nullptr; } diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 1eded116d167..8b3d0792f70d 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -255,7 +255,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert aStr.append(pSlot->pUnoName).append('.').append(pType->aAttrib[nSub].pName); if ( rPropValue.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) ) { - sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID; + sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[nSub].nAID)); if ( bConvertTwips ) nSubId |= CONVERT_TWIPS; if ( pItem->PutValue( rPropValue.Value, nSubId ) ) @@ -372,7 +372,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert #ifdef DBG_UTIL ++nFoundArgs; #endif - sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID; + sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[nSub].nAID)); if ( bConvertTwips ) nSubId |= CONVERT_TWIPS; if (!pItem->PutValue( rProp.Value, nSubId ) ) @@ -1265,7 +1265,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b // complex type, add a property value for every member of the struct for ( sal_uInt16 n=1; n<=nSubCount; ++n ) { - sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[n-1].nAID; + sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[n-1].nAID)); if ( bConvertTwips ) nSubId |= CONVERT_TWIPS; @@ -1311,7 +1311,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b // complex type, add a property value for every member of the struct for ( sal_uInt16 n = 1; n <= nSubCount; ++n ) { - sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) rArg.pType->aAttrib[n-1].nAID; + sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(rArg.pType->aAttrib[n-1].nAID)); if ( bConvertTwips ) nSubId |= CONVERT_TWIPS; @@ -1429,12 +1429,12 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b if ( rSet.GetItemState( SID_VIEW_ID, false, &pItem ) == SfxItemState::SET ) { pValue[nActProp].Name = sViewId; - pValue[nActProp++].Value <<= (sal_Int16) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + pValue[nActProp++].Value <<= static_cast<sal_Int16>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); } if ( rSet.GetItemState( SID_PLUGIN_MODE, false, &pItem ) == SfxItemState::SET ) { pValue[nActProp].Name = sPluginMode; - pValue[nActProp++].Value <<= (sal_Int16) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + pValue[nActProp++].Value <<= static_cast<sal_Int16>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); } if ( rSet.GetItemState( SID_DOC_READONLY, false, &pItem ) == SfxItemState::SET ) { @@ -1548,12 +1548,12 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b if ( rSet.GetItemState( SID_MACROEXECMODE, false, &pItem ) == SfxItemState::SET ) { pValue[nActProp].Name = sMacroExecMode; - pValue[nActProp++].Value <<= (sal_Int16) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + pValue[nActProp++].Value <<= static_cast<sal_Int16>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); } if ( rSet.GetItemState( SID_UPDATEDOCMODE, false, &pItem ) == SfxItemState::SET ) { pValue[nActProp].Name = sUpdateDocMode; - pValue[nActProp++].Value <<= (sal_Int16) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + pValue[nActProp++].Value <<= static_cast<sal_Int16>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); } if ( rSet.GetItemState( SID_REPAIRPACKAGE, false, &pItem ) == SfxItemState::SET ) { diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 37391b4c3dee..07f0e1186a43 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -392,7 +392,7 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI // Read version char cToken = ','; sal_Int32 nPos = aWinData.indexOf( cToken ); - sal_uInt16 nActVersion = (sal_uInt16)aWinData.copy( 0, nPos + 1 ).toInt32(); + sal_uInt16 nActVersion = static_cast<sal_uInt16>(aWinData.copy( 0, nPos + 1 ).toInt32()); if ( nActVersion != nVersion ) return; @@ -408,12 +408,12 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI if ( nNextPos != -1 ) { // there is extra information - rInfo.nFlags = static_cast<SfxChildWindowFlags>((sal_uInt16)aWinData.copy( nPos+1, nNextPos - nPos - 1 ).toInt32()); + rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1, nNextPos - nPos - 1 ).toInt32())); aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, "" ); rInfo.aExtraString = aWinData; } else - rInfo.nFlags = static_cast<SfxChildWindowFlags>((sal_uInt16)aWinData.copy( nPos+1 ).toInt32()); + rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1 ).toInt32())); } } } @@ -581,7 +581,7 @@ bool SfxChildWinInfo::GetExtraData_Impl if ( aStr.isEmpty() ) return false; if ( pAlign ) - *pAlign = (SfxChildAlignment) (sal_uInt16) aStr.toInt32(); + *pAlign = (SfxChildAlignment) static_cast<sal_uInt16>(aStr.toInt32()); // then the LastAlignment nPos = aStr.indexOf(','); diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx index 05e1f92fa12d..dff4a7f9619f 100644 --- a/sfx2/source/appl/linksrc.cxx +++ b/sfx2/source/appl/linksrc.cxx @@ -149,7 +149,7 @@ bool SvLinkSource_EntryIter_Impl::IsValidCurrValue( SvLinkSource_Entry_Impl* pEn SvLinkSource_Entry_Impl* SvLinkSource_EntryIter_Impl::Next() { SvLinkSource_Entry_Impl* pRet = nullptr; - if( nPos + 1 < (sal_uInt16)aArr.size() ) + if( nPos + 1 < static_cast<sal_uInt16>(aArr.size()) ) { ++nPos; if( rOrigArr.size() == aArr.size() && diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index fc86a0711c93..e13437461fc9 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -209,7 +209,7 @@ namespace sfx2 { nStartPos = aBoundary.endPos; OUString sSearchToken( rSearchString.copy( - (sal_uInt16)aBoundary.startPos, (sal_uInt16)aBoundary.endPos - (sal_uInt16)aBoundary.startPos ) ); + static_cast<sal_uInt16>(aBoundary.startPos), static_cast<sal_uInt16>(aBoundary.endPos) - static_cast<sal_uInt16>(aBoundary.startPos) ) ); if ( !sSearchToken.isEmpty() && ( sSearchToken.getLength() > 1 || sSearchToken[0] != '.' ) ) { if ( bForSearch && sSearchToken[ sSearchToken.getLength() - 1 ] != '*' ) @@ -960,7 +960,7 @@ void SearchTabPage_Impl::dispose() nChecked = m_pScopeCB->IsChecked() ? 1 : 0; aUserData += OUString::number( nChecked ); aUserData += ";"; - sal_Int32 nCount = std::min( m_pSearchED->GetEntryCount(), (sal_Int32)10 ); // save only 10 entries + sal_Int32 nCount = std::min( m_pSearchED->GetEntryCount(), sal_Int32(10) ); // save only 10 entries for ( sal_Int32 i = 0; i < nCount; ++i ) { @@ -1430,7 +1430,7 @@ SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent) SvtViewOptions aViewOpt( EViewType::TabDialog, CONFIGNAME_INDEXWIN ); if ( aViewOpt.Exists() ) nPageId = aViewOpt.GetPageID(); - m_pTabCtrl->SetCurPageId( (sal_uInt16)nPageId ); + m_pTabCtrl->SetCurPageId( static_cast<sal_uInt16>(nPageId) ); ActivatePageHdl( m_pTabCtrl ); m_pActiveLB->SetSelectHdl( LINK( this, SfxHelpIndexWindow_Impl, SelectHdl ) ); @@ -1459,7 +1459,7 @@ void SfxHelpIndexWindow_Impl::dispose() delete static_cast<OUString*>(m_pActiveLB->GetEntryData(i)); SvtViewOptions aViewOpt( EViewType::TabDialog, CONFIGNAME_INDEXWIN ); - aViewOpt.SetPageID( (sal_Int32)m_pTabCtrl->GetCurPageId() ); + aViewOpt.SetPageID( static_cast<sal_Int32>(m_pTabCtrl->GetCurPageId()) ); disposeBuilder(); m_pActiveLB.clear(); @@ -1485,7 +1485,7 @@ void SfxHelpIndexWindow_Impl::Initialize() m_pActiveLB->SetEntryData( nPos, pFactory ); } - m_pActiveLB->SetDropDownLineCount( (sal_uInt16)aFactories.size() ); + m_pActiveLB->SetDropDownLineCount( static_cast<sal_uInt16>(aFactories.size()) ); if ( m_pActiveLB->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND ) SetActiveFactory(); } diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index b645c8820138..2aaccbc6001a 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -197,7 +197,7 @@ SfxPickListImpl::SfxPickListImpl( sal_uInt32 nAllowedMenuSize ) : m_nAllowedMenuSize( nAllowedMenuSize ) { m_xStringLength = new StringLength; - m_nAllowedMenuSize = ::std::min( m_nAllowedMenuSize, (sal_uInt32)PICKLIST_MAXSIZE ); + m_nAllowedMenuSize = ::std::min( m_nAllowedMenuSize, sal_uInt32(PICKLIST_MAXSIZE) ); StartListening( *SfxGetpApp() ); } diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index df323eeca6cc..be129dabac5f 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -399,7 +399,7 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo if ( iVersion >= 0 ) { - sal_Int16 uVersion = (sal_Int16)iVersion; + sal_Int16 uVersion = static_cast<sal_Int16>(iVersion); aArgs.realloc( ++nArgs ); aArgs[nArgs-1].Name = "Version"; diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 4e228b4ffd8b..1a2524a485f0 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1714,8 +1714,8 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, bool bEnabled, SfxVisibilityFlags nMode ) { - sal_uInt16 nInter = (sal_uInt16) ( lId >> 16 ); - sal_uInt16 nId = (sal_uInt16) ( lId & 0xFFFF ); + sal_uInt16 nInter = static_cast<sal_uInt16>( lId >> 16 ); + sal_uInt16 nId = static_cast<sal_uInt16>( lId & 0xFFFF ); SfxChildWin_Impl *pCW=nullptr; SfxWorkWindow *pWork = pParent; diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 1356c20fc231..c2511e29b541 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -755,7 +755,7 @@ std::size_t SfxBindings::GetSlotPos( sal_uInt16 nId, std::size_t nStartSearchAt { nMid = (nLow + nHigh) >> 1; DBG_ASSERT( nMid < pImpl->pCaches.size(), "bsearch is buggy" ); - int nDiff = (int) nId - (int) ( (pImpl->pCaches[nMid])->GetId() ); + int nDiff = static_cast<int>(nId) - static_cast<int>( (pImpl->pCaches[nMid])->GetId() ); if ( nDiff < 0) { if ( nMid == 0 ) break; diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 4fb228570b5e..e7dd16a45bd7 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -780,7 +780,7 @@ void SfxDispatcher::DoDeactivate_Impl(bool bMDI, SfxViewFrame const * pNew) { for (size_t n=0; n<xImp->aChildWins.size();) { - SfxChildWindow *pWin = pWorkWin->GetChildWindow_Impl( (sal_uInt16) ( xImp->aChildWins[n] & 0xFFFF ) ); + SfxChildWindow *pWin = pWorkWin->GetChildWindow_Impl( static_cast<sal_uInt16>( xImp->aChildWins[n] & 0xFFFF ) ); if (!pWin || pWin->GetAlignment() == SfxChildAlignment::NOALIGNMENT) xImp->aChildWins.erase(xImp->aChildWins.begin()+n); else @@ -1370,7 +1370,7 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne for ( nNo=0; pIFace && nNo<pIFace->GetChildWindowCount(); nNo++ ) { sal_uInt32 nId = pIFace->GetChildWindowId(nNo); - const SfxSlot *pSlot = pSlotPool->GetSlot( (sal_uInt16) nId ); + const SfxSlot *pSlot = pSlotPool->GetSlot( static_cast<sal_uInt16>(nId) ); SAL_WARN_IF( !pSlot, "sfx.control", "Childwindow slot missing: " << nId ); if ( bReadOnlyShell ) { @@ -1401,7 +1401,7 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne if ( bUIActive || bIsActive ) pWorkWin->SetChildWindowVisible_Impl( nId, true, nMode ); - if ( bUIActive || bIsActive || !pWorkWin->IsFloating( (sal_uInt16) ( nId & 0xFFFF ) ) ) + if ( bUIActive || bIsActive || !pWorkWin->IsFloating( static_cast<sal_uInt16>( nId & 0xFFFF ) ) ) xImp->aChildWins.push_back( nId ); } @@ -1630,7 +1630,7 @@ void SfxDispatcher::SetSlotFilter(SfxSlotFilterState nEnable, extern "C" int SfxCompareSIDs_Impl(const void* pSmaller, const void* pBigger) { - return ( (long) *static_cast<sal_uInt16 const *>(pSmaller) ) - ( (long) *static_cast<sal_uInt16 const *>(pBigger) ); + return static_cast<long>(*static_cast<sal_uInt16 const *>(pSmaller)) - static_cast<long>(*static_cast<sal_uInt16 const *>(pBigger)); } /** Searches for 'nSID' in the Filter set by <SetSlotFilter()> and @@ -2064,7 +2064,7 @@ SfxItemState SfxDispatcher::QueryState( sal_uInt16 nSID, css::uno::Any& rAny ) sal_uInt16 nWhich = rPool.GetWhich( nSID ); if ( rPool.GetMetric( nWhich ) == MapUnit::MapTwip ) nSubId |= CONVERT_TWIPS; - pItem->QueryValue( aState, (sal_uInt8)nSubId ); + pItem->QueryValue( aState, static_cast<sal_uInt8>(nSubId) ); } rAny = aState; diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index 5a04d69f5f90..46951bd9e6ad 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -38,15 +38,15 @@ extern "C" { static int SfxCompareSlots_qsort( const void* pSmaller, const void* pBigger ) { - return ( (int) static_cast<SfxSlot const *>(pSmaller)->GetSlotId() ) - - ( (int) static_cast<SfxSlot const *>(pBigger)->GetSlotId() ); + return static_cast<int>(static_cast<SfxSlot const *>(pSmaller)->GetSlotId()) - + static_cast<int>(static_cast<SfxSlot const *>(pBigger)->GetSlotId()); } static int SfxCompareSlots_bsearch( const void* pSmaller, const void* pBigger ) { - return ( (int) *static_cast<sal_uInt16 const *>(pSmaller) ) - - ( (int) static_cast<SfxSlot const *>(pBigger)->GetSlotId() ); + return static_cast<int>(*static_cast<sal_uInt16 const *>(pSmaller)) - + static_cast<int>(static_cast<SfxSlot const *>(pBigger)->GetSlotId()); } } diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index c6c34ca14667..5f0867e94cae 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -560,7 +560,7 @@ void SfxShell::SetVerbs(const css::uno::Sequence < css::embed::VerbDescriptor >& else pNewSlot->pNextSlot = pNewSlot; - pImpl->aSlotArr.insert(pImpl->aSlotArr.begin() + (sal_uInt16) n, std::unique_ptr<SfxSlot>(pNewSlot)); + pImpl->aSlotArr.insert(pImpl->aSlotArr.begin() + static_cast<sal_uInt16>(n), std::unique_ptr<SfxSlot>(pNewSlot)); } pImpl->aVerbList = aVerbs; diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 8bfdcf8c1edd..82b82c23e5ff 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -273,13 +273,13 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed) nScrBarWidth = mpScrBar->GetSizePixel().Width(); // calculate maximum number of visible columns - mnCols = (sal_uInt16)((aWinSize.Width()-nScrBarWidth) / (mnItemWidth)); + mnCols = static_cast<sal_uInt16>((aWinSize.Width()-nScrBarWidth) / (mnItemWidth)); if (!mnCols) mnCols = 1; // calculate maximum number of visible rows - mnVisLines = (sal_uInt16)(aWinSize.Height() / mnItemHeight); + mnVisLines = static_cast<sal_uInt16>(aWinSize.Height() / mnItemHeight); // calculate empty space long nHSpace = aWinSize.Width()-nScrBarWidth - mnCols*mnItemWidth; @@ -296,8 +296,8 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed) if ( mnLines <= mnVisLines ) mnFirstLine = 0; - else if ( mnFirstLine > (sal_uInt16)(mnLines-mnVisLines) ) - mnFirstLine = (sal_uInt16)(mnLines-mnVisLines); + else if ( mnFirstLine > static_cast<sal_uInt16>(mnLines-mnVisLines) ) + mnFirstLine = static_cast<sal_uInt16>(mnLines-mnVisLines); mbHasVisibleItems = true; @@ -400,7 +400,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed) mpScrBar->SetRangeMax( (nCurCount+mnCols-1)*mnFineness/mnCols); mpScrBar->SetVisibleSize( mnVisLines ); if (!bScrollBarUsed) - mpScrBar->SetThumbPos( (long)mnFirstLine*mnFineness ); + mpScrBar->SetThumbPos( static_cast<long>(mnFirstLine)*mnFineness ); long nPageSize = mnVisLines; if ( nPageSize < 1 ) nPageSize = 1; @@ -1077,14 +1077,14 @@ void ThumbnailView::SelectItem( sal_uInt16 nItemId ) // if necessary scroll to the visible area if (mbScroll && nItemId && mnCols) { - sal_uInt16 nNewLine = (sal_uInt16)(nItemPos / mnCols); + sal_uInt16 nNewLine = static_cast<sal_uInt16>(nItemPos / mnCols); if ( nNewLine < mnFirstLine ) { mnFirstLine = nNewLine; } - else if ( nNewLine > (sal_uInt16)(mnFirstLine+mnVisLines-1) ) + else if ( nNewLine > static_cast<sal_uInt16>(mnFirstLine+mnVisLines-1) ) { - mnFirstLine = (sal_uInt16)(nNewLine-mnVisLines+1); + mnFirstLine = static_cast<sal_uInt16>(nNewLine-mnVisLines+1); } } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 5f4c2edf5241..63df319437a5 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -816,7 +816,7 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, sal_uInt16 nSubId( 0 ); if ( eMapUnit == MapUnit::MapTwip ) nSubId |= CONVERT_TWIPS; - pItem->QueryValue( aEvent.Result, (sal_uInt8)nSubId ); + pItem->QueryValue( aEvent.Result, static_cast<sal_uInt8>(nSubId) ); } rListener->dispatchFinished( aEvent ); @@ -948,7 +948,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt if ( eMapUnit == MapUnit::MapTwip ) nSubId |= CONVERT_TWIPS; - pState->QueryValue( aState, (sal_uInt8)nSubId ); + pState->QueryValue( aState, static_cast<sal_uInt8>(nSubId) ); } else if ( eState == SfxItemState::DONTCARE ) { diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index fd0dcd6fd4a2..2de97e9910d0 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1712,7 +1712,7 @@ void CustomPropertiesWindow::Resize() sal_uInt16 CustomPropertiesWindow::GetVisibleLineCount() const { sal_Int32 nScrollOffset = GetLineHeight(); - sal_uInt16 nCount = ceil((double)GetSizePixel().Height() / nScrollOffset); + sal_uInt16 nCount = ceil(static_cast<double>(GetSizePixel().Height()) / nScrollOffset); return nCount; } @@ -2496,7 +2496,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ). IsNumberFormat( sValue, nIndex, dValue ); if ( bIsNum ) - seqValue[k] = (sal_Int64) dValue; + seqValue[k] = static_cast<sal_Int64>(dValue); } aPropertiesSeq[i].Value <<= seqValue; } diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index d54acfd7688f..e4ba1463a909 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -896,7 +896,7 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo) pImpl->aWinState = pInfo->aWinState; // check for valid alignment - SfxChildAlignment eLocalAlignment = (SfxChildAlignment) (sal_uInt16) aStr.toInt32(); + SfxChildAlignment eLocalAlignment = (SfxChildAlignment) static_cast<sal_uInt16>(aStr.toInt32()); bool bIgnoreFloatConfig = (eLocalAlignment == SfxChildAlignment::NOALIGNMENT && !StyleSettings::GetDockingFloatsSupported()); if (pImpl->bDockingPrevented || bIgnoreFloatConfig) @@ -918,7 +918,7 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo) if ( nPos != -1 ) { aStr = aStr.copy(nPos+1); - pImpl->SetLastAlignment( (SfxChildAlignment) (sal_uInt16) aStr.toInt32() ); + pImpl->SetLastAlignment( (SfxChildAlignment) static_cast<sal_uInt16>(aStr.toInt32()) ); } nPos = aStr.indexOf(','); @@ -929,8 +929,8 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo) aStr = aStr.copy(nPos+1); if ( GetPosSizeFromString( aStr, aPos, pImpl->aSplitSize ) ) { - pImpl->nLine = pImpl->nDockLine = (sal_uInt16) aPos.X(); - pImpl->nPos = pImpl->nDockPos = (sal_uInt16) aPos.Y(); + pImpl->nLine = pImpl->nDockLine = static_cast<sal_uInt16>(aPos.X()); + pImpl->nPos = pImpl->nDockPos = static_cast<sal_uInt16>(aPos.Y()); pImpl->nVerticalSize = pImpl->aSplitSize.Height(); pImpl->nHorizontalSize = pImpl->aSplitSize.Width(); if ( GetSplitSizeFromString( aStr, pImpl->aSplitSize )) diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 4fbec31928ae..9871ab45cc3e 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -647,7 +647,7 @@ void FileDialogHelper_Impl::updateVersions() ControlActions::ADD_ITEMS, aValue ); Any aPos; - aPos <<= (sal_Int32) 0; + aPos <<= sal_Int32(0); xDlg->setValue( ExtendedFilePickerElementIds::LISTBOX_VERSION, ControlActions::SET_SELECT_ITEM, aPos ); } @@ -693,8 +693,8 @@ IMPL_LINK_NOARG(FileDialogHelper_Impl, TimeOutHdl_Impl, Timer *, void) sal_Int32 nBmpWidth = aBmp.GetSizePixel().Width(); sal_Int32 nBmpHeight = aBmp.GetSizePixel().Height(); - double nXRatio = (double) nOutWidth / nBmpWidth; - double nYRatio = (double) nOutHeight / nBmpHeight; + double nXRatio = static_cast<double>(nOutWidth) / nBmpWidth; + double nYRatio = static_cast<double>(nOutHeight) / nBmpHeight; if ( nXRatio < nYRatio ) aBmp.Scale( nXRatio, nXRatio ); @@ -1479,7 +1479,7 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList, sal_Int32 nVersion = 0; if ( ( aValue >>= nVersion ) && nVersion > 0 ) // open a special version; 0 == current version - rpSet->Put( SfxInt16Item( SID_VERSION, (short)nVersion ) ); + rpSet->Put( SfxInt16Item( SID_VERSION, static_cast<short>(nVersion) ) ); } catch( const IllegalArgumentException& ){} } @@ -1970,7 +1970,7 @@ void FileDialogHelper_Impl::saveConfig() aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0 ); bool bValue = false; aValue >>= bValue; - SetToken( aUserData, 1, ' ', OUString::number( (sal_Int32) bValue ) ); + SetToken( aUserData, 1, ' ', OUString::number( static_cast<sal_Int32>(bValue) ) ); INetURLObject aObj( getPath() ); @@ -2006,7 +2006,7 @@ void FileDialogHelper_Impl::saveConfig() aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0 ); bool bAutoExt = true; aValue >>= bAutoExt; - SetToken( aUserData, 0, ' ', OUString::number( (sal_Int32) bAutoExt ) ); + SetToken( aUserData, 0, ' ', OUString::number( static_cast<sal_Int32>(bAutoExt) ) ); bWriteConfig = true; } catch( const IllegalArgumentException& ){} @@ -2031,7 +2031,7 @@ void FileDialogHelper_Impl::saveConfig() aValue >>= bSelection; if ( comphelper::string::getTokenCount(aUserData, ' ') < 3 ) aUserData += " "; - SetToken( aUserData, 2, ' ', OUString::number( (sal_Int32) bSelection ) ); + SetToken( aUserData, 2, ' ', OUString::number( static_cast<sal_Int32>(bSelection) ) ); bWriteConfig = true; } catch( const IllegalArgumentException& ){} @@ -2156,7 +2156,7 @@ void FileDialogHelper_Impl::loadConfig() if ( mbHasAutoExt ) { sal_Int32 nFlag = aUserData.getToken( 0, ' ' ).toInt32(); - aValue <<= (bool) nFlag; + aValue <<= static_cast<bool>(nFlag); try { xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue ); @@ -2167,7 +2167,7 @@ void FileDialogHelper_Impl::loadConfig() if( mbHasSelectionBox ) { sal_Int32 nFlag = aUserData.getToken( 2, ' ' ).toInt32(); - aValue <<= (bool) nFlag; + aValue <<= static_cast<bool>(nFlag); try { xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0, aValue ); diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index 04e09f66807b..213ede3684eb 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -877,7 +877,7 @@ namespace sfx2 std::shared_ptr<const SfxFilter> TSortedFilterList::impl_getFilter(sal_Int32 nIndex) { - if (nIndex<0 || nIndex>=(sal_Int32)m_lFilters.size()) + if (nIndex<0 || nIndex>=static_cast<sal_Int32>(m_lFilters.size())) return nullptr; const OUString& sFilterName = m_lFilters[nIndex]; if (sFilterName.isEmpty()) @@ -1021,7 +1021,7 @@ namespace sfx2 if ( !aImportantFilterGroup.empty() ) { Sequence< StringPair > aFilters( aImportantFilterGroup.size() ); - for ( sal_Int32 i = 0; i < (sal_Int32)aImportantFilterGroup.size(); i++ ) + for ( sal_Int32 i = 0; i < static_cast<sal_Int32>(aImportantFilterGroup.size()); i++ ) { aFilters[i].First = addExtension( aImportantFilterGroup[i].aUIName, aImportantFilterGroup[i].aWildcard, @@ -1041,7 +1041,7 @@ namespace sfx2 if ( !aFilterGroup.empty() ) { Sequence< StringPair > aFilters( aFilterGroup.size() ); - for ( sal_Int32 i = 0; i < (sal_Int32)aFilterGroup.size(); i++ ) + for ( sal_Int32 i = 0; i < static_cast<sal_Int32>(aFilterGroup.size()); i++ ) { aFilters[i].First = addExtension( aFilterGroup[i].aUIName, aFilterGroup[i].aWildcard, @@ -1063,7 +1063,7 @@ namespace sfx2 // Fallback solution just add both filter groups as single filters sal_Int32 n; - for ( n = 0; n < (sal_Int32)aImportantFilterGroup.size(); n++ ) + for ( n = 0; n < static_cast<sal_Int32>(aImportantFilterGroup.size()); n++ ) { try { @@ -1081,7 +1081,7 @@ namespace sfx2 } } - for ( n = 0; n < (sal_Int32)aFilterGroup.size(); n++ ) + for ( n = 0; n < static_cast<sal_Int32>(aFilterGroup.size()); n++ ) { try { diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx index 1f7cc583ad87..347629fc7615 100644 --- a/sfx2/source/dialog/passwd.cxx +++ b/sfx2/source/dialog/passwd.cxx @@ -157,7 +157,7 @@ void SfxPasswordDialog::SetPasswdText( ) else { maMainPwdStr = maMinLenPwdStr; - maMainPwdStr = maMainPwdStr.replaceAll( "$(MINLEN)", OUString::number((sal_Int32) mnMinLen ) ); + maMainPwdStr = maMainPwdStr.replaceAll( "$(MINLEN)", OUString::number(static_cast<sal_Int32>(mnMinLen) ) ); mpMinLengthFT->SetText(maMainPwdStr); } } diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx index 5e6a0ece8ab7..8b8538b92ee3 100644 --- a/sfx2/source/dialog/printopt.cxx +++ b/sfx2/source/dialog/printopt.cxx @@ -232,7 +232,7 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu { if( nDPI >= aDPIArray[ i ] ) { - m_pReduceBitmapsResolutionLB->SelectEntryPos( (sal_uInt16) i ); + m_pReduceBitmapsResolutionLB->SelectEntryPos( static_cast<sal_uInt16>(i) ); i = -1; } } @@ -255,7 +255,7 @@ void SfxCommonPrintOptionsTabPage::ImplSaveControls( PrinterOptions* pCurrentOpt pCurrentOptions->SetReducedTransparencyMode( m_pReduceTransparencyAutoRB->IsChecked() ? PrinterTransparencyMode::Auto : PrinterTransparencyMode::NONE ); pCurrentOptions->SetReduceGradients( m_pReduceGradientsCB->IsChecked() ); pCurrentOptions->SetReducedGradientMode( m_pReduceGradientsStripesRB->IsChecked() ? PrinterGradientMode::Stripes : PrinterGradientMode::Color ); - pCurrentOptions->SetReducedGradientStepCount( (sal_uInt16) m_pReduceGradientsStepCountNF->GetValue() ); + pCurrentOptions->SetReducedGradientStepCount( static_cast<sal_uInt16>(m_pReduceGradientsStepCountNF->GetValue()) ); pCurrentOptions->SetReduceBitmaps( m_pReduceBitmapsCB->IsChecked() ); pCurrentOptions->SetReducedBitmapMode( m_pReduceBitmapsOptimalRB->IsChecked() ? PrinterBitmapMode::Optimal : ( m_pReduceBitmapsNormalRB->IsChecked() ? PrinterBitmapMode::Normal : PrinterBitmapMode::Resolution ) ); diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 686df19aaa55..5b9dcaf873e0 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -235,24 +235,24 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl, aWinData = aTemp; if ( aWinData.startsWith("V") ) { - pEmptyWin->nState = (sal_uInt16) aWinData.getToken( 1, ',' ).toInt32(); + pEmptyWin->nState = static_cast<sal_uInt16>(aWinData.getToken( 1, ',' ).toInt32()); if ( pEmptyWin->nState & 2 ) pEmptyWin->bFadeIn = true; bPinned = true; // always assume pinned - floating mode not used anymore sal_uInt16 i=2; - sal_uInt16 nCount = (sal_uInt16) aWinData.getToken(i++, ',').toInt32(); + sal_uInt16 nCount = static_cast<sal_uInt16>(aWinData.getToken(i++, ',').toInt32()); for ( sal_uInt16 n=0; n<nCount; n++ ) { SfxDock_Impl *pDock = new SfxDock_Impl; pDock->pWin = nullptr; pDock->bNewLine = false; pDock->bHide = true; - pDock->nType = (sal_uInt16) aWinData.getToken(i++, ',').toInt32(); + pDock->nType = static_cast<sal_uInt16>(aWinData.getToken(i++, ',').toInt32()); if ( !pDock->nType ) { // could mean NewLine - pDock->nType = (sal_uInt16) aWinData.getToken(i++, ',').toInt32(); + pDock->nType = static_cast<sal_uInt16>(aWinData.getToken(i++, ',').toInt32()); if ( !pDock->nType ) { // Read error @@ -463,7 +463,7 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize { // Not known until now in which real line it is located GetWindowPos( rDock.pWin, nL, nPos ); - nLine = (short) nL; + nLine = static_cast<short>(nL); } if ( !pFoundDock ) diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx index 3e1ead28c63c..39993c970f3d 100644 --- a/sfx2/source/dialog/srchdlg.cxx +++ b/sfx2/source/dialog/srchdlg.cxx @@ -32,7 +32,7 @@ using namespace ::com::sun::star::uno; namespace sfx2 { -#define MAX_SAVE_COUNT (sal_uInt16)10 +#define MAX_SAVE_COUNT sal_uInt16(10) // SearchDialog diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 784a0c274b45..ff154a9bc2bb 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -577,7 +577,7 @@ void SfxTabDialog::Start_Impl() SetWindowState(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_ASCII_US)); // initial TabPage from Program/Help/config - nActPage = (sal_uInt16)aDlgOpt.GetPageID(); + nActPage = static_cast<sal_uInt16>(aDlgOpt.GetPageID()); if ( USHRT_MAX != m_nAppPageId ) nActPage = m_nAppPageId; diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index a5864f2cc84c..c5da37418639 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -336,7 +336,7 @@ void SfxVersionDialog::Open_Impl() SvTreeListEntry *pEntry = m_pVersionBox->FirstSelected(); sal_uIntPtr nPos = SvTreeList::GetRelPos( pEntry ); - SfxInt16Item aItem( SID_VERSION, (short)nPos+1 ); + SfxInt16Item aItem( SID_VERSION, static_cast<short>(nPos)+1 ); SfxStringItem aTarget( SID_TARGETNAME, "_blank" ); SfxStringItem aReferer( SID_REFERER, "private:user" ); SfxStringItem aFile( SID_FILE_NAME, pObjShell->GetMedium()->GetName() ); @@ -432,7 +432,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton, void ) { SfxAllItemSet aSet( pObjShell->GetPool() ); sal_uIntPtr nPos = SvTreeList::GetRelPos( pEntry ); - aSet.Put( SfxInt16Item( SID_VERSION, (short)nPos+1 ) ); + aSet.Put( SfxInt16Item( SID_VERSION, static_cast<short>(nPos)+1 ) ); aSet.Put( SfxStringItem( SID_FILE_NAME, pObjShell->GetMedium()->GetName() ) ); SfxItemSet* pSet = pObjShell->GetMedium()->GetItemSet(); diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index a4ead8ff3e37..f190667ee87f 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -285,7 +285,7 @@ std::shared_ptr<const SfxFilter> SfxObjectFactory::GetTemplateFilter() const if( pTemp->IsOwnFormat() && pTemp->IsOwnTemplateFormat() && ( pTemp->GetVersion() > nVersion ) ) { pFilter = pTemp; - nVersion = (sal_uInt16) pTemp->GetVersion(); + nVersion = static_cast<sal_uInt16>(pTemp->GetVersion()); } pTemp = aIter.Next(); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 865fc60a0b71..e862a88ecabe 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1435,7 +1435,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo ) // current version short nVersion = pVersion ? pVersion->GetValue() : 0; if ( nVersion<0 ) - nVersion = ( (short) pImpl->aVersions.getLength() ) + nVersion; + nVersion = static_cast<short>(pImpl->aVersions.getLength()) + nVersion; else if ( nVersion ) nVersion--; @@ -1746,7 +1746,7 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, { Reference< XInputStream > aTempInput = aTempCont.openStream(); bTransactStarted = true; - aOriginalContent.setPropertyValue( "Size", uno::makeAny( (sal_Int64)0 ) ); + aOriginalContent.setPropertyValue( "Size", uno::makeAny( sal_Int64(0) ) ); aOriginalContent.writeStream( aTempInput, bOverWrite ); bResult = true; } diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index fc0432dd43c5..2ddb5b876164 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -279,7 +279,7 @@ IMPL_LINK_NOARG(DocumentInserter, DialogClosedHdl, sfx2::FileDialogHelper*, void sal_Int32 nVersion = 0; if ( ( aValue >>= nVersion ) && nVersion > 0 ) // open a special version; 0 == current version - m_pItemSet->Put( SfxInt16Item( SID_VERSION, (short)nVersion ) ); + m_pItemSet->Put( SfxInt16Item( SID_VERSION, static_cast<short>(nVersion) ) ); } catch( const IllegalArgumentException& ){} } diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index f5beabedfe78..5f82dde5827c 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -1500,7 +1500,7 @@ void SfxDocTemplate_Impl::AddRegion( const OUString& rTitle, RegionData_Impl* pRegion; pRegion = new RegionData_Impl( this, rTitle ); - if ( ! InsertRegion( pRegion, (size_t)-1 ) ) + if ( ! InsertRegion( pRegion, size_t(-1) ) ) { delete pRegion; return; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 1da245af8a2e..9faeef85804e 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -515,7 +515,7 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceDefaultFilter { ::comphelper::SequenceAsHashMap aFiltHM( aProps ); SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aFiltHM.getUnpackedValueOrDefault("Flags", - (sal_Int32)0 )); + sal_Int32(0) )); if ( ( ( nFlags & nMust ) == nMust ) && !( nFlags & nDont ) ) aFilterProps = aProps; } @@ -735,13 +735,13 @@ sal_Int8 ModelData_Impl::CheckFilter( const OUString& aFilterName ) m_pOwner->GetFilterConfiguration()->getByName( aFilterName ) >>= aFilterProps; aFiltPropsHM = ::comphelper::SequenceAsHashMap( aFilterProps ); - nFiltFlags = static_cast<SfxFilterFlags>(aFiltPropsHM.getUnpackedValueOrDefault("Flags", (sal_Int32)0 )); + nFiltFlags = static_cast<SfxFilterFlags>(aFiltPropsHM.getUnpackedValueOrDefault("Flags", sal_Int32(0) )); } // only a temporary solution until default filter retrieving feature is implemented // then GetDocServiceDefaultFilter() must be used ::comphelper::SequenceAsHashMap aDefFiltPropsHM = GetDocServiceDefaultFilterCheckFlags( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT, SfxFilterFlags::NONE ); - SfxFilterFlags nDefFiltFlags = static_cast<SfxFilterFlags>(aDefFiltPropsHM.getUnpackedValueOrDefault("Flags", (sal_Int32)0 )); + SfxFilterFlags nDefFiltFlags = static_cast<SfxFilterFlags>(aDefFiltPropsHM.getUnpackedValueOrDefault("Flags", sal_Int32(0) )); // if the old filter is not acceptable // and there is no default filter or it is not acceptable for requested parameters then proceed with saveAs @@ -770,7 +770,7 @@ sal_Int8 ModelData_Impl::CheckFilter( const OUString& aFilterName ) if ( aPreusedFilterName != aFilterName && aUIName != aDefUIName ) { if ( !SfxStoringHelper::WarnUnacceptableFormat( GetModel(), aUIName, aDefExtension, - (bool)( nDefFiltFlags & SfxFilterFlags::ALIEN ) ) ) + static_cast<bool>( nDefFiltFlags & SfxFilterFlags::ALIEN ) ) ) return STATUS_SAVEAS_STANDARDNAME; } } @@ -941,7 +941,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, m_pOwner->GetFilterConfiguration()->getByName( aOldFilterName ) >>= aOldFilterProps; ::comphelper::SequenceAsHashMap aOldFiltPropsHM( aOldFilterProps ); - SfxFilterFlags nOldFiltFlags = static_cast<SfxFilterFlags>(aOldFiltPropsHM.getUnpackedValueOrDefault("Flags", (sal_Int32)0 )); + SfxFilterFlags nOldFiltFlags = static_cast<SfxFilterFlags>(aOldFiltPropsHM.getUnpackedValueOrDefault("Flags", sal_Int32(0) )); if ( bSetStandardName || ( nOldFiltFlags & nMust ) != nMust || bool(nOldFiltFlags & nDont) ) { diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 1d65791ff158..5f0837000902 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -187,7 +187,7 @@ sal_Bool SAL_CALL IFrameObject::load( uno::Sequence < beans::PropertyValue > aProps(2); aProps[0].Name = "PluginMode"; - aProps[0].Value <<= (sal_Int16) 2; + aProps[0].Value <<= sal_Int16(2); aProps[1].Name = "ReadOnly"; aProps[1].Value <<= true; uno::Reference < frame::XDispatch > xDisp = mxFrame->queryDispatch( aTargetURL, "_self", 0 ); @@ -361,12 +361,12 @@ uno::Any SAL_CALL IFrameObject::getPropertyValue(const OUString& aPropertyName) break; case WID_FRAME_MARGIN_WIDTH: { - aAny <<= (sal_Int32 ) maFrmDescr.GetMargin().Width(); + aAny <<= static_cast<sal_Int32>(maFrmDescr.GetMargin().Width()); } break; case WID_FRAME_MARGIN_HEIGHT: { - aAny <<= (sal_Int32 ) maFrmDescr.GetMargin().Height(); + aAny <<= static_cast<sal_Int32>(maFrmDescr.GetMargin().Height()); } break; default: ; diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 779296f35e7c..a383427ae0c5 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2925,7 +2925,7 @@ void SfxBaseModel::impl_store( const OUString& sURL // TODO/LATER: the sequence of PropertyValue should replace the hash completely in future sal_Int32 nMPHTmp = 0; pModifyPasswordInfoItem->GetValue() >>= nMPHTmp; - nModifyPasswordHash = (sal_uInt32)nMPHTmp; + nModifyPasswordHash = static_cast<sal_uInt32>(nMPHTmp); pModifyPasswordInfoItem->GetValue() >>= aModifyPasswordInfo; } pItemSet->ClearItem(SID_MODIFYPASSWORDINFO); diff --git a/sfx2/source/doc/zoomitem.cxx b/sfx2/source/doc/zoomitem.cxx index b86c738e3c5f..a94f92ec5d42 100644 --- a/sfx2/source/doc/zoomitem.cxx +++ b/sfx2/source/doc/zoomitem.cxx @@ -82,7 +82,7 @@ bool SvxZoomItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const break; } - case MID_VALUE: rVal <<= (sal_Int32) GetValue(); break; + case MID_VALUE: rVal <<= static_cast<sal_Int32>(GetValue()); break; case MID_VALUESET: rVal <<= (sal_Int16) nValueSet; break; case MID_TYPE: rVal <<= (sal_Int16) eType; break; default: @@ -129,7 +129,7 @@ bool SvxZoomItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) if ( bAllConverted && nConvertedCount == ZOOM_PARAMS ) { - SetValue( (sal_uInt16)nValueTmp ); + SetValue( static_cast<sal_uInt16>(nValueTmp) ); nValueSet = static_cast<SvxZoomEnableFlags>(nValueSetTmp); eType = static_cast<SvxZoomType>(nTypeTmp); return true; @@ -142,7 +142,7 @@ bool SvxZoomItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int32 nVal = 0; if ( rVal >>= nVal ) { - SetValue( (sal_uInt16)nVal ); + SetValue( static_cast<sal_uInt16>(nVal) ); return true; } else diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx index c50bd6fdd226..5f5f19228d27 100644 --- a/sfx2/source/inc/workwin.hxx +++ b/sfx2/source/inc/workwin.hxx @@ -112,8 +112,8 @@ struct SfxChildWin_Impl bool bEnable; SfxChildWin_Impl( sal_uInt32 nID ) : - nSaveId((sal_uInt16) (nID & 0xFFFF) ), - nInterfaceId((sal_uInt16) (nID >> 16)), + nSaveId(static_cast<sal_uInt16>(nID & 0xFFFF) ), + nInterfaceId(static_cast<sal_uInt16>(nID >> 16)), nId(nSaveId), pWin(nullptr), bCreate(false), diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx index 2f7d7e1abc9f..44d8afcfe7c7 100644 --- a/sfx2/source/sidebar/SidebarToolBox.cxx +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -245,7 +245,7 @@ IMPL_LINK(SidebarToolBox, SelectHandler, ToolBox*, pToolBox, void) Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId())); if (xController.is()) - xController->execute((sal_Int16)pToolBox->GetModifier()); + xController->execute(static_cast<sal_Int16>(pToolBox->GetModifier())); } IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void) diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 4e03ee9cb3d0..6306380fd976 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -296,7 +296,7 @@ sal_Bool SAL_CALL SfxStatusBarControl::mouseButtonDown( ::Point aPos( rMouseEvent.X, rMouseEvent.Y ); ::MouseEvent aMouseEvent( aPos, - (sal_uInt16)rMouseEvent.ClickCount, + static_cast<sal_uInt16>(rMouseEvent.ClickCount), MouseEventModifiers::NONE, convertAwtToVCLMouseButtons( rMouseEvent.Buttons ), 0 ); @@ -312,7 +312,7 @@ sal_Bool SAL_CALL SfxStatusBarControl::mouseMove( ::Point aPos( rMouseEvent.X, rMouseEvent.Y ); ::MouseEvent aMouseEvent( aPos, - (sal_uInt16)rMouseEvent.ClickCount, + static_cast<sal_uInt16>(rMouseEvent.ClickCount), MouseEventModifiers::NONE, convertAwtToVCLMouseButtons( rMouseEvent.Buttons ), 0 ); @@ -327,7 +327,7 @@ sal_Bool SAL_CALL SfxStatusBarControl::mouseButtonUp( ::Point aPos( rMouseEvent.X, rMouseEvent.Y ); ::MouseEvent aMouseEvent( aPos, - (sal_uInt16)rMouseEvent.ClickCount, + static_cast<sal_uInt16>(rMouseEvent.ClickCount), MouseEventModifiers::NONE, convertAwtToVCLMouseButtons( rMouseEvent.Buttons ), 0 ); diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index aa850909e03d..4a08477c5339 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -529,7 +529,7 @@ void SAL_CALL SfxToolBoxControl::statusChanged( const FeatureStateEvent& rEvent void SAL_CALL SfxToolBoxControl::execute( sal_Int16 KeyModifier ) { SolarMutexGuard aGuard; - Select( (sal_uInt16)KeyModifier ); + Select( static_cast<sal_uInt16>(KeyModifier) ); } void SAL_CALL SfxToolBoxControl::click() diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index ab0f73e38434..af0e596a2440 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -304,7 +304,7 @@ void SfxFrame::GetViewData_Impl() } if ( pViewFrame->GetCurViewId() ) - pSet->Put( SfxUInt16Item( SID_VIEW_ID, (sal_uInt16)pViewFrame->GetCurViewId() ) ); + pSet->Put( SfxUInt16Item( SID_VIEW_ID, static_cast<sal_uInt16>(pViewFrame->GetCurViewId()) ) ); } } diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 51763ea50f03..663d9bfef299 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -242,7 +242,7 @@ SfxFrame* SfxFrame::Create( SfxObjectShell const & rDoc, vcl::Window& rWindow, S aArgs.put( "Model", rDoc.GetModel() ); aArgs.put( "Hidden", bHidden ); if ( nViewId != SFX_INTERFACE_NONE ) - aArgs.put( "ViewId", (sal_uInt16)nViewId ); + aArgs.put( "ViewId", static_cast<sal_uInt16>(nViewId) ); aLoadArgs = aArgs.getPropertyValues(); diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 6fd6a7699038..b84496be2c27 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -32,7 +32,7 @@ int SfxLokHelper::createView() SfxViewShell* pViewShell = SfxViewShell::Current(); if (!pViewShell) return -1; - return (sal_Int32)pViewShell->GetViewShellId(); + return static_cast<sal_Int32>(pViewShell->GetViewShellId()); } void SfxLokHelper::destroyView(int nId) @@ -46,7 +46,7 @@ void SfxLokHelper::destroyView(int nId) for (SfxViewShell* pViewShell : rViewArr) { - if ((sal_Int32)pViewShell->GetViewShellId() == nViewShellId) + if (static_cast<sal_Int32>(pViewShell->GetViewShellId()) == nViewShellId) { SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); SfxRequest aRequest(pViewFrame, SID_CLOSEWIN); @@ -67,7 +67,7 @@ void SfxLokHelper::setView(int nId) for (SfxViewShell* pViewShell : rViewArr) { - if ((sal_Int32)pViewShell->GetViewShellId() == nViewShellId) + if (static_cast<sal_Int32>(pViewShell->GetViewShellId()) == nViewShellId) { // update the current LOK language for the dialog tunneling comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); @@ -96,7 +96,7 @@ int SfxLokHelper::getView(SfxViewShell* pViewShell) if (!pViewShell) return -1; - return (sal_Int32)pViewShell->GetViewShellId(); + return static_cast<sal_Int32>(pViewShell->GetViewShellId()); } std::size_t SfxLokHelper::getViewsCount() @@ -118,7 +118,7 @@ bool SfxLokHelper::getViewIds(int* pArray, size_t nSize) for (std::size_t i = 0; i < rViewArr.size(); ++i) { SfxViewShell* pViewShell = rViewArr[i]; - pArray[i] = (sal_Int32)pViewShell->GetViewShellId(); + pArray[i] = static_cast<sal_Int32>(pViewShell->GetViewShellId()); } return true; } @@ -194,7 +194,7 @@ void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OStri if (comphelper::LibreOfficeKit::isPartInInvalidation()) { aBuf.append(", "); - aBuf.append((sal_Int32) pThisView->getPart()); + aBuf.append(static_cast<sal_Int32>(pThisView->getPart())); } pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, aBuf.makeStringAndClear().getStr()); } diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 145caa12f666..827ec6237081 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -173,7 +173,7 @@ sal_Int16 MapGroupIDToCommandGroup( SfxGroupId nGroupID ) sal_uInt32 Get10ThSec() { - sal_uInt32 n10Ticks = 10 * (sal_uInt32)clock(); + sal_uInt32 n10Ticks = 10 * static_cast<sal_uInt32>(clock()); return n10Ticks / CLOCKS_PER_SEC; } @@ -777,7 +777,7 @@ Reference< frame::XDispatch > SAL_CALL SfxBaseController::queryDispatch( const } else if ( aURL.Protocol == "slot:" ) { - sal_uInt16 nId = (sal_uInt16) aURL.Path.toInt32(); + sal_uInt16 nId = static_cast<sal_uInt16>(aURL.Path.toInt32()); pAct = m_pData->m_pViewShell->GetViewFrame() ; if (nId >= SID_VERB_START && nId <= SID_VERB_END) diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 7ebc86176495..0f05946039f2 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1533,7 +1533,7 @@ void SfxViewShell::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("SfxViewShell")); xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number((sal_Int32)GetViewShellId()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number(static_cast<sal_Int32>(GetViewShellId())).getStr())); xmlTextWriterEndElement(pWriter); } |