vcl/inc/osx/saldata.hxx                |    2 +-
 vcl/inc/osx/salinst.h                  |    4 ++--
 vcl/inc/qt5/QtInstance.hxx             |    5 +++--
 vcl/inc/salinst.hxx                    |    6 ++++--
 vcl/inc/unx/gtk/gtkinst.hxx            |    5 +++--
 vcl/inc/unx/i18n_ic.hxx                |    8 +++++---
 vcl/inc/unx/salinst.h                  |    4 ++--
 vcl/osx/service_entry.cxx              |    5 +++--
 vcl/qt5/QtInstance.cxx                 |    4 ++--
 vcl/source/components/dtranscomp.cxx   |    7 ++++---
 vcl/unx/generic/app/i18n_ic.cxx        |   16 +++++++---------
 vcl/unx/generic/dtrans/X11_service.cxx |    3 ++-
 vcl/unx/gtk3/gtkinst.cxx               |    5 +++--
 13 files changed, 41 insertions(+), 33 deletions(-)

New commits:
commit 2e8a055fbd8ca62b73d042b1955917e3969ddf1e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri May 9 23:51:05 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat May 10 17:33:27 2025 +0200

    gen: Pass X11SalFrame to SalI18N_InputContext ctor
    
    ... instead of a pointer to the subclass, SalFrame.
    
    This allows retrieving the two windows of interest directly
    from the X11SalFrame instead of using the indirection
    via the frame's SystemEnvData.
    
    Change-Id: I7afb6d2067c238b94865836fd528d3824c7054f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185118
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/unx/i18n_ic.hxx b/vcl/inc/unx/i18n_ic.hxx
index 2b114313c3b7..6929895409ff 100644
--- a/vcl/inc/unx/i18n_ic.hxx
+++ b/vcl/inc/unx/i18n_ic.hxx
@@ -72,7 +72,7 @@ public:
     void Map(X11SalFrame* pFrame);
     void Unmap();
 
-    SalI18N_InputContext( SalFrame *aFrame );
+    SalI18N_InputContext(X11SalFrame* pFrame);
     ~SalI18N_InputContext();
 };
 
diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index 17f9c1a7417b..c43ebb0f117e 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -120,7 +120,7 @@ const XIMStyle g_nSupportedStatusStyle(
 
 // Constructor for an InputContext (IC)
 
-SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
+SalI18N_InputContext::SalI18N_InputContext(X11SalFrame* pFrame) :
         mbUseable( True ),
         maContext( nullptr ),
         mnSupportedPreeditStyle(
@@ -162,9 +162,8 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame 
*pFrame ) :
     if (pInputMethod->UseMethod()
         && SupportInputMethodStyle( pInputMethod->GetSupportedStyles() ) )
     {
-        const SystemEnvData& rEnv = pFrame->GetSystemData();
-        ::Window  aClientWindow = rEnv.aShellWindow;
-        ::Window  aFocusWindow  = rEnv.GetWindowHandle(pFrame);
+        ::Window aClientWindow = pFrame->GetShellWindow();
+        ::Window aFocusWindow  = pFrame->GetWindow();
 
         // for status callbacks and commit string callbacks
 #define PREEDIT_BUFSZ 16
commit 23a0ff4f42436ef629a089b4e3972b0dd7b4b2fd
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri May 9 23:41:44 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat May 10 17:33:21 2025 +0200

    gen: Use more specific X11SalFrame param
    
    ... in SalI18N_InputContext::SetICFocus and
    related SalI18N_InputContext::Map. This allows
    retrieving the two windows of interest directly
    from the X11SalFrame instead of using the indirection
    via the frame's SystemEnvData.
    
    Change-Id: Ia5af52fc949b77d8cd22fbf83a14e5b4e4cc6c60
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185117
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/inc/unx/i18n_ic.hxx b/vcl/inc/unx/i18n_ic.hxx
index 303b3fb2e497..2b114313c3b7 100644
--- a/vcl/inc/unx/i18n_ic.hxx
+++ b/vcl/inc/unx/i18n_ic.hxx
@@ -21,6 +21,8 @@
 
 #include "i18n_cb.hxx"
 
+#include <unx/salframe.h>
+
 enum class EndExtTextInputFlags;
 
 class SalI18N_InputContext
@@ -59,7 +61,7 @@ public:
     XIC  GetContext() const { return maContext; }
 
     void ExtendEventMask(  ::Window aFocusWindow );
-    void SetICFocus( SalFrame* pFocusFrame );
+    void SetICFocus(X11SalFrame* pFocusFrame);
     void UnsetICFocus();
     void HandleDestroyIM();
 
@@ -67,7 +69,7 @@ public:
     void CommitKeyEvent( sal_Unicode const * pText, std::size_t nLength );
     int  UpdateSpotLocation();
 
-    void Map( SalFrame *pFrame );
+    void Map(X11SalFrame* pFrame);
     void Unmap();
 
     SalI18N_InputContext( SalFrame *aFrame );
diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index 1fd3454aeaa7..17f9c1a7417b 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -361,7 +361,7 @@ SalI18N_InputContext::Unmap()
 }
 
 void
-SalI18N_InputContext::Map( SalFrame *pFrame )
+SalI18N_InputContext::Map(X11SalFrame* pFrame)
 {
     if( !mbUseable )
         return;
@@ -539,16 +539,15 @@ SalI18N_InputContext::UpdateSpotLocation()
 // in unmapped state
 
 void
-SalI18N_InputContext::SetICFocus( SalFrame* pFocusFrame )
+SalI18N_InputContext::SetICFocus(X11SalFrame* pFocusFrame)
 {
     if ( !(mbUseable && (maContext != nullptr))  )
         return;
 
     maClientData.pFrame = pFocusFrame;
 
-    const SystemEnvData& rEnv   = pFocusFrame->GetSystemData();
-    ::Window  aClientWindow  = rEnv.aShellWindow;
-    ::Window  aFocusWindow   = rEnv.GetWindowHandle(pFocusFrame);
+    ::Window aClientWindow = pFocusFrame->GetShellWindow();
+    ::Window  aFocusWindow = pFocusFrame->GetWindow();
 
     XSetICValues( maContext,
                   XNFocusWindow,       aFocusWindow,
commit 75f2077fd057901142a1e5e333409f2eb1193903
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri May 9 22:21:16 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat May 10 17:33:14 2025 +0200

    vcl: Return XClipboard in SalInstance::CreateClipboard
    
    ... instead of the very generic XInterface, to make
    clearer what this is about from the return type as well.
    
    Adjust related code accordingly. This also allows dropping
    a static_cast and UNO_QUERY in AquaSalInstance::CreateClipboard.
    
    Change-Id: Ibf40f2844a60c4ceb1b5e3e11125b10803d5303e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185115
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/osx/saldata.hxx b/vcl/inc/osx/saldata.hxx
index 66c6b3f11cd7..4934b529cd61 100644
--- a/vcl/inc/osx/saldata.hxx
+++ b/vcl/inc/osx/saldata.hxx
@@ -88,7 +88,7 @@ public:
     sal_Int32                                     mnDPIX;           // 
#i100617# read DPI only once per office life
     sal_Int32                                     mnDPIY;           // 
#i100617# read DPI only once per office life
 
-    css::uno::Reference< css::uno::XInterface >   mxClipboard;
+    css::uno::Reference<css::datatransfer::clipboard::XClipboard> mxClipboard;
 
     SalData();
     ~SalData();
diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h
index d3493352d920..a7dffb67eef0 100644
--- a/vcl/inc/osx/salinst.h
+++ b/vcl/inc/osx/salinst.h
@@ -137,8 +137,8 @@ public:
     virtual OUString        getOSVersion() override;
 
     // dtrans implementation
-    virtual css::uno::Reference< css::uno::XInterface > CreateClipboard(
-            const css::uno::Sequence< css::uno::Any >& i_rArguments ) override;
+    virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
+    CreateClipboard(const css::uno::Sequence<css::uno::Any>& i_rArguments) 
override;
     virtual css::uno::Reference<css::datatransfer::dnd::XDragSource>
     ImplCreateDragSource(const SystemEnvData*) override;
     virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget>
diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx
index df8b214fa5e1..40057554170d 100644
--- a/vcl/inc/qt5/QtInstance.hxx
+++ b/vcl/inc/qt5/QtInstance.hxx
@@ -71,7 +71,8 @@ class VCLPLUG_QT_PUBLIC QtInstance : public QObject,
     const bool m_bUseCairo;
     QtTimer* m_pTimer;
     bool m_bSleeping;
-    std::unordered_map<OUString, css::uno::Reference<css::uno::XInterface>> 
m_aClipboards;
+    std::unordered_map<OUString, 
css::uno::Reference<css::datatransfer::clipboard::XClipboard>>
+        m_aClipboards;
 
     std::unique_ptr<QApplication> m_pQApplication;
     std::vector<FreeableCStr> m_pFakeArgvFreeable;
@@ -215,7 +216,7 @@ public:
     css::uno::Reference<css::ui::dialogs::XFolderPicker2>
     createFolderPicker(const 
css::uno::Reference<css::uno::XComponentContext>&) override;
 
-    virtual css::uno::Reference<css::uno::XInterface>
+    virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
     CreateClipboard(const css::uno::Sequence<css::uno::Any>& i_rArguments) 
override;
     virtual css::uno::Reference<css::datatransfer::dnd::XDragSource>
     ImplCreateDragSource(const SystemEnvData*) override;
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index ecc00398f1ef..a07f8200b811 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -27,6 +27,7 @@
 
 #include "displayconnectiondispatch.hxx"
 
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
@@ -78,7 +79,7 @@ class VCL_DLLPUBLIC SalInstance
 private:
     rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
     const std::unique_ptr<comphelper::SolarMutex> m_pYieldMutex;
-    css::uno::Reference<css::uno::XInterface> m_clipboard;
+    css::uno::Reference<css::datatransfer::clipboard::XClipboard> m_clipboard;
 
 protected:
     bool m_bSupportsBitmap32 = false;
@@ -188,7 +189,8 @@ public:
     virtual OUString        GetConnectionIdentifier() = 0;
 
     // dtrans implementation
-    virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const 
css::uno::Sequence< css::uno::Any >& i_rArguments );
+    virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
+    CreateClipboard(const css::uno::Sequence<css::uno::Any>& i_rArguments);
     virtual css::uno::Reference<css::datatransfer::dnd::XDragSource>
     ImplCreateDragSource(const SystemEnvData*);
     virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget>
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 94e3e67d861d..f799071380cd 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -286,7 +286,8 @@ public:
     virtual css::uno::Reference< css::ui::dialogs::XFolderPicker2 >
         createFolderPicker( const css::uno::Reference< 
css::uno::XComponentContext >& ) override;
 
-    virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const 
css::uno::Sequence< css::uno::Any >& i_rArguments ) override;
+    virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
+    CreateClipboard(const css::uno::Sequence<css::uno::Any>& i_rArguments) 
override;
     virtual css::uno::Reference<css::datatransfer::dnd::XDragSource>
     ImplCreateDragSource(const SystemEnvData*) override;
     virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget>
@@ -308,7 +309,7 @@ public:
 
 private:
     GtkSalTimer *m_pTimer;
-    css::uno::Reference<css::uno::XInterface> m_aClipboards[2];
+    css::uno::Reference<css::datatransfer::clipboard::XClipboard> 
m_aClipboards[2];
     bool                        IsTimerExpired();
     bool                        bNeedsInit;
     cairo_font_options_t*       m_pLastCairoFontOptions;
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index a66ee7ecb22c..d28e29781bd7 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -82,8 +82,8 @@ public:
     virtual void                AfterAppInit() override;
 
     // dtrans implementation
-    virtual css::uno::Reference< css::uno::XInterface >
-        CreateClipboard( const css::uno::Sequence< css::uno::Any >& 
i_rArguments ) override;
+    virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
+    CreateClipboard(const css::uno::Sequence<css::uno::Any>& i_rArguments) 
override;
     virtual css::uno::Reference<css::datatransfer::dnd::XDragSource>
     ImplCreateDragSource(const SystemEnvData*) override;
     virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget>
diff --git a/vcl/osx/service_entry.cxx b/vcl/osx/service_entry.cxx
index ab2a505ab737..e85b07c59c04 100644
--- a/vcl/osx/service_entry.cxx
+++ b/vcl/osx/service_entry.cxx
@@ -38,14 +38,15 @@ using namespace ::cppu;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::datatransfer::clipboard;
 
-uno::Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< 
Any >& i_rArguments )
+uno::Reference<css::datatransfer::clipboard::XClipboard>
+AquaSalInstance::CreateClipboard(const Sequence<Any>& i_rArguments)
 {
     if ( Application::IsHeadlessModeEnabled() || o3tl::IsRunningUnitTest() || 
o3tl::IsRunningUITest() )
         return SalInstance::CreateClipboard( i_rArguments );
 
     SalData* pSalData = GetSalData();
     if( ! pSalData->mxClipboard.is() )
-        pSalData->mxClipboard.set(static_cast< XClipboard* >(new 
AquaClipboard(nullptr, true)), UNO_QUERY);
+        pSalData->mxClipboard = new AquaClipboard(nullptr, true);
     return pSalData->mxClipboard;
 }
 
diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index 9bdc19d9bf45..08053ca5a84e 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -627,7 +627,7 @@ QtInstance::createFolderPicker(const 
css::uno::Reference<css::uno::XComponentCon
         createPicker(context, QFileDialog::Directory));
 }
 
