[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue May 3 19:24:05 PDT 2011


 sc/inc/document.hxx               |    1 
 sc/inc/rangenam.hxx               |    3 --
 sc/inc/table.hxx                  |    1 
 sc/source/core/data/documen2.cxx  |   47 -----------------------------------
 sc/source/core/data/table4.cxx    |    6 ----
 sc/source/core/tool/rangenam.cxx  |   17 ++----------
 sc/source/ui/docshell/docfunc.cxx |    9 ++----
 sc/source/ui/inc/undoblk.hxx      |    4 ---
 sc/source/ui/undo/undoblk3.cxx    |   50 +-------------------------------------
 9 files changed, 9 insertions(+), 129 deletions(-)

New commits:
commit d9c7edd51d7858fae466853dc57eec66c740399e
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue May 3 22:20:42 2011 -0400

    fdo#36051: Eliminated the hang due to removal of autofill undo object.
    
    An artifact of the old code, which appears to do nothing meaningful
    today was performing an incredibly slow operation upon destruction of
    the autofill undo object.  Removed it, and also removed several other
    methods and data members that were used only in that removed code.

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 820dd2c..4c7202b 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1487,7 +1487,6 @@ public:
     VirtualDevice*	GetVirtualDevice_100th_mm();
     SC_DLLPUBLIC OutputDevice*	GetRefDevice();	// WYSIWYG: Printer, otherwise VirtualDevice...
 
-    void 			EraseNonUsedSharedNames(sal_uInt16 nLevel);
     sal_Bool			GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab,
                                         sal_Bool bInSel, const ScMarkData& rMark) const;
 
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index e06f208..21cf333 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -181,7 +181,6 @@ class ScRangeName
 private:
     typedef ::boost::ptr_set<ScRangeData> DataType;
     DataType maData;
-    sal_uInt16  mnSharedMaxIndex;
 
 public:
     /// Map that manages stored ScRangeName instances.
@@ -208,8 +207,6 @@ public:
     void UpdateTabRef(SCTAB nTable, sal_uInt16 nFlag, SCTAB nNewTable = 0);
     void UpdateTranspose(const ScRange& rSource, const ScAddress& rDest);
     void UpdateGrow(const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY);
-    sal_uInt16 GetSharedMaxIndex();
-    void SetSharedMaxIndex(sal_uInt16 nInd);
 
     SC_DLLPUBLIC const_iterator begin() const;
     SC_DLLPUBLIC const_iterator end() const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 27c925b..36bd138 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -173,7 +173,6 @@ private:
     ScSortParam		aSortParam;
     CollatorWrapper*	pSortCollator;
     sal_Bool			bGlobalKeepQuery;
-    sal_Bool			bSharedNameInserted;
 
     ScRangeVec      aPrintRanges;
     bool            bPrintEntireSheet;
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 5c4957d..80b0c12 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1130,53 +1130,6 @@ void ScDocument::SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const sal_uInt16
             pTab[nTab]->SetError( nCol, nRow, nError );
 }
 
-namespace {
-
-bool eraseUnusedSharedName(ScRangeName* pRangeName, ScTable* pTab[], sal_uInt16 nLevel)
-{
-    if (!pRangeName)
-        return false;
-
-    ScRangeName::iterator itr = pRangeName->begin(), itrEnd = pRangeName->end();
-    for (; itr != itrEnd; ++itr)
-    {
-        if (!itr->HasType(RT_SHARED))
-            continue;
-
-        String aName;
-        itr->GetName(aName);
-        aName.Erase(0, 6);						// !!! vgl. Table4, FillFormula !!
-        sal_uInt16 nInd = static_cast<sal_uInt16>(aName.ToInt32());
-        if (nInd > nLevel)
-            continue;
-
-        sal_uInt16 nIndex = itr->GetIndex();
-
-        bool bInUse = false;
-        for (SCTAB j = 0; !bInUse && (j <= MAXTAB); ++j)
-        {
-            if (pTab[j])
-                bInUse = pTab[j]->IsRangeNameInUse(0, 0, MAXCOL-1, MAXROW-1, nIndex);
-        }
-        if (!bInUse)
-        {
-            pRangeName->erase(itr);
-            return true;
-        }
-    }
-    return false;
-}
-
-}
-
-void ScDocument::EraseNonUsedSharedNames(sal_uInt16 nLevel)
-{
-    if (!pRangeName)
-        return;
-    while (eraseUnusedSharedName(pRangeName, pTab, nLevel))
-        ;
-}
-
 //	----------------------------------------------------------------------------
 
 void ScDocument::SetConsolidateDlgData( const ScConsolidateParam* pData )
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 4d0c5d1..4c2e15b 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1576,17 +1576,11 @@ void ScTable::Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
     ScProgress aProgress( pDocument->GetDocumentShell(),
                             ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
 
-    bSharedNameInserted = false;
-
     if (eFillCmd == FILL_AUTO)
         FillAuto(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir, aProgress);
     else
         FillSeries(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir,
                     eFillCmd, eFillDateCmd, nStepValue, nMaxValue, 0, sal_True, aProgress);
-
-    if (bSharedNameInserted)						// Wurde Shared-Name eingefuegt?
-        pDocument->GetRangeName()->SetSharedMaxIndex(
-            pDocument->GetRangeName()->GetSharedMaxIndex()+1);	// dann hochzaehlen
 }
 
 
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 01e2fbd..94d6797 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -729,11 +729,10 @@ void ScRangeName::copyLocalNames(const TabNameMap& rNames, TabNameCopyMap& rCopy
     }
 }
 
