2005-04-13 05:16:29 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 15:18:26 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2005-04-13 05:16:29 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2005-04-13 05:16:29 -05:00
|
|
|
*
|
2008-04-10 15:18:26 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2005-04-13 05:16:29 -05:00
|
|
|
*
|
2008-04-10 15:18:26 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2005-04-13 05:16:29 -05:00
|
|
|
*
|
2008-04-10 15:18:26 -05: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.
|
2005-04-13 05:16:29 -05:00
|
|
|
*
|
2008-04-10 15:18:26 -05: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).
|
2005-04-13 05:16:29 -05:00
|
|
|
*
|
2008-04-10 15:18:26 -05: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.
|
2005-04-13 05:16:29 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 09:04:46 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
2009-10-08 09:48:26 -05:00
|
|
|
#include "precompiled_svl.hxx"
|
2005-04-13 05:16:29 -05:00
|
|
|
#include <com/sun/star/script/XTypeConverter.hpp>
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
|
2009-10-08 09:59:48 -05:00
|
|
|
#include <svl/ilstitem.hxx>
|
2005-04-13 05:16:29 -05:00
|
|
|
|
|
|
|
#define _SVSTDARR_ULONGS
|
2009-10-08 09:59:48 -05:00
|
|
|
#include <svl/svstdarr.hxx>
|
2005-04-13 05:16:29 -05:00
|
|
|
|
|
|
|
TYPEINIT1_AUTOFACTORY(SfxIntegerListItem, SfxPoolItem);
|
|
|
|
|
|
|
|
SfxIntegerListItem::SfxIntegerListItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-06-19 15:16:13 -05:00
|
|
|
SfxIntegerListItem::SfxIntegerListItem( USHORT which, const SvULongs& rList )
|
|
|
|
: SfxPoolItem( which )
|
2005-04-13 05:16:29 -05:00
|
|
|
{
|
|
|
|
m_aList.realloc( rList.Count() );
|
|
|
|
for ( USHORT n=0; n<rList.Count(); n++ )
|
|
|
|
m_aList[n] = rList[n];
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxIntegerListItem::SfxIntegerListItem( const SfxIntegerListItem& rItem )
|
|
|
|
: SfxPoolItem( rItem )
|
|
|
|
{
|
|
|
|
m_aList = rItem.m_aList;
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxIntegerListItem::~SfxIntegerListItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int SfxIntegerListItem::operator==( const SfxPoolItem& rPoolItem ) const
|
|
|
|
{
|
|
|
|
if ( !rPoolItem.ISA( SfxIntegerListItem ) )
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
const SfxIntegerListItem rItem = (const SfxIntegerListItem&) rPoolItem;
|
|
|
|
return rItem.m_aList == m_aList;
|
|
|
|
}
|
|
|
|
|
2006-06-19 15:16:13 -05:00
|
|
|
SfxPoolItem* SfxIntegerListItem::Clone( SfxItemPool * ) const
|
2005-04-13 05:16:29 -05:00
|
|
|
{
|
|
|
|
return new SfxIntegerListItem( *this );
|
|
|
|
}
|
|
|
|
|
2006-06-19 15:16:13 -05:00
|
|
|
BOOL SfxIntegerListItem::PutValue ( const com::sun::star::uno::Any& rVal, BYTE )
|
2005-04-13 05:16:29 -05:00
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference < ::com::sun::star::script::XTypeConverter > xConverter
|
|
|
|
( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")),
|
|
|
|
::com::sun::star::uno::UNO_QUERY );
|
|
|
|
::com::sun::star::uno::Any aNew;
|
|
|
|
try { aNew = xConverter->convertTo( rVal, ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int32 >*)0) ); }
|
|
|
|
catch (::com::sun::star::uno::Exception&)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ( aNew >>= m_aList );
|
|
|
|
}
|
|
|
|
|
2006-06-19 15:16:13 -05:00
|
|
|
BOOL SfxIntegerListItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const
|
2005-04-13 05:16:29 -05:00
|
|
|
{
|
|
|
|
rVal <<= m_aList;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SfxIntegerListItem::GetList( SvULongs& rList ) const
|
|
|
|
{
|
|
|
|
for ( sal_Int32 n=0; n<m_aList.getLength(); n++ )
|
2006-10-12 09:22:09 -05:00
|
|
|
rList.Insert( m_aList[n], sal::static_int_cast< USHORT >(n) );
|
2005-04-13 05:16:29 -05:00
|
|
|
}
|