2010-10-27 13:11:31 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 15:18:56 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 09:37:52 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 09:37:52 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 09:37:52 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 09:37:52 +00:00
|
|
|
* 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.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 09:37:52 +00:00
|
|
|
* 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).
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 09:37:52 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_
|
|
|
|
#define _CONNECTIVITY_OSUBCOMPONENT_HXX_
|
|
|
|
|
2001-05-08 09:03:03 +00:00
|
|
|
#include <cppuhelper/weak.hxx>
|
2001-05-14 10:55:19 +00:00
|
|
|
#include <cppuhelper/interfacecontainer.h>
|
2008-12-30 13:32:01 +00:00
|
|
|
#include "connectivity/dbtoolsdllapi.hxx"
|
|
|
|
|
2001-05-14 10:55:19 +00:00
|
|
|
namespace com
|
|
|
|
{
|
|
|
|
namespace sun
|
|
|
|
{
|
|
|
|
namespace star
|
|
|
|
{
|
|
|
|
namespace lang
|
|
|
|
{
|
|
|
|
class XComponent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
namespace connectivity
|
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
OOO_DLLPUBLIC_DBTOOLS
|
2001-05-14 10:55:19 +00:00
|
|
|
void release(oslInterlockedCount& _refCount,
|
|
|
|
::cppu::OBroadcastHelper& rBHelper,
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
|
|
|
|
::com::sun::star::lang::XComponent* _pObject);
|
2000-09-18 15:18:56 +00:00
|
|
|
//************************************************************
|
|
|
|
// OSubComponent
|
|
|
|
//************************************************************
|
2001-04-12 14:12:41 +00:00
|
|
|
template <class SELF, class WEAK> class OSubComponent
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
// the parent must support the tunnel implementation
|
2000-10-06 10:59:01 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
|
2001-04-12 14:12:41 +00:00
|
|
|
SELF* m_pDerivedImplementation;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
public:
|
2000-10-06 10:59:01 +00:00
|
|
|
OSubComponent(
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent,
|
2001-04-12 14:12:41 +00:00
|
|
|
SELF* _pDerivedImplementation)
|
2000-10-06 10:59:01 +00:00
|
|
|
:m_xParent(_xParent)
|
|
|
|
,m_pDerivedImplementation(_pDerivedImplementation)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void dispose_ChildImpl()
|
|
|
|
{
|
2007-03-26 13:01:11 +00:00
|
|
|
// avoid ambiguity
|
|
|
|
::osl::MutexGuard aGuard( m_pDerivedImplementation->WEAK::rBHelper.rMutex );
|
2009-09-08 09:50:48 +00:00
|
|
|
m_xParent.clear();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
void relase_ChildImpl()
|
|
|
|
{
|
2001-05-14 10:55:19 +00:00
|
|
|
::connectivity::release(m_pDerivedImplementation->m_refCount,
|
2007-03-26 13:01:11 +00:00
|
|
|
m_pDerivedImplementation->WEAK::rBHelper,
|
2001-05-14 10:55:19 +00:00
|
|
|
m_xParent,
|
|
|
|
m_pDerivedImplementation);
|
2001-04-12 14:12:41 +00:00
|
|
|
|
|
|
|
m_pDerivedImplementation->WEAK::release();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // _CONNECTIVITY_OSUBCOMPONENT_HXX_
|
|
|
|
|
2010-10-27 13:11:31 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|