summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-03-01 17:32:08 +0530
committerpranavk <pranavk@collabora.co.uk>2017-03-07 12:14:53 +0000
commitc3d1be64e882f7e0edd0e693b9f73a0556bcb003 (patch)
treea9a6f0645a03e3d51b3895fa59d71445c4fadf8a /sw
parentea6bb12bb1b94bcbdaf67a5e4f0c7d659fe94188 (diff)
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@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/sdi/swriter.sdi2
-rw-r--r--sw/source/uibase/shells/textfld.cxx34
2 files changed, 34 insertions, 2 deletions
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index cb42b581d609..e9ac67777e5f 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 6cee27968e31..ac5af4115966 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;