sfx2/source/view/viewfrm.cxx |   25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

New commits:
commit a2c09afebef70d2419823445ff92379fe3df9485
Author:     Matt K <matt...@gmail.com>
AuthorDate: Fri Jan 19 17:05:35 2024 -0600
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Jan 30 12:49:42 2024 +0100

    tdf#151352 Don't display tip-of-the-day in base form editor
    
    The problem is that there is some crash with tip-of-the-day
    on Linux with GTK3 when opening a base form for editing.
    The fix is to avoid showing the tip-of-the-day for base
    form editor, as suggested in the bug comments.
    
    Change-Id: Ic155e137c4314b7e014f09d83589519197bd0039
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162326
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 16b41843ba31..ab6e2ebdda0d 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -78,6 +78,7 @@
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
+#include <com/sun/star/frame/ModuleManager.hpp>
 
 #include <unotools/ucbhelper.hxx>
 #include <comphelper/lok.hxx>
@@ -1515,9 +1516,27 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, 
const SfxHint& rHint )
                 // open where SdModule::ExecuteNewDocument will launch it 
instead when that dialog is dismissed
                 if (SfxApplication::IsTipOfTheDayDue() && !bIsHeadlessOrUITest 
&& !IsInModalMode())
                 {
-                    // tdf#127946 pass in argument for dialog parent
-                    SfxUnoFrameItem aDocFrame(SID_FILLFRAME, 
GetFrame().GetFrameInterface());
-                    GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, 
SfxCallMode::SLOT, {}, { &aDocFrame });
+                    bool bIsBaseFormOpen = false;
+
+                    const auto xCurrentFrame = GetFrame().GetFrameInterface();
+                    const auto xContext = 
comphelper::getProcessComponentContext();
+                    const auto xModuleManager = 
css::frame::ModuleManager::create(xContext);
+                    switch (vcl::EnumContext::GetApplicationEnum(
+                        xModuleManager->identify(xCurrentFrame)))
+                    {
+                        case vcl::EnumContext::Application::WriterForm:
+                            bIsBaseFormOpen = true;
+                            break;
+                        default:
+                            break;
+                    }
+                    if (!bIsBaseFormOpen)
+                    {
+                        // tdf#127946 pass in argument for dialog parent
+                        SfxUnoFrameItem aDocFrame(SID_FILLFRAME, 
GetFrame().GetFrameInterface());
+                        GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, 
SfxCallMode::SLOT, {},
+                                                     { &aDocFrame });
+                    }
                 }
 
                 // inform about the community involvement

Reply via email to