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/svdstr.hrc"
22 #include "svdglob.hxx"
23 #include <svx/cube3d.hxx>
24 #include "svx/globl3d.hxx"
25 #include <basegfx/point/b3dpoint.hxx>
26 #include <basegfx/polygon/b3dpolygon.hxx>
27 #include <sdr/contact/viewcontactofe3dcube.hxx>
30 // DrawContact section
32 sdr::contact::ViewContact
* E3dCubeObj::CreateObjectSpecificViewContact()
34 return new sdr::contact::ViewContactOfE3dCube(*this);
37 TYPEINIT1(E3dCubeObj
, E3dCompoundObject
);
39 E3dCubeObj::E3dCubeObj(E3dDefaultAttributes
& rDefault
, basegfx::B3DPoint aPos
, const basegfx::B3DVector
& r3DSize
)
40 : E3dCompoundObject(rDefault
)
43 SetDefaultAttributes(rDefault
);
45 aCubePos
= aPos
; // position centre or left, bottom, back (dependent on bPosIsCenter)
49 E3dCubeObj::E3dCubeObj()
53 E3dDefaultAttributes aDefault
;
54 SetDefaultAttributes(aDefault
);
57 void E3dCubeObj::SetDefaultAttributes(E3dDefaultAttributes
& rDefault
)
59 aCubePos
= rDefault
.GetDefaultCubePos();
60 aCubeSize
= rDefault
.GetDefaultCubeSize();
61 nSideFlags
= rDefault
.GetDefaultCubeSideFlags();
62 bPosIsCenter
= rDefault
.GetDefaultCubePosIsCenter();
65 sal_uInt16
E3dCubeObj::GetObjIdentifier() const
67 return E3D_CUBEOBJ_ID
;
70 // Convert the object into a group object consisting of 6 polygons
72 SdrObject
*E3dCubeObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
77 E3dCubeObj
* E3dCubeObj::Clone() const
79 return CloneHelper
< E3dCubeObj
>();
82 // Set local parameters with geometry re-creating
84 void E3dCubeObj::SetCubePos(const basegfx::B3DPoint
& rNew
)
93 void E3dCubeObj::SetCubeSize(const basegfx::B3DVector
& rNew
)
102 void E3dCubeObj::SetPosIsCenter(bool bNew
)
104 if(bPosIsCenter
!= bNew
)
111 // Get the name of the object (singular)
113 OUString
E3dCubeObj::TakeObjNameSingul() const
115 OUStringBuffer
sName(ImpGetResStr(STR_ObjNameSingulCube3d
));
117 OUString
aName(GetName());
118 if (!aName
.isEmpty())
125 return sName
.makeStringAndClear();
128 // Get the name of the object (plural)
130 OUString
E3dCubeObj::TakeObjNamePlural() const
132 return ImpGetResStr(STR_ObjNamePluralCube3d
);
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */