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