sd/source/ui/annotations/annotationmanager.cxx |    5 +++++
 sd/source/ui/func/fusel.cxx                    |    8 ++++++++
 sd/source/ui/inc/DrawViewShell.hxx             |    2 ++
 sd/source/ui/inc/annotationmanager.hxx         |    6 ++++++
 4 files changed, 21 insertions(+)

New commits:
commit 5a0e097113a897e9a9db38e58dabe4ddc0cc01f8
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sat Jul 13 23:58:49 2024 +0900
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Jul 23 10:20:25 2024 +0200

    tdf#161994 annot: trigger selection of the current annotation
    
    Delete annotation isn't active if no annotation is selected, but
    we do not report a new selection anymore, so fix this.
    
    Change-Id: Idb455d0c0d42412c55de4a7ca037342b58da548b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170429
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit aff09d7cb464af3223ee43cac0483ae3bf22fddd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170831
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sd/source/ui/annotations/annotationmanager.cxx 
b/sd/source/ui/annotations/annotationmanager.cxx
index 5f7deeb17aaa..396f8f0ee635 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -1298,6 +1298,11 @@ void AnnotationManager::GetAnnotationState(SfxItemSet& 
rItemSet)
     mxImpl->GetAnnotationState(rItemSet);
 }
 
+void 
AnnotationManager::SelectAnnotation(rtl::Reference<sdr::annotation::Annotation> 
const& xAnnotation)
+{
+    mxImpl->SelectAnnotation(xAnnotation);
 }
 
+} // end sd
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index 6673271232e3..5efab0c18526 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -51,6 +51,7 @@
 #include <DrawViewShell.hxx>
 #include <ToolBarManager.hxx>
 #include <Client.hxx>
+#include <annotationmanager.hxx>
 
 #include <svx/svdundo.hxx>
 
@@ -861,7 +862,14 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
         {
             auto& pAnnotationData = pSingleObj->getAnnotationData();
             if (pAnnotationData)
+            {
+                auto* pDrawViewShell = 
dynamic_cast<DrawViewShell*>(mpViewShell);
+                if (pDrawViewShell && 
pDrawViewShell->getAnnotationManagerPtr())
+                {
+                    
pDrawViewShell->getAnnotationManagerPtr()->SelectAnnotation(pAnnotationData->mxAnnotation);
+                }
                 pAnnotationData->openPopup();
+            }
             return true;
         }
 
diff --git a/sd/source/ui/inc/DrawViewShell.hxx 
b/sd/source/ui/inc/DrawViewShell.hxx
index f2f1cadb8b06..09de1c685361 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -228,6 +228,8 @@ public:
     void            ExecuteAnnotation (SfxRequest const & rRequest);
     void            GetAnnotationState (SfxItemSet& rItemSet);
 
+    AnnotationManager* getAnnotationManagerPtr() { return 
mpAnnotationManager.get(); }
+
     void            StartRulerDrag (const Ruler& rRuler, const MouseEvent& 
rMEvt);
 
     virtual bool    PrepareClose( bool bUI = true ) override;
diff --git a/sd/source/ui/inc/annotationmanager.hxx 
b/sd/source/ui/inc/annotationmanager.hxx
index 6f47efd1fc06..25bf5503384e 100644
--- a/sd/source/ui/inc/annotationmanager.hxx
+++ b/sd/source/ui/inc/annotationmanager.hxx
@@ -24,6 +24,11 @@
 class SfxRequest;
 class SfxItemSet;
 
+namespace sdr::annotation
+{
+class Annotation;
+}
+
 namespace sd
 {
 class ViewShellBase;
@@ -37,6 +42,7 @@ public:
 
     void ExecuteAnnotation(SfxRequest const& rRequest);
     void GetAnnotationState(SfxItemSet& rItemSet);
+    void SelectAnnotation(rtl::Reference<sdr::annotation::Annotation> const& 
xAnnotation);
 
 private:
     ::rtl::Reference<AnnotationManagerImpl> mxImpl;

Reply via email to