summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-03-28 11:23:56 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-03-28 15:53:08 +0100
commitd4d923f9db926d8b0b6eb3bb7b62f5a7a520c00d (patch)
treea17dbff086495671ae21c5017d5f749361219a85 /sfx2
parent696e405a8d734e1440e3178a04cbb10190bbc4d7 (diff)
null deref of mpSidebarController
follow the pattern used in the rest of this and skip the branch that depends on mpSidebarController existing git show -w Change-Id: I739754b2af7ad09fa80c36693d8adbf173ece2e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165426 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx117
1 files changed, 60 insertions, 57 deletions
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 23c3b459c3be..d0edf8066332 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -136,75 +136,78 @@ SfxChildAlignment SidebarDockingWindow::CheckAlignment (
bool SidebarDockingWindow::EventNotify(NotifyEvent& rEvent)
{
- NotifyEventType nType = rEvent.GetType();
- if (NotifyEventType::KEYINPUT == nType)
+ if (mpSidebarController)
{
- const vcl::KeyCode& rKeyCode = rEvent.GetKeyEvent()->GetKeyCode();
- switch (rKeyCode.GetCode())
+ NotifyEventType nType = rEvent.GetType();
+ if (NotifyEventType::KEYINPUT == nType)
{
- case KEY_UP:
- case KEY_DOWN:
- case KEY_PAGEUP:
- case KEY_PAGEDOWN:
- case KEY_HOME:
- case KEY_END:
- case KEY_LEFT:
- case KEY_RIGHT:
- case KEY_BACKSPACE:
- case KEY_DELETE:
- case KEY_INSERT:
- case KEY_RETURN:
- case KEY_ESCAPE:
+ const vcl::KeyCode& rKeyCode = rEvent.GetKeyEvent()->GetKeyCode();
+ switch (rKeyCode.GetCode())
{
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_PAGEUP:
+ case KEY_PAGEDOWN:
+ case KEY_HOME:
+ case KEY_END:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_BACKSPACE:
+ case KEY_DELETE:
+ case KEY_INSERT:
+ case KEY_RETURN:
+ case KEY_ESCAPE:
+ {
+ return true;
+ }
+ default:
+ break;
+ }
+ if (!mpAccel)
+ {
+ mpAccel = svt::AcceleratorExecute::createAcceleratorHelper();
+ mpAccel->init(comphelper::getProcessComponentContext(), mpSidebarController->getXFrame());
+ }
+ const OUString aCommand(mpAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rKeyCode)));
+ if (".uno:DesignerDialog" == aCommand)
+ {
+ std::shared_ptr<PanelDescriptor> xPanelDescriptor =
+ mpSidebarController->GetResourceManager()->GetPanelDescriptor( u"StyleListPanel" );
+ if ( xPanelDescriptor && mpSidebarController->IsDeckVisible( xPanelDescriptor->msDeckId ) )
+ Close();
+ return true;
+ }
+ if (".uno:Undo" == aCommand || ".uno:Redo" == aCommand)
+ {
+ comphelper::dispatchCommand(aCommand, {});
return true;
}
- default:
- break;
- }
- if (!mpAccel)
- {
- mpAccel = svt::AcceleratorExecute::createAcceleratorHelper();
- mpAccel->init(comphelper::getProcessComponentContext(), mpSidebarController->getXFrame());
- }
- const OUString aCommand(mpAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rKeyCode)));
- if (".uno:DesignerDialog" == aCommand)
- {
- std::shared_ptr<PanelDescriptor> xPanelDescriptor =
- mpSidebarController->GetResourceManager()->GetPanelDescriptor( u"StyleListPanel" );
- if ( xPanelDescriptor && mpSidebarController->IsDeckVisible( xPanelDescriptor->msDeckId ) )
- Close();
- return true;
}
- if (".uno:Undo" == aCommand || ".uno:Redo" == aCommand)
+ else if (NotifyEventType::MOUSEBUTTONDOWN == nType)
{
- comphelper::dispatchCommand(aCommand, {});
- return true;
+ const MouseEvent *mEvt = rEvent.GetMouseEvent();
+ if (mEvt->IsLeft())
+ {
+ tools::Rectangle aGrip = mpSidebarController->GetDeckDragArea();
+ if ( aGrip.Contains( mEvt->GetPosPixel() ) )
+ mbIsReadyToDrag = true;
+ }
}
- }
- else if (NotifyEventType::MOUSEBUTTONDOWN == nType)
- {
- const MouseEvent *mEvt = rEvent.GetMouseEvent();
- if (mEvt->IsLeft())
+ else if (NotifyEventType::MOUSEMOVE == nType)
{
+ const MouseEvent *mEvt = rEvent.GetMouseEvent();
tools::Rectangle aGrip = mpSidebarController->GetDeckDragArea();
- if ( aGrip.Contains( mEvt->GetPosPixel() ) )
- mbIsReadyToDrag = true;
- }
- }
- else if (NotifyEventType::MOUSEMOVE == nType)
- {
- const MouseEvent *mEvt = rEvent.GetMouseEvent();
- tools::Rectangle aGrip = mpSidebarController->GetDeckDragArea();
- if (mEvt->IsLeft() && aGrip.Contains( mEvt->GetPosPixel() ) && mbIsReadyToDrag )
- {
- Point aPos = mEvt->GetPosPixel();
- vcl::Window* pWindow = rEvent.GetWindow();
- if ( pWindow != this )
+ if (mEvt->IsLeft() && aGrip.Contains( mEvt->GetPosPixel() ) && mbIsReadyToDrag )
{
- aPos = pWindow->OutputToScreenPixel( aPos );
- aPos = ScreenToOutputPixel( aPos );
+ Point aPos = mEvt->GetPosPixel();
+ vcl::Window* pWindow = rEvent.GetWindow();
+ if ( pWindow != this )
+ {
+ aPos = pWindow->OutputToScreenPixel( aPos );
+ aPos = ScreenToOutputPixel( aPos );
+ }
+ ImplStartDocking( aPos );
}
- ImplStartDocking( aPos );
}
}