[Libreoffice-commits] core.git: sw/inc sw/sdi sw/source

Luboš Luňák l.lunak at collabora.com
Tue Apr 29 02:12:24 PDT 2014


 sw/inc/cmdid.h                             |    2 -
 sw/inc/swcommands.h                        |    2 -
 sw/sdi/_viewsh.sdi                         |   12 ------
 sw/sdi/swriter.sdi                         |   50 -----------------------------
 sw/source/core/uibase/inc/redline_tmpl.hrc |   12 ------
 sw/source/core/uibase/lingu/olmenu.cxx     |   17 ++-------
 sw/source/core/uibase/uiview/view2.cxx     |   39 +++++++++++-----------
 sw/source/core/uibase/uiview/viewstat.cxx  |   28 +++++-----------
 8 files changed, 33 insertions(+), 129 deletions(-)

New commits:
commit d46e7dabd3090697c46e24a350cc75f35c28a8f7
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Tue Apr 29 11:08:48 2014 +0200

    do not have a separate action for accepting changes in a selection
    
    It doesn't really make sense to have two different UI elements, one
    for a change that cursor points at and one for all changes in a selection,
    as it's always either one or the other, so just keep the one UI element
    and do the right thing internally.
    So this reverts a part of 4a60f9387ddd832f7c164102b76351e5e520d920.
    
    Change-Id: Ic94a7704cbbc6273e91b0ee478f6304019220c4d

diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 721b3f4b..8f49675 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -163,8 +163,6 @@
 #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 */
-#define FN_REDLINE_ACCEPT_DIRECT_SELECTION (FN_EDIT2 + 43)    /* accept redlines in the selection */
-#define FN_REDLINE_REJECT_DIRECT_SELECTION (FN_EDIT2 + 44)    /* reject redlines in the selection */
 
 /*--------------------------------------------------------------------
     Region: Edit
diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h
index aa580e3..cc9bc07 100644
--- a/sw/inc/swcommands.h
+++ b/sw/inc/swcommands.h
@@ -122,8 +122,6 @@
 #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_ACCEPT_DIRECT_SELECTION      ".uno:AcceptTracedChangesInSelection"
-#define CMD_FN_REDLINE_REJECT_DIRECT_SELECTION      ".uno:RejectTracedChangesInSelection"
 #define CMD_FN_REDLINE_NEXT_CHANGE                  ".uno:NextTrackedChange"
 #define CMD_FN_REDLINE_PREV_CHANGE                  ".uno:PreviousTrackedChange"
 #define CMD_FN_REMOVE_HYPERLINK                     ".uno:RemoveHyperlink"
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 7c8f2ad..40ec958 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -142,18 +142,6 @@ interface BaseTextEditView
         StateMethod = GetState ;
         DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
     ]
-    FN_REDLINE_ACCEPT_DIRECT_SELECTION
-    [
-        ExecMethod = Execute ;
-        StateMethod = GetState ;
-        DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
-    ]
-    FN_REDLINE_REJECT_DIRECT_SELECTION
-    [
-        ExecMethod = Execute ;
-        StateMethod = GetState ;
-        DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
-    ]
     FN_REDLINE_NEXT_CHANGE
     [
         ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 1ddeba3..9bde88a 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -9823,56 +9823,6 @@ SfxVoidItem RejectTracedChange FN_REDLINE_REJECT_DIRECT
     GroupId = GID_EDIT;
 ]
 
-SfxVoidItem AcceptTracedChangeInSelection FN_REDLINE_ACCEPT_DIRECT_SELECTION
-[
-    /* 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 RejectTracedChangeInSelection FN_REDLINE_REJECT_DIRECT_SELECTION
-[
-    /* 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 NextTrackedChange FN_REDLINE_NEXT_CHANGE
 [
     /* flags: */
diff --git a/sw/source/core/uibase/inc/redline_tmpl.hrc b/sw/source/core/uibase/inc/redline_tmpl.hrc
index 8212465..4271708 100644
--- a/sw/source/core/uibase/inc/redline_tmpl.hrc
+++ b/sw/source/core/uibase/inc/redline_tmpl.hrc
@@ -25,18 +25,6 @@
         };                                                           \
         MenuItem                                                     \
         {                                                            \
-            Identifier = FN_REDLINE_ACCEPT_DIRECT_SELECTION;         \
-            HelpId = CMD_FN_REDLINE_ACCEPT_DIRECT_SELECTION ;        \
-            Text [ en-US ] = "Accept Changes" ;                      \
-        };                                                           \
-        MenuItem                                                     \
-        {                                                            \
-            Identifier = FN_REDLINE_REJECT_DIRECT_SELECTION ;        \
-            HelpId = CMD_FN_REDLINE_REJECT_DIRECT_SELECTION ;        \
-            Text [ en-US ] = "Reject Changes" ;                      \
-        };                                                           \
-        MenuItem                                                     \
-        {                                                            \
             Identifier = FN_REDLINE_NEXT_CHANGE;                     \
             HelpId = CMD_FN_REDLINE_NEXT_CHANGE ;                    \
             Text [ en-US ] = "Next Change" ;                         \
diff --git a/sw/source/core/uibase/lingu/olmenu.cxx b/sw/source/core/uibase/lingu/olmenu.cxx
index 7bd3281..682df9a 100644
--- a/sw/source/core/uibase/lingu/olmenu.cxx
+++ b/sw/source/core/uibase/lingu/olmenu.cxx
@@ -607,13 +607,13 @@ void SwSpellPopup::checkRedline()
     // Build an item set that contains a void item for each menu entry. The
     // WhichId of each item is set, so SwView may clear it.
     static const sal_uInt16 pRedlineIds[] = {
+        FN_REDLINE_ACCEPT_DIRECT,
+        FN_REDLINE_REJECT_DIRECT,
         FN_REDLINE_NEXT_CHANGE,
-        FN_REDLINE_PREV_CHANGE,
-        FN_REDLINE_ACCEPT_DIRECT_SELECTION,
-        FN_REDLINE_REJECT_DIRECT_SELECTION
+        FN_REDLINE_PREV_CHANGE
     };
     SwDoc *pDoc = m_pSh->GetDoc();
-    SfxItemSet aSet(pDoc->GetAttrPool(), FN_REDLINE_NEXT_CHANGE, FN_REDLINE_REJECT_DIRECT_SELECTION);
+    SfxItemSet aSet(pDoc->GetAttrPool(), FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_PREV_CHANGE);
     for (size_t i = 0; i < SAL_N_ELEMENTS(pRedlineIds); ++i)
     {
         const sal_uInt16 nWhich = pRedlineIds[i];
@@ -628,11 +628,6 @@ void SwSpellPopup::checkRedline()
         const sal_uInt16 nWhich = pRedlineIds[i];
         EnableItem(nWhich, aSet.Get(nWhich).Which());
     }
-    // Spellcheck popup selects the whole word, so xxx_SELECTION items would be enabled if needed,
-    // and there would be needless duplicates (and if only a part of the word is redlined,
-    // these might not work anyway).
-    EnableItem(FN_REDLINE_ACCEPT_DIRECT, false);
-    EnableItem(FN_REDLINE_REJECT_DIRECT, false);
 }
 
 sal_uInt16  SwSpellPopup::Execute( const Rectangle& rWordPos, Window* pWin )
@@ -813,9 +808,7 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
         }
     }
     else if (nId == FN_REDLINE_ACCEPT_DIRECT || nId == FN_REDLINE_REJECT_DIRECT
-            || nId == FN_REDLINE_NEXT_CHANGE || nId == FN_REDLINE_PREV_CHANGE
-            || nId == FN_REDLINE_ACCEPT_DIRECT_SELECTION
-            || nId == FN_REDLINE_REJECT_DIRECT_SELECTION)
+            || nId == FN_REDLINE_NEXT_CHANGE || nId == FN_REDLINE_PREV_CHANGE)
     {
         // Let SwView::Execute() handle the redline actions.
         SfxRequest aReq(m_pSh->GetView().GetViewFrame(), nId);
diff --git a/sw/source/core/uibase/uiview/view2.cxx b/sw/source/core/uibase/uiview/view2.cxx
index cf2d68a..e33ea5d 100644
--- a/sw/source/core/uibase/uiview/view2.cxx
+++ b/sw/source/core/uibase/uiview/view2.cxx
@@ -664,33 +664,32 @@ void SwView::Execute(SfxRequest &rReq)
         case FN_REDLINE_ACCEPT_DIRECT:
         case FN_REDLINE_REJECT_DIRECT:
         {
-            // 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 = m_pWrtShell->GetDoc();
             SwPaM *pCursor = m_pWrtShell->GetCrsr();
-
-            sal_uInt16 nRedline = 0;
-            const SwRangeRedline *pRedline = pDoc->GetRedline(*pCursor->Start(), &nRedline);
-            assert(pRedline != 0);
-            if (pRedline)
+            if( pCursor->HasMark())
             {
                 if (FN_REDLINE_ACCEPT_DIRECT == nSlot)
-                    m_pWrtShell->AcceptRedline(nRedline);
+                    m_pWrtShell->AcceptRedlinesInSelection();
                 else
-                    m_pWrtShell->RejectRedline(nRedline);
+                    m_pWrtShell->RejectRedlinesInSelection();
             }
-        }
-        break;
-
-        case FN_REDLINE_ACCEPT_DIRECT_SELECTION:
-        case FN_REDLINE_REJECT_DIRECT_SELECTION:
-        {
-            if (FN_REDLINE_ACCEPT_DIRECT_SELECTION == nSlot)
-                m_pWrtShell->AcceptRedlinesInSelection();
             else
-                m_pWrtShell->RejectRedlinesInSelection();
+            {
+                // 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)
+                sal_uInt16 nRedline = 0;
+                const SwRangeRedline *pRedline = pDoc->GetRedline(*pCursor->Start(), &nRedline);
+                assert(pRedline != 0);
+                if (pRedline)
+                {
+                    if (FN_REDLINE_ACCEPT_DIRECT == nSlot)
+                        m_pWrtShell->AcceptRedline(nRedline);
+                    else
+                        m_pWrtShell->RejectRedline(nRedline);
+                }
+            }
         }
         break;
 
diff --git a/sw/source/core/uibase/uiview/viewstat.cxx b/sw/source/core/uibase/uiview/viewstat.cxx
index 195889b..775e340 100644
--- a/sw/source/core/uibase/uiview/viewstat.cxx
+++ b/sw/source/core/uibase/uiview/viewstat.cxx
@@ -289,29 +289,12 @@ void SwView::GetState(SfxItemSet &rSet)
             case FN_REDLINE_ACCEPT_DIRECT:
             case FN_REDLINE_REJECT_DIRECT:
             {
-                // If the selection/cursor start position isn't on a redline, disable
-                // accepting/rejecting changes.
-                SwDoc *pDoc = m_pWrtShell->GetDoc();
-                SwPaM *pCursor = m_pWrtShell->GetCrsr();
-                if (0 == pDoc->GetRedline(*pCursor->Start(), 0))
-                    rSet.DisableItem(nWhich);
-                if (GetDocShell()->HasChangeRecordProtection())
-                    rSet.DisableItem(nWhich);
-            }
-            break;
-            case FN_REDLINE_ACCEPT_DIRECT_SELECTION:
-            case FN_REDLINE_REJECT_DIRECT_SELECTION:
-            {
-                // If the selection does not contain a redline, disable
-                // accepting/rejecting changes.
                 SwDoc *pDoc = m_pWrtShell->GetDoc();
                 SwPaM *pCursor = m_pWrtShell->GetCrsr();
                 if (GetDocShell()->HasChangeRecordProtection())
                     rSet.DisableItem(nWhich);
-                else if (!pCursor->HasMark())
-                    rSet.DisableItem(nWhich);
-                else
-                {
+                else if (pCursor->HasMark())
+                { // If the selection does not contain redlines, disable accepting/rejecting changes.
                     sal_uInt16 index = 0;
                     const SwRedlineTbl& table = pDoc->GetRedlineTbl();
                     const SwRangeRedline* redline = table.FindAtPosition( *pCursor->Start(), index );
@@ -334,6 +317,13 @@ void SwView::GetState(SfxItemSet &rSet)
                     if( redline == NULL )
                         rSet.DisableItem(nWhich);
                 }
+                else
+                {
+                    // If the cursor position isn't on a redline, disable
+                    // accepting/rejecting changes.
+                    if (0 == pDoc->GetRedline(*pCursor->Start(), 0))
+                        rSet.DisableItem(nWhich);
+                }
             }
             break;
 


More information about the Libreoffice-commits mailing list