diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-07-24 17:51:16 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-07-26 14:25:29 +0200 |
commit | 361824bb8a3445c9685ea02cbc1b96b4ca8ba61f (patch) | |
tree | 01e17a5ae6db2e223e345fcd9ea4d435ab79d069 /sw/source | |
parent | 6f7f22df1f89613a36bad874d5e134732703b51c (diff) |
Use more proper integer types, avoid temporaries, constify
Change-Id: I8352df21754e7b12ad0851dcdb64be6aa679537e
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/uiview/srcview.cxx | 23 | ||||
-rw-r--r-- | sw/source/uibase/uiview/uivwimp.cxx | 3 |
2 files changed, 12 insertions, 14 deletions
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 8c2606fde81c..ace3b275a060 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -127,7 +127,7 @@ void SwSrcView::InitInterface_Impl() TYPEINIT1(SwSrcView, SfxViewShell) -static void lcl_PrintHeader( OutputDevice &rOutDev, sal_uInt16 nPages, sal_uInt16 nCurPage, const OUString& rTitle ) +static void lcl_PrintHeader( OutputDevice &rOutDev, sal_Int32 nPages, sal_Int32 nCurPage, const OUString& rTitle ) { short nLeftMargin = LMARGPRN; Size aSz = rOutDev.GetOutputSize(); @@ -287,9 +287,8 @@ void SwSrcView::SaveContent(const OUString& rTmpFile) void SwSrcView::Execute(SfxRequest& rReq) { - sal_uInt16 nSlot = rReq.GetSlot(); TextView* pTextView = aEditWin.GetTextView(); - switch( nSlot ) + switch( rReq.GetSlot() ) { case SID_SAVEACOPY: case SID_SAVEASDOC: @@ -364,7 +363,7 @@ void SwSrcView::Execute(SfxRequest& rReq) { const SfxItemSet* pTmpArgs = rReq.GetArgs(); - sal_uInt16 nWhich = pTmpArgs->GetWhichByPos( 0 ); + const sal_uInt16 nWhich = pTmpArgs->GetWhichByPos( 0 ); OSL_ENSURE( nWhich, "Which for SearchItem ?" ); const SfxPoolItem& rItem = pTmpArgs->Get( nWhich ); SetSearchItem( (const SvxSearchItem&)rItem); @@ -578,7 +577,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, bool bAtStart = pTextView->GetSelection() == TextSelection( aPaM, aPaM ); if( !bForward ) - aPaM = TextPaM( (sal_uLong)-1, (sal_uInt16)-1 ); + aPaM = TextPaM( (sal_uLong)-1, USHRT_MAX ); if( bFromStart ) { @@ -712,28 +711,28 @@ sal_Int32 SwSrcView::PrintSource( OUString aTitle( GetViewFrame()->GetWindow().GetText() ); - sal_uInt16 nLineHeight = (sal_uInt16) pOutDev->GetTextHeight(); // slightly more - sal_uInt16 nParaSpace = 10; + const long nLineHeight = pOutDev->GetTextHeight(); // slightly more + const long nParaSpace = 10; Size aPaperSz = pOutDev->GetOutputSize(); aPaperSz.Width() -= (LMARGPRN + RMARGPRN); aPaperSz.Height() -= (TMARGPRN + BMARGPRN); // nLinepPage is not true, if lines have to be wrapped... - sal_uInt16 nLinespPage = (sal_uInt16) (aPaperSz.Height() / nLineHeight); + const long nLinespPage = aPaperSz.Height() / nLineHeight; const sal_Int32 nCharspLine = static_cast<sal_Int32>(aPaperSz.Width() / pOutDev->GetTextWidth("X")); - sal_uInt16 nParas = static_cast< sal_uInt16 >( pTextEngine->GetParagraphCount() ); + const sal_uLong nParas = pTextEngine->GetParagraphCount(); - sal_uInt16 nPages = (sal_uInt16) (nParas / nLinespPage + 1 ); - sal_uInt16 nCurPage = 1; + const sal_Int32 nPages = static_cast<sal_Int32>(nParas / nLinespPage + 1 ); + sal_Int32 nCurPage = 1; // Print header... if (!bCalcNumPagesOnly && nPage == nCurPage) lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle ); const Point aStartPos( LMARGPRN, TMARGPRN ); Point aPos( aStartPos ); - for ( sal_uInt16 nPara = 0; nPara < nParas; ++nPara ) + for ( sal_uLong nPara = 0; nPara < nParas; ++nPara ) { const OUString aLine( lcl_ConvertTabsToSpaces(pTextEngine->GetText( nPara )) ); const sal_Int32 nLineLen = aLine.getLength(); diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx index 9be563188c24..e2915e30c678 100644 --- a/sw/source/uibase/uiview/uivwimp.cxx +++ b/sw/source/uibase/uiview/uivwimp.cxx @@ -121,8 +121,7 @@ SwXTextView* SwView_Impl::GetUNOObject_Impl() void SwView_Impl::ExecuteScan( SfxRequest& rReq ) { - sal_uInt16 nSlot = rReq.GetSlot(); - switch(nSlot) + switch(rReq.GetSlot()) { case SID_TWAIN_SELECT: { |