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