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/svdview.hxx>
33 : : #include <svx/svdattr.hxx>
34 : : #include <svx/svdpage.hxx>
35 : : #include <svx/svdmodel.hxx>
36 : : #include "svx/svditer.hxx"
37 : : #include "svx/globl3d.hxx"
38 : : #include <svx/camera3d.hxx>
39 : : #include <svx/scene3d.hxx>
40 : : #include <svx/polysc3d.hxx>
41 : : #include <svx/cube3d.hxx>
42 : : #include <svx/lathe3d.hxx>
43 : : #include <svx/sphere3d.hxx>
44 : : #include <svx/extrud3d.hxx>
45 : : #include <svx/obj3d.hxx>
46 : : #include <svx/xtable.hxx>
47 : : #include <svx/xflclit.hxx>
48 : : #include <vcl/svapp.hxx>
49 : : #include <vcl/settings.hxx>
50 : : #include <svx/xlnclit.hxx>
51 : : #include <svl/metitem.hxx>
52 : : #include <svx/xfillit.hxx>
53 : : #include <svx/xlnwtit.hxx>
54 : : #include <vcl/virdev.hxx>
55 : : #include <tools/poly.hxx>
56 : : #include <tools/b3dtrans.hxx>
57 : : #include <svx/svxids.hrc>
58 : : #include <editeng/colritem.hxx>
59 : : #include <svx/e3ditem.hxx>
60 : : #include <svx/xlntrit.hxx>
61 : : #include <svx/xfltrit.hxx>
62 : : #include <svx/svdpagv.hxx>
63 : : #include <vcl/gradient.hxx>
64 : : #include <vcl/metaact.hxx>
65 : : #include <svx/svx3ditems.hxx>
66 : : #include <svl/whiter.hxx>
67 : : #include <svtools/colorcfg.hxx>
68 : : #include <editeng/eeitem.hxx>
69 : : #include <svx/xgrscit.hxx>
70 : : #include <svx/sdr/properties/e3dproperties.hxx>
71 : : #include <svx/sdr/properties/e3dcompoundproperties.hxx>
72 : : #include <basegfx/polygon/b3dpolypolygontools.hxx>
73 : : #include <basegfx/point/b3dpoint.hxx>
74 : : #include <basegfx/vector/b3dvector.hxx>
75 : : #include <svx/xlndsit.hxx>
76 : : #include <basegfx/matrix/b3dhommatrix.hxx>
77 : : #include <basegfx/polygon/b3dpolygon.hxx>
78 : : #include <basegfx/matrix/b2dhommatrix.hxx>
79 : : #include <basegfx/polygon/b2dpolypolygontools.hxx>
80 : : #include <basegfx/polygon/b3dpolygontools.hxx>
81 : : #include <svx/helperhittest3d.hxx>
82 : : #include <svx/sdr/contact/viewcontactofe3d.hxx>
83 : : #include <drawinglayer/geometry/viewinformation3d.hxx>
84 : : #include <com/sun/star/uno/Sequence.h>
85 : : #include <svx/sdr/contact/viewcontactofe3dscene.hxx>
86 : : #include <svx/e3dsceneupdater.hxx>
87 : :
88 : : //////////////////////////////////////////////////////////////////////////////
89 : :
90 : : using namespace com::sun::star;
91 : :
92 : :
93 : : // List for 3D-Objects
94 : :
95 [ - + ][ - + ]: 7983 : TYPEINIT1(E3dObjList, SdrObjList);
96 : :
97 : 2675 : E3dObjList::E3dObjList(SdrModel* pNewModel, SdrPage* pNewPage, E3dObjList* pNewUpList)
98 : 2675 : : SdrObjList(pNewModel, pNewPage, pNewUpList)
99 : : {
100 : 2675 : }
101 : :
102 : 0 : E3dObjList::E3dObjList(const E3dObjList& rSrcList)
103 : 0 : : SdrObjList(rSrcList)
104 : : {
105 : 0 : }
106 : :
107 : 2675 : E3dObjList::~E3dObjList()
108 : : {
109 [ - + ]: 2675 : }
110 : :
111 : 2661 : void E3dObjList::NbcInsertObject(SdrObject* pObj, sal_uIntPtr nPos, const SdrInsertReason* pReason)
112 : : {
113 : : // Get owner
114 : : DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "Insert 3D object in parent != 3DObject");
115 : :
116 : : // Is it even a 3D object?
117 [ + - ][ + - ]: 2661 : if(pObj && pObj->ISA(E3dObject))
[ + - ]
118 : : {
119 : : // Normal 3D object, insert means
120 : : // call parent
121 : 2661 : SdrObjList::NbcInsertObject(pObj, nPos, pReason);
122 : : }
123 : : else
124 : : {
125 : : // No 3D object, inserted a page in place in a scene ...
126 : 0 : GetOwnerObj()->GetPage()->InsertObject(pObj, nPos);
127 : : }
128 : 2661 : }
129 : :
130 : 0 : void E3dObjList::InsertObject(SdrObject* pObj, sal_uIntPtr nPos, const SdrInsertReason* pReason)
131 : : {
132 : : OSL_ENSURE(GetOwnerObj()->ISA(E3dObject), "Insert 3D object in non-3D Parent");
133 : :
134 : : // call parent
135 : 0 : SdrObjList::InsertObject(pObj, nPos, pReason);
136 : :
137 : 0 : E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
138 [ # # ]: 0 : if(pScene)
139 : : {
140 : 0 : pScene->Cleanup3DDepthMapper();
141 : : }
142 : 0 : }
143 : :
144 : 1894 : SdrObject* E3dObjList::NbcRemoveObject(sal_uIntPtr nObjNum)
145 : : {
146 : : DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "Remove 3D object from Parent != 3DObject");
147 : :
148 : : // call parent
149 : 1894 : SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum);
150 : :
151 : 1894 : E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
152 [ + - ]: 1894 : if(pScene)
153 : : {
154 : 1894 : pScene->Cleanup3DDepthMapper();
155 : : }
156 : :
157 : 1894 : return pRetval;
158 : : }
159 : :
160 : 0 : SdrObject* E3dObjList::RemoveObject(sal_uIntPtr nObjNum)
161 : : {
162 : : OSL_ENSURE(GetOwnerObj()->ISA(E3dObject), "3D object is removed from non-3D Parent");
163 : :
164 : : // call parent
165 : 0 : SdrObject* pRetval = SdrObjList::RemoveObject(nObjNum);
166 : :
167 : 0 : E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
168 [ # # ]: 0 : if(pScene)
169 : : {
170 : 0 : pScene->Cleanup3DDepthMapper();
171 : : }
172 : :
173 : 0 : return pRetval;
174 : : }
175 : :
176 : : //////////////////////////////////////////////////////////////////////////////
177 : :
178 : 0 : sdr::properties::BaseProperties* E3dObject::CreateObjectSpecificProperties()
179 : : {
180 [ # # ]: 0 : return new sdr::properties::E3dProperties(*this);
181 : : }
182 : :
183 : : //////////////////////////////////////////////////////////////////////////////
184 : :
185 [ + + ][ - + ]: 16160553 : TYPEINIT1(E3dObject, SdrAttrObj);
186 : :
187 : 2675 : E3dObject::E3dObject()
188 : : : maSubList(),
189 : : maLocalBoundVol(),
190 : : maTransformation(),
191 : : maFullTransform(),
192 : : mbTfHasChanged(true),
193 [ + - ][ + - ]: 2675 : mbIsSelected(false)
[ + - ][ + - ]
194 : : {
195 : 2675 : bIs3DObj = true;
196 : 2675 : maSubList.SetOwnerObj(this);
197 : 2675 : maSubList.SetListKind(SDROBJLIST_GROUPOBJ);
198 : 2675 : bClosedObj = true;
199 : 2675 : }
200 : :
201 [ + - ][ + - ]: 2675 : E3dObject::~E3dObject()
[ + - ]
202 : : {
203 [ - + ]: 2675 : }
204 : :
205 : 0 : void E3dObject::SetSelected(bool bNew)
206 : : {
207 [ # # ]: 0 : if((bool)mbIsSelected != bNew)
208 : : {
209 : 0 : mbIsSelected = bNew;
210 : : }
211 : :
212 [ # # ]: 0 : for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
213 : : {
214 [ # # ]: 0 : E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
215 : :
216 [ # # ]: 0 : if(pCandidate)
217 : : {
218 : 0 : pCandidate->SetSelected(bNew);
219 : : }
220 : : }
221 : 0 : }
222 : :
223 : : // Break, default implementations
224 : :
225 : 0 : sal_Bool E3dObject::IsBreakObjPossible()
226 : : {
227 : 0 : return sal_False;
228 : : }
229 : :
230 : 0 : SdrAttrObj* E3dObject::GetBreakObj()
231 : : {
232 : 0 : return 0L;
233 : : }
234 : :
235 : : // SetRectsDirty must be done through the local SdrSubList
236 : :
237 : 1203127 : void E3dObject::SetRectsDirty(sal_Bool bNotMyself)
238 : : {
239 : : // call parent
240 : 1203127 : SdrAttrObj::SetRectsDirty(bNotMyself);
241 : :
242 [ + + ]: 2348345 : for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
243 : : {
244 [ - + ]: 1145218 : E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
245 : :
246 [ + - ]: 1145218 : if(pCandidate)
247 : : {
248 : 1145218 : pCandidate->SetRectsDirty(bNotMyself);
249 : : }
250 : : }
251 : 1203127 : }
252 : :
253 : 13178 : sal_uInt32 E3dObject::GetObjInventor() const
254 : : {
255 : 13178 : return E3dInventor;
256 : : }
257 : :
258 : 0 : sal_uInt16 E3dObject::GetObjIdentifier() const
259 : : {
260 : 0 : return E3D_OBJECT_ID;
261 : : }
262 : :
263 : : // Determine the capabilities of the object
264 : :
265 : 0 : void E3dObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
266 : : {
267 : 0 : rInfo.bResizeFreeAllowed = sal_True;
268 : 0 : rInfo.bResizePropAllowed = sal_True;
269 : 0 : rInfo.bRotateFreeAllowed = sal_True;
270 : 0 : rInfo.bRotate90Allowed = sal_True;
271 : 0 : rInfo.bMirrorFreeAllowed = sal_False;
272 : 0 : rInfo.bMirror45Allowed = sal_False;
273 : 0 : rInfo.bMirror90Allowed = sal_False;
274 : 0 : rInfo.bShearAllowed = sal_False;
275 : 0 : rInfo.bEdgeRadiusAllowed = sal_False;
276 : 0 : rInfo.bCanConvToPath = sal_False;
277 : :
278 : : // no transparence for 3d objects
279 : 0 : rInfo.bTransparenceAllowed = sal_False;
280 : :
281 : : // gradient depends on fillstyle
282 : : // BM *** check if SetItem is NULL ***
283 : 0 : XFillStyle eFillStyle = ((XFillStyleItem&)(GetMergedItem(XATTR_FILLSTYLE))).GetValue();
284 : 0 : rInfo.bGradientAllowed = (eFillStyle == XFILL_GRADIENT);
285 : :
286 : : // Convert 3D objects in a group of polygons:
287 : : // At first not only possible, because the creation of a group of
288 : : // 2D polygons would be required which need to be sorted by depth,
289 : : // ie at intersections be cut relative to each other. Also the texture
290 : : // coorinates were an unsolved problem.
291 : 0 : rInfo.bCanConvToPoly = sal_False;
292 : 0 : rInfo.bCanConvToContour = sal_False;
293 : 0 : rInfo.bCanConvToPathLineToArea = sal_False;
294 : 0 : rInfo.bCanConvToPolyLineToArea = sal_False;
295 : 0 : }
296 : :
297 : 0 : void E3dObject::NbcSetLayer(SdrLayerID nLayer)
298 : : {
299 : 0 : SdrAttrObj::NbcSetLayer(nLayer);
300 : :
301 [ # # ]: 0 : for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
302 : : {
303 [ # # ]: 0 : E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
304 : :
305 [ # # ]: 0 : if(pCandidate)
306 : : {
307 : 0 : pCandidate->NbcSetLayer(nLayer);
308 : : }
309 : : }
310 : 0 : }
311 : :
312 : : // Set ObjList also on SubList
313 : :
314 : 4569 : void E3dObject::SetObjList(SdrObjList* pNewObjList)
315 : : {
316 : 4569 : SdrObject::SetObjList(pNewObjList);
317 : 4569 : maSubList.SetUpList(pNewObjList);
318 : 4569 : }
319 : :
320 : 8025 : void E3dObject::SetPage(SdrPage* pNewPage)
321 : : {
322 : 8025 : SdrAttrObj::SetPage(pNewPage);
323 : 8025 : maSubList.SetPage(pNewPage);
324 : 8025 : }
325 : :
326 : 2689 : void E3dObject::SetModel(SdrModel* pNewModel)
327 : : {
328 : 2689 : SdrAttrObj::SetModel(pNewModel);
329 : 2689 : maSubList.SetModel(pNewModel);
330 : 2689 : }
331 : :
332 : : // resize object, used from old 2d interfaces, e.g. in Move/Scale dialog (F4)
333 : :
334 : 0 : void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
335 : : {
336 : : // Movement in X, Y in the eye coordinate system
337 : 0 : E3dScene* pScene = GetScene();
338 : :
339 [ # # ]: 0 : if(pScene)
340 : : {
341 : : // transform pos from 2D world to 3D eye
342 [ # # ]: 0 : const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
343 [ # # ][ # # ]: 0 : const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
344 : 0 : basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y());
345 [ # # ][ # # ]: 0 : basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
346 : :
347 [ # # ]: 0 : aInverseSceneTransform.invert();
348 [ # # ]: 0 : aScaleCenter2D = aInverseSceneTransform * aScaleCenter2D;
349 : :
350 : 0 : basegfx::B3DPoint aScaleCenter3D(aScaleCenter2D.getX(), aScaleCenter2D.getY(), 0.5);
351 [ # # ][ # # ]: 0 : basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
[ # # ]
352 : :
353 [ # # ]: 0 : aInverseViewToEye.invert();
354 [ # # ][ # # ]: 0 : aScaleCenter3D = aInverseViewToEye * aScaleCenter3D;
355 : :
356 : : // Get scale factors
357 [ # # ]: 0 : double fScaleX(xFact);
358 [ # # ]: 0 : double fScaleY(yFact);
359 : :
360 : : // build transform
361 [ # # ][ # # ]: 0 : basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
362 [ # # ]: 0 : aInverseOrientation.invert();
363 [ # # ][ # # ]: 0 : basegfx::B3DHomMatrix mFullTransform(GetFullTransform());
364 [ # # ]: 0 : basegfx::B3DHomMatrix mTrans(mFullTransform);
365 : :
366 [ # # ][ # # ]: 0 : mTrans *= aViewInfo3D.getOrientation();
367 [ # # ]: 0 : mTrans.translate(-aScaleCenter3D.getX(), -aScaleCenter3D.getY(), -aScaleCenter3D.getZ());
368 [ # # ]: 0 : mTrans.scale(fScaleX, fScaleY, 1.0);
369 [ # # ]: 0 : mTrans.translate(aScaleCenter3D.getX(), aScaleCenter3D.getY(), aScaleCenter3D.getZ());
370 [ # # ]: 0 : mTrans *= aInverseOrientation;
371 [ # # ]: 0 : mFullTransform.invert();
372 [ # # ]: 0 : mTrans *= mFullTransform;
373 : :
374 : : // Apply
375 [ # # ][ # # ]: 0 : basegfx::B3DHomMatrix mObjTrans(GetTransform());
376 [ # # ]: 0 : mObjTrans *= mTrans;
377 : :
378 [ # # ]: 0 : E3DModifySceneSnapRectUpdater aUpdater(this);
379 [ # # ][ # # ]: 0 : SetTransform(mObjTrans);
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
380 : : }
381 : 0 : }
382 : :
383 : :
384 : : // Move object in 2D is needed when using cursor keys
385 : :
386 : 0 : void E3dObject::NbcMove(const Size& rSize)
387 : : {
388 : : // Movement in X, Y in the eye coordinate system
389 : 0 : E3dScene* pScene = GetScene();
390 : :
391 [ # # ]: 0 : if(pScene)
392 : : {
393 : : //Dimensions of the scene in 3D and 2D for comparison
394 [ # # ]: 0 : Rectangle aRect = pScene->GetSnapRect();
395 : :
396 [ # # ]: 0 : basegfx::B3DHomMatrix mInvDispTransform;
397 [ # # ][ # # ]: 0 : if(GetParentObj())
398 : : {
399 [ # # ][ # # ]: 0 : mInvDispTransform = GetParentObj()->GetFullTransform();
[ # # ]
400 [ # # ]: 0 : mInvDispTransform.invert();
401 : : }
402 : :
403 : : // BoundVolume from 3d world to 3d eye
404 [ # # ]: 0 : const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
405 [ # # ][ # # ]: 0 : const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
406 [ # # ]: 0 : basegfx::B3DRange aEyeVol(pScene->GetBoundVolume());
407 [ # # ][ # # ]: 0 : aEyeVol.transform(aViewInfo3D.getOrientation());
408 : :
409 : : // build relative movement vector in eye coordinates
410 : : basegfx::B3DPoint aMove(
411 [ # # ][ # # ]: 0 : (double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(),
412 [ # # ][ # # ]: 0 : (double)-rSize.Height() * aEyeVol.getHeight() / (double)aRect.GetHeight(),
413 : 0 : 0.0);
414 : 0 : basegfx::B3DPoint aPos(0.0, 0.0, 0.0);
415 : :
416 : : // movement vector to local coordinates of objects' parent
417 [ # # ][ # # ]: 0 : basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
418 [ # # ]: 0 : aInverseOrientation.invert();
419 [ # # ]: 0 : basegfx::B3DHomMatrix aCompleteTrans(mInvDispTransform * aInverseOrientation);
420 : :
421 [ # # ][ # # ]: 0 : aMove = aCompleteTrans * aMove;
422 [ # # ][ # # ]: 0 : aPos = aCompleteTrans * aPos;
423 : :
424 : : // build transformation and apply
425 [ # # ]: 0 : basegfx::B3DHomMatrix aTranslate;
426 [ # # ]: 0 : aTranslate.translate(aMove.getX() - aPos.getX(), aMove.getY() - aPos.getY(), aMove.getZ() - aPos.getZ());
427 : :
428 [ # # ]: 0 : E3DModifySceneSnapRectUpdater aUpdater(pScene);
429 [ # # ][ # # ]: 0 : SetTransform(aTranslate * GetTransform());
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
430 : : }
431 : 0 : }
432 : :
433 : : // Return the sublist, but only if it contains objects!
434 : :
435 : 76185 : SdrObjList* E3dObject::GetSubList() const
436 : : {
437 : 76185 : return &(const_cast< E3dObjList& >(maSubList));
438 : : }
439 : :
440 : 722 : void E3dObject::RecalcSnapRect()
441 : : {
442 : 722 : maSnapRect = Rectangle();
443 : :
444 [ - + ]: 722 : for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
445 : : {
446 [ # # ]: 0 : E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
447 : :
448 [ # # ]: 0 : if(pCandidate)
449 : : {
450 : 0 : maSnapRect.Union(pCandidate->GetSnapRect());
451 : : }
452 : : }
453 : 722 : }
454 : :
455 : : // Inform the parent about insertion of a 3D object, so that the parent is able
456 : : // treat the particualar objects in a special way (eg Light / Label in E3dScene)
457 : :
458 : 0 : void E3dObject::NewObjectInserted(const E3dObject* p3DObj)
459 : : {
460 [ # # ]: 0 : if(GetParentObj())
461 : 0 : GetParentObj()->NewObjectInserted(p3DObj);
462 : 0 : }
463 : :
464 : : // Inform parent of changes in the structure (eg by transformation), in this
465 : : // process the object in which the change has occurred is returned.
466 : :
467 : 53451 : void E3dObject::StructureChanged()
468 : : {
469 [ + + ]: 53451 : if ( GetParentObj() )
470 : : {
471 : 30224 : GetParentObj()->InvalidateBoundVolume();
472 : 30224 : GetParentObj()->StructureChanged();
473 : : }
474 : 53451 : }
475 : :
476 : 0 : void E3dObject::Insert3DObj(E3dObject* p3DObj)
477 : : {
478 : : DBG_ASSERT(p3DObj, "Insert3DObj with NULL-pointer!");
479 : 0 : SdrPage* pPg = pPage;
480 : 0 : maSubList.InsertObject(p3DObj);
481 : 0 : pPage = pPg;
482 : 0 : InvalidateBoundVolume();
483 : 0 : NewObjectInserted(p3DObj);
484 : 0 : StructureChanged();
485 : 0 : }
486 : :
487 : 0 : void E3dObject::Remove3DObj(E3dObject* p3DObj)
488 : : {
489 : : DBG_ASSERT(p3DObj, "Remove3DObj with NULL-pointer!");
490 : :
491 [ # # ]: 0 : if(p3DObj->GetParentObj() == this)
492 : : {
493 : 0 : SdrPage* pPg = pPage;
494 : 0 : maSubList.RemoveObject(p3DObj->GetOrdNum());
495 : 0 : pPage = pPg;
496 : :
497 : 0 : InvalidateBoundVolume();
498 : 0 : StructureChanged();
499 : : }
500 : 0 : }
501 : :
502 : 5834305 : E3dObject* E3dObject::GetParentObj() const
503 : : {
504 : 5834305 : E3dObject* pRetval = NULL;
505 : :
506 [ + + + - : 17494025 : if(GetObjList()
+ + ][ + + ]
507 : 5829860 : && GetObjList()->GetOwnerObj()
508 : 5829860 : && GetObjList()->GetOwnerObj()->ISA(E3dObject))
509 : 5115314 : pRetval = ((E3dObject*)GetObjList()->GetOwnerObj());
510 : 5834305 : return pRetval;
511 : : }
512 : :
513 : : // Determine the top-level scene object
514 : :
515 : 29793 : E3dScene* E3dObject::GetScene() const
516 : : {
517 [ + - ]: 29793 : if(GetParentObj())
518 : 29793 : return GetParentObj()->GetScene();
519 : 29793 : return NULL;
520 : : }
521 : :
522 : : // Calculate enclosed volume, including all child objects
523 : :
524 : 0 : basegfx::B3DRange E3dObject::RecalcBoundVolume() const
525 : : {
526 : 0 : basegfx::B3DRange aRetval;
527 : 0 : const sal_uInt32 nObjCnt(maSubList.GetObjCount());
528 : :
529 [ # # ]: 0 : if(nObjCnt)
530 : : {
531 [ # # ]: 0 : for(sal_uInt32 a(0); a < nObjCnt; a++)
532 : : {
533 [ # # ]: 0 : const E3dObject* p3DObject = dynamic_cast< const E3dObject* >(maSubList.GetObj(a));
534 : :
535 [ # # ]: 0 : if(p3DObject)
536 : : {
537 [ # # ]: 0 : basegfx::B3DRange aLocalRange(p3DObject->GetBoundVolume());
538 [ # # ][ # # ]: 0 : aLocalRange.transform(p3DObject->GetTransform());
539 [ # # ]: 0 : aRetval.expand(aLocalRange);
540 : : }
541 : : }
542 : : }
543 : : else
544 : : {
545 : : // single 3D object
546 [ # # ]: 0 : const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
547 : :
548 [ # # ]: 0 : if(pVCOfE3D)
549 : : {
550 : : // BoundVolume is without 3D object transformation, use correct sequence
551 [ # # ]: 0 : const drawinglayer::primitive3d::Primitive3DSequence xLocalSequence(pVCOfE3D->getVIP3DSWithoutObjectTransform());
552 : :
553 [ # # ]: 0 : if(xLocalSequence.hasElements())
554 : : {
555 [ # # ]: 0 : const uno::Sequence< beans::PropertyValue > aEmptyParameters;
556 [ # # ]: 0 : const drawinglayer::geometry::ViewInformation3D aLocalViewInformation3D(aEmptyParameters);
557 : :
558 : : aRetval = drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(
559 [ # # ][ # # ]: 0 : xLocalSequence, aLocalViewInformation3D);
[ # # ]
560 [ # # ]: 0 : }
561 : : }
562 : : }
563 : :
564 : 0 : return aRetval;
565 : : }
566 : :
567 : : // Get enclosed volume and possibly recalculate it
568 : :
569 : 0 : const basegfx::B3DRange& E3dObject::GetBoundVolume() const
570 : : {
571 [ # # ]: 0 : if(maLocalBoundVol.isEmpty())
572 : : {
573 : 0 : const_cast< E3dObject* >(this)->maLocalBoundVol = RecalcBoundVolume();
574 : : }
575 : :
576 : 0 : return maLocalBoundVol;
577 : : }
578 : :
579 : 32286 : void E3dObject::InvalidateBoundVolume()
580 : : {
581 : 32286 : maLocalBoundVol.reset();
582 : 32286 : }
583 : :
584 : : // Pass on the changes of the BoundVolumes to all child objects
585 : :
586 : 0 : void E3dObject::SetBoundVolInvalid()
587 : : {
588 : 0 : InvalidateBoundVolume();
589 : :
590 [ # # ]: 0 : for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
591 : : {
592 [ # # ]: 0 : E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
593 : :
594 [ # # ]: 0 : if(pCandidate)
595 : : {
596 : 0 : pCandidate->SetBoundVolInvalid();
597 : : }
598 : : }
599 : 0 : }
600 : :
601 : : // Pass on the changes in transformation to all child objects
602 : :
603 : 1999 : void E3dObject::SetTransformChanged()
604 : : {
605 : 1999 : InvalidateBoundVolume();
606 : 1999 : mbTfHasChanged = true;
607 : :
608 [ + + ]: 2422 : for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
609 : : {
610 [ - + ]: 423 : E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
611 : :
612 [ + - ]: 423 : if(pCandidate)
613 : : {
614 : 423 : pCandidate->SetTransformChanged();
615 : : }
616 : : }
617 : 1999 : }
618 : :
619 : : // Define the hierarchical transformation over all Parents, store in
620 : : // maFullTransform and return them
621 : :
622 : 0 : const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const
623 : : {
624 [ # # ]: 0 : if(mbTfHasChanged)
625 : : {
626 [ # # ]: 0 : basegfx::B3DHomMatrix aNewFullTransformation(maTransformation);
627 : :
628 [ # # ][ # # ]: 0 : if ( GetParentObj() )
629 : : {
630 [ # # ][ # # ]: 0 : aNewFullTransformation = GetParentObj()->GetFullTransform() * aNewFullTransformation;
[ # # ][ # # ]
[ # # ]
631 : : }
632 : :
633 [ # # ]: 0 : const_cast< E3dObject* >(this)->maFullTransform = aNewFullTransformation;
634 [ # # ]: 0 : const_cast< E3dObject* >(this)->mbTfHasChanged = false;
635 : : }
636 : :
637 : 0 : return maFullTransform;
638 : : }
639 : :
640 : 29491 : const basegfx::B3DHomMatrix& E3dObject::GetTransform() const
641 : : {
642 : 29491 : return maTransformation;
643 : : }
644 : :
645 : 1576 : void E3dObject::NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix)
646 : : {
647 [ + - ]: 1576 : if(maTransformation != rMatrix)
648 : : {
649 : 1576 : maTransformation = rMatrix;
650 : 1576 : SetTransformChanged();
651 : 1576 : StructureChanged();
652 : : }
653 : 1576 : }
654 : :
655 : : // Set transformation matrix with repaint broadcast
656 : :
657 : 1576 : void E3dObject::SetTransform(const basegfx::B3DHomMatrix& rMatrix)
658 : : {
659 [ + - ]: 1576 : if(rMatrix != maTransformation)
660 : : {
661 : 1576 : NbcSetTransform(rMatrix);
662 : 1576 : SetChanged();
663 : 1576 : BroadcastObjectChange();
664 [ # # ][ - + ]: 1576 : if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
665 : : }
666 : 1576 : }
667 : :
668 : 0 : basegfx::B3DPolyPolygon E3dObject::CreateWireframe() const
669 : : {
670 [ # # ]: 0 : const basegfx::B3DRange aBoundVolume(GetBoundVolume());
671 [ # # ]: 0 : return basegfx::tools::createCubePolyPolygonFromB3DRange(aBoundVolume);
672 : : }
673 : :
674 : : // Get the name of the object (singular)
675 : :
676 : 0 : void E3dObject::TakeObjNameSingul(XubString& rName) const
677 : : {
678 [ # # ][ # # ]: 0 : rName=ImpGetResStr(STR_ObjNameSingulObj3d);
[ # # ]
679 : :
680 [ # # ][ # # ]: 0 : String aName( GetName() );
681 [ # # ]: 0 : if(aName.Len())
682 : : {
683 [ # # ]: 0 : rName += sal_Unicode(' ');
684 [ # # ]: 0 : rName += sal_Unicode('\'');
685 [ # # ]: 0 : rName += aName;
686 [ # # ]: 0 : rName += sal_Unicode('\'');
687 [ # # ]: 0 : }
688 : 0 : }
689 : :
690 : : // Get the name of the object (plural)
691 : :
692 : 0 : void E3dObject::TakeObjNamePlural(XubString& rName) const
693 : : {
694 [ # # ]: 0 : rName=ImpGetResStr(STR_ObjNamePluralObj3d);
695 : 0 : }
696 : :
697 : 0 : E3dObject* E3dObject::Clone() const
698 : : {
699 : 0 : return CloneHelper< E3dObject >();
700 : : }
701 : :
702 : 0 : E3dObject& E3dObject::operator=(const E3dObject& rObj)
703 : : {
704 [ # # ]: 0 : if( this == &rObj )
705 : 0 : return *this;
706 : 0 : SdrObject::operator=(rObj);
707 : :
708 : 0 : const E3dObject& r3DObj = (const E3dObject&) rObj;
709 [ # # ]: 0 : if (r3DObj.GetSubList())
710 : : {
711 : 0 : maSubList.CopyObjects(*r3DObj.GetSubList());
712 : : }
713 : :
714 : : // BoundVol can be copied since also the children are copied
715 : 0 : maLocalBoundVol = r3DObj.maLocalBoundVol;
716 : 0 : maTransformation = r3DObj.maTransformation;
717 : :
718 : : // Because the parent may have changed, definitely redefine the total
719 : : // transformation next time
720 : 0 : SetTransformChanged();
721 : :
722 : : // Copy selection status
723 : 0 : mbIsSelected = r3DObj.mbIsSelected;
724 : 0 : return *this;
725 : : }
726 : :
727 : 0 : SdrObjGeoData *E3dObject::NewGeoData() const
728 : : {
729 [ # # ]: 0 : return new E3DObjGeoData;
730 : : }
731 : :
732 : 0 : void E3dObject::SaveGeoData(SdrObjGeoData& rGeo) const
733 : : {
734 : 0 : SdrAttrObj::SaveGeoData (rGeo);
735 : :
736 : 0 : ((E3DObjGeoData &) rGeo).maLocalBoundVol = maLocalBoundVol;
737 : 0 : ((E3DObjGeoData &) rGeo).maTransformation = maTransformation;
738 : 0 : }
739 : :
740 : 0 : void E3dObject::RestGeoData(const SdrObjGeoData& rGeo)
741 : : {
742 : 0 : maLocalBoundVol = ((E3DObjGeoData &) rGeo).maLocalBoundVol;
743 [ # # ]: 0 : E3DModifySceneSnapRectUpdater aUpdater(this);
744 [ # # ]: 0 : NbcSetTransform(((E3DObjGeoData &) rGeo).maTransformation);
745 [ # # ][ # # ]: 0 : SdrAttrObj::RestGeoData (rGeo);
746 : 0 : }
747 : :
748 : : // 2D-rotation of a 3D-body, normally this is done by the scene itself.
749 : : // This is however a correct implementation, because everything that has
750 : : // happened is a rotation around the axis perpendicular to the screen and that
751 : : // is regardless of how the scene has been rotated up until now.
752 : :
753 : 0 : void E3dObject::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
754 : : {
755 : : // So currently the glue points are defined relative to the scene aOutRect.
756 : : // Before turning the glue points are defined relative to the page. They
757 : : // take no part in the rotation of the scene. To ensure this, there is the
758 : : // SetGlueReallyAbsolute(sal_True);
759 : :
760 : 0 : double fWinkelInRad = nWink/100 * F_PI180;
761 : :
762 [ # # ]: 0 : basegfx::B3DHomMatrix aRotateZ;
763 [ # # ]: 0 : aRotateZ.rotate(0.0, 0.0, fWinkelInRad);
764 [ # # ][ # # ]: 0 : NbcSetTransform(aRotateZ * GetTransform());
[ # # ][ # # ]
765 : :
766 [ # # ]: 0 : SetRectsDirty(); // This forces a recalculation of all BoundRects
767 [ # # ]: 0 : NbcRotateGluePoints(rRef,nWink,sn,cs); // Rotate the glue points (who still
768 : : // have coordinates relative to the
769 : : // original page)
770 [ # # ][ # # ]: 0 : SetGlueReallyAbsolute(sal_False); // from now they are again relative to BoundRect (that is defined as aOutRect)
771 : 0 : }
772 : :
773 : : /*************************************************************************/
774 : :
775 : : //////////////////////////////////////////////////////////////////////////////
776 : :
777 : 438 : sdr::properties::BaseProperties* E3dCompoundObject::CreateObjectSpecificProperties()
778 : : {
779 [ + - ]: 438 : return new sdr::properties::E3dCompoundProperties(*this);
780 : : }
781 : :
782 : : //////////////////////////////////////////////////////////////////////////////
783 : :
784 [ + + ][ + + ]: 215851 : TYPEINIT1(E3dCompoundObject, E3dObject);
785 : :
786 : 1939 : E3dCompoundObject::E3dCompoundObject()
787 : : : E3dObject(),
788 : : aMaterialAmbientColor(),
789 : : bCreateNormals(false),
790 : 1939 : bCreateTexture(false)
791 : : {
792 : : // Set defaults
793 [ + - ]: 1939 : E3dDefaultAttributes aDefault;
794 [ + - ][ + - ]: 1939 : SetDefaultAttributes(aDefault);
795 : 1939 : }
796 : :
797 : 0 : E3dCompoundObject::E3dCompoundObject(E3dDefaultAttributes& rDefault)
798 : : : E3dObject(),
799 : : aMaterialAmbientColor(),
800 : : bCreateNormals(false),
801 : 0 : bCreateTexture(false)
802 : : {
803 : : // Set defaults
804 [ # # ]: 0 : SetDefaultAttributes(rDefault);
805 : 0 : }
806 : :
807 : 1939 : void E3dCompoundObject::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
808 : : {
809 : : // Set defaults
810 : 1939 : aMaterialAmbientColor = rDefault.GetDefaultAmbientColor();
811 : :
812 : 1939 : bCreateNormals = rDefault.GetDefaultCreateNormals();
813 : 1939 : bCreateTexture = rDefault.GetDefaultCreateTexture();
814 : 1939 : }
815 : :
816 : 1939 : E3dCompoundObject::~E3dCompoundObject ()
817 : : {
818 [ - + ]: 1939 : }
819 : :
820 : 0 : basegfx::B2DPolyPolygon E3dCompoundObject::TakeXorPoly() const
821 : : {
822 [ # # ]: 0 : basegfx::B2DPolyPolygon aRetval;
823 [ # # ]: 0 : const uno::Sequence< beans::PropertyValue > aEmptyParameters;
824 [ # # ]: 0 : drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
825 [ # # ]: 0 : E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
826 : :
827 [ # # ]: 0 : if(pRootScene)
828 : : {
829 [ # # ]: 0 : const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
830 [ # # ]: 0 : const basegfx::B3DPolyPolygon aCubePolyPolygon(CreateWireframe());
831 : : aRetval = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCubePolyPolygon,
832 [ # # ][ # # ]: 0 : aViewInfo3D.getObjectToView() * GetTransform());
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
833 [ # # ][ # # ]: 0 : aRetval.transform(rVCScene.getObjectTransformation());
[ # # ]
834 : : }
835 : :
836 [ # # ][ # # ]: 0 : return aRetval;
837 : : }
838 : :
839 : 0 : sal_uInt32 E3dCompoundObject::GetHdlCount() const
840 : : {
841 : : // 8 corners + 1 E3dVolumeMarker (= Wireframe representation)
842 : 0 : return 9L;
843 : : }
844 : :
845 : 0 : void E3dCompoundObject::AddToHdlList(SdrHdlList& rHdlList) const
846 : : {
847 [ # # ]: 0 : const uno::Sequence< beans::PropertyValue > aEmptyParameters;
848 [ # # ]: 0 : drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
849 [ # # ]: 0 : E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
850 : :
851 [ # # ]: 0 : if(pRootScene)
852 : : {
853 [ # # ]: 0 : const basegfx::B3DRange aBoundVolume(GetBoundVolume());
854 : :
855 [ # # ][ # # ]: 0 : if(!aBoundVolume.isEmpty())
856 : : {
857 [ # # ]: 0 : const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
858 : :
859 [ # # ]: 0 : for(sal_uInt32 a(0); a < 8; a++)
860 : : {
861 : 0 : basegfx::B3DPoint aPos3D;
862 : :
863 [ # # # # : 0 : switch(a)
# # # #
# ]
864 : : {
865 [ # # ][ # # ]: 0 : case 0 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
[ # # ]
866 [ # # ][ # # ]: 0 : case 1 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
[ # # ]
867 [ # # ][ # # ]: 0 : case 2 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
[ # # ]
868 [ # # ][ # # ]: 0 : case 3 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
[ # # ]
869 [ # # ][ # # ]: 0 : case 4 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
[ # # ]
870 [ # # ][ # # ]: 0 : case 5 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
[ # # ]
871 [ # # ][ # # ]: 0 : case 6 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
[ # # ]
872 [ # # ][ # # ]: 0 : case 7 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
[ # # ]
873 : : }
874 : :
875 : : // to 3d view coor
876 [ # # ][ # # ]: 0 : aPos3D *= aViewInfo3D.getObjectToView() * GetTransform();
[ # # ][ # # ]
[ # # ]
877 : :
878 : : // create 2d relative scene
879 : 0 : basegfx::B2DPoint aPos2D(aPos3D.getX(), aPos3D.getY());
880 : :
881 : : // to 2d world coor
882 [ # # ][ # # ]: 0 : aPos2D *= rVCScene.getObjectTransformation();
883 : :
884 [ # # ][ # # ]: 0 : rHdlList.AddHdl(new SdrHdl(Point(basegfx::fround(aPos2D.getX()), basegfx::fround(aPos2D.getY())), HDL_BWGT));
[ # # ]
885 : 0 : }
886 : : }
887 : : }
888 : :
889 [ # # ]: 0 : const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly());
890 : :
891 [ # # ][ # # ]: 0 : if(aPolyPolygon.count())
892 : : {
893 [ # # ][ # # ]: 0 : E3dVolumeMarker* pVolMarker = new E3dVolumeMarker(aPolyPolygon);
894 [ # # ]: 0 : rHdlList.AddHdl(pVolMarker);
895 [ # # ][ # # ]: 0 : }
[ # # ]
896 : 0 : }
897 : :
898 : 0 : sal_uInt16 E3dCompoundObject::GetObjIdentifier() const
899 : : {
900 : 0 : return E3D_COMPOUNDOBJ_ID;
901 : : }
902 : :
903 : 3404 : void E3dCompoundObject::RecalcSnapRect()
904 : : {
905 [ + - ]: 3404 : const uno::Sequence< beans::PropertyValue > aEmptyParameters;
906 [ + - ]: 3404 : drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
907 [ + - ]: 3404 : E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
908 [ + - ]: 3404 : maSnapRect = Rectangle();
909 : :
910 [ + - ]: 3404 : if(pRootScene)
911 : : {
912 : : // get VC of 3D candidate
913 [ + - ][ - + ]: 3404 : const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
914 : :
915 [ + - ]: 3404 : if(pVCOfE3D)
916 : : {
917 : : // get 3D primitive sequence
918 [ + - ]: 3404 : const drawinglayer::primitive3d::Primitive3DSequence xLocalSequence(pVCOfE3D->getViewIndependentPrimitive3DSequence());
919 : :
920 [ + - ]: 3404 : if(xLocalSequence.hasElements())
921 : : {
922 : : // get BoundVolume
923 : : basegfx::B3DRange aBoundVolume(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(
924 [ + - ]: 3404 : xLocalSequence, aViewInfo3D));
925 : :
926 : : // transform bound volume to relative scene coordinates
927 [ + - ][ + - ]: 3404 : aBoundVolume.transform(aViewInfo3D.getObjectToView());
928 : :
929 : : // build 2d relative scene range
930 : : basegfx::B2DRange aSnapRange(
931 : : aBoundVolume.getMinX(), aBoundVolume.getMinY(),
932 [ + - ][ + - ]: 3404 : aBoundVolume.getMaxX(), aBoundVolume.getMaxY());
[ + - ][ + - ]
[ + - ]
933 : :
934 : : // transform to 2D world coordiantes
935 [ + - ]: 3404 : const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
936 [ + - ][ + - ]: 3404 : aSnapRange.transform(rVCScene.getObjectTransformation());
937 : :
938 : : // snap to integer
939 : : maSnapRect = Rectangle(
940 [ + - ][ + - ]: 3404 : sal_Int32(floor(aSnapRange.getMinX())), sal_Int32(floor(aSnapRange.getMinY())),
941 [ + - ][ + - ]: 6808 : sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY())));
[ + - ]
942 [ + - ]: 3404 : }
943 : : }
944 [ + - ][ + - ]: 3404 : }
945 : 3404 : }
946 : :
947 : 0 : E3dCompoundObject* E3dCompoundObject::Clone() const
948 : : {
949 : 0 : return CloneHelper< E3dCompoundObject >();
950 : : }
951 : :
952 : : // convert given basegfx::B3DPolyPolygon to screen coor
953 : :
954 : 0 : basegfx::B2DPolyPolygon E3dCompoundObject::TransformToScreenCoor(const basegfx::B3DPolyPolygon& rCandidate)
955 : : {
956 [ # # ]: 0 : const uno::Sequence< beans::PropertyValue > aEmptyParameters;
957 [ # # ]: 0 : drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
958 [ # # ]: 0 : E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
959 [ # # ]: 0 : basegfx::B2DPolyPolygon aRetval;
960 : :
961 [ # # ]: 0 : if(pRootScene)
962 : : {
963 : : aRetval = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rCandidate,
964 [ # # ][ # # ]: 0 : aViewInfo3D.getObjectToView() * GetTransform());
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
965 [ # # ]: 0 : const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
966 [ # # ][ # # ]: 0 : aRetval.transform(rVCScene.getObjectTransformation());
967 : : }
968 : :
969 [ # # ][ # # ]: 0 : return aRetval;
970 : : }
971 : :
972 : 0 : sal_Bool E3dCompoundObject::IsAOrdNumRemapCandidate(E3dScene*& prScene) const
973 : : {
974 [ # # # # : 0 : if(GetObjList()
# # ][ # # ]
975 : 0 : && GetObjList()->GetOwnerObj()
976 : 0 : && GetObjList()->GetOwnerObj()->ISA(E3dScene))
977 : : {
978 : 0 : prScene = (E3dScene*)GetObjList()->GetOwnerObj();
979 : 0 : return sal_True;
980 : : }
981 : :
982 : 0 : return sal_False;
983 : : }
984 : :
985 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|