tdf#43175: Adapt ranges when copying or moving several sheets

When copying several sheets at once using the "Move or copy sheets..."
feature, the ranges were not updated, in charts for example. Same when
moving a sheet and choosing a new name at the same time.

Change-Id: I0d05f2d123dfe1174ba126d7f73845988ec1e983
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108739
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 1122264..814e3a0 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -3084,6 +3084,10 @@
                    nDestTab1=nTabCount;
                }
            }
            //If sheets are copied or renamed when moved, the references to the data inside the sheets have to be adapted
            if (bCopy || bRename)
                ScChartHelper::AdjustRangesOfChartsOnDestinationPage(rDoc, rDestDoc, nMovTab,
                                                                     nDestTab1);

            pDestTabs->push_back(nDestTab1);
        }
@@ -3133,9 +3137,6 @@

        SetTabNo( nNewTab, true );

        //#i29848# adjust references to data on the copied sheet
        if( bCopy )
            ScChartHelper::AdjustRangesOfChartsOnDestinationPage( rDoc, rDestDoc, nTab, nNewTab );
    }
}