diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2011-01-28 11:59:17 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2011-01-28 11:59:17 +0100 |
commit | 6749960ece5556b75b8879dbc6494f43a45ea890 (patch) | |
tree | 0b36c705becc62d4b9a1ade2c08f90bb80fbee47 /starmath | |
parent | fc8b4b4b2ebe3d5183e00a07ba8721d5909c34ad (diff) | |
parent | abb716d15ea02bf3cbedd0dcce4395b7725ef8c5 (diff) |
CWS-TOOLING: integrate CWS undoapi
Diffstat (limited to 'starmath')
-rwxr-xr-x | starmath/inc/document.hxx | 2 | ||||
-rwxr-xr-x | starmath/source/document.cxx | 42 |
2 files changed, 26 insertions, 18 deletions
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index 3aea9e3e4e09..f8ffef16dfcd 100755 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -216,7 +216,7 @@ public: void Repaint(); - virtual SfxUndoManager *GetUndoManager (); + virtual ::svl::IUndoManager *GetUndoManager (); virtual SfxItemPool& GetPool() const; diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 05f51ec8ed9f..1f7271168e0a 100755 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -98,6 +98,7 @@ #include "mathmlexport.hxx" #include <sfx2/sfxsids.hrc> #include <svx/svxids.hrc> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; @@ -1008,7 +1009,7 @@ void SmDocShell::Execute(SfxRequest& rReq) SmFormat aNewFormat( aOldFormat ); aNewFormat.SetTextmode(!aOldFormat.IsTextmode()); - SfxUndoManager *pTmpUndoMgr = GetUndoManager(); + ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager(); if (pTmpUndoMgr) pTmpUndoMgr->AddUndoAction( new SmFormatAction(this, aOldFormat, aNewFormat)); @@ -1051,7 +1052,7 @@ void SmDocShell::Execute(SfxRequest& rReq) SmFormat aNewFormat( aOldFormat ); pFontTypeDialog->WriteTo(aNewFormat); - SfxUndoManager *pTmpUndoMgr = GetUndoManager(); + ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager(); if (pTmpUndoMgr) pTmpUndoMgr->AddUndoAction( new SmFormatAction(this, aOldFormat, aNewFormat)); @@ -1075,7 +1076,7 @@ void SmDocShell::Execute(SfxRequest& rReq) pFontSizeDialog->WriteTo(aNewFormat); - SfxUndoManager *pTmpUndoMgr = GetUndoManager(); + ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager(); if (pTmpUndoMgr) pTmpUndoMgr->AddUndoAction( new SmFormatAction(this, aOldFormat, aNewFormat)); @@ -1099,7 +1100,7 @@ void SmDocShell::Execute(SfxRequest& rReq) pDistanceDialog->WriteTo(aNewFormat); - SfxUndoManager *pTmpUndoMgr = GetUndoManager(); + ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager(); if (pTmpUndoMgr) pTmpUndoMgr->AddUndoAction( new SmFormatAction(this, aOldFormat, aNewFormat)); @@ -1128,7 +1129,7 @@ void SmDocShell::Execute(SfxRequest& rReq) pAlignDialog->WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); - SfxUndoManager *pTmpUndoMgr = GetUndoManager(); + ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager(); if (pTmpUndoMgr) pTmpUndoMgr->AddUndoAction( new SmFormatAction(this, aOldFormat, aNewFormat)); @@ -1151,7 +1152,7 @@ void SmDocShell::Execute(SfxRequest& rReq) case SID_UNDO: case SID_REDO: { - SfxUndoManager* pTmpUndoMgr = GetUndoManager(); + ::svl::IUndoManager* pTmpUndoMgr = GetUndoManager(); if( pTmpUndoMgr ) { USHORT nId = rReq.GetSlot(), nCnt = 1; @@ -1160,22 +1161,29 @@ void SmDocShell::Execute(SfxRequest& rReq) if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, FALSE, &pItem )) nCnt = ((SfxUInt16Item*)pItem)->GetValue(); - BOOL (SfxUndoManager:: *fnDo)( USHORT ); + BOOL (::svl::IUndoManager:: *fnDo)(); sal_uInt16 nCount; if( SID_UNDO == rReq.GetSlot() ) { nCount = pTmpUndoMgr->GetUndoActionCount(); - fnDo = &SfxUndoManager::Undo; + fnDo = &::svl::IUndoManager::Undo; } else { nCount = pTmpUndoMgr->GetRedoActionCount(); - fnDo = &SfxUndoManager::Redo; + fnDo = &::svl::IUndoManager::Redo; } - for( ; nCnt && nCount; --nCnt, --nCount ) - (pTmpUndoMgr->*fnDo)( 0 ); + try + { + for( ; nCnt && nCount; --nCnt, --nCount ) + (pTmpUndoMgr->*fnDo)(); + } + catch( const Exception& e ) + { + DBG_UNHANDLED_EXCEPTION(); + } } Repaint(); SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this ); @@ -1258,27 +1266,27 @@ void SmDocShell::GetState(SfxItemSet &rSet) case SID_GETUNDOSTRINGS: case SID_GETREDOSTRINGS: { - SfxUndoManager* pTmpUndoMgr = GetUndoManager(); + ::svl::IUndoManager* pTmpUndoMgr = GetUndoManager(); if( pTmpUndoMgr ) { - UniString(SfxUndoManager:: *fnGetComment)( USHORT ) const; + UniString(::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const; sal_uInt16 nCount; if( SID_GETUNDOSTRINGS == nWh ) { nCount = pTmpUndoMgr->GetUndoActionCount(); - fnGetComment = &SfxUndoManager::GetUndoActionComment; + fnGetComment = &::svl::IUndoManager::GetUndoActionComment; } else { nCount = pTmpUndoMgr->GetRedoActionCount(); - fnGetComment = &SfxUndoManager::GetRedoActionComment; + fnGetComment = &::svl::IUndoManager::GetRedoActionComment; } if( nCount ) { String sList; for( sal_uInt16 n = 0; n < nCount; ++n ) - ( sList += (pTmpUndoMgr->*fnGetComment)( n ) ) + ( sList += (pTmpUndoMgr->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) ) += '\n'; SfxStringListItem aItem( nWh ); @@ -1295,7 +1303,7 @@ void SmDocShell::GetState(SfxItemSet &rSet) } -SfxUndoManager *SmDocShell::GetUndoManager() +::svl::IUndoManager *SmDocShell::GetUndoManager() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::GetUndoManager" ); |