LibreOffice Module svx (master)  1
lathe3d.hxx
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 #ifndef INCLUDED_SVX_LATHE3D_HXX
21 #define INCLUDED_SVX_LATHE3D_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 #include <svx/svx3ditems.hxx>
29 
30 class E3dDefaultAttributes;
31 
32 /*************************************************************************
33 |*
34 |* Create a 3D rotation object from a passed 2D polygon
35 |*
36 |* The aPolyPoly3D is rotated around its axis in nHSegments steps.
37 |* nVSegments contains the number of lines of aPolyPoly3D and therefore
38 |* is effectively a vertical segmentation.
39 |*
40 \************************************************************************/
41 
43 {
45 
46  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
47  virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
48  void SetDefaultAttributes(const E3dDefaultAttributes& rDefault);
49 
50 private:
51  // protected destructor - due to final, make private
52  virtual ~E3dLatheObj() override;
53 
54 public:
56  SdrModel& rSdrModel,
57  const E3dDefaultAttributes& rDefault,
58  const basegfx::B2DPolyPolygon& rPoly2D);
59  E3dLatheObj(SdrModel& rSdrModel);
60 
61  // HorizontalSegments:
62  sal_uInt32 GetHorizontalSegments() const
63  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_HORZ_SEGS).GetValue(); }
64 
65  // VerticalSegments:
66  sal_uInt32 GetVerticalSegments() const
67  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_VERT_SEGS).GetValue(); }
68 
69  // PercentDiagonal: 0..100, before 0.0..0.5
70  sal_uInt16 GetPercentDiagonal() const
71  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL).GetValue(); }
72 
73  // BackScale: 0..100, before 0.0..1.0
74  sal_uInt16 GetBackScale() const
75  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_BACKSCALE).GetValue(); }
76 
77  // EndAngle: 0..10000
78  sal_uInt32 GetEndAngle() const
79  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_END_ANGLE).GetValue(); }
80 
81  // #107245# GetSmoothNormals() for bLatheSmoothed
82  bool GetSmoothNormals() const
83  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_NORMALS).GetValue(); }
84 
85  // #107245# GetSmoothLids() for bLatheSmoothFrontBack
86  bool GetSmoothLids() const
87  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_LIDS).GetValue(); }
88 
89  // #107245# GetCharacterMode() for bLatheCharacterMode
90  bool GetCharacterMode() const
91  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_CHARACTER_MODE).GetValue(); }
92 
93  // #107245# GetCloseFront() for bLatheCloseFront
94  bool GetCloseFront() const
95  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_FRONT).GetValue(); }
96 
97  // #107245# GetCloseBack() for bLatheCloseBack
98  bool GetCloseBack() const
99  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_BACK).GetValue(); }
100 
101  virtual sal_uInt16 GetObjIdentifier() const override;
102 
103  virtual E3dLatheObj* CloneSdrObject(SdrModel& rTargetModel) const override;
104 
105  // implemented mainly for the purposes of Clone()
106  E3dLatheObj& operator=(const E3dLatheObj& rObj);
107 
108  virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
109 
110  // TakeObjName...() is for the display in the UI, for example "3 frames selected".
111  virtual OUString TakeObjNameSingul() const override;
112  virtual OUString TakeObjNamePlural() const override;
113 
114  // set/get local parameters with geometry recreation
115  void SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew);
116  const basegfx::B2DPolyPolygon& GetPolyPoly2D() const { return maPolyPoly2D; }
117 
118  // break up
119  virtual bool IsBreakObjPossible() override;
120  virtual std::unique_ptr<SdrAttrObj,SdrObjectFreeOp> GetBreakObj() override;
121 };
122 
123 #endif // INCLUDED_SVX_LATHE3D_HXX
124 
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString TakeObjNameSingul() const override
Definition: obj3d.cxx:362
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DOBJ_VERT_SEGS(SDRATTR_3DOBJ_FIRST+4)
virtual sal_uInt16 GetObjIdentifier() const override
Definition: obj3d.cxx:545
constexpr TypedWhichId< Svx3DSmoothNormalsItem > SDRATTR_3DOBJ_SMOOTH_NORMALS(SDRATTR_3DOBJ_FIRST+19)
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const
Definition: svdobj.cxx:2530
bool GetCharacterMode() const
Definition: lathe3d.hxx:90
bool GetCloseFront() const
Definition: lathe3d.hxx:94
bool GetSmoothLids() const
Definition: lathe3d.hxx:86
constexpr TypedWhichId< Svx3DCharacterModeItem > SDRATTR_3DOBJ_CHARACTER_MODE(SDRATTR_3DOBJ_FIRST+21)
virtual bool IsBreakObjPossible()
Definition: obj3d.cxx:76
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1884
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DOBJ_HORZ_SEGS(SDRATTR_3DOBJ_FIRST+3)
E3dCompoundObject & operator=(const E3dCompoundObject &rObj)
Definition: obj3d.cxx:598
sal_uInt16 GetBackScale() const
Definition: lathe3d.hxx:74
const basegfx::B2DPolyPolygon & GetPolyPoly2D() const
Definition: lathe3d.hxx:116
sal_uInt32 GetVerticalSegments() const
Definition: lathe3d.hxx:66
sal_uInt32 GetEndAngle() const
Definition: lathe3d.hxx:78
bool GetSmoothNormals() const
Definition: lathe3d.hxx:82
constexpr TypedWhichId< Svx3DSmoothLidsItem > SDRATTR_3DOBJ_SMOOTH_LIDS(SDRATTR_3DOBJ_FIRST+20)
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact()
Definition: svdobj.cxx:240
constexpr TypedWhichId< Svx3DCloseBackItem > SDRATTR_3DOBJ_CLOSE_BACK(SDRATTR_3DOBJ_FIRST+23)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr TypedWhichId< SfxUInt16Item > SDRATTR_3DOBJ_BACKSCALE(SDRATTR_3DOBJ_FIRST+1)
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
constexpr TypedWhichId< SfxUInt16Item > SDRATTR_3DOBJ_PERCENT_DIAGONAL(SDRATTR_3DOBJ_FIRST+0)
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:114
bool GetCloseBack() const
Definition: lathe3d.hxx:98
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: obj3d.cxx:454
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DOBJ_END_ANGLE(SDRATTR_3DOBJ_FIRST+5)
sal_uInt32 GetHorizontalSegments() const
Definition: lathe3d.hxx:62
virtual std::unique_ptr< SdrAttrObj, SdrObjectFreeOp > GetBreakObj()
Definition: obj3d.cxx:81
sal_uInt16 GetPercentDiagonal() const
Definition: lathe3d.hxx:70
basegfx::B2DPolyPolygon maPolyPoly2D
Definition: lathe3d.hxx:44
virtual E3dCompoundObject * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: obj3d.cxx:593
virtual OUString TakeObjNamePlural() const override
Definition: obj3d.cxx:378
constexpr TypedWhichId< Svx3DCloseFrontItem > SDRATTR_3DOBJ_CLOSE_FRONT(SDRATTR_3DOBJ_FIRST+22)