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