diff options
-rw-r--r-- | sw/inc/IDocumentUndoRedo.hxx | 34 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 10 | ||||
-rw-r--r-- | sw/inc/swundo.hxx | 32 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/edundo.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/edws.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/frmedt/fefly1.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/UndoManager.hxx | 10 | ||||
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 120 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbmgr.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/docvw/edtwin.cxx | 5 | ||||
-rwxr-xr-x | sw/source/ui/shells/annotsh.cxx | 9 | ||||
-rw-r--r-- | sw/source/ui/shells/basesh.cxx | 12 | ||||
-rw-r--r-- | sw/source/ui/table/chartins.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/uiview/viewstat.cxx | 12 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/makefile.mk | 3 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/wrtsh2.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/wrtundo.cxx | 56 |
21 files changed, 162 insertions, 185 deletions
diff --git a/sw/inc/IDocumentUndoRedo.hxx b/sw/inc/IDocumentUndoRedo.hxx index 0f0c4d70c4f5..3a1a389107c4 100644 --- a/sw/inc/IDocumentUndoRedo.hxx +++ b/sw/inc/IDocumentUndoRedo.hxx @@ -29,17 +29,17 @@ #define IDOCUMENTUNDOREDO_HXX_INCLUDED #include <sal/types.h> + #include <swundo.hxx> class SwUndoIter; class SwRewriter; -class String; -class SwUndoIds; class SwNodes; class SwUndo; + /** IDocumentUndoRedo */ class IDocumentUndoRedo @@ -144,14 +144,17 @@ public: */ virtual void DelAllUndoObj() = 0; - /** Get Ids and comments of Undo actions. + /** Get Id and comment of last Undo action. @param o_pStr if not 0, receives comment of last Undo action. - @param o_pUndoIds if not 0, receives SwUndoIdAndName objects for all - top-level Undo actions. @return Id of last Undo action, or UNDO_EMPTY if there is none. */ - virtual SwUndoId GetUndoIds(String *const o_pStr, - SwUndoIds *const o_pUndoIds) const = 0; + virtual SwUndoId GetLastUndoInfo(::rtl::OUString *const o_pStr) const = 0; + + /** Get comments of Undo actions. + @return comments of all top-level Undo actions. + */ + virtual SwUndoComments_t GetUndoComments() const = 0; + virtual SwUndo* RemoveLastUndo(SwUndoId const eUndoId) = 0; @@ -168,19 +171,22 @@ public: */ virtual bool Redo(SwUndoIter & rUndoIter) = 0; - /** Get Ids and comments of Redo actions. + /** Get Id and comment of first Redo action. @param o_pStr if not 0, receives comment of first Redo action. - @param o_pUndoIds if not 0, receives SwUndoIdAndName objects for all - top-level Redo actions. @return Id of first Redo action, or UNDO_EMPTY if there is none. */ - virtual SwUndoId GetRedoIds(String *const o_pStr, - SwUndoIds *const o_pRedoIds) const = 0; + virtual SwUndoId GetFirstRedoInfo(::rtl::OUString *const o_pStr) const = 0; + + /** Get comments of Redo actions. + @return comments of all top-level Redo actions. + */ + virtual SwUndoComments_t GetRedoComments() const = 0; /** Repeat the last Undo action. @return true if repeating the last Undo Redo action was attempted. */ - virtual bool Repeat(SwUndoIter & rUndoIter, sal_uInt16 const nRepeatCnt) = 0; + virtual bool Repeat(SwUndoIter & rUndoIter, sal_uInt16 const nRepeatCnt) + = 0; /** Get Id and comment of last Undo action, if it is Repeat capable. @param o_pStr if not 0, receives comment of last Undo action @@ -188,7 +194,7 @@ public: @return Id of last Undo action if it is Repeat capable, or UNDO_EMPTY if there is none or it is not Repeat capable. */ - virtual SwUndoId GetRepeatIds(String *const o_pStr) const = 0; + virtual SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const = 0; /** Add new Undo action. Takes over ownership of pUndo. diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 8780ea9eb7b7..ca80ee71ef2d 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -73,7 +73,6 @@ class SwFmtRefMark; class SwNumRule; // Numerierung //class SwNodeNum; // Numerierung -class SwUndoIds; // fuer Undo class SwTxtFmtColl; class SwGrfNode; class SwFlyFrmFmt; @@ -533,13 +532,10 @@ public: SwUndoId StartUndo( SwUndoId eUndoId = UNDO_EMPTY, const SwRewriter * pRewriter = 0 ); // schliesst Klammerung der nUndoId, nicht vom UI benutzt SwUndoId EndUndo( SwUndoId eUndoId = UNDO_EMPTY, const SwRewriter * pRewriter = 0 ); - SwUndoId GetUndoIds( String* pUndoStr = 0, SwUndoIds *pUndoIds = 0) const; - // Redo - SwUndoId GetRedoIds( String* pRedoStr = 0, SwUndoIds *pRedoIds = 0) const; - - // Repeat - SwUndoId GetRepeatIds( String* pRepeatStr = 0) const; + SwUndoId GetLastUndoInfo(::rtl::OUString *const o_pStr) const; + SwUndoId GetFirstRedoInfo(::rtl::OUString *const o_pStr) const; + SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const; // 0 letzte Aktion, sonst Aktionen bis zum Start der Klammerung nUndoId // mit KillPaMs, ClearMark diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx index 02212401d990..3506a7e176b9 100644 --- a/sw/inc/swundo.hxx +++ b/sw/inc/swundo.hxx @@ -24,10 +24,16 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _SWUNDO_HXX -#define _SWUNDO_HXX +#ifndef SWUNDO_HXX +#define SWUNDO_HXX + +#include <vector> + +#include <rtl/ustring.hxx> + + +typedef ::std::vector< ::rtl::OUString > SwUndoComments_t; -#include <svl/svarray.hxx> // die Ids fuer StdAktionen enum SwUndoId @@ -177,24 +183,4 @@ enum SwUndoId }; -#define INIT_UNDOIDS 20 -#define GROW_UNDOIDS 32 -// Das Array der verwendeten Undo-Ids -class String; -class SwUndoIdAndName -{ - SwUndoId eUndoId; - String* pUndoStr; - -public: - SwUndoIdAndName() : eUndoId( UNDO_EMPTY ), pUndoStr( 0 ) {} - SwUndoIdAndName( SwUndoId nId, const String* pStr = 0 ); - ~SwUndoIdAndName(); - - SwUndoId GetUndoId() const { return eUndoId; } - const String* GetUndoStr() const { return pUndoStr; } -}; -typedef SwUndoIdAndName* SwUndoIdAndNamePtr; -SV_DECL_PTRARR_DEL( SwUndoIds, SwUndoIdAndNamePtr, INIT_UNDOIDS, GROW_UNDOIDS ) - #endif diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 480876904d59..8e3299dd227c 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -335,7 +335,8 @@ public: /** Provides access to the document undo/redo interface */ - IDocumentUndoRedo* getIDocumentUndoRedoAccess(); + IDocumentUndoRedo const& GetIDocumentUndoRedo() const; + IDocumentUndoRedo & GetIDocumentUndoRedo(); // --> OD 2007-11-14 #i83479# const IDocumentListItems* getIDocumentListItemsAccess() const; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 553324f64d1d..ed561397f353 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -2451,7 +2451,7 @@ bool SwDoc::RestoreInvisibleContent() { bool bRet = false; if (UNDO_UI_DELETE_INVISIBLECNTNT == - GetIDocumentUndoRedo().GetUndoIds(0, 0)) + GetIDocumentUndoRedo().GetLastUndoInfo(0)) { SwPaM aPam( GetNodes().GetEndOfPostIts() ); SwUndoIter aUndoIter( &aPam ); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 9d4be3861856..ccd953e27739 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2365,7 +2365,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) if( pUndo ) { delete pUndo; - if (UNDO_REDLINE == GetIDocumentUndoRedo().GetUndoIds(NULL, NULL)) + if (UNDO_REDLINE == GetIDocumentUndoRedo().GetLastUndoInfo(0)) { SwUndoRedline *const pU = static_cast<SwUndoRedline*>( GetIDocumentUndoRedo().RemoveLastUndo(UNDO_REDLINE)); diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx index c3614fca091a..5b8d8b8e3230 100644 --- a/sw/source/core/edit/edundo.cxx +++ b/sw/source/core/edit/edundo.cxx @@ -70,7 +70,7 @@ BOOL SwEditShell::Undo( SwUndoId nUndoId, USHORT nCnt ) // JP 02.04.98: Cursor merken - beim Auto-Format/-Korrektur // soll dieser wieder an die Position SwUndoId const nLastUndoId = - GetDoc()->GetIDocumentUndoRedo().GetUndoIds(NULL, NULL); + GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(0); BOOL bRestoreCrsr = 1 == nCnt && ( UNDO_AUTOFORMAT == nLastUndoId || UNDO_AUTOCORRECT == nLastUndoId ); Push(); diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index 072d65229058..83f231fd6f6b 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -298,14 +298,14 @@ SwUndoId SwEditShell::EndUndo(SwUndoId eUndoId, { return GetDoc()->GetIDocumentUndoRedo().EndUndo(eUndoId, pRewriter); } -SwUndoId SwEditShell::GetUndoIds(String* pStr,SwUndoIds *pUndoIds) const -{ return GetDoc()->GetIDocumentUndoRedo().GetUndoIds(pStr,pUndoIds); } +SwUndoId SwEditShell::GetLastUndoInfo(::rtl::OUString *const o_pStr) const +{ return GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(o_pStr); } -SwUndoId SwEditShell::GetRedoIds(String* pStr,SwUndoIds *pRedoIds) const -{ return GetDoc()->GetIDocumentUndoRedo().GetRedoIds(pStr,pRedoIds); } +SwUndoId SwEditShell::GetFirstRedoInfo(::rtl::OUString *const o_pStr) const +{ return GetDoc()->GetIDocumentUndoRedo().GetFirstRedoInfo(o_pStr); } -SwUndoId SwEditShell::GetRepeatIds(String* pStr) const -{ return GetDoc()->GetIDocumentUndoRedo().GetRepeatIds(pStr); } +SwUndoId SwEditShell::GetRepeatInfo(::rtl::OUString *const o_pStr) const +{ return GetDoc()->GetIDocumentUndoRedo().GetRepeatInfo(o_pStr); } diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index dd9b8d9f08ed..1a80a96e44b2 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -770,7 +770,7 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, sal_Bool bAnchVali GetDoc()->GetIDocumentUndoRedo().DoesUndo(); if (bDoesUndo && (UNDO_INSLAYFMT == - GetDoc()->GetIDocumentUndoRedo().GetUndoIds(NULL, NULL))) + GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(0))) { GetDoc()->GetIDocumentUndoRedo().DoUndo(false); } diff --git a/sw/source/core/inc/UndoManager.hxx b/sw/source/core/inc/UndoManager.hxx index 93b3cccb77aa..976d023905c5 100644 --- a/sw/source/core/inc/UndoManager.hxx +++ b/sw/source/core/inc/UndoManager.hxx @@ -69,15 +69,15 @@ public: virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const*const pRewriter); virtual void DelAllUndoObj(); - virtual SwUndoId GetUndoIds(String *const o_pStr, - SwUndoIds *const o_pUndoIds) const; + virtual SwUndoId GetLastUndoInfo(::rtl::OUString *const o_pStr) const; + virtual SwUndoComments_t GetUndoComments() const; virtual SwUndo* RemoveLastUndo(SwUndoId const eUndoId); virtual bool HasTooManyUndos() const; virtual bool Redo(SwUndoIter & rUndoIter); - virtual SwUndoId GetRedoIds(String *const o_pStr, - SwUndoIds *const o_pRedoIds) const; + virtual SwUndoId GetFirstRedoInfo(::rtl::OUString *const o_pStr) const; + virtual SwUndoComments_t GetRedoComments() const; virtual bool Repeat(SwUndoIter & rUndoIter, sal_uInt16 const nRepeatCnt); - virtual SwUndoId GetRepeatIds(String *const o_pStr) const; + virtual SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const; virtual void AppendUndo(SwUndo *const pUndo); virtual void ClearRedo(); virtual bool IsUndoNodes(SwNodes const& rNodes) const; diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index a965239cef58..56f0bb048952 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -55,8 +55,6 @@ using namespace ::com::sun::star; #define UNDO_ACTION_LIMIT (USHRT_MAX - 1000) -SV_IMPL_PTRARR( SwUndoIds, SwUndoIdAndNamePtr ) - //#define _SHOW_UNDORANGE #ifdef _SHOW_UNDORANGE @@ -708,6 +706,7 @@ UndoManager::EndUndo(SwUndoId const i_eUndoId, SwRewriter const*const pRewriter) -----------------------------------------------------------------------*/ +typedef ::std::pair<SwUndoId, ::rtl::OUString> IdAndName_t; /** Returns id and comment for a certain undo object in an undo stack. @@ -730,9 +729,9 @@ UndoManager::EndUndo(SwUndoId const i_eUndoId, SwRewriter const*const pRewriter) @param rUndos the undo stack @param nPos position of the undo object to query - @return SwUndoIdAndName object containing the query result + @return IdAndName_t object containing the query result */ -SwUndoIdAndName * lcl_GetUndoIdAndName(const SwUndos & rUndos, sal_uInt16 nPos ) +IdAndName_t lcl_GetUndoIdAndName(const SwUndos & rUndos, sal_uInt16 nPos) { SwUndo * pUndo = rUndos[ nPos ]; SwUndoId nId = UNDO_EMPTY; @@ -834,38 +833,41 @@ SwUndoIdAndName * lcl_GetUndoIdAndName(const SwUndos & rUndos, sal_uInt16 nPos ) sStr = pUndo->GetComment(); } - return new SwUndoIdAndName(nId, &sStr); + return IdAndName_t(nId, sStr); } -SwUndoId -UndoManager::GetUndoIds(String *const o_pStr, SwUndoIds *const o_pUndoIds) const + +SwUndoId UndoManager::GetLastUndoInfo(::rtl::OUString *const o_pStr) const { + if (!m_nUndoPos) + { + return UNDO_EMPTY; + } + + IdAndName_t const idAndName(lcl_GetUndoIdAndName(*m_pUndos, m_nUndoPos-1)); + + if (o_pStr) + { + *o_pStr = idAndName.second; + } + + return idAndName.first; +} + + +SwUndoComments_t UndoManager::GetUndoComments() const +{ + SwUndoComments_t ret; int nTmpPos = m_nUndoPos - 1; - SwUndoId nId = UNDO_EMPTY; while (nTmpPos >= 0) { SwUndo *const pUndo = (*m_pUndos)[ static_cast<USHORT>(nTmpPos) ]; - SwUndoIdAndName *const pIdAndName = - lcl_GetUndoIdAndName( *m_pUndos, static_cast<sal_uInt16>(nTmpPos) ); - - if (nTmpPos == m_nUndoPos - 1) - { - nId = pIdAndName->GetUndoId(); - - if (o_pStr) - { - *o_pStr = *pIdAndName->GetUndoStr(); - } - } + IdAndName_t const idAndName( + lcl_GetUndoIdAndName(*m_pUndos, static_cast<sal_uInt16>(nTmpPos))); - if (o_pUndoIds) - { - o_pUndoIds->Insert(pIdAndName, o_pUndoIds->Count()); - } - else - break; + ret.push_back(idAndName.second); if (pUndo->GetId() == UNDO_END) { @@ -875,7 +877,7 @@ UndoManager::GetUndoIds(String *const o_pStr, SwUndoIds *const o_pUndoIds) const nTmpPos--; } - return nId; + return ret; } bool UndoManager::HasTooManyUndos() const @@ -953,35 +955,36 @@ bool UndoManager::Redo(SwUndoIter & rUndoIter) } -SwUndoId -UndoManager::GetRedoIds(String *const o_pStr, SwUndoIds *const o_pRedoIds) const +SwUndoId UndoManager::GetFirstRedoInfo(::rtl::OUString *const o_pStr) const { + if (m_pUndos->Count() == m_nUndoPos) + { + return UNDO_EMPTY; + } + + IdAndName_t const idAndName(lcl_GetUndoIdAndName(*m_pUndos, m_nUndoPos)); + + if (o_pStr) + { + *o_pStr = idAndName.second; + } + + return idAndName.first; +} + + +SwUndoComments_t UndoManager::GetRedoComments() const +{ + SwUndoComments_t ret; sal_uInt16 nTmpPos = m_nUndoPos; - SwUndoId nId = UNDO_EMPTY; while (nTmpPos < m_pUndos->Count()) { SwUndo *const pUndo = (*m_pUndos)[nTmpPos]; - SwUndoIdAndName *const pIdAndName = - lcl_GetUndoIdAndName(*m_pUndos, nTmpPos); - - if (nTmpPos == m_nUndoPos) - { - nId = pIdAndName->GetUndoId(); - - if (o_pStr) - { - *o_pStr = *pIdAndName->GetUndoStr(); - } - } + IdAndName_t const idAndName(lcl_GetUndoIdAndName(*m_pUndos, nTmpPos)); - if (o_pRedoIds) - { - o_pRedoIds->Insert(pIdAndName, o_pRedoIds->Count()); - } - else - break; + ret.push_back(idAndName.second); if (pUndo->GetId() == UNDO_START) { @@ -992,7 +995,7 @@ UndoManager::GetRedoIds(String *const o_pStr, SwUndoIds *const o_pRedoIds) const nTmpPos++; } - return nId; + return ret; } /**************** REPEAT ******************/ @@ -1057,10 +1060,9 @@ bool UndoManager::Repeat(SwUndoIter & rUndoIter, sal_uInt16 const nRepeatCnt) } -SwUndoId -UndoManager::GetRepeatIds(String *const o_pStr) const +SwUndoId UndoManager::GetRepeatInfo(::rtl::OUString *const o_pStr) const { - SwUndoId const nRepeatId = GetUndoIds(o_pStr, 0); + SwUndoId const nRepeatId = GetLastUndoInfo(o_pStr); if( REPEAT_START <= nRepeatId && REPEAT_END > nRepeatId ) { return nRepeatId; @@ -1092,17 +1094,3 @@ SwUndo* UndoManager::RemoveLastUndo(SwUndoId const eUndoId) } // namespace sw -// SwUndoIdAndName /////////////////////////////////////////////////////// - -SwUndoIdAndName::SwUndoIdAndName( SwUndoId nId, const String* pStr ) - : eUndoId( nId ), pUndoStr( pStr ? new String( *pStr ) : 0 ) -{ -} - -SwUndoIdAndName::~SwUndoIdAndName() -{ - delete pUndoStr; -} - - - diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 54a3f82e901a..e7addbff63e0 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -2732,8 +2732,10 @@ IDocumentContentOperations* ViewShell::getIDocumentContentOperations() { return IDocumentStylePoolAccess* ViewShell::getIDocumentStylePoolAccess() { return pDoc; } const IDocumentStatistics* ViewShell::getIDocumentStatistics() const { return pDoc; } -IDocumentUndoRedo* ViewShell::getIDocumentUndoRedoAccess() -{ return &pDoc->GetIDocumentUndoRedo(); } +IDocumentUndoRedo & ViewShell::GetIDocumentUndoRedo() +{ return pDoc->GetIDocumentUndoRedo(); } +IDocumentUndoRedo const& ViewShell::GetIDocumentUndoRedo() const +{ return pDoc->GetIDocumentUndoRedo(); } // --> OD 2007-11-14 #i83479# const IDocumentListItems* ViewShell::getIDocumentListItemsAccess() const diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 90eeb6ee1982..e5444d286230 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -2938,8 +2938,11 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, SwNewDBMgr* pWorkDBMgr = pWorkDoc->GetNewDBMgr(); pWorkDoc->SetNewDBMgr( this ); pWorkDoc->EmbedAllLinks(); - if(UNDO_UI_DELETE_INVISIBLECNTNT == rWorkShell.GetUndoIds()) + if (UNDO_UI_DELETE_INVISIBLECNTNT == + rWorkShell.GetLastUndoInfo(0)) + { rWorkShell.Undo(); + } // #i69485# lock fields to prevent access to the result set while calculating layout rWorkShell.LockExpFlds(); // create a layout diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 5049220b1b5a..792c022a4995 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -4320,8 +4320,11 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) !GetConnectMetaFile() && rSh.VisArea().IsInside( aDocPt )) { - if( UNDO_INS_FROM_SHADOWCRSR == rSh.GetUndoIds() ) + if (UNDO_INS_FROM_SHADOWCRSR == + rSh.GetLastUndoInfo(0)) + { rSh.Undo(); + } SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCrsrFillMode(); rSh.SetShadowCrsrPos( aDocPt, eMode ); } diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index db68e952468b..494f72051476 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -1448,7 +1448,7 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) sal_uInt16 nCount = pUndoManager->GetUndoActionCount(); if ( nCount ) pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); - else if (UNDO_EMPTY != rSh.GetUndoIds()) + else if (UNDO_EMPTY != rSh.GetLastUndoInfo(0)) { rSet.Put( SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::UNDO)) ); } @@ -1461,7 +1461,7 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) sal_uInt16 nCount = pUndoManager->GetRedoActionCount(); if ( nCount ) pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); - else if (UNDO_EMPTY != rSh.GetRedoIds()) + else if (UNDO_EMPTY != rSh.GetFirstRedoInfo(0)) { rSet.Put(SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::REDO)) ); } @@ -1498,12 +1498,13 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) SfxStringListItem aItem( nWhich ); if ((nWhich == SID_GETUNDOSTRINGS) && - (UNDO_EMPTY != rSh.GetUndoIds())) + (UNDO_EMPTY != rSh.GetLastUndoInfo(0))) { rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); } else if ((nWhich == SID_GETREDOSTRINGS) && - (UNDO_EMPTY != rSh.GetRedoIds())) + (UNDO_EMPTY != + rSh.GetFirstRedoInfo(0))) { rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); } diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 1ab6cdfde351..dafd52d54774 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -543,7 +543,7 @@ void SwBaseShell::StateUndo(SfxItemSet &rSet) { case SID_UNDO: { - if (UNDO_EMPTY != rSh.GetUndoIds()) + if (UNDO_EMPTY != rSh.GetLastUndoInfo(0)) { rSet.Put( SfxStringItem(nWhich, rSh.GetDoString(SwWrtShell::UNDO))); @@ -554,7 +554,7 @@ void SwBaseShell::StateUndo(SfxItemSet &rSet) } case SID_REDO: { - if (UNDO_EMPTY != rSh.GetRedoIds()) + if (UNDO_EMPTY != rSh.GetFirstRedoInfo(0)) { rSet.Put(SfxStringItem(nWhich, rSh.GetDoString(SwWrtShell::REDO))); @@ -565,9 +565,9 @@ void SwBaseShell::StateUndo(SfxItemSet &rSet) } case SID_REPEAT: { // Repeat nur moeglich wenn kein REDO moeglich - UI-Restriktion - if ((rSh.GetRedoIds() == UNDO_EMPTY) && + if ((UNDO_EMPTY == rSh.GetFirstRedoInfo(0)) && !rSh.IsSelFrmMode() && - (UNDO_EMPTY != rSh.GetRepeatIds())) + (UNDO_EMPTY != rSh.GetRepeatInfo(0))) { rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString())); } @@ -577,7 +577,7 @@ void SwBaseShell::StateUndo(SfxItemSet &rSet) } case SID_GETUNDOSTRINGS: - if (UNDO_EMPTY != rSh.GetUndoIds()) + if (UNDO_EMPTY != rSh.GetLastUndoInfo(0)) { SfxStringListItem aStrLst( nWhich ); rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst ); @@ -588,7 +588,7 @@ void SwBaseShell::StateUndo(SfxItemSet &rSet) break; case SID_GETREDOSTRINGS: - if (UNDO_EMPTY != rSh.GetRedoIds()) + if (UNDO_EMPTY != rSh.GetFirstRedoInfo(0)) { SfxStringListItem aStrLst( nWhich ); rSh.GetDoStrings( SwWrtShell::REDO, aStrLst ); diff --git a/sw/source/ui/table/chartins.cxx b/sw/source/ui/table/chartins.cxx index a11f04d55656..50d22e2d7804 100644 --- a/sw/source/ui/table/chartins.cxx +++ b/sw/source/ui/table/chartins.cxx @@ -53,9 +53,7 @@ #include <edtwin.hxx> #include <cmdid.h> -#ifndef _CHARTINS_HRC #include <chartins.hrc> -#endif #include <anchoredobject.hxx> #include <sot/clsids.hxx> @@ -259,7 +257,7 @@ void SwInsertChart(Window* pParent, SfxBindings* pBindings ) if( nDialogRet == ui::dialogs::ExecutableDialogResults::CANCEL ) { rWrtShell.Undo(); - rWrtShell.getIDocumentUndoRedoAccess()->ClearRedo(); + rWrtShell.GetIDocumentUndoRedo().ClearRedo(); } else { diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index 40ba6e3c6d2d..0f449ebabe5e 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <com/sun/star/linguistic2/XThesaurus.hpp> #include <com/sun/star/uno/Sequence.hxx> @@ -49,28 +50,20 @@ #include <tox.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/app.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <wrtsh.hxx> -#ifndef _BASESH_HXX #include <basesh.hxx> -#endif #include <uitool.hxx> #include <viewopt.hxx> #include <tablemgr.hxx> #include <pagedesc.hxx> -#ifndef _WVIEW_HXX #include <wview.hxx> -#endif #include <globdoc.hxx> #include <svl/stritem.hxx> #include <unotools/moduleoptions.hxx> #include <svl/visitem.hxx> -#ifndef _CMDID_H #include <cmdid.h> -#endif #include <IDocumentRedlineAccess.hxx> @@ -163,7 +156,8 @@ void SwView::GetState(SfxItemSet &rSet) break; case SID_CLEARHISTORY: { - rSet.Put(SfxBoolItem(nWhich, pWrtShell->GetUndoIds() != UNDO_EMPTY)); + rSet.Put(SfxBoolItem(nWhich, + pWrtShell->GetLastUndoInfo(0) != UNDO_EMPTY)); } break; case SID_UNDO: diff --git a/sw/source/ui/wrtsh/makefile.mk b/sw/source/ui/wrtsh/makefile.mk index baeb3acd25e5..0304667870fa 100644 --- a/sw/source/ui/wrtsh/makefile.mk +++ b/sw/source/ui/wrtsh/makefile.mk @@ -54,7 +54,8 @@ SLOFILES = \ EXCEPTIONSFILES = \ $(SLO)$/wrtsh1.obj \ - $(SLO)$/wrtsh2.obj + $(SLO)$/wrtsh2.obj \ + $(SLO)$/wrtundo.obj \ # --- Tagets ------------------------------------------------------- diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx index 0666fa9de64c..89993926feb5 100644 --- a/sw/source/ui/wrtsh/wrtsh2.cxx +++ b/sw/source/ui/wrtsh/wrtsh2.cxx @@ -481,8 +481,10 @@ void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk, // the undostack. Then the change of the section dont create // any undoobject. - BUG 69145 BOOL bDoesUndo = DoesUndo(); - if( UNDO_INSSECTION != GetUndoIds() ) - DoUndo( FALSE ); + if (UNDO_INSSECTION != GetLastUndoInfo(0)) + { + DoUndo(false); + } UpdateSection( GetSectionFmtPos( *pIns->GetFmt() ), aSection ); DoUndo( bDoesUndo ); } diff --git a/sw/source/ui/wrtsh/wrtundo.cxx b/sw/source/ui/wrtsh/wrtundo.cxx index dca0c9a82c38..1e38985e0ec5 100644 --- a/sw/source/ui/wrtsh/wrtundo.cxx +++ b/sw/source/ui/wrtsh/wrtundo.cxx @@ -36,11 +36,10 @@ #include <svl/slstitm.hxx> #include <wrtsh.hxx> #include <swundo.hxx> // fuer Undo-Ids +#include <IDocumentUndoRedo.hxx> #include <swdtflvr.hxx> -#ifndef _WRTSH_HRC #include <wrtsh.hrc> -#endif #include <sfx2/sfx.hrc> @@ -113,71 +112,68 @@ void SwWrtShell::Do( DoType eDoType, USHORT nCnt ) String SwWrtShell::GetDoString( DoType eDoType ) const { - String aStr, aUndoStr; + ::rtl::OUString aUndoStr; USHORT nResStr = STR_UNDO; switch( eDoType ) { case UNDO: nResStr = STR_UNDO; - GetUndoIds(& aUndoStr, 0); + GetLastUndoInfo(& aUndoStr); break; case REDO: nResStr = STR_REDO; - GetRedoIds(& aUndoStr, 0); + GetFirstRedoInfo(& aUndoStr); break; default:;//prevent warning } - aStr.Insert( String(ResId( nResStr, *SFX_APP()->GetSfxResManager())), 0 ); - aStr += aUndoStr; + ::rtl::OUStringBuffer buf( + String(ResId(nResStr, *SFX_APP()->GetSfxResManager())) ); + buf.append(aUndoStr); - return aStr; + return buf.makeStringAndClear(); } USHORT 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 - { - ASSERT( !this, "no Undo/Redo Test set" ); - } - sList += '\n'; + OSL_ENSURE(comments[i].getLength(), "no Undo/Redo Text set"); + buf.append(comments[i]); + buf.append(sal_Unicode('\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; - GetRepeatIds(& aUndoStr); + ::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(ResId(STR_REPEAT, *SFX_APP()->GetSfxResManager())) ); + buf.append(str); + return buf.makeStringAndClear(); } |