1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include "svx/svdstr.hrc"
22 #include "svdglob.hxx"
23 #include <svx/svdmodel.hxx>
24 #include <svx/svdpage.hxx>
25 #include "svx/globl3d.hxx"
26 #include <svx/sphere3d.hxx>
28 #include <svx/svxids.hrc>
29 #include <svx/svx3ditems.hxx>
30 #include <sdr/properties/e3dsphereproperties.hxx>
31 #include <basegfx/vector/b3dvector.hxx>
32 #include <basegfx/point/b3dpoint.hxx>
33 #include <sdr/contact/viewcontactofe3dsphere.hxx>
34 #include <basegfx/polygon/b3dpolygon.hxx>
37 // DrawContact section
39 sdr::contact::ViewContact
* E3dSphereObj::CreateObjectSpecificViewContact()
41 return new sdr::contact::ViewContactOfE3dSphere(*this);
46 sdr::properties::BaseProperties
* E3dSphereObj::CreateObjectSpecificProperties()
48 return new sdr::properties::E3dSphereProperties(*this);
53 TYPEINIT1(E3dSphereObj
, E3dCompoundObject
);
56 // Build Sphere from polygon facets in latitude and longitude
58 E3dSphereObj::E3dSphereObj(E3dDefaultAttributes
& rDefault
, const basegfx::B3DPoint
& rCenter
, const basegfx::B3DVector
& r3DSize
)
59 : E3dCompoundObject(rDefault
)
62 SetDefaultAttributes(rDefault
);
68 // Create Sphere without creating the Polygons within
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)
75 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.
80 E3dDefaultAttributes aDefault
;
81 SetDefaultAttributes(aDefault
);
84 void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes
& rDefault
)
87 aCenter
= rDefault
.GetDefaultSphereCenter();
88 aSize
= rDefault
.GetDefaultSphereSize();
91 sal_uInt16
E3dSphereObj::GetObjIdentifier() const
93 return E3D_SPHEREOBJ_ID
;
96 // Convert the object into a group object consisting of n polygons
98 SdrObject
*E3dSphereObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
103 E3dSphereObj
* E3dSphereObj::Clone() const
105 return CloneHelper
< E3dSphereObj
>();
108 // Set local parameters with geometry re-creating
110 void E3dSphereObj::SetCenter(const basegfx::B3DPoint
& rNew
)
119 void E3dSphereObj::SetSize(const basegfx::B3DVector
& rNew
)
128 // Get the name of the object (singular)
130 OUString
E3dSphereObj::TakeObjNameSingul() const
132 OUStringBuffer
sName(ImpGetResStr(STR_ObjNameSingulSphere3d
));
134 OUString
aName(GetName());
135 if (!aName
.isEmpty())
142 return sName
.makeStringAndClear();
145 // Get the name of the object (plural)
147 OUString
E3dSphereObj::TakeObjNamePlural() const
149 return ImpGetResStr(STR_ObjNamePluralSphere3d
);
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */