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