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