diff options
Diffstat (limited to 'sw/source/ui/wrtsh/wrtundo.cxx')
-rw-r--r-- | sw/source/ui/wrtsh/wrtundo.cxx | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/sw/source/ui/wrtsh/wrtundo.cxx b/sw/source/ui/wrtsh/wrtundo.cxx index a7ae5c1b10e9..5ec7103246a7 100644 --- a/sw/source/ui/wrtsh/wrtundo.cxx +++ b/sw/source/ui/wrtsh/wrtundo.cxx @@ -37,8 +37,11 @@ #include <svl/slstitm.hxx> #include <wrtsh.hxx> #include <swundo.hxx> // fuer Undo-Ids +#include <IDocumentUndoRedo.hxx> #include <swdtflvr.hxx> - +#include <svtools/svtdata.hxx> +#include <svtools/svtools.hrc> +#include <svtools/svtdata.hxx> #include <wrtsh.hrc> #include <sfx2/sfx.hrc> @@ -47,7 +50,7 @@ // ist, muss die fuer die weiteren Aktionen beruecksichtigt werden. -void SwWrtShell::Do( DoType eDoType, USHORT nCnt ) +void SwWrtShell::Do( DoType eDoType, sal_uInt16 nCnt ) { // #105332# save current state of DoesUndo() sal_Bool bSaveDoesUndo = DoesUndo(); @@ -59,7 +62,7 @@ void SwWrtShell::Do( DoType eDoType, USHORT nCnt ) DoUndo(sal_False); // #i21739# // Modi zuruecksetzen EnterStdMode(); - SwEditShell::Undo(UNDO_EMPTY, nCnt ); + SwEditShell::Undo(nCnt); break; case REDO: DoUndo(sal_False); // #i21739# @@ -76,8 +79,8 @@ void SwWrtShell::Do( DoType eDoType, USHORT nCnt ) // #105332# restore undo state DoUndo(bSaveDoesUndo); - BOOL bCreateXSelection = FALSE; - const BOOL bFrmSelected = IsFrmSelected() || IsObjSelected(); + sal_Bool bCreateXSelection = sal_False; + const sal_Bool bFrmSelected = IsFrmSelected() || IsObjSelected(); if ( IsSelection() ) { if ( bFrmSelected ) @@ -87,18 +90,18 @@ void SwWrtShell::Do( DoType eDoType, USHORT nCnt ) // bei Cursor setzen fnKillSel = &SwWrtShell::ResetSelect; fnSetCrsr = &SwWrtShell::SetCrsrKillSel; - bCreateXSelection = TRUE; + bCreateXSelection = sal_True; } else if ( bFrmSelected ) { EnterSelFrmMode(); - bCreateXSelection = TRUE; + bCreateXSelection = sal_True; } else if( (CNT_GRF | CNT_OLE ) & GetCntType() ) { SelectObj( GetCharRect().Pos() ); EnterSelFrmMode(); - bCreateXSelection = TRUE; + bCreateXSelection = sal_True; } if( bCreateXSelection ) @@ -112,70 +115,67 @@ void SwWrtShell::Do( DoType eDoType, USHORT nCnt ) String SwWrtShell::GetDoString( DoType eDoType ) const { - String aStr, aUndoStr; - USHORT nResStr = STR_UNDO; + ::rtl::OUString aUndoStr; + sal_uInt16 nResStr = STR_UNDO; switch( eDoType ) { case UNDO: nResStr = STR_UNDO; - aUndoStr = GetUndoIdsStr(); + GetLastUndoInfo(& aUndoStr, 0); break; case REDO: nResStr = STR_REDO; - aUndoStr = GetRedoIdsStr(); + GetFirstRedoInfo(& aUndoStr); break; default:;//prevent warning } - aStr.Insert( String(ResId( nResStr, *SFX_APP()->GetSfxResManager())), 0 ); - aStr += aUndoStr; + ::rtl::OUStringBuffer buf = ::rtl::OUStringBuffer( String( SvtResId( nResStr ) ) ); + buf.append(aUndoStr); - return aStr; + return buf.makeStringAndClear(); } -USHORT SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) const +sal_uInt16 SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) const { - SwUndoIds aIds; + SwUndoComments_t comments; switch( eDoType ) { case UNDO: - GetUndoIds( NULL, &aIds ); + comments = GetIDocumentUndoRedo().GetUndoComments(); break; case REDO: - GetRedoIds( NULL, &aIds ); + comments = GetIDocumentUndoRedo().GetRedoComments(); break; default:;//prevent warning } - String sList; - for( USHORT n = 0, nEnd = aIds.Count(); n < nEnd; ++n ) + ::rtl::OUStringBuffer buf; + for (size_t i = 0; i < comments.size(); ++i) { - const SwUndoIdAndName& rIdNm = *aIds[ n ]; - if( rIdNm.GetUndoStr() ) - sList += *rIdNm.GetUndoStr(); - else - { + OSL_ENSURE(comments[i].getLength(), "no Undo/Redo Text set"); + buf.append(comments[i]); + buf.append(sal_Unicode('\n')); OSL_ENSURE( !this, "no Undo/Redo Test set" ); - } - sList += '\n'; } - rStrs.SetString( sList ); - return aIds.Count(); + rStrs.SetString(buf.makeStringAndClear()); + return static_cast<sal_uInt16>(comments.size()); } String SwWrtShell::GetRepeatString() const { - String aStr; - String aUndoStr = GetRepeatIdsStr(); + ::rtl::OUString str; + GetRepeatInfo(& str); - if (aUndoStr.Len() > 0) + if (str.getLength() == 0) { - aStr.Insert( ResId( STR_REPEAT, *SFX_APP()->GetSfxResManager()), 0 ); - aStr += aUndoStr; + return str; } - return aStr; + ::rtl::OUStringBuffer buf( String(SvtResId(STR_REPEAT)) ); + buf.append(str); + return buf.makeStringAndClear(); } |