View | Details | Raw Unified | Return to issue 108813
Collapse All | Expand All

(-)a/sw/source/ui/docvw/postit.cxx (-13 / +39 lines)
Lines 1612-1625 void SwPostIt::UpdateData() Link Here
1612
{
1612
{
1613
	if ( Engine()->IsModified() )
1613
	if ( Engine()->IsModified() )
1614
	{
1614
	{
1615
        SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
1615
        // --> OD 2010-02-01 #i108813# - check, if undo is active
1616
        SwPosition aPosition( pTxtFld->GetTxtNode() );
1616
        std::auto_ptr<SwField> pOldField( 0 );
1617
        aPosition.nContent = *pTxtFld->GetStart();
1617
        if ( DocView()->GetDocShell()->GetDoc()->DoesUndo() )
1618
        SwField* pOldField = mpFld->Copy();
1618
        {
1619
            pOldField.reset( mpFld->Copy() );
1620
        }
1621
        // <--
1622
1619
        mpFld->SetPar2(Engine()->GetEditEngine().GetText());
1623
        mpFld->SetPar2(Engine()->GetEditEngine().GetText());
1620
        mpFld->SetTextObject(Engine()->CreateParaObject());
1624
        mpFld->SetTextObject(Engine()->CreateParaObject());
1621
        DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
1625
1622
        delete pOldField;
1626
        // --> OD 2010-02-01 #i108813# - check, if undo is active
1627
        if ( DocView()->GetDocShell()->GetDoc()->DoesUndo() )
1628
        {
1629
            SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
1630
            SwPosition aPosition( pTxtFld->GetTxtNode() );
1631
            aPosition.nContent = *pTxtFld->GetStart();
1632
            DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
1633
        }
1634
        // <--
1623
        // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one)
1635
        // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one)
1624
        Mgr()->SetLayout();
1636
        Mgr()->SetLayout();
1625
		// #i98686# if we have several views, all notes should update their text
1637
		// #i98686# if we have several views, all notes should update their text
Lines 1793-1807 void SwPostIt::InitAnswer(OutlinerParaOb Link Here
1793
	// lets insert an undo step so the initial text can be easily deleted
1805
	// lets insert an undo step so the initial text can be easily deleted
1794
	// but do not use UpdateData() directly, would set modified state again and reentrance into Mgr
1806
	// but do not use UpdateData() directly, would set modified state again and reentrance into Mgr
1795
	Engine()->SetModifyHdl( Link() );
1807
	Engine()->SetModifyHdl( Link() );
1796
    SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
1808
1797
    SwPosition aPosition( pTxtFld->GetTxtNode() );
1809
    // --> OD 2010-02-01 #i108813# - check, if undo is active
1798
    aPosition.nContent = *pTxtFld->GetStart();
1810
    std::auto_ptr<SwField> pOldField( 0 );
1799
    SwField* pOldField = mpFld->Copy();
1811
    if ( DocView()->GetDocShell()->GetDoc()->DoesUndo() )
1812
    {
1813
        pOldField.reset( mpFld->Copy() );
1814
    }
1815
    // <--
1816
1800
    mpFld->SetPar2(Engine()->GetEditEngine().GetText());
1817
    mpFld->SetPar2(Engine()->GetEditEngine().GetText());
1801
    mpFld->SetTextObject(Engine()->CreateParaObject());
1818
    mpFld->SetTextObject(Engine()->CreateParaObject());
1802
    DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
1819
1803
    delete pOldField;
1820
    // --> OD 2010-02-01 #i108813# - check, if undo is active
1804
	Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) );
1821
    if ( DocView()->GetDocShell()->GetDoc()->DoesUndo() )
1822
    {
1823
        SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
1824
        SwPosition aPosition( pTxtFld->GetTxtNode() );
1825
        aPosition.nContent = *pTxtFld->GetStart();
1826
        DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
1827
    }
1828
    // <--
1829
1830
    Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) );
1805
	Engine()->ClearModifyFlag();
1831
	Engine()->ClearModifyFlag();
1806
	Engine()->GetUndoManager().Clear();
1832
	Engine()->GetUndoManager().Clear();
1807
}
1833
}

Return to issue 108813