Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include <com/sun/star/script/XTypeConverter.hpp>
21 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
22 : :
23 : : #include <comphelper/processfactory.hxx>
24 : :
25 : : #include <svl/ilstitem.hxx>
26 : :
27 [ - + ][ - + ]: 387 : TYPEINIT1_AUTOFACTORY(SfxIntegerListItem, SfxPoolItem);
[ # # ]
28 : :
29 [ # # ]: 0 : SfxIntegerListItem::SfxIntegerListItem()
30 : : {
31 : 0 : }
32 : :
33 : 112 : SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::std::vector < sal_Int32 >& rList )
34 [ + - ]: 112 : : SfxPoolItem( which )
35 : : {
36 [ + - ]: 112 : m_aList.realloc( rList.size() );
37 [ - + ]: 112 : for ( sal_uInt16 n=0; n<rList.size(); ++n )
38 [ # # ][ # # ]: 0 : m_aList[n] = rList[n];
39 : 112 : }
40 : :
41 : 0 : SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::com::sun::star::uno::Sequence < sal_Int32 >& rList )
42 [ # # ]: 0 : : SfxPoolItem( which )
43 : : {
44 [ # # ]: 0 : m_aList.realloc( rList.getLength() );
45 [ # # ]: 0 : for ( sal_Int32 n=0; n<rList.getLength(); ++n )
46 [ # # ]: 0 : m_aList[n] = rList[n];
47 : 0 : }
48 : :
49 : 0 : SfxIntegerListItem::SfxIntegerListItem( const SfxIntegerListItem& rItem )
50 [ # # ]: 0 : : SfxPoolItem( rItem )
51 : : {
52 [ # # ]: 0 : m_aList = rItem.m_aList;
53 : 0 : }
54 : :
55 [ + - ]: 112 : SfxIntegerListItem::~SfxIntegerListItem()
56 : : {
57 [ - + ]: 224 : }
58 : :
59 : 0 : int SfxIntegerListItem::operator==( const SfxPoolItem& rPoolItem ) const
60 : : {
61 [ # # ][ # # ]: 0 : if ( !rPoolItem.ISA( SfxIntegerListItem ) )
[ # # ]
62 : 0 : return sal_False;
63 : :
64 [ # # ]: 0 : const SfxIntegerListItem rItem = (const SfxIntegerListItem&) rPoolItem;
65 [ # # ][ # # ]: 0 : return rItem.m_aList == m_aList;
66 : : }
67 : :
68 : 0 : SfxPoolItem* SfxIntegerListItem::Clone( SfxItemPool * ) const
69 : : {
70 [ # # ]: 0 : return new SfxIntegerListItem( *this );
71 : : }
72 : :
73 : 0 : bool SfxIntegerListItem::PutValue ( const com::sun::star::uno::Any& rVal, sal_uInt8 )
74 : : {
75 : : ::com::sun::star::uno::Reference < ::com::sun::star::script::XTypeConverter > xConverter
76 [ # # ]: 0 : ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.script.Converter")),
[ # # # # ]
77 [ # # ][ # # ]: 0 : ::com::sun::star::uno::UNO_QUERY );
78 : 0 : ::com::sun::star::uno::Any aNew;
79 [ # # ][ # # ]: 0 : try { aNew = xConverter->convertTo( rVal, ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int32 >*)0) ); }
[ # # ]
80 [ # # ]: 0 : catch (::com::sun::star::uno::Exception&)
81 : : {
82 : 0 : return true;
83 : : }
84 : :
85 [ # # ]: 0 : return ( aNew >>= m_aList );
86 : : }
87 : :
88 : 0 : bool SfxIntegerListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const
89 : : {
90 : 0 : rVal <<= m_aList;
91 : 0 : return true;
92 : : }
93 : :
94 : 0 : void SfxIntegerListItem::GetList( ::std::vector< sal_Int32 >& rList ) const
95 : : {
96 : 0 : rList.reserve( m_aList.getLength() );
97 [ # # ]: 0 : for ( sal_Int32 n=0; n<m_aList.getLength(); ++n )
98 : 0 : rList.push_back( m_aList[n] );
99 : 0 : }
100 : :
101 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|