sc/source/core/tool/dbdata.cxx | 65 ++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 33 deletions(-)
New commits: commit 01de8e10bfa6a99dbbfd771a626657790be8129c Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Mon Dec 20 09:48:27 2021 +0100 Commit: Samuel Mehrbrodt <[email protected]> CommitDate: Tue Dec 21 13:05:15 2021 +0100 Fix formatting (wrong indentation) Apply clang-format to this method Change-Id: I67fbdc4ca8b9c602ed85a57dbbde8ed47bdd45c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127215 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <[email protected]> diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index f5328139f3e4..8ea877502087 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -546,44 +546,43 @@ bool ScDBData::HasSubTotalParam() const void ScDBData::UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos) { - ScRange aRange; - GetArea( aRange ); - SCTAB nTab = aRange.aStart.Tab(); // a database range is only on one sheet + ScRange aRange; + GetArea(aRange); + SCTAB nTab = aRange.aStart.Tab(); // a database range is only on one sheet - // customize as the current table as ScTablesHint (tabvwsh5.cxx) + // customize as the current table as ScTablesHint (tabvwsh5.cxx) - if ( nTab == nOldPos ) // moved sheet - nTab = nNewPos; - else if ( nOldPos < nNewPos ) // moved to the back - { - if ( nTab > nOldPos && nTab <= nNewPos ) // move this sheet - --nTab; - } - else // moved to the front - { - if ( nTab >= nNewPos && nTab < nOldPos ) // move this sheet - ++nTab; - } - - bool bChanged = ( nTab != aRange.aStart.Tab() ); - if (bChanged) - { - // SetArea() invalidates column names, but it is the same column range - // just on a different sheet; remember and set new. - ::std::vector<OUString> aNames( maTableColumnNames); - bool bTableColumnNamesDirty = mbTableColumnNamesDirty; - // Same column range. - SetArea( nTab, aRange.aStart.Col(), aRange.aStart.Row(), - aRange.aEnd.Col(),aRange.aEnd.Row() ); - // Do not use SetTableColumnNames() because that resets mbTableColumnNamesDirty. - maTableColumnNames = aNames; - mbTableColumnNamesDirty = bTableColumnNamesDirty; - } + if (nTab == nOldPos) // moved sheet + nTab = nNewPos; + else if (nOldPos < nNewPos) // moved to the back + { + if (nTab > nOldPos && nTab <= nNewPos) // move this sheet + --nTab; + } + else // moved to the front + { + if (nTab >= nNewPos && nTab < nOldPos) // move this sheet + ++nTab; + } - // MoveTo() is not necessary if only the sheet changed. + bool bChanged = (nTab != aRange.aStart.Tab()); + if (bChanged) + { + // SetArea() invalidates column names, but it is the same column range + // just on a different sheet; remember and set new. + ::std::vector<OUString> aNames(maTableColumnNames); + bool bTableColumnNamesDirty = mbTableColumnNamesDirty; + // Same column range. + SetArea(nTab, aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), + aRange.aEnd.Row()); + // Do not use SetTableColumnNames() because that resets mbTableColumnNamesDirty. + maTableColumnNames = aNames; + mbTableColumnNamesDirty = bTableColumnNamesDirty; + } - SetModified(bChanged); + // MoveTo() is not necessary if only the sheet changed. + SetModified(bChanged); } bool ScDBData::UpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
