diff --git a/unoxml/inc/node.hxx b/unoxml/inc/node.hxx index 852bcd1ae972..c4933dbdc234 100644 --- a/unoxml/inc/node.hxx +++ b/unoxml/inc/node.hxx @@ -32,7 +32,6 @@ #include #include -#include #include #include #include @@ -89,7 +88,8 @@ namespace DOM class CDocument; - class CNode : public cppu::WeakImplHelper< css::xml::dom::XNode, css::lang::XUnoTunnel, css::xml::dom::events::XEventTarget > + class SAL_LOPLUGIN_ANNOTATE("crosscast") CNode + : public cppu::WeakImplHelper< css::xml::dom::XNode, css::xml::dom::events::XEventTarget > { friend class CDocument; friend class CElement; @@ -123,8 +123,6 @@ namespace DOM virtual ~CNode() override; - static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; - xmlNodePtr GetNodePtr() { return m_aNodePtr; } virtual CDocument & GetOwnerDocument(); @@ -290,10 +288,6 @@ namespace DOM sal_Bool useCapture) override; virtual sal_Bool SAL_CALL dispatchEvent(const css::uno::Reference< css::xml::dom::events::XEvent >& evt) override; - - // --- XUnoTunnel - virtual ::sal_Int64 SAL_CALL - getSomething(css::uno::Sequence< ::sal_Int8 > const& rId) override; }; /// eliminate redundant namespace declarations diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index 757ac1c17de4..06917c1f400e 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -470,7 +470,7 @@ namespace DOM } ::rtl::Reference const pCNode( - comphelper::getFromUnoTunnel(Reference(oldAttr))); + dynamic_cast(oldAttr.get())); if (!pCNode.is()) { throw RuntimeException(); } xmlNodePtr const pNode = pCNode->GetNodePtr(); @@ -529,8 +529,7 @@ namespace DOM } // get the implementation - CAttr *const pCAttr = dynamic_cast( - comphelper::getFromUnoTunnel(xNewAttr)); + CAttr *const pCAttr = dynamic_cast(xNewAttr.get()); if (!pCAttr) { throw RuntimeException(); } xmlAttrPtr const pAttr = reinterpret_cast(pCAttr->GetNodePtr()); diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index f5bd99aef475..c60c5e9a0bb3 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -161,12 +161,6 @@ namespace DOM } } - const css::uno::Sequence< sal_Int8 > & CNode::getUnoTunnelId() noexcept - { - static const comphelper::UnoIdInit theCNodeUnoTunnelId; - return theCNodeUnoTunnelId.getSeq(); - } - CDocument & CNode::GetOwnerDocument() { OSL_ASSERT(m_xDocument.is()); @@ -300,7 +294,7 @@ namespace DOM if (nullptr == m_aNodePtr) { return nullptr; } - CNode *const pNewChild(comphelper::getFromUnoTunnel(xNewChild)); + CNode *const pNewChild(dynamic_cast(xNewChild.get())); if (!pNewChild) { throw RuntimeException(); } xmlNodePtr const cur = pNewChild->GetNodePtr(); if (!cur) { throw RuntimeException(); } @@ -639,8 +633,8 @@ namespace DOM ::osl::ClearableMutexGuard guard(m_rMutex); - CNode *const pNewNode(comphelper::getFromUnoTunnel(newChild)); - CNode *const pRefNode(comphelper::getFromUnoTunnel(refChild)); + CNode *const pNewNode(dynamic_cast(newChild.get())); + CNode *const pRefNode(dynamic_cast(refChild.get())); if (!pNewNode || !pRefNode) { throw RuntimeException(); } xmlNodePtr const pNewChild(pNewNode->GetNodePtr()); xmlNodePtr const pRefChild(pRefNode->GetNodePtr()); @@ -740,7 +734,7 @@ namespace DOM Reference xReturn( xOldChild ); - ::rtl::Reference const pOld(comphelper::getFromUnoTunnel(xOldChild)); + ::rtl::Reference const pOld(dynamic_cast(xOldChild.get())); if (!pOld.is()) { throw RuntimeException(); } xmlNodePtr const old = pOld->GetNodePtr(); if (!old) { throw RuntimeException(); } @@ -808,10 +802,8 @@ namespace DOM ::osl::ClearableMutexGuard guard(m_rMutex); - ::rtl::Reference const pOldNode( - comphelper::getFromUnoTunnel(xOldChild)); - ::rtl::Reference const pNewNode( - comphelper::getFromUnoTunnel(xNewChild)); + ::rtl::Reference const pOldNode(dynamic_cast(xOldChild.get())); + ::rtl::Reference const pNewNode(dynamic_cast(xNewChild.get())); if (!pOldNode.is() || !pNewNode.is()) { throw RuntimeException(); } xmlNodePtr const pOld = pOldNode->GetNodePtr(); xmlNodePtr const pNew = pNewNode->GetNodePtr(); @@ -976,12 +968,6 @@ namespace DOM pDispatcher->dispatchEvent(*pDocument, m_rMutex, pNode, this, evt); return true; } - - ::sal_Int64 SAL_CALL - CNode::getSomething(Sequence< ::sal_Int8 > const& rId) - { - return comphelper::getSomethingImpl(rId, this); - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index f1968c208860..d4c4f0a469cc 100644 --- a/unoxml/source/xpath/xpathapi.cxx +++ b/unoxml/source/xpath/xpathapi.cxx @@ -109,7 +109,7 @@ namespace XPath static void lcl_collectNamespaces( nsmap_t & rNamespaces, Reference< XNode > const& xNamespaceNode) { - DOM::CNode *const pCNode(comphelper::getFromUnoTunnel(xNamespaceNode)); + DOM::CNode *const pCNode(dynamic_cast(xNamespaceNode.get())); if (!pCNode) { throw RuntimeException(); } ::osl::MutexGuard const g(pCNode->GetOwnerDocument().GetMutex()); @@ -291,11 +291,10 @@ namespace XPath // get the node and document ::rtl::Reference const pCDoc( - dynamic_cast( comphelper::getFromUnoTunnel( - xContextNode->getOwnerDocument()))); + dynamic_cast(xContextNode->getOwnerDocument().get())); if (!pCDoc.is()) { throw RuntimeException(); } - DOM::CNode *const pCNode = comphelper::getFromUnoTunnel(xContextNode); + DOM::CNode *const pCNode = dynamic_cast(xContextNode.get()); if (!pCNode) { throw RuntimeException(); } ::osl::MutexGuard const g(pCDoc->GetMutex()); // lock the document!