From ad137adbaea7fcb009b4b22ad00a5e3fd3a89ff5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Jan 2018 20:19:59 +0100 Subject: More loplugin:cstylecast: lotuswordpro auto-rewrite with "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Idd6bd4f316b916877629579bf187d0f05251263d --- lotuswordpro/inc/lwpdefs.hxx | 2 +- lotuswordpro/inc/lwptools.hxx | 2 +- lotuswordpro/inc/xfilter/xfcolor.hxx | 4 +- lotuswordpro/inc/xfilter/xfnumfmt.hxx | 2 +- lotuswordpro/source/filter/explode.cxx | 12 +- lotuswordpro/source/filter/localtime.cxx | 12 +- lotuswordpro/source/filter/lwpcelllayout.cxx | 6 +- lotuswordpro/source/filter/lwpdrawobj.cxx | 204 ++++++++++----------- lotuswordpro/source/filter/lwpframelayout.cxx | 2 +- lotuswordpro/source/filter/lwpgrfobj.cxx | 14 +- lotuswordpro/source/filter/lwpidxmgr.cxx | 4 +- lotuswordpro/source/filter/lwpnumericfmt.cxx | 12 +- lotuswordpro/source/filter/lwpobjid.cxx | 4 +- lotuswordpro/source/filter/lwpoleobject.cxx | 6 +- lotuswordpro/source/filter/lwprowlayout.cxx | 12 +- .../source/filter/lwpsdwgrouploaderv0102.cxx | 14 +- lotuswordpro/source/filter/lwpsdwrect.cxx | 26 +-- lotuswordpro/source/filter/lwptablelayout.cxx | 14 +- lotuswordpro/source/filter/lwptblcell.cxx | 8 +- lotuswordpro/source/filter/lwptblformula.cxx | 6 +- lotuswordpro/source/filter/lwptoc.cxx | 4 +- lotuswordpro/source/filter/lwpverdocument.cxx | 2 +- lotuswordpro/source/filter/tocread.cxx | 2 +- .../source/filter/xfilter/xfframestyle.cxx | 2 +- lotuswordpro/source/filter/xfilter/xfliststyle.cxx | 6 +- lotuswordpro/source/filter/xfilter/xfparastyle.cxx | 2 +- 26 files changed, 192 insertions(+), 192 deletions(-) (limited to 'lotuswordpro') diff --git a/lotuswordpro/inc/lwpdefs.hxx b/lotuswordpro/inc/lwpdefs.hxx index 02df11566baf..2cf89eaa696b 100644 --- a/lotuswordpro/inc/lwpdefs.hxx +++ b/lotuswordpro/inc/lwpdefs.hxx @@ -62,7 +62,7 @@ #define INCLUDED_LOTUSWORDPRO_INC_LWPDEFS_HXX #define BAD_OFFSET 0xFFFFFFFFUL -#define BAD_ATOM ((sal_Int32)(-1)) // Invalid Atom ID +#define BAD_ATOM (sal_Int32(-1)) // Invalid Atom ID //Please remove the item from the commented defines after you add the tag to the following enum. enum VO_TYPE diff --git a/lotuswordpro/inc/lwptools.hxx b/lotuswordpro/inc/lwptools.hxx index e8bdc818af77..edbfd4d00949 100644 --- a/lotuswordpro/inc/lwptools.hxx +++ b/lotuswordpro/inc/lwptools.hxx @@ -107,7 +107,7 @@ public: inline double LwpTools::ConvertFromUnits(sal_Int32 nUnits) { - return (double)nUnits/UNITS_PER_INCH; + return static_cast(nUnits)/UNITS_PER_INCH; } inline double LwpTools::ConvertToMetric(double fInch) { diff --git a/lotuswordpro/inc/xfilter/xfcolor.hxx b/lotuswordpro/inc/xfilter/xfcolor.hxx index b7ec2f32cb99..eec54c0a6c35 100644 --- a/lotuswordpro/inc/xfilter/xfcolor.hxx +++ b/lotuswordpro/inc/xfilter/xfcolor.hxx @@ -69,12 +69,12 @@ class XFColor { public: - XFColor():m_nRed((sal_Int8)0),m_nGreen((sal_Int8)0),m_nBlue((sal_Int8)0) + XFColor():m_nRed(sal_Int8(0)),m_nGreen(sal_Int8(0)),m_nBlue(sal_Int8(0)) { m_bValid = false; } XFColor(sal_Int32 red, sal_Int32 green, sal_Int32 blue) - :m_nRed((sal_Int8)red),m_nGreen((sal_Int8)green),m_nBlue((sal_Int8)blue) + :m_nRed(static_cast(red)),m_nGreen(static_cast(green)),m_nBlue(static_cast(blue)) { m_bValid = true; } diff --git a/lotuswordpro/inc/xfilter/xfnumfmt.hxx b/lotuswordpro/inc/xfilter/xfnumfmt.hxx index dad4b0018749..3e3f70d370a1 100644 --- a/lotuswordpro/inc/xfilter/xfnumfmt.hxx +++ b/lotuswordpro/inc/xfilter/xfnumfmt.hxx @@ -136,7 +136,7 @@ public: pAttrList->AddAttribute( "style:num-suffix", m_strSuffix ); pAttrList->AddAttribute( "style:num-format", m_strFormat ); if( m_nStartValue != 0 ) - pAttrList->AddAttribute( "text:start-value", OUString::number((sal_Int32)m_nStartValue) ); + pAttrList->AddAttribute( "text:start-value", OUString::number(static_cast(m_nStartValue)) ); } private: OUString m_strPrefix; diff --git a/lotuswordpro/source/filter/explode.cxx b/lotuswordpro/source/filter/explode.cxx index 54fe504fa48f..1cc895ec6c8a 100644 --- a/lotuswordpro/source/filter/explode.cxx +++ b/lotuswordpro/source/filter/explode.cxx @@ -187,7 +187,7 @@ sal_uInt32 Decompression::ReadBits(sal_uInt16 iCount, sal_uInt32 & nBits) m_pBuffer = m_Buffer; if (m_nBytesLeft == 0) return 1; } - val |= (sal_uInt32)(*m_pBuffer++) << m_nBitsLeft; /* load eight bits */ + val |= static_cast(*m_pBuffer++) << m_nBitsLeft; /* load eight bits */ m_nBytesLeft --; m_nBitsLeft += 8; } @@ -239,7 +239,7 @@ sal_Int32 Decompression::explode() sal_uInt32 symbol; if (0 != ReadBits(8, symbol)) break; - m_Output[m_nOutputBufferPos++] = (sal_uInt8)symbol; + m_Output[m_nOutputBufferPos++] = static_cast(symbol); if (m_nOutputBufferPos == MAXWIN) { m_pOutStream->WriteBytes(m_Output, m_nOutputBufferPos); @@ -263,7 +263,7 @@ sal_Int32 Decompression::explode() // read more (L1-7) bits -> L2 // LENGTH = L2 + M[L1-7] + 2 sal_uInt32 L2; - if (0 != ReadBits((sal_uInt16)(L1 - 7), L2)) + if (0 != ReadBits(static_cast(L1 - 7), L2)) break; Length = L2 + 2 + m_iArrayOfM[L1 -7]; } @@ -291,7 +291,7 @@ sal_Int32 Decompression::explode() // D1 = D1 << P2 // the parameter 2 // read P2 bits -> D2 D1 = D1 << P2; - if (0 != ReadBits((sal_uInt16)P2, D2)) + if (0 != ReadBits(static_cast(P2), D2)) break; } // DISTANCE = (D1 | D2) + 1 @@ -309,7 +309,7 @@ sal_Int32 Decompression::explode() m_pOutStream->Flush(); // point back to copy position and read bytes - m_pOutStream->SeekRel(-(long)distance); + m_pOutStream->SeekRel(-static_cast(distance)); sal_uInt8 sTemp[MAXWIN]; sal_uInt32 nRead = distance > Length? Length:distance; m_pOutStream->ReadBytes(sTemp, nRead); @@ -445,7 +445,7 @@ void Decompression::fillArray() m_iArrayOfM[0] = 7; for (int i=1; i < 16; i++) { - m_iArrayOfM[i] = m_iArrayOfM[i - 1]+ (sal_uInt32)pow(2.0, i-1);//2 + m_iArrayOfM[i] = m_iArrayOfM[i - 1]+ static_cast(pow(2.0, i-1));//2 } } diff --git a/lotuswordpro/source/filter/localtime.cxx b/lotuswordpro/source/filter/localtime.cxx index 3805c5d6f973..39b6e0212058 100644 --- a/lotuswordpro/source/filter/localtime.cxx +++ b/lotuswordpro/source/filter/localtime.cxx @@ -77,7 +77,7 @@ bool LtgGmTime(long rtime,LtTm& rtm) long tmptim; long caltim = rtime; - tmptim = (long)(caltim / FOURYEAR_SEC); + tmptim = static_cast(caltim / FOURYEAR_SEC); caltim -= tmptim * FOURYEAR_SEC; //Determine which year of the interval @@ -120,7 +120,7 @@ bool LtgGmTime(long rtime,LtTm& rtm) //Determine days since January 1 (0 - 365). This is the tm_yday value. //Leave caltim with number of elapsed seconds in that day. - rtm.tm_yday = (long)(caltim / DAY_SEC); + rtm.tm_yday = static_cast(caltim / DAY_SEC); caltim -= rtm.tm_yday * DAY_SEC; //Determine months since January (0 - 11) and day of month (1 - 31) @@ -147,16 +147,16 @@ bool LtgGmTime(long rtime,LtTm& rtm) //Determine days since Sunday (0 - 6) - rtm.tm_wday = ((long)(rtime / DAY_SEC) + BASE_DOW) % 7; + rtm.tm_wday = (static_cast(rtime / DAY_SEC) + BASE_DOW) % 7; //Determine hours since midnight (0 - 23), minutes after the hour //(0 - 59), and seconds after the minute (0 - 59). - rtm.tm_hour = (long)(caltim / 3600); + rtm.tm_hour = static_cast(caltim / 3600); caltim -= rtm.tm_hour * 3600; - rtm.tm_min = (long)(caltim / 60); - rtm.tm_sec = (long)(caltim - (rtm.tm_min) * 60); + rtm.tm_min = static_cast(caltim / 60); + rtm.tm_sec = static_cast(caltim - (rtm.tm_min) * 60); //adjust year & month rtm.tm_year += 1900; diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx index ca16bde31ffd..ccff1e38024b 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.cxx +++ b/lotuswordpro/source/filter/lwpcelllayout.cxx @@ -164,7 +164,7 @@ void LwpCellLayout::ApplyPadding(XFCellStyle *pCellStyle) double fRight = GetMarginsValue(MARGIN_RIGHT); double fTop = GetMarginsValue(MARGIN_TOP); double fBottom = GetMarginsValue(MARGIN_BOTTOM); - pCellStyle->SetPadding((float)fLeft,(float)fRight,(float)fTop,(float)fBottom); + pCellStyle->SetPadding(static_cast(fLeft),static_cast(fRight),static_cast(fTop),static_cast(fBottom)); } /** * @short Apply border to cell style according to cell position, default cell layout won't use this function @@ -619,7 +619,7 @@ void LwpCellLayout::Read() else { crowid = pStrm->QuickReaduInt16(); - ccolid = (sal_uInt8) pStrm->QuickReaduInt16(); // written as a lushort + ccolid = static_cast(pStrm->QuickReaduInt16()); // written as a lushort sal_uInt16 type; @@ -817,7 +817,7 @@ void LwpConnectedCellLayout::Read() cnumrows = m_pObjStrm->QuickReaduInt16(); numcols = m_pObjStrm->QuickReaduInt16(); // written as a lushort - cnumcols = (sal_uInt8)numcols; + cnumcols = static_cast(numcols); m_nRealrowspan = cnumrows; m_nRealcolspan = cnumcols; diff --git a/lotuswordpro/source/filter/lwpdrawobj.cxx b/lotuswordpro/source/filter/lwpdrawobj.cxx index 1494106fd966..abc7326be812 100644 --- a/lotuswordpro/source/filter/lwpdrawobj.cxx +++ b/lotuswordpro/source/filter/lwpdrawobj.cxx @@ -256,7 +256,7 @@ void LwpDrawObj::SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 n } // line width - double fWidth = (double)nWidth/TWIPS_PER_CM; + double fWidth = static_cast(nWidth)/TWIPS_PER_CM; // line color XFColor aXFColor(rColor.nR, rColor.nG, rColor.nB); @@ -280,10 +280,10 @@ void LwpDrawObj::SetPosition(XFFrame* pObj) fScaleY = m_pTransData->fScaleY; } - pObj->SetPosition((double)m_aObjHeader.nLeft/TWIPS_PER_CM * fScaleX+ fOffsetX, - (double)m_aObjHeader.nTop/TWIPS_PER_CM * fScaleY + fOffsetY, - (double)(m_aObjHeader.nRight-m_aObjHeader.nLeft)/TWIPS_PER_CM * fScaleX, - (double)(m_aObjHeader.nBottom-m_aObjHeader.nTop)/TWIPS_PER_CM * fScaleY); + pObj->SetPosition(static_cast(m_aObjHeader.nLeft)/TWIPS_PER_CM * fScaleX+ fOffsetX, + static_cast(m_aObjHeader.nTop)/TWIPS_PER_CM * fScaleY + fOffsetY, + static_cast(m_aObjHeader.nRight-m_aObjHeader.nLeft)/TWIPS_PER_CM * fScaleX, + static_cast(m_aObjHeader.nBottom-m_aObjHeader.nTop)/TWIPS_PER_CM * fScaleY); } /** @@ -311,7 +311,7 @@ void LwpDrawObj::SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag // arrowhead flag of an object's end side sal_uInt8 nRightArrow = (nArrowFlag & 0xF0) >> 4; - double fWidth_inch = (double)nLineWidth/TWIPS_PER_CM; + double fWidth_inch = static_cast(nLineWidth)/TWIPS_PER_CM; double fArrowSize_inch = fWidth_inch + 0.08; double fArrowSize = fArrowSize_inch * CM_PER_INCH; @@ -453,10 +453,10 @@ OUString LwpDrawLine::RegisterStyle() XFFrame* LwpDrawLine::CreateDrawObj(const OUString& rStyleName ) { XFDrawPath* pLine = new XFDrawPath(); - pLine->MoveTo(XFPoint((double)(m_aLineRec.nStartX)/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)(m_aLineRec.nStartY)/TWIPS_PER_CM * m_pTransData->fScaleY)); - pLine->LineTo(XFPoint((double)(m_aLineRec.nEndX)/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)(m_aLineRec.nEndY)/TWIPS_PER_CM * m_pTransData->fScaleY)); + pLine->MoveTo(XFPoint(static_cast(m_aLineRec.nStartX)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aLineRec.nStartY)/TWIPS_PER_CM * m_pTransData->fScaleY)); + pLine->LineTo(XFPoint(static_cast(m_aLineRec.nEndX)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aLineRec.nEndY)/TWIPS_PER_CM * m_pTransData->fScaleY)); SetPosition(pLine); pLine->SetStyleName(rStyleName); @@ -467,8 +467,8 @@ XFFrame* LwpDrawLine::CreateDrawObj(const OUString& rStyleName ) XFFrame* LwpDrawLine::CreateStandardDrawObj(const OUString& rStyleName) { XFDrawLine* pLine = new XFDrawLine(); - pLine->SetStartPoint((double)(m_aLineRec.nStartX)/TWIPS_PER_CM,(double)(m_aLineRec.nStartY)/TWIPS_PER_CM); - pLine->SetEndPoint((double)(m_aLineRec.nEndX)/TWIPS_PER_CM,(double)(m_aLineRec.nEndY)/TWIPS_PER_CM); + pLine->SetStartPoint(static_cast(m_aLineRec.nStartX)/TWIPS_PER_CM,static_cast(m_aLineRec.nStartY)/TWIPS_PER_CM); + pLine->SetEndPoint(static_cast(m_aLineRec.nEndX)/TWIPS_PER_CM,static_cast(m_aLineRec.nEndY)/TWIPS_PER_CM); pLine->SetStyleName(rStyleName); return pLine; @@ -535,12 +535,12 @@ OUString LwpDrawPolyLine::RegisterStyle() XFFrame* LwpDrawPolyLine::CreateDrawObj(const OUString& rStyleName ) { XFDrawPath* pPolyline = new XFDrawPath(); - pPolyline->MoveTo(XFPoint((double)m_pVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_pVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pPolyline->MoveTo(XFPoint(static_cast(m_pVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_pVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); for (sal_uInt16 nC = 1; nC < m_aPolyLineRec.nNumPoints; nC++) { - pPolyline->LineTo(XFPoint((double)m_pVector[nC].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_pVector[nC].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pPolyline->LineTo(XFPoint(static_cast(m_pVector[nC].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_pVector[nC].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); } SetPosition(pPolyline); @@ -554,8 +554,8 @@ XFFrame* LwpDrawPolyLine::CreateStandardDrawObj(const OUString& rStyleName) XFDrawPolyline* pPolyline = new XFDrawPolyline(); for (sal_uInt16 nC = 0; nC < m_aPolyLineRec.nNumPoints; nC++) { - pPolyline->AddPoint((double)m_pVector[nC].x/TWIPS_PER_CM, - (double)m_pVector[nC].y/TWIPS_PER_CM); + pPolyline->AddPoint(static_cast(m_pVector[nC].x)/TWIPS_PER_CM, + static_cast(m_pVector[nC].y)/TWIPS_PER_CM); } pPolyline->SetStyleName(rStyleName); @@ -621,12 +621,12 @@ OUString LwpDrawPolygon::RegisterStyle() XFFrame* LwpDrawPolygon::CreateDrawObj(const OUString& rStyleName) { XFDrawPath* pPolygon = new XFDrawPath(); - pPolygon->MoveTo(XFPoint((double)m_pVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_pVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pPolygon->MoveTo(XFPoint(static_cast(m_pVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_pVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); for (sal_uInt16 nC = 1; nC < m_nNumPoints; nC++) { - pPolygon->LineTo(XFPoint((double)m_pVector[nC].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_pVector[nC].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pPolygon->LineTo(XFPoint(static_cast(m_pVector[nC].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_pVector[nC].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); } pPolygon->ClosePath(); SetPosition(pPolygon); @@ -640,8 +640,8 @@ XFFrame* LwpDrawPolygon::CreateStandardDrawObj(const OUString& rStyleName) XFDrawPolygon* pPolygon = new XFDrawPolygon(); for (sal_uInt16 nC = 0; nC < m_nNumPoints; nC++) { - pPolygon->AddPoint((double)m_pVector[nC].x/TWIPS_PER_CM, - (double)m_pVector[nC].y/TWIPS_PER_CM); + pPolygon->AddPoint(static_cast(m_pVector[nC].x)/TWIPS_PER_CM, + static_cast(m_pVector[nC].y)/TWIPS_PER_CM); } pPolygon->SetStyleName(rStyleName); @@ -707,15 +707,15 @@ XFFrame* LwpDrawRectangle::CreateDrawObj(const OUString& rStyleName) else { XFDrawPath* pRect = new XFDrawPath(); - pRect->MoveTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pRect->MoveTo(XFPoint(static_cast(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); for (sal_uInt8 nC = 1; nC < 4; nC++) { - pRect->LineTo(XFPoint((double)m_aVector[nC].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[nC].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pRect->LineTo(XFPoint(static_cast(m_aVector[nC].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[nC].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); } - pRect->LineTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pRect->LineTo(XFPoint(static_cast(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); pRect->ClosePath(); SetPosition(pRect); @@ -728,38 +728,38 @@ XFFrame* LwpDrawRectangle::CreateDrawObj(const OUString& rStyleName) XFFrame* LwpDrawRectangle::CreateRoundedRect(const OUString& rStyleName) { XFDrawPath* pRoundedRect = new XFDrawPath(); - pRoundedRect->MoveTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pRoundedRect->MoveTo(XFPoint(static_cast(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); sal_uInt8 nPtIndex = 1; for (sal_uInt8 nC = 0; nC < 7; nC++) { if (nC%2 == 0) { - XFPoint aCtrl1((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aCtrl1(static_cast(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY); nPtIndex++; - XFPoint aCtrl2((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aCtrl2(static_cast(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY); nPtIndex++; - XFPoint aDest((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aDest(static_cast(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY); nPtIndex++; pRoundedRect->CurveTo(aDest, aCtrl1, aCtrl2); } else { - XFPoint aDest((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aDest(static_cast(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY); nPtIndex++; pRoundedRect->LineTo(aDest); } } - pRoundedRect->LineTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pRoundedRect->LineTo(XFPoint(static_cast(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); pRoundedRect->ClosePath(); SetPosition(pRoundedRect); @@ -860,19 +860,19 @@ OUString LwpDrawEllipse::RegisterStyle() XFFrame* LwpDrawEllipse::CreateDrawObj(const OUString& rStyleName ) { XFDrawPath* pEllipse = new XFDrawPath(); - pEllipse->MoveTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY)); + pEllipse->MoveTo(XFPoint(static_cast(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); sal_uInt8 nPtIndex = 1; for (sal_uInt8 nC = 0; nC < 4; nC++) { - XFPoint aCtrl1((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aCtrl1(static_cast(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY); nPtIndex++; - XFPoint aCtrl2((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aCtrl2(static_cast(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY); nPtIndex++; - XFPoint aDest((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aDest(static_cast(m_aVector[nPtIndex].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[nPtIndex].y)/TWIPS_PER_CM * m_pTransData->fScaleY); nPtIndex++; pEllipse->CurveTo(aDest, aCtrl1, aCtrl2); @@ -939,14 +939,14 @@ OUString LwpDrawArc::RegisterStyle() XFFrame* LwpDrawArc::CreateDrawObj(const OUString& rStyleName ) { XFDrawPath* pArc = new XFDrawPath(); - pArc->MoveTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY)); - XFPoint aDest((double)m_aVector[3].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[3].y/TWIPS_PER_CM * m_pTransData->fScaleY); - XFPoint aCtl1((double)m_aVector[1].x/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)m_aVector[1].y/TWIPS_PER_CM * m_pTransData->fScaleY); - XFPoint aCtl2((double)m_aVector[2].x/TWIPS_PER_CM* m_pTransData->fScaleX, - (double)m_aVector[2].y/TWIPS_PER_CM * m_pTransData->fScaleY); + pArc->MoveTo(XFPoint(static_cast(m_aVector[0].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[0].y)/TWIPS_PER_CM * m_pTransData->fScaleY)); + XFPoint aDest(static_cast(m_aVector[3].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[3].y)/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aCtl1(static_cast(m_aVector[1].x)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(m_aVector[1].y)/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aCtl2(static_cast(m_aVector[2].x)/TWIPS_PER_CM* m_pTransData->fScaleX, + static_cast(m_aVector[2].y)/TWIPS_PER_CM * m_pTransData->fScaleY); pArc->CurveTo(aDest, aCtl1, aCtl2); SetPosition(pArc); @@ -1163,8 +1163,8 @@ void LwpDrawTextArt::CreateFWPath(XFDrawPath* pPath) sal_Int16 nX, nY; nX = (m_aTextArtRec.aPath[0].pPts[0].x + m_aTextArtRec.aPath[1].pPts[0].x) / 2; nY = (m_aTextArtRec.aPath[0].pPts[0].y + m_aTextArtRec.aPath[1].pPts[0].y) / 2; - XFPoint aStart((double)nX/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)nY/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aStart(static_cast(nX)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(nY)/TWIPS_PER_CM * m_pTransData->fScaleY); pPath->MoveTo(aStart); sal_uInt8 nPtIndex = 1; @@ -1172,20 +1172,20 @@ void LwpDrawTextArt::CreateFWPath(XFDrawPath* pPath) { nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2; nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2; - XFPoint aCtrl1((double)nX/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)nY/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aCtrl1(static_cast(nX)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(nY)/TWIPS_PER_CM * m_pTransData->fScaleY); nPtIndex++; nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2; nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2; - XFPoint aCtrl2((double)nX/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)nY/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aCtrl2(static_cast(nX)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(nY)/TWIPS_PER_CM * m_pTransData->fScaleY); nPtIndex++; nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2; nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2; - XFPoint aDest((double)nX/TWIPS_PER_CM * m_pTransData->fScaleX, - (double)nY/TWIPS_PER_CM * m_pTransData->fScaleY); + XFPoint aDest(static_cast(nX)/TWIPS_PER_CM * m_pTransData->fScaleX, + static_cast(nY)/TWIPS_PER_CM * m_pTransData->fScaleY); pPath->CurveTo(aDest, aCtrl1, aCtrl2); } @@ -1418,57 +1418,57 @@ void LwpDrawBitmap::Read() sal_uInt32 nOffBits = 14 + aInfoHeader2.nHeaderLen + rgbTableSize; m_pImageData[0] = 'B'; m_pImageData[1] = 'M'; - m_pImageData[2] = (sal_uInt8)m_aBmpRec.nFileSize; - m_pImageData[3] = (sal_uInt8)(m_aBmpRec.nFileSize >> 8); - m_pImageData[4] = (sal_uInt8)(m_aBmpRec.nFileSize >> 16); - m_pImageData[5] = (sal_uInt8)(m_aBmpRec.nFileSize >> 24); + m_pImageData[2] = static_cast(m_aBmpRec.nFileSize); + m_pImageData[3] = static_cast(m_aBmpRec.nFileSize >> 8); + m_pImageData[4] = static_cast(m_aBmpRec.nFileSize >> 16); + m_pImageData[5] = static_cast(m_aBmpRec.nFileSize >> 24); m_pImageData[6] = 0; m_pImageData[7] = 0; m_pImageData[8] = 0; m_pImageData[9] = 0; - m_pImageData[10] = (sal_uInt8)nOffBits; - m_pImageData[11] = (sal_uInt8)(nOffBits >> 8); - m_pImageData[12] = (sal_uInt8)(nOffBits >> 16); - m_pImageData[13] = (sal_uInt8)(nOffBits >> 24); + m_pImageData[10] = static_cast(nOffBits); + m_pImageData[11] = static_cast(nOffBits >> 8); + m_pImageData[12] = static_cast(nOffBits >> 16); + m_pImageData[13] = static_cast(nOffBits >> 24); sal_uInt32 nDIBRemaining; sal_uInt8* pPicData = m_pImageData; if (aInfoHeader2.nHeaderLen== sizeof(BmpInfoHeader)) { - m_pImageData[14] = (sal_uInt8)aInfoHeader2.nHeaderLen; - m_pImageData[15] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 8); - m_pImageData[16] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 16); - m_pImageData[17] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 24); - m_pImageData[18] = (sal_uInt8)aInfoHeader2.nWidth; - m_pImageData[19] = (sal_uInt8)(aInfoHeader2.nWidth >> 8); - m_pImageData[20] = (sal_uInt8)aInfoHeader2.nHeight; - m_pImageData[21] = (sal_uInt8)(aInfoHeader2.nHeight >> 8); - m_pImageData[22] = (sal_uInt8)aInfoHeader2.nPlanes; - m_pImageData[23] = (sal_uInt8)(aInfoHeader2.nPlanes >> 8); - m_pImageData[24] = (sal_uInt8)aInfoHeader2.nBitCount; - m_pImageData[25] = (sal_uInt8)(aInfoHeader2.nBitCount >> 8); + m_pImageData[14] = static_cast(aInfoHeader2.nHeaderLen); + m_pImageData[15] = static_cast(aInfoHeader2.nHeaderLen >> 8); + m_pImageData[16] = static_cast(aInfoHeader2.nHeaderLen >> 16); + m_pImageData[17] = static_cast(aInfoHeader2.nHeaderLen >> 24); + m_pImageData[18] = static_cast(aInfoHeader2.nWidth); + m_pImageData[19] = static_cast(aInfoHeader2.nWidth >> 8); + m_pImageData[20] = static_cast(aInfoHeader2.nHeight); + m_pImageData[21] = static_cast(aInfoHeader2.nHeight >> 8); + m_pImageData[22] = static_cast(aInfoHeader2.nPlanes); + m_pImageData[23] = static_cast(aInfoHeader2.nPlanes >> 8); + m_pImageData[24] = static_cast(aInfoHeader2.nBitCount); + m_pImageData[25] = static_cast(aInfoHeader2.nBitCount >> 8); nDIBRemaining = m_aBmpRec.nFileSize - 26; pPicData += 26*sizeof(sal_uInt8); } else { - m_pImageData[14] = (sal_uInt8)aInfoHeader2.nHeaderLen; - m_pImageData[15] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 8); - m_pImageData[16] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 16); - m_pImageData[17] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 24); - m_pImageData[18] = (sal_uInt8)aInfoHeader2.nWidth; - m_pImageData[19] = (sal_uInt8)(aInfoHeader2.nWidth >> 8); - m_pImageData[20] = (sal_uInt8)(aInfoHeader2.nWidth >> 16); - m_pImageData[21] = (sal_uInt8)(aInfoHeader2.nWidth >> 24); - m_pImageData[22] = (sal_uInt8)aInfoHeader2.nHeight; - m_pImageData[23] = (sal_uInt8)(aInfoHeader2.nHeight >> 8); - m_pImageData[24] = (sal_uInt8)(aInfoHeader2.nHeight >> 16); - m_pImageData[25] = (sal_uInt8)(aInfoHeader2.nHeight >> 24); - m_pImageData[26] = (sal_uInt8)aInfoHeader2.nPlanes; - m_pImageData[27] = (sal_uInt8)(aInfoHeader2.nPlanes >> 8); - m_pImageData[28] = (sal_uInt8)aInfoHeader2.nBitCount; - m_pImageData[29] = (sal_uInt8)(aInfoHeader2.nBitCount >> 8); + m_pImageData[14] = static_cast(aInfoHeader2.nHeaderLen); + m_pImageData[15] = static_cast(aInfoHeader2.nHeaderLen >> 8); + m_pImageData[16] = static_cast(aInfoHeader2.nHeaderLen >> 16); + m_pImageData[17] = static_cast(aInfoHeader2.nHeaderLen >> 24); + m_pImageData[18] = static_cast(aInfoHeader2.nWidth); + m_pImageData[19] = static_cast(aInfoHeader2.nWidth >> 8); + m_pImageData[20] = static_cast(aInfoHeader2.nWidth >> 16); + m_pImageData[21] = static_cast(aInfoHeader2.nWidth >> 24); + m_pImageData[22] = static_cast(aInfoHeader2.nHeight); + m_pImageData[23] = static_cast(aInfoHeader2.nHeight >> 8); + m_pImageData[24] = static_cast(aInfoHeader2.nHeight >> 16); + m_pImageData[25] = static_cast(aInfoHeader2.nHeight >> 24); + m_pImageData[26] = static_cast(aInfoHeader2.nPlanes); + m_pImageData[27] = static_cast(aInfoHeader2.nPlanes >> 8); + m_pImageData[28] = static_cast(aInfoHeader2.nBitCount); + m_pImageData[29] = static_cast(aInfoHeader2.nBitCount >> 8); nDIBRemaining = m_aBmpRec.nFileSize - 30; pPicData += 30*sizeof(sal_uInt8); diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index 12e1a7afe86b..df851fd8d4f2 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -692,7 +692,7 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame) rtl::Reference pFont = m_pLayout->GetFont(); if(pFont.is()) { - offset = (double)(pFont->GetFontSize())*CM_PER_INCH/POINTS_PER_INCH; + offset = static_cast(pFont->GetFontSize())*CM_PER_INCH/POINTS_PER_INCH; } fYOffset = offset-fYOffset; break; diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx index 43e02747b4cc..6e737a2fba16 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.cxx +++ b/lotuswordpro/source/filter/lwpgrfobj.cxx @@ -448,12 +448,12 @@ void LwpGraphicObject::CreateGrafObject() { if (m_aIPData.nBrightness != 50) { - sal_Int32 nSODCBrightness = (sal_Int32)m_aIPData.nBrightness*2 - 100; + sal_Int32 nSODCBrightness = static_cast(m_aIPData.nBrightness)*2 - 100; xImageStyle->SetBrightness(nSODCBrightness); } if (m_aIPData.nContrast != 50) { - sal_Int32 nSODCContrast = (sal_Int32)(80 - (double)m_aIPData.nContrast*1.6); + sal_Int32 nSODCContrast = static_cast(80 - static_cast(m_aIPData.nContrast)*1.6); xImageStyle->SetContrast(nSODCContrast); } } @@ -468,8 +468,8 @@ void LwpGraphicObject::CreateGrafObject() LwpLayoutGeometry* pFrameGeo = pMyFrameLayout->GetGeometry(); // original image size - double fOrgGrafWidth = (double)m_Cache.Width/TWIPS_PER_CM; - double fOrgGrafHeight = (double)m_Cache.Height/TWIPS_PER_CM; + double fOrgGrafWidth = static_cast(m_Cache.Width)/TWIPS_PER_CM; + double fOrgGrafHeight = static_cast(m_Cache.Height)/TWIPS_PER_CM; // get margin values double fLeftMargin = pMyFrameLayout->GetMarginsValue(MARGIN_LEFT); @@ -503,7 +503,7 @@ void LwpGraphicObject::CreateGrafObject() } else if (nScalemode & LwpLayoutScale::PERCENTAGE) { - double fScalePercentage = (double)pMyScale->GetScalePercentage() / 1000; + double fScalePercentage = static_cast(pMyScale->GetScalePercentage()) / 1000; fSclGrafWidth = fScalePercentage * fOrgGrafWidth; fSclGrafHeight = fScalePercentage * fOrgGrafHeight; } @@ -730,8 +730,8 @@ void LwpGraphicObject::XFConvertEquation(XFContentContainer * pCont) void LwpGraphicObject::GetGrafOrgSize(double & rWidth, double & rHeight) { // original image size - rWidth = (double)m_Cache.Width/TWIPS_PER_CM; - rHeight = (double)m_Cache.Height/TWIPS_PER_CM; + rWidth = static_cast(m_Cache.Width)/TWIPS_PER_CM; + rHeight = static_cast(m_Cache.Height)/TWIPS_PER_CM; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx index 6eac6d47becc..b695f78c1824 100644 --- a/lotuswordpro/source/filter/lwpidxmgr.cxx +++ b/lotuswordpro/source/filter/lwpidxmgr.cxx @@ -231,11 +231,11 @@ void LwpIndexManager::ReadObjIndex( LwpSvStream *pStrm ) std::unique_ptr pObjStrm( new LwpObjectStream(pStrm, ObjHdr.IsCompressed(), static_cast(ObjHdr.GetSize()) ) ); - if( (sal_uInt32)VO_OBJINDEX == ObjHdr.GetTag() ) + if( sal_uInt32(VO_OBJINDEX) == ObjHdr.GetTag() ) { ReadObjIndexData( pObjStrm.get() ); } - else if( (sal_uInt32)VO_LEAFOBJINDEX == ObjHdr.GetTag() ) + else if( sal_uInt32(VO_LEAFOBJINDEX) == ObjHdr.GetTag() ) { ReadLeafData( pObjStrm.get() ); } diff --git a/lotuswordpro/source/filter/lwpnumericfmt.cxx b/lotuswordpro/source/filter/lwpnumericfmt.cxx index 6da7cea9edc3..5a8eed18d29f 100644 --- a/lotuswordpro/source/filter/lwpnumericfmt.cxx +++ b/lotuswordpro/source/filter/lwpnumericfmt.cxx @@ -352,14 +352,14 @@ XFStyle* LwpNumericFormat::Convert() pStyle->SetPrefix(aPrefix); //Set suffix pStyle->SetSurfix(aSuffix); - pStyle->SetColor( XFColor( (sal_uInt8)aColor.GetRed(), - (sal_uInt8)aColor.GetGreen(), - (sal_uInt8)aColor.GetBlue()) ); + pStyle->SetColor( XFColor( static_cast(aColor.GetRed()), + static_cast(aColor.GetGreen()), + static_cast(aColor.GetBlue())) ); } {//Negtive - pStyle->SetNegativeStyle( aNegPrefix, aNegSuffix, XFColor((sal_uInt8)aNegativeColor.GetRed(), - (sal_uInt8)aNegativeColor.GetGreen(), - (sal_uInt8)aNegativeColor.GetBlue()) ); + pStyle->SetNegativeStyle( aNegPrefix, aNegSuffix, XFColor(static_cast(aNegativeColor.GetRed()), + static_cast(aNegativeColor.GetGreen()), + static_cast(aNegativeColor.GetBlue())) ); } return pStyle; diff --git a/lotuswordpro/source/filter/lwpobjid.cxx b/lotuswordpro/source/filter/lwpobjid.cxx index 3a7d71b51be0..767c60931f46 100644 --- a/lotuswordpro/source/filter/lwpobjid.cxx +++ b/lotuswordpro/source/filter/lwpobjid.cxx @@ -109,7 +109,7 @@ void LwpObjectID::ReadIndexed(LwpSvStream *pStrm) LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); LwpObjectFactory* pFactory = pGlobal->GetLwpObjFactory(); LwpIndexManager& rIdxMgr = pFactory->GetIndexManager(); - m_nLow = rIdxMgr.GetObjTime( (sal_uInt16)m_nIndex); + m_nLow = rIdxMgr.GetObjTime( static_cast(m_nIndex)); } else { @@ -140,7 +140,7 @@ sal_uInt32 LwpObjectID::ReadIndexed(LwpObjectStream *pStrm) LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); LwpObjectFactory* pFactory = pGlobal->GetLwpObjFactory(); LwpIndexManager& rIdxMgr = pFactory->GetIndexManager(); - m_nLow = rIdxMgr.GetObjTime( (sal_uInt16)m_nIndex); + m_nLow = rIdxMgr.GetObjTime( static_cast(m_nIndex)); } else m_nLow = pStrm->QuickReaduInt32(); diff --git a/lotuswordpro/source/filter/lwpoleobject.cxx b/lotuswordpro/source/filter/lwpoleobject.cxx index d9ca5f7ed088..ed500545fd5c 100644 --- a/lotuswordpro/source/filter/lwpoleobject.cxx +++ b/lotuswordpro/source/filter/lwpoleobject.cxx @@ -144,7 +144,7 @@ void LwpGraphicOleObject::GetGrafScaledSize(double & fWidth, double & fHeight) } else if (nScalemode & LwpLayoutScale::PERCENTAGE) { - double fScalePercentage = (double)pMyScale->GetScalePercentage() / 1000; + double fScalePercentage = static_cast(pMyScale->GetScalePercentage()) / 1000; fSclGrafWidth = fScalePercentage * fWidth; fSclGrafHeight = fScalePercentage * fHeight; } @@ -255,8 +255,8 @@ void LwpOleObject::XFConvert(XFContentContainer * /*pCont*/) void LwpOleObject::GetGrafOrgSize(double & rWidth, double & rHeight) { - rWidth = (double)m_SizeRect.GetWidth()/1000;//cm unit - rHeight = (double)m_SizeRect.GetHeight()/1000;//cm unit + rWidth = static_cast(m_SizeRect.GetWidth())/1000;//cm unit + rHeight = static_cast(m_SizeRect.GetHeight())/1000;//cm unit } void LwpOleObject::RegisterStyle() diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx index f80adffb20ec..8e90b856da45 100644 --- a/lotuswordpro/source/filter/lwprowlayout.cxx +++ b/lotuswordpro/source/filter/lwprowlayout.cxx @@ -117,11 +117,11 @@ void LwpRowLayout::RegisterStyle() if (m_nDirection & 0x0030) { - pRowStyle->SetMinRowHeight((float)LwpTools::ConvertFromUnitsToMetric(cheight)); + pRowStyle->SetMinRowHeight(static_cast(LwpTools::ConvertFromUnitsToMetric(cheight))); } else { - pRowStyle->SetRowHeight((float)LwpTools::ConvertFromUnitsToMetric(cheight)); + pRowStyle->SetRowHeight(static_cast(LwpTools::ConvertFromUnitsToMetric(cheight))); } XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); m_StyleName = pXFStyleManager->AddStyle(pRowStyle).m_pStyle->GetStyleName(); @@ -166,9 +166,9 @@ void LwpRowLayout::Read() // Row layout content crowid = pStrm->QuickReaduInt16(); cheight = pStrm->QuickReadInt32(); - cLeaderDotCount = (sal_uInt8)pStrm->QuickReaduInt16(); // was written as lushort. + cLeaderDotCount = static_cast(pStrm->QuickReaduInt16()); // was written as lushort. cLeaderDotY = MAXUNIT; // Sentinel meaning "not calculated yet" - cRowFlags = (sal_uInt8)pStrm->QuickReaduInt16(); // was written as lushort. + cRowFlags = static_cast(pStrm->QuickReaduInt16()); // was written as lushort. pStrm->SkipExtra(); } @@ -283,11 +283,11 @@ void LwpRowLayout::RegisterCurRowStyle(XFRow* pXFRow,sal_uInt16 nRowMark) if (m_nDirection & 0x0030) { - pNewStyle->SetMinRowHeight((float)fHeight); + pNewStyle->SetMinRowHeight(static_cast(fHeight)); } else { - pNewStyle->SetRowHeight((float)fHeight); + pNewStyle->SetRowHeight(static_cast(fHeight)); } pXFRow->SetStyleName(pXFStyleManager->AddStyle(pNewStyle).m_pStyle->GetStyleName()); diff --git a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx index ef94322c23f7..05daa2e7686b 100644 --- a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx +++ b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx @@ -139,8 +139,8 @@ void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::ReferenceGetGrafOrgSize(nWidth, nHeight); - double fGrafOrgWidth = (double)nWidth/TWIPS_PER_CM; - double fGrafOrgHeight = (double)nHeight/TWIPS_PER_CM; + double fGrafOrgWidth = static_cast(nWidth)/TWIPS_PER_CM; + double fGrafOrgHeight = static_cast(nHeight)/TWIPS_PER_CM; // get margin values double fLeftMargin = xMyFrameLayout->GetMarginsValue(MARGIN_LEFT); @@ -167,14 +167,14 @@ void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::ReferenceGetScalePercentage() / 1000; + double fScalePercentage = static_cast(pMyScale->GetScalePercentage()) / 1000; m_aTransformData.fScaleX = fScalePercentage; m_aTransformData.fScaleY = fScalePercentage; } else if (nScalemode & LwpLayoutScale::FIT_IN_FRAME) { - double fWidth0 = (double)right / TWIPS_PER_CM; - double fHeight0 = (double)bottom / TWIPS_PER_CM; + double fWidth0 = static_cast(right) / TWIPS_PER_CM; + double fHeight0 = static_cast(bottom) / TWIPS_PER_CM; double fWidth1 = LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleWidth()); double fHeight1 = LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleHeight()); @@ -206,8 +206,8 @@ void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::Reference(aCenter.X())/TWIPS_PER_CM; + m_aTransformData.fOffsetY = fNewCenterY -static_cast(aCenter.Y())/TWIPS_PER_CM; } else { diff --git a/lotuswordpro/source/filter/lwpsdwrect.cxx b/lotuswordpro/source/filter/lwpsdwrect.cxx index bb462d9951d7..f06f68d6c71d 100644 --- a/lotuswordpro/source/filter/lwpsdwrect.cxx +++ b/lotuswordpro/source/filter/lwpsdwrect.cxx @@ -86,8 +86,8 @@ SdwRectangle::SdwRectangle(const Point& rPt0, const Point& rPt1, **************************************************************************/ Point SdwRectangle::GetRectCenter() const { - long nX = (long)((double)(m_nRectCorner[0].X() + m_nRectCorner[2].X())/2 + 0.5); - long nY = (long)((double)(m_nRectCorner[0].Y() + m_nRectCorner[2].Y())/2 + 0.5); + long nX = static_cast(static_cast(m_nRectCorner[0].X() + m_nRectCorner[2].X())/2 + 0.5); + long nY = static_cast(static_cast(m_nRectCorner[0].Y() + m_nRectCorner[2].Y())/2 + 0.5); return Point(nX, nY); } @@ -102,7 +102,7 @@ long SdwRectangle::GetWidth() const long nX1 = m_nRectCorner[1].X(); long nY1 = m_nRectCorner[1].Y(); - return (long)CalcDistBetween2Points(nX0, nY0, nX1, nY1); + return static_cast(CalcDistBetween2Points(nX0, nY0, nX1, nY1)); } /************************************************************************** * @short: Calculate height of the rectangle. @@ -115,7 +115,7 @@ long SdwRectangle::GetHeight() const long nX2 = m_nRectCorner[2].X(); long nY2 = m_nRectCorner[2].Y(); - return (long)CalcDistBetween2Points(nX1, nY1, nX2, nY2); + return static_cast(CalcDistBetween2Points(nX1, nY1, nX2, nY2)); } /************************************************************************** * @short: Calculate coordinate of the original rectangle. @@ -129,8 +129,8 @@ tools::Rectangle SdwRectangle::GetOriginalRect() const long nWidth = GetWidth(); Point aCenter = GetRectCenter(); - Point aLT(aCenter.X()-(long)((double)nWidth/2+0.5), - aCenter.Y()-(long)((double)nHeight/2+0.5)); + Point aLT(aCenter.X()-static_cast(static_cast(nWidth)/2+0.5), + aCenter.Y()-static_cast(static_cast(nHeight)/2+0.5)); Point aRB(aLT.X()+nWidth, aLT.Y()+nHeight); return tools::Rectangle(aLT, aRB); @@ -151,16 +151,16 @@ double SdwRectangle::GetRotationAngle() const return 0.00; } - double fX1 = (double)(m_nRectCorner[1].X()); - double fY1 = (double)(m_nRectCorner[1].Y()); - double fX2 = (double)(m_nRectCorner[2].X()); - double fY2 = (double)(m_nRectCorner[2].Y()); + double fX1 = static_cast(m_nRectCorner[1].X()); + double fY1 = static_cast(m_nRectCorner[1].Y()); + double fX2 = static_cast(m_nRectCorner[2].X()); + double fY2 = static_cast(m_nRectCorner[2].Y()); double fMidX = (fX1 + fX2) / 2; double fMidY = (fY1 + fY2) / 2; Point aCenter = GetRectCenter(); - double fCenterX = (double)aCenter.X(); - double fCenterY = (double)aCenter.Y(); + double fCenterX = static_cast(aCenter.X()); + double fCenterY = static_cast(aCenter.Y()); double fAngle = atan2((fMidY - fCenterY), (fMidX - fCenterX)); @@ -169,7 +169,7 @@ double SdwRectangle::GetRotationAngle() const double SdwRectangle::CalcDistBetween2Points(long nX1, long nY1, long nX2, long nY2) { - return sqrt((double)((nX1-nX2)*(nX1-nX2) + (nY1-nY2)*(nY1-nY2))); + return sqrt(static_cast((nX1-nX2)*(nX1-nX2) + (nY1-nY2)*(nY1-nY2))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index de78337ba4b8..17a418e6c9d6 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -653,11 +653,11 @@ void LwpTableLayout::RegisterRows() XFRowStyle * pRowStyle = new XFRowStyle(); if (m_nDirection & 0x0030) { - pRowStyle->SetMinRowHeight((float)pTable->GetHeight()); + pRowStyle->SetMinRowHeight(static_cast(pTable->GetHeight())); } else { - pRowStyle->SetRowHeight((float)pTable->GetHeight()); + pRowStyle->SetRowHeight(static_cast(pTable->GetHeight())); } XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); m_DefaultRowStyleName = pXFStyleManager->AddStyle(pRowStyle).m_pStyle->GetStyleName(); @@ -778,7 +778,7 @@ void LwpTableLayout::ParseTable() m_pXFTable->SetStyleName(m_StyleName); sal_uInt16 nRow = m_nRows; - sal_uInt8 nCol = (sal_uInt8)m_nCols; + sal_uInt8 nCol = static_cast(m_nCols); //process header rows LwpTableHeadingLayout* pTableHeading; @@ -904,11 +904,11 @@ void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable, rtl::Reference } if (m_nDirection & 0x0030) { - pRowStyle->SetMinRowHeight((float)fHeight); + pRowStyle->SetMinRowHeight(static_cast(fHeight)); } else { - pRowStyle->SetRowHeight((float)fHeight); + pRowStyle->SetRowHeight(static_cast(fHeight)); } pXFRow->SetStyleName(pXFStyleManager->AddStyle(pRowStyle).m_pStyle->GetStyleName()); @@ -1302,7 +1302,7 @@ void LwpTableLayout::SplitConflictCells() } else { - nEffectRows = i + pRowLayout->GetCurMaxSpannedRows(0,(sal_uInt8)nCol); + nEffectRows = i + pRowLayout->GetCurMaxSpannedRows(0,static_cast(nCol)); for (sal_uInt16 j = i+1; jQuickReaduInt16(); // forced to lushort - ccolid = (sal_uInt8)colid; + ccolid = static_cast(colid); cwidth = pStrm->QuickReadInt32(); pStrm->SkipExtra(); diff --git a/lotuswordpro/source/filter/lwptblcell.cxx b/lotuswordpro/source/filter/lwptblcell.cxx index b293deecd3d0..7f13c6a0252b 100644 --- a/lotuswordpro/source/filter/lwptblcell.cxx +++ b/lotuswordpro/source/filter/lwptblcell.cxx @@ -89,7 +89,7 @@ void LwpCellList::Read() LwpObjectID cDependent; cDependent.ReadIndexed(m_pObjStrm.get()); - cColumn = (sal_uInt8) m_pObjStrm->QuickReaduInt16(); // written as a sal_uInt16 + cColumn = static_cast(m_pObjStrm->QuickReaduInt16()); // written as a sal_uInt16 // sal_uInt8 cCellFlags = (sal_uInt8) m_pObjStrm->QuickReaduInt16(); // written as a sal_uInt16 m_pObjStrm->SeekRel(2);//CellFlags m_pObjStrm->SkipExtra(); @@ -232,7 +232,7 @@ void LwpDependent::Read() cFormulaInfo.ReadIndexed(m_pObjStrm.get()); cReferenceOffset = m_pObjStrm->QuickReaduInt16(); - cFlags = (sal_uInt8)m_pObjStrm->QuickReaduInt16(); // Written as lushort. + cFlags = static_cast(m_pObjStrm->QuickReaduInt16()); // Written as lushort. m_pObjStrm->SkipExtra(); } @@ -248,14 +248,14 @@ void LwpRowSpecifier::QuickRead(LwpObjectStream *pStrm) } void LwpColumnSpecifier::QuickRead(LwpObjectStream *pStrm) { - cColumn = (sal_uInt8)pStrm->QuickReaduInt16(); + cColumn = static_cast(pStrm->QuickReaduInt16()); cQualifier.QuickRead(pStrm); } void LwpRowColumnQualifier::QuickRead(LwpObjectStream *pStrm) { // written as lushort for future flags - cFlags = (sal_uInt8)pStrm->QuickReaduInt16(); + cFlags = static_cast(pStrm->QuickReaduInt16()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx index 665a3f3258ec..7c9f0567a76c 100644 --- a/lotuswordpro/source/filter/lwptblformula.cxx +++ b/lotuswordpro/source/filter/lwptblformula.cxx @@ -259,7 +259,7 @@ void LwpFormulaInfo::ReadArguments(LwpFormulaFunc& aFunc) for (sal_uInt16 Count = 0; Count < NumberOfArguments; Count++) { - sal_uInt8 ArgumentType = (sal_uInt8) m_pObjStrm->QuickReaduInt16(); // written as lushort + sal_uInt8 ArgumentType = static_cast(m_pObjStrm->QuickReaduInt16()); // written as lushort sal_uInt16 ArgumentDiskLength = m_pObjStrm->QuickReaduInt16(); bool bArgument = true; @@ -595,14 +595,14 @@ OUString LwpFormulaTools::GetName(sal_uInt16 nTokenType) OUString LwpFormulaTools::GetCellAddr(sal_Int16 nRow, sal_Int16 nCol, LwpTableLayout* pCellsMap) { OUString aCellAddr; - XFCell* pCell = pCellsMap->GetCellsMap(nRow,(sal_uInt8)nCol); + XFCell* pCell = pCellsMap->GetCellsMap(nRow,static_cast(nCol)); if (pCell) { aCellAddr = pCell->GetCellName(); } else { - assert( -1==nRow || -1==(sal_Int8)nCol); + assert( -1==nRow || -1==static_cast(nCol)); } return aCellAddr; } diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx index 940ff20e7ba9..3f2add0b96a2 100644 --- a/lotuswordpro/source/filter/lwptoc.cxx +++ b/lotuswordpro/source/filter/lwptoc.cxx @@ -226,7 +226,7 @@ void LwpTocSuperLayout::XFConvert(XFContentContainer* pCont) pTemplate->AddEntry(enumXFIndexTemplatePage, "TOC Page Number Text Style"); } - xToc->AddTemplate(OUString::number((sal_Int32)i), m_pFoundry->FindActuralStyleName(pLevel->GetSearchStyle()), pTemplate); + xToc->AddTemplate(OUString::number(static_cast(i)), m_pFoundry->FindActuralStyleName(pLevel->GetSearchStyle()), pTemplate); bInserted = true; } @@ -370,7 +370,7 @@ sal_uInt16 LwpTocSuperLayout::GetSeparatorType(sal_uInt16 index) if (index >= MAX_LEVELS) return NONE; - sal_uInt16 Flag = (sal_uInt16)m_nFlags[index]; + sal_uInt16 Flag = static_cast(m_nFlags[index]); if (Flag & TS_LEADERDOTS) return LEADERDOTS; diff --git a/lotuswordpro/source/filter/lwpverdocument.cxx b/lotuswordpro/source/filter/lwpverdocument.cxx index ccbcc8762198..a19d9a6c8263 100644 --- a/lotuswordpro/source/filter/lwpverdocument.cxx +++ b/lotuswordpro/source/filter/lwpverdocument.cxx @@ -92,7 +92,7 @@ void LwpVerDocument::Read() void LwpVerDocument::RegisterStyle() { XFDefaultParaStyle* pDefault = new XFDefaultParaStyle; - double len =(double) m_nTabSpacing/UNITS_PER_INCH*CM_PER_INCH; + double len =static_cast(m_nTabSpacing)/UNITS_PER_INCH*CM_PER_INCH; if(len < 0.001) { len = 1.27; //0.5 inch diff --git a/lotuswordpro/source/filter/tocread.cxx b/lotuswordpro/source/filter/tocread.cxx index f85e0c4230d8..fcbd329380d6 100644 --- a/lotuswordpro/source/filter/tocread.cxx +++ b/lotuswordpro/source/filter/tocread.cxx @@ -452,7 +452,7 @@ CBenTOCReader::ReadSegment(CBenValue * pValue, BenByte * pLookAhead) else if (Length != 0) { assert(Length <= 4); - new CBenValueSegment(pValue, ImmData, (unsigned short) Length); + new CBenValueSegment(pValue, ImmData, static_cast(Length)); } } diff --git a/lotuswordpro/source/filter/xfilter/xfframestyle.cxx b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx index 178372956660..1127633f8ae4 100644 --- a/lotuswordpro/source/filter/xfilter/xfframestyle.cxx +++ b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx @@ -152,7 +152,7 @@ void XFFrameStyle::ToXml(IXFStream *pStrm) if( m_aBackColor.IsValid() ) { pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() ); - pAttrList->AddAttribute( "style:background-transparency", OUString::number((sal_Int32)m_nTransparency) + "%"); + pAttrList->AddAttribute( "style:background-transparency", OUString::number(static_cast(m_nTransparency)) + "%"); } //pad diff --git a/lotuswordpro/source/filter/xfilter/xfliststyle.cxx b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx index 16b71b4fb3f4..85db3c77a973 100644 --- a/lotuswordpro/source/filter/xfilter/xfliststyle.cxx +++ b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx @@ -78,11 +78,11 @@ void XFListlevelNumber::ToXml(IXFStream *pStrm) IXFAttrList *pAttrList = pStrm->GetAttrList(); pAttrList->Clear(); - pAttrList->AddAttribute( "text:level", OUString::number((sal_Int32)m_nLevel) ); + pAttrList->AddAttribute( "text:level", OUString::number(static_cast(m_nLevel)) ); //text:style-name,ignore now. m_aNumFmt.ToXml(pStrm); if( m_nDisplayLevel ) - pAttrList->AddAttribute( "text:display-levels", OUString::number((sal_Int32)m_nDisplayLevel) ); + pAttrList->AddAttribute( "text:display-levels", OUString::number(static_cast(m_nDisplayLevel)) ); pStrm->StartElement( "text:list-level-style-number" ); @@ -113,7 +113,7 @@ void XFListLevelBullet::ToXml(IXFStream *pStrm) IXFAttrList *pAttrList = pStrm->GetAttrList(); pAttrList->Clear(); - pAttrList->AddAttribute( "text:level", OUString::number((sal_Int32)m_nLevel) ); + pAttrList->AddAttribute( "text:level", OUString::number(static_cast(m_nLevel)) ); //text:style-name,ignore now. m_aNumFmt.ToXml(pStrm); //bullet-char diff --git a/lotuswordpro/source/filter/xfilter/xfparastyle.cxx b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx index 6fe3b29c5004..04de9138e488 100644 --- a/lotuswordpro/source/filter/xfilter/xfparastyle.cxx +++ b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx @@ -273,7 +273,7 @@ void XFParaStyle::SetLineHeight(enumLHType type, double value) m_aLineHeight.SetLeastHeight(value); break; case enumLHPercent: //perhaps i should redesign the interface here,ohm.. - m_aLineHeight.SetPercent((sal_Int32)value); + m_aLineHeight.SetPercent(static_cast(value)); break; case enumLHSpace: m_aLineHeight.SetSpace(value*0.5666); //don't known why,just suspect. -- cgit