Adjust includes
[LibreOffice.git] / svx / source / engine3d / sphere3d.cxx
blob4c70359c21fffe21babb6b259c7cecb0be2ecccc
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 <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);
45 sdr::properties::BaseProperties* E3dSphereObj::CreateObjectSpecificProperties()
47 return new sdr::properties::E3dSphereProperties(*this);
51 // Build Sphere from polygon facets in latitude and longitude
53 E3dSphereObj::E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& rCenter, const basegfx::B3DVector& r3DSize)
54 : E3dCompoundObject(rDefault)
56 // Set defaults
57 SetDefaultAttributes(rDefault);
59 aCenter = rCenter;
60 aSize = r3DSize;
63 // Create Sphere without creating the Polygons within
65 // This call is from the 3D Object Factory (objfac3d.cxx) and only when loading
66 // of documents. Here you do not need CreateSphere call, since the real number
67 // of segments is not even known yet. This was until 10.02.1997 a (small)
68 // memory leak.
70 E3dSphereObj::E3dSphereObj(Dummy /*dummy*/)
71 // the parameters it needs to be able to distinguish which
72 // constructors of the two is meant. The above is the default.
74 // Set defaults
75 E3dDefaultAttributes aDefault;
76 SetDefaultAttributes(aDefault);
79 void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
81 // Set defaults
82 aCenter = rDefault.GetDefaultSphereCenter();
83 aSize = rDefault.GetDefaultSphereSize();
86 sal_uInt16 E3dSphereObj::GetObjIdentifier() const
88 return E3D_SPHEREOBJ_ID;
91 // Convert the object into a group object consisting of n polygons
93 SdrObject *E3dSphereObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
95 return nullptr;
98 E3dSphereObj* E3dSphereObj::Clone() const
100 return CloneHelper< E3dSphereObj >();
103 // Set local parameters with geometry re-creating
105 void E3dSphereObj::SetCenter(const basegfx::B3DPoint& rNew)
107 if(aCenter != rNew)
109 aCenter = rNew;
110 ActionChanged();
114 void E3dSphereObj::SetSize(const basegfx::B3DVector& rNew)
116 if(aSize != rNew)
118 aSize = rNew;
119 ActionChanged();
123 // Get the name of the object (singular)
125 OUString E3dSphereObj::TakeObjNameSingul() const
127 OUStringBuffer sName(ImpGetResStr(STR_ObjNameSingulSphere3d));
129 OUString aName(GetName());
130 if (!aName.isEmpty())
132 sName.append(' ');
133 sName.append('\'');
134 sName.append(aName);
135 sName.append('\'');
137 return sName.makeStringAndClear();
140 // Get the name of the object (plural)
142 OUString E3dSphereObj::TakeObjNamePlural() const
144 return ImpGetResStr(STR_ObjNamePluralSphere3d);
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */