diff -urp sc-ori/source/core/data/column.cxx sc-new/source/core/data/column.cxx --- sc-ori/source/core/data/column.cxx 2008-05-08 16:42:44.000000000 +0800 +++ sc-new/source/core/data/column.cxx 2008-05-08 16:45:18.000000000 +0800 @@ -906,10 +906,44 @@ void ScColumn::SwapRow(SCROW nRow1, SCRO else pBC2 = NULL; + ScPostIt aCellNote1(pDocument); + ScPostIt aCellNote2(pDocument); + if ( pCell1 && pCell2 ) { pItems[nIndex1].pCell = pCell2; pItems[nIndex2].pCell = pCell1; + + if(pCell1 && pCell1->GetNote(aCellNote1)) + { + const Rectangle Rectangle1 = aCellNote1.GetRectangle(); + Size aSizeEdit1 = Rectangle1.GetSize(); + + Rectangle aRectEdit1 = aCellNote1.DefaultRectangle(ScAddress(nCol,nRow2,nTab)); + long nCoordX1 = aRectEdit1.getX(); + long nCoordY1 = aRectEdit1.getY(); + Rectangle aNewRect1(Point(nCoordX1, nCoordY1),aSizeEdit1); + aCellNote1.SetRectangle(aNewRect1); + + pCell1->SetNote(aCellNote1); + + } + if(pCell2 && pCell2->GetNote( aCellNote2 )) + { + const Rectangle Rectangle2 = aCellNote2.GetRectangle(); + Size aSizeEdit2 = Rectangle2.GetSize(); + + Rectangle aRectEdit2 = aCellNote2.DefaultRectangle(ScAddress(nCol,nRow1,nTab)); + long nCoordX2 = aRectEdit2.getX(); + long nCoordY2 = aRectEdit2.getY(); + + Rectangle aNewRect2(Point(nCoordX2, nCoordY2),aSizeEdit2); + aCellNote2.SetRectangle(aNewRect2); + + pCell2->SetNote(aCellNote2); + + } + if ( pBC1 ) pCell2->SetBroadcaster( pBC1 ); if ( pBC2 ) @@ -963,17 +997,34 @@ void ScColumn::SwapRow(SCROW nRow1, SCRO } ScPostIt aCellNote(pDocument); //Hide the visible note if doing a swap. - if(pCell1 && pCell1->GetNote(aCellNote) && aCellNote.IsShown())//20080430 - { - ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow1 ); - aCellNote.SetShown(FALSE); - pCell1->SetNote(aCellNote); - } - if(pCell2 && pCell2->GetNote(aCellNote) && aCellNote.IsShown()) - { - ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow2 ); - aCellNote.SetShown(FALSE); - pCell2->SetNote(aCellNote); + //if(pCell1 && pCell1->GetNote(aCellNote) && aCellNote.IsShown())//20080430 + //{ + // ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow1 ); + // aCellNote.SetShown(FALSE); + // pCell1->SetNote(aCellNote); + //} + //if(pCell2 && pCell2->GetNote(aCellNote) && aCellNote.IsShown()) + //{ + // ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow2 ); + // aCellNote.SetShown(FALSE); + // pCell2->SetNote(aCellNote); + //} + + if(pCell1 && pCell2->GetNote(aCellNote) && aCellNote.IsShown()) + { + ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow2 ); + ScDetectiveFunc( pDocument, nTab ).ShowComment( nCol, nRow1, FALSE ); + //aCellNote.SetShown(TRUE); + aCellNote.SetShown(TRUE); + pCell2->SetNote(aCellNote); + } + if(pCell2 && pCell1->GetNote(aCellNote) && aCellNote.IsShown()) + { + ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow1 ); + ScDetectiveFunc( pDocument, nTab ).ShowComment( nCol, nRow2, FALSE ); + //aCellNote.SetShown(TRUE); + aCellNote.SetShown(TRUE); + pCell1->SetNote(aCellNote); } return ;