[Libreoffice-commits] core.git: sc/source

Andreas Heinisch (via logerrit) logerrit at kemper.freedesktop.org
Sun May 9 07:52:14 UTC 2021


 sc/source/ui/view/viewfun2.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit d55bf8aab008d84fac673f3cd907f5199347ce77
Author:     Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Tue May 4 10:51:21 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun May 9 09:51:31 2021 +0200

    tdf#43175 - Adjust chart references on every copied sheet
    
    Change-Id: I92fcfeecb9aa10bf8974de953399d780ffe02176
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115058
    Tested-by: Jenkins
    Tested-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 6182277d3833..b3febf088c8d 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -3059,6 +3059,16 @@ void ScViewFunc::MoveTable(
             }
             pDocShell->MoveTable( nMovTab, nDestTab1, bCopy, false );   // Undo is here
 
+            // tdf#43175 - Adjust chart references on every copied sheet
+            if (bCopy)
+            {
+                // New position of source table after moving
+                SCTAB nSrcTab = (nDestTab1 <= nMovTab) ? nMovTab + 1 : nMovTab;
+                //#i29848# adjust references to data on the copied sheet
+                ScChartHelper::AdjustRangesOfChartsOnDestinationPage(rDoc, rDestDoc, nSrcTab,
+                                                                     nDestTab1);
+            }
+
             if(bCopy && rDoc.IsScenario(nMovTab))
             {
                 OUString aComment;
@@ -3131,10 +3141,6 @@ void ScViewFunc::MoveTable(
             nNewTab--;
 
         SetTabNo( nNewTab, true );
-
-        //#i29848# adjust references to data on the copied sheet
-        if( bCopy )
-            ScChartHelper::AdjustRangesOfChartsOnDestinationPage( rDoc, rDestDoc, nTab, nNewTab );
     }
 }
 


More information about the Libreoffice-commits mailing list