tdf#63029 Copy and paste comments with slide

Change-Id: Iceb0e744f8e994ece91cd8f50fefaed631aa8396
Reviewed-on: https://gerrit.libreoffice.org/64126
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 0744eca..996f976 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -30,6 +30,7 @@
#include <svl/urihelper.hxx>
#include <editeng/xmlcnitm.hxx>
#include <svx/svditer.hxx>
#include <com/sun/star/text/XTextCopy.hpp>

#include <Annotation.hxx>
#include <notifydocumentevent.hxx>
@@ -391,6 +392,22 @@ void SdPage::lateInit(const SdPage& rSrcPage)
    // animations
    rSrcPage.cloneAnimations(*this);

    // annotations
    for(const Reference< XAnnotation >& srcAnnotation : rSrcPage.maAnnotations)
    {
        Reference< XAnnotation > ref;
        createAnnotation(ref);
        ref->setPosition(srcAnnotation->getPosition());
        ref->setSize(srcAnnotation->getSize());
        ref->setAuthor(srcAnnotation->getAuthor());
        ref->setInitials(srcAnnotation->getInitials());
        ref->setDateTime(srcAnnotation->getDateTime());
        Reference< ::css::text::XTextCopy > srcRange ( srcAnnotation->getTextRange(), uno::UNO_QUERY);
        Reference< ::css::text::XTextCopy > range ( ref->getTextRange(), uno::UNO_QUERY);
        if(srcRange.is() && range.is())
            range->copyText( srcRange );
    }

    // fix user calls for duplicated slide
    SdrObjListIter aSourceIter( &rSrcPage, SdrIterMode::DeepWithGroups );
    SdrObjListIter aTargetIter( this, SdrIterMode::DeepWithGroups );