Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hello,

I would like to get this patch into 3.4. I pushed a similar patch to master(
master and 3-4 diverged in this area a bit):
http://cgit.freedesktop.org/libreoffice/calc/commit/?id=cacc32f86fa18cb8262f5597b381c099117a3344

We need to treat local range names the same way as global range names and
therefore update them during sheet operations and if ranges get updated.
Global range names are updated in the ScDocument class with the same method,
so I think this patch is very safe. The corresponding method in ScDocument
calls the method in ScTable that will call the UpdateTabRef or
UpdateReference method for ScRangeName.

Regards,
Markus
From 8e374bbcecec5085cc655ca65dacda3761b168e1 Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <markus.mohrhard@googlemail.com>
Date: Thu, 30 Jun 2011 05:44:00 +0200
Subject: [PATCH] fix for fdo#38380: update local range names

local range names must be updated like global range names
---
 sc/source/core/data/table1.cxx |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 2927aa0..b755bdf 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1303,6 +1303,12 @@ void ScTable::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, 
SCROW
         bUpdated |= aCol[i].UpdateReference(
             eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz, pUndoDoc );
 
+    if (mpRangeName)
+    {
+        ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );;
+        mpRangeName->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
+    }
+
     if ( bIncludeDraw )
         UpdateDrawRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz, 
bUpdateNoteCaptionPos );
 
@@ -1410,6 +1416,9 @@ void ScTable::UpdateInsertTab(SCTAB nTable)
     }
     for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].UpdateInsertTab(nTable);
 
+    if (mpRangeName)
+        mpRangeName->UpdateTabRef( nTable, 1);
+
     if (IsStreamValid())
         SetStreamValid(false);
 }
@@ -1429,6 +1438,11 @@ void ScTable::UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScTable* 
pRefUndo
     else
         for (i=0; i <= MAXCOL; i++) aCol[i].UpdateDeleteTab(nTable, bIsMove, NULL);
 
+    if (mpRangeName)
+    {
+        mpRangeName->UpdateTabRef( nTable, 2 );
+    }
+
     if (IsStreamValid())
         SetStreamValid(false);
 }
@@ -1443,6 +1457,9 @@ void ScTable::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo,
         rProgress.SetState( rProgress.GetState() + aCol[i].GetCodeCount() );
     }
 
+    if (mpRangeName)
+        mpRangeName->UpdateTabRef(nOldPos, 3, nNewPos);
+
     if (IsStreamValid())
         SetStreamValid(false);
    if (pDBDataNoName)
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.