diff options
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarDockingWindow.cxx | 117 |
5 files changed, 82 insertions, 66 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 4e1b06e522..37c67e1ef2 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -1044,9 +1044,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if( aFileName.startsWith("#") ) // Mark without URL { SfxViewFrame *pView = pTargetFrame ? pTargetFrame->GetCurrentViewFrame() : nullptr; - if ( !pView ) + if (!pView) pView = SfxViewFrame::Current(); - pView->GetViewShell()->JumpToMark( aFileName.copy(1) ); + if (pView) + pView->GetViewShell()->JumpToMark( aFileName.copy(1) ); rReq.SetReturnValue( SfxViewFrameItem( pView ) ); return; } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index fedbfb205d..90ef2ee232 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -453,6 +453,10 @@ static void sendErrorToLOK(ErrCodeMsg error) if (error.GetCode().GetClass() == ErrCodeClass::NONE) return; + SfxViewShell* pNotifier = SfxViewShell::Current(); + if (!pNotifier) + return; + boost::property_tree::ptree aTree; aTree.put("code", error); aTree.put("kind", ""); @@ -465,7 +469,7 @@ static void sendErrorToLOK(ErrCodeMsg error) std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); - SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, OString(aStream.str())); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, OString(aStream.str())); } namespace diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 17ee6bf621..a6aaee75ea 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2428,7 +2428,11 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium, uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); if (xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName("_MarkAsFinal")) { - if (xPropertySet->getPropertyValue("_MarkAsFinal").get<bool>()) + Any anyMarkAsFinal = xPropertySet->getPropertyValue("_MarkAsFinal"); + if ( + ( (anyMarkAsFinal.getValueType() == cppu::UnoType<bool>::get()) && (anyMarkAsFinal.get<bool>()) ) || + ( (anyMarkAsFinal.getValueType() == cppu::UnoType<OUString>::get()) && (anyMarkAsFinal.get<OUString>() == "true") ) + ) { uno::Reference< lang::XMultiServiceFactory > xFactory(GetModel(), uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index 8e9c2c9ca4..69d41b04d8 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -418,6 +418,9 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, if (bIsLOK) { + if (!pViewShell) + return false; + // Notebookbar was loaded too early what caused: // * in LOK: Paste Special feature was incorrectly initialized // Skip first request so Notebookbar will be initialized after document was loaded @@ -608,11 +611,12 @@ void SfxNotebookBar::ToggleMenubar() void SfxNotebookBar::ReloadNotebookBar(std::u16string_view sUIPath) { - if (SfxNotebookBar::IsActive()) - { - SfxViewShell* pViewShell = SfxViewShell::Current(); - sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame().GetBindings(), sUIPath, true); - } + if (!SfxNotebookBar::IsActive()) + return; + SfxViewShell* pViewShell = SfxViewShell::Current(); + if (!pViewShell) + return; + sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame().GetBindings(), sUIPath, true); } IMPL_STATIC_LINK(SfxNotebookBar, VclDisposeHdl, const SfxViewShell*, pViewShell, void) diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 23c3b459c3..d0edf80663 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 ); } } |