summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-01-12 16:25:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-01-13 18:13:51 +0000
commitd60722e29a0dde6282915188e5ff7e24890a14d3 (patch)
treef69b4c7e4b4abb44cbbfd3235a3136dff833a386 /sw
parentd4d046bb9c5d17cdd432b362c38914cc7b0a75f1 (diff)
XUnoTunnel->dynamic_cast in TransferableHelper
which leads us to find that we can skip all the dynamic_cast'ing altogether in SwView_Impl Change-Id: I8914f78df6bfdd743df370c0017d5b8521863594 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145483 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx14
-rw-r--r--sw/source/uibase/inc/swdtflvr.hxx3
-rw-r--r--sw/source/uibase/inc/uivwimp.hxx3
-rw-r--r--sw/source/uibase/uiview/uivwimp.cxx7
4 files changed, 6 insertions, 21 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index d9a6db5c1bb5..43308154fcb1 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -4351,21 +4351,9 @@ void SwTransferable::ClearSelection( const SwWrtShell& rSh,
}
}
-const Sequence< sal_Int8 >& SwTransferable::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit theSwTransferableUnoTunnelId;
- return theSwTransferableUnoTunnelId.getSeq();
-}
-
-sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<TransferableHelper>{});
-}
-
SwTransferable* SwTransferable::GetSwTransferable( const TransferableDataHelper& rData )
{
- return comphelper::getFromUnoTunnel<SwTransferable>(rData.GetTransferable());
+ return dynamic_cast<SwTransferable*>(rData.GetTransferable().get());
}
SwTransferDdeLink::SwTransferDdeLink( SwTransferable& rTrans, SwWrtShell& rSh )
diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx
index df16e3a8bd56..375ca33a128d 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -237,9 +237,6 @@ public:
// the related SwView is being closed and the SwTransferable is invalid now
void Invalidate() {m_pWrtShell = nullptr;}
- static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
-
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override;
static void SelectPasteFormat(TransferableDataHelper& rData, sal_uInt8& nAction,
SotClipboardFormatId& nFormat);
diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index 1cb5fd6590ed..352469f33401 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
+#include <unotools/weakref.hxx>
class SwXTextView;
class SfxRequest;
@@ -86,7 +87,7 @@ class SwView_Impl
{
css::uno::Reference< css::frame::XDispatchProviderInterceptor > m_xDispatchProviderInterceptor;
css::uno::Reference< css::view::XSelectionSupplier > mxXTextView; // UNO object
- std::vector< css::uno::WeakReference< css::lang::XUnoTunnel > > mxTransferables;
+ std::vector< unotools::WeakReference< SwTransferable > > mxTransferables;
// temporary document for printing text of selection / multi selection
// in PDF export.
diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx
index cea09ed3b5ba..efe2a713d635 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -212,7 +212,7 @@ void SwView_Impl::Invalidate()
GetUNOObject_Impl()->Invalidate();
for (const auto& xTransferable: mxTransferables)
{
- auto pTransferable = comphelper::getFromUnoTunnel<SwTransferable>(xTransferable.get());
+ auto pTransferable = xTransferable.get().get();
if(pTransferable)
pTransferable->Invalidate();
}
@@ -225,9 +225,8 @@ void SwView_Impl::AddTransferable(SwTransferable& rTransferable)
{
// Remove previously added, but no longer existing weak references.
mxTransferables.erase(std::remove_if(mxTransferables.begin(), mxTransferables.end(),
- [](const css::uno::WeakReference<css::lang::XUnoTunnel>& rTunnel) {
- uno::Reference<lang::XUnoTunnel> xTunnel(rTunnel.get(), uno::UNO_QUERY);
- return !xTunnel.is();
+ [](const unotools::WeakReference<SwTransferable>& rTunnel) {
+ return !rTunnel.get();
}), mxTransferables.end());
mxTransferables.emplace_back(&rTransferable);