1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svddrgv.cxx,v $
10 * $Revision: 1.27.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #include <svx/svddrgv.hxx>
36 #include <svx/xpoly.hxx>
37 #include <svx/svdetc.hxx>
38 #include <svx/svdtrans.hxx>
39 #include <svx/svdundo.hxx>
40 #include <svx/svdocapt.hxx>
41 #include <svx/svdpagv.hxx>
42 #include <svx/svdopath.hxx>
43 #include <svx/svdoedge.hxx>
45 #include "svdglob.hxx"
46 #include "svddrgm1.hxx"
47 #include <svx/obj3d.hxx>
48 #include <svx/svdoashp.hxx>
49 #include <sdrpaintwindow.hxx>
50 #include <basegfx/polygon/b2dpolypolygontools.hxx>
51 #include <basegfx/polygon/b2dpolygontools.hxx>
52 #include <svx/polypolygoneditor.hxx>
53 #include <basegfx/matrix/b2dhommatrix.hxx>
54 #include <svx/sdr/overlay/overlaymanager.hxx>
58 ////////////////////////////////////////////////////////////////////////////////////////////////////
59 ////////////////////////////////////////////////////////////////////////////////////////////////////
61 // @@@@@ @@@@@ @@@@ @@@@ @@ @@ @@ @@@@@ @@ @@
62 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
63 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
64 // @@ @@ @@@@@ @@@@@@ @@ @@@ @@@@@ @@ @@@@ @@@@@@@
65 // @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
66 // @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
67 // @@@@@ @@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@
69 ////////////////////////////////////////////////////////////////////////////////////////////////////
70 ////////////////////////////////////////////////////////////////////////////////////////////////////
72 void SdrDragView::ImpClearVars()
75 eDragMode
=SDRDRAG_MOVE
;
77 bMarkedHitMovesAlways
=FALSE
;
82 mpCurrentSdrDragMethod
=NULL
;
88 bInsObjPointMode
=FALSE
;
89 bInsGluePointMode
=FALSE
;
90 nDragXorPolyLimit
=100;
91 nDragXorPointLimit
=500;
92 bNoDragXorPolys
=FALSE
;
95 bRubberEdgeDragging
=TRUE
;
96 nRubberEdgeDraggingLimit
=100;
97 bDetailedEdgeDragging
=TRUE
;
98 nDetailedEdgeDraggingLimit
=10;
99 bResizeAtCenter
=FALSE
;
100 bCrookAtCenter
=FALSE
;
101 bMouseHideWhileDraggingPoints
=FALSE
;
103 // init using default
104 mbSolidDragging
= getOptionsDrawinglayer().IsSolidDragCreate();
107 void SdrDragView::ImpMakeDragAttr()
112 SdrDragView::SdrDragView(SdrModel
* pModel1
, OutputDevice
* pOut
)
113 : SdrExchangeView(pModel1
,pOut
)
119 SdrDragView::~SdrDragView()
124 void SdrDragView::ImpDelDragAttr()
128 BOOL
SdrDragView::IsAction() const
130 return (mpCurrentSdrDragMethod
|| SdrExchangeView::IsAction());
133 void SdrDragView::MovAction(const Point
& rPnt
)
135 SdrExchangeView::MovAction(rPnt
);
136 if (mpCurrentSdrDragMethod
)
142 void SdrDragView::EndAction()
144 if (mpCurrentSdrDragMethod
)
148 SdrExchangeView::EndAction();
151 void SdrDragView::BckAction()
153 SdrExchangeView::BckAction();
157 void SdrDragView::BrkAction()
159 SdrExchangeView::BrkAction();
163 void SdrDragView::TakeActionRect(Rectangle
& rRect
) const
165 if (mpCurrentSdrDragMethod
)
167 rRect
=aDragStat
.GetActionRect();
170 SdrPageView
* pPV
= GetSdrPageView();
172 if(pPV
&& pPV
->HasMarkedObjPageView())
174 // #i95646# is this used..?
175 const basegfx::B2DRange
aBoundRange(mpCurrentSdrDragMethod
->getCurrentRange());
177 basegfx::fround(aBoundRange
.getMinX()), basegfx::fround(aBoundRange
.getMinY()),
178 basegfx::fround(aBoundRange
.getMaxX()), basegfx::fround(aBoundRange
.getMaxY()));
183 rRect
=Rectangle(aDragStat
.GetNow(),aDragStat
.GetNow());
188 SdrExchangeView::TakeActionRect(rRect
);
192 BOOL
SdrDragView::TakeDragObjAnchorPos(Point
& rPos
, BOOL bTR
) const
196 rPos
= bTR
? aR
.TopRight() : aR
.TopLeft();
197 if (GetMarkedObjectCount()==1 && IsDragObj() && // nur bei Einzelselektion
198 !IsDraggingPoints() && !IsDraggingGluePoints() && // nicht beim Punkteschieben
199 !mpCurrentSdrDragMethod
->ISA(SdrDragMovHdl
)) // nicht beim Handlesschieben
201 SdrObject
* pObj
=GetMarkedObjectByIndex(0);
202 if (pObj
->ISA(SdrCaptionObj
))
204 Point
aPt(((SdrCaptionObj
*)pObj
)->GetTailPos());
205 BOOL bTail
=eDragHdl
==HDL_POLY
; // Schwanz wird gedraggt (nicht so ganz feine Abfrage hier)
206 BOOL bOwn
=mpCurrentSdrDragMethod
->ISA(SdrDragObjOwn
); // Objektspeziefisch
208 { // bei bTail liefert TakeActionRect schon das richtige
210 { // bOwn kann sein MoveTextFrame, ResizeTextFrame aber eben nicht mehr DragTail
215 // drag the whole Object (Move, Resize, ...)
216 const basegfx::B2DPoint
aTransformed(mpCurrentSdrDragMethod
->getCurrentTransformation() * basegfx::B2DPoint(aPt
.X(), aPt
.Y()));
217 rPos
.X() = basegfx::fround(aTransformed
.getX());
218 rPos
.Y() = basegfx::fround(aTransformed
.getY());
227 ////////////////////////////////////////////////////////////////////////////////////////////////////
229 BOOL
SdrDragView::TakeDragLimit(SdrDragMode
/*eMode*/, Rectangle
& /*rRect*/) const
234 BOOL
SdrDragView::BegDragObj(const Point
& rPnt
, OutputDevice
* pOut
, SdrHdl
* pHdl
, short nMinMov
, SdrDragMethod
* pForcedMeth
)
240 SetDragWithCopy(FALSE
);
241 //ForceEdgesOfMarkedNodes();
242 //TODO: aAni.Reset();
243 mpCurrentSdrDragMethod
=NULL
;
246 SdrDragMode eTmpMode
=eDragMode
;
247 if (eTmpMode
==SDRDRAG_MOVE
&& pHdl
!=NULL
&& pHdl
->GetKind()!=HDL_MOVE
) {
248 eTmpMode
=SDRDRAG_RESIZE
;
250 bDragLimit
=TakeDragLimit(eTmpMode
,aDragLimit
);
251 bFramDrag
=ImpIsFrameHandles();
253 (pMarkedObj
==NULL
|| !pMarkedObj
->hasSpecialDrag()) &&
254 (pHdl
==NULL
|| pHdl
->GetObj()==NULL
)) {
260 || pHdl
->GetKind() == HDL_MOVE
261 || pHdl
->GetKind() == HDL_MIRX
262 || pHdl
->GetKind() == HDL_TRNS
263 || pHdl
->GetKind() == HDL_GRAD
)
265 aDragStat
.Reset(aPnt
);
269 aDragStat
.Reset(pHdl
->GetPos());
272 aDragStat
.SetView((SdrView
*)this);
273 aDragStat
.SetPageView(pMarkedPV
); // <<-- hier muss die DragPV rein!!!
274 aDragStat
.SetMinMove(ImpGetMinMovLogic(nMinMov
,pOut
));
275 aDragStat
.SetHdl(pHdl
);
276 aDragStat
.NextPoint();
279 eDragHdl
= pHdl
==NULL
? HDL_MOVE
: pHdl
->GetKind();
280 bDragHdl
=eDragHdl
==HDL_REF1
|| eDragHdl
==HDL_REF2
|| eDragHdl
==HDL_MIRX
;
282 // #103894# Expand test for HDL_ANCHOR_TR
283 BOOL bNotDraggable
= (HDL_ANCHOR
== eDragHdl
|| HDL_ANCHOR_TR
== eDragHdl
);
287 mpCurrentSdrDragMethod
= new SdrDragMovHdl(*this);
289 else if(!bNotDraggable
)
293 case SDRDRAG_ROTATE
: case SDRDRAG_SHEAR
: case SDRDRAG_DISTORT
:
297 case HDL_LEFT
: case HDL_RIGHT
:
298 case HDL_UPPER
: case HDL_LOWER
:
300 // Sind 3D-Objekte selektiert?
301 BOOL b3DObjSelected
= FALSE
;
302 for(UINT32 a
=0;!b3DObjSelected
&& a
<GetMarkedObjectCount();a
++)
304 SdrObject
* pObj
= GetMarkedObjectByIndex(a
);
305 if(pObj
&& pObj
->ISA(E3dObject
))
306 b3DObjSelected
= TRUE
;
308 // Falls ja, Shear auch bei !IsShearAllowed zulassen,
309 // da es sich bei 3D-Objekten um eingeschraenkte
310 // Rotationen handelt
311 if (!b3DObjSelected
&& !IsShearAllowed())
313 mpCurrentSdrDragMethod
= new SdrDragShear(*this,eDragMode
==SDRDRAG_ROTATE
);
315 case HDL_UPLFT
: case HDL_UPRGT
:
316 case HDL_LWLFT
: case HDL_LWRGT
:
318 if (eDragMode
==SDRDRAG_SHEAR
|| eDragMode
==SDRDRAG_DISTORT
)
320 if (!IsDistortAllowed(TRUE
) && !IsDistortAllowed(FALSE
)) return FALSE
;
321 mpCurrentSdrDragMethod
= new SdrDragDistort(*this);
325 if (!IsRotateAllowed(TRUE
)) return FALSE
;
326 mpCurrentSdrDragMethod
= new SdrDragRotate(*this);
331 if (IsMarkedHitMovesAlways() && eDragHdl
==HDL_MOVE
)
332 { // HDL_MOVE ist auch wenn Obj direkt getroffen
333 if (!IsMoveAllowed()) return FALSE
;
334 mpCurrentSdrDragMethod
= new SdrDragMove(*this);
338 if (!IsRotateAllowed(TRUE
)) return FALSE
;
339 mpCurrentSdrDragMethod
= new SdrDragRotate(*this);
346 if (eDragHdl
==HDL_MOVE
&& IsMarkedHitMovesAlways())
348 if (!IsMoveAllowed()) return FALSE
;
349 mpCurrentSdrDragMethod
= new SdrDragMove(*this);
353 if (!IsMirrorAllowed(TRUE
,TRUE
)) return FALSE
;
354 mpCurrentSdrDragMethod
= new SdrDragMirror(*this);
360 if (eDragHdl
==HDL_MOVE
&& IsMarkedHitMovesAlways())
362 if (!IsMoveAllowed())
364 mpCurrentSdrDragMethod
= new SdrDragMove(*this);
368 if (!IsCrookAllowed(TRUE
) && !IsCrookAllowed(FALSE
))
370 mpCurrentSdrDragMethod
= new SdrDragCrop(*this);
375 case SDRDRAG_TRANSPARENCE
:
377 if(eDragHdl
== HDL_MOVE
&& IsMarkedHitMovesAlways())
381 mpCurrentSdrDragMethod
= new SdrDragMove(*this);
385 if(!IsTransparenceAllowed())
388 mpCurrentSdrDragMethod
= new SdrDragGradient(*this, FALSE
);
392 case SDRDRAG_GRADIENT
:
394 if(eDragHdl
== HDL_MOVE
&& IsMarkedHitMovesAlways())
398 mpCurrentSdrDragMethod
= new SdrDragMove(*this);
402 if(!IsGradientAllowed())
405 mpCurrentSdrDragMethod
= new SdrDragGradient(*this);
412 if (eDragHdl
==HDL_MOVE
&& IsMarkedHitMovesAlways())
414 if (!IsMoveAllowed()) return FALSE
;
415 mpCurrentSdrDragMethod
= new SdrDragMove(*this);
419 if (!IsCrookAllowed(TRUE
) && !IsCrookAllowed(FALSE
)) return FALSE
;
420 mpCurrentSdrDragMethod
= new SdrDragCrook(*this);
427 if((eDragHdl
== HDL_MOVE
) && !IsMoveAllowed())
431 else if(eDragHdl
== HDL_GLUE
)
433 mpCurrentSdrDragMethod
= new SdrDragMove(*this);
439 if(eDragHdl
== HDL_MOVE
)
441 mpCurrentSdrDragMethod
= new SdrDragMove(*this);
445 if(!IsResizeAllowed(TRUE
))
450 sal_Bool bSingleTextObjMark
= sal_False
; // SJ: #i100490#
451 if ( GetMarkedObjectCount() == 1 )
453 pMarkedObj
=GetMarkedObjectByIndex(0);
455 pMarkedObj
->ISA( SdrTextObj
) &&
456 static_cast<SdrTextObj
*>(pMarkedObj
)->IsTextFrame() )
457 bSingleTextObjMark
= sal_True
;
459 if ( bSingleTextObjMark
)
460 mpCurrentSdrDragMethod
= new SdrDragObjOwn(*this);
462 mpCurrentSdrDragMethod
= new SdrDragResize(*this);
467 if(HDL_MOVE
== eDragHdl
)
469 const bool bCustomShapeSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrObjCustomShape
));
471 if(bCustomShapeSelected
)
473 mpCurrentSdrDragMethod
= new SdrDragMove( *this );
476 else if(HDL_POLY
== eDragHdl
)
478 const bool bConnectorSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrEdgeObj
));
480 if(bConnectorSelected
)
483 // fallback to old behaviour for connectors (see
484 // text in task description for more details)
486 else if(!IsMoveAllowed() || !IsResizeAllowed())
489 // do not allow move of polygon points if object is move or size protected
494 if(!mpCurrentSdrDragMethod
)
496 // fallback to DragSpecial if no interaction defined
498 mpCurrentSdrDragMethod
= new SdrDragObjOwn(*this);
505 if (pForcedMeth
!=NULL
)
507 delete mpCurrentSdrDragMethod
;
508 mpCurrentSdrDragMethod
= pForcedMeth
;
510 aDragStat
.SetDragMethod(mpCurrentSdrDragMethod
);
511 if (mpCurrentSdrDragMethod
)
513 bRet
= mpCurrentSdrDragMethod
->BeginSdrDrag();
516 if (pHdl
==NULL
&& IS_TYPE(SdrDragObjOwn
,mpCurrentSdrDragMethod
))
518 // Aha, Obj kann nicht Move SpecialDrag, also MoveFrameDrag versuchen
519 delete mpCurrentSdrDragMethod
;
520 mpCurrentSdrDragMethod
= 0;
523 if (!IsMoveAllowed())
527 mpCurrentSdrDragMethod
= new SdrDragMove(*this);
528 aDragStat
.SetDragMethod(mpCurrentSdrDragMethod
);
529 bRet
= mpCurrentSdrDragMethod
->BeginSdrDrag();
534 delete mpCurrentSdrDragMethod
;
535 mpCurrentSdrDragMethod
= 0;
536 aDragStat
.SetDragMethod(mpCurrentSdrDragMethod
);
544 void SdrDragView::MovDragObj(const Point
& rPnt
)
546 if (mpCurrentSdrDragMethod
)
549 ImpLimitToWorkArea(aPnt
);
550 mpCurrentSdrDragMethod
->MoveSdrDrag(aPnt
); // this call already makes a Hide()/Show combination
554 BOOL
SdrDragView::EndDragObj(BOOL bCopy
)
558 // #i73341# If insert GluePoint, do not insist on last points being different
559 if(mpCurrentSdrDragMethod
&& aDragStat
.IsMinMoved() && (IsInsertGluePoint() || aDragStat
.GetNow() != aDragStat
.GetPrev()))
563 if (bEliminatePolyPoints
)
565 nHdlAnzMerk
=GetMarkablePointCount();
568 const bool bUndo
= IsUndoEnabled();
569 if (IsInsertGluePoint() && bUndo
)
571 BegUndo(aInsPointUndoStr
);
572 AddUndo(pInsPointUndo
);
575 bRet
= mpCurrentSdrDragMethod
->EndSdrDrag(bCopy
);
577 if( IsInsertGluePoint() && bUndo
)
580 delete mpCurrentSdrDragMethod
;
581 mpCurrentSdrDragMethod
= 0;
583 if (bEliminatePolyPoints
)
585 if (nHdlAnzMerk
!=GetMarkablePointCount())
597 BegUndo(aInsPointUndoStr
);
598 AddUndo(pInsPointUndo
);
606 if (!bSomeObjChgdFlag
)
608 // Aha, Obj hat nicht gebroadcastet (z.B. Writer FlyFrames)
621 SetInsertGluePoint(FALSE
);
626 void SdrDragView::BrkDragObj()
628 if (mpCurrentSdrDragMethod
)
630 mpCurrentSdrDragMethod
->CancelSdrDrag();
632 delete mpCurrentSdrDragMethod
;
633 mpCurrentSdrDragMethod
= 0;
637 pInsPointUndo
->Undo(); // Den eingefuegten Punkt wieder raus
638 delete pInsPointUndo
;
644 if (IsInsertGluePoint())
646 pInsPointUndo
->Undo(); // Den eingefuegten Klebepunkt wieder raus
647 delete pInsPointUndo
;
649 SetInsertGluePoint(FALSE
);
657 BOOL
SdrDragView::IsInsObjPointPossible() const
659 return pMarkedObj
!=NULL
&& pMarkedObj
->IsPolyObj();
662 sal_Bool
SdrDragView::ImpBegInsObjPoint(sal_Bool bIdxZwang
, sal_uInt32 nIdx
, const Point
& rPnt
, sal_Bool bNewObj
, OutputDevice
* pOut
)
664 sal_Bool
bRet(sal_False
);
666 if(pMarkedObj
&& pMarkedObj
->ISA(SdrPathObj
))
668 SdrPathObj
* pMarkedPath
= (SdrPathObj
*)pMarkedObj
;
670 pInsPointUndo
= dynamic_cast< SdrUndoGeoObj
* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pMarkedObj
) );
671 DBG_ASSERT( pInsPointUndo
, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
673 XubString
aStr(ImpGetResStr(STR_DragInsertPoint
));
675 pMarkedObj
->TakeObjNameSingul(aName
);
676 xub_StrLen
nPos(aStr
.SearchAscii("%1"));
678 if(STRING_NOTFOUND
!= nPos
)
681 aStr
.Insert(aName
, nPos
);
684 aInsPointUndoStr
= aStr
;
688 aPt
= GetSnapPos(aPt
,pMarkedPV
);
690 sal_Bool
bClosed0(pMarkedPath
->IsClosedObj());
694 mnInsPointNum
= pMarkedPath
->NbcInsPoint(nIdx
, aPt
, bNewObj
, sal_True
);
698 mnInsPointNum
= pMarkedPath
->NbcInsPointOld(aPt
, bNewObj
, sal_True
);
701 if(bClosed0
!= pMarkedPath
->IsClosedObj())
703 // Obj was closed implicit
705 pMarkedPath
->SetChanged();
706 pMarkedPath
->BroadcastObjectChange();
709 if(0xffffffff != mnInsPointNum
)
711 bInsPolyPoint
= sal_True
;
715 bRet
= BegDragObj(rPnt
, pOut
, aHdl
.GetHdl(mnInsPointNum
), 0);
719 aDragStat
.SetMinMoved();
725 delete pInsPointUndo
;
726 pInsPointUndo
= NULL
;
733 BOOL
SdrDragView::EndInsObjPoint(SdrCreateCmd eCmd
)
737 sal_uInt32
nNextPnt(mnInsPointNum
);
738 Point
aPnt(aDragStat
.GetNow());
739 BOOL bOk
=EndDragObj(FALSE
);
740 if (bOk
==TRUE
&& eCmd
!=SDRCREATE_FORCEEND
)
742 // Ret=True bedeutet: Action ist vorbei.
743 bOk
=!(ImpBegInsObjPoint(sal_True
, nNextPnt
, aPnt
, eCmd
== SDRCREATE_NEXTOBJECT
, pDragWin
));
750 BOOL
SdrDragView::IsInsGluePointPossible() const
753 if (IsInsGluePointMode() && AreObjectsMarked())
755 if (GetMarkedObjectCount()==1)
757 // FALSE liefern, wenn 1 Objekt und dieses ein Verbinder ist.
758 const SdrObject
* pObj
=GetMarkedObjectByIndex(0);
759 if (!HAS_BASE(SdrEdgeObj
,pObj
))
772 BOOL
SdrDragView::BegInsGluePoint(const Point
& rPnt
)
778 if (PickMarkedObj(rPnt
,pObj
,pPV
,&nMarkNum
,SDRSEARCH_PASS2BOUND
))
781 UnmarkAllGluePoints();
782 pInsPointUndo
= dynamic_cast< SdrUndoGeoObj
* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj
) );
783 DBG_ASSERT( pInsPointUndo
, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
784 XubString
aStr(ImpGetResStr(STR_DragInsertGluePoint
));
785 XubString aName
; pObj
->TakeObjNameSingul(aName
);
787 aStr
.SearchAndReplaceAscii("%1", aName
);
789 aInsPointUndoStr
=aStr
;
790 SdrGluePointList
* pGPL
=pObj
->ForceGluePointList();
793 USHORT nGlueIdx
=pGPL
->Insert(SdrGluePoint());
794 SdrGluePoint
& rGP
=(*pGPL
)[nGlueIdx
];
795 USHORT nGlueId
=rGP
.GetId();
796 rGP
.SetAbsolutePos(rPnt
,*pObj
);
799 if (MarkGluePoint(pObj
,nGlueId
,pPV
))
801 pHdl
=GetGluePointHdl(pObj
,nGlueId
);
803 if (pHdl
!=NULL
&& pHdl
->GetKind()==HDL_GLUE
&& pHdl
->GetObj()==pObj
&& pHdl
->GetObjHdlNum()==nGlueId
)
805 SetInsertGluePoint(TRUE
);
806 bRet
=BegDragObj(rPnt
,NULL
,pHdl
,0);
809 aDragStat
.SetMinMoved();
814 SetInsertGluePoint(FALSE
);
815 delete pInsPointUndo
;
821 DBG_ERROR("BegInsGluePoint(): GluePoint-Handle nicht gefunden");
826 // Keine Klebepunkte moeglich bei diesem Objekt (z.B. Edge)
827 SetInsertGluePoint(FALSE
);
828 delete pInsPointUndo
;
836 void SdrDragView::ShowDragObj()
838 if(mpCurrentSdrDragMethod
&& !aDragStat
.IsShown())
840 for(sal_uInt32
a(0); a
< PaintWindowCount(); a
++)
842 SdrPaintWindow
* pCandidate
= GetPaintWindow(a
);
843 sdr::overlay::OverlayManager
* pOverlayManager
= pCandidate
->GetOverlayManager();
847 mpCurrentSdrDragMethod
->CreateOverlayGeometry(*pOverlayManager
);
849 // #i101679# Force changed overlay to be shown
850 pOverlayManager
->flush();
854 aDragStat
.SetShown(TRUE
);
858 void SdrDragView::HideDragObj()
860 if(mpCurrentSdrDragMethod
&& aDragStat
.IsShown())
862 mpCurrentSdrDragMethod
->destroyOverlayGeometry();
863 aDragStat
.SetShown(FALSE
);
867 ////////////////////////////////////////////////////////////////////////////////////////////////////
869 void SdrDragView::SetNoDragXorPolys(BOOL bOn
)
871 if (IsNoDragXorPolys()!=bOn
)
873 const bool bDragging(mpCurrentSdrDragMethod
);
874 const bool bShown(bDragging
&& aDragStat
.IsShown());
881 bNoDragXorPolys
= bOn
;
885 // force recreation of drag content
886 mpCurrentSdrDragMethod
->resetSdrDragEntries();
896 void SdrDragView::SetDragStripes(BOOL bOn
)
898 if (mpCurrentSdrDragMethod
&& aDragStat
.IsShown())
910 BOOL
SdrDragView::IsOrthoDesired() const
912 if(mpCurrentSdrDragMethod
&& (IS_TYPE(SdrDragObjOwn
, mpCurrentSdrDragMethod
) || IS_TYPE(SdrDragResize
, mpCurrentSdrDragMethod
)))
914 return bOrthoDesiredOnMarked
;
920 ////////////////////////////////////////////////////////////////////////////////////////////////////
922 void SdrDragView::SetRubberEdgeDragging(BOOL bOn
)
924 if (bOn
!=IsRubberEdgeDragging())
926 ULONG nAnz
= GetEdgesOfMarkedNodes().GetMarkCount();
927 BOOL bShowHide
=nAnz
!=0 && IsDragObj() &&
928 (nRubberEdgeDraggingLimit
>=nAnz
);
931 bRubberEdgeDragging
=bOn
;
937 void SdrDragView::SetRubberEdgeDraggingLimit(USHORT nEdgeObjAnz
)
939 if (nEdgeObjAnz
!=nRubberEdgeDraggingLimit
)
941 ULONG nAnz
= GetEdgesOfMarkedNodes().GetMarkCount();
942 BOOL bShowHide
=IsRubberEdgeDragging() && nAnz
!=0 && IsDragObj() &&
943 (nEdgeObjAnz
>=nAnz
)!=(nRubberEdgeDraggingLimit
>=nAnz
);
946 nRubberEdgeDraggingLimit
=nEdgeObjAnz
;
952 void SdrDragView::SetDetailedEdgeDragging(BOOL bOn
)
954 if (bOn
!=IsDetailedEdgeDragging())
956 ULONG nAnz
= GetEdgesOfMarkedNodes().GetMarkCount();
957 BOOL bShowHide
=nAnz
!=0 && IsDragObj() &&
958 (nDetailedEdgeDraggingLimit
>=nAnz
);
961 bDetailedEdgeDragging
=bOn
;
967 void SdrDragView::SetDetailedEdgeDraggingLimit(USHORT nEdgeObjAnz
)
969 if (nEdgeObjAnz
!=nDetailedEdgeDraggingLimit
)
971 ULONG nAnz
= GetEdgesOfMarkedNodes().GetMarkCount();
972 BOOL bShowHide
=IsDetailedEdgeDragging() && nAnz
!=0 && IsDragObj() &&
973 (nEdgeObjAnz
>=nAnz
)!=(nDetailedEdgeDraggingLimit
>=nAnz
);
976 nDetailedEdgeDraggingLimit
=nEdgeObjAnz
;
982 void SdrDragView::SetMarkHandles()
987 SdrExchangeView::SetMarkHandles();
990 void SdrDragView::SetSolidDragging(bool bOn
)
992 if((bool)mbSolidDragging
!= bOn
)
994 mbSolidDragging
= bOn
;
998 bool SdrDragView::IsSolidDragging() const
1000 // allow each user to disable by having a local setting, but using AND for
1001 // checking allowance
1002 return mbSolidDragging
&& getOptionsDrawinglayer().IsSolidDragCreate();