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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <svl/imageitm.hxx>
22 #include <com/sun/star/uno/Sequence.hxx>
25 SfxPoolItem
* SfxImageItem::CreateDefault() { return new SfxImageItem
; }
27 struct SfxImageItem_Impl
32 bool operator == ( const SfxImageItem_Impl
& rOther
) const
33 { return nAngle
== rOther
.nAngle
&& bMirrored
== rOther
.bMirrored
; }
37 SfxImageItem::SfxImageItem( sal_uInt16 which
)
38 : SfxInt16Item( which
, 0 ),
39 pImpl( new SfxImageItem_Impl
)
42 pImpl
->bMirrored
= false;
45 SfxImageItem::SfxImageItem( const SfxImageItem
& rItem
)
46 : SfxInt16Item( rItem
),
47 pImpl( new SfxImageItem_Impl( *rItem
.pImpl
) )
51 SfxImageItem::~SfxImageItem()
56 SfxPoolItem
* SfxImageItem::Clone( SfxItemPool
* ) const
58 return new SfxImageItem( *this );
62 bool SfxImageItem::operator==( const SfxPoolItem
& rItem
) const
64 return (static_cast<const SfxImageItem
&>(rItem
).GetValue() == GetValue()) &&
65 (*pImpl
== *static_cast<const SfxImageItem
&>(rItem
).pImpl
);
68 bool SfxImageItem::QueryValue( css::uno::Any
& rVal
, sal_uInt8
) const
70 css::uno::Sequence
< css::uno::Any
> aSeq( 4 );
71 aSeq
[0] <<= GetValue();
72 aSeq
[1] <<= pImpl
->nAngle
;
73 aSeq
[2] <<= pImpl
->bMirrored
;
74 aSeq
[3] <<= pImpl
->aURL
;
80 bool SfxImageItem::PutValue( const css::uno::Any
& rVal
, sal_uInt8
)
82 css::uno::Sequence
< css::uno::Any
> aSeq
;
83 if (( rVal
>>= aSeq
) && ( aSeq
.getLength() == 4 ))
85 sal_Int16 nVal
= sal_Int16();
87 if ( aSeq
[0] >>= nVal
)
89 aSeq
[1] >>= pImpl
->nAngle
;
90 aSeq
[2] >>= pImpl
->bMirrored
;
91 if ( aSeq
[3] >>= aURL
)
99 void SfxImageItem::SetRotation( long nValue
)
101 pImpl
->nAngle
= nValue
;
104 long SfxImageItem::GetRotation() const
106 return pImpl
->nAngle
;
109 void SfxImageItem::SetMirrored( bool bSet
)
111 pImpl
->bMirrored
= bSet
;
114 bool SfxImageItem::IsMirrored() const
116 return pImpl
->bMirrored
;
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */