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/deflt3d.hxx>
23 #include <svx/dialmgr.hxx>
24 #include <svx/svdmodel.hxx>
25 #include <svx/svdobjkind.hxx>
26 #include <svx/sphere3d.hxx>
28 #include <sdr/properties/e3dsphereproperties.hxx>
29 #include <basegfx/vector/b3dvector.hxx>
30 #include <basegfx/point/b3dpoint.hxx>
31 #include <sdr/contact/viewcontactofe3dsphere.hxx>
33 // DrawContact section
34 std::unique_ptr
<sdr::contact::ViewContact
> E3dSphereObj::CreateObjectSpecificViewContact()
36 return std::make_unique
<sdr::contact::ViewContactOfE3dSphere
>(*this);
39 std::unique_ptr
<sdr::properties::BaseProperties
> E3dSphereObj::CreateObjectSpecificProperties()
41 return std::make_unique
<sdr::properties::E3dSphereProperties
>(*this);
44 // Build Sphere from polygon facets in latitude and longitude
45 E3dSphereObj::E3dSphereObj(
47 const E3dDefaultAttributes
& rDefault
,
48 const basegfx::B3DPoint
& rCenter
,
49 const basegfx::B3DVector
& r3DSize
)
50 : E3dCompoundObject(rSdrModel
)
53 SetDefaultAttributes(rDefault
);
59 E3dSphereObj::E3dSphereObj(SdrModel
& rSdrModel
)
60 : E3dCompoundObject(rSdrModel
)
63 const E3dDefaultAttributes aDefault
;
65 SetDefaultAttributes(aDefault
);
68 E3dSphereObj::E3dSphereObj(SdrModel
& rSdrModel
, E3dSphereObj
const & rSource
)
69 : E3dCompoundObject(rSdrModel
, rSource
)
72 const E3dDefaultAttributes aDefault
;
73 SetDefaultAttributes(aDefault
);
75 aCenter
= rSource
.aCenter
;
76 aSize
= rSource
.aSize
;
79 E3dSphereObj::~E3dSphereObj()
83 void E3dSphereObj::SetDefaultAttributes(const E3dDefaultAttributes
& rDefault
)
86 aCenter
= rDefault
.GetDefaultSphereCenter();
87 aSize
= rDefault
.GetDefaultSphereSize();
90 SdrObjKind
E3dSphereObj::GetObjIdentifier() const
92 return SdrObjKind::E3D_Sphere
;
95 // Convert the object into a group object consisting of n polygons
97 rtl::Reference
<SdrObject
> E3dSphereObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
102 rtl::Reference
<SdrObject
> E3dSphereObj::CloneSdrObject(SdrModel
& rTargetModel
) const
104 return new E3dSphereObj(rTargetModel
, *this);
107 // Set local parameters with geometry re-creating
109 void E3dSphereObj::SetCenter(const basegfx::B3DPoint
& rNew
)
118 void E3dSphereObj::SetSize(const basegfx::B3DVector
& rNew
)
127 // Get the name of the object (singular)
129 OUString
E3dSphereObj::TakeObjNameSingul() const
131 OUString
sName(SvxResId(STR_ObjNameSingulSphere3d
));
133 OUString
aName(GetName());
134 if (!aName
.isEmpty())
136 sName
+= " '" + aName
+ "'";
141 // Get the name of the object (plural)
143 OUString
E3dSphereObj::TakeObjNamePlural() const
145 return SvxResId(STR_ObjNamePluralSphere3d
);
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */