diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-02-20 11:29:46 +0530 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-02-28 11:12:06 +0100 |
commit | 08cdff16dc60065ef519743f19ba458b8d207f33 (patch) | |
tree | 415ad1b833fa1f59f153862ddf1cccb169f87545 | |
parent | 2c5e93e4bb4e5c3cc40935460cfe90ab591b9019 (diff) |
sd lok: Support for replying to annotations by id
Change-Id: I9e6416b87300c20969669ee9592f0b560959e160
Reviewed-on: https://gerrit.libreoffice.org/34459
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
(cherry picked from commit 357fae01a15b88a53873278cccb1040b4d46bdba)
-rw-r--r-- | sd/source/ui/annotations/annotationmanager.cxx | 15 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index dd5f78dc99b4..e1d3d37592ee 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -472,11 +472,21 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq ) { Reference< XAnnotation > xAnnotation; const SfxItemSet* pArgs = rReq.GetArgs(); + sal_uInt32 nReplyId = 0; // Id of the comment to reply to + OUString sReplyText; if( pArgs ) { const SfxPoolItem* pPoolItem = nullptr; - if( SfxItemState::SET == pArgs->GetItemState( rReq.GetSlot(), true, &pPoolItem ) ) + if( SfxItemState::SET == pArgs->GetItemState( SID_ATTR_POSTIT_ID, true, &pPoolItem ) ) + { + nReplyId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32(); + xAnnotation = GetAnnotationById(nReplyId); + } + else if( SfxItemState::SET == pArgs->GetItemState( rReq.GetSlot(), true, &pPoolItem ) ) static_cast<const SfxUnoAnyItem*>( pPoolItem )->GetValue() >>= xAnnotation; + + if( SfxItemState::SET == pArgs->GetItemState( SID_ATTR_POSTIT_TEXT, true, &pPoolItem ) ) + sReplyText = static_cast<const SvxPostItTextItem*>( pPoolItem )->GetValue(); } TextApiObject* pTextApi = getTextApiObject( xAnnotation ); @@ -518,6 +528,9 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq ) pOutliner->QuickSetAttribs( aAnswerSet, aSel ); } + if (!sReplyText.isEmpty()) + pOutliner->Insert(sReplyText); + std::unique_ptr< OutlinerParaObject > pOPO( pOutliner->CreateParaObject() ); pTextApi->SetText( *pOPO.get() ); diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index aa0f036bee95..91265a3df430 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -4575,7 +4575,7 @@ SfxBoolItem ShowAnnotations SID_SHOW_POSTIT SfxVoidItem ReplyToAnnotation SID_REPLYTO_POSTIT -() +(SvxPostItIdItem Id SID_ATTR_POSTIT_ID,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT) [ AutoUpdate = FALSE, FastCall = FALSE, |