accessibility/source/extended/accessibleiconchoicectrlentry.cxx |    9 
+++++++--
 accessibility/source/extended/accessiblelistboxentry.cxx        |    9 
+++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 9a493013f2f3b116a21266c14952e507c475f419
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Dec 13 18:40:07 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Dec 13 20:53:06 2024 +0100

    a11y: Port from svtools to vcl clipboard helper
    
    Switch from using svt::OStringTransfer::CopyString
    to vcl::unohelper::TextDataObject::CopyStringTo
    to copy a string to the clipboard, to avoid
    a dependency on the svtools library for this task.
    
    Change-Id: I5226c28b5519d4fc020f45d7967b9ad15aab0dae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178438
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx 
b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
index 991a417e080c..a27abb27198e 100644
--- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -22,13 +22,14 @@
 #include <com/sun/star/awt/Rectangle.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/unohelp.hxx>
+#include <vcl/unohelp2.hxx>
 #include <unotools/accessiblerelationsethelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
-#include <svtools/stringtransfer.hxx>
 #include <comphelper/accessibleeventnotifier.hxx>
 #include <i18nlangtag/languagetag.hxx>
 
@@ -429,8 +430,12 @@ namespace accessibility
             || ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) )
             throw IndexOutOfBoundsException();
 
+        if (!m_pIconCtrl)
+            return false;
+
         sal_Int32 nLen = nEndIndex - nStartIndex + 1;
-        ::svt::OStringTransfer::CopyString( sText.copy( nStartIndex, nLen ), 
m_pIconCtrl );
+        css::uno::Reference<css::datatransfer::clipboard::XClipboard> 
xClipBoard = m_pIconCtrl->GetClipboard();
+        vcl::unohelper::TextDataObject::CopyStringTo(sText.copy(nStartIndex, 
nLen), xClipBoard);
 
         return true;
     }
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx 
b/accessibility/source/extended/accessiblelistboxentry.cxx
index f88825818257..10ce865c4f61 100644
--- a/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -20,18 +20,19 @@
 #include <extended/accessiblelistboxentry.hxx>
 #include <extended/accessiblelistbox.hxx>
 #include <vcl/toolkit/treelistbox.hxx>
-#include <svtools/stringtransfer.hxx>
 #include <vcl/toolkit/svlbitm.hxx>
 #include <com/sun/star/awt/Rectangle.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <i18nlangtag/languagetag.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/unohelp.hxx>
+#include <vcl/unohelp2.hxx>
 #include <unotools/accessiblerelationsethelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <comphelper/accessibleeventnotifier.hxx>
@@ -666,8 +667,12 @@ namespace accessibility
             || ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) )
             throw IndexOutOfBoundsException();
 
+        if (!m_pTreeListBox)
+            return false;
+
         sal_Int32 nLen = nEndIndex - nStartIndex + 1;
-        ::svt::OStringTransfer::CopyString( sText.copy( nStartIndex, nLen ), 
m_pTreeListBox );
+        css::uno::Reference<css::datatransfer::clipboard::XClipboard> 
xClipBoard = m_pTreeListBox->GetClipboard();
+        vcl::unohelper::TextDataObject::CopyStringTo(sText.copy(nStartIndex, 
nLen), xClipBoard);
 
         return true;
     }

Reply via email to