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>
32 #include <rtl/ustrbuf.hxx>
34 // DrawContact section
35 std::unique_ptr
<sdr::contact::ViewContact
> E3dSphereObj::CreateObjectSpecificViewContact()
37 return std::make_unique
<sdr::contact::ViewContactOfE3dSphere
>(*this);
40 std::unique_ptr
<sdr::properties::BaseProperties
> E3dSphereObj::CreateObjectSpecificProperties()
42 return std::make_unique
<sdr::properties::E3dSphereProperties
>(*this);
45 // Build Sphere from polygon facets in latitude and longitude
46 E3dSphereObj::E3dSphereObj(
48 const E3dDefaultAttributes
& rDefault
,
49 const basegfx::B3DPoint
& rCenter
,
50 const basegfx::B3DVector
& r3DSize
)
51 : E3dCompoundObject(rSdrModel
)
54 SetDefaultAttributes(rDefault
);
60 E3dSphereObj::E3dSphereObj(SdrModel
& rSdrModel
)
61 : E3dCompoundObject(rSdrModel
)
64 const E3dDefaultAttributes aDefault
;
66 SetDefaultAttributes(aDefault
);
69 E3dSphereObj::~E3dSphereObj()
73 void E3dSphereObj::SetDefaultAttributes(const E3dDefaultAttributes
& rDefault
)
76 aCenter
= rDefault
.GetDefaultSphereCenter();
77 aSize
= rDefault
.GetDefaultSphereSize();
80 SdrObjKind
E3dSphereObj::GetObjIdentifier() const
82 return E3D_SPHEREOBJ_ID
;
85 // Convert the object into a group object consisting of n polygons
87 SdrObjectUniquePtr
E3dSphereObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
92 E3dSphereObj
* E3dSphereObj::CloneSdrObject(SdrModel
& rTargetModel
) const
94 return CloneHelper
< E3dSphereObj
>(rTargetModel
);
97 E3dSphereObj
& E3dSphereObj::operator=(const E3dSphereObj
& rObj
)
101 E3dCompoundObject::operator=(rObj
);
103 aCenter
= rObj
.aCenter
;
109 // Set local parameters with geometry re-creating
111 void E3dSphereObj::SetCenter(const basegfx::B3DPoint
& rNew
)
120 void E3dSphereObj::SetSize(const basegfx::B3DVector
& rNew
)
129 // Get the name of the object (singular)
131 OUString
E3dSphereObj::TakeObjNameSingul() const
133 OUStringBuffer
sName(SvxResId(STR_ObjNameSingulSphere3d
));
135 OUString
aName(GetName());
136 if (!aName
.isEmpty())
143 return sName
.makeStringAndClear();
146 // Get the name of the object (plural)
148 OUString
E3dSphereObj::TakeObjNamePlural() const
150 return SvxResId(STR_ObjNamePluralSphere3d
);
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */