LibreOffice Module svx (master)  1
svddrgv.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 
21 #include <tools/debug.hxx>
22 #include <svx/svddrgv.hxx>
23 #include <svx/svdview.hxx>
24 #include <svx/svdundo.hxx>
25 #include <svx/svdocapt.hxx>
26 #include <svx/svdpagv.hxx>
27 #include <svx/svdopath.hxx>
28 #include <svx/svdoedge.hxx>
29 #include <svx/strings.hrc>
30 #include <svx/dialmgr.hxx>
31 #include "svddrgm1.hxx"
32 #include <svx/obj3d.hxx>
33 #include <svx/svdoashp.hxx>
34 #include <svx/sdrpaintwindow.hxx>
37 #include <svx/sdrpagewindow.hxx>
38 
39 using namespace sdr;
40 
42  : SdrExchangeView(rSdrModel, pOut)
43  , mpDragHdl(nullptr)
44  , mpInsPointUndo(nullptr)
45  , meDragHdl(SdrHdlKind::Move)
46  , mbFramDrag(false)
47  , mbMarkedHitMovesAlways(false)
48  , mbDragLimit(false)
49  , mbDragHdl(false)
50  , mbDragStripes(false)
51  , mbSolidDragging(getOptionsDrawinglayer().IsSolidDragCreate())
52  , mbResizeAtCenter(false)
53  , mbCrookAtCenter(false)
54  , mbDragWithCopy(false)
55  , mbInsGluePoint(false)
56  , mbInsObjPointMode(false)
57  , mbInsGluePointMode(false)
58  , mbNoDragXorPolys(false)
59 {
61 }
62 
64 {
65 }
66 
68 {
70 }
71 
72 void SdrDragView::MovAction(const Point& rPnt)
73 {
76  {
77  MovDragObj(rPnt);
78  }
79 }
80 
82 {
84  {
85  EndDragObj();
86  }
88 }
89 
91 {
93  BrkDragObj();
94 }
95 
97 {
99  BrkDragObj();
100 }
101 
103 {
105  {
106  rRect=maDragStat.GetActionRect();
107  if (rRect.IsEmpty())
108  {
109  SdrPageView* pPV = GetSdrPageView();
110 
111  if(pPV&& pPV->HasMarkedObjPageView())
112  {
113  // #i95646# is this used..?
114  const basegfx::B2DRange aBoundRange(mpCurrentSdrDragMethod->getCurrentRange());
115  if (aBoundRange.isEmpty())
116  {
117  rRect.SetEmpty();
118  }
119  else
120  {
121  rRect = tools::Rectangle(
122  basegfx::fround(aBoundRange.getMinX()), basegfx::fround(aBoundRange.getMinY()),
123  basegfx::fround(aBoundRange.getMaxX()), basegfx::fround(aBoundRange.getMaxY()));
124  }
125  }
126  }
127  if (rRect.IsEmpty())
128  {
130  }
131  }
132  else
133  {
135  }
136 }
137 
138 bool SdrDragView::TakeDragObjAnchorPos(Point& rPos, bool bTR ) const
139 {
140  tools::Rectangle aR;
141  TakeActionRect(aR);
142  rPos = bTR ? aR.TopRight() : aR.TopLeft();
143  if (GetMarkedObjectCount()==1 && IsDragObj() && // only on single selection
144  !IsDraggingPoints() && !IsDraggingGluePoints() && // not when moving points
145  dynamic_cast<const SdrDragMovHdl*>( mpCurrentSdrDragMethod.get() ) == nullptr) // not when moving handles
146  {
148  if (dynamic_cast<const SdrCaptionObj*>( pObj) != nullptr)
149  {
150  Point aPt(static_cast<SdrCaptionObj*>(pObj)->GetTailPos());
151  bool bTail=meDragHdl==SdrHdlKind::Poly; // drag tail
152  bool bOwn=dynamic_cast<const SdrDragObjOwn*>( mpCurrentSdrDragMethod.get() ) != nullptr; // specific to object
153  if (!bTail)
154  { // for bTail, TakeActionRect already does the right thing
155  if (bOwn)
156  { // bOwn may be MoveTextFrame, ResizeTextFrame, but may not (any more) be DragTail
157  rPos=aPt;
158  }
159  else
160  {
161  // drag the whole Object (Move, Resize, ...)
162  const basegfx::B2DPoint aTransformed(mpCurrentSdrDragMethod->getCurrentTransformation() * basegfx::B2DPoint(aPt.X(), aPt.Y()));
163  rPos.setX( basegfx::fround(aTransformed.getX()) );
164  rPos.setY( basegfx::fround(aTransformed.getY()) );
165  }
166  }
167  }
168  return true;
169  }
170  return false;
171 }
172 
173 
174 bool SdrDragView::TakeDragLimit(SdrDragMode /*eMode*/, tools::Rectangle& /*rRect*/) const
175 {
176  return false;
177 }
178 
179 bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl, short nMinMov, SdrDragMethod* _pForcedMeth)
180 {
181  BrkAction();
182 
183  // so we don't leak the object on early return
184  std::unique_ptr<SdrDragMethod> pForcedMeth(_pForcedMeth);
185 
186  bool bRet=false;
187  {
188  SetDragWithCopy(false);
189  //TODO: aAni.Reset();
190  mpCurrentSdrDragMethod=nullptr;
191  SdrDragMode eTmpMode=meDragMode;
192  if (eTmpMode==SdrDragMode::Move && pHdl!=nullptr && pHdl->GetKind()!=SdrHdlKind::Move) {
193  eTmpMode=SdrDragMode::Resize;
194  }
197  if (!mbFramDrag &&
198  (mpMarkedObj==nullptr || !mpMarkedObj->hasSpecialDrag()) &&
199  (pHdl==nullptr || pHdl->GetObj()==nullptr)) {
200  mbFramDrag=true;
201  }
202 
203  Point aPnt(rPnt);
204  basegfx::B2DVector aGridOffset(0.0, 0.0);
205 
206  // Coordinate maybe affected by GridOffset, so we may need to
207  // adapt to Model-coordinates here
209  aGridOffset,
210  basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
211  GetSdrPageView()))
212  {
213  aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
214  aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
215  }
216 
217  if(pHdl == nullptr
218  || pHdl->GetKind() == SdrHdlKind::Move
219  || pHdl->GetKind() == SdrHdlKind::MirrorAxis
220  || pHdl->GetKind() == SdrHdlKind::Transparence
221  || pHdl->GetKind() == SdrHdlKind::Gradient)
222  {
223  maDragStat.Reset(aPnt);
224  }
225  else
226  {
227  maDragStat.Reset(pHdl->GetPos());
228  }
229 
230  maDragStat.SetView(static_cast<SdrView*>(this));
231  maDragStat.SetPageView(mpMarkedPV); // <<-- DragPV has to go here!!!
232  maDragStat.SetMinMove(ImpGetMinMovLogic(nMinMov,pOut));
233  maDragStat.SetHdl(pHdl);
235  mpDragWin=pOut;
236  mpDragHdl=pHdl;
237  meDragHdl= pHdl==nullptr ? SdrHdlKind::Move : pHdl->GetKind();
239 
240  // Expand test for SdrHdlKind::Anchor_TR
241  bool bNotDraggable = (SdrHdlKind::Anchor == meDragHdl || SdrHdlKind::Anchor_TR == meDragHdl);
242 
243  if(pHdl && (pHdl->GetKind() == SdrHdlKind::SmartTag) && pForcedMeth )
244  {
245  // just use the forced method for smart tags
246  }
247  else if(mbDragHdl)
248  {
249  mpCurrentSdrDragMethod.reset(new SdrDragMovHdl(*this));
250  }
251  else if(!bNotDraggable)
252  {
253  switch (meDragMode)
254  {
256  {
257  switch (meDragHdl)
258  {
261  {
262  // are 3D objects selected?
263  bool b3DObjSelected = false;
264  for(size_t a=0; !b3DObjSelected && a<GetMarkedObjectCount(); ++a)
265  {
267  if(dynamic_cast< const E3dObject* >(pObj))
268  b3DObjSelected = true;
269  }
270  // If yes, allow shear even when !IsShearAllowed,
271  // because 3D objects are limited rotations
272  if (!b3DObjSelected && !IsShearAllowed())
273  return false;
275  } break;
278  {
280  {
281  if (!IsDistortAllowed(true) && !IsDistortAllowed()) return false;
282  mpCurrentSdrDragMethod.reset(new SdrDragDistort(*this));
283  }
284  else
285  {
286  if (!IsRotateAllowed(true)) return false;
287  mpCurrentSdrDragMethod.reset(new SdrDragRotate(*this));
288  }
289  } break;
290  default:
291  {
293  { // SdrHdlKind::Move is true, even if Obj is hit directly
294  if (!IsMoveAllowed()) return false;
295  mpCurrentSdrDragMethod.reset(new SdrDragMove(*this));
296  }
297  else
298  {
299  if (!IsRotateAllowed(true)) return false;
300  mpCurrentSdrDragMethod.reset(new SdrDragRotate(*this));
301  }
302  }
303  }
304  } break;
305  case SdrDragMode::Mirror:
306  {
308  {
309  if (!IsMoveAllowed()) return false;
310  mpCurrentSdrDragMethod.reset(new SdrDragMove(*this));
311  }
312  else
313  {
314  if (!IsMirrorAllowed(true,true)) return false;
315  mpCurrentSdrDragMethod.reset(new SdrDragMirror(*this));
316  }
317  } break;
318 
319  case SdrDragMode::Crop:
320  {
322  {
323  if (!IsMoveAllowed())
324  return false;
325  mpCurrentSdrDragMethod.reset(new SdrDragMove(*this));
326  }
327  else
328  {
329  if (!IsCropAllowed())
330  return false;
331  mpCurrentSdrDragMethod.reset(new SdrDragCrop(*this));
332  }
333  }
334  break;
335 
337  {
339  {
340  if(!IsMoveAllowed())
341  return false;
342  mpCurrentSdrDragMethod.reset(new SdrDragMove(*this));
343  }
344  else
345  {
346  if(!IsTransparenceAllowed())
347  return false;
348 
349  mpCurrentSdrDragMethod.reset(new SdrDragGradient(*this, false));
350  }
351  break;
352  }
354  {
356  {
357  if(!IsMoveAllowed())
358  return false;
359  mpCurrentSdrDragMethod.reset(new SdrDragMove(*this));
360  }
361  else
362  {
363  if(!IsGradientAllowed())
364  return false;
365 
366  mpCurrentSdrDragMethod.reset(new SdrDragGradient(*this));
367  }
368  break;
369  }
370 
371  case SdrDragMode::Crook :
372  {
374  {
375  if (!IsMoveAllowed()) return false;
376  mpCurrentSdrDragMethod.reset( new SdrDragMove(*this) );
377  }
378  else
379  {
380  if (!IsCrookAllowed(true) && !IsCrookAllowed()) return false;
381  mpCurrentSdrDragMethod.reset( new SdrDragCrook(*this) );
382  }
383  } break;
384 
385  default:
386  {
387  // SdrDragMode::Move
389  {
390  return false;
391  }
392  else if(meDragHdl == SdrHdlKind::Glue)
393  {
394  mpCurrentSdrDragMethod.reset( new SdrDragMove(*this) );
395  }
396  else
397  {
398  if(mbFramDrag)
399  {
401  {
402  mpCurrentSdrDragMethod.reset( new SdrDragMove(*this) );
403  }
404  else
405  {
406  if(!IsResizeAllowed(true))
407  {
408  return false;
409  }
410 
411  bool bSingleTextObjMark = false; // SJ: #i100490#
412  if ( GetMarkedObjectCount() == 1 )
413  {
415  if ( mpMarkedObj &&
416  dynamic_cast<const SdrTextObj*>( mpMarkedObj) != nullptr &&
417  static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame() )
418  bSingleTextObjMark = true;
419  }
420  if ( bSingleTextObjMark )
421  mpCurrentSdrDragMethod.reset( new SdrDragObjOwn(*this) );
422  else
423  mpCurrentSdrDragMethod.reset( new SdrDragResize(*this) );
424  }
425  }
426  else
427  {
429  {
430  const bool bCustomShapeSelected(1 == GetMarkedObjectCount() && dynamic_cast<const SdrObjCustomShape*>(GetMarkedObjectByIndex(0)) != nullptr);
431 
432  if(bCustomShapeSelected)
433  {
434  mpCurrentSdrDragMethod.reset( new SdrDragMove( *this ) );
435  }
436  }
437  else if(SdrHdlKind::Poly == meDragHdl)
438  {
439  const bool bConnectorSelected(1 == GetMarkedObjectCount() && dynamic_cast<const SdrEdgeObj*>(GetMarkedObjectByIndex(0)) != nullptr);
440 
441  if(bConnectorSelected)
442  {
443  // #i97784#
444  // fallback to old behaviour for connectors (see
445  // text in task description for more details)
446  }
447  else if(!IsMoveAllowed() || !IsResizeAllowed())
448  {
449  // #i77187#
450  // do not allow move of polygon points if object is move or size protected
451  return false;
452  }
453  }
454 
456  {
457  // fallback to DragSpecial if no interaction defined
458  mpCurrentSdrDragMethod.reset( new SdrDragObjOwn(*this) );
459  }
460  }
461  }
462  }
463  }
464  }
465  if (pForcedMeth)
466  {
467  mpCurrentSdrDragMethod = std::move(pForcedMeth);
468  }
471  {
472  bRet = mpCurrentSdrDragMethod->BeginSdrDrag();
473  if (!bRet)
474  {
475  if (pHdl==nullptr && dynamic_cast< const SdrDragObjOwn* >(mpCurrentSdrDragMethod.get()) != nullptr)
476  {
477  // Obj may not Move SpecialDrag, so try with MoveFrameDrag
478  mpCurrentSdrDragMethod.reset();
479 
480  if (!IsMoveAllowed())
481  return false;
482 
483  mbFramDrag=true;
484  mpCurrentSdrDragMethod.reset( new SdrDragMove(*this) );
486  bRet = mpCurrentSdrDragMethod->BeginSdrDrag();
487  }
488  }
489  if (!bRet)
490  {
491  mpCurrentSdrDragMethod.reset();
493  }
494  }
495  }
496 
497  return bRet;
498 }
499 
500 void SdrDragView::MovDragObj(const Point& rPnt)
501 {
503  return;
504 
505  Point aPnt(rPnt);
506  basegfx::B2DVector aGridOffset(0.0, 0.0);
507 
508  // Coordinate maybe affected by GridOffset, so we may need to
509  // adapt to Model-coordinates here
511  aGridOffset,
512  basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
513  GetSdrPageView()))
514  {
515  aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
516  aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
517  }
518 
519  ImpLimitToWorkArea(aPnt);
520  mpCurrentSdrDragMethod->MoveSdrDrag(aPnt); // this call already makes a Hide()/Show combination
521 }
522 
523 bool SdrDragView::EndDragObj(bool bCopy)
524 {
525  bool bRet(false);
526 
527  // #i73341# If inserting GluePoint, do not insist on last points being different
529  {
530  sal_Int32 nSavedHdlCount=0;
531 
533  {
534  nSavedHdlCount=GetMarkablePointCount();
535  }
536 
537  const bool bUndo = IsUndoEnabled();
538  if (IsInsertGluePoint() && bUndo)
539  {
541  AddUndo(std::unique_ptr<SdrUndoAction>(mpInsPointUndo));
542  }
543 
544  bRet = mpCurrentSdrDragMethod->EndSdrDrag(bCopy);
545 
546  if( IsInsertGluePoint() && bUndo)
547  EndUndo();
548 
549  mpCurrentSdrDragMethod.reset();
550 
552  {
553  if (nSavedHdlCount!=GetMarkablePointCount())
554  {
555  UnmarkAllPoints();
556  }
557  }
558 
559  if (mbInsPolyPoint)
560  {
561  SetMarkHandles(nullptr);
562  mbInsPolyPoint=false;
563  if( bUndo )
564  {
566  AddUndo(std::unique_ptr<SdrUndoAction>(mpInsPointUndo));
567  EndUndo();
568  }
569  }
570 
572  mpDragHdl=nullptr;
573 
574  if (!mbSomeObjChgdFlag)
575  {
576  // Obj did not broadcast (e. g. Writer FlyFrames)
577  if(!mbDragHdl)
578  {
579  AdjustMarkHdl();
580  }
581  }
582  }
583  else
584  {
585  BrkDragObj();
586  }
587 
588  mbInsPolyPoint=false;
589  SetInsertGluePoint(false);
590 
591  return bRet;
592 }
593 
595 {
597  return;
598 
599  mpCurrentSdrDragMethod->CancelSdrDrag();
600 
601  mpCurrentSdrDragMethod.reset();
602 
603  if (mbInsPolyPoint)
604  {
605  mpInsPointUndo->Undo(); // delete inserted point again
606  delete mpInsPointUndo;
607  mpInsPointUndo=nullptr;
608  SetMarkHandles(nullptr);
609  mbInsPolyPoint=false;
610  }
611 
612  if (IsInsertGluePoint())
613  {
614  mpInsPointUndo->Undo(); // delete inserted glue point again
615  delete mpInsPointUndo;
616  mpInsPointUndo=nullptr;
617  SetInsertGluePoint(false);
618  }
619 
621  mpDragHdl=nullptr;
622 }
623 
625 {
626  return mpMarkedObj!=nullptr && mpMarkedObj->IsPolyObj();
627 }
628 
629 bool SdrDragView::ImpBegInsObjPoint(bool bIdxZwang, const Point& rPnt, bool bNewObj, OutputDevice* pOut)
630 {
631  bool bRet(false);
632 
633  if(auto pMarkedPath = dynamic_cast<SdrPathObj*>( mpMarkedObj))
634  {
635  BrkAction();
636  mpInsPointUndo = dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mpMarkedObj).release() );
637  DBG_ASSERT( mpInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
638 
639  OUString aStr(SvxResId(STR_DragInsertPoint));
640 
641  maInsPointUndoStr = aStr.replaceFirst("%1", mpMarkedObj->TakeObjNameSingul() );
642 
643  Point aPt(rPnt);
644 
645  if(bNewObj)
646  aPt = GetSnapPos(aPt,mpMarkedPV);
647 
648  bool bClosed0 = pMarkedPath->IsClosedObj();
649 
650  const sal_uInt32 nInsPointNum { bIdxZwang
651  ? pMarkedPath->NbcInsPoint(aPt, bNewObj)
652  : pMarkedPath->NbcInsPointOld(aPt, bNewObj)
653  };
654 
655  if(bClosed0 != pMarkedPath->IsClosedObj())
656  {
657  // Obj was closed implicitly
658  // object changed
659  pMarkedPath->SetChanged();
660  pMarkedPath->BroadcastObjectChange();
661  }
662 
663  if (nInsPointNum != SAL_MAX_UINT32)
664  {
665  mbInsPolyPoint = true;
666  UnmarkAllPoints();
667  AdjustMarkHdl();
668 
669  bRet = BegDragObj(rPnt, pOut, maHdlList.GetHdl(nInsPointNum), 0);
670 
671  if (bRet)
672  {
674  MovDragObj(rPnt);
675  }
676  }
677  else
678  {
679  delete mpInsPointUndo;
680  mpInsPointUndo = nullptr;
681  }
682  }
683 
684  return bRet;
685 }
686 
688 {
689  if(IsInsObjPoint())
690  {
691  Point aPnt(maDragStat.GetNow());
692  bool bOk=EndDragObj();
693  if (bOk && eCmd!=SdrCreateCmd::ForceEnd)
694  {
695  // Ret=True means: Action is over.
696  bOk = ! ImpBegInsObjPoint(true, aPnt, eCmd == SdrCreateCmd::NextObject, mpDragWin);
697  }
698 
699  return bOk;
700  } else return false;
701 }
702 
704 {
705  bool bRet=false;
707  {
708  if (GetMarkedObjectCount()==1)
709  {
710  // return sal_False, if only 1 object which is a connector.
711  const SdrObject* pObj=GetMarkedObjectByIndex(0);
712  if (dynamic_cast<const SdrEdgeObj *>(pObj) == nullptr)
713  {
714  bRet=true;
715  }
716  }
717  else
718  {
719  bRet=true;
720  }
721  }
722  return bRet;
723 }
724 
725 bool SdrDragView::BegInsGluePoint(const Point& rPnt)
726 {
727  bool bRet=false;
728  SdrObject* pObj;
729  SdrPageView* pPV;
730  if (PickMarkedObj(rPnt,pObj,pPV,SdrSearchOptions::PASS2BOUND))
731  {
732  BrkAction();
734  mpInsPointUndo= dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj).release() );
735  DBG_ASSERT( mpInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
736  OUString aStr(SvxResId(STR_DragInsertGluePoint));
737 
738  maInsPointUndoStr = aStr.replaceFirst("%1", pObj->TakeObjNameSingul() );
739 
740  SdrGluePointList* pGPL=pObj->ForceGluePointList();
741  if (pGPL!=nullptr)
742  {
743  sal_uInt16 nGlueIdx=pGPL->Insert(SdrGluePoint());
744  SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
745  sal_uInt16 nGlueId=rGP.GetId();
746  rGP.SetAbsolutePos(rPnt,*pObj);
747 
748  SdrHdl* pHdl=nullptr;
749  if (MarkGluePoint(pObj,nGlueId,false))
750  {
751  pHdl=GetGluePointHdl(pObj,nGlueId);
752  }
753  if (pHdl!=nullptr && pHdl->GetKind()==SdrHdlKind::Glue && pHdl->GetObj()==pObj && pHdl->GetObjHdlNum()==nGlueId)
754  {
755  SetInsertGluePoint(true);
756  bRet=BegDragObj(rPnt,nullptr,pHdl,0);
757  if (bRet)
758  {
760  MovDragObj(rPnt);
761  }
762  else
763  {
764  SetInsertGluePoint(false);
765  delete mpInsPointUndo;
766  mpInsPointUndo=nullptr;
767  }
768  }
769  else
770  {
771  OSL_FAIL("BegInsGluePoint(): GluePoint handle not found.");
772  }
773  }
774  else
775  {
776  // no glue points possible for this object (e. g. Edge)
777  SetInsertGluePoint(false);
778  delete mpInsPointUndo;
779  mpInsPointUndo=nullptr;
780  }
781  }
782 
783  return bRet;
784 }
785 
787 {
789  return;
790 
791  // Changed for the GridOffset stuff: No longer iterate over
792  // SdrPaintWindow(s), but now over SdrPageWindow(s), so doing the
793  // same as the SdrHdl visualizations (see ::CreateB2dIAObject) do.
794  // This is needed to get access to an ObjectContact which is needed
795  // to evtl. process that GridOffset in CreateOverlayGeometry
796  SdrPageView* pPageView(GetSdrPageView());
797 
798  if(nullptr != pPageView)
799  {
800  for(sal_uInt32 a(0); a < pPageView->PageWindowCount(); a++)
801  {
802  const SdrPageWindow& rPageWindow(*pPageView->GetPageWindow(a));
803  const SdrPaintWindow& rPaintWindow(rPageWindow.GetPaintWindow());
804 
805  if(rPaintWindow.OutputToWindow())
806  {
807  const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager(
808  rPaintWindow.GetOverlayManager());
809 
810  if(xOverlayManager.is())
811  {
812  mpCurrentSdrDragMethod->CreateOverlayGeometry(
813  *xOverlayManager,
814  rPageWindow.GetObjectContact());
815 
816  // #i101679# Force changed overlay to be shown
817  xOverlayManager->flush();
818  }
819  }
820  }
821  }
822 
823  maDragStat.SetShown(true);
824 }
825 
827 {
829  {
830  mpCurrentSdrDragMethod->destroyOverlayGeometry();
831  maDragStat.SetShown(false);
832  }
833 }
834 
835 
837 {
838  if (IsNoDragXorPolys()==bOn)
839  return;
840 
841  const bool bDragging(mpCurrentSdrDragMethod);
842  const bool bShown(bDragging && maDragStat.IsShown());
843 
844  if(bShown)
845  {
846  HideDragObj();
847  }
848 
849  mbNoDragXorPolys = bOn;
850 
851  if(bDragging)
852  {
853  // force recreation of drag content
854  mpCurrentSdrDragMethod->resetSdrDragEntries();
855  }
856 
857  if(bShown)
858  {
859  ShowDragObj();
860  }
861 }
862 
864 {
866  {
867  HideDragObj();
868  mbDragStripes=bOn;
869  ShowDragObj();
870  }
871  else
872  {
873  mbDragStripes=bOn;
874  }
875 }
876 
878 {
879  if( dynamic_cast< const SdrDragObjOwn* >( mpCurrentSdrDragMethod.get() )
880  || dynamic_cast< const SdrDragResize* >(mpCurrentSdrDragMethod.get() ))
881  {
883  }
884 
885  return false;
886 }
887 
889 {
890  if( mpDragHdl )
891  mpDragHdl = nullptr;
892 
893  SdrExchangeView::SetMarkHandles(pOtherShell);
894 }
895 
897 {
898  if(mbSolidDragging != bOn)
899  {
900  mbSolidDragging = bOn;
901  }
902 }
903 
905 {
906  // allow each user to disable by having a local setting, but using AND for
907  // checking allowance
909 }
910 
911 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
friend class SdrDragCrook
Definition: svdedtv.hxx:75
OUString maInsPointUndoStr
Definition: svddrgv.hxx:45
void SetMinMove(sal_uInt16 nDist)
Definition: svddrag.hxx:111
virtual bool BegDragObj(const Point &rPnt, OutputDevice *pOut, SdrHdl *pHdl, short nMinMov=-3, SdrDragMethod *pForcedMeth=nullptr)
Definition: svddrgv.cxx:179
void Reset()
Definition: svddrag.cxx:36
virtual sal_Int32 GetMarkablePointCount() const
Definition: svdmrkv1.cxx:45
virtual void SetMarkHandles(SfxViewShell *pOtherShell)
Definition: svdmrkv.cxx:936
virtual bool IsAction() const override
Definition: svddrgv.cxx:67
std::unique_ptr< SdrDragMethod > mpCurrentSdrDragMethod
Definition: svddrgv.hxx:42
virtual void BrkAction() override
Definition: svdedxv.cxx:119
bool UnmarkAllGluePoints()
Definition: svdmrkv.hxx:391
bool IsResizeAllowed(bool bProp=false) const
Definition: svdedtv.cxx:389
bool mbInsPolyPoint
Definition: svdmrkv.hxx:126
virtual void TakeActionRect(tools::Rectangle &rRect) const override
Definition: svddrgv.cxx:102
bool IsShown() const
Definition: svddrag.hxx:105
virtual bool IsPolyObj() const
Definition: svdobj.cxx:1661
SdrHdlKind
Definition: svdhdl.hxx:52
bool AreObjectsMarked() const
Definition: svdmrkv.hxx:259
bool IsUndoEnabled() const
Definition: svdedtv.cxx:1053
void SetDragMethod(SdrDragMethod *pMth)
Definition: svddrag.hxx:154
bool ImpIsFrameHandles() const
Definition: svdmrkv.cxx:584
bool EndDragObj(bool bCopy=false)
Definition: svddrgv.cxx:523
SdrHdl * mpDragHdl
Definition: svddrgv.hxx:41
bool IsInsObjPoint() const
Definition: svddrgv.hxx:123
double getX() const
bool IsDraggingPoints() const
Definition: svddrgv.hxx:106
bool IsTransparenceAllowed() const
Definition: svdedtv.cxx:414
bool IsCropAllowed() const
Definition: svdedtv.cxx:420
void BegUndo()
Definition: svdedtv.hxx:178
virtual bool hasSpecialDrag() const
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdobj.cxx:1269
SdrObject * GetObj() const
Definition: svdhdl.hxx:203
double getY() const
SdrDragStat maDragStat
Definition: svdpntv.hxx:141
Changing the geometry of an object.
Definition: svdundo.hxx:207
virtual OUString TakeObjNameSingul() const
Definition: svdobj.cxx:1018
const Point & GetPos() const
Definition: svdhdl.hxx:197
SdrUndoGeoObj * mpInsPointUndo
Definition: svddrgv.hxx:43
bool IsDraggingGluePoints() const
Definition: svddrgv.hxx:107
void BrkDragObj()
Definition: svddrgv.cxx:594
virtual void SetMarkHandles(SfxViewShell *pOtherShell) override
Definition: svddrgv.cxx:888
sal_uInt16 ImpGetMinMovLogic(short nMinMov, const OutputDevice *pOut) const
Definition: svdpntv.cxx:300
bool IsMoveAllowed() const
Definition: svdedtv.hxx:234
friend class SdrDragDistort
Definition: svdedtv.hxx:74
VclPtr< OutputDevice > mpDragWin
Definition: svdpntv.hxx:128
SdrHdlKind meDragHdl
Definition: svddrgv.hxx:46
void ShowDragObj()
Definition: svddrgv.cxx:786
bool IsEmpty() const
#define SAL_MAX_UINT32
sal_uInt16 GetId() const
Definition: svdglue.hxx:86
bool MarkGluePoint(const SdrObject *pObj, sal_uInt16 nId, bool bUnmark)
Definition: svdmrkv1.cxx:476
virtual void BckAction() override
Definition: svddrgv.cxx:90
bool mbDragStripes
Definition: svddrgv.hxx:52
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
Definition: svdpagv.cxx:82
void SetInsertGluePoint(bool bOn)
Definition: svddrgv.hxx:115
virtual void MovAction(const Point &rPnt) override
Definition: svddrgv.cxx:72
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:25
Point GetSnapPos(const Point &rPnt, const SdrPageView *pPV) const
Definition: svdsnpv.cxx:254
void SetDragWithCopy(bool bOn)
Definition: svddrgv.hxx:112
bool mbNoDragXorPolys
Definition: svddrgv.hxx:60
bool IsRotateAllowed(bool b90Deg=false) const
Definition: svdedtv.cxx:397
B2IRange fround(const B2DRange &rRange)
void EndUndo()
Definition: svdedtv.cxx:301
bool IsInsObjPointPossible() const
Definition: svddrgv.cxx:624
bool IsMinMoved() const
Definition: svddrag.hxx:108
virtual void BckAction() override
Definition: svdedxv.cxx:113
virtual void EndAction() override
Definition: svddrgv.cxx:81
bool PickMarkedObj(const Point &rPnt, SdrObject *&rpObj, SdrPageView *&rpPV, SdrSearchOptions nOptions) const
Definition: svdmrkv.cxx:2292
bool ImpLimitToWorkArea(Point &rPt) const
Definition: svdxcgv.cxx:61
bool getPossibleGridOffsetForPosition(basegfx::B2DVector &rOffset, const basegfx::B2DPoint &rPoint, const SdrPageView *pPV) const
Definition: svdmrkv.cxx:2028
SdrDragMode meDragMode
Definition: svdmrkv.hxx:119
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdedtv.hxx:182
bool IsShearAllowed() const
Definition: svdedtv.cxx:432
virtual ~SdrDragView() override
Definition: svddrgv.cxx:63
SdrDragView(SdrModel &rSdrModel, OutputDevice *pOut)
Definition: svddrgv.cxx:41
void HideDragObj()
Definition: svddrgv.cxx:826
bool HasMarkedObjPageView() const
Definition: svdpagv.hxx:182
#define DBG_ASSERT(sCon, aError)
bool bEliminatePolyPoints
Definition: svdsnpv.hxx:126
bool IsInsGluePointPossible() const
Definition: svddrgv.cxx:703
uno_Any a
virtual void TakeActionRect(tools::Rectangle &rRect) const override
Definition: svdedxv.cxx:200
size_t GetMarkedObjectCount() const
Definition: svdmrkv.hxx:257
void MovDragObj(const Point &rPnt)
Definition: svddrgv.cxx:500
const tools::Rectangle & GetActionRect() const
Definition: svddrag.hxx:156
bool mbFramDrag
Definition: svddrgv.hxx:48
bool BegInsGluePoint(const Point &rPnt)
Definition: svddrgv.cxx:725
virtual bool TakeDragLimit(SdrDragMode eMode, tools::Rectangle &rRect) const
Definition: svddrgv.cxx:174
void NextPoint()
Definition: svddrag.cxx:73
bool mbSomeObjChgdFlag
Definition: svdpntv.hxx:168
SdrPageView * mpMarkedPV
Definition: svdmrkv.hxx:104
void SetHdl(SdrHdl *pH)
Definition: svddrag.hxx:102
bool TakeDragObjAnchorPos(Point &rPos, bool bTopRight) const
Definition: svddrgv.cxx:138
void SetAbsolutePos(const Point &rNewPos, const SdrObject &rObj)
Definition: svdglue.cxx:88
Abstract DrawObject.
Definition: svdobj.hxx:260
void SetSolidDragging(bool bOn)
Definition: svddrgv.cxx:896
virtual void Undo() override
Definition: svdundo.cxx:581
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
Definition: svdmodel.cxx:1961
bool IsSolidDragCreate() const
virtual std::unique_ptr< SdrUndoAction > CreateUndoGeoObject(SdrObject &rObject)
Definition: svdundo.cxx:1644
SdrObject * mpMarkedObj
Definition: svdmrkv.hxx:103
sal_uInt16 Insert(const SdrGluePoint &rGP)
Definition: svdglue.cxx:292
const Point & GetPrev() const
Definition: svddrag.hxx:93
tools::Rectangle maDragLimit
Definition: svddrgv.hxx:44
bool IsInsGluePointMode() const
Definition: svddrgv.hxx:137
SdrHdl * GetHdl(size_t nNum) const
Definition: svdhdl.hxx:462
void SetNoDragXorPolys(bool bOn)
Definition: svddrgv.cxx:836
const SvtOptionsDrawinglayer & getOptionsDrawinglayer() const
Definition: svdpntv.hxx:508
bool IsMirrorAllowed(bool b45Deg=false, bool b90Deg=false) const
Definition: svdedtv.cxx:405
sal_uInt32 GetObjHdlNum() const
Definition: svdhdl.hxx:216
bool UnmarkAllPoints()
Definition: svdmrkv.hxx:341
virtual SdrGluePointList * ForceGluePointList()
Definition: svdobj.cxx:2211
SdrDragMode
Definition: svdtypes.hxx:34
bool IsSolidDragging() const
Definition: svddrgv.cxx:904
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
Definition: svdmrkv.cxx:2379
SdrHdl * GetGluePointHdl(const SdrObject *pObj, sal_uInt16 nId) const
Definition: svdmrkv1.cxx:519
bool IsGradientAllowed() const
Definition: svdedtv.cxx:426
SdrObject * GetMarkedObjectByIndex(size_t nNum) const
Definition: svdmrkv.hxx:256
const Point & GetNow() const
Definition: svddrag.hxx:95
bool IsCrookAllowed(bool bNoContortion=false) const
Definition: svdedtv.cxx:445
bool mbDragLimit
Definition: svddrgv.hxx:50
void SetView(SdrView *pV)
Definition: svddrag.hxx:87
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:303
virtual void BrkAction() override
Definition: svddrgv.cxx:96
void SetMinMoved()
Definition: svddrag.hxx:109
void SetShown(bool bOn)
Definition: svddrag.hxx:106
bool IsDragObj() const
Definition: svddrgv.hxx:103
SdrHdlList maHdlList
Definition: svdmrkv.hxx:108
bool mbDragHdl
Definition: svddrgv.hxx:51
bool m_bOrthoDesiredOnMarked
Definition: svdedtv.hxx:93
bool IsMarkedHitMovesAlways() const
Definition: svddrgv.hxx:183
bool IsNoDragXorPolys() const
Definition: svddrgv.hxx:152
void SetPageView(SdrPageView *pPV)
Definition: svddrag.hxx:89
void SetDragStripes(bool bOn)
Definition: svddrgv.cxx:863
SdrCreateCmd
Definition: svdtypes.hxx:27
bool IsInsertGluePoint() const
Definition: svddrgv.hxx:116
bool mbSolidDragging
Definition: svddrgv.hxx:53
SdrModel * GetModel() const
Definition: svdpntv.hxx:264
aStr
Point TopRight() const
bool EndInsObjPoint(SdrCreateCmd eCmd)
Definition: svddrgv.cxx:687
virtual void EndAction() override
Definition: svdedxv.cxx:106
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
bool IsDistortAllowed(bool bNoContortion=false) const
Definition: svdedtv.cxx:457
virtual void MovAction(const Point &rPnt) override
Definition: svdedxv.cxx:99
bool IsOrthoDesired() const
Definition: svddrgv.cxx:877
virtual bool IsAction() const override
Definition: svdedxv.cxx:97
sal_uInt32 PageWindowCount() const
Definition: svdpagv.hxx:94
bool ImpBegInsObjPoint(bool bIdxZwang, const Point &rPnt, bool bNewObj, OutputDevice *pOut)
Definition: svddrgv.cxx:629