LibreOffice Module svl (master) 1
imageitm.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
21#include <svl/imageitm.hxx>
22#include <com/sun/star/uno/Sequence.hxx>
23
24
26
27SfxImageItem::SfxImageItem( sal_uInt16 which )
28 : SfxInt16Item( which, 0 ), mnAngle(0), mbMirrored(false)
29{
30}
31
33 : SfxInt16Item( rItem ),
34 mnAngle(rItem.mnAngle), mbMirrored(rItem.mbMirrored)
35{
36}
37
39{
40}
41
43{
44 return new SfxImageItem( *this );
45}
46
47bool SfxImageItem::operator==( const SfxPoolItem& rItem ) const
48{
49 if (!SfxInt16Item::operator==(rItem))
50 return false;
51 const SfxImageItem& rOther = static_cast<const SfxImageItem&>(rItem);
52 return mnAngle == rOther.mnAngle && mbMirrored == rOther.mbMirrored;
53}
54
55bool SfxImageItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const
56{
57 css::uno::Sequence< css::uno::Any > aSeq{ css::uno::Any(GetValue()),
58 css::uno::Any(sal_Int16(mnAngle)),
59 css::uno::Any(mbMirrored),
60 css::uno::Any(maURL) };
61 rVal <<= aSeq;
62 return true;
63}
64
65bool SfxImageItem::PutValue( const css::uno::Any& rVal, sal_uInt8 )
66{
67 css::uno::Sequence< css::uno::Any > aSeq;
68 if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 ))
69 {
70 sal_Int16 nVal = sal_Int16();
71 if ( aSeq[0] >>= nVal )
72 SetValue( nVal );
73 sal_Int16 nTmp = 0;
74 aSeq[1] >>= nTmp;
75 mnAngle = Degree10(nTmp);
76 aSeq[2] >>= mbMirrored;
77 aSeq[3] >>= maURL;
78 return true;
79 }
80
81 return false;
82}
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Degree10 mnAngle
Definition: imageitm.hxx:48
bool mbMirrored
Definition: imageitm.hxx:49
virtual SfxImageItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: imageitm.cxx:42
virtual bool operator==(const SfxPoolItem &) const override
Definition: imageitm.cxx:47
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: imageitm.cxx:65
SfxImageItem(sal_uInt16 nWhich=0)
Definition: imageitm.cxx:27
OUString maURL
Definition: imageitm.hxx:47
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: imageitm.cxx:55
static SfxPoolItem * CreateDefault()
Definition: imageitm.cxx:25
virtual ~SfxImageItem() override
Definition: imageitm.cxx:38
sal_Int16 GetValue() const
Definition: intitem.hxx:69
void SetValue(sal_Int16 nTheValue)
Definition: intitem.hxx:74
Base class for providers of defaults of SfxPoolItems.
Definition: itempool.hxx:51
Sequence< sal_Int8 > aSeq
sal_Int32 mnAngle
unsigned char sal_uInt8