bump product version to 6.1.0.2
[LibreOffice.git] / svx / source / engine3d / sphere3d.cxx
bloba3a3f0c168c1722001219ad57a2d8841f54b6595
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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(
49 SdrModel& rSdrModel,
50 const E3dDefaultAttributes& rDefault,
51 const basegfx::B3DPoint& rCenter,
52 const basegfx::B3DVector& r3DSize)
53 : E3dCompoundObject(rSdrModel)
55 // Set defaults
56 SetDefaultAttributes(rDefault);
58 aCenter = rCenter;
59 aSize = r3DSize;
62 E3dSphereObj::E3dSphereObj(SdrModel& rSdrModel)
63 : E3dCompoundObject(rSdrModel)
65 // Set defaults
66 const E3dDefaultAttributes aDefault;
68 SetDefaultAttributes(aDefault);
71 E3dSphereObj::~E3dSphereObj()
75 void E3dSphereObj::SetDefaultAttributes(const E3dDefaultAttributes& rDefault)
77 // Set defaults
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
91 return nullptr;
94 E3dSphereObj* E3dSphereObj::CloneSdrObject(SdrModel& rTargetModel) const
96 return CloneHelper< E3dSphereObj >(rTargetModel);
99 E3dSphereObj& E3dSphereObj::operator=(const E3dSphereObj& rObj)
101 if( this == &rObj )
102 return *this;
103 E3dCompoundObject::operator=(rObj);
105 aCenter = rObj.aCenter;
106 aSize = rObj.aSize;
108 return *this;
111 // Set local parameters with geometry re-creating
113 void E3dSphereObj::SetCenter(const basegfx::B3DPoint& rNew)
115 if(aCenter != rNew)
117 aCenter = rNew;
118 ActionChanged();
122 void E3dSphereObj::SetSize(const basegfx::B3DVector& rNew)
124 if(aSize != rNew)
126 aSize = rNew;
127 ActionChanged();
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())
140 sName.append(' ');
141 sName.append('\'');
142 sName.append(aName);
143 sName.append('\'');
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: */