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

Pranav Kant pranavk at collabora.co.uk
Tue Mar 7 12:15:35 UTC 2017


 sw/sdi/swriter.sdi                  |    2 +-
 sw/source/uibase/shells/textfld.cxx |   34 +++++++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)

New commits:
commit c3d1be64e882f7e0edd0e693b9f73a0556bcb003
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Mar 1 17:32:08 2017 +0530

    lok: Allow changing comment text of document redlines
    
    The id of the redline is optional. If not mentioned, the current redline
    is assumed to be the one whose comment text will be changed.
    
    Change-Id: Ia859de171603239a78f4bdef5eff0facd580d027
    Reviewed-on: https://gerrit.libreoffice.org/34923
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index cb42b58..e9ac677 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -663,7 +663,7 @@ SfxVoidItem ClosePreview FN_CLOSE_PAGEPREVIEW
 ]
 
 SfxVoidItem CommentChangeTracking FN_REDLINE_COMMENT
-()
+(SfxUInt16Item ChangeTrackingId FN_REDLINE_COMMENT,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 6cee279..ac5af41 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -509,9 +509,41 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                 */
 
                 const SwRangeRedline *pRedline = rSh.GetCurrRedline();
+                SwDoc *pDoc = rSh.GetDoc();
+                SwRedlineTable::size_type nRedline = SwRedlineTable::npos;
+                if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
+                {
+                    //TODO: SfxUInt16Item vs. SwRedlineTable::size_type mismatch:
+                    nRedline = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+                    if (nRedline == USHRT_MAX)
+                        nRedline = SwRedlineTable::npos;
+
+                    if (nRedline != SwRedlineTable::npos)
+                    {
+                        // If index is specified, goto and select the appropriate redline
+                        const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+                        if (nRedline < rTable.size())
+                            pRedline = rSh.GotoRedline(nRedline, true);
+                    }
+                }
+
+                OUString sCommentText;
+                const SfxStringItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
+                if (pTextItem)
+                    sCommentText = pTextItem->GetValue();
 
                 if (pRedline)
                 {
+                    // In case of LOK and comment text is already provided, skip
+                    // dialog creation and just change the redline comment directly
+                    if (comphelper::LibreOfficeKit::isActive() && !sCommentText.isEmpty())
+                    {
+                        rSh.SetRedlineComment(sCommentText);
+                        GetView().AttrChangedNotify(GetShellPtr());
+                        const_cast<SwRangeRedline*>(pRedline)->MaybeNotifyModification();
+                        break;
+                    }
+
                     OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
 
                     bool bTravel = false;
@@ -811,7 +843,7 @@ void SwTextShell::StateField( SfxItemSet &rSet )
             break;
 
         case FN_REDLINE_COMMENT:
-            if (!rSh.GetCurrRedline())
+            if (!comphelper::LibreOfficeKit::isActive() && !rSh.GetCurrRedline())
                 rSet.DisableItem(nWhich);
             break;
 


More information about the Libreoffice-commits mailing list