LibreOffice Module svx (master)  1
svddrgmt.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 #include "svddrgm1.hxx"
21 #include <math.h>
22 
23 #include <o3tl/numeric.hxx>
24 #include <vcl/canvastools.hxx>
25 #include <vcl/svapp.hxx>
26 #include <vcl/settings.hxx>
27 #include <vcl/ptrstyle.hxx>
28 #include <svx/xpoly.hxx>
29 #include <svx/svdtrans.hxx>
30 #include <svx/svdundo.hxx>
31 #include <svx/svdmark.hxx>
32 #include <svx/svdpagv.hxx>
33 #include <svx/svddrgv.hxx>
34 #include <svx/svdograf.hxx>
35 #include <svx/strings.hrc>
36 #include <svx/dialmgr.hxx>
37 #include <svx/sdgcpitm.hxx>
38 #include <svx/sdooitm.hxx>
39 #include <svx/sdtagitm.hxx>
44 #include <svx/sdrpagewindow.hxx>
45 #include <svx/sdrpaintwindow.hxx>
52 #include <svx/svditer.hxx>
53 #include <svx/svdopath.hxx>
66 #include <svl/itempool.hxx>
67 #include <comphelper/lok.hxx>
68 #include <map>
69 #include <vector>
70 
71 
73 : mbAddToTransparent(false)
74 {
75 }
76 
78 {
79 }
80 
81 
83 : SdrDragEntry(),
84  maOriginalPolyPolygon(rOriginalPolyPolygon)
85 {
86 }
87 
89 {
90 }
91 
93 {
95 
97  {
99  const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
100 
101  rDragMethod.applyCurrentTransformationToPolyPolygon(aCopy);
102  basegfx::BColor aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
103  basegfx::BColor aColB(aSvtOptionsDrawinglayer.GetStripeColorB().getBColor());
104  const double fStripeLength(aSvtOptionsDrawinglayer.GetStripeLength());
105 
107  {
109  aColB.invert();
110  }
111 
112  aRetval.resize(2);
114  aCopy,
115  aColA,
116  aColB,
117  fStripeLength);
118 
119  const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
120  const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
121 
123  aCopy,
124  aHilightColor,
125  fTransparence,
126  3.0,
127  false);
128  }
129 
130  return aRetval;
131 }
132 
133 
135  const SdrObject& rOriginal,
136  bool bModify)
137 : SdrDragEntry(),
138  maOriginal(rOriginal),
139  mbModify(bModify)
140 {
141  // add SdrObject parts to transparent overlay stuff
142  setAddToTransparent(true);
143 }
144 
146 {
147 }
148 
150 {
151  // for the moment, i need to re-create the clone in all cases. I need to figure
152  // out when clone and original have the same class, so that i can use operator=
153  // in those cases
154 
155  mxClone.reset();
156 
157  if(mbModify)
158  {
160 
161  // apply original transformation, implemented at the DragMethods
163  }
164 }
165 
167 {
168  const SdrObject* pSource = &maOriginal;
169 
170  if(mbModify && mxClone)
171  {
172  // choose source for geometry data
173  pSource = mxClone.get();
174  }
175 
176  // use the view-independent primitive representation (without
177  // evtl. GridOffset, that may be applied to the DragEntry individually)
179 }
180 
181 
184 : SdrDragEntry(),
185  maPrimitive2DSequence(rSequence)
186 {
187  // add parts to transparent overlay stuff if necessary
188  setAddToTransparent(true);
189 }
190 
192 {
193 }
194 
196 {
199  rDragMethod.getCurrentTransformation(),
201 
202  return drawinglayer::primitive2d::Primitive2DContainer { aTransformPrimitive2D };
203 }
204 
205 
206 SdrDragEntryPointGlueDrag::SdrDragEntryPointGlueDrag(const std::vector< basegfx::B2DPoint >& rPositions, bool bIsPointDrag)
207 : maPositions(rPositions),
208  mbIsPointDrag(bIsPointDrag)
209 {
210  // add SdrObject parts to transparent overlay stuff
211  setAddToTransparent(true);
212 }
213 
215 {
216 }
217 
219 {
221 
222  if(!maPositions.empty())
223  {
224  basegfx::B2DPolygon aPolygon;
225 
226  for(auto const & a: maPositions)
227  {
228  aPolygon.append(a);
229  }
230 
231  basegfx::B2DPolyPolygon aPolyPolygon(aPolygon);
232 
233  rDragMethod.applyCurrentTransformationToPolyPolygon(aPolyPolygon);
234 
235  const basegfx::B2DPolygon aTransformed(aPolyPolygon.getB2DPolygon(0));
236  std::vector< basegfx::B2DPoint > aTransformedPositions;
237 
238  aTransformedPositions.reserve(aTransformed.count());
239 
240  for(sal_uInt32 a = 0; a < aTransformed.count(); a++)
241  {
242  aTransformedPositions.push_back(aTransformed.getB2DPoint(a));
243  }
244 
245  if(mbIsPointDrag)
246  {
247  const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
248  basegfx::BColor aColor(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
249 
251  {
253  }
254 
255  drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
256  new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
258 
259  aRetval = drawinglayer::primitive2d::Primitive2DContainer { aMarkerArrayPrimitive2D };
260  }
261  else
262  {
263  drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
264  new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
266  aRetval = drawinglayer::primitive2d::Primitive2DContainer { aMarkerArrayPrimitive2D };
267  }
268  }
269 
270  return aRetval;
271 }
272 
273 
275 {
276  // clear entries; creation is on demand
278 }
279 
281 {
283 }
284 
286 {
287  maSdrDragEntries.clear();
288 }
289 
290 void SdrDragMethod::addSdrDragEntry(std::unique_ptr<SdrDragEntry> pNew)
291 {
292  assert(pNew);
293  maSdrDragEntries.push_back(std::move(pNew));
294 }
295 
297 {
298  if(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView())
299  {
301  {
303  }
305  {
307  }
308  else
309  {
311  {
313  }
314  else
315  {
317  }
318  }
319  }
320 }
321 
323 {
324  // add full object drag; Clone() at the object has to work
325  // for this
326  addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntrySdrObject(rOriginal, true/*bModify*/)));
327 }
328 
330  std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject,
331  const sdr::contact::ObjectContact& rObjectContact,
332  sdr::overlay::OverlayManager& rOverlayManager)
333 {
334  // check if we have an OverlayObject
335  if(!pOverlayObject)
336  {
337  return;
338  }
339 
340  // add to OverlayManager
341  rOverlayManager.add(*pOverlayObject);
342 
343  // Add GridOffset for non-linear ViewToDevice transformation (calc)
344  if(rObjectContact.supportsGridOffsets())
345  {
346  const basegfx::B2DRange& rNewRange(pOverlayObject->getBaseRange());
347 
348  if(!rNewRange.isEmpty())
349  {
350  basegfx::B2DVector aOffset(0.0, 0.0);
351  rObjectContact.calculateGridOffsetForB2DRange(aOffset, rNewRange);
352 
353  if(!aOffset.equalZero())
354  {
355  pOverlayObject->setOffset(aOffset);
356  }
357  }
358  }
359 
360  // add to local OverlayObjectList - ownership change (!)
361  maOverlayObjectList.append(std::move(pOverlayObject));
362 }
363 
365 {
366  const size_t nMarkCount(getSdrDragView().GetMarkedObjectCount());
368 
369  if(pPV)
370  {
371  for(size_t a = 0; a < nMarkCount; ++a)
372  {
374 
375  if(pM->GetPageView() == pPV)
376  {
377  const SdrObject* pObject = pM->GetMarkedSdrObj();
378 
379  if(pObject)
380  {
381  if(pPV->PageWindowCount())
382  {
383  SdrObjListIter aIter(*pObject);
384 
385  while(aIter.IsMore())
386  {
387  SdrObject* pCandidate = aIter.Next();
388 
389  if(pCandidate)
390  {
391  const bool bSuppressFullDrag(!pCandidate->supportsFullDrag());
392  bool bAddWireframe(bSuppressFullDrag);
393 
394  if(!bAddWireframe && !pCandidate->HasLineStyle())
395  {
396  // add wireframe for objects without outline
397  bAddWireframe = true;
398  }
399 
400  if(!bSuppressFullDrag)
401  {
402  // add full object drag; Clone() at the object has to work
403  // for this
404  createSdrDragEntryForSdrObject(*pCandidate);
405  }
406 
407  if(bAddWireframe)
408  {
409  // when dragging a 50% transparent copy of a filled or not filled object without
410  // outline, this is normally hard to see. Add extra wireframe in that case. This
411  // works nice e.g. with text frames etc.
412  addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly())));
413  }
414  }
415  }
416  }
417  }
418  }
419  }
420  }
421 }
422 
424 {
425  const size_t nMarkCount(getSdrDragView().GetMarkedObjectCount());
426  bool bNoPolygons(getSdrDragView().IsNoDragXorPolys() || nMarkCount > SdrDragView::GetDragXorPolyLimit());
427  basegfx::B2DPolyPolygon aResult;
428  sal_uInt32 nPointCount(0);
429 
430  for(size_t a = 0; !bNoPolygons && a < nMarkCount; ++a)
431  {
433 
434  if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
435  {
436  const basegfx::B2DPolyPolygon aNewPolyPolygon(pM->GetMarkedSdrObj()->TakeXorPoly());
437 
438  for(auto const& rPolygon : aNewPolyPolygon)
439  {
440  nPointCount += rPolygon.count();
441  }
442 
443  if(nPointCount > SdrDragView::GetDragXorPointLimit())
444  {
445  bNoPolygons = true;
446  }
447 
448  if(!bNoPolygons)
449  {
450  aResult.append(aNewPolyPolygon);
451  }
452  }
453  }
454 
455  if(bNoPolygons)
456  {
457  const tools::Rectangle aR(getSdrDragView().GetSdrPageView()->MarkSnap());
460 
462  }
463 
464  if(aResult.count())
465  {
466  addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aResult)));
467  }
468 }
469 
471 {
472  const size_t nMarkCount(getSdrDragView().GetMarkedObjectCount());
473  std::vector< basegfx::B2DPoint > aPositions;
474 
475  for(size_t nm = 0; nm < nMarkCount; ++nm)
476  {
478 
479  if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
480  {
481  const SdrUShortCont& rPts = pM->GetMarkedPoints();
482 
483  if (!rPts.empty())
484  {
485  const SdrObject* pObj = pM->GetMarkedSdrObj();
486  const SdrPathObj* pPath = dynamic_cast< const SdrPathObj* >(pObj);
487 
488  if(pPath)
489  {
490  const basegfx::B2DPolyPolygon& aPathXPP = pPath->GetPathPoly();
491 
492  if(aPathXPP.count())
493  {
494  for(const sal_uInt16 nObjPt : rPts)
495  {
496  sal_uInt32 nPolyNum, nPointNum;
497 
498  if(sdr::PolyPolygonEditor::GetRelativePolyPoint(aPathXPP, nObjPt, nPolyNum, nPointNum))
499  {
500  aPositions.push_back(aPathXPP.getB2DPolygon(nPolyNum).getB2DPoint(nPointNum));
501  }
502  }
503  }
504  }
505  }
506  }
507  }
508 
509  if(!aPositions.empty())
510  {
511  addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPointGlueDrag(aPositions, true)));
512  }
513 }
514 
516 {
517  const size_t nMarkCount(getSdrDragView().GetMarkedObjectCount());
518  std::vector< basegfx::B2DPoint > aPositions;
519 
520  for(size_t nm = 0; nm < nMarkCount; ++nm)
521  {
523 
524  if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
525  {
526  const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
527 
528  if (!rPts.empty())
529  {
530  const SdrObject* pObj = pM->GetMarkedSdrObj();
531  const SdrGluePointList* pGPL = pObj->GetGluePointList();
532 
533  if (pGPL)
534  {
535  for(const sal_uInt16 nObjPt : rPts)
536  {
537  const sal_uInt16 nGlueNum(pGPL->FindGluePoint(nObjPt));
538 
539  if(SDRGLUEPOINT_NOTFOUND != nGlueNum)
540  {
541  const Point aPoint((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
542  aPositions.emplace_back(aPoint.X(), aPoint.Y());
543  }
544  }
545  }
546  }
547  }
548  }
549 
550  if(!aPositions.empty())
551  {
552  addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPointGlueDrag(aPositions, false)));
553  }
554 }
555 
556 OUString SdrDragMethod::ImpGetDescriptionStr(const char* pStrCacheID) const
557 {
559  if (IsDraggingPoints()) {
561  } else if (IsDraggingGluePoints()) {
563  }
564  return getSdrDragView().ImpGetDescriptionString(pStrCacheID, nOpt);
565 }
566 
568 {
569  SdrObject* pObj=nullptr;
570  if (getSdrDragView().mpDragHdl!=nullptr) pObj=getSdrDragView().mpDragHdl->GetObj();
571  if (pObj==nullptr) pObj=getSdrDragView().mpMarkedObj;
572  return pObj;
573 }
574 
576 {
577  SdrPageView* pPV=nullptr;
578  if (getSdrDragView().mpDragHdl!=nullptr) pPV=getSdrDragView().mpDragHdl->GetPageView();
579  if (pPV==nullptr) pPV=getSdrDragView().mpMarkedPV;
580  return pPV;
581 }
582 
584 {
585  // the original applies the transformation using TRGetBaseGeometry/TRSetBaseGeometry.
586  // Later this should be the only needed one for linear transforms (not for SdrDragCrook and
587  // SdrDragDistort, those are NOT linear). Currently, this can not yet be used since the
588  // special handling of rotate/mirror due to the not-being-able to handle it in the old
589  // drawinglayer stuff. Text would currently not correctly be mirrored in the preview.
590  basegfx::B2DHomMatrix aObjectTransform;
591  basegfx::B2DPolyPolygon aObjectPolyPolygon;
592  bool bPolyUsed(rTarget.TRGetBaseGeometry(aObjectTransform, aObjectPolyPolygon));
593 
594  // apply transform to object transform
595  aObjectTransform *= getCurrentTransformation();
596 
597  if(bPolyUsed)
598  {
599  // do something special since the object size is in the polygon
600  // break up matrix to get the scale
601  const basegfx::utils::B2DHomMatrixBufferedDecompose aTmpDecomp(aObjectTransform);
602 
603  // get polygon's position and size
604  const basegfx::B2DRange aPolyRange(aObjectPolyPolygon.getB2DRange());
605 
606  // get the scaling factors (do not mirror, this is in the object transformation)
607  const double fScaleX(fabs(aTmpDecomp.getScale().getX()) / (basegfx::fTools::equalZero(aPolyRange.getWidth()) ? 1.0 : aPolyRange.getWidth()));
608  const double fScaleY(fabs(aTmpDecomp.getScale().getY()) / (basegfx::fTools::equalZero(aPolyRange.getHeight()) ? 1.0 : aPolyRange.getHeight()));
609 
610  // prepare transform matrix for polygon
611  basegfx::B2DHomMatrix aPolyTransform(
613  -aPolyRange.getMinX(),
614  -aPolyRange.getMinY()));
615  aPolyTransform.scale(fScaleX, fScaleY);
616 
617  // transform the polygon
618  aObjectPolyPolygon.transform(aPolyTransform);
619  }
620 
621  rTarget.TRSetBaseGeometry(getCurrentTransformation() * aObjectTransform, aObjectPolyPolygon);
622 }
623 
625 {
626  // original uses CurrentTransformation
628 }
629 
631 : maSdrDragEntries(),
632  maOverlayObjectList(),
633  mrSdrDragView(rNewView),
634  mbMoveOnly(false),
635  mbSolidDraggingActive(getSdrDragView().IsSolidDragging()),
636  mbShiftPressed(false)
637 {
638  if(mbSolidDraggingActive && Application::GetSettings().GetStyleSettings().GetHighContrastMode())
639  {
640  // fallback to wireframe when high contrast is used
641  mbSolidDraggingActive = false;
642  }
643 }
644 
646 {
648 }
649 
651 {
653 }
654 
656 {
658 }
659 
661 {
662  return basegfx::B2DHomMatrix();
663 }
664 
666 {
667  Hide();
668 }
669 
670 typedef std::map< const SdrObject*, SdrObject* > SdrObjectAndCloneMap;
671 
673  sdr::overlay::OverlayManager& rOverlayManager,
674  const sdr::contact::ObjectContact& rObjectContact)
675 {
676  // We do client-side object manipulation with the Kit API
678  return;
679 
680  // create SdrDragEntries on demand
681  if(maSdrDragEntries.empty())
682  {
684  }
685 
686  // if there are entries, derive OverlayObjects from the entries, including
687  // modification from current interactive state
688  if(!maSdrDragEntries.empty())
689  {
690  // #i54102# SdrDragEntrySdrObject creates clones of SdrObjects as base for creating the needed
691  // primitives, holding the original and the clone. If connectors (Edges) are involved,
692  // the cloned connectors need to be connected to the cloned SdrObjects (after cloning
693  // they are connected to the original SdrObjects). To do so, trigger the preparation
694  // steps for SdrDragEntrySdrObject, save an association of (orig, clone) in a helper
695  // and evtl. remember if it was an edge
696  SdrObjectAndCloneMap aOriginalAndClones;
697  std::vector< SdrEdgeObj* > aEdges;
698 
699  // #i54102# execute prepareCurrentState for all SdrDragEntrySdrObject, register pair of original and
700  // clone, remember edges
701  for(auto const & a: maSdrDragEntries)
702  {
703  SdrDragEntrySdrObject* pSdrDragEntrySdrObject = dynamic_cast< SdrDragEntrySdrObject*>(a.get());
704 
705  if(pSdrDragEntrySdrObject)
706  {
707  pSdrDragEntrySdrObject->prepareCurrentState(*this);
708 
709  SdrEdgeObj* pSdrEdgeObj = dynamic_cast< SdrEdgeObj* >(pSdrDragEntrySdrObject->getClone());
710 
711  if(pSdrEdgeObj)
712  {
713  aEdges.push_back(pSdrEdgeObj);
714  }
715 
716  if(pSdrDragEntrySdrObject->getClone())
717  {
718  aOriginalAndClones[&pSdrDragEntrySdrObject->getOriginal()] = pSdrDragEntrySdrObject->getClone();
719  }
720  }
721  }
722 
723  // #i54102# if there are edges, reconnect their ends to the corresponding clones (if found)
724  for(SdrEdgeObj* pSdrEdgeObj: aEdges)
725  {
726  SdrObject* pConnectedTo = pSdrEdgeObj->GetConnectedNode(true);
727 
728  if(pConnectedTo)
729  {
730  SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo);
731 
732  if(aEntry != aOriginalAndClones.end())
733  {
734  pSdrEdgeObj->ConnectToNode(true, aEntry->second);
735  }
736  }
737 
738  pConnectedTo = pSdrEdgeObj->GetConnectedNode(false);
739 
740  if(pConnectedTo)
741  {
742  SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo);
743 
744  if(aEntry != aOriginalAndClones.end())
745  {
746  pSdrEdgeObj->ConnectToNode(false, aEntry->second);
747  }
748  }
749  }
750 
751  // collect primitives for visualisation
754 
755  for(auto & pCandidate: maSdrDragEntries)
756  {
757  const drawinglayer::primitive2d::Primitive2DContainer aCandidateResult(pCandidate->createPrimitive2DSequenceInCurrentState(*this));
758 
759  if(!aCandidateResult.empty())
760  {
761  if(pCandidate->getAddToTransparent())
762  {
763  aResultTransparent.append(aCandidateResult);
764  }
765  else
766  {
767  aResult.append(aCandidateResult);
768  }
769  }
770  }
771 
773  {
775 
776  if(!aConnectorOverlays.empty())
777  {
778  // add connector overlays to transparent part
779  aResultTransparent.append(aConnectorOverlays);
780  }
781  }
782 
783  if(!aResult.empty())
784  {
785  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(
787  aResult));
788 
790  std::move(pNewOverlayObject),
791  rObjectContact,
792  rOverlayManager);
793  }
794 
795  if(!aResultTransparent.empty())
796  {
797  drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5));
798  aResultTransparent = drawinglayer::primitive2d::Primitive2DContainer { aUnifiedTransparencePrimitive2D };
799 
800  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(
802  aResultTransparent));
803 
805  std::move(pNewOverlayObject),
806  rObjectContact,
807  rOverlayManager);
808  }
809  }
810 
811  // add DragStripes if necessary (help lines cross the page when dragging)
812  if(getSdrDragView().IsDragStripes())
813  {
814  tools::Rectangle aActionRectangle;
815  getSdrDragView().TakeActionRect(aActionRectangle);
816 
817  const basegfx::B2DPoint aTopLeft(aActionRectangle.Left(), aActionRectangle.Top());
818  const basegfx::B2DPoint aBottomRight(aActionRectangle.Right(), aActionRectangle.Bottom());
819  std::unique_ptr<sdr::overlay::OverlayRollingRectangleStriped> pNew(
821  aTopLeft,
822  aBottomRight,
823  true,
824  false));
825 
827  std::move(pNew),
828  rObjectContact,
829  rOverlayManager);
830  }
831 }
832 
834 {
836 }
837 
839 {
840  // these conditions are translated from SdrDragView::ImpDrawEdgeXor
841  const SdrMarkList& rMarkedNodes = getSdrDragView().GetEdgesOfMarkedNodes();
842 
843  if(!rMarkedNodes.GetMarkCount())
844  {
845  return false;
846  }
847 
849  {
850  return false;
851  }
852 
853  if(!getMoveOnly() && !(
854  dynamic_cast<const SdrDragMove*>(this) != nullptr || dynamic_cast<const SdrDragResize*>(this) != nullptr ||
855  dynamic_cast<const SdrDragRotate*>(this) != nullptr || dynamic_cast<const SdrDragMirror*>(this) != nullptr ))
856  {
857  return false;
858  }
859 
860  // one more migrated from SdrEdgeObj::NspToggleEdgeXor
861  if( dynamic_cast< const SdrDragObjOwn* >(this) != nullptr || dynamic_cast< const SdrDragMovHdl* >(this) != nullptr )
862  {
863  return false;
864  }
865 
866  return true;
867 }
868 
870 {
872  const bool bDetail(getMoveOnly());
873  const SdrMarkList& rMarkedNodes = getSdrDragView().GetEdgesOfMarkedNodes();
874 
875  for(size_t a = 0; a < rMarkedNodes.GetMarkCount(); ++a)
876  {
877  SdrMark* pEM = rMarkedNodes.GetMark(a);
878 
879  if(pEM && pEM->GetMarkedSdrObj())
880  {
881  SdrEdgeObj* pEdge = dynamic_cast< SdrEdgeObj* >(pEM->GetMarkedSdrObj());
882 
883  if(pEdge)
884  {
885  const basegfx::B2DPolygon aEdgePolygon(pEdge->ImplAddConnectorOverlay(*this, pEM->IsCon1(), pEM->IsCon2(), bDetail));
886 
887  if(aEdgePolygon.count())
888  {
889  // this polygon is a temporary calculated connector path, so it is not possible to fetch
890  // the needed primitives directly from the pEdge object which does not get changed. If full
891  // drag is on, use the SdrObjects ItemSet to create an adequate representation
892  bool bUseSolidDragging(getSolidDraggingActive());
893 
894  if(bUseSolidDragging)
895  {
896  // switch off solid dragging if connector is not visible
897  if(!pEdge->HasLineStyle())
898  {
899  bUseSolidDragging = false;
900  }
901  }
902 
903  if(bUseSolidDragging)
904  {
905  const SfxItemSet& rItemSet = pEdge->GetMergedItemSet();
908 
909  if(!aLine.isDefault())
910  {
913  rItemSet,
914  aLine.getWidth()));
915 
917  aEdgePolygon,
918  aLine,
919  aLineStartEnd));
920  }
921  }
922  else
923  {
924  const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
925  basegfx::BColor aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
926  basegfx::BColor aColB(aSvtOptionsDrawinglayer.GetStripeColorB().getBColor());
927  const double fStripeLength(aSvtOptionsDrawinglayer.GetStripeLength());
928 
930  {
932  aColB.invert();
933  }
934 
935  drawinglayer::primitive2d::Primitive2DReference aPolyPolygonMarkerPrimitive2D(
937  aEdgePolygon, aColA, aColB, fStripeLength));
938  aRetval.push_back(aPolyPolygonMarkerPrimitive2D);
939  }
940  }
941  }
942  }
943  }
944 
945  return aRetval;
946 }
947 
948 
950 : SdrDragMethod(rNewView)
951 {
952 }
953 
955 {
956  // SdrDragMovHdl does not use the default drags,
957  // but creates nothing
958 }
959 
961 {
962  OUString aStr=SvxResId(STR_DragMethMovHdl);
963  if (getSdrDragView().IsDragWithCopy()) aStr+=SvxResId(STR_EditWithCopy);
964  return aStr;
965 }
966 
968 {
969  if( !GetDragHdl() )
970  return false;
971 
972  DragStat().SetRef1(GetDragHdl()->GetPos());
973  DragStat().SetShown(!DragStat().IsShown());
974  SdrHdlKind eKind=GetDragHdl()->GetKind();
977 
978  if (eKind==SdrHdlKind::MirrorAxis)
979  {
980  if (pH1==nullptr || pH2==nullptr)
981  {
982  OSL_FAIL("SdrDragMovHdl::BeginSdrDrag(): Moving the axis of reflection: reference handles not found.");
983  return false;
984  }
985 
987  }
988  else
989  {
990  Point aPt(GetDragHdl()->GetPos());
992  }
993 
994  return true;
995 }
996 
997 void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
998 {
999  Point aPnt(rNoSnapPnt);
1000 
1001  if ( GetDragHdl() && DragStat().CheckMinMoved(rNoSnapPnt))
1002  {
1003  if (GetDragHdl()->GetKind()==SdrHdlKind::MirrorAxis)
1004  {
1007 
1008  if (pH1==nullptr || pH2==nullptr)
1009  return;
1010 
1011  if (!DragStat().IsNoSnap())
1012  {
1013  long nBestXSnap=0;
1014  long nBestYSnap=0;
1015  bool bXSnapped=false;
1016  bool bYSnapped=false;
1017  Point aDif(aPnt-DragStat().GetStart());
1018  getSdrDragView().CheckSnap(Ref1()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
1019  getSdrDragView().CheckSnap(Ref2()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
1020  aPnt.AdjustX(nBestXSnap );
1021  aPnt.AdjustY(nBestYSnap );
1022  }
1023 
1024  if (aPnt!=DragStat().GetNow())
1025  {
1026  Hide();
1027  DragStat().NextMove(aPnt);
1028  Point aDif(DragStat().GetNow()-DragStat().GetStart());
1029  pH1->SetPos(Ref1()+aDif);
1030  pH2->SetPos(Ref2()+aDif);
1031 
1033 
1034  if(pHM)
1035  pHM->Touch();
1036 
1037  Show();
1039  }
1040  }
1041  else
1042  {
1043  if (!DragStat().IsNoSnap()) SnapPos(aPnt);
1044  long nSA=0;
1045 
1047  nSA=getSdrDragView().GetSnapAngle();
1048 
1049  if (getSdrDragView().IsMirrorAllowed(true,true))
1050  { // limited
1051  if (!getSdrDragView().IsMirrorAllowed()) nSA=4500;
1052  if (!getSdrDragView().IsMirrorAllowed(true)) nSA=9000;
1053  }
1054 
1055  if (getSdrDragView().IsOrtho() && nSA!=9000)
1056  nSA=4500;
1057 
1058  if (nSA!=0)
1059  { // angle snapping
1061 
1062  if (GetDragHdl()->GetKind()==SdrHdlKind::Ref1)
1063  eRef=SdrHdlKind::Ref2;
1064 
1065  SdrHdl* pH=GetHdlList().GetHdl(eRef);
1066 
1067  if (pH!=nullptr)
1068  {
1069  Point aRef(pH->GetPos());
1070  long nAngle=NormAngle36000(GetAngle(aPnt-aRef));
1071  long nNewAngle=nAngle;
1072  nNewAngle+=nSA/2;
1073  nNewAngle/=nSA;
1074  nNewAngle*=nSA;
1075  nNewAngle=NormAngle36000(nNewAngle);
1076  double a=(nNewAngle-nAngle)*F_PI18000;
1077  double nSin=sin(a);
1078  double nCos=cos(a);
1079  RotatePoint(aPnt,aRef,nSin,nCos);
1080 
1081  // eliminate rounding errors for certain values
1082  if (nSA==9000)
1083  {
1084  if (nNewAngle==0 || nNewAngle==18000) aPnt.setY(aRef.Y() );
1085  if (nNewAngle==9000 || nNewAngle==27000) aPnt.setX(aRef.X() );
1086  }
1087 
1088  if (nSA==4500)
1089  OrthoDistance8(aRef,aPnt,true);
1090  }
1091  }
1092 
1093  if (aPnt!=DragStat().GetNow())
1094  {
1095  Hide();
1096  DragStat().NextMove(aPnt);
1097  GetDragHdl()->SetPos(DragStat().GetNow());
1099 
1100  if(pHM)
1101  pHM->Touch();
1102 
1103  Show();
1104  DragStat().SetActionRect(tools::Rectangle(aPnt,aPnt));
1105  }
1106  }
1107  }
1108 }
1109 
1110 bool SdrDragMovHdl::EndSdrDrag(bool /*bCopy*/)
1111 {
1112  if( GetDragHdl() )
1113  {
1114  switch (GetDragHdl()->GetKind())
1115  {
1116  case SdrHdlKind::Ref1:
1117  Ref1()=DragStat().GetNow();
1118  break;
1119 
1120  case SdrHdlKind::Ref2:
1121  Ref2()=DragStat().GetNow();
1122  break;
1123 
1125  Ref1()+=DragStat().GetNow()-DragStat().GetStart();
1126  Ref2()+=DragStat().GetNow()-DragStat().GetStart();
1127  break;
1128 
1129  default: break;
1130  }
1131  }
1132 
1133  return true;
1134 }
1135 
1137 {
1138  Hide();
1139 
1140  SdrHdl* pHdl = GetDragHdl();
1141  if( pHdl )
1142  pHdl->SetPos(DragStat().GetRef1());
1143 
1145 
1146  if(pHM)
1147  pHM->Touch();
1148 }
1149 
1151 {
1152  const SdrHdl* pHdl = GetDragHdl();
1153 
1154  if (pHdl!=nullptr)
1155  {
1156  return pHdl->GetPointer();
1157  }
1158 
1159  return PointerStyle::RefHand;
1160 }
1161 
1162 
1164 : SdrDragMethod(rNewView)
1165 {
1166  const SdrObject* pObj = GetDragObj();
1167 
1168  if(pObj)
1169  {
1170  // suppress full drag for some object types
1172  }
1173 }
1174 
1176 {
1177 }
1178 
1180 {
1181  if(mxClone)
1182  {
1183  basegfx::B2DPolyPolygon aDragPolyPolygon;
1184  bool bAddWireframe(true);
1185 
1187  {
1189 
1190  if(pPV && pPV->PageWindowCount())
1191  {
1192  addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntrySdrObject(*mxClone, false)));
1193 
1194  // potentially no wireframe needed, full drag works
1195  bAddWireframe = false;
1196  }
1197  }
1198 
1199  if(!bAddWireframe)
1200  {
1201  // check for extra conditions for wireframe, e.g. no border at
1202  // objects
1203  if(!mxClone->HasLineStyle())
1204  {
1205  bAddWireframe = true;
1206  }
1207  }
1208 
1209  if(bAddWireframe)
1210  {
1211  // use wireframe poly when full drag is off or did not work
1212  aDragPolyPolygon = mxClone->TakeXorPoly();
1213  }
1214 
1215  // add evtl. extra DragPolyPolygon
1216  const basegfx::B2DPolyPolygon aSpecialDragPolyPolygon(mxClone->getSpecialDragPoly(DragStat()));
1217 
1218  if(aSpecialDragPolyPolygon.count())
1219  {
1220  aDragPolyPolygon.append(aSpecialDragPolyPolygon);
1221  }
1222 
1223  if(aDragPolyPolygon.count())
1224  {
1225  addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragPolyPolygon)));
1226  }
1227  }
1228 }
1229 
1231 {
1232  OUString aStr;
1233  // #i103058# get info string from the clone preferred, the original will
1234  // not be changed. For security, use original as fallback
1235  if(mxClone)
1236  {
1237  aStr = mxClone->getSpecialDragComment(DragStat());
1238  }
1239  else
1240  {
1241  const SdrObject* pObj = GetDragObj();
1242 
1243  if(pObj)
1244  {
1245  aStr = pObj->getSpecialDragComment(DragStat());
1246  }
1247  }
1248  return aStr;
1249 }
1250 
1252 {
1253  if(!mxClone)
1254  {
1255  const SdrObject* pObj = GetDragObj();
1256 
1257  if(pObj && !pObj->IsResizeProtect())
1258  {
1259  if(pObj->beginSpecialDrag(DragStat()))
1260  {
1261  // create initial clone to have a start visualization
1262  mxClone = pObj->getFullDragClone();
1263  mxClone->applySpecialDrag(DragStat());
1264 
1265  return true;
1266  }
1267  }
1268  }
1269 
1270  return false;
1271 }
1272 
1273 void SdrDragObjOwn::MoveSdrDrag(const Point& rNoSnapPnt)
1274 {
1275  const SdrObject* pObj = GetDragObj();
1276 
1277  if (!pObj)
1278  // No object to drag. Bail out.
1279  return;
1280 
1281  Point aPnt(rNoSnapPnt);
1282  SdrPageView* pPV = GetDragPV();
1283 
1284  if (!pPV)
1285  // No page view available. Bail out.
1286  return;
1287 
1288  if(!DragStat().IsNoSnap())
1289  {
1290  SnapPos(aPnt);
1291  }
1292  if(getSdrDragView().IsOrtho())
1293  {
1294  if (DragStat().IsOrtho8Possible())
1295  {
1296  OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
1297  }
1298  else if (DragStat().IsOrtho4Possible())
1299  {
1300  OrthoDistance4(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
1301  }
1302  }
1303 
1304  if (!DragStat().CheckMinMoved(rNoSnapPnt))
1305  // Not moved by the minimum threshold. Nothing to do.
1306  return;
1307 
1308  Hide();
1309  DragStat().NextMove(aPnt);
1310 
1311  // since SdrDragObjOwn currently supports no transformation of
1312  // existing SdrDragEntries but only their recreation, a recreation
1313  // after every move is needed in this mode. Delete existing
1314  // SdrDragEntries here to force their recreation in the following Show().
1316 
1317  // delete current clone (after the last reference to it is deleted above)
1318  mxClone.reset();
1319 
1320  // create a new clone and modify to current drag state
1321  mxClone = pObj->getFullDragClone();
1322  mxClone->applySpecialDrag(DragStat());
1323 
1324  // AutoGrowWidth may change for SdrTextObj due to the automatism used
1325  // with bDisableAutoWidthOnDragging, so not only geometry changes but
1326  // also this (pretty indirect) property change is possible. If it gets
1327  // changed, it needs to be copied to the original since nothing will
1328  // happen when it only changes in the drag clone
1329  const bool bOldAutoGrowWidth(pObj->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue());
1330  const bool bNewAutoGrowWidth(mxClone->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue());
1331 
1332  if (bOldAutoGrowWidth != bNewAutoGrowWidth)
1333  {
1334  GetDragObj()->SetMergedItem(makeSdrTextAutoGrowWidthItem(bNewAutoGrowWidth));
1335  }
1336 
1337  Show();
1338 }
1339 
1340 bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
1341 {
1342  Hide();
1343  std::vector< std::unique_ptr<SdrUndoAction> > vConnectorUndoActions;
1344  bool bRet = false;
1345  SdrObject* pObj = GetDragObj();
1346 
1347  if(pObj)
1348  {
1349  std::unique_ptr<SdrUndoAction> pUndo;
1350  std::unique_ptr<SdrUndoAction> pUndo2;
1351  const bool bUndo = getSdrDragView().IsUndoEnabled();
1352 
1353  if( bUndo )
1354  {
1356  if(!getSdrDragView().IsInsObjPoint() && pObj->IsInserted() )
1357  {
1359  {
1361 
1362  if (DragStat().IsEndDragChangesGeoAndAttributes())
1363  {
1364  vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
1366  }
1367  }
1368  else
1369  {
1370  vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
1372  }
1373  }
1374 
1375  if( pUndo )
1376  {
1377  getSdrDragView().BegUndo( pUndo->GetComment() );
1378  }
1379  else
1380  {
1381  getSdrDragView().BegUndo();
1382  }
1383  }
1384 
1385  // Maybe use operator = for setting changed object data (do not change selection in
1386  // view, this will destroy the interactor). This is possible since a clone is now
1387  // directly modified by the modifiers. Only SdrTableObj is adding own UNDOs
1388  // in its SdrTableObj::endSpecialDrag, so currently not possible. OTOH it uses
1389  // a CreateUndoGeoObject(), so maybe setting SetEndDragChangesAttributes is okay. I
1390  // will test this now
1391  tools::Rectangle aBoundRect0;
1392 
1393  if(pObj->GetUserCall())
1394  {
1395  aBoundRect0 = pObj->GetLastBoundRect();
1396  }
1397 
1398  bRet = pObj->applySpecialDrag(DragStat());
1399  if (DragStat().IsEndDragChangesLayout())
1400  {
1401  auto pGeoUndo = dynamic_cast<SdrUndoGeoObj*>(pUndo.get());
1402  if (pGeoUndo)
1403  pGeoUndo->SetSkipChangeLayout(true);
1404  }
1405 
1406  if(bRet)
1407  {
1408  pObj->SetChanged();
1409  pObj->BroadcastObjectChange();
1410  pObj->SendUserCall( SdrUserCallType::Resize, aBoundRect0 );
1411  }
1412 
1413  if(bRet && bUndo )
1414  {
1415  getSdrDragView().AddUndoActions( std::move(vConnectorUndoActions) );
1416 
1417  if ( pUndo )
1418  {
1419  getSdrDragView().AddUndo(std::move(pUndo));
1420  }
1421 
1422  if ( pUndo2 )
1423  {
1424  getSdrDragView().AddUndo(std::move(pUndo2));
1425  }
1426  }
1427 
1428  if( bUndo )
1429  getSdrDragView().EndUndo();
1430  }
1431 
1432  return bRet;
1433 }
1434 
1436 {
1437  const SdrHdl* pHdl=GetDragHdl();
1438 
1439  if (pHdl)
1440  {
1441  return pHdl->GetPointer();
1442  }
1443 
1444  return PointerStyle::Move;
1445 }
1446 
1447 
1449 {
1450  // use the view-independent primitive representation (without
1451  // evtl. GridOffset, that may be applied to the DragEntry individually)
1453  std::unique_ptr<SdrDragEntry>(
1456 
1457 }
1458 
1460 {
1461  rTarget.Move(Size(DragStat().GetDX(), DragStat().GetDY()));
1462 }
1463 
1465  : SdrDragMethod(rNewView)
1466  , nBestXSnap(0)
1467  , nBestYSnap(0)
1468  , bXSnapped(false)
1469  , bYSnapped(false)
1470 {
1471  setMoveOnly(true);
1472 }
1473 
1475 {
1476  OUString aStr = ImpGetDescriptionStr(STR_DragMethMove)
1477  + " (x="
1479  + " y="
1481  + ")";
1482 
1483  if(getSdrDragView().IsDragWithCopy())
1484  {
1485  if(!getSdrDragView().IsInsObjPoint() && !getSdrDragView().IsInsGluePoint())
1486  {
1487  aStr += SvxResId(STR_EditWithCopy);
1488  }
1489  }
1490  return aStr;
1491 }
1492 
1494 {
1496  Show();
1497 
1498  return true;
1499 }
1500 
1502 {
1503  return basegfx::utils::createTranslateB2DHomMatrix(DragStat().GetDX(), DragStat().GetDY());
1504 }
1505 
1506 void SdrDragMove::ImpCheckSnap(const Point& rPt)
1507 {
1508  Point aPt(rPt);
1509  SdrSnap nRet=SnapPos(aPt);
1510  aPt-=rPt;
1511 
1512  if (nRet & SdrSnap::XSNAPPED)
1513  {
1514  if (bXSnapped)
1515  {
1516  if (std::abs(aPt.X())<std::abs(nBestXSnap))
1517  {
1518  nBestXSnap=aPt.X();
1519  }
1520  }
1521  else
1522  {
1523  nBestXSnap=aPt.X();
1524  bXSnapped=true;
1525  }
1526  }
1527 
1528  if (nRet & SdrSnap::YSNAPPED)
1529  {
1530  if (bYSnapped)
1531  {
1532  if (std::abs(aPt.Y())<std::abs(nBestYSnap))
1533  {
1534  nBestYSnap=aPt.Y();
1535  }
1536  }
1537  else
1538  {
1539  nBestYSnap=aPt.Y();
1540  bYSnapped=true;
1541  }
1542  }
1543 }
1544 
1545 void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
1546 {
1547  nBestXSnap=0;
1548  nBestYSnap=0;
1549  bXSnapped=false;
1550  bYSnapped=false;
1551  Point aNoSnapPnt(rNoSnapPnt_);
1552  const tools::Rectangle& aSR=GetMarkedRect();
1553  long nMovedx=aNoSnapPnt.X()-DragStat().GetStart().X();
1554  long nMovedy=aNoSnapPnt.Y()-DragStat().GetStart().Y();
1555  Point aLO(aSR.TopLeft()); aLO.AdjustX(nMovedx ); aLO.AdjustY(nMovedy );
1556  Point aRU(aSR.BottomRight()); aRU.AdjustX(nMovedx ); aRU.AdjustY(nMovedy );
1557  Point aLU(aLO.X(),aRU.Y());
1558  Point aRO(aRU.X(),aLO.Y());
1559  ImpCheckSnap(aLO);
1560 
1561  if (!getSdrDragView().IsMoveSnapOnlyTopLeft())
1562  {
1563  ImpCheckSnap(aRO);
1564  ImpCheckSnap(aLU);
1565  ImpCheckSnap(aRU);
1566  }
1567 
1568  Point aPnt(aNoSnapPnt.X()+nBestXSnap,aNoSnapPnt.Y()+nBestYSnap);
1569  bool bOrtho=getSdrDragView().IsOrtho();
1570 
1571  if (bOrtho)
1572  OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
1573 
1574  if (DragStat().CheckMinMoved(aNoSnapPnt))
1575  {
1576  Point aPt1(aPnt);
1577  tools::Rectangle aLR(getSdrDragView().GetWorkArea());
1578  bool bWorkArea=!aLR.IsEmpty();
1579  bool bDragLimit=IsDragLimit();
1580 
1581  if (bDragLimit || bWorkArea)
1582  {
1584  Point aD(aPt1-DragStat().GetStart());
1585 
1586  if (bDragLimit)
1587  {
1589 
1590  if (bWorkArea)
1591  aLR.Intersection(aR2);
1592  else
1593  aLR=aR2;
1594  }
1595 
1596  if (aSR2.Left()>aLR.Left() || aSR2.Right()<aLR.Right())
1597  { // any space to move to?
1598  aSR2.Move(aD.X(),0);
1599 
1600  if (aSR2.Left()<aLR.Left())
1601  {
1602  aPt1.AdjustX( -(aSR2.Left()-aLR.Left()) );
1603  }
1604  else if (aSR2.Right()>aLR.Right())
1605  {
1606  aPt1.AdjustX( -(aSR2.Right()-aLR.Right()) );
1607  }
1608  }
1609  else
1610  aPt1.setX(DragStat().GetStart().X() ); // no space to move to
1611 
1612  if (aSR2.Top()>aLR.Top() || aSR2.Bottom()<aLR.Bottom())
1613  { // any space to move to?
1614  aSR2.Move(0,aD.Y());
1615 
1616  if (aSR2.Top()<aLR.Top())
1617  {
1618  aPt1.AdjustY( -(aSR2.Top()-aLR.Top()) );
1619  }
1620  else if (aSR2.Bottom()>aLR.Bottom())
1621  {
1622  aPt1.AdjustY( -(aSR2.Bottom()-aLR.Bottom()) );
1623  }
1624  }
1625  else
1626  aPt1.setY(DragStat().GetStart().Y() ); // no space to move to
1627  }
1628 
1630  { // restrict glue points to the BoundRect of the Obj
1631  aPt1-=DragStat().GetStart();
1632  const SdrMarkList& rML=GetMarkedObjectList();
1633  const size_t nMarkCount=rML.GetMarkCount();
1634 
1635  for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
1636  {
1637  const SdrMark* pM=rML.GetMark(nMarkNum);
1638  const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
1639 
1640  if (!rPts.empty())
1641  {
1642  const SdrObject* pObj=pM->GetMarkedSdrObj();
1643  const SdrGluePointList* pGPL=pObj->GetGluePointList();
1644  tools::Rectangle aBound(pObj->GetCurrentBoundRect());
1645 
1646  for (sal_uInt16 nId : rPts)
1647  {
1648  sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
1649 
1650  if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
1651  {
1652  Point aPt((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
1653  aPt+=aPt1; // move by this much
1654  if (aPt.X()<aBound.Left() ) aPt1.AdjustX( -(aPt.X()-aBound.Left()) ) ;
1655  if (aPt.X()>aBound.Right() ) aPt1.AdjustX( -(aPt.X()-aBound.Right()) ) ;
1656  if (aPt.Y()<aBound.Top() ) aPt1.AdjustY( -(aPt.Y()-aBound.Top()) ) ;
1657  if (aPt.Y()>aBound.Bottom()) aPt1.AdjustY( -(aPt.Y()-aBound.Bottom()) );
1658  }
1659  }
1660  }
1661  }
1662 
1663  aPt1+=DragStat().GetStart();
1664  }
1665 
1666  if (bOrtho)
1667  OrthoDistance8(DragStat().GetStart(),aPt1,false);
1668 
1669  if (aPt1!=DragStat().GetNow())
1670  {
1671  Hide();
1672  DragStat().NextMove(aPt1);
1673  tools::Rectangle aAction(GetMarkedRect());
1674  aAction.Move(DragStat().GetDX(),DragStat().GetDY());
1675  DragStat().SetActionRect(aAction);
1676  Show();
1677  }
1678  }
1679 }
1680 
1681 bool SdrDragMove::EndSdrDrag(bool bCopy)
1682 {
1683  Hide();
1684 
1685  if (getSdrDragView().IsInsObjPoint() || getSdrDragView().IsInsGluePoint())
1686  bCopy=false;
1687 
1688  if (IsDraggingPoints())
1689  {
1690  getSdrDragView().MoveMarkedPoints(Size(DragStat().GetDX(),DragStat().GetDY()));
1691  }
1692  else if (IsDraggingGluePoints())
1693  {
1694  getSdrDragView().MoveMarkedGluePoints(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
1695  }
1696  else
1697  {
1698  getSdrDragView().MoveMarkedObj(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
1699  }
1700 
1701  return true;
1702 }
1703 
1705 {
1707  {
1708  return PointerStyle::MovePoint;
1709  }
1710  else
1711  {
1712  return PointerStyle::Move;
1713  }
1714 }
1715 
1716 
1718 : SdrDragMethod(rNewView),
1719  aXFact(1,1),
1720  aYFact(1,1)
1721 {
1722 }
1723 
1725 {
1726  OUString aStr = ImpGetDescriptionStr(STR_DragMethResize);
1727  Fraction aFact1(1,1);
1728  Point aStart(DragStat().GetStart());
1729  Point aRef(DragStat().GetRef1());
1730  sal_Int32 nXDiv(aStart.X() - aRef.X());
1731 
1732  if(!nXDiv)
1733  nXDiv = 1;
1734 
1735  sal_Int32 nYDiv(aStart.Y() - aRef.Y());
1736 
1737  if(!nYDiv)
1738  nYDiv = 1;
1739 
1740  bool bX(aXFact != aFact1 && std::abs(nXDiv) > 1);
1741  bool bY(aYFact != aFact1 && std::abs(nYDiv) > 1);
1742 
1743  if(bX || bY)
1744  {
1745  aStr += " (";
1746 
1747  bool bEqual(aXFact == aYFact);
1748  if(bX)
1749  {
1750  if(!bEqual)
1751  aStr += "x=";
1752 
1754  }
1755 
1756  if(bY && !bEqual)
1757  {
1758  if(bX)
1759  aStr += " ";
1760 
1761  aStr += "y=" + SdrModel::GetPercentString(aYFact);
1762  }
1763 
1764  aStr += ")";
1765  }
1766 
1767  if(getSdrDragView().IsDragWithCopy())
1768  aStr += SvxResId(STR_EditWithCopy);
1769  return aStr;
1770 }
1771 
1773 {
1774  SdrHdlKind eRefHdl=SdrHdlKind::Move;
1775  SdrHdl* pRefHdl=nullptr;
1776 
1777  switch (GetDragHdlKind())
1778  {
1779  case SdrHdlKind::UpperLeft: eRefHdl=SdrHdlKind::LowerRight; break;
1780  case SdrHdlKind::Upper: eRefHdl=SdrHdlKind::Lower; DragStat().SetHorFixed(true); break;
1781  case SdrHdlKind::UpperRight: eRefHdl=SdrHdlKind::LowerLeft; break;
1782  case SdrHdlKind::Left : eRefHdl=SdrHdlKind::Right; DragStat().SetVerFixed(true); break;
1783  case SdrHdlKind::Right: eRefHdl=SdrHdlKind::Left ; DragStat().SetVerFixed(true); break;
1784  case SdrHdlKind::LowerLeft: eRefHdl=SdrHdlKind::UpperRight; break;
1785  case SdrHdlKind::Lower: eRefHdl=SdrHdlKind::Upper; DragStat().SetHorFixed(true); break;
1786  case SdrHdlKind::LowerRight: eRefHdl=SdrHdlKind::UpperLeft; break;
1787  default: break;
1788  }
1789 
1790  if (eRefHdl!=SdrHdlKind::Move)
1791  pRefHdl=GetHdlList().GetHdl(eRefHdl);
1792 
1793  if (pRefHdl!=nullptr && !getSdrDragView().IsResizeAtCenter())
1794  {
1795  DragStat().SetRef1(pRefHdl->GetPos());
1796  }
1797  else
1798  {
1801 
1802  if (pRef1!=nullptr && pRef2!=nullptr)
1803  {
1804  DragStat().SetRef1(tools::Rectangle(pRef1->GetPos(),pRef2->GetPos()).Center());
1805  }
1806  else
1807  {
1809  }
1810  }
1811 
1812  Show();
1813 
1814  return true;
1815 }
1816 
1818 {
1820  -DragStat().GetRef1().X(), -DragStat().GetRef1().Y()));
1821  aRetval.scale(double(aXFact), double(aYFact));
1822  aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
1823 
1824  return aRetval;
1825 }
1826 
1827 void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
1828 {
1829  Point aPnt(GetSnapPos(rNoSnapPnt));
1830  Point aStart(DragStat().GetStart());
1831  Point aRef(DragStat().GetRef1());
1832  Fraction aMaxFact(0x7FFFFFFF,1);
1833  tools::Rectangle aLR(getSdrDragView().GetWorkArea());
1834  bool bWorkArea=!aLR.IsEmpty();
1835  bool bDragLimit=IsDragLimit();
1836 
1837  if (bDragLimit || bWorkArea)
1838  {
1840 
1841  if (bDragLimit)
1842  {
1844 
1845  if (bWorkArea)
1846  aLR.Intersection(aR2);
1847  else
1848  aLR=aR2;
1849  }
1850 
1851  if (aPnt.X()<aLR.Left())
1852  aPnt.setX(aLR.Left() );
1853  else if (aPnt.X()>aLR.Right())
1854  aPnt.setX(aLR.Right() );
1855 
1856  if (aPnt.Y()<aLR.Top())
1857  aPnt.setY(aLR.Top() );
1858  else if (aPnt.Y()>aLR.Bottom())
1859  aPnt.setY(aLR.Bottom() );
1860 
1861  if (aRef.X()>aSR.Left())
1862  {
1863  Fraction aMax(aRef.X()-aLR.Left(),aRef.X()-aSR.Left());
1864 
1865  if (aMax<aMaxFact)
1866  aMaxFact=aMax;
1867  }
1868 
1869  if (aRef.X()<aSR.Right())
1870  {
1871  Fraction aMax(aLR.Right()-aRef.X(),aSR.Right()-aRef.X());
1872 
1873  if (aMax<aMaxFact)
1874  aMaxFact=aMax;
1875  }
1876 
1877  if (aRef.Y()>aSR.Top())
1878  {
1879  Fraction aMax(aRef.Y()-aLR.Top(),aRef.Y()-aSR.Top());
1880 
1881  if (aMax<aMaxFact)
1882  aMaxFact=aMax;
1883  }
1884 
1885  if (aRef.Y()<aSR.Bottom())
1886  {
1887  Fraction aMax(aLR.Bottom()-aRef.Y(),aSR.Bottom()-aRef.Y());
1888 
1889  if (aMax<aMaxFact)
1890  aMaxFact=aMax;
1891  }
1892  }
1893 
1894  long nXDiv=aStart.X()-aRef.X(); if (nXDiv==0) nXDiv=1;
1895  long nYDiv=aStart.Y()-aRef.Y(); if (nYDiv==0) nYDiv=1;
1896  long nXMul=aPnt.X()-aRef.X();
1897  long nYMul=aPnt.Y()-aRef.Y();
1898 
1899  if (nXDiv<0)
1900  {
1901  nXDiv=-nXDiv;
1902  nXMul=-nXMul;
1903  }
1904 
1905  if (nYDiv<0)
1906  {
1907  nYDiv=-nYDiv;
1908  nYMul=-nYMul;
1909  }
1910 
1911  bool bXNeg=nXMul<0; if (bXNeg) nXMul=-nXMul;
1912  bool bYNeg=nYMul<0; if (bYNeg) nYMul=-nYMul;
1913  bool bOrtho=getSdrDragView().IsOrtho() || !getSdrDragView().IsResizeAllowed();
1914 
1915  if (!DragStat().IsHorFixed() && !DragStat().IsVerFixed())
1916  {
1917  if (std::abs(nXDiv)<=1 || std::abs(nYDiv)<=1)
1918  bOrtho=false;
1919 
1920  if (bOrtho)
1921  {
1922  if ((Fraction(nXMul,nXDiv)>Fraction(nYMul,nYDiv)) !=getSdrDragView().IsBigOrtho())
1923  {
1924  nXMul=nYMul;
1925  nXDiv=nYDiv;
1926  }
1927  else
1928  {
1929  nYMul=nXMul;
1930  nYDiv=nXDiv;
1931  }
1932  }
1933  }
1934  else
1935  {
1936  if (bOrtho)
1937  {
1938  if (DragStat().IsHorFixed())
1939  {
1940  bXNeg=false;
1941  nXMul=nYMul;
1942  nXDiv=nYDiv;
1943  }
1944 
1945  if (DragStat().IsVerFixed())
1946  {
1947  bYNeg=false;
1948  nYMul=nXMul;
1949  nYDiv=nXDiv;
1950  }
1951  }
1952  else
1953  {
1954  if (DragStat().IsHorFixed())
1955  {
1956  bXNeg=false;
1957  nXMul=1;
1958  nXDiv=1;
1959  }
1960 
1961  if (DragStat().IsVerFixed())
1962  {
1963  bYNeg=false;
1964  nYMul=1;
1965  nYDiv=1;
1966  }
1967  }
1968  }
1969 
1970  Fraction aNewXFact(nXMul,nXDiv);
1971  Fraction aNewYFact(nYMul,nYDiv);
1972 
1973  if (bOrtho)
1974  {
1975  if (aNewXFact>aMaxFact)
1976  {
1977  aNewXFact=aMaxFact;
1978  aNewYFact=aMaxFact;
1979  }
1980 
1981  if (aNewYFact>aMaxFact)
1982  {
1983  aNewXFact=aMaxFact;
1984  aNewYFact=aMaxFact;
1985  }
1986  }
1987 
1988  if (bXNeg)
1989  aNewXFact=Fraction(-aNewXFact.GetNumerator(),aNewXFact.GetDenominator());
1990 
1991  if (bYNeg)
1992  aNewYFact=Fraction(-aNewYFact.GetNumerator(),aNewYFact.GetDenominator());
1993 
1994  if (DragStat().CheckMinMoved(aPnt))
1995  {
1996  if ((!DragStat().IsHorFixed() && aPnt.X()!=DragStat().GetNow().X()) ||
1997  (!DragStat().IsVerFixed() && aPnt.Y()!=DragStat().GetNow().Y()))
1998  {
1999  Hide();
2000  DragStat().NextMove(aPnt);
2001  aXFact=aNewXFact;
2002  aYFact=aNewYFact;
2003  Show();
2004  }
2005  }
2006 }
2007 
2009 {
2010  rTarget.Resize(DragStat().GetRef1(),aXFact,aYFact);
2011 }
2012 
2014 {
2015  Hide();
2016 
2017  if (IsDraggingPoints())
2018  {
2020  }
2021  else if (IsDraggingGluePoints())
2022  {
2024  }
2025  else
2026  {
2027  getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aXFact,aYFact,bCopy);
2028  }
2029 
2030  return true;
2031 }
2032 
2034 {
2035  const SdrHdl* pHdl=GetDragHdl();
2036 
2037  if (pHdl!=nullptr)
2038  {
2039  return pHdl->GetPointer();
2040  }
2041 
2042  return PointerStyle::Move;
2043 }
2044 
2045 
2047 {
2048  rTarget.Rotate(DragStat().GetRef1(), nAngle, sin(nAngle * F_PI18000), cos(nAngle * F_PI18000));
2049 }
2050 
2052 : SdrDragMethod(rNewView),
2053  nSin(0.0),
2054  nCos(1.0),
2055  nAngle0(0),
2056  nAngle(0),
2057  bRight(false)
2058 {
2059 }
2060 
2062 {
2063  OUString aStr = ImpGetDescriptionStr(STR_DragMethRotate) +
2064  " (";
2065  sal_Int32 nTmpAngle(NormAngle36000(nAngle));
2066 
2067  if(bRight && nAngle)
2068  {
2069  nTmpAngle -= 36000;
2070  }
2071 
2072  aStr += SdrModel::GetAngleString(nTmpAngle) + ")";
2073 
2074  if(getSdrDragView().IsDragWithCopy())
2075  aStr += SvxResId(STR_EditWithCopy);
2076  return aStr;
2077 }
2078 
2080 {
2082 
2083  if (nullptr != pH)
2084  {
2085  Show();
2086  DragStat().SetRef1(pH->GetPos());
2087  nAngle0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
2088  return true;
2089  }
2090 
2091  // RotGrfFlyFrame: Support rotation around center *without* Ref1 (normally
2092  // the rotation point)
2093  const tools::Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
2094 
2095  if(!aLocalMarkRect.IsEmpty())
2096  {
2097  Show();
2098  DragStat().SetRef1(aLocalMarkRect.Center());
2099  nAngle0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
2100  return true;
2101  }
2102 
2103  OSL_FAIL("SdrDragRotate::BeginSdrDrag(): No reference point handle found.");
2104  return false;
2105 }
2106 
2108 {
2110  DragStat().GetRef1().X(), DragStat().GetRef1().Y(),
2111  -atan2(nSin, nCos));
2112 }
2113 
2114 void SdrDragRotate::MoveSdrDrag(const Point& rPnt_)
2115 {
2116  Point aPnt(rPnt_);
2117  if (DragStat().CheckMinMoved(aPnt))
2118  {
2119  long nNewAngle=NormAngle36000(GetAngle(aPnt-DragStat().GetRef1())-nAngle0);
2120  long nSA=0;
2121 
2122  if (getSdrDragView().IsAngleSnapEnabled())
2123  nSA=getSdrDragView().GetSnapAngle();
2124 
2125  if (!getSdrDragView().IsRotateAllowed())
2126  nSA=9000;
2127 
2128  if (nSA!=0)
2129  { // angle snapping
2130  nNewAngle+=nSA/2;
2131  nNewAngle/=nSA;
2132  nNewAngle*=nSA;
2133  }
2134 
2135  nNewAngle=NormAngle18000(nNewAngle);
2136 
2137  if (nAngle!=nNewAngle)
2138  {
2139  sal_uInt16 nSekt0=GetAngleSector(nAngle);
2140  sal_uInt16 nSekt1=GetAngleSector(nNewAngle);
2141 
2142  if (nSekt0==0 && nSekt1==3)
2143  bRight=true;
2144 
2145  if (nSekt0==3 && nSekt1==0)
2146  bRight=false;
2147 
2148  nAngle=nNewAngle;
2149  double a = nAngle * F_PI18000;
2150  double nSin1=sin(a); // calculate now, so as little time as possible
2151  double nCos1=cos(a); // passes between Hide() and Show()
2152  Hide();
2153  nSin=nSin1;
2154  nCos=nCos1;
2155  DragStat().NextMove(aPnt);
2156  Show();
2157  }
2158  }
2159 }
2160 
2162 {
2163  Hide();
2164 
2165  if (nAngle!=0)
2166  {
2167  if (IsDraggingPoints())
2168  {
2170  }
2171  else if (IsDraggingGluePoints())
2172  {
2174  }
2175  else
2176  {
2177  getSdrDragView().RotateMarkedObj(DragStat().GetRef1(),nAngle,bCopy);
2178  }
2179  }
2180  return true;
2181 }
2182 
2184 {
2185  return PointerStyle::Rotate;
2186 }
2187 
2188 
2189 SdrDragShear::SdrDragShear(SdrDragView& rNewView, bool bSlant1)
2190 : SdrDragMethod(rNewView),
2191  aFact(1,1),
2192  nAngle0(0),
2193  nAngle(0),
2194  nTan(0.0),
2195  bVertical(false),
2196  bResize(false),
2197  bUpSideDown(false),
2198  bSlant(bSlant1)
2199 {
2200 }
2201 
2203 {
2204  OUString aStr = ImpGetDescriptionStr(STR_DragMethShear) +
2205  " (";
2206 
2207  sal_Int32 nTmpAngle(nAngle);
2208 
2209  if(bUpSideDown)
2210  nTmpAngle += 18000;
2211 
2212  nTmpAngle = NormAngle18000(nTmpAngle);
2213 
2214  aStr += SdrModel::GetAngleString(nTmpAngle) + ")";
2215 
2216  if(getSdrDragView().IsDragWithCopy())
2217  aStr += SvxResId(STR_EditWithCopy);
2218  return aStr;
2219 }
2220 
2222 {
2223  SdrHdlKind eRefHdl=SdrHdlKind::Move;
2224  SdrHdl* pRefHdl=nullptr;
2225 
2226  switch (GetDragHdlKind())
2227  {
2228  case SdrHdlKind::Upper: eRefHdl=SdrHdlKind::Lower; break;
2229  case SdrHdlKind::Lower: eRefHdl=SdrHdlKind::Upper; break;
2230  case SdrHdlKind::Left : eRefHdl=SdrHdlKind::Right; bVertical=true; break;
2231  case SdrHdlKind::Right: eRefHdl=SdrHdlKind::Left ; bVertical=true; break;
2232  default: break;
2233  }
2234 
2235  if (eRefHdl!=SdrHdlKind::Move)
2236  pRefHdl=GetHdlList().GetHdl(eRefHdl);
2237 
2238  if (pRefHdl!=nullptr)
2239  {
2240  DragStat().SetRef1(pRefHdl->GetPos());
2241  nAngle0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
2242  }
2243  else
2244  {
2245  OSL_FAIL("SdrDragShear::BeginSdrDrag(): No reference point handle for shearing found.");
2246  return false;
2247  }
2248 
2249  Show();
2250  return true;
2251 }
2252 
2254 {
2256  -DragStat().GetRef1().X(), -DragStat().GetRef1().Y()));
2257 
2258  if (bResize)
2259  {
2260  if (bVertical)
2261  {
2262  aRetval.scale(double(aFact), 1.0);
2263  aRetval.shearY(-nTan);
2264  }
2265  else
2266  {
2267  aRetval.scale(1.0, double(aFact));
2268  aRetval.shearX(-nTan);
2269  }
2270  }
2271 
2272  aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
2273 
2274  return aRetval;
2275 }
2276 
2277 void SdrDragShear::MoveSdrDrag(const Point& rPnt)
2278 {
2279  if (!DragStat().CheckMinMoved(rPnt))
2280  return;
2281 
2283  long nSA=0;
2284 
2285  if (getSdrDragView().IsAngleSnapEnabled())
2286  nSA=getSdrDragView().GetSnapAngle();
2287 
2288  Point aP0(DragStat().GetStart());
2289  Point aPnt(rPnt);
2290  Fraction aNewFract(1,1);
2291 
2292  // if angle snapping not activated, snap to raster (except when using slant)
2293  if (nSA==0 && !bSlant)
2294  aPnt=GetSnapPos(aPnt);
2295 
2296  if (!bSlant && !bResize)
2297  { // shear, but no resize
2298  if (bVertical)
2299  aPnt.setX(aP0.X() );
2300  else
2301  aPnt.setY(aP0.Y() );
2302  }
2303 
2304  Point aRef(DragStat().GetRef1());
2305  Point aDif(aPnt-aRef);
2306 
2307  long nNewAngle=0;
2308 
2309  if (bSlant)
2310  {
2311  nNewAngle=NormAngle18000(-(GetAngle(aDif)-nAngle0));
2312 
2313  if (bVertical)
2314  nNewAngle=NormAngle18000(-nNewAngle);
2315  }
2316  else
2317  {
2318  if (bVertical)
2319  nNewAngle=NormAngle18000(GetAngle(aDif));
2320  else
2321  nNewAngle=NormAngle18000(-(GetAngle(aDif)-9000));
2322 
2323  if (nNewAngle<-9000 || nNewAngle>9000)
2324  nNewAngle=NormAngle18000(nNewAngle+18000);
2325 
2326  if (bResize)
2327  {
2328  Point aPt2(aPnt);
2329 
2330  if (nSA!=0)
2331  aPt2=GetSnapPos(aPnt); // snap this one in any case
2332 
2333  if (bVertical)
2334  {
2335  aNewFract=Fraction(aPt2.X()-aRef.X(),aP0.X()-aRef.X());
2336  }
2337  else
2338  {
2339  aNewFract=Fraction(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y());
2340  }
2341  }
2342  }
2343 
2344  bool bNeg=nNewAngle<0;
2345 
2346  if (bNeg)
2347  nNewAngle=-nNewAngle;
2348 
2349  if (nSA!=0)
2350  { // angle snapping
2351  nNewAngle+=nSA/2;
2352  nNewAngle/=nSA;
2353  nNewAngle*=nSA;
2354  }
2355 
2356  nNewAngle=NormAngle36000(nNewAngle);
2357  bUpSideDown=nNewAngle>9000 && nNewAngle<27000;
2358 
2359  if (bSlant)
2360  { // calculate resize for slant
2361  // when angle snapping is activated, disable 89 degree limit
2362  long nTmpAngle=nNewAngle;
2363  if (bUpSideDown) nNewAngle-=18000;
2364  if (bNeg) nTmpAngle=-nTmpAngle;
2365  bResize=true;
2366  aNewFract = cos(nTmpAngle * F_PI18000);
2367  aFact.ReduceInaccurate(10); // three decimals should be enough
2368  }
2369 
2370  if (nNewAngle>8900)
2371  nNewAngle=8900;
2372 
2373  if (bNeg)
2374  nNewAngle=-nNewAngle;
2375 
2376  if (nAngle!=nNewAngle || aFact!=aNewFract)
2377  {
2378  nAngle=nNewAngle;
2379  aFact=aNewFract;
2380  double a = nAngle * F_PI18000;
2381  double nTan1=tan(a); // calculate now, so as little time as possible passes between Hide() and Show()
2382  Hide();
2383  nTan=nTan1;
2384  DragStat().NextMove(rPnt);
2385  Show();
2386  }
2387 }
2388 
2390 {
2391  if (bResize)
2392  {
2393  if (bVertical)
2394  {
2395  rTarget.Resize(DragStat().GetRef1(),aFact,Fraction(1,1));
2396  }
2397  else
2398  {
2399  rTarget.Resize(DragStat().GetRef1(),Fraction(1,1),aFact);
2400  }
2401  }
2402 
2403  if (nAngle!=0)
2404  {
2405  rTarget.Shear(DragStat().GetRef1(), nAngle, tan(nAngle * F_PI18000), bVertical);
2406  }
2407 }
2408 
2410 {
2411  Hide();
2412 
2413  if (bResize && aFact==Fraction(1,1))
2414  bResize=false;
2415 
2416  if (nAngle!=0 || bResize)
2417  {
2418  if (nAngle!=0 && bResize)
2419  {
2420  OUString aStr = ImpGetDescriptionStr(STR_EditShear);
2421 
2422  if (bCopy)
2423  aStr += SvxResId(STR_EditWithCopy);
2424 
2425  getSdrDragView().BegUndo(aStr);
2426  }
2427 
2428  if (bResize)
2429  {
2430  if (bVertical)
2431  {
2432  getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aFact,Fraction(1,1),bCopy);
2433  }
2434  else
2435  {
2436  getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),Fraction(1,1),aFact,bCopy);
2437  }
2438 
2439  bCopy=false;
2440  }
2441 
2442  if (nAngle!=0)
2443  {
2444  getSdrDragView().ShearMarkedObj(DragStat().GetRef1(),nAngle,bVertical,bCopy);
2445  }
2446 
2447  if (nAngle!=0 && bResize)
2448  getSdrDragView().EndUndo();
2449 
2450  return true;
2451  }
2452 
2453  return false;
2454 }
2455 
2457 {
2458  if (bVertical)
2459  return PointerStyle::VShear;
2460  else
2461  return PointerStyle::HShear;
2462 }
2463 
2464 
2466 {
2467  if(bMirrored)
2468  {
2469  rTarget.Mirror(DragStat().GetRef1(), DragStat().GetRef2());
2470  }
2471 }
2472 
2474 : SdrDragMethod(rNewView),
2475  nAngle(0),
2476  bMirrored(false),
2477  bSide0(false)
2478 {
2479 }
2480 
2481 bool SdrDragMirror::ImpCheckSide(const Point& rPnt) const
2482 {
2483  long nAngle1=GetAngle(rPnt-DragStat().GetRef1());
2484  nAngle1-=nAngle;
2485  nAngle1=NormAngle36000(nAngle1);
2486 
2487  return nAngle1<18000;
2488 }
2489 
2491 {
2492  OUString aStr;
2493  if (aDif.X()==0)
2494  aStr = ImpGetDescriptionStr(STR_DragMethMirrorHori);
2495  else if (aDif.Y()==0)
2496  aStr = ImpGetDescriptionStr(STR_DragMethMirrorVert);
2497  else if (std::abs(aDif.X()) == std::abs(aDif.Y()))
2498  aStr = ImpGetDescriptionStr(STR_DragMethMirrorDiag);
2499  else
2500  aStr = ImpGetDescriptionStr(STR_DragMethMirrorFree);
2501 
2502  if (getSdrDragView().IsDragWithCopy())
2503  aStr+=SvxResId(STR_EditWithCopy);
2504  return aStr;
2505 }
2506 
2508 {
2511 
2512  if (pH1!=nullptr && pH2!=nullptr)
2513  {
2514  DragStat().SetRef1(pH1->GetPos());
2515  DragStat().SetRef2(pH2->GetPos());
2516  Ref1()=pH1->GetPos();
2517  Ref2()=pH2->GetPos();
2518  aDif=pH2->GetPos()-pH1->GetPos();
2519  bool b90=(aDif.X()==0) || aDif.Y()==0;
2520  bool b45=b90 || (std::abs(aDif.X()) == std::abs(aDif.Y()));
2522 
2523  if (!getSdrDragView().IsMirrorAllowed() && !b45)
2524  return false; // free choice of axis angle not allowed
2525 
2526  if (!getSdrDragView().IsMirrorAllowed() && !b90)
2527  return false; // 45 degrees not allowed either
2528 
2529  bSide0=ImpCheckSide(DragStat().GetStart());
2530  Show();
2531  return true;
2532  }
2533  else
2534  {
2535  OSL_FAIL("SdrDragMirror::BeginSdrDrag(): Axis of reflection not found.");
2536  return false;
2537  }
2538 }
2539 
2541 {
2542  basegfx::B2DHomMatrix aRetval;
2543 
2544  if (bMirrored)
2545  {
2546  const double fDeltaX(DragStat().GetRef2().X() - DragStat().GetRef1().X());
2547  const double fDeltaY(DragStat().GetRef2().Y() - DragStat().GetRef1().Y());
2548  const double fRotation(atan2(fDeltaY, fDeltaX));
2549 
2550  aRetval = basegfx::utils::createTranslateB2DHomMatrix(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y());
2551  aRetval.rotate(-fRotation);
2552  aRetval.scale(1.0, -1.0);
2553  aRetval.rotate(fRotation);
2554  aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
2555  }
2556 
2557  return aRetval;
2558 }
2559 
2560 void SdrDragMirror::MoveSdrDrag(const Point& rPnt)
2561 {
2562  if (DragStat().CheckMinMoved(rPnt))
2563  {
2564  bool bNewSide=ImpCheckSide(rPnt);
2565  bool bNewMirrored=bSide0!=bNewSide;
2566 
2567  if (bMirrored!=bNewMirrored)
2568  {
2569  Hide();
2570  bMirrored=bNewMirrored;
2571  DragStat().NextMove(rPnt);
2572  Show();
2573  }
2574  }
2575 }
2576 
2578 {
2579  Hide();
2580 
2581  if (bMirrored)
2582  {
2583  getSdrDragView().MirrorMarkedObj(DragStat().GetRef1(),DragStat().GetRef2(),bCopy);
2584  }
2585 
2586  return true;
2587 }
2588 
2590 {
2591  return PointerStyle::Mirror;
2592 }
2593 
2594 
2596 : SdrDragMethod(rNewView),
2597  pIAOHandle(nullptr),
2598  bIsGradient(bGrad)
2599 {
2600 }
2601 
2603 {
2604  if(IsGradient())
2605  return ImpGetDescriptionStr(STR_DragMethGradient);
2606  else
2607  return ImpGetDescriptionStr(STR_DragMethTransparence);
2608 }
2609 
2611 {
2612  bool bRetval(false);
2613 
2615 
2616  if(pIAOHandle)
2617  {
2618  // save old values
2621 
2622  // what was hit?
2623  bool bHit(false);
2624  SdrHdlColor* pColHdl = pIAOHandle->GetColorHdl1();
2625 
2626  // init handling flags
2629 
2630  // test first color handle
2631  if(pColHdl)
2632  {
2633  basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
2634 
2635  if(pColHdl->getOverlayObjectList().isHitLogic(aPosition))
2636  {
2637  bHit = true;
2640  }
2641  }
2642 
2643  // test second color handle
2644  pColHdl = pIAOHandle->GetColorHdl2();
2645 
2646  if(!bHit && pColHdl)
2647  {
2648  basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
2649 
2650  if(pColHdl->getOverlayObjectList().isHitLogic(aPosition))
2651  {
2652  bHit = true;
2654  }
2655  }
2656 
2657  // test gradient handle itself
2658  if(!bHit)
2659  {
2660  basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
2661 
2662  if(pIAOHandle->getOverlayObjectList().isHitLogic(aPosition))
2663  {
2664  bHit = true;
2665  }
2666  }
2667 
2668  // everything up and running :o}
2669  bRetval = bHit;
2670  }
2671  else
2672  {
2673  OSL_FAIL("SdrDragGradient::BeginSdrDrag(): IAOGradient not found.");
2674  }
2675 
2676  return bRetval;
2677 }
2678 
2679 void SdrDragGradient::MoveSdrDrag(const Point& rPnt)
2680 {
2681  if(pIAOHandle && DragStat().CheckMinMoved(rPnt))
2682  {
2683  DragStat().NextMove(rPnt);
2684 
2685  // Do the Move here!!! DragStat().GetStart()
2686  Point aMoveDiff = rPnt - DragStat().GetStart();
2687 
2689  {
2691  {
2692  pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
2693  if(pIAOHandle->GetColorHdl1())
2694  pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
2695  }
2696  else
2697  {
2698  pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
2699  if(pIAOHandle->GetColorHdl2())
2700  pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
2701  }
2702  }
2703  else
2704  {
2705  pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
2706  pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
2707 
2708  if(pIAOHandle->GetColorHdl1())
2709  pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
2710 
2711  if(pIAOHandle->GetColorHdl2())
2712  pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
2713  }
2714 
2715  // new state
2716  pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), false, false);
2717  }
2718 }
2719 
2720 bool SdrDragGradient::EndSdrDrag(bool /*bCopy*/)
2721 {
2722  Ref1() = pIAOHandle->GetPos();
2723  Ref2() = pIAOHandle->Get2ndPos();
2724 
2725  // new state
2726  pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), true, true);
2727 
2728  return true;
2729 }
2730 
2732 {
2733  // restore old values
2734  pIAOHandle->SetPos(DragStat().GetRef1());
2735  pIAOHandle->Set2ndPos(DragStat().GetRef2());
2736 
2737  if(pIAOHandle->GetColorHdl1())
2738  pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1());
2739 
2740  if(pIAOHandle->GetColorHdl2())
2741  pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2());
2742 
2743  // new state
2744  pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), true, false);
2745 }
2746 
2748 {
2749  return PointerStyle::RefHand;
2750 }
2751 
2752 
2754 : SdrDragMethod(rNewView),
2755  aFact(1,1),
2756  bContortionAllowed(false),
2757  bNoContortionAllowed(false),
2758  bContortion(false),
2759  bResizeAllowed(false),
2760  bResize(false),
2761  bRotateAllowed(false),
2762  bRotate(false),
2763  bVertical(false),
2764  bValid(false),
2765  bLft(false),
2766  bRgt(false),
2767  bUpr(false),
2768  bLwr(false),
2769  bAtCenter(false),
2770  nAngle(0),
2771  nMarkSize(0),
2773 {
2774 }
2775 
2777 {
2778  OUString aStr = ImpGetDescriptionStr(!bContortion ? STR_DragMethCrook : STR_DragMethCrookContortion);
2779 
2780  if(bValid)
2781  {
2782  aStr += " (";
2783 
2784  sal_Int32 nVal(nAngle);
2785 
2786  if(bAtCenter)
2787  nVal *= 2;
2788 
2789  nVal = std::abs(nVal);
2790  aStr += SdrModel::GetAngleString(nVal) + ")";
2791  }
2792 
2793  if(getSdrDragView().IsDragWithCopy())
2794  aStr += SvxResId(STR_EditWithCopy);
2795  return aStr;
2796 }
2797 
2798 // These defines parametrize the created raster
2799 // for interactions
2800 #define DRAG_CROOK_RASTER_MINIMUM (4)
2801 #define DRAG_CROOK_RASTER_MAXIMUM (15)
2802 #define DRAG_CROOK_RASTER_DISTANCE (30)
2803 
2805 {
2806  basegfx::B2DPolyPolygon aRetval;
2807 
2808  if(rPageView.PageWindowCount())
2809  {
2810  OutputDevice& rOut = rPageView.GetPageWindow(0)->GetPaintWindow().GetOutputDevice();
2811  tools::Rectangle aPixelSize = rOut.LogicToPixel(rMarkRect);
2812  sal_uInt32 nHorDiv(aPixelSize.GetWidth() / DRAG_CROOK_RASTER_DISTANCE);
2813  sal_uInt32 nVerDiv(aPixelSize.GetHeight() / DRAG_CROOK_RASTER_DISTANCE);
2814 
2815  if(nHorDiv > DRAG_CROOK_RASTER_MAXIMUM)
2816  nHorDiv = DRAG_CROOK_RASTER_MAXIMUM;
2817  if(nHorDiv < DRAG_CROOK_RASTER_MINIMUM)
2818  nHorDiv = DRAG_CROOK_RASTER_MINIMUM;
2819 
2820  if(nVerDiv > DRAG_CROOK_RASTER_MAXIMUM)
2821  nVerDiv = DRAG_CROOK_RASTER_MAXIMUM;
2822  if(nVerDiv < DRAG_CROOK_RASTER_MINIMUM)
2823  nVerDiv = DRAG_CROOK_RASTER_MINIMUM;
2824 
2825  const double fXLen(rMarkRect.GetWidth() / static_cast<double>(nHorDiv));
2826  const double fYLen(rMarkRect.GetHeight() / static_cast<double>(nVerDiv));
2827  double fYPos(rMarkRect.Top());
2828  sal_uInt32 a, b;
2829 
2830  for(a = 0; a <= nVerDiv; a++)
2831  {
2832  // horizontal lines
2833  for(b = 0; b < nHorDiv; b++)
2834  {
2835  basegfx::B2DPolygon aHorLineSegment;
2836 
2837  const double fNewX(rMarkRect.Left() + (b * fXLen));
2838  aHorLineSegment.append(basegfx::B2DPoint(fNewX, fYPos));
2839  aHorLineSegment.appendBezierSegment(
2840  basegfx::B2DPoint(fNewX + (fXLen * (1.0 / 3.0)), fYPos),
2841  basegfx::B2DPoint(fNewX + (fXLen * (2.0 / 3.0)), fYPos),
2842  basegfx::B2DPoint(fNewX + fXLen, fYPos));
2843  aRetval.append(aHorLineSegment);
2844  }
2845 
2846  // increments
2847  fYPos += fYLen;
2848  }
2849 
2850  double fXPos(rMarkRect.Left());
2851 
2852  for(a = 0; a <= nHorDiv; a++)
2853  {
2854  // vertical lines
2855  for(b = 0; b < nVerDiv; b++)
2856  {
2857  basegfx::B2DPolygon aVerLineSegment;
2858 
2859  const double fNewY(rMarkRect.Top() + (b * fYLen));
2860  aVerLineSegment.append(basegfx::B2DPoint(fXPos, fNewY));
2861  aVerLineSegment.appendBezierSegment(
2862  basegfx::B2DPoint(fXPos, fNewY + (fYLen * (1.0 / 3.0))),
2863  basegfx::B2DPoint(fXPos, fNewY + (fYLen * (2.0 / 3.0))),
2864  basegfx::B2DPoint(fXPos, fNewY + fYLen));
2865  aRetval.append(aVerLineSegment);
2866  }
2867 
2868  // increments
2869  fXPos += fXLen;
2870  }
2871  }
2872 
2873  return aRetval;
2874 }
2875 
2877 {
2878  // Add extended frame raster first, so it will be behind objects
2879  if(getSdrDragView().GetSdrPageView())
2880  {
2881  const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
2882 
2883  if(aDragRaster.count())
2884  {
2885  addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragRaster)));
2886  }
2887  }
2888 
2889  // call parent
2891 }
2892 
2894 {
2899 
2901  {
2907  aStart=DragStat().GetStart();
2908  Show();
2909  return true;
2910  }
2911  else
2912  {
2913  return false;
2914  }
2915 }
2916 
2918 {
2920 
2921  if(pPV)
2922  {
2923  XPolyPolygon aTempPolyPoly(rTarget);
2924 
2925  if (pPV->HasMarkedObjPageView())
2926  {
2927  sal_uInt16 nPolyCount=aTempPolyPoly.Count();
2928 
2929  if (!bContortion && !getSdrDragView().IsNoDragXorPolys())
2930  {
2931  sal_uInt16 n1st=0,nLast=0;
2932  Point aC(aCenter);
2933 
2934  while (n1st<nPolyCount)
2935  {
2936  nLast=n1st;
2937  while (nLast<nPolyCount && aTempPolyPoly[nLast].GetPointCount()!=0) nLast++;
2938  tools::Rectangle aBound(aTempPolyPoly[n1st].GetBoundRect());
2939  sal_uInt16 i;
2940 
2941  for (i=n1st+1; i<nLast; i++)
2942  {
2943  aBound.Union(aTempPolyPoly[n1st].GetBoundRect());
2944  }
2945 
2946  Point aCtr0(aBound.Center());
2947  Point aCtr1(aCtr0);
2948 
2949  if (bResize)
2950  {
2951  Fraction aFact1(1,1);
2952 
2953  if (bVertical)
2954  {
2955  ResizePoint(aCtr1,aC,aFact1,aFact);
2956  }
2957  else
2958  {
2959  ResizePoint(aCtr1,aC,aFact,aFact1);
2960  }
2961  }
2962 
2963  bool bRotOk=false;
2964  double nSin=0,nCos=0;
2965 
2966  if (aRad.X()!=0 && aRad.Y()!=0)
2967  {
2968  bRotOk=bRotate;
2969 
2970  switch (eMode)
2971  {
2972  case SdrCrookMode::Rotate : CrookRotateXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
2973  case SdrCrookMode::Slant : CrookSlantXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
2974  case SdrCrookMode::Stretch: CrookStretchXPoint(aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical,aMarkRect); break;
2975  } // switch
2976  }
2977 
2978  aCtr1-=aCtr0;
2979 
2980  for (i=n1st; i<nLast; i++)
2981  {
2982  if (bRotOk)
2983  {
2984  RotateXPoly(aTempPolyPoly[i],aCtr0,nSin,nCos);
2985  }
2986 
2987  aTempPolyPoly[i].Move(aCtr1.X(),aCtr1.Y());
2988  }
2989 
2990  n1st=nLast+1;
2991  }
2992  }
2993  else
2994  {
2995  sal_uInt16 i,j;
2996 
2997  for (j=0; j<nPolyCount; j++)
2998  {
2999  XPolygon& aPol=aTempPolyPoly[j];
3000  sal_uInt16 nPointCount=aPol.GetPointCount();
3001  i=0;
3002 
3003  while (i<nPointCount)
3004  {
3005  Point* pPnt=&aPol[i];
3006  Point* pC1=nullptr;
3007  Point* pC2=nullptr;
3008 
3009  if (i+1<nPointCount && aPol.IsControl(i))
3010  { // control point on the left
3011  pC1=pPnt;
3012  i++;
3013  pPnt=&aPol[i];
3014  }
3015 
3016  i++;
3017 
3018  if (i<nPointCount && aPol.IsControl(i))
3019  { // control point on the right
3020  pC2=&aPol[i];
3021  i++;
3022  }
3023 
3024  MovCrookPoint(*pPnt,pC1,pC2);
3025  }
3026  }
3027  }
3028  }
3029 
3030  rTarget = aTempPolyPoly.getB2DPolyPolygon();
3031  }
3032 }
3033 
3034 void SdrDragCrook::MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2)
3035 {
3036  bool bVert=bVertical;
3037  bool bC1=pC1!=nullptr;
3038  bool bC2=pC2!=nullptr;
3039  Point aC(aCenter);
3040 
3041  if (bResize)
3042  {
3043  Fraction aFact1(1,1);
3044 
3045  if (bVert)
3046  {
3047  ResizePoint(rPnt,aC,aFact1,aFact);
3048 
3049  if (bC1)
3050  ResizePoint(*pC1,aC,aFact1,aFact);
3051 
3052  if (bC2)
3053  ResizePoint(*pC2,aC,aFact1,aFact);
3054  }
3055  else
3056  {
3057  ResizePoint(rPnt,aC,aFact,aFact1);
3058 
3059  if (bC1)
3060  ResizePoint(*pC1,aC,aFact,aFact1);
3061 
3062  if (bC2)
3063  ResizePoint(*pC2,aC,aFact,aFact1);
3064  }
3065  }
3066 
3067  if (aRad.X()!=0 && aRad.Y()!=0)
3068  {
3069  double nSin,nCos;
3070 
3071  switch (eMode)
3072  {
3073  case SdrCrookMode::Rotate : CrookRotateXPoint (rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert); break;
3074  case SdrCrookMode::Slant : CrookSlantXPoint (rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert); break;
3075  case SdrCrookMode::Stretch: CrookStretchXPoint(rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert,aMarkRect); break;
3076  } // switch
3077  }
3078 }
3079 
3080 void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
3081 {
3082  if (!DragStat().CheckMinMoved(rPnt))
3083  return;
3084 
3085  bool bNewMoveOnly=getSdrDragView().IsMoveOnlyDragging();
3086  bAtCenter=false;
3088  bool bNewContortion=!bNewMoveOnly && ((bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed);
3089  bResize=!getSdrDragView().IsOrtho() && bResizeAllowed && !bNewMoveOnly;
3090  bool bNewRotate=bRotateAllowed && !bNewContortion && !bNewMoveOnly && eNewMode==SdrCrookMode::Rotate;
3091 
3092  Point aPnt(GetSnapPos(rPnt));
3093 
3094  Point aNewCenter(aMarkCenter.X(),aStart.Y());
3095 
3096  if (bVertical)
3097  {
3098  aNewCenter.setX(aStart.X() );
3099  aNewCenter.setY(aMarkCenter.Y() );
3100  }
3101 
3103  {
3104  switch (GetDragHdlKind())
3105  {
3106  case SdrHdlKind::UpperLeft: aNewCenter.setX(aMarkRect.Right() ); bLft=true; break;
3107  case SdrHdlKind::Upper: aNewCenter.setY(aMarkRect.Bottom() ); bUpr=true; break;
3108  case SdrHdlKind::UpperRight: aNewCenter.setX(aMarkRect.Left() ); bRgt=true; break;
3109  case SdrHdlKind::Left : aNewCenter.setX(aMarkRect.Right() ); bLft=true; break;
3110  case SdrHdlKind::Right: aNewCenter.setX(aMarkRect.Left() ); bRgt=true; break;
3111  case SdrHdlKind::LowerLeft: aNewCenter.setX(aMarkRect.Right() ); bLft=true; break;
3112  case SdrHdlKind::Lower: aNewCenter.setY(aMarkRect.Top() ); bLwr=true; break;
3113  case SdrHdlKind::LowerRight: aNewCenter.setX(aMarkRect.Left() ); bRgt=true; break;
3114  default: bAtCenter=true;
3115  }
3116  }
3117  else
3118  bAtCenter=true;
3119 
3120  Fraction aNewFract(1,1);
3121  long dx1=aPnt.X()-aNewCenter.X();
3122  long dy1=aPnt.Y()-aNewCenter.Y();
3123  bValid=bVertical ? dx1!=0 : dy1!=0;
3124 
3125  if (bValid)
3126  {
3127  if (bVertical)
3128  bValid = std::abs(dx1)*100>std::abs(dy1);
3129  else
3130  bValid = std::abs(dy1)*100>std::abs(dx1);
3131  }
3132 
3133  long nNewRad=0;
3134  nAngle=0;
3135 
3136  if (bValid)
3137  {
3138  double a=0; // slope of the radius
3139  long nPntWink=0;
3140 
3141  if (bVertical)
3142  {
3143  a=static_cast<double>(dy1)/static_cast<double>(dx1); // slope of the radius
3144  nNewRad=(static_cast<long>(dy1*a)+dx1) /2;
3145  aNewCenter.AdjustX(nNewRad );
3146  nPntWink=GetAngle(aPnt-aNewCenter);
3147  }
3148  else
3149  {
3150  a=static_cast<double>(dx1)/static_cast<double>(dy1); // slope of the radius
3151  nNewRad=(static_cast<long>(dx1*a)+dy1) /2;
3152  aNewCenter.AdjustY(nNewRad );
3153  nPntWink=GetAngle(aPnt-aNewCenter)-9000;
3154  }
3155 
3156  if (!bAtCenter)
3157  {
3158  if (nNewRad<0)
3159  {
3160  if (bRgt) nPntWink+=18000;
3161  if (bLft) nPntWink=18000-nPntWink;
3162  if (bLwr) nPntWink=-nPntWink;
3163  }
3164  else
3165  {
3166  if (bRgt) nPntWink=-nPntWink;
3167  if (bUpr) nPntWink=18000-nPntWink;
3168  if (bLwr) nPntWink+=18000;
3169  }
3170 
3171  nPntWink=NormAngle36000(nPntWink);
3172  }
3173  else
3174  {
3175  if (nNewRad<0) nPntWink+=18000;
3176  if (bVertical) nPntWink=18000-nPntWink;
3177  nPntWink=NormAngle18000(nPntWink);
3178  nPntWink = std::abs(nPntWink);
3179  }
3180 
3181  double nUmfang = 2 * std::abs(nNewRad) * M_PI;
3182 
3183  if (bResize)
3184  {
3185  long nMul=static_cast<long>(nUmfang*NormAngle36000(nPntWink)/36000);
3186 
3187  if (bAtCenter)
3188  nMul*=2;
3189 
3190  aNewFract=Fraction(nMul,nMarkSize);
3191  nAngle=nPntWink;
3192  }
3193  else
3194  {
3195  nAngle=static_cast<long>((nMarkSize*360/nUmfang)*100)/2;
3196 
3197  if (nAngle==0)
3198  bValid=false;
3199  }
3200  }
3201 
3202  if (nAngle==0 || nNewRad==0)
3203  bValid=false;
3204 
3205  if (!bValid)
3206  nNewRad=0;
3207 
3208  if (!bValid && bResize)
3209  {
3210  long nMul=bVertical ? dy1 : dx1;
3211 
3212  if (bLft || bUpr)
3213  nMul=-nMul;
3214 
3215  long nDiv=nMarkSize;
3216 
3217  if (bAtCenter)
3218  {
3219  nMul*=2;
3220  nMul = std::abs(nMul);
3221  }
3222 
3223  aNewFract=Fraction(nMul,nDiv);
3224  }
3225 
3226  if (aNewCenter==aCenter && bNewContortion==bContortion && aNewFract==aFact &&
3227  bNewMoveOnly == getMoveOnly() && bNewRotate==bRotate && eNewMode==eMode)
3228  return;
3229 
3230  Hide();
3231  setMoveOnly(bNewMoveOnly);
3232  bRotate=bNewRotate;
3233  eMode=eNewMode;
3234  bContortion=bNewContortion;
3235  aCenter=aNewCenter;
3236  aFact=aNewFract;
3237  aRad=Point(nNewRad,nNewRad);
3238  bResize=aFact!=Fraction(1,1) && aFact.GetDenominator()!=0 && aFact.IsValid();
3239  DragStat().NextMove(aPnt);
3240  Show();
3241 }
3242 
3244 {
3245  const bool bDoResize(aFact!=Fraction(1,1));
3246  const bool bDoCrook(aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0);
3247 
3248  if (bDoCrook || bDoResize)
3249  {
3250  if (bDoResize)
3251  {
3252  Fraction aFact1(1,1);
3253 
3254  if (bContortion)
3255  {
3256  if (bVertical)
3257  {
3258  rTarget.Resize(aCenter,aFact1,aFact);
3259  }
3260  else
3261  {
3262  rTarget.Resize(aCenter,aFact,aFact1);
3263  }
3264  }
3265  else
3266  {
3267  Point aCtr0(rTarget.GetSnapRect().Center());
3268  Point aCtr1(aCtr0);
3269 
3270  if (bVertical)
3271  {
3272  ResizePoint(aCtr1,aCenter,aFact1,aFact);
3273  }
3274  else
3275  {
3276  ResizePoint(aCtr1,aCenter,aFact,aFact1);
3277  }
3278 
3279  Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
3280 
3281  rTarget.Move(aSiz);
3282  }
3283  }
3284 
3285  if (bDoCrook)
3286  {
3287  const tools::Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
3288  const bool bLocalRotate(!bContortion && eMode == SdrCrookMode::Rotate && getSdrDragView().IsRotateAllowed());
3289 
3290  SdrEditView::ImpCrookObj(&rTarget,aCenter,aRad,eMode,bVertical,!bContortion,bLocalRotate,aLocalMarkRect);
3291  }
3292  }
3293 }
3294 
3296 {
3297  // use helper derived from old stuff
3298  MovAllPoints(rTarget);
3299 }
3300 
3302 {
3303  Hide();
3304 
3305  if (bResize && aFact==Fraction(1,1))
3306  bResize=false;
3307 
3308  const bool bUndo = getSdrDragView().IsUndoEnabled();
3309 
3310  bool bDoCrook=aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0;
3311 
3312  if (bDoCrook || bResize)
3313  {
3314  if (bResize && bUndo)
3315  {
3316  OUString aStr = ImpGetDescriptionStr(!bContortion?STR_EditCrook:STR_EditCrookContortion);
3317 
3318  if (bCopy)
3319  aStr += SvxResId(STR_EditWithCopy);
3320 
3321  getSdrDragView().BegUndo(aStr);
3322  }
3323 
3324  if (bResize)
3325  {
3326  Fraction aFact1(1,1);
3327 
3328  if (bContortion)
3329  {
3330  if (bVertical)
3331  getSdrDragView().ResizeMarkedObj(aCenter,aFact1,aFact,bCopy);
3332  else
3333  getSdrDragView().ResizeMarkedObj(aCenter,aFact,aFact1,bCopy);
3334  }
3335  else
3336  {
3337  if (bCopy)
3339 
3340  const size_t nMarkCount=getSdrDragView().GetMarkedObjectList().GetMarkCount();
3341 
3342  for (size_t nm=0; nm<nMarkCount; ++nm)
3343  {
3345  SdrObject* pO=pM->GetMarkedSdrObj();
3346  Point aCtr0(pO->GetSnapRect().Center());
3347  Point aCtr1(aCtr0);
3348 
3349  if (bVertical)
3350  ResizePoint(aCtr1,aCenter,aFact1,aFact);
3351  else
3352  ResizePoint(aCtr1,aCenter,aFact,aFact1);
3353 
3354  Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
3355  if( bUndo )
3356  AddUndo(getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pO,aSiz));
3357  pO->Move(aSiz);
3358  }
3359  }
3360 
3361  bCopy=false;
3362  }
3363 
3364  if (bDoCrook)
3365  {
3367  }
3368 
3369  if (bResize && bUndo)
3370  getSdrDragView().EndUndo();
3371 
3372  return true;
3373  }
3374 
3375  return false;
3376 }
3377 
3379 {
3380  return PointerStyle::Crook;
3381 }
3382 
3383 
3385 : SdrDragMethod(rNewView),
3386  nPolyPt(0),
3387  bContortionAllowed(false),
3388  bNoContortionAllowed(false),
3389  bContortion(false)
3390 {
3391 }
3392 
3394 {
3395  OUString aStr = ImpGetDescriptionStr(STR_DragMethDistort)
3396  + " (x="
3398  + " y="
3400  + ")";
3401 
3402  if(getSdrDragView().IsDragWithCopy())
3403  aStr += SvxResId(STR_EditWithCopy);
3404  return aStr;
3405 }
3406 
3408 {
3409  // Add extended frame raster first, so it will be behind objects
3410  if(getSdrDragView().GetSdrPageView())
3411  {
3412  const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
3413 
3414  if(aDragRaster.count())
3415  {
3416  addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragRaster)));
3417  }
3418  }
3419 
3420  // call parent
3422 }
3423 
3425 {
3428 
3430  {
3431  SdrHdlKind eKind=GetDragHdlKind();
3432  nPolyPt=0xFFFF;
3433 
3434  if (eKind==SdrHdlKind::UpperLeft) nPolyPt=0;
3435  if (eKind==SdrHdlKind::UpperRight) nPolyPt=1;
3436  if (eKind==SdrHdlKind::LowerRight) nPolyPt=2;
3437  if (eKind==SdrHdlKind::LowerLeft) nPolyPt=3;
3438  if (nPolyPt>3) return false;
3439 
3442  Show();
3443  return true;
3444  }
3445  else
3446  {
3447  return false;
3448  }
3449 }
3450 
3452 {
3453  if (bContortion)
3454  {
3456 
3457  if(pPV && pPV->HasMarkedObjPageView())
3458  {
3459  basegfx::B2DPolyPolygon aDragPolygon(rTarget);
3461  const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
3462  const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
3463  const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
3464  const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
3465 
3466  aDragPolygon = basegfx::utils::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
3467  rTarget = aDragPolygon;
3468  }
3469  }
3470 }
3471 
3472 void SdrDragDistort::MoveSdrDrag(const Point& rPnt)
3473 {
3474  if (DragStat().CheckMinMoved(rPnt))
3475  {
3476  Point aPnt(GetSnapPos(rPnt));
3477 
3478  if (getSdrDragView().IsOrtho())
3479  OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
3480 
3482 
3483  if (bNewContortion!=bContortion || aDistortedRect[nPolyPt]!=aPnt)
3484  {
3485  Hide();
3486  aDistortedRect[nPolyPt]=aPnt;
3487  bContortion=bNewContortion;
3488  DragStat().NextMove(aPnt);
3489  Show();
3490  }
3491  }
3492 }
3493 
3495 {
3496  Hide();
3497  bool bDoDistort=DragStat().GetDX()!=0 || DragStat().GetDY()!=0;
3498 
3499  if (bDoDistort)
3500  {
3502  return true;
3503  }
3504 
3505  return false;
3506 }
3507 
3509 {
3510  return PointerStyle::RefHand;
3511 }
3512 
3514 {
3515  const bool bDoDistort(DragStat().GetDX()!=0 || DragStat().GetDY()!=0);
3516 
3517  if (bDoDistort)
3518  {
3520  }
3521 }
3522 
3524 {
3525  // use helper derived from old stuff
3526  MovAllPoints(rTarget);
3527 }
3528 
3529 
3531 : SdrDragObjOwn(rNewView)
3532 {
3533  // switch off solid dragging for crop; it just makes no sense since showing
3534  // a 50% transparent object above the original will not be visible
3535  setSolidDraggingActive(false);
3536 }
3537 
3539 {
3540  OUString aStr = ImpGetDescriptionStr(STR_DragMethCrop)
3541  + " (x="
3543  + " y="
3545  + ")";
3546 
3547  if(getSdrDragView().IsDragWithCopy())
3548  aStr += SvxResId(STR_EditWithCopy);
3549  return aStr;
3550 }
3551 
3553 {
3554  // call parent
3555  bool bRetval(SdrDragObjOwn::BeginSdrDrag());
3556 
3557  if(!GetDragHdl())
3558  {
3559  // we need the DragHdl, break if not there
3560  bRetval = false;
3561  }
3562 
3563  return bRetval;
3564 }
3565 
3566 bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/)
3567 {
3568  Hide();
3569 
3570  if(0 == DragStat().GetDX() && 0 == DragStat().GetDY())
3571  {
3572  // no change, done
3573  return false;
3574  }
3575 
3576  const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList();
3577 
3578  if(1 != rMarkList.GetMarkCount())
3579  {
3580  // Crop only with single Object selected
3581  return false;
3582  }
3583 
3584  // prepare for SdrGrafObj or others. This code has to work with usual
3585  // SdrGrafObj's from Draw/Impress/Calc, but also with SdrObjects from
3586  // Writer. It would be better to handle this in Writer directly, but
3587  // there are currently no easy mechanisms to plug an alternative interaction
3588  // from there
3589  SdrObject* pSdrObject = rMarkList.GetMark(0)->GetMarkedSdrObj();
3590  SdrObjectUniquePtr pFullDragClone;
3591  bool bExternal(false);
3592  SdrObject* pExternalSdrObject(nullptr);
3593 
3594  // RotGrfFlyFrame: Crop decision for DrawingLayer/Writer now
3595  // locally, no two-in-one methods any more
3596  if (nullptr != pSdrObject && dynamic_cast< const SdrGrafObj* >(pSdrObject) == nullptr)
3597  {
3598  // If Writer, get the already offered for interaction SdrGrafObj
3599  // and set up for using that replacement object that contains the
3600  // real transformation. That SdrObject is owned and has to be deleted,
3601  // so use a std::unique_ptr with special handling for the protected
3602  // SDrObject destructor
3603  pFullDragClone = pSdrObject->getFullDragClone();
3604 
3605  if(dynamic_cast< SdrGrafObj* >(pFullDragClone.get()))
3606  {
3607  bExternal = true;
3608  pExternalSdrObject = pSdrObject;
3609  pSdrObject = pFullDragClone.get();
3610  }
3611  }
3612 
3613  // get and check for SdrGrafObj now
3614  SdrGrafObj* pObj = dynamic_cast<SdrGrafObj*>( pSdrObject );
3615 
3616  if(!pObj)
3617  {
3618  return false;
3619  }
3620 
3621  // no undo for external needed, done there
3622  const bool bUndo(!bExternal && getSdrDragView().IsUndoEnabled());
3623 
3624  if(bUndo)
3625  {
3626  OUString aUndoStr = ImpGetDescriptionStr(STR_DragMethCrop);
3627 
3628  getSdrDragView().BegUndo( aUndoStr );
3629  getSdrDragView().AddUndo( getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
3630  // also need attr undo, the SdrGrafCropItem will be changed
3631  getSdrDragView().AddUndo( getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
3632  }
3633 
3634  // get the original objects transformation
3635  basegfx::B2DHomMatrix aOriginalMatrix;
3636  basegfx::B2DPolyPolygon aPolyPolygon;
3637  bool bShearCorrected(false);
3638  pObj->TRGetBaseGeometry(aOriginalMatrix, aPolyPolygon);
3639 
3640  { // correct shear, it comes currently mirrored from TRGetBaseGeometry, can be removed with aw080
3641  const basegfx::utils::B2DHomMatrixBufferedDecompose aTmpDecomp(aOriginalMatrix);
3642 
3643  if(!basegfx::fTools::equalZero(aTmpDecomp.getShearX()))
3644  {
3645  bShearCorrected = true;
3647  aTmpDecomp.getScale(),
3648  -aTmpDecomp.getShearX(),
3649  aTmpDecomp.getRotate(),
3650  aTmpDecomp.getTranslate());
3651  }
3652  }
3653 
3654  // generate start point of original drag vector in unit coordinates (the
3655  // vis-a-vis of the drag point)
3656  basegfx::B2DPoint aLocalStart(0.0, 0.0);
3657  bool bOnAxis(false);
3658 
3659  switch(GetDragHdlKind())
3660  {
3661  case SdrHdlKind::UpperLeft: aLocalStart.setX(1.0); aLocalStart.setY(1.0); break;
3662  case SdrHdlKind::Upper: aLocalStart.setX(0.5); aLocalStart.setY(1.0); bOnAxis = true; break;
3663  case SdrHdlKind::UpperRight: aLocalStart.setX(0.0); aLocalStart.setY(1.0); break;
3664  case SdrHdlKind::Left : aLocalStart.setX(1.0); aLocalStart.setY(0.5); bOnAxis = true; break;
3665  case SdrHdlKind::Right: aLocalStart.setX(0.0); aLocalStart.setY(0.5); bOnAxis = true; break;
3666  case SdrHdlKind::LowerLeft: aLocalStart.setX(1.0); aLocalStart.setY(0.0); break;
3667  case SdrHdlKind::Lower: aLocalStart.setX(0.5); aLocalStart.setY(0.0); bOnAxis = true; break;
3668  case SdrHdlKind::LowerRight: aLocalStart.setX(0.0); aLocalStart.setY(0.0); break;
3669  default: break;
3670  }
3671 
3672  // create the current drag position in unit coordinates. To get there,
3673  // transform back the DragPoint to UnitCoordinates
3674  basegfx::B2DHomMatrix aInverse(aOriginalMatrix);
3675  aInverse.invert();
3676  basegfx::B2DPoint aLocalCurrent(aInverse * basegfx::B2DPoint(DragStat().GetNow().X(), DragStat().GetNow().Y()));
3677 
3678  // if one of the edge handles is used, limit to X or Y drag only
3679  if(bOnAxis)
3680  {
3681  if(basegfx::fTools::equal(aLocalStart.getX(), 0.5))
3682  {
3683  aLocalCurrent.setX(aLocalStart.getX());
3684  }
3685  else
3686  {
3687  aLocalCurrent.setY(aLocalStart.getY());
3688  }
3689  }
3690 
3691  // create internal change in unit coordinates
3692  basegfx::B2DHomMatrix aDiscreteChangeMatrix;
3693 
3694  if(!basegfx::fTools::equal(aLocalCurrent.getX(), aLocalStart.getX()))
3695  {
3696  if(aLocalStart.getX() < 0.5)
3697  {
3698  aDiscreteChangeMatrix.scale(aLocalCurrent.getX(), 1.0);
3699  }
3700  else
3701  {
3702  aDiscreteChangeMatrix.scale(1.0 - aLocalCurrent.getX(), 1.0);
3703  aDiscreteChangeMatrix.translate(aLocalCurrent.getX(), 0.0);
3704  }
3705  }
3706 
3707  if(!basegfx::fTools::equal(aLocalCurrent.getY(), aLocalStart.getY()))
3708  {
3709  if(aLocalStart.getY() < 0.5)
3710  {
3711  aDiscreteChangeMatrix.scale(1.0, aLocalCurrent.getY());
3712  }
3713  else
3714  {
3715  aDiscreteChangeMatrix.scale(1.0, 1.0 - aLocalCurrent.getY());
3716  aDiscreteChangeMatrix.translate(0.0, aLocalCurrent.getY());
3717  }
3718  }
3719 
3720  // We now have the whole executed Crop in UnitCoordinates in
3721  // aDiscreteChangeMatrix, go to concrete sizes now.
3722  // Create the unrotated original rectangle and the unrotated modified
3723  // rectangle as Ranges
3724  const basegfx::utils::B2DHomMatrixBufferedDecompose aOriginalMatrixDecomp(aOriginalMatrix);
3725 
3726  // prepare unsheared/unrotated versions of the old and new transformation
3727  const basegfx::B2DHomMatrix aOriginalMatrixNoShearNoRotate(
3729  basegfx::absolute(aOriginalMatrixDecomp.getScale()),
3730  aOriginalMatrixDecomp.getTranslate()));
3731 
3732  // create the ranges for these
3733  basegfx::B2DRange aRangeOriginalNoShearNoRotate(0.0, 0.0, 1.0, 1.0);
3734  basegfx::B2DRange aRangeNewNoShearNoRotate(0.0, 0.0, 1.0, 1.0);
3735  aRangeOriginalNoShearNoRotate.transform(aOriginalMatrixNoShearNoRotate);
3736  aRangeNewNoShearNoRotate.transform(aOriginalMatrixNoShearNoRotate * aDiscreteChangeMatrix);
3737 
3738  if(bExternal)
3739  {
3740  // With aLocalStart point (opposed to dragged point), X scale and Y scale,
3741  // we call crop (virtual method) on pSdrObject which calls VirtFlyDrawObj
3742  // crop. Use aLocalStart unchanged, so being relative to the Crop-Action,
3743  // the called instance knows best how to use it
3744  const double fScaleX(aRangeNewNoShearNoRotate.getWidth() / aRangeOriginalNoShearNoRotate.getWidth());
3745  const double fScaleY(aRangeNewNoShearNoRotate.getHeight() / aRangeOriginalNoShearNoRotate.getHeight());
3746 
3747  pExternalSdrObject->Crop(
3748  aLocalStart,
3749  fScaleX,
3750  fScaleY);
3751  }
3752  else
3753  {
3754  // prepare matrix to apply to object; evtl. back-correct shear
3755  basegfx::B2DHomMatrix aNewObjectMatrix(aOriginalMatrix * aDiscreteChangeMatrix);
3756 
3757  if(bShearCorrected)
3758  {
3759  // back-correct shear
3760  const basegfx::utils::B2DHomMatrixBufferedDecompose aTmpDecomp(aNewObjectMatrix);
3761 
3763  aTmpDecomp.getScale(),
3764  -aTmpDecomp.getShearX(),
3765  aTmpDecomp.getRotate(),
3766  aTmpDecomp.getTranslate());
3767  }
3768 
3769  // apply change to object by applying the unit coordinate change followed
3770  // by the original change
3771  pObj->TRSetBaseGeometry(aNewObjectMatrix, aPolyPolygon);
3772 
3773  // extract the old Rectangle structures
3774  tools::Rectangle aOldRect(
3775  basegfx::fround(aRangeOriginalNoShearNoRotate.getMinX()),
3776  basegfx::fround(aRangeOriginalNoShearNoRotate.getMinY()),
3777  basegfx::fround(aRangeOriginalNoShearNoRotate.getMaxX()),
3778  basegfx::fround(aRangeOriginalNoShearNoRotate.getMaxY()));
3779  tools::Rectangle aNewRect(
3780  basegfx::fround(aRangeNewNoShearNoRotate.getMinX()),
3781  basegfx::fround(aRangeNewNoShearNoRotate.getMinY()),
3782  basegfx::fround(aRangeNewNoShearNoRotate.getMaxX()),
3783  basegfx::fround(aRangeNewNoShearNoRotate.getMaxY()));
3784 
3785  // continue with the old original stuff
3786  if (!aOldRect.GetWidth() || !aOldRect.GetHeight())
3787  {
3788  throw o3tl::divide_by_zero();
3789  }
3790 
3791  if((pObj->GetGraphicType() == GraphicType::NONE) || (pObj->GetGraphicType() == GraphicType::Default))
3792  {
3793  return false;
3794  }
3795 
3796  const GraphicObject& rGraphicObject(pObj->GetGraphicObject());
3797  // tdf#117145 Usually Writer will go the bExternal path (see above), but more correct for
3798  // the future is to use the MapMode from the SdrModel/SfxItemPool if the Writer's current
3799  // special handling should be unified to this path in the future. Usually it *should* be
3800  // MapUnit::Map100thMM, but better do not mix up Units.
3801  // Checked now what SwVirtFlyDrawObj::NbcCrop is doing - it calculates everything forced
3802  // to MapUnit::Map100thMM, but extracts/packs Twips to the used SdrGrafCropItem in Writer.
3803  const MapMode aMapModePool(pObj->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
3804  Size aGraphicSize(rGraphicObject.GetPrefSize());
3805 
3806  if(MapUnit::MapPixel == rGraphicObject.GetPrefMapMode().GetMapUnit())
3807  {
3808  aGraphicSize = Application::GetDefaultDevice()->PixelToLogic(aGraphicSize, aMapModePool);
3809  }
3810  else
3811  {
3812  aGraphicSize = OutputDevice::LogicToLogic(aGraphicSize, rGraphicObject.GetPrefMapMode(), aMapModePool);
3813  }
3814 
3815  if(0 == aGraphicSize.Width() || 0 == aGraphicSize.Height())
3816  {
3817  return false;
3818  }
3819 
3820  const SdrGrafCropItem& rOldCrop = pObj->GetMergedItem(SDRATTR_GRAFCROP);
3821  double fScaleX = ( aGraphicSize.Width() - rOldCrop.GetLeft() - rOldCrop.GetRight() ) / static_cast<double>(aOldRect.GetWidth());
3822  double fScaleY = ( aGraphicSize.Height() - rOldCrop.GetTop() - rOldCrop.GetBottom() ) / static_cast<double>(aOldRect.GetHeight());
3823 
3824  sal_Int32 nDiffLeft = aNewRect.Left() - aOldRect.Left();
3825  sal_Int32 nDiffTop = aNewRect.Top() - aOldRect.Top();
3826  sal_Int32 nDiffRight = aNewRect.Right() - aOldRect.Right();
3827  sal_Int32 nDiffBottom = aNewRect.Bottom() - aOldRect.Bottom();
3828 
3829  if(pObj->IsMirrored())
3830  {
3831  // mirrored X or Y, for old stuff, exchange X
3832  // check for aw080
3833  sal_Int32 nTmp(nDiffLeft);
3834  nDiffLeft = -nDiffRight;
3835  nDiffRight = -nTmp;
3836  }
3837 
3838  sal_Int32 nLeftCrop = static_cast<sal_Int32>( rOldCrop.GetLeft() + nDiffLeft * fScaleX );
3839  sal_Int32 nTopCrop = static_cast<sal_Int32>( rOldCrop.GetTop() + nDiffTop * fScaleY );
3840  sal_Int32 nRightCrop = static_cast<sal_Int32>( rOldCrop.GetRight() - nDiffRight * fScaleX );
3841  sal_Int32 nBottomCrop = static_cast<sal_Int32>( rOldCrop.GetBottom() - nDiffBottom * fScaleY );
3842 
3845  aSet.Put( SdrGrafCropItem( nLeftCrop, nTopCrop, nRightCrop, nBottomCrop ) );
3846  getSdrDragView().SetAttributes( aSet, false );
3847  }
3848 
3849  if(bUndo)
3850  {
3851  getSdrDragView().EndUndo();
3852  }
3853 
3854  return true;
3855 }
3856 
3858 {
3859  return PointerStyle::Crop;
3860 }
3861 
3862 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Color GetStripeColorA() const
const SdrMarkList & GetMarkedObjectList()
Definition: svddrgmt.hxx:171
Point TopLeft() const
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:2679
const SdrUShortCont & GetMarkedGluePoints() const
Definition: svdmark.hxx:115
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
The Xor-Polygon is required by the View to drag the object.
Definition: svdobj.cxx:1067
SdrObjectUniquePtr mxClone
Definition: svddrgmt.hxx:287
void createSdrDragEntries_SolidDrag()
Definition: svddrgmt.cxx:364
SdrObject * getClone()
Definition: svddrgmt.hxx:81
SdrHdlColor * GetColorHdl1() const
Definition: svdhdl.hxx:319
long GetWidth() const
void setX(double fX)
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:2560
long nBestXSnap
Definition: svddrgmt.hxx:232
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:1681
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:1545
virtual void applyCurrentTransformationToSdrObject(SdrObject &rTarget) override
Definition: svddrgmt.cxx:2465
void MirrorMarkedObj(const Point &rRef1, const Point &rRef2, bool bCopy=false)
Definition: svdedtv1.cxx:368
static basegfx::B2DPolyPolygon impCreateDragRaster(SdrPageView const &rPageView, const tools::Rectangle &rMarkRect)
Definition: svddrgmt.cxx:2804
SdrHdl * GetDragHdl() const
Definition: svddrgmt.hxx:161
bool DoAddConnectorOverlays()
Definition: svddrgmt.cxx:838
size_t GetMarkCount() const
Definition: svdmark.hxx:180
virtual void CreateOverlayGeometry(sdr::overlay::OverlayManager &rOverlayManager, const sdr::contact::ObjectContact &rObjectContact)
Definition: svddrgmt.cxx:672
long GetHeight() const
void prepareCurrentState(SdrDragMethod &rDragMethod)
Definition: svddrgmt.cxx:149
virtual const tools::Rectangle & GetCurrentBoundRect() const
Definition: svdobj.cxx:854
bool bYSnapped
Definition: svddrgmt.hxx:235
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true)
Definition: svdobj.cxx:1484
sal_uInt16 Count() const
Definition: _xpoly.cxx:890
void SetPos(const Point &rPnt)
Definition: svdhdl.cxx:341
SdrDragEntryPolyPolygon(const basegfx::B2DPolyPolygon &rOriginalPolyPolygon)
Definition: svddrgmt.cxx:82
SdrHdlColor * GetColorHdl2() const
Definition: svdhdl.hxx:320
virtual ~SdrDragEntryPointGlueDrag() override
Definition: svddrgmt.cxx:214
double getHeight() const
tools::Rectangle & Intersection(const tools::Rectangle &rRect)
SdrDragEntryPointGlueDrag(const std::vector< basegfx::B2DPoint > &rPositions, bool bIsPointDrag)
Definition: svddrgmt.cxx:206
bool IsResizeAllowed(bool bProp=false) const
Definition: svdedtv.cxx:363
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const
Definition: svdobj.cxx:1308
const SdrUShortCont & GetMarkedPoints() const
Definition: svdmark.hxx:110
sal_uInt16 GetTransparentSelectionPercent() const
void Set2ndPos(const Point &rPnt)
Definition: svdhdl.cxx:1267
B2DTuple absolute(const B2DTuple &rTup)
SdrDragResize(SdrDragView &rNewView)
Definition: svddrgmt.cxx:1717
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:2720
virtual void TakeActionRect(tools::Rectangle &rRect) const override
Definition: svddrgv.cxx:116
void SetSkipChangeLayout(bool bOn)
Definition: svdundo.hxx:224
virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod &rDragMethod) override
Definition: svddrgmt.cxx:92
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:2061
static bool equal(const double &rfValA, const double &rfValB)
void SetVerFixed(bool bOn)
Definition: svddrag.hxx:116
void ResizePoint(Point &rPnt, const Point &rRef, const Fraction &xFract, const Fraction &yFract)
Definition: svdtrans.hxx:106
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWWIDTH(SDRATTR_MISC_FIRST+12)
const Point & GetStart() const
Definition: svddrag.hxx:92
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:3552
SdrHdlKind
Definition: svdhdl.hxx:52
long nBestYSnap
Definition: svddrgmt.hxx:233
void RotateMarkedPoints(const Point &rRef, long nAngle)
Definition: svdpoev.cxx:640
B2DPolygon expandToCurve(const B2DPolygon &rCandidate)
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:2013
bool IsUndoEnabled() const
Definition: svdedtv.cxx:1027
void CheckSnap(const Point &rPt, long &nBestXSnap, long &nBestYSnap, bool &bXSnapped, bool &bYSnapped) const
Definition: svdsnpv.cxx:412
bool CheckMinMoved(const Point &rPnt)
Definition: svddrag.cxx:86
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
bool IsCon1() const
Definition: svdmark.hxx:85
SdrHdl * mpDragHdl
Definition: svddrgv.hxx:41
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:2577
virtual void applyCurrentTransformationToSdrObject(SdrObject &rTarget) override
Definition: svddrgmt.cxx:3513
virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon &rTarget)
Definition: svddrgmt.cxx:624
virtual basegfx::B2DHomMatrix getCurrentTransformation() override
Definition: svddrgmt.cxx:2253
static void ImpDistortObj(SdrObject *pO, const tools::Rectangle &rRef, const XPolygon &rDistortedRect, bool bNoContortion)
Definition: svdedtv1.cxx:624
double getX() const
bool IsDraggingPoints() const
Definition: svddrgv.hxx:109
static size_t GetDragXorPointLimit()
Definition: svddrgv.hxx:166
bool IsInserted() const
Definition: svdobj.hxx:793
basegfx::B2DPolyPolygon getB2DPolyPolygon() const
Definition: _xpoly.cxx:935
void resetSdrDragEntries()
Definition: svddrgmt.cxx:274
void appendBezierSegment(const basegfx::B2DPoint &rNextControlPoint, const basegfx::B2DPoint &rPrevControlPoint, const basegfx::B2DPoint &rPoint)
void BegUndo()
Definition: svdedtv.hxx:179
sal_Int16 nId
virtual void createSdrDragEntries()
Definition: svddrgmt.cxx:296
SdrHdlGradient * pIAOHandle
Definition: svddrgm1.hxx:121
double getY() const
SdrObject * GetObj() const
Definition: svdhdl.hxx:203
virtual void CancelSdrDrag()
Definition: svddrgmt.cxx:665
virtual void applyCurrentTransformationToSdrObject(SdrObject &rTarget) override
Definition: svddrgmt.cxx:2008
Changing the geometry of an object.
Definition: svdundo.hxx:207
virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod &rDragMethod) override
Definition: svddrgmt.cxx:218
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:1827
SdrMark * GetMark(size_t nNum) const
Definition: svdmark.cxx:229
std::vector< std::unique_ptr< SdrUndoAction > > CreateConnectorUndo(SdrObject &rO)
Definition: svdedtv1.cxx:149
void append(std::unique_ptr< OverlayObject > pOverlayObject)
SdrDragShear(SdrDragView &rNewView, bool bSlant1)
Definition: svddrgmt.cxx:2189
std::set< sal_uInt16 > SdrUShortCont
Definition: svdmark.hxx:36
const Point & GetPos() const
Definition: svdhdl.hxx:197
virtual void createSdrDragEntryForSdrObject(const SdrObject &rOriginal) override
Definition: svddrgmt.cxx:1448
virtual void ConnectToNode(bool bTail1, SdrObject *pObj)
Definition: svdobj.cxx:2259
const GraphicObject & GetGraphicObject(bool bForceSwapIn=false) const
Definition: svdograf.cxx:275
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdotext.cxx:1612
virtual void createSdrDragEntries() override
Definition: svddrgmt.cxx:1179
void EndTextEditAllViews() const
Checks if this or other views have an active text edit, if true, end them.
Definition: svdedtv.cxx:1032
SdrDragCrop(SdrDragView &rNewView)
Definition: svddrgmt.cxx:3530
Color GetStripeColorB() const
void shearY(double fSy)
bool IsDraggingGluePoints() const
Definition: svddrgv.hxx:110
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:997
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:3494
Center
GraphicType GetGraphicType() const
Definition: svdograf.cxx:351
EmbeddedObjectRef * pObject
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:1273
double getMaxX() const
long NormAngle36000(long a)
Normalize angle to -180.00..179.99.
Definition: svdtrans.cxx:408
basegfx::B2DPolygon ImplAddConnectorOverlay(SdrDragMethod &rDragMethod, bool bTail1, bool bTail2, bool bDetail) const
Definition: svdoedge.cxx:1991
double CrookRotateXPoint(Point &rPnt, Point *pC1, Point *pC2, const Point &rCenter, const Point &rRad, double &rSin, double &rCos, bool bVert)
The following methods accept a point of an XPolygon, whereas the neighbouring control points of the a...
Definition: svdtrans.cxx:162
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:2893
SdrDragStat & DragStat()
Definition: svddrgmt.hxx:163
const Color & GetHighlightColor() const
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs)
Definition: svdobj.cxx:1511
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:245
virtual PointerStyle GetPointer() const
Definition: svdhdl.cxx:952
void Move(long nHorzMoveDelta, long nVertMoveDelta)
void ShowDragObj()
Definition: svddrgv.cxx:800
virtual const tools::Rectangle & GetSnapRect() const
Definition: svdobj.cxx:1597
const Point & Get2ndPos() const
Definition: svdhdl.hxx:322
B2DRange getB2DRange() const
SdrDragRotate(SdrDragView &rNewView)
Definition: svddrgmt.cxx:2051
void add(OverlayObject &rOverlayObject)
static OutputDevice * GetDefaultDevice()
void createSdrDragEntries_PolygonDrag()
Definition: svddrgmt.cxx:423
bool IsEmpty() const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
std::vector< std::unique_ptr< SdrDragEntry > > maSdrDragEntries
Definition: svddrgmt.hxx:118
static OUString GetAngleString(long nAngle)
Definition: svdmodel.cxx:1205
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:2079
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:2033
SdrCrookMode
Definition: svdsnpv.hxx:83
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
Definition: svdpagv.cxx:81
long Right() const
bool bUpSideDown
Definition: svddrgm1.hxx:78
double getWidth() const
std::map< const SdrObject *, SdrObject * > SdrObjectAndCloneMap
Definition: svddrgmt.cxx:670
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:2114
bool mbSolidDraggingActive
Definition: svddrgmt.hxx:123
void RotateMarkedObj(const Point &rRef, long nAngle, bool bCopy=false)
Definition: svdedtv1.cxx:312
Point & Ref2() const
Definition: svddrgmt.hxx:166
bool IsOrtho() const
Definition: svdsnpv.hxx:246
virtual basegfx::B2DHomMatrix getCurrentTransformation()
Definition: svddrgmt.cxx:660
bool IsMore() const
Definition: svditer.hxx:62
void addSdrDragEntry(std::unique_ptr< SdrDragEntry > pNew)
Definition: svddrgmt.cxx:290
bool bContortionAllowed
Definition: svddrgm1.hxx:148
bool getMoveOnly() const
Definition: svddrgmt.hxx:215
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
long GetDX() const
Definition: svddrag.hxx:148
void setSolidDraggingActive(bool bNew)
Definition: svddrgmt.hxx:151
double CrookStretchXPoint(Point &rPnt, Point *pC1, Point *pC2, const Point &rCenter, const Point &rRad, double &rSin, double &rCos, bool bVert, const tools::Rectangle &rRefRect)
Definition: svdtrans.cxx:271
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
void SetHorFixed(bool bOn)
Definition: svddrag.hxx:114
SdrDragEntrySdrObject(const SdrObject &rOriginal, bool bModify)
Definition: svddrgmt.cxx:134
#define X
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
Point aStart
Definition: svddrgm1.hxx:145
bool bResizeAllowed
Definition: svddrgm1.hxx:151
virtual void applyCurrentTransformationToSdrObject(SdrObject &rTarget) override
Definition: svddrgmt.cxx:2389
void ResizeMarkedPoints(const Point &rRef, const Fraction &xFact, const Fraction &yFact)
Definition: svdpoev.cxx:623
sal_uInt16 GetAngleSector(long nAngle)
Normalize angle to 0.00..359.99.
Definition: svdtrans.cxx:415
Point GetSnapPos(const Point &rPt) const
Definition: svddrgmt.hxx:172
tools::Rectangle aMarkRect
Definition: svddrgm1.hxx:142
attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet &rSet)
bool IsMoveFirstHandle() const
Definition: svdhdl.hxx:334
bool GetHighContrastMode() const
virtual void Crop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact)
Definition: svdobj.cxx:1502
void DistortMarkedObj(const tools::Rectangle &rRef, const XPolygon &rDistortedRect, bool bNoContortion, bool bCopy=false)
Definition: svdedtv1.cxx:658
Mode eMode
SdrCrookMode GetCrookMode() const
Definition: svdsnpv.hxx:277
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:2456
long Top() const
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:3508
void Touch()
Definition: svdhdl.cxx:389
bool IsRotateAllowed(bool b90Deg=false) const
Definition: svdedtv.cxx:371
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
Definition: sdtagitm.hxx:29
Fraction aFact
Definition: svddrgm1.hxx:146
SdrDragMethod(SdrDragView &rNewView)
Definition: svddrgmt.cxx:630
double getMaxY() const
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:1230
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:1435
const tools::Rectangle & GetMarkedRect() const
Definition: svddrgmt.hxx:219
Point & Ref1() const
Definition: svddrgmt.hxx:165
virtual SdrObject * GetConnectedNode(bool bTail1) const
Definition: svdobj.cxx:2267
B2IRange fround(const B2DRange &rRange)
virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod &rDragMethod) override
Definition: svddrgmt.cxx:195
void EndUndo()
Definition: svdedtv.cxx:275
tools::Rectangle aMarkRect
Definition: svddrgm1.hxx:190
void ImpCheckSnap(const Point &rPt)
Definition: svddrgmt.cxx:1506
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:2589
void shearX(double fSx)
virtual ~SdrDragObjOwn() override
Definition: svddrgmt.cxx:1175
virtual ~SdrDragEntry()
Definition: svddrgmt.cxx:77
void SetRef2(const Point &pt)
Definition: svddrag.hxx:100
void clearSdrDragEntries()
Definition: svddrgmt.cxx:285
SdrObject * GetMarkedSdrObj() const
Definition: svdmark.hxx:68
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:3393
bool IsDragLimit()
Definition: svddrgmt.hxx:169
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:3378
Point BottomRight() const
Everything a View needs to know about a selected object.
Definition: svdmark.hxx:44
virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod &rDragMethod) override
Definition: svddrgmt.cxx:166
bool bContortionAllowed
Definition: svddrgm1.hxx:193
SdrDragView & getSdrDragView()
Definition: svddrgmt.hxx:146
void ReduceInaccurate(unsigned nSignificantBits)
sdr::overlay::OverlayObjectList maOverlayObjectList
Definition: svddrgmt.hxx:119
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:3080
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdedtv.hxx:183
bool IsCrookNoContortion() const
Definition: svdsnpv.hxx:273
void ResizeMarkedGluePoints(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bCopy)
Definition: svdglev.cxx:367
void CopyMarkedObj()
Definition: svdedtv.cxx:879
virtual const SdrGluePointList * GetGluePointList() const
Definition: svdobj.cxx:2203
static bool GetRelativePolyPoint(const basegfx::B2DPolyPolygon &rPoly, sal_uInt32 nAbsPnt, sal_uInt32 &rPolyNum, sal_uInt32 &rPointNum)
Outputs the relative position ( polygon number and point number in that polygon ) from the absolute p...
void setMoveOnly(bool bNew)
Definition: svddrgmt.hxx:150
void HideDragObj()
Definition: svddrgv.cxx:840
void SetRef1(const Point &pt)
Definition: svddrag.hxx:98
bool HasMarkedObjPageView() const
Definition: svdpagv.hxx:182
Fraction aXFact
Definition: svddrgmt.hxx:261
double nSin
Definition: svddrgm1.hxx:50
int i
void ResizeMarkedObj(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bCopy=false)
Definition: svdedtv1.cxx:216
SdrDragMirror(SdrDragView &rNewView)
Definition: svddrgmt.cxx:2473
uno_Any a
#define SDRGLUEPOINT_NOTFOUND
Definition: svdglue.hxx:116
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:3472
SdrSnap
Definition:
Definition: svdsnpv.hxx:71
SdrSnap SnapPos(Point &rPt) const
Definition: svddrgmt.hxx:173
void rotate(double fRadiant)
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:3538
const B2DPolyPolygon maOriginal
virtual basegfx::B2DHomMatrix getCurrentTransformation() override
Definition: svddrgmt.cxx:1501
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon)
Definition: svdobj.cxx:2914
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:1251
bool bXSnapped
Definition: svddrgmt.hxx:234
void BroadcastObjectChange() const
Definition: svdobj.cxx:905
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
BitmapEx createDefaultCross_3x3(const basegfx::BColor &rBColor)
const SdrMarkList & GetMarkedObjectList() const
Definition: svdmrkv.hxx:252
SdrPageView * GetPageView() const
Definition: svdmark.hxx:70
SdrDragGradient(SdrDragView &rNewView, bool bGrad=true)
Definition: svddrgmt.cxx:2595
virtual bool supportsFullDrag() const
Definition: svdobj.cxx:1274
SdrObjectUniquePtr mxClone
Definition: svddrgmt.hxx:68
bool bMirrored
Definition: svddrgm1.hxx:99
bool IsAngleSnapEnabled() const
Definition: svdsnpv.hxx:222
static bool equalZero(const double &rfVal)
virtual void CancelSdrDrag() override
Definition: svddrgmt.cxx:1136
#define DRAG_CROOK_RASTER_DISTANCE
Definition: svddrgmt.cxx:2802
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:2490
bool bRotateAllowed
Definition: svddrgm1.hxx:153
void FromIAOToItem(SdrObject *pObj, bool bSetItemOnObject, bool bUndo)
Definition: svdhdl.cxx:1367
bool bVertical
Definition: svddrgm1.hxx:155
static void ImpCrookObj(SdrObject *pO, const Point &rRef, const Point &rRad, SdrCrookMode eMode, bool bVertical, bool bNoContortion, bool bRotate, const tools::Rectangle &rMarkRect)
Definition: svdedtv1.cxx:502
bool IsDraggingGluePoints() const
Definition: svddrgmt.hxx:178
virtual void applyCurrentTransformationToSdrObject(SdrObject &rTarget)
Definition: svddrgmt.cxx:583
void OrthoDistance8(const Point &rPt0, Point &rPt, bool bBigOrtho)
Definition: svdtrans.cxx:529
long Bottom() const
void scale(double fX, double fY)
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:273
void transform(const basegfx::B2DHomMatrix &rMatrix)
virtual ~SdrDragMethod()
Definition: svddrgmt.cxx:645
virtual void append(const Primitive2DReference &) override
void NextMove(const Point &rPnt)
Definition: svddrag.cxx:66
long GetSnapAngle() const
Definition: svdsnpv.hxx:224
virtual void calculateGridOffsetForB2DRange(basegfx::B2DVector &rTarget, const basegfx::B2DRange &rB2DRange) const
const SdrMarkList & GetEdgesOfMarkedNodes() const
Definition: svdmrkv.hxx:267
virtual void createSdrDragEntries() override
Definition: svddrgmt.cxx:2876
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:2610
SdrPageView * GetPageView() const
Definition: svdhdl.hxx:200
virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon &rTarget) override
Definition: svddrgmt.cxx:3295
virtual void Move(const Size &rSiz)
Definition: svdobj.cxx:1467
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1899
SdrPageView * mpMarkedPV
Definition: svdmrkv.hxx:104
bool bNoContortionAllowed
Definition: svddrgm1.hxx:194
bool IsResizeProtect() const
Definition: svdobj.hxx:801
virtual void CancelSdrDrag() override
Definition: svddrgmt.cxx:2731
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:3301
bool IsCrookAtCenter() const
Definition: svddrgv.hxx:197
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1924
basegfx::B2DRange getCurrentRange() const
Definition: svddrgmt.cxx:280
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:79
bool getSolidDraggingActive() const
Definition: svddrgmt.hxx:216
SdrDragMove(SdrDragView &rNewView)
Definition: svddrgmt.cxx:1464
Abstract DrawObject.
Definition: svdobj.hxx:312
XPolygon aDistortedRect
Definition: svddrgm1.hxx:191
Fraction aFact
Definition: svddrgm1.hxx:72
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:3424
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:2221
constexpr TypedWhichId< SdrGrafCropItem > SDRATTR_GRAFCROP(SDRATTR_GRAF_FIRST+9)
virtual void Mirror(const Point &rRef1, const Point &rRef2)
Definition: svdobj.cxx:1522
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
Definition: svdmodel.cxx:1961
attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute(const SfxItemSet &rSet, double fWidth)
#define Y
void CrookMarkedObj(const Point &rRef, const Point &rRad, SdrCrookMode eMode, bool bVertical, bool bNoContortion, bool bCopy=false)
Definition: svdedtv1.cxx:580
bool bContortion
Definition: svddrgm1.hxx:150
Point aMarkCenter
Definition: svddrgm1.hxx:143
virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon &rTarget) override
Definition: svddrgmt.cxx:3523
sal_uInt16 FindGluePoint(sal_uInt16 nId) const
Definition: svdglue.cxx:331
bool HasLineStyle() const
Definition: svdobj.cxx:2959
virtual std::unique_ptr< SdrUndoAction > CreateUndoGeoObject(SdrObject &rObject)
Definition: svdundo.cxx:1644
OUString GetMetricString(long nVal, bool bNoUnitChars=false, sal_Int32 nNumDigits=-1) const
Definition: svdmodel.cxx:1083
SdrObject * mpMarkedObj
Definition: svdmrkv.hxx:103
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
const sdr::overlay::OverlayObjectList & getOverlayObjectList() const
Definition: svdhdl.hxx:191
void MovAllPoints(basegfx::B2DPolyPolygon &rTarget)
Definition: svddrgmt.cxx:3451
void MovCrookPoint(Point &rPnt, Point *pC1, Point *pC2)
Definition: svddrgmt.cxx:3034
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
long NormAngle18000(long a)
Definition: svdtrans.cxx:401
long GetDY() const
Definition: svddrag.hxx:149
const tools::Rectangle & GetDragLimitRect()
Definition: svddrgmt.hxx:170
Point aCenter
Definition: svddrgm1.hxx:144
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:2602
void RotateMarkedGluePoints(const Point &rRef, long nAngle, bool bCopy)
Definition: svdglev.cxx:385
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:868
SdrObject * Next()
Definition: svditer.hxx:63
void setAddToTransparent(bool bNew)
Definition: svddrgmt.hxx:38
double nCos
Definition: svddrgm1.hxx:51
virtual void createSdrDragEntries() override
Definition: svddrgmt.cxx:954
SdrHdl * GetHdl(size_t nNum) const
Definition: svdhdl.hxx:462
bool ImpCheckSide(const Point &rPnt) const
Definition: svddrgmt.cxx:2481
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
Definition: svdtrans.hxx:114
void SetActionRect(const tools::Rectangle &rR)
Definition: svddrag.hxx:157
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
double getMinY() const
drawinglayer::primitive2d::Primitive2DContainer const & getViewIndependentPrimitive2DContainer() const
sal_uInt32 count() const
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:1110
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:3566
double nTan
Definition: svddrgm1.hxx:75
void createSdrDragEntries_GlueDrag()
Definition: svddrgmt.cxx:515
SdrHdlKind GetDragHdlKind() const
Definition: svddrgmt.hxx:162
sal_Int32 GetDenominator() const
basegfx::B2DPolyPolygon maOriginalPolyPolygon
Definition: svddrgmt.hxx:54
virtual basegfx::B2DHomMatrix getCurrentTransformation() override
Definition: svddrgmt.cxx:1817
SdrDragCrook(SdrDragView &rNewView)
Definition: svddrgmt.cxx:2753
void setY(double fY)
bool equalZero() const
tools::Rectangle & Union(const tools::Rectangle &rRect)
bool IsGradient() const
Definition: svddrgm1.hxx:129
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:2409
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:2776
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:960
bool IsControl(sal_uInt16 nPos) const
short path to read the CONTROL flag directly (TODO: better explain what the sense behind this flag is...
Definition: _xpoly.cxx:466
OUString ImpGetDescriptionString(const char *pStrCacheID, ImpGetDescriptionOptions nOpt=ImpGetDescriptionOptions::NONE) const
Definition: svdmrkv.cxx:2429
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svddrgmt.hxx:168
virtual void createSdrDragEntryForSdrObject(const SdrObject &rOriginal)
Definition: svddrgmt.cxx:322
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:2747
void ShearMarkedObj(const Point &rRef, long nAngle, bool bVShear=false, bool bCopy=false)
Definition: svdedtv1.cxx:468
const SdrObject & maOriginal
Definition: svddrgmt.hxx:67
B2DHomMatrix createRotateAroundPoint(double fPointX, double fPointY, double fRadiant)
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:1724
double CrookSlantXPoint(Point &rPnt, Point *pC1, Point *pC2, const Point &rCenter, const Point &rRad, double &rSin, double &rCos, bool bVert)
Definition: svdtrans.cxx:216
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1889
virtual basegfx::B2DHomMatrix getCurrentTransformation() override
Definition: svddrgmt.cxx:2107
bool bResize
Definition: svddrgm1.hxx:77
SdrDragDistort(SdrDragView &rNewView)
Definition: svddrgmt.cxx:3384
virtual bool supportsGridOffsets() const
SdrPaintWindow & GetPaintWindow() const
#define F_PI18000
virtual void applyCurrentTransformationToSdrObject(SdrObject &rTarget) override
Definition: svddrgmt.cxx:2046
SdrDragObjOwn(SdrDragView &rNewView)
Definition: svddrgmt.cxx:1163
#define DRAG_CROOK_RASTER_MINIMUM
Definition: svddrgmt.cxx:2800
void MoveMarkedPoints(const Size &rSiz)
Definition: svdpoev.cxx:606
std::vector< basegfx::B2DPoint > maPositions
Definition: svddrgmt.hxx:104
B2DPoint distort(const B2DPoint &rCandidate, const B2DRange &rOriginal, const B2DPoint &rTopLeft, const B2DPoint &rTopRight, const B2DPoint &rBottomLeft, const B2DPoint &rBottomRight)
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:1150
sal_Int32 GetNumerator() const
void createSdrDragEntries_PointDrag()
Definition: svddrgmt.cxx:470
void AddUndoActions(std::vector< std::unique_ptr< SdrUndoAction > >)
Definition: svdedtv1.cxx:176
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:114
SdrObject * GetDragObj() const
Definition: svddrgmt.cxx:567
static size_t GetDragXorPolyLimit()
Definition: svddrgv.hxx:160
virtual SdrObjectUniquePtr getFullDragClone() const
Definition: svdobj.cxx:1279
Fraction aYFact
Definition: svddrgmt.hxx:262
const Point & GetNow() const
Definition: svddrag.hxx:95
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const
Definition: svdobj.cxx:1285
long GetAngle(const Point &rPnt)
The Y axis points down! The function negates the Y axis, when calculating the angle, such that GetAngle(Point(0,-1))=90 deg.
Definition: svdtrans.cxx:386
basegfx::B2DRange getBaseRange() const
static BitmapEx createGluePointBitmap()
Definition: svdhdl.cxx:1073
long Left() const
void translate(double fX, double fY)
drawinglayer::primitive2d::Primitive2DContainer maPrimitive2DSequence
Definition: svddrgmt.hxx:90
PointerStyle
bool IsCrookAllowed(bool bNoContortion=false) const
Definition: svdedtv.cxx:419
void SetMoveFirstHandle(bool bNew)
Definition: svdhdl.hxx:335
const basegfx::B2DPolyPolygon & GetPathPoly() const
Definition: svdopath.hxx:139
basegfx::BColor getBColor() const
ImpGetDescriptionOptions
options for ImpGetDescriptionString()
Definition: svdmrkv.hxx:81
drawinglayer::primitive2d::Primitive2DContainer AddConnectorOverlays()
Definition: svddrgmt.cxx:869
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:310
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll)
Definition: svdedxv.cxx:2114
bool IsMirrored() const
Definition: svdograf.hxx:208
virtual void Shear(const Point &rRef, long nAngle, double tn, bool bVShear)
Definition: svdobj.cxx:1531
bool bNoContortionAllowed
Definition: svddrgm1.hxx:149
void SetShown(bool bOn)
Definition: svddrag.hxx:106
const SdrObject & getOriginal() const
Definition: svddrgmt.hxx:80
virtual bool applySpecialDrag(SdrDragStat &rDrag)
Definition: svdobj.cxx:1296
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: svddrgmt.cxx:2277
bool bVertical
Definition: svddrgm1.hxx:76
void RotateXPoly(XPolygon &rPoly, const Point &rRef, double sn, double cs)
Definition: svdtrans.cxx:88
virtual void applyCurrentTransformationToSdrObject(SdrObject &rTarget) override
Definition: svddrgmt.cxx:3243
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:1493
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:314
double getMinX() const
void destroyOverlayGeometry()
Definition: svddrgmt.cxx:833
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:1340
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const override
Definition: svdotext.cxx:1577
virtual ~SdrDragEntrySdrObject() override
Definition: svddrgmt.cxx:145
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:3857
virtual void createSdrDragEntries() override
Definition: svddrgmt.cxx:3407
virtual ~SdrDragEntryPolyPolygon() override
Definition: svddrgmt.cxx:88
static OUString GetPercentString(const Fraction &rVal)
Definition: svdmodel.cxx:1235
SdrMark * GetSdrMarkByIndex(size_t nNum) const
Definition: svdmrkv.hxx:256
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:1704
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:1772
void setX(long x)
bool IsValid() const
sal_uInt16 GetStripeLength() const
SdrCrookMode eMode
Definition: svddrgm1.hxx:164
Primitive2DReference createPolygonLinePrimitive(const basegfx::B2DPolygon &rPolygon, const attribute::SdrLineAttribute &rLine, const attribute::SdrLineStartEndAttribute &rStroke)
long nAngle0
Definition: svddrgm1.hxx:73
bool isHitLogic(const basegfx::B2DPoint &rLogicPosition, double fLogicTolerance=0.0) const
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const
Definition: svdobj.cxx:2887
bool IsCon2() const
Definition: svdmark.hxx:95
SdrDragEntryPrimitive2DSequence(const drawinglayer::primitive2d::Primitive2DContainer &rSequence)
Definition: svddrgmt.cxx:182
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
bool IsVerFixed() const
Definition: svddrag.hxx:115
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:2507
sal_uInt16 GetPointCount() const
Definition: _xpoly.cxx:346
virtual std::unique_ptr< SdrUndoAction > CreateUndoAttrObject(SdrObject &rObject, bool bStyleSheet1=false, bool bSaveText=false)
Definition: svdundo.cxx:1649
void reserve(sal_uInt32 nCount)
virtual ~SdrDragEntryPrimitive2DSequence() override
Definition: svddrgmt.cxx:191
virtual void SetChanged()
Definition: svdobj.cxx:929
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:1474
virtual OUString GetSdrDragComment() const override
Definition: svddrgmt.cxx:2202
SdrPageView * GetDragPV() const
Definition: svddrgmt.cxx:575
OUString ImpGetDescriptionStr(const char *pStrCacheID) const
Definition: svddrgmt.cxx:556
virtual bool BeginSdrDrag() override
Definition: svddrgmt.cxx:967
virtual basegfx::B2DHomMatrix getCurrentTransformation() override
Definition: svddrgmt.cxx:2540
sal_uInt16 nPolyPt
Definition: svddrgm1.hxx:192
bool IsMoveOnlyDragging() const
Definition: svdsnpv.hxx:265
void OrthoDistance4(const Point &rPt0, Point &rPt, bool bBigOrtho)
Definition: svdtrans.cxx:545
long nMarkSize
Definition: svddrgm1.hxx:163
SdrModel * GetModel() const
Definition: svdpntv.hxx:271
void SetMoveSingleHandle(bool bNew)
Definition: svdhdl.hxx:333
SdrObjUserCall * GetUserCall() const
Definition: svdobj.hxx:885
#define DRAG_CROOK_RASTER_MAXIMUM
Definition: svddrgmt.cxx:2801
bool IsNoSnap() const
Definition: svddrag.hxx:120
aStr
bool IsDraggingPoints() const
Definition: svddrgmt.hxx:177
OutputDevice & GetOutputDevice() const
void MoveMarkedGluePoints(const Size &rSiz, bool bCopy)
Definition: svdglev.cxx:349
void MovAllPoints(basegfx::B2DPolyPolygon &rTarget)
Definition: svddrgmt.cxx:2917
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2654
void insertNewlyCreatedOverlayObjectForSdrDragMethod(std::unique_ptr< sdr::overlay::OverlayObject > pOverlayObject, const sdr::contact::ObjectContact &rObjectContact, sdr::overlay::OverlayManager &rOverlayManager)
Definition: svddrgmt.cxx:329
Point Center() const
virtual void applyCurrentTransformationToSdrObject(SdrObject &rTarget) override
Definition: svddrgmt.cxx:1459
virtual bool EndSdrDrag(bool bCopy) override
Definition: svddrgmt.cxx:2161
bool bAtCenter
Definition: svddrgm1.hxx:161
SdrDragMovHdl(SdrDragView &rNewView)
Definition: svddrgmt.cxx:949
Point Rotate(const Point &rPoint, short nOrientation, const Point &rOrigin)
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
bool IsDistortAllowed(bool bNoContortion=false) const
Definition: svdedtv.cxx:431
Utility class SdrEdgeObj.
Definition: svdoedge.hxx:128
const SdrHdlList & GetHdlList() const
Definition: svddrgmt.hxx:167
sal_uInt32 count() const
bool IsMoveSingleHandle() const
Definition: svdhdl.hxx:332
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
Color getHilightColor() const
void MoveMarkedObj(const Size &rSiz, bool bCopy=false)
Definition: svdedtv1.cxx:182
sal_uInt32 PageWindowCount() const
Definition: svdpagv.hxx:94
virtual PointerStyle GetSdrDragPointer() const override
Definition: svddrgmt.cxx:2183
bool IsEndDragChangesAttributes() const
Definition: svddrag.hxx:132