update dev300-m58
[ooovba.git] / svx / source / items / e3ditem.cxx
blob229d38c11bc633c510fce941ef35b76024958f3b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: e3ditem.cxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <com/sun/star/drawing/Direction3D.hpp>
34 #include <tools/stream.hxx>
36 #include <svx/e3ditem.hxx>
38 using namespace ::rtl;
39 using namespace ::com::sun::star;
41 // STATIC DATA -----------------------------------------------------------
43 DBG_NAMEEX(SvxB3DVectorItem)
44 DBG_NAME(SvxB3DVectorItem)
46 // -----------------------------------------------------------------------
48 TYPEINIT1_FACTORY(SvxB3DVectorItem, SfxPoolItem, new SvxB3DVectorItem);
50 // -----------------------------------------------------------------------
52 SvxB3DVectorItem::SvxB3DVectorItem()
54 DBG_CTOR(SvxB3DVectorItem, 0);
57 SvxB3DVectorItem::~SvxB3DVectorItem()
59 DBG_DTOR(SvxB3DVectorItem, 0);
62 // -----------------------------------------------------------------------
64 SvxB3DVectorItem::SvxB3DVectorItem( USHORT _nWhich, const basegfx::B3DVector& rVal ) :
65 SfxPoolItem( _nWhich ),
66 aVal( rVal )
68 DBG_CTOR(SvxB3DVectorItem, 0);
71 // -----------------------------------------------------------------------
73 SvxB3DVectorItem::SvxB3DVectorItem( USHORT _nWhich, SvStream& rStream ) :
74 SfxPoolItem( _nWhich )
76 DBG_CTOR(SvxB3DVectorItem, 0);
77 double fValue;
78 rStream >> fValue; aVal.setX(fValue);
79 rStream >> fValue; aVal.setY(fValue);
80 rStream >> fValue; aVal.setZ(fValue);
83 // -----------------------------------------------------------------------
85 SvxB3DVectorItem::SvxB3DVectorItem( const SvxB3DVectorItem& rItem ) :
86 SfxPoolItem( rItem ),
87 aVal( rItem.aVal )
89 DBG_CTOR(SvxB3DVectorItem, 0);
92 // -----------------------------------------------------------------------
94 int SvxB3DVectorItem::operator==( const SfxPoolItem &rItem ) const
96 DBG_CHKTHIS(SvxB3DVectorItem, 0);
97 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
98 return ((SvxB3DVectorItem&)rItem).aVal == aVal;
101 // -----------------------------------------------------------------------
103 SfxPoolItem* SvxB3DVectorItem::Clone( SfxItemPool* /*pPool*/ ) const
105 DBG_CHKTHIS(SvxB3DVectorItem, 0);
106 return new SvxB3DVectorItem( *this );
109 // -----------------------------------------------------------------------
111 SfxPoolItem* SvxB3DVectorItem::Create(SvStream &rStream, USHORT /*nVersion*/) const
113 DBG_CHKTHIS(SvxB3DVectorItem, 0);
114 basegfx::B3DVector aStr;
115 double fValue;
116 rStream >> fValue; aStr.setX(fValue);
117 rStream >> fValue; aStr.setY(fValue);
118 rStream >> fValue; aStr.setZ(fValue);
119 return new SvxB3DVectorItem(Which(), aStr);
122 // -----------------------------------------------------------------------
124 SvStream& SvxB3DVectorItem::Store(SvStream &rStream, USHORT /*nItemVersion*/) const
126 DBG_CHKTHIS(SvxB3DVectorItem, 0);
128 // ## if (nItemVersion)
129 double fValue;
130 fValue = aVal.getX(); rStream << fValue;
131 fValue = aVal.getY(); rStream << fValue;
132 fValue = aVal.getZ(); rStream << fValue;
134 return rStream;
137 // -----------------------------------------------------------------------
139 sal_Bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const
141 drawing::Direction3D aDirection;
143 // Werte eintragen
144 aDirection.DirectionX = aVal.getX();
145 aDirection.DirectionY = aVal.getY();
146 aDirection.DirectionZ = aVal.getZ();
148 rVal <<= aDirection;
149 return( sal_True );
152 // -----------------------------------------------------------------------
154 sal_Bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ )
156 drawing::Direction3D aDirection;
157 if(!(rVal >>= aDirection))
158 return sal_False;
160 aVal.setX(aDirection.DirectionX);
161 aVal.setY(aDirection.DirectionY);
162 aVal.setZ(aDirection.DirectionZ);
163 return sal_True;
166 // -----------------------------------------------------------------------
168 USHORT SvxB3DVectorItem::GetVersion (USHORT nFileFormatVersion) const
170 return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) ? USHRT_MAX : 0;
173 // eof