summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:29:48 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:29:48 +0100
commite662242ec057ef5f922507866a88819e984fd131 (patch)
treef2c65bdb822a7da6eb1675c684825f69fbbefeca /basctl
parenta82b177f981f14582d88e819ce8c167f9db0c213 (diff)
More loplugin:cstylecast: basctl
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: I3bddf4b08e064dead05eae87619db2232744d7f8
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2.cxx10
-rw-r--r--basctl/source/basicide/baside2b.cxx16
-rw-r--r--basctl/source/basicide/basides1.cxx6
-rw-r--r--basctl/source/basicide/basides2.cxx2
-rw-r--r--basctl/source/basicide/basides3.cxx2
-rw-r--r--basctl/source/basicide/basidesh.cxx2
-rw-r--r--basctl/source/basicide/breakpoint.cxx2
-rw-r--r--basctl/source/basicide/brkdlg.cxx2
-rw-r--r--basctl/source/basicide/linenumberwindow.cxx2
-rw-r--r--basctl/source/basicide/moduldl2.cxx2
-rw-r--r--basctl/source/dlged/dlged.cxx16
-rw-r--r--basctl/source/dlged/dlgedfac.cxx4
-rw-r--r--basctl/source/dlged/dlgedobj.cxx6
13 files changed, 36 insertions, 36 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index ad26c8d3518e..a2415818def2 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -498,12 +498,12 @@ void ModulWindow::ToggleBreakPoint( sal_uLong nLine )
BreakPoint* pBrk = GetBreakPoints().FindBreakPoint( nLine );
if ( pBrk ) // remove
{
- m_xModule->ClearBP( (sal_uInt16)nLine );
+ m_xModule->ClearBP( static_cast<sal_uInt16>(nLine) );
delete GetBreakPoints().remove( pBrk );
}
else // create one
{
- if ( m_xModule->SetBP( (sal_uInt16)nLine) )
+ if ( m_xModule->SetBP( static_cast<sal_uInt16>(nLine)) )
{
GetBreakPoints().InsertSorted( new BreakPoint( nLine ) );
if ( StarBASIC::IsRunning() )
@@ -529,9 +529,9 @@ void ModulWindow::UpdateBreakPoint( const BreakPoint& rBrk )
CheckCompileBasic();
if ( rBrk.bEnabled )
- m_xModule->SetBP( (sal_uInt16)rBrk.nLine );
+ m_xModule->SetBP( static_cast<sal_uInt16>(rBrk.nLine) );
else
- m_xModule->ClearBP( (sal_uInt16)rBrk.nLine );
+ m_xModule->ClearBP( static_cast<sal_uInt16>(rBrk.nLine) );
}
}
@@ -718,7 +718,7 @@ void ModulWindow::EditMacro( const OUString& rMacroName )
{
long nMaxY = pView->GetTextEngine()->GetTextHeight() - nVisHeight;
long nOldStartY = pView->GetStartDocPos().Y();
- long nNewStartY = (long)nStart * pView->GetTextEngine()->GetCharHeight();
+ long nNewStartY = static_cast<long>(nStart) * pView->GetTextEngine()->GetCharHeight();
nNewStartY = std::min( nNewStartY, nMaxY );
pView->Scroll( 0, -(nNewStartY-nOldStartY) );
pView->ShowCursor( false );
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 1163c94d9aca..b4036f27f159 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -354,13 +354,13 @@ void EditorWindow::RequestHelp( const HelpEvent& rHEvt )
if (SbxVariable const* pVar = IsSbxVariable(pSBX))
{
SbxDataType eType = pVar->GetType();
- if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT )
+ if ( static_cast<sal_uInt8>(eType) == sal_uInt8(SbxOBJECT) )
// might cause a crash e. g. at the selections-object
// Type == Object does not mean pVar == Object!
; // aHelpText = ((SbxObject*)pVar)->GetClassName();
else if ( eType & SbxARRAY )
; // aHelpText = "{...}";
- else if ( (sal_uInt8)eType != (sal_uInt8)SbxEMPTY )
+ else if ( static_cast<sal_uInt8>(eType) != sal_uInt8(SbxEMPTY) )
{
aHelpText = pVar->GetName();
if ( aHelpText.isEmpty() ) // name is not copied with the passed parameters
@@ -1291,7 +1291,7 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, bool bInserted )
}
else
{
- rModulWindow.GetBreakPoints().AdjustBreakPoints( (sal_uInt16)nPara+1, bInserted );
+ rModulWindow.GetBreakPoints().AdjustBreakPoints( static_cast<sal_uInt16>(nPara)+1, bInserted );
long nLineHeight = GetTextHeight();
Size aSz = rModulWindow.GetBreakPointWindow().GetOutputSize();
@@ -1441,7 +1441,7 @@ void BreakPointWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
long nYPos = aMousePos.Y() + nCurYOffset;
long nLine = nYPos / nLineHeight + 1;
- rModulWindow.ToggleBreakPoint( (sal_uLong)nLine );
+ rModulWindow.ToggleBreakPoint( static_cast<sal_uLong>(nLine) );
Invalidate();
}
}
@@ -2294,7 +2294,7 @@ bool WatchTreeListBox::ImplBasicEntryEdited( SvTreeListEntry* pEntry, const OUSt
if (SbxVariable* pVar = IsSbxVariable(pSBX))
{
SbxDataType eType = pVar->GetType();
- if ( (sal_uInt8)eType != (sal_uInt8)SbxOBJECT
+ if ( static_cast<sal_uInt8>(eType) != sal_uInt8(SbxOBJECT)
&& ( eType & SbxARRAY ) == 0 )
{
// If the type is variable, the conversion of the SBX does not matter,
@@ -2479,7 +2479,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
aWatchStr += "<?>";
}
}
- else if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT )
+ else if ( static_cast<sal_uInt8>(eType) == sal_uInt8(SbxOBJECT) )
{
if (SbxObject* pObj = dynamic_cast<SbxObject*>(pVar->GetObject()))
{
@@ -2530,7 +2530,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
implEnableChildren( pEntry, false );
}
- bool bString = ((sal_uInt8)eType == (sal_uInt8)SbxSTRING);
+ bool bString = (static_cast<sal_uInt8>(eType) == sal_uInt8(SbxSTRING));
OUString aStrStr( "\"" );
if( bString )
{
@@ -2827,7 +2827,7 @@ void CodeCompleteWindow::ResizeAndPositionListBox()
}
// get column/line count
const sal_uInt16& nColumns = aLongestEntry.getLength();
- const sal_uInt16 nLines = static_cast<sal_uInt16>( std::min( (sal_Int32) 6, pListBox->GetEntryCount() ));
+ const sal_uInt16 nLines = static_cast<sal_uInt16>( std::min( sal_Int32(6), pListBox->GetEntryCount() ));
Size aSize = pListBox->CalcBlockSize( nColumns, nLines );
//set the size
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 5d7420a3d00a..f1d41d3ce9f8 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -1067,9 +1067,9 @@ void Shell::SetCurWindow( BaseWindow* pNewWin, bool bUpdateTabBar, bool bRemembe
if ( bUpdateTabBar )
{
sal_uLong nKey = GetWindowId( pCurWin );
- if ( pCurWin && ( pTabBar->GetPagePos( (sal_uInt16)nKey ) == TAB_PAGE_NOTFOUND ) )
- pTabBar->InsertPage( (sal_uInt16)nKey, pCurWin->GetTitle() ); // has just been faded in
- pTabBar->SetCurPageId( (sal_uInt16)nKey );
+ if ( pCurWin && ( pTabBar->GetPagePos( static_cast<sal_uInt16>(nKey) ) == TAB_PAGE_NOTFOUND ) )
+ pTabBar->InsertPage( static_cast<sal_uInt16>(nKey), pCurWin->GetTitle() ); // has just been faded in
+ pTabBar->SetCurPageId( static_cast<sal_uInt16>(nKey) );
}
if ( pCurWin && pCurWin->IsSuspended() ) // if the window is shown in the case of an error...
pCurWin->SetStatus( pCurWin->GetStatus() & ~BASWIN_SUSPENDED );
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index cbe3f8f40069..ab2d5766aa1f 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -190,7 +190,7 @@ VclPtr<ModulWindow> Shell::CreateBasWin( const ScriptDocument& rDocument, const
aModName += " (" + sObjName + ")";
}
}
- pTabBar->InsertPage( (sal_uInt16)nKey, aModName );
+ pTabBar->InsertPage( static_cast<sal_uInt16>(nKey), aModName );
pTabBar->Sort();
if(pWin)
{
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index b3e3d38ce70c..9ba2a6db36bb 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -97,7 +97,7 @@ VclPtr<DialogWindow> Shell::CreateDlgWin( const ScriptDocument& rDocument, const
if( pWin )
{
pWin->GrabScrollBars( aHScrollBar.get(), aVScrollBar.get() );
- pTabBar->InsertPage( (sal_uInt16)nKey, aDlgName );
+ pTabBar->InsertPage( static_cast<sal_uInt16>(nKey), aDlgName );
pTabBar->Sort();
if ( !pCurWin )
SetCurWindow( pWin, false, false );
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 88d9f280645a..8c5518d17160 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -747,7 +747,7 @@ void Shell::RemoveWindow( BaseWindow* pWindow_, bool bDestroy, bool bAllowChange
DBG_ASSERT( pWindow_, "Cannot delete NULL-Pointer!" );
sal_uLong nKey = GetWindowId( pWindow_ );
- pTabBar->RemovePage( (sal_uInt16)nKey );
+ pTabBar->RemovePage( static_cast<sal_uInt16>(nKey) );
aWindowTable.erase( nKey );
if ( pWindow_ == pCurWin )
{
diff --git a/basctl/source/basicide/breakpoint.cxx b/basctl/source/basicide/breakpoint.cxx
index 23ce9a8e674e..5fd549760bbb 100644
--- a/basctl/source/basicide/breakpoint.cxx
+++ b/basctl/source/basicide/breakpoint.cxx
@@ -75,7 +75,7 @@ void BreakPointList::SetBreakPointsInBasic(SbModule* pModule)
for (BreakPoint* pBrk : maBreakPoints)
{
if ( pBrk->bEnabled )
- pModule->SetBP( (sal_uInt16)pBrk->nLine );
+ pModule->SetBP( static_cast<sal_uInt16>(pBrk->nLine) );
}
}
diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
index bab9694795f1..f661b114264c 100644
--- a/basctl/source/basicide/brkdlg.cxx
+++ b/basctl/source/basicide/brkdlg.cxx
@@ -200,7 +200,7 @@ IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton, void )
{
BreakPoint* pBrk = new BreakPoint( nLine );
pBrk->bEnabled = m_pCheckBox->IsChecked();
- pBrk->nStopAfter = (size_t) m_pNumericField->GetValue();
+ pBrk->nStopAfter = static_cast<size_t>(m_pNumericField->GetValue());
m_aModifiedBreakPointList.InsertSorted( pBrk );
OUString aEntryStr( "# " + OUString::number(pBrk->nLine) );
m_pComboBox->InsertEntry( aEntryStr );
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
index 0fe9517cbf98..257ac8fd1a8d 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -78,7 +78,7 @@ void LineNumberWindow::Paint( vcl::RenderContext& rRenderContext, const tools::R
m_nWidth += m_nBaseWidth;
}
- sal_Int64 y = (nStartLine - 1) * (sal_Int64)nLineHeight;
+ sal_Int64 y = (nStartLine - 1) * static_cast<sal_Int64>(nLineHeight);
for (sal_uInt32 n = nStartLine; n <= nEndLine; ++n, y += nLineHeight)
rRenderContext.DrawText(Point(0, y - m_nCurYOffset), OUString::number(n));
}
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 94c81559ace1..d563ddcb7cf8 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -834,7 +834,7 @@ void LibPage::InsertLib()
( xDlgLibContImport.is() && xDlgLibContImport->hasByName( aLibName ) && xDlgLibContImport->isLibraryLink( aLibName ) ) ) )
{
SvTreeListEntry* pEntry = pLibDlg->GetLibBox().DoInsertEntry( aLibName );
- sal_uInt16 nPos = (sal_uInt16) pLibDlg->GetLibBox().GetModel()->GetAbsPos( pEntry );
+ sal_uInt16 nPos = static_cast<sal_uInt16>(pLibDlg->GetLibBox().GetModel()->GetAbsPos( pEntry ));
pLibDlg->GetLibBox().CheckEntryPos(nPos);
}
}
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 8b698c407230..4aa1315223df 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -278,8 +278,8 @@ void DlgEditor::InitScrollBars()
pHScroll->SetRange( Range( 0, aPgSize.Width() ));
pVScroll->SetRange( Range( 0, aPgSize.Height() ));
- pHScroll->SetVisibleSize( (sal_uLong)aOutSize.Width() );
- pVScroll->SetVisibleSize( (sal_uLong)aOutSize.Height() );
+ pHScroll->SetVisibleSize( static_cast<sal_uLong>(aOutSize.Width()) );
+ pVScroll->SetVisibleSize( static_cast<sal_uLong>(aOutSize.Height()) );
pHScroll->SetLineSize( aOutSize.Width() / 10 );
pVScroll->SetLineSize( aOutSize.Height() / 10 );
@@ -654,7 +654,7 @@ void implCopyStreamToByteSequence( const Reference< XInputStream >& xStream,
sal_Int32 nPos = bytes.getLength();
bytes.realloc( nPos + nRead );
- memcpy( bytes.getArray() + nPos, readBytes.getConstArray(), (sal_uInt32)nRead );
+ memcpy( bytes.getArray() + nPos, readBytes.getConstArray(), static_cast<sal_uInt32>(nRead) );
}
}
@@ -934,7 +934,7 @@ void DlgEditor::Paste()
// set tabindex
Reference< container::XNameAccess > xNA( m_xUnoControlDialogModel , UNO_QUERY );
Sequence< OUString > aNames_ = xNA->getElementNames();
- xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any((sal_Int16) aNames_.getLength()) );
+ xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any(static_cast<sal_Int16>(aNames_.getLength())) );
if( bLocalized )
{
@@ -1173,13 +1173,13 @@ void DlgEditor::Print( Printer* pPrinter, const OUString& rTitle ) // not wor
Size aOutputSz;
if( nBmpSzHeight * nScaleX <= nPaperSzHeight )
{
- aOutputSz.Width() = (long)(nBmpSzWidth * nScaleX);
- aOutputSz.Height() = (long)(nBmpSzHeight * nScaleX);
+ aOutputSz.Width() = static_cast<long>(nBmpSzWidth * nScaleX);
+ aOutputSz.Height() = static_cast<long>(nBmpSzHeight * nScaleX);
}
else
{
- aOutputSz.Width() = (long)(nBmpSzWidth * nScaleY);
- aOutputSz.Height() = (long)(nBmpSzHeight * nScaleY);
+ aOutputSz.Width() = static_cast<long>(nBmpSzWidth * nScaleY);
+ aOutputSz.Height() = static_cast<long>(nBmpSzHeight * nScaleY);
}
Point aPosOffs(
diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx
index 8e9ba230d6e8..beb6ba7bfbbf 100644
--- a/basctl/source/dlged/dlgedfac.cxx
+++ b/basctl/source/dlged/dlgedfac.cxx
@@ -156,7 +156,7 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY);
if (xPSet.is())
{
- xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, uno::Any((sal_Int32) css::awt::ScrollBarOrientation::VERTICAL) );
+ xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, uno::Any(sal_Int32(css::awt::ScrollBarOrientation::VERTICAL)) );
}
}
catch(...)
@@ -176,7 +176,7 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY);
if (xPSet.is())
{
- xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, uno::Any((sal_Int32) 1) );
+ xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, uno::Any(sal_Int32(1)) );
}
}
catch(...)
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 167c48c35cc7..1bdd8718d78b 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -602,7 +602,7 @@ void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt )
SAL_WARN("basctl", "tab " << i << " > SAL_MAX_INT16");
continue;
}
- xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any((sal_Int16) i) );
+ xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any(static_cast<sal_Int16>(i)) );
}
}
@@ -873,7 +873,7 @@ void DlgEdObj::clonedFrom(const DlgEdObj* _pSource)
{
// set tabindex
Sequence< OUString > aNames = xCont->getElementNames();
- xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any((sal_Int16) aNames.getLength()) );
+ xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any(static_cast<sal_Int16>(aNames.getLength())) );
// insert control model in dialog model
Reference< awt::XControlModel > xCtrl( xPSet , UNO_QUERY );
@@ -999,7 +999,7 @@ void DlgEdObj::SetDefaults()
// set tabindex
Sequence< OUString > aNames = xCont->getElementNames();
uno::Any aTabIndex;
- aTabIndex <<= (sal_Int16) aNames.getLength();
+ aTabIndex <<= static_cast<sal_Int16>(aNames.getLength());
xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex );
// set step