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 #ifndef INCLUDED_SVX_SPHERE3D_HXX 21 #define INCLUDED_SVX_SPHERE3D_HXX 22 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> 28 29 class E3dDefaultAttributes; 30 31 /** 32 * SphereObject with diameter r3DSize. 33 * The count of planes depends on the horizontal and vertical segment count. 34 */ 35 class SVX_DLLPUBLIC E3dSphereObj final : public E3dCompoundObject 36 { 37 private: 38 basegfx::B3DPoint aCenter; 39 basegfx::B3DVector aSize; 40 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); 44 45 private: 46 // protected destructor - due to final, make private 47 virtual ~E3dSphereObj() override; 48 49 public: 50 E3dSphereObj( 51 SdrModel& rSdrModel, 52 const E3dDefaultAttributes& rDefault, 53 const basegfx::B3DPoint& rCenter, 54 const basegfx::B3DVector& r3DSize); 55 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); 60 61 // horizontal segments: GetHorizontalSegments() const62 sal_uInt32 GetHorizontalSegments() const 63 { return GetObjectItemSet().Get(SDRATTR_3DOBJ_HORZ_SEGS).GetValue(); } 64 65 // VerticalSegments: GetVerticalSegments() const66 sal_uInt32 GetVerticalSegments() const 67 { return GetObjectItemSet().Get(SDRATTR_3DOBJ_VERT_SEGS).GetValue(); } 68 69 virtual sal_uInt16 GetObjIdentifier() const override; 70 virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override; 71 72 virtual E3dSphereObj* CloneSdrObject(SdrModel& rTargetModel) const override; 73 74 // implemented mainly for the purposes of Clone() 75 E3dSphereObj& operator=(const E3dSphereObj& rObj); 76 Center() const77 const basegfx::B3DPoint& Center() const { return aCenter; } Size() const78 const basegfx::B3DVector& Size() const { return aSize; } 79 80 // set local parameters when the geometry is recreated 81 void SetCenter(const basegfx::B3DPoint& rNew); 82 void SetSize(const basegfx::B3DVector& rNew); 83 84 // TakeObjName...() is for displaying in the UI, eg "3 selected frames." 85 virtual OUString TakeObjNameSingul() const override; 86 virtual OUString TakeObjNamePlural() const override; 87 }; 88 89 #endif // INCLUDED_SVX_SPHERE3D_HXX 90 91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 92