2000-09-18 11:07:07 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-07 12:46:35 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-07 12:46:35 -05:00
|
|
|
* $RCSfile: objitem.cxx,v $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2006-06-19 16:29:21 -05:00
|
|
|
* $Revision: 1.7 $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2006-06-19 16:29:21 -05:00
|
|
|
* last change: $Author: hr $ $Date: 2006-06-19 22:29:21 $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-07 12:46:35 -05:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
*
|
2005-09-07 12:46:35 -05:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-07 12:46:35 -05:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-07 12:46:35 -05:00
|
|
|
* This library 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 for more details.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-07 12:46:35 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2004-04-21 07:16:35 -05:00
|
|
|
#ifndef GCC
|
2000-09-18 11:07:07 -05:00
|
|
|
#pragma hdrstop
|
2004-04-21 07:16:35 -05:00
|
|
|
#endif
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
#include "objsh.hxx"
|
|
|
|
//#include "objshimp.hxx"
|
|
|
|
#include "objitem.hxx"
|
|
|
|
|
2004-08-31 08:57:32 -05:00
|
|
|
#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
|
|
|
|
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
//====================================================================
|
|
|
|
|
2004-07-23 05:58:48 -05:00
|
|
|
TYPEINIT1_AUTOFACTORY(SfxObjectShellItem,SfxPoolItem)
|
2000-09-18 11:07:07 -05:00
|
|
|
TYPEINIT1_AUTOFACTORY(SfxObjectItem,SfxPoolItem)
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
|
|
|
int SfxObjectShellItem::operator==( const SfxPoolItem &rItem ) const
|
|
|
|
{
|
|
|
|
return PTR_CAST(SfxObjectShellItem, &rItem)->pObjSh == pObjSh;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
|
|
|
String SfxObjectShellItem::GetValueText() const
|
|
|
|
{
|
|
|
|
return String();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
|
|
|
SfxPoolItem* SfxObjectShellItem::Clone( SfxItemPool *) const
|
|
|
|
{
|
|
|
|
return new SfxObjectShellItem( Which(), pObjSh );
|
|
|
|
}
|
|
|
|
|
2004-02-25 08:46:13 -06:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
2006-06-19 16:29:21 -05:00
|
|
|
sal_Bool SfxObjectShellItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const
|
2004-02-25 08:46:13 -06:00
|
|
|
{
|
2004-08-31 08:57:32 -05:00
|
|
|
if ( pObjSh )
|
|
|
|
{
|
|
|
|
// This item MUST provide a model. Please don't change this, there are UNO-based
|
|
|
|
// implementations which need it!!
|
|
|
|
rVal <<= pObjSh->GetModel();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rVal <<= ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >();
|
|
|
|
}
|
|
|
|
return TRUE;
|
2004-07-23 05:58:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
2006-06-19 16:29:21 -05:00
|
|
|
sal_Bool SfxObjectShellItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ )
|
2004-07-23 05:58:48 -05:00
|
|
|
{
|
2004-08-31 08:57:32 -05:00
|
|
|
// This item MUST have a model. Please don't change this, there are UNO-based
|
|
|
|
// implementations which need it!!
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel;
|
|
|
|
|
|
|
|
if ( rVal >>= xModel )
|
2004-02-25 08:46:13 -06:00
|
|
|
{
|
2004-08-31 08:57:32 -05:00
|
|
|
if ( xModel.is() )
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xTunnel(
|
|
|
|
xModel, ::com::sun::star::uno::UNO_QUERY );
|
|
|
|
if ( xTunnel.is() )
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Sequence < sal_Int8 > aSeq( (sal_Int8*) SvGlobalName( SFX_GLOBAL_CLASSID ).GetBytes(), 16 );
|
|
|
|
sal_Int64 nHandle = xTunnel->getSomething( aSeq );
|
|
|
|
if ( nHandle )
|
|
|
|
{
|
2006-06-19 16:29:21 -05:00
|
|
|
pObjSh = reinterpret_cast< SfxObjectShell* >(sal::static_int_cast<sal_IntPtr>( nHandle ));
|
2004-08-31 08:57:32 -05:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pObjSh = 0;
|
|
|
|
return TRUE;
|
2004-02-25 08:46:13 -06:00
|
|
|
}
|
2004-08-31 08:57:32 -05:00
|
|
|
|
|
|
|
return FALSE;
|
2004-02-25 08:46:13 -06:00
|
|
|
}
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
//=========================================================================
|
|
|
|
|
2006-06-19 16:29:21 -05:00
|
|
|
SfxObjectItem::SfxObjectItem( USHORT nWhichId, SfxShell *pSh )
|
|
|
|
: SfxPoolItem( nWhichId ),
|
2000-09-18 11:07:07 -05:00
|
|
|
_pSh( pSh )
|
|
|
|
{}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
|
|
|
int SfxObjectItem::operator==( const SfxPoolItem &rItem ) const
|
|
|
|
{
|
|
|
|
SfxObjectItem *pOther = PTR_CAST(SfxObjectItem, &rItem);
|
|
|
|
return pOther->_pSh == _pSh;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
|
|
|
SfxPoolItem* SfxObjectItem::Clone( SfxItemPool *) const
|
|
|
|
{
|
|
|
|
return new SfxObjectItem( Which(), _pSh );
|
|
|
|
}
|