[Libreoffice-commits] .: 2 commits - sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Thu Mar 1 03:45:36 PST 2012


 sc/source/core/data/documen2.cxx |   81 ---------------------------------------
 1 file changed, 1 insertion(+), 80 deletions(-)

New commits:
commit 1b93146d442bb8396126d6106f05a5bb0ee9fffa
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

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index f082069..7cd70c8 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -991,80 +991,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,
@@ -1072,11 +998,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();
         }
 
commit e25ce6abc572046e3d6af367d9727c018ba78e65
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Mar 1 11:50:13 2012 +0100

    use correct source table

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 81031b9..f082069 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -952,7 +952,7 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
 
         // Copy the RTL settings
         maTabs[nDestPos]->SetLayoutRTL(pSrcDoc->maTabs[nSrcPos]->IsLayoutRTL());
-        maTabs[nDestPos]->SetLoadingRTL(pSrcDoc->maTabs[nDestPos]->IsLoadingRTL());
+        maTabs[nDestPos]->SetLoadingRTL(pSrcDoc->maTabs[nSrcPos]->IsLoadingRTL());
     }
     else                        // bestehende Tabelle ersetzen
     {


More information about the Libreoffice-commits mailing list