1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svx.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <svx/svdcrtv.hxx> 32*cdf0e10cSrcweir #include "svx/xattr.hxx" 33*cdf0e10cSrcweir #include <svx/svdundo.hxx> 34*cdf0e10cSrcweir #include <svx/svdocapt.hxx> // Spezialbehandlung: Nach dem Create transparente Fuellung 35*cdf0e10cSrcweir #include <svx/svdoedge.hxx> 36*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 37*cdf0e10cSrcweir #include <svx/svdpage.hxx> 38*cdf0e10cSrcweir #include <svx/svdetc.hxx> 39*cdf0e10cSrcweir #include <svx/scene3d.hxx> 40*cdf0e10cSrcweir #include <svx/view3d.hxx> 41*cdf0e10cSrcweir #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> 42*cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx> 43*cdf0e10cSrcweir #include <svx/svdouno.hxx> 44*cdf0e10cSrcweir #define XOR_CREATE_PEN PEN_SOLID 45*cdf0e10cSrcweir #include <svx/svdopath.hxx> 46*cdf0e10cSrcweir #include <svx/sdr/overlay/overlaypolypolygon.hxx> 47*cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx> 48*cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx> 49*cdf0e10cSrcweir #include "fmobj.hxx" 50*cdf0e10cSrcweir #include <svx/svdocirc.hxx> 51*cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx> 52*cdf0e10cSrcweir #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> 53*cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx> 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir class ImplConnectMarkerOverlay 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir // The OverlayObjects 60*cdf0e10cSrcweir ::sdr::overlay::OverlayObjectList maObjects; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir // The remembered target object 63*cdf0e10cSrcweir const SdrObject& mrObject; 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir public: 66*cdf0e10cSrcweir ImplConnectMarkerOverlay(const SdrCreateView& rView, SdrObject& rObject); 67*cdf0e10cSrcweir ~ImplConnectMarkerOverlay(); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir const SdrObject& GetTargetObject() const { return mrObject; } 70*cdf0e10cSrcweir }; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, SdrObject& rObject) 73*cdf0e10cSrcweir : mrObject(rObject) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir basegfx::B2DPolyPolygon aB2DPolyPolygon(rObject.TakeXorPoly()); 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); 80*cdf0e10cSrcweir ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir if(pTargetOverlay) 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir Size aHalfLogicSize(pTargetOverlay->getOutputDevice().PixelToLogic(Size(4, 4))); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir // object 87*cdf0e10cSrcweir ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aB2DPolyPolygon); 88*cdf0e10cSrcweir pTargetOverlay->add(*pNew); 89*cdf0e10cSrcweir maObjects.append(*pNew); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir // gluepoints 92*cdf0e10cSrcweir if(rView.IsAutoVertexConnectors()) 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir for(sal_uInt16 i(0); i < 4; i++) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir SdrGluePoint aGluePoint(rObject.GetVertexGluePoint(i)); 97*cdf0e10cSrcweir const Point& rPosition = aGluePoint.GetAbsolutePos(rObject); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir basegfx::B2DPoint aTopLeft(rPosition.X() - aHalfLogicSize.Width(), rPosition.Y() - aHalfLogicSize.Height()); 100*cdf0e10cSrcweir basegfx::B2DPoint aBottomRight(rPosition.X() + aHalfLogicSize.Width(), rPosition.Y() + aHalfLogicSize.Height()); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir basegfx::B2DPolygon aTempPoly; 103*cdf0e10cSrcweir aTempPoly.append(aTopLeft); 104*cdf0e10cSrcweir aTempPoly.append(basegfx::B2DPoint(aBottomRight.getX(), aTopLeft.getY())); 105*cdf0e10cSrcweir aTempPoly.append(aBottomRight); 106*cdf0e10cSrcweir aTempPoly.append(basegfx::B2DPoint(aTopLeft.getX(), aBottomRight.getY())); 107*cdf0e10cSrcweir aTempPoly.setClosed(true); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir basegfx::B2DPolyPolygon aTempPolyPoly; 110*cdf0e10cSrcweir aTempPolyPoly.append(aTempPoly); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aTempPolyPoly); 113*cdf0e10cSrcweir pTargetOverlay->add(*pNew); 114*cdf0e10cSrcweir maObjects.append(*pNew); 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir } 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir ImplConnectMarkerOverlay::~ImplConnectMarkerOverlay() 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir // The OverlayObjects are cleared using the destructor of OverlayObjectList. 124*cdf0e10cSrcweir // That destructor calls clear() at the list which removes all objects from the 125*cdf0e10cSrcweir // OverlayManager and deletes them. 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir class ImpSdrCreateViewExtraData 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir // The OverlayObjects for XOR replacement 133*cdf0e10cSrcweir ::sdr::overlay::OverlayObjectList maObjects; 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir public: 136*cdf0e10cSrcweir ImpSdrCreateViewExtraData(); 137*cdf0e10cSrcweir ~ImpSdrCreateViewExtraData(); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir void CreateAndShowOverlay(const SdrCreateView& rView, const SdrObject* pObject, const basegfx::B2DPolyPolygon& rPolyPoly); 140*cdf0e10cSrcweir void HideOverlay(); 141*cdf0e10cSrcweir }; 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir ImpSdrCreateViewExtraData::ImpSdrCreateViewExtraData() 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir ImpSdrCreateViewExtraData::~ImpSdrCreateViewExtraData() 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir HideOverlay(); 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir void ImpSdrCreateViewExtraData::CreateAndShowOverlay(const SdrCreateView& rView, const SdrObject* pObject, const basegfx::B2DPolyPolygon& rPolyPoly) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); 157*cdf0e10cSrcweir ::sdr::overlay::OverlayManager* pOverlayManager = pCandidate->GetOverlayManager(); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir if(pOverlayManager) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir if(pObject) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir const sdr::contact::ViewContact& rVC = pObject->GetViewContact(); 164*cdf0e10cSrcweir const drawinglayer::primitive2d::Primitive2DSequence aSequence = rVC.getViewIndependentPrimitive2DSequence(); 165*cdf0e10cSrcweir sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir pOverlayManager->add(*pNew); 168*cdf0e10cSrcweir maObjects.append(*pNew); 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir if(rPolyPoly.count()) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(rPolyPoly); 174*cdf0e10cSrcweir pOverlayManager->add(*pNew); 175*cdf0e10cSrcweir maObjects.append(*pNew); 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir void ImpSdrCreateViewExtraData::HideOverlay() 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir // the clear() call at the list removes all objects from the 184*cdf0e10cSrcweir // OverlayManager and deletes them. 185*cdf0e10cSrcweir maObjects.clear(); 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 189*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 190*cdf0e10cSrcweir // 191*cdf0e10cSrcweir // @@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@ 192*cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ 193*cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ 194*cdf0e10cSrcweir // @@ @@@@@ @@@@ @@@@@@ @@ @@@@ @@@@@ @@ @@@@ @@@@@@@ 195*cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@ 196*cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ 197*cdf0e10cSrcweir // @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@ 198*cdf0e10cSrcweir // 199*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 200*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir void SdrCreateView::ImpClearConnectMarker() 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir if(mpCoMaOverlay) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir delete mpCoMaOverlay; 207*cdf0e10cSrcweir mpCoMaOverlay = 0L; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir void SdrCreateView::ImpClearVars() 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir nAktInvent=SdrInventor; 214*cdf0e10cSrcweir nAktIdent=OBJ_NONE; 215*cdf0e10cSrcweir pAktCreate=NULL; 216*cdf0e10cSrcweir pCreatePV=NULL; 217*cdf0e10cSrcweir bAutoTextEdit=sal_False; 218*cdf0e10cSrcweir b1stPointAsCenter=sal_False; 219*cdf0e10cSrcweir aAktCreatePointer=Pointer(POINTER_CROSS); 220*cdf0e10cSrcweir bUseIncompatiblePathCreateInterface=sal_False; 221*cdf0e10cSrcweir bAutoClosePolys=sal_True; 222*cdf0e10cSrcweir nAutoCloseDistPix=5; 223*cdf0e10cSrcweir nFreeHandMinDistPix=10; 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir ImpClearConnectMarker(); 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir void SdrCreateView::ImpMakeCreateAttr() 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir SdrCreateView::SdrCreateView(SdrModel* pModel1, OutputDevice* pOut) 233*cdf0e10cSrcweir : SdrDragView(pModel1,pOut), 234*cdf0e10cSrcweir mpCoMaOverlay(0L), 235*cdf0e10cSrcweir mpCreateViewExtraData(new ImpSdrCreateViewExtraData()) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir ImpClearVars(); 238*cdf0e10cSrcweir ImpMakeCreateAttr(); 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir SdrCreateView::~SdrCreateView() 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir ImpClearConnectMarker(); 244*cdf0e10cSrcweir delete mpCreateViewExtraData; 245*cdf0e10cSrcweir SdrObject::Free( pAktCreate ); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir void SdrCreateView::ImpDelCreateAttr() 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir sal_Bool SdrCreateView::IsAction() const 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir return SdrDragView::IsAction() || pAktCreate!=NULL; 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir void SdrCreateView::MovAction(const Point& rPnt) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir SdrDragView::MovAction(rPnt); 260*cdf0e10cSrcweir if (pAktCreate!=NULL) { 261*cdf0e10cSrcweir MovCreateObj(rPnt); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir void SdrCreateView::EndAction() 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir if (pAktCreate!=NULL) EndCreateObj(SDRCREATE_FORCEEND); 268*cdf0e10cSrcweir SdrDragView::EndAction(); 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir void SdrCreateView::BckAction() 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir if (pAktCreate!=NULL) BckCreateObj(); 274*cdf0e10cSrcweir SdrDragView::BckAction(); 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir void SdrCreateView::BrkAction() 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir SdrDragView::BrkAction(); 280*cdf0e10cSrcweir BrkCreateObj(); 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir void SdrCreateView::TakeActionRect(Rectangle& rRect) const 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir if (pAktCreate!=NULL) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir rRect=aDragStat.GetActionRect(); 288*cdf0e10cSrcweir if (rRect.IsEmpty()) 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir rRect=Rectangle(aDragStat.GetPrev(),aDragStat.GetNow()); 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir else 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir SdrDragView::TakeActionRect(rRect); 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir sal_Bool SdrCreateView::CheckEdgeMode() 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir sal_uInt32 nInv=nAktInvent; 302*cdf0e10cSrcweir sal_uInt16 nIdn=nAktIdent; 303*cdf0e10cSrcweir if (pAktCreate!=NULL) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir nInv=pAktCreate->GetObjInventor(); 306*cdf0e10cSrcweir nIdn=pAktCreate->GetObjIdentifier(); 307*cdf0e10cSrcweir // wird vom EdgeObj gemanaged 308*cdf0e10cSrcweir if (nAktInvent==SdrInventor && nAktIdent==OBJ_EDGE) return sal_False; 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir if (!IsCreateMode() || nAktInvent!=SdrInventor || nAktIdent!=OBJ_EDGE) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir ImpClearConnectMarker(); 314*cdf0e10cSrcweir return sal_False; 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir else 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir // sal_True heisst: MouseMove soll Connect checken 319*cdf0e10cSrcweir return !IsAction(); 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir void SdrCreateView::SetConnectMarker(const SdrObjConnection& rCon, const SdrPageView& /*rPV*/) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir SdrObject* pTargetObject = rCon.pObj; 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir if(pTargetObject) 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir // if target object changes, throw away overlay object to make room for changes 330*cdf0e10cSrcweir if(mpCoMaOverlay && pTargetObject != &mpCoMaOverlay->GetTargetObject()) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir ImpClearConnectMarker(); 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir if(!mpCoMaOverlay) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir mpCoMaOverlay = new ImplConnectMarkerOverlay(*this, *pTargetObject); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir else 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir ImpClearConnectMarker(); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir void SdrCreateView::HideConnectMarker() 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir ImpClearConnectMarker(); 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir sal_Bool SdrCreateView::MouseMove(const MouseEvent& rMEvt, Window* pWin) 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir if(CheckEdgeMode() && pWin) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir SdrPageView* pPV = GetSdrPageView(); 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir if(pPV) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir // Defaultete Hit-Toleranz bei IsMarkedHit() mal aendern !!!! 360*cdf0e10cSrcweir Point aPos(pWin->PixelToLogic(rMEvt.GetPosPixel())); 361*cdf0e10cSrcweir sal_Bool bMarkHit=PickHandle(aPos)!=NULL || IsMarkedObjHit(aPos); 362*cdf0e10cSrcweir SdrObjConnection aCon; 363*cdf0e10cSrcweir if (!bMarkHit) SdrEdgeObj::ImpFindConnector(aPos,*pPV,aCon,NULL,pWin); 364*cdf0e10cSrcweir SetConnectMarker(aCon,*pPV); 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir return SdrDragView::MouseMove(rMEvt,pWin); 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir sal_Bool SdrCreateView::IsTextTool() const 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir return eEditMode==SDREDITMODE_CREATE && nAktInvent==SdrInventor && (nAktIdent==OBJ_TEXT || nAktIdent==OBJ_TEXTEXT || nAktIdent==OBJ_TITLETEXT || nAktIdent==OBJ_OUTLINETEXT); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir sal_Bool SdrCreateView::IsEdgeTool() const 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir return eEditMode==SDREDITMODE_CREATE && nAktInvent==SdrInventor && (nAktIdent==OBJ_EDGE); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir sal_Bool SdrCreateView::IsMeasureTool() const 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir return eEditMode==SDREDITMODE_CREATE && nAktInvent==SdrInventor && (nAktIdent==OBJ_MEASURE); 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir void SdrCreateView::SetCurrentObj(sal_uInt16 nIdent, sal_uInt32 nInvent) 386*cdf0e10cSrcweir { 387*cdf0e10cSrcweir if (nAktInvent!=nInvent || nAktIdent!=nIdent) 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir nAktInvent=nInvent; 390*cdf0e10cSrcweir nAktIdent=nIdent; 391*cdf0e10cSrcweir SdrObject* pObj = SdrObjFactory::MakeNewObject(nInvent,nIdent,NULL,NULL); 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir if(pObj) 394*cdf0e10cSrcweir { 395*cdf0e10cSrcweir // Auf pers. Wunsch von Marco: 396*cdf0e10cSrcweir // Mauszeiger bei Textwerkzeug immer I-Beam. Fadenkreuz 397*cdf0e10cSrcweir // mit kleinem I-Beam erst bai MouseButtonDown 398*cdf0e10cSrcweir if(IsTextTool()) 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir // #81944# AW: Here the correct pointer needs to be used 401*cdf0e10cSrcweir // if the default is set to vertical writing 402*cdf0e10cSrcweir aAktCreatePointer = POINTER_TEXT; 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir else 405*cdf0e10cSrcweir aAktCreatePointer = pObj->GetCreatePointer(); 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir SdrObject::Free( pObj ); 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir else 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir aAktCreatePointer = Pointer(POINTER_CROSS); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir CheckEdgeMode(); 416*cdf0e10cSrcweir ImpSetGlueVisible3(IsEdgeTool()); 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir sal_Bool SdrCreateView::ImpBegCreateObj(sal_uInt32 nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut, 420*cdf0e10cSrcweir short nMinMov, SdrPageView* pPV, const Rectangle& rLogRect, SdrObject* pPreparedFactoryObject) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir sal_Bool bRet=sal_False; 423*cdf0e10cSrcweir UnmarkAllObj(); 424*cdf0e10cSrcweir BrkAction(); 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir ImpClearConnectMarker(); 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir if (pPV!=NULL) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir pCreatePV=pPV; 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir else 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir pCreatePV = GetSdrPageView(); 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir if (pCreatePV!=NULL) 437*cdf0e10cSrcweir { // ansonsten keine Seite angemeldet! 438*cdf0e10cSrcweir String aLay(aAktLayer); 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir if(nInvent == SdrInventor && nIdent == OBJ_MEASURE && aMeasureLayer.Len()) 441*cdf0e10cSrcweir { 442*cdf0e10cSrcweir aLay = aMeasureLayer; 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir SdrLayerID nLayer=pCreatePV->GetPage()->GetLayerAdmin().GetLayerID(aLay,sal_True); 446*cdf0e10cSrcweir if (nLayer==SDRLAYER_NOTFOUND) nLayer=0; 447*cdf0e10cSrcweir if (!pCreatePV->GetLockedLayers().IsSet(nLayer) && pCreatePV->GetVisibleLayers().IsSet(nLayer)) 448*cdf0e10cSrcweir { 449*cdf0e10cSrcweir if(pPreparedFactoryObject) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir pAktCreate = pPreparedFactoryObject; 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir if(pCreatePV->GetPage()) 454*cdf0e10cSrcweir { 455*cdf0e10cSrcweir pAktCreate->SetPage(pCreatePV->GetPage()); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir else if (pMod) 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir pAktCreate->SetModel(pMod); 460*cdf0e10cSrcweir } 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir else 463*cdf0e10cSrcweir { 464*cdf0e10cSrcweir pAktCreate = SdrObjFactory::MakeNewObject(nInvent, nIdent, pCreatePV->GetPage(), pMod); 465*cdf0e10cSrcweir } 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir Point aPnt(rPnt); 468*cdf0e10cSrcweir if (nAktInvent!=SdrInventor || (nAktIdent!=sal_uInt16(OBJ_EDGE) && 469*cdf0e10cSrcweir nAktIdent!=sal_uInt16(OBJ_FREELINE) && 470*cdf0e10cSrcweir nAktIdent!=sal_uInt16(OBJ_FREEFILL) )) { // Kein Fang fuer Edge und Freihand! 471*cdf0e10cSrcweir aPnt=GetSnapPos(aPnt,pCreatePV); 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir if (pAktCreate!=NULL) 474*cdf0e10cSrcweir { 475*cdf0e10cSrcweir sal_Bool bStartEdit=sal_False; // nach Ende von Create automatisch TextEdit starten 476*cdf0e10cSrcweir if (pDefaultStyleSheet!=NULL) pAktCreate->NbcSetStyleSheet(pDefaultStyleSheet, sal_False); 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir // #101618# SW uses a naked SdrObject for frame construction. Normally, such an 479*cdf0e10cSrcweir // object should not be created. Since it is possible to use it as a helper 480*cdf0e10cSrcweir // object (e.g. in letting the user define an area with the interactive 481*cdf0e10cSrcweir // construction) at least no items should be set at that object. 482*cdf0e10cSrcweir if(nInvent != SdrInventor || nIdent != OBJ_NONE) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir pAktCreate->SetMergedItemSet(aDefaultAttr); 485*cdf0e10cSrcweir } 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir if (HAS_BASE(SdrCaptionObj,pAktCreate)) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir SfxItemSet aSet(pMod->GetItemPool()); 490*cdf0e10cSrcweir aSet.Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet 491*cdf0e10cSrcweir aSet.Put(XFillStyleItem(XFILL_NONE)); 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir pAktCreate->SetMergedItemSet(aSet); 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir bStartEdit=sal_True; 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir if (nInvent==SdrInventor && (nIdent==OBJ_TEXT || nIdent==OBJ_TEXTEXT || 498*cdf0e10cSrcweir nIdent==OBJ_TITLETEXT || nIdent==OBJ_OUTLINETEXT)) 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir // Fuer alle Textrahmen default keinen Hintergrund und keine Umrandung 501*cdf0e10cSrcweir SfxItemSet aSet(pMod->GetItemPool()); 502*cdf0e10cSrcweir aSet.Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet 503*cdf0e10cSrcweir aSet.Put(XFillStyleItem(XFILL_NONE)); 504*cdf0e10cSrcweir aSet.Put(XLineColorItem(String(),Color(COL_BLACK))); // Falls einer auf Solid umschaltet 505*cdf0e10cSrcweir aSet.Put(XLineStyleItem(XLINE_NONE)); 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir pAktCreate->SetMergedItemSet(aSet); 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir bStartEdit=sal_True; 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir if (!rLogRect.IsEmpty()) pAktCreate->NbcSetLogicRect(rLogRect); 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir // #90129# make sure drag start point is inside WorkArea 514*cdf0e10cSrcweir const Rectangle& rWorkArea = ((SdrDragView*)this)->GetWorkArea(); 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir if(!rWorkArea.IsEmpty()) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir if(aPnt.X() < rWorkArea.Left()) 519*cdf0e10cSrcweir { 520*cdf0e10cSrcweir aPnt.X() = rWorkArea.Left(); 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir if(aPnt.X() > rWorkArea.Right()) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir aPnt.X() = rWorkArea.Right(); 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir if(aPnt.Y() < rWorkArea.Top()) 529*cdf0e10cSrcweir { 530*cdf0e10cSrcweir aPnt.Y() = rWorkArea.Top(); 531*cdf0e10cSrcweir } 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir if(aPnt.Y() > rWorkArea.Bottom()) 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir aPnt.Y() = rWorkArea.Bottom(); 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir } 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir aDragStat.Reset(aPnt); 540*cdf0e10cSrcweir aDragStat.SetView((SdrView*)this); 541*cdf0e10cSrcweir aDragStat.SetPageView(pCreatePV); 542*cdf0e10cSrcweir aDragStat.SetMinMove(ImpGetMinMovLogic(nMinMov,pOut)); 543*cdf0e10cSrcweir pDragWin=pOut; 544*cdf0e10cSrcweir if (pAktCreate->BegCreate(aDragStat)) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir ShowCreateObj(/*pOut,sal_True*/); 547*cdf0e10cSrcweir bRet=sal_True; 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir else 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir SdrObject::Free( pAktCreate ); 552*cdf0e10cSrcweir pAktCreate=NULL; 553*cdf0e10cSrcweir pCreatePV=NULL; 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir } 556*cdf0e10cSrcweir } 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir return bRet; 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir sal_Bool SdrCreateView::BegCreateObj(const Point& rPnt, OutputDevice* pOut, short nMinMov, SdrPageView* pPV) 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir return ImpBegCreateObj(nAktInvent,nAktIdent,rPnt,pOut,nMinMov,pPV,Rectangle(), 0L); 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir sal_Bool SdrCreateView::BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir sal_uInt32 nInvent(nAktInvent); 569*cdf0e10cSrcweir sal_uInt16 nIdent(nAktIdent); 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir if(pPreparedFactoryObject) 572*cdf0e10cSrcweir { 573*cdf0e10cSrcweir nInvent = pPreparedFactoryObject->GetObjInventor(); 574*cdf0e10cSrcweir nIdent = pPreparedFactoryObject->GetObjIdentifier(); 575*cdf0e10cSrcweir } 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir return ImpBegCreateObj(nInvent, nIdent, rPnt, 0L, nMinMov, 0L, Rectangle(), pPreparedFactoryObject); 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir sal_Bool SdrCreateView::BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, 581*cdf0e10cSrcweir OutputDevice* pOut, short nMinMov, SdrPageView* pPV) 582*cdf0e10cSrcweir { 583*cdf0e10cSrcweir return ImpBegCreateObj(SdrInventor,OBJ_CAPTION,rPnt,pOut,nMinMov,pPV, 584*cdf0e10cSrcweir Rectangle(rPnt,Size(rObjSiz.Width()+1,rObjSiz.Height()+1)), 0L); 585*cdf0e10cSrcweir } 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir void SdrCreateView::MovCreateObj(const Point& rPnt) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir if (pAktCreate!=NULL) { 590*cdf0e10cSrcweir Point aPnt(rPnt); 591*cdf0e10cSrcweir if (!aDragStat.IsNoSnap()) 592*cdf0e10cSrcweir { 593*cdf0e10cSrcweir aPnt=GetSnapPos(aPnt,pCreatePV); 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir if (IsOrtho()) 596*cdf0e10cSrcweir { 597*cdf0e10cSrcweir if (aDragStat.IsOrtho8Possible()) OrthoDistance8(aDragStat.GetPrev(),aPnt,IsBigOrtho()); 598*cdf0e10cSrcweir else if (aDragStat.IsOrtho4Possible()) OrthoDistance4(aDragStat.GetPrev(),aPnt,IsBigOrtho()); 599*cdf0e10cSrcweir } 600*cdf0e10cSrcweir 601*cdf0e10cSrcweir // #77734# If the drag point was limited and Ortho is active, do 602*cdf0e10cSrcweir // the small ortho correction (reduction) -> last parameter to FALSE. 603*cdf0e10cSrcweir sal_Bool bDidLimit(ImpLimitToWorkArea(aPnt)); 604*cdf0e10cSrcweir if(bDidLimit && IsOrtho()) 605*cdf0e10cSrcweir { 606*cdf0e10cSrcweir if(aDragStat.IsOrtho8Possible()) 607*cdf0e10cSrcweir OrthoDistance8(aDragStat.GetPrev(), aPnt, sal_False); 608*cdf0e10cSrcweir else if(aDragStat.IsOrtho4Possible()) 609*cdf0e10cSrcweir OrthoDistance4(aDragStat.GetPrev(), aPnt, sal_False); 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir if (aPnt==aDragStat.GetNow()) return; 613*cdf0e10cSrcweir bool bMerk(aDragStat.IsMinMoved()); 614*cdf0e10cSrcweir if (aDragStat.CheckMinMoved(aPnt)) 615*cdf0e10cSrcweir { 616*cdf0e10cSrcweir Rectangle aBound; 617*cdf0e10cSrcweir if (!bMerk) aDragStat.NextPoint(); 618*cdf0e10cSrcweir aDragStat.NextMove(aPnt); 619*cdf0e10cSrcweir pAktCreate->MovCreate(aDragStat); 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir // MovCreate changes the object, so use ActionChanged() on it 622*cdf0e10cSrcweir pAktCreate->ActionChanged(); 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir // replace for DrawCreateObjDiff 625*cdf0e10cSrcweir HideCreateObj(); 626*cdf0e10cSrcweir ShowCreateObj(); 627*cdf0e10cSrcweir } 628*cdf0e10cSrcweir } 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir sal_Bool SdrCreateView::EndCreateObj(SdrCreateCmd eCmd) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir sal_Bool bRet=sal_False; 634*cdf0e10cSrcweir SdrObject* pObjMerk=pAktCreate; 635*cdf0e10cSrcweir SdrPageView* pPVMerk=pCreatePV; 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir if (pAktCreate!=NULL) 638*cdf0e10cSrcweir { 639*cdf0e10cSrcweir sal_uIntPtr nAnz=aDragStat.GetPointAnz(); 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir if (nAnz<=1 && eCmd==SDRCREATE_FORCEEND) 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir BrkCreateObj(); // Objekte mit nur einem Punkt gibt's nicht (zumindest noch nicht) 644*cdf0e10cSrcweir return sal_False; // sal_False=Event nicht ausgewertet 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir sal_Bool bPntsEq=nAnz>1; 648*cdf0e10cSrcweir sal_uIntPtr i=1; 649*cdf0e10cSrcweir Point aP0=aDragStat.GetPoint(0); 650*cdf0e10cSrcweir while (bPntsEq && i<nAnz) { bPntsEq=aP0==aDragStat.GetPoint(i); i++; } 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir if (pAktCreate->EndCreate(aDragStat,eCmd)) 653*cdf0e10cSrcweir { 654*cdf0e10cSrcweir HideCreateObj(); 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir if (!bPntsEq) 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir // sonst Brk, weil alle Punkte gleich sind. 659*cdf0e10cSrcweir SdrObject* pObj=pAktCreate; 660*cdf0e10cSrcweir pAktCreate=NULL; 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir const SdrLayerAdmin& rAd = pCreatePV->GetPage()->GetLayerAdmin(); 663*cdf0e10cSrcweir SdrLayerID nLayer(0); 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir // #i72535# 666*cdf0e10cSrcweir if(pObj->ISA(FmFormObj)) 667*cdf0e10cSrcweir { 668*cdf0e10cSrcweir // for FormControls, force to form layer 669*cdf0e10cSrcweir nLayer = rAd.GetLayerID(rAd.GetControlLayerName(), true); 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir else 672*cdf0e10cSrcweir { 673*cdf0e10cSrcweir nLayer = rAd.GetLayerID(aAktLayer, sal_True); 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir if(SDRLAYER_NOTFOUND == nLayer) 677*cdf0e10cSrcweir { 678*cdf0e10cSrcweir nLayer=0; 679*cdf0e10cSrcweir } 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir pObj->SetLayer(nLayer); 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir // #83403# recognize creation of a new 3D object inside a 3D scene 684*cdf0e10cSrcweir sal_Bool bSceneIntoScene(sal_False); 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir if(pObjMerk 687*cdf0e10cSrcweir && pObjMerk->ISA(E3dScene) 688*cdf0e10cSrcweir && pCreatePV 689*cdf0e10cSrcweir && pCreatePV->GetAktGroup() 690*cdf0e10cSrcweir && pCreatePV->GetAktGroup()->ISA(E3dScene)) 691*cdf0e10cSrcweir { 692*cdf0e10cSrcweir sal_Bool bDidInsert = ((E3dView*)this)->ImpCloneAll3DObjectsToDestScene( 693*cdf0e10cSrcweir (E3dScene*)pObjMerk, (E3dScene*)pCreatePV->GetAktGroup(), Point(0, 0)); 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir if(bDidInsert) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir // delete object, it's content is cloned and inserted 698*cdf0e10cSrcweir SdrObject::Free( pObjMerk ); 699*cdf0e10cSrcweir pObjMerk = 0L; 700*cdf0e10cSrcweir bRet = sal_False; 701*cdf0e10cSrcweir bSceneIntoScene = sal_True; 702*cdf0e10cSrcweir } 703*cdf0e10cSrcweir } 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir if(!bSceneIntoScene) 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir // do the same as before 708*cdf0e10cSrcweir InsertObjectAtView(pObj, *pCreatePV); 709*cdf0e10cSrcweir } 710*cdf0e10cSrcweir 711*cdf0e10cSrcweir pCreatePV=NULL; 712*cdf0e10cSrcweir bRet=sal_True; // sal_True=Event ausgewertet 713*cdf0e10cSrcweir } 714*cdf0e10cSrcweir else 715*cdf0e10cSrcweir { 716*cdf0e10cSrcweir BrkCreateObj(); 717*cdf0e10cSrcweir } 718*cdf0e10cSrcweir } 719*cdf0e10cSrcweir else 720*cdf0e10cSrcweir { // Mehr Punkte 721*cdf0e10cSrcweir if (eCmd==SDRCREATE_FORCEEND || // nix da, Ende erzwungen 722*cdf0e10cSrcweir nAnz==0 || // keine Punkte da (kann eigentlich nicht vorkommen) 723*cdf0e10cSrcweir (nAnz<=1 && !aDragStat.IsMinMoved())) { // MinMove nicht erfuellt 724*cdf0e10cSrcweir BrkCreateObj(); 725*cdf0e10cSrcweir } 726*cdf0e10cSrcweir else 727*cdf0e10cSrcweir { 728*cdf0e10cSrcweir // replace for DrawCreateObjDiff 729*cdf0e10cSrcweir HideCreateObj(); 730*cdf0e10cSrcweir ShowCreateObj(); 731*cdf0e10cSrcweir aDragStat.ResetMinMoved(); // NextPoint gibt's bei MovCreateObj() 732*cdf0e10cSrcweir bRet=sal_True; 733*cdf0e10cSrcweir } 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir if (bRet && pObjMerk!=NULL && IsTextEditAfterCreate()) 736*cdf0e10cSrcweir { 737*cdf0e10cSrcweir SdrTextObj* pText=PTR_CAST(SdrTextObj,pObjMerk); 738*cdf0e10cSrcweir if (pText!=NULL && pText->IsTextFrame()) 739*cdf0e10cSrcweir { 740*cdf0e10cSrcweir SdrBeginTextEdit(pText, pPVMerk, (Window*)0L, sal_True, (SdrOutliner*)0L, (OutlinerView*)0L); 741*cdf0e10cSrcweir } 742*cdf0e10cSrcweir } 743*cdf0e10cSrcweir } 744*cdf0e10cSrcweir return bRet; 745*cdf0e10cSrcweir } 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir void SdrCreateView::BckCreateObj() 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir if (pAktCreate!=NULL) 750*cdf0e10cSrcweir { 751*cdf0e10cSrcweir if (aDragStat.GetPointAnz()<=2 ) 752*cdf0e10cSrcweir { 753*cdf0e10cSrcweir BrkCreateObj(); 754*cdf0e10cSrcweir } 755*cdf0e10cSrcweir else 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir HideCreateObj(); 758*cdf0e10cSrcweir aDragStat.PrevPoint(); 759*cdf0e10cSrcweir if (pAktCreate->BckCreate(aDragStat)) 760*cdf0e10cSrcweir { 761*cdf0e10cSrcweir ShowCreateObj(); 762*cdf0e10cSrcweir } 763*cdf0e10cSrcweir else 764*cdf0e10cSrcweir { 765*cdf0e10cSrcweir BrkCreateObj(); 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir } 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir } 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir void SdrCreateView::BrkCreateObj() 772*cdf0e10cSrcweir { 773*cdf0e10cSrcweir if (pAktCreate!=NULL) 774*cdf0e10cSrcweir { 775*cdf0e10cSrcweir HideCreateObj(); 776*cdf0e10cSrcweir pAktCreate->BrkCreate(aDragStat); 777*cdf0e10cSrcweir SdrObject::Free( pAktCreate ); 778*cdf0e10cSrcweir pAktCreate=NULL; 779*cdf0e10cSrcweir pCreatePV=NULL; 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir } 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir if(IsCreateObj() && !aDragStat.IsShown()) 786*cdf0e10cSrcweir { 787*cdf0e10cSrcweir if(pAktCreate) 788*cdf0e10cSrcweir { 789*cdf0e10cSrcweir // for migration from XOR, replace DrawDragObj here to create 790*cdf0e10cSrcweir // overlay objects instead. 791*cdf0e10cSrcweir sal_Bool bUseSolidDragging(IsSolidDragging()); 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir // #i101648# check if dragged object is a naked SdrObject (no 794*cdf0e10cSrcweir // derivation of). This is e.g. used in SW Frame construction 795*cdf0e10cSrcweir // as placeholder. Do not use SolidDragging for naked SDrObjects, 796*cdf0e10cSrcweir // they cannot have a valid optical representation 797*cdf0e10cSrcweir if(bUseSolidDragging && OBJ_NONE == pAktCreate->GetObjIdentifier()) 798*cdf0e10cSrcweir { 799*cdf0e10cSrcweir bUseSolidDragging = false; 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir 802*cdf0e10cSrcweir // check for objects with no fill and no line 803*cdf0e10cSrcweir if(bUseSolidDragging) 804*cdf0e10cSrcweir { 805*cdf0e10cSrcweir const SfxItemSet& rSet = pAktCreate->GetMergedItemSet(); 806*cdf0e10cSrcweir const XFillStyle eFill(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue()); 807*cdf0e10cSrcweir const XLineStyle eLine(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue()); 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir if(XLINE_NONE == eLine && XFILL_NONE == eFill) 810*cdf0e10cSrcweir { 811*cdf0e10cSrcweir bUseSolidDragging = sal_False; 812*cdf0e10cSrcweir } 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir // check for form controls 816*cdf0e10cSrcweir if(bUseSolidDragging) 817*cdf0e10cSrcweir { 818*cdf0e10cSrcweir if(pAktCreate->ISA(SdrUnoObj)) 819*cdf0e10cSrcweir { 820*cdf0e10cSrcweir bUseSolidDragging = sal_False; 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir } 823*cdf0e10cSrcweir 824*cdf0e10cSrcweir // #i101781# force to non-solid dragging when not creating a full circle 825*cdf0e10cSrcweir if(bUseSolidDragging) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(pAktCreate); 828*cdf0e10cSrcweir 829*cdf0e10cSrcweir if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier()) 830*cdf0e10cSrcweir { 831*cdf0e10cSrcweir // #i103058# Allow SolidDragging with four points 832*cdf0e10cSrcweir if(aDragStat.GetPointAnz() < 4) 833*cdf0e10cSrcweir { 834*cdf0e10cSrcweir bUseSolidDragging = false; 835*cdf0e10cSrcweir } 836*cdf0e10cSrcweir } 837*cdf0e10cSrcweir } 838*cdf0e10cSrcweir 839*cdf0e10cSrcweir if(bUseSolidDragging) 840*cdf0e10cSrcweir { 841*cdf0e10cSrcweir basegfx::B2DPolyPolygon aDragPolyPolygon; 842*cdf0e10cSrcweir 843*cdf0e10cSrcweir if(pAktCreate->ISA(SdrRectObj)) 844*cdf0e10cSrcweir { 845*cdf0e10cSrcweir // ensure object has some size, necessary for SdrTextObj because 846*cdf0e10cSrcweir // there are still untested divisions by that sizes 847*cdf0e10cSrcweir Rectangle aCurrentSnapRect(pAktCreate->GetSnapRect()); 848*cdf0e10cSrcweir 849*cdf0e10cSrcweir if(!(aCurrentSnapRect.GetWidth() > 1 && aCurrentSnapRect.GetHeight() > 1)) 850*cdf0e10cSrcweir { 851*cdf0e10cSrcweir Rectangle aNewRect(aDragStat.GetStart(), aDragStat.GetStart() + Point(2, 2)); 852*cdf0e10cSrcweir pAktCreate->NbcSetSnapRect(aNewRect); 853*cdf0e10cSrcweir } 854*cdf0e10cSrcweir } 855*cdf0e10cSrcweir 856*cdf0e10cSrcweir if(pAktCreate->ISA(SdrPathObj)) 857*cdf0e10cSrcweir { 858*cdf0e10cSrcweir // The up-to-now created path needs to be set at the object to have something 859*cdf0e10cSrcweir // that can be visualized 860*cdf0e10cSrcweir SdrPathObj& rPathObj((SdrPathObj&)(*pAktCreate)); 861*cdf0e10cSrcweir const basegfx::B2DPolyPolygon aCurrentPolyPolygon(rPathObj.getObjectPolyPolygon(aDragStat)); 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir if(aCurrentPolyPolygon.count()) 864*cdf0e10cSrcweir { 865*cdf0e10cSrcweir rPathObj.NbcSetPathPoly(aCurrentPolyPolygon); 866*cdf0e10cSrcweir } 867*cdf0e10cSrcweir 868*cdf0e10cSrcweir aDragPolyPolygon = rPathObj.getDragPolyPolygon(aDragStat); 869*cdf0e10cSrcweir } 870*cdf0e10cSrcweir 871*cdf0e10cSrcweir // use directly the SdrObject for overlay 872*cdf0e10cSrcweir mpCreateViewExtraData->CreateAndShowOverlay(*this, pAktCreate, aDragPolyPolygon); 873*cdf0e10cSrcweir } 874*cdf0e10cSrcweir else 875*cdf0e10cSrcweir { 876*cdf0e10cSrcweir mpCreateViewExtraData->CreateAndShowOverlay(*this, 0, pAktCreate->TakeCreatePoly(aDragStat)); 877*cdf0e10cSrcweir } 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir // #i101679# Force changed overlay to be shown 880*cdf0e10cSrcweir for(sal_uInt32 a(0); a < PaintWindowCount(); a++) 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir SdrPaintWindow* pCandidate = GetPaintWindow(a); 883*cdf0e10cSrcweir sdr::overlay::OverlayManager* pOverlayManager = pCandidate->GetOverlayManager(); 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir if(pOverlayManager) 886*cdf0e10cSrcweir { 887*cdf0e10cSrcweir pOverlayManager->flush(); 888*cdf0e10cSrcweir } 889*cdf0e10cSrcweir } 890*cdf0e10cSrcweir } 891*cdf0e10cSrcweir 892*cdf0e10cSrcweir aDragStat.SetShown(sal_True); 893*cdf0e10cSrcweir } 894*cdf0e10cSrcweir } 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir void SdrCreateView::HideCreateObj() 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir if(IsCreateObj() && aDragStat.IsShown()) 899*cdf0e10cSrcweir { 900*cdf0e10cSrcweir // for migration from XOR, replace DrawDragObj here to create 901*cdf0e10cSrcweir // overlay objects instead. 902*cdf0e10cSrcweir mpCreateViewExtraData->HideOverlay(); 903*cdf0e10cSrcweir 904*cdf0e10cSrcweir //DrawCreateObj(pOut,bFull); 905*cdf0e10cSrcweir aDragStat.SetShown(sal_False); 906*cdf0e10cSrcweir } 907*cdf0e10cSrcweir } 908*cdf0e10cSrcweir 909*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 910*cdf0e10cSrcweir 911*cdf0e10cSrcweir /* new interface src537 */ 912*cdf0e10cSrcweir sal_Bool SdrCreateView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const 913*cdf0e10cSrcweir { 914*cdf0e10cSrcweir if(pAktCreate) 915*cdf0e10cSrcweir { 916*cdf0e10cSrcweir rTargetSet.Put(pAktCreate->GetMergedItemSet()); 917*cdf0e10cSrcweir return sal_True; 918*cdf0e10cSrcweir } 919*cdf0e10cSrcweir else 920*cdf0e10cSrcweir { 921*cdf0e10cSrcweir return SdrDragView::GetAttributes(rTargetSet, bOnlyHardAttr); 922*cdf0e10cSrcweir } 923*cdf0e10cSrcweir } 924*cdf0e10cSrcweir 925*cdf0e10cSrcweir sal_Bool SdrCreateView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll) 926*cdf0e10cSrcweir { 927*cdf0e10cSrcweir if(pAktCreate) 928*cdf0e10cSrcweir { 929*cdf0e10cSrcweir pAktCreate->SetMergedItemSetAndBroadcast(rSet, bReplaceAll); 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir return sal_True; 932*cdf0e10cSrcweir } 933*cdf0e10cSrcweir else 934*cdf0e10cSrcweir { 935*cdf0e10cSrcweir return SdrDragView::SetAttributes(rSet,bReplaceAll); 936*cdf0e10cSrcweir } 937*cdf0e10cSrcweir } 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir SfxStyleSheet* SdrCreateView::GetStyleSheet() const // SfxStyleSheet* SdrCreateView::GetStyleSheet(sal_Bool& rOk) const 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir if (pAktCreate!=NULL) 942*cdf0e10cSrcweir { 943*cdf0e10cSrcweir //rOk=sal_True; 944*cdf0e10cSrcweir return pAktCreate->GetStyleSheet(); 945*cdf0e10cSrcweir } 946*cdf0e10cSrcweir else 947*cdf0e10cSrcweir { 948*cdf0e10cSrcweir return SdrDragView::GetStyleSheet(); // SdrDragView::GetStyleSheet(rOk); 949*cdf0e10cSrcweir } 950*cdf0e10cSrcweir } 951*cdf0e10cSrcweir 952*cdf0e10cSrcweir sal_Bool SdrCreateView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr) 953*cdf0e10cSrcweir { 954*cdf0e10cSrcweir if (pAktCreate!=NULL) 955*cdf0e10cSrcweir { 956*cdf0e10cSrcweir pAktCreate->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); 957*cdf0e10cSrcweir return sal_True; 958*cdf0e10cSrcweir } 959*cdf0e10cSrcweir else 960*cdf0e10cSrcweir { 961*cdf0e10cSrcweir return SdrDragView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); 962*cdf0e10cSrcweir } 963*cdf0e10cSrcweir } 964*cdf0e10cSrcweir 965