diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-03-01 17:32:08 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2017-03-07 12:14:53 +0000 |
commit | c3d1be64e882f7e0edd0e693b9f73a0556bcb003 (patch) | |
tree | a9a6f0645a03e3d51b3895fa59d71445c4fadf8a /sw/source/uibase/shells | |
parent | ea6bb12bb1b94bcbdaf67a5e4f0c7d659fe94188 (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/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/textfld.cxx | 34 |
1 files changed, 33 insertions, 1 deletions
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; |