LibreOffice Module svx (master)  1
svdhdl.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 
21 #include <algorithm>
22 #include <cassert>
23 
24 #include <svx/svdhdl.hxx>
25 #include <svx/svdpagv.hxx>
26 #include <svx/svdmrkv.hxx>
27 #include <vcl/settings.hxx>
28 #include <vcl/virdev.hxx>
29 #include <vcl/ptrstyle.hxx>
30 
31 #include <svx/sxekitm.hxx>
32 #include <svx/strings.hrc>
33 #include <svx/svdmodel.hxx>
34 #include "gradtrns.hxx"
35 #include <svx/xflgrit.hxx>
36 #include <svx/svdundo.hxx>
37 #include <svx/dialmgr.hxx>
38 #include <svx/xflftrit.hxx>
39 
40 #include <svx/svdopath.hxx>
50 #include <svx/sdrpagewindow.hxx>
51 #include <svx/sdrpaintwindow.hxx>
52 #include <vcl/svapp.hxx>
54 #include <vcl/lazydelete.hxx>
55 #include <vcl/BitmapTools.hxx>
58 
65 #include <memory>
66 #include <bitmaps.hlst>
67 
68 namespace {
69 
70 // #i15222#
71 // Due to the resource problems in Win95/98 with bitmap resources I
72 // will change this handle bitmap providing class. Old version was splitting
73 // and preparing all small handle bitmaps in device bitmap format, now this will
74 // be done on the fly. Thus, there is only one big bitmap in memory. With
75 // three source bitmaps, this will be 3 system bitmap resources instead of hundreds.
76 // The price for that needs to be evaluated. Maybe we will need another change here
77 // if this is too expensive.
78 class SdrHdlBitmapSet
79 {
80  // the bitmap holding all information
81  BitmapEx maMarkersBitmap;
82 
83  // the cropped Bitmaps for reusage
84  ::std::vector< BitmapEx > maRealMarkers;
85 
86  // helpers
87  BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle);
88 
89 public:
90  explicit SdrHdlBitmapSet();
91 
92  const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd);
93 };
94 
95 }
96 
97 #define KIND_COUNT (14)
98 #define INDEX_COUNT (6)
99 #define INDIVIDUAL_COUNT (5)
100 
101 SdrHdlBitmapSet::SdrHdlBitmapSet()
102  : maMarkersBitmap(SIP_SA_MARKERS),
103  // 15 kinds (BitmapMarkerKind) use index [0..5] + 5 extra
104  maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT)
105 {
106 }
107 
108 BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle)
109 {
110  BitmapEx& rTargetBitmap = maRealMarkers[nIndex];
111 
112  if(rTargetBitmap.IsEmpty())
113  {
114  rTargetBitmap = maMarkersBitmap;
115  rTargetBitmap.Crop(rRectangle);
116  }
117 
118  return rTargetBitmap;
119 }
120 
121 // change getting of bitmap to use the big resource bitmap
122 const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
123 {
124  // fill in size and source position in maMarkersBitmap
125  const sal_uInt16 nYPos(nInd * 11);
126 
127  switch(eKindOfMarker)
128  {
129  default:
130  {
131  OSL_FAIL( "Unknown kind of marker." );
132  [[fallthrough]]; // return Rect_9x9 as default
133  }
135  {
136  return impGetOrCreateTargetBitmap((1 * INDEX_COUNT) + nInd, tools::Rectangle(Point(7, nYPos), Size(9, 9)));
137  }
138 
140  {
141  return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, tools::Rectangle(Point(0, nYPos), Size(7, 7)));
142  }
143 
145  {
146  return impGetOrCreateTargetBitmap((2 * INDEX_COUNT) + nInd, tools::Rectangle(Point(16, nYPos), Size(11, 11)));
147  }
148 
150  {
151  const sal_uInt16 nIndex((3 * INDEX_COUNT) + nInd);
152 
153  switch(nInd)
154  {
155  case 0:
156  {
157  return impGetOrCreateTargetBitmap(nIndex, tools::Rectangle(Point(72, 66), Size(13, 13)));
158  }
159  case 1:
160  {
161  return impGetOrCreateTargetBitmap(nIndex, tools::Rectangle(Point(85, 66), Size(13, 13)));
162  }
163  case 2:
164  {
165  return impGetOrCreateTargetBitmap(nIndex, tools::Rectangle(Point(72, 79), Size(13, 13)));
166  }
167  case 3:
168  {
169  return impGetOrCreateTargetBitmap(nIndex, tools::Rectangle(Point(85, 79), Size(13, 13)));
170  }
171  case 4:
172  {
173  return impGetOrCreateTargetBitmap(nIndex, tools::Rectangle(Point(98, 79), Size(13, 13)));
174  }
175  default: // case 5:
176  {
177  return impGetOrCreateTargetBitmap(nIndex, tools::Rectangle(Point(98, 66), Size(13, 13)));
178  }
179  }
180  }
181 
184  {
185  return impGetOrCreateTargetBitmap((4 * INDEX_COUNT) + nInd, tools::Rectangle(Point(27, nYPos), Size(7, 7)));
186  }
187 
190  {
191  return impGetOrCreateTargetBitmap((5 * INDEX_COUNT) + nInd, tools::Rectangle(Point(34, nYPos), Size(9, 9)));
192  }
193 
196  {
197  return impGetOrCreateTargetBitmap((6 * INDEX_COUNT) + nInd, tools::Rectangle(Point(43, nYPos), Size(11, 11)));
198  }
199 
201  {
202  return impGetOrCreateTargetBitmap((7 * INDEX_COUNT) + nInd, tools::Rectangle(Point(54, nYPos), Size(7, 9)));
203  }
204 
206  {
207  return impGetOrCreateTargetBitmap((8 * INDEX_COUNT) + nInd, tools::Rectangle(Point(61, nYPos), Size(9, 11)));
208  }
209 
211  {
212  return impGetOrCreateTargetBitmap((9 * INDEX_COUNT) + nInd, tools::Rectangle(Point(70, nYPos), Size(9, 7)));
213  }
214 
216  {
217  return impGetOrCreateTargetBitmap((10 * INDEX_COUNT) + nInd, tools::Rectangle(Point(79, nYPos), Size(11, 9)));
218  }
219 
221  {
222  return impGetOrCreateTargetBitmap((11 * INDEX_COUNT) + nInd, tools::Rectangle(Point(90, nYPos), Size(7, 7)));
223  }
224 
226  {
227  return impGetOrCreateTargetBitmap((12 * INDEX_COUNT) + nInd, tools::Rectangle(Point(97, nYPos), Size(9, 9)));
228  }
229 
231  {
232  return impGetOrCreateTargetBitmap((13 * INDEX_COUNT) + nInd, tools::Rectangle(Point(106, nYPos), Size(11, 11)));
233  }
234 
236  {
237  return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 0, tools::Rectangle(Point(0, 68), Size(15, 15)));
238  }
239 
241  {
242  return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, tools::Rectangle(Point(15, 76), Size(9, 9)));
243  }
244 
246  {
247  return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, tools::Rectangle(Point(15, 67), Size(9, 9)));
248  }
249 
250  case BitmapMarkerKind::Anchor: // AnchorTR for SW
252  {
253  return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, tools::Rectangle(Point(24, 67), Size(24, 24)));
254  }
255 
256  // add AnchorPressed to be able to animate anchor control
259  {
260  return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 4, tools::Rectangle(Point(48, 67), Size(24, 24)));
261  }
262  }
263 }
264 
265 
267  pObj(nullptr),
268  pPV(nullptr),
269  pHdlList(nullptr),
270  eKind(SdrHdlKind::Move),
271  nRotationAngle(0),
272  nObjHdlNum(0),
273  nPolyNum(0),
274  nPPntNum(0),
275  nSourceHdlNum(0),
276  bSelect(false),
277  b1PixMore(false),
278  bPlusHdl(false),
279  mbMoveOutside(false),
280  mbMouseOver(false)
281 {
282 }
283 
284 SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind):
285  pObj(nullptr),
286  pPV(nullptr),
287  pHdlList(nullptr),
288  aPos(rPnt),
289  eKind(eNewKind),
290  nRotationAngle(0),
291  nObjHdlNum(0),
292  nPolyNum(0),
293  nPPntNum(0),
294  nSourceHdlNum(0),
295  bSelect(false),
296  b1PixMore(false),
297  bPlusHdl(false),
298  mbMoveOutside(false),
299  mbMouseOver(false)
300 {
301 }
302 
304 {
306 }
307 
308 void SdrHdl::Set1PixMore(bool bJa)
309 {
310  if(b1PixMore != bJa)
311  {
312  b1PixMore = bJa;
313 
314  // create new display
315  Touch();
316  }
317 }
318 
319 void SdrHdl::SetMoveOutside( bool bMoveOutside )
320 {
321  if(mbMoveOutside != bMoveOutside)
322  {
323  mbMoveOutside = bMoveOutside;
324 
325  // create new display
326  Touch();
327  }
328 }
329 
331 {
332  if(nRotationAngle != n)
333  {
334  nRotationAngle = n;
335 
336  // create new display
337  Touch();
338  }
339 }
340 
341 void SdrHdl::SetPos(const Point& rPnt)
342 {
343  if(aPos != rPnt)
344  {
345  // remember new position
346  aPos = rPnt;
347 
348  // create new display
349  Touch();
350  }
351 }
352 
353 void SdrHdl::SetSelected(bool bJa)
354 {
355  if(bSelect != bJa)
356  {
357  // remember new value
358  bSelect = bJa;
359 
360  // create new display
361  Touch();
362  }
363 }
364 
366 {
367  if(pHdlList != pList)
368  {
369  // remember list
370  pHdlList = pList;
371 
372  // now it's possible to create graphic representation
373  Touch();
374  }
375 }
376 
377 void SdrHdl::SetObj(SdrObject* pNewObj)
378 {
379  if(pObj != pNewObj)
380  {
381  // remember new object
382  pObj = pNewObj;
383 
384  // graphic representation may have changed
385  Touch();
386  }
387 }
388 
390 {
391  // force update of graphic representation
393 }
394 
396 {
397 
398  // OVERLAYMANAGER
400 }
401 
403 {
404  // first throw away old one
406 
408  return;
409 
412 
413  bool bRot = pHdlList->IsRotateShear();
414  if(pObj)
416  if(bRot)
417  {
418  // red rotation handles
419  if(pObj && bSelect)
420  eColIndex = BitmapColorIndex::Red;
421  else
422  eColIndex = BitmapColorIndex::LightRed;
423  }
424 
425  switch(eKind)
426  {
427  case SdrHdlKind::Move:
428  {
430  break;
431  }
436  {
437  // corner handles
438  if(bRot)
439  {
440  eKindOfMarker = BitmapMarkerKind::Circ_7x7;
441  }
442  else
443  {
444  eKindOfMarker = BitmapMarkerKind::Rect_7x7;
445  }
446  break;
447  }
448  case SdrHdlKind::Upper:
449  case SdrHdlKind::Lower:
450  {
451  // Upper/Lower handles
452  if(bRot)
453  {
454  eKindOfMarker = BitmapMarkerKind::Elli_9x7;
455  }
456  else
457  {
458  eKindOfMarker = BitmapMarkerKind::Rect_7x7;
459  }
460  break;
461  }
462  case SdrHdlKind::Left:
463  case SdrHdlKind::Right:
464  {
465  // Left/Right handles
466  if(bRot)
467  {
468  eKindOfMarker = BitmapMarkerKind::Elli_7x9;
469  }
470  else
471  {
472  eKindOfMarker = BitmapMarkerKind::Rect_7x7;
473  }
474  break;
475  }
476  case SdrHdlKind::Poly:
477  {
478  if(bRot)
479  {
481  }
482  else
483  {
485  }
486  break;
487  }
488  case SdrHdlKind::BezierWeight: // weight at poly
489  {
490  eKindOfMarker = BitmapMarkerKind::Circ_7x7;
491  break;
492  }
493  case SdrHdlKind::Circle:
494  {
495  eKindOfMarker = BitmapMarkerKind::Rect_11x11;
496  break;
497  }
498  case SdrHdlKind::Ref1:
499  case SdrHdlKind::Ref2:
500  {
501  eKindOfMarker = BitmapMarkerKind::Crosshair;
502  break;
503  }
504  case SdrHdlKind::Glue:
505  {
506  eKindOfMarker = BitmapMarkerKind::Glue;
507  break;
508  }
509  case SdrHdlKind::Anchor:
510  {
511  eKindOfMarker = BitmapMarkerKind::Anchor;
512  break;
513  }
514  case SdrHdlKind::User:
515  {
516  break;
517  }
518  // top right anchor for SW
520  {
521  eKindOfMarker = BitmapMarkerKind::AnchorTR;
522  break;
523  }
524 
525  // for SJ and the CustomShapeHandles:
527  {
529  eColIndex = BitmapColorIndex::Yellow;
530  break;
531  }
532  default:
533  break;
534  }
535 
536  SdrMarkView* pView = pHdlList->GetView();
537  SdrPageView* pPageView = pView->GetSdrPageView();
538 
539  if(!pPageView)
540  return;
541 
542  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
543  {
544  // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
545  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
546 
547  if(rPageWindow.GetPaintWindow().OutputToWindow())
548  {
549  Point aMoveOutsideOffset(0, 0);
550  OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
551 
552  // add offset if necessary
554  {
555  Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
556 
558  aMoveOutsideOffset.AdjustY( -(aOffset.Width()) );
560  aMoveOutsideOffset.AdjustY(aOffset.Height() );
562  aMoveOutsideOffset.AdjustX( -(aOffset.Width()) );
564  aMoveOutsideOffset.AdjustX(aOffset.Height() );
565  }
566 
568  if (xManager.is())
569  {
570  basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
571  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject;
572  if (getenv ("SVX_DRAW_HANDLES") && (eKindOfMarker == BitmapMarkerKind::Rect_7x7 || eKindOfMarker == BitmapMarkerKind::Rect_9x9 || eKindOfMarker == BitmapMarkerKind::Rect_11x11))
573  {
574  double fSize = 7.0;
575  switch (eKindOfMarker)
576  {
578  fSize = 9.0;
579  break;
581  fSize = 11.0;
582  break;
583  default:
584  break;
585  }
586  float fScalingFactor = rOutDev.GetDPIScaleFactor();
587  basegfx::B2DSize aB2DSize(fSize * fScalingFactor, fSize * fScalingFactor);
588 
589  Color aHandleFillColor(COL_LIGHTGREEN);
590  switch (eColIndex)
591  {
593  aHandleFillColor = COL_CYAN;
594  break;
596  aHandleFillColor = COL_LIGHTCYAN;
597  break;
599  aHandleFillColor = COL_RED;
600  break;
602  aHandleFillColor = COL_LIGHTRED;
603  break;
605  aHandleFillColor = COL_YELLOW;
606  break;
607  default:
608  break;
609  }
610  pNewOverlayObject.reset(new sdr::overlay::OverlayHandle(aPosition, aB2DSize, /*HandleStrokeColor*/COL_BLACK, aHandleFillColor));
611  }
612  else
613  {
614  pNewOverlayObject = CreateOverlayObject(
615  aPosition, eColIndex, eKindOfMarker,
616  aMoveOutsideOffset);
617  }
618 
619  // OVERLAYMANAGER
621  std::move(pNewOverlayObject),
622  rPageWindow.GetObjectContact(),
623  *xManager);
624  }
625  }
626  }
627 }
628 
630 {
631  BitmapMarkerKind eRetval(eKnd);
632 
633  switch(eKnd)
634  {
638 
641 
644  //case BitmapMarkerKind::Customshape_11x11: eRetval = ; break;
645 
647 
649 
652 
653  // let anchor blink with its pressed state
655 
656  // same for AnchorTR
658  default:
659  break;
660  }
661 
662  return eRetval;
663 }
664 
665 namespace
666 {
667 
668 OUString appendMarkerName(BitmapMarkerKind eKindOfMarker)
669 {
670  switch(eKindOfMarker)
671  {
673  return "rect7";
675  return "rect9";
677  return "rect11";
679  return "rect13";
682  return "circ7";
685  return "circ9";
688  return "circ11";
690  return "elli7x9";
692  return "elli9x11";
694  return "elli9x7";
696  return "elli11x9";
698  return "rectplus7";
700  return "rectplus9";
702  return "rectplus11";
704  return "cross";
707  return "anchor";
710  return "anchor-pressed";
712  return "glue-selected";
714  return "glue-unselected";
715  default:
716  break;
717  }
718  return OUString();
719 }
720 
721 OUString appendMarkerColor(BitmapColorIndex eIndex)
722 {
723  switch(eIndex)
724  {
726  return "1";
728  return "2";
730  return "3";
732  return "4";
734  return "5";
736  return "6";
737  default:
738  break;
739  }
740  return OUString();
741 }
742 
743 BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex)
744 {
745  // use this code path only when we use HiDPI (for now)
746  if (Application::GetDefaultDevice()->GetDPIScalePercentage() > 100)
747  {
748  OUString sMarkerName = appendMarkerName(eKindOfMarker);
749  if (!sMarkerName.isEmpty())
750  {
751  OUString sMarkerPrefix("svx/res/marker-");
752  BitmapEx aBitmapEx;
753 
754  if (eKindOfMarker == BitmapMarkerKind::Crosshair
755  || eKindOfMarker == BitmapMarkerKind::Anchor
756  || eKindOfMarker == BitmapMarkerKind::AnchorTR
757  || eKindOfMarker == BitmapMarkerKind::AnchorPressed
758  || eKindOfMarker == BitmapMarkerKind::AnchorPressedTR
759  || eKindOfMarker == BitmapMarkerKind::Glue
760  || eKindOfMarker == BitmapMarkerKind::Glue_Deselected)
761  {
762  aBitmapEx = vcl::bitmap::loadFromName(sMarkerPrefix + sMarkerName + ".png");
763  }
764  else
765  {
766  aBitmapEx = vcl::bitmap::loadFromName(sMarkerPrefix + sMarkerName + "-" + appendMarkerColor(eIndex) + ".png");
767  }
768 
769  if (!aBitmapEx.IsEmpty())
770  return aBitmapEx;
771  }
772  }
773 
774  // if we can't load the marker...
775 
776  static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet);
777  return aModernSet.get()->GetBitmapEx(eKindOfMarker, sal_uInt16(eIndex));
778 }
779 
780 } // end anonymous namespace
781 
782 std::unique_ptr<sdr::overlay::OverlayObject> SdrHdl::CreateOverlayObject(
783  const basegfx::B2DPoint& rPos,
784  BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset)
785 {
786  std::unique_ptr<sdr::overlay::OverlayObject> pRetval;
787 
788  // support bigger sizes
789  bool bForceBiggerSize(false);
790 
791  if(pHdlList->GetHdlSize() > 3)
792  {
793  switch(eKindOfMarker)
794  {
799  {
800  // #i121463# For anchor, do not simply make bigger because of HdlSize,
801  // do it dependent of IsSelected() which Writer can set in drag mode
802  if(IsSelected())
803  {
804  bForceBiggerSize = true;
805  }
806  break;
807  }
808  default:
809  {
810  bForceBiggerSize = true;
811  break;
812  }
813  }
814  }
815 
816  if(bForceBiggerSize)
817  {
818  eKindOfMarker = GetNextBigger(eKindOfMarker);
819  }
820 
821  // This handle has the focus, visualize it
822  if(IsFocusHdl() && pHdlList && pHdlList->GetFocusHdl() == this)
823  {
824  // create animated handle
825  BitmapMarkerKind eNextBigger = GetNextBigger(eKindOfMarker);
826 
827  if(eNextBigger == eKindOfMarker)
828  {
829  // this may happen for the not supported getting-bigger types.
830  // Choose an alternative here
831  switch(eKindOfMarker)
832  {
835  case BitmapMarkerKind::Elli_9x11: eNextBigger = BitmapMarkerKind::Elli_11x9; break;
836  case BitmapMarkerKind::Elli_11x9: eNextBigger = BitmapMarkerKind::Elli_9x11; break;
838 
840  eNextBigger = BitmapMarkerKind::Glue;
841  break;
842 
844  eNextBigger = BitmapMarkerKind::Crosshair;
845  break;
847  eNextBigger = BitmapMarkerKind::Glue;
848  break;
849  default:
850  break;
851  }
852  }
853 
854  // create animated handle
855  BitmapEx aBmpEx1 = ImpGetBitmapEx(eKindOfMarker, eColIndex);
856  BitmapEx aBmpEx2 = ImpGetBitmapEx(eNextBigger, eColIndex);
857 
858  // #i53216# Use system cursor blink time. Use the unsigned value.
859  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
860  const sal_uInt64 nBlinkTime(rStyleSettings.GetCursorBlinkTime());
861 
862  if(eKindOfMarker == BitmapMarkerKind::Anchor || eKindOfMarker == BitmapMarkerKind::AnchorPressed)
863  {
864  // when anchor is used take upper left as reference point inside the handle
865  pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime));
866  }
867  else if(eKindOfMarker == BitmapMarkerKind::AnchorTR || eKindOfMarker == BitmapMarkerKind::AnchorPressedTR)
868  {
869  // AnchorTR for SW, take top right as (0,0)
870  pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
871  static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1), 0,
872  static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1), 0));
873  }
874  else
875  {
876  // create centered handle as default
877  pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
878  static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
879  static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
880  static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
881  static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1));
882  }
883  }
884  else
885  {
886  // create normal handle: use ImpGetBitmapEx(...) now
887  BitmapEx aBmpEx = ImpGetBitmapEx(eKindOfMarker, eColIndex);
888 
889  // When the image with handles is not found, the bitmap returned is
890  // empty. This is a problem when we use LibreOffice as a library
891  // (through LOKit - for example on Android) even when we don't show
892  // the handles, because the hit test would always return false.
893  //
894  // This HACK replaces the empty bitmap with a black 13x13 bitmap handle
895  // so that the hit test works for this case.
896  if (aBmpEx.IsEmpty())
897  {
898  aBmpEx = BitmapEx(Size(13, 13), 24);
899  aBmpEx.Erase(COL_BLACK);
900  }
901 
902  if(eKindOfMarker == BitmapMarkerKind::Anchor || eKindOfMarker == BitmapMarkerKind::AnchorPressed)
903  {
904  // upper left as reference point inside the handle for AnchorPressed, too
905  pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx));
906  }
907  else if(eKindOfMarker == BitmapMarkerKind::AnchorTR || eKindOfMarker == BitmapMarkerKind::AnchorPressedTR)
908  {
909  // AnchorTR for SW, take top right as (0,0)
910  pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
911  static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1), 0));
912  }
913  else
914  {
915  sal_uInt16 nCenX(static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1) >> 1);
916  sal_uInt16 nCenY(static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Height() - 1) >> 1);
917 
918  if(aMoveOutsideOffset.X() > 0)
919  {
920  nCenX = 0;
921  }
922  else if(aMoveOutsideOffset.X() < 0)
923  {
924  nCenX = static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1);
925  }
926 
927  if(aMoveOutsideOffset.Y() > 0)
928  {
929  nCenY = 0;
930  }
931  else if(aMoveOutsideOffset.Y() < 0)
932  {
933  nCenY = static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Height() - 1);
934  }
935 
936  // create centered handle as default
937  pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, nCenX, nCenY));
938  }
939  }
940 
941  return pRetval;
942 }
943 
944 bool SdrHdl::IsHdlHit(const Point& rPnt) const
945 {
946  // OVERLAYMANAGER
947  basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y());
948  return maOverlayGroup.isHitLogic(aPosition);
949 }
950 
952 {
953  PointerStyle ePtr=PointerStyle::Move;
955  const bool bRot=pHdlList!=nullptr && pHdlList->IsRotateShear();
956  const bool bDis=pHdlList!=nullptr && pHdlList->IsDistortShear();
957  if (bSize && pHdlList!=nullptr && (bRot || bDis)) {
958  switch (eKind) {
960  case SdrHdlKind::LowerLeft: case SdrHdlKind::LowerRight: ePtr=bRot ? PointerStyle::Rotate : PointerStyle::RefHand; break;
961  case SdrHdlKind::Left : case SdrHdlKind::Right: ePtr=PointerStyle::VShear; break;
962  case SdrHdlKind::Upper: case SdrHdlKind::Lower: ePtr=PointerStyle::HShear; break;
963  default:
964  break;
965  }
966  } else {
967  // When resizing rotated rectangles, rotate the mouse cursor slightly, too
968  if (bSize && nRotationAngle!=0_deg100) {
969  Degree100 nHdlAngle(0);
970  switch (eKind) {
971  case SdrHdlKind::LowerRight: nHdlAngle=31500_deg100; break;
972  case SdrHdlKind::Lower: nHdlAngle=27000_deg100; break;
973  case SdrHdlKind::LowerLeft: nHdlAngle=22500_deg100; break;
974  case SdrHdlKind::Left : nHdlAngle=18000_deg100; break;
975  case SdrHdlKind::UpperLeft: nHdlAngle=13500_deg100; break;
976  case SdrHdlKind::Upper: nHdlAngle=9000_deg100; break;
977  case SdrHdlKind::UpperRight: nHdlAngle=4500_deg100; break;
978  case SdrHdlKind::Right: nHdlAngle=0_deg100; break;
979  default:
980  break;
981  }
982  // a little bit more (for rounding)
983  nHdlAngle = NormAngle36000(nHdlAngle + nRotationAngle + 2249_deg100);
984  nHdlAngle/=4500_deg100;
985  switch (static_cast<sal_uInt8>(nHdlAngle.get())) {
986  case 0: ePtr=PointerStyle::ESize; break;
987  case 1: ePtr=PointerStyle::NESize; break;
988  case 2: ePtr=PointerStyle::NSize; break;
989  case 3: ePtr=PointerStyle::NWSize; break;
990  case 4: ePtr=PointerStyle::WSize; break;
991  case 5: ePtr=PointerStyle::SWSize; break;
992  case 6: ePtr=PointerStyle::SSize; break;
993  case 7: ePtr=PointerStyle::SESize; break;
994  } // switch
995  } else {
996  switch (eKind) {
997  case SdrHdlKind::UpperLeft: ePtr=PointerStyle::NWSize; break;
998  case SdrHdlKind::Upper: ePtr=PointerStyle::NSize; break;
999  case SdrHdlKind::UpperRight: ePtr=PointerStyle::NESize; break;
1000  case SdrHdlKind::Left : ePtr=PointerStyle::WSize; break;
1001  case SdrHdlKind::Right: ePtr=PointerStyle::ESize; break;
1002  case SdrHdlKind::LowerLeft: ePtr=PointerStyle::SWSize; break;
1003  case SdrHdlKind::Lower: ePtr=PointerStyle::SSize; break;
1004  case SdrHdlKind::LowerRight: ePtr=PointerStyle::SESize; break;
1005  case SdrHdlKind::Poly : ePtr=PointerStyle::MovePoint; break;
1006  case SdrHdlKind::Circle : ePtr=PointerStyle::Hand; break;
1007  case SdrHdlKind::Ref1 : ePtr=PointerStyle::RefHand; break;
1008  case SdrHdlKind::Ref2 : ePtr=PointerStyle::RefHand; break;
1009  case SdrHdlKind::BezierWeight : ePtr=PointerStyle::MoveBezierWeight; break;
1010  case SdrHdlKind::Glue : ePtr=PointerStyle::MovePoint; break;
1011  case SdrHdlKind::CustomShape1 : ePtr=PointerStyle::Hand; break;
1012  default:
1013  break;
1014  }
1015  }
1016  }
1017  return ePtr;
1018 }
1019 
1021 {
1022  switch(eKind)
1023  {
1024  case SdrHdlKind::UpperLeft:
1025  case SdrHdlKind::Upper:
1027  case SdrHdlKind::Left:
1028  case SdrHdlKind::Right:
1029  case SdrHdlKind::LowerLeft:
1030  case SdrHdlKind::Lower:
1032  {
1033  // if it's an activated TextEdit, it's moved to extended points
1034  return !pHdlList || !pHdlList->IsMoveOutside();
1035  }
1036 
1037  case SdrHdlKind::Move: // handle to move object
1038  case SdrHdlKind::Poly: // selected point of polygon or curve
1039  case SdrHdlKind::BezierWeight: // weight at a curve
1040  case SdrHdlKind::Circle: // angle of circle segments, corner radius of rectangles
1041  case SdrHdlKind::Ref1: // reference point 1, e. g. center of rotation
1042  case SdrHdlKind::Ref2: // reference point 2, e. g. endpoint of reflection axis
1043  case SdrHdlKind::Glue: // glue point
1044 
1045  // for SJ and the CustomShapeHandles:
1047 
1048  case SdrHdlKind::User:
1049  {
1050  return true;
1051  }
1052 
1053  default:
1054  {
1055  return false;
1056  }
1057  }
1058 }
1059 
1060 void SdrHdl::onMouseEnter(const MouseEvent& /*rMEvt*/)
1061 {
1062 }
1063 
1065 {
1066 }
1067 
1069 {
1070 }
1071 
1073 {
1075 }
1076 
1078  std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject,
1079  const sdr::contact::ObjectContact& rObjectContact,
1080  sdr::overlay::OverlayManager& rOverlayManager)
1081 {
1082  // check if we have an OverlayObject
1083  if(!pOverlayObject)
1084  {
1085  return;
1086  }
1087 
1088  // Add GridOffset for non-linear ViewToDevice transformation (calc)
1089  if(nullptr != GetObj() && rObjectContact.supportsGridOffsets())
1090  {
1091  basegfx::B2DVector aOffset(0.0, 0.0);
1092  const sdr::contact::ViewObjectContact& rVOC(GetObj()->GetViewContact().GetViewObjectContact(
1093  const_cast<sdr::contact::ObjectContact&>(rObjectContact)));
1094 
1095  rObjectContact.calculateGridOffsetForViewOjectContact(aOffset, rVOC);
1096 
1097  if(!aOffset.equalZero())
1098  {
1099  pOverlayObject->setOffset(aOffset);
1100  }
1101  }
1102 
1103  // add to OverlayManager
1104  rOverlayManager.add(*pOverlayObject);
1105 
1106  // add to local OverlayObjectList - ownership change (!)
1107  maOverlayGroup.append(std::move(pOverlayObject));
1108 }
1109 
1110 SdrHdlColor::SdrHdlColor(const Point& rRef, Color aCol, const Size& rSize, bool bLum)
1111 : SdrHdl(rRef, SdrHdlKind::Color),
1112  aMarkerSize(rSize),
1113  bUseLuminance(bLum)
1114 {
1115  if(IsUseLuminance())
1116  aCol = GetLuminance(aCol);
1117 
1118  // remember color
1119  aMarkerColor = aCol;
1120 }
1121 
1123 {
1124 }
1125 
1127 {
1128  // first throw away old one
1129  GetRidOfIAObject();
1130 
1131  if(!pHdlList)
1132  return;
1133 
1134  SdrMarkView* pView = pHdlList->GetView();
1135 
1136  if(!pView || pView->areMarkHandlesHidden())
1137  return;
1138 
1139  SdrPageView* pPageView = pView->GetSdrPageView();
1140 
1141  if(!pPageView)
1142  return;
1143 
1144  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1145  {
1146  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1147 
1148  if(rPageWindow.GetPaintWindow().OutputToWindow())
1149  {
1150  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
1151  if (xManager.is())
1152  {
1154  basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1155  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
1157  aPosition,
1158  aBmpCol,
1159  static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Width() - 1) >> 1,
1160  static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Height() - 1) >> 1
1161  ));
1162 
1163  // OVERLAYMANAGER
1165  std::move(pNewOverlayObject),
1166  rPageWindow.GetObjectContact(),
1167  *xManager);
1168  }
1169  }
1170  }
1171 }
1172 
1174 {
1175  // get the Bitmap
1178  pWrite->SetBackground(aCol);
1179  pWrite->Erase();
1180 
1181  // draw outer border
1182  sal_Int32 nWidth = aMarkerSize.Width();
1183  sal_Int32 nHeight = aMarkerSize.Height();
1184 
1185  pWrite->SetLineColor(COL_LIGHTGRAY);
1186  pWrite->DrawLine(Point(0, 0), Point(0, nHeight - 1));
1187  pWrite->DrawLine(Point(1, 0), Point(nWidth - 1, 0));
1188  pWrite->SetLineColor(COL_GRAY);
1189  pWrite->DrawLine(Point(1, nHeight - 1), Point(nWidth - 1, nHeight - 1));
1190  pWrite->DrawLine(Point(nWidth - 1, 1), Point(nWidth - 1, nHeight - 2));
1191 
1192  // draw lighter UpperLeft
1193  const Color aLightColor(
1194  static_cast<sal_uInt8>(::std::min(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetRed()) + sal_Int16(0x0040)), sal_Int16(0x00ff))),
1195  static_cast<sal_uInt8>(::std::min(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetGreen()) + sal_Int16(0x0040)), sal_Int16(0x00ff))),
1196  static_cast<sal_uInt8>(::std::min(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetBlue()) + sal_Int16(0x0040)), sal_Int16(0x00ff))));
1197  pWrite->SetLineColor(aLightColor);
1198  pWrite->DrawLine(Point(1, 1), Point(1, nHeight - 2));
1199  pWrite->DrawLine(Point(2, 1), Point(nWidth - 2, 1));
1200 
1201  // draw darker LowerRight
1202  const Color aDarkColor(
1203  static_cast<sal_uInt8>(::std::max(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetRed()) - sal_Int16(0x0040)), sal_Int16(0x0000))),
1204  static_cast<sal_uInt8>(::std::max(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetGreen()) - sal_Int16(0x0040)), sal_Int16(0x0000))),
1205  static_cast<sal_uInt8>(::std::max(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetBlue()) - sal_Int16(0x0040)), sal_Int16(0x0000))));
1206  pWrite->SetLineColor(aDarkColor);
1207  pWrite->DrawLine(Point(2, nHeight - 2), Point(nWidth - 2, nHeight - 2));
1208  pWrite->DrawLine(Point(nWidth - 2, 2), Point(nWidth - 2, nHeight - 3));
1209 
1210  return pWrite->GetBitmapEx(Point(0,0), aMarkerSize);
1211 }
1212 
1214 {
1215  sal_uInt8 aLum = rCol.GetLuminance();
1216  Color aRetval(aLum, aLum, aLum);
1217  return aRetval;
1218 }
1219 
1220 void SdrHdlColor::SetColor(Color aNew, bool bCallLink)
1221 {
1222  if(IsUseLuminance())
1223  aNew = GetLuminance(aNew);
1224 
1225  if(aMarkerColor != aNew)
1226  {
1227  // remember new color
1228  aMarkerColor = aNew;
1229 
1230  // create new display
1231  Touch();
1232 
1233  // tell about change
1234  if(bCallLink)
1235  aColorChangeHdl.Call(this);
1236  }
1237 }
1238 
1239 void SdrHdlColor::SetSize(const Size& rNew)
1240 {
1241  if(rNew != aMarkerSize)
1242  {
1243  // remember new size
1244  aMarkerSize = rNew;
1245 
1246  // create new display
1247  Touch();
1248  }
1249 }
1250 
1251 SdrHdlGradient::SdrHdlGradient(const Point& rRef1, const Point& rRef2, bool bGrad)
1252  : SdrHdl(rRef1, bGrad ? SdrHdlKind::Gradient : SdrHdlKind::Transparence)
1253  , pColHdl1(nullptr)
1254  , pColHdl2(nullptr)
1255  , a2ndPos(rRef2)
1256  , bGradient(bGrad)
1257  , bMoveSingleHandle(false)
1258  , bMoveFirstHandle(false)
1259 {
1260 }
1261 
1263 {
1264 }
1265 
1266 void SdrHdlGradient::Set2ndPos(const Point& rPnt)
1267 {
1268  if(a2ndPos != rPnt)
1269  {
1270  // remember new position
1271  a2ndPos = rPnt;
1272 
1273  // create new display
1274  Touch();
1275  }
1276 }
1277 
1279 {
1280  // first throw away old one
1281  GetRidOfIAObject();
1282 
1283  if(!pHdlList)
1284  return;
1285 
1286  SdrMarkView* pView = pHdlList->GetView();
1287 
1288  if(!pView || pView->areMarkHandlesHidden())
1289  return;
1290 
1291  SdrPageView* pPageView = pView->GetSdrPageView();
1292 
1293  if(!pPageView)
1294  return;
1295 
1296  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1297  {
1298  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1299 
1300  if(rPageWindow.GetPaintWindow().OutputToWindow())
1301  {
1302  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
1303  if (xManager.is())
1304  {
1305  // striped line in between
1306  basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
1307  double fVecLen = aVec.getLength();
1308  double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
1309  double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
1310  aVec.normalize();
1311  basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
1312  sal_Int32 nMidX = static_cast<sal_Int32>(aPos.X() + aVec.getX() * fLongPercentArrow);
1313  sal_Int32 nMidY = static_cast<sal_Int32>(aPos.Y() + aVec.getY() * fLongPercentArrow);
1314  Point aMidPoint(nMidX, nMidY);
1315 
1316  basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1317  basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
1318 
1319  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
1321  aPosition, aMidPos
1322  ));
1323 
1324  pNewOverlayObject->setBaseColor(IsGradient() ? COL_BLACK : COL_BLUE);
1325 
1326  // OVERLAYMANAGER
1328  std::move(pNewOverlayObject),
1329  rPageWindow.GetObjectContact(),
1330  *xManager);
1331 
1332  // arrowhead
1333  Point aLeft(aMidPoint.X() + static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
1334  aMidPoint.Y() + static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
1335  Point aRight(aMidPoint.X() - static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
1336  aMidPoint.Y() - static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
1337 
1338  basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
1339  basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
1340  basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
1341 
1342  pNewOverlayObject.reset(new
1344  aPositionLeft,
1345  aPosition2,
1346  aPositionRight,
1347  IsGradient() ? COL_BLACK : COL_BLUE
1348  ));
1349 
1350  // OVERLAYMANAGER
1352  std::move(pNewOverlayObject),
1353  rPageWindow.GetObjectContact(),
1354  *xManager);
1355  }
1356  }
1357  }
1358 }
1359 
1361 {
1362  if(GetObj())
1363  FromIAOToItem(GetObj(), true, true);
1364 }
1365 
1366 void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, bool bSetItemOnObject, bool bUndo)
1367 {
1368  // from IAO positions and colors to gradient
1369  const SfxItemSet& rSet = _pObj->GetMergedItemSet();
1370 
1371  GradTransGradient aOldGradTransGradient;
1372  GradTransGradient aGradTransGradient;
1373  GradTransVector aGradTransVector;
1374 
1375  aGradTransVector.maPositionA = basegfx::B2DPoint(GetPos().X(), GetPos().Y());
1376  aGradTransVector.maPositionB = basegfx::B2DPoint(Get2ndPos().X(), Get2ndPos().Y());
1377  if(pColHdl1)
1378  aGradTransVector.aCol1 = pColHdl1->GetColor();
1379  if(pColHdl2)
1380  aGradTransVector.aCol2 = pColHdl2->GetColor();
1381 
1382  if(IsGradient())
1383  aOldGradTransGradient.aGradient = rSet.Get(XATTR_FILLGRADIENT).GetGradientValue();
1384  else
1385  aOldGradTransGradient.aGradient = rSet.Get(XATTR_FILLFLOATTRANSPARENCE).GetGradientValue();
1386 
1387  // transform vector data to gradient
1388  GradTransformer::VecToGrad(aGradTransVector, aGradTransGradient, aOldGradTransGradient, _pObj, bMoveSingleHandle, bMoveFirstHandle);
1389 
1390  if(bSetItemOnObject)
1391  {
1392  SdrModel& rModel(_pObj->getSdrModelFromSdrObject());
1393  SfxItemSet aNewSet(rModel.GetItemPool());
1394  const OUString aString;
1395 
1396  if(IsGradient())
1397  {
1398  XFillGradientItem aNewGradItem(aString, aGradTransGradient.aGradient);
1399  aNewSet.Put(aNewGradItem);
1400  }
1401  else
1402  {
1403  XFillFloatTransparenceItem aNewTransItem(aString, aGradTransGradient.aGradient);
1404  aNewSet.Put(aNewTransItem);
1405  }
1406 
1407  if(bUndo && rModel.IsUndoEnabled())
1408  {
1409  rModel.BegUndo(SvxResId(IsGradient() ? SIP_XA_FILLGRADIENT : SIP_XA_FILLTRANSPARENCE));
1410  rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoAttrObject(*_pObj));
1411  rModel.EndUndo();
1412  }
1413 
1415  }
1416 
1417  // back transformation, set values on pIAOHandle
1418  GradTransformer::GradToVec(aGradTransGradient, aGradTransVector, _pObj);
1419 
1420  SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1421  Set2ndPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1422  if(pColHdl1)
1423  {
1424  pColHdl1->SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1425  pColHdl1->SetColor(aGradTransVector.aCol1);
1426  }
1427  if(pColHdl2)
1428  {
1429  pColHdl2->SetPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1430  pColHdl2->SetColor(aGradTransVector.aCol2);
1431  }
1432 }
1433 
1434 
1436 
1438 {
1439  // first throw away old one
1440  GetRidOfIAObject();
1441 
1442  if(!pHdlList)
1443  return;
1444 
1445  SdrMarkView* pView = pHdlList->GetView();
1446 
1447  if(!(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2))
1448  return;
1449 
1450  SdrPageView* pPageView = pView->GetSdrPageView();
1451 
1452  if(!pPageView)
1453  return;
1454 
1455  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1456  {
1457  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1458 
1459  if(rPageWindow.GetPaintWindow().OutputToWindow())
1460  {
1461  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
1462  if (xManager.is())
1463  {
1464  basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1465  basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
1466 
1467  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
1469  aPosition1,
1470  aPosition2
1471  ));
1472 
1473  // color(?)
1474  pNewOverlayObject->setBaseColor(COL_LIGHTRED);
1475 
1476  // OVERLAYMANAGER
1478  std::move(pNewOverlayObject),
1479  rPageWindow.GetObjectContact(),
1480  *xManager);
1481  }
1482  }
1483  }
1484 }
1485 
1487 {
1488  return PointerStyle::RefHand;
1489 }
1490 
1491 
1493 
1495 {
1496  // call parent
1498 
1499  // create lines
1500  if(!pHdlList)
1501  return;
1502 
1503  SdrMarkView* pView = pHdlList->GetView();
1504 
1505  if(!pView || pView->areMarkHandlesHidden())
1506  return;
1507 
1508  SdrPageView* pPageView = pView->GetSdrPageView();
1509 
1510  if(!pPageView)
1511  return;
1512 
1513  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1514  {
1515  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1516 
1517  if(rPageWindow.GetPaintWindow().OutputToWindow())
1518  {
1519  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
1520  if (xManager.is())
1521  {
1522  basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1523  basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
1524 
1525  if(!aPosition1.equal(aPosition2))
1526  {
1527  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
1529  aPosition1,
1530  aPosition2
1531  ));
1532 
1533  // line part is not hittable
1534  pNewOverlayObject->setHittable(false);
1535 
1536  // color(?)
1537  pNewOverlayObject->setBaseColor(COL_LIGHTBLUE);
1538 
1539  // OVERLAYMANAGER
1541  std::move(pNewOverlayObject),
1542  rPageWindow.GetObjectContact(),
1543  *xManager);
1544  }
1545  }
1546  }
1547  }
1548 }
1549 
1550 
1552 {
1553  aWireframePoly = rWireframePoly;
1554 }
1555 
1557 {
1558  // create lines
1559  if(!pHdlList)
1560  return;
1561 
1562  SdrMarkView* pView = pHdlList->GetView();
1563 
1564  if(!pView || pView->areMarkHandlesHidden())
1565  return;
1566 
1567  SdrPageView* pPageView = pView->GetSdrPageView();
1568 
1569  if(!pPageView)
1570  return;
1571 
1572  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1573  {
1574  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1575 
1576  if(rPageWindow.GetPaintWindow().OutputToWindow())
1577  {
1578  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
1579  if (xManager.is() && aWireframePoly.count())
1580  {
1581  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
1583  aWireframePoly));
1584 
1585  pNewOverlayObject->setBaseColor(COL_BLACK);
1586 
1587  // OVERLAYMANAGER
1589  std::move(pNewOverlayObject),
1590  rPageWindow.GetObjectContact(),
1591  *xManager);
1592  }
1593  }
1594  }
1595 }
1596 
1597 
1599 {
1600 }
1601 
1603 {
1604  if(nObjHdlNum <= 1 && pObj)
1605  {
1606  // first throw away old one
1607  GetRidOfIAObject();
1608 
1611 
1612  if(pHdlList)
1613  {
1614  SdrMarkView* pView = pHdlList->GetView();
1615 
1616  if(pView && !pView->areMarkHandlesHidden())
1617  {
1618  const SdrEdgeObj* pEdge = static_cast<SdrEdgeObj*>(pObj);
1619 
1620  if(pEdge->GetConnectedNode(nObjHdlNum == 0) != nullptr)
1621  eColIndex = BitmapColorIndex::LightRed;
1622 
1623  if(nPPntNum < 2)
1624  {
1625  // Handle with plus sign inside
1626  eKindOfMarker = BitmapMarkerKind::Circ_7x7;
1627  }
1628 
1629  SdrPageView* pPageView = pView->GetSdrPageView();
1630 
1631  if(pPageView)
1632  {
1633  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1634  {
1635  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1636 
1637  if(rPageWindow.GetPaintWindow().OutputToWindow())
1638  {
1639  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
1640  if (xManager.is())
1641  {
1642  basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1643  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(CreateOverlayObject(
1644  aPosition,
1645  eColIndex,
1646  eKindOfMarker));
1647 
1648  // OVERLAYMANAGER
1650  std::move(pNewOverlayObject),
1651  rPageWindow.GetObjectContact(),
1652  *xManager);
1653  }
1654  }
1655  }
1656  }
1657  }
1658  }
1659  }
1660  else
1661  {
1662  // call parent
1664  }
1665 }
1666 
1668 {
1669  if(eLineCode != eCode)
1670  {
1671  // remember new value
1672  eLineCode = eCode;
1673 
1674  // create new display
1675  Touch();
1676  }
1677 }
1678 
1680 {
1681  SdrEdgeObj* pEdge=dynamic_cast<SdrEdgeObj*>( pObj );
1682  if (pEdge==nullptr)
1683  return SdrHdl::GetPointer();
1684  if (nObjHdlNum<=1)
1685  return PointerStyle::MovePoint;
1686  if (IsHorzDrag())
1687  return PointerStyle::ESize;
1688  else
1689  return PointerStyle::SSize;
1690 }
1691 
1693 {
1694  SdrEdgeObj* pEdge=dynamic_cast<SdrEdgeObj*>( pObj );
1695  if (pEdge==nullptr)
1696  return false;
1697  if (nObjHdlNum<=1)
1698  return false;
1699 
1700  SdrEdgeKind eEdgeKind = pEdge->GetObjectItem(SDRATTR_EDGEKIND).GetValue();
1701 
1702  const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
1703  if (eEdgeKind==SdrEdgeKind::OrthoLines || eEdgeKind==SdrEdgeKind::Bezier)
1704  {
1705  return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
1706  }
1707  else if (eEdgeKind==SdrEdgeKind::ThreeLines)
1708  {
1709  tools::Long nAngle=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
1710  return nAngle==0 || nAngle==18000;
1711  }
1712  return false;
1713 }
1714 
1715 
1717 {
1718 }
1719 
1721 {
1722  // first throw away old one
1723  GetRidOfIAObject();
1724 
1725  if(!pHdlList)
1726  return;
1727 
1728  SdrMarkView* pView = pHdlList->GetView();
1729 
1730  if(!pView || pView->areMarkHandlesHidden())
1731  return;
1732 
1735 
1736  if(nObjHdlNum > 1)
1737  {
1738  eKindOfMarker = BitmapMarkerKind::Rect_7x7;
1739  }
1740 
1741  if(bSelect)
1742  {
1743  eColIndex = BitmapColorIndex::Cyan;
1744  }
1745 
1746  SdrPageView* pPageView = pView->GetSdrPageView();
1747 
1748  if(!pPageView)
1749  return;
1750 
1751  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1752  {
1753  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1754 
1755  if(rPageWindow.GetPaintWindow().OutputToWindow())
1756  {
1757  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
1758  if (xManager.is())
1759  {
1760  basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1761  std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(CreateOverlayObject(
1762  aPosition,
1763  eColIndex,
1764  eKindOfMarker));
1765 
1766  // OVERLAYMANAGER
1768  std::move(pNewOverlayObject),
1769  rPageWindow.GetObjectContact(),
1770  *xManager);
1771  }
1772  }
1773  }
1774 }
1775 
1777 {
1778  switch (nObjHdlNum)
1779  {
1780  case 0: case 1: return PointerStyle::Hand;
1781  case 2: case 3: return PointerStyle::MovePoint;
1782  case 4: case 5: return SdrHdl::GetPointer(); // will then be rotated appropriately
1783  } // switch
1784  return PointerStyle::NotAllowed;
1785 }
1786 
1787 
1789  SdrHdl(rRect.TopLeft(),SdrHdlKind::Move),
1790  maRect(rRect)
1791 {
1792 }
1793 
1795 {
1796  // first throw away old one
1797  GetRidOfIAObject();
1798 
1799  if(!pHdlList)
1800  return;
1801 
1802  SdrMarkView* pView = pHdlList->GetView();
1803 
1804  if(!pView || pView->areMarkHandlesHidden())
1805  return;
1806 
1807  SdrPageView* pPageView = pView->GetSdrPageView();
1808 
1809  if(!pPageView)
1810  return;
1811 
1812  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1813  {
1814  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1815 
1816  if(rPageWindow.GetPaintWindow().OutputToWindow())
1817  {
1818  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
1819  if (xManager.is())
1820  {
1821  const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
1822  const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
1823  const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
1824  const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
1825  const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
1826 
1827  std::unique_ptr<sdr::overlay::OverlayRectangle> pNewOverlayObject(new sdr::overlay::OverlayRectangle(
1828  aTopLeft,
1829  aBottomRight,
1830  aHilightColor,
1831  fTransparence,
1832  3.0,
1833  3.0,
1835  true)); // allow animation; the Handle is not shown at text edit time
1836 
1837  pNewOverlayObject->setHittable(false);
1838 
1839  // OVERLAYMANAGER
1841  std::move(pNewOverlayObject),
1842  rPageWindow.GetObjectContact(),
1843  *xManager);
1844  }
1845  }
1846  }
1847 }
1848 
1849 
1850 static bool ImpSdrHdlListSorter(std::unique_ptr<SdrHdl> const& lhs, std::unique_ptr<SdrHdl> const& rhs)
1851 {
1852  SdrHdlKind eKind1=lhs->GetKind();
1853  SdrHdlKind eKind2=rhs->GetKind();
1854  // Level 1: first normal handles, then Glue, then User, then Plus handles, then reference point handles
1855  unsigned n1=1;
1856  unsigned n2=1;
1857  if (eKind1!=eKind2)
1858  {
1859  if (eKind1==SdrHdlKind::Ref1 || eKind1==SdrHdlKind::Ref2 || eKind1==SdrHdlKind::MirrorAxis) n1=5;
1860  else if (eKind1==SdrHdlKind::Glue) n1=2;
1861  else if (eKind1==SdrHdlKind::User) n1=3;
1862  else if (eKind1==SdrHdlKind::SmartTag) n1=0;
1863  if (eKind2==SdrHdlKind::Ref1 || eKind2==SdrHdlKind::Ref2 || eKind2==SdrHdlKind::MirrorAxis) n2=5;
1864  else if (eKind2==SdrHdlKind::Glue) n2=2;
1865  else if (eKind2==SdrHdlKind::User) n2=3;
1866  else if (eKind2==SdrHdlKind::SmartTag) n2=0;
1867  }
1868  if (lhs->IsPlusHdl()) n1=4;
1869  if (rhs->IsPlusHdl()) n2=4;
1870  if (n1==n2)
1871  {
1872  // Level 2: PageView (Pointer)
1873  SdrPageView* pPV1=lhs->GetPageView();
1874  SdrPageView* pPV2=rhs->GetPageView();
1875  if (pPV1==pPV2)
1876  {
1877  // Level 3: Position (x+y)
1878  SdrObject* pObj1=lhs->GetObj();
1879  SdrObject* pObj2=rhs->GetObj();
1880  if (pObj1==pObj2)
1881  {
1882  sal_uInt32 nNum1=lhs->GetObjHdlNum();
1883  sal_uInt32 nNum2=rhs->GetObjHdlNum();
1884  if (nNum1==nNum2)
1885  {
1886  if (eKind1==eKind2)
1887  return lhs<rhs; // Hack, to always get to the same sorting
1888  return static_cast<sal_uInt16>(eKind1)<static_cast<sal_uInt16>(eKind2);
1889  }
1890  else
1891  return nNum1<nNum2;
1892  }
1893  else
1894  {
1895  return pObj1<pObj2;
1896  }
1897  }
1898  else
1899  {
1900  return pPV1<pPV2;
1901  }
1902  }
1903  else
1904  {
1905  return n1<n2;
1906  }
1907 }
1908 
1909 namespace {
1910 
1911 // Helper struct for re-sorting handles
1912 struct ImplHdlAndIndex
1913 {
1914  SdrHdl* mpHdl;
1915  sal_uInt32 mnIndex;
1916 };
1917 
1918 }
1919 
1920 extern "C" {
1921 
1922 // Helper method for sorting handles taking care of OrdNums, keeping order in
1923 // single objects and re-sorting polygon handles intuitively
1924 static int ImplSortHdlFunc( const void* pVoid1, const void* pVoid2 )
1925 {
1926  const ImplHdlAndIndex* p1 = static_cast<ImplHdlAndIndex const *>(pVoid1);
1927  const ImplHdlAndIndex* p2 = static_cast<ImplHdlAndIndex const *>(pVoid2);
1928 
1929  if(p1->mpHdl->GetObj() == p2->mpHdl->GetObj())
1930  {
1931  if(p1->mpHdl->GetObj() && dynamic_cast<const SdrPathObj*>(p1->mpHdl->GetObj()) != nullptr)
1932  {
1933  // same object and a path object
1934  if((p1->mpHdl->GetKind() == SdrHdlKind::Poly || p1->mpHdl->GetKind() == SdrHdlKind::BezierWeight)
1935  && (p2->mpHdl->GetKind() == SdrHdlKind::Poly || p2->mpHdl->GetKind() == SdrHdlKind::BezierWeight))
1936  {
1937  // both handles are point or control handles
1938  if(p1->mpHdl->GetPolyNum() == p2->mpHdl->GetPolyNum())
1939  {
1940  if(p1->mpHdl->GetPointNum() < p2->mpHdl->GetPointNum())
1941  {
1942  return -1;
1943  }
1944  else
1945  {
1946  return 1;
1947  }
1948  }
1949  else if(p1->mpHdl->GetPolyNum() < p2->mpHdl->GetPolyNum())
1950  {
1951  return -1;
1952  }
1953  else
1954  {
1955  return 1;
1956  }
1957  }
1958  }
1959  }
1960  else
1961  {
1962  if(!p1->mpHdl->GetObj())
1963  {
1964  return -1;
1965  }
1966  else if(!p2->mpHdl->GetObj())
1967  {
1968  return 1;
1969  }
1970  else
1971  {
1972  // different objects, use OrdNum for sort
1973  const sal_uInt32 nOrdNum1 = p1->mpHdl->GetObj()->GetOrdNum();
1974  const sal_uInt32 nOrdNum2 = p2->mpHdl->GetObj()->GetOrdNum();
1975 
1976  if(nOrdNum1 < nOrdNum2)
1977  {
1978  return -1;
1979  }
1980  else
1981  {
1982  return 1;
1983  }
1984  }
1985  }
1986 
1987  // fallback to indices
1988  if(p1->mnIndex < p2->mnIndex)
1989  {
1990  return -1;
1991  }
1992  else
1993  {
1994  return 1;
1995  }
1996 }
1997 
1998 }
1999 
2000 void SdrHdlList::TravelFocusHdl(bool bForward)
2001 {
2002  // security correction
2003  if (mnFocusIndex >= GetHdlCount())
2004  mnFocusIndex = SAL_MAX_SIZE;
2005 
2006  if(maList.empty())
2007  return;
2008 
2009  // take care of old handle
2010  const size_t nOldHdlNum(mnFocusIndex);
2011  SdrHdl* pOld = nullptr;
2012  if (nOldHdlNum < GetHdlCount())
2013  pOld = GetHdl(nOldHdlNum);
2014 
2015  if(pOld)
2016  {
2017  // switch off old handle
2018  mnFocusIndex = SAL_MAX_SIZE;
2019  pOld->Touch();
2020  }
2021 
2022  // allocate pointer array for sorted handle list
2023  std::unique_ptr<ImplHdlAndIndex[]> pHdlAndIndex(new ImplHdlAndIndex[maList.size()]);
2024 
2025  // build sorted handle list
2026  for( size_t a = 0; a < maList.size(); ++a)
2027  {
2028  pHdlAndIndex[a].mpHdl = maList[a].get();
2029  pHdlAndIndex[a].mnIndex = a;
2030  }
2031 
2032  qsort(pHdlAndIndex.get(), maList.size(), sizeof(ImplHdlAndIndex), ImplSortHdlFunc);
2033 
2034  // look for old num in sorted array
2035  size_t nOldHdl(nOldHdlNum);
2036 
2037  if(nOldHdlNum != SAL_MAX_SIZE)
2038  {
2039  for(size_t a = 0; a < maList.size(); ++a)
2040  {
2041  if(pHdlAndIndex[a].mpHdl == pOld)
2042  {
2043  nOldHdl = a;
2044  break;
2045  }
2046  }
2047  }
2048 
2049  // build new HdlNum
2050  size_t nNewHdl(nOldHdl);
2051 
2052  // do the focus travel
2053  if(bForward)
2054  {
2055  if(nOldHdl != SAL_MAX_SIZE)
2056  {
2057  if(nOldHdl == maList.size() - 1)
2058  {
2059  // end forward run
2060  nNewHdl = SAL_MAX_SIZE;
2061  }
2062  else
2063  {
2064  // simply the next handle
2065  nNewHdl++;
2066  }
2067  }
2068  else
2069  {
2070  // start forward run at first entry
2071  nNewHdl = 0;
2072  }
2073  }
2074  else
2075  {
2076  if(nOldHdl == SAL_MAX_SIZE)
2077  {
2078  // start backward run at last entry
2079  nNewHdl = maList.size() - 1;
2080 
2081  }
2082  else
2083  {
2084  if(nOldHdl == 0)
2085  {
2086  // end backward run
2087  nNewHdl = SAL_MAX_SIZE;
2088  }
2089  else
2090  {
2091  // simply the previous handle
2092  nNewHdl--;
2093  }
2094  }
2095  }
2096 
2097  // build new HdlNum
2098  sal_uIntPtr nNewHdlNum(nNewHdl);
2099 
2100  // look for old num in sorted array
2101  if(nNewHdl != SAL_MAX_SIZE)
2102  {
2103  SdrHdl* pNew = pHdlAndIndex[nNewHdl].mpHdl;
2104 
2105  for(size_t a = 0; a < maList.size(); ++a)
2106  {
2107  if(maList[a].get() == pNew)
2108  {
2109  nNewHdlNum = a;
2110  break;
2111  }
2112  }
2113  }
2114 
2115  // take care of next handle
2116  if(nOldHdlNum != nNewHdlNum)
2117  {
2118  mnFocusIndex = nNewHdlNum;
2119  if (mnFocusIndex < GetHdlCount())
2120  {
2121  SdrHdl* pNew = GetHdl(mnFocusIndex);
2122  pNew->Touch();
2123  }
2124  }
2125 }
2126 
2128 {
2129  if(mnFocusIndex < GetHdlCount())
2130  return GetHdl(mnFocusIndex);
2131  else
2132  return nullptr;
2133 }
2134 
2136 {
2137  if(!pNew)
2138  return;
2139 
2140  SdrHdl* pActual = GetFocusHdl();
2141 
2142  if(pActual && pActual == pNew)
2143  return;
2144 
2145  const size_t nNewHdlNum = GetHdlNum(pNew);
2146 
2147  if(nNewHdlNum != SAL_MAX_SIZE)
2148  {
2149  mnFocusIndex = nNewHdlNum;
2150 
2151  if(pActual)
2152  {
2153  pActual->Touch();
2154  }
2155 
2156  pNew->Touch();
2157  }
2158 }
2159 
2161 {
2162  SdrHdl* pHdl = GetFocusHdl();
2163 
2164  mnFocusIndex = SAL_MAX_SIZE;
2165 
2166  if(pHdl)
2167  {
2168  pHdl->Touch();
2169  }
2170 }
2171 
2172 
2174 : mnFocusIndex(SAL_MAX_SIZE),
2175  pView(pV)
2176 {
2177  nHdlSize = 3;
2178  bRotateShear = false;
2179  bMoveOutside = false;
2180  bDistortShear = false;
2181 }
2182 
2184 {
2185  Clear();
2186 }
2187 
2188 void SdrHdlList::SetHdlSize(sal_uInt16 nSiz)
2189 {
2190  if(nHdlSize != nSiz)
2191  {
2192  // remember new value
2193  nHdlSize = nSiz;
2194 
2195  // propagate change to IAOs
2196  for(size_t i=0; i<GetHdlCount(); ++i)
2197  {
2198  SdrHdl* pHdl = GetHdl(i);
2199  pHdl->Touch();
2200  }
2201  }
2202 }
2203 
2205 {
2206  if(bMoveOutside != bOn)
2207  {
2208  // remember new value
2209  bMoveOutside = bOn;
2210 
2211  // propagate change to IAOs
2212  for(size_t i=0; i<GetHdlCount(); ++i)
2213  {
2214  SdrHdl* pHdl = GetHdl(i);
2215  pHdl->Touch();
2216  }
2217  }
2218 }
2219 
2221 {
2222  bRotateShear = bOn;
2223 }
2224 
2226 {
2227  bDistortShear = bOn;
2228 }
2229 
2230 std::unique_ptr<SdrHdl> SdrHdlList::RemoveHdl(size_t nNum)
2231 {
2232  std::unique_ptr<SdrHdl> pRetval = std::move(maList[nNum]);
2233  maList.erase(maList.begin() + nNum);
2234 
2235  return pRetval;
2236 }
2237 
2239 {
2240  maList.erase(std::remove_if(maList.begin(), maList.end(),
2241  [&eKind](std::unique_ptr<SdrHdl>& rItem) { return rItem->GetKind() == eKind; }),
2242  maList.end());
2243 }
2244 
2246 {
2247  maList.clear();
2248 
2249  bRotateShear=false;
2250  bDistortShear=false;
2251 }
2252 
2254 {
2255  // remember currently focused handle
2256  SdrHdl* pPrev = GetFocusHdl();
2257 
2258  std::sort( maList.begin(), maList.end(), ImpSdrHdlListSorter );
2259 
2260  // get now and compare
2261  SdrHdl* pNow = GetFocusHdl();
2262 
2263  if(pPrev == pNow)
2264  return;
2265 
2266  if(pPrev)
2267  {
2268  pPrev->Touch();
2269  }
2270 
2271  if(pNow)
2272  {
2273  pNow->Touch();
2274  }
2275 }
2276 
2277 size_t SdrHdlList::GetHdlNum(const SdrHdl* pHdl) const
2278 {
2279  if (pHdl==nullptr)
2280  return SAL_MAX_SIZE;
2281  auto it = std::find_if( maList.begin(), maList.end(),
2282  [&](const std::unique_ptr<SdrHdl> & p) { return p.get() == pHdl; });
2283  assert(it != maList.end());
2284  if( it == maList.end() )
2285  return SAL_MAX_SIZE;
2286  return it - maList.begin();
2287 }
2288 
2289 void SdrHdlList::AddHdl(std::unique_ptr<SdrHdl> pHdl)
2290 {
2291  assert(pHdl);
2292  pHdl->SetHdlList(this);
2293  maList.push_back(std::move(pHdl));
2294 }
2295 
2296 SdrHdl* SdrHdlList::IsHdlListHit(const Point& rPnt) const
2297 {
2298  SdrHdl* pRet=nullptr;
2299  const size_t nCount=GetHdlCount();
2300  size_t nNum=nCount;
2301  while (nNum>0 && pRet==nullptr)
2302  {
2303  nNum--;
2304  SdrHdl* pHdl=GetHdl(nNum);
2305  if (pHdl->IsHdlHit(rPnt))
2306  pRet=pHdl;
2307  }
2308  return pRet;
2309 }
2310 
2312 {
2313  SdrHdl* pRet=nullptr;
2314  for (size_t i=0; i<GetHdlCount() && pRet==nullptr; ++i)
2315  {
2316  SdrHdl* pHdl=GetHdl(i);
2317  if (pHdl->GetKind()==eKind1)
2318  pRet=pHdl;
2319  }
2320  return pRet;
2321 }
2322 
2324 {
2325  for (auto & pHdl : maList)
2326  pHdl->SetHdlList(&rOther);
2327  rOther.maList.insert(rOther.maList.end(),
2328  std::make_move_iterator(maList.begin()), std::make_move_iterator(maList.end()));
2329  maList.clear();
2330 }
2331 
2333  const Point& rPnt,
2334  SdrHdlKind eNewKind,
2335  double fShearX,
2336  double fRotation)
2337 : SdrHdl(rPnt, eNewKind),
2338  mfShearX(fShearX),
2339  mfRotation(fRotation)
2340 {
2341 }
2342 
2343 
2345 {
2346  int nPixelSize = 0, nX = 0, nY = 0, nOffset = 0;
2347 
2348  if( nSize <= 3 )
2349  {
2350  nPixelSize = 13;
2351  nOffset = 0;
2352  }
2353  else if( nSize <=4 )
2354  {
2355  nPixelSize = 17;
2356  nOffset = 39;
2357  }
2358  else
2359  {
2360  nPixelSize = 21;
2361  nOffset = 90;
2362  }
2363 
2364  switch( eKind )
2365  {
2366  case SdrHdlKind::UpperLeft: nX = 0; nY = 0; break;
2367  case SdrHdlKind::Upper: nX = 1; nY = 0; break;
2368  case SdrHdlKind::UpperRight: nX = 2; nY = 0; break;
2369  case SdrHdlKind::Left: nX = 0; nY = 1; break;
2370  case SdrHdlKind::Right: nX = 2; nY = 1; break;
2371  case SdrHdlKind::LowerLeft: nX = 0; nY = 2; break;
2372  case SdrHdlKind::Lower: nX = 1; nY = 2; break;
2373  case SdrHdlKind::LowerRight: nX = 2; nY = 2; break;
2374  default: break;
2375  }
2376 
2377  tools::Rectangle aSourceRect( Point( nX * nPixelSize + nOffset, nY * nPixelSize), Size(nPixelSize, nPixelSize) );
2378 
2379  BitmapEx aRetval(rBitmap);
2380  aRetval.Crop(aSourceRect);
2381  return aRetval;
2382 }
2383 
2384 
2386 {
2387  // first throw away old one
2388  GetRidOfIAObject();
2389 
2390  SdrMarkView* pView = pHdlList ? pHdlList->GetView() : nullptr;
2391  SdrPageView* pPageView = pView ? pView->GetSdrPageView() : nullptr;
2392 
2393  if( !pPageView || pView->areMarkHandlesHidden() )
2394  return;
2395 
2396  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2397  int nHdlSize = pHdlList->GetHdlSize();
2398 
2399  const BitmapEx aHandlesBitmap(SIP_SA_CROP_MARKERS);
2400  BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
2401 
2402  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
2403  {
2404  const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
2405 
2406  if(rPageWindow.GetPaintWindow().OutputToWindow())
2407  {
2408  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
2409  if (xManager.is())
2410  {
2411  basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
2412 
2413  std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject;
2414 
2415  // animate focused handles
2416  if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
2417  {
2418  if( nHdlSize >= 2 )
2419  nHdlSize = 1;
2420 
2421  BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
2422 
2423  const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime();
2424 
2425  pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx(
2426  aPosition,
2427  aBmpEx1,
2428  aBmpEx2,
2429  nBlinkTime,
2430  static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2431  static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2432  static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
2433  static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1,
2434  mfShearX,
2435  mfRotation));
2436  }
2437  else
2438  {
2439  // create centered handle as default
2440  pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx(
2441  aPosition,
2442  aBmpEx1,
2443  static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2444  static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2445  0.0,
2446  mfShearX,
2447  mfRotation));
2448  }
2449 
2450  // OVERLAYMANAGER
2452  std::move(pOverlayObject),
2453  rPageWindow.GetObjectContact(),
2454  *xManager);
2455  }
2456  }
2457  }
2458 }
2459 
2460 
2461 // with the correction of crop handling I could get rid of the extra mirroring flag, adapted stuff
2462 // accordingly
2463 
2465  const basegfx::B2DHomMatrix& rObjectTransform,
2466  const Graphic& rGraphic,
2467  double fCropLeft,
2468  double fCropTop,
2469  double fCropRight,
2470  double fCropBottom)
2471 : SdrHdl(Point(), SdrHdlKind::User),
2472  maObjectTransform(rObjectTransform),
2473  maGraphic(rGraphic),
2474  mfCropLeft(fCropLeft),
2475  mfCropTop(fCropTop),
2476  mfCropRight(fCropRight),
2477  mfCropBottom(fCropBottom)
2478 {
2479 }
2480 
2481 namespace {
2482 
2483 void translateRotationToMirroring(basegfx::B2DVector & scale, double * rotate) {
2484  assert(rotate != nullptr);
2485 
2486  // detect 180 degree rotation, this is the same as mirrored in X and Y,
2487  // thus change to mirroring. Prefer mirroring here. Use the equal call
2488  // with getSmallValue here, the original which uses rtl::math::approxEqual
2489  // is too correct here. Maybe this changes with enhanced precision in aw080
2490  // to the better so that this can be reduced to the more precise call again
2491  if(basegfx::fTools::equal(fabs(*rotate), F_PI, 0.000000001))
2492  {
2493  scale.setX(scale.getX() * -1.0);
2494  scale.setY(scale.getY() * -1.0);
2495  *rotate = 0.0;
2496  }
2497 }
2498 
2499 }
2500 
2502 {
2503  GetRidOfIAObject();
2504  SdrMarkView* pView = pHdlList ? pHdlList->GetView() : nullptr;
2505  SdrPageView* pPageView = pView ? pView->GetSdrPageView() : nullptr;
2506 
2507  if(!pPageView || pView->areMarkHandlesHidden())
2508  {
2509  return;
2510  }
2511 
2512  // decompose to have current translate and scale
2513  basegfx::B2DVector aScale, aTranslate;
2514  double fRotate, fShearX;
2515 
2516  maObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX);
2517 
2518  if(aScale.equalZero())
2519  {
2520  return;
2521  }
2522 
2523  translateRotationToMirroring(aScale, &fRotate);
2524 
2525  // remember mirroring, reset at Scale and adapt crop values for usage;
2526  // mirroring can stay in the object transformation, so do not have to
2527  // cope with it here (except later for the CroppedImage transformation,
2528  // see below)
2529  const bool bMirroredX(aScale.getX() < 0.0);
2530  const bool bMirroredY(aScale.getY() < 0.0);
2531  double fCropLeft(mfCropLeft);
2532  double fCropTop(mfCropTop);
2533  double fCropRight(mfCropRight);
2534  double fCropBottom(mfCropBottom);
2535 
2536  if(bMirroredX)
2537  {
2538  aScale.setX(-aScale.getX());
2539  }
2540 
2541  if(bMirroredY)
2542  {
2543  aScale.setY(-aScale.getY());
2544  }
2545 
2546  // create target translate and scale
2547  const basegfx::B2DVector aTargetScale(
2548  aScale.getX() + fCropRight + fCropLeft,
2549  aScale.getY() + fCropBottom + fCropTop);
2550  const basegfx::B2DVector aTargetTranslate(
2551  aTranslate.getX() - fCropLeft,
2552  aTranslate.getY() - fCropTop);
2553 
2554  // create ranges to make comparisons
2555  const basegfx::B2DRange aCurrentForCompare(
2556  aTranslate.getX(), aTranslate.getY(),
2557  aTranslate.getX() + aScale.getX(), aTranslate.getY() + aScale.getY());
2558  basegfx::B2DRange aCropped(
2559  aTargetTranslate.getX(), aTargetTranslate.getY(),
2560  aTargetTranslate.getX() + aTargetScale.getX(), aTargetTranslate.getY() + aTargetScale.getY());
2561 
2562  if(aCropped.isEmpty())
2563  {
2564  // nothing to return since cropped content is completely empty
2565  return;
2566  }
2567 
2568  if(aCurrentForCompare.equal(aCropped))
2569  {
2570  // no crop at all
2571  return;
2572  }
2573 
2574  // back-transform to have values in unit coordinates
2575  basegfx::B2DHomMatrix aBackToUnit;
2576  aBackToUnit.translate(-aTranslate.getX(), -aTranslate.getY());
2577  aBackToUnit.scale(
2578  basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : 1.0 / aScale.getX(),
2579  basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : 1.0 / aScale.getY());
2580 
2581  // transform cropped back to unit coordinates
2582  aCropped.transform(aBackToUnit);
2583 
2584  // prepare crop PolyPolygon
2585  basegfx::B2DPolygon aGraphicOutlinePolygon(
2587  aCropped));
2588  basegfx::B2DPolyPolygon aCropPolyPolygon(aGraphicOutlinePolygon);
2589 
2590  // current range is unit range
2591  basegfx::B2DRange aOverlap(0.0, 0.0, 1.0, 1.0);
2592 
2593  aOverlap.intersect(aCropped);
2594 
2595  if(!aOverlap.isEmpty())
2596  {
2597  aCropPolyPolygon.append(
2599  aOverlap));
2600  }
2601 
2602  // transform to object coordinates to prepare for clip
2603  aCropPolyPolygon.transform(maObjectTransform);
2604  aGraphicOutlinePolygon.transform(maObjectTransform);
2605 
2606  // create cropped transformation
2607  basegfx::B2DHomMatrix aCroppedTransform;
2608 
2609  aCroppedTransform.scale(
2610  aCropped.getWidth(),
2611  aCropped.getHeight());
2612  aCroppedTransform.translate(
2613  aCropped.getMinX(),
2614  aCropped.getMinY());
2615  aCroppedTransform = maObjectTransform * aCroppedTransform;
2616 
2617  // prepare graphic primitive (transformed)
2620  aCroppedTransform,
2621  maGraphic));
2622 
2623  // prepare outline polygon for whole graphic
2624  const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
2625  const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
2628  aGraphicOutlinePolygon,
2629  aHilightColor));
2630 
2631  // combine these
2633  aCombination[0] = aGraphic;
2634  aCombination[1] = aGraphicOutline;
2635 
2636  // embed to MaskPrimitive2D
2639  aCropPolyPolygon,
2640  aCombination));
2641 
2642  // embed to UnifiedTransparencePrimitive2D
2643  const drawinglayer::primitive2d::Primitive2DReference aTransparenceMaskedGraphic(
2646  0.8));
2647 
2648  const drawinglayer::primitive2d::Primitive2DContainer aSequence { aTransparenceMaskedGraphic };
2649 
2650  for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
2651  {
2652  // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
2653  const SdrPageWindow& rPageWindow = *(pPageView->GetPageWindow(b));
2654 
2655  if(rPageWindow.GetPaintWindow().OutputToWindow())
2656  {
2657  const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
2658  if(xManager.is())
2659  {
2660  std::unique_ptr<sdr::overlay::OverlayObject> pNew(new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence));
2661 
2662  // only informative object, no hit
2663  pNew->setHittable(false);
2664 
2665  // OVERLAYMANAGER
2667  std::move(pNew),
2668  rPageWindow.GetObjectContact(),
2669  *xManager);
2670  }
2671  }
2672  }
2673 }
2674 
2675 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< SdrHdl > RemoveHdl(size_t nNum)
Definition: svdhdl.cxx:2230
BitmapEx GetBitmapForHandle(const BitmapEx &rBitmap, int nSize)
Definition: svdhdl.cxx:2344
rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const
SdrHdlKind eKind
Definition: svdhdl.hxx:144
SdrHdlGradient(const Point &rRef1, const Point &rRef2, bool bGrad)
Definition: svdhdl.cxx:1251
bool Erase(const Color &rFillColor)
void setX(double fX)
SdrHdl * pHdl2
Definition: svdhdl.hxx:346
size_t GetHdlNum(const SdrHdl *pHdl) const
Definition: svdhdl.cxx:2277
virtual void CreateB2dIAObject() override
Definition: svdhdl.cxx:1602
SdrHdlList * pHdlList
Definition: svdhdl.hxx:138
bool IsMoveOutside() const
Definition: svdhdl.hxx:467
XGradient aGradient
Definition: gradtrns.hxx:40
sal_uInt8 GetRed() const
void SetPos(const Point &rPnt)
Definition: svdhdl.cxx:341
virtual void CreateB2dIAObject() override
Definition: svdhdl.cxx:1437
SdrMarkView * GetView() const
Definition: svdhdl.hxx:455
void insertNewlyCreatedOverlayObjectForSdrHdl(std::unique_ptr< sdr::overlay::OverlayObject > pOverlayObject, const sdr::contact::ObjectContact &rObjectContact, sdr::overlay::OverlayManager &rOverlayManager)
Definition: svdhdl.cxx:1077
basegfx::B2DPoint maPositionB
Definition: gradtrns.hxx:32
void Set2ndPos(const Point &rPnt)
Definition: svdhdl.cxx:1266
double mfCropRight
Definition: svdhdl.hxx:517
static bool equal(const double &rfValA, const double &rfValB)
#define INDEX_COUNT
Definition: svdhdl.cxx:98
Size aMarkerSize
Definition: svdhdl.hxx:258
SdrHdlKind
Definition: svdhdl.hxx:52
int n1
constexpr::Color COL_RED(0x80, 0x00, 0x00)
double mfRotation
Definition: svdhdl.hxx:506
virtual ~ImpEdgeHdl() override
Definition: svdhdl.cxx:1598
Utility class SdrEdgeInfoRec.
Definition: svdoedge.hxx:74
long Long
virtual void calculateGridOffsetForViewOjectContact(basegfx::B2DVector &rTarget, const ViewObjectContact &rClient) const
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
sal_uInt8 GetLuminance() const
bool IsHorzDrag() const
Definition: svdhdl.cxx:1692
double getX() const
static void VecToGrad(GradTransVector const &rV, GradTransGradient &rG, GradTransGradient const &rGOld, const SdrObject *pObj, bool bMoveSingle, bool bMoveFirst)
Definition: gradtrns.cxx:182
bool bRotateShear
Definition: svdhdl.hxx:436
tools::Long nAngle2
Definition: svdoedge.hxx:88
virtual bool IsFocusHdl() const
Definition: svdhdl.cxx:1020
void SetSelected(bool bJa=true)
Definition: svdhdl.cxx:353
SdrEdgeInfoRec aEdgeInfo
Definition: svdoedge.hxx:146
SdrObject * pObj
Definition: svdhdl.hxx:136
double getY() const
SdrObject * GetObj() const
Definition: svdhdl.hxx:203
SdrCropViewHdl(const basegfx::B2DHomMatrix &rObjectTransform, const Graphic &rGraphic, double fCropLeft, double fCropTop, double fCropRight, double fCropBottom)
Definition: svdhdl.cxx:2464
void append(std::unique_ptr< OverlayObject > pOverlayObject)
basegfx::B2DPolyPolygon aWireframePoly
Definition: svdhdl.hxx:375
const Point & GetPos() const
Definition: svdhdl.hxx:197
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
bool IsUseLuminance() const
Definition: svdhdl.hxx:280
bool IsRotateShear() const
Definition: svdhdl.hxx:469
SdrHdlColor * pColHdl2
Definition: svdhdl.hxx:296
Graphic maGraphic
Definition: svdhdl.hxx:514
void ResetFocusHdl()
Definition: svdhdl.cxx:2160
virtual void CreateB2dIAObject() override
Definition: svdhdl.cxx:1278
virtual PointerStyle GetPointer() const
Definition: svdhdl.cxx:951
const Point & Get2ndPos() const
Definition: svdhdl.hxx:322
void add(OverlayObject &rOverlayObject)
static OutputDevice * GetDefaultDevice()
#define KIND_COUNT
Definition: svdhdl.cxx:97
constexpr TypedWhichId< SdrEdgeKindItem > SDRATTR_EDGEKIND(SDRATTR_EDGE_FIRST+0)
void SetBackground()
size_t mnFocusIndex
Definition: svdhdl.hxx:431
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
Definition: svdpagv.cxx:82
BitmapMarkerKind
Definition: svdhdl.hxx:95
tools::Long nAngle1
Definition: svdoedge.hxx:87
Degree100 nRotationAngle
Definition: svdhdl.hxx:146
int n2
tools::Long Left() const
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:25
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
const Color & GetColor() const
Definition: svdhdl.hxx:282
bool OutputToWindow() const
#define X
constexpr::Color COL_CYAN(0x00, 0x80, 0x80)
int nCount
IMPL_LINK_NOARG(SdrHdlGradient, ColorChangeHdl, SdrHdlColor *, void)
Definition: svdhdl.cxx:1360
tools::Long Bottom() const
SdrHdlColor(const Point &rRef, Color aCol, const Size &rSize, bool bLuminance)
Definition: svdhdl.cxx:1110
Degree100 NormAngle36000(Degree100 deg100)
Normalize angle to -180.00..179.99.
Definition: svdtrans.cxx:408
void Clear()
Definition: svdhdl.cxx:2245
void Touch()
Definition: svdhdl.cxx:389
sal_uInt16 GetHdlSize() const
Definition: svdhdl.hxx:465
virtual PointerStyle GetPointer() const override
Definition: svdhdl.cxx:1776
SdrEdgeLineCode
Definition: svdoedge.hxx:71
void DrawLine(const Point &rStartPt, const Point &rEndPt)
sal_uInt8 GetBlue() const
virtual PointerStyle GetPointer() const override
Definition: svdhdl.cxx:1486
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTRED
void SetDistortShear(bool bOn)
Definition: svdhdl.cxx:2225
bool ImpIsHorzLine(SdrEdgeLineCode eLineCode, const XPolygon &rXP) const
Definition: svdoedge.cxx:110
virtual void CreateB2dIAObject() override
Definition: svdhdl.cxx:1794
sal_uInt16 nHdlSize
Definition: svdhdl.hxx:434
SdrObject * GetConnectedNode(bool bTail1) const override
Definition: svdoedge.cxx:472
void Set1PixMore(bool bJa=true)
Definition: svdhdl.cxx:308
void SetHdlList(SdrHdlList *pList)
Definition: svdhdl.cxx:365
BitmapColorIndex
Definition: svdhdl.hxx:84
const tools::Rectangle maRect
Definition: svdhdl.hxx:418
SdrHdl * IsHdlListHit(const Point &rPnt) const
Definition: svdhdl.cxx:2296
void Sort()
Definition: svdhdl.cxx:2253
static int ImplSortHdlFunc(const void *pVoid1, const void *pVoid2)
Definition: svdhdl.cxx:1924
const SfxPoolItem & GetObjectItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1932
E3dVolumeMarker(const basegfx::B2DPolyPolygon &rWireframePoly)
Definition: svdhdl.cxx:1551
bool isEmpty() const
bool IsEmpty() const
virtual void CreateB2dIAObject()
Definition: svdhdl.cxx:402
void SetLineColor()
bool mbMoveOutside
Definition: svdhdl.hxx:156
double mfShearX
Definition: svdhdl.hxx:505
UNDERLYING_TYPE get() const
void SetColor(Color aNew, bool bCallLink=false)
Definition: svdhdl.cxx:1220
void SetObj(SdrObject *pNewObj)
Definition: svdhdl.cxx:377
Point aPos
Definition: svdhdl.hxx:142
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
#define INDIVIDUAL_COUNT
Definition: svdhdl.cxx:99
int i
uno_Any a
void MoveTo(SdrHdlList &rOther)
Definition: svdhdl.cxx:2323
virtual void CreateB2dIAObject() override
Definition: svdhdl.cxx:2385
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
tools::Long FRound(double fVal)
basegfx::B2DPoint maPositionA
Definition: gradtrns.hxx:31
bool IsSelected() const
Definition: svdhdl.hxx:206
bool SetOutputSizePixel(const Size &rNewSize, bool bErase=true)
sal_uInt32 nPPntNum
Definition: svdhdl.hxx:149
virtual void onHelpRequest()
is called when help is requested for the area of this handle
Definition: svdhdl.cxx:1064
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
void RemoveAllByKind(SdrHdlKind eKind)
Definition: svdhdl.cxx:2238
static bool equalZero(const double &rfVal)
tools::Long Width() const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_GRAY
void FromIAOToItem(SdrObject *pObj, bool bSetItemOnObject, bool bUndo)
Definition: svdhdl.cxx:1366
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1942
void TravelFocusHdl(bool bForward)
Definition: svdhdl.cxx:2000
SdrEdgeKind
Definition: sxekitm.hxx:26
void scale(double fX, double fY)
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:273
void transform(const basegfx::B2DHomMatrix &rMatrix)
std::deque< std::unique_ptr< SdrHdl > > maList
Definition: svdhdl.hxx:433
void SetMoveOutside(bool bOn)
Definition: svdhdl.cxx:2204
sal_uInt32 nObjHdlNum
Definition: svdhdl.hxx:147
SVX_DLLPRIVATE SdrHdlList(const SdrHdlList &)=delete
void SetHdlSize(sal_uInt16 nSiz)
Definition: svdhdl.cxx:2188
void SetMoveOutside(bool bMoveOutside)
Definition: svdhdl.cxx:319
tools::Long Top() const
const sdr::contact::ObjectContact & GetObjectContact() const
Abstract DrawObject.
Definition: svdobj.hxx:261
void intersect(const B2DRange &rRange)
virtual ~SdrHdl()
Definition: svdhdl.cxx:303
#define Y
float GetDPIScaleFactor() const
bool bSelect
Definition: svdhdl.hxx:152
void transform(const basegfx::B2DHomMatrix &rMatrix)
virtual void CreateB2dIAObject() override
Definition: svdhdl.cxx:2501
Point PixelToLogic(const Point &rDevicePt) const
double mfCropLeft
Definition: svdhdl.hxx:515
sal_uInt8 GetGreen() const
SdrHdl * GetFocusHdl() const
Definition: svdhdl.cxx:2127
bool IsGradient() const
Definition: svdhdl.hxx:315
virtual void CreateB2dIAObject() override
Definition: svdhdl.cxx:1494
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
SdrHdl()
Definition: svdhdl.cxx:266
size_t GetHdlCount() const
Definition: svdhdl.hxx:461
SdrHdl * GetHdl(size_t nNum) const
Definition: svdhdl.hxx:462
sdr::overlay::OverlayObjectList maOverlayGroup
Definition: svdhdl.hxx:140
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTCYAN
virtual ~SdrHdlLine() override
Definition: svdhdl.cxx:1435
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
sal_uInt32 count() const
bool bMoveFirstHandle
Definition: svdhdl.hxx:306
std::unique_ptr< XPolygon > pEdgeTrack
Definition: svdoedge.hxx:144
void setY(double fY)
sal_uInt64 GetCursorBlinkTime() const
void SetRotationAngle(Degree100 n)
Definition: svdhdl.cxx:330
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool equalZero() const
unsigned char sal_uInt8
const SdrHdl * pHdl1
Definition: svdhdl.hxx:369
Point a2ndPos
Definition: svdhdl.hxx:299
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1902
virtual SVX_DLLPRIVATE void CreateB2dIAObject() override
Definition: svdhdl.cxx:1126
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTGREEN
virtual bool supportsGridOffsets() const
SdrPaintWindow & GetPaintWindow() const
bool bMoveOutside
Definition: svdhdl.hxx:438
#define F_PI18000
void SetFocusHdl(SdrHdl *pNew)
Definition: svdhdl.cxx:2135
bool IsHdlHit(const Point &rPnt) const
Definition: svdhdl.cxx:944
void GetRidOfIAObject()
Definition: svdhdl.cxx:395
tools::Long Height() const
void * p
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_YELLOW
bool IsDistortShear() const
Definition: svdhdl.hxx:471
bool areMarkHandlesHidden() const
Definition: svdmrkv.hxx:276
basegfx::B2DHomMatrix maObjectTransform
Definition: svdhdl.hxx:513
virtual void CreateB2dIAObject() override
Definition: svdhdl.cxx:1720
static BitmapEx createGluePointBitmap()
Definition: svdhdl.cxx:1072
void translate(double fX, double fY)
PointerStyle
SdrHdlColor * pColHdl1
Definition: svdhdl.hxx:295
virtual ~SdrHdlColor() override
Definition: svdhdl.cxx:1122
basegfx::BColor getBColor() const
struct _ADOUser User
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:303
double getLength() const
bool b1PixMore
Definition: svdhdl.hxx:153
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTBLUE
BitmapEx GetBitmapEx(const Point &rSrcPt, const Size &rSize) const
BitmapEx loadFromName(const OUString &rFileName, const ImageLoadFlags eFlags)
std::unique_ptr< sdr::overlay::OverlayObject > CreateOverlayObject(const basegfx::B2DPoint &rPos, BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset=Point())
Definition: svdhdl.cxx:782
Link< SdrHdlColor *, void > aColorChangeHdl
Definition: svdhdl.hxx:264
static BitmapMarkerKind GetNextBigger(BitmapMarkerKind eKnd)
Definition: svdhdl.cxx:629
Color aMarkerColor
Definition: svdhdl.hxx:261
virtual void onMouseEnter(const MouseEvent &rMEvt)
is called when the mouse enters the area of this handle.
Definition: svdhdl.cxx:1060
constexpr::Color COL_BLUE(0x00, 0x00, 0x80)
static bool ImpSdrHdlListSorter(std::unique_ptr< SdrHdl > const &lhs, std::unique_ptr< SdrHdl > const &rhs)
Definition: svdhdl.cxx:1850
SdrEdgeLineCode eLineCode
Definition: svdhdl.hxx:387
void SetLineCode(SdrEdgeLineCode eCode)
Definition: svdhdl.cxx:1667
virtual ~SdrHdlBezWgt() override
Definition: svdhdl.cxx:1492
ImpTextframeHdl(const tools::Rectangle &rRect)
Definition: svdhdl.cxx:1788
SVX_DLLPRIVATE BitmapEx CreateColorDropper(Color aCol)
Definition: svdhdl.cxx:1173
bool isHitLogic(const basegfx::B2DPoint &rLogicPosition, double fLogicTolerance=0.0) const
int mnIndex
virtual void CreateB2dIAObject() override
Definition: svdhdl.cxx:1556
virtual ~ImpMeasureHdl() override
Definition: svdhdl.cxx:1716
virtual void onMouseLeave()
is called when the mouse leaves the area of this handle.
Definition: svdhdl.cxx:1068
const Size & GetSizePixel() const
double mfCropTop
Definition: svdhdl.hxx:516
SdrCropHdl(const Point &rPnt, SdrHdlKind eNewKind, double fShearX, double fRotation)
Definition: svdhdl.cxx:2332
SdrHdl * pHdl1
Definition: svdhdl.hxx:345
static void GradToVec(GradTransGradient const &rG, GradTransVector &rV, const SdrObject *pObj)
Definition: gradtrns.cxx:30
bool Crop(const tools::Rectangle &rRectPixel)
bool bMoveSingleHandle
Definition: svdhdl.hxx:305
void SetSize(const Size &rNew)
Definition: svdhdl.cxx:1239
OutputDevice & GetOutputDevice() const
tools::Long Right() const
bool bDistortShear
Definition: svdhdl.hxx:437
void SetRotateShear(bool bOn)
Definition: svdhdl.cxx:2220
const Graphic maGraphic
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2289
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
virtual PointerStyle GetPointer() const override
Definition: svdhdl.cxx:1679
Utility class SdrEdgeObj.
Definition: svdoedge.hxx:128
static SVX_DLLPRIVATE Color GetLuminance(const Color &rCol)
Definition: svdhdl.cxx:1213
Color getHilightColor() const
virtual ~SdrHdlGradient() override
Definition: svdhdl.cxx:1262
double mfCropBottom
Definition: svdhdl.hxx:518
sal_uInt32 PageWindowCount() const
Definition: svdpagv.hxx:94