1 diff --git sc/source/core/data/column.cxx sc/source/core/data/column.cxx
2 index 374606a..bf98488 100644
3 --- sc/source/core/data/column.cxx
4 +++ sc/source/core/data/column.cxx
5 @@ -854,6 +854,10 @@ void lclTakeBroadcaster( ScBaseCell*& rpCell, SvtBroadcaster* pBC )
7 void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
9 + // TODO: We probably don't need to broadcast value changes here since
10 + // deleting and inserting cells do it.
11 + bool bBroadcast = false;
13 /* Simple swap of cell pointers does not work if broadcasters exist (crash
14 if cell broadcasts directly or indirectly to itself). While swapping
15 the cells, broadcasters have to remain at old positions! */
16 @@ -912,10 +916,13 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
17 pCell1->TakeBroadcaster( pBC2 );
18 pCell2->TakeBroadcaster( pBC1 );
20 - ScHint aHint1( SC_HINT_DATACHANGED, aPos1, pCell2 );
21 - pDocument->Broadcast( aHint1 );
22 - ScHint aHint2( SC_HINT_DATACHANGED, aPos2, pCell1 );
23 - pDocument->Broadcast( aHint2 );
26 + ScHint aHint1( SC_HINT_DATACHANGED, aPos1, pCell2 );
27 + pDocument->Broadcast( aHint1 );
28 + ScHint aHint2( SC_HINT_DATACHANGED, aPos2, pCell1 );
29 + pDocument->Broadcast( aHint2 );
34 @@ -936,7 +943,8 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
36 // insert ColEntry at new position
37 Insert( nRow2, pCell1 );
38 - pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos1, pDummyCell ) );
40 + pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos1, pDummyCell ) );
44 @@ -1021,10 +1029,13 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
45 // #64122# Bei Formeln hinterher nochmal broadcasten, damit die Formel nicht in irgendwelchen
46 // FormulaTrack-Listen landet, ohne die Broadcaster beruecksichtigt zu haben
47 // (erst hier, wenn beide Zellen eingefuegt sind)
48 - if ( pBC1 && pFmlaCell2 )
49 - pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos1, pNew1 ) );
50 - if ( pBC2 && pFmlaCell1 )
51 - pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos2, pNew2 ) );
54 + if ( pBC1 && pFmlaCell2 )
55 + pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos1, pNew1 ) );
56 + if ( pBC2 && pFmlaCell1 )
57 + pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos2, pNew2 ) );
62 diff --git sc/source/core/data/table3.cxx sc/source/core/data/table3.cxx
63 index 95f68fc..9082beb 100644
64 --- sc/source/core/data/table3.cxx
65 +++ sc/source/core/data/table3.cxx
66 @@ -349,15 +349,11 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress& rProgress )
67 BOOL bByRow = aSortParam.bByRow;
68 SCSIZE nCount = pArray->GetCount();
69 ScSortInfo** ppInfo = pArray->GetFirstArray();
70 - // hngngn.. Win16 legacy? Table has ULONG count but can only be initialized using USHORT :-/
71 - // FIXME: use std::vector instead, would be better anyway (type safe)
72 - USHORT nArghl = (nCount > USHRT_MAX ? USHRT_MAX : static_cast<USHORT>(nCount));
73 - Table aTable( nArghl );
74 + ::std::vector<ScSortInfo*> aTable2(nCount+1);
76 for ( nPos = 0; nPos < nCount; nPos++ )
78 - aTable.Insert( ppInfo[nPos]->nOrg, (void*) ppInfo[nPos] );
80 + aTable2[ppInfo[nPos]->nOrg] = ppInfo[nPos];
82 SCCOLROW nDest = pArray->GetStart();
83 for ( nPos = 0; nPos < nCount; nPos++, nDest++ )
85 @@ -371,9 +367,9 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress& rProgress )
86 // neue Position des weggeswapten eintragen
87 ScSortInfo* p = ppInfo[nPos];
89 - p = (ScSortInfo*) aTable.Replace( nDest, (void*) p );
90 + ::std::swap(p, aTable2[nDest]);
92 - p = (ScSortInfo*) aTable.Replace( nOrg, (void*) p );
93 + ::std::swap(p, aTable2[nOrg]);
94 DBG_ASSERT( p == ppInfo[nPos], "SortReorder: nOrg MisMatch" );
96 rProgress.SetStateOnPercent( nPos );