-ScRangeName::ScRangeName() :
-    mnSharedMaxIndex(0) {}
+ScRangeName::ScRangeName() {}
 
 ScRangeName::ScRangeName(const ScRangeName& r) :
-    maData(r.maData), mnSharedMaxIndex(r.mnSharedMaxIndex) {}
+    maData(r.maData) {}
 
 const ScRangeData* ScRangeName::findByRange(const ScRange& rRange) const
 {
@@ -806,16 +805,6 @@ void ScRangeName::UpdateGrow(const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY)
         itr->UpdateGrow(rArea, nGrowX, nGrowY);
 }
 
-sal_uInt16 ScRangeName::GetSharedMaxIndex()
-{
-    return mnSharedMaxIndex;
-}
-
-void ScRangeName::SetSharedMaxIndex(sal_uInt16 nInd)
-{
-    mnSharedMaxIndex = nInd;
-}
-
 ScRangeName::const_iterator ScRangeName::begin() const
 {
     return maData.begin();
@@ -886,7 +875,7 @@ void ScRangeName::clear()
 
 bool ScRangeName::operator== (const ScRangeName& r) const
 {
-    return maData == r.maData && mnSharedMaxIndex == r.mnSharedMaxIndex;
+    return maData == r.maData;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 30551cf..a0e5355 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -4023,8 +4023,7 @@ sal_Bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMar
         {
             rDocShell.GetUndoManager()->AddUndoAction(
                 new ScUndoAutoFill( &rDocShell, aDestArea, aSourceArea, pUndoDoc, aMark,
-                                    eDir, FILL_SIMPLE, FILL_DAY, MAXDOUBLE, 1.0, 1e307,
-                                    pDoc->GetRangeName()->GetSharedMaxIndex()+1 ) );
+                                    eDir, FILL_SIMPLE, FILL_DAY, MAXDOUBLE, 1.0, 1e307) );
         }
 
         rDocShell.PostPaintGridAll();
@@ -4143,8 +4142,7 @@ sal_Bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMar
         {
             rDocShell.GetUndoManager()->AddUndoAction(
                 new ScUndoAutoFill( &rDocShell, aDestArea, aSourceArea, pUndoDoc, aMark,
-                                    eDir, eCmd, eDateCmd, fStart, fStep, fMax,
-                                    pDoc->GetRangeName()->GetSharedMaxIndex()+1 ) );
+                                    eDir, eCmd, eDateCmd, fStart, fStep, fMax) );
         }
 
         bSuccess = sal_True;
@@ -4271,8 +4269,7 @@ sal_Bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillD
     {
         rDocShell.GetUndoManager()->AddUndoAction(
             new ScUndoAutoFill( &rDocShell, aDestArea, aSourceArea, pUndoDoc, aMark,
-                                eDir, eCmd, eDateCmd, MAXDOUBLE, fStep, fMax,
-                                pDoc->GetRangeName()->GetSharedMaxIndex()+1 ) );
+                                eDir, eCmd, eDateCmd, MAXDOUBLE, fStep, fMax) );
     }
 
     rDocShell.PostPaintGridAll();
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index d1e484d..42293d4 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -421,8 +421,7 @@ public:
                                     ScDocument* pNewUndoDoc, const ScMarkData& rMark,
                                     FillDir eNewFillDir,
                                     FillCmd eNewFillCmd, FillDateCmd eNewFillDateCmd,
