summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2016-02-18 17:33:12 +0900
committerCaolán McNamara <caolanm@redhat.com>2016-02-18 09:38:12 +0000
commitd2f33d22836621506adec6814abf010fa2d683e6 (patch)
treea46cc1fc9f643022ce77f027ade969e295c7b4be
parent945977f8495a14658520857d55ca30bfc1567da7 (diff)
starmath: Avoid C-style cast
Change-Id: Id54997718a61b1b5a488922f05374c559f1e4454 Reviewed-on: https://gerrit.libreoffice.org/22460 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--starmath/inc/rect.hxx2
-rw-r--r--starmath/source/dialog.cxx2
-rw-r--r--starmath/source/node.cxx16
-rw-r--r--starmath/source/parse.cxx18
-rw-r--r--starmath/source/unomodel.cxx8
5 files changed, 23 insertions, 23 deletions
diff --git a/starmath/inc/rect.hxx b/starmath/inc/rect.hxx
index 3ef8ec483c92..31b337c9cdec 100644
--- a/starmath/inc/rect.hxx
+++ b/starmath/inc/rect.hxx
@@ -39,7 +39,7 @@ bool SmIsMathAlpha(const OUString &rText);
inline long SmFromTo(long nFrom, long nTo, double fRelDist)
{
- return nFrom + (long) (fRelDist * (nTo - nFrom));
+ return nFrom + static_cast<long>(fRelDist * (nTo - nFrom));
}
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 3c23d9c29b19..19b8d0d8d9c4 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1330,7 +1330,7 @@ void SmShowSymbolSetWindow::SetScrollBarRange()
void SmShowSymbolSetWindow::SelectSymbol(sal_uInt16 nSymbol)
{
- int v = (int) (m_pVScrollBar->GetThumbPos() * nColumns);
+ int v = static_cast<int>(m_pVScrollBar->GetThumbPos() * nColumns);
if (nSelectSymbol != SYMBOL_NONE)
Invalidate(Rectangle(OffsetPoint(Point(((nSelectSymbol - v) % nColumns) * nLen,
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 27c67556f937..7c16927bece6 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -170,7 +170,7 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType)
{
Fraction aVal (SmPtsTo100th_mm(rSize.GetNumerator()),
rSize.GetDenominator());
- long nHeight = (long)aVal;
+ long nHeight = static_cast<long>(aVal);
aFntSize = GetFont().GetFontSize();
aFntSize.Width() = 0;
@@ -189,12 +189,12 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType)
break;
case FontSizeType::MULTIPLY:
- aFntSize.Height() = (long) (Fraction(aFntSize.Height()) * rSize);
+ aFntSize.Height() = static_cast<long>(Fraction(aFntSize.Height()) * rSize);
break;
case FontSizeType::DIVIDE:
if (rSize != Fraction(0L))
- aFntSize.Height() = (long) (Fraction(aFntSize.Height()) / rSize);
+ aFntSize.Height() = static_cast<long>(Fraction(aFntSize.Height()) / rSize);
break;
default:
break;
@@ -1195,8 +1195,8 @@ sal_uInt16 GetLineIntersectionPoint(Point &rResult,
double fLambda = ( (rPoint1.Y() - rPoint2.Y()) * rHeading2.X()
- (rPoint1.X() - rPoint2.X()) * rHeading2.Y())
/ fDet;
- rResult = Point(rPoint1.X() + (long) (fLambda * rHeading1.X()),
- rPoint1.Y() + (long) (fLambda * rHeading1.Y()));
+ rResult = Point(rPoint1.X() + static_cast<long>(fLambda * rHeading1.X()),
+ rPoint1.Y() + static_cast<long>(fLambda * rHeading1.Y()));
}
return nRes;
@@ -1227,8 +1227,8 @@ void SmBinDiagonalNode::GetOperPosSize(Point &rPos, Size &rSize,
nRectBottom = GetBottom();
Point aRightHdg (100, 0),
aDownHdg (0, 100),
- aDiagHdg ( (long)(100.0 * cos(fAngleRad)),
- (long)(-100.0 * sin(fAngleRad)) );
+ aDiagHdg ( static_cast<long>(100.0 * cos(fAngleRad)),
+ static_cast<long>(-100.0 * sin(fAngleRad)) );
long nLeft, nRight, nTop, nBottom; // margins of the rectangle for the diagonal
Point aPoint;
@@ -1645,7 +1645,7 @@ void SmBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
Size aTmpSize (pLeft->GetFont().GetFontSize());
OSL_ENSURE(pRight->GetFont().GetFontSize() == aTmpSize,
"Sm : different font sizes");
- aTmpSize.Width() = std::min((long) nBraceHeight * 60L / 100L,
+ aTmpSize.Width() = std::min(nBraceHeight * 60L / 100L,
rFormat.GetBaseSize().Height() * 3L / 2L);
// correction factor since change from StarMath to OpenSymbol font
// because of the different font width in the FontMetric
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index c2c7e883d1bb..f5f5d91c1f4c 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1243,14 +1243,14 @@ void SmParser::DoSubSup(sal_uLong nActiveGroup)
switch (eType)
{
- case TRSUB : nIndex = (int) RSUB; break;
- case TRSUP : nIndex = (int) RSUP; break;
+ case TRSUB : nIndex = static_cast<int>(RSUB); break;
+ case TRSUP : nIndex = static_cast<int>(RSUP); break;
case TFROM :
- case TCSUB : nIndex = (int) CSUB; break;
+ case TCSUB : nIndex = static_cast<int>(CSUB); break;
case TTO :
- case TCSUP : nIndex = (int) CSUP; break;
- case TLSUB : nIndex = (int) LSUB; break;
- case TLSUP : nIndex = (int) LSUP; break;
+ case TCSUP : nIndex = static_cast<int>(CSUP); break;
+ case TLSUB : nIndex = static_cast<int>(LSUB); break;
+ case TLSUP : nIndex = static_cast<int>(LSUP); break;
default :
SAL_WARN( "starmath", "unknown case");
}
@@ -2459,10 +2459,10 @@ const SmErrorDesc *SmParser::NextError()
const SmErrorDesc *SmParser::PrevError()
{
if ( !m_aErrDescList.empty() )
- if (m_nCurError < (int) (m_aErrDescList.size() - 1)) return m_aErrDescList[ ++m_nCurError ].get();
+ if (m_nCurError < static_cast<int>(m_aErrDescList.size() - 1)) return m_aErrDescList[ ++m_nCurError ].get();
else
{
- m_nCurError = (int) (m_aErrDescList.size() - 1);
+ m_nCurError = static_cast<int>(m_aErrDescList.size() - 1);
return m_aErrDescList[ m_nCurError ].get();
}
else return nullptr;
@@ -2474,7 +2474,7 @@ const SmErrorDesc *SmParser::GetError(size_t i)
if ( i < m_aErrDescList.size() )
return m_aErrDescList[ i ].get();
- if ( (size_t)m_nCurError < m_aErrDescList.size() )
+ if ( static_cast<size_t>(m_nCurError) < m_aErrDescList.size() )
return m_aErrDescList[ m_nCurError ].get();
return nullptr;
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 812cde5e3c24..07cf72467535 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -1051,10 +1051,10 @@ void SAL_CALL SmModel::render(
{
aPrtPaperSize = lcl_GuessPaperSize();
// factors from Windows DIN A4
- aOutputSize = Size( (long)(aPrtPaperSize.Width() * 0.941),
- (long)(aPrtPaperSize.Height() * 0.961));
- aPrtPageOffset = Point( (long)(aPrtPaperSize.Width() * 0.0250),
- (long)(aPrtPaperSize.Height() * 0.0214));
+ aOutputSize = Size( static_cast<long>(aPrtPaperSize.Width() * 0.941),
+ static_cast<long>(aPrtPaperSize.Height() * 0.961));
+ aPrtPageOffset = Point( static_cast<long>(aPrtPaperSize.Width() * 0.0250),
+ static_cast<long>(aPrtPaperSize.Height() * 0.0214));
}
Point aZeroPoint;
Rectangle OutputRect( aZeroPoint, aOutputSize );