-css::uno::Reference<css::uno::XInterface>
+css::uno::Reference<css::datatransfer::clipboard::XClipboard>
 QtInstance::CreateClipboard(const css::uno::Sequence<css::uno::Any>& arguments)
 {
     OUString sel;
@@ -650,7 +650,7 @@ QtInstance::CreateClipboard(const 
css::uno::Sequence<css::uno::Any>& arguments)
     if (it != m_aClipboards.end())
         return it->second;
 
-    css::uno::Reference<css::uno::XInterface> xClipboard
+    css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard
         = EmscriptenLightweightRunInMainThread([&sel] { return 
QtClipboard::create(sel); });
     if (xClipboard.is())
         m_aClipboards[sel] = xClipboard;
diff --git a/vcl/source/components/dtranscomp.cxx 
b/vcl/source/components/dtranscomp.cxx
index 9c4637d536af..5b9298341ad2 100644
--- a/vcl/source/components/dtranscomp.cxx
+++ b/vcl/source/components/dtranscomp.cxx
@@ -412,14 +412,15 @@ Reference< XInterface > DropTarget_createInstance( const 
Reference< XMultiServic
 /*
 *   SalInstance generic
 */
-Reference< XInterface > SalInstance::CreateClipboard( const Sequence< Any >& 
arguments )
+Reference<css::datatransfer::clipboard::XClipboard>
+SalInstance::CreateClipboard(const Sequence<Any>& arguments)
 {
     if (arguments.hasElements()) {
         throw css::lang::IllegalArgumentException(
             u"non-empty SalInstance::CreateClipboard arguments"_ustr, {}, -1);
     }
 #ifdef IOS
-    return getXWeak(new vcl::GenericClipboard());
+    return new vcl::GenericClipboard();
 #else
     if (comphelper::LibreOfficeKit::isActive()) {
         // In LOK, each document view shall have its own clipboard instance 
(whereas
@@ -434,7 +435,7 @@ Reference< XInterface > SalInstance::CreateClipboard( const 
Sequence< Any >& arg
 #endif
     DBG_TESTSOLARMUTEX();
     if (!m_clipboard.is()) {
-        m_clipboard = getXWeak(new vcl::GenericClipboard());
+        m_clipboard = new vcl::GenericClipboard();
     }
     return m_clipboard;
 }
diff --git a/vcl/unx/generic/dtrans/X11_service.cxx 
b/vcl/unx/generic/dtrans/X11_service.cxx
index ae79d46f8767..d45803a0a27c 100644
--- a/vcl/unx/generic/dtrans/X11_service.cxx
+++ b/vcl/unx/generic/dtrans/X11_service.cxx
@@ -59,7 +59,8 @@ Sequence< OUString > 
x11::Xdnd_dropTarget_getSupportedServiceNames()
     return { u"com.sun.star.datatransfer.dnd.X11DropTarget"_ustr };
 }
 
-css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const 
Sequence< Any >& arguments )
+css::uno::Reference<css::datatransfer::clipboard::XClipboard>
+X11SalInstance::CreateClipboard(const Sequence<Any>& arguments)
 {
     if ( o3tl::IsRunningUnitTest() || o3tl::IsRunningUITest() )
         return SalInstance::CreateClipboard( arguments );
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 39fb99323e30..41cef0edf6f0 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -1586,7 +1586,8 @@ void VclGtkClipboard::removeClipboardListener( const 
Reference< datatransfer::cl
     std::erase(m_aListeners, listener);
 }
 
-Reference< XInterface > GtkInstance::CreateClipboard(const Sequence< Any >& 
arguments)
+Reference<css::datatransfer::clipboard::XClipboard>
+GtkInstance::CreateClipboard(const Sequence<Any>& arguments)
 {
     if ( o3tl::IsRunningUnitTest() || o3tl::IsRunningUITest() )
         return SalInstance::CreateClipboard( arguments );
@@ -1605,7 +1606,7 @@ Reference< XInterface > 
GtkInstance::CreateClipboard(const Sequence< Any >& argu
     if (m_aClipboards[eSelection].is())
         return m_aClipboards[eSelection];
 
-    Reference<XInterface> xClipboard(getXWeak(new 
VclGtkClipboard(eSelection)));
+    Reference<css::datatransfer::clipboard::XClipboard> xClipboard(new 
VclGtkClipboard(eSelection));
     m_aClipboards[eSelection] = xClipboard;
     return xClipboard;
 }

Reply via email to