[Libreoffice-commits] core.git: vcl/inc vcl/Library_vclplug_qt5.mk vcl/qt5
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 3 14:35:47 UTC 2019
vcl/Library_vclplug_qt5.mk | 1
vcl/inc/qt5/Qt5Clipboard.hxx | 22 -----
vcl/inc/qt5/Qt5DragAndDrop.hxx | 18 ----
vcl/inc/qt5/Qt5Transferable.hxx | 56 +++++++++++++
vcl/qt5/Qt5Clipboard.cxx | 131 ++-----------------------------
vcl/qt5/Qt5DragAndDrop.cxx | 79 ------------------
vcl/qt5/Qt5Frame.cxx | 1
vcl/qt5/Qt5Transferable.cxx | 167 ++++++++++++++++++++++++++++++++++++++++
8 files changed, 239 insertions(+), 236 deletions(-)
New commits:
commit 2f0114b6244af429def59e107bd0b2835818913c
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sat Jun 1 03:36:36 2019 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Mon Jun 3 16:34:49 2019 +0200
Qt5 refactor and move XTransferable implementations
There is already duplicate code getTransferDataFlavorsAsVector.
Maybe getTransferData can be also merged later.
Change-Id: Iaa1c16990c1f19757f04944bcd21f395f6b8f69b
Reviewed-on: https://gerrit.libreoffice.org/73301
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 4b49eba7504d..3231672c8743 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -107,6 +107,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/Qt5System \
vcl/qt5/Qt5Timer \
vcl/qt5/Qt5Tools \
+ vcl/qt5/Qt5Transferable \
vcl/qt5/Qt5VirtualDevice \
vcl/qt5/Qt5Widget \
vcl/qt5/Qt5XAccessible \
diff --git a/vcl/inc/qt5/Qt5Clipboard.hxx b/vcl/inc/qt5/Qt5Clipboard.hxx
index fb79ec463717..2c2bb93f5016 100644
--- a/vcl/inc/qt5/Qt5Clipboard.hxx
+++ b/vcl/inc/qt5/Qt5Clipboard.hxx
@@ -10,36 +10,16 @@
#pragma once
-#include <cppuhelper/compbase.hxx>
-
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp>
#include <com/sun/star/datatransfer/clipboard/XSystemClipboard.hpp>
#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
+#include <cppuhelper/compbase.hxx>
#include <QtGui/QClipboard>
-class Qt5Transferable : public cppu::WeakImplHelper<css::datatransfer::XTransferable>
-{
-public:
- explicit Qt5Transferable(QClipboard::Mode aMode);
-
- virtual css::uno::Any SAL_CALL
- getTransferData(const css::datatransfer::DataFlavor& rFlavor) override;
-
- virtual std::vector<css::datatransfer::DataFlavor> getTransferDataFlavorsAsVector();
-
- virtual css::uno::Sequence<css::datatransfer::DataFlavor>
- SAL_CALL getTransferDataFlavors() override;
- virtual sal_Bool SAL_CALL
- isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) override;
-
-private:
- QClipboard::Mode m_aClipboardMode;
-};
-
class Qt5Clipboard
: public QObject,
public cppu::WeakComponentImplHelper<css::datatransfer::clipboard::XSystemClipboard,
diff --git a/vcl/inc/qt5/Qt5DragAndDrop.hxx b/vcl/inc/qt5/Qt5DragAndDrop.hxx
index 3547131587f3..dcd6cb5e4048 100644
--- a/vcl/inc/qt5/Qt5DragAndDrop.hxx
+++ b/vcl/inc/qt5/Qt5DragAndDrop.hxx
@@ -10,29 +10,13 @@
#pragma once
-#include <cppuhelper/compbase.hxx>
-#include "Qt5Clipboard.hxx"
-
#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/compbase.hxx>
class Qt5Frame;
-class QMimeData;
-
-class Qt5DnDTransferable : public Qt5Transferable
-{
-public:
- Qt5DnDTransferable(const QMimeData* pMimeData);
- virtual css::uno::Any SAL_CALL
- getTransferData(const css::datatransfer::DataFlavor& rFlavor) override;
-
- virtual std::vector<css::datatransfer::DataFlavor> getTransferDataFlavorsAsVector() override;
-
-private:
- const QMimeData* m_pMimeData;
-};
class Qt5DragSource
: public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDragSource,
diff --git a/vcl/inc/qt5/Qt5Transferable.hxx b/vcl/inc/qt5/Qt5Transferable.hxx
new file mode 100644
index 000000000000..edc14904f769
--- /dev/null
+++ b/vcl/inc/qt5/Qt5Transferable.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <cppuhelper/compbase.hxx>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+
+#include <QtGui/QClipboard>
+
+/**
+ * Abstract XTransferable used for clipboard and D'n'D transfers
+ **/
+class Qt5Transferable : public cppu::WeakImplHelper<css::datatransfer::XTransferable>
+{
+ Qt5Transferable() = delete;
+ Qt5Transferable(const Qt5Transferable&) = delete;
+
+protected:
+ const QMimeData* m_pMimeData;
+
+ Qt5Transferable(const QMimeData* pMimeData);
+ std::vector<css::datatransfer::DataFlavor> getTransferDataFlavorsAsVector();
+
+public:
+ ~Qt5Transferable() override;
+
+ css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL getTransferDataFlavors() override;
+ sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) override;
+};
+
+class Qt5ClipboardTransferable final : public Qt5Transferable
+{
+public:
+ explicit Qt5ClipboardTransferable(QClipboard::Mode aMode);
+ ~Qt5ClipboardTransferable() override;
+
+ css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override;
+};
+
+class Qt5DnDTransferable final : public Qt5Transferable
+{
+public:
+ Qt5DnDTransferable(const QMimeData* pMimeData);
+
+ css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Clipboard.cxx b/vcl/qt5/Qt5Clipboard.cxx
index 8f9c373836bb..2fc97caeb16b 100644
--- a/vcl/qt5/Qt5Clipboard.cxx
+++ b/vcl/qt5/Qt5Clipboard.cxx
@@ -14,13 +14,13 @@
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
-#include <QtWidgets/QApplication>
-#include <QtCore/QBuffer>
#include <QtCore/QMimeData>
#include <QtCore/QUuid>
+#include <QtWidgets/QApplication>
#include <Qt5Clipboard.hxx>
#include <Qt5Clipboard.moc>
+#include <Qt5Transferable.hxx>
#include <Qt5Tools.hxx>
#include <map>
@@ -29,26 +29,20 @@ using namespace com::sun::star;
namespace
{
-std::map<OUString, QClipboard::Mode> g_nameToClipboardMap
- = { { "CLIPBOARD", QClipboard::Clipboard }, { "PRIMARY", QClipboard::Selection } };
-
QClipboard::Mode getClipboardTypeFromName(const OUString& aString)
{
- // use QClipboard::Clipboard as fallback if requested type isn't found
+ static const std::map<OUString, QClipboard::Mode> aNameToClipboardMap
+ = { { "CLIPBOARD", QClipboard::Clipboard }, { "PRIMARY", QClipboard::Selection } };
+
+ // default to QClipboard::Clipboard as fallback
QClipboard::Mode aMode = QClipboard::Clipboard;
- auto iter = g_nameToClipboardMap.find(aString);
- if (iter != g_nameToClipboardMap.end())
- {
+ auto iter = aNameToClipboardMap.find(aString);
+ if (iter != aNameToClipboardMap.end())
aMode = iter->second;
- }
else
- {
SAL_WARN("vcl.qt5", "Unrecognized clipboard type \""
- << aString
- << "\" is requested, falling back to QClipboard::Clipboard");
- }
-
+ << aString << "\"; falling back to QClipboard::Clipboard");
return aMode;
}
@@ -67,107 +61,6 @@ void lcl_peekFormats(const css::uno::Sequence<css::datatransfer::DataFlavor>& rF
}
}
-Qt5Transferable::Qt5Transferable(QClipboard::Mode aMode)
- : m_aClipboardMode(aMode)
-{
-}
-
-std::vector<css::datatransfer::DataFlavor> Qt5Transferable::getTransferDataFlavorsAsVector()
-{
- std::vector<css::datatransfer::DataFlavor> aVector;
-
- const QClipboard* clipboard = QApplication::clipboard();
- const QMimeData* mimeData = clipboard->mimeData(m_aClipboardMode);
- css::datatransfer::DataFlavor aFlavor;
-
- if (mimeData)
- {
- for (QString& rMimeType : mimeData->formats())
- {
- // filter out non-MIME types such as TARGETS, MULTIPLE, TIMESTAMP
- if (rMimeType.indexOf('/') == -1)
- continue;
-
- if (rMimeType.startsWith("text/plain"))
- {
- aFlavor.MimeType = "text/plain;charset=utf-16";
- aFlavor.DataType = cppu::UnoType<OUString>::get();
- aVector.push_back(aFlavor);
- }
- else
- {
- aFlavor.MimeType = toOUString(rMimeType);
- aFlavor.DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get();
- aVector.push_back(aFlavor);
- }
- }
- }
-
- return aVector;
-}
-
-css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL Qt5Transferable::getTransferDataFlavors()
-{
- return comphelper::containerToSequence(getTransferDataFlavorsAsVector());
-}
-
-sal_Bool SAL_CALL
-Qt5Transferable::isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor)
-{
- const std::vector<css::datatransfer::DataFlavor> aAll = getTransferDataFlavorsAsVector();
-
- return std::any_of(aAll.begin(), aAll.end(), [&](const css::datatransfer::DataFlavor& aFlavor) {
- return rFlavor.MimeType == aFlavor.MimeType;
- }); //FIXME
-}
-
-/*
- * XTransferable
- */
-
-css::uno::Any SAL_CALL
-Qt5Transferable::getTransferData(const css::datatransfer::DataFlavor& rFlavor)
-{
- css::uno::Any aRet;
- const QClipboard* clipboard = QApplication::clipboard();
- const QMimeData* mimeData = clipboard->mimeData(m_aClipboardMode);
-
- if (mimeData)
- {
- if (rFlavor.MimeType == "text/plain;charset=utf-16")
- {
- QString clipboardContent = mimeData->text();
- OUString sContent = toOUString(clipboardContent);
-
- aRet <<= sContent.replaceAll("\r\n", "\n");
- }
- else if (rFlavor.MimeType == "text/html")
- {
- QString clipboardContent = mimeData->html();
- std::string aStr = clipboardContent.toStdString();
- 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())
- {
- QImage image = qvariant_cast<QImage>(mimeData->imageData());
- QByteArray ba;
- QBuffer buffer(&ba);
- sal_Int32 nIndex = rFlavor.MimeType.indexOf('/');
- OUString sFormat(nIndex != -1 ? rFlavor.MimeType.copy(nIndex + 1) : "png");
-
- buffer.open(QIODevice::WriteOnly);
- image.save(&buffer, sFormat.toUtf8().getStr());
-
- uno::Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(ba.data()), ba.size());
- aRet <<= aSeq;
- }
- }
-
- return aRet;
-}
-
Qt5Clipboard::Qt5Clipboard(const OUString& aModeString)
: cppu::WeakComponentImplHelper<datatransfer::clipboard::XSystemClipboard,
datatransfer::clipboard::XFlushableClipboard, XServiceInfo>(
@@ -195,8 +88,7 @@ OUString Qt5Clipboard::getImplementationName()
uno::Sequence<OUString> Qt5Clipboard::getSupportedServiceNames()
{
- uno::Sequence<OUString> aRet{ "com.sun.star.datatransfer.clipboard.SystemClipboard" };
- return aRet;
+ return { "com.sun.star.datatransfer.clipboard.SystemClipboard" };
}
sal_Bool Qt5Clipboard::supportsService(const OUString& ServiceName)
@@ -207,8 +99,7 @@ sal_Bool Qt5Clipboard::supportsService(const OUString& ServiceName)
uno::Reference<css::datatransfer::XTransferable> Qt5Clipboard::getContents()
{
if (!m_aContents.is())
- m_aContents = new Qt5Transferable(m_aClipboardMode);
-
+ m_aContents = new Qt5ClipboardTransferable(m_aClipboardMode);
return m_aContents;
}
diff --git a/vcl/qt5/Qt5DragAndDrop.cxx b/vcl/qt5/Qt5DragAndDrop.cxx
index d22d35610ae7..74908d2cba8f 100644
--- a/vcl/qt5/Qt5DragAndDrop.cxx
+++ b/vcl/qt5/Qt5DragAndDrop.cxx
@@ -14,93 +14,16 @@
#include <cppuhelper/supportsservice.hxx>
#include <sal/log.hxx>
-#include <QtCore/QMimeData>
-#include <QtCore/QUrl>
-
#include <Qt5DragAndDrop.hxx>
#include <Qt5Frame.hxx>
#include <Qt5Widget.hxx>
using namespace com::sun::star;
-Qt5DnDTransferable::Qt5DnDTransferable(const QMimeData* pMimeData)
- : Qt5Transferable(QClipboard::Clipboard)
- , m_pMimeData(pMimeData)
-{
-}
-
-css::uno::Any Qt5DnDTransferable::getTransferData(const css::datatransfer::DataFlavor&)
-{
- uno::Any aAny;
- assert(m_pMimeData);
-
- // FIXME: not sure if we should support more mimetypes here
- // (how to carry out external DnD with anything else than [file] URL?)
- if (m_pMimeData->hasUrls())
- {
- QList<QUrl> urlList = m_pMimeData->urls();
-
- if (urlList.size() > 0)
- {
- std::string aStr;
-
- // transfer data is list of URLs
- for (int i = 0; i < urlList.size(); ++i)
- {
- QString url = urlList.at(i).path();
- aStr += url.toStdString();
- // separated by newline if more than 1
- if (i < urlList.size() - 1)
- aStr += "\n";
- }
-
- uno::Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(aStr.c_str()),
- aStr.length());
- aAny <<= aSeq;
- }
- }
- return aAny;
-}
-
-std::vector<css::datatransfer::DataFlavor> Qt5DnDTransferable::getTransferDataFlavorsAsVector()
-{
- std::vector<css::datatransfer::DataFlavor> aVector;
- css::datatransfer::DataFlavor aFlavor;
-
- if (m_pMimeData)
- {
- for (QString& rMimeType : m_pMimeData->formats())
- {
- // filter out non-MIME types such as TARGETS, MULTIPLE, TIMESTAMP
- if (rMimeType.indexOf('/') == -1)
- continue;
-
- if (rMimeType.startsWith("text/plain"))
- {
- aFlavor.MimeType = "text/plain;charset=utf-16";
- aFlavor.DataType = cppu::UnoType<OUString>::get();
- aVector.push_back(aFlavor);
- }
- else
- {
- aFlavor.MimeType = toOUString(rMimeType);
- aFlavor.DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get();
- aVector.push_back(aFlavor);
- }
- }
- }
-
- return aVector;
-}
-
bool Qt5DragSource::m_bDropSuccessSet = false;
bool Qt5DragSource::m_bDropSuccess = false;
-Qt5DragSource::~Qt5DragSource()
-{
- //if (m_pFrame)
- // m_pFrame->deregisterDragSource(this);
-}
+Qt5DragSource::~Qt5DragSource() {}
void Qt5DragSource::deinitialize() { m_pFrame = nullptr; }
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 6d19d825fa1c..a4ad672bab16 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -28,6 +28,7 @@
#include <Qt5Menu.hxx>
#include <Qt5SvpGraphics.hxx>
#include <Qt5Tools.hxx>
+#include <Qt5Transferable.hxx>
#include <Qt5Widget.hxx>
#include <QtCore/QMimeData>
diff --git a/vcl/qt5/Qt5Transferable.cxx b/vcl/qt5/Qt5Transferable.cxx
new file mode 100644
index 000000000000..a78ff8bc712e
--- /dev/null
+++ b/vcl/qt5/Qt5Transferable.cxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <Qt5Transferable.hxx>
+
+#include <comphelper/solarmutex.hxx>
+#include <comphelper/sequence.hxx>
+#include <sal/log.hxx>
+
+#include <QtCore/QBuffer>
+#include <QtCore/QMimeData>
+#include <QtCore/QUrl>
+#include <QtWidgets/QApplication>
+
+#include <Qt5Clipboard.hxx>
+#include <Qt5Tools.hxx>
+
+using namespace com::sun::star;
+
+Qt5Transferable::Qt5Transferable(const QMimeData* pMimeData)
+ : m_pMimeData(pMimeData)
+{
+}
+
+Qt5Transferable::~Qt5Transferable() {}
+
+std::vector<css::datatransfer::DataFlavor> Qt5Transferable::getTransferDataFlavorsAsVector()
+{
+ std::vector<css::datatransfer::DataFlavor> aVector;
+ assert(m_pMimeData);
+ if (!m_pMimeData)
+ return aVector;
+
+ css::datatransfer::DataFlavor aFlavor;
+ for (QString& rMimeType : m_pMimeData->formats())
+ {
+ // filter out non-MIME types such as TARGETS, MULTIPLE, TIMESTAMP
+ if (rMimeType.indexOf('/') == -1)
+ continue;
+
+ aFlavor.MimeType = toOUString(rMimeType);
+ if (rMimeType.startsWith("text/plain"))
+ {
+ aFlavor.MimeType = "text/plain;charset=utf-16";
+ aFlavor.DataType = cppu::UnoType<OUString>::get();
+ aVector.push_back(aFlavor);
+ }
+ else
+ {
+ aFlavor.MimeType = toOUString(rMimeType);
+ aFlavor.DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get();
+ aVector.push_back(aFlavor);
+ }
+ }
+
+ return aVector;
+}
+
+css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL Qt5Transferable::getTransferDataFlavors()
+{
+ return comphelper::containerToSequence(getTransferDataFlavorsAsVector());
+}
+
+sal_Bool SAL_CALL
+Qt5Transferable::isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor)
+{
+ const std::vector<css::datatransfer::DataFlavor> aAll = getTransferDataFlavorsAsVector();
+
+ return std::any_of(aAll.begin(), aAll.end(), [&](const css::datatransfer::DataFlavor& aFlavor) {
+ return rFlavor.MimeType == aFlavor.MimeType;
+ }); //FIXME
+}
+
+Qt5ClipboardTransferable::Qt5ClipboardTransferable(QClipboard::Mode aMode)
+ : Qt5Transferable(QApplication::clipboard()->mimeData(aMode))
+{
+}
+
+Qt5ClipboardTransferable::~Qt5ClipboardTransferable() {}
+
+css::uno::Any SAL_CALL
+Qt5ClipboardTransferable::getTransferData(const css::datatransfer::DataFlavor& rFlavor)
+{
+ css::uno::Any aAny;
+ assert(m_pMimeData);
+ if (!m_pMimeData)
+ return aAny;
+
+ if (rFlavor.MimeType == "text/plain;charset=utf-16")
+ {
+ QString clipboardContent = m_pMimeData->text();
+ OUString sContent = toOUString(clipboardContent);
+
+ aAny <<= sContent.replaceAll("\r\n", "\n");
+ }
+ else if (rFlavor.MimeType == "text/html")
+ {
+ QString clipboardContent = m_pMimeData->html();
+ std::string aStr = clipboardContent.toStdString();
+ uno::Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(aStr.c_str()),
+ aStr.length());
+ aAny <<= aSeq;
+ }
+ else if (rFlavor.MimeType.startsWith("image") && m_pMimeData->hasImage())
+ {
+ QImage image = qvariant_cast<QImage>(m_pMimeData->imageData());
+ QByteArray ba;
+ QBuffer buffer(&ba);
+ sal_Int32 nIndex = rFlavor.MimeType.indexOf('/');
+ OUString sFormat(nIndex != -1 ? rFlavor.MimeType.copy(nIndex + 1) : "png");
+
+ buffer.open(QIODevice::WriteOnly);
+ image.save(&buffer, sFormat.toUtf8().getStr());
+
+ uno::Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(ba.data()), ba.size());
+ aAny <<= aSeq;
+ }
+
+ return aAny;
+}
+
+Qt5DnDTransferable::Qt5DnDTransferable(const QMimeData* pMimeData)
+ : Qt5Transferable(pMimeData)
+{
+}
+
+css::uno::Any Qt5DnDTransferable::getTransferData(const css::datatransfer::DataFlavor&)
+{
+ uno::Any aAny;
+ assert(m_pMimeData);
+
+ // FIXME: not sure if we should support more mimetypes here
+ // (how to carry out external DnD with anything else than [file] URL?)
+ if (m_pMimeData->hasUrls())
+ {
+ QList<QUrl> urlList = m_pMimeData->urls();
+
+ if (urlList.size() > 0)
+ {
+ std::string aStr;
+
+ // transfer data is list of URLs
+ for (int i = 0; i < urlList.size(); ++i)
+ {
+ QString url = urlList.at(i).path();
+ aStr += url.toStdString();
+ // separated by newline if more than 1
+ if (i < urlList.size() - 1)
+ aStr += "\n";
+ }
+
+ uno::Sequence<sal_Int8> aSeq(reinterpret_cast<const sal_Int8*>(aStr.c_str()),
+ aStr.length());
+ aAny <<= aSeq;
+ }
+ }
+ return aAny;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list