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>
30 // DrawContact section
32 std::unique_ptr
<sdr::contact::ViewContact
> E3dCubeObj::CreateObjectSpecificViewContact()
34 return std::make_unique
<sdr::contact::ViewContactOfE3dCube
>(*this);
38 E3dCubeObj::E3dCubeObj(
40 const E3dDefaultAttributes
& rDefault
,
41 const basegfx::B3DPoint
& aPos
,
42 const basegfx::B3DVector
& r3DSize
)
43 : E3dCompoundObject(rSdrModel
)
46 SetDefaultAttributes(rDefault
);
48 // position centre or left, bottom, back (dependent on bPosIsCenter)
53 E3dCubeObj::E3dCubeObj(SdrModel
& rSdrModel
)
54 : E3dCompoundObject(rSdrModel
)
57 const E3dDefaultAttributes aDefault
;
59 SetDefaultAttributes(aDefault
);
62 E3dCubeObj::E3dCubeObj(SdrModel
& rSdrModel
, E3dCubeObj
const & rSource
)
63 : E3dCompoundObject(rSdrModel
, rSource
)
66 const E3dDefaultAttributes aDefault
;
68 SetDefaultAttributes(aDefault
);
70 aCubePos
= rSource
.aCubePos
;
71 aCubeSize
= rSource
.aCubeSize
;
72 bPosIsCenter
= rSource
.bPosIsCenter
;
75 E3dCubeObj::~E3dCubeObj()
79 void E3dCubeObj::SetDefaultAttributes(const E3dDefaultAttributes
& rDefault
)
81 aCubePos
= rDefault
.GetDefaultCubePos();
82 aCubeSize
= rDefault
.GetDefaultCubeSize();
83 bPosIsCenter
= rDefault
.GetDefaultCubePosIsCenter();
86 SdrObjKind
E3dCubeObj::GetObjIdentifier() const
88 return SdrObjKind::E3D_Cube
;
91 // Convert the object into a group object consisting of 6 polygons
93 rtl::Reference
<SdrObject
> E3dCubeObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
98 rtl::Reference
<SdrObject
> E3dCubeObj::CloneSdrObject(SdrModel
& rTargetModel
) const
100 return new E3dCubeObj(rTargetModel
, *this);
103 // Set local parameters with geometry re-creating
105 void E3dCubeObj::SetCubePos(const basegfx::B3DPoint
& rNew
)
114 void E3dCubeObj::SetCubeSize(const basegfx::B3DVector
& rNew
)
116 if(aCubeSize
!= rNew
)
123 void E3dCubeObj::SetPosIsCenter(bool bNew
)
125 if(bPosIsCenter
!= bNew
)
132 // Get the name of the object (singular)
134 OUString
E3dCubeObj::TakeObjNameSingul() const
136 OUString sName
= SvxResId(STR_ObjNameSingulCube3d
);
138 OUString
aName(GetName());
139 if (!aName
.isEmpty())
141 sName
+= " \'" + aName
+ "'";
146 // Get the name of the object (plural)
148 OUString
E3dCubeObj::TakeObjNamePlural() const
150 return SvxResId(STR_ObjNamePluralCube3d
);
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */