From 386cc4f05131c81024779e040019b79330b4dcaf Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 1 Jun 2011 09:31:57 +0100 Subject: unotunnelhelper.hxx unused --- unotools/Package_inc.mk | 1 - unotools/inc/unotools/unotunnelhelper.hxx | 195 ------------------------------ 2 files changed, 196 deletions(-) delete mode 100644 unotools/inc/unotools/unotunnelhelper.hxx (limited to 'unotools') diff --git a/unotools/Package_inc.mk b/unotools/Package_inc.mk index 13a8165e3ba6..a4830616e9d1 100644 --- a/unotools/Package_inc.mk +++ b/unotools/Package_inc.mk @@ -108,7 +108,6 @@ $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucblockbytes.hxx,uno $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucbstreamhelper.hxx,unotools/ucbstreamhelper.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/undoopt.hxx,unotools/undoopt.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/unotoolsdllapi.h,unotools/unotoolsdllapi.h)) -$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/unotunnelhelper.hxx,unotools/unotunnelhelper.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/useroptions_const.hxx,unotools/useroptions_const.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/useroptions.hxx,unotools/useroptions.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/viewoptions.hxx,unotools/viewoptions.hxx)) diff --git a/unotools/inc/unotools/unotunnelhelper.hxx b/unotools/inc/unotools/unotunnelhelper.hxx deleted file mode 100644 index b573fef7b883..000000000000 --- a/unotools/inc/unotools/unotunnelhelper.hxx +++ /dev/null @@ -1,195 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UNOTOOLS_UNOTUNNELHLP_HXX -#define _UNOTOOLS_UNOTUNNELHLP_HXX - -#include -#include -#include -#include -#include -#include - -namespace utl -{ -namespace staruno = ::com::sun::star::uno; -namespace starlang = ::com::sun::star::lang; - -//----------------------------------------------------------------------------------------------------------- -// to use the following, define -// sal_Bool getTunneledImplementation(Classname*& pObjImpl, staruno::Reference const& xObj); - -template -sal_Bool getImplementation(Classname*& pImpl, staruno::Reference const& xTunnel) - throw(staruno::RuntimeException) -{ - if (xTunnel.is()) - return getTunneledImplementation(pImpl, xTunnel); - - pImpl = 0; - return sal_False; -} - -template -sal_Bool getImplementation(Classname*& pImpl, staruno::Reference const& xObj) - throw(staruno::RuntimeException) -{ - staruno::Reference xTunnel(xObj,staruno::UNO_QUERY); - if (xTunnel.is()) - return getTunneledImplementation(pImpl, xTunnel); - - pImpl = 0; - return sal_False; -} - -template -sal_Bool getImplementation(Classname*& pImpl, staruno::Any const& aObj) - throw(staruno::RuntimeException) -{ - staruno::Reference xTunnel; - if (cppu::extractInterface(xTunnel, aObj)) - getTunneledImplementation(pImpl, xTunnel); - - pImpl = 0; - return sal_False; -} - -template -sal_Bool getImplementation(Classname*& pImpl, starlang::XUnoTunnel* pObj) - throw(staruno::RuntimeException) -{ - if (pObj) - { - staruno::Reference xTunnel(pObj); - return getTunneledImplementation(pImpl, xTunnel); - } - - pImpl = 0; - return sal_False; -} - -//----------------------------------------------------------------------------------------------------------- - -class UnoTunnelId -{ - sal_Int8 tunnelId[16]; -public: - UnoTunnelId(sal_Bool bUseMAC = sal_True) throw() - { - rtl_createUuid(reinterpret_cast(tunnelId),0,bUseMAC); - } - - staruno::Sequence getId() const throw(staruno::RuntimeException) - { - return staruno::Sequence(tunnelId, sizeof(tunnelId)); - } - - sal_Bool equalTo(staruno::Sequence const& rIdentifier) throw() - { - return rIdentifier.getLength() == sizeof(tunnelId) && - rtl_compareMemory(tunnelId, rIdentifier.getConstArray(), sizeof(tunnelId)) == 0; - } - - sal_Int8 const (&getIdBytes() const)[16] { return tunnelId; } -}; - -//----------------------------------------------------------------------------------------------------------- -template -class UnoTunnelImplBase -{ -protected: - Classname* ThisImplementation() throw() { return static_cast(this); } - - sal_Int64 makeUnoSomething() throw() - { - return reinterpret_cast(static_cast(ThisImplementation())); - } - - static Classname* extractUnoSomething(sal_Int64 nSomething) throw() - { - if (nSomething != sal_Int64()) - return static_cast(reinterpret_cast(nSomething)); - - return NULL; - } -#ifdef LINUX -public: -#endif - static Classname* - extractUnoSomething( - staruno::Reference const& xObj, - staruno::Sequence const& rMyTunnelId - ) - throw(staruno::RuntimeException) - { - return xObj.is() ? extractUnoSomething(xObj->getSomething(rMyTunnelId)) : NULL; - } -}; -//----------------------------------------------------------------------------------------------------------- - - -template -class UnoTunnelHelper : public UnoTunnelImplBase -{ -protected: - static UnoTunnelId s_aTunnelId; - - sal_Int64 getSomething(staruno::Sequence const& rTunnelId) throw() - { - if (s_aTunnelId.equalTo(rTunnelId)) - return this->makeUnoSomething(); - else - return sal_Int64(); - } -public: - static staruno::Sequence getImplementationTunnelId() - throw(staruno::RuntimeException) - { - return s_aTunnelId.getId(); - } -#ifndef LINUX - friend sal_Bool getTunneledImplementation(Classname*& pImpl, staruno::Reference const& xObj) - throw(staruno::RuntimeException) - { - pImpl = UnoTunnelHelper::UnoTunnelHelper::extractUnoSomething( xObj, UnoTunnelHelper::getImplementationTunnelId() ); - - return pImpl != 0; - } -#endif -}; -template -UnoTunnelId UnoTunnelHelper::s_aTunnelId; - - -//----------------------------------------------------------------------------------------------------------- -} // namespace utl - -#endif // _UNOTOOLS_UNOTUNNELHLP_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3