summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw/edtwin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/docvw/edtwin.cxx')
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx33
1 files changed, 23 insertions, 10 deletions
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index d10edecc9d48..7d160526f120 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -76,6 +76,7 @@
#include <wrtsh.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <textboxhelper.hxx>
#include <dcontact.hxx>
#include <fldbas.hxx>
@@ -4767,15 +4768,15 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
{
if( rSh.IsSelection() && !rSh.HasReadonlySel() )
{
- if(nId == RES_CHRATR_BACKGROUND)
+ m_pApplyTempl->nUndo =
+ std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
+ if (nId == RES_CHRATR_BACKGROUND)
rSh.SetAttrItem( SvxBrushItem( SwEditWin::m_aTextBackColor, nId ) );
else
rSh.SetAttrItem( SvxColorItem( SwEditWin::m_aTextColor, nId ) );
rSh.UnSetVisCrsr();
rSh.EnterStdMode();
rSh.SetVisCrsr(aDocPt);
-
- m_pApplyTempl->bUndo = true;
bCallBase = false;
m_aTemplateTimer.Stop();
}
@@ -4796,7 +4797,8 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
& eSelection ) && !rSh.HasReadonlySel() )
{
rSh.SetTxtFmtColl( m_pApplyTempl->aColl.pTxtColl );
- m_pApplyTempl->bUndo = true;
+ m_pApplyTempl->nUndo =
+ std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
bCallBase = false;
if ( m_pApplyTempl->aColl.pTxtColl )
aStyleName = m_pApplyTempl->aColl.pTxtColl->GetName();
@@ -4810,7 +4812,8 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
rSh.UnSetVisCrsr();
rSh.EnterStdMode();
rSh.SetVisCrsr(aDocPt);
- m_pApplyTempl->bUndo = true;
+ m_pApplyTempl->nUndo =
+ std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
bCallBase = false;
if ( m_pApplyTempl->aColl.pCharFmt )
aStyleName = m_pApplyTempl->aColl.pCharFmt->GetName();
@@ -4822,7 +4825,8 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
if(PTR_CAST(SwFlyFrmFmt, pFmt))
{
rSh.SetFrmFmt( m_pApplyTempl->aColl.pFrmFmt, false, &aDocPt );
- m_pApplyTempl->bUndo = true;
+ m_pApplyTempl->nUndo =
+ std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
bCallBase = false;
if( m_pApplyTempl->aColl.pFrmFmt )
aStyleName = m_pApplyTempl->aColl.pFrmFmt->GetName();
@@ -4834,6 +4838,8 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
rSh.ChgCurPageDesc( *m_pApplyTempl->aColl.pPageDesc );
if ( m_pApplyTempl->aColl.pPageDesc )
aStyleName = m_pApplyTempl->aColl.pPageDesc->GetName();
+ m_pApplyTempl->nUndo =
+ std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
bCallBase = false;
break;
case SFX_STYLE_FAMILY_PSEUDO:
@@ -4843,7 +4849,8 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
false,
m_pApplyTempl->aColl.pNumRule->GetDefaultListId() );
bCallBase = false;
- m_pApplyTempl->bUndo = true;
+ m_pApplyTempl->nUndo =
+ std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
if( m_pApplyTempl->aColl.pNumRule )
aStyleName = m_pApplyTempl->aColl.pNumRule->GetName();
}
@@ -4892,14 +4899,16 @@ void SwEditWin::SetApplyTemplate(const SwApplyTemplate &rTempl)
if(rTempl.m_pFormatClipboard)
{
m_pApplyTempl = new SwApplyTemplate( rTempl );
+ m_pApplyTempl->nUndo = rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount();
SetPointer( POINTER_FILL );//@todo #i20119# maybe better a new brush pointer here in future
- rSh.NoEdit( false );
- bIdle = rSh.GetViewOptions()->IsIdle();
+ rSh.NoEdit( false );
+ bIdle = rSh.GetViewOptions()->IsIdle();
((SwViewOption *)rSh.GetViewOptions())->SetIdle( false );
}
else if(rTempl.nColor)
{
m_pApplyTempl = new SwApplyTemplate( rTempl );
+ m_pApplyTempl->nUndo = rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount();
SetPointer( POINTER_FILL );
rSh.NoEdit( false );
bIdle = rSh.GetViewOptions()->IsIdle();
@@ -4908,6 +4917,7 @@ void SwEditWin::SetApplyTemplate(const SwApplyTemplate &rTempl)
else if( rTempl.eType )
{
m_pApplyTempl = new SwApplyTemplate( rTempl );
+ m_pApplyTempl->nUndo = rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount();
SetPointer( POINTER_FILL );
rSh.NoEdit( false );
bIdle = rSh.GetViewOptions()->IsIdle();
@@ -5214,8 +5224,11 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
else if ( !m_rView.ExecSpellPopup( aDocPos ) )
SfxDispatcher::ExecutePopup( 0, this, &aPixPos);
}
- else if (m_pApplyTempl->bUndo)
+ else if (m_pApplyTempl->nUndo < rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount())
+ {
+ // Undo until we reach the point when we entered this context.
rSh.Do(SwWrtShell::UNDO);
+ }
bCallBase = false;
}
}