1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <svl/grabbagitem.hxx>
11 #include <sal/config.h>
13 #include <sal/log.hxx>
14 #include <comphelper/sequence.hxx>
15 #include <com/sun/star/beans/PropertyValue.hpp>
17 using namespace com::sun::star
;
19 SfxGrabBagItem::SfxGrabBagItem() = default;
21 SfxGrabBagItem::SfxGrabBagItem(sal_uInt16 nWhich
)
26 SfxGrabBagItem::~SfxGrabBagItem() = default;
28 bool SfxGrabBagItem::operator==(const SfxPoolItem
& rItem
) const
30 auto pItem
= static_cast<const SfxGrabBagItem
*>(&rItem
);
32 return m_aMap
== pItem
->m_aMap
;
35 SfxPoolItem
* SfxGrabBagItem::Clone(SfxItemPool
* /*pPool*/) const
37 return new SfxGrabBagItem(*this);
40 bool SfxGrabBagItem::PutValue(const uno::Any
& rVal
, sal_uInt8
/*nMemberId*/)
42 uno::Sequence
<beans::PropertyValue
> aValue
;
46 for (beans::PropertyValue
const& aPropertyValue
: aValue
)
48 m_aMap
[aPropertyValue
.Name
] = aPropertyValue
.Value
;
53 SAL_WARN("svl", "SfxGrabBagItem::PutValue: wrong type");
57 bool SfxGrabBagItem::QueryValue(uno::Any
& rVal
, sal_uInt8
/*nMemberId*/) const
59 uno::Sequence
<beans::PropertyValue
> aValue(m_aMap
.size());
60 beans::PropertyValue
* pValue
= aValue
.getArray();
61 for (const auto& i
: m_aMap
)
63 pValue
[0].Name
= i
.first
;
64 pValue
[0].Value
= i
.second
;
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */