[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 18 05:39:18 UTC 2019


 vcl/inc/qt5/Qt5Clipboard.hxx |   44 +++++++++++-------------
 vcl/qt5/Qt5Clipboard.cxx     |   76 ++++++++++++++++++++++---------------------
 vcl/qt5/Qt5DragAndDrop.cxx   |   33 +++++++++---------
 vcl/qt5/Qt5Instance.cxx      |   12 +++---
 4 files changed, 84 insertions(+), 81 deletions(-)

New commits:
commit 901b2956839fa117de6d0dbcd320ffdf48ef0360
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri May 31 16:34:37 2019 +0000
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Tue Jun 18 07:38:32 2019 +0200

    Qt5 remove header using namespaces and Vcl prefix
    
    This is mainly about the using namespace in the Qt5Clipboard
    header. While at it get rid of the Vcl prefix.
    
    Change-Id: I62a804a83afe2feb4bf130eb5475790bc52365c4
    Reviewed-on: https://gerrit.libreoffice.org/73287
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit 6e8448cdf0541f017e8b54734dd0928e935c73fa)
    Reviewed-on: https://gerrit.libreoffice.org/74204
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/vcl/inc/qt5/Qt5Clipboard.hxx b/vcl/inc/qt5/Qt5Clipboard.hxx
index 7539b748dc23..fb79ec463717 100644
--- a/vcl/inc/qt5/Qt5Clipboard.hxx
+++ b/vcl/inc/qt5/Qt5Clipboard.hxx
@@ -21,10 +21,6 @@
 
 #include <QtGui/QClipboard>
 
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-
 class Qt5Transferable : public cppu::WeakImplHelper<css::datatransfer::XTransferable>
 {
 public:
@@ -44,31 +40,30 @@ private:
     QClipboard::Mode m_aClipboardMode;
 };
 
-class VclQt5Clipboard
+class Qt5Clipboard
     : public QObject,
-      public cppu::WeakComponentImplHelper<datatransfer::clipboard::XSystemClipboard,
-                                           datatransfer::clipboard::XFlushableClipboard,
-                                           XServiceInfo>
+      public cppu::WeakComponentImplHelper<css::datatransfer::clipboard::XSystemClipboard,
+                                           css::datatransfer::clipboard::XFlushableClipboard,
+                                           css::lang::XServiceInfo>
 {
     Q_OBJECT
 
-private Q_SLOTS:
-    void handleClipboardChange(QClipboard::Mode mode);
-
-private:
     osl::Mutex m_aMutex;
-    Reference<css::datatransfer::XTransferable> m_aContents;
-    Reference<css::datatransfer::clipboard::XClipboardOwner> m_aOwner;
-    std::vector<Reference<css::datatransfer::clipboard::XClipboardListener>> m_aListeners;
+    css::uno::Reference<css::datatransfer::XTransferable> m_aContents;
+    css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner> m_aOwner;
+    std::vector<css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>> m_aListeners;
     OUString m_aClipboardName;
     QClipboard::Mode m_aClipboardMode;
     // custom MIME type to detect whether clipboard content was added by self or externally
     const QString m_sMimeTypeUuid = "application/x-libreoffice-clipboard-uuid";
     const QByteArray m_aUuid;
 
+private Q_SLOTS:
+    void handleClipboardChange(QClipboard::Mode mode);
+
 public:
-    explicit VclQt5Clipboard(const OUString& aModeString);
-    virtual ~VclQt5Clipboard() override;
+    explicit Qt5Clipboard(const OUString& aModeString);
+    virtual ~Qt5Clipboard() override;
 
     /*
      * XServiceInfo
@@ -76,17 +71,18 @@ public:
 
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
-    virtual Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+    virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
 
     /*
      * XClipboard
      */
 
-    virtual Reference<css::datatransfer::XTransferable> SAL_CALL getContents() override;
+    virtual css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL getContents() override;
 
     virtual void SAL_CALL setContents(
-        const Reference<css::datatransfer::XTransferable>& xTrans,
-        const Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner) override;
+        const css::uno::Reference<css::datatransfer::XTransferable>& xTrans,
+        const css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner)
+        override;
 
     virtual OUString SAL_CALL getName() override;
 