-                                    double fNewStartValue, double fNewStepValue, double fNewMaxValue,
-                                    sal_uInt16 nMaxShIndex );
+                                    double fNewStartValue, double fNewStepValue, double fNewMaxValue );
     virtual 		~ScUndoAutoFill();
 
     virtual void	Undo();
@@ -444,7 +443,6 @@ private:
     double			fMaxValue;
     sal_uLong			nStartChangeAction;
     sal_uLong			nEndChangeAction;
-    sal_uInt16			nMaxSharedIndex;
 
     void			SetChangeTrack();
 };
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index b8cfabe..33caf97 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -602,8 +602,7 @@ ScUndoAutoFill::ScUndoAutoFill( ScDocShell* pNewDocShell,
                 const ScRange& rRange, const ScRange& rSourceArea,
                 ScDocument* pNewUndoDoc, const ScMarkData& rMark,
                 FillDir eNewFillDir, FillCmd eNewFillCmd, FillDateCmd eNewFillDateCmd,
-                double fNewStartValue, double fNewStepValue, double fNewMaxValue,
-                sal_uInt16 nMaxShIndex )
+                double fNewStartValue, double fNewStepValue, double fNewMaxValue )
         //
     :	ScBlockUndo( pNewDocShell, rRange, SC_UNDO_AUTOHEIGHT ),
         //
@@ -615,8 +614,7 @@ ScUndoAutoFill::ScUndoAutoFill( ScDocShell* pNewDocShell,
         eFillDateCmd	( eNewFillDateCmd ),
         fStartValue		( fNewStartValue ),
         fStepValue		( fNewStepValue ),
-        fMaxValue		( fNewMaxValue ),
-        nMaxSharedIndex	( nMaxShIndex)
+        fMaxValue		( fNewMaxValue )
 {
     SetChangeTrack();
 }
@@ -626,7 +624,6 @@ ScUndoAutoFill::ScUndoAutoFill( ScDocShell* pNewDocShell,
 
 ScUndoAutoFill::~ScUndoAutoFill()
 {
-    pDocShell->GetDocument()->EraseNonUsedSharedNames(nMaxSharedIndex);
     delete pUndoDoc;
 }
 
@@ -649,26 +646,6 @@ void ScUndoAutoFill::SetChangeTrack()
         nStartChangeAction = nEndChangeAction = 0;
 }
 
-namespace {
-
-bool eraseNameContaining(ScRangeName& rNames, const rtl::OUString& rCriteria)
-{
-    ScRangeName::iterator itr = rNames.begin(), itrEnd = rNames.end();
-    for (; itr != itrEnd; ++itr)
-    {
-        rtl::OUString aRName = itr->GetName();
-        if (aRName.indexOf(rCriteria) >= 0)
-        {
-            // Criteria found.  Erase this.
-            rNames.erase(itr);
-            return true;
-        }
-    }
-    return false;
-}
-
-}
-
 void ScUndoAutoFill::Undo()
 {
     BeginUndo();
@@ -698,29 +675,6 @@ void ScUndoAutoFill::Undo()
     if (pViewShell)
         pViewShell->CellContentChanged();
 
-// Shared-Names loeschen
-// Falls Undo ins Dokument gespeichert
-// => automatisches Loeschen am Ende
-// umarbeiten!!
-
-    String aName = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("___SC_"));
-    aName += String::CreateFromInt32(nMaxSharedIndex);
-    aName += '_';
-    ScRangeName* pRangeName = pDoc->GetRangeName();
-    bool bHasFound = false;
-    // Remove all range names that contain ___SC_...
-    while (true)
-    {
-        bool bErased = eraseNameContaining(*pRangeName, aName);
-        if (bErased)
-            bHasFound = true;
-        else
-            break;
-    }
-
-    if (bHasFound)
-        pRangeName->SetSharedMaxIndex(pRangeName->GetSharedMaxIndex()-1);
-
     ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
     if ( pChangeTrack )
         pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );


More information about the Libreoffice-commits mailing list