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-15 11:49:35.140625000 +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(), @@ -481,6 +481,8 @@ pDoc->RemoveFlagsTab( aOutRange.aStart.Col(), aOutRange.aStart.Row(), aOutRange.aEnd.Col(), aOutRange.aEnd.Row(), aOutRange.aStart.Tab(), SC_MF_AUTO ); + if( pOutput ) + pOutput->SetPosition( rPos ); CreateOutput(); // create xSource and pOutput if not already done 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-15 11:50:03.234375000 +0800 @@ -58,6 +58,7 @@ #include "editable.hxx" #include "attrib.hxx" #include "drwlayer.hxx" +#include "dpshttab.hxx" // ----------------------------------------------------------------- @@ -1299,6 +1300,20 @@ 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()-1 ); + aNewOut.aEnd.SetRow( aNewOut.aEnd.Row()+nDiff-1 ); + } + } + if ( bOverflow ) { // like with STR_PROTECTIONERR, use undo to reverse everything @@ -1354,9 +1369,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;