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