diff options
author | Carsten Driesner <cd@openoffice.org> | 2011-02-07 13:06:08 +0100 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2011-02-07 13:06:08 +0100 |
commit | a27e4b8ca5d84790c04a7351c4ea5ef004a0bbea (patch) | |
tree | e400e267e96a54f7c37896e7cdccca345b2616f0 /sw/source/core/edit/edundo.cxx | |
parent | 4f65368101fde95f5bf97f114290b494a80ef051 (diff) | |
parent | 5b7dc4c9b5c1190edce19e568676270f315c31e6 (diff) |
removetooltypes01: Rebase to DEV300m99
Diffstat (limited to 'sw/source/core/edit/edundo.cxx')
-rw-r--r-- | sw/source/core/edit/edundo.cxx | 139 |
1 files changed, 135 insertions, 4 deletions
diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx index aa4d6c43f6a9..1e27b3b44cfb 100644 --- a/sw/source/core/edit/edundo.cxx +++ b/sw/source/core/edit/edundo.cxx @@ -28,18 +28,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <svx/svdview.hxx> + #include <editsh.hxx> #include <fesh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> -#include <undobj.hxx> +#include <UndoCore.hxx> #include <swundo.hxx> #include <dcontact.hxx> #include <flyfrm.hxx> #include <frmfmt.hxx> #include <viewimp.hxx> +#include <docsh.hxx> /** helper function to select all objects in an SdrMarkList; @@ -47,16 +49,77 @@ void lcl_SelectSdrMarkList( SwEditShell* pShell, const SdrMarkList* pSdrMarkList ); +bool SwEditShell::CursorsLocked() const +{ +<<<<<<< local sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt ) +======= + return GetDoc()->GetDocShell()->GetModel()->hasControllersLocked(); +} + +void +SwEditShell::HandleUndoRedoContext(::sw::UndoRedoContext & rContext) +{ + // do nothing if somebody has locked controllers! + if (CursorsLocked()) + { + return; + } + + SwFrmFmt * pSelFmt(0); + SdrMarkList * pMarkList(0); + rContext.GetSelections(pSelFmt, pMarkList); + + if (pSelFmt) // select frame + { + if (RES_DRAWFRMFMT == pSelFmt->Which()) + { + SdrObject* pSObj = pSelFmt->FindSdrObject(); + static_cast<SwFEShell*>(this)->SelectObj( + pSObj->GetCurrentBoundRect().Center() ); + } + else + { + Point aPt; + SwFlyFrm *const pFly = + static_cast<SwFlyFrmFmt*>(pSelFmt)->GetFrm(& aPt, false); + if (pFly) + { + static_cast<SwFEShell*>(this)->SelectFlyFrm(*pFly, true); + } + } + } + else if (pMarkList) + { + lcl_SelectSdrMarkList( this, pMarkList ); + } + else if (GetCrsr()->GetNext() != GetCrsr()) + { + // current cursor is the last one: + // go around the ring, to the first cursor + GoNextCrsr(); + } +} + +bool SwEditShell::Undo(USHORT const nCount) +>>>>>>> other { SET_CURR_SHELL( this ); // #105332# current undo state was not saved +<<<<<<< local sal_Bool bRet = sal_False; sal_Bool bSaveDoesUndo = GetDoc()->DoesUndo(); +======= + ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo()); + BOOL bRet = FALSE; +>>>>>>> other +<<<<<<< local GetDoc()->DoUndo( sal_False ); +======= +>>>>>>> other StartAllAction(); { // eigentlich muesste ja nur der aktuelle Cursor berarbeitet @@ -69,8 +132,14 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt ) // JP 02.04.98: Cursor merken - beim Auto-Format/-Korrektur // soll dieser wieder an die Position +<<<<<<< local SwUndoId nLastUndoId = GetDoc()->GetUndoIds(NULL, NULL); sal_Bool bRestoreCrsr = 1 == nCnt && ( UNDO_AUTOFORMAT == nLastUndoId || +======= + SwUndoId nLastUndoId(UNDO_EMPTY); + GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId); + bool bRestoreCrsr = 1 == nCount && (UNDO_AUTOFORMAT == nLastUndoId || +>>>>>>> other UNDO_AUTOCORRECT == nLastUndoId ); Push(); @@ -80,6 +149,7 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt ) RedlineMode_t eOld = GetDoc()->GetRedlineMode(); +<<<<<<< local SwUndoIter aUndoIter( GetCrsr(), nUndoId ); while( nCnt-- ) { @@ -100,9 +170,23 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt ) } } while( sal_True ); } +======= + try { + for (USHORT i = 0; i < nCount; ++i) + { + bRet = GetDoc()->GetIDocumentUndoRedo().Undo() + || bRet; + } + } catch (::com::sun::star::uno::Exception & e) { + OSL_TRACE("SwEditShell::Undo(): exception caught:\n %s", + ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8) + .getStr()); + } +>>>>>>> other Pop( !bRestoreCrsr ); +<<<<<<< local if( aUndoIter.pSelFmt ) // dann erzeuge eine Rahmen-Selection { if( RES_DRAWFRMFMT == aUndoIter.pSelFmt->Which() ) @@ -126,6 +210,8 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt ) else if( GetCrsr()->GetNext() != GetCrsr() ) // gehe nach einem GoNextCrsr(); // Undo zur alten Undo-Position !! +======= +>>>>>>> other GetDoc()->SetRedlineMode( eOld ); GetDoc()->CompressRedlines(); @@ -134,21 +220,35 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt ) } EndAllAction(); +<<<<<<< local // #105332# undo state was not restored but set to sal_False everytime GetDoc()->DoUndo( bSaveDoesUndo ); +======= +>>>>>>> other return bRet; } +<<<<<<< local sal_uInt16 SwEditShell::Redo( sal_uInt16 nCnt ) +======= +bool SwEditShell::Redo(USHORT const nCount) +>>>>>>> other { SET_CURR_SHELL( this ); sal_Bool bRet = sal_False; // #105332# undo state was not saved +<<<<<<< local sal_Bool bSaveDoesUndo = GetDoc()->DoesUndo(); +======= + ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo()); +>>>>>>> other +<<<<<<< local GetDoc()->DoUndo( sal_False ); +======= +>>>>>>> other StartAllAction(); { @@ -166,6 +266,7 @@ sal_uInt16 SwEditShell::Redo( sal_uInt16 nCnt ) RedlineMode_t eOld = GetDoc()->GetRedlineMode(); +<<<<<<< local SwUndoIter aUndoIter( GetCrsr(), UNDO_EMPTY ); while( nCnt-- ) { @@ -211,6 +312,19 @@ sal_uInt16 SwEditShell::Redo( sal_uInt16 nCnt ) } else if( GetCrsr()->GetNext() != GetCrsr() ) // gehe nach einem GoNextCrsr(); // Redo zur alten Undo-Position !! +======= + try { + for (USHORT i = 0; i < nCount; ++i) + { + bRet = GetDoc()->GetIDocumentUndoRedo().Redo() + || bRet; + } + } catch (::com::sun::star::uno::Exception & e) { + OSL_TRACE("SwEditShell::Redo(): exception caught:\n %s", + ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8) + .getStr()); + } +>>>>>>> other GetDoc()->SetRedlineMode( eOld ); GetDoc()->CompressRedlines(); @@ -221,26 +335,41 @@ sal_uInt16 SwEditShell::Redo( sal_uInt16 nCnt ) EndAllAction(); +<<<<<<< local // #105332# undo state was not restored but set sal_False everytime GetDoc()->DoUndo( bSaveDoesUndo ); +======= +>>>>>>> other return bRet; } +<<<<<<< local sal_uInt16 SwEditShell::Repeat( sal_uInt16 nCount ) +======= +bool SwEditShell::Repeat(USHORT const nCount) +>>>>>>> other { SET_CURR_SHELL( this ); sal_Bool bRet = sal_False; StartAllAction(); - SwUndoIter aUndoIter( GetCrsr(), UNDO_EMPTY ); - bRet = GetDoc()->Repeat( aUndoIter, nCount ) || bRet; + try { + ::sw::RepeatContext context(*GetDoc(), *GetCrsr()); + bRet = GetDoc()->GetIDocumentUndoRedo().Repeat( context, nCount ) + || bRet; + } catch (::com::sun::star::uno::Exception & e) { + OSL_TRACE("SwEditShell::Repeat(): exception caught:\n %s", + ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8) + .getStr()); + } EndAllAction(); return bRet; } +<<<<<<< local // abfragen/setzen der Anzahl von wiederherstellbaren Undo-Actions sal_uInt16 SwEditShell::GetUndoActionCount() @@ -256,6 +385,8 @@ void SwEditShell::SetUndoActionCount( sal_uInt16 nNew ) +======= +>>>>>>> other void lcl_SelectSdrMarkList( SwEditShell* pShell, const SdrMarkList* pSdrMarkList ) |