LibreOffice Module svl (master) 1
ilstitem.cxx
Go to the documentation of this file.
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/Converter.hpp>
21
24
25#include <svl/ilstitem.hxx>
26
27
29
31{
32}
33
34SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, ::std::vector < sal_Int32 >&& rList )
35 : SfxPoolItem( which )
36 , m_aList( std::move(rList) )
37{
38}
39
40SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const css::uno::Sequence < sal_Int32 >& rList )
41 : SfxPoolItem( which )
42{
44}
45
47{
48}
49
50bool SfxIntegerListItem::operator==( const SfxPoolItem& rPoolItem ) const
51{
52 if ( !SfxPoolItem::operator==(rPoolItem) )
53 return false;
54
55 const SfxIntegerListItem & rItem = static_cast<const SfxIntegerListItem&>(rPoolItem);
56 return rItem.m_aList == m_aList;
57}
58
60{
61 return new SfxIntegerListItem( *this );
62}
63
64bool SfxIntegerListItem::PutValue ( const css::uno::Any& rVal, sal_uInt8 )
65{
66 css::uno::Reference < css::script::XTypeConverter > xConverter
67 ( css::script::Converter::create(::comphelper::getProcessComponentContext()) );
68 css::uno::Any aNew;
69 try { aNew = xConverter->convertTo( rVal, cppu::UnoType<css::uno::Sequence < sal_Int32 >>::get() ); }
70 catch (css::uno::Exception&)
71 {
72 return true;
73 }
74
75 css::uno::Sequence<sal_Int32> aTempSeq;
76 bool bRet = aNew >>= aTempSeq;
77 if (bRet)
78 m_aList = comphelper::sequenceToContainer<std::vector<sal_Int32>>(aTempSeq);
79 return bRet;
80}
81
82bool SfxIntegerListItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const
83{
85 return true;
86}
87
88/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~SfxIntegerListItem() override
Definition: ilstitem.cxx:46
virtual bool operator==(const SfxPoolItem &) const override
Definition: ilstitem.cxx:50
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: ilstitem.cxx:64
std::vector< sal_Int32 > m_aList
Definition: ilstitem.hxx:31
static SfxPoolItem * CreateDefault()
Definition: ilstitem.cxx:28
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: ilstitem.cxx:82
virtual SfxIntegerListItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: ilstitem.cxx:59
Base class for providers of defaults of SfxPoolItems.
Definition: itempool.hxx:51
Reference< XTypeConverter > xConverter
DstType sequenceToContainer(const css::uno::Sequence< SrcType > &i_Sequence)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
unsigned char sal_uInt8