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