summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-05-24 15:22:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-05-24 15:24:55 +0100
commit26333736f103342344b9b0fa20a3a04d426fac4f (patch)
tree9936dccf0408950932c26d91be13d301d7da6515 /sd
parentada1f674902467940e9b4d13fc8100690d7e07d8 (diff)
Resolves: tdf#99712 Crash in impress annotation context menu
which is an issue since... commit dd46727b99d4bb5135451aa7e5e1bdb197373843 Author: Caolán McNamara <caolanm@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
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx21
-rw-r--r--sd/source/ui/annotations/annotationmanagerimpl.hxx5
-rw-r--r--sd/source/ui/annotations/annotationtag.cxx10
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx6
-rw-r--r--sd/source/ui/annotations/annotationwindow.hxx5
5 files changed, 21 insertions, 26 deletions
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 9f574b55fb33..03f492521b5b 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 5f6a6d409775..623631c6e428 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 0096af14385c..8fcd3dae0b67 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 19a4729fbe7c..0e59a38b8f8a 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 6aed9ec748f7..0ce319766afa 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;