bump product version to 6.3.0.0.beta1
[LibreOffice.git] / svl / source / items / imageitm.cxx
blob269e80936af3ff93155bd6aadecda695ff08ed08
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
29 OUString aURL;
30 long nAngle;
31 bool bMirrored;
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)
41 pImpl->nAngle = 0;
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;
76 rVal <<= aSeq;
77 return true;
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();
86 OUString aURL;
87 if ( aSeq[0] >>= nVal )
88 SetValue( nVal );
89 aSeq[1] >>= pImpl->nAngle;
90 aSeq[2] >>= pImpl->bMirrored;
91 if ( aSeq[3] >>= aURL )
92 pImpl->aURL = aURL;
93 return true;
96 return false;
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: */