Kaydet (Commit) 361824bb authored tarafından Matteo Casalin's avatar Matteo Casalin

Use more proper integer types, avoid temporaries, constify

Change-Id: I8352df21754e7b12ad0851dcdb64be6aa679537e
üst 6f7f22df
...@@ -127,7 +127,7 @@ void SwSrcView::InitInterface_Impl() ...@@ -127,7 +127,7 @@ void SwSrcView::InitInterface_Impl()
TYPEINIT1(SwSrcView, SfxViewShell) 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; short nLeftMargin = LMARGPRN;
Size aSz = rOutDev.GetOutputSize(); Size aSz = rOutDev.GetOutputSize();
...@@ -287,9 +287,8 @@ void SwSrcView::SaveContent(const OUString& rTmpFile) ...@@ -287,9 +287,8 @@ void SwSrcView::SaveContent(const OUString& rTmpFile)
void SwSrcView::Execute(SfxRequest& rReq) void SwSrcView::Execute(SfxRequest& rReq)
{ {
sal_uInt16 nSlot = rReq.GetSlot();
TextView* pTextView = aEditWin.GetTextView(); TextView* pTextView = aEditWin.GetTextView();
switch( nSlot ) switch( rReq.GetSlot() )
{ {
case SID_SAVEACOPY: case SID_SAVEACOPY:
case SID_SAVEASDOC: case SID_SAVEASDOC:
...@@ -364,7 +363,7 @@ void SwSrcView::Execute(SfxRequest& rReq) ...@@ -364,7 +363,7 @@ void SwSrcView::Execute(SfxRequest& rReq)
{ {
const SfxItemSet* pTmpArgs = rReq.GetArgs(); const SfxItemSet* pTmpArgs = rReq.GetArgs();
sal_uInt16 nWhich = pTmpArgs->GetWhichByPos( 0 ); const sal_uInt16 nWhich = pTmpArgs->GetWhichByPos( 0 );
OSL_ENSURE( nWhich, "Which for SearchItem ?" ); OSL_ENSURE( nWhich, "Which for SearchItem ?" );
const SfxPoolItem& rItem = pTmpArgs->Get( nWhich ); const SfxPoolItem& rItem = pTmpArgs->Get( nWhich );
SetSearchItem( (const SvxSearchItem&)rItem); SetSearchItem( (const SvxSearchItem&)rItem);
...@@ -578,7 +577,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, ...@@ -578,7 +577,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
bool bAtStart = pTextView->GetSelection() == TextSelection( aPaM, aPaM ); bool bAtStart = pTextView->GetSelection() == TextSelection( aPaM, aPaM );
if( !bForward ) if( !bForward )
aPaM = TextPaM( (sal_uLong)-1, (sal_uInt16)-1 ); aPaM = TextPaM( (sal_uLong)-1, USHRT_MAX );
if( bFromStart ) if( bFromStart )
{ {
...@@ -712,28 +711,28 @@ sal_Int32 SwSrcView::PrintSource( ...@@ -712,28 +711,28 @@ sal_Int32 SwSrcView::PrintSource(
OUString aTitle( GetViewFrame()->GetWindow().GetText() ); OUString aTitle( GetViewFrame()->GetWindow().GetText() );
sal_uInt16 nLineHeight = (sal_uInt16) pOutDev->GetTextHeight(); // slightly more const long nLineHeight = pOutDev->GetTextHeight(); // slightly more
sal_uInt16 nParaSpace = 10; const long nParaSpace = 10;
Size aPaperSz = pOutDev->GetOutputSize(); Size aPaperSz = pOutDev->GetOutputSize();
aPaperSz.Width() -= (LMARGPRN + RMARGPRN); aPaperSz.Width() -= (LMARGPRN + RMARGPRN);
aPaperSz.Height() -= (TMARGPRN + BMARGPRN); aPaperSz.Height() -= (TMARGPRN + BMARGPRN);
// nLinepPage is not true, if lines have to be wrapped... // 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 = const sal_Int32 nCharspLine =
static_cast<sal_Int32>(aPaperSz.Width() / pOutDev->GetTextWidth("X")); 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 ); const sal_Int32 nPages = static_cast<sal_Int32>(nParas / nLinespPage + 1 );
sal_uInt16 nCurPage = 1; sal_Int32 nCurPage = 1;
// Print header... // Print header...
if (!bCalcNumPagesOnly && nPage == nCurPage) if (!bCalcNumPagesOnly && nPage == nCurPage)
lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle ); lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle );
const Point aStartPos( LMARGPRN, TMARGPRN ); const Point aStartPos( LMARGPRN, TMARGPRN );
Point aPos( aStartPos ); 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 OUString aLine( lcl_ConvertTabsToSpaces(pTextEngine->GetText( nPara )) );
const sal_Int32 nLineLen = aLine.getLength(); const sal_Int32 nLineLen = aLine.getLength();
......
...@@ -121,8 +121,7 @@ SwXTextView* SwView_Impl::GetUNOObject_Impl() ...@@ -121,8 +121,7 @@ SwXTextView* SwView_Impl::GetUNOObject_Impl()
void SwView_Impl::ExecuteScan( SfxRequest& rReq ) void SwView_Impl::ExecuteScan( SfxRequest& rReq )
{ {
sal_uInt16 nSlot = rReq.GetSlot(); switch(rReq.GetSlot())
switch(nSlot)
{ {
case SID_TWAIN_SELECT: case SID_TWAIN_SELECT:
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment