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