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

Caolán McNamara caolanm at redhat.com
Tue May 24 14:25:24 UTC 2016


 sd/source/ui/annotations/annotationmanager.cxx     |   21 +++++++--------------
 sd/source/ui/annotations/annotationmanagerimpl.hxx |    5 +++++
 sd/source/ui/annotations/annotationtag.cxx         |   10 ++++------
 sd/source/ui/annotations/annotationwindow.cxx      |    6 +++++-
 sd/source/ui/annotations/annotationwindow.hxx      |    5 -----
 5 files changed, 21 insertions(+), 26 deletions(-)

New commits:
commit 26333736f103342344b9b0fa20a3a04d426fac4f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 24 15:22:39 2016 +0100

    Resolves: tdf#99712 Crash in impress annotation context menu
    
    which is an issue since...
    
    commit dd46727b99d4bb5135451aa7e5e1bdb197373843
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Tue Apr 5 15:27:38 2016 +0100
    
        Resolves; tdf#87120 no keyboard navigation inside floating windows
    
        lets try and treat these the same as we do normal toplevels
        like dialogs if they popup with GrabFocus.
    
        This way focus can be set on widgets inside the floating windows, and
        so keyboard traversal of widgets etc all works.
    
    which allows keyboard focus inside floating windows to allow a11y keyboard
    navigation inside them without jumping through difficult hoops.
    
    Change-Id: I6024c048e80d09a70cb3a628378975248a55d6b6

diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 9f574b5..03f4925 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -172,6 +172,7 @@ AnnotationManagerImpl::AnnotationManagerImpl( ViewShellBase& rViewShellBase )
 , mrBase( rViewShellBase )
 , mpDoc( rViewShellBase.GetDocument() )
 , mbShowAnnotations( true )
+, mbPopupMenuActive( false )
 , mnUpdateTagsEvent( nullptr )
 {
     SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType());
@@ -996,23 +997,15 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( const Reference< XAnno
         }
     }
 
-    AnnotationWindow* pParentAnnotationWindow = dynamic_cast< AnnotationWindow* >( pParent );
-
-    if(pParentAnnotationWindow)
-    {
-        // tdf#99388 make known that PopupMenu is active at parent
-        // to allow suppressing closing of that window if needed
-        pParentAnnotationWindow->setPopupMenuActive(true);
-    }
+    // tdf#99388 and tdf#99712 make known that PopupMenu is active at parent to
+    // allow suppressing closing of that window if needed
+    setPopupMenuActive(true);
 
     nId = pMenu->Execute( pParent, rContextRect, PopupMenuFlags::ExecuteDown|PopupMenuFlags::NoMouseUpClose );
 
-    if(pParentAnnotationWindow)
-    {
-        // tdf#99388 reset flag, need to be done before reacting
-        // since closing it is one possible reaction
-        pParentAnnotationWindow->setPopupMenuActive(false);
-    }
+    // tdf#99388 and tdf#99712 reset flag, need to be done before reacting
+    // since closing it is one possible reaction
+    setPopupMenuActive(false);
 
     switch( nId )
     {
diff --git a/sd/source/ui/annotations/annotationmanagerimpl.hxx b/sd/source/ui/annotations/annotationmanagerimpl.hxx
index 5f6a6d4..623631c 100644
--- a/sd/source/ui/annotations/annotationmanagerimpl.hxx
+++ b/sd/source/ui/annotations/annotationmanagerimpl.hxx
@@ -112,6 +112,10 @@ public:
 
     void ShowAnnotations(bool bShow);
 
+    // tdf#99388 and tdf#99712 flag to transport if the PopupMenu is active
+    bool getPopupMenuActive() const { return mbPopupMenuActive; }
+    void setPopupMenuActive(bool bNew) { mbPopupMenuActive = bNew; }
+
 private:
     ViewShellBase& mrBase;
     SdDrawDocument* mpDoc;
@@ -123,6 +127,7 @@ private:
     css::uno::Reference< css::office::XAnnotation > mxSelectedAnnotation;
 
     bool mbShowAnnotations;
+    bool mbPopupMenuActive;
     ImplSVEvent * mnUpdateTagsEvent;
     vcl::Font maFont;
 };
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 0096af1..8fcd3da 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -620,12 +620,10 @@ IMPL_LINK_TYPED(AnnotationTag, WindowEventHandler, VclWindowEvent&, rEvent, void
             {
                 if( rEvent.GetId() == VCLEVENT_WINDOW_DEACTIVATE )
                 {
-                    if(mpAnnotationWindow->getPopupMenuActive())
-                    {
-                        // tdf#99388 if PopupMenu is active, suppress deletion of the
-                        // AnnotationWindow which is triggeded by it losing focus
-                    }
-                    else
+                    // tdf#99388 and tdf#99712 if PopupMenu is active, suppress
+                    // deletion of the AnnotationWindow which is triggered by
+                    // it losing focus
+                    if (!mrManager.getPopupMenuActive())
                     {
                         if( mnClosePopupEvent )
                             Application::RemoveUserEvent( mnClosePopupEvent );
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 19a4729..0e59a38 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -281,7 +281,6 @@ AnnotationWindow::AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShel
 , mbReadonly(pDocShell->IsReadOnly())
 , mbProtected(false)
 , mbMouseOverButton(false)
-, mbPopupMenuActive(false)
 , mpTextWindow(nullptr)
 , mpMeta(nullptr)
 {
@@ -610,6 +609,11 @@ void AnnotationWindow::SetColor()
 
 void AnnotationWindow::Deactivate()
 {
+    //tdf#99388 and tdf#99712, don't deactivate if we lose focus because of our
+    //own popup
+    if (mrManager.getPopupMenuActive())
+        return;
+
     Reference< XAnnotation > xAnnotation( mxAnnotation );
 
     // write changed text back to annotation
diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx
index 6aed9ec..0ce3197 100644
--- a/sd/source/ui/annotations/annotationwindow.hxx
+++ b/sd/source/ui/annotations/annotationwindow.hxx
@@ -88,7 +88,6 @@ class AnnotationWindow : public FloatingWindow
         bool                    mbReadonly;
         bool                    mbProtected;
         bool                    mbMouseOverButton;
-        bool                    mbPopupMenuActive;
         VclPtr<AnnotationTextWindow>   mpTextWindow;
         VclPtr<MultiLineEdit>   mpMeta;
         Rectangle               maRectMetaButton;
@@ -134,10 +133,6 @@ class AnnotationWindow : public FloatingWindow
 
         void            ToggleInsMode();
 
-        // tdf#99388 flag to transport if the PopupMenu is active
-        bool getPopupMenuActive() const { return mbPopupMenuActive; }
-        void setPopupMenuActive(bool bNew) { mbPopupMenuActive = bNew; }
-
         virtual void    Deactivate() override;
         virtual void    Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect) override;
         virtual void    MouseMove( const MouseEvent& rMEvt ) override;


More information about the Libreoffice-commits mailing list