[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Mar 1 09:58:26 PST 2012
sc/source/core/data/documen2.cxx | 79 ---------------------------------------
1 file changed, 79 deletions(-)
New commits:
commit fcc9e377ad525a919ab13e7b0424a6c6d5673878
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Mar 1 12:36:10 2012 +0100
don't try to update the range names twice
the update process is now done in cell.cxx:adjustRangeNames
Signed-off-by: Kohei Yoshida <kohei.yoshida at suse.com>
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index b0ae78e..567135d 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -994,80 +994,6 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
if ( !bResultsOnly )
{
- bool bNamesLost = false;
- // array containing range names which might need update of indices.
- // The instances inserted into this vector are managed by the
- // range name container of this document, so no need to delete
- // them afterward.
- ::std::vector<ScRangeData*> aSrcRangeNames;
-
- // the index mapping thereof
- ScRangeData::IndexMap aSrcRangeMap;
- bool bRangeNameReplace = false;
-
- // find named ranges that are used in the source sheet
- std::set<sal_uInt16> aUsedNames;
- pSrcDoc->maTabs[nSrcPos]->FindRangeNamesInUse( 0, 0, MAXCOL, MAXROW, aUsedNames );
-
- if (pSrcDoc->pRangeName)
- {
- ScRangeName::const_iterator itr = pSrcDoc->pRangeName->begin(), itrEnd = pSrcDoc->pRangeName->end();
- for (; itr != itrEnd; ++itr) //! DB-Bereiche Pivot-Bereiche auch !!!
- {
- sal_uInt16 nOldIndex = itr->second->GetIndex();
- bool bInUse = ( aUsedNames.find(nOldIndex) != aUsedNames.end() );
- if (bInUse)
- {
- const ScRangeData* pExistingData = GetRangeName()->findByUpperName(itr->second->GetUpperName());
- if (pExistingData)
- {
- // the name exists already in the destination document
- // -> use the existing name, but show a warning
- // (when refreshing links, the existing name is used and the warning not shown)
-
- sal_uInt16 nExistingIndex = pExistingData->GetIndex();
-
- // don't modify the named range
- aSrcRangeMap.insert(
- ScRangeData::IndexMap::value_type(nOldIndex, nExistingIndex));
- bRangeNameReplace = true;
- bNamesLost = true;
- }
- else
- {
- ScRangeData* pData = new ScRangeData( *itr->second );
- pData->SetDocument(this);
- if ( pRangeName->findByIndex( pData->GetIndex() ) )
- pData->SetIndex(0); // need new index, done in Insert
- if (!pRangeName->insert(pData))
- {
- OSL_FAIL("can't insert name"); // shouldn't happen
- pData = NULL;
- }
- else
- {
- pData->TransferTabRef( nSrcPos, nDestPos );
- aSrcRangeNames.push_back(pData);
- sal_uInt16 nNewIndex = pData->GetIndex();
- aSrcRangeMap.insert(
- ScRangeData::IndexMap::value_type(nOldIndex, nNewIndex));
- if ( !bRangeNameReplace )
- bRangeNameReplace = ( nOldIndex != nNewIndex );
- }
- }
- }
- }
- }
- if ( bRangeNameReplace )
- {
- // first update all inserted named formulas if they contain other
- // range names and used indices changed
- for (size_t i = 0, n = aSrcRangeNames.size(); i < n; ++i) //! DB-Bereiche Pivot-Bereiche auch
- aSrcRangeNames[i]->ReplaceRangeNamesInUse( aSrcRangeMap );
-
- // then update the formulas, they might need the just updated range names
- maTabs[nDestPos]->ReplaceRangeNamesInUse( 0, 0, MAXCOL, MAXROW, aSrcRangeMap );
- }
SCsTAB nDz = ((SCsTAB)nDestPos) - (SCsTAB)nSrcPos;
maTabs[nDestPos]->UpdateReference(URM_COPY, 0, 0, nDestPos,
@@ -1075,11 +1001,6 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
0, 0, nDz, NULL);
// Readjust self-contained absolute references to this sheet
maTabs[nDestPos]->TestTabRefAbs(nSrcPos);
- if (bNamesLost)
- {
- nRetVal += 2;
- // message: duplicate names
- }
maTabs[nDestPos]->CompileAll();
}
More information about the Libreoffice-commits
mailing list