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 .
20 #ifndef INCLUDED_SVX_SPHERE3D_HXX
21 #define INCLUDED_SVX_SPHERE3D_HXX
23 #include <svl/intitem.hxx>
24 #include <svl/itemset.hxx>
25 #include <svx/obj3d.hxx>
26 #include <svx/svxdllapi.h>
27 #include <svx/svddef.hxx>
29 class E3dDefaultAttributes
;
32 * SphereObject with diameter r3DSize.
33 * The count of planes depends on the horizontal and vertical segment count.
35 class SVX_DLLPUBLIC E3dSphereObj final
: public E3dCompoundObject
38 basegfx::B3DPoint aCenter
;
39 basegfx::B3DVector aSize
;
41 virtual std::unique_ptr
<sdr::contact::ViewContact
> CreateObjectSpecificViewContact() override
;
42 virtual std::unique_ptr
<sdr::properties::BaseProperties
> CreateObjectSpecificProperties() override
;
43 void SetDefaultAttributes(const E3dDefaultAttributes
& rDefault
);
46 // protected destructor - due to final, make private
47 virtual ~E3dSphereObj() override
;
52 const E3dDefaultAttributes
& rDefault
,
53 const basegfx::B3DPoint
& rCenter
,
54 const basegfx::B3DVector
& r3DSize
);
56 // FG: This constructor is only called from MakeObject from the 3d-Objectfactory
57 // when a document with a sphere is loaded. This constructor does not call
58 // CreateSphere, or create any spheres.
59 E3dSphereObj(SdrModel
& rSdrModel
);
61 // horizontal segments:
62 sal_uInt32
GetHorizontalSegments() const
63 { return GetObjectItemSet().Get(SDRATTR_3DOBJ_HORZ_SEGS
).GetValue(); }
66 sal_uInt32
GetVerticalSegments() const
67 { return GetObjectItemSet().Get(SDRATTR_3DOBJ_VERT_SEGS
).GetValue(); }
69 virtual sal_uInt16
GetObjIdentifier() const override
;
70 virtual SdrObjectUniquePtr
DoConvertToPolyObj(bool bBezier
, bool bAddText
) const override
;
72 virtual E3dSphereObj
* CloneSdrObject(SdrModel
& rTargetModel
) const override
;
74 // implemented mainly for the purposes of Clone()
75 E3dSphereObj
& operator=(const E3dSphereObj
& rObj
);
77 const basegfx::B3DPoint
& Center() const { return aCenter
; }
78 const basegfx::B3DVector
& Size() const { return aSize
; }
80 // set local parameters when the geometry is recreated
81 void SetCenter(const basegfx::B3DPoint
& rNew
);
82 void SetSize(const basegfx::B3DVector
& rNew
);
84 // TakeObjName...() is for displaying in the UI, eg "3 selected frames."
85 virtual OUString
TakeObjNameSingul() const override
;
86 virtual OUString
TakeObjNamePlural() const override
;
89 #endif // INCLUDED_SVX_SPHERE3D_HXX
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */