fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / svx / source / items / e3ditem.cxx
blob40be011d7033f688fed58ad84efea93958ca9b76
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 .
20 #include <com/sun/star/drawing/Direction3D.hpp>
21 #include <tools/stream.hxx>
23 #include <svx/e3ditem.hxx>
25 using namespace ::rtl;
26 using namespace ::com::sun::star;
28 // STATIC DATA -----------------------------------------------------------
30 DBG_NAMEEX(SvxB3DVectorItem)
31 DBG_NAME(SvxB3DVectorItem)
33 // -----------------------------------------------------------------------
35 TYPEINIT1_FACTORY(SvxB3DVectorItem, SfxPoolItem, new SvxB3DVectorItem);
37 // -----------------------------------------------------------------------
39 SvxB3DVectorItem::SvxB3DVectorItem()
41 DBG_CTOR(SvxB3DVectorItem, 0);
44 SvxB3DVectorItem::~SvxB3DVectorItem()
46 DBG_DTOR(SvxB3DVectorItem, 0);
49 // -----------------------------------------------------------------------
51 SvxB3DVectorItem::SvxB3DVectorItem( sal_uInt16 _nWhich, const basegfx::B3DVector& rVal ) :
52 SfxPoolItem( _nWhich ),
53 aVal( rVal )
55 DBG_CTOR(SvxB3DVectorItem, 0);
58 // -----------------------------------------------------------------------
60 SvxB3DVectorItem::SvxB3DVectorItem( const SvxB3DVectorItem& rItem ) :
61 SfxPoolItem( rItem ),
62 aVal( rItem.aVal )
64 DBG_CTOR(SvxB3DVectorItem, 0);
67 // -----------------------------------------------------------------------
69 int SvxB3DVectorItem::operator==( const SfxPoolItem &rItem ) const
71 DBG_CHKTHIS(SvxB3DVectorItem, 0);
72 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
73 return ((SvxB3DVectorItem&)rItem).aVal == aVal;
76 // -----------------------------------------------------------------------
78 SfxPoolItem* SvxB3DVectorItem::Clone( SfxItemPool* /*pPool*/ ) const
80 DBG_CHKTHIS(SvxB3DVectorItem, 0);
81 return new SvxB3DVectorItem( *this );
84 // -----------------------------------------------------------------------
86 SfxPoolItem* SvxB3DVectorItem::Create(SvStream &rStream, sal_uInt16 /*nVersion*/) const
88 DBG_CHKTHIS(SvxB3DVectorItem, 0);
89 basegfx::B3DVector aStr;
90 double fValue;
91 rStream >> fValue; aStr.setX(fValue);
92 rStream >> fValue; aStr.setY(fValue);
93 rStream >> fValue; aStr.setZ(fValue);
94 return new SvxB3DVectorItem(Which(), aStr);
97 // -----------------------------------------------------------------------
99 SvStream& SvxB3DVectorItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/) const
101 DBG_CHKTHIS(SvxB3DVectorItem, 0);
103 // ## if (nItemVersion)
104 double fValue;
105 fValue = aVal.getX(); rStream << fValue;
106 fValue = aVal.getY(); rStream << fValue;
107 fValue = aVal.getZ(); rStream << fValue;
109 return rStream;
112 // -----------------------------------------------------------------------
114 bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
116 drawing::Direction3D aDirection;
118 // Werte eintragen
119 aDirection.DirectionX = aVal.getX();
120 aDirection.DirectionY = aVal.getY();
121 aDirection.DirectionZ = aVal.getZ();
123 rVal <<= aDirection;
124 return true;
127 // -----------------------------------------------------------------------
129 bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
131 drawing::Direction3D aDirection;
132 if(!(rVal >>= aDirection))
133 return false;
135 aVal.setX(aDirection.DirectionX);
136 aVal.setY(aDirection.DirectionY);
137 aVal.setZ(aDirection.DirectionZ);
138 return true;
141 // -----------------------------------------------------------------------
143 sal_uInt16 SvxB3DVectorItem::GetVersion (sal_uInt16 nFileFormatVersion) const
145 return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) ? USHRT_MAX : 0;
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */