summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-12-20 23:55:43 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-12-21 01:50:17 +0100
commit64e416d42af6e315bd9e06ab638294a906cae219 (patch)
tree5a08d0efd522669f01a18725c9b196e5bf31b2fa
parent5e3059834e30276e520b8e0f701351d51af5c604 (diff)
fix small problem with range names in copy/paste
-rw-r--r--sc/qa/unit/ucalc.cxx4
-rw-r--r--sc/source/core/data/cell.cxx6
2 files changed, 7 insertions, 3 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index c3d47ef9914c..f98195da9378 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -184,7 +184,7 @@ public:
CPPUNIT_TEST(testFunctionLists);
CPPUNIT_TEST(testToggleRefFlag);
CPPUNIT_TEST(testAutofilter);
- //CPPUNIT_TEST(testCopyPaste);
+ CPPUNIT_TEST(testCopyPaste);
CPPUNIT_TEST(testMergedCells);
CPPUNIT_TEST(testUpdateReference);
CPPUNIT_TEST_SUITE_END();
@@ -2738,8 +2738,8 @@ void Test::testCopyPaste()
//check values after copying
rtl::OUString aString;
m_pDoc->GetValue(1,1,1, aValue);
- CPPUNIT_ASSERT_MESSAGE("copied formula should return 2", aValue == 2);
m_pDoc->GetFormula(1,1,1, aString);
+ CPPUNIT_ASSERT_MESSAGE("copied formula should return 2", aValue == 2);
CPPUNIT_ASSERT_MESSAGE("formula string was not copied correctly", aString == aFormulaString);
m_pDoc->GetValue(0,1,1, aValue);
CPPUNIT_ASSERT_MESSAGE("copied value should be 1", aValue == 1);
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index a5d6df44b720..f7ea541435fd 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -180,7 +180,11 @@ void adjustRangeName(ScToken* pToken, ScDocument& rNewDoc, const ScDocument* pOl
bNewGlobal = bOldGlobal;
pRangeData = new ScRangeData(*pOldRangeData, &rNewDoc);
ScTokenArray* pRangeNameToken = pRangeData->GetCode();
- pRangeNameToken->ReadjusteAbsolute3DReferences(pOldDoc, &rNewDoc, pRangeData->GetPos(), true);
+ if (rNewDoc.GetPool() != const_cast<ScDocument*>(pOldDoc)->GetPool())
+ {
+ pRangeNameToken->ReadjusteAbsolute3DReferences(pOldDoc, &rNewDoc, pRangeData->GetPos(), true);
+ }
+
bool bInserted;
if (bNewGlobal)
bInserted = rNewDoc.GetRangeName()->insert(pRangeData);