diff -r ac64efb3a1b4 sw/source/ui/docvw/postit.cxx --- a/sw/source/ui/docvw/postit.cxx Wed Jan 13 16:08:21 2010 +0100 +++ b/sw/source/ui/docvw/postit.cxx Mon Feb 01 15:03:03 2010 +0100 @@ -1612,14 +1612,26 @@ void SwPostIt::UpdateData() { if ( Engine()->IsModified() ) { - SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); - SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); - SwField* pOldField = mpFld->Copy(); + // --> OD 2010-02-01 #i108813# - check, if undo is active + std::auto_ptr pOldField( 0 ); + if ( DocView()->GetDocShell()->GetDoc()->DoesUndo() ) + { + pOldField.reset( mpFld->Copy() ); + } + // <-- + mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); - delete pOldField; + + // --> OD 2010-02-01 #i108813# - check, if undo is active + if ( DocView()->GetDocShell()->GetDoc()->DoesUndo() ) + { + SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); + SwPosition aPosition( pTxtFld->GetTxtNode() ); + aPosition.nContent = *pTxtFld->GetStart(); + DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + } + // <-- // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one) Mgr()->SetLayout(); // #i98686# if we have several views, all notes should update their text @@ -1793,15 +1805,29 @@ void SwPostIt::InitAnswer(OutlinerParaOb // lets insert an undo step so the initial text can be easily deleted // but do not use UpdateData() directly, would set modified state again and reentrance into Mgr Engine()->SetModifyHdl( Link() ); - SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); - SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); - SwField* pOldField = mpFld->Copy(); + + // --> OD 2010-02-01 #i108813# - check, if undo is active + std::auto_ptr pOldField( 0 ); + if ( DocView()->GetDocShell()->GetDoc()->DoesUndo() ) + { + pOldField.reset( mpFld->Copy() ); + } + // <-- + mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); - delete pOldField; - Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) ); + + // --> OD 2010-02-01 #i108813# - check, if undo is active + if ( DocView()->GetDocShell()->GetDoc()->DoesUndo() ) + { + SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); + SwPosition aPosition( pTxtFld->GetTxtNode() ); + aPosition.nContent = *pTxtFld->GetStart(); + DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + } + // <-- + + Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) ); Engine()->ClearModifyFlag(); Engine()->GetUndoManager().Clear(); }