summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r--sc/source/ui/view/cellsh1.cxx4
-rw-r--r--sc/source/ui/view/cellsh3.cxx16
-rw-r--r--sc/source/ui/view/colrowba.cxx14
-rw-r--r--sc/source/ui/view/drawutil.cxx18
-rw-r--r--sc/source/ui/view/editsh.cxx2
-rw-r--r--sc/source/ui/view/formatsh.cxx8
-rw-r--r--sc/source/ui/view/gridwin.cxx12
-rw-r--r--sc/source/ui/view/gridwin4.cxx10
-rw-r--r--sc/source/ui/view/hdrcont.cxx6
-rw-r--r--sc/source/ui/view/output.cxx30
-rw-r--r--sc/source/ui/view/output2.cxx116
-rw-r--r--sc/source/ui/view/output3.cxx12
-rw-r--r--sc/source/ui/view/preview.cxx92
-rw-r--r--sc/source/ui/view/prevloc.cxx18
-rw-r--r--sc/source/ui/view/prevwsh.cxx12
-rw-r--r--sc/source/ui/view/printfun.cxx122
-rw-r--r--sc/source/ui/view/select.cxx2
-rw-r--r--sc/source/ui/view/tabview.cxx36
-rw-r--r--sc/source/ui/view/tabview2.cxx14
-rw-r--r--sc/source/ui/view/tabview3.cxx4
-rw-r--r--sc/source/ui/view/tabview4.cxx2
-rw-r--r--sc/source/ui/view/tabview5.cxx8
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx4
-rw-r--r--sc/source/ui/view/tabvwsha.cxx4
-rw-r--r--sc/source/ui/view/viewdata.cxx52
-rw-r--r--sc/source/ui/view/viewfun2.cxx4
-rw-r--r--sc/source/ui/view/viewfun3.cxx4
-rw-r--r--sc/source/ui/view/viewfun5.cxx2
-rw-r--r--sc/source/ui/view/viewfunc.cxx6
29 files changed, 316 insertions, 318 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index f4599a40b35f..c77bcb3a409e 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1465,7 +1465,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
rReq.AppendItem( SfxBoolItem( FN_PARAM_3, bTranspose ) );
rReq.AppendItem( SfxBoolItem( FN_PARAM_4, bAsLink ) );
rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, static_cast<sal_uInt16>(nFunction) ) );
- rReq.AppendItem( SfxInt16Item( FN_PARAM_5, (sal_Int16) eMoveMode ) );
+ rReq.AppendItem( SfxInt16Item( FN_PARAM_5, static_cast<sal_Int16>(eMoveMode) ) );
rReq.Done();
}
}
@@ -2525,7 +2525,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
const OUString& rName = pHyper->GetName();
const OUString& rURL = pHyper->GetURL();
const OUString& rTarget = pHyper->GetTargetFrame();
- sal_uInt16 nType = (sal_uInt16) pHyper->GetInsertMode();
+ sal_uInt16 nType = static_cast<sal_uInt16>(pHyper->GetInsertMode());
pTabViewShell->InsertURL( rName, rURL, rTarget, nType );
rReq.Done();
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index f0a77deca879..d40a11d2dd79 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -576,10 +576,10 @@ void ScCellShell::Execute( SfxRequest& rReq )
if ( pDlg->Execute() == RET_OK )
{
long nVal = pDlg->GetInputValue();
- pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, (sal_uInt16)nVal );
+ pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, static_cast<sal_uInt16>(nVal) );
// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert
- rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, (sal_uInt16)TwipsToEvenHMM(nVal) ) );
+ rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, static_cast<sal_uInt16>(TwipsToEvenHMM(nVal)) ) );
rReq.Done();
}
@@ -616,11 +616,11 @@ void ScCellShell::Execute( SfxRequest& rReq )
if ( pDlg->Execute() == RET_OK )
{
long nVal = pDlg->GetInputValue();
- pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_OPTIMAL, (sal_uInt16)nVal );
+ pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_OPTIMAL, static_cast<sal_uInt16>(nVal) );
ScGlobal::nLastRowHeightExtra = nVal;
// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert
- rReq.AppendItem( SfxUInt16Item( FID_ROW_OPT_HEIGHT, (sal_uInt16)TwipsToEvenHMM(nVal) ) );
+ rReq.AppendItem( SfxUInt16Item( FID_ROW_OPT_HEIGHT, static_cast<sal_uInt16>(TwipsToEvenHMM(nVal)) ) );
rReq.Done();
}
@@ -681,10 +681,10 @@ void ScCellShell::Execute( SfxRequest& rReq )
if ( pDlg->Execute() == RET_OK )
{
long nVal = pDlg->GetInputValue();
- pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_DIRECT, (sal_uInt16)nVal );
+ pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_DIRECT, static_cast<sal_uInt16>(nVal) );
// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert
- rReq.AppendItem( SfxUInt16Item( FID_COL_WIDTH, (sal_uInt16)TwipsToEvenHMM(nVal)) );
+ rReq.AppendItem( SfxUInt16Item( FID_COL_WIDTH, static_cast<sal_uInt16>(TwipsToEvenHMM(nVal))) );
rReq.Done();
}
@@ -720,11 +720,11 @@ void ScCellShell::Execute( SfxRequest& rReq )
if ( pDlg->Execute() == RET_OK )
{
long nVal = pDlg->GetInputValue();
- pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_OPTIMAL, (sal_uInt16)nVal );
+ pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_OPTIMAL, static_cast<sal_uInt16>(nVal) );
ScGlobal::nLastColWidthExtra = nVal;
// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert
- rReq.AppendItem( SfxUInt16Item( FID_COL_OPT_WIDTH, (sal_uInt16)TwipsToEvenHMM(nVal) ) );
+ rReq.AppendItem( SfxUInt16Item( FID_COL_OPT_WIDTH, static_cast<sal_uInt16>(TwipsToEvenHMM(nVal)) ) );
rReq.Done();
}
}
diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx
index 246fd7b5238a..f1636efe1509 100644
--- a/sc/source/ui/view/colrowba.cxx
+++ b/sc/source/ui/view/colrowba.cxx
@@ -74,7 +74,7 @@ sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) const
if (pDoc->ColHidden(static_cast<SCCOL>(nEntryNo), nTab))
return 0;
else
- return (sal_uInt16) ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), rViewData.GetPPTX() );
+ return static_cast<sal_uInt16>(ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), rViewData.GetPPTX() ));
}
OUString ScColBar::GetEntryText( SCCOLROW nEntryNo ) const
@@ -97,7 +97,7 @@ void ScColBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize )
eMode = SC_SIZE_OPTIMAL;
}
else
- nSizeTwips = (sal_uInt16) ( nNewSize / rViewData.GetPPTX() );
+ nSizeTwips = static_cast<sal_uInt16>( nNewSize / rViewData.GetPPTX() );
const ScMarkData& rMark = rViewData.GetMarkData();
@@ -196,7 +196,7 @@ void ScColBar::DrawInvert( long nDragPosP )
OUString ScColBar::GetDragHelp( long nVal )
{
- long nTwips = (long) ( nVal / pTabView->GetViewData().GetPPTX() );
+ long nTwips = static_cast<long>( nVal / pTabView->GetViewData().GetPPTX() );
return lcl_MetricString( nTwips, ScGlobal::GetRscString(STR_TIP_WIDTH) );
}
@@ -234,8 +234,8 @@ sal_uInt16 ScRowBar::GetEntrySize( SCCOLROW nEntryNo ) const
if (pDoc->RowHidden(nEntryNo, nTab, nullptr, &nLastRow))
return 0;
else
- return (sal_uInt16) ScViewData::ToPixel( pDoc->GetOriginalHeight( nEntryNo,
- nTab ), rViewData.GetPPTY() );
+ return static_cast<sal_uInt16>(ScViewData::ToPixel( pDoc->GetOriginalHeight( nEntryNo,
+ nTab ), rViewData.GetPPTY() ));
}
OUString ScRowBar::GetEntryText( SCCOLROW nEntryNo ) const
@@ -256,7 +256,7 @@ void ScRowBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize )
eMode = SC_SIZE_OPTIMAL;
}
else
- nSizeTwips = (sal_uInt16) ( nNewSize / rViewData.GetPPTY() );
+ nSizeTwips = static_cast<sal_uInt16>( nNewSize / rViewData.GetPPTY() );
const ScMarkData& rMark = rViewData.GetMarkData();
@@ -355,7 +355,7 @@ void ScRowBar::DrawInvert( long nDragPosP )
OUString ScRowBar::GetDragHelp( long nVal )
{
- long nTwips = (long) ( nVal / pTabView->GetViewData().GetPPTY() );
+ long nTwips = static_cast<long>( nVal / pTabView->GetViewData().GetPPTY() );
return lcl_MetricString( nTwips, ScGlobal::GetRscString(STR_TIP_HEIGHT) );
}
diff --git a/sc/source/ui/view/drawutil.cxx b/sc/source/ui/view/drawutil.cxx
index 435c0854fa5d..ff859eb2074c 100644
--- a/sc/source/ui/view/drawutil.cxx
+++ b/sc/source/ui/view/drawutil.cxx
@@ -38,7 +38,7 @@ void ScDrawUtil::CalcScale( const ScDocument* pDoc, SCTAB nTab,
for (SCCOL i=nStartCol; i<nEndCol; i++)
{
sal_uInt16 nWidth = pDoc->GetColWidth(i,nTab);
- nTwipsX += (long) nWidth;
+ nTwipsX += static_cast<long>(nWidth);
nPixelX += ScViewData::ToPixel( nWidth, nPPTX );
}
@@ -63,20 +63,20 @@ void ScDrawUtil::CalcScale( const ScDocument* pDoc, SCTAB nTab,
// because ReduceInaccurate is called later anyway.
if ( aPixelLog.X() && nTwipsX )
- rScaleX = Fraction( ((double)aPixelLog.X()) *
- ((double)rZoomX.GetNumerator()) /
- ((double)nTwipsX) /
+ rScaleX = Fraction( static_cast<double>(aPixelLog.X()) *
+ static_cast<double>(rZoomX.GetNumerator()) /
+ static_cast<double>(nTwipsX) /
HMM_PER_TWIPS /
- ((double)rZoomX.GetDenominator()) );
+ static_cast<double>(rZoomX.GetDenominator()) );
else
rScaleX = Fraction( 1, 1 );
if ( aPixelLog.Y() && nTwipsY )
- rScaleY = Fraction( ((double)aPixelLog.Y()) *
- ((double)rZoomY.GetNumerator()) /
- ((double)nTwipsY) /
+ rScaleY = Fraction( static_cast<double>(aPixelLog.Y()) *
+ static_cast<double>(rZoomY.GetNumerator()) /
+ static_cast<double>(nTwipsY) /
HMM_PER_TWIPS /
- ((double)rZoomY.GetDenominator()) );
+ static_cast<double>(rZoomY.GetDenominator()) );
else
rScaleY = Fraction( 1, 1 );
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 9cbac20a0fc8..2b08da9db8ca 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -614,7 +614,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
if (!bDone)
{
pViewData->GetViewShell()->
- InsertURL( rName, rURL, rTarget, (sal_uInt16) eMode );
+ InsertURL( rName, rURL, rTarget, static_cast<sal_uInt16>(eMode) );
// when "Button", the InsertURL in ViewShell turns the EditShell off
// thus the immediate return statement
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index a8cfadc0dfab..ba95dba00a56 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1232,10 +1232,10 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
break;
}
- const bool bThousand = (bool)sFormat[0].toInt32();
- const bool bNegRed = (bool)sFormat[1].toInt32();
- const sal_uInt16 nPrecision = (sal_uInt16)sFormat[2].toInt32();
- const sal_uInt16 nLeadZeroes = (sal_uInt16)sFormat[3].toInt32();
+ const bool bThousand = static_cast<bool>(sFormat[0].toInt32());
+ const bool bNegRed = static_cast<bool>(sFormat[1].toInt32());
+ const sal_uInt16 nPrecision = static_cast<sal_uInt16>(sFormat[2].toInt32());
+ const sal_uInt16 nLeadZeroes = static_cast<sal_uInt16>(sFormat[3].toInt32());
aCode = pFormatter->GenerateFormat(
nCurrentNumberFormat,//modify
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 1d1cae4a5dc2..84ad31b969da 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4654,7 +4654,7 @@ bool ScGridWindow::HitRangeFinder( const Point& rMouse, RfCorner& rCorner,
bool bCornerVerticalUp = rMouse.Y() >= aCellStart.Y() && rMouse.Y() <= aCellStart.Y() + 8;
// corner is hit only if the mouse is within the cell
- sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count();
+ sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count());
for (sal_uInt16 i=nCount; i;)
{
// search backwards so that the last repainted frame is found
@@ -4953,10 +4953,10 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp )
nEndY = MAXROW;
}
- aNew.aStart.SetCol((SCCOL)nStartX);
- aNew.aStart.SetRow((SCROW)nStartY);
- aNew.aEnd.SetCol((SCCOL)nEndX);
- aNew.aEnd.SetRow((SCROW)nEndY);
+ aNew.aStart.SetCol(static_cast<SCCOL>(nStartX));
+ aNew.aStart.SetRow(static_cast<SCROW>(nStartY));
+ aNew.aEnd.SetCol(static_cast<SCCOL>(nEndX));
+ aNew.aEnd.SetRow(static_cast<SCROW>(nEndY));
}
if ( bUp )
@@ -5244,7 +5244,7 @@ bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRang
if (!nBWidth)
return false; // No Button drawn yet -> there is none
long nBHeight = aButSize.Height();
- long nHSpace = (long)( SC_SCENARIO_HSPACE * pViewData->GetPPTX() );
+ long nHSpace = static_cast<long>( SC_SCENARIO_HSPACE * pViewData->GetPPTX() );
//! cache the Ranges in Table!!!!
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 9387c1e6d79c..5bfda7ea5915 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -97,8 +97,8 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle&
lcl_LimitRect( aInner, aVisible );
tools::Rectangle aOuter = aInner;
- long nHor = (long) ( SC_SCENARIO_HSPACE * nPPTX );
- long nVer = (long) ( SC_SCENARIO_VSPACE * nPPTY );
+ long nHor = static_cast<long>( SC_SCENARIO_HSPACE * nPPTX );
+ long nVer = static_cast<long>( SC_SCENARIO_VSPACE * nPPTY );
aOuter.Left() -= nHor;
aOuter.Right() += nHor;
aOuter.Top() -= nVer;
@@ -842,7 +842,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
if ( pRangeFinder && !pRangeFinder->IsHidden() &&
pRangeFinder->GetDocName() == pDocSh->GetTitle() )
{
- sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count();
+ sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count());
for (sal_uInt16 i=0; i<nCount; i++)
{
ScRangeFindData& rData = pRangeFinder->GetObject(i);
@@ -1461,9 +1461,9 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
long nPageNo = rData.GetFirstPage();
if ( rData.IsTopDown() )
- nPageNo += ((long)nColPos)*nRowBreaks+nRowPos;
+ nPageNo += static_cast<long>(nColPos)*nRowBreaks+nRowPos;
else
- nPageNo += ((long)nRowPos)*nColBreaks+nColPos;
+ nPageNo += static_cast<long>(nRowPos)*nColBreaks+nColPos;
OUString aThisPageStr = aPageStr.replaceFirst("%1", OUString::number(nPageNo));
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 96d388c0483e..07b69115fdc8 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -272,9 +272,9 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools
Size aTextSize;
if (bVertical)
- nBarSize = (sal_uInt16) GetSizePixel().Width();
+ nBarSize = static_cast<sal_uInt16>(GetSizePixel().Width());
else
- nBarSize = (sal_uInt16) GetSizePixel().Height();
+ nBarSize = static_cast<sal_uInt16>(GetSizePixel().Height());
SCCOLROW nPos = GetPos();
@@ -786,7 +786,7 @@ void ScHeaderControl::MouseButtonUp( const MouseEvent& rMEvt )
else
{
if (bDragMoved)
- SetEntrySize( nDragNo, (sal_uInt16) nNewWidth );
+ SetEntrySize( nDragNo, static_cast<sal_uInt16>(nNewWidth) );
}
}
else
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 6cfa4c2861b1..bd3687cd1cd3 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1220,9 +1220,9 @@ void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBot
nPosY + pRowInfo[nArrY].nHeight - 1 );
long nSize = pAttr->GetWidth();
- long nSizeX = (long)(nSize*mnPPTX);
+ long nSizeX = static_cast<long>(nSize*mnPPTX);
if (nSizeX >= nMaxWidth) nSizeX = nMaxWidth-1;
- long nSizeY = (long)(nSize*mnPPTY);
+ long nSizeY = static_cast<long>(nSize*mnPPTY);
if (nSizeY >= nRowHeight) nSizeY = nRowHeight-1;
nSizeX *= nLayoutSign; // used only to add to rectangle values
@@ -1562,7 +1562,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext)
while (nCol > nX)
{
--nCol;
- nPosX -= nLayoutSign * (long)pRowInfo[0].pCellInfo[nCol + 1].nWidth;
+ nPosX -= nLayoutSign * static_cast<long>(pRowInfo[0].pCellInfo[nCol + 1].nWidth);
}
}
@@ -1582,7 +1582,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext)
double nCos = cos(nRealOrient);
double nSin = sin(nRealOrient);
//! restrict !!!
- long nSkew = (long)(nRowHeight * nCos / nSin);
+ long nSkew = static_cast<long>(nRowHeight * nCos / nSin);
switch (eRotMode)
{
@@ -2262,8 +2262,8 @@ void ScOutputData::AddPDFNotes()
if ( mpDoc->GetNote(nMergeX, nMergeY, nTab) && ( bIsMerged ||
( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
{
- long nNoteWidth = (long)( SC_CLIPMARK_SIZE * mnPPTX );
- long nNoteHeight = (long)( SC_CLIPMARK_SIZE * mnPPTY );
+ long nNoteWidth = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX );
+ long nNoteHeight = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTY );
long nMarkX = nPosX + ( pRowInfo[0].pCellInfo[nX+1].nWidth - nNoteWidth ) * nLayoutSign;
if ( bIsMerged || pInfo->bMerged )
@@ -2352,26 +2352,26 @@ void ScOutputData::DrawClipMarks()
nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & ScMF::Hor ) )
{
--nOverX;
- nStartPosX -= nLayoutSign * (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX );
+ nStartPosX -= nLayoutSign * static_cast<long>( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX );
}
while ( nOverY > 0 && ( static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr(
nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & ScMF::Ver ) )
{
--nOverY;
- nStartPosY -= nLayoutSign * (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY );
+ nStartPosY -= nLayoutSign * static_cast<long>( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY );
}
- long nOutWidth = (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX );
- long nOutHeight = (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY );
+ long nOutWidth = static_cast<long>( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX );
+ long nOutHeight = static_cast<long>( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY );
const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(
mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE ));
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=1; i<nCountX; i++)
- nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
+ nOutWidth += static_cast<long>( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
SCROW nCountY = pMerge->GetRowMerge();
- nOutHeight += (long) mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY);
+ nOutHeight += static_cast<long>(mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY));
if ( bLayoutRTL )
nStartPosX -= nOutWidth - 1;
@@ -2390,9 +2390,9 @@ void ScOutputData::DrawClipMarks()
&pInfo->pPatternAttr->GetItem(ATTR_MERGE);
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=1; i<nCountX; i++)
- nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
+ nOutWidth += static_cast<long>( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
SCROW nCountY = pMerge->GetRowMerge();
- nOutHeight += (long) mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY);
+ nOutHeight += static_cast<long>(mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY));
}
long nStartPosX = nPosX;
@@ -2409,7 +2409,7 @@ void ScOutputData::DrawClipMarks()
else
aCellRect.Right() -= 1;
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
+ long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX );
Size aMarkSize( nMarkPixel, (nMarkPixel-1)*2 );
if ( pInfo->nClipMark & ( bLayoutRTL ? ScClipMark::Right : ScClipMark::Left ) )
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 9e0d761e64d8..c4d47392f141 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -700,7 +700,7 @@ void ScDrawStringsVars::SetAutoText( const OUString& rAutoText )
if ( !pRefDevice->GetConnectMetaFile() || pRefDevice->GetOutDevType() == OUTDEV_PRINTER )
{
double fMul = pOutput->GetStretch();
- aTextSize.Width() = (long)(aTextSize.Width() / fMul + 0.5);
+ aTextSize.Width() = static_cast<long>(aTextSize.Width() / fMul + 0.5);
}
aTextSize.Height() = aMetric.GetAscent() + aMetric.GetDescent();
@@ -770,7 +770,7 @@ void ScDrawStringsVars::TextChanged()
if ( !pRefDevice->GetConnectMetaFile() || pRefDevice->GetOutDevType() == OUTDEV_PRINTER )
{
double fMul = pOutput->GetStretch();
- aTextSize.Width() = (long)(aTextSize.Width() / fMul + 0.5);
+ aTextSize.Width() = static_cast<long>(aTextSize.Width() / fMul + 0.5);
}
aTextSize.Height() = aMetric.GetAscent() + aMetric.GetDescent();
@@ -825,12 +825,12 @@ double ScOutputData::GetStretch()
if ( mpRefDevice == pFmtDevice )
{
MapMode aOld = mpRefDevice->GetMapMode();
- return ((double)aOld.GetScaleY()) / ((double)aOld.GetScaleX()) * ((double)aZoomY) / ((double)aZoomX);
+ return static_cast<double>(aOld.GetScaleY()) / static_cast<double>(aOld.GetScaleX()) * static_cast<double>(aZoomY) / static_cast<double>(aZoomX);
}
else
{
// when formatting for printer, device map mode has already been taken care of
- return ((double)aZoomY) / ((double)aZoomX);
+ return static_cast<double>(aZoomY) / static_cast<double>(aZoomX);
}
}
@@ -1168,7 +1168,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
//! extra member function for width?
long nColWidth = ( nCompCol <= nX2 ) ?
pRowInfo[0].pCellInfo[nCompCol+1].nWidth :
- (long) ( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX );
+ static_cast<long>( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX );
nCellPosX += nColWidth * nLayoutSign;
++nCompCol;
}
@@ -1177,7 +1177,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
--nCompCol;
long nColWidth = ( nCompCol <= nX2 ) ?
pRowInfo[0].pCellInfo[nCompCol+1].nWidth :
- (long) ( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX );
+ static_cast<long>( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX );
nCellPosX -= nColWidth * nLayoutSign;
}
@@ -1196,11 +1196,11 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
{
sal_uInt16 nDocHeight = mpDoc->GetRowHeight( nCompRow, nTab );
if ( nDocHeight )
- nCellPosY += (long) ( nDocHeight * mnPPTY );
+ nCellPosY += static_cast<long>( nDocHeight * mnPPTY );
++nCompRow;
}
}
- nCellPosY -= (long) mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, mnPPTY );
+ nCellPosY -= static_cast<long>(mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, mnPPTY ));
const ScMergeAttr* pMerge = &rPattern.GetItem( ATTR_MERGE );
bool bMerged = pMerge->IsMerged();
@@ -1216,7 +1216,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
{
long nColWidth = ( nCellX+i <= nX2 ) ?
pRowInfo[0].pCellInfo[nCellX+i+1].nWidth :
- (long) ( mpDoc->GetColWidth( sal::static_int_cast<SCCOL>(nCellX+i), nTab ) * mnPPTX );
+ static_cast<long>( mpDoc->GetColWidth( sal::static_int_cast<SCCOL>(nCellX+i), nTab ) * mnPPTX );
nMergeSizeX += nColWidth;
}
long nMergeSizeY = 0;
@@ -1228,7 +1228,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
nDirect = 1; // skip in loop
}
// following rows always from document
- nMergeSizeY += (long) mpDoc->GetScaledRowHeight( nCellY+nDirect, nCellY+nMergeRows-1, nTab, mnPPTY);
+ nMergeSizeY += static_cast<long>(mpDoc->GetScaledRowHeight( nCellY+nDirect, nCellY+nMergeRows-1, nTab, mnPPTY));
--nMergeSizeX; // leave out the grid horizontally, also for alignment (align between grid lines)
@@ -1286,7 +1286,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
while ( nRightMissing > 0 && nRightX < MAXCOL && ( bOverwrite || IsAvailable( nRightX+1, nCellY ) ) )
{
++nRightX;
- long nAdd = (long) ( mpDoc->GetColWidth( nRightX, nTab ) * mnPPTX );
+ long nAdd = static_cast<long>( mpDoc->GetColWidth( nRightX, nTab ) * mnPPTX );
nRightMissing -= nAdd;
rParam.maClipRect.Right() += nAdd * nLayoutSign;
@@ -1300,7 +1300,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
rThisRowInfo.pCellInfo[nLeftX].bHideGrid = true;
--nLeftX;
- long nAdd = (long) ( mpDoc->GetColWidth( nLeftX, nTab ) * mnPPTX );
+ long nAdd = static_cast<long>( mpDoc->GetColWidth( nLeftX, nTab ) * mnPPTX );
nLeftMissing -= nAdd;
rParam.maClipRect.Left() -= nAdd * nLayoutSign;
}
@@ -1312,14 +1312,14 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
{
rThisRowInfo.pCellInfo[nRightX+1].nClipMark |= ScClipMark::Right;
bAnyClipped = true;
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
+ long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX );
rParam.maClipRect.Right() -= nMarkPixel * nLayoutSign;
}
if ( nLeftMissing > 0 && bMarkClipped && nLeftX >= nX1 && nLeftX <= nX2 && !bBreak && !bCellIsValue )
{
rThisRowInfo.pCellInfo[nLeftX+1].nClipMark |= ScClipMark::Left;
bAnyClipped = true;
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
+ long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX );
rParam.maClipRect.Left() += nMarkPixel * nLayoutSign;
}
@@ -1802,8 +1802,8 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co
else
{
long nHeight = aVars.GetTextSize().Height() +
- (long)(aVars.GetMargin()->GetTopMargin()*mnPPTY) +
- (long)(aVars.GetMargin()->GetBottomMargin()*mnPPTY);
+ static_cast<long>(aVars.GetMargin()->GetTopMargin()*mnPPTY) +
+ static_cast<long>(aVars.GetMargin()->GetBottomMargin()*mnPPTY);
bNeedEdit = ( nHeight > aAreaParam.maClipRect.GetHeight() );
}
}
@@ -1835,8 +1835,8 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co
aVars.SetTextToWidthOrHash(aCell, aAreaParam.mnColWidth - nTotalMargin);
nNeededWidth = aVars.GetTextSize().Width() +
- (long) ( aVars.GetLeftTotal() * mnPPTX ) +
- (long) ( aVars.GetMargin()->GetRightMargin() * mnPPTX );
+ static_cast<long>( aVars.GetLeftTotal() * mnPPTX ) +
+ static_cast<long>( aVars.GetMargin()->GetRightMargin() * mnPPTX );
if ( nNeededWidth <= aAreaParam.maClipRect.GetWidth() )
{
// Cell value is no longer clipped. Reset relevant parameters.
@@ -1867,17 +1867,17 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co
switch (eOutHorJust)
{
case SvxCellHorJustify::Left:
- nJustPosX += (long) ( aVars.GetLeftTotal() * mnPPTX );
+ nJustPosX += static_cast<long>( aVars.GetLeftTotal() * mnPPTX );
break;
case SvxCellHorJustify::Right:
nJustPosX += nAvailWidth - aVars.GetTextSize().Width() -
- (long) ( aVars.GetRightTotal() * mnPPTX );
+ static_cast<long>( aVars.GetRightTotal() * mnPPTX );
bRightAdjusted = true;
break;
case SvxCellHorJustify::Center:
nJustPosX += ( nAvailWidth - aVars.GetTextSize().Width() +
- (long) ( aVars.GetLeftTotal() * mnPPTX ) -
- (long) ( aVars.GetMargin()->GetRightMargin() * mnPPTX ) ) / 2;
+ static_cast<long>( aVars.GetLeftTotal() * mnPPTX ) -
+ static_cast<long>( aVars.GetMargin()->GetRightMargin() * mnPPTX ) ) / 2;
break;
default:
{
@@ -1891,22 +1891,22 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co
case SvxCellVerJustify::Top:
case SvxCellVerJustify::Block:
{
- long nTop = (long)( aVars.GetMargin()->GetTopMargin() * mnPPTY );
+ long nTop = static_cast<long>( aVars.GetMargin()->GetTopMargin() * mnPPTY );
nJustPosY += nTop;
nTestClipHeight += nTop;
}
break;
case SvxCellVerJustify::Bottom:
{
- long nBot = (long)( aVars.GetMargin()->GetBottomMargin() * mnPPTY );
+ long nBot = static_cast<long>( aVars.GetMargin()->GetBottomMargin() * mnPPTY );
nJustPosY += nOutHeight - aVars.GetTextSize().Height() - nBot;
nTestClipHeight += nBot;
}
break;
case SvxCellVerJustify::Center:
{
- long nTop = (long)( aVars.GetMargin()->GetTopMargin() * mnPPTY );
- long nBot = (long)( aVars.GetMargin()->GetBottomMargin() * mnPPTY );
+ long nTop = static_cast<long>( aVars.GetMargin()->GetTopMargin() * mnPPTY );
+ long nBot = static_cast<long>( aVars.GetMargin()->GetBottomMargin() * mnPPTY );
nJustPosY += ( nOutHeight + nTop -
aVars.GetTextSize().Height() - nBot ) / 2;
nTestClipHeight += std::abs( nTop - nBot );
@@ -2208,7 +2208,7 @@ static long lcl_GetEditSize( EditEngine& rEngine, bool bWidth, bool bSwap, long
if ( nAttrRotate )
{
- long nRealWidth = (long) rEngine.CalcTextWidth();
+ long nRealWidth = static_cast<long>(rEngine.CalcTextWidth());
long nRealHeight = rEngine.GetTextHeight();
// assuming standard mode, otherwise width isn't used
@@ -2217,12 +2217,12 @@ static long lcl_GetEditSize( EditEngine& rEngine, bool bWidth, bool bSwap, long
double nAbsCos = fabs( cos( nRealOrient ) );
double nAbsSin = fabs( sin( nRealOrient ) );
if ( bWidth )
- return (long) ( nRealWidth * nAbsCos + nRealHeight * nAbsSin );
+ return static_cast<long>( nRealWidth * nAbsCos + nRealHeight * nAbsSin );
else
- return (long) ( nRealHeight * nAbsCos + nRealWidth * nAbsSin );
+ return static_cast<long>( nRealHeight * nAbsCos + nRealWidth * nAbsSin );
}
else if ( bWidth )
- return (long) rEngine.CalcTextWidth();
+ return static_cast<long>(rEngine.CalcTextWidth());
else
return rEngine.GetTextHeight();
}
@@ -2707,7 +2707,7 @@ void ScOutputData::DrawEditParam::adjustForHyperlinkInPDF(Point aURLStart, const
if (!bHasURL)
return;
- long nURLWidth = (long) mpEngine->CalcTextWidth();
+ long nURLWidth = static_cast<long>(mpEngine->CalcTextWidth());
long nURLHeight = mpEngine->GetTextHeight();
if (mbBreak)
{
@@ -3081,7 +3081,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
pClipMarkCell->nClipMark |= ScClipMark::Right; //! also allow left?
bAnyClipped = true;
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
+ long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX );
if ( aAreaParam.maClipRect.Right() - nMarkPixel > aAreaParam.maClipRect.Left() )
aAreaParam.maClipRect.Right() -= nMarkPixel;
}
@@ -3919,7 +3919,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
pClipMarkCell->nClipMark |= ScClipMark::Right; //! also allow left?
bAnyClipped = true;
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
+ long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX );
if ( aAreaParam.maClipRect.Right() - nMarkPixel > aAreaParam.maClipRect.Left() )
aAreaParam.maClipRect.Right() -= nMarkPixel;
}
@@ -4208,7 +4208,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
pClipMarkCell->nClipMark |= ScClipMark::Right; //! also allow left?
bAnyClipped = true;
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
+ long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX );
if ( aAreaParam.maClipRect.Right() - nMarkPixel > aAreaParam.maClipRect.Left() )
aAreaParam.maClipRect.Right() -= nMarkPixel;
}
@@ -4486,7 +4486,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
for (SCSIZE nArrY=0; nArrY+1<nArrCount; nArrY++) // 0 for the rest of the merged
{
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
- long nCellHeight = (long) pThisRowInfo->nHeight;
+ long nCellHeight = static_cast<long>(pThisRowInfo->nHeight);
if (nArrY==1) nRowPosY = nScrY; // positions before are calculated individually
if ( ( pThisRowInfo->bChanged || nArrY==0 ) && pThisRowInfo->nRotMaxCol != SC_ROTMAX_NONE )
@@ -4535,7 +4535,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
if (aCell.isEmpty() || IsEmptyCellText(pThisRowInfo, nX, nY))
bHidden = true; // nRotateDir is also set without a cell
- long nCellWidth = (long) pRowInfo[0].pCellInfo[nX+1].nWidth;
+ long nCellWidth = static_cast<long>(pRowInfo[0].pCellInfo[nX+1].nWidth);
SvxCellHorJustify eHorJust =
pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet).GetValue();
@@ -4562,7 +4562,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
while (nCol > nX)
{
--nCol;
- nStartX -= nLayoutSign * (long) pRowInfo[0].pCellInfo[nCol+1].nWidth;
+ nStartX -= nLayoutSign * static_cast<long>(pRowInfo[0].pCellInfo[nCol+1].nWidth);
}
}
}
@@ -4579,9 +4579,9 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
{
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=1; i<nCountX; i++)
- nOutWidth += (long) ( mpDoc->GetColWidth(nX+i,nTab) * mnPPTX );
+ nOutWidth += static_cast<long>( mpDoc->GetColWidth(nX+i,nTab) * mnPPTX );
SCROW nCountY = pMerge->GetRowMerge();
- nOutHeight += (long) mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY);
+ nOutHeight += static_cast<long>(mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY));
}
SvxCellVerJustify eVerJust =
@@ -4642,10 +4642,10 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
if ( bPixelToLogic )
nTotalHeight = mpRefDevice->PixelToLogic(Size(0,nTotalHeight)).Height();
- long nLeftM = (long) ( (pMargin->GetLeftMargin() + nIndent) * mnPPTX );
- long nTopM = (long) ( pMargin->GetTopMargin() * mnPPTY );
- long nRightM = (long) ( pMargin->GetRightMargin() * mnPPTX );
- long nBottomM = (long) ( pMargin->GetBottomMargin() * mnPPTY );
+ long nLeftM = static_cast<long>( (pMargin->GetLeftMargin() + nIndent) * mnPPTX );
+ long nTopM = static_cast<long>( pMargin->GetTopMargin() * mnPPTY );
+ long nRightM = static_cast<long>( pMargin->GetRightMargin() * mnPPTX );
+ long nBottomM = static_cast<long>( pMargin->GetBottomMargin() * mnPPTY );
nStartX += nLeftM;
nStartY += nTopM;
nOutWidth -= nLeftM + nRightM;
@@ -4687,7 +4687,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
//! of rows, as long as the rows can not be outputted individually
//! offsetted -> therefore unlimited, so no wrapping.
//! With offset rows the following would be correct:
- aPaperSize.Width() = (long)(nOutHeight / fabs(nSin));
+ aPaperSize.Width() = static_cast<long>(nOutHeight / fabs(nSin));
}
else if (eOrient == SvxCellOrientation::Standard)
aPaperSize.Width() = nOutWidth;
@@ -4737,7 +4737,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
pEngine->SetUpdateMode( true ); // after SetText, before CalcTextWidth/GetTextHeight
- long nEngineWidth = (long) pEngine->CalcTextWidth();
+ long nEngineWidth = static_cast<long>(pEngine->CalcTextWidth());
long nEngineHeight = pEngine->GetTextHeight();
if (nAttrRotate && bBreak)
@@ -4752,8 +4752,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
// everything is in pixels
long nEnginePixel = mpRefDevice->LogicToPixel(
Size(0,nEngineHeight)).Height();
- long nEffHeight = nOutHeight - (long)(nEnginePixel * nAbsCos) + 2;
- long nNewWidth = (long)(nEffHeight / nAbsSin) + 2;
+ long nEffHeight = nOutHeight - static_cast<long>(nEnginePixel * nAbsCos) + 2;
+ long nNewWidth = static_cast<long>(nEffHeight / nAbsSin) + 2;
bool bFits = ( nNewWidth >= aPaperSize.Width() );
if ( bFits )
nSteps = 0;
@@ -4763,7 +4763,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
{
// can't fit -> fall back to using half height
nEffHeight = nOutHeight / 2;
- nNewWidth = (long)(nEffHeight / nAbsSin) + 2;
+ nNewWidth = static_cast<long>(nEffHeight / nAbsSin) + 2;
nSteps = 0;
}
else
@@ -4777,7 +4777,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
pEngine->SetPaperSize(aPaperSize); // Scale is always 1
//pEngine->QuickFormatDoc( sal_True );
- nEngineWidth = (long) pEngine->CalcTextWidth();
+ nEngineWidth = static_cast<long>(pEngine->CalcTextWidth());
nEngineHeight = pEngine->GetTextHeight();
}
}
@@ -4793,13 +4793,13 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
double nAbsSin = fabs( nSin );
if ( eRotMode == SVX_ROTATE_MODE_STANDARD )
- nEngineWidth = (long) ( nRealWidth * nAbsCos +
+ nEngineWidth = static_cast<long>( nRealWidth * nAbsCos +
nRealHeight * nAbsSin );
else
- nEngineWidth = (long) ( nRealHeight / nAbsSin );
+ nEngineWidth = static_cast<long>( nRealHeight / nAbsSin );
//! limit !!!
- nEngineHeight = (long) ( nRealHeight * nAbsCos +
+ nEngineHeight = static_cast<long>( nRealHeight * nAbsCos +
nRealWidth * nAbsSin );
}
@@ -4825,7 +4825,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
if ( eRotMode != SVX_ROTATE_MODE_STANDARD )
{
nGridWidth = aCellSize.Width() +
- std::abs((long) ( aCellSize.Height() * nCos / nSin ));
+ std::abs(static_cast<long>( aCellSize.Height() * nCos / nSin ));
bNegative = ( pInfo->nRotateDir == ScRotateDir::Left );
if ( bLayoutRTL )
bNegative = !bNegative;
@@ -4871,11 +4871,11 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
// nEngineWidth/nEngineHeight is updated in ShrinkEditEngine
// (but width is only valid for standard mode)
- nRealWidth = (long) pEngine->CalcTextWidth();
+ nRealWidth = static_cast<long>(pEngine->CalcTextWidth());
nRealHeight = pEngine->GetTextHeight();
if ( eRotMode != SVX_ROTATE_MODE_STANDARD )
- nEngineWidth = (long) ( nRealHeight / fabs( nSin ) );
+ nEngineWidth = static_cast<long>( nRealHeight / fabs( nSin ) );
}
long nClipStartX = nStartX;
@@ -5070,8 +5070,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
nAddX += ( nUp * nCos / fabs(nSin) );
}
- aLogicStart.X() += (long) nAddX;
- aLogicStart.Y() += (long) nAddY;
+ aLogicStart.X() += static_cast<long>(nAddX);
+ aLogicStart.Y() += static_cast<long>(nAddY);
}
// bSimClip is not used here (because nOriVal is set)
@@ -5089,7 +5089,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
}
}
- pEngine->Draw( mpDev, aLogicStart, (short)nOriVal );
+ pEngine->Draw( mpDev, aLogicStart, static_cast<short>(nOriVal) );
if (bMetaFile)
mpDev->Pop();
diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx
index 9cb20ad3c1ad..37da03f697b8 100644
--- a/sc/source/ui/view/output3.cxx
+++ b/sc/source/ui/view/output3.cxx
@@ -58,8 +58,8 @@ Point ScOutputData::PrePrintDrawingLayer(long nLogStX, long nLogStY )
aRect.Top() = aRect.Bottom() = -aOffset.Y();
Point aMMOffset( aOffset );
- aMMOffset.X() = (long)(aMMOffset.X() * HMM_PER_TWIPS);
- aMMOffset.Y() = (long)(aMMOffset.Y() * HMM_PER_TWIPS);
+ aMMOffset.X() = static_cast<long>(aMMOffset.X() * HMM_PER_TWIPS);
+ aMMOffset.Y() = static_cast<long>(aMMOffset.Y() * HMM_PER_TWIPS);
if (!bMetaFile)
aMMOffset += Point( nLogStX, nLogStY );
@@ -68,10 +68,10 @@ Point ScOutputData::PrePrintDrawingLayer(long nLogStX, long nLogStY )
aRect.Right() += mpDoc->GetColWidth( nCol, nTab );
aRect.Bottom() += mpDoc->GetRowHeight( nY1, nY2, nTab );
- aRect.Left() = (long) (aRect.Left() * HMM_PER_TWIPS);
- aRect.Top() = (long) (aRect.Top() * HMM_PER_TWIPS);
- aRect.Right() = (long) (aRect.Right() * HMM_PER_TWIPS);
- aRect.Bottom() = (long) (aRect.Bottom() * HMM_PER_TWIPS);
+ aRect.Left() = static_cast<long>(aRect.Left() * HMM_PER_TWIPS);
+ aRect.Top() = static_cast<long>(aRect.Top() * HMM_PER_TWIPS);
+ aRect.Right() = static_cast<long>(aRect.Right() * HMM_PER_TWIPS);
+ aRect.Bottom() = static_cast<long>(aRect.Bottom() * HMM_PER_TWIPS);
if(pViewShell || pDrawView)
{
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 86c6821623c1..8fa2d8e3bd0b 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -351,7 +351,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
}
Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
bool bDoPrint = ( pFillLocation == nullptr );
@@ -460,15 +460,15 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
if (nPrinted) // if not, draw everything grey
{
aLocalPageSize = pPrintFunc->GetPageSize();
- aLocalPageSize.Width() = (long) (aLocalPageSize.Width() * HMM_PER_TWIPS );
- aLocalPageSize.Height() = (long) (aLocalPageSize.Height() * HMM_PER_TWIPS );
-
- nLeftMargin = (long) ( nLeftMargin * HMM_PER_TWIPS );
- nRightMargin = (long) ( nRightMargin * HMM_PER_TWIPS );
- nTopMargin = (long) ( nTopMargin * HMM_PER_TWIPS );
- nBottomMargin = (long) ( nBottomMargin * HMM_PER_TWIPS );
- nHeaderHeight = (long) ( nHeaderHeight * HMM_PER_TWIPS * mnScale / 100 + nTopMargin );
- nFooterHeight = (long) ( nFooterHeight * HMM_PER_TWIPS * mnScale / 100 + nBottomMargin );
+ aLocalPageSize.Width() = static_cast<long>(aLocalPageSize.Width() * HMM_PER_TWIPS );
+ aLocalPageSize.Height() = static_cast<long>(aLocalPageSize.Height() * HMM_PER_TWIPS );
+
+ nLeftMargin = static_cast<long>( nLeftMargin * HMM_PER_TWIPS );
+ nRightMargin = static_cast<long>( nRightMargin * HMM_PER_TWIPS );
+ nTopMargin = static_cast<long>( nTopMargin * HMM_PER_TWIPS );
+ nBottomMargin = static_cast<long>( nBottomMargin * HMM_PER_TWIPS );
+ nHeaderHeight = static_cast<long>( nHeaderHeight * HMM_PER_TWIPS * mnScale / 100 + nTopMargin );
+ nFooterHeight = static_cast<long>( nFooterHeight * HMM_PER_TWIPS * mnScale / 100 + nBottomMargin );
}
if (!bStateValid)
@@ -543,10 +543,10 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
{
SetMapMode(aMMMode);
SetLineColor( COL_BLACK );
- DrawInvert( (long)( nTopMargin - aOffset.Y() ), PointerStyle::VSizeBar );
- DrawInvert( (long)(nPageEndY - nBottomMargin ), PointerStyle::VSizeBar );
- DrawInvert( (long)( nLeftMargin - aOffset.X() ), PointerStyle::HSizeBar );
- DrawInvert( (long)( nPageEndX - nRightMargin ) , PointerStyle::HSizeBar );
+ DrawInvert( static_cast<long>( nTopMargin - aOffset.Y() ), PointerStyle::VSizeBar );
+ DrawInvert( static_cast<long>(nPageEndY - nBottomMargin ), PointerStyle::VSizeBar );
+ DrawInvert( static_cast<long>( nLeftMargin - aOffset.X() ), PointerStyle::HSizeBar );
+ DrawInvert( static_cast<long>( nPageEndX - nRightMargin ) , PointerStyle::HSizeBar );
if( bHeaderOn )
{
DrawInvert( nHeaderHeight - aOffset.Y(), PointerStyle::VSizeBar );
@@ -738,7 +738,7 @@ void ScPreview::SetZoom(sal_uInt16 nNewZoom)
// apply new MapMode and call UpdateScrollBars to update aOffset
Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
SetMapMode( aMMMode );
@@ -821,8 +821,8 @@ sal_uInt16 ScPreview::GetOptimalZoom(bool bWidthOnly)
Size aLocalPageSize = lcl_GetDocPageSize( &pDocShell->GetDocument(), nTab );
if ( aLocalPageSize.Width() && aLocalPageSize.Height() )
{
- long nZoomX = (long) ( aWinSize.Width() * 100 / ( aLocalPageSize.Width() * nWinScaleX ));
- long nZoomY = (long) ( aWinSize.Height() * 100 / ( aLocalPageSize.Height() * nWinScaleY ));
+ long nZoomX = static_cast<long>( aWinSize.Width() * 100 / ( aLocalPageSize.Width() * nWinScaleX ));
+ long nZoomY = static_cast<long>( aWinSize.Height() * 100 / ( aLocalPageSize.Height() * nWinScaleY ));
long nOptimal = nZoomX;
if (!bWidthOnly && nZoomY<nOptimal)
@@ -833,7 +833,7 @@ sal_uInt16 ScPreview::GetOptimalZoom(bool bWidthOnly)
if (nOptimal>400)
nOptimal = 400;
- return (sal_uInt16) nOptimal;
+ return static_cast<sal_uInt16>(nOptimal);
}
else
return nZoom;
@@ -966,7 +966,7 @@ void ScPreview::DataChanged( const DataChangedEvent& rDCEvt )
void ScPreview::MouseButtonDown( const MouseEvent& rMEvt )
{
Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
aButtonDownChangePoint = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
@@ -1049,7 +1049,7 @@ void ScPreview::MouseButtonDown( const MouseEvent& rMEvt )
void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
{
Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
aButtonUpPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
@@ -1103,13 +1103,13 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
ScDocShellModificator aModificator( *pDocShell );
if( bLeftRulerChange && bLeftRulerMove )
{
- aLRItem.SetLeft( (long)( aButtonUpPt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS ));
+ aLRItem.SetLeft( static_cast<long>( aButtonUpPt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS ));
rStyleSet.Put( aLRItem );
pDocShell->SetModified();
}
else if( bRightRulerChange && bRightRulerMove )
{
- aLRItem.SetRight( (long)( nWidth - aButtonUpPt.X() / HMM_PER_TWIPS - aOffset.X() / HMM_PER_TWIPS ));
+ aLRItem.SetRight( static_cast<long>( nWidth - aButtonUpPt.X() / HMM_PER_TWIPS - aOffset.X() / HMM_PER_TWIPS ));
rStyleSet.Put( aLRItem );
pDocShell->SetModified();
}
@@ -1175,13 +1175,13 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
if( bTopRulerMove && bTopRulerChange )
{
- aULItem.SetUpperValue( (sal_uInt16)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS ) );
+ aULItem.SetUpperValue( static_cast<sal_uInt16>( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS ) );
rStyleSet.Put( aULItem );
pDocShell->SetModified();
}
else if( bBottomRulerMove && bBottomRulerChange )
{
- aULItem.SetLowerValue( (sal_uInt16)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS ) );
+ aULItem.SetLowerValue( static_cast<sal_uInt16>( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS ) );
rStyleSet.Put( aULItem );
pDocShell->SetModified();
}
@@ -1192,7 +1192,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
{
const SfxItemSet& rHeaderSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet();
Size aHeaderSize = rHeaderSet.Get(ATTR_PAGE_SIZE).GetSize();
- aHeaderSize.Height() = (long)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS - aULItem.GetUpper());
+ aHeaderSize.Height() = static_cast<long>( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS - aULItem.GetUpper());
aHeaderSize.Height() = aHeaderSize.Height() * 100 / mnScale;
SvxSetItem aNewHeader( rStyleSet.Get(ATTR_PAGE_HEADERSET) );
aNewHeader.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aHeaderSize ) );
@@ -1207,7 +1207,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
{
const SfxItemSet& rFooterSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet();
Size aFooterSize = rFooterSet.Get(ATTR_PAGE_SIZE).GetSize();
- aFooterSize.Height() = (long)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS - aULItem.GetLower() );
+ aFooterSize.Height() = static_cast<long>( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS - aULItem.GetLower() );
aFooterSize.Height() = aFooterSize.Height() * 100 / mnScale;
SvxSetItem aNewFooter( rStyleSet.Get(ATTR_PAGE_FOOTERSET) );
aNewFooter.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aFooterSize ) );
@@ -1267,20 +1267,20 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
if( !bLayoutRTL )
{
- nNewColWidth = (long) ( PixelToLogic( Point( rMEvt.GetPosPixel().X() - mvRight[ nColNumberButttonDown ], 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale;
+ nNewColWidth = static_cast<long>( PixelToLogic( Point( rMEvt.GetPosPixel().X() - mvRight[ nColNumberButttonDown ], 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale;
nNewColWidth += pDocShell->GetDocument().GetColWidth( nColNumberButttonDown, nTab );
}
else
{
- nNewColWidth = (long) ( PixelToLogic( Point( mvRight[ nColNumberButttonDown ] - rMEvt.GetPosPixel().X(), 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale;
+ nNewColWidth = static_cast<long>( PixelToLogic( Point( mvRight[ nColNumberButttonDown ] - rMEvt.GetPosPixel().X(), 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale;
nNewColWidth += pDocShell->GetDocument().GetColWidth( nColNumberButttonDown, nTab );
}
if( nNewColWidth >= 0 )
{
pDocShell->GetDocFunc().SetWidthOrHeight(
- true, aCols, nTab, SC_SIZE_DIRECT, (sal_uInt16)nNewColWidth, true, true);
+ true, aCols, nTab, SC_SIZE_DIRECT, static_cast<sal_uInt16>(nNewColWidth), true, true);
pDocShell->SetModified();
}
if ( ValidTab( nTab ) )
@@ -1299,7 +1299,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
void ScPreview::MouseMove( const MouseEvent& rMEvt )
{
Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
Point aMouseMovePoint = PixelToLogic( rMEvt.GetPosPixel(), aMMMode );
@@ -1322,31 +1322,31 @@ void ScPreview::MouseMove( const MouseEvent& rMEvt )
else
pPrintFunc = new ScPrintFunc( this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions );
- nLeftMargin = (long)( pPrintFunc->GetLeftMargin() * HMM_PER_TWIPS - aOffset.X() );
- nRightMargin = (long)( pPrintFunc->GetRightMargin() * HMM_PER_TWIPS );
- nRightMargin = (long)( nWidth * HMM_PER_TWIPS - nRightMargin - aOffset.X() );
- nTopMargin = (long)( pPrintFunc->GetTopMargin() * HMM_PER_TWIPS - aOffset.Y() );
- nBottomMargin = (long)( pPrintFunc->GetBottomMargin() * HMM_PER_TWIPS );
- nBottomMargin = (long)( nHeight * HMM_PER_TWIPS - nBottomMargin - aOffset.Y() );
+ nLeftMargin = static_cast<long>( pPrintFunc->GetLeftMargin() * HMM_PER_TWIPS - aOffset.X() );
+ nRightMargin = static_cast<long>( pPrintFunc->GetRightMargin() * HMM_PER_TWIPS );
+ nRightMargin = static_cast<long>( nWidth * HMM_PER_TWIPS - nRightMargin - aOffset.X() );
+ nTopMargin = static_cast<long>( pPrintFunc->GetTopMargin() * HMM_PER_TWIPS - aOffset.Y() );
+ nBottomMargin = static_cast<long>( pPrintFunc->GetBottomMargin() * HMM_PER_TWIPS );
+ nBottomMargin = static_cast<long>( nHeight * HMM_PER_TWIPS - nBottomMargin - aOffset.Y() );
if( mnScale > 0 )
{
- nHeaderHeight = (long)( nTopMargin + pPrintFunc->GetHeader().nHeight * HMM_PER_TWIPS * mnScale / 100 );
- nFooterHeight = (long)( nBottomMargin - pPrintFunc->GetFooter().nHeight * HMM_PER_TWIPS * mnScale / 100 );
+ nHeaderHeight = static_cast<long>( nTopMargin + pPrintFunc->GetHeader().nHeight * HMM_PER_TWIPS * mnScale / 100 );
+ nFooterHeight = static_cast<long>( nBottomMargin - pPrintFunc->GetFooter().nHeight * HMM_PER_TWIPS * mnScale / 100 );
}
else
{
- nHeaderHeight = (long)( nTopMargin + pPrintFunc->GetHeader().nHeight * HMM_PER_TWIPS );
- nFooterHeight = (long)( nBottomMargin - pPrintFunc->GetFooter().nHeight * HMM_PER_TWIPS );
+ nHeaderHeight = static_cast<long>( nTopMargin + pPrintFunc->GetHeader().nHeight * HMM_PER_TWIPS );
+ nFooterHeight = static_cast<long>( nBottomMargin - pPrintFunc->GetFooter().nHeight * HMM_PER_TWIPS );
}
delete pPrintFunc;
}
Point aPixPt( rMEvt.GetPosPixel() );
Point aLeftTop = LogicToPixel( Point( nLeftMargin, -aOffset.Y() ) , aMMMode );
- Point aLeftBottom = LogicToPixel( Point( nLeftMargin ,(long)(nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode );
+ Point aLeftBottom = LogicToPixel( Point( nLeftMargin ,static_cast<long>(nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode );
Point aRightTop = LogicToPixel( Point( nRightMargin, -aOffset.Y() ), aMMMode );
Point aTopLeft = LogicToPixel( Point( -aOffset.X(), nTopMargin ), aMMMode );
- Point aTopRight = LogicToPixel( Point( (long)(nWidth * HMM_PER_TWIPS - aOffset.X()), nTopMargin ), aMMMode );
+ Point aTopRight = LogicToPixel( Point( static_cast<long>(nWidth * HMM_PER_TWIPS - aOffset.X()), nTopMargin ), aMMMode );
Point aBottomLeft = LogicToPixel( Point( -aOffset.X(), nBottomMargin ), aMMMode );
Point aHeaderLeft = LogicToPixel( Point( -aOffset.X(), nHeaderHeight ), aMMMode );
Point aFooderLeft = LogicToPixel( Point( -aOffset.X(), nFooterHeight ), aMMMode );
@@ -1356,7 +1356,7 @@ void ScPreview::MouseMove( const MouseEvent& rMEvt )
for( SCCOL i=aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ )
{
Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode );
- Point aColumnBottom = LogicToPixel( Point( 0, (long)( nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode );
+ Point aColumnBottom = LogicToPixel( Point( 0, static_cast<long>( nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode );
long nRight = i < static_cast<SCCOL>(mvRight.size()) ? mvRight[i] : 0;
if( aPixPt.X() < ( nRight + 2 ) && ( aPixPt.X() > ( nRight - 2 ) ) && ( aPixPt.X() < aRightTop.X() ) && ( aPixPt.X() > aLeftTop.X() )
&& ( aPixPt.Y() > aColumnTop.Y() ) && ( aPixPt.Y() < aColumnBottom.Y() ) && !bLeftRulerMove && !bRightRulerMove
@@ -1537,7 +1537,7 @@ css::uno::Reference<css::accessibility::XAccessible> ScPreview::CreateAccessible
void ScPreview::DragMove( long nDragMovePos, PointerStyle nFlags )
{
Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
SetMapMode( aMMMode );
long nPos = nDragMovePos;
@@ -1567,12 +1567,12 @@ void ScPreview::DrawInvert( long nDragPos, PointerStyle nFlags )
long nWidth = lcl_GetDocPageSize( &pDocShell->GetDocument(), nTab ).Width();
if( nFlags == PointerStyle::HSizeBar || nFlags == PointerStyle::HSplit )
{
- tools::Rectangle aRect( nDragPos, -aOffset.Y(), nDragPos + 1,(long)( ( nHeight * HMM_PER_TWIPS ) - aOffset.Y()));
+ tools::Rectangle aRect( nDragPos, -aOffset.Y(), nDragPos + 1,static_cast<long>( ( nHeight * HMM_PER_TWIPS ) - aOffset.Y()));
Invert( aRect, InvertFlags::N50 );
}
else if( nFlags == PointerStyle::VSizeBar )
{
- tools::Rectangle aRect( -aOffset.X(), nDragPos,(long)( ( nWidth * HMM_PER_TWIPS ) - aOffset.X() ), nDragPos + 1 );
+ tools::Rectangle aRect( -aOffset.X(), nDragPos,static_cast<long>( ( nWidth * HMM_PER_TWIPS ) - aOffset.X() ), nDragPos + 1 );
Invert( aRect, InvertFlags::N50 );
}
}
diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx
index cdcc83fcf6dd..4161242f5ff2 100644
--- a/sc/source/ui/view/prevloc.cxx
+++ b/sc/source/ui/view/prevloc.cxx
@@ -288,14 +288,14 @@ tools::Rectangle ScPreviewLocationData::GetOffsetPixel( const ScAddress& rCellPo
{
sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nTab );
if (nDocW)
- nPosX += (long) (nDocW * nScaleX);
+ nPosX += static_cast<long>(nDocW * nScaleX);
}
- long nSizeX = (long) ( pDoc->GetColWidth( nEndCol, nTab ) * nScaleX );
+ long nSizeX = static_cast<long>( pDoc->GetColWidth( nEndCol, nTab ) * nScaleX );
SCROW nEndRow = rCellPos.Row();
- long nPosY = (long) pDoc->GetScaledRowHeight( rRange.aStart.Row(),
- nEndRow, nTab, nScaleY);
- long nSizeY = (long) ( pDoc->GetRowHeight( nEndRow, nTab ) * nScaleY );
+ long nPosY = static_cast<long>(pDoc->GetScaledRowHeight( rRange.aStart.Row(),
+ nEndRow, nTab, nScaleY));
+ long nSizeY = static_cast<long>( pDoc->GetRowHeight( nEndRow, nTab ) * nScaleY );
Size aOffsetLogic( nPosX, nPosY );
Size aSizeLogic( nSizeX, nSizeY );
@@ -553,7 +553,7 @@ void ScPreviewLocationData::GetTableInfo( const tools::Rectangle& rVisiblePixel,
if (!pDoc->ColHidden(nCol, nTab))
{
sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nTab );
- long nNextX = nPosX + (long) (nDocW * nScaleX);
+ long nNextX = nPosX + static_cast<long>(nDocW * nScaleX);
long nPixelStart = pWindow->LogicToPixel( Size( nPosX, 0 ), aCellMapMode ).Width();
long nPixelEnd = pWindow->LogicToPixel( Size( nNextX, 0 ), aCellMapMode ).Width() - 1;
@@ -572,7 +572,7 @@ void ScPreviewLocationData::GetTableInfo( const tools::Rectangle& rVisiblePixel,
if (!pDoc->ColHidden(nCol, nTab))
{
sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nTab );
- long nNextX = nPosX + (long) (nDocW * nScaleX);
+ long nNextX = nPosX + static_cast<long>(nDocW * nScaleX);
long nPixelStart = pWindow->LogicToPixel( Size( nPosX, 0 ), aCellMapMode ).Width();
long nPixelEnd = pWindow->LogicToPixel( Size( nNextX, 0 ), aCellMapMode ).Width() - 1;
@@ -618,7 +618,7 @@ void ScPreviewLocationData::GetTableInfo( const tools::Rectangle& rVisiblePixel,
continue;
sal_uInt16 nDocH = pDoc->GetOriginalHeight( nRow, nTab );
- long nNextY = nPosY + (long) (nDocH * nScaleY);
+ long nNextY = nPosY + static_cast<long>(nDocH * nScaleY);
long nPixelStart = pWindow->LogicToPixel( Size( 0, nPosY ), aCellMapMode ).Height();
long nPixelEnd = pWindow->LogicToPixel( Size( 0, nNextY ), aCellMapMode ).Height() - 1;
@@ -639,7 +639,7 @@ void ScPreviewLocationData::GetTableInfo( const tools::Rectangle& rVisiblePixel,
continue;
sal_uInt16 nDocH = pDoc->GetOriginalHeight( nRow, nTab );
- long nNextY = nPosY + (long) (nDocH * nScaleY);
+ long nNextY = nPosY + static_cast<long>(nDocH * nScaleY);
long nPixelStart = pWindow->LogicToPixel( Size( 0, nPosY ), aCellMapMode ).Height();
long nPixelEnd = pWindow->LogicToPixel( Size( 0, nNextY ), aCellMapMode ).Height() - 1;
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 41b7caa91af7..2bab27e4f3c1 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -246,8 +246,8 @@ bool ScPreviewShell::GetPageSize( Size& aPageSize )
const SfxItemSet* pParamSet = &pStyleSheet->GetItemSet();
aPageSize = pParamSet->Get(ATTR_PAGE_SIZE).GetSize();
- aPageSize.Width() = (long) (aPageSize.Width() * HMM_PER_TWIPS );
- aPageSize.Height() = (long) (aPageSize.Height() * HMM_PER_TWIPS );
+ aPageSize.Width() = static_cast<long>(aPageSize.Width() * HMM_PER_TWIPS );
+ aPageSize.Height() = static_cast<long>(aPageSize.Height() * HMM_PER_TWIPS );
return true;
}
@@ -483,14 +483,14 @@ bool ScPreviewShell::ScrollCommand( const CommandEvent& rCEvt )
long nOld = pPreview->GetZoom();
long nNew;
if ( pData->GetDelta() < 0 )
- nNew = std::max( (long) MINZOOM, basegfx::zoomtools::zoomOut( nOld ));
+ nNew = std::max( long(MINZOOM), basegfx::zoomtools::zoomOut( nOld ));
else
- nNew = std::min( (long) MAXZOOM, basegfx::zoomtools::zoomIn( nOld ));
+ nNew = std::min( long(MAXZOOM), basegfx::zoomtools::zoomIn( nOld ));
if ( nNew != nOld )
{
eZoom = SvxZoomType::PERCENT;
- pPreview->SetZoom( (sal_uInt16)nNew );
+ pPreview->SetZoom( static_cast<sal_uInt16>(nNew) );
}
bDone = true;
@@ -918,7 +918,7 @@ void ScPreviewShell::ReadUserData(const OUString& rData, bool /* bBrowse */)
if (!rData.isEmpty())
{
sal_Int32 nIndex = 0;
- pPreview->SetZoom((sal_uInt16)rData.getToken(0, SC_USERDATA_SEP, nIndex).toInt32());
+ pPreview->SetZoom(static_cast<sal_uInt16>(rData.getToken(0, SC_USERDATA_SEP, nIndex).toInt32()));
pPreview->SetPageNo(rData.getToken(0, SC_USERDATA_SEP, nIndex).toInt32());
eZoom = SvxZoomType::PERCENT;
}
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 5a7711e9867a..2282d7ec9ebe 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -514,15 +514,15 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr
long nTwipsSizeX = 0;
for (SCCOL i=nX1; i<=nX2; i++)
nTwipsSizeX += pDoc->GetColWidth( i, nTab );
- long nTwipsSizeY = (long) pDoc->GetRowHeight( nY1, nY2, nTab );
+ long nTwipsSizeY = static_cast<long>(pDoc->GetRowHeight( nY1, nY2, nTab ));
// if no lines, still space for the outline frame (20 Twips = 1pt)
// (HasLines initializes aLines to 0,0,0,0)
nTwipsSizeX += aLines.Left() + std::max( aLines.Right(), 20L );
nTwipsSizeY += aLines.Top() + std::max( aLines.Bottom(), 20L );
- double nScaleX = (double) nDevSizeX / nTwipsSizeX;
- double nScaleY = (double) nDevSizeY / nTwipsSizeY;
+ double nScaleX = static_cast<double>(nDevSizeX) / nTwipsSizeX;
+ double nScaleY = static_cast<double>(nDevSizeY) / nTwipsSizeY;
//! hand over Flag at FillInfo !!!!!
ScRange aERange;
@@ -548,9 +548,9 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr
// If no lines, still leave space for grid lines
// (would be elseways cut away)
- long nAddX = (long)( aLines.Left() * nScaleX );
+ long nAddX = static_cast<long>( aLines.Left() * nScaleX );
nScrX += ( nAddX ? nAddX : 1 );
- long nAddY = (long)( aLines.Top() * nScaleY );
+ long nAddY = static_cast<long>( aLines.Top() * nScaleY );
nScrY += ( nAddY ? nAddY : 1 );
ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pDoc, nTab,
@@ -768,7 +768,7 @@ long ScPrintFunc::TextHeight( const EditTextObject* pObject )
pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false );
- return (long) pEditEngine->GetTextHeight();
+ return static_cast<long>(pEditEngine->GetTextHeight());
}
// nZoom must be set !!!
@@ -932,7 +932,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
aTableParam.bLeftRight = !aTableParam.bLeftRight;
aTableParam.nFirstPageNo = lcl_GetUShort(pParamSet,ATTR_PAGE_FIRSTPAGENO);
if (!aTableParam.nFirstPageNo)
- aTableParam.nFirstPageNo = (sal_uInt16) nPageStart; // from previous table
+ aTableParam.nFirstPageNo = static_cast<sal_uInt16>(nPageStart); // from previous table
if ( pScaleItem && pScaleToItem && pScaleToPagesItem )
{
@@ -1277,10 +1277,10 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH,
// aFrameRect - outside around frame, without shadow
if ( pShadow && pShadow->GetLocation() != SvxShadowLocation::NONE )
{
- nLeft += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX );
- nRight += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX );
- nTop += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY );
- nBottom += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY );
+ nLeft += static_cast<long>( pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX );
+ nRight += static_cast<long>( pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX );
+ nTop += static_cast<long>( pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY );
+ nBottom += static_cast<long>( pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY );
}
tools::Rectangle aFrameRect( Point(nScrX+nLeft, nScrY+nTop),
Size(nScrW-nLeft-nRight, nScrH-nTop-nBottom) );
@@ -1288,10 +1288,10 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH,
// center of frame, to paint lines through OutputData
if (pBorderData)
{
- nLeft += (long) ( lcl_LineTotal(pBorderData->GetLeft()) * nScaleX / 2 );
- nRight += (long) ( lcl_LineTotal(pBorderData->GetRight()) * nScaleX / 2 );
- nTop += (long) ( lcl_LineTotal(pBorderData->GetTop()) * nScaleY / 2 );
- nBottom += (long) ( lcl_LineTotal(pBorderData->GetBottom()) * nScaleY / 2 );
+ nLeft += static_cast<long>( lcl_LineTotal(pBorderData->GetLeft()) * nScaleX / 2 );
+ nRight += static_cast<long>( lcl_LineTotal(pBorderData->GetRight()) * nScaleX / 2 );
+ nTop += static_cast<long>( lcl_LineTotal(pBorderData->GetTop()) * nScaleY / 2 );
+ nBottom += static_cast<long>( lcl_LineTotal(pBorderData->GetBottom()) * nScaleY / 2 );
}
long nEffHeight = nScrH - nTop - nBottom;
long nEffWidth = nScrW - nLeft - nRight;
@@ -1325,8 +1325,8 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH,
{
pDev->SetFillColor(pShadow->GetColor());
pDev->SetLineColor();
- long nShadowX = (long) ( pShadow->GetWidth() * nScaleX );
- long nShadowY = (long) ( pShadow->GetWidth() * nScaleY );
+ long nShadowX = static_cast<long>( pShadow->GetWidth() * nScaleX );
+ long nShadowY = static_cast<long>( pShadow->GetWidth() * nScaleY );
switch (pShadow->GetLocation())
{
case SvxShadowLocation::TopLeft:
@@ -1380,9 +1380,9 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH,
nScaleX, nScaleY, false, false );
OSL_ENSURE(aTabInfo.mnArrCount,"nArrCount == 0");
- aTabInfo.mpRowInfo[1].nHeight = (sal_uInt16) nEffHeight;
+ aTabInfo.mpRowInfo[1].nHeight = static_cast<sal_uInt16>(nEffHeight);
aTabInfo.mpRowInfo[0].pCellInfo[1].nWidth =
- aTabInfo.mpRowInfo[1].pCellInfo[1].nWidth = (sal_uInt16) nEffWidth;
+ aTabInfo.mpRowInfo[1].pCellInfo[1].nWidth = static_cast<sal_uInt16>(nEffWidth);
ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pBorderDoc.get(), 0,
nScrX+nLeft, nScrY+nTop, 0,0, 0,0, nScaleX, nScaleY );
@@ -1403,14 +1403,14 @@ void ScPrintFunc::PrintColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY )
long nOneY = aOnePixel.Height();
SCCOL nCol;
- long nHeight = (long) (PRINT_HEADER_HEIGHT * nScaleY);
+ long nHeight = static_cast<long>(PRINT_HEADER_HEIGHT * nScaleY);
long nEndY = nScrY + nHeight - nOneY;
long nPosX = nScrX;
if ( bLayoutRTL )
{
for (nCol=nX1; nCol<=nX2; nCol++)
- nPosX += (long)( pDoc->GetColWidth( nCol, nPrintTab ) * nScaleX );
+ nPosX += static_cast<long>( pDoc->GetColWidth( nCol, nPrintTab ) * nScaleX );
}
else
nPosX -= nOneX;
@@ -1422,7 +1422,7 @@ void ScPrintFunc::PrintColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY )
sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nPrintTab );
if (nDocW)
{
- long nWidth = (long) (nDocW * nScaleX);
+ long nWidth = static_cast<long>(nDocW * nScaleX);
long nEndX = nPosX + nWidth * nLayoutSign;
pDev->DrawRect( tools::Rectangle( nPosX,nPosY,nEndX,nEndY ) );
@@ -1450,7 +1450,7 @@ void ScPrintFunc::PrintRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY )
bool bLayoutRTL = pDoc->IsLayoutRTL( nPrintTab );
- long nWidth = (long) (PRINT_HEADER_WIDTH * nScaleX);
+ long nWidth = static_cast<long>(PRINT_HEADER_WIDTH * nScaleX);
long nEndX = nScrX + nWidth;
long nPosX = nScrX;
if ( !bLayoutRTL )
@@ -1466,7 +1466,7 @@ void ScPrintFunc::PrintRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY )
sal_uInt16 nDocH = pDoc->GetRowHeight( nRow, nPrintTab );
if (nDocH)
{
- long nHeight = (long) (nDocH * nScaleY);
+ long nHeight = static_cast<long>(nDocH * nScaleY);
long nEndY = nPosY + nHeight;
pDev->DrawRect( tools::Rectangle( nPosX,nPosY,nEndX,nEndY ) );
@@ -1490,7 +1490,7 @@ void ScPrintFunc::LocateColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY,
long nOneX = aOnePixel.Width();
long nOneY = aOnePixel.Height();
- long nHeight = (long) (PRINT_HEADER_HEIGHT * nScaleY);
+ long nHeight = static_cast<long>(PRINT_HEADER_HEIGHT * nScaleY);
long nEndY = nScrY + nHeight - nOneY;
long nPosX = nScrX - nOneX;
@@ -1498,7 +1498,7 @@ void ScPrintFunc::LocateColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY,
{
sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nPrintTab );
if (nDocW)
- nPosX += (long) (nDocW * nScaleX);
+ nPosX += static_cast<long>(nDocW * nScaleX);
}
tools::Rectangle aCellRect( nScrX, nScrY, nPosX, nEndY );
rLocationData.AddColHeaders( aCellRect, nX1, nX2, bRepCol );
@@ -1513,7 +1513,7 @@ void ScPrintFunc::LocateRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY,
bool bLayoutRTL = pDoc->IsLayoutRTL( nPrintTab );
- long nWidth = (long) (PRINT_HEADER_WIDTH * nScaleX);
+ long nWidth = static_cast<long>(PRINT_HEADER_WIDTH * nScaleX);
long nEndX = nScrX + nWidth;
if ( !bLayoutRTL )
nEndX -= nOneX;
@@ -1541,8 +1541,8 @@ void ScPrintFunc::LocateArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
aTwipOffset.Y() -= pDoc->GetRowHeight( 0, nY1-1, nPrintTab );
Point aMMOffset( aTwipOffset );
- aMMOffset.X() = (long)(aMMOffset.X() * HMM_PER_TWIPS);
- aMMOffset.Y() = (long)(aMMOffset.Y() * HMM_PER_TWIPS);
+ aMMOffset.X() = static_cast<long>(aMMOffset.X() * HMM_PER_TWIPS);
+ aMMOffset.Y() = static_cast<long>(aMMOffset.Y() * HMM_PER_TWIPS);
aMMOffset += Point( nLogStX, nLogStY );
MapMode aDrawMapMode( MapUnit::Map100thMM, aMMOffset, aLogicMode.GetScaleX(), aLogicMode.GetScaleY() );
@@ -1557,7 +1557,7 @@ void ScPrintFunc::LocateArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
{
sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nPrintTab );
if (nDocW)
- nPosX += (long) (nDocW * nScaleX);
+ nPosX += static_cast<long>(nDocW * nScaleX);
}
long nPosY = nScrY - nOneY;
@@ -1834,7 +1834,7 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY,
pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false );
Point aDraw = aStart;
- long nDif = aPaperSize.Height() - (long) pEditEngine->GetTextHeight();
+ long nDif = aPaperSize.Height() - static_cast<long>(pEditEngine->GetTextHeight());
if (nDif > 0)
aDraw.Y() += nDif / 2;
pEditEngine->Draw( pDev, aDraw );
@@ -1848,7 +1848,7 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY,
pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false );
Point aDraw = aStart;
- long nDif = aPaperSize.Height() - (long) pEditEngine->GetTextHeight();
+ long nDif = aPaperSize.Height() - static_cast<long>(pEditEngine->GetTextHeight());
if (nDif > 0)
aDraw.Y() += nDif / 2;
pEditEngine->Draw( pDev, aDraw );
@@ -1862,7 +1862,7 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY,
pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false );
Point aDraw = aStart;
- long nDif = aPaperSize.Height() - (long) pEditEngine->GetTextHeight();
+ long nDif = aPaperSize.Height() - static_cast<long>(pEditEngine->GetTextHeight());
if (nDif > 0)
aDraw.Y() += nDif / 2;
pEditEngine->Draw( pDev, aDraw );
@@ -1955,7 +1955,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, bool bDoPrint, ScPreviewLocationData
long ScPrintFunc::PrintNotes( long nPageNo, long nNoteStart, bool bDoPrint, ScPreviewLocationData* pLocationData )
{
- if ( nNoteStart >= (long) aNotePosList.size() || !aTableParam.bNotes )
+ if ( nNoteStart >= static_cast<long>(aNotePosList.size()) || !aTableParam.bNotes )
return 0;
if ( bDoPrint && bClearWin )
@@ -1970,8 +1970,8 @@ long ScPrintFunc::PrintNotes( long nPageNo, long nNoteStart, bool bDoPrint, ScPr
pDev->SetLineColor();
pDev->SetFillColor(aBackgroundColor);
pDev->DrawRect(tools::Rectangle(Point(),
- Size((long)(aPageSize.Width() * nScaleX * 100 / nZoom),
- (long)(aPageSize.Height() * nScaleY * 100 / nZoom))));
+ Size(static_cast<long>(aPageSize.Width() * nScaleX * 100 / nZoom),
+ static_cast<long>(aPageSize.Height() * nScaleY * 100 / nZoom))));
}
// adjust aPageRect for left/right page
@@ -2039,8 +2039,8 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
pDev->SetLineColor();
pDev->SetFillColor(aBackgroundColor);
pDev->DrawRect(tools::Rectangle(Point(),
- Size((long)(aPageSize.Width() * nScaleX * 100 / nZoom),
- (long)(aPageSize.Height() * nScaleY * 100 / nZoom))));
+ Size(static_cast<long>(aPageSize.Width() * nScaleX * 100 / nZoom),
+ static_cast<long>(aPageSize.Height() * nScaleY * 100 / nZoom))));
}
// adjust aPageRect for left/right page
@@ -2107,7 +2107,7 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
for (i=nRepeatStartCol; i<=nRepeatEndCol; i++)
nDataWidth += pDoc->GetColWidth( i,nPrintTab );
if (aTableParam.bHeaders)
- nDataWidth += (long) PRINT_HEADER_WIDTH;
+ nDataWidth += long(PRINT_HEADER_WIDTH);
if (pBorderItem)
nDataWidth += pBorderItem->GetDistance(SvxBoxItemLine::LEFT) +
pBorderItem->GetDistance(SvxBoxItemLine::RIGHT); //! Line width?
@@ -2130,7 +2130,7 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
nDataHeight += pDoc->GetRowHeight( nRepeatStartRow,
nRepeatEndRow, nPrintTab);
if (aTableParam.bHeaders)
- nDataHeight += (long) PRINT_HEADER_HEIGHT;
+ nDataHeight += long(PRINT_HEADER_HEIGHT);
if (pBorderItem)
nDataHeight += pBorderItem->GetDistance(SvxBoxItemLine::TOP) +
pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM); //! Line width?
@@ -2153,37 +2153,37 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
long nContentHeight = 0;
if (aTableParam.bHeaders)
{
- nHeaderWidth = (long) (PRINT_HEADER_WIDTH * nScaleX);
- nHeaderHeight = (long) (PRINT_HEADER_HEIGHT * nScaleY);
+ nHeaderWidth = static_cast<long>(PRINT_HEADER_WIDTH * nScaleX);
+ nHeaderHeight = static_cast<long>(PRINT_HEADER_HEIGHT * nScaleY);
}
if (bDoRepCol)
for (SCCOL i=nRepeatStartCol; i<=nRepeatEndCol; i++)
- nRepeatWidth += (long) (pDoc->GetColWidth(i,nPrintTab) * nScaleX);
+ nRepeatWidth += static_cast<long>(pDoc->GetColWidth(i,nPrintTab) * nScaleX);
if (bDoRepRow)
nRepeatHeight += pDoc->GetScaledRowHeight( nRepeatStartRow,
nRepeatEndRow, nPrintTab, nScaleY);
for (SCCOL i=nX1; i<=nX2; i++)
- nContentWidth += (long) (pDoc->GetColWidth(i,nPrintTab) * nScaleX);
+ nContentWidth += static_cast<long>(pDoc->GetColWidth(i,nPrintTab) * nScaleX);
nContentHeight += pDoc->GetScaledRowHeight( nY1, nY2, nPrintTab,
nScaleY);
// partition the page
- long nStartX = (long) ( nLeftSpace * nScaleX );
- long nStartY = (long) ( nTopSpace * nScaleY );
+ long nStartX = static_cast<long>( nLeftSpace * nScaleX );
+ long nStartY = static_cast<long>( nTopSpace * nScaleY );
long nInnerStartX = nStartX;
long nInnerStartY = nStartY;
if (pBorderItem)
{
- nInnerStartX += (long) ( ( lcl_LineTotal(pBorderItem->GetLeft()) +
+ nInnerStartX += static_cast<long>( ( lcl_LineTotal(pBorderItem->GetLeft()) +
pBorderItem->GetDistance(SvxBoxItemLine::LEFT) ) * nScaleX );
- nInnerStartY += (long) ( ( lcl_LineTotal(pBorderItem->GetTop()) +
+ nInnerStartY += static_cast<long>( ( lcl_LineTotal(pBorderItem->GetTop()) +
pBorderItem->GetDistance(SvxBoxItemLine::TOP) ) * nScaleY );
}
if (pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE)
{
- nInnerStartX += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX );
- nInnerStartY += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY );
+ nInnerStartX += static_cast<long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX );
+ nInnerStartY += static_cast<long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY );
}
if ( bLayoutRTL )
@@ -2229,15 +2229,15 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
long nBorderEndY = nEndY;
if (pBorderItem)
{
- nBorderEndX += (long) ( ( lcl_LineTotal(pBorderItem->GetRight()) +
+ nBorderEndX += static_cast<long>( ( lcl_LineTotal(pBorderItem->GetRight()) +
pBorderItem->GetDistance(SvxBoxItemLine::RIGHT) ) * nScaleX );
- nBorderEndY += (long) ( ( lcl_LineTotal(pBorderItem->GetBottom()) +
+ nBorderEndY += static_cast<long>( ( lcl_LineTotal(pBorderItem->GetBottom()) +
pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM) ) * nScaleY );
}
if (pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE)
{
- nBorderEndX += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX );
- nBorderEndY += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY );
+ nBorderEndX += static_cast<long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX );
+ nBorderEndY += static_cast<long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY );
}
if ( bDoPrint )
@@ -2484,7 +2484,7 @@ long ScPrintFunc::CountPages() // sets also nPagesX, nP
nPages += m_aRanges.m_aPageRows[nY].CountVisible();
}
else
- nPages += ((long) m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY;
+ nPages += static_cast<long>(m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY;
if ( pPageData )
FillPageData();
}
@@ -2499,7 +2499,7 @@ long ScPrintFunc::CountPages() // sets also nPagesX, nP
nPages += m_aRanges.m_aPageRows[nY].CountVisible();
}
else
- nPages += ((long) m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY;
+ nPages += static_cast<long>(m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY;
if ( pPageData )
FillPageData();
}
@@ -2580,7 +2580,7 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc.
{
aOffset = Point( aSrcOffset.X()*100/nZoom, aSrcOffset.Y()*100/nZoom );
- long nEffZoom = nZoom * (long) nManualZoom;
+ long nEffZoom = nZoom * static_cast<long>(nManualZoom);
nScaleX = nScaleY = HMM_PER_TWIPS; // output in 1/100 mm
Fraction aZoomFract( nEffZoom,10000 );
@@ -2589,7 +2589,7 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc.
if ( !pPrinter && !bIsRender ) // adjust scale for preview
{
double nFact = pDocShell->GetOutputFactor();
- aHorFract = Fraction( (long)( nEffZoom / nFact ), 10000 );
+ aHorFract = Fraction( static_cast<long>( nEffZoom / nFact ), 10000 );
}
aLogicMode = MapMode( MapUnit::Map100thMM, Point(), aHorFract, aZoomFract );
@@ -2597,7 +2597,7 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc.
Point aLogicOfs( -aOffset.X(), -aOffset.Y() );
aOffsetMode = MapMode( MapUnit::Map100thMM, aLogicOfs, aHorFract, aZoomFract );
- Point aTwipsOfs( (long) ( -aOffset.X() / nScaleX + 0.5 ), (long) ( -aOffset.Y() / nScaleY + 0.5 ) );
+ Point aTwipsOfs( static_cast<long>( -aOffset.X() / nScaleX + 0.5 ), static_cast<long>( -aOffset.Y() / nScaleY + 0.5 ) );
aTwipMode = MapMode( MapUnit::MapTwip, aTwipsOfs, aHorFract, aZoomFract );
}
@@ -2944,8 +2944,8 @@ Size ScPrintFunc::GetDocPageSize()
Size aDocPageSize = aPageRect.GetSize();
if (aTableParam.bHeaders)
{
- aDocPageSize.Width() -= (long) PRINT_HEADER_WIDTH;
- aDocPageSize.Height() -= (long) PRINT_HEADER_HEIGHT;
+ aDocPageSize.Width() -= long(PRINT_HEADER_WIDTH);
+ aDocPageSize.Height() -= long(PRINT_HEADER_HEIGHT);
}
if (pBorderItem)
{
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index f06043c79276..34edfe50b2c7 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -494,7 +494,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
long nSizeX = 0;
for (SCCOL i=nPosX+1; i<=nEndX; i++)
nSizeX += pDoc->GetColWidth( i, nTab );
- long nSizeY = (long) pDoc->GetRowHeight( nPosY+1, nEndY, nTab );
+ long nSizeY = static_cast<long>(pDoc->GetRowHeight( nPosY+1, nEndY, nTab ));
SCCOL nDelStartX = nStartX;
SCROW nDelStartY = nStartY;
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 9e88f11f36e5..070fe7dacd4f 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -765,7 +765,7 @@ void ScTabView::UpdateVarZoom()
const Fraction& rOldX = GetViewData().GetZoomX();
const Fraction& rOldY = GetViewData().GetZoomY();
long nOldPercent = long(rOldY * 100);
- sal_uInt16 nNewZoom = CalcZoom( eZoomType, (sal_uInt16)nOldPercent );
+ sal_uInt16 nNewZoom = CalcZoom( eZoomType, static_cast<sal_uInt16>(nOldPercent) );
Fraction aNew( nNewZoom, 100 );
if ( aNew != rOldX || aNew != rOldY )
@@ -985,12 +985,12 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
// and can't be changed directly
const Fraction& rOldY = aViewData.GetZoomY();
- long nOld = (long)( rOldY * 100 );
+ long nOld = static_cast<long>( rOldY * 100 );
long nNew;
if ( pData->GetDelta() < 0 )
- nNew = std::max( (long) MINZOOM, basegfx::zoomtools::zoomOut( nOld ));
+ nNew = std::max( long(MINZOOM), basegfx::zoomtools::zoomOut( nOld ));
else
- nNew = std::min( (long) MAXZOOM, basegfx::zoomtools::zoomIn( nOld ));
+ nNew = std::min( long(MAXZOOM), basegfx::zoomtools::zoomIn( nOld ));
if ( nNew != nOld )
{
// scroll wheel doesn't set the AppOptions default
@@ -1087,7 +1087,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll, void )
if (bHoriz)
{
aHelpStr = ScGlobal::GetRscString(STR_COLUMN) +
- " " + ScColToAlpha((SCCOL) nScrollPos);
+ " " + ScColToAlpha(static_cast<SCCOL>(nScrollPos));
aRect.Left() = aMousePos.X();
aRect.Top() = aPos.Y() - 4;
@@ -1120,10 +1120,10 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll, void )
nDelta = 1;
break;
case ScrollType::PageUp:
- if ( pScroll == aHScrollLeft.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT );
- if ( pScroll == aHScrollRight.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT );
- if ( pScroll == aVScrollTop.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP );
- if ( pScroll == aVScrollBottom.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM );
+ if ( pScroll == aHScrollLeft.get() ) nDelta = -static_cast<long>(aViewData.PrevCellsX( SC_SPLIT_LEFT ));
+ if ( pScroll == aHScrollRight.get() ) nDelta = -static_cast<long>(aViewData.PrevCellsX( SC_SPLIT_RIGHT ));
+ if ( pScroll == aVScrollTop.get() ) nDelta = -static_cast<long>(aViewData.PrevCellsY( SC_SPLIT_TOP ));
+ if ( pScroll == aVScrollBottom.get() ) nDelta = -static_cast<long>(aViewData.PrevCellsY( SC_SPLIT_BOTTOM ));
if (nDelta==0) nDelta=-1;
break;
case ScrollType::PageDown:
@@ -1592,7 +1592,7 @@ void ScTabView::DoHSplit(long nSplitPos)
long nLeftWidth = nSplitPos - pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
if ( nLeftWidth < 0 ) nLeftWidth = 0;
nNewDelta = nOldDelta + aViewData.CellsAtX( nOldDelta, 1, SC_SPLIT_LEFT,
- (sal_uInt16) nLeftWidth );
+ static_cast<sal_uInt16>(nLeftWidth) );
if ( nNewDelta > MAXCOL )
nNewDelta = MAXCOL;
aViewData.SetPosX( SC_SPLIT_RIGHT, nNewDelta );
@@ -1664,7 +1664,7 @@ void ScTabView::DoVSplit(long nSplitPos)
long nTopHeight = nSplitPos - pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
if ( nTopHeight < 0 ) nTopHeight = 0;
nNewDelta = nOldDelta + aViewData.CellsAtY( nOldDelta, 1, SC_SPLIT_TOP,
- (sal_uInt16) nTopHeight );
+ static_cast<sal_uInt16>(nTopHeight) );
if ( nNewDelta > MAXROW )
nNewDelta = MAXROW;
aViewData.SetPosY( SC_SPLIT_BOTTOM, nNewDelta );
@@ -1699,11 +1699,11 @@ Point ScTabView::GetInsertPos()
long nPosX = 0;
for (SCCOL i=0; i<nCol; i++)
nPosX += pDoc->GetColWidth(i,nTab);
- nPosX = (long)(nPosX * HMM_PER_TWIPS);
+ nPosX = static_cast<long>(nPosX * HMM_PER_TWIPS);
if ( pDoc->IsNegativePage( nTab ) )
nPosX = -nPosX;
- long nPosY = (long) pDoc->GetRowHeight( 0, nRow-1, nTab);
- nPosY = (long)(nPosY * HMM_PER_TWIPS);
+ long nPosY = static_cast<long>(pDoc->GetRowHeight( 0, nRow-1, nTab));
+ nPosY = static_cast<long>(nPosY * HMM_PER_TWIPS);
return Point(nPosX,nPosY);
}
@@ -1737,8 +1737,8 @@ Point ScTabView::GetChartInsertPos( const Size& rSize, const ScRange& rCellRange
bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
long nLayoutSign = bLayoutRTL ? -1 : 1;
- long nDocX = (long)( (double) pDoc->GetColOffset( MAXCOL + 1, nTab ) * HMM_PER_TWIPS ) * nLayoutSign;
- long nDocY = (long)( (double) pDoc->GetRowOffset( MAXROW + 1, nTab ) * HMM_PER_TWIPS );
+ long nDocX = static_cast<long>( static_cast<double>(pDoc->GetColOffset( MAXCOL + 1, nTab )) * HMM_PER_TWIPS ) * nLayoutSign;
+ long nDocY = static_cast<long>( static_cast<double>(pDoc->GetRowOffset( MAXROW + 1, nTab )) * HMM_PER_TWIPS );
if ( aVisible.Left() * nLayoutSign > nDocX * nLayoutSign )
aVisible.Left() = nDocX;
@@ -2795,7 +2795,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
if (pModelObj)
aOldSize = pModelObj->getDocumentSize();
- aViewData.SetMaxTiledRow(std::min(std::max(nEndRow, aViewData.GetMaxTiledRow()) + nVisibleRows, (long)MAXTILEDROW));
+ aViewData.SetMaxTiledRow(std::min(std::max(nEndRow, aViewData.GetMaxTiledRow()) + nVisibleRows, long(MAXTILEDROW)));
Size aNewSize(0, 0);
if (pModelObj)
@@ -2936,7 +2936,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
if (pModelObj)
aOldSize = pModelObj->getDocumentSize();
- aViewData.SetMaxTiledCol(std::min(std::max(nEndCol, aViewData.GetMaxTiledCol()) + nVisibleCols, (long)MAXCOL));
+ aViewData.SetMaxTiledCol(std::min(std::max(nEndCol, aViewData.GetMaxTiledCol()) + nVisibleCols, long(MAXCOL)));
Size aNewSize(0, 0);
if (pModelObj)
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index ee2897e38a69..cf4770798a19 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -1125,7 +1125,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
SCCOL nFixPosX, SCROW nFixPosY )
{
- double fZoomFactor = (double)Fraction(nZoom,100);
+ double fZoomFactor = static_cast<double>(Fraction(nZoom,100));
fScaleX *= fZoomFactor;
fScaleY *= fZoomFactor;
@@ -1137,7 +1137,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom,
sal_uInt16 nColTwips = pDoc->GetColWidth( nCol, nTab );
if (nColTwips)
{
- nBlockX += (long)(nColTwips * fScaleX);
+ nBlockX += static_cast<long>(nColTwips * fScaleX);
if (nBlockX > nWindowX)
return false;
}
@@ -1147,7 +1147,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom,
sal_uInt16 nColTwips = pDoc->GetColWidth( nCol, nTab );
if (nColTwips)
{
- nBlockX += (long)(nColTwips * fScaleX);
+ nBlockX += static_cast<long>(nColTwips * fScaleX);
if (nBlockX > nWindowX)
return false;
}
@@ -1163,7 +1163,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom,
sal_uInt16 nRowTwips = pDoc->GetRowHeight(nRow, nTab);
if (nRowTwips)
{
- nBlockY += (long)(nRowTwips * fScaleY);
+ nBlockY += static_cast<long>(nRowTwips * fScaleY);
if (nBlockY > nWindowY)
return false;
}
@@ -1173,7 +1173,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom,
sal_uInt16 nRowTwips = pDoc->GetRowHeight(nRow, nTab);
if (nRowTwips)
{
- nBlockY += (long)(nRowTwips * fScaleY);
+ nBlockY += static_cast<long>(nRowTwips * fScaleY);
if (nBlockY > nWindowY)
return false;
}
@@ -1350,9 +1350,9 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
double nPPTX = ScGlobal::nScreenPPTX / aViewData.GetDocShell()->GetOutputFactor();
double nPPTY = ScGlobal::nScreenPPTY;
- long nZoomX = (long) ( aWinSize.Width() * 100 /
+ long nZoomX = static_cast<long>( aWinSize.Width() * 100 /
( aPageSize.Width() * nPPTX ) );
- long nZoomY = (long) ( aWinSize.Height() * 100 /
+ long nZoomY = static_cast<long>( aWinSize.Height() * 100 /
( aPageSize.Height() * nPPTY ) );
if (nZoomX > 0)
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index d1db0c9e9d97..6f40587c4d54 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2344,7 +2344,7 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
//!if ( nCol1 > 0 && !aViewData.GetDocument()->IsBlockEmpty(
//! aViewData.GetTabNo(),
//! 0, nRow1, nCol1-1, nRow2 ) )
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * aViewData.GetPPTX() );
+ long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * aViewData.GetPPTX() );
aStart.X() -= nMarkPixel * nLayoutSign;
}
@@ -2430,7 +2430,7 @@ void ScTabView::PaintRangeFinder( long nNumber )
if ( pRangeFinder && pRangeFinder->GetDocName() == aViewData.GetDocShell()->GetTitle() )
{
SCTAB nTab = aViewData.GetTabNo();
- sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count();
+ sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count());
if (nNumber < 0)
{
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index a366f99be4a0..be95dcbab4b5 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -369,7 +369,7 @@ static long lcl_GetScrollRange( SCCOLROW nDocEnd, SCCOLROW nPos, SCCOLROW nVis,
++nVis;
++nMax; // for partially visible cells
- SCCOLROW nEnd = std::max(nDocEnd, (SCCOLROW)(nPos+nVis)) + nVis;
+ SCCOLROW nEnd = std::max(nDocEnd, static_cast<SCCOLROW>(nPos+nVis)) + nVis;
if (nEnd > nMax)
nEnd = nMax;
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 005399636816..eb76bafe7151 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -581,7 +581,7 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect )
if (nScrollX > 0)
while (nScrollX > 0 && nPosX < MAXCOL)
{
- nScrollX -= (long) ( pDoc->GetColWidth(nPosX, nTab) * nPPTX );
+ nScrollX -= static_cast<long>( pDoc->GetColWidth(nPosX, nTab) * nPPTX );
++nPosX;
++nLinesX;
}
@@ -589,14 +589,14 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect )
while (nScrollX < 0 && nPosX > 0)
{
--nPosX;
- nScrollX += (long) ( pDoc->GetColWidth(nPosX, nTab) * nPPTX );
+ nScrollX += static_cast<long>( pDoc->GetColWidth(nPosX, nTab) * nPPTX );
--nLinesX;
}
if (nScrollY > 0)
while (nScrollY > 0 && nPosY < MAXROW)
{
- nScrollY -= (long) ( pDoc->GetRowHeight(nPosY, nTab) * nPPTY );
+ nScrollY -= static_cast<long>( pDoc->GetRowHeight(nPosY, nTab) * nPPTY );
++nPosY;
++nLinesY;
}
@@ -604,7 +604,7 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect )
while (nScrollY < 0 && nPosY > 0)
{
--nPosY;
- nScrollY += (long) ( pDoc->GetRowHeight(nPosY, nTab) * nPPTY );
+ nScrollY += static_cast<long>( pDoc->GetRowHeight(nPosY, nTab) * nPPTY );
--nLinesY;
}
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index ddd1ef663525..a1450c31bf06 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -381,7 +381,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
{
// one-based row numbers
- aScAddress.SetRow( (SCROW)(nNumeric - 1) );
+ aScAddress.SetRow( static_cast<SCROW>(nNumeric - 1) );
aScAddress.SetCol( rViewData.GetCurX() );
aScAddress.SetTab( nTab );
aScRange = ScRange( aScAddress, aScAddress );
@@ -692,7 +692,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
SvxZoomType eOldZoomType = GetZoomType();
SvxZoomType eNewZoomType = eOldZoomType;
const Fraction& rOldY = GetViewData().GetZoomY(); // Y is shown
- sal_uInt16 nOldZoom = (sal_uInt16)long( rOldY * 100 );
+ sal_uInt16 nOldZoom = static_cast<sal_uInt16>(long( rOldY * 100 ));
sal_uInt16 nZoom = nOldZoom;
bool bCancel = false;
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 844eecb01f3a..3c69bb0ce1d4 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -301,7 +301,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
else
{
const Fraction& rOldY = GetViewData().GetZoomY();
- sal_uInt16 nZoom = (sal_uInt16)long( rOldY * 100 );
+ sal_uInt16 nZoom = static_cast<sal_uInt16>(long( rOldY * 100 ));
rSet.Put( SvxZoomItem( SvxZoomType::PERCENT, nZoom, nWhich ) );
}
break;
@@ -313,7 +313,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
else
{
const Fraction& rOldY = GetViewData().GetZoomY();
- sal_uInt16 nCurrentZoom = (sal_uInt16)long( rOldY * 100 );
+ sal_uInt16 nCurrentZoom = static_cast<sal_uInt16>(long( rOldY * 100 ));
if( nCurrentZoom )
{
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index a7fe6dc18ce8..90206529602e 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -514,8 +514,8 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) :
SetHScrollMode ( true );
SetOutlineMode ( true );
- aScrSize = Size( (long) ( STD_COL_WIDTH * PIXEL_PER_TWIPS * OLE_STD_CELLS_X ),
- (long) ( ScGlobal::nStdRowHeight * PIXEL_PER_TWIPS * OLE_STD_CELLS_Y ) );
+ aScrSize = Size( long( STD_COL_WIDTH * PIXEL_PER_TWIPS * OLE_STD_CELLS_X ),
+ static_cast<long>( ScGlobal::nStdRowHeight * PIXEL_PER_TWIPS * OLE_STD_CELLS_Y ) );
maTabData.push_back( new ScViewDataTable );
pThisTab = maTabData[nTabNo];
for (sal_uInt16 j=0; j<4; j++)
@@ -824,9 +824,9 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vec
// sanity check - we shouldn't need something this low / big
SAL_WARN_IF(rNewX < Fraction(1, 100) || rNewX > Fraction(100, 1), "sc.viewdata",
- "fraction rNewX not sensible: " << (double) rNewX);
+ "fraction rNewX not sensible: " << static_cast<double>(rNewX));
SAL_WARN_IF(rNewY < Fraction(1, 100) || rNewY > Fraction(100, 1), "sc.viewdata",
- "fraction rNewY not sensible: " << (double) rNewY);
+ "fraction rNewY not sensible: " << static_cast<double>(rNewY));
if ( bAll )
{
@@ -2043,7 +2043,7 @@ SCCOL ScViewData::CellsAtX( SCCOL nPosX, SCCOL nDir, ScHSplitPos eWhichX, sal_uI
SCCOL nX;
sal_uInt16 nScrPosX = 0;
- if (nScrSizeX == SC_SIZE_NONE) nScrSizeX = (sal_uInt16) aScrSize.Width();
+ if (nScrSizeX == SC_SIZE_NONE) nScrSizeX = static_cast<sal_uInt16>(aScrSize.Width());
if (nDir==1)
nX = nPosX; // forwards
@@ -2062,7 +2062,7 @@ SCCOL ScViewData::CellsAtX( SCCOL nPosX, SCCOL nDir, ScHSplitPos eWhichX, sal_uI
if (nTSize)
{
long nSizeXPix = ToPixel( nTSize, nPPTX );
- nScrPosX = sal::static_int_cast<sal_uInt16>( nScrPosX + (sal_uInt16) nSizeXPix );
+ nScrPosX = sal::static_int_cast<sal_uInt16>( nScrPosX + static_cast<sal_uInt16>(nSizeXPix) );
}
}
}
@@ -2083,7 +2083,7 @@ SCROW ScViewData::CellsAtY( SCROW nPosY, SCROW nDir, ScVSplitPos eWhichY, sal_uI
if (pView)
const_cast<ScViewData*>(this)->aScrSize.Height() = pView->GetGridHeight(eWhichY);
- if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = (sal_uInt16) aScrSize.Height();
+ if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = static_cast<sal_uInt16>(aScrSize.Height());
SCROW nY;
@@ -2316,7 +2316,7 @@ void ScViewData::SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX )
pThisTab->nPosX[eWhich] = nNewPosX;
pThisTab->nTPosX[eWhich] = nTPosX;
- pThisTab->nMPosX[eWhich] = (long) (nTPosX * HMM_PER_TWIPS);
+ pThisTab->nMPosX[eWhich] = static_cast<long>(nTPosX * HMM_PER_TWIPS);
pThisTab->nPixPosX[eWhich] = nPixPosX;
}
else
@@ -2359,7 +2359,7 @@ void ScViewData::SetPosY( ScVSplitPos eWhich, SCROW nNewPosY )
pThisTab->nPosY[eWhich] = nNewPosY;
pThisTab->nTPosY[eWhich] = nTPosY;
- pThisTab->nMPosY[eWhich] = (long) (nTPosY * HMM_PER_TWIPS);
+ pThisTab->nMPosY[eWhich] = static_cast<long>(nTPosY * HMM_PER_TWIPS);
pThisTab->nPixPosY[eWhich] = nPixPosY;
}
else
@@ -2421,7 +2421,7 @@ void ScViewData::SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
if (nTSize)
{
nSizePix = ToPixel( nTSize, nPPTX );
- nScrPosX += (sal_uInt16) nSizePix;
+ nScrPosX += static_cast<sal_uInt16>(nSizePix);
}
}
@@ -2431,7 +2431,7 @@ void ScViewData::SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
if (nTSize)
{
nSizePix = ToPixel( nTSize, nPPTY );
- nScrPosY += (sal_uInt16) nSizePix;
+ nScrPosY += static_cast<sal_uInt16>(nSizePix);
}
}
@@ -2446,14 +2446,14 @@ void ScViewData::SetScreenPos( const Point& rVisAreaStart )
bool bEnd;
nSize = 0;
- nTwips = (long) (rVisAreaStart.X() / HMM_PER_TWIPS);
+ nTwips = static_cast<long>(rVisAreaStart.X() / HMM_PER_TWIPS);
if ( pDoc->IsLayoutRTL( nTabNo ) )
nTwips = -nTwips;
SCCOL nX1 = 0;
bEnd = false;
while (!bEnd)
{
- nAdd = (long) pDoc->GetColWidth(nX1,nTabNo);
+ nAdd = static_cast<long>(pDoc->GetColWidth(nX1,nTabNo));
if (nSize+nAdd <= nTwips+1 && nX1<MAXCOL)
{
nSize += nAdd;
@@ -2464,12 +2464,12 @@ void ScViewData::SetScreenPos( const Point& rVisAreaStart )
}
nSize = 0;
- nTwips = (long) (rVisAreaStart.Y() / HMM_PER_TWIPS);
+ nTwips = static_cast<long>(rVisAreaStart.Y() / HMM_PER_TWIPS);
SCROW nY1 = 0;
bEnd = false;
while (!bEnd)
{
- nAdd = (long) pDoc->GetRowHeight(nY1,nTabNo);
+ nAdd = static_cast<long>(pDoc->GetRowHeight(nY1,nTabNo));
if (nSize+nAdd <= nTwips+1 && nY1<MAXROW)
{
nSize += nAdd;
@@ -2494,10 +2494,8 @@ void ScViewData::SetScreen( const tools::Rectangle& rVisArea )
// here without GetOutputFactor(), since it's for the output into a Metafile
aScrSize = rVisArea.GetSize();
- aScrSize.Width() = (long)
- ( aScrSize.Width() * ScGlobal::nScreenPPTX / HMM_PER_TWIPS );
- aScrSize.Height() = (long)
- ( aScrSize.Height() * ScGlobal::nScreenPPTY / HMM_PER_TWIPS );
+ aScrSize.Width() = static_cast<long>( aScrSize.Width() * ScGlobal::nScreenPPTX / HMM_PER_TWIPS );
+ aScrSize.Height() = static_cast<long>( aScrSize.Height() * ScGlobal::nScreenPPTY / HMM_PER_TWIPS );
}
ScDocFunc& ScViewData::GetDocFunc() const
@@ -2572,18 +2570,18 @@ void ScViewData::UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY
aHeight *= Fraction( aScrSize.Height(),1 );
aHeight /= aOldY;
- aScrSize.Width() = (long) aWidth;
- aScrSize.Height() = (long) aHeight;
+ aScrSize.Width() = static_cast<long>(aWidth);
+ aScrSize.Height() = static_cast<long>(aHeight);
}
void ScViewData::CalcPPT()
{
double nOldPPTX = nPPTX;
double nOldPPTY = nPPTY;
- nPPTX = ScGlobal::nScreenPPTX * (double) GetZoomX();
+ nPPTX = ScGlobal::nScreenPPTX * static_cast<double>(GetZoomX());
if (pDocShell)
nPPTX = nPPTX / pDocShell->GetOutputFactor(); // Factor is printer to screen
- nPPTY = ScGlobal::nScreenPPTY * (double) GetZoomY();
+ nPPTY = ScGlobal::nScreenPPTY * static_cast<double>(GetZoomY());
// if detective objects are present,
// try to adjust horizontal scale so the most common column width has minimal rounding errors,
@@ -2636,9 +2634,9 @@ void ScViewData::WriteUserData(OUString& rData)
// PosX[left]/PosX[right]/PosY[top]/PosY[bottom]
// when rows bigger than 8192, "+" instead of "/"
- sal_uInt16 nZoom = (sal_uInt16)long(pThisTab->aZoomY * 100);
+ sal_uInt16 nZoom = static_cast<sal_uInt16>(long(pThisTab->aZoomY * 100));
rData = OUString::number( nZoom ) + "/";
- nZoom = (sal_uInt16)long(pThisTab->aPageZoomY * 100);
+ nZoom = static_cast<sal_uInt16>(long(pThisTab->aPageZoomY * 100));
rData += OUString::number( nZoom ) + "/";
if (bPagebreak)
rData += "1";
@@ -2836,7 +2834,7 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
rSplitPos = Point( bHSplit ? pViewTab->nHSplitPos : 0, bVSplit ? pViewTab->nVSplitPos : 0 );
rSplitPos = Application::GetDefaultDevice()->PixelToLogic( rSplitPos, MapMode( MapUnit::MapTwip ) );
if( pDocShell )
- rSplitPos.X() = (long)((double)rSplitPos.X() / pDocShell->GetOutputFactor());
+ rSplitPos.X() = static_cast<long>(static_cast<double>(rSplitPos.X()) / pDocShell->GetOutputFactor());
}
else if( bFrozen )
{
@@ -2976,7 +2974,7 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
if( pDocShell && SC_MOD()->GetInputOptions().GetTextWysiwyg())
{
double nFactor = pDocShell->GetOutputFactor();
- aPixel.X() = (long)( aPixel.X() * nFactor + 0.5 );
+ aPixel.X() = static_cast<long>( aPixel.X() * nFactor + 0.5 );
}
bHSplit = bHSplit && aPixel.X() > 0;
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index e3ff5a013a01..729cad4210eb 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -174,7 +174,7 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow )
Fraction aZoomY = GetViewData().GetZoomY();
sal_uInt16 nOldPixel = 0;
if (nStartRow == nEndRow)
- nOldPixel = (sal_uInt16) (rDoc.GetRowHeight(nStartRow,nTab) * nPPTY);
+ nOldPixel = static_cast<sal_uInt16>(rDoc.GetRowHeight(nStartRow,nTab) * nPPTY);
ScSizeDeviceProvider aProv(pDocSh);
if (aProv.IsPrinter())
@@ -192,7 +192,7 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow )
if (bChanged && ( nStartRow == nEndRow ))
{
- sal_uInt16 nNewPixel = (sal_uInt16) (rDoc.GetRowHeight(nStartRow,nTab) * nPPTY);
+ sal_uInt16 nNewPixel = static_cast<sal_uInt16>(rDoc.GetRowHeight(nStartRow,nTab) * nPPTY);
if ( nNewPixel == nOldPixel )
bChanged = false;
}
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index dd038f35e242..4111afb66aac 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -609,12 +609,12 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran
{
sal_Int64 nHandle = xTunnel->getSomething( ScTransferObj::getUnoTunnelId() );
if ( nHandle )
- pOwnClip = reinterpret_cast<ScTransferObj*>( (sal_IntPtr) nHandle);
+ pOwnClip = reinterpret_cast<ScTransferObj*>( static_cast<sal_IntPtr>(nHandle));
else
{
nHandle = xTunnel->getSomething( ScDrawTransferObj::getUnoTunnelId() );
if ( nHandle )
- pDrawClip = reinterpret_cast<ScDrawTransferObj*>( (sal_IntPtr) nHandle );
+ pDrawClip = reinterpret_cast<ScDrawTransferObj*>( static_cast<sal_IntPtr>(nHandle) );
}
}
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 7a82ea88b9ea..3f4db0cfba59 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -97,7 +97,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
if (pDoc->IsNegativePage(nTab))
nXT = -nXT;
sal_uLong nYT = pDoc->GetRowHeight( 0, nPosY-1, nTab);
- aPos = Point( (long)(nXT * HMM_PER_TWIPS), (long)(nYT * HMM_PER_TWIPS) );
+ aPos = Point( static_cast<long>(nXT * HMM_PER_TWIPS), static_cast<long>(nYT * HMM_PER_TWIPS) );
}
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 787d9f9a8352..3959bcd28348 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -305,7 +305,7 @@ static bool lcl_AddFunction( ScAppOptions& rAppOpt, sal_uInt16 nOpCode )
if ( !lcl_FunctionKnown( nOpCode ) )
return false; // not in function list -> no change
- sal_uInt16 nNewCount = std::min( (sal_uInt16)(nOldCount + 1), (sal_uInt16)LRU_MAX );
+ sal_uInt16 nNewCount = std::min( static_cast<sal_uInt16>(nOldCount + 1), sal_uInt16(LRU_MAX) );
sal_uInt16 nNewList[LRU_MAX];
nNewList[0] = nOpCode;
for (nPos=1; nPos<nNewCount; nPos++)
@@ -2372,7 +2372,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal )
nMargin = sal::static_int_cast<sal_uInt16>(
nMargin + pPattern->GetItem(ATTR_INDENT).GetValue() );
- nWidth = (sal_uInt16)(nEdit * pDocSh->GetOutputFactor() / HMM_PER_TWIPS)
+ nWidth = static_cast<sal_uInt16>(nEdit * pDocSh->GetOutputFactor() / HMM_PER_TWIPS)
+ nMargin + STD_EXTRA_WIDTH;
}
}
@@ -2393,7 +2393,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal )
long nPixel = rDoc.GetNeededSize( nCol, nRow, nTab, aProv.GetDevice(),
nPPTX, nPPTY, aZoomX, aZoomY, true );
- sal_uInt16 nTwips = (sal_uInt16)( nPixel / nPPTX );
+ sal_uInt16 nTwips = static_cast<sal_uInt16>( nPixel / nPPTX );
if (nTwips != 0)
nWidth = nTwips + STD_EXTRA_WIDTH;
else