@@ -105,10 +101,12 @@ public:
      * XClipboardNotifier
      */
     virtual void SAL_CALL addClipboardListener(
-        const Reference<css::datatransfer::clipboard::XClipboardListener>& listener) override;
+        const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener)
+        override;
 
     virtual void SAL_CALL removeClipboardListener(
-        const Reference<css::datatransfer::clipboard::XClipboardListener>& listener) override;
+        const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener)
+        override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Clipboard.cxx b/vcl/qt5/Qt5Clipboard.cxx
index 6d333d498ff2..8f9c373836bb 100644
--- a/vcl/qt5/Qt5Clipboard.cxx
+++ b/vcl/qt5/Qt5Clipboard.cxx
@@ -25,6 +25,8 @@
 
 #include <map>
 
+using namespace com::sun::star;
+
 namespace
 {
 std::map<OUString, QClipboard::Mode> g_nameToClipboardMap
@@ -95,7 +97,7 @@ std::vector<css::datatransfer::DataFlavor> Qt5Transferable::getTransferDataFlavo
             else
             {
                 aFlavor.MimeType = toOUString(rMimeType);
-                aFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get();
+                aFlavor.DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get();
                 aVector.push_back(aFlavor);
             }
         }
@@ -143,7 +145,8 @@ Qt5Transferable::getTransferData(const css::datatransfer::DataFlavor& rFlavor)
         {
             QString clipboardContent = mimeData->html();
             std::string aStr = clipboardContent.toStdString();
-            Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(aStr.c_str()), aStr.length());
+            uno::Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(aStr.c_str()),
+                                         aStr.length());
             aRet <<= aSeq;
         }
         else if (rFlavor.MimeType.startsWith("image") && mimeData->hasImage())
@@ -157,7 +160,7 @@ Qt5Transferable::getTransferData(const css::datatransfer::DataFlavor& rFlavor)
             buffer.open(QIODevice::WriteOnly);
             image.save(&buffer, sFormat.toUtf8().getStr());
 
-            Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(ba.data()), ba.size());
+            uno::Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(ba.data()), ba.size());
             aRet <<= aSeq;
         }
     }
@@ -165,7 +168,7 @@ Qt5Transferable::getTransferData(const css::datatransfer::DataFlavor& rFlavor)
     return aRet;
 }
 
-VclQt5Clipboard::VclQt5Clipboard(const OUString& aModeString)
+Qt5Clipboard::Qt5Clipboard(const OUString& aModeString)
     : cppu::WeakComponentImplHelper<datatransfer::clipboard::XSystemClipboard,
                                     datatransfer::clipboard::XFlushableClipboard, XServiceInfo>(
           m_aMutex)
@@ -174,34 +177,34 @@ VclQt5Clipboard::VclQt5Clipboard(const OUString& aModeString)
     , m_aUuid(QUuid::createUuid().toByteArray())
 {
     connect(QApplication::clipboard(), &QClipboard::changed, this,
-            &VclQt5Clipboard::handleClipboardChange, Qt::DirectConnection);
+            &Qt5Clipboard::handleClipboardChange, Qt::DirectConnection);
 }
 
-void VclQt5Clipboard::flushClipboard()
+void Qt5Clipboard::flushClipboard()
 {
     SolarMutexGuard aGuard;
     return;
 }
 
-VclQt5Clipboard::~VclQt5Clipboard() {}
+Qt5Clipboard::~Qt5Clipboard() {}
 
-OUString VclQt5Clipboard::getImplementationName()
+OUString Qt5Clipboard::getImplementationName()
 {
-    return OUString("com.sun.star.datatransfer.VclQt5Clipboard");
+    return OUString("com.sun.star.datatransfer.Qt5Clipboard");
 }
 
-Sequence<OUString> VclQt5Clipboard::getSupportedServiceNames()
+uno::Sequence<OUString> Qt5Clipboard::getSupportedServiceNames()
 {
-    Sequence<OUString> aRet{ "com.sun.star.datatransfer.clipboard.SystemClipboard" };
+    uno::Sequence<OUString> aRet{ "com.sun.star.datatransfer.clipboard.SystemClipboard" };
     return aRet;
 }
 
-sal_Bool VclQt5Clipboard::supportsService(const OUString& ServiceName)
+sal_Bool Qt5Clipboard::supportsService(const OUString& ServiceName)
 {
     return cppu::supportsService(this, ServiceName);
 }
 
-Reference<css::datatransfer::XTransferable> VclQt5Clipboard::getContents()
+uno::Reference<css::datatransfer::XTransferable> Qt5Clipboard::getContents()
 {
     if (!m_aContents.is())
         m_aContents = new Qt5Transferable(m_aClipboardMode);
@@ -209,17 +212,18 @@ Reference<css::datatransfer::XTransferable> VclQt5Clipboard::getContents()
     return m_aContents;
 }
 
-void VclQt5Clipboard::setContents(
-    const Reference<css::datatransfer::XTransferable>& xTrans,
-    const Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner)
+void Qt5Clipboard::setContents(
+    const uno::Reference<css::datatransfer::XTransferable>& xTrans,
+    const uno::Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner)
 {
     osl::ClearableMutexGuard aGuard(m_aMutex);
-    Reference<datatransfer::clipboard::XClipboardOwner> xOldOwner(m_aOwner);
-    Reference<datatransfer::XTransferable> xOldContents(m_aContents);
+    uno::Reference<datatransfer::clipboard::XClipboardOwner> xOldOwner(m_aOwner);
+    uno::Reference<datatransfer::XTransferable> xOldContents(m_aContents);
     m_aContents = xTrans;
     m_aOwner = xClipboardOwner;
 
-    std::vector<Reference<datatransfer::clipboard::XClipboardListener>> aListeners(m_aListeners);
+    std::vector<uno::Reference<datatransfer::clipboard::XClipboardListener>> aListeners(
+        m_aListeners);
     datatransfer::clipboard::ClipboardEvent aEv;
 
     QClipboard* clipboard = QApplication::clipboard();
@@ -264,9 +268,9 @@ void VclQt5Clipboard::setContents(
         {
             css::datatransfer::DataFlavor aFlavor;
             aFlavor.MimeType = "text/html";
-            aFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get();
+            aFlavor.DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get();
 
-            Any aValue;
+            uno::Any aValue;
             try
             {
                 aValue = xTrans->getTransferData(aFlavor);
@@ -275,9 +279,9 @@ void VclQt5Clipboard::setContents(
             {
             }
 
-            if (aValue.getValueType() == cppu::UnoType<Sequence<sal_Int8>>::get())
+            if (aValue.getValueType() == cppu::UnoType<uno::Sequence<sal_Int8>>::get())
             {
-                Sequence<sal_Int8> aData;
+                uno::Sequence<sal_Int8> aData;
                 aValue >>= aData;
 
                 OUString aHtmlAsString(reinterpret_cast<const char*>(aData.getConstArray()),
@@ -293,9 +297,9 @@ void VclQt5Clipboard::setContents(
             css::datatransfer::DataFlavor aFlavor;
             //FIXME: other image formats?
             aFlavor.MimeType = "image/png";
-            aFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get();
+            aFlavor.DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get();
 
-            Any aValue;
+            uno::Any aValue;
             try
             {
                 aValue = xTrans->getTransferData(aFlavor);
@@ -304,9 +308,9 @@ void VclQt5Clipboard::setContents(
             {
             }
 
-            if (aValue.getValueType() == cppu::UnoType<Sequence<sal_Int8>>::get())
+            if (aValue.getValueType() == cppu::UnoType<uno::Sequence<sal_Int8>>::get())
             {
-                Sequence<sal_Int8> aData;
+                uno::Sequence<sal_Int8> aData;
                 aValue >>= aData;
 
                 QImage image;
@@ -324,7 +328,7 @@ void VclQt5Clipboard::setContents(
             aFlavor.MimeType = "text/plain;charset=utf-16";
             aFlavor.DataType = cppu::UnoType<OUString>::get();
 
-            Any aValue;
+            uno::Any aValue;
             try
             {
                 aValue = xTrans->getTransferData(aFlavor);
@@ -333,7 +337,7 @@ void VclQt5Clipboard::setContents(
             {
             }
 
-            if (aValue.getValueTypeClass() == TypeClass_STRING)
+            if (aValue.getValueTypeClass() == uno::TypeClass_STRING)
             {
                 OUString aString;
                 aValue >>= aString;
@@ -359,20 +363,20 @@ void VclQt5Clipboard::setContents(
     }
 }
 
-OUString VclQt5Clipboard::getName() { return m_aClipboardName; }
+OUString Qt5Clipboard::getName() { return m_aClipboardName; }
 
-sal_Int8 VclQt5Clipboard::getRenderingCapabilities() { return 0; }
+sal_Int8 Qt5Clipboard::getRenderingCapabilities() { return 0; }
 
-void VclQt5Clipboard::addClipboardListener(
-    const Reference<datatransfer::clipboard::XClipboardListener>& listener)
+void Qt5Clipboard::addClipboardListener(
+    const uno::Reference<datatransfer::clipboard::XClipboardListener>& listener)
 {
     osl::ClearableMutexGuard aGuard(m_aMutex);
 
     m_aListeners.push_back(listener);
 }
 
-void VclQt5Clipboard::removeClipboardListener(
-    const Reference<datatransfer::clipboard::XClipboardListener>& listener)
+void Qt5Clipboard::removeClipboardListener(
+    const uno::Reference<datatransfer::clipboard::XClipboardListener>& listener)
 {
     osl::ClearableMutexGuard aGuard(m_aMutex);
 
@@ -380,7 +384,7 @@ void VclQt5Clipboard::removeClipboardListener(
                        m_aListeners.end());
 }
 
-void VclQt5Clipboard::handleClipboardChange(QClipboard::Mode aMode)
+void Qt5Clipboard::handleClipboardChange(QClipboard::Mode aMode)
 {
     // if system clipboard content has changed and current content was not created by
     // this clipboard itself, clear the own current content
diff --git a/vcl/qt5/Qt5DragAndDrop.cxx b/vcl/qt5/Qt5DragAndDrop.cxx
index 001302fef0d0..aec98fde73ee 100644
--- a/vcl/qt5/Qt5DragAndDrop.cxx
+++ b/vcl/qt5/Qt5DragAndDrop.cxx
@@ -22,8 +22,6 @@
 #include <Qt5Widget.hxx>
 
 using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
 
 Qt5DnDTransferable::Qt5DnDTransferable(const QMimeData* pMimeData)
     : Qt5Transferable(QClipboard::Clipboard)
@@ -56,7 +54,8 @@ css::uno::Any Qt5DnDTransferable::getTransferData(const css::datatransfer::DataF
                     aStr += "\n";
             }
 
-            Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(aStr.c_str()), aStr.length());
+            uno::Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(aStr.c_str()),
+                                         aStr.length());
             aAny <<= aSeq;
         }
     }
@@ -85,7 +84,7 @@ std::vector<css::datatransfer::DataFlavor> Qt5DnDTransferable::getTransferDataFl
             else
             {
                 aFlavor.MimeType = toOUString(rMimeType);
-                aFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get();
+                aFlavor.DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get();
                 aVector.push_back(aFlavor);
             }
         }
@@ -114,8 +113,8 @@ void Qt5DragSource::initialize(const css::uno::Sequence<css::uno::Any>& rArgumen
 {
     if (rArguments.getLength() < 2)
     {
-        throw RuntimeException("DragSource::initialize: Cannot install window event handler",
-                               static_cast<OWeakObject*>(this));
+        throw uno::RuntimeException("DragSource::initialize: Cannot install window event handler",
+                                    static_cast<OWeakObject*>(this));
     }
 
     sal_IntPtr nFrame = 0;
@@ -123,8 +122,8 @@ void Qt5DragSource::initialize(const css::uno::Sequence<css::uno::Any>& rArgumen
 
     if (!nFrame)
     {
-        throw RuntimeException("DragSource::initialize: missing SalFrame",
-                               static_cast<OWeakObject*>(this));
+        throw uno::RuntimeException("DragSource::initialize: missing SalFrame",
+                                    static_cast<OWeakObject*>(this));
     }
 
     m_pFrame = reinterpret_cast<Qt5Frame*>(nFrame);
@@ -198,7 +197,7 @@ sal_Bool SAL_CALL Qt5DragSource::supportsService(OUString const& ServiceName)
 
 css::uno::Sequence<OUString> SAL_CALL Qt5DragSource::getSupportedServiceNames()
 {
-    Sequence<OUString> aRet{ "com.sun.star.datatransfer.dnd.Qt5DragSource" };
+    uno::Sequence<OUString> aRet{ "com.sun.star.datatransfer.dnd.Qt5DragSource" };
     return aRet;
 }
 
@@ -222,7 +221,7 @@ sal_Bool SAL_CALL Qt5DropTarget::supportsService(OUString const& ServiceName)
 
 css::uno::Sequence<OUString> SAL_CALL Qt5DropTarget::getSupportedServiceNames()
 {
-    Sequence<OUString> aRet{ "com.sun.star.datatransfer.dnd.Qt5DropTarget" };
+    uno::Sequence<OUString> aRet{ "com.sun.star.datatransfer.dnd.Qt5DropTarget" };
     return aRet;
 }
 
@@ -238,12 +237,12 @@ void Qt5DropTarget::deinitialize()
     m_bActive = false;
 }
 
-void Qt5DropTarget::initialize(const Sequence<Any>& rArguments)
+void Qt5DropTarget::initialize(const uno::Sequence<uno::Any>& rArguments)
 {
     if (rArguments.getLength() < 2)
     {
-        throw RuntimeException("DropTarget::initialize: Cannot install window event handler",
-                               static_cast<OWeakObject*>(this));
+        throw uno::RuntimeException("DropTarget::initialize: Cannot install window event handler",
+                                    static_cast<OWeakObject*>(this));
     }
 
     sal_IntPtr nFrame = 0;
@@ -251,8 +250,8 @@ void Qt5DropTarget::initialize(const Sequence<Any>& rArguments)
 
     if (!nFrame)
     {
-        throw RuntimeException("DropTarget::initialize: missing SalFrame",
-                               static_cast<OWeakObject*>(this));
+        throw uno::RuntimeException("DropTarget::initialize: missing SalFrame",
+                                    static_cast<OWeakObject*>(this));
     }
 
     mnDragAction = datatransfer::dnd::DNDConstants::ACTION_NONE;
@@ -264,7 +263,7 @@ void Qt5DropTarget::initialize(const Sequence<Any>& rArguments)
 }
 
 void Qt5DropTarget::addDropTargetListener(
-    const Reference<css::datatransfer::dnd::XDropTargetListener>& xListener)
+    const uno::Reference<css::datatransfer::dnd::XDropTargetListener>& xListener)
 {
     ::osl::Guard<::osl::Mutex> aGuard(m_aMutex);
 
@@ -272,7 +271,7 @@ void Qt5DropTarget::addDropTargetListener(
 }
 
 void Qt5DropTarget::removeDropTargetListener(
-    const Reference<css::datatransfer::dnd::XDropTargetListener>& xListener)
+    const uno::Reference<css::datatransfer::dnd::XDropTargetListener>& xListener)
 {
     ::osl::Guard<::osl::Mutex> aGuard(m_aMutex);
 
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 7256ea77ed49..d260536683e7 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -449,20 +449,22 @@ Qt5Instance::CreateClipboard(const css::uno::Sequence<css::uno::Any>& arguments)
     }
 
     css::uno::Reference<css::uno::XInterface> xClipboard(
-        static_cast<cppu::OWeakObject*>(new VclQt5Clipboard(sel)));
+        static_cast<cppu::OWeakObject*>(new Qt5Clipboard(sel)));
     m_aClipboards[sel] = xClipboard;
 
     return xClipboard;
 }
 
-Reference<XInterface> Qt5Instance::CreateDragSource()
+css::uno::Reference<css::uno::XInterface> Qt5Instance::CreateDragSource()
 {
-    return Reference<XInterface>(static_cast<cppu::OWeakObject*>(new Qt5DragSource()));
+    return css::uno::Reference<css::uno::XInterface>(
+        static_cast<cppu::OWeakObject*>(new Qt5DragSource()));
 }
 
-Reference<XInterface> Qt5Instance::CreateDropTarget()
+css::uno::Reference<css::uno::XInterface> Qt5Instance::CreateDropTarget()
 {
-    return Reference<XInterface>(static_cast<cppu::OWeakObject*>(new Qt5DropTarget()));
+    return css::uno::Reference<css::uno::XInterface>(
+        static_cast<cppu::OWeakObject*>(new Qt5DropTarget()));
 }
 
 IMPL_LINK_NOARG(Qt5Instance, updateStyleHdl, Timer*, void)


More information about the Libreoffice-commits mailing list