diff -x .svn -Nur original/inc/document.hxx modified/inc/document.hxx --- original/inc/document.hxx 2012-06-13 13:07:18.531250000 -0700 +++ modified/inc/document.hxx 2012-06-13 11:29:01.453125000 -0700 @@ -712,6 +712,9 @@ ScDrawLayer* GetDrawLayer() { return pDrawLayer; } SfxBroadcaster* GetDrawBroadcaster(); // zwecks Header-Vermeidung void BeginDrawUndo(); + sal_Bool IsDrawRecording() const; + void EndDrawUndo();//paired with BeginDrawUndo, clear undo object if GetUndoObj is not called. \ + Not necessary if GetUndoObj is called, but call EndDrawUndo paired with BeginDrawUndo is recommended void BeginUnoRefUndo(); bool HasUnoRefUndo() const { return ( pUnoRefUndoList != NULL ); } diff -x .svn -Nur original/source/core/data/documen9.cxx modified/source/core/data/documen9.cxx --- original/source/core/data/documen9.cxx 2012-06-13 13:07:17.250000000 -0700 +++ modified/source/core/data/documen9.cxx 2012-06-13 11:30:02.437500000 -0700 @@ -78,6 +78,17 @@ pDrawLayer->BeginCalcUndo(); } +sal_Bool ScDocument::IsDrawRecording() const +{ + return pDrawLayer ? pDrawLayer->IsRecording() : sal_False; +} + +void ScDocument::EndDrawUndo() +{ + if( pDrawLayer ) + delete pDrawLayer->GetCalcUndo(); +} + XColorTable* ScDocument::GetColorTable() { if (pDrawLayer) diff -x .svn -Nur original/source/ui/view/dbfunc3.cxx modified/source/ui/view/dbfunc3.cxx --- original/source/ui/view/dbfunc3.cxx 2012-06-13 13:07:18.156250000 -0700 +++ modified/source/ui/view/dbfunc3.cxx 2012-06-12 19:49:39.171875000 -0700 @@ -614,6 +614,11 @@ SCTAB nNewTab = nSrcTab+1; + const bool bDrawUndo = ( bUndo && !pDoc->IsDrawRecording() ); + + if( bDrawUndo ) + pDoc->BeginDrawUndo(); + SCTAB i=1; while ( !pDoc->InsertTab( nNewTab, lcl_MakePivotTabName( aName, i ) ) && i <= MAXTAB ) i++; @@ -629,6 +634,9 @@ SetTabNo( nNewTab, sal_True ); aDestRange = ScRange( 0, 0, nNewTab ); + + if( bDrawUndo ) + pDoc->EndDrawUndo(); } ScDPObject* pDPObj = pDoc->GetDPAtCursor(