unoxml/inc/node.hxx | 3 +-- unoxml/source/dom/element.cxx | 5 +++-- unoxml/source/dom/node.cxx | 24 +++++++++--------------- unoxml/source/xpath/xpathapi.cxx | 7 ++++--- 4 files changed, 17 insertions(+), 22 deletions(-)
New commits: commit cc0dc723c7d8354b5203310ef1381bbf54258eba Author: Arkadiy Illarionov <qar...@gmail.com> AuthorDate: Tue Jun 18 00:10:57 2019 +0300 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Tue Jun 18 12:50:43 2019 +0200 tdf#39593 Remove DOM::CNode::GetImplementation Replace with comphelper::getUnoTunnelImplementation. Change-Id: If98801fd85bf0967c54e1924a04b6de371868942 Reviewed-on: https://gerrit.libreoffice.org/74234 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/unoxml/inc/node.hxx b/unoxml/inc/node.hxx index 216f80eda3d5..e35ab3aafda5 100644 --- a/unoxml/inc/node.hxx +++ b/unoxml/inc/node.hxx @@ -119,8 +119,7 @@ namespace DOM virtual ~CNode() override; - static CNode * GetImplementation(css::uno::Reference< - css::uno::XInterface> const& xNode); + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); xmlNodePtr GetNodePtr() { return m_aNodePtr; } diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index f7cae19fdbdc..6ed9ba1ebd1e 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/xml/sax/FastToken.hpp> #include <comphelper/attributelist.hxx> +#include <comphelper/servicehelper.hxx> #include <node.hxx> #include "attr.hxx" @@ -472,7 +473,7 @@ namespace DOM } ::rtl::Reference<CNode> const pCNode( - CNode::GetImplementation(Reference<XNode>(oldAttr.get()))); + comphelper::getUnoTunnelImplementation<CNode>(Reference<XNode>(oldAttr.get()))); if (!pCNode.is()) { throw RuntimeException(); } xmlNodePtr const pNode = pCNode->GetNodePtr(); @@ -532,7 +533,7 @@ namespace DOM // get the implementation CAttr *const pCAttr = dynamic_cast<CAttr*>( - CNode::GetImplementation(xNewAttr)); + comphelper::getUnoTunnelImplementation<CNode>(xNewAttr)); if (!pCAttr) { throw RuntimeException(); } xmlAttrPtr const pAttr = reinterpret_cast<xmlAttrPtr>(pCAttr->GetNodePtr()); diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index f486182eca83..7171e6c2f791 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -168,15 +168,9 @@ namespace DOM } } - CNode * - CNode::GetImplementation(uno::Reference<uno::XInterface> const& xNode) + const css::uno::Sequence< sal_Int8 > & CNode::getUnoTunnelId() throw() { - uno::Reference<lang::XUnoTunnel> const xUnoTunnel(xNode, UNO_QUERY); - if (!xUnoTunnel.is()) { return nullptr; } - CNode *const pCNode( reinterpret_cast< CNode* >( - ::sal::static_int_cast< sal_IntPtr >( - xUnoTunnel->getSomething(theCNodeUnoTunnelId::get().getSeq())))); - return pCNode; + return theCNodeUnoTunnelId::get().getSeq(); } CDocument & CNode::GetOwnerDocument() @@ -290,7 +284,7 @@ namespace DOM if (nullptr == m_aNodePtr) { return nullptr; } - CNode *const pNewChild(CNode::GetImplementation(xNewChild)); + CNode *const pNewChild(comphelper::getUnoTunnelImplementation<CNode>(xNewChild)); if (!pNewChild) { throw RuntimeException(); } xmlNodePtr const cur = pNewChild->GetNodePtr(); if (!cur) { throw RuntimeException(); } @@ -645,8 +639,8 @@ namespace DOM ::osl::ClearableMutexGuard guard(m_rMutex); - CNode *const pNewNode(CNode::GetImplementation(newChild)); - CNode *const pRefNode(CNode::GetImplementation(refChild)); + CNode *const pNewNode(comphelper::getUnoTunnelImplementation<CNode>(newChild)); + CNode *const pRefNode(comphelper::getUnoTunnelImplementation<CNode>(refChild)); if (!pNewNode || !pRefNode) { throw RuntimeException(); } xmlNodePtr const pNewChild(pNewNode->GetNodePtr()); xmlNodePtr const pRefChild(pRefNode->GetNodePtr()); @@ -753,7 +747,7 @@ namespace DOM Reference<XNode> xReturn( xOldChild ); - ::rtl::Reference<CNode> const pOld(CNode::GetImplementation(xOldChild)); + ::rtl::Reference<CNode> const pOld(comphelper::getUnoTunnelImplementation<CNode>(xOldChild)); if (!pOld.is()) { throw RuntimeException(); } xmlNodePtr const old = pOld->GetNodePtr(); if (!old) { throw RuntimeException(); } @@ -825,9 +819,9 @@ namespace DOM ::osl::ClearableMutexGuard guard(m_rMutex); ::rtl::Reference<CNode> const pOldNode( - CNode::GetImplementation(xOldChild)); + comphelper::getUnoTunnelImplementation<CNode>(xOldChild)); ::rtl::Reference<CNode> const pNewNode( - CNode::GetImplementation(xNewChild)); + comphelper::getUnoTunnelImplementation<CNode>(xNewChild)); if (!pOldNode.is() || !pNewNode.is()) { throw RuntimeException(); } xmlNodePtr const pOld = pOldNode->GetNodePtr(); xmlNodePtr const pNew = pNewNode->GetNodePtr(); @@ -1000,7 +994,7 @@ namespace DOM CNode::getSomething(Sequence< ::sal_Int8 > const& rId) { if ((rId.getLength() == 16) && - (0 == memcmp(theCNodeUnoTunnelId::get().getSeq().getConstArray(), + (0 == memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16))) { return ::sal::static_int_cast< sal_Int64 >( diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index 415f565d3ae0..874f4e6cd114 100644 --- a/unoxml/source/xpath/xpathapi.cxx +++ b/unoxml/source/xpath/xpathapi.cxx @@ -36,6 +36,7 @@ #include <node.hxx> #include "../dom/document.hxx" +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> using namespace css::io; @@ -135,7 +136,7 @@ namespace XPath static void lcl_collectNamespaces( nsmap_t & rNamespaces, Reference< XNode > const& xNamespaceNode) { - DOM::CNode *const pCNode(DOM::CNode::GetImplementation(xNamespaceNode)); + DOM::CNode *const pCNode(comphelper::getUnoTunnelImplementation<DOM::CNode>(xNamespaceNode)); if (!pCNode) { throw RuntimeException(); } ::osl::MutexGuard const g(pCNode->GetOwnerDocument().GetMutex()); @@ -314,11 +315,11 @@ namespace XPath // get the node and document ::rtl::Reference<DOM::CDocument> const pCDoc( - dynamic_cast<DOM::CDocument*>( DOM::CNode::GetImplementation( + dynamic_cast<DOM::CDocument*>( comphelper::getUnoTunnelImplementation<DOM::CNode>( xContextNode->getOwnerDocument()))); if (!pCDoc.is()) { throw RuntimeException(); } - DOM::CNode *const pCNode = DOM::CNode::GetImplementation(xContextNode); + DOM::CNode *const pCNode = comphelper::getUnoTunnelImplementation<DOM::CNode>(xContextNode); if (!pCNode) { throw RuntimeException(); } ::osl::MutexGuard const g(pCDoc->GetMutex()); // lock the document! _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits