diff -uNr old/sc/inc/dpobject.hxx new/sc/inc/dpobject.hxx --- old/sc/inc/dpobject.hxx 2009-03-12 18:53:01.656250000 +0800 +++ new/sc/inc/dpobject.hxx 2009-05-15 11:49:07.734375000 +0800 @@ -127,7 +127,8 @@ void InvalidateData(); void InvalidateSource(); - void Output(); + + void Output( const ScAddress& rPos ); ScRange GetNewOutputRange( BOOL& rOverflow ); const ScRange GetOutputRangeByType( sal_Int32 nType ); diff -uNr old/sc/source/core/data/dpobject.cxx new/sc/source/core/data/dpobject.cxx --- old/sc/source/core/data/dpobject.cxx 2009-03-12 18:44:55.671875000 +0800 +++ new/sc/source/core/data/dpobject.cxx 2009-05-20 17:17:49.609375000 +0800 @@ -472,7 +472,7 @@ } } -void ScDPObject::Output() +void ScDPObject::Output( const ScAddress& rPos ) { // clear old output area pDoc->DeleteAreaTab( aOutRange.aStart.Col(), aOutRange.aStart.Row(), @@ -484,6 +484,9 @@ CreateOutput(); // create xSource and pOutput if not already done + if( pOutput ) + pOutput->SetPosition( rPos ); + pOutput->Output(); // aOutRange is always the range that was last output to the document diff -uNr old/sc/source/ui/docshell/dbdocfun.cxx new/sc/source/ui/docshell/dbdocfun.cxx --- old/sc/source/ui/docshell/dbdocfun.cxx 2009-04-29 15:36:12.468750000 +0800 +++ new/sc/source/ui/docshell/dbdocfun.cxx 2009-05-20 17:18:20.265625000 +0800 @@ -58,6 +58,7 @@ #include "editable.hxx" #include "attrib.hxx" #include "drwlayer.hxx" +#include "dpshttab.hxx" // ----------------------------------------------------------------- @@ -1299,6 +1300,22 @@ BOOL bOverflow = FALSE; ScRange aNewOut = pDestObj->GetNewOutputRange( bOverflow ); + + //! test for overlap with other data pilot tables + if( pOldObj ) + { + const ScSheetSourceDesc* pSheetDesc = pOldObj->GetSheetDesc(); + if( pSheetDesc && pSheetDesc->aSourceRange.Intersects( aNewOut ) ) + { + ScRange aOldRange = pOldObj->GetOutRange(); + USHORT nDiff = aOldRange.aStart.Row()-aNewOut.aStart.Row(); + aNewOut.aStart.SetRow( aOldRange.aStart.Row() ); + aNewOut.aEnd.SetRow( aNewOut.aEnd.Row()+nDiff ); + if( !ValidRow( aNewOut.aStart.Row() ) || !ValidRow( aNewOut.aEnd.Row() ) ) + bOverflow = TRUE; + } + } + if ( bOverflow ) { // like with STR_PROTECTIONERR, use undo to reverse everything @@ -1354,9 +1371,7 @@ pDoc->CopyToDocument( aNewOut, IDF_ALL, FALSE, pNewUndoDoc ); } - //! test for overlap with other data pilot tables - - pDestObj->Output(); + pDestObj->Output( aNewOut.aStart ); rDocShell.PostPaintGridAll(); //! only necessary parts bDone = TRUE;