[Libreoffice-commits] .: Branch 'feature/unlimited-number-of-sheets' - sc/inc sc/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Mon Jun 6 13:37:05 PDT 2011
sc/inc/document.hxx | 2 +-
sc/inc/table.hxx | 2 +-
sc/source/core/data/documen2.cxx | 15 ++++++---------
sc/source/core/data/markdata.cxx | 2 +-
sc/source/core/data/table1.cxx | 5 +++--
sc/source/ui/docshell/docsh5.cxx | 9 ++++++++-
sc/source/ui/undo/undotab.cxx | 17 +++++++++++++----
7 files changed, 33 insertions(+), 19 deletions(-)
New commits:
commit f5bbfc04b64d61b773d8ccfa22d260024db17436
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Jun 6 22:35:01 2011 +0200
move ScProgress out of ScDocument::MoveTab
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c3d7e2d..f8a18a6 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -584,7 +584,7 @@ public:
SC_DLLPUBLIC sal_Bool RenameTab( SCTAB nTab, const String& rName,
sal_Bool bUpdateRef = sal_True,
sal_Bool bExternalDocument = false );
- sal_Bool MoveTab( SCTAB nOldPos, SCTAB nNewPos );
+ sal_Bool MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress = NULL );
sal_Bool CopyTab( SCTAB nOldPos, SCTAB nNewPos,
const ScMarkData* pOnlyMarked = NULL );
SC_DLLPUBLIC sal_uLong TransferTab(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos,
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index ea60345..6d02ad5 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -478,7 +478,7 @@ public:
void UpdateInsertTab(SCTAB nTable, SCTAB nNewSheets = 1);
void UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScTable* pRefUndo = NULL, SCTAB nSheets = 1 );
- void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress& );
+ void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress* pProgress );
void UpdateCompile( sal_Bool bForceIfNameInUse = false );
void SetTabNo(SCTAB nNewTab);
sal_Bool IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 7378d2f..c1252ba 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -729,23 +729,21 @@ sal_Bool ScDocument::GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRo
return false;
}
-sal_Bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos )
+sal_Bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress )
{
if (nOldPos == nNewPos) return false;
sal_Bool bValid = false;
- if (VALIDTAB(nOldPos) && nOldPos < static_cast<SCTAB>(pTab.size()))
+ SCTAB nTabCount = static_cast<SCTAB>(pTab.size());
+ if (VALIDTAB(nOldPos) && nOldPos < nTabCount )
{
if (pTab[nOldPos])
{
- SCTAB nTabCount = static_cast<SCTAB>(pTab.size());
if (nTabCount > 1)
{
sal_Bool bOldAutoCalc = GetAutoCalc();
SetAutoCalc( false ); // Mehrfachberechnungen vermeiden
SetNoListening( sal_True );
- ScProgress* pProgress = new ScProgress( GetDocumentShell(),
- ScGlobal::GetRscString(STR_UNDO_MOVE_TAB), GetCodeCount() );
- if (nNewPos == SC_TAB_APPEND || nNewPos >= static_cast<SCTAB>(pTab.size()))
+ if (nNewPos == SC_TAB_APPEND || nNewPos >= nTabCount)
nNewPos = nTabCount-1;
// Referenz-Updaterei
@@ -777,10 +775,9 @@ sal_Bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos )
pTab.erase(pTab.begin()+nOldPos);
pTab.insert(pTab.begin()+nNewPos, pSaveTab);
TableContainer::iterator it = pTab.begin();
- for (SCTAB i = 0; i < static_cast<SCTAB>(pTab.size()); i++)
+ for (SCTAB i = 0; i < nTabCount; i++)
if (pTab[i])
- pTab[i]->UpdateMoveTab( nOldPos, nNewPos, i, *pProgress );
- delete pProgress; // freimachen fuer evtl. andere
+ pTab[i]->UpdateMoveTab( nOldPos, nNewPos, i, pProgress );
it = pTab.begin();
for (; it != pTab.end(); ++it)
if (*it)
diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx
index edd5a6d..81a4115 100644
--- a/sc/source/core/data/markdata.cxx
+++ b/sc/source/core/data/markdata.cxx
@@ -414,7 +414,7 @@ void ScMarkData::FillRangeListWithMarks( ScRangeList* pList, sal_Bool bClear ) c
pList->Append( aMarkRange );
}
-void ScMarkData::ExtendRangeListTables( ScRangeList* pList ) const//TODO:FIXME
+void ScMarkData::ExtendRangeListTables( ScRangeList* pList ) const
{
if (!pList)
return;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 1fb4447..e92a626 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1424,13 +1424,14 @@ void ScTable::UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScTable* pRefUndo
}
void ScTable::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo,
- ScProgress& rProgress )
+ ScProgress* pProgress )
{
nTab = nTabNo;
for ( SCCOL i=0; i <= MAXCOL; i++ )
{
aCol[i].UpdateMoveTab( nOldPos, nNewPos, nTabNo );
- rProgress.SetState( rProgress.GetState() + aCol[i].GetCodeCount() );
+ if (pProgress)
+ pProgress->SetState(pProgress->GetState() + aCol[i].GetCodeCount());
}
if (IsStreamValid())
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index da2bf45..4bc5ba6 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -59,6 +59,7 @@
#include "dbdocfun.hxx"
#include "consoli.hxx"
#include "dbdata.hxx"
+#include "progress.hxx"
#include "olinetab.hxx"
#include "patattr.hxx"
#include "attrib.hxx"
@@ -973,8 +974,14 @@ sal_Bool ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, sal_Bool bCopy, s
return sal_True; // nothing to do, but valid
}
- if (!aDocument.MoveTab( nSrcTab, nDestTab ))
+ ScProgress* pProgress = new ScProgress(this, ScGlobal::GetRscString(STR_UNDO_MOVE_TAB),
+ aDocument.GetCodeCount());
+ bool bDone = aDocument.MoveTab( nSrcTab, nDestTab, pProgress );
+ delete pProgress;
+ if (!bDone)
+ {
return false;
+ }
else if (bRecord)
{
auto_ptr< vector<SCTAB> > pSrcList(new vector<SCTAB>(1, nSrcTab));
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 3e110fb..144640a 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -49,6 +49,7 @@
#include "chgtrack.hxx"
#include "tabprotection.hxx"
#include "viewdata.hxx"
+#include "progress.hxx"
// for ScUndoRenameObject - might me moved to another file later
#include <svx/svditer.hxx>
@@ -553,14 +554,17 @@ void ScUndoMoveTab::DoChange( sal_Bool bUndo ) const
if (bUndo) // UnDo
{
- for (size_t i = mpNewTabs->size(); i > 0; --i)
+ size_t i = mpNewTabs->size();
+ ScProgress* pProgress = new ScProgress(pDocShell , ScGlobal::GetRscString(STR_UNDO_MOVE_TAB),
+ i * pDoc->GetCodeCount());
+ for (; i > 0; --i)
{
SCTAB nDestTab = (*mpNewTabs)[i-1];
SCTAB nOldTab = (*mpOldTabs)[i-1];
if (nDestTab > MAXTAB) // angehaengt ?
nDestTab = pDoc->GetTableCount() - 1;
- pDoc->MoveTab( nDestTab, nOldTab );
+ pDoc->MoveTab( nDestTab, nOldTab, pProgress );
pViewShell->GetViewData()->MoveTab( nDestTab, nOldTab );
pViewShell->SetTabNo( nOldTab, true );
if (mpOldNames)
@@ -569,10 +573,14 @@ void ScUndoMoveTab::DoChange( sal_Bool bUndo ) const
pDoc->RenameTab(nOldTab, rOldName);
}
}
+ delete pProgress;
}
else
{
- for (size_t i = 0, n = mpNewTabs->size(); i < n; ++i)
+ size_t n = mpNewTabs->size();
+ ScProgress* pProgress = new ScProgress(pDocShell , ScGlobal::GetRscString(STR_UNDO_MOVE_TAB),
+ n * pDoc->GetCodeCount());
+ for (size_t i = 0; i < n; ++i)
{
SCTAB nDestTab = (*mpNewTabs)[i];
SCTAB nNewTab = nDestTab;
@@ -580,7 +588,7 @@ void ScUndoMoveTab::DoChange( sal_Bool bUndo ) const
if (nDestTab > MAXTAB) // angehaengt ?
nDestTab = pDoc->GetTableCount() - 1;
- pDoc->MoveTab( nOldTab, nNewTab );
+ pDoc->MoveTab( nOldTab, nNewTab, pProgress );
pViewShell->GetViewData()->MoveTab( nOldTab, nNewTab );
pViewShell->SetTabNo( nDestTab, true );
if (mpNewNames)
@@ -589,6 +597,7 @@ void ScUndoMoveTab::DoChange( sal_Bool bUndo ) const
pDoc->RenameTab(nNewTab, rNewName);
}
}
+ delete pProgress;
}
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); // Navigator
More information about the Libreoffice-commits
mailing list