summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-06-02 12:16:29 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-06-02 13:07:37 +0200
commit620cf04907360ce39a03dc2b9f97ac437cdf9a8e (patch)
tree420e7e5e8a8c77083113f3a96105eccfead03893 /desktop
parent733a6b4f8eac9d9b93d7ea9c605bebab9f5345dd (diff)
fix handling of XTransferable2 if the type is only XTransferable
Apparently some selections provide only XTransferable and not XTransferable2, making this entire call think that there's no selection at all. Handle that properly, and if XTransferable2 is not provided, then presumably it's not important to check for isComplex(). Change-Id: I3bbafe46a6b9ac8552c62e524137e1691b54895a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135300 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e5b0412d7cef..c833bc817c0d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4667,14 +4667,15 @@ static int doc_getSelectionType(LibreOfficeKitDocument* pThis)
return LOK_SELTYPE_NONE;
}
- css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(pDoc->getSelection(), css::uno::UNO_QUERY);
+ css::uno::Reference<css::datatransfer::XTransferable> xTransferable = pDoc->getSelection();
if (!xTransferable)
{
SetLastExceptionMsg("No selection available");
return LOK_SELTYPE_NONE;
}
- if (xTransferable->isComplex())
+ css::uno::Reference<css::datatransfer::XTransferable2> xTransferable2(xTransferable, css::uno::UNO_QUERY);
+ if (xTransferable2.is() && xTransferable2->isComplex())
return LOK_SELTYPE_COMPLEX;
OString aRet;
@@ -4704,14 +4705,15 @@ static int doc_getSelectionTypeAndText(LibreOfficeKitDocument* pThis, const char
return LOK_SELTYPE_NONE;
}
- css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(pDoc->getSelection(), css::uno::UNO_QUERY);
+ css::uno::Reference<css::datatransfer::XTransferable> xTransferable = pDoc->getSelection();
if (!xTransferable)
{
SetLastExceptionMsg("No selection available");
return LOK_SELTYPE_NONE;
}
- if (xTransferable->isComplex())
+ css::uno::Reference<css::datatransfer::XTransferable2> xTransferable2(xTransferable, css::uno::UNO_QUERY);
+ if (xTransferable2.is() && xTransferable2->isComplex())
return LOK_SELTYPE_COMPLEX;
const char *pType = pMimeType;