1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10*f6e50924SAndrew Rist * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f6e50924SAndrew Rist * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19*f6e50924SAndrew Rist * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 28cdf0e10cSrcweir #include <svx/svdogrp.hxx> 29cdf0e10cSrcweir #include <svx/svdopath.hxx> 30cdf0e10cSrcweir #include <tools/shl.hxx> 31cdf0e10cSrcweir #include "svx/svditer.hxx" 32cdf0e10cSrcweir #include <svx/svdpool.hxx> 33cdf0e10cSrcweir #include <svx/svdorect.hxx> 34cdf0e10cSrcweir #include <svx/svdmodel.hxx> 35cdf0e10cSrcweir #include <svx/svdpagv.hxx> 36cdf0e10cSrcweir #include <svx/svxids.hrc> 37cdf0e10cSrcweir #include <editeng/colritem.hxx> 38cdf0e10cSrcweir #include <svx/xtable.hxx> 39cdf0e10cSrcweir #include <svx/svdview.hxx> 40cdf0e10cSrcweir #include <svx/dialogs.hrc> 41cdf0e10cSrcweir #include <svx/dialmgr.hxx> 42cdf0e10cSrcweir #include "svx/globl3d.hxx" 43cdf0e10cSrcweir #include <svx/obj3d.hxx> 44cdf0e10cSrcweir #include <svx/lathe3d.hxx> 45cdf0e10cSrcweir #include <svx/sphere3d.hxx> 46cdf0e10cSrcweir #include <svx/extrud3d.hxx> 47cdf0e10cSrcweir #include <svx/cube3d.hxx> 48cdf0e10cSrcweir #include <svx/polysc3d.hxx> 49cdf0e10cSrcweir #include "dragmt3d.hxx" 50cdf0e10cSrcweir #include <svx/view3d.hxx> 51cdf0e10cSrcweir #include <svx/svdundo.hxx> 52cdf0e10cSrcweir #include <svx/xflclit.hxx> 53cdf0e10cSrcweir #include <svx/xlnclit.hxx> 54cdf0e10cSrcweir #include <svx/svdograf.hxx> 55cdf0e10cSrcweir #include <svx/xbtmpit.hxx> 56cdf0e10cSrcweir #include <svx/xflbmtit.hxx> 57cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx> 58cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx> 59cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx> 60cdf0e10cSrcweir #include <svx/xlnwtit.hxx> 61cdf0e10cSrcweir #include <svx/sdr/overlay/overlaypolypolygon.hxx> 62cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx> 63cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx> 64cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofe3dscene.hxx> 65cdf0e10cSrcweir #include <drawinglayer/geometry/viewinformation3d.hxx> 66cdf0e10cSrcweir #include <svx/sdrpagewindow.hxx> 67cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx> 68cdf0e10cSrcweir #include <svx/sdr/contact/objectcontact.hxx> 69cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontact.hxx> 70cdf0e10cSrcweir #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> 71cdf0e10cSrcweir #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> 72cdf0e10cSrcweir #include <drawinglayer/primitive2d/transformprimitive2d.hxx> 73cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx> 74cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygoncutter.hxx> 75cdf0e10cSrcweir 76cdf0e10cSrcweir #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() 77cdf0e10cSrcweir 78cdf0e10cSrcweir TYPEINIT1(E3dView, SdrView); 79cdf0e10cSrcweir 80cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 81cdf0e10cSrcweir // Migrate Marking 82cdf0e10cSrcweir 83cdf0e10cSrcweir class Impl3DMirrorConstructOverlay 84cdf0e10cSrcweir { 85cdf0e10cSrcweir // The OverlayObjects 86cdf0e10cSrcweir ::sdr::overlay::OverlayObjectList maObjects; 87cdf0e10cSrcweir 88cdf0e10cSrcweir // the view 89cdf0e10cSrcweir const E3dView& mrView; 90cdf0e10cSrcweir 91cdf0e10cSrcweir // the object count 92cdf0e10cSrcweir sal_uInt32 mnCount; 93cdf0e10cSrcweir 94cdf0e10cSrcweir // the unmirrored polygons 95cdf0e10cSrcweir basegfx::B2DPolyPolygon* mpPolygons; 96cdf0e10cSrcweir 97cdf0e10cSrcweir // the overlay geometry from selected objects 98cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence maFullOverlay; 99cdf0e10cSrcweir 100cdf0e10cSrcweir public: 101cdf0e10cSrcweir Impl3DMirrorConstructOverlay(const E3dView& rView); 102cdf0e10cSrcweir ~Impl3DMirrorConstructOverlay(); 103cdf0e10cSrcweir 104cdf0e10cSrcweir void SetMirrorAxis(Point aMirrorAxisA, Point aMirrorAxisB); 105cdf0e10cSrcweir }; 106cdf0e10cSrcweir 107cdf0e10cSrcweir Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView) 108cdf0e10cSrcweir : maObjects(), 109cdf0e10cSrcweir mrView(rView), 110cdf0e10cSrcweir mnCount(rView.GetMarkedObjectCount()), 111cdf0e10cSrcweir mpPolygons(0), 112cdf0e10cSrcweir maFullOverlay() 113cdf0e10cSrcweir { 114cdf0e10cSrcweir if(mnCount) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir if(mrView.IsSolidDragging()) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir SdrPageView* pPV = rView.GetSdrPageView(); 119cdf0e10cSrcweir 120cdf0e10cSrcweir if(pPV && pPV->PageWindowCount()) 121cdf0e10cSrcweir { 122cdf0e10cSrcweir sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact(); 123cdf0e10cSrcweir sdr::contact::DisplayInfo aDisplayInfo; 124cdf0e10cSrcweir 125cdf0e10cSrcweir // Do not use the last ViewPort set at the OC at the last ProcessDisplay() 126cdf0e10cSrcweir rOC.resetViewPort(); 127cdf0e10cSrcweir 128cdf0e10cSrcweir for(sal_uInt32 a(0);a < mnCount;a++) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir SdrObject* pObject = mrView.GetMarkedObjectByIndex(a); 131cdf0e10cSrcweir 132cdf0e10cSrcweir if(pObject) 133cdf0e10cSrcweir { 134cdf0e10cSrcweir sdr::contact::ViewContact& rVC = pObject->GetViewContact(); 135cdf0e10cSrcweir sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(rOC); 136cdf0e10cSrcweir 137cdf0e10cSrcweir const drawinglayer::primitive2d::Primitive2DSequence aNewSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo)); 138cdf0e10cSrcweir drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(maFullOverlay, aNewSequence); 139cdf0e10cSrcweir } 140cdf0e10cSrcweir } 141cdf0e10cSrcweir } 142cdf0e10cSrcweir } 143cdf0e10cSrcweir else 144cdf0e10cSrcweir { 145cdf0e10cSrcweir mpPolygons = new basegfx::B2DPolyPolygon[mnCount]; 146cdf0e10cSrcweir 147cdf0e10cSrcweir for(sal_uInt32 a(0); a < mnCount; a++) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir SdrObject* pObject = mrView.GetMarkedObjectByIndex(a); 150cdf0e10cSrcweir mpPolygons[mnCount - (a + 1)] = pObject->TakeXorPoly(); 151cdf0e10cSrcweir } 152cdf0e10cSrcweir } 153cdf0e10cSrcweir } 154cdf0e10cSrcweir } 155cdf0e10cSrcweir 156cdf0e10cSrcweir Impl3DMirrorConstructOverlay::~Impl3DMirrorConstructOverlay() 157cdf0e10cSrcweir { 158cdf0e10cSrcweir // The OverlayObjects are cleared using the destructor of OverlayObjectList. 159cdf0e10cSrcweir // That destructor calls clear() at the list which removes all objects from the 160cdf0e10cSrcweir // OverlayManager and deletes them. 161cdf0e10cSrcweir if(!mrView.IsSolidDragging()) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir delete[] mpPolygons; 164cdf0e10cSrcweir } 165cdf0e10cSrcweir } 166cdf0e10cSrcweir 167cdf0e10cSrcweir void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirrorAxisB) 168cdf0e10cSrcweir { 169cdf0e10cSrcweir // get rid of old overlay objects 170cdf0e10cSrcweir maObjects.clear(); 171cdf0e10cSrcweir 172cdf0e10cSrcweir // create new ones 173cdf0e10cSrcweir for(sal_uInt32 a(0); a < mrView.PaintWindowCount(); a++) 174cdf0e10cSrcweir { 175cdf0e10cSrcweir SdrPaintWindow* pCandidate = mrView.GetPaintWindow(a); 176cdf0e10cSrcweir ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); 177cdf0e10cSrcweir 178cdf0e10cSrcweir if(pTargetOverlay) 179cdf0e10cSrcweir { 180cdf0e10cSrcweir // buld transfoprmation: translate and rotate so that given edge is 181cdf0e10cSrcweir // on x axis, them mirror in y and translate back 182cdf0e10cSrcweir const basegfx::B2DVector aEdge(aMirrorAxisB.X() - aMirrorAxisA.X(), aMirrorAxisB.Y() - aMirrorAxisA.Y()); 183cdf0e10cSrcweir basegfx::B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix( 184cdf0e10cSrcweir -aMirrorAxisA.X(), -aMirrorAxisA.Y())); 185cdf0e10cSrcweir aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX())); 186cdf0e10cSrcweir aMatrixTransform.scale(1.0, -1.0); 187cdf0e10cSrcweir aMatrixTransform.rotate(atan2(aEdge.getY(), aEdge.getX())); 188cdf0e10cSrcweir aMatrixTransform.translate(aMirrorAxisA.X(), aMirrorAxisA.Y()); 189cdf0e10cSrcweir 190cdf0e10cSrcweir if(mrView.IsSolidDragging()) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir if(maFullOverlay.hasElements()) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence aContent(maFullOverlay); 195cdf0e10cSrcweir 196cdf0e10cSrcweir if(!aMatrixTransform.isIdentity()) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir // embed in transformation group 199cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DReference aTransformPrimitive2D(new drawinglayer::primitive2d::TransformPrimitive2D(aMatrixTransform, aContent)); 200cdf0e10cSrcweir aContent = drawinglayer::primitive2d::Primitive2DSequence(&aTransformPrimitive2D, 1); 201cdf0e10cSrcweir } 202cdf0e10cSrcweir 203cdf0e10cSrcweir // if we have full overlay from selected objects, embed with 50% transparence, the 204cdf0e10cSrcweir // transformation is added to the OverlayPrimitive2DSequenceObject 205cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aContent, 0.5)); 206cdf0e10cSrcweir aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1); 207cdf0e10cSrcweir 208cdf0e10cSrcweir sdr::overlay::OverlayPrimitive2DSequenceObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aContent); 209cdf0e10cSrcweir 210cdf0e10cSrcweir pTargetOverlay->add(*pNew); 211cdf0e10cSrcweir maObjects.append(*pNew); 212cdf0e10cSrcweir } 213cdf0e10cSrcweir } 214cdf0e10cSrcweir else 215cdf0e10cSrcweir { 216cdf0e10cSrcweir for(sal_uInt32 b(0); b < mnCount; b++) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir // apply to polygon 219cdf0e10cSrcweir basegfx::B2DPolyPolygon aPolyPolygon(mpPolygons[b]); 220cdf0e10cSrcweir aPolyPolygon.transform(aMatrixTransform); 221cdf0e10cSrcweir 222cdf0e10cSrcweir ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aPolyPolygon); 223cdf0e10cSrcweir pTargetOverlay->add(*pNew); 224cdf0e10cSrcweir maObjects.append(*pNew); 225cdf0e10cSrcweir } 226cdf0e10cSrcweir } 227cdf0e10cSrcweir } 228cdf0e10cSrcweir } 229cdf0e10cSrcweir } 230cdf0e10cSrcweir 231cdf0e10cSrcweir /************************************************************************* 232cdf0e10cSrcweir |* 233cdf0e10cSrcweir |* Konstruktor 1 234cdf0e10cSrcweir |* 235cdf0e10cSrcweir \************************************************************************/ 236cdf0e10cSrcweir 237cdf0e10cSrcweir E3dView::E3dView(SdrModel* pModel, OutputDevice* pOut) : 238cdf0e10cSrcweir SdrView(pModel, pOut) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir InitView (); 241cdf0e10cSrcweir } 242cdf0e10cSrcweir 243cdf0e10cSrcweir /************************************************************************* 244cdf0e10cSrcweir |* 245cdf0e10cSrcweir |* DrawMarkedObj ueberladen, da eventuell nur einzelne 3D-Objekte 246cdf0e10cSrcweir |* gezeichnet werden sollen 247cdf0e10cSrcweir |* 248cdf0e10cSrcweir \************************************************************************/ 249cdf0e10cSrcweir 250cdf0e10cSrcweir void E3dView::DrawMarkedObj(OutputDevice& rOut) const 251cdf0e10cSrcweir { 252cdf0e10cSrcweir // Existieren 3D-Objekte, deren Szenen nicht selektiert sind? 253cdf0e10cSrcweir sal_Bool bSpecialHandling = sal_False; 254cdf0e10cSrcweir E3dScene *pScene = NULL; 255cdf0e10cSrcweir 256cdf0e10cSrcweir long nCnt = GetMarkedObjectCount(); 257cdf0e10cSrcweir for(long nObjs = 0;nObjs < nCnt;nObjs++) 258cdf0e10cSrcweir { 259cdf0e10cSrcweir SdrObject *pObj = GetMarkedObjectByIndex(nObjs); 260cdf0e10cSrcweir if(pObj && pObj->ISA(E3dCompoundObject)) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir // zugehoerige Szene 263cdf0e10cSrcweir pScene = ((E3dCompoundObject*)pObj)->GetScene(); 264cdf0e10cSrcweir if(pScene && !IsObjMarked(pScene)) 265cdf0e10cSrcweir bSpecialHandling = sal_True; 266cdf0e10cSrcweir } 267cdf0e10cSrcweir // Alle SelectionFlags zuruecksetzen 268cdf0e10cSrcweir if(pObj && pObj->ISA(E3dObject)) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir pScene = ((E3dObject*)pObj)->GetScene(); 271cdf0e10cSrcweir if(pScene) 272cdf0e10cSrcweir pScene->SetSelected(sal_False); 273cdf0e10cSrcweir } 274cdf0e10cSrcweir } 275cdf0e10cSrcweir 276cdf0e10cSrcweir if(bSpecialHandling) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir // SelectionFlag bei allen zu 3D Objekten gehoerigen 279cdf0e10cSrcweir // Szenen und deren Objekten auf nicht selektiert setzen 280cdf0e10cSrcweir long nObjs; 281cdf0e10cSrcweir for(nObjs = 0;nObjs < nCnt;nObjs++) 282cdf0e10cSrcweir { 283cdf0e10cSrcweir SdrObject *pObj = GetMarkedObjectByIndex(nObjs); 284cdf0e10cSrcweir if(pObj && pObj->ISA(E3dCompoundObject)) 285cdf0e10cSrcweir { 286cdf0e10cSrcweir // zugehoerige Szene 287cdf0e10cSrcweir pScene = ((E3dCompoundObject*)pObj)->GetScene(); 288cdf0e10cSrcweir if(pScene) 289cdf0e10cSrcweir pScene->SetSelected(sal_False); 290cdf0e10cSrcweir } 291cdf0e10cSrcweir } 292cdf0e10cSrcweir 293cdf0e10cSrcweir // bei allen direkt selektierten Objekten auf selektiert setzen 294cdf0e10cSrcweir SdrMark* pM = NULL; 295cdf0e10cSrcweir 296cdf0e10cSrcweir for(nObjs = 0;nObjs < nCnt;nObjs++) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir SdrObject *pObj = GetMarkedObjectByIndex(nObjs); 299cdf0e10cSrcweir if(pObj && pObj->ISA(E3dObject)) 300cdf0e10cSrcweir { 301cdf0e10cSrcweir // Objekt markieren 302cdf0e10cSrcweir E3dObject* p3DObj = (E3dObject*)pObj; 303cdf0e10cSrcweir p3DObj->SetSelected(sal_True); 304cdf0e10cSrcweir pScene = p3DObj->GetScene(); 305cdf0e10cSrcweir pM = GetSdrMarkByIndex(nObjs); 306cdf0e10cSrcweir } 307cdf0e10cSrcweir } 308cdf0e10cSrcweir 309cdf0e10cSrcweir if(pScene) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir // code from parent 312cdf0e10cSrcweir SortMarkedObjects(); 313cdf0e10cSrcweir 314cdf0e10cSrcweir pScene->SetDrawOnlySelected(sal_True); 315cdf0e10cSrcweir pScene->SingleObjectPainter(rOut); // #110094#-17 316cdf0e10cSrcweir pScene->SetDrawOnlySelected(sal_False); 317cdf0e10cSrcweir } 318cdf0e10cSrcweir 319cdf0e10cSrcweir // SelectionFlag zuruecksetzen 320cdf0e10cSrcweir for(nObjs = 0;nObjs < nCnt;nObjs++) 321cdf0e10cSrcweir { 322cdf0e10cSrcweir SdrObject *pObj = GetMarkedObjectByIndex(nObjs); 323cdf0e10cSrcweir if(pObj && pObj->ISA(E3dCompoundObject)) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir // zugehoerige Szene 326cdf0e10cSrcweir pScene = ((E3dCompoundObject*)pObj)->GetScene(); 327cdf0e10cSrcweir if(pScene) 328cdf0e10cSrcweir pScene->SetSelected(sal_False); 329cdf0e10cSrcweir } 330cdf0e10cSrcweir } 331cdf0e10cSrcweir } 332cdf0e10cSrcweir else 333cdf0e10cSrcweir { 334cdf0e10cSrcweir // call parent 335cdf0e10cSrcweir SdrExchangeView::DrawMarkedObj(rOut); 336cdf0e10cSrcweir } 337cdf0e10cSrcweir } 338cdf0e10cSrcweir 339cdf0e10cSrcweir /************************************************************************* 340cdf0e10cSrcweir |* 341cdf0e10cSrcweir |* Model holen ueberladen, da bei einzelnen 3D Objekten noch eine Szene 342cdf0e10cSrcweir |* untergeschoben werden muss 343cdf0e10cSrcweir |* 344cdf0e10cSrcweir \************************************************************************/ 345cdf0e10cSrcweir 346cdf0e10cSrcweir SdrModel* E3dView::GetMarkedObjModel() const 347cdf0e10cSrcweir { 348cdf0e10cSrcweir // Existieren 3D-Objekte, deren Szenen nicht selektiert sind? 349cdf0e10cSrcweir bool bSpecialHandling(false); 350cdf0e10cSrcweir const sal_uInt32 nCount(GetMarkedObjectCount()); 351cdf0e10cSrcweir sal_uInt32 nObjs(0); 352cdf0e10cSrcweir E3dScene *pScene = 0; 353cdf0e10cSrcweir 354cdf0e10cSrcweir for(nObjs = 0; nObjs < nCount; nObjs++) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir const SdrObject* pObj = GetMarkedObjectByIndex(nObjs); 357cdf0e10cSrcweir 358cdf0e10cSrcweir if(!bSpecialHandling && pObj && pObj->ISA(E3dCompoundObject)) 359cdf0e10cSrcweir { 360cdf0e10cSrcweir // if the object is selected, but it's scene not, 361cdf0e10cSrcweir // we need special handling 362cdf0e10cSrcweir pScene = ((E3dCompoundObject*)pObj)->GetScene(); 363cdf0e10cSrcweir 364cdf0e10cSrcweir if(pScene && !IsObjMarked(pScene)) 365cdf0e10cSrcweir { 366cdf0e10cSrcweir bSpecialHandling = true; 367cdf0e10cSrcweir } 368cdf0e10cSrcweir } 369cdf0e10cSrcweir 370cdf0e10cSrcweir if(pObj && pObj->ISA(E3dObject)) 371cdf0e10cSrcweir { 372cdf0e10cSrcweir // reset all selection flags at 3D objects 373cdf0e10cSrcweir pScene = ((E3dObject*)pObj)->GetScene(); 374cdf0e10cSrcweir 375cdf0e10cSrcweir if(pScene) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir pScene->SetSelected(false); 378cdf0e10cSrcweir } 379cdf0e10cSrcweir } 380cdf0e10cSrcweir } 381cdf0e10cSrcweir 382cdf0e10cSrcweir if(!bSpecialHandling) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir // call parent 385cdf0e10cSrcweir return SdrView::GetMarkedObjModel(); 386cdf0e10cSrcweir } 387cdf0e10cSrcweir 388cdf0e10cSrcweir SdrModel* pNewModel = 0; 389cdf0e10cSrcweir Rectangle aSelectedSnapRect; 390cdf0e10cSrcweir 391cdf0e10cSrcweir // set 3d selection flags at all directly selected objects 392cdf0e10cSrcweir // and collect SnapRect of selected objects 393cdf0e10cSrcweir for(nObjs = 0; nObjs < nCount; nObjs++) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir SdrObject *pObj = GetMarkedObjectByIndex(nObjs); 396cdf0e10cSrcweir 397cdf0e10cSrcweir if(pObj && pObj->ISA(E3dCompoundObject)) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir // mark object, but not scenes 400cdf0e10cSrcweir E3dCompoundObject* p3DObj = (E3dCompoundObject*)pObj; 401cdf0e10cSrcweir p3DObj->SetSelected(true); 402cdf0e10cSrcweir aSelectedSnapRect.Union(p3DObj->GetSnapRect()); 403cdf0e10cSrcweir } 404cdf0e10cSrcweir } 405cdf0e10cSrcweir 406cdf0e10cSrcweir // create new mark list which contains all indirectly selected3d 407cdf0e10cSrcweir // scenes as selected objects 408cdf0e10cSrcweir SdrMarkList aOldML(GetMarkedObjectList()); 409cdf0e10cSrcweir SdrMarkList aNewML; 410cdf0e10cSrcweir SdrMarkList& rCurrentMarkList = ((E3dView*)this)->GetMarkedObjectListWriteAccess(); 411cdf0e10cSrcweir rCurrentMarkList = aNewML; 412cdf0e10cSrcweir 413cdf0e10cSrcweir for(nObjs = 0; nObjs < nCount; nObjs++) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir SdrObject *pObj = aOldML.GetMark(nObjs)->GetMarkedSdrObj(); 416cdf0e10cSrcweir 417cdf0e10cSrcweir if(pObj && pObj->ISA(E3dObject)) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir pScene = ((E3dObject*)pObj)->GetScene(); 420cdf0e10cSrcweir 421cdf0e10cSrcweir if(pScene && !IsObjMarked(pScene) && GetSdrPageView()) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir ((E3dView*)this)->MarkObj(pScene, GetSdrPageView(), sal_False, sal_True); 424cdf0e10cSrcweir } 425cdf0e10cSrcweir } 426cdf0e10cSrcweir } 427cdf0e10cSrcweir 428cdf0e10cSrcweir // call parent. This will copy all scenes and the selection flags at the 3d objectss. So 429cdf0e10cSrcweir // it will be possible to delete all non-selected 3d objects from the cloned 3d scenes 430cdf0e10cSrcweir pNewModel = SdrView::GetMarkedObjModel(); 431cdf0e10cSrcweir 432cdf0e10cSrcweir if(pNewModel) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir for(sal_uInt16 nPg(0); nPg < pNewModel->GetPageCount(); nPg++) 435cdf0e10cSrcweir { 436cdf0e10cSrcweir const SdrPage* pSrcPg=pNewModel->GetPage(nPg); 437cdf0e10cSrcweir const sal_uInt32 nObAnz(pSrcPg->GetObjCount()); 438cdf0e10cSrcweir 439cdf0e10cSrcweir for(sal_uInt32 nOb(0); nOb < nObAnz; nOb++) 440cdf0e10cSrcweir { 441cdf0e10cSrcweir const SdrObject* pSrcOb=pSrcPg->GetObj(nOb); 442cdf0e10cSrcweir 443cdf0e10cSrcweir if(pSrcOb->ISA(E3dScene)) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir pScene = (E3dScene*)pSrcOb; 446cdf0e10cSrcweir 447cdf0e10cSrcweir // delete all not intentionally cloned 3d objects 448cdf0e10cSrcweir pScene->removeAllNonSelectedObjects(); 449cdf0e10cSrcweir 450cdf0e10cSrcweir // reset select flags and set SnapRect of all selected objects 451cdf0e10cSrcweir pScene->SetSelected(false); 452cdf0e10cSrcweir pScene->SetSnapRect(aSelectedSnapRect); 453cdf0e10cSrcweir } 454cdf0e10cSrcweir } 455cdf0e10cSrcweir } 456cdf0e10cSrcweir } 457cdf0e10cSrcweir 458cdf0e10cSrcweir // restore old selection 459cdf0e10cSrcweir rCurrentMarkList = aOldML; 460cdf0e10cSrcweir 461cdf0e10cSrcweir // model zurueckgeben 462cdf0e10cSrcweir return pNewModel; 463cdf0e10cSrcweir } 464cdf0e10cSrcweir 465cdf0e10cSrcweir /************************************************************************* 466cdf0e10cSrcweir |* 467cdf0e10cSrcweir |* Bei Paste muss - falls in eine Scene eingefuegt wird - die 468cdf0e10cSrcweir |* Objekte der Szene eingefuegt werden, die Szene selbst aber nicht 469cdf0e10cSrcweir |* 470cdf0e10cSrcweir \************************************************************************/ 471cdf0e10cSrcweir 472cdf0e10cSrcweir sal_Bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions) 473cdf0e10cSrcweir { 474cdf0e10cSrcweir sal_Bool bRetval = sal_False; 475cdf0e10cSrcweir 476cdf0e10cSrcweir // Liste holen 477cdf0e10cSrcweir Point aPos(rPos); 478cdf0e10cSrcweir SdrObjList* pDstList = pLst; 479cdf0e10cSrcweir ImpGetPasteObjList(aPos, pDstList); 480cdf0e10cSrcweir 481cdf0e10cSrcweir if(!pDstList) 482cdf0e10cSrcweir return sal_False; 483cdf0e10cSrcweir 484cdf0e10cSrcweir // Owner der Liste holen 485cdf0e10cSrcweir SdrObject* pOwner = pDstList->GetOwnerObj(); 486cdf0e10cSrcweir if(pOwner && pOwner->ISA(E3dScene)) 487cdf0e10cSrcweir { 488cdf0e10cSrcweir E3dScene* pDstScene = (E3dScene*)pOwner; 489cdf0e10cSrcweir BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_EXCHANGE_PASTE)); 490cdf0e10cSrcweir 491cdf0e10cSrcweir // Alle Objekte aus E3dScenes kopieren und direkt einfuegen 492cdf0e10cSrcweir for(sal_uInt16 nPg(0); nPg < rMod.GetPageCount(); nPg++) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir const SdrPage* pSrcPg=rMod.GetPage(nPg); 495cdf0e10cSrcweir sal_uInt32 nObAnz(pSrcPg->GetObjCount()); 496cdf0e10cSrcweir 497cdf0e10cSrcweir // calculate offset for paste 498cdf0e10cSrcweir Rectangle aR = pSrcPg->GetAllObjBoundRect(); 499cdf0e10cSrcweir Point aDist(aPos - aR.Center()); 500cdf0e10cSrcweir 501cdf0e10cSrcweir // Unterobjekte von Szenen einfuegen 502cdf0e10cSrcweir for(sal_uInt32 nOb(0); nOb < nObAnz; nOb++) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir const SdrObject* pSrcOb = pSrcPg->GetObj(nOb); 505cdf0e10cSrcweir if(pSrcOb->ISA(E3dScene)) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir E3dScene* pSrcScene = (E3dScene*)pSrcOb; 508cdf0e10cSrcweir ImpCloneAll3DObjectsToDestScene(pSrcScene, pDstScene, aDist); 509cdf0e10cSrcweir } 510cdf0e10cSrcweir } 511cdf0e10cSrcweir } 512cdf0e10cSrcweir EndUndo(); 513cdf0e10cSrcweir } 514cdf0e10cSrcweir else 515cdf0e10cSrcweir { 516cdf0e10cSrcweir // call parent 517cdf0e10cSrcweir bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions); 518cdf0e10cSrcweir } 519cdf0e10cSrcweir 520cdf0e10cSrcweir // und Rueckgabewert liefern 521cdf0e10cSrcweir return bRetval; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir 524cdf0e10cSrcweir // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...) 525cdf0e10cSrcweir sal_Bool E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point /*aOffset*/) 526cdf0e10cSrcweir { 527cdf0e10cSrcweir sal_Bool bRetval(sal_False); 528cdf0e10cSrcweir 529cdf0e10cSrcweir if(pSrcScene && pDstScene) 530cdf0e10cSrcweir { 531cdf0e10cSrcweir const sdr::contact::ViewContactOfE3dScene& rVCSceneDst = static_cast< sdr::contact::ViewContactOfE3dScene& >(pDstScene->GetViewContact()); 532cdf0e10cSrcweir const drawinglayer::geometry::ViewInformation3D aViewInfo3DDst(rVCSceneDst.getViewInformation3D()); 533cdf0e10cSrcweir const sdr::contact::ViewContactOfE3dScene& rVCSceneSrc = static_cast< sdr::contact::ViewContactOfE3dScene& >(pSrcScene->GetViewContact()); 534cdf0e10cSrcweir const drawinglayer::geometry::ViewInformation3D aViewInfo3DSrc(rVCSceneSrc.getViewInformation3D()); 535cdf0e10cSrcweir 536cdf0e10cSrcweir for(sal_uInt32 i(0); i < pSrcScene->GetSubList()->GetObjCount(); i++) 537cdf0e10cSrcweir { 538cdf0e10cSrcweir E3dCompoundObject* pCompoundObj = dynamic_cast< E3dCompoundObject* >(pSrcScene->GetSubList()->GetObj(i)); 539cdf0e10cSrcweir 540cdf0e10cSrcweir if(pCompoundObj) 541cdf0e10cSrcweir { 542cdf0e10cSrcweir // #116235# 543cdf0e10cSrcweir E3dCompoundObject* pNewCompoundObj = dynamic_cast< E3dCompoundObject* >(pCompoundObj->Clone()); 544cdf0e10cSrcweir 545cdf0e10cSrcweir if(pNewCompoundObj) 546cdf0e10cSrcweir { 547cdf0e10cSrcweir // get dest scene's current range in 3D world coordinates 548cdf0e10cSrcweir const basegfx::B3DHomMatrix aSceneToWorldTrans(pDstScene->GetFullTransform()); 549cdf0e10cSrcweir basegfx::B3DRange aSceneRange(pDstScene->GetBoundVolume()); 550cdf0e10cSrcweir aSceneRange.transform(aSceneToWorldTrans); 551cdf0e10cSrcweir 552cdf0e10cSrcweir // get new object's implied object transformation 553cdf0e10cSrcweir const basegfx::B3DHomMatrix aNewObjectTrans(pNewCompoundObj->GetTransform()); 554cdf0e10cSrcweir 555cdf0e10cSrcweir // get new object's range in 3D world coordinates in dest scene 556cdf0e10cSrcweir // as if it were already added 557cdf0e10cSrcweir const basegfx::B3DHomMatrix aObjectToWorldTrans(aSceneToWorldTrans * aNewObjectTrans); 558cdf0e10cSrcweir basegfx::B3DRange aObjectRange(pNewCompoundObj->GetBoundVolume()); 559cdf0e10cSrcweir aObjectRange.transform(aObjectToWorldTrans); 560cdf0e10cSrcweir 561cdf0e10cSrcweir // get scale adaption 562cdf0e10cSrcweir const basegfx::B3DVector aSceneScale(aSceneRange.getRange()); 563cdf0e10cSrcweir const basegfx::B3DVector aObjectScale(aObjectRange.getRange()); 564cdf0e10cSrcweir double fScale(1.0); 565cdf0e10cSrcweir 566cdf0e10cSrcweir // if new object's size in X,Y or Z is bigger that 80% of dest scene, adapt scale 567cdf0e10cSrcweir // to not change the scene by the inserted object 568cdf0e10cSrcweir const double fSizeFactor(0.5); 569cdf0e10cSrcweir 570cdf0e10cSrcweir if(aObjectScale.getX() * fScale > aSceneScale.getX() * fSizeFactor) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir const double fObjSize(aObjectScale.getX() * fScale); 573cdf0e10cSrcweir const double fFactor((aSceneScale.getX() * fSizeFactor) / (basegfx::fTools::equalZero(fObjSize) ? 1.0 : fObjSize)); 574cdf0e10cSrcweir fScale *= fFactor; 575cdf0e10cSrcweir } 576cdf0e10cSrcweir 577cdf0e10cSrcweir if(aObjectScale.getY() * fScale > aSceneScale.getY() * fSizeFactor) 578cdf0e10cSrcweir { 579cdf0e10cSrcweir const double fObjSize(aObjectScale.getY() * fScale); 580cdf0e10cSrcweir const double fFactor((aSceneScale.getY() * fSizeFactor) / (basegfx::fTools::equalZero(fObjSize) ? 1.0 : fObjSize)); 581cdf0e10cSrcweir fScale *= fFactor; 582cdf0e10cSrcweir } 583cdf0e10cSrcweir 584cdf0e10cSrcweir if(aObjectScale.getZ() * fScale > aSceneScale.getZ() * fSizeFactor) 585cdf0e10cSrcweir { 586cdf0e10cSrcweir const double fObjSize(aObjectScale.getZ() * fScale); 587cdf0e10cSrcweir const double fFactor((aSceneScale.getZ() * fSizeFactor) / (basegfx::fTools::equalZero(fObjSize) ? 1.0 : fObjSize)); 588cdf0e10cSrcweir fScale *= fFactor; 589cdf0e10cSrcweir } 590cdf0e10cSrcweir 591cdf0e10cSrcweir // get translation adaption 592cdf0e10cSrcweir const basegfx::B3DPoint aSceneCenter(aSceneRange.getCenter()); 593cdf0e10cSrcweir const basegfx::B3DPoint aObjectCenter(aObjectRange.getCenter()); 594cdf0e10cSrcweir 595cdf0e10cSrcweir // build full modification transform. The object's transformation 596cdf0e10cSrcweir // shall be modified, so start at object coordinates; transform to 3d world coor 597cdf0e10cSrcweir basegfx::B3DHomMatrix aModifyingTransform(aObjectToWorldTrans); 598cdf0e10cSrcweir 599cdf0e10cSrcweir // translate to absolute center in 3d world coor 600cdf0e10cSrcweir aModifyingTransform.translate(-aObjectCenter.getX(), -aObjectCenter.getY(), -aObjectCenter.getZ()); 601cdf0e10cSrcweir 602cdf0e10cSrcweir // scale to dest size in 3d world coor 603cdf0e10cSrcweir aModifyingTransform.scale(fScale, fScale, fScale); 604cdf0e10cSrcweir 605cdf0e10cSrcweir // translate to dest scene center in 3d world coor 606cdf0e10cSrcweir aModifyingTransform.translate(aSceneCenter.getX(), aSceneCenter.getY(), aSceneCenter.getZ()); 607cdf0e10cSrcweir 608cdf0e10cSrcweir // transform from 3d world to dest object coordinates 609cdf0e10cSrcweir basegfx::B3DHomMatrix aWorldToObject(aObjectToWorldTrans); 610cdf0e10cSrcweir aWorldToObject.invert(); 611cdf0e10cSrcweir aModifyingTransform = aWorldToObject * aModifyingTransform; 612cdf0e10cSrcweir 613cdf0e10cSrcweir // correct implied object transform by applying changing one in object coor 614cdf0e10cSrcweir pNewCompoundObj->SetTransform(aModifyingTransform * aNewObjectTrans); 615cdf0e10cSrcweir 616cdf0e10cSrcweir // fill and insert new object 617cdf0e10cSrcweir pNewCompoundObj->SetModel(pDstScene->GetModel()); 618cdf0e10cSrcweir pNewCompoundObj->SetPage(pDstScene->GetPage()); 619cdf0e10cSrcweir pNewCompoundObj->NbcSetLayer(pCompoundObj->GetLayer()); 620cdf0e10cSrcweir pNewCompoundObj->NbcSetStyleSheet(pCompoundObj->GetStyleSheet(), sal_True); 621cdf0e10cSrcweir pDstScene->Insert3DObj(pNewCompoundObj); 622cdf0e10cSrcweir bRetval = sal_True; 623cdf0e10cSrcweir 624cdf0e10cSrcweir // Undo anlegen 625cdf0e10cSrcweir if( GetModel()->IsUndoEnabled() ) 626cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNewCompoundObj)); 627cdf0e10cSrcweir } 628cdf0e10cSrcweir } 629cdf0e10cSrcweir } 630cdf0e10cSrcweir } 631cdf0e10cSrcweir 632cdf0e10cSrcweir return bRetval; 633cdf0e10cSrcweir } 634cdf0e10cSrcweir 635cdf0e10cSrcweir /************************************************************************* 636cdf0e10cSrcweir |* 637cdf0e10cSrcweir |* 3D-Konvertierung moeglich? 638cdf0e10cSrcweir |* 639cdf0e10cSrcweir \************************************************************************/ 640cdf0e10cSrcweir 641cdf0e10cSrcweir sal_Bool E3dView::IsConvertTo3DObjPossible() const 642cdf0e10cSrcweir { 643cdf0e10cSrcweir sal_Bool bAny3D(sal_False); 644cdf0e10cSrcweir sal_Bool bGroupSelected(sal_False); 645cdf0e10cSrcweir sal_Bool bRetval(sal_True); 646cdf0e10cSrcweir 647cdf0e10cSrcweir for(sal_uInt32 a=0;!bAny3D && a<GetMarkedObjectCount();a++) 648cdf0e10cSrcweir { 649cdf0e10cSrcweir SdrObject *pObj = GetMarkedObjectByIndex(a); 650cdf0e10cSrcweir if(pObj) 651cdf0e10cSrcweir { 652cdf0e10cSrcweir ImpIsConvertTo3DPossible(pObj, bAny3D, bGroupSelected); 653cdf0e10cSrcweir } 654cdf0e10cSrcweir } 655cdf0e10cSrcweir 656cdf0e10cSrcweir bRetval = !bAny3D 657cdf0e10cSrcweir && ( 658cdf0e10cSrcweir IsConvertToPolyObjPossible(sal_False) 659cdf0e10cSrcweir || IsConvertToPathObjPossible(sal_False) 660cdf0e10cSrcweir || IsImportMtfPossible()); 661cdf0e10cSrcweir return bRetval; 662cdf0e10cSrcweir } 663cdf0e10cSrcweir 664cdf0e10cSrcweir void E3dView::ImpIsConvertTo3DPossible(SdrObject* pObj, sal_Bool& rAny3D, 665cdf0e10cSrcweir sal_Bool& rGroupSelected) const 666cdf0e10cSrcweir { 667cdf0e10cSrcweir if(pObj) 668cdf0e10cSrcweir { 669cdf0e10cSrcweir if(pObj->ISA(E3dObject)) 670cdf0e10cSrcweir { 671cdf0e10cSrcweir rAny3D = sal_True; 672cdf0e10cSrcweir } 673cdf0e10cSrcweir else 674cdf0e10cSrcweir { 675cdf0e10cSrcweir if(pObj->IsGroupObject()) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir SdrObjListIter aIter(*pObj, IM_DEEPNOGROUPS); 678cdf0e10cSrcweir while(aIter.IsMore()) 679cdf0e10cSrcweir { 680cdf0e10cSrcweir SdrObject* pNewObj = aIter.Next(); 681cdf0e10cSrcweir ImpIsConvertTo3DPossible(pNewObj, rAny3D, rGroupSelected); 682cdf0e10cSrcweir } 683cdf0e10cSrcweir rGroupSelected = sal_True; 684cdf0e10cSrcweir } 685cdf0e10cSrcweir } 686cdf0e10cSrcweir } 687cdf0e10cSrcweir } 688cdf0e10cSrcweir 689cdf0e10cSrcweir /************************************************************************* 690cdf0e10cSrcweir |* 691cdf0e10cSrcweir |* 3D-Konvertierung zu Extrude ausfuehren 692cdf0e10cSrcweir |* 693cdf0e10cSrcweir \************************************************************************/ 694cdf0e10cSrcweir #include <editeng/eeitem.hxx> 695cdf0e10cSrcweir 696cdf0e10cSrcweir void E3dView::ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj) 697cdf0e10cSrcweir { 698cdf0e10cSrcweir if(pObj->ISA(SdrTextObj)) 699cdf0e10cSrcweir { 700cdf0e10cSrcweir const SfxItemSet& rSet = pObj->GetMergedItemSet(); 701cdf0e10cSrcweir const SvxColorItem& rTextColorItem = (const SvxColorItem&)rSet.Get(EE_CHAR_COLOR); 702cdf0e10cSrcweir if(rTextColorItem.GetValue() == RGB_Color(COL_BLACK)) 703cdf0e10cSrcweir { 704cdf0e10cSrcweir // Bei schwarzen Textobjekten wird die Farbe auf grau gesetzt 705cdf0e10cSrcweir if(pObj->GetPage()) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir // #84864# if black is only default attribute from 708cdf0e10cSrcweir // pattern set it hard so that it is used in undo. 709cdf0e10cSrcweir pObj->SetMergedItem(SvxColorItem(RGB_Color(COL_BLACK), EE_CHAR_COLOR)); 710cdf0e10cSrcweir 711cdf0e10cSrcweir // add undo now 712cdf0e10cSrcweir if( GetModel()->IsUndoEnabled() ) 713cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj, false, false)); 714cdf0e10cSrcweir } 715cdf0e10cSrcweir 716cdf0e10cSrcweir pObj->SetMergedItem(SvxColorItem(RGB_Color(COL_GRAY), EE_CHAR_COLOR)); 717cdf0e10cSrcweir } 718cdf0e10cSrcweir } 719cdf0e10cSrcweir } 720cdf0e10cSrcweir 721cdf0e10cSrcweir void E3dView::ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir if(pObj->ISA(SdrPathObj)) 724cdf0e10cSrcweir { 725cdf0e10cSrcweir const SfxItemSet& rSet = pObj->GetMergedItemSet(); 726cdf0e10cSrcweir sal_Int32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); 727cdf0e10cSrcweir XLineStyle eLineStyle = (XLineStyle)((const XLineStyleItem&)rSet.Get(XATTR_LINESTYLE)).GetValue(); 728cdf0e10cSrcweir XFillStyle eFillStyle = ITEMVALUE(rSet, XATTR_FILLSTYLE, XFillStyleItem); 729cdf0e10cSrcweir 730cdf0e10cSrcweir if(((SdrPathObj*)pObj)->IsClosed() 731cdf0e10cSrcweir && eLineStyle == XLINE_SOLID 732cdf0e10cSrcweir && !nLineWidth 733cdf0e10cSrcweir && eFillStyle != XFILL_NONE) 734cdf0e10cSrcweir { 735cdf0e10cSrcweir if(pObj->GetPage() && GetModel()->IsUndoEnabled() ) 736cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj, false, false)); 737cdf0e10cSrcweir pObj->SetMergedItem(XLineStyleItem(XLINE_NONE)); 738cdf0e10cSrcweir pObj->SetMergedItem(XLineWidthItem(0L)); 739cdf0e10cSrcweir } 740cdf0e10cSrcweir } 741cdf0e10cSrcweir } 742cdf0e10cSrcweir 743cdf0e10cSrcweir void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, sal_Bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat) 744cdf0e10cSrcweir { 745cdf0e10cSrcweir // Einzelnes PathObject, dieses umwanden 746cdf0e10cSrcweir SdrPathObj* pPath = PTR_CAST(SdrPathObj, pObj); 747cdf0e10cSrcweir 748cdf0e10cSrcweir if(pPath) 749cdf0e10cSrcweir { 750cdf0e10cSrcweir E3dDefaultAttributes aDefault = Get3DDefaultAttributes(); 751cdf0e10cSrcweir if(bExtrude) 752cdf0e10cSrcweir aDefault.SetDefaultExtrudeCharacterMode(sal_True); 753cdf0e10cSrcweir else 754cdf0e10cSrcweir aDefault.SetDefaultLatheCharacterMode(sal_True); 755cdf0e10cSrcweir 756cdf0e10cSrcweir // ItemSet des Ursprungsobjektes holen 757cdf0e10cSrcweir SfxItemSet aSet(pObj->GetMergedItemSet()); 758cdf0e10cSrcweir 759cdf0e10cSrcweir XFillStyle eFillStyle = ITEMVALUE(aSet, XATTR_FILLSTYLE, XFillStyleItem); 760cdf0e10cSrcweir 761cdf0e10cSrcweir // Linienstil ausschalten 762cdf0e10cSrcweir aSet.Put(XLineStyleItem(XLINE_NONE)); 763cdf0e10cSrcweir 764cdf0e10cSrcweir // Feststellen, ob ein FILL_Attribut gesetzt ist. 765cdf0e10cSrcweir if(!pPath->IsClosed() || eFillStyle == XFILL_NONE) 766cdf0e10cSrcweir { 767cdf0e10cSrcweir // Das SdrPathObj ist nicht gefuellt, lasse die 768cdf0e10cSrcweir // vordere und hintere Flaeche weg. Ausserdem ist 769cdf0e10cSrcweir // eine beidseitige Darstellung notwendig. 770cdf0e10cSrcweir aDefault.SetDefaultExtrudeCloseFront(sal_False); 771cdf0e10cSrcweir aDefault.SetDefaultExtrudeCloseBack(sal_False); 772cdf0e10cSrcweir 773cdf0e10cSrcweir aSet.Put(Svx3DDoubleSidedItem(sal_True)); 774cdf0e10cSrcweir 775cdf0e10cSrcweir // Fuellattribut setzen 776cdf0e10cSrcweir aSet.Put(XFillStyleItem(XFILL_SOLID)); 777cdf0e10cSrcweir 778cdf0e10cSrcweir // Fuellfarbe muss auf Linienfarbe, da das Objekt vorher 779cdf0e10cSrcweir // nur eine Linie war 780cdf0e10cSrcweir Color aColorLine = ((const XLineColorItem&)(aSet.Get(XATTR_LINECOLOR))).GetColorValue(); 781cdf0e10cSrcweir aSet.Put(XFillColorItem(String(), aColorLine)); 782cdf0e10cSrcweir } 783cdf0e10cSrcweir 784cdf0e10cSrcweir // Neues Extrude-Objekt erzeugen 785cdf0e10cSrcweir E3dObject* p3DObj = NULL; 786cdf0e10cSrcweir if(bExtrude) 787cdf0e10cSrcweir { 788cdf0e10cSrcweir p3DObj = new E3dExtrudeObj(aDefault, pPath->GetPathPoly(), fDepth); 789cdf0e10cSrcweir } 790cdf0e10cSrcweir else 791cdf0e10cSrcweir { 792cdf0e10cSrcweir basegfx::B2DPolyPolygon aPolyPoly2D(pPath->GetPathPoly()); 793cdf0e10cSrcweir aPolyPoly2D.transform(rLatheMat); 794cdf0e10cSrcweir p3DObj = new E3dLatheObj(aDefault, aPolyPoly2D); 795cdf0e10cSrcweir } 796cdf0e10cSrcweir 797cdf0e10cSrcweir // Attribute setzen 798cdf0e10cSrcweir if(p3DObj) 799cdf0e10cSrcweir { 800cdf0e10cSrcweir p3DObj->NbcSetLayer(pObj->GetLayer()); 801cdf0e10cSrcweir 802cdf0e10cSrcweir p3DObj->SetMergedItemSet(aSet); 803cdf0e10cSrcweir 804cdf0e10cSrcweir p3DObj->NbcSetStyleSheet(pObj->GetStyleSheet(), sal_True); 805cdf0e10cSrcweir 806cdf0e10cSrcweir // Neues 3D-Objekt einfuegen 807cdf0e10cSrcweir pScene->Insert3DObj(p3DObj); 808cdf0e10cSrcweir } 809cdf0e10cSrcweir } 810cdf0e10cSrcweir } 811cdf0e10cSrcweir 812cdf0e10cSrcweir void E3dView::ImpCreate3DObject(E3dScene* pScene, SdrObject* pObj, sal_Bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat) 813cdf0e10cSrcweir { 814cdf0e10cSrcweir if(pObj) 815cdf0e10cSrcweir { 816cdf0e10cSrcweir // change text color attribute for not so dark colors 817cdf0e10cSrcweir if(pObj->IsGroupObject()) 818cdf0e10cSrcweir { 819cdf0e10cSrcweir SdrObjListIter aIter(*pObj, IM_DEEPWITHGROUPS); 820cdf0e10cSrcweir while(aIter.IsMore()) 821cdf0e10cSrcweir { 822cdf0e10cSrcweir SdrObject* pGroupMember = aIter.Next(); 823cdf0e10cSrcweir ImpChangeSomeAttributesFor3DConversion(pGroupMember); 824cdf0e10cSrcweir } 825cdf0e10cSrcweir } 826cdf0e10cSrcweir else 827cdf0e10cSrcweir ImpChangeSomeAttributesFor3DConversion(pObj); 828cdf0e10cSrcweir 829cdf0e10cSrcweir // convert completely to path objects 830cdf0e10cSrcweir SdrObject* pNewObj1 = pObj->ConvertToPolyObj(sal_False, sal_False); 831cdf0e10cSrcweir 832cdf0e10cSrcweir if(pNewObj1) 833cdf0e10cSrcweir { 834cdf0e10cSrcweir // change text color attribute for not so dark colors 835cdf0e10cSrcweir if(pNewObj1->IsGroupObject()) 836cdf0e10cSrcweir { 837cdf0e10cSrcweir SdrObjListIter aIter(*pNewObj1, IM_DEEPWITHGROUPS); 838cdf0e10cSrcweir while(aIter.IsMore()) 839cdf0e10cSrcweir { 840cdf0e10cSrcweir SdrObject* pGroupMember = aIter.Next(); 841cdf0e10cSrcweir ImpChangeSomeAttributesFor3DConversion2(pGroupMember); 842cdf0e10cSrcweir } 843cdf0e10cSrcweir } 844cdf0e10cSrcweir else 845cdf0e10cSrcweir ImpChangeSomeAttributesFor3DConversion2(pNewObj1); 846cdf0e10cSrcweir 847cdf0e10cSrcweir // convert completely to path objects 848cdf0e10cSrcweir SdrObject* pNewObj2 = pObj->ConvertToContourObj(pNewObj1, sal_True); 849cdf0e10cSrcweir 850cdf0e10cSrcweir if(pNewObj2) 851cdf0e10cSrcweir { 852cdf0e10cSrcweir // add all to flat scene 853cdf0e10cSrcweir if(pNewObj2->IsGroupObject()) 854cdf0e10cSrcweir { 855cdf0e10cSrcweir SdrObjListIter aIter(*pNewObj2, IM_DEEPWITHGROUPS); 856cdf0e10cSrcweir while(aIter.IsMore()) 857cdf0e10cSrcweir { 858cdf0e10cSrcweir SdrObject* pGroupMember = aIter.Next(); 859cdf0e10cSrcweir ImpCreateSingle3DObjectFlat(pScene, pGroupMember, bExtrude, fDepth, rLatheMat); 860cdf0e10cSrcweir } 861cdf0e10cSrcweir } 862cdf0e10cSrcweir else 863cdf0e10cSrcweir ImpCreateSingle3DObjectFlat(pScene, pNewObj2, bExtrude, fDepth, rLatheMat); 864cdf0e10cSrcweir 865cdf0e10cSrcweir // delete zwi object 866cdf0e10cSrcweir if(pNewObj2 != pObj && pNewObj2 != pNewObj1 && pNewObj2) 867cdf0e10cSrcweir SdrObject::Free( pNewObj2 ); 868cdf0e10cSrcweir } 869cdf0e10cSrcweir 870cdf0e10cSrcweir // delete zwi object 871cdf0e10cSrcweir if(pNewObj1 != pObj && pNewObj1) 872cdf0e10cSrcweir SdrObject::Free( pNewObj1 ); 873cdf0e10cSrcweir } 874cdf0e10cSrcweir } 875cdf0e10cSrcweir } 876cdf0e10cSrcweir 877cdf0e10cSrcweir /************************************************************************* 878cdf0e10cSrcweir |* 879cdf0e10cSrcweir |* 3D-Konvertierung zu Extrude steuern 880cdf0e10cSrcweir |* 881cdf0e10cSrcweir \************************************************************************/ 882cdf0e10cSrcweir 883cdf0e10cSrcweir void E3dView::ConvertMarkedObjTo3D(sal_Bool bExtrude, basegfx::B2DPoint aPnt1, basegfx::B2DPoint aPnt2) 884cdf0e10cSrcweir { 885cdf0e10cSrcweir if(AreObjectsMarked()) 886cdf0e10cSrcweir { 887cdf0e10cSrcweir // Undo anlegen 888cdf0e10cSrcweir if(bExtrude) 889cdf0e10cSrcweir BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_EXTRUDE)); 890cdf0e10cSrcweir else 891cdf0e10cSrcweir BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_LATHE)); 892cdf0e10cSrcweir 893cdf0e10cSrcweir // Neue Szene fuer zu erzeugende 3D-Objekte anlegen 894cdf0e10cSrcweir E3dScene* pScene = new E3dPolyScene(Get3DDefaultAttributes()); 895cdf0e10cSrcweir 896cdf0e10cSrcweir // Rechteck bestimmen und evtl. korrigieren 897cdf0e10cSrcweir Rectangle aRect = GetAllMarkedRect(); 898cdf0e10cSrcweir if(aRect.GetWidth() <= 1) 899cdf0e10cSrcweir aRect.SetSize(Size(500, aRect.GetHeight())); 900cdf0e10cSrcweir if(aRect.GetHeight() <= 1) 901cdf0e10cSrcweir aRect.SetSize(Size(aRect.GetWidth(), 500)); 902cdf0e10cSrcweir 903cdf0e10cSrcweir // Tiefe relativ zur Groesse der Selektion bestimmen 904cdf0e10cSrcweir double fDepth = 0.0; 905cdf0e10cSrcweir double fRot3D = 0.0; 906cdf0e10cSrcweir basegfx::B2DHomMatrix aLatheMat; 907cdf0e10cSrcweir 908cdf0e10cSrcweir if(bExtrude) 909cdf0e10cSrcweir { 910cdf0e10cSrcweir double fW = (double)aRect.GetWidth(); 911cdf0e10cSrcweir double fH = (double)aRect.GetHeight(); 912cdf0e10cSrcweir fDepth = sqrt(fW*fW + fH*fH) / 6.0; 913cdf0e10cSrcweir } 914cdf0e10cSrcweir if(!bExtrude) 915cdf0e10cSrcweir { 916cdf0e10cSrcweir // Transformation fuer Polygone Rotationskoerper erstellen 917cdf0e10cSrcweir if(aPnt1 != aPnt2) 918cdf0e10cSrcweir { 919cdf0e10cSrcweir // Rotation um Kontrollpunkt1 mit eigestelltem Winkel 920cdf0e10cSrcweir // fuer 3D Koordinaten 921cdf0e10cSrcweir basegfx::B2DPoint aDiff(aPnt1 - aPnt2); 922cdf0e10cSrcweir fRot3D = atan2(aDiff.getY(), aDiff.getX()) - F_PI2; 923cdf0e10cSrcweir 924cdf0e10cSrcweir if(basegfx::fTools::equalZero(fabs(fRot3D))) 925cdf0e10cSrcweir fRot3D = 0.0; 926cdf0e10cSrcweir 927cdf0e10cSrcweir if(fRot3D != 0.0) 928cdf0e10cSrcweir { 929cdf0e10cSrcweir aLatheMat = basegfx::tools::createRotateAroundPoint(aPnt2, -fRot3D) 930cdf0e10cSrcweir * aLatheMat; 931cdf0e10cSrcweir } 932cdf0e10cSrcweir } 933cdf0e10cSrcweir 934cdf0e10cSrcweir if(aPnt2.getX() != 0.0) 935cdf0e10cSrcweir { 936cdf0e10cSrcweir // Translation auf Y=0 - Achse 937cdf0e10cSrcweir aLatheMat.translate(-aPnt2.getX(), 0.0); 938cdf0e10cSrcweir } 939cdf0e10cSrcweir else 940cdf0e10cSrcweir { 941cdf0e10cSrcweir aLatheMat.translate((double)-aRect.Left(), 0.0); 942cdf0e10cSrcweir } 943cdf0e10cSrcweir 944cdf0e10cSrcweir // Inverse Matrix bilden, um die Zielausdehnung zu bestimmen 945cdf0e10cSrcweir basegfx::B2DHomMatrix aInvLatheMat(aLatheMat); 946cdf0e10cSrcweir aInvLatheMat.invert(); 947cdf0e10cSrcweir 948cdf0e10cSrcweir // SnapRect Ausdehnung mittels Spiegelung an der Rotationsachse 949cdf0e10cSrcweir // erweitern 950cdf0e10cSrcweir for(sal_uInt32 a=0;a<GetMarkedObjectCount();a++) 951cdf0e10cSrcweir { 952cdf0e10cSrcweir SdrMark* pMark = GetSdrMarkByIndex(a); 953cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 954cdf0e10cSrcweir Rectangle aTurnRect = pObj->GetSnapRect(); 955cdf0e10cSrcweir basegfx::B2DPoint aRot; 956cdf0e10cSrcweir Point aRotPnt; 957cdf0e10cSrcweir 958cdf0e10cSrcweir aRot = basegfx::B2DPoint(aTurnRect.Left(), -aTurnRect.Top()); 959cdf0e10cSrcweir aRot *= aLatheMat; 960cdf0e10cSrcweir aRot.setX(-aRot.getX()); 961cdf0e10cSrcweir aRot *= aInvLatheMat; 962cdf0e10cSrcweir aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5)); 963cdf0e10cSrcweir aRect.Union(Rectangle(aRotPnt, aRotPnt)); 964cdf0e10cSrcweir 965cdf0e10cSrcweir aRot = basegfx::B2DPoint(aTurnRect.Left(), -aTurnRect.Bottom()); 966cdf0e10cSrcweir aRot *= aLatheMat; 967cdf0e10cSrcweir aRot.setX(-aRot.getX()); 968cdf0e10cSrcweir aRot *= aInvLatheMat; 969cdf0e10cSrcweir aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5)); 970cdf0e10cSrcweir aRect.Union(Rectangle(aRotPnt, aRotPnt)); 971cdf0e10cSrcweir 972cdf0e10cSrcweir aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Top()); 973cdf0e10cSrcweir aRot *= aLatheMat; 974cdf0e10cSrcweir aRot.setX(-aRot.getX()); 975cdf0e10cSrcweir aRot *= aInvLatheMat; 976cdf0e10cSrcweir aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5)); 977cdf0e10cSrcweir aRect.Union(Rectangle(aRotPnt, aRotPnt)); 978cdf0e10cSrcweir 979cdf0e10cSrcweir aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Bottom()); 980cdf0e10cSrcweir aRot *= aLatheMat; 981cdf0e10cSrcweir aRot.setX(-aRot.getX()); 982cdf0e10cSrcweir aRot *= aInvLatheMat; 983cdf0e10cSrcweir aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5)); 984cdf0e10cSrcweir aRect.Union(Rectangle(aRotPnt, aRotPnt)); 985cdf0e10cSrcweir } 986cdf0e10cSrcweir } 987cdf0e10cSrcweir 988cdf0e10cSrcweir // Ueber die Selektion gehen und in 3D wandeln, komplett mit 989cdf0e10cSrcweir // Umwandeln in SdrPathObject, auch Schriften 990cdf0e10cSrcweir for(sal_uInt32 a=0;a<GetMarkedObjectCount();a++) 991cdf0e10cSrcweir { 992cdf0e10cSrcweir SdrMark* pMark = GetSdrMarkByIndex(a); 993cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 994cdf0e10cSrcweir 995cdf0e10cSrcweir ImpCreate3DObject(pScene, pObj, bExtrude, fDepth, aLatheMat); 996cdf0e10cSrcweir } 997cdf0e10cSrcweir 998cdf0e10cSrcweir if(pScene->GetSubList() && pScene->GetSubList()->GetObjCount() != 0) 999cdf0e10cSrcweir { 1000cdf0e10cSrcweir // Alle angelegten Objekte Tiefenarrangieren 1001cdf0e10cSrcweir if(bExtrude) 1002cdf0e10cSrcweir DoDepthArrange(pScene, fDepth); 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir // 3D-Objekte auf die Mitte des Gesamtrechtecks zentrieren 1005cdf0e10cSrcweir basegfx::B3DPoint aCenter(pScene->GetBoundVolume().getCenter()); 1006cdf0e10cSrcweir basegfx::B3DHomMatrix aMatrix; 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir aMatrix.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ()); 1009cdf0e10cSrcweir pScene->SetTransform(aMatrix * pScene->GetTransform()); // #112587# 1010cdf0e10cSrcweir 1011cdf0e10cSrcweir // Szene initialisieren 1012cdf0e10cSrcweir pScene->NbcSetSnapRect(aRect); 1013cdf0e10cSrcweir basegfx::B3DRange aBoundVol = pScene->GetBoundVolume(); 1014cdf0e10cSrcweir InitScene(pScene, (double)aRect.GetWidth(), (double)aRect.GetHeight(), aBoundVol.getDepth()); 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir // Szene anstelle des ersten selektierten Objektes einfuegen 1017cdf0e10cSrcweir // und alle alten Objekte weghauen 1018cdf0e10cSrcweir SdrObject* pRepObj = GetMarkedObjectByIndex(0); 1019cdf0e10cSrcweir SdrPageView* pPV = GetSdrPageViewOfMarkedByIndex(0); 1020cdf0e10cSrcweir MarkObj(pRepObj, pPV, sal_True); 1021cdf0e10cSrcweir ReplaceObjectAtView(pRepObj, *pPV, pScene, sal_False); 1022cdf0e10cSrcweir DeleteMarked(); 1023cdf0e10cSrcweir MarkObj(pScene, pPV); 1024cdf0e10cSrcweir 1025cdf0e10cSrcweir // Rotationskoerper um Rotationsachse drehen 1026cdf0e10cSrcweir basegfx::B3DHomMatrix aRotate; 1027cdf0e10cSrcweir 1028cdf0e10cSrcweir if(!bExtrude && fRot3D != 0.0) 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir aRotate.rotate(0.0, 0.0, fRot3D); 1031cdf0e10cSrcweir } 1032cdf0e10cSrcweir 1033cdf0e10cSrcweir // Default-Rotation setzen 1034cdf0e10cSrcweir { 1035cdf0e10cSrcweir double XRotateDefault = 20; 1036cdf0e10cSrcweir aRotate.rotate(DEG2RAD(XRotateDefault), 0.0, 0.0); 1037cdf0e10cSrcweir } 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir if(!aRotate.isIdentity()) 1040cdf0e10cSrcweir { 1041cdf0e10cSrcweir pScene->SetTransform(aRotate * pScene->GetTransform()); 1042cdf0e10cSrcweir } 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir // SnapRects der Objekte ungueltig 1045cdf0e10cSrcweir pScene->SetSnapRect(aRect); 1046cdf0e10cSrcweir } 1047cdf0e10cSrcweir else 1048cdf0e10cSrcweir { 1049cdf0e10cSrcweir // Es wurden keine 3D Objekte erzeugt, schmeiss alles weg 1050cdf0e10cSrcweir delete pScene; 1051cdf0e10cSrcweir } 1052cdf0e10cSrcweir 1053cdf0e10cSrcweir // Undo abschliessen 1054cdf0e10cSrcweir EndUndo(); 1055cdf0e10cSrcweir } 1056cdf0e10cSrcweir } 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir /************************************************************************* 1059cdf0e10cSrcweir |* 1060cdf0e10cSrcweir |* Alle enthaltenen Extrude-Objekte Tiefenarrangieren 1061cdf0e10cSrcweir |* 1062cdf0e10cSrcweir \************************************************************************/ 1063cdf0e10cSrcweir 1064cdf0e10cSrcweir struct E3dDepthNeighbour 1065cdf0e10cSrcweir { 1066cdf0e10cSrcweir E3dDepthNeighbour* mpNext; 1067cdf0e10cSrcweir E3dExtrudeObj* mpObj; 1068cdf0e10cSrcweir basegfx::B2DPolyPolygon maPreparedPolyPolygon; 1069cdf0e10cSrcweir 1070cdf0e10cSrcweir E3dDepthNeighbour() 1071cdf0e10cSrcweir : mpNext(0), 1072cdf0e10cSrcweir mpObj(0), 1073cdf0e10cSrcweir maPreparedPolyPolygon() 1074cdf0e10cSrcweir { 1075cdf0e10cSrcweir } 1076cdf0e10cSrcweir }; 1077cdf0e10cSrcweir 1078cdf0e10cSrcweir struct E3dDepthLayer 1079cdf0e10cSrcweir { 1080cdf0e10cSrcweir E3dDepthLayer* mpDown; 1081cdf0e10cSrcweir E3dDepthNeighbour* mpNext; 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir E3dDepthLayer() 1084cdf0e10cSrcweir : mpDown(0), 1085cdf0e10cSrcweir mpNext(0) 1086cdf0e10cSrcweir { 1087cdf0e10cSrcweir } 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir ~E3dDepthLayer() 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir while(mpNext) 1092cdf0e10cSrcweir { 1093cdf0e10cSrcweir E3dDepthNeighbour* pSucc = mpNext->mpNext; 1094cdf0e10cSrcweir delete mpNext; 1095cdf0e10cSrcweir mpNext = pSucc; 1096cdf0e10cSrcweir } 1097cdf0e10cSrcweir } 1098cdf0e10cSrcweir }; 1099cdf0e10cSrcweir 1100cdf0e10cSrcweir void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) 1101cdf0e10cSrcweir { 1102cdf0e10cSrcweir if(pScene && pScene->GetSubList() && pScene->GetSubList()->GetObjCount() > 1) 1103cdf0e10cSrcweir { 1104cdf0e10cSrcweir SdrObjList* pSubList = pScene->GetSubList(); 1105cdf0e10cSrcweir SdrObjListIter aIter(*pSubList, IM_FLAT); 1106cdf0e10cSrcweir E3dDepthLayer* pBaseLayer = NULL; 1107cdf0e10cSrcweir E3dDepthLayer* pLayer = NULL; 1108cdf0e10cSrcweir sal_Int32 nNumLayers = 0; 1109cdf0e10cSrcweir 1110cdf0e10cSrcweir while(aIter.IsMore()) 1111cdf0e10cSrcweir { 1112cdf0e10cSrcweir E3dExtrudeObj* pExtrudeObj = dynamic_cast< E3dExtrudeObj* >(aIter.Next()); 1113cdf0e10cSrcweir 1114cdf0e10cSrcweir if(pExtrudeObj) 1115cdf0e10cSrcweir { 1116cdf0e10cSrcweir const basegfx::B2DPolyPolygon aExtrudePoly( 1117cdf0e10cSrcweir basegfx::tools::prepareForPolygonOperation(pExtrudeObj->GetExtrudePolygon())); 1118cdf0e10cSrcweir const SfxItemSet& rLocalSet = pExtrudeObj->GetMergedItemSet(); 1119cdf0e10cSrcweir const XFillStyle eLocalFillStyle = ITEMVALUE(rLocalSet, XATTR_FILLSTYLE, XFillStyleItem); 1120cdf0e10cSrcweir const Color aLocalColor = ((const XFillColorItem&)(rLocalSet.Get(XATTR_FILLCOLOR))).GetColorValue(); 1121cdf0e10cSrcweir 1122cdf0e10cSrcweir // sort in ExtrudeObj 1123cdf0e10cSrcweir if(pLayer) 1124cdf0e10cSrcweir { 1125cdf0e10cSrcweir // do we have overlap with an object of this layer? 1126cdf0e10cSrcweir bool bOverlap(false); 1127cdf0e10cSrcweir E3dDepthNeighbour* pAct = pLayer->mpNext; 1128cdf0e10cSrcweir 1129cdf0e10cSrcweir while(!bOverlap && pAct) 1130cdf0e10cSrcweir { 1131cdf0e10cSrcweir // do pAct->mpObj and pExtrudeObj overlap? Check by 1132cdf0e10cSrcweir // using logical AND clipping 1133cdf0e10cSrcweir const basegfx::B2DPolyPolygon aAndPolyPolygon( 1134cdf0e10cSrcweir basegfx::tools::solvePolygonOperationAnd( 1135cdf0e10cSrcweir aExtrudePoly, 1136cdf0e10cSrcweir pAct->maPreparedPolyPolygon)); 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir bOverlap = (0 != aAndPolyPolygon.count()); 1139cdf0e10cSrcweir 1140cdf0e10cSrcweir if(bOverlap) 1141cdf0e10cSrcweir { 1142cdf0e10cSrcweir // second ciriteria: is another fillstyle or color used? 1143cdf0e10cSrcweir const SfxItemSet& rCompareSet = pAct->mpObj->GetMergedItemSet(); 1144cdf0e10cSrcweir 1145cdf0e10cSrcweir XFillStyle eCompareFillStyle = ITEMVALUE(rCompareSet, XATTR_FILLSTYLE, XFillStyleItem); 1146cdf0e10cSrcweir 1147cdf0e10cSrcweir if(eLocalFillStyle == eCompareFillStyle) 1148cdf0e10cSrcweir { 1149cdf0e10cSrcweir if(eLocalFillStyle == XFILL_SOLID) 1150cdf0e10cSrcweir { 1151cdf0e10cSrcweir Color aCompareColor = ((const XFillColorItem&)(rCompareSet.Get(XATTR_FILLCOLOR))).GetColorValue(); 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir if(aCompareColor == aLocalColor) 1154cdf0e10cSrcweir { 1155cdf0e10cSrcweir bOverlap = sal_False; 1156cdf0e10cSrcweir } 1157cdf0e10cSrcweir } 1158cdf0e10cSrcweir else if(eLocalFillStyle == XFILL_NONE) 1159cdf0e10cSrcweir { 1160cdf0e10cSrcweir bOverlap = sal_False; 1161cdf0e10cSrcweir } 1162cdf0e10cSrcweir } 1163cdf0e10cSrcweir } 1164cdf0e10cSrcweir 1165cdf0e10cSrcweir pAct = pAct->mpNext; 1166cdf0e10cSrcweir } 1167cdf0e10cSrcweir 1168cdf0e10cSrcweir if(bOverlap) 1169cdf0e10cSrcweir { 1170cdf0e10cSrcweir // yes, start a new layer 1171cdf0e10cSrcweir pLayer->mpDown = new E3dDepthLayer; 1172cdf0e10cSrcweir pLayer = pLayer->mpDown; 1173cdf0e10cSrcweir nNumLayers++; 1174cdf0e10cSrcweir pLayer->mpNext = new E3dDepthNeighbour; 1175cdf0e10cSrcweir pLayer->mpNext->mpObj = pExtrudeObj; 1176cdf0e10cSrcweir pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly; 1177cdf0e10cSrcweir } 1178cdf0e10cSrcweir else 1179cdf0e10cSrcweir { 1180cdf0e10cSrcweir // no, add to current layer 1181cdf0e10cSrcweir E3dDepthNeighbour* pNewNext = new E3dDepthNeighbour; 1182cdf0e10cSrcweir pNewNext->mpObj = pExtrudeObj; 1183cdf0e10cSrcweir pNewNext->maPreparedPolyPolygon = aExtrudePoly; 1184cdf0e10cSrcweir pNewNext->mpNext = pLayer->mpNext; 1185cdf0e10cSrcweir pLayer->mpNext = pNewNext; 1186cdf0e10cSrcweir } 1187cdf0e10cSrcweir } 1188cdf0e10cSrcweir else 1189cdf0e10cSrcweir { 1190cdf0e10cSrcweir // first layer ever 1191cdf0e10cSrcweir pBaseLayer = new E3dDepthLayer; 1192cdf0e10cSrcweir pLayer = pBaseLayer; 1193cdf0e10cSrcweir nNumLayers++; 1194cdf0e10cSrcweir pLayer->mpNext = new E3dDepthNeighbour; 1195cdf0e10cSrcweir pLayer->mpNext->mpObj = pExtrudeObj; 1196cdf0e10cSrcweir pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly; 1197cdf0e10cSrcweir } 1198cdf0e10cSrcweir } 1199cdf0e10cSrcweir } 1200cdf0e10cSrcweir 1201cdf0e10cSrcweir // number of layers is done 1202cdf0e10cSrcweir if(nNumLayers > 1) 1203cdf0e10cSrcweir { 1204cdf0e10cSrcweir // need to be arranged 1205cdf0e10cSrcweir double fMinDepth = fDepth * 0.8; 1206cdf0e10cSrcweir double fStep = (fDepth - fMinDepth) / (double)nNumLayers; 1207cdf0e10cSrcweir pLayer = pBaseLayer; 1208cdf0e10cSrcweir 1209cdf0e10cSrcweir while(pLayer) 1210cdf0e10cSrcweir { 1211cdf0e10cSrcweir // move along layer 1212cdf0e10cSrcweir E3dDepthNeighbour* pAct = pLayer->mpNext; 1213cdf0e10cSrcweir 1214cdf0e10cSrcweir while(pAct) 1215cdf0e10cSrcweir { 1216cdf0e10cSrcweir // adapt extrude value 1217cdf0e10cSrcweir pAct->mpObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5))); 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir // next 1220cdf0e10cSrcweir pAct = pAct->mpNext; 1221cdf0e10cSrcweir } 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir // next layer 1224cdf0e10cSrcweir pLayer = pLayer->mpDown; 1225cdf0e10cSrcweir fMinDepth += fStep; 1226cdf0e10cSrcweir } 1227cdf0e10cSrcweir } 1228cdf0e10cSrcweir 1229cdf0e10cSrcweir // cleanup 1230cdf0e10cSrcweir while(pBaseLayer) 1231cdf0e10cSrcweir { 1232cdf0e10cSrcweir pLayer = pBaseLayer->mpDown; 1233cdf0e10cSrcweir delete pBaseLayer; 1234cdf0e10cSrcweir pBaseLayer = pLayer; 1235cdf0e10cSrcweir } 1236cdf0e10cSrcweir } 1237cdf0e10cSrcweir } 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir /************************************************************************* 1240cdf0e10cSrcweir |* 1241cdf0e10cSrcweir |* Drag beginnen, vorher ggf. Drag-Methode fuer 3D-Objekte erzeugen 1242cdf0e10cSrcweir |* 1243cdf0e10cSrcweir \************************************************************************/ 1244cdf0e10cSrcweir 1245cdf0e10cSrcweir sal_Bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* pOut, 1246cdf0e10cSrcweir SdrHdl* pHdl, short nMinMov, 1247cdf0e10cSrcweir SdrDragMethod* pForcedMeth) 1248cdf0e10cSrcweir { 1249cdf0e10cSrcweir if(Is3DRotationCreationActive() && GetMarkedObjectCount()) 1250cdf0e10cSrcweir { 1251cdf0e10cSrcweir // bestimme alle selektierten Polygone und gebe die gespiegelte Hilfsfigur aus 1252cdf0e10cSrcweir mpMirrorOverlay->SetMirrorAxis(aRef1, aRef2); 1253cdf0e10cSrcweir } 1254cdf0e10cSrcweir else 1255cdf0e10cSrcweir { 1256cdf0e10cSrcweir sal_Bool bOwnActionNecessary; 1257cdf0e10cSrcweir if (pHdl == NULL) 1258cdf0e10cSrcweir { 1259cdf0e10cSrcweir bOwnActionNecessary = sal_True; 1260cdf0e10cSrcweir } 1261cdf0e10cSrcweir else if (pHdl->IsVertexHdl() || pHdl->IsCornerHdl()) 1262cdf0e10cSrcweir { 1263cdf0e10cSrcweir bOwnActionNecessary = sal_True; 1264cdf0e10cSrcweir } 1265cdf0e10cSrcweir else 1266cdf0e10cSrcweir { 1267cdf0e10cSrcweir bOwnActionNecessary = sal_False; 1268cdf0e10cSrcweir } 1269cdf0e10cSrcweir 1270cdf0e10cSrcweir if(bOwnActionNecessary && GetMarkedObjectCount() >= 1) 1271cdf0e10cSrcweir { 1272cdf0e10cSrcweir E3dDragConstraint eConstraint = E3DDRAG_CONSTR_XYZ; 1273cdf0e10cSrcweir sal_Bool bThereAreRootScenes = sal_False; 1274cdf0e10cSrcweir sal_Bool bThereAre3DObjects = sal_False; 1275cdf0e10cSrcweir long nCnt = GetMarkedObjectCount(); 1276cdf0e10cSrcweir for(long nObjs = 0;nObjs < nCnt;nObjs++) 1277cdf0e10cSrcweir { 1278cdf0e10cSrcweir SdrObject *pObj = GetMarkedObjectByIndex(nObjs); 1279cdf0e10cSrcweir if(pObj) 1280cdf0e10cSrcweir { 1281cdf0e10cSrcweir if(pObj->ISA(E3dScene) && ((E3dScene*)pObj)->GetScene() == pObj) 1282cdf0e10cSrcweir bThereAreRootScenes = sal_True; 1283cdf0e10cSrcweir if(pObj->ISA(E3dObject)) 1284cdf0e10cSrcweir bThereAre3DObjects = sal_True; 1285cdf0e10cSrcweir } 1286cdf0e10cSrcweir } 1287cdf0e10cSrcweir if( bThereAre3DObjects ) 1288cdf0e10cSrcweir { 1289cdf0e10cSrcweir eDragHdl = ( pHdl == NULL ? HDL_MOVE : pHdl->GetKind() ); 1290cdf0e10cSrcweir switch ( eDragMode ) 1291cdf0e10cSrcweir { 1292cdf0e10cSrcweir case SDRDRAG_ROTATE: 1293cdf0e10cSrcweir case SDRDRAG_SHEAR: 1294cdf0e10cSrcweir { 1295cdf0e10cSrcweir switch ( eDragHdl ) 1296cdf0e10cSrcweir { 1297cdf0e10cSrcweir case HDL_LEFT: 1298cdf0e10cSrcweir case HDL_RIGHT: 1299cdf0e10cSrcweir { 1300cdf0e10cSrcweir eConstraint = E3DDRAG_CONSTR_X; 1301cdf0e10cSrcweir } 1302cdf0e10cSrcweir break; 1303cdf0e10cSrcweir 1304cdf0e10cSrcweir case HDL_UPPER: 1305cdf0e10cSrcweir case HDL_LOWER: 1306cdf0e10cSrcweir { 1307cdf0e10cSrcweir eConstraint = E3DDRAG_CONSTR_Y; 1308cdf0e10cSrcweir } 1309cdf0e10cSrcweir break; 1310cdf0e10cSrcweir 1311cdf0e10cSrcweir case HDL_UPLFT: 1312cdf0e10cSrcweir case HDL_UPRGT: 1313cdf0e10cSrcweir case HDL_LWLFT: 1314cdf0e10cSrcweir case HDL_LWRGT: 1315cdf0e10cSrcweir { 1316cdf0e10cSrcweir eConstraint = E3DDRAG_CONSTR_Z; 1317cdf0e10cSrcweir } 1318cdf0e10cSrcweir break; 1319cdf0e10cSrcweir default: break; 1320cdf0e10cSrcweir } 1321cdf0e10cSrcweir 1322cdf0e10cSrcweir // die nicht erlaubten Rotationen ausmaskieren 1323cdf0e10cSrcweir eConstraint = E3dDragConstraint(eConstraint& eDragConstraint); 1324cdf0e10cSrcweir pForcedMeth = new E3dDragRotate(*this, GetMarkedObjectList(), eConstraint, IsSolidDragging()); 1325cdf0e10cSrcweir } 1326cdf0e10cSrcweir break; 1327cdf0e10cSrcweir 1328cdf0e10cSrcweir case SDRDRAG_MOVE: 1329cdf0e10cSrcweir { 1330cdf0e10cSrcweir if(!bThereAreRootScenes) 1331cdf0e10cSrcweir { 1332cdf0e10cSrcweir pForcedMeth = new E3dDragMove(*this, GetMarkedObjectList(), eDragHdl, eConstraint, IsSolidDragging()); 1333cdf0e10cSrcweir } 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir break; 1336cdf0e10cSrcweir 1337cdf0e10cSrcweir // spaeter mal 1338cdf0e10cSrcweir case SDRDRAG_MIRROR: 1339cdf0e10cSrcweir case SDRDRAG_CROOK: 1340cdf0e10cSrcweir case SDRDRAG_DISTORT: 1341cdf0e10cSrcweir case SDRDRAG_TRANSPARENCE: 1342cdf0e10cSrcweir case SDRDRAG_GRADIENT: 1343cdf0e10cSrcweir default: 1344cdf0e10cSrcweir { 1345cdf0e10cSrcweir } 1346cdf0e10cSrcweir break; 1347cdf0e10cSrcweir } 1348cdf0e10cSrcweir } 1349cdf0e10cSrcweir } 1350cdf0e10cSrcweir } 1351cdf0e10cSrcweir return SdrView::BegDragObj(rPnt, pOut, pHdl, nMinMov, pForcedMeth); 1352cdf0e10cSrcweir } 1353cdf0e10cSrcweir 1354cdf0e10cSrcweir /************************************************************************* 1355cdf0e10cSrcweir |* 1356cdf0e10cSrcweir |* Pruefen, obj 3D-Szene markiert ist 1357cdf0e10cSrcweir |* 1358cdf0e10cSrcweir \************************************************************************/ 1359cdf0e10cSrcweir 1360cdf0e10cSrcweir sal_Bool E3dView::HasMarkedScene() 1361cdf0e10cSrcweir { 1362cdf0e10cSrcweir return (GetMarkedScene() != NULL); 1363cdf0e10cSrcweir } 1364cdf0e10cSrcweir 1365cdf0e10cSrcweir /************************************************************************* 1366cdf0e10cSrcweir |* 1367cdf0e10cSrcweir |* Pruefen, obj 3D-Szene markiert ist 1368cdf0e10cSrcweir |* 1369cdf0e10cSrcweir \************************************************************************/ 1370cdf0e10cSrcweir 1371cdf0e10cSrcweir E3dScene* E3dView::GetMarkedScene() 1372cdf0e10cSrcweir { 1373cdf0e10cSrcweir sal_uIntPtr nCnt = GetMarkedObjectCount(); 1374cdf0e10cSrcweir 1375cdf0e10cSrcweir for ( sal_uIntPtr i = 0; i < nCnt; i++ ) 1376cdf0e10cSrcweir if ( GetMarkedObjectByIndex(i)->ISA(E3dScene) ) 1377cdf0e10cSrcweir return (E3dScene*) GetMarkedObjectByIndex(i); 1378cdf0e10cSrcweir 1379cdf0e10cSrcweir return NULL; 1380cdf0e10cSrcweir } 1381cdf0e10cSrcweir 1382cdf0e10cSrcweir /************************************************************************* 1383cdf0e10cSrcweir |* 1384cdf0e10cSrcweir |* aktuelles 3D-Zeichenobjekt setzen, dafuer Szene erzeugen 1385cdf0e10cSrcweir |* 1386cdf0e10cSrcweir \************************************************************************/ 1387cdf0e10cSrcweir 1388cdf0e10cSrcweir E3dScene* E3dView::SetCurrent3DObj(E3dObject* p3DObj) 1389cdf0e10cSrcweir { 1390cdf0e10cSrcweir DBG_ASSERT(p3DObj != NULL, "Nana, wer steckt denn hier 'nen NULL-Zeiger rein?"); 1391cdf0e10cSrcweir E3dScene* pScene = NULL; 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir // get transformed BoundVolume of the object 1394cdf0e10cSrcweir basegfx::B3DRange aVolume(p3DObj->GetBoundVolume()); 1395cdf0e10cSrcweir aVolume.transform(p3DObj->GetTransform()); 1396cdf0e10cSrcweir double fW(aVolume.getWidth()); 1397cdf0e10cSrcweir double fH(aVolume.getHeight()); 1398cdf0e10cSrcweir 1399cdf0e10cSrcweir Rectangle aRect(0,0, (long) fW, (long) fH); 1400cdf0e10cSrcweir 1401cdf0e10cSrcweir pScene = new E3dPolyScene(Get3DDefaultAttributes()); 1402cdf0e10cSrcweir 1403cdf0e10cSrcweir InitScene(pScene, fW, fH, aVolume.getMaxZ() + ((fW + fH) / 4.0)); 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir pScene->Insert3DObj(p3DObj); 1406cdf0e10cSrcweir pScene->NbcSetSnapRect(aRect); 1407cdf0e10cSrcweir 1408cdf0e10cSrcweir return pScene; 1409cdf0e10cSrcweir } 1410cdf0e10cSrcweir 1411cdf0e10cSrcweir /************************************************************************* 1412cdf0e10cSrcweir |* 1413cdf0e10cSrcweir |* neu erzeugte Szene initialisieren 1414cdf0e10cSrcweir |* 1415cdf0e10cSrcweir \************************************************************************/ 1416cdf0e10cSrcweir 1417cdf0e10cSrcweir void E3dView::InitScene(E3dScene* pScene, double fW, double fH, double fCamZ) 1418cdf0e10cSrcweir { 1419cdf0e10cSrcweir Camera3D aCam(pScene->GetCamera()); 1420cdf0e10cSrcweir 1421cdf0e10cSrcweir aCam.SetAutoAdjustProjection(sal_False); 1422cdf0e10cSrcweir aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH); 1423cdf0e10cSrcweir basegfx::B3DPoint aLookAt; 1424cdf0e10cSrcweir 1425cdf0e10cSrcweir double fDefaultCamPosZ = GetDefaultCamPosZ(); 1426cdf0e10cSrcweir basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ); 1427cdf0e10cSrcweir 1428cdf0e10cSrcweir aCam.SetPosAndLookAt(aCamPos, aLookAt); 1429cdf0e10cSrcweir aCam.SetFocalLength(GetDefaultCamFocal()); 1430cdf0e10cSrcweir aCam.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, GetDefaultCamFocal()); 1431cdf0e10cSrcweir pScene->SetCamera(aCam); 1432cdf0e10cSrcweir } 1433cdf0e10cSrcweir 1434cdf0e10cSrcweir /************************************************************************* 1435cdf0e10cSrcweir |* 1436cdf0e10cSrcweir |* startsequenz fuer die erstellung eines 3D-Rotationskoerpers 1437cdf0e10cSrcweir |* 1438cdf0e10cSrcweir \************************************************************************/ 1439cdf0e10cSrcweir 1440cdf0e10cSrcweir void E3dView::Start3DCreation() 1441cdf0e10cSrcweir { 1442cdf0e10cSrcweir if (GetMarkedObjectCount()) 1443cdf0e10cSrcweir { 1444cdf0e10cSrcweir // irgendwelche Markierungen ermitteln und ausschalten 1445cdf0e10cSrcweir //HMHBOOL bVis = IsMarkHdlShown(); 1446cdf0e10cSrcweir 1447cdf0e10cSrcweir //HMHif (bVis) HideMarkHdl(); 1448cdf0e10cSrcweir 1449cdf0e10cSrcweir // bestimme die koordinaten fuer JOEs Mirrorachse 1450cdf0e10cSrcweir // entgegen der normalen Achse wird diese an die linke Seite des Objektes 1451cdf0e10cSrcweir // positioniert 1452cdf0e10cSrcweir long nOutMin = 0; 1453cdf0e10cSrcweir long nOutMax = 0; 1454cdf0e10cSrcweir long nMinLen = 0; 1455cdf0e10cSrcweir long nObjDst = 0; 1456cdf0e10cSrcweir long nOutHgt = 0; 1457cdf0e10cSrcweir OutputDevice* pOut = GetFirstOutputDevice(); //GetWin(0); 1458cdf0e10cSrcweir 1459cdf0e10cSrcweir // erstmal Darstellungsgrenzen bestimmen 1460cdf0e10cSrcweir if (pOut != NULL) 1461cdf0e10cSrcweir { 1462cdf0e10cSrcweir nMinLen = pOut->PixelToLogic(Size(0,50)).Height(); 1463cdf0e10cSrcweir nObjDst = pOut->PixelToLogic(Size(0,20)).Height(); 1464cdf0e10cSrcweir 1465cdf0e10cSrcweir long nDst = pOut->PixelToLogic(Size(0,10)).Height(); 1466cdf0e10cSrcweir 1467cdf0e10cSrcweir nOutMin = -pOut->GetMapMode().GetOrigin().Y(); 1468cdf0e10cSrcweir nOutMax = pOut->GetOutputSize().Height() - 1 + nOutMin; 1469cdf0e10cSrcweir nOutMin += nDst; 1470cdf0e10cSrcweir nOutMax -= nDst; 1471cdf0e10cSrcweir 1472cdf0e10cSrcweir if (nOutMax - nOutMin < nDst) 1473cdf0e10cSrcweir { 1474cdf0e10cSrcweir nOutMin += nOutMax + 1; 1475cdf0e10cSrcweir nOutMin /= 2; 1476cdf0e10cSrcweir nOutMin -= (nDst + 1) / 2; 1477cdf0e10cSrcweir nOutMax = nOutMin + nDst; 1478cdf0e10cSrcweir } 1479cdf0e10cSrcweir 1480cdf0e10cSrcweir nOutHgt = nOutMax - nOutMin; 1481cdf0e10cSrcweir 1482cdf0e10cSrcweir long nTemp = nOutHgt / 4; 1483cdf0e10cSrcweir if (nTemp > nMinLen) nMinLen = nTemp; 1484cdf0e10cSrcweir } 1485cdf0e10cSrcweir 1486cdf0e10cSrcweir // und dann die Markierungen oben und unten an das Objekt heften 1487cdf0e10cSrcweir basegfx::B2DRange aR; 1488cdf0e10cSrcweir for(sal_uInt32 nMark(0L); nMark < GetMarkedObjectCount(); nMark++) 1489cdf0e10cSrcweir { 1490cdf0e10cSrcweir SdrObject* pMark = GetMarkedObjectByIndex(nMark); 1491cdf0e10cSrcweir basegfx::B2DPolyPolygon aXPP(pMark->TakeXorPoly()); 1492cdf0e10cSrcweir aR.expand(basegfx::tools::getRange(aXPP)); 1493cdf0e10cSrcweir } 1494cdf0e10cSrcweir 1495cdf0e10cSrcweir basegfx::B2DPoint aCenter(aR.getCenter()); 1496cdf0e10cSrcweir long nMarkHgt = basegfx::fround(aR.getHeight()) - 1; 1497cdf0e10cSrcweir long nHgt = nMarkHgt + nObjDst * 2; 1498cdf0e10cSrcweir 1499cdf0e10cSrcweir if (nHgt < nMinLen) nHgt = nMinLen; 1500cdf0e10cSrcweir 1501cdf0e10cSrcweir long nY1 = basegfx::fround(aCenter.getY()) - (nHgt + 1) / 2; 1502cdf0e10cSrcweir long nY2 = nY1 + nHgt; 1503cdf0e10cSrcweir 1504cdf0e10cSrcweir if (pOut && (nMinLen > nOutHgt)) nMinLen = nOutHgt; 1505cdf0e10cSrcweir if (pOut) 1506cdf0e10cSrcweir { 1507cdf0e10cSrcweir if (nY1 < nOutMin) 1508cdf0e10cSrcweir { 1509cdf0e10cSrcweir nY1 = nOutMin; 1510cdf0e10cSrcweir if (nY2 < nY1 + nMinLen) nY2 = nY1 + nMinLen; 1511cdf0e10cSrcweir } 1512cdf0e10cSrcweir if (nY2 > nOutMax) 1513cdf0e10cSrcweir { 1514cdf0e10cSrcweir nY2 = nOutMax; 1515cdf0e10cSrcweir if (nY1 > nY2 - nMinLen) nY1 = nY2 - nMinLen; 1516cdf0e10cSrcweir } 1517cdf0e10cSrcweir } 1518cdf0e10cSrcweir 1519cdf0e10cSrcweir aRef1.X() = basegfx::fround(aR.getMinX()); // Initial Achse um 2/100mm nach links 1520cdf0e10cSrcweir aRef1.Y() = nY1; 1521cdf0e10cSrcweir aRef2.X() = aRef1.X(); 1522cdf0e10cSrcweir aRef2.Y() = nY2; 1523cdf0e10cSrcweir 1524cdf0e10cSrcweir // Markierungen einschalten 1525cdf0e10cSrcweir SetMarkHandles(); 1526cdf0e10cSrcweir 1527cdf0e10cSrcweir //HMHif (bVis) ShowMarkHdl(); 1528cdf0e10cSrcweir if (AreObjectsMarked()) MarkListHasChanged(); 1529cdf0e10cSrcweir 1530cdf0e10cSrcweir // SpiegelPolygone SOFORT zeigen 1531cdf0e10cSrcweir const SdrHdlList &aHdlList = GetHdlList(); 1532cdf0e10cSrcweir mpMirrorOverlay = new Impl3DMirrorConstructOverlay(*this); 1533cdf0e10cSrcweir mpMirrorOverlay->SetMirrorAxis(aHdlList.GetHdl(HDL_REF1)->GetPos(), aHdlList.GetHdl(HDL_REF2)->GetPos()); 1534cdf0e10cSrcweir //CreateMirrorPolygons (); 1535cdf0e10cSrcweir //ShowMirrorPolygons (aHdlList.GetHdl (HDL_REF1)->GetPos (), 1536cdf0e10cSrcweir // aHdlList.GetHdl (HDL_REF2)->GetPos ()); 1537cdf0e10cSrcweir } 1538cdf0e10cSrcweir } 1539cdf0e10cSrcweir 1540cdf0e10cSrcweir /************************************************************************* 1541cdf0e10cSrcweir |* 1542cdf0e10cSrcweir |* was passiert bei einer Mausbewegung, wenn das Objekt erstellt wird ? 1543cdf0e10cSrcweir |* 1544cdf0e10cSrcweir \************************************************************************/ 1545cdf0e10cSrcweir 1546cdf0e10cSrcweir void E3dView::MovAction(const Point& rPnt) 1547cdf0e10cSrcweir { 1548cdf0e10cSrcweir if(Is3DRotationCreationActive()) 1549cdf0e10cSrcweir { 1550cdf0e10cSrcweir SdrHdl* pHdl = GetDragHdl(); 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir if (pHdl) 1553cdf0e10cSrcweir { 1554cdf0e10cSrcweir SdrHdlKind eHdlKind = pHdl->GetKind(); 1555cdf0e10cSrcweir 1556cdf0e10cSrcweir // reagiere nur bei einer spiegelachse 1557cdf0e10cSrcweir if ((eHdlKind == HDL_REF1) || 1558cdf0e10cSrcweir (eHdlKind == HDL_REF2) || 1559cdf0e10cSrcweir (eHdlKind == HDL_MIRX)) 1560cdf0e10cSrcweir { 1561cdf0e10cSrcweir const SdrHdlList &aHdlList = GetHdlList (); 1562cdf0e10cSrcweir 1563cdf0e10cSrcweir // loesche das gespiegelte Polygon, spiegele das Original und zeichne es neu 1564cdf0e10cSrcweir //ShowMirrored (); 1565cdf0e10cSrcweir SdrView::MovAction (rPnt); 1566cdf0e10cSrcweir mpMirrorOverlay->SetMirrorAxis( 1567cdf0e10cSrcweir aHdlList.GetHdl (HDL_REF1)->GetPos(), 1568cdf0e10cSrcweir aHdlList.GetHdl (HDL_REF2)->GetPos()); 1569cdf0e10cSrcweir } 1570cdf0e10cSrcweir } 1571cdf0e10cSrcweir else 1572cdf0e10cSrcweir { 1573cdf0e10cSrcweir SdrView::MovAction (rPnt); 1574cdf0e10cSrcweir } 1575cdf0e10cSrcweir } 1576cdf0e10cSrcweir else 1577cdf0e10cSrcweir { 1578cdf0e10cSrcweir SdrView::MovAction (rPnt); 1579cdf0e10cSrcweir } 1580cdf0e10cSrcweir } 1581cdf0e10cSrcweir 1582cdf0e10cSrcweir /************************************************************************* 1583cdf0e10cSrcweir |* 1584cdf0e10cSrcweir |* Schluss. Objekt und evtl. Unterobjekte ueber ImpCreate3DLathe erstellen 1585cdf0e10cSrcweir |* [FG] Mit dem Parameterwert sal_True (SDefault: sal_False) wird einfach ein 1586cdf0e10cSrcweir |* Rotationskoerper erzeugt, ohne den Benutzer die Lage der 1587cdf0e10cSrcweir |* Achse fetlegen zu lassen. Es reicht dieser Aufruf, falls 1588cdf0e10cSrcweir |* ein Objekt selektiert ist. (keine Initialisierung noetig) 1589cdf0e10cSrcweir |* 1590cdf0e10cSrcweir \************************************************************************/ 1591cdf0e10cSrcweir 1592cdf0e10cSrcweir void E3dView::End3DCreation(sal_Bool bUseDefaultValuesForMirrorAxes) 1593cdf0e10cSrcweir { 1594cdf0e10cSrcweir ResetCreationActive(); 1595cdf0e10cSrcweir 1596cdf0e10cSrcweir if(AreObjectsMarked()) 1597cdf0e10cSrcweir { 1598cdf0e10cSrcweir if(bUseDefaultValuesForMirrorAxes) 1599cdf0e10cSrcweir { 1600cdf0e10cSrcweir Rectangle aRect = GetAllMarkedRect(); 1601cdf0e10cSrcweir if(aRect.GetWidth() <= 1) 1602cdf0e10cSrcweir aRect.SetSize(Size(500, aRect.GetHeight())); 1603cdf0e10cSrcweir if(aRect.GetHeight() <= 1) 1604cdf0e10cSrcweir aRect.SetSize(Size(aRect.GetWidth(), 500)); 1605cdf0e10cSrcweir 1606cdf0e10cSrcweir basegfx::B2DPoint aPnt1(aRect.Left(), -aRect.Top()); 1607cdf0e10cSrcweir basegfx::B2DPoint aPnt2(aRect.Left(), -aRect.Bottom()); 1608cdf0e10cSrcweir 1609cdf0e10cSrcweir ConvertMarkedObjTo3D(sal_False, aPnt1, aPnt2); 1610cdf0e10cSrcweir } 1611cdf0e10cSrcweir else 1612cdf0e10cSrcweir { 1613cdf0e10cSrcweir // Hilfsfigur ausschalten 1614cdf0e10cSrcweir // bestimme aus den Handlepositionen und den Versatz der Punkte 1615cdf0e10cSrcweir const SdrHdlList &aHdlList = GetHdlList(); 1616cdf0e10cSrcweir Point aMirrorRef1 = aHdlList.GetHdl(HDL_REF1)->GetPos(); 1617cdf0e10cSrcweir Point aMirrorRef2 = aHdlList.GetHdl(HDL_REF2)->GetPos(); 1618cdf0e10cSrcweir 1619cdf0e10cSrcweir basegfx::B2DPoint aPnt1(aMirrorRef1.X(), -aMirrorRef1.Y()); 1620cdf0e10cSrcweir basegfx::B2DPoint aPnt2(aMirrorRef2.X(), -aMirrorRef2.Y()); 1621cdf0e10cSrcweir 1622cdf0e10cSrcweir ConvertMarkedObjTo3D(sal_False, aPnt1, aPnt2); 1623cdf0e10cSrcweir } 1624cdf0e10cSrcweir } 1625cdf0e10cSrcweir } 1626cdf0e10cSrcweir 1627cdf0e10cSrcweir /************************************************************************* 1628cdf0e10cSrcweir |* 1629cdf0e10cSrcweir |* Destruktor 1630cdf0e10cSrcweir |* 1631cdf0e10cSrcweir \************************************************************************/ 1632cdf0e10cSrcweir 1633cdf0e10cSrcweir E3dView::~E3dView () 1634cdf0e10cSrcweir { 1635cdf0e10cSrcweir } 1636cdf0e10cSrcweir 1637cdf0e10cSrcweir /************************************************************************* 1638cdf0e10cSrcweir |* 1639cdf0e10cSrcweir |* beende das erzeugen und loesche die polygone 1640cdf0e10cSrcweir |* 1641cdf0e10cSrcweir \************************************************************************/ 1642cdf0e10cSrcweir 1643cdf0e10cSrcweir void E3dView::ResetCreationActive () 1644cdf0e10cSrcweir { 1645cdf0e10cSrcweir if(mpMirrorOverlay) 1646cdf0e10cSrcweir { 1647cdf0e10cSrcweir delete mpMirrorOverlay; 1648cdf0e10cSrcweir mpMirrorOverlay = 0L; 1649cdf0e10cSrcweir } 1650cdf0e10cSrcweir } 1651cdf0e10cSrcweir 1652cdf0e10cSrcweir /************************************************************************* 1653cdf0e10cSrcweir |* 1654cdf0e10cSrcweir |* Klasse initialisieren 1655cdf0e10cSrcweir |* 1656cdf0e10cSrcweir \************************************************************************/ 1657cdf0e10cSrcweir 1658cdf0e10cSrcweir void E3dView::InitView () 1659cdf0e10cSrcweir { 1660cdf0e10cSrcweir eDragConstraint = E3DDRAG_CONSTR_XYZ; 1661cdf0e10cSrcweir fDefaultScaleX = 1662cdf0e10cSrcweir fDefaultScaleY = 1663cdf0e10cSrcweir fDefaultScaleZ = 1.0; 1664cdf0e10cSrcweir fDefaultRotateX = 1665cdf0e10cSrcweir fDefaultRotateY = 1666cdf0e10cSrcweir fDefaultRotateZ = 0.0; 1667cdf0e10cSrcweir fDefaultExtrusionDeepth = 1000; // old: 2000; 1668cdf0e10cSrcweir fDefaultLightIntensity = 0.8; // old: 0.6; 1669cdf0e10cSrcweir fDefaultAmbientIntensity = 0.4; 1670cdf0e10cSrcweir nHDefaultSegments = 12; 1671cdf0e10cSrcweir nVDefaultSegments = 12; 1672cdf0e10cSrcweir aDefaultLightColor = RGB_Color(COL_WHITE); 1673cdf0e10cSrcweir aDefaultAmbientColor = RGB_Color(COL_BLACK); 1674cdf0e10cSrcweir bDoubleSided = sal_False; 1675cdf0e10cSrcweir mpMirrorOverlay = 0L; 1676cdf0e10cSrcweir } 1677cdf0e10cSrcweir 1678cdf0e10cSrcweir /************************************************************************* 1679cdf0e10cSrcweir |* 1680cdf0e10cSrcweir |* Koennen die selektierten Objekte aufgebrochen werden? 1681cdf0e10cSrcweir |* 1682cdf0e10cSrcweir \************************************************************************/ 1683cdf0e10cSrcweir 1684cdf0e10cSrcweir sal_Bool E3dView::IsBreak3DObjPossible() const 1685cdf0e10cSrcweir { 1686cdf0e10cSrcweir sal_uIntPtr nCount = GetMarkedObjectCount(); 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir if (nCount > 0) 1689cdf0e10cSrcweir { 1690cdf0e10cSrcweir sal_uIntPtr i = 0; 1691cdf0e10cSrcweir 1692cdf0e10cSrcweir while (i < nCount) 1693cdf0e10cSrcweir { 1694cdf0e10cSrcweir SdrObject* pObj = GetMarkedObjectByIndex(i); 1695cdf0e10cSrcweir 1696cdf0e10cSrcweir if (pObj && pObj->ISA(E3dObject)) 1697cdf0e10cSrcweir { 1698cdf0e10cSrcweir if(!(((E3dObject*)pObj)->IsBreakObjPossible())) 1699cdf0e10cSrcweir return sal_False; 1700cdf0e10cSrcweir } 1701cdf0e10cSrcweir else 1702cdf0e10cSrcweir { 1703cdf0e10cSrcweir return sal_False; 1704cdf0e10cSrcweir } 1705cdf0e10cSrcweir 1706cdf0e10cSrcweir i++; 1707cdf0e10cSrcweir } 1708cdf0e10cSrcweir } 1709cdf0e10cSrcweir else 1710cdf0e10cSrcweir { 1711cdf0e10cSrcweir return sal_False; 1712cdf0e10cSrcweir } 1713cdf0e10cSrcweir 1714cdf0e10cSrcweir return sal_True; 1715cdf0e10cSrcweir } 1716cdf0e10cSrcweir 1717cdf0e10cSrcweir /************************************************************************* 1718cdf0e10cSrcweir |* 1719cdf0e10cSrcweir |* Selektierte Lathe-Objekte aufbrechen 1720cdf0e10cSrcweir |* 1721cdf0e10cSrcweir \************************************************************************/ 1722cdf0e10cSrcweir 1723cdf0e10cSrcweir void E3dView::Break3DObj() 1724cdf0e10cSrcweir { 1725cdf0e10cSrcweir if(IsBreak3DObjPossible()) 1726cdf0e10cSrcweir { 1727cdf0e10cSrcweir // ALLE selektierten Objekte werden gewandelt 1728cdf0e10cSrcweir sal_uInt32 nCount = GetMarkedObjectCount(); 1729cdf0e10cSrcweir 1730cdf0e10cSrcweir BegUndo(String(SVX_RESSTR(RID_SVX_3D_UNDO_BREAK_LATHE))); 1731cdf0e10cSrcweir for(sal_uInt32 a=0;a<nCount;a++) 1732cdf0e10cSrcweir { 1733cdf0e10cSrcweir E3dObject* pObj = (E3dObject*)GetMarkedObjectByIndex(a); 1734cdf0e10cSrcweir BreakSingle3DObj(pObj); 1735cdf0e10cSrcweir } 1736cdf0e10cSrcweir DeleteMarked(); 1737cdf0e10cSrcweir EndUndo(); 1738cdf0e10cSrcweir } 1739cdf0e10cSrcweir } 1740cdf0e10cSrcweir 1741cdf0e10cSrcweir void E3dView::BreakSingle3DObj(E3dObject* pObj) 1742cdf0e10cSrcweir { 1743cdf0e10cSrcweir if(pObj->ISA(E3dScene)) 1744cdf0e10cSrcweir { 1745cdf0e10cSrcweir SdrObjList* pSubList = pObj->GetSubList(); 1746cdf0e10cSrcweir SdrObjListIter aIter(*pSubList, IM_FLAT); 1747cdf0e10cSrcweir 1748cdf0e10cSrcweir while(aIter.IsMore()) 1749cdf0e10cSrcweir { 1750cdf0e10cSrcweir E3dObject* pSubObj = (E3dObject*)aIter.Next(); 1751cdf0e10cSrcweir BreakSingle3DObj(pSubObj); 1752cdf0e10cSrcweir } 1753cdf0e10cSrcweir } 1754cdf0e10cSrcweir else 1755cdf0e10cSrcweir { 1756cdf0e10cSrcweir SdrAttrObj* pNewObj = pObj->GetBreakObj(); 1757cdf0e10cSrcweir if(pNewObj) 1758cdf0e10cSrcweir { 1759cdf0e10cSrcweir InsertObjectAtView(pNewObj, *GetSdrPageView(), SDRINSERT_DONTMARK); 1760cdf0e10cSrcweir pNewObj->SetChanged(); 1761cdf0e10cSrcweir pNewObj->BroadcastObjectChange(); 1762cdf0e10cSrcweir } 1763cdf0e10cSrcweir } 1764cdf0e10cSrcweir } 1765cdf0e10cSrcweir 1766cdf0e10cSrcweir /************************************************************************* 1767cdf0e10cSrcweir |* 1768cdf0e10cSrcweir |* Szenen mischen 1769cdf0e10cSrcweir |* 1770cdf0e10cSrcweir \************************************************************************/ 1771cdf0e10cSrcweir 1772cdf0e10cSrcweir void E3dView::MergeScenes () 1773cdf0e10cSrcweir { 1774cdf0e10cSrcweir sal_uIntPtr nCount = GetMarkedObjectCount(); 1775cdf0e10cSrcweir 1776cdf0e10cSrcweir if (nCount > 0) 1777cdf0e10cSrcweir { 1778cdf0e10cSrcweir sal_uIntPtr nObj = 0; 1779cdf0e10cSrcweir SdrObject *pObj = GetMarkedObjectByIndex(nObj); 1780cdf0e10cSrcweir E3dScene *pScene = new E3dPolyScene(Get3DDefaultAttributes()); 1781cdf0e10cSrcweir basegfx::B3DRange aBoundVol; 1782cdf0e10cSrcweir Rectangle aAllBoundRect (GetMarkedObjBoundRect ()); 1783cdf0e10cSrcweir Point aCenter (aAllBoundRect.Center()); 1784cdf0e10cSrcweir 1785cdf0e10cSrcweir while (pObj) 1786cdf0e10cSrcweir { 1787cdf0e10cSrcweir if (pObj->ISA(E3dScene)) 1788cdf0e10cSrcweir { 1789cdf0e10cSrcweir /********************************************************** 1790cdf0e10cSrcweir * Es ist eine 3D-Scene oder 3D-PolyScene 1791cdf0e10cSrcweir **********************************************************/ 1792cdf0e10cSrcweir SdrObjList* pSubList = ((E3dObject*) pObj)->GetSubList(); 1793cdf0e10cSrcweir 1794cdf0e10cSrcweir SdrObjListIter aIter(*pSubList, IM_FLAT); 1795cdf0e10cSrcweir 1796cdf0e10cSrcweir while (aIter.IsMore()) 1797cdf0e10cSrcweir { 1798cdf0e10cSrcweir /****************************************************** 1799cdf0e10cSrcweir * LatheObjekte suchen 1800cdf0e10cSrcweir ******************************************************/ 1801cdf0e10cSrcweir SdrObject* pSubObj = aIter.Next(); 1802cdf0e10cSrcweir 1803cdf0e10cSrcweir E3dObject *pNewObj = 0; 1804cdf0e10cSrcweir 1805cdf0e10cSrcweir switch (pSubObj->GetObjIdentifier()) 1806cdf0e10cSrcweir { 1807cdf0e10cSrcweir case E3D_CUBEOBJ_ID : 1808cdf0e10cSrcweir pNewObj = new E3dCubeObj; 1809cdf0e10cSrcweir *(E3dCubeObj*)pNewObj = *(E3dCubeObj*)pSubObj; 1810cdf0e10cSrcweir break; 1811cdf0e10cSrcweir 1812cdf0e10cSrcweir case E3D_SPHEREOBJ_ID: 1813cdf0e10cSrcweir pNewObj = new E3dSphereObj; 1814cdf0e10cSrcweir *(E3dSphereObj*)pNewObj = *(E3dSphereObj*)pSubObj; 1815cdf0e10cSrcweir break; 1816cdf0e10cSrcweir 1817cdf0e10cSrcweir case E3D_EXTRUDEOBJ_ID: 1818cdf0e10cSrcweir pNewObj = new E3dExtrudeObj; 1819cdf0e10cSrcweir *(E3dExtrudeObj*)pNewObj = *(E3dExtrudeObj*)pSubObj; 1820cdf0e10cSrcweir break; 1821cdf0e10cSrcweir 1822cdf0e10cSrcweir case E3D_LATHEOBJ_ID: 1823cdf0e10cSrcweir pNewObj = new E3dLatheObj; 1824cdf0e10cSrcweir *(E3dLatheObj*)pNewObj = *(E3dLatheObj*)pSubObj; 1825cdf0e10cSrcweir break; 1826cdf0e10cSrcweir 1827cdf0e10cSrcweir case E3D_COMPOUNDOBJ_ID: 1828cdf0e10cSrcweir pNewObj = new E3dCompoundObject; 1829cdf0e10cSrcweir *(E3dCompoundObject*)pNewObj = *(E3dCompoundObject*)pSubObj; 1830cdf0e10cSrcweir break; 1831cdf0e10cSrcweir } 1832cdf0e10cSrcweir 1833cdf0e10cSrcweir Rectangle aBoundRect = pSubObj->GetCurrentBoundRect(); 1834cdf0e10cSrcweir 1835cdf0e10cSrcweir basegfx::B3DHomMatrix aMatrix; 1836cdf0e10cSrcweir aMatrix.translate(aBoundRect.Left() - aCenter.getX(), aCenter.getY(), 0.0); 1837cdf0e10cSrcweir pNewObj->SetTransform(aMatrix * pNewObj->GetTransform()); // #112587# 1838cdf0e10cSrcweir 1839cdf0e10cSrcweir if (pNewObj) aBoundVol.expand(pNewObj->GetBoundVolume()); 1840cdf0e10cSrcweir pScene->Insert3DObj (pNewObj); 1841cdf0e10cSrcweir } 1842cdf0e10cSrcweir } 1843cdf0e10cSrcweir 1844cdf0e10cSrcweir nObj++; 1845cdf0e10cSrcweir 1846cdf0e10cSrcweir if (nObj < nCount) 1847cdf0e10cSrcweir { 1848cdf0e10cSrcweir pObj = GetMarkedObjectByIndex(nObj); 1849cdf0e10cSrcweir } 1850cdf0e10cSrcweir else 1851cdf0e10cSrcweir { 1852cdf0e10cSrcweir pObj = NULL; 1853cdf0e10cSrcweir } 1854cdf0e10cSrcweir } 1855cdf0e10cSrcweir 1856cdf0e10cSrcweir double fW = aAllBoundRect.GetWidth(); 1857cdf0e10cSrcweir double fH = aAllBoundRect.GetHeight(); 1858cdf0e10cSrcweir Rectangle aRect(0,0, (long) fW, (long) fH); 1859cdf0e10cSrcweir 1860cdf0e10cSrcweir InitScene(pScene, fW, fH, aBoundVol.getMaxZ() + + ((fW + fH) / 4.0)); 1861cdf0e10cSrcweir pScene->NbcSetSnapRect(aRect); 1862cdf0e10cSrcweir 1863cdf0e10cSrcweir Camera3D &aCamera = (Camera3D&) pScene->GetCamera (); 1864cdf0e10cSrcweir basegfx::B3DPoint aMinVec(aBoundVol.getMinimum()); 1865cdf0e10cSrcweir basegfx::B3DPoint aMaxVec(aBoundVol.getMaximum()); 1866cdf0e10cSrcweir double fDeepth(fabs(aMaxVec.getZ() - aMinVec.getZ())); 1867cdf0e10cSrcweir 1868cdf0e10cSrcweir aCamera.SetPRP(basegfx::B3DPoint(0.0, 0.0, 1000.0)); 1869cdf0e10cSrcweir double fDefaultCamPosZ(GetDefaultCamPosZ()); 1870cdf0e10cSrcweir aCamera.SetPosition(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ + fDeepth / 2.0)); 1871cdf0e10cSrcweir aCamera.SetFocalLength(GetDefaultCamFocal()); 1872cdf0e10cSrcweir pScene->SetCamera (aCamera); 1873cdf0e10cSrcweir 1874cdf0e10cSrcweir // SnapRects der Objekte ungueltig 1875cdf0e10cSrcweir pScene->SetRectsDirty(); 1876cdf0e10cSrcweir 1877cdf0e10cSrcweir InsertObjectAtView(pScene, *(GetSdrPageViewOfMarkedByIndex(0))); 1878cdf0e10cSrcweir 1879cdf0e10cSrcweir // SnapRects der Objekte ungueltig 1880cdf0e10cSrcweir pScene->SetRectsDirty(); 1881cdf0e10cSrcweir } 1882cdf0e10cSrcweir } 1883cdf0e10cSrcweir 1884cdf0e10cSrcweir /************************************************************************* 1885cdf0e10cSrcweir |* 1886cdf0e10cSrcweir |* Possibilities, hauptsaechlich gruppieren/ungruppieren 1887cdf0e10cSrcweir |* 1888cdf0e10cSrcweir \************************************************************************/ 1889cdf0e10cSrcweir void E3dView::CheckPossibilities() 1890cdf0e10cSrcweir { 1891cdf0e10cSrcweir // call parent 1892cdf0e10cSrcweir SdrView::CheckPossibilities(); 1893cdf0e10cSrcweir 1894cdf0e10cSrcweir // Weitere Flags bewerten 1895cdf0e10cSrcweir if(bGroupPossible || bUnGroupPossible || bGrpEnterPossible) 1896cdf0e10cSrcweir { 1897cdf0e10cSrcweir sal_Int32 nMarkCnt = GetMarkedObjectCount(); 1898cdf0e10cSrcweir sal_Bool bCoumpound = sal_False; 1899cdf0e10cSrcweir sal_Bool b3DObject = sal_False; 1900cdf0e10cSrcweir for(sal_Int32 nObjs = 0L; (nObjs < nMarkCnt) && !bCoumpound; nObjs++) 1901cdf0e10cSrcweir { 1902cdf0e10cSrcweir SdrObject *pObj = GetMarkedObjectByIndex(nObjs); 1903cdf0e10cSrcweir if(pObj && pObj->ISA(E3dCompoundObject)) 1904cdf0e10cSrcweir bCoumpound = sal_True; 1905cdf0e10cSrcweir if(pObj && pObj->ISA(E3dObject)) 1906cdf0e10cSrcweir b3DObject = sal_True; 1907cdf0e10cSrcweir } 1908cdf0e10cSrcweir 1909cdf0e10cSrcweir // Bisher: Es sind ZWEI oder mehr beliebiger Objekte selektiert. 1910cdf0e10cSrcweir // Nachsehen, ob CompoundObjects beteiligt sind. Falls ja, 1911cdf0e10cSrcweir // das Gruppieren verbieten. 1912cdf0e10cSrcweir if(bGroupPossible && bCoumpound) 1913cdf0e10cSrcweir bGroupPossible = sal_False; 1914cdf0e10cSrcweir 1915cdf0e10cSrcweir if(bUnGroupPossible && b3DObject) 1916cdf0e10cSrcweir bUnGroupPossible = sal_False; 1917cdf0e10cSrcweir 1918cdf0e10cSrcweir if(bGrpEnterPossible && bCoumpound) 1919cdf0e10cSrcweir bGrpEnterPossible = sal_False; 1920cdf0e10cSrcweir } 1921cdf0e10cSrcweir } 1922cdf0e10cSrcweir 1923cdf0e10cSrcweir // eof 1924