summaryrefslogtreecommitdiff
path: root/sw/source/ui/ribbar/inputwin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/ribbar/inputwin.cxx')
-rwxr-xr-xsw/source/ui/ribbar/inputwin.cxx86
1 files changed, 34 insertions, 52 deletions
diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx
index f6429dbdfc9f..d205e8650f43 100755
--- a/sw/source/ui/ribbar/inputwin.cxx
+++ b/sw/source/ui/ribbar/inputwin.cxx
@@ -36,6 +36,7 @@
#include <svx/ruler.hxx>
#include <svl/zforlist.hxx>
#include <svl/stritem.hxx>
+#include <unotools/undoopt.hxx>
#include "swtypes.hxx"
#include "cmdid.h"
@@ -74,9 +75,13 @@ SwInputWindow::SwInputWindow( Window* pParent, SfxBindings* pBind )
pView(0),
pBindings(pBind),
aAktTableName(aEmptyStr)
+ , m_nActionCount(0)
+ , m_bDoesUndo(true)
+ , m_bResetUndo(false)
+ , m_bCallUndo(false)
{
- bFirst = bDoesUndo = sal_True;
- bActive = bIsTable = bDelSel = bResetUndo = bCallUndo = sal_False;
+ bFirst = sal_True;
+ bActive = bIsTable = bDelSel = sal_False;
FreeResource();
@@ -143,16 +148,27 @@ __EXPORT SwInputWindow::~SwInputWindow()
if(pWrtShell)
pWrtShell->EndSelTblCells();
- if( bResetUndo )
+ CleanupUglyHackWithUndo();
+}
+
+void SwInputWindow::CleanupUglyHackWithUndo()
+{
+ if (m_bResetUndo)
{
DelBoxCntnt();
- pWrtShell->DoUndo( bDoesUndo );
- if(bCallUndo)
+ pWrtShell->DoUndo(m_bDoesUndo);
+ if (m_bCallUndo)
+ {
pWrtShell->Undo();
- SwEditShell::SetUndoActionCount( nActionCnt );
+ }
+ if (0 == m_nActionCount)
+ {
+ SW_MOD()->GetUndoOptions().SetUndoCount(0);
+ }
}
}
+
//==================================================================
void SwInputWindow::DataChanged( const DataChangedEvent& rDCEvt )
@@ -233,9 +249,11 @@ void SwInputWindow::ShowWin()
{
if( bIsTable )
{
- bResetUndo = sal_True;
- nActionCnt = SwEditShell::GetUndoActionCount();
- SwEditShell::SetUndoActionCount( nActionCnt + 1 );
+ m_bResetUndo = true;
+ m_nActionCount = SW_MOD()->GetUndoOptions().GetUndoCount();
+ if (0 == m_nActionCount) { // deactivated? turn it on...
+ SW_MOD()->GetUndoOptions().SetUndoCount(1);
+ }
bDoesUndo = pWrtShell->DoesUndo();
if( !bDoesUndo )
@@ -252,9 +270,11 @@ void SwInputWindow::ShowWin()
pWrtShell->StartUndo( UNDO_DELETE );
pWrtShell->Delete();
if( 0 != pWrtShell->EndUndo( UNDO_DELETE ))
- bCallUndo = sal_True;
+ {
+ m_bCallUndo = true;
+ }
}
- pWrtShell->DoUndo( sal_False );
+ pWrtShell->DoUndo(false);
SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
if( pWrtShell->GetTblBoxFormulaAttrs( aSet ))
@@ -376,15 +396,7 @@ void SwInputWindow::ApplyFormula()
{
pView->GetViewFrame()->GetDispatcher()->Lock(sal_False);
pView->GetEditWin().LockKeyInput(sal_False);
- if( bResetUndo )
- {
- DelBoxCntnt();
- pWrtShell->DoUndo( bDoesUndo );
- SwEditShell::SetUndoActionCount( nActionCnt );
- if( bCallUndo )
- pWrtShell->Undo();
- bResetUndo = sal_False;
- }
+ CleanupUglyHackWithUndo();
pWrtShell->Pop( sal_False );
// JP 13.01.97: Formel soll immer mit einem "=" beginnen, hier
@@ -411,15 +423,7 @@ void SwInputWindow::CancelFormula()
{
pView->GetViewFrame()->GetDispatcher()->Lock( sal_False );
pView->GetEditWin().LockKeyInput(sal_False);
- if( bResetUndo )
- {
- DelBoxCntnt();
- pWrtShell->DoUndo( bDoesUndo );
- SwEditShell::SetUndoActionCount( nActionCnt );
- if( bCallUndo )
- pWrtShell->Undo();
- bResetUndo = sal_False;
- }
+ CleanupUglyHackWithUndo();
pWrtShell->Pop( sal_False );
if( bDelSel )
@@ -496,7 +500,7 @@ void SwInputWindow::SetFormula( const String& rFormula, sal_Bool bDelFlag )
IMPL_LINK( SwInputWindow, ModifyHdl, InputEdit*, EMPTYARG )
{
- if( bIsTable && bResetUndo )
+ if (bIsTable && m_bResetUndo)
{
pWrtShell->StartAllAction();
DelBoxCntnt();
@@ -670,25 +674,3 @@ SfxChildWinInfo __EXPORT SwInputChild::GetInfo() const
return aInfo;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-