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

Pranav Kant pranavk at collabora.co.uk
Mon Feb 20 09:25:54 UTC 2017


 sd/source/ui/annotations/annotationmanager.cxx |   15 ++++++++++++++-
 svx/sdi/svx.sdi                                |    2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 357fae01a15b88a53873278cccb1040b4d46bdba
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Feb 20 11:29:46 2017 +0530

    sd lok: Support for replying to annotations by id
    
    Change-Id: I9e6416b87300c20969669ee9592f0b560959e160
    Reviewed-on: https://gerrit.libreoffice.org/34459
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>

diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 56aaf8c..9101cc0 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 bf93a6e..33daa10 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -4590,7 +4590,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,


More information about the Libreoffice-commits mailing list