Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / svdraw / svddrgv.cxx
blob428ab361bd0e546f9b1f7c769a76a23f7a8c043e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <svx/svddrgv.hxx>
22 #include "svx/xattr.hxx"
23 #include <svx/xpoly.hxx>
24 #include <svx/svdetc.hxx>
25 #include <svx/svdtrans.hxx>
26 #include <svx/svdundo.hxx>
27 #include <svx/svdocapt.hxx>
28 #include <svx/svdpagv.hxx>
29 #include <svx/svdopath.hxx>
30 #include <svx/svdoedge.hxx>
31 #include "svx/svdstr.hrc"
32 #include "svdglob.hxx"
33 #include "svddrgm1.hxx"
34 #include <svx/obj3d.hxx>
35 #include <svx/svdoashp.hxx>
36 #include <svx/sdrpaintwindow.hxx>
37 #include <basegfx/polygon/b2dpolypolygontools.hxx>
38 #include <basegfx/polygon/b2dpolygontools.hxx>
39 #include <svx/polypolygoneditor.hxx>
40 #include <basegfx/matrix/b2dhommatrix.hxx>
41 #include <svx/sdr/overlay/overlaymanager.hxx>
43 using namespace sdr;
47 // DragView
51 void SdrDragView::ImpClearVars()
53 bFramDrag=false;
54 eDragMode=SDRDRAG_MOVE;
55 bDragLimit=false;
56 bMarkedHitMovesAlways=false;
57 eDragHdl=HDL_MOVE;
58 pDragHdl=NULL;
59 bDragHdl=false;
60 bDragSpecial=false;
61 mpCurrentSdrDragMethod=NULL;
62 bDragStripes=false;
63 bMirrRefDragObj=true;
64 bDragWithCopy=false;
65 pInsPointUndo=NULL;
66 bInsGluePoint=false;
67 bInsObjPointMode=false;
68 bInsGluePointMode=false;
69 nDragXorPolyLimit=100;
70 nDragXorPointLimit=500;
71 bNoDragXorPolys=false;
72 bAutoVertexCon=true;
73 bAutoCornerCon=false;
74 bRubberEdgeDragging=true;
75 bDetailedEdgeDragging=true;
76 nDetailedEdgeDraggingLimit=10;
77 bResizeAtCenter=false;
78 bCrookAtCenter=false;
79 bMouseHideWhileDraggingPoints=false;
81 // init using default
82 mbSolidDragging = getOptionsDrawinglayer().IsSolidDragCreate();
85 SdrDragView::SdrDragView(SdrModel* pModel1, OutputDevice* pOut)
86 : SdrExchangeView(pModel1,pOut)
88 ImpClearVars();
91 SdrDragView::~SdrDragView()
95 bool SdrDragView::IsAction() const
97 return (mpCurrentSdrDragMethod || SdrExchangeView::IsAction());
100 void SdrDragView::MovAction(const Point& rPnt)
102 SdrExchangeView::MovAction(rPnt);
103 if (mpCurrentSdrDragMethod)
105 MovDragObj(rPnt);
109 void SdrDragView::EndAction()
111 if (mpCurrentSdrDragMethod)
113 EndDragObj(false);
115 SdrExchangeView::EndAction();
118 void SdrDragView::BckAction()
120 SdrExchangeView::BckAction();
121 BrkDragObj();
124 void SdrDragView::BrkAction()
126 SdrExchangeView::BrkAction();
127 BrkDragObj();
130 void SdrDragView::TakeActionRect(Rectangle& rRect) const
132 if (mpCurrentSdrDragMethod)
134 rRect=aDragStat.GetActionRect();
135 if (rRect.IsEmpty())
137 SdrPageView* pPV = GetSdrPageView();
139 if(pPV&& pPV->HasMarkedObjPageView())
141 // #i95646# is this used..?
142 const basegfx::B2DRange aBoundRange(mpCurrentSdrDragMethod->getCurrentRange());
143 rRect = Rectangle(
144 basegfx::fround(aBoundRange.getMinX()), basegfx::fround(aBoundRange.getMinY()),
145 basegfx::fround(aBoundRange.getMaxX()), basegfx::fround(aBoundRange.getMaxY()));
148 if (rRect.IsEmpty())
150 rRect=Rectangle(aDragStat.GetNow(),aDragStat.GetNow());
153 else
155 SdrExchangeView::TakeActionRect(rRect);
159 bool SdrDragView::TakeDragObjAnchorPos(Point& rPos, bool bTR ) const
161 Rectangle aR;
162 TakeActionRect(aR);
163 rPos = bTR ? aR.TopRight() : aR.TopLeft();
164 if (GetMarkedObjectCount()==1 && IsDragObj() && // only on single selection
165 !IsDraggingPoints() && !IsDraggingGluePoints() && // not when moving points
166 !mpCurrentSdrDragMethod->ISA(SdrDragMovHdl)) // not when moving handles
168 SdrObject* pObj=GetMarkedObjectByIndex(0);
169 if (pObj->ISA(SdrCaptionObj))
171 Point aPt(((SdrCaptionObj*)pObj)->GetTailPos());
172 bool bTail=eDragHdl==HDL_POLY; // drag tail
173 bool bOwn=mpCurrentSdrDragMethod->ISA(SdrDragObjOwn); // specific to object
174 if (!bTail)
175 { // for bTail, TakeActionRect already does the right thing
176 if (bOwn)
177 { // bOwn may be MoveTextFrame, ResizeTextFrame, but may not (any more) be DragTail
178 rPos=aPt;
180 else
182 // drag the whole Object (Move, Resize, ...)
183 const basegfx::B2DPoint aTransformed(mpCurrentSdrDragMethod->getCurrentTransformation() * basegfx::B2DPoint(aPt.X(), aPt.Y()));
184 rPos.X() = basegfx::fround(aTransformed.getX());
185 rPos.Y() = basegfx::fround(aTransformed.getY());
189 return true;
191 return false;
196 bool SdrDragView::TakeDragLimit(SdrDragMode /*eMode*/, Rectangle& /*rRect*/) const
198 return false;
201 bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl, short nMinMov, SdrDragMethod* pForcedMeth)
203 BrkAction();
205 bool bRet=false;
207 SetDragWithCopy(false);
208 //TODO: aAni.Reset();
209 mpCurrentSdrDragMethod=NULL;
210 bDragSpecial=false;
211 bDragLimit=false;
212 SdrDragMode eTmpMode=eDragMode;
213 if (eTmpMode==SDRDRAG_MOVE && pHdl!=NULL && pHdl->GetKind()!=HDL_MOVE) {
214 eTmpMode=SDRDRAG_RESIZE;
216 bDragLimit=TakeDragLimit(eTmpMode,aDragLimit);
217 bFramDrag=ImpIsFrameHandles();
218 if (!bFramDrag &&
219 (pMarkedObj==NULL || !pMarkedObj->hasSpecialDrag()) &&
220 (pHdl==NULL || pHdl->GetObj()==NULL)) {
221 bFramDrag=true;
224 Point aPnt(rPnt);
225 if(pHdl == NULL
226 || pHdl->GetKind() == HDL_MOVE
227 || pHdl->GetKind() == HDL_MIRX
228 || pHdl->GetKind() == HDL_TRNS
229 || pHdl->GetKind() == HDL_GRAD)
231 aDragStat.Reset(aPnt);
233 else
235 aDragStat.Reset(pHdl->GetPos());
238 aDragStat.SetView((SdrView*)this);
239 aDragStat.SetPageView(pMarkedPV); // <<-- DragPV has to go here!!!
240 aDragStat.SetMinMove(ImpGetMinMovLogic(nMinMov,pOut));
241 aDragStat.SetHdl(pHdl);
242 aDragStat.NextPoint();
243 pDragWin=pOut;
244 pDragHdl=pHdl;
245 eDragHdl= pHdl==NULL ? HDL_MOVE : pHdl->GetKind();
246 bDragHdl=eDragHdl==HDL_REF1 || eDragHdl==HDL_REF2 || eDragHdl==HDL_MIRX;
248 // Expand test for HDL_ANCHOR_TR
249 bool bNotDraggable = (HDL_ANCHOR == eDragHdl || HDL_ANCHOR_TR == eDragHdl);
251 if(pHdl && (pHdl->GetKind() == HDL_SMARTTAG) && pForcedMeth )
253 // just use the forced method for smart tags
255 else if(bDragHdl)
257 mpCurrentSdrDragMethod = new SdrDragMovHdl(*this);
259 else if(!bNotDraggable)
261 switch (eDragMode)
263 case SDRDRAG_ROTATE: case SDRDRAG_SHEAR: case SDRDRAG_DISTORT:
265 switch (eDragHdl)
267 case HDL_LEFT: case HDL_RIGHT:
268 case HDL_UPPER: case HDL_LOWER:
270 // are 3D objects selected?
271 bool b3DObjSelected = false;
272 for(sal_uInt32 a=0;!b3DObjSelected && a<GetMarkedObjectCount();a++)
274 SdrObject* pObj = GetMarkedObjectByIndex(a);
275 if(pObj && pObj->ISA(E3dObject))
276 b3DObjSelected = true;
278 // If yes, allow shear even when !IsShearAllowed,
279 // because 3D objects are limited rotations
280 if (!b3DObjSelected && !IsShearAllowed())
281 return false;
282 mpCurrentSdrDragMethod = new SdrDragShear(*this,eDragMode==SDRDRAG_ROTATE);
283 } break;
284 case HDL_UPLFT: case HDL_UPRGT:
285 case HDL_LWLFT: case HDL_LWRGT:
287 if (eDragMode==SDRDRAG_SHEAR || eDragMode==SDRDRAG_DISTORT)
289 if (!IsDistortAllowed(true) && !IsDistortAllowed(false)) return false;
290 mpCurrentSdrDragMethod = new SdrDragDistort(*this);
292 else
294 if (!IsRotateAllowed(true)) return false;
295 mpCurrentSdrDragMethod = new SdrDragRotate(*this);
297 } break;
298 default:
300 if (IsMarkedHitMovesAlways() && eDragHdl==HDL_MOVE)
301 { // HDL_MOVE is true, even if Obj is hit directly
302 if (!IsMoveAllowed()) return false;
303 mpCurrentSdrDragMethod = new SdrDragMove(*this);
305 else
307 if (!IsRotateAllowed(true)) return false;
308 mpCurrentSdrDragMethod = new SdrDragRotate(*this);
312 } break;
313 case SDRDRAG_MIRROR:
315 if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
317 if (!IsMoveAllowed()) return false;
318 mpCurrentSdrDragMethod = new SdrDragMove(*this);
320 else
322 if (!IsMirrorAllowed(true,true)) return false;
323 mpCurrentSdrDragMethod = new SdrDragMirror(*this);
325 } break;
327 case SDRDRAG_CROP:
329 if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
331 if (!IsMoveAllowed())
332 return false;
333 mpCurrentSdrDragMethod = new SdrDragMove(*this);
335 else
337 if (!IsCrookAllowed(true) && !IsCrookAllowed(false))
338 return false;
339 mpCurrentSdrDragMethod = new SdrDragCrop(*this);
342 break;
344 case SDRDRAG_TRANSPARENCE:
346 if(eDragHdl == HDL_MOVE && IsMarkedHitMovesAlways())
348 if(!IsMoveAllowed())
349 return false;
350 mpCurrentSdrDragMethod = new SdrDragMove(*this);
352 else
354 if(!IsTransparenceAllowed())
355 return false;
357 mpCurrentSdrDragMethod = new SdrDragGradient(*this, false);
359 break;
361 case SDRDRAG_GRADIENT:
363 if(eDragHdl == HDL_MOVE && IsMarkedHitMovesAlways())
365 if(!IsMoveAllowed())
366 return false;
367 mpCurrentSdrDragMethod = new SdrDragMove(*this);
369 else
371 if(!IsGradientAllowed())
372 return false;
374 mpCurrentSdrDragMethod = new SdrDragGradient(*this);
376 break;
379 case SDRDRAG_CROOK :
381 if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
383 if (!IsMoveAllowed()) return false;
384 mpCurrentSdrDragMethod = new SdrDragMove(*this);
386 else
388 if (!IsCrookAllowed(true) && !IsCrookAllowed(false)) return false;
389 mpCurrentSdrDragMethod = new SdrDragCrook(*this);
391 } break;
393 default:
395 // SDRDRAG_MOVE
396 if((eDragHdl == HDL_MOVE) && !IsMoveAllowed())
398 return false;
400 else if(eDragHdl == HDL_GLUE)
402 mpCurrentSdrDragMethod = new SdrDragMove(*this);
404 else
406 if(bFramDrag)
408 if(eDragHdl == HDL_MOVE)
410 mpCurrentSdrDragMethod = new SdrDragMove(*this);
412 else
414 if(!IsResizeAllowed(true))
416 return false;
419 bool bSingleTextObjMark = false; // SJ: #i100490#
420 if ( GetMarkedObjectCount() == 1 )
422 pMarkedObj=GetMarkedObjectByIndex(0);
423 if ( pMarkedObj &&
424 pMarkedObj->ISA( SdrTextObj ) &&
425 static_cast<SdrTextObj*>(pMarkedObj)->IsTextFrame() )
426 bSingleTextObjMark = true;
428 if ( bSingleTextObjMark )
429 mpCurrentSdrDragMethod = new SdrDragObjOwn(*this);
430 else
431 mpCurrentSdrDragMethod = new SdrDragResize(*this);
434 else
436 if(HDL_MOVE == eDragHdl)
438 const bool bCustomShapeSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrObjCustomShape));
440 if(bCustomShapeSelected)
442 mpCurrentSdrDragMethod = new SdrDragMove( *this );
445 else if(HDL_POLY == eDragHdl)
447 const bool bConnectorSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrEdgeObj));
449 if(bConnectorSelected)
451 // #i97784#
452 // fallback to old behaviour for connectors (see
453 // text in task description for more details)
455 else if(!IsMoveAllowed() || !IsResizeAllowed())
457 // #i77187#
458 // do not allow move of polygon points if object is move or size protected
459 return false;
463 if(!mpCurrentSdrDragMethod)
465 // fallback to DragSpecial if no interaction defined
466 bDragSpecial = true;
467 mpCurrentSdrDragMethod = new SdrDragObjOwn(*this);
474 if (pForcedMeth!=NULL)
476 delete mpCurrentSdrDragMethod;
477 mpCurrentSdrDragMethod = pForcedMeth;
479 aDragStat.SetDragMethod(mpCurrentSdrDragMethod);
480 if (mpCurrentSdrDragMethod)
482 bRet = mpCurrentSdrDragMethod->BeginSdrDrag();
483 if (!bRet)
485 if (pHdl==NULL && IS_TYPE(SdrDragObjOwn,mpCurrentSdrDragMethod))
487 // Obj may not Move SpecialDrag, so try with MoveFrameDrag
488 delete mpCurrentSdrDragMethod;
489 mpCurrentSdrDragMethod = 0;
490 bDragSpecial=false;
492 if (!IsMoveAllowed())
493 return false;
495 bFramDrag=true;
496 mpCurrentSdrDragMethod = new SdrDragMove(*this);
497 aDragStat.SetDragMethod(mpCurrentSdrDragMethod);
498 bRet = mpCurrentSdrDragMethod->BeginSdrDrag();
501 if (!bRet)
503 delete mpCurrentSdrDragMethod;
504 mpCurrentSdrDragMethod = 0;
505 aDragStat.SetDragMethod(mpCurrentSdrDragMethod);
510 return bRet;
513 void SdrDragView::MovDragObj(const Point& rPnt)
515 if (mpCurrentSdrDragMethod)
517 Point aPnt(rPnt);
518 ImpLimitToWorkArea(aPnt);
519 mpCurrentSdrDragMethod->MoveSdrDrag(aPnt); // this call already makes a Hide()/Show combination
523 bool SdrDragView::EndDragObj(bool bCopy)
525 bool bRet(false);
527 // #i73341# If inserting GluePoint, do not insist on last points being different
528 if(mpCurrentSdrDragMethod && aDragStat.IsMinMoved() && (IsInsertGluePoint() || aDragStat.GetNow() != aDragStat.GetPrev()))
530 sal_uIntPtr nHdlAnzMerk=0;
532 if (bEliminatePolyPoints)
533 { // IBM Special
534 nHdlAnzMerk=GetMarkablePointCount();
537 const bool bUndo = IsUndoEnabled();
538 if (IsInsertGluePoint() && bUndo)
540 BegUndo(aInsPointUndoStr);
541 AddUndo(pInsPointUndo);
544 bRet = mpCurrentSdrDragMethod->EndSdrDrag(bCopy);
546 if( IsInsertGluePoint() && bUndo)
547 EndUndo();
549 delete mpCurrentSdrDragMethod;
550 mpCurrentSdrDragMethod = 0;
552 if (bEliminatePolyPoints)
553 { // IBM Special
554 if (nHdlAnzMerk!=GetMarkablePointCount())
556 UnmarkAllPoints();
560 if (bInsPolyPoint)
562 SetMarkHandles();
563 bInsPolyPoint=false;
564 if( bUndo )
566 BegUndo(aInsPointUndoStr);
567 AddUndo(pInsPointUndo);
568 EndUndo();
572 eDragHdl=HDL_MOVE;
573 pDragHdl=NULL;
575 if (!bSomeObjChgdFlag)
577 // Obj did not broadcast (e. g. Writer FlyFrames)
578 if(!bDragHdl)
580 AdjustMarkHdl();
584 else
586 BrkDragObj();
589 bInsPolyPoint=false;
590 SetInsertGluePoint(false);
592 return bRet;
595 void SdrDragView::BrkDragObj()
597 if (mpCurrentSdrDragMethod)
599 mpCurrentSdrDragMethod->CancelSdrDrag();
601 delete mpCurrentSdrDragMethod;
602 mpCurrentSdrDragMethod = 0;
604 if (bInsPolyPoint)
606 pInsPointUndo->Undo(); // delete inserted point again
607 delete pInsPointUndo;
608 pInsPointUndo=NULL;
609 SetMarkHandles();
610 bInsPolyPoint=false;
613 if (IsInsertGluePoint())
615 pInsPointUndo->Undo(); // delete inserted glue point again
616 delete pInsPointUndo;
617 pInsPointUndo=NULL;
618 SetInsertGluePoint(false);
621 eDragHdl=HDL_MOVE;
622 pDragHdl=NULL;
626 bool SdrDragView::IsInsObjPointPossible() const
628 return pMarkedObj!=NULL && pMarkedObj->IsPolyObj();
631 bool SdrDragView::ImpBegInsObjPoint(bool bIdxZwang, sal_uInt32 nIdx, const Point& rPnt, bool bNewObj, OutputDevice* pOut)
633 bool bRet(false);
635 if(pMarkedObj && pMarkedObj->ISA(SdrPathObj))
637 SdrPathObj* pMarkedPath = (SdrPathObj*)pMarkedObj;
638 BrkAction();
639 pInsPointUndo = dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pMarkedObj) );
640 DBG_ASSERT( pInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
642 OUString aStr(ImpGetResStr(STR_DragInsertPoint));
644 aInsPointUndoStr = aStr.replaceFirst("%1", pMarkedObj->TakeObjNameSingul() );
646 Point aPt(rPnt);
648 if(bNewObj)
649 aPt = GetSnapPos(aPt,pMarkedPV);
651 bool bClosed0 = pMarkedPath->IsClosedObj();
653 if(bIdxZwang)
655 mnInsPointNum = pMarkedPath->NbcInsPoint(nIdx, aPt, bNewObj, true);
657 else
659 mnInsPointNum = pMarkedPath->NbcInsPointOld(aPt, bNewObj, true);
662 if(bClosed0 != pMarkedPath->IsClosedObj())
664 // Obj was closed implicitly
665 // object changed
666 pMarkedPath->SetChanged();
667 pMarkedPath->BroadcastObjectChange();
670 if(0xffffffff != mnInsPointNum)
672 bInsPolyPoint = true;
673 UnmarkAllPoints();
674 AdjustMarkHdl();
676 bRet = BegDragObj(rPnt, pOut, aHdl.GetHdl(mnInsPointNum), 0);
678 if (bRet)
680 aDragStat.SetMinMoved();
681 MovDragObj(rPnt);
684 else
686 delete pInsPointUndo;
687 pInsPointUndo = NULL;
691 return bRet;
694 bool SdrDragView::EndInsObjPoint(SdrCreateCmd eCmd)
696 if(IsInsObjPoint())
698 sal_uInt32 nNextPnt(mnInsPointNum);
699 Point aPnt(aDragStat.GetNow());
700 bool bOk=EndDragObj(false);
701 if (bOk && eCmd!=SDRCREATE_FORCEEND)
703 // Ret=True means: Action is over.
704 bOk=!(ImpBegInsObjPoint(true, nNextPnt, aPnt, eCmd == SDRCREATE_NEXTOBJECT, pDragWin));
707 return bOk;
708 } else return false;
711 bool SdrDragView::IsInsGluePointPossible() const
713 bool bRet=false;
714 if (IsInsGluePointMode() && AreObjectsMarked())
716 if (GetMarkedObjectCount()==1)
718 // return sal_False, if only 1 object which is a connector.
719 const SdrObject* pObj=GetMarkedObjectByIndex(0);
720 if (!HAS_BASE(SdrEdgeObj,pObj))
722 bRet=true;
725 else
727 bRet=true;
730 return bRet;
733 bool SdrDragView::BegInsGluePoint(const Point& rPnt)
735 bool bRet=false;
736 SdrObject* pObj;
737 SdrPageView* pPV;
738 sal_uIntPtr nMarkNum;
739 if (PickMarkedObj(rPnt,pObj,pPV,&nMarkNum,SDRSEARCH_PASS2BOUND))
741 BrkAction();
742 UnmarkAllGluePoints();
743 pInsPointUndo= dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj) );
744 DBG_ASSERT( pInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
745 OUString aStr(ImpGetResStr(STR_DragInsertGluePoint));
747 aInsPointUndoStr = aStr.replaceFirst("%1", pObj->TakeObjNameSingul() );
749 SdrGluePointList* pGPL=pObj->ForceGluePointList();
750 if (pGPL!=NULL)
752 sal_uInt16 nGlueIdx=pGPL->Insert(SdrGluePoint());
753 SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
754 sal_uInt16 nGlueId=rGP.GetId();
755 rGP.SetAbsolutePos(rPnt,*pObj);
757 SdrHdl* pHdl=NULL;
758 if (MarkGluePoint(pObj,nGlueId,pPV))
760 pHdl=GetGluePointHdl(pObj,nGlueId);
762 if (pHdl!=NULL && pHdl->GetKind()==HDL_GLUE && pHdl->GetObj()==pObj && pHdl->GetObjHdlNum()==nGlueId)
764 SetInsertGluePoint(true);
765 bRet=BegDragObj(rPnt,NULL,pHdl,0);
766 if (bRet)
768 aDragStat.SetMinMoved();
769 MovDragObj(rPnt);
771 else
773 SetInsertGluePoint(false);
774 delete pInsPointUndo;
775 pInsPointUndo=NULL;
778 else
780 OSL_FAIL("BegInsGluePoint(): GluePoint handle not found.");
783 else
785 // no glue points possible for this object (e. g. Edge)
786 SetInsertGluePoint(false);
787 delete pInsPointUndo;
788 pInsPointUndo=NULL;
792 return bRet;
795 void SdrDragView::ShowDragObj()
797 if(mpCurrentSdrDragMethod && !aDragStat.IsShown())
799 for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
801 SdrPaintWindow* pCandidate = GetPaintWindow(a);
802 rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = pCandidate->GetOverlayManager();
804 if (xOverlayManager.is())
806 mpCurrentSdrDragMethod->CreateOverlayGeometry(*xOverlayManager);
808 // #i101679# Force changed overlay to be shown
809 xOverlayManager->flush();
813 aDragStat.SetShown(true);
817 void SdrDragView::HideDragObj()
819 if(mpCurrentSdrDragMethod && aDragStat.IsShown())
821 mpCurrentSdrDragMethod->destroyOverlayGeometry();
822 aDragStat.SetShown(false);
828 void SdrDragView::SetNoDragXorPolys(bool bOn)
830 if (IsNoDragXorPolys()!=bOn)
832 const bool bDragging(mpCurrentSdrDragMethod);
833 const bool bShown(bDragging && aDragStat.IsShown());
835 if(bShown)
837 HideDragObj();
840 bNoDragXorPolys = bOn;
842 if(bDragging)
844 // force recreation of drag content
845 mpCurrentSdrDragMethod->resetSdrDragEntries();
848 if(bShown)
850 ShowDragObj();
855 void SdrDragView::SetDragStripes(bool bOn)
857 if (mpCurrentSdrDragMethod && aDragStat.IsShown())
859 HideDragObj();
860 bDragStripes=bOn;
861 ShowDragObj();
863 else
865 bDragStripes=bOn;
869 bool SdrDragView::IsOrthoDesired() const
871 if(mpCurrentSdrDragMethod && (IS_TYPE(SdrDragObjOwn, mpCurrentSdrDragMethod) || IS_TYPE(SdrDragResize, mpCurrentSdrDragMethod)))
873 return bOrthoDesiredOnMarked;
876 return false;
879 void SdrDragView::SetMarkHandles()
881 if( pDragHdl )
882 pDragHdl = 0;
884 SdrExchangeView::SetMarkHandles();
887 void SdrDragView::SetSolidDragging(bool bOn)
889 if((bool)mbSolidDragging != bOn)
891 mbSolidDragging = bOn;
895 bool SdrDragView::IsSolidDragging() const
897 // allow each user to disable by having a local setting, but using AND for
898 // checking allowance
899 return mbSolidDragging && getOptionsDrawinglayer().IsSolidDragCreate();
902 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */