LibreOffice Module svx (master)  1
extrud3d.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_EXTRUD3D_HXX
21 #define INCLUDED_SVX_EXTRUD3D_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 
31 
32 /*************************************************************************
33 |*
34 |* 3D extrusion object created from the provided 2D polygon
35 |*
36 \************************************************************************/
37 
39 {
40 private:
41  // to allow sdr::properties::E3dExtrudeProperties access to SetGeometryValid()
43 
44  // geometry, which determines the object
46 
47  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
48  virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
49  void SetDefaultAttributes(const E3dDefaultAttributes& rDefault);
50 
51 private:
52  // protected destructor - due to final, make private
53  virtual ~E3dExtrudeObj() override;
54 
55 public:
57  SdrModel& rSdrModel,
58  const E3dDefaultAttributes& rDefault,
59  const basegfx::B2DPolyPolygon& rPP,
60  double fDepth);
61  E3dExtrudeObj(SdrModel& rSdrModel);
62 
63  // PercentDiagonal: 0..100, before 0.0..0.5
64  sal_uInt16 GetPercentDiagonal() const
65  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL).GetValue(); }
66 
67  // BackScale: 0..100, before 0.0..1.0
68  sal_uInt16 GetPercentBackScale() const
69  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_BACKSCALE).GetValue(); }
70 
71  // BackScale: 0..100, before 0.0..1.0
72  sal_uInt32 GetExtrudeDepth() const
73  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_DEPTH).GetValue(); }
74 
75  // #107245# GetSmoothNormals() for bExtrudeSmoothed
76  bool GetSmoothNormals() const
77  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_NORMALS).GetValue(); }
78 
79  // #107245# GetSmoothLids() for bExtrudeSmoothFrontBack
80  bool GetSmoothLids() const
81  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_LIDS).GetValue(); }
82 
83  // #107245# GetCharacterMode() for bExtrudeCharacterMode
84  bool GetCharacterMode() const
85  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_CHARACTER_MODE).GetValue(); }
86 
87  // #107245# GetCloseFront() for bExtrudeCloseFront
88  bool GetCloseFront() const
89  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_FRONT).GetValue(); }
90 
91  // #107245# GetCloseBack() for bExtrudeCloseBack
92  bool GetCloseBack() const
93  { return GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_BACK).GetValue(); }
94 
95  virtual sal_uInt16 GetObjIdentifier() const override;
96 
97  virtual E3dExtrudeObj* CloneSdrObject(SdrModel& rTargetModel) const override;
98 
99  // implemented mainly for the purposes of Clone()
100  E3dExtrudeObj& operator=(const E3dExtrudeObj& rObj);
101 
102  // TakeObjName...() is for the display in the UI (for example "3 frames selected")
103  virtual OUString TakeObjNameSingul() const override;
104  virtual OUString TakeObjNamePlural() const override;
105 
106  // set/get local parameters with geometry regeneration
107  void SetExtrudePolygon(const basegfx::B2DPolyPolygon &rNew);
108  const basegfx::B2DPolyPolygon &GetExtrudePolygon() const { return maExtrudePolygon; }
109 
110  virtual bool IsBreakObjPossible() override;
111  virtual std::unique_ptr<SdrAttrObj,SdrObjectFreeOp> GetBreakObj() override;
112 };
113 
114 #endif // INCLUDED_SVX_EXTRUD3D_HXX
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString TakeObjNameSingul() const override
Definition: obj3d.cxx:395
#define SDRATTR_3DOBJ_PERCENT_DIAGONAL
Definition: svddef.hxx:323
#define SDRATTR_3DOBJ_CLOSE_BACK
Definition: svddef.hxx:349
virtual sal_uInt16 GetObjIdentifier() const override
Definition: obj3d.cxx:578
sal_uInt16 GetPercentBackScale() const
Definition: extrud3d.hxx:68
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
#define SDRATTR_3DOBJ_SMOOTH_NORMALS
Definition: svddef.hxx:345
virtual bool IsBreakObjPossible()
Definition: obj3d.cxx:109
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1906
bool GetSmoothLids() const
Definition: extrud3d.hxx:80
basegfx::B2DPolyPolygon maExtrudePolygon
Definition: extrud3d.hxx:45
#define SDRATTR_3DOBJ_SMOOTH_LIDS
Definition: svddef.hxx:346
E3dCompoundObject & operator=(const E3dCompoundObject &rObj)
Definition: obj3d.cxx:631
#define SDRATTR_3DOBJ_BACKSCALE
Definition: svddef.hxx:324
#define SDRATTR_3DOBJ_DEPTH
Definition: svddef.hxx:325
sal_uInt16 GetPercentDiagonal() const
Definition: extrud3d.hxx:64
#define SAL_WARN_UNUSED
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact()
Definition: svdobj.cxx:266
bool GetCharacterMode() const
Definition: extrud3d.hxx:84
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt32 GetExtrudeDepth() const
Definition: extrud3d.hxx:72
const basegfx::B2DPolyPolygon & GetExtrudePolygon() const
Definition: extrud3d.hxx:108
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: obj3d.cxx:487
#define SDRATTR_3DOBJ_CHARACTER_MODE
Definition: svddef.hxx:347
bool GetCloseFront() const
Definition: extrud3d.hxx:88
virtual std::unique_ptr< SdrAttrObj, SdrObjectFreeOp > GetBreakObj()
Definition: obj3d.cxx:114
bool GetCloseBack() const
Definition: extrud3d.hxx:92
virtual E3dCompoundObject * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: obj3d.cxx:626
bool GetSmoothNormals() const
Definition: extrud3d.hxx:76
virtual OUString TakeObjNamePlural() const override
Definition: obj3d.cxx:411
#define SDRATTR_3DOBJ_CLOSE_FRONT
Definition: svddef.hxx:348