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/strings.hrc>
22 #include <svx/dialmgr.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>
36 // DrawContact section
37 sdr::contact::ViewContact
* E3dSphereObj::CreateObjectSpecificViewContact()
39 return new sdr::contact::ViewContactOfE3dSphere(*this);
42 sdr::properties::BaseProperties
* E3dSphereObj::CreateObjectSpecificProperties()
44 return new sdr::properties::E3dSphereProperties(*this);
47 // Build Sphere from polygon facets in latitude and longitude
48 E3dSphereObj::E3dSphereObj(
50 const E3dDefaultAttributes
& rDefault
,
51 const basegfx::B3DPoint
& rCenter
,
52 const basegfx::B3DVector
& r3DSize
)
53 : E3dCompoundObject(rSdrModel
)
56 SetDefaultAttributes(rDefault
);
62 E3dSphereObj::E3dSphereObj(SdrModel
& rSdrModel
)
63 : E3dCompoundObject(rSdrModel
)
66 const E3dDefaultAttributes aDefault
;
68 SetDefaultAttributes(aDefault
);
71 E3dSphereObj::~E3dSphereObj()
75 void E3dSphereObj::SetDefaultAttributes(const E3dDefaultAttributes
& rDefault
)
78 aCenter
= rDefault
.GetDefaultSphereCenter();
79 aSize
= rDefault
.GetDefaultSphereSize();
82 sal_uInt16
E3dSphereObj::GetObjIdentifier() const
84 return E3D_SPHEREOBJ_ID
;
87 // Convert the object into a group object consisting of n polygons
89 SdrObject
*E3dSphereObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
94 E3dSphereObj
* E3dSphereObj::CloneSdrObject(SdrModel
& rTargetModel
) const
96 return CloneHelper
< E3dSphereObj
>(rTargetModel
);
99 E3dSphereObj
& E3dSphereObj::operator=(const E3dSphereObj
& rObj
)
103 E3dCompoundObject::operator=(rObj
);
105 aCenter
= rObj
.aCenter
;
111 // Set local parameters with geometry re-creating
113 void E3dSphereObj::SetCenter(const basegfx::B3DPoint
& rNew
)
122 void E3dSphereObj::SetSize(const basegfx::B3DVector
& rNew
)
131 // Get the name of the object (singular)
133 OUString
E3dSphereObj::TakeObjNameSingul() const
135 OUStringBuffer
sName(SvxResId(STR_ObjNameSingulSphere3d
));
137 OUString
aName(GetName());
138 if (!aName
.isEmpty())
145 return sName
.makeStringAndClear();
148 // Get the name of the object (plural)
150 OUString
E3dSphereObj::TakeObjNamePlural() const
152 return SvxResId(STR_ObjNamePluralSphere3d
);
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */