LibreOffice Module svx (master)  1
cube3d.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/cube3d.hxx>
25 #include <svx/globl3d.hxx>
29 
30 
31 // DrawContact section
32 
33 std::unique_ptr<sdr::contact::ViewContact> E3dCubeObj::CreateObjectSpecificViewContact()
34 {
35  return std::make_unique<sdr::contact::ViewContactOfE3dCube>(*this);
36 }
37 
38 
40  SdrModel& rSdrModel,
41  const E3dDefaultAttributes& rDefault,
42  const basegfx::B3DPoint& aPos,
43  const basegfx::B3DVector& r3DSize)
44 : E3dCompoundObject(rSdrModel)
45 {
46  // Set Defaults
47  SetDefaultAttributes(rDefault);
48 
49  // position centre or left, bottom, back (dependent on bPosIsCenter)
50  aCubePos = aPos;
51  aCubeSize = r3DSize;
52 }
53 
55 : E3dCompoundObject(rSdrModel)
56 {
57  // Set Defaults
58  const E3dDefaultAttributes aDefault;
59 
60  SetDefaultAttributes(aDefault);
61 }
62 
64 {
65 }
66 
68 {
69  aCubePos = rDefault.GetDefaultCubePos();
70  aCubeSize = rDefault.GetDefaultCubeSize();
72 }
73 
74 sal_uInt16 E3dCubeObj::GetObjIdentifier() const
75 {
76  return E3D_CUBEOBJ_ID;
77 }
78 
79 // Convert the object into a group object consisting of 6 polygons
80 
81 SdrObjectUniquePtr E3dCubeObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
82 {
83  return nullptr;
84 }
85 
87 {
88  return CloneHelper< E3dCubeObj >(rTargetModel);
89 }
90 
92 {
93  if( this == &rObj )
94  return *this;
96 
97  aCubePos = rObj.aCubePos;
98  aCubeSize = rObj.aCubeSize;
100 
101  return *this;
102 }
103 
104 // Set local parameters with geometry re-creating
105 
107 {
108  if(aCubePos != rNew)
109  {
110  aCubePos = rNew;
111  ActionChanged();
112  }
113 }
114 
116 {
117  if(aCubeSize != rNew)
118  {
119  aCubeSize = rNew;
120  ActionChanged();
121  }
122 }
123 
125 {
126  if(bPosIsCenter != bNew)
127  {
128  bPosIsCenter = bNew;
129  ActionChanged();
130  }
131 }
132 
133 // Get the name of the object (singular)
134 
136 {
137  OUStringBuffer sName(SvxResId(STR_ObjNameSingulCube3d));
138 
139  OUString aName(GetName());
140  if (!aName.isEmpty())
141  {
142  sName.append(' ');
143  sName.append('\'');
144  sName.append(aName);
145  sName.append('\'');
146  }
147  return sName.makeStringAndClear();
148 }
149 
150 // Get the name of the object (plural)
151 
153 {
154  return SvxResId(STR_ObjNamePluralCube3d);
155 }
156 
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: cube3d.cxx:81
virtual ~E3dCubeObj() override
Definition: cube3d.cxx:63
bool bPosIsCenter
Definition: cube3d.hxx:54
virtual OUString TakeObjNameSingul() const override
Definition: cube3d.cxx:135
basegfx::B3DVector aCubeSize
Definition: cube3d.hxx:51
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: cube3d.cxx:33
virtual E3dCubeObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: cube3d.cxx:86
void SetCubeSize(const basegfx::B3DVector &rNew)
Definition: cube3d.cxx:115
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
virtual sal_uInt16 GetObjIdentifier() const override
Definition: cube3d.cxx:74
const basegfx::B3DPoint & GetDefaultCubePos() const
Definition: deflt3d.hxx:67
E3dCubeObj & operator=(const E3dCubeObj &rObj)
Definition: cube3d.cxx:91
OUString sName
E3dCompoundObject & operator=(const E3dCompoundObject &rObj)
Definition: obj3d.cxx:631
void ActionChanged() const
Definition: svdobj.cxx:283
virtual OUString TakeObjNamePlural() const override
Definition: cube3d.cxx:152
const basegfx::B3DVector & GetDefaultCubeSize() const
Definition: deflt3d.hxx:68
OUString GetName() const
Definition: svdobj.cxx:725
void SetPosIsCenter(bool bNew)
Definition: cube3d.cxx:124
void SetCubePos(const basegfx::B3DPoint &rNew)
Definition: cube3d.cxx:106
OUString aName
basegfx::B3DPoint aCubePos
Definition: cube3d.hxx:50
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:114
E3dCubeObj(SdrModel &rSdrModel, const E3dDefaultAttributes &rDefault, const basegfx::B3DPoint &aPos, const basegfx::B3DVector &r3DSize)
Definition: cube3d.cxx:39
bool GetDefaultCubePosIsCenter() const
Definition: deflt3d.hxx:69
const sal_uInt16 E3D_CUBEOBJ_ID
Definition: globl3d.hxx:27
void SetDefaultAttributes(const E3dDefaultAttributes &rDefault)
Definition: cube3d.cxx:67