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>
24 TYPEINIT1( SfxImageItem
, SfxInt16Item
);
26 struct SfxImageItem_Impl
31 bool operator == ( const SfxImageItem_Impl
& rOther
) const
32 { return nAngle
== rOther
.nAngle
&& bMirrored
== rOther
.bMirrored
; }
36 SfxImageItem::SfxImageItem( sal_uInt16 which
, sal_uInt16 nImage
)
37 : SfxInt16Item( which
, nImage
)
39 pImp
= new SfxImageItem_Impl
;
41 pImp
->bMirrored
= false;
44 SfxImageItem::SfxImageItem( const SfxImageItem
& rItem
)
45 : SfxInt16Item( rItem
)
47 pImp
= new SfxImageItem_Impl( *(rItem
.pImp
) );
50 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 (*pImp
== *static_cast<const SfxImageItem
&>(rItem
).pImp
);
68 bool SfxImageItem::QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8
) const
70 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> aSeq( 4 );
71 aSeq
[0] = ::com::sun::star::uno::makeAny( GetValue() );
72 aSeq
[1] = ::com::sun::star::uno::makeAny( pImp
->nAngle
);
73 aSeq
[2] = ::com::sun::star::uno::makeAny( pImp
->bMirrored
);
74 aSeq
[3] = ::com::sun::star::uno::makeAny( OUString( pImp
->aURL
));
76 rVal
= ::com::sun::star::uno::makeAny( aSeq
);
80 bool SfxImageItem::PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8
)
82 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> aSeq
;
83 if (( rVal
>>= aSeq
) && ( aSeq
.getLength() == 4 ))
85 sal_Int16 nVal
= sal_Int16();
87 if ( aSeq
[0] >>= nVal
)
89 aSeq
[1] >>= pImp
->nAngle
;
90 aSeq
[2] >>= pImp
->bMirrored
;
91 if ( aSeq
[3] >>= aURL
)
99 void SfxImageItem::SetRotation( long nValue
)
101 pImp
->nAngle
= nValue
;
104 long SfxImageItem::GetRotation() const
109 void SfxImageItem::SetMirrored( bool bSet
)
111 pImp
->bMirrored
= bSet
;
114 bool SfxImageItem::IsMirrored() const
116 return pImp
->bMirrored
;
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */