diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-14 08:19:47 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-15 06:07:36 +0200 |
commit | 05bc93db2de56000f65764d7e394d03747cac23d (patch) | |
tree | 975de9ae83572aac8a5c3ea8db281e1017ee5be0 /unoxml | |
parent | 8cbb414ed737f9ffc76e1258e6671769bf63fc6c (diff) |
Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1
The header got some changes:
1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace
2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace
of uses of OImplementationId with it, including in XTypeProvider
3. Introduce convenience functions 'getSomething_cast' to cast between
sal_Int64 and object pointers uniformly.
4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make
it a bit shorter, and to reflect its function better. Templatize it
to take also css::uno::Any for convenience.
5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it
handle cases both with and without fallback to parent.
6. Adjust UNO3_GETIMPLEMENTATION_* macros
TODO (in separate commits):
- Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation
- Replace all uses of OImplementationId in core with UnoIdInit
- Deprecate OImplementationId in <cppuhelper/typeprovider.hxx>
- Change implementations of getSomething to use getSomethingImpl
- Revise uses of getSomething to use getFromUnoTunnel
Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'unoxml')
-rw-r--r-- | unoxml/source/dom/element.cxx | 4 | ||||
-rw-r--r-- | unoxml/source/dom/node.cxx | 16 | ||||
-rw-r--r-- | unoxml/source/xpath/xpathapi.cxx | 6 |
3 files changed, 13 insertions, 13 deletions
diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index e82f2edab4f2..481b071e62e5 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -471,7 +471,7 @@ namespace DOM } ::rtl::Reference<CNode> const pCNode( - comphelper::getUnoTunnelImplementation<CNode>(Reference<XNode>(oldAttr))); + comphelper::getFromUnoTunnel<CNode>(Reference<XNode>(oldAttr))); if (!pCNode.is()) { throw RuntimeException(); } xmlNodePtr const pNode = pCNode->GetNodePtr(); @@ -531,7 +531,7 @@ namespace DOM // get the implementation CAttr *const pCAttr = dynamic_cast<CAttr*>( - comphelper::getUnoTunnelImplementation<CNode>(xNewAttr)); + comphelper::getFromUnoTunnel<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 a6809cf7df47..64545d877753 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -164,7 +164,7 @@ namespace DOM const css::uno::Sequence< sal_Int8 > & CNode::getUnoTunnelId() noexcept { - static const UnoTunnelIdInit theCNodeUnoTunnelId; + static const comphelper::UnoIdInit theCNodeUnoTunnelId; return theCNodeUnoTunnelId.getSeq(); } @@ -279,7 +279,7 @@ namespace DOM if (nullptr == m_aNodePtr) { return nullptr; } - CNode *const pNewChild(comphelper::getUnoTunnelImplementation<CNode>(xNewChild)); + CNode *const pNewChild(comphelper::getFromUnoTunnel<CNode>(xNewChild)); if (!pNewChild) { throw RuntimeException(); } xmlNodePtr const cur = pNewChild->GetNodePtr(); if (!cur) { throw RuntimeException(); } @@ -624,8 +624,8 @@ namespace DOM ::osl::ClearableMutexGuard guard(m_rMutex); - CNode *const pNewNode(comphelper::getUnoTunnelImplementation<CNode>(newChild)); - CNode *const pRefNode(comphelper::getUnoTunnelImplementation<CNode>(refChild)); + CNode *const pNewNode(comphelper::getFromUnoTunnel<CNode>(newChild)); + CNode *const pRefNode(comphelper::getFromUnoTunnel<CNode>(refChild)); if (!pNewNode || !pRefNode) { throw RuntimeException(); } xmlNodePtr const pNewChild(pNewNode->GetNodePtr()); xmlNodePtr const pRefChild(pRefNode->GetNodePtr()); @@ -732,7 +732,7 @@ namespace DOM Reference<XNode> xReturn( xOldChild ); - ::rtl::Reference<CNode> const pOld(comphelper::getUnoTunnelImplementation<CNode>(xOldChild)); + ::rtl::Reference<CNode> const pOld(comphelper::getFromUnoTunnel<CNode>(xOldChild)); if (!pOld.is()) { throw RuntimeException(); } xmlNodePtr const old = pOld->GetNodePtr(); if (!old) { throw RuntimeException(); } @@ -804,9 +804,9 @@ namespace DOM ::osl::ClearableMutexGuard guard(m_rMutex); ::rtl::Reference<CNode> const pOldNode( - comphelper::getUnoTunnelImplementation<CNode>(xOldChild)); + comphelper::getFromUnoTunnel<CNode>(xOldChild)); ::rtl::Reference<CNode> const pNewNode( - comphelper::getUnoTunnelImplementation<CNode>(xNewChild)); + comphelper::getFromUnoTunnel<CNode>(xNewChild)); if (!pOldNode.is() || !pNewNode.is()) { throw RuntimeException(); } xmlNodePtr const pOld = pOldNode->GetNodePtr(); xmlNodePtr const pNew = pNewNode->GetNodePtr(); @@ -978,7 +978,7 @@ namespace DOM ::sal_Int64 SAL_CALL CNode::getSomething(Sequence< ::sal_Int8 > const& rId) { - if (isUnoTunnelId<CNode>(rId)) + if (comphelper::isUnoTunnelId<CNode>(rId)) { return ::sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index 28c733490b04..f1968c208860 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::getUnoTunnelImplementation<DOM::CNode>(xNamespaceNode)); + DOM::CNode *const pCNode(comphelper::getFromUnoTunnel<DOM::CNode>(xNamespaceNode)); if (!pCNode) { throw RuntimeException(); } ::osl::MutexGuard const g(pCNode->GetOwnerDocument().GetMutex()); @@ -291,11 +291,11 @@ namespace XPath // get the node and document ::rtl::Reference<DOM::CDocument> const pCDoc( - dynamic_cast<DOM::CDocument*>( comphelper::getUnoTunnelImplementation<DOM::CNode>( + dynamic_cast<DOM::CDocument*>( comphelper::getFromUnoTunnel<DOM::CNode>( xContextNode->getOwnerDocument()))); if (!pCDoc.is()) { throw RuntimeException(); } - DOM::CNode *const pCNode = comphelper::getUnoTunnelImplementation<DOM::CNode>(xContextNode); + DOM::CNode *const pCNode = comphelper::getFromUnoTunnel<DOM::CNode>(xContextNode); if (!pCNode) { throw RuntimeException(); } ::osl::MutexGuard const g(pCDoc->GetMutex()); // lock the document! |