Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/drawing/Direction3D.hpp>
30 : : #include <tools/stream.hxx>
31 : :
32 : : #include <svx/e3ditem.hxx>
33 : :
34 : : using namespace ::rtl;
35 : : using namespace ::com::sun::star;
36 : :
37 : : // STATIC DATA -----------------------------------------------------------
38 : :
39 : : DBG_NAMEEX(SvxB3DVectorItem)
40 : : DBG_NAME(SvxB3DVectorItem)
41 : :
42 : : // -----------------------------------------------------------------------
43 : :
44 [ - + ][ - + ]: 96520 : TYPEINIT1_FACTORY(SvxB3DVectorItem, SfxPoolItem, new SvxB3DVectorItem);
[ # # ]
45 : :
46 : : // -----------------------------------------------------------------------
47 : :
48 : 0 : SvxB3DVectorItem::SvxB3DVectorItem()
49 : : {
50 : : DBG_CTOR(SvxB3DVectorItem, 0);
51 : 0 : }
52 : :
53 : 29857 : SvxB3DVectorItem::~SvxB3DVectorItem()
54 : : {
55 : : DBG_DTOR(SvxB3DVectorItem, 0);
56 [ - + ]: 30106 : }
57 : :
58 : : // -----------------------------------------------------------------------
59 : :
60 : 31984 : SvxB3DVectorItem::SvxB3DVectorItem( sal_uInt16 _nWhich, const basegfx::B3DVector& rVal ) :
61 : : SfxPoolItem( _nWhich ),
62 : 31984 : aVal( rVal )
63 : : {
64 : : DBG_CTOR(SvxB3DVectorItem, 0);
65 : 31984 : }
66 : :
67 : : // -----------------------------------------------------------------------
68 : :
69 : 249 : SvxB3DVectorItem::SvxB3DVectorItem( const SvxB3DVectorItem& rItem ) :
70 : : SfxPoolItem( rItem ),
71 : 249 : aVal( rItem.aVal )
72 : : {
73 : : DBG_CTOR(SvxB3DVectorItem, 0);
74 : 249 : }
75 : :
76 : : // -----------------------------------------------------------------------
77 : :
78 : 137 : int SvxB3DVectorItem::operator==( const SfxPoolItem &rItem ) const
79 : : {
80 : : DBG_CHKTHIS(SvxB3DVectorItem, 0);
81 : : DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
82 : 137 : return ((SvxB3DVectorItem&)rItem).aVal == aVal;
83 : : }
84 : :
85 : : // -----------------------------------------------------------------------
86 : :
87 : 249 : SfxPoolItem* SvxB3DVectorItem::Clone( SfxItemPool* /*pPool*/ ) const
88 : : {
89 : : DBG_CHKTHIS(SvxB3DVectorItem, 0);
90 [ + - ]: 249 : return new SvxB3DVectorItem( *this );
91 : : }
92 : :
93 : : // -----------------------------------------------------------------------
94 : :
95 : 0 : SfxPoolItem* SvxB3DVectorItem::Create(SvStream &rStream, sal_uInt16 /*nVersion*/) const
96 : : {
97 : : DBG_CHKTHIS(SvxB3DVectorItem, 0);
98 : 0 : basegfx::B3DVector aStr;
99 : : double fValue;
100 [ # # ]: 0 : rStream >> fValue; aStr.setX(fValue);
101 [ # # ]: 0 : rStream >> fValue; aStr.setY(fValue);
102 [ # # ]: 0 : rStream >> fValue; aStr.setZ(fValue);
103 [ # # ][ # # ]: 0 : return new SvxB3DVectorItem(Which(), aStr);
104 : : }
105 : :
106 : : // -----------------------------------------------------------------------
107 : :
108 : 0 : SvStream& SvxB3DVectorItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/) const
109 : : {
110 : : DBG_CHKTHIS(SvxB3DVectorItem, 0);
111 : :
112 : : // ## if (nItemVersion)
113 : : double fValue;
114 [ # # ]: 0 : fValue = aVal.getX(); rStream << fValue;
115 [ # # ]: 0 : fValue = aVal.getY(); rStream << fValue;
116 [ # # ]: 0 : fValue = aVal.getZ(); rStream << fValue;
117 : :
118 : 0 : return rStream;
119 : : }
120 : :
121 : : // -----------------------------------------------------------------------
122 : :
123 : 0 : bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
124 : : {
125 : 0 : drawing::Direction3D aDirection;
126 : :
127 : : // Werte eintragen
128 : 0 : aDirection.DirectionX = aVal.getX();
129 : 0 : aDirection.DirectionY = aVal.getY();
130 : 0 : aDirection.DirectionZ = aVal.getZ();
131 : :
132 [ # # ]: 0 : rVal <<= aDirection;
133 : 0 : return true;
134 : : }
135 : :
136 : : // -----------------------------------------------------------------------
137 : :
138 : 112 : bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
139 : : {
140 : 112 : drawing::Direction3D aDirection;
141 [ - + ][ + - ]: 112 : if(!(rVal >>= aDirection))
142 : 0 : return false;
143 : :
144 : 112 : aVal.setX(aDirection.DirectionX);
145 : 112 : aVal.setY(aDirection.DirectionY);
146 : 112 : aVal.setZ(aDirection.DirectionZ);
147 : 112 : return true;
148 : : }
149 : :
150 : : // -----------------------------------------------------------------------
151 : :
152 : 0 : sal_uInt16 SvxB3DVectorItem::GetVersion (sal_uInt16 nFileFormatVersion) const
153 : : {
154 [ # # ]: 0 : return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) ? USHRT_MAX : 0;
155 : : }
156 : :
157 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|