summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-11-29 17:19:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-11-29 17:19:32 +0100
commit34dda497cdf0b131381c5d728a89343455d9c7d8 (patch)
tree1920b8c031c525adfdb9bbcaa5e7051ed728a8aa
parent1ba9b792ccd6a27b56709917374a1ea03c0a000a (diff)
Rewrite some (trivial) assignments inside if/while conditions: sc
Change-Id: Ia2dfbd64d63958d4f9c04e892cc7ebc250e9ca70
-rw-r--r--sc/source/core/data/dociter.cxx4
-rw-r--r--sc/source/core/tool/address.cxx6
-rw-r--r--sc/source/core/tool/chgtrack.cxx42
-rw-r--r--sc/source/filter/excel/xeview.cxx5
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx3
-rw-r--r--sc/source/ui/pagedlg/areasdlg.cxx3
-rw-r--r--sc/source/ui/unoobj/docuno.cxx6
-rw-r--r--sc/source/ui/view/viewfun2.cxx12
8 files changed, 48 insertions, 33 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 8bbb121de8fe..6f3467ff8bc6 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -82,8 +82,8 @@ void ScAttrArray_IterGetNumberFormat( sal_uLong& nFormat, const ScAttrArray*& rp
{
SCROW nRowStart = 0;
SCROW nRowEnd = MAXROW;
- const ScPatternAttr* pPattern;
- if( !(pPattern = pNewArr->GetPatternRange( nRowStart, nRowEnd, nRow ) ) )
+ const ScPatternAttr* pPattern = pNewArr->GetPatternRange( nRowStart, nRowEnd, nRow );
+ if( !pPattern )
{
pPattern = pDoc->GetDefPattern();
nRowEnd = MAXROW;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 0a7a2a9836a2..ad82b72a2218 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -662,7 +662,8 @@ static const sal_Unicode* lcl_r1c1_get_col( const sal_Unicode* p,
return nullptr;
p++;
- if( ( isRelative = (*p == '[') ) )
+ isRelative = *p == '[';
+ if( isRelative )
p++;
n = sal_Unicode_strtol( p, &pEnd );
if( nullptr == pEnd )
@@ -708,7 +709,8 @@ static inline const sal_Unicode* lcl_r1c1_get_row(
return nullptr;
p++;
- if( ( isRelative = (*p == '[') ) )
+ isRelative = *p == '[';
+ if( isRelative )
p++;
n = sal_Unicode_strtol( p, &pEnd );
if( nullptr == pEnd )
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 9a6963fc1e91..1b34fe2982b0 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1013,21 +1013,18 @@ bool ScChangeActionDel::Reject( ScDocument* pDoc )
case SC_CAT_DELETE_COLS :
if ( !(aRange.aStart.Col() == 0 && aRange.aEnd.Col() == MAXCOL) )
{ // Only if not TabDelete
- if ( ( bOk = pDoc->CanInsertCol( aRange ) ) )
- bOk = pDoc->InsertCol( aRange );
+ bOk = pDoc->CanInsertCol( aRange ) && pDoc->InsertCol( aRange );
}
break;
case SC_CAT_DELETE_ROWS :
- if ( ( bOk = pDoc->CanInsertRow( aRange ) ) )
- bOk = pDoc->InsertRow( aRange );
+ bOk = pDoc->CanInsertRow( aRange ) && pDoc->InsertRow( aRange );
break;
case SC_CAT_DELETE_TABS :
{
//TODO: Remember table names?
OUString aName;
pDoc->CreateValidTabName( aName );
- if ( ( bOk = pDoc->ValidNewTabName( aName ) ) )
- bOk = pDoc->InsertTab( aRange.aStart.Tab(), aName );
+ bOk = pDoc->ValidNewTabName( aName ) && pDoc->InsertTab( aRange.aStart.Tab(), aName );
}
break;
default:
@@ -4239,11 +4236,15 @@ bool ScChangeTrack::Reject(
bOk = Reject( itChangeAction->second, nullptr, true ); // Recursion!
}
}
- if ( bOk && (bRejected = pAct->Reject( pDoc )) )
+ if ( bOk )
{
- // pRefDoc NULL := Do not save deleted Cells
- AppendDeleteRange( pAct->GetBigRange().MakeRange(), nullptr, (short) 0,
- pAct->GetActionNumber() );
+ bRejected = pAct->Reject( pDoc );
+ if ( bRejected )
+ {
+ // pRefDoc NULL := Do not save deleted Cells
+ AppendDeleteRange( pAct->GetBigRange().MakeRange(), nullptr, (short) 0,
+ pAct->GetActionNumber() );
+ }
}
}
else if ( pAct->IsDeleteType() )
@@ -4352,14 +4353,18 @@ bool ScChangeTrack::Reject(
bOk = Reject( itChangeAction->second, nullptr, true ); // Recursion!
}
}
- if ( bOk && (bRejected = pAct->Reject( pDoc )) )
+ if ( bOk )
{
- ScChangeActionMove* pReject = new ScChangeActionMove(
- pAct->GetBigRange().MakeRange(),
- static_cast<ScChangeActionMove*>(pAct)->GetFromRange().MakeRange(), this );
- pReject->SetRejectAction( pAct->GetActionNumber() );
- pReject->SetState( SC_CAS_ACCEPTED );
- Append( pReject );
+ bRejected = pAct->Reject( pDoc );
+ if ( bRejected )
+ {
+ ScChangeActionMove* pReject = new ScChangeActionMove(
+ pAct->GetBigRange().MakeRange(),
+ static_cast<ScChangeActionMove*>(pAct)->GetFromRange().MakeRange(), this );
+ pReject->SetRejectAction( pAct->GetActionNumber() );
+ pReject->SetState( SC_CAS_ACCEPTED );
+ Append( pReject );
+ }
}
}
else if ( pAct->GetType() == SC_CAT_CONTENT )
@@ -4376,7 +4381,8 @@ bool ScChangeTrack::Reject(
aCell.assign(*pDoc, aRange.aStart);
pReject->SetOldValue(aCell, pDoc, pDoc);
}
- if ( (bRejected = pAct->Reject( pDoc )) && !bRecursion )
+ bRejected = pAct->Reject( pDoc );
+ if ( bRejected && !bRecursion )
{
ScCellValue aCell;
aCell.assign(*pDoc, aRange.aStart);
diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx
index 550c9ed71f86..153ee4f2612c 100644
--- a/sc/source/filter/excel/xeview.cxx
+++ b/sc/source/filter/excel/xeview.cxx
@@ -209,8 +209,11 @@ XclExpSelection::XclExpSelection( const XclTabViewData& rData, sal_uInt8 nPane )
XclRangeList& rXclSel = maSelData.maXclSelection;
bool bFound = false;
for( XclRangeVector::const_iterator aIt = rXclSel.begin(), aEnd = rXclSel.end(); !bFound && (aIt != aEnd); ++aIt )
- if( (bFound = aIt->Contains( maSelData.maXclCursor )) )
+ {
+ bFound = aIt->Contains( maSelData.maXclCursor );
+ if( bFound )
maSelData.mnCursorIdx = static_cast< sal_uInt16 >( aIt - rXclSel.begin() );
+ }
/* Cursor cell not found in list? (e.g. inactive pane, or removed in
ConvertRangeList(), because Calc cursor on invalid pos)
-> insert the valid Excel cursor. */
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 22f07c471680..408ae020ccd3 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -293,7 +293,8 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
// skip rows that are not selected
if ( !bDoSelection )
{
- if ( !(bEnd = !xRowSet->next()) )
+ bEnd = !xRowSet->next();
+ if ( !bEnd )
++nRowsRead;
}
else
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx
index 1165a857cbe5..b0561f271280 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -644,7 +644,8 @@ static bool lcl_CheckOne_OOO( const OUString& rStr, bool bIsRow, SCCOLROW& rVal
{
sal_Int32 n = aStr.toInt32();
- if ( ( bStrOk = (n > 0) && ( n <= MAXROWCOUNT ) ) )
+ bStrOk = (n > 0) && ( n <= MAXROWCOUNT );
+ if ( bStrOk )
nNum = static_cast<SCCOLROW>(n - 1);
}
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7b61def5cb14..ca17d5950101 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -723,13 +723,11 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy
{
SolarMutexGuard aGuard;
- ScEditShell* pShell;
- ScDrawShell* pDrawShell;
TransferableDataHelper aDataHelper;
ScViewData* pViewData = ScDocShell::GetViewData();
uno::Reference<datatransfer::XTransferable> xTransferable;
- if (( pShell = dynamic_cast<ScEditShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) )) )
+ if ( ScEditShell * pShell = dynamic_cast<ScEditShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ) )
xTransferable = pShell->GetEditView()->GetTransferable();
else if ( nullptr != dynamic_cast<ScDrawTextObjectBar*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ))
{
@@ -738,7 +736,7 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy
if (pOutView)
xTransferable = pOutView->GetEditView().GetTransferable();
}
- else if (( pDrawShell = dynamic_cast<ScDrawShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) )) )
+ else if ( ScDrawShell * pDrawShell = dynamic_cast<ScDrawShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ) )
xTransferable = pDrawShell->GetDrawView()->CopyToTransferable();
else
{
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index ee8f6f7e854a..b790b7d16008 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -314,7 +314,8 @@ static bool lcl_GetAutoSumForColumnRange( ScDocument* pDoc, ScRangeList& rRangeL
{
rRangeList.Append( ScRange( nCol, nStartRow, nTab, nCol, nEndRow, nTab ) );
nEndRow = static_cast< SCROW >( nExtend );
- if ( ( bContinue = lcl_FindNextSumEntryInColumn( pDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, aStart.Row() ) ) )
+ bContinue = lcl_FindNextSumEntryInColumn( pDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, aStart.Row() );
+ if ( bContinue )
{
nStartRow = nEndRow;
}
@@ -356,7 +357,8 @@ static bool lcl_GetAutoSumForRowRange( ScDocument* pDoc, ScRangeList& rRangeList
{
rRangeList.Append( ScRange( nStartCol, nRow, nTab, nEndCol, nRow, nTab ) );
nEndCol = static_cast< SCCOL >( nExtend );
- if ( ( bContinue = lcl_FindNextSumEntryInRow( pDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, aStart.Col() ) ) )
+ bContinue = lcl_FindNextSumEntryInRow( pDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, aStart.Col() );
+ if ( bContinue )
{
nStartCol = nEndCol;
}
@@ -459,7 +461,8 @@ bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
if ( bRow )
{
nEndRow = static_cast< SCROW >( nExtend );
- if ( ( bContinue = lcl_FindNextSumEntryInColumn( pDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, 0 ) ) )
+ bContinue = lcl_FindNextSumEntryInColumn( pDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, 0 );
+ if ( bContinue )
{
nStartRow = nEndRow;
}
@@ -467,7 +470,8 @@ bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
else
{
nEndCol = static_cast< SCCOL >( nExtend );
- if ( ( bContinue = lcl_FindNextSumEntryInRow( pDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, 0 ) ) )
+ bContinue = lcl_FindNextSumEntryInRow( pDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, 0 );
+ if ( bContinue )
{
nStartCol = nEndCol;
}