embeddedobj/source/commonembedding/miscobj.cxx |    7 +++----
 embeddedobj/source/inc/commonembobj.hxx        |    3 +++
 sc/source/ui/drawfunc/fusel.cxx                |    4 ++++
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit dd56b1c4980bea867286880bd0ac194b6106c968
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Apr 3 17:24:25 2023 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Apr 3 21:01:51 2023 +0200

    set a parent for embedded object warning dialog
    
    calc does a lot of "CaptureMouse" which then leads to a lot of
    "ReleaseMouse", I'm somewhat unconvinced that there should be any
    CaptureMouse calls in there.
    
    Change-Id: I7c44d2c36c89a5c32c525d65939723da9be77a72
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149973
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index ecd149b8bb17..9fb1de15830b 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -37,7 +37,6 @@
 
 #include <utility>
 #include <vcl/weld.hxx>
-#include <unotools/resmgr.hxx>
 #include <vcl/stdtext.hxx>
 #include <strings.hrc>
 #include <osl/file.hxx>
@@ -346,7 +345,7 @@ void OCommonEmbeddedObject::PostEvent_Impl( const OUString& 
aEventName )
 }
 
 
-static int ShowMsgDialog( TranslateId Msg, const OUString& sFileName )
+int OCommonEmbeddedObject::ShowMsgDialog(TranslateId Msg, const OUString& 
sFileName)
 {
     std::locale aResLocale = Translate::Create( "emo" );
     OUString aMsg  = Translate::get( Msg, aResLocale );
@@ -356,7 +355,7 @@ static int ShowMsgDialog( TranslateId Msg, const OUString& 
sFileName )
     osl::FileBase::getSystemPathFromFileURL( sFileName, aTemp );
 
     aMsg = aMsg.replaceFirst( "%{filename}", aTemp );
-    weld::Window* pParent = Application::GetFrameWeld( nullptr );
+    weld::Window* pParent = Application::GetFrameWeld(m_xClientWindow);
 
     std::unique_ptr<weld::MessageDialog> xQueryBox 
(Application::CreateMessageDialog( pParent,
         VclMessageType::Warning, VclButtonsType::NONE, aMsg ) );
@@ -431,7 +430,7 @@ void OCommonEmbeddedObject::handleLinkedOLE( 
CopyBackToOLELink eState )
             OUString aMsg;
             osl::FileBase::getSystemPathFromFileURL( SrcName, aMsg );
             aMsg = ex.Message + "\n\n" + aMsg;
-            weld::Window* pParent = Application::GetFrameWeld( nullptr );
+            weld::Window* pParent = Application::GetFrameWeld(m_xClientWindow);
             std::unique_ptr<weld::MessageDialog> xQueryBox( 
Application::CreateMessageDialog( pParent,
                                                      VclMessageType::Error, 
VclButtonsType::Ok, aMsg ) );
 
diff --git a/embeddedobj/source/inc/commonembobj.hxx 
b/embeddedobj/source/inc/commonembobj.hxx
index 8f0a685c22c3..64ce9ae0f9f5 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -41,6 +41,7 @@
 #include <map>
 #include <memory>
 #include <svtools/filechangedchecker.hxx>
+#include <unotools/resmgr.hxx>
 
 namespace com::sun::star {
     namespace embed {
@@ -251,6 +252,8 @@ private:
                     const css::uno::Sequence< css::beans::PropertyValue >& 
lArguments,
                     const css::uno::Sequence< css::beans::PropertyValue >& 
lObjArgs );
 
+    int ShowMsgDialog(TranslateId Msg, const OUString& sFileName);
+
 public:
     OCommonEmbeddedObject(
         css::uno::Reference< css::uno::XComponentContext > xContext,
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 2fd8a9dc3fd6..d95f810308fa 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -489,6 +489,10 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
                         {
                             if 
(static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is())
                             {
+                                // release so if ActivateObject launches a 
warning dialog, then that dialog
+                                // can get mouse events
+                                if (pWindow->IsMouseCaptured())
+                                    pWindow->ReleaseMouse();
                                 
rViewShell.ActivateObject(static_cast<SdrOle2Obj*>(pObj), 
css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY);
                             }
                         }

Reply via email to