officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 10 + scripting/workben/bindings/writermenubar.xml | 2 sw/inc/cmdid.h | 2 sw/inc/swcommands.h | 2 sw/sdi/_viewsh.sdi | 12 + sw/sdi/swriter.sdi | 52 ++++++ sw/source/ui/app/mn.src | 12 + sw/source/ui/uiview/view2.cxx | 75 +++++++--- sw/source/ui/uiview/viewstat.cxx | 23 ++- sw/uiconfig/sglobal/menubar/menubar.xml | 2 sw/uiconfig/swform/menubar/menubar.xml | 2 sw/uiconfig/swreport/menubar/menubar.xml | 2 sw/uiconfig/swriter/menubar/menubar.xml | 2 sw/uiconfig/swxform/menubar/menubar.xml | 2 14 files changed, 180 insertions(+), 20 deletions(-)
New commits: commit a0a58556f36cbf396f5139e18881720ed838ddd4 Author: Muhammad Haggag <mhag...@gmail.com> Date: Fri Nov 23 20:15:41 2012 +0200 fdo#48317 - Support jumping to next/previous change Added two new writer commands: NextTrackedChange (FN_REDLINE_NEXT_CHANGE) and PreviousTrackedChange (FN_REDLINE_PREV_CHANGE). Rewrote the logic for Accept/Reject change (FN_REDLINE_ACCEPT_DIRECT and FN_REDLINE_REJECT_DIRECT) to work well with the newly introduced commands. Change-Id: I03d583bef4225409f69934f16db1854564c2db5f Reviewed-on: https://gerrit.libreoffice.org/1156 Reviewed-by: Bosdonnat Cedric <cedric.bosdon...@free.fr> Tested-by: Bosdonnat Cedric <cedric.bosdon...@free.fr> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index b1a231d..2fc7502 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -171,6 +171,16 @@ <value xml:lang="en-US">Accept Change</value> </prop> </node> + <node oor:name=".uno:NextTrackedChange" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Next Change</value> + </prop> + </node> + <node oor:name=".uno:PreviousTrackedChange" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Pr~evious Change</value> + </prop> + </node> <node oor:name=".uno:UpdateAllLinks" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Links</value> diff --git a/scripting/workben/bindings/writermenubar.xml b/scripting/workben/bindings/writermenubar.xml index c47edb4..9390954 100644 --- a/scripting/workben/bindings/writermenubar.xml +++ b/scripting/workben/bindings/writermenubar.xml @@ -88,6 +88,8 @@ <menu:menuseparator/> <menu:menuitem menu:id="slot:21829" menu:helpid="21829" menu:label="~Accept or Reject..."/> <menu:menuitem menu:id="slot:21827" menu:helpid="21827" menu:label="~Comment..."/> + <menu:menuitem menu:id="slot:21841" menu:helpid="21841" menu:label="~Next Change"/> + <menu:menuitem menu:id="slot:21842" menu:helpid="21842" menu:label="Pr~evious Change"/> <menu:menuseparator/> <menu:menuitem menu:id="slot:6587" menu:helpid="6587" menu:label="~Merge Document..."/> </menu:menupopup> diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 4660bae..524adcd 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -168,6 +168,8 @@ included in c-context files, so c++ style stuff will cause problems. #define FN_REDLINE_REJECT_DIRECT (FN_EDIT2 + 38) /* reject redline at current position*/ #define FN_REMOVE_HYPERLINK (FN_EDIT2 + 39) /* remove hyperlink attribute */ #define FN_COPY_HYPERLINK_LOCATION (FN_EDIT2 + 40) /* copy hyperlink URL to clipboard */ +#define FN_REDLINE_NEXT_CHANGE (FN_EDIT2 + 41) /* Go to the next change */ +#define FN_REDLINE_PREV_CHANGE (FN_EDIT2 + 42) /* Go to the previous change */ /*-------------------------------------------------------------------- Region: Edit diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h index 74a93ad..1037141 100644 --- a/sw/inc/swcommands.h +++ b/sw/inc/swcommands.h @@ -121,6 +121,8 @@ #define CMD_FN_HIDE_ALL_NOTES ".uno:HideAllNotes" #define CMD_FN_REDLINE_ACCEPT_DIRECT ".uno:AcceptTracedChange" #define CMD_FN_REDLINE_REJECT_DIRECT ".uno:RejectTracedChange" +#define CMD_FN_REDLINE_NEXT_CHANGE ".uno:NextTrackedChange" +#define CMD_FN_REDLINE_PREV_CHANGE ".uno:PreviousTrackedChange" #define CMD_FN_REMOVE_HYPERLINK ".uno:RemoveHyperlink" #define CMD_FN_COPY_HYPERLINK_LOCATION ".uno:CopyHyperlinkLocation" #define CMD_FN_HEADERFOOTER_EDIT ".uno:HeaderFooterEdit" diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index d4486af..605ce54 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -144,6 +144,18 @@ interface BaseTextEditView StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR"; ] + FN_REDLINE_NEXT_CHANGE + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR"; + ] + FN_REDLINE_PREV_CHANGE + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR"; + ] SID_DOCUMENT_COMPARE // status(play) [ diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index dc8f8bc..290f671 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -10215,6 +10215,58 @@ SfxVoidItem RejectTracedChange FN_REDLINE_REJECT_DIRECT ] //-------------------------------------------------------------------------- +SfxVoidItem NextTrackedChange FN_REDLINE_NEXT_CHANGE +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- +SfxVoidItem PreviousTrackedChange FN_REDLINE_PREV_CHANGE +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- SfxVoidItem RemoveHyperlink FN_REMOVE_HYPERLINK [ /* flags: */ diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src index 837fb1f..888b58e 100644 --- a/sw/source/ui/app/mn.src +++ b/sw/source/ui/app/mn.src @@ -239,6 +239,18 @@ location: <project>/uiconfig/[swriter|sweb|sglobal]/menubar/menubar.xml HelpId = CMD_FN_REDLINE_REJECT_DIRECT ; \ Text [ en-US ] = "Reject Change" ; \ }; \ + MenuItem \ + { \ + Identifier = FN_REDLINE_NEXT_CHANGE; \ + HelpId = CMD_FN_REDLINE_NEXT_CHANGE ; \ + Text [ en-US ] = "Next Change" ; \ + };\ + MenuItem \ + { \ + Identifier = FN_REDLINE_PREV_CHANGE; \ + HelpId = CMD_FN_REDLINE_PREV_CHANGE ; \ + Text [ en-US ] = "Previous Change" ; \ + };\ SEPARATOR ; #define _MN_EDIT_BIB_ENTRY_DLG \ MenuItem \ diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 88cade7..afeb9f4 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -630,26 +630,69 @@ void SwView::Execute(SfxRequest &rReq) case FN_REDLINE_ACCEPT_DIRECT: case FN_REDLINE_REJECT_DIRECT: { - SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE ); - Point aCrsrPos = pWrtShell->GetCrsrDocPos( sal_True ); - if( pWrtShell->GetContentAtPos( aCrsrPos, aCntntAtPos ) ) + // We check for a redline at the start of the selection/cursor, not the point. + // This ensures we work properly with FN_REDLINE_NEXT_CHANGE, which leaves the + // point at the *end* of the redline and the mark at the start (so GetRedline + // would return NULL if called on the point) + SwDoc *pDoc = pWrtShell->GetDoc(); + SwPaM *pCursor = pWrtShell->GetCrsr(); + + sal_uInt16 nRedline = 0; + const SwRedline *pRedline = pDoc->GetRedline(*pCursor->Start(), &nRedline); + assert(pRedline != 0); + if (pRedline) + { + if (FN_REDLINE_ACCEPT_DIRECT == nSlot) + pWrtShell->AcceptRedline(nRedline); + else + pWrtShell->RejectRedline(nRedline); + } + } + break; + + case FN_REDLINE_NEXT_CHANGE: + { + const SwRedline *pCurrent = pWrtShell->GetCurrRedline(); + const SwRedline *pNext = pWrtShell->SelNextRedline(); + + // FN_REDLINE_PREV_CHANGE leaves the selection point at the start of the redline. + // In such cases, SelNextRedline (which starts searching from the selection point) + // immediately finds the current redline and advances the selection point to its end. + // + // This behavior means that PREV_CHANGE followed by NEXT_CHANGE would not change + // the current redline, so we detect it and select the next redline again. + if (pCurrent && pCurrent == pNext) + pNext = pWrtShell->SelNextRedline(); + + if (pNext) + pWrtShell->SetInSelect(); + } + break; + + case FN_REDLINE_PREV_CHANGE: + { + const SwPaM *pCursor = pWrtShell->GetCrsr(); + const SwPosition initialCursorStart = *pCursor->Start(); + const SwRedline *pPrev = pWrtShell->SelPrevRedline(); + + if (pPrev) { - sal_uInt16 nCount = pWrtShell->GetRedlineCount(); - for( sal_uInt16 nRedline = 0; nRedline < nCount; ++nRedline ) - { - const SwRedline& rRedline = pWrtShell->GetRedline( nRedline ); - if( *aCntntAtPos.aFnd.pRedl == rRedline ) - { - if( FN_REDLINE_ACCEPT_DIRECT == nSlot ) - pWrtShell->AcceptRedline( nRedline ); - else - pWrtShell->RejectRedline( nRedline ); - break; - } - } + // FN_REDLINE_NEXT_CHANGE leaves the selection point at the end of the redline. + // In such cases, SelPrevRedline (which starts searching from the selection point) + // immediately finds the current redline and advances the selection point to its + // start. + // + // This behavior means that NEXT_CHANGE followed by PREV_CHANGE would not change + // the current redline, so we detect it and move to the previous redline again. + if (initialCursorStart == *pPrev->Start()) + pPrev = pWrtShell->SelPrevRedline(); } + + if (pPrev) + pWrtShell->SetInSelect(); } break; + case SID_DOCUMENT_COMPARE: case SID_DOCUMENT_MERGE: { diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index cfa97d3..c7d7656 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -65,6 +65,7 @@ #include <cmdid.h> #include <IDocumentRedlineAccess.hxx> +#include <doc.hxx> using namespace ::com::sun::star; @@ -274,12 +275,26 @@ void SwView::GetState(SfxItemSet &rSet) case FN_REDLINE_ACCEPT_DIRECT: case FN_REDLINE_REJECT_DIRECT: { - SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE ); - Point aCrsrPos = pWrtShell->GetCrsrDocPos( sal_True ); - if( !pWrtShell->GetContentAtPos( aCrsrPos, aCntntAtPos ) ) - rSet.DisableItem( nWhich ); + // If the selection/cursor start position isn't on a redline, disable + // accepting/rejecting changes. + SwDoc *pDoc = pWrtShell->GetDoc(); + SwPaM *pCursor = pWrtShell->GetCrsr(); + if (0 == pDoc->GetRedline(*pCursor->Start(), 0)) + rSet.DisableItem(nWhich); } break; + + case FN_REDLINE_NEXT_CHANGE: + case FN_REDLINE_PREV_CHANGE: + { + // Enable change navigation if we have any redlines. Ideally we should disable + // "Next Change" if we're at or past the last change, and similarly for + // "Previous Change" + if (0 == pWrtShell->GetRedlineCount()) + rSet.DisableItem(nWhich); + } + break; + case SID_THESAURUS: { SwWrtShell &rSh = GetWrtShell(); diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml index ae37597..84f7545 100644 --- a/sw/uiconfig/sglobal/menubar/menubar.xml +++ b/sw/uiconfig/sglobal/menubar/menubar.xml @@ -84,6 +84,8 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:AcceptTrackedChanges"/> <menu:menuitem menu:id=".uno:CommentChangeTracking"/> + <menu:menuitem menu:id=".uno:NextTrackedChange"/> + <menu:menuitem menu:id=".uno:PreviousTrackedChange"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:MergeDocuments"/> </menu:menupopup> diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml index a0c80fe..beb36a6 100644 --- a/sw/uiconfig/swform/menubar/menubar.xml +++ b/sw/uiconfig/swform/menubar/menubar.xml @@ -84,6 +84,8 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:AcceptTrackedChanges"/> <menu:menuitem menu:id=".uno:CommentChangeTracking"/> + <menu:menuitem menu:id=".uno:NextTrackedChange"/> + <menu:menuitem menu:id=".uno:PreviousTrackedChange"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:MergeDocuments"/> </menu:menupopup> diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml index e93a3dd..d4a0e41 100644 --- a/sw/uiconfig/swreport/menubar/menubar.xml +++ b/sw/uiconfig/swreport/menubar/menubar.xml @@ -84,6 +84,8 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:AcceptTrackedChanges"/> <menu:menuitem menu:id=".uno:CommentChangeTracking"/> + <menu:menuitem menu:id=".uno:NextTrackedChange"/> + <menu:menuitem menu:id=".uno:PreviousTrackedChange"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:MergeDocuments"/> </menu:menupopup> diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index 473cebf..d53ba3d 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -87,6 +87,8 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:AcceptTrackedChanges"/> <menu:menuitem menu:id=".uno:CommentChangeTracking"/> + <menu:menuitem menu:id=".uno:NextTrackedChange"/> + <menu:menuitem menu:id=".uno:PreviousTrackedChange"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:MergeDocuments"/> </menu:menupopup> diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml index 9f43e34..429b9c3 100644 --- a/sw/uiconfig/swxform/menubar/menubar.xml +++ b/sw/uiconfig/swxform/menubar/menubar.xml @@ -85,6 +85,8 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:AcceptTrackedChanges"/> <menu:menuitem menu:id=".uno:CommentChangeTracking"/> + <menu:menuitem menu:id=".uno:NextTrackedChange"/> + <menu:menuitem menu:id=".uno:PreviousTrackedChange"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:MergeDocuments"/> </menu:menupopup> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits