LibreOffice Module svx (master) 1
sphere3d.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20
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>
27
32
33// DrawContact section
34std::unique_ptr<sdr::contact::ViewContact> E3dSphereObj::CreateObjectSpecificViewContact()
35{
36 return std::make_unique<sdr::contact::ViewContactOfE3dSphere>(*this);
37}
38
39std::unique_ptr<sdr::properties::BaseProperties> E3dSphereObj::CreateObjectSpecificProperties()
40{
41 return std::make_unique<sdr::properties::E3dSphereProperties>(*this);
42}
43
44// Build Sphere from polygon facets in latitude and longitude
46 SdrModel& rSdrModel,
47 const E3dDefaultAttributes& rDefault,
48 const basegfx::B3DPoint& rCenter,
49 const basegfx::B3DVector& r3DSize)
50: E3dCompoundObject(rSdrModel)
51{
52 // Set defaults
53 SetDefaultAttributes(rDefault);
54
55 aCenter = rCenter;
56 aSize = r3DSize;
57}
58
60: E3dCompoundObject(rSdrModel)
61{
62 // Set defaults
63 const E3dDefaultAttributes aDefault;
64
65 SetDefaultAttributes(aDefault);
66}
67
69: E3dCompoundObject(rSdrModel, rSource)
70{
71 // Set defaults
72 const E3dDefaultAttributes aDefault;
73 SetDefaultAttributes(aDefault);
74
75 aCenter = rSource.aCenter;
76 aSize = rSource.aSize;
77}
78
80{
81}
82
83void E3dSphereObj::SetDefaultAttributes(const E3dDefaultAttributes& rDefault)
84{
85 // Set defaults
86 aCenter = rDefault.GetDefaultSphereCenter();
87 aSize = rDefault.GetDefaultSphereSize();
88}
89
91{
93}
94
95// Convert the object into a group object consisting of n polygons
96
97rtl::Reference<SdrObject> E3dSphereObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
98{
99 return nullptr;
100}
101
103{
104 return new E3dSphereObj(rTargetModel, *this);
105}
106
107// Set local parameters with geometry re-creating
108
110{
111 if(aCenter != rNew)
112 {
113 aCenter = rNew;
115 }
116}
117
119{
120 if(aSize != rNew)
121 {
122 aSize = rNew;
124 }
125}
126
127// Get the name of the object (singular)
128
130{
131 OUString sName(SvxResId(STR_ObjNameSingulSphere3d));
132
133 OUString aName(GetName());
134 if (!aName.isEmpty())
135 {
136 sName += " '" + aName + "'";
137 }
138 return sName;
139}
140
141// Get the name of the object (plural)
142
144{
145 return SvxResId(STR_ObjNamePluralSphere3d);
146}
147
148/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SphereObject with diameter r3DSize.
Definition: sphere3d.hxx:36
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: sphere3d.cxx:34
virtual OUString TakeObjNameSingul() const override
Definition: sphere3d.cxx:129
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: sphere3d.cxx:39
virtual SdrObjKind GetObjIdentifier() const override
Definition: sphere3d.cxx:90
void SetCenter(const basegfx::B3DPoint &rNew)
Definition: sphere3d.cxx:109
E3dSphereObj(SdrModel &rSdrModel, const E3dDefaultAttributes &rDefault, const basegfx::B3DPoint &rCenter, const basegfx::B3DVector &r3DSize)
Definition: sphere3d.cxx:45
void SetDefaultAttributes(const E3dDefaultAttributes &rDefault)
Definition: sphere3d.cxx:83
virtual ~E3dSphereObj() override
Definition: sphere3d.cxx:79
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: sphere3d.cxx:97
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
Definition: sphere3d.cxx:102
basegfx::B3DPoint aCenter
Definition: sphere3d.hxx:38
virtual OUString TakeObjNamePlural() const override
Definition: sphere3d.cxx:143
basegfx::B3DVector aSize
Definition: sphere3d.hxx:39
void SetSize(const basegfx::B3DVector &rNew)
Definition: sphere3d.cxx:118
void ActionChanged() const
Definition: svdobj.cxx:273
virtual const OUString & GetName() const
Definition: svdobj.cxx:771
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
OUString sName
OUString aName
SdrObjKind
Definition: svdobjkind.hxx:25