diff options
author | Michael Stahl <mst@openoffice.org> | 2010-11-25 14:31:10 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2010-11-25 14:31:10 +0100 |
commit | e4bb13bc4e808118ef1f73503cdc75e16c873191 (patch) | |
tree | 856a4a9a315e3f4e6e8ceb978ef5a104cd4baf0a | |
parent | 5a890bc44e8053880ad445d60023e95c61357a52 (diff) |
unodapi: #i115383#: remove clutter from IDocumentUndoRedo:
remove methods GetUndoIdsStr(), GetRedoIdsStr(), GetRepeatIdsStr().
remove unused parameter from GetRepeatIds().
-rw-r--r-- | sw/inc/IDocumentUndoRedo.hxx | 37 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 12 | ||||
-rw-r--r-- | sw/source/core/edit/edws.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/inc/UndoManager.hxx | 9 | ||||
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 78 | ||||
-rwxr-xr-x | sw/source/ui/shells/annotsh.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/shells/basesh.cxx | 18 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/wrtundo.cxx | 7 |
8 files changed, 41 insertions, 158 deletions
diff --git a/sw/inc/IDocumentUndoRedo.hxx b/sw/inc/IDocumentUndoRedo.hxx index 3777e181e089..191d372131ed 100644 --- a/sw/inc/IDocumentUndoRedo.hxx +++ b/sw/inc/IDocumentUndoRedo.hxx @@ -123,15 +123,6 @@ public: virtual SwUndoId GetUndoIds(String *const o_pStr, SwUndoIds *const o_pUndoIds) const = 0; - /** Get Ids and comments of Undo actions. - @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 comment of last Undo action, or empty string if none. - */ - virtual String GetUndoIdsStr(String *const o_pStr, - SwUndoIds *const o_pUndoIds) const = 0; - /** Is there an Undo action with the given Id, or a Start/End action with the given Id as UserId? */ @@ -168,38 +159,18 @@ public: virtual SwUndoId GetRedoIds(String *const o_pStr, SwUndoIds *const o_pRedoIds) const = 0; - /** Get Ids and comments of Redo actions. - @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 comment of first Redo action, or empty string if none. - */ - virtual String GetRedoIdsStr(String *const o_pStr, - SwUndoIds *const o_pRedoIds) 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; - /** Get Ids and comments of Undo actions. - @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. + /** 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 + if it is Repeat capable. @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, - SwUndoIds *const o_pUndoIds) const = 0; - - /** Get Ids and comments of Undo actions. - @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 comment of last Undo action (sometimes). - */ - virtual String GetRepeatIdsStr(String *const o_pStr, - SwUndoIds *const pUndoIds) const = 0; + virtual SwUndoId GetRepeatIds(String *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 85201ff9b5b9..544c68ed0327 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -533,27 +533,17 @@ 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 ); - // liefert die Id der letzten undofaehigen Aktion zurueck - // fuellt ggf. VARARR mit User-UndoIds SwUndoId GetUndoIds( String* pUndoStr = 0, SwUndoIds *pUndoIds = 0) const; - String GetUndoIdsStr( String* pUndoStr = 0, SwUndoIds *pUndoIds = 0) const; // abfragen/setzen der Anzahl von wiederherstellbaren Undo-Actions static USHORT GetUndoActionCount(); static void SetUndoActionCount( USHORT nNew ); // Redo - // liefert die Id der letzten Redofaehigen Aktion zurueck - // fuellt ggf. VARARR mit RedoIds SwUndoId GetRedoIds( String* pRedoStr = 0, SwUndoIds *pRedoIds = 0) const; - String GetRedoIdsStr( String* pRedoStr = 0, SwUndoIds *pRedoIds = 0) const; // Repeat - // liefert die Id der letzten Repeatfaehigen Aktion zurueck - // fuellt ggf. VARARR mit RedoIds - SwUndoId GetRepeatIds( String* pRepeatStr = 0, SwUndoIds *pRedoIds = 0) const; - String GetRepeatIdsStr( String* pRepeatStr = 0, - SwUndoIds *pRedoIds = 0) const; + SwUndoId GetRepeatIds( String* pRepeatStr = 0) const; // 0 letzte Aktion, sonst Aktionen bis zum Start der Klammerung nUndoId // mit KillPaMs, ClearMark diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index 88c6575a4c2d..072d65229058 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -297,35 +297,15 @@ SwUndoId SwEditShell::EndUndo(SwUndoId eUndoId, const SwRewriter *pRewriter) { return GetDoc()->GetIDocumentUndoRedo().EndUndo(eUndoId, pRewriter); } -// liefert die Id der letzten undofaehigen Aktion zurueck -// fuellt ggf. VARARR mit sdbcx::User-UndoIds - SwUndoId SwEditShell::GetUndoIds(String* pStr,SwUndoIds *pUndoIds) const { return GetDoc()->GetIDocumentUndoRedo().GetUndoIds(pStr,pUndoIds); } -String SwEditShell::GetUndoIdsStr(String* pStr,SwUndoIds *pUndoIds) const -{ return GetDoc()->GetIDocumentUndoRedo().GetUndoIdsStr(pStr,pUndoIds); } - -// liefert die Id der letzten Redofaehigen Aktion zurueck -// fuellt ggf. VARARR mit RedoIds - - SwUndoId SwEditShell::GetRedoIds(String* pStr,SwUndoIds *pRedoIds) const { return GetDoc()->GetIDocumentUndoRedo().GetRedoIds(pStr,pRedoIds); } -String SwEditShell::GetRedoIdsStr(String* pStr,SwUndoIds *pRedoIds) const -{ return GetDoc()->GetIDocumentUndoRedo().GetRedoIdsStr(pStr,pRedoIds); } - -// liefert die Id der letzten Repeatfaehigen Aktion zurueck -// fuellt ggf. VARARR mit RedoIds - - -SwUndoId SwEditShell::GetRepeatIds(String* pStr, SwUndoIds *pRedoIds) const -{ return GetDoc()->GetIDocumentUndoRedo().GetRepeatIds(pStr,pRedoIds); } - -String SwEditShell::GetRepeatIdsStr(String* pStr, SwUndoIds *pRedoIds) const -{ return GetDoc()->GetIDocumentUndoRedo().GetRepeatIdsStr(pStr,pRedoIds); } +SwUndoId SwEditShell::GetRepeatIds(String* pStr) const +{ return GetDoc()->GetIDocumentUndoRedo().GetRepeatIds(pStr); } diff --git a/sw/source/core/inc/UndoManager.hxx b/sw/source/core/inc/UndoManager.hxx index 736cc80f3909..e1fc467027f8 100644 --- a/sw/source/core/inc/UndoManager.hxx +++ b/sw/source/core/inc/UndoManager.hxx @@ -64,8 +64,6 @@ public: virtual void DelAllUndoObj(); virtual SwUndoId GetUndoIds(String *const o_pStr, SwUndoIds *const o_pUndoIds) const; - virtual String GetUndoIdsStr(String *const o_pStr, - SwUndoIds *const o_pUndoIds) const; virtual bool HasUndoId(SwUndoId const eId) const; virtual const SwNodes* GetUndoNds() const; virtual SwUndo* RemoveLastUndo(SwUndoId const eUndoId); @@ -73,13 +71,8 @@ public: virtual bool Redo(SwUndoIter & rUndoIter); virtual SwUndoId GetRedoIds(String *const o_pStr, SwUndoIds *const o_pRedoIds) const; - virtual String GetRedoIdsStr(String *const o_pStr, - SwUndoIds *const o_pRedoIds) const; virtual bool Repeat(SwUndoIter & rUndoIter, sal_uInt16 const nRepeatCnt); - virtual SwUndoId GetRepeatIds(String *const o_pStr, - SwUndoIds *const o_pUndoIds) const; - virtual String GetRepeatIdsStr(String *const o_pStr, - SwUndoIds *const o_pUndoIds) const; + virtual SwUndoId GetRepeatIds(String *const o_pStr) const; virtual void AppendUndo(SwUndo *const pUndo); virtual void ClearRedo(); virtual void setUndoNoModifiedPosition(SwUndoNoModifiedPosition const nPos); diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 4b1700aa96b9..1fadb50fa121 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -40,9 +40,7 @@ #include <undobj.hxx> #include <rolbck.hxx> #include <docary.hxx> -#ifndef _UNDO_HRC #include <undo.hrc> -#endif using namespace ::com::sun::star; @@ -664,28 +662,6 @@ UndoManager::EndUndo(SwUndoId const i_eUndoId, SwRewriter const*const pRewriter) return eUndoId; } -// liefert die Id der letzten Undofaehigen Aktion zurueck oder 0 -// fuellt ggf. VARARR mit User-UndoIds - -String -UndoManager::GetUndoIdsStr(String *const o_pStr, - SwUndoIds *const o_pUndoIds) const -{ - String aTmpStr; - - if (o_pStr != NULL) - { - GetUndoIds(o_pStr, o_pUndoIds); - aTmpStr = *o_pStr; - } - else - { - GetUndoIds( &aTmpStr, o_pUndoIds); - } - - return aTmpStr; -} - /*-- 24.11.2004 16:11:21--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -951,26 +927,6 @@ bool UndoManager::Redo(SwUndoIter & rUndoIter) } -// liefert die Id der letzten Redofaehigen Aktion zurueck oder 0 -// fuellt ggf. VARARR mit User-RedoIds - -String UndoManager::GetRedoIdsStr( String* pStr, SwUndoIds *pRedoIds ) const -{ - String aTmpStr; - - if (pStr != NULL) - { - GetRedoIds( pStr, pRedoIds ); - aTmpStr = *pStr; - } - else - GetRedoIds( &aTmpStr, pRedoIds ); - - - return aTmpStr; -} - - SwUndoId UndoManager::GetRedoIds( String* pStr, SwUndoIds *pRedoIds ) const { sal_uInt16 nTmpPos = nUndoPos; @@ -1059,39 +1015,19 @@ bool UndoManager::Repeat(SwUndoIter & rUndoIter, sal_uInt16 const nRepeatCnt) return TRUE; } -// liefert die Id der letzten Repeatfaehigen Aktion zurueck oder 0 -// fuellt ggf. VARARR mit User-RedoIds -String -UndoManager::GetRepeatIdsStr(String *const o_pStr, - SwUndoIds *const o_pRepeatIds) const +SwUndoId +UndoManager::GetRepeatIds(String *const o_pStr) const { - String aTmpStr; - SwUndoId nId; - - if (o_pStr != NULL) + SwUndoId const nRepeatId = GetUndoIds(o_pStr, 0); + if( REPEAT_START <= nRepeatId && REPEAT_END > nRepeatId ) { - nId = GetRepeatIds(o_pStr, o_pRepeatIds); - aTmpStr = *o_pStr; + return nRepeatId; } - else + if (o_pStr) // not repeatable -> clear comment { - nId = GetRepeatIds(&aTmpStr, o_pRepeatIds); + *o_pStr = String(); } - - if (nId <= UNDO_END) - return String(); - - return aTmpStr; -} - -SwUndoId -UndoManager::GetRepeatIds(String *const o_pStr, - SwUndoIds *const o_pRepeatIds) const -{ - SwUndoId nRepeatId = GetUndoIds( o_pStr, o_pRepeatIds ); - if( REPEAT_START <= nRepeatId && REPEAT_END > nRepeatId ) - return nRepeatId; return UNDO_EMPTY; } diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 8115b4ec7438..3df64efba322 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -1448,8 +1448,10 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) sal_uInt16 nCount = pUndoManager->GetUndoActionCount(); if ( nCount ) pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); - else if( rSh.GetUndoIds() ) + else if (UNDO_EMPTY != rSh.GetUndoIds()) + { rSet.Put( SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::UNDO)) ); + } else rSet.DisableItem(nWhich); break; @@ -1459,8 +1461,10 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) sal_uInt16 nCount = pUndoManager->GetRedoActionCount(); if ( nCount ) pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); - else if(rSh.GetRedoIds()) + else if (UNDO_EMPTY != rSh.GetRedoIds()) + { rSet.Put(SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::REDO)) ); + } else rSet.DisableItem(nWhich); break; @@ -1493,11 +1497,13 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) } SfxStringListItem aItem( nWhich ); - if( nWhich == SID_GETUNDOSTRINGS && rSh.GetUndoIds() ) + if ((nWhich == SID_GETUNDOSTRINGS) && + (UNDO_EMPTY != rSh.GetUndoIds())) { rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); } - else if( nWhich == SID_GETREDOSTRINGS && rSh.GetRedoIds() ) + else if ((nWhich == SID_GETREDOSTRINGS) && + (UNDO_EMPTY != rSh.GetRedoIds())) { rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); } diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 15c97f67c847..039c40fb505f 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -553,35 +553,41 @@ void SwBaseShell::StateUndo(SfxItemSet &rSet) { case SID_UNDO: { - if( rSh.GetUndoIds() ) + if (UNDO_EMPTY != rSh.GetUndoIds()) + { rSet.Put( SfxStringItem(nWhich, rSh.GetDoString(SwWrtShell::UNDO))); + } else rSet.DisableItem(nWhich); break; } case SID_REDO: { - if(rSh.GetRedoIds()) + if (UNDO_EMPTY != rSh.GetRedoIds()) + { rSet.Put(SfxStringItem(nWhich, rSh.GetDoString(SwWrtShell::REDO))); + } else rSet.DisableItem(nWhich); break; } case SID_REPEAT: { // Repeat nur moeglich wenn kein REDO moeglich - UI-Restriktion - if(rSh.GetRedoIds() == UNDO_EMPTY && + if ((rSh.GetRedoIds() == UNDO_EMPTY) && !rSh.IsSelFrmMode() && - rSh.GetRepeatIds() ) + (UNDO_EMPTY != rSh.GetRepeatIds())) + { rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString())); + } else rSet.DisableItem(nWhich); break; } case SID_GETUNDOSTRINGS: - if( rSh.GetUndoIds() ) + if (UNDO_EMPTY != rSh.GetUndoIds()) { SfxStringListItem aStrLst( nWhich ); rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst ); @@ -592,7 +598,7 @@ void SwBaseShell::StateUndo(SfxItemSet &rSet) break; case SID_GETREDOSTRINGS: - if( rSh.GetRedoIds() ) + if (UNDO_EMPTY != rSh.GetRedoIds()) { SfxStringListItem aStrLst( nWhich ); rSh.GetDoStrings( SwWrtShell::REDO, aStrLst ); diff --git a/sw/source/ui/wrtsh/wrtundo.cxx b/sw/source/ui/wrtsh/wrtundo.cxx index f3c62f9f9dff..dca0c9a82c38 100644 --- a/sw/source/ui/wrtsh/wrtundo.cxx +++ b/sw/source/ui/wrtsh/wrtundo.cxx @@ -119,11 +119,11 @@ String SwWrtShell::GetDoString( DoType eDoType ) const { case UNDO: nResStr = STR_UNDO; - aUndoStr = GetUndoIdsStr(); + GetUndoIds(& aUndoStr, 0); break; case REDO: nResStr = STR_REDO; - aUndoStr = GetRedoIdsStr(); + GetRedoIds(& aUndoStr, 0); break; default:;//prevent warning } @@ -168,7 +168,8 @@ USHORT SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) cons String SwWrtShell::GetRepeatString() const { String aStr; - String aUndoStr = GetRepeatIdsStr(); + String aUndoStr; + GetRepeatIds(& aUndoStr); if (aUndoStr.Len() > 0) { |