diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-05-03 22:20:42 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-05-03 22:20:42 -0400 |
commit | 9ba100be28096667e32c81ddb17261b1074c1288 (patch) | |
tree | 8de8e9cd178ed595b2bb6678a065530cfeab5153 /sc | |
parent | Simplify the code a bit. (diff) | |
download | core-9ba100be28096667e32c81ddb17261b1074c1288.tar.gz core-9ba100be28096667e32c81ddb17261b1074c1288.zip |
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.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 1 | ||||
-rw-r--r-- | sc/inc/rangenam.hxx | 3 | ||||
-rw-r--r-- | sc/inc/table.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 47 | ||||
-rw-r--r-- | sc/source/core/data/table4.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/rangenam.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/inc/undoblk.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/undo/undoblk3.cxx | 50 |
9 files changed, 9 insertions, 129 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 19496d0f3f15..3c485fd48575 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 c9e00e64dfb1..3689634ba62d 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 26cb8a846263..cf30f6b23cd8 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 2188a458a855..756990e681bc 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 55b4da849665..edba012fadd1 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 440a9598e59e..df5f43617ae1 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 c9d600f34d9c..62ced922b01f 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 d8617490219a..16fc7591ac08 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 446e3dede1c6..45ea822f2090 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 ); |