GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / svl / source / items / imageitm.cxx
blobdeb5a7368a84f30c2091b596a21940e3904a32f1
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>
24 TYPEINIT1( SfxImageItem, SfxInt16Item );
26 struct SfxImageItem_Impl
28 OUString aURL;
29 long nAngle;
30 bool bMirrored;
31 int 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;
40 pImp->nAngle = 0;
41 pImp->bMirrored = false;
44 SfxImageItem::SfxImageItem( const SfxImageItem& rItem )
45 : SfxInt16Item( rItem )
47 pImp = new SfxImageItem_Impl( *(rItem.pImp) );
50 SfxImageItem::~SfxImageItem()
52 delete pImp;
56 SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const
58 return new SfxImageItem( *this );
62 int SfxImageItem::operator==( const SfxPoolItem& rItem ) const
64 return( ((SfxImageItem&) rItem).GetValue() == GetValue() && (*pImp == *(((SfxImageItem&)rItem).pImp) ) );
67 bool SfxImageItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const
69 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 4 );
70 aSeq[0] = ::com::sun::star::uno::makeAny( GetValue() );
71 aSeq[1] = ::com::sun::star::uno::makeAny( pImp->nAngle );
72 aSeq[2] = ::com::sun::star::uno::makeAny( pImp->bMirrored );
73 aSeq[3] = ::com::sun::star::uno::makeAny( OUString( pImp->aURL ));
75 rVal = ::com::sun::star::uno::makeAny( aSeq );
76 return true;
79 bool SfxImageItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
81 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq;
82 if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 ))
84 sal_Int16 nVal = sal_Int16();
85 OUString aURL;
86 if ( aSeq[0] >>= nVal )
87 SetValue( nVal );
88 aSeq[1] >>= pImp->nAngle;
89 aSeq[2] >>= pImp->bMirrored;
90 if ( aSeq[3] >>= aURL )
91 pImp->aURL = aURL;
92 return true;
95 return false;
98 void SfxImageItem::SetRotation( long nValue )
100 pImp->nAngle = nValue;
103 long SfxImageItem::GetRotation() const
105 return pImp->nAngle;
108 void SfxImageItem::SetMirrored( bool bSet )
110 pImp->bMirrored = bSet;
113 bool SfxImageItem::IsMirrored() const
115 return pImp->bMirrored;
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */