1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <svx/strings.hrc>
22 #include <svx/deflt3d.hxx>
23 #include <svx/dialmgr.hxx>
24 #include <svx/cube3d.hxx>
25 #include <svx/svdobjkind.hxx>
26 #include <basegfx/point/b3dpoint.hxx>
27 #include <sdr/contact/viewcontactofe3dcube.hxx>
28 #include <rtl/ustrbuf.hxx>
31 // DrawContact section
33 std::unique_ptr
<sdr::contact::ViewContact
> E3dCubeObj::CreateObjectSpecificViewContact()
35 return std::make_unique
<sdr::contact::ViewContactOfE3dCube
>(*this);
39 E3dCubeObj::E3dCubeObj(
41 const E3dDefaultAttributes
& rDefault
,
42 const basegfx::B3DPoint
& aPos
,
43 const basegfx::B3DVector
& r3DSize
)
44 : E3dCompoundObject(rSdrModel
)
47 SetDefaultAttributes(rDefault
);
49 // position centre or left, bottom, back (dependent on bPosIsCenter)
54 E3dCubeObj::E3dCubeObj(SdrModel
& rSdrModel
)
55 : E3dCompoundObject(rSdrModel
)
58 const E3dDefaultAttributes aDefault
;
60 SetDefaultAttributes(aDefault
);
63 E3dCubeObj::~E3dCubeObj()
67 void E3dCubeObj::SetDefaultAttributes(const E3dDefaultAttributes
& rDefault
)
69 aCubePos
= rDefault
.GetDefaultCubePos();
70 aCubeSize
= rDefault
.GetDefaultCubeSize();
71 bPosIsCenter
= rDefault
.GetDefaultCubePosIsCenter();
74 SdrObjKind
E3dCubeObj::GetObjIdentifier() const
76 return E3D_CUBEOBJ_ID
;
79 // Convert the object into a group object consisting of 6 polygons
81 SdrObjectUniquePtr
E3dCubeObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
86 E3dCubeObj
* E3dCubeObj::CloneSdrObject(SdrModel
& rTargetModel
) const
88 return CloneHelper
< E3dCubeObj
>(rTargetModel
);
91 E3dCubeObj
& E3dCubeObj::operator=(const E3dCubeObj
& rObj
)
95 E3dCompoundObject::operator=(rObj
);
97 aCubePos
= rObj
.aCubePos
;
98 aCubeSize
= rObj
.aCubeSize
;
99 bPosIsCenter
= rObj
.bPosIsCenter
;
104 // Set local parameters with geometry re-creating
106 void E3dCubeObj::SetCubePos(const basegfx::B3DPoint
& rNew
)
115 void E3dCubeObj::SetCubeSize(const basegfx::B3DVector
& rNew
)
117 if(aCubeSize
!= rNew
)
124 void E3dCubeObj::SetPosIsCenter(bool bNew
)
126 if(bPosIsCenter
!= bNew
)
133 // Get the name of the object (singular)
135 OUString
E3dCubeObj::TakeObjNameSingul() const
137 OUStringBuffer
sName(SvxResId(STR_ObjNameSingulCube3d
));
139 OUString
aName(GetName());
140 if (!aName
.isEmpty())
147 return sName
.makeStringAndClear();
150 // Get the name of the object (plural)
152 OUString
E3dCubeObj::TakeObjNamePlural() const
154 return SvxResId(STR_ObjNamePluralCube3d
);
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */