diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-29 16:12:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-30 09:59:39 +0200 |
commit | 75f398b22ae14dcf442abf6b1c92a50509565ae5 (patch) | |
tree | 3532d576d4cea3cdf420c8dfa662c876b57e1428 /sc/source/core/data/documen2.cxx | |
parent | 0c311bfbf67441823f8b3916db963e2680e9eb43 (diff) |
loplugin:flatten in sc/core/data
Change-Id: I9ffe58d68172c6fe9c76000c01c0c67a03967146
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99699
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/core/data/documen2.cxx')
-rw-r--r-- | sc/source/core/data/documen2.cxx | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index d80e15dd1c34..9b966c8d5cf5 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1273,85 +1273,85 @@ void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aT // Change-Tracking ScChangeTrack* pTrack = GetChangeTrack(); ScChangeViewSettings* pSettings = GetChangeViewSettings(); - if ( pTrack && pTrack->GetFirst() && pSettings && pSettings->ShowChanges()) + if ( !(pTrack && pTrack->GetFirst() && pSettings && pSettings->ShowChanges())) + return; + + const ScChangeAction* pFound = nullptr; + const ScChangeAction* pFoundContent = nullptr; + const ScChangeAction* pFoundMove = nullptr; + const ScChangeAction* pAction = pTrack->GetFirst(); + while (pAction) { - const ScChangeAction* pFound = nullptr; - const ScChangeAction* pFoundContent = nullptr; - const ScChangeAction* pFoundMove = nullptr; - const ScChangeAction* pAction = pTrack->GetFirst(); - while (pAction) + if ( pAction->IsVisible() && + ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) ) { - if ( pAction->IsVisible() && - ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) ) + ScChangeActionType eType = pAction->GetType(); + const ScBigRange& rBig = pAction->GetBigRange(); + if ( rBig.aStart.Tab() == aCellPos.Tab()) { - ScChangeActionType eType = pAction->GetType(); - const ScBigRange& rBig = pAction->GetBigRange(); - if ( rBig.aStart.Tab() == aCellPos.Tab()) + ScRange aRange = rBig.MakeRange(); + if ( eType == SC_CAT_DELETE_ROWS ) + aRange.aEnd.SetRow( aRange.aStart.Row() ); + else if ( eType == SC_CAT_DELETE_COLS ) + aRange.aEnd.SetCol( aRange.aStart.Col() ); + if ( aRange.In( aCellPos ) ) { - ScRange aRange = rBig.MakeRange(); - if ( eType == SC_CAT_DELETE_ROWS ) - aRange.aEnd.SetRow( aRange.aStart.Row() ); - else if ( eType == SC_CAT_DELETE_COLS ) - aRange.aEnd.SetCol( aRange.aStart.Col() ); - if ( aRange.In( aCellPos ) ) + pFound = pAction; // the last wins + switch ( eType ) { - pFound = pAction; // the last wins - switch ( eType ) - { - case SC_CAT_CONTENT : - pFoundContent = pAction; - break; - case SC_CAT_MOVE : - pFoundMove = pAction; + case SC_CAT_CONTENT : + pFoundContent = pAction; + break; + case SC_CAT_MOVE : + pFoundMove = pAction; + break; + default: break; - default: - break; - } } } - if ( eType == SC_CAT_MOVE ) - { - ScRange aRange = - static_cast<const ScChangeActionMove*>(pAction)-> - GetFromRange().MakeRange(); - if ( aRange.In( aCellPos ) ) - { - pFound = pAction; - } - } - } - pAction = pAction->GetNext(); - } - if ( pFound ) - { - if ( pFoundContent && pFound->GetType() != SC_CAT_CONTENT ) - pFound = pFoundContent; // Content wins - if ( pFoundMove && pFound->GetType() != SC_CAT_MOVE && - pFoundMove->GetActionNumber() > - pFound->GetActionNumber() ) - pFound = pFoundMove; // Move wins - // for deleted columns: arrow on left side of row - if ( pFound->GetType() == SC_CAT_DELETE_COLS ) - bLeftEdge = true; - DateTime aDT = pFound->GetDateTime(); - aTrackText = pFound->GetUser(); - aTrackText += ", "; - aTrackText += ScGlobal::getLocaleDataPtr()->getDate(aDT); - aTrackText += " "; - aTrackText += ScGlobal::getLocaleDataPtr()->getTime(aDT); - aTrackText += ":\n"; - OUString aComStr = pFound->GetComment(); - if(!aComStr.isEmpty()) - { - aTrackText += aComStr; - aTrackText += "\n( "; } - pFound->GetDescription( aTrackText, this ); - if (!aComStr.isEmpty()) + if ( eType == SC_CAT_MOVE ) { - aTrackText += ")"; + ScRange aRange = + static_cast<const ScChangeActionMove*>(pAction)-> + GetFromRange().MakeRange(); + if ( aRange.In( aCellPos ) ) + { + pFound = pAction; + } } } + pAction = pAction->GetNext(); + } + if ( !pFound ) + return; + + if ( pFoundContent && pFound->GetType() != SC_CAT_CONTENT ) + pFound = pFoundContent; // Content wins + if ( pFoundMove && pFound->GetType() != SC_CAT_MOVE && + pFoundMove->GetActionNumber() > + pFound->GetActionNumber() ) + pFound = pFoundMove; // Move wins + // for deleted columns: arrow on left side of row + if ( pFound->GetType() == SC_CAT_DELETE_COLS ) + bLeftEdge = true; + DateTime aDT = pFound->GetDateTime(); + aTrackText = pFound->GetUser(); + aTrackText += ", "; + aTrackText += ScGlobal::getLocaleDataPtr()->getDate(aDT); + aTrackText += " "; + aTrackText += ScGlobal::getLocaleDataPtr()->getTime(aDT); + aTrackText += ":\n"; + OUString aComStr = pFound->GetComment(); + if(!aComStr.isEmpty()) + { + aTrackText += aComStr; + aTrackText += "\n( "; + } + pFound->GetDescription( aTrackText, this ); + if (!aComStr.isEmpty()) + { + aTrackText += ")"; } } |