summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorNigel Hawkins <n.hawkins@gmx.com>2011-01-27 13:52:52 +0000
committerKohei Yoshida <kyoshida@novell.com>2011-01-28 09:52:12 -0500
commit911f80ca103cbdf613aeaecd2cf0b0215d588fd2 (patch)
tree5cffeab73c57d4e4fc8d640f6d288b080ce9f11a /sc/source/ui
parent0787bb32a9312755501593aadd8fa64aaf1884c3 (diff)
Replace SvShorts with std::vector
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/docshell/docfunc.cxx5
-rw-r--r--sc/source/ui/inc/undotab.hxx4
-rw-r--r--sc/source/ui/inc/viewfunc.hxx3
-rw-r--r--sc/source/ui/undo/undotab.cxx37
-rw-r--r--sc/source/ui/view/tabvwshf.cxx8
-rw-r--r--sc/source/ui/view/viewfun2.cxx35
6 files changed, 47 insertions, 45 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 7d040b269e9d..479a4d5939e7 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -105,6 +105,7 @@
#include <basic/basmgr.hxx>
#include <boost/scoped_ptr.hpp>
#include <set>
+#include <vector>
using namespace com::sun::star;
using ::com::sun::star::uno::Sequence;
@@ -2833,8 +2834,8 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab, BOOL bRecord, BOOL /* bApi */ )
{
if (bRecord)
{
- SvShorts theTabs;
- theTabs.Insert(nTab,theTabs.Count());
+ vector<SCTAB> theTabs;
+ theTabs.push_back(nTab);
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoDeleteTab( &rDocShell, theTabs, pUndoDoc, pUndoData ));
}
diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx
index c6480c90f084..204bc1c29688 100644
--- a/sc/source/ui/inc/undotab.hxx
+++ b/sc/source/ui/inc/undotab.hxx
@@ -130,7 +130,7 @@ public:
TYPEINFO();
ScUndoDeleteTab(
ScDocShell* pNewDocShell,
- const SvShorts &theTabs, //SCTAB nNewTab,
+ const std::vector<SCTAB> &theTabs, //SCTAB nNewTab,
ScDocument* pUndoDocument,
ScRefUndoData* pRefData );
virtual ~ScUndoDeleteTab();
@@ -143,7 +143,7 @@ public:
virtual String GetComment() const;
private:
- SvShorts theTabs;
+ std::vector<SCTAB> theTabs;
ULONG nStartChangeAction;
ULONG nEndChangeAction;
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 57498f346269..069d08a8f5d9 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -46,6 +46,7 @@
#endif
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/embed/Aspects.hpp>
+#include <vector>
class ScPatternAttr;
class ScAutoFormatData;
@@ -269,7 +270,7 @@ public:
BOOL AppendTable( const String& rName, BOOL bRecord = TRUE );
BOOL DeleteTable( SCTAB nTabNr, BOOL bRecord = TRUE );
- BOOL DeleteTables(const SvShorts &TheTabs, BOOL bRecord = TRUE );
+ BOOL DeleteTables(const std::vector<SCTAB>& TheTabs, BOOL bRecord = TRUE );
BOOL RenameTable( const String& rName, SCTAB nTabNr );
void MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const String* pNewTabName = NULL );
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index e51d749da84c..1b9e7fd7af12 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -57,6 +57,8 @@
#include "drwlayer.hxx"
#include "scresid.hxx"
+#include <vector>
+
extern BOOL bDrawIsInUndo; //! irgendwo als Member !!!
using namespace com::sun::star;
@@ -252,14 +254,13 @@ void ScUndoInsertTables::Undo()
pDocShell->SetInUndo( TRUE ); //! BeginUndo
bDrawIsInUndo = TRUE;
- SvShorts TheTabs;
- for(int i=0;i<pNameList->Count();i++)
+ vector<SCTAB> TheTabs;
+ for(int i=0; i<pNameList->Count(); ++i)
{
- TheTabs.Insert( sal::static_int_cast<short>(nTab+i), TheTabs.Count() );
+ TheTabs.push_back(nTab+i);
}
-
pViewShell->DeleteTables( TheTabs, FALSE );
- TheTabs.Remove(0,TheTabs.Count());
+ TheTabs.clear();
bDrawIsInUndo = FALSE;
pDocShell->SetInUndo( FALSE ); //! EndUndo
@@ -309,19 +310,17 @@ BOOL ScUndoInsertTables::CanRepeat(SfxRepeatTarget& rTarget) const
// Tabelle loeschen
//
-ScUndoDeleteTab::ScUndoDeleteTab( ScDocShell* pNewDocShell,const SvShorts &aTab, //SCTAB nNewTab,
+ScUndoDeleteTab::ScUndoDeleteTab( ScDocShell* pNewDocShell, const vector<SCTAB> &aTab, //SCTAB nNewTab,
ScDocument* pUndoDocument, ScRefUndoData* pRefData ) :
ScMoveUndo( pNewDocShell, pUndoDocument, pRefData, SC_UNDO_REFLAST )
{
- for(int i=0;i<aTab.Count();i++)
- theTabs.Insert(aTab[sal::static_int_cast<USHORT>(i)],theTabs.Count());
-
- SetChangeTrack();
+ theTabs.insert(theTabs.end(), aTab.begin(), aTab.end() );
+ SetChangeTrack();
}
ScUndoDeleteTab::~ScUndoDeleteTab()
{
- theTabs.Remove(0,theTabs.Count());
+ theTabs.clear();
}
String ScUndoDeleteTab::GetComment() const
@@ -338,10 +337,10 @@ void ScUndoDeleteTab::SetChangeTrack()
nStartChangeAction = pChangeTrack->GetActionMax() + 1;
nEndChangeAction = 0;
ScRange aRange( 0, 0, 0, MAXCOL, MAXROW, 0 );
- for ( int i = 0; i < theTabs.Count(); i++ )
+ for ( unsigned int i = 0; i < theTabs.size(); ++i )
{
- aRange.aStart.SetTab( theTabs[sal::static_int_cast<USHORT>(i)] );
- aRange.aEnd.SetTab( theTabs[sal::static_int_cast<USHORT>(i)] );
+ aRange.aStart.SetTab( theTabs[i] );
+ aRange.aEnd.SetTab( theTabs[i] );
pChangeTrack->AppendDeleteRange( aRange, pRefUndoDoc,
nTmpChangeAction, nEndChangeAction, (short) i );
}
@@ -361,15 +360,15 @@ SCTAB lcl_GetVisibleTabBefore( ScDocument& rDoc, SCTAB nTab )
void ScUndoDeleteTab::Undo()
{
BeginUndo();
- int i=0;
+ unsigned int i=0;
ScDocument* pDoc = pDocShell->GetDocument();
BOOL bLink = FALSE;
String aName;
- for(i=0;i<theTabs.Count();i++)
+ for(i=0; i<theTabs.size(); ++i)
{
- SCTAB nTab = theTabs[sal::static_int_cast<USHORT>(i)];
+ SCTAB nTab = theTabs[i];
pRefUndoDoc->GetName( nTab, aName );
bDrawIsInUndo = TRUE;
@@ -425,9 +424,9 @@ void ScUndoDeleteTab::Undo()
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
- for(i=0;i<theTabs.Count();i++)
+ for(i=0; i<theTabs.size(); ++i)
{
- pDocShell->Broadcast( ScTablesHint( SC_TAB_INSERTED, theTabs[sal::static_int_cast<USHORT>(i)]) );
+ pDocShell->Broadcast( ScTablesHint( SC_TAB_INSERTED, theTabs[i]) );
}
SfxApplication* pSfxApp = SFX_APP(); // Navigator
pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 7bfaf145c0c2..9c987f17207d 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -59,6 +59,8 @@
#include "tabbgcolor.hxx"
#include "tabbgcolordlg.hxx"
+#include <vector>
+
using ::boost::scoped_ptr;
using namespace com::sun::star;
@@ -634,12 +636,12 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
SCTAB nFirstTab=0;
BOOL bTabFlag=FALSE;
ScMarkData& rMark = pViewData->GetMarkData();
- SvShorts TheTabs;
+ std::vector<SCTAB> TheTabs;
for(SCTAB i=0;i<nTabCount;i++)
{
if(rMark.GetTableSelect(i) &&!pDoc->IsTabProtected(i))
{
- TheTabs.Insert(i,TheTabs.Count());
+ TheTabs.push_back(i);
bTabFlag=TRUE;
if(nNewTab==i) nNewTab++;
}
@@ -649,7 +651,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
pViewData->SetTabNo(nNewTab);
DeleteTables(TheTabs);
- TheTabs.Remove(0,TheTabs.Count());
+ TheTabs.clear();
rReq.Done();
}
}
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 6cc498991e36..5568c3efee0b 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2195,13 +2195,12 @@ BOOL ScViewFunc::DeleteTable( SCTAB nTab, BOOL bRecord )
return bSuccess;
}
-BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
+BOOL ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, BOOL bRecord )
{
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScDocument* pDoc = pDocSh->GetDocument();
BOOL bVbaEnabled = pDoc ? pDoc->IsInVBAMode() : FALSE;
SCTAB nNewTab = TheTabs[0];
- int i;
WaitObject aWait( GetFrameWin() );
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = FALSE;
@@ -2220,9 +2219,9 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
SCTAB nCount = pDoc->GetTableCount();
String aOldName;
- for(i=0;i<TheTabs.Count();i++)
+ for(unsigned int i=0; i<TheTabs.size(); ++i)
{
- SCTAB nTab = TheTabs[sal::static_int_cast<USHORT>(i)];
+ SCTAB nTab = TheTabs[i];
if (i==0)
pUndoDoc->InitUndo( pDoc, nTab,nTab, TRUE,TRUE ); // incl. Spalten/Zeilenflags
else
@@ -2270,11 +2269,11 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
BOOL bDelDone = FALSE;
- for(i=TheTabs.Count()-1;i>=0;i--)
+ for(int i=TheTabs.size()-1; i>=0; --i)
{
String sCodeName;
- BOOL bHasCodeName = pDoc->GetCodeName( TheTabs[sal::static_int_cast<USHORT>(i)], sCodeName );
- if (pDoc->DeleteTab( TheTabs[sal::static_int_cast<USHORT>(i)], pUndoDoc ))
+ BOOL bHasCodeName = pDoc->GetCodeName( TheTabs[i], sCodeName );
+ if (pDoc->DeleteTab( TheTabs[i], pUndoDoc ))
{
bDelDone = TRUE;
if( bVbaEnabled )
@@ -2284,7 +2283,7 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
VBA_DeleteModule( *pDocSh, sCodeName );
}
}
- pDocSh->Broadcast( ScTablesHint( SC_TAB_DELETED, TheTabs[sal::static_int_cast<USHORT>(i)] ) );
+ pDocSh->Broadcast( ScTablesHint( SC_TAB_DELETED, TheTabs[i] ) );
}
}
if (bRecord)
@@ -2615,21 +2614,21 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const
SCTAB nTabCount = pDoc->GetTableCount();
SCTAB nTabSelCount = rMark.GetSelectCount();
- SvShorts TheTabs;
+ vector<SCTAB> TheTabs;
- for(SCTAB i=0;i<nTabCount;i++)
+ for(SCTAB i=0; i<nTabCount; ++i)
{
if(rMark.GetTableSelect(i))
{
String aTabName;
pDoc->GetName( i, aTabName);
- TheTabs.Insert(i,TheTabs.Count());
+ TheTabs.push_back(i);
for(SCTAB j=i+1;j<nTabCount;j++)
{
if((!pDoc->IsVisible(j))&&(pDoc->IsScenario(j)))
{
pDoc->GetName( j, aTabName);
- TheTabs.Insert(j,TheTabs.Count());
+ TheTabs.push_back(j);
i=j;
}
else break;
@@ -2649,7 +2648,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const
if(nDestTab==SC_TAB_APPEND)
nDestTab=pDestDoc->GetTableCount();
SCTAB nDestTab1=nDestTab;
- for( USHORT j=0; j<TheTabs.Count(); j++, nDestTab1++ )
+ for( USHORT j=0; j<TheTabs.size(); ++j, ++nDestTab1 )
{ // #63304# insert sheets first and update all references
String aName;
if (bRename)
@@ -2667,9 +2666,9 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const
if ( nErrVal > 0 )
{
nDestTab1 = nDestTab;
- for(USHORT i=0;i<TheTabs.Count();i++)
+ for(USHORT i=0; i<TheTabs.size();++i)
{
- nErrVal = pDestShell->TransferTab( *pDocShell, static_cast<SCTAB>(TheTabs[i]), static_cast<SCTAB>(nDestTab1), FALSE, FALSE );
+ nErrVal = pDestShell->TransferTab( *pDocShell, TheTabs[i], static_cast<SCTAB>(nDestTab1), FALSE, FALSE );
nDestTab1++;
}
}
@@ -2679,7 +2678,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const
pDestDoc->GetName(nDestTab, sName);
pDestShell->GetUndoManager()->AddUndoAction(
new ScUndoImportTab( pDestShell, nDestTab,
- static_cast<SCTAB>(TheTabs.Count()), FALSE));
+ static_cast<SCTAB>(TheTabs.size()), FALSE));
}
else
@@ -2726,7 +2725,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const
if ( pDestDoc->IsChartListenerCollectionNeedsUpdate() )
pDestDoc->UpdateChartListenerCollection();
- pDestDoc->DeleteTab(static_cast<SCTAB>(TheTabs.Count())); // alte erste Tabelle
+ pDestDoc->DeleteTab(static_cast<SCTAB>(TheTabs.size())); // alte erste Tabelle
if (pDestViewSh)
pDestViewSh->TabChanged(); // Pages auf dem Drawing-Layer
pDestShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB,
@@ -2741,7 +2740,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const
pDestShell->PostPaintGridAll();
}
- TheTabs.Remove(0,TheTabs.Count());
+ TheTabs.clear();
pDestShell->SetDocumentModified();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );