Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "svx/svdstr.hrc"
31 : : #include "svx/svdglob.hxx"
32 : : #include <svx/cube3d.hxx>
33 : : #include "svx/globl3d.hxx"
34 : : #include <basegfx/point/b3dpoint.hxx>
35 : : #include <basegfx/polygon/b3dpolygon.hxx>
36 : : #include <svx/sdr/contact/viewcontactofe3dcube.hxx>
37 : :
38 : : //////////////////////////////////////////////////////////////////////////////
39 : : // DrawContact section
40 : :
41 : 0 : sdr::contact::ViewContact* E3dCubeObj::CreateObjectSpecificViewContact()
42 : : {
43 [ # # ]: 0 : return new sdr::contact::ViewContactOfE3dCube(*this);
44 : : }
45 : :
46 [ # # ][ # # ]: 0 : TYPEINIT1(E3dCubeObj, E3dCompoundObject);
47 : :
48 : 0 : E3dCubeObj::E3dCubeObj(E3dDefaultAttributes& rDefault, basegfx::B3DPoint aPos, const basegfx::B3DVector& r3DSize)
49 : 0 : : E3dCompoundObject(rDefault)
50 : : {
51 : : // Set Defaults
52 [ # # ]: 0 : SetDefaultAttributes(rDefault);
53 : :
54 [ # # ]: 0 : aCubePos = aPos; // position centre or left, bottom, back (dependant on bPosIsCenter)
55 [ # # ]: 0 : aCubeSize = r3DSize;
56 : 0 : }
57 : :
58 : 0 : E3dCubeObj::E3dCubeObj()
59 : 0 : : E3dCompoundObject()
60 : : {
61 : : // Set Defaults
62 [ # # ]: 0 : E3dDefaultAttributes aDefault;
63 [ # # ][ # # ]: 0 : SetDefaultAttributes(aDefault);
64 : 0 : }
65 : :
66 : 0 : void E3dCubeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
67 : : {
68 : 0 : aCubePos = rDefault.GetDefaultCubePos();
69 : 0 : aCubeSize = rDefault.GetDefaultCubeSize();
70 : 0 : nSideFlags = rDefault.GetDefaultCubeSideFlags();
71 : 0 : bPosIsCenter = rDefault.GetDefaultCubePosIsCenter();
72 : 0 : }
73 : :
74 : 0 : sal_uInt16 E3dCubeObj::GetObjIdentifier() const
75 : : {
76 : 0 : return E3D_CUBEOBJ_ID;
77 : : }
78 : :
79 : : // Convert the object into a group object consisting of 6 polygons
80 : :
81 : 0 : SdrObject *E3dCubeObj::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
82 : : {
83 : 0 : return NULL;
84 : : }
85 : :
86 : 0 : E3dCubeObj* E3dCubeObj::Clone() const
87 : : {
88 : 0 : return CloneHelper< E3dCubeObj >();
89 : : }
90 : :
91 : : // Set local parameters with geometry re-creating
92 : :
93 : 0 : void E3dCubeObj::SetCubePos(const basegfx::B3DPoint& rNew)
94 : : {
95 [ # # ]: 0 : if(aCubePos != rNew)
96 : : {
97 : 0 : aCubePos = rNew;
98 : 0 : ActionChanged();
99 : : }
100 : 0 : }
101 : :
102 : 0 : void E3dCubeObj::SetCubeSize(const basegfx::B3DVector& rNew)
103 : : {
104 [ # # ]: 0 : if(aCubeSize != rNew)
105 : : {
106 : 0 : aCubeSize = rNew;
107 : 0 : ActionChanged();
108 : : }
109 : 0 : }
110 : :
111 : 0 : void E3dCubeObj::SetPosIsCenter(sal_Bool bNew)
112 : : {
113 [ # # ]: 0 : if(bPosIsCenter != bNew)
114 : : {
115 : 0 : bPosIsCenter = bNew;
116 : 0 : ActionChanged();
117 : : }
118 : 0 : }
119 : :
120 : : // Get the name of the object (singular)
121 : :
122 : 0 : void E3dCubeObj::TakeObjNameSingul(XubString& rName) const
123 : : {
124 [ # # ][ # # ]: 0 : rName=ImpGetResStr(STR_ObjNameSingulCube3d);
[ # # ]
125 : :
126 [ # # ][ # # ]: 0 : String aName( GetName() );
127 [ # # ]: 0 : if(aName.Len())
128 : : {
129 [ # # ]: 0 : rName += sal_Unicode(' ');
130 [ # # ]: 0 : rName += sal_Unicode('\'');
131 [ # # ]: 0 : rName += aName;
132 [ # # ]: 0 : rName += sal_Unicode('\'');
133 [ # # ]: 0 : }
134 : 0 : }
135 : :
136 : : // Get the name of the object (plural)
137 : :
138 : 0 : void E3dCubeObj::TakeObjNamePlural(XubString& rName) const
139 : : {
140 [ # # ]: 0 : rName=ImpGetResStr(STR_ObjNamePluralCube3d);
141 : 0 : }
142 : :
143 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|