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 : :
30 : : #include "svx/svdstr.hrc"
31 : : #include "svx/svdglob.hxx"
32 : : #include <svx/svdmodel.hxx>
33 : : #include <svx/svdpage.hxx>
34 : : #include "svx/globl3d.hxx"
35 : : #include <svx/sphere3d.hxx>
36 : :
37 : : #include <svx/svxids.hrc>
38 : : #include <svx/svx3ditems.hxx>
39 : : #include <svx/sdr/properties/e3dsphereproperties.hxx>
40 : : #include <basegfx/vector/b3dvector.hxx>
41 : : #include <basegfx/point/b3dpoint.hxx>
42 : : #include <svx/sdr/contact/viewcontactofe3dsphere.hxx>
43 : : #include <basegfx/polygon/b3dpolygon.hxx>
44 : :
45 : : //////////////////////////////////////////////////////////////////////////////
46 : : // DrawContact section
47 : :
48 : 0 : sdr::contact::ViewContact* E3dSphereObj::CreateObjectSpecificViewContact()
49 : : {
50 [ # # ]: 0 : return new sdr::contact::ViewContactOfE3dSphere(*this);
51 : : }
52 : :
53 : : //////////////////////////////////////////////////////////////////////////////
54 : :
55 : 0 : sdr::properties::BaseProperties* E3dSphereObj::CreateObjectSpecificProperties()
56 : : {
57 [ # # ]: 0 : return new sdr::properties::E3dSphereProperties(*this);
58 : : }
59 : :
60 : : //////////////////////////////////////////////////////////////////////////////
61 : :
62 [ # # ][ # # ]: 0 : TYPEINIT1(E3dSphereObj, E3dCompoundObject);
63 : :
64 : :
65 : : // Build Sphere from polygon facets in latitude and longitude
66 : :
67 : 0 : E3dSphereObj::E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& rCenter, const basegfx::B3DVector& r3DSize)
68 : 0 : : E3dCompoundObject(rDefault)
69 : : {
70 : : // Set defaults
71 [ # # ]: 0 : SetDefaultAttributes(rDefault);
72 : :
73 [ # # ]: 0 : aCenter = rCenter;
74 [ # # ]: 0 : aSize = r3DSize;
75 : 0 : }
76 : :
77 : : // Create Sphere without creating the Polygons within
78 : :
79 : : // This call is from the 3D Object Factory (objfac3d.cxx) and only when loading
80 : : // of documents. Here you do not need CreateSphere call, since the real number
81 : : // of segments is not even known yet. This was until 10.02.1997 a (small)
82 : : // memory leak.
83 : :
84 : 0 : E3dSphereObj::E3dSphereObj(int /*dummy*/)
85 : : // the parameters it needs to be able to distinguish which
86 : : // constructors of the two is meant. The above is the default.
87 : : {
88 : : // Set defaults
89 [ # # ]: 0 : E3dDefaultAttributes aDefault;
90 [ # # ][ # # ]: 0 : SetDefaultAttributes(aDefault);
91 : 0 : }
92 : :
93 : 0 : void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
94 : : {
95 : : // Set defaults
96 : 0 : aCenter = rDefault.GetDefaultSphereCenter();
97 : 0 : aSize = rDefault.GetDefaultSphereSize();
98 : 0 : }
99 : :
100 : 0 : sal_uInt16 E3dSphereObj::GetObjIdentifier() const
101 : : {
102 : 0 : return E3D_SPHEREOBJ_ID;
103 : : }
104 : :
105 : : // Convert the object into a group object consisting of n polygons
106 : :
107 : 0 : SdrObject *E3dSphereObj::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
108 : : {
109 : 0 : return NULL;
110 : : }
111 : :
112 : 0 : E3dSphereObj* E3dSphereObj::Clone() const
113 : : {
114 : 0 : return CloneHelper< E3dSphereObj >();
115 : : }
116 : :
117 : : // Set local parameters with geometry re-creating
118 : :
119 : 0 : void E3dSphereObj::SetCenter(const basegfx::B3DPoint& rNew)
120 : : {
121 [ # # ]: 0 : if(aCenter != rNew)
122 : : {
123 : 0 : aCenter = rNew;
124 : 0 : ActionChanged();
125 : : }
126 : 0 : }
127 : :
128 : 0 : void E3dSphereObj::SetSize(const basegfx::B3DVector& rNew)
129 : : {
130 [ # # ]: 0 : if(aSize != rNew)
131 : : {
132 : 0 : aSize = rNew;
133 : 0 : ActionChanged();
134 : : }
135 : 0 : }
136 : :
137 : : // Get the name of the object (singular)
138 : :
139 : 0 : void E3dSphereObj::TakeObjNameSingul(XubString& rName) const
140 : : {
141 [ # # ][ # # ]: 0 : rName=ImpGetResStr(STR_ObjNameSingulSphere3d);
[ # # ]
142 : :
143 [ # # ][ # # ]: 0 : String aName( GetName() );
144 [ # # ]: 0 : if(aName.Len())
145 : : {
146 [ # # ]: 0 : rName += sal_Unicode(' ');
147 [ # # ]: 0 : rName += sal_Unicode('\'');
148 [ # # ]: 0 : rName += aName;
149 [ # # ]: 0 : rName += sal_Unicode('\'');
150 [ # # ]: 0 : }
151 : 0 : }
152 : :
153 : : // Get the name of the object (plural)
154 : :
155 : 0 : void E3dSphereObj::TakeObjNamePlural(XubString& rName) const
156 : : {
157 [ # # ]: 0 : rName=ImpGetResStr(STR_ObjNamePluralSphere3d);
158 : 0 : }
159 : :
160 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|