Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / source / svdraw / svdhdl.cxx
blob62c3aae7500bd5ce02e75a2358749b9ab592ec47
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include <algorithm>
32 #include <svx/svdhdl.hxx>
33 #include <svx/svdpagv.hxx>
34 #include <svx/svdetc.hxx>
35 #include <svx/svdmrkv.hxx>
36 #include <vcl/window.hxx>
38 #include <vcl/virdev.hxx>
39 #include <tools/poly.hxx>
40 #include <vcl/bmpacc.hxx>
42 #include <svx/sxekitm.hxx>
43 #include "svx/svdstr.hrc"
44 #include "svx/svdglob.hxx"
46 #include <svx/svdmodel.hxx>
47 #include "gradtrns.hxx"
48 #include <svx/xflgrit.hxx>
49 #include <svx/svdundo.hxx>
50 #include <svx/dialmgr.hxx>
51 #include <svx/xflftrit.hxx>
53 // #105678#
54 #include <svx/svdopath.hxx>
55 #include <basegfx/vector/b2dvector.hxx>
56 #include <basegfx/polygon/b2dpolygon.hxx>
57 #include <svx/sdr/overlay/overlaymanager.hxx>
58 #include <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
59 #include <svx/sdr/overlay/overlaybitmapex.hxx>
60 #include <svx/sdr/overlay/overlayline.hxx>
61 #include <svx/sdr/overlay/overlaytriangle.hxx>
62 #include <svx/sdr/overlay/overlayhatchrect.hxx>
63 #include <svx/sdrpagewindow.hxx>
64 #include <svx/sdrpaintwindow.hxx>
65 #include <vcl/svapp.hxx>
66 #include <svx/sdr/overlay/overlaypolypolygon.hxx>
67 #include <vcl/lazydelete.hxx>
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
80 // the bitmap holding all information
81 BitmapEx maMarkersBitmap;
83 // the cropped Bitmaps for reusage
84 ::std::vector< BitmapEx > maRealMarkers;
86 // helpers
87 BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle);
89 public:
90 SdrHdlBitmapSet(sal_uInt16 nResId);
91 ~SdrHdlBitmapSet();
93 const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd=0);
96 ////////////////////////////////////////////////////////////////////////////////////////////////////
97 #define KIND_COUNT (14)
98 #define INDEX_COUNT (6)
99 #define INDIVIDUAL_COUNT (4)
101 SdrHdlBitmapSet::SdrHdlBitmapSet(sal_uInt16 nResId)
102 : maMarkersBitmap(ResId(nResId, *ImpGetResMgr())),
103 // 14 kinds (BitmapMarkerKind) use index [0..5], 4 extra
104 maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT)
108 SdrHdlBitmapSet::~SdrHdlBitmapSet()
112 BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle)
114 BitmapEx& rTargetBitmap = maRealMarkers[nIndex];
116 if(rTargetBitmap.IsEmpty())
118 rTargetBitmap = maMarkersBitmap;
119 rTargetBitmap.Crop(rRectangle);
122 return rTargetBitmap;
125 // change getting of bitmap to use the big resource bitmap
126 const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
128 // fill in size and source position in maMarkersBitmap
129 const sal_uInt16 nYPos(nInd * 11);
131 switch(eKindOfMarker)
133 default:
135 OSL_FAIL( "Unknown kind of marker." );
136 // no break here, return Rect_9x9 as default
138 case Rect_9x9:
140 return impGetOrCreateTargetBitmap((1 * INDEX_COUNT) + nInd, Rectangle(Point(7, nYPos), Size(9, 9)));
143 case Rect_7x7:
145 return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, Rectangle(Point(0, nYPos), Size(7, 7)));
148 case Rect_11x11:
150 return impGetOrCreateTargetBitmap((2 * INDEX_COUNT) + nInd, Rectangle(Point(16, nYPos), Size(11, 11)));
153 case Rect_13x13:
155 const sal_uInt16 nIndex((3 * INDEX_COUNT) + nInd);
157 switch(nInd)
159 case 0:
161 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 66), Size(13, 13)));
163 case 1:
165 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 66), Size(13, 13)));
167 case 2:
169 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 79), Size(13, 13)));
171 case 3:
173 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 79), Size(13, 13)));
175 case 4:
177 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 79), Size(13, 13)));
179 default: // case 5:
181 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 66), Size(13, 13)));
186 case Circ_7x7:
188 return impGetOrCreateTargetBitmap((4 * INDEX_COUNT) + nInd, Rectangle(Point(27, nYPos), Size(7, 7)));
191 case Circ_9x9:
192 case Customshape1:
194 return impGetOrCreateTargetBitmap((5 * INDEX_COUNT) + nInd, Rectangle(Point(34, nYPos), Size(9, 9)));
197 case Circ_11x11:
199 return impGetOrCreateTargetBitmap((6 * INDEX_COUNT) + nInd, Rectangle(Point(43, nYPos), Size(11, 11)));
202 case Elli_7x9:
204 return impGetOrCreateTargetBitmap((7 * INDEX_COUNT) + nInd, Rectangle(Point(54, nYPos), Size(7, 9)));
207 case Elli_9x11:
209 return impGetOrCreateTargetBitmap((8 * INDEX_COUNT) + nInd, Rectangle(Point(61, nYPos), Size(9, 11)));
212 case Elli_9x7:
214 return impGetOrCreateTargetBitmap((9 * INDEX_COUNT) + nInd, Rectangle(Point(70, nYPos), Size(9, 7)));
217 case Elli_11x9:
219 return impGetOrCreateTargetBitmap((10 * INDEX_COUNT) + nInd, Rectangle(Point(79, nYPos), Size(11, 9)));
222 case RectPlus_7x7:
224 return impGetOrCreateTargetBitmap((11 * INDEX_COUNT) + nInd, Rectangle(Point(90, nYPos), Size(7, 7)));
227 case RectPlus_9x9:
229 return impGetOrCreateTargetBitmap((12 * INDEX_COUNT) + nInd, Rectangle(Point(97, nYPos), Size(9, 9)));
232 case RectPlus_11x11:
234 return impGetOrCreateTargetBitmap((13 * INDEX_COUNT) + nInd, Rectangle(Point(106, nYPos), Size(11, 11)));
237 case Crosshair:
239 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 0, Rectangle(Point(0, 68), Size(15, 15)));
242 case Glue:
244 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 76), Size(9, 9)));
247 case Glue_Deselected:
249 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 67), Size(9, 9)));
252 case Anchor: // AnchorTR for SW
253 case AnchorTR:
255 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, Rectangle(Point(24, 67), Size(24, 24)));
258 // add AnchorPressed to be able to animate anchor control
259 case AnchorPressed:
260 case AnchorPressedTR:
262 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(48, 67), Size(24, 24)));
267 ////////////////////////////////////////////////////////////////////////////////////////////////////
269 SdrHdl::SdrHdl():
270 pObj(NULL),
271 pPV(NULL),
272 pHdlList(NULL),
273 eKind(HDL_MOVE),
274 nDrehWink(0),
275 nObjHdlNum(0),
276 nPolyNum(0),
277 nPPntNum(0),
278 nSourceHdlNum(0),
279 bSelect(sal_False),
280 b1PixMore(sal_False),
281 bPlusHdl(sal_False),
282 mbMoveOutside(false),
283 mbMouseOver(false)
287 SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind):
288 pObj(NULL),
289 pPV(NULL),
290 pHdlList(NULL),
291 aPos(rPnt),
292 eKind(eNewKind),
293 nDrehWink(0),
294 nObjHdlNum(0),
295 nPolyNum(0),
296 nPPntNum(0),
297 nSourceHdlNum(0),
298 bSelect(sal_False),
299 b1PixMore(sal_False),
300 bPlusHdl(sal_False),
301 mbMoveOutside(false),
302 mbMouseOver(false)
306 SdrHdl::~SdrHdl()
308 GetRidOfIAObject();
311 void SdrHdl::Set1PixMore(sal_Bool bJa)
313 if(b1PixMore != bJa)
315 b1PixMore = bJa;
317 // create new display
318 Touch();
322 void SdrHdl::SetMoveOutside( bool bMoveOutside )
324 if(mbMoveOutside != bMoveOutside)
326 mbMoveOutside = bMoveOutside;
328 // create new display
329 Touch();
333 void SdrHdl::SetDrehWink(long n)
335 if(nDrehWink != n)
337 nDrehWink = n;
339 // create new display
340 Touch();
344 void SdrHdl::SetPos(const Point& rPnt)
346 if(aPos != rPnt)
348 // remember new position
349 aPos = rPnt;
351 // create new display
352 Touch();
356 void SdrHdl::SetSelected(sal_Bool bJa)
358 if(bSelect != bJa)
360 // remember new value
361 bSelect = bJa;
363 // create new display
364 Touch();
368 void SdrHdl::SetHdlList(SdrHdlList* pList)
370 if(pHdlList != pList)
372 // rememver list
373 pHdlList = pList;
375 // now its possible to create graphic representation
376 Touch();
380 void SdrHdl::SetObj(SdrObject* pNewObj)
382 if(pObj != pNewObj)
384 // remember new object
385 pObj = pNewObj;
387 // graphic representation may have changed
388 Touch();
392 void SdrHdl::Touch()
394 // force update of graphic representation
395 CreateB2dIAObject();
398 void SdrHdl::GetRidOfIAObject()
401 // OVERLAYMANAGER
402 maOverlayGroup.clear();
405 void SdrHdl::CreateB2dIAObject()
407 // first throw away old one
408 GetRidOfIAObject();
410 if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
412 BitmapColorIndex eColIndex = LightGreen;
413 BitmapMarkerKind eKindOfMarker = Rect_7x7;
415 sal_Bool bRot = pHdlList->IsRotateShear();
416 if(pObj)
417 eColIndex = (bSelect) ? Cyan : LightCyan;
418 if(bRot)
420 // red rotation handles
421 if(pObj && bSelect)
422 eColIndex = Red;
423 else
424 eColIndex = LightRed;
427 switch(eKind)
429 case HDL_MOVE:
431 eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
432 break;
434 case HDL_UPLFT:
435 case HDL_UPRGT:
436 case HDL_LWLFT:
437 case HDL_LWRGT:
439 // corner handles
440 if(bRot)
442 eKindOfMarker = Circ_7x7;
444 else
446 eKindOfMarker = Rect_7x7;
448 break;
450 case HDL_UPPER:
451 case HDL_LOWER:
453 // Upper/Lower handles
454 if(bRot)
456 eKindOfMarker = Elli_9x7;
458 else
460 eKindOfMarker = Rect_7x7;
462 break;
464 case HDL_LEFT:
465 case HDL_RIGHT:
467 // Left/Right handles
468 if(bRot)
470 eKindOfMarker = Elli_7x9;
472 else
474 eKindOfMarker = Rect_7x7;
476 break;
478 case HDL_POLY:
480 if(bRot)
482 eKindOfMarker = (b1PixMore) ? Circ_9x9 : Circ_7x7;
484 else
486 eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
488 break;
490 case HDL_BWGT: // weight at poly
492 eKindOfMarker = Circ_7x7;
493 break;
495 case HDL_CIRC:
497 eKindOfMarker = Rect_11x11;
498 break;
500 case HDL_REF1:
501 case HDL_REF2:
503 eKindOfMarker = Crosshair;
504 break;
506 case HDL_GLUE:
508 eKindOfMarker = Glue;
509 break;
511 case HDL_GLUE_DESELECTED:
513 eKindOfMarker = Glue_Deselected;
514 break;
516 case HDL_ANCHOR:
518 eKindOfMarker = Anchor;
519 break;
521 case HDL_USER:
523 break;
525 // top right anchor for SW
526 case HDL_ANCHOR_TR:
528 eKindOfMarker = AnchorTR;
529 break;
532 // for SJ and the CustomShapeHandles:
533 case HDL_CUSTOMSHAPE1:
535 eKindOfMarker = Customshape1;
536 eColIndex = Yellow;
537 break;
539 default:
540 break;
543 SdrMarkView* pView = pHdlList->GetView();
544 SdrPageView* pPageView = pView->GetSdrPageView();
546 if(pPageView)
548 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
550 // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
551 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
553 if(rPageWindow.GetPaintWindow().OutputToWindow())
555 Point aMoveOutsideOffset(0, 0);
557 // add offset if necessary
558 if(pHdlList->IsMoveOutside() || mbMoveOutside)
560 OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
561 Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
563 if(eKind == HDL_UPLFT || eKind == HDL_UPPER || eKind == HDL_UPRGT)
564 aMoveOutsideOffset.Y() -= aOffset.Width();
565 if(eKind == HDL_LWLFT || eKind == HDL_LOWER || eKind == HDL_LWRGT)
566 aMoveOutsideOffset.Y() += aOffset.Height();
567 if(eKind == HDL_UPLFT || eKind == HDL_LEFT || eKind == HDL_LWLFT)
568 aMoveOutsideOffset.X() -= aOffset.Width();
569 if(eKind == HDL_UPRGT || eKind == HDL_RIGHT || eKind == HDL_LWRGT)
570 aMoveOutsideOffset.X() += aOffset.Height();
573 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
574 if (xManager.is())
576 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
577 ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
578 aPosition,
579 eColIndex,
580 eKindOfMarker,
581 aMoveOutsideOffset);
583 // OVERLAYMANAGER
584 if(pNewOverlayObject)
586 xManager->add(*pNewOverlayObject);
587 maOverlayGroup.append(*pNewOverlayObject);
596 BitmapMarkerKind SdrHdl::GetNextBigger(BitmapMarkerKind eKnd) const
598 BitmapMarkerKind eRetval(eKnd);
600 switch(eKnd)
602 case Rect_7x7: eRetval = Rect_9x9; break;
603 case Rect_9x9: eRetval = Rect_11x11; break;
604 case Rect_11x11: eRetval = Rect_13x13; break;
606 case Circ_7x7: eRetval = Circ_9x9; break;
607 case Circ_9x9: eRetval = Circ_11x11; break;
609 case Elli_7x9: eRetval = Elli_9x11; break;
611 case Elli_9x7: eRetval = Elli_11x9; break;
613 case RectPlus_7x7: eRetval = RectPlus_9x9; break;
614 case RectPlus_9x9: eRetval = RectPlus_11x11; break;
616 // let anchor blink with its pressed state
617 case Anchor: eRetval = AnchorPressed; break;
619 // same for AnchorTR
620 case AnchorTR: eRetval = AnchorPressedTR; break;
621 default:
622 break;
625 return eRetval;
628 BitmapEx SdrHdl::ImpGetBitmapEx( BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
630 static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_MARKERS));
631 return aModernSet.get()->GetBitmapEx(eKindOfMarker, nInd);
634 ::sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
635 const basegfx::B2DPoint& rPos,
636 BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset)
638 ::sdr::overlay::OverlayObject* pRetval = 0L;
640 // support bigger sizes
641 sal_Bool bForceBiggerSize(sal_False);
643 if(pHdlList->GetHdlSize() > 3)
645 bForceBiggerSize = sal_True;
648 if(bForceBiggerSize)
650 eKindOfMarker = GetNextBigger(eKindOfMarker);
653 // This handle has the focus, visualize it
654 if(IsFocusHdl() && pHdlList && pHdlList->GetFocusHdl() == this)
656 // create animated handle
657 BitmapMarkerKind eNextBigger = GetNextBigger(eKindOfMarker);
659 if(eNextBigger == eKindOfMarker)
661 // this may happen for the not supported getting-bigger types.
662 // Choose an alternative here
663 switch(eKindOfMarker)
665 case Rect_13x13: eNextBigger = Rect_11x11; break;
666 case Circ_11x11: eNextBigger = Elli_11x9; break;
667 case Elli_9x11: eNextBigger = Elli_11x9; break;
668 case Elli_11x9: eNextBigger = Elli_9x11; break;
669 case RectPlus_11x11: eNextBigger = Rect_13x13; break;
671 case Crosshair:
672 eNextBigger = Glue;
673 break;
675 case Glue:
676 eNextBigger = Crosshair;
677 break;
678 case Glue_Deselected:
679 eNextBigger = Glue;
680 break;
681 default:
682 break;
686 // create animated handle
687 BitmapEx aBmpEx1 = ImpGetBitmapEx( eKindOfMarker, (sal_uInt16)eColIndex );
688 BitmapEx aBmpEx2 = ImpGetBitmapEx( eNextBigger, (sal_uInt16)eColIndex );
690 // #i53216# Use system cursor blink time. Use the unsigned value.
691 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
692 const sal_uInt32 nBlinkTime((sal_uInt32)rStyleSettings.GetCursorBlinkTime());
694 if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
696 // when anchor is used take upper left as reference point inside the handle
697 pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime);
699 else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
701 // AnchorTR for SW, take top right as (0,0)
702 pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
703 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1), 0,
704 (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1), 0);
706 else
708 // create centered handle as default
709 pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
710 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
711 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
712 (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
713 (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
716 else
718 // create normal handle: use ImpGetBitmapEx(...) now
719 BitmapEx aBmpEx = ImpGetBitmapEx(eKindOfMarker, (sal_uInt16)eColIndex);
721 if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
723 // upper left as reference point inside the handle for AnchorPressed, too
724 pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx);
726 else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
728 // AnchorTR for SW, take top right as (0,0)
729 pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
730 (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1), 0);
732 else
734 sal_uInt16 nCenX((sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1L) >> 1);
735 sal_uInt16 nCenY((sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1L) >> 1);
737 if(aMoveOutsideOffset.X() > 0)
739 nCenX = 0;
741 else if(aMoveOutsideOffset.X() < 0)
743 nCenX = (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1);
746 if(aMoveOutsideOffset.Y() > 0)
748 nCenY = 0;
750 else if(aMoveOutsideOffset.Y() < 0)
752 nCenY = (sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1);
755 // create centered handle as default
756 pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, nCenX, nCenY);
760 return pRetval;
763 bool SdrHdl::IsHdlHit(const Point& rPnt) const
765 // OVERLAYMANAGER
766 basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y());
767 return maOverlayGroup.isHitLogic(aPosition);
770 Pointer SdrHdl::GetPointer() const
772 PointerStyle ePtr=POINTER_MOVE;
773 const sal_Bool bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT;
774 const sal_Bool bRot=pHdlList!=NULL && pHdlList->IsRotateShear();
775 const sal_Bool bDis=pHdlList!=NULL && pHdlList->IsDistortShear();
776 if (bSize && pHdlList!=NULL && (bRot || bDis)) {
777 switch (eKind) {
778 case HDL_UPLFT: case HDL_UPRGT:
779 case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break;
780 case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break;
781 case HDL_UPPER: case HDL_LOWER: ePtr=POINTER_HSHEAR; break;
782 default:
783 break;
785 } else {
786 // When resizing rotated rectangles, rotate the mouse cursor slightly, too
787 if (bSize && nDrehWink!=0) {
788 long nHdlWink=0;
789 switch (eKind) {
790 case HDL_LWRGT: nHdlWink=31500; break;
791 case HDL_LOWER: nHdlWink=27000; break;
792 case HDL_LWLFT: nHdlWink=22500; break;
793 case HDL_LEFT : nHdlWink=18000; break;
794 case HDL_UPLFT: nHdlWink=13500; break;
795 case HDL_UPPER: nHdlWink=9000; break;
796 case HDL_UPRGT: nHdlWink=4500; break;
797 case HDL_RIGHT: nHdlWink=0; break;
798 default:
799 break;
801 nHdlWink+=nDrehWink+2249; // a little bit more (for rounding)
802 while (nHdlWink<0) nHdlWink+=36000;
803 while (nHdlWink>=36000) nHdlWink-=36000;
804 nHdlWink/=4500;
805 switch ((sal_uInt8)nHdlWink) {
806 case 0: ePtr=POINTER_ESIZE; break;
807 case 1: ePtr=POINTER_NESIZE; break;
808 case 2: ePtr=POINTER_NSIZE; break;
809 case 3: ePtr=POINTER_NWSIZE; break;
810 case 4: ePtr=POINTER_WSIZE; break;
811 case 5: ePtr=POINTER_SWSIZE; break;
812 case 6: ePtr=POINTER_SSIZE; break;
813 case 7: ePtr=POINTER_SESIZE; break;
814 } // switch
815 } else {
816 switch (eKind) {
817 case HDL_UPLFT: ePtr=POINTER_NWSIZE; break;
818 case HDL_UPPER: ePtr=POINTER_NSIZE; break;
819 case HDL_UPRGT: ePtr=POINTER_NESIZE; break;
820 case HDL_LEFT : ePtr=POINTER_WSIZE; break;
821 case HDL_RIGHT: ePtr=POINTER_ESIZE; break;
822 case HDL_LWLFT: ePtr=POINTER_SWSIZE; break;
823 case HDL_LOWER: ePtr=POINTER_SSIZE; break;
824 case HDL_LWRGT: ePtr=POINTER_SESIZE; break;
825 case HDL_POLY : ePtr=POINTER_MOVEPOINT; break;
826 case HDL_CIRC : ePtr=POINTER_HAND; break;
827 case HDL_REF1 : ePtr=POINTER_REFHAND; break;
828 case HDL_REF2 : ePtr=POINTER_REFHAND; break;
829 case HDL_BWGT : ePtr=POINTER_MOVEBEZIERWEIGHT; break;
830 case HDL_GLUE : ePtr=POINTER_MOVEPOINT; break;
831 case HDL_GLUE_DESELECTED : ePtr=POINTER_MOVEPOINT; break;
832 case HDL_CUSTOMSHAPE1 : ePtr=POINTER_HAND; break;
833 default:
834 break;
838 return Pointer(ePtr);
841 sal_Bool SdrHdl::IsFocusHdl() const
843 switch(eKind)
845 case HDL_UPLFT:
846 case HDL_UPPER:
847 case HDL_UPRGT:
848 case HDL_LEFT:
849 case HDL_RIGHT:
850 case HDL_LWLFT:
851 case HDL_LOWER:
852 case HDL_LWRGT:
854 // if it's an activated TextEdit, it's moved to extended points
855 if(pHdlList && pHdlList->IsMoveOutside())
856 return sal_False;
857 else
858 return sal_True;
861 case HDL_MOVE: // handle to move object
862 case HDL_POLY: // selected point of polygon or curve
863 case HDL_BWGT: // weight at a curve
864 case HDL_CIRC: // angle of circle segments, corner radius of rectangles
865 case HDL_REF1: // reference point 1, e. g. center of rotation
866 case HDL_REF2: // reference point 2, e. g. endpoint of reflection axis
867 case HDL_GLUE: // glue point
868 case HDL_GLUE_DESELECTED: // deselected glue point, used to be a little blue cross
870 // for SJ and the CustomShapeHandles:
871 case HDL_CUSTOMSHAPE1:
873 case HDL_USER:
875 return sal_True;
878 default:
880 return sal_False;
885 void SdrHdl::onMouseEnter(const MouseEvent& /*rMEvt*/)
889 void SdrHdl::onMouseLeave()
893 ////////////////////////////////////////////////////////////////////////////////////////////////////
894 // class SdrHdlColor
896 SdrHdlColor::SdrHdlColor(const Point& rRef, Color aCol, const Size& rSize, sal_Bool bLum)
897 : SdrHdl(rRef, HDL_COLR),
898 aMarkerSize(rSize),
899 bUseLuminance(bLum)
901 if(IsUseLuminance())
902 aCol = GetLuminance(aCol);
904 // remember color
905 aMarkerColor = aCol;
908 SdrHdlColor::~SdrHdlColor()
912 void SdrHdlColor::CreateB2dIAObject()
914 // first throw away old one
915 GetRidOfIAObject();
917 if(pHdlList)
919 SdrMarkView* pView = pHdlList->GetView();
921 if(pView && !pView->areMarkHandlesHidden())
923 SdrPageView* pPageView = pView->GetSdrPageView();
925 if(pPageView)
927 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
929 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
931 if(rPageWindow.GetPaintWindow().OutputToWindow())
933 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
934 if (xManager.is())
936 Bitmap aBmpCol(CreateColorDropper(aMarkerColor));
937 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
938 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
939 ::sdr::overlay::OverlayBitmapEx(
940 aPosition,
941 BitmapEx(aBmpCol),
942 (sal_uInt16)(aBmpCol.GetSizePixel().Width() - 1) >> 1,
943 (sal_uInt16)(aBmpCol.GetSizePixel().Height() - 1) >> 1
945 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
947 // OVERLAYMANAGER
948 if(pNewOverlayObject)
950 xManager->add(*pNewOverlayObject);
951 maOverlayGroup.append(*pNewOverlayObject);
961 Bitmap SdrHdlColor::CreateColorDropper(Color aCol)
963 // get the Bitmap
964 Bitmap aRetval(aMarkerSize, 24);
965 aRetval.Erase(aCol);
967 // get write access
968 BitmapWriteAccess* pWrite = aRetval.AcquireWriteAccess();
969 DBG_ASSERT(pWrite, "Got NO write access to a new Bitmap!");
971 if(pWrite)
973 // draw outer border
974 sal_Int32 nWidth = aMarkerSize.Width();
975 sal_Int32 nHeight = aMarkerSize.Height();
977 pWrite->SetLineColor(Color(COL_LIGHTGRAY));
978 pWrite->DrawLine(Point(0, 0), Point(0, nHeight - 1));
979 pWrite->DrawLine(Point(1, 0), Point(nWidth - 1, 0));
980 pWrite->SetLineColor(Color(COL_GRAY));
981 pWrite->DrawLine(Point(1, nHeight - 1), Point(nWidth - 1, nHeight - 1));
982 pWrite->DrawLine(Point(nWidth - 1, 1), Point(nWidth - 1, nHeight - 2));
984 // draw lighter UpperLeft
985 const Color aLightColor(
986 (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetRed() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
987 (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetGreen() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
988 (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetBlue() + (sal_Int16)0x0040), (sal_Int16)0x00ff)));
989 pWrite->SetLineColor(aLightColor);
990 pWrite->DrawLine(Point(1, 1), Point(1, nHeight - 2));
991 pWrite->DrawLine(Point(2, 1), Point(nWidth - 2, 1));
993 // draw darker LowerRight
994 const Color aDarkColor(
995 (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetRed() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
996 (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetGreen() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
997 (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetBlue() - (sal_Int16)0x0040), (sal_Int16)0x0000)));
998 pWrite->SetLineColor(aDarkColor);
999 pWrite->DrawLine(Point(2, nHeight - 2), Point(nWidth - 2, nHeight - 2));
1000 pWrite->DrawLine(Point(nWidth - 2, 2), Point(nWidth - 2, nHeight - 3));
1002 // get rid of write access
1003 delete pWrite;
1006 return aRetval;
1009 Color SdrHdlColor::GetLuminance(const Color& rCol)
1011 sal_uInt8 aLum = rCol.GetLuminance();
1012 Color aRetval(aLum, aLum, aLum);
1013 return aRetval;
1016 void SdrHdlColor::CallColorChangeLink()
1018 aColorChangeHdl.Call(this);
1021 void SdrHdlColor::SetColor(Color aNew, sal_Bool bCallLink)
1023 if(IsUseLuminance())
1024 aNew = GetLuminance(aNew);
1026 if(aMarkerColor != aNew)
1028 // remember new color
1029 aMarkerColor = aNew;
1031 // create new display
1032 Touch();
1034 // tell about change
1035 if(bCallLink)
1036 CallColorChangeLink();
1040 void SdrHdlColor::SetSize(const Size& rNew)
1042 if(rNew != aMarkerSize)
1044 // remember new size
1045 aMarkerSize = rNew;
1047 // create new display
1048 Touch();
1052 ////////////////////////////////////////////////////////////////////////////////////////////////////
1053 // class SdrHdlGradient
1055 SdrHdlGradient::SdrHdlGradient(const Point& rRef1, const Point& rRef2, sal_Bool bGrad)
1056 : SdrHdl(rRef1, bGrad ? HDL_GRAD : HDL_TRNS),
1057 pColHdl1(NULL),
1058 pColHdl2(NULL),
1059 a2ndPos(rRef2),
1060 bGradient(bGrad)
1064 SdrHdlGradient::~SdrHdlGradient()
1068 void SdrHdlGradient::Set2ndPos(const Point& rPnt)
1070 if(a2ndPos != rPnt)
1072 // remember new position
1073 a2ndPos = rPnt;
1075 // create new display
1076 Touch();
1080 void SdrHdlGradient::CreateB2dIAObject()
1082 // first throw away old one
1083 GetRidOfIAObject();
1085 if(pHdlList)
1087 SdrMarkView* pView = pHdlList->GetView();
1089 if(pView && !pView->areMarkHandlesHidden())
1091 SdrPageView* pPageView = pView->GetSdrPageView();
1093 if(pPageView)
1095 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1097 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1099 if(rPageWindow.GetPaintWindow().OutputToWindow())
1101 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1102 if (xManager.is())
1104 // striped line in between
1105 basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
1106 double fVecLen = aVec.getLength();
1107 double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
1108 double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
1109 aVec.normalize();
1110 basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
1111 sal_Int32 nMidX = (sal_Int32)(aPos.X() + aVec.getX() * fLongPercentArrow);
1112 sal_Int32 nMidY = (sal_Int32)(aPos.Y() + aVec.getY() * fLongPercentArrow);
1113 Point aMidPoint(nMidX, nMidY);
1115 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1116 basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
1118 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1119 ::sdr::overlay::OverlayLineStriped(
1120 aPosition, aMidPos
1122 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1124 pNewOverlayObject->setBaseColor(IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE));
1125 xManager->add(*pNewOverlayObject);
1126 maOverlayGroup.append(*pNewOverlayObject);
1128 // arrowhead
1129 Point aLeft(aMidPoint.X() + (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
1130 aMidPoint.Y() + (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
1131 Point aRight(aMidPoint.X() - (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
1132 aMidPoint.Y() - (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
1134 basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
1135 basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
1136 basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
1138 pNewOverlayObject = new
1139 ::sdr::overlay::OverlayTriangle(
1140 aPositionLeft,
1141 aPosition2,
1142 aPositionRight,
1143 IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)
1145 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1147 xManager->add(*pNewOverlayObject);
1148 maOverlayGroup.append(*pNewOverlayObject);
1157 IMPL_LINK(SdrHdlGradient, ColorChangeHdl, SdrHdl*, /*pHdl*/)
1159 if(GetObj())
1160 FromIAOToItem(GetObj(), sal_True, sal_True);
1161 return 0;
1164 void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, sal_Bool bSetItemOnObject, sal_Bool bUndo)
1166 // from IAO positions and colors to gradient
1167 const SfxItemSet& rSet = _pObj->GetMergedItemSet();
1169 GradTransformer aGradTransformer;
1170 GradTransGradient aOldGradTransGradient;
1171 GradTransGradient aGradTransGradient;
1172 GradTransVector aGradTransVector;
1174 String aString;
1176 aGradTransVector.maPositionA = basegfx::B2DPoint(GetPos().X(), GetPos().Y());
1177 aGradTransVector.maPositionB = basegfx::B2DPoint(Get2ndPos().X(), Get2ndPos().Y());
1178 if(pColHdl1)
1179 aGradTransVector.aCol1 = pColHdl1->GetColor();
1180 if(pColHdl2)
1181 aGradTransVector.aCol2 = pColHdl2->GetColor();
1183 if(IsGradient())
1184 aOldGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
1185 else
1186 aOldGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue();
1188 // transform vector data to gradient
1189 aGradTransformer.VecToGrad(aGradTransVector, aGradTransGradient, aOldGradTransGradient, _pObj, bMoveSingleHandle, bMoveFirstHandle);
1191 if(bSetItemOnObject)
1193 SdrModel* pModel = _pObj->GetModel();
1194 SfxItemSet aNewSet(pModel->GetItemPool());
1196 if(IsGradient())
1198 aString = String();
1199 XFillGradientItem aNewGradItem(aString, aGradTransGradient.aGradient);
1200 aNewSet.Put(aNewGradItem);
1202 else
1204 aString = String();
1205 XFillFloatTransparenceItem aNewTransItem(aString, aGradTransGradient.aGradient);
1206 aNewSet.Put(aNewTransItem);
1209 if(bUndo && pModel->IsUndoEnabled())
1211 pModel->BegUndo(SVX_RESSTR(IsGradient() ? SIP_XA_FILLGRADIENT : SIP_XA_FILLTRANSPARENCE));
1212 pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*_pObj));
1213 pModel->EndUndo();
1216 pObj->SetMergedItemSetAndBroadcast(aNewSet);
1219 // back transformation, set values on pIAOHandle
1220 aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, _pObj);
1222 SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1223 Set2ndPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1224 if(pColHdl1)
1226 pColHdl1->SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1227 pColHdl1->SetColor(aGradTransVector.aCol1);
1229 if(pColHdl2)
1231 pColHdl2->SetPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1232 pColHdl2->SetColor(aGradTransVector.aCol2);
1236 ////////////////////////////////////////////////////////////////////////////////////////////////////
1238 SdrHdlLine::~SdrHdlLine() {}
1240 void SdrHdlLine::CreateB2dIAObject()
1242 // first throw away old one
1243 GetRidOfIAObject();
1245 if(pHdlList)
1247 SdrMarkView* pView = pHdlList->GetView();
1249 if(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2)
1251 SdrPageView* pPageView = pView->GetSdrPageView();
1253 if(pPageView)
1255 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1257 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1259 if(rPageWindow.GetPaintWindow().OutputToWindow())
1261 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1262 if (xManager.is())
1264 basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1265 basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
1267 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1268 ::sdr::overlay::OverlayLineStriped(
1269 aPosition1,
1270 aPosition2
1272 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1274 // OVERLAYMANAGER
1275 if(pNewOverlayObject)
1277 // color(?)
1278 pNewOverlayObject->setBaseColor(Color(COL_LIGHTRED));
1280 xManager->add(*pNewOverlayObject);
1281 maOverlayGroup.append(*pNewOverlayObject);
1291 Pointer SdrHdlLine::GetPointer() const
1293 return Pointer(POINTER_REFHAND);
1296 ////////////////////////////////////////////////////////////////////////////////////////////////////
1298 SdrHdlBezWgt::~SdrHdlBezWgt() {}
1300 void SdrHdlBezWgt::CreateB2dIAObject()
1302 // call parent
1303 SdrHdl::CreateB2dIAObject();
1305 // create lines
1306 if(pHdlList)
1308 SdrMarkView* pView = pHdlList->GetView();
1310 if(pView && !pView->areMarkHandlesHidden())
1312 SdrPageView* pPageView = pView->GetSdrPageView();
1314 if(pPageView)
1316 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1318 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1320 if(rPageWindow.GetPaintWindow().OutputToWindow())
1322 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1323 if (xManager.is())
1325 basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1326 basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
1328 if(!aPosition1.equal(aPosition2))
1330 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1331 ::sdr::overlay::OverlayLineStriped(
1332 aPosition1,
1333 aPosition2
1335 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1337 // OVERLAYMANAGER
1338 if(pNewOverlayObject)
1340 // line part is not hittable
1341 pNewOverlayObject->setHittable(sal_False);
1343 // color(?)
1344 pNewOverlayObject->setBaseColor(Color(COL_LIGHTBLUE));
1346 xManager->add(*pNewOverlayObject);
1347 maOverlayGroup.append(*pNewOverlayObject);
1358 ////////////////////////////////////////////////////////////////////////////////////////////////////
1360 E3dVolumeMarker::E3dVolumeMarker(const basegfx::B2DPolyPolygon& rWireframePoly)
1362 aWireframePoly = rWireframePoly;
1365 void E3dVolumeMarker::CreateB2dIAObject()
1367 // create lines
1368 if(pHdlList)
1370 SdrMarkView* pView = pHdlList->GetView();
1372 if(pView && !pView->areMarkHandlesHidden())
1374 SdrPageView* pPageView = pView->GetSdrPageView();
1376 if(pPageView)
1378 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1380 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1382 if(rPageWindow.GetPaintWindow().OutputToWindow())
1384 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1385 if (xManager.is() && aWireframePoly.count())
1387 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1388 ::sdr::overlay::OverlayPolyPolygonStriped(aWireframePoly);
1389 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1391 // OVERLAYMANAGER
1392 if(pNewOverlayObject)
1394 pNewOverlayObject->setBaseColor(Color(COL_BLACK));
1396 xManager->add(*pNewOverlayObject);
1397 maOverlayGroup.append(*pNewOverlayObject);
1407 ////////////////////////////////////////////////////////////////////////////////////////////////////
1409 ImpEdgeHdl::~ImpEdgeHdl()
1413 void ImpEdgeHdl::CreateB2dIAObject()
1415 if(nObjHdlNum <= 1 && pObj)
1417 // first throw away old one
1418 GetRidOfIAObject();
1420 BitmapColorIndex eColIndex = LightCyan;
1421 BitmapMarkerKind eKindOfMarker = Rect_7x7;
1423 if(pHdlList)
1425 SdrMarkView* pView = pHdlList->GetView();
1427 if(pView && !pView->areMarkHandlesHidden())
1429 const SdrEdgeObj* pEdge = (SdrEdgeObj*)pObj;
1431 if(pEdge->GetConnectedNode(nObjHdlNum == 0) != NULL)
1432 eColIndex = LightRed;
1434 if(nPPntNum < 2)
1436 // Handle with plus sign inside
1437 eKindOfMarker = Circ_7x7;
1440 SdrPageView* pPageView = pView->GetSdrPageView();
1442 if(pPageView)
1444 for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1446 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1448 if(rPageWindow.GetPaintWindow().OutputToWindow())
1450 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1451 if (xManager.is())
1453 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1455 ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
1456 aPosition,
1457 eColIndex,
1458 eKindOfMarker);
1460 // OVERLAYMANAGER
1461 if(pNewOverlayObject)
1463 xManager->add(*pNewOverlayObject);
1464 maOverlayGroup.append(*pNewOverlayObject);
1473 else
1475 // call parent
1476 SdrHdl::CreateB2dIAObject();
1480 void ImpEdgeHdl::SetLineCode(SdrEdgeLineCode eCode)
1482 if(eLineCode != eCode)
1484 // remember new value
1485 eLineCode = eCode;
1487 // create new display
1488 Touch();
1492 Pointer ImpEdgeHdl::GetPointer() const
1494 SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
1495 if (pEdge==NULL)
1496 return SdrHdl::GetPointer();
1497 if (nObjHdlNum<=1)
1498 return Pointer(POINTER_MOVEPOINT);
1499 if (IsHorzDrag())
1500 return Pointer(POINTER_ESIZE);
1501 else
1502 return Pointer(POINTER_SSIZE);
1505 sal_Bool ImpEdgeHdl::IsHorzDrag() const
1507 SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
1508 if (pEdge==NULL)
1509 return sal_False;
1510 if (nObjHdlNum<=1)
1511 return sal_False;
1513 SdrEdgeKind eEdgeKind = ((SdrEdgeKindItem&)(pEdge->GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
1515 const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
1516 if (eEdgeKind==SDREDGE_ORTHOLINES || eEdgeKind==SDREDGE_BEZIER)
1518 return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
1520 else if (eEdgeKind==SDREDGE_THREELINES)
1522 long nWink=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
1523 if (nWink==0 || nWink==18000)
1524 return sal_True;
1525 else
1526 return sal_False;
1528 return sal_False;
1531 ////////////////////////////////////////////////////////////////////////////////////////////////////
1533 ImpMeasureHdl::~ImpMeasureHdl()
1537 void ImpMeasureHdl::CreateB2dIAObject()
1539 // first throw away old one
1540 GetRidOfIAObject();
1542 if(pHdlList)
1544 SdrMarkView* pView = pHdlList->GetView();
1546 if(pView && !pView->areMarkHandlesHidden())
1548 BitmapColorIndex eColIndex = LightCyan;
1549 BitmapMarkerKind eKindOfMarker = Rect_9x9;
1551 if(nObjHdlNum > 1)
1553 eKindOfMarker = Rect_7x7;
1556 if(bSelect)
1558 eColIndex = Cyan;
1561 SdrPageView* pPageView = pView->GetSdrPageView();
1563 if(pPageView)
1565 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1567 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1569 if(rPageWindow.GetPaintWindow().OutputToWindow())
1571 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1572 if (xManager.is())
1574 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1576 ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
1577 aPosition,
1578 eColIndex,
1579 eKindOfMarker);
1581 // OVERLAYMANAGER
1582 if(pNewOverlayObject)
1584 xManager->add(*pNewOverlayObject);
1585 maOverlayGroup.append(*pNewOverlayObject);
1595 Pointer ImpMeasureHdl::GetPointer() const
1597 switch (nObjHdlNum)
1599 case 0: case 1: return Pointer(POINTER_HAND);
1600 case 2: case 3: return Pointer(POINTER_MOVEPOINT);
1601 case 4: case 5: return SdrHdl::GetPointer(); // will then be rotated appropriately
1602 } // switch
1603 return Pointer(POINTER_NOTALLOWED);
1606 ////////////////////////////////////////////////////////////////////////////////////////////////////
1608 ImpTextframeHdl::ImpTextframeHdl(const Rectangle& rRect) :
1609 SdrHdl(rRect.TopLeft(),HDL_MOVE),
1610 maRect(rRect)
1614 void ImpTextframeHdl::CreateB2dIAObject()
1616 // first throw away old one
1617 GetRidOfIAObject();
1619 if(pHdlList)
1621 SdrMarkView* pView = pHdlList->GetView();
1623 if(pView && !pView->areMarkHandlesHidden())
1625 SdrPageView* pPageView = pView->GetSdrPageView();
1627 if(pPageView)
1629 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1631 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1633 if(rPageWindow.GetPaintWindow().OutputToWindow())
1635 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1636 if (xManager.is())
1638 const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
1639 const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
1640 const svtools::ColorConfig aColorConfig;
1641 const Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
1643 ::sdr::overlay::OverlayHatchRect* pNewOverlayObject = new ::sdr::overlay::OverlayHatchRect(
1644 aTopLeft,
1645 aBottomRight,
1646 aHatchCol,
1647 3.0,
1648 3.0,
1649 45 * F_PI180,
1650 nDrehWink * -F_PI18000);
1651 pNewOverlayObject->setHittable(false);
1653 // OVERLAYMANAGER
1654 if(pNewOverlayObject)
1656 xManager->add(*pNewOverlayObject);
1657 maOverlayGroup.append(*pNewOverlayObject);
1667 ////////////////////////////////////////////////////////////////////////////////////////////////////
1669 class ImpSdrHdlListSorter: public ContainerSorter {
1670 public:
1671 ImpSdrHdlListSorter(Container& rNewCont): ContainerSorter(rNewCont) {}
1672 virtual ~ImpSdrHdlListSorter() {}
1673 virtual int Compare(const void* pElem1, const void* pElem2) const;
1676 int ImpSdrHdlListSorter::Compare(const void* pElem1, const void* pElem2) const
1678 SdrHdlKind eKind1=((SdrHdl*)pElem1)->GetKind();
1679 SdrHdlKind eKind2=((SdrHdl*)pElem2)->GetKind();
1680 // Level 1: first normal handles, then Glue, then User, then Plus handles, then reference point handles
1681 unsigned n1=1;
1682 unsigned n2=1;
1683 if (eKind1!=eKind2)
1685 if (eKind1==HDL_REF1 || eKind1==HDL_REF2 || eKind1==HDL_MIRX) n1=5;
1686 else if (eKind1==HDL_GLUE || eKind1==HDL_GLUE_DESELECTED) n1=2;
1687 else if (eKind1==HDL_USER) n1=3;
1688 else if (eKind1==HDL_SMARTTAG) n1=0;
1689 if (eKind2==HDL_REF1 || eKind2==HDL_REF2 || eKind2==HDL_MIRX) n2=5;
1690 else if (eKind2==HDL_GLUE || eKind2==HDL_GLUE_DESELECTED) n2=2;
1691 else if (eKind2==HDL_USER) n2=3;
1692 else if (eKind2==HDL_SMARTTAG) n2=0;
1694 if (((SdrHdl*)pElem1)->IsPlusHdl()) n1=4;
1695 if (((SdrHdl*)pElem2)->IsPlusHdl()) n2=4;
1696 if (n1==n2)
1698 // Level 2: PageView (Pointer)
1699 SdrPageView* pPV1=((SdrHdl*)pElem1)->GetPageView();
1700 SdrPageView* pPV2=((SdrHdl*)pElem2)->GetPageView();
1701 if (pPV1==pPV2)
1703 // Level 3: Position (x+y)
1704 SdrObject* pObj1=((SdrHdl*)pElem1)->GetObj();
1705 SdrObject* pObj2=((SdrHdl*)pElem2)->GetObj();
1706 if (pObj1==pObj2)
1708 sal_uInt32 nNum1=((SdrHdl*)pElem1)->GetObjHdlNum();
1709 sal_uInt32 nNum2=((SdrHdl*)pElem2)->GetObjHdlNum();
1710 if (nNum1==nNum2)
1712 if (eKind1==eKind2)
1713 return (long)pElem1<(long)pElem2 ? -1 : 1; // Hack, to always get to the same sorting
1714 return (sal_uInt16)eKind1<(sal_uInt16)eKind2 ? -1 : 1;
1716 else
1717 return nNum1<nNum2 ? -1 : 1;
1719 else
1721 return (long)pObj1<(long)pObj2 ? -1 : 1;
1724 else
1726 return (long)pPV1<(long)pPV2 ? -1 : 1;
1729 else
1731 return n1<n2 ? -1 : 1;
1735 SdrMarkView* SdrHdlList::GetView() const
1737 return pView;
1740 // Helper struct for re-sorting handles
1741 struct ImplHdlAndIndex
1743 SdrHdl* mpHdl;
1744 sal_uInt32 mnIndex;
1747 // Helper method for sorting handles taking care of OrdNums, keeping order in
1748 // single objects and re-sorting polygon handles intuitively
1749 extern "C" int __LOADONCALLAPI ImplSortHdlFunc( const void* pVoid1, const void* pVoid2 )
1751 const ImplHdlAndIndex* p1 = (ImplHdlAndIndex*)pVoid1;
1752 const ImplHdlAndIndex* p2 = (ImplHdlAndIndex*)pVoid2;
1754 if(p1->mpHdl->GetObj() == p2->mpHdl->GetObj())
1756 if(p1->mpHdl->GetObj() && p1->mpHdl->GetObj()->ISA(SdrPathObj))
1758 // same object and a path object
1759 if((p1->mpHdl->GetKind() == HDL_POLY || p1->mpHdl->GetKind() == HDL_BWGT)
1760 && (p2->mpHdl->GetKind() == HDL_POLY || p2->mpHdl->GetKind() == HDL_BWGT))
1762 // both handles are point or control handles
1763 if(p1->mpHdl->GetPolyNum() == p2->mpHdl->GetPolyNum())
1765 if(p1->mpHdl->GetPointNum() < p2->mpHdl->GetPointNum())
1767 return -1;
1769 else
1771 return 1;
1774 else if(p1->mpHdl->GetPolyNum() < p2->mpHdl->GetPolyNum())
1776 return -1;
1778 else
1780 return 1;
1785 else
1787 if(!p1->mpHdl->GetObj())
1789 return -1;
1791 else if(!p2->mpHdl->GetObj())
1793 return 1;
1795 else
1797 // different objects, use OrdNum for sort
1798 const sal_uInt32 nOrdNum1 = p1->mpHdl->GetObj()->GetOrdNum();
1799 const sal_uInt32 nOrdNum2 = p2->mpHdl->GetObj()->GetOrdNum();
1801 if(nOrdNum1 < nOrdNum2)
1803 return -1;
1805 else
1807 return 1;
1812 // fallback to indices
1813 if(p1->mnIndex < p2->mnIndex)
1815 return -1;
1817 else
1819 return 1;
1823 ////////////////////////////////////////////////////////////////////////////////////////////////////
1825 void SdrHdlList::TravelFocusHdl(sal_Bool bForward)
1827 // security correction
1828 if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex >= GetHdlCount())
1829 mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1831 if(aList.Count())
1833 // take care of old handle
1834 const sal_uIntPtr nOldHdlNum(mnFocusIndex);
1835 SdrHdl* pOld = GetHdl(nOldHdlNum);
1837 if(pOld)
1839 // switch off old handle
1840 mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1841 pOld->Touch();
1844 // allocate pointer array for sorted handle list
1845 ImplHdlAndIndex* pHdlAndIndex = new ImplHdlAndIndex[aList.Count()];
1847 // build sorted handle list
1848 sal_uInt32 a;
1849 for( a = 0; a < aList.Count(); a++)
1851 pHdlAndIndex[a].mpHdl = (SdrHdl*)aList.GetObject(a);
1852 pHdlAndIndex[a].mnIndex = a;
1855 qsort(pHdlAndIndex, aList.Count(), sizeof(ImplHdlAndIndex), ImplSortHdlFunc);
1857 // look for old num in sorted array
1858 sal_uIntPtr nOldHdl(nOldHdlNum);
1860 if(nOldHdlNum != CONTAINER_ENTRY_NOTFOUND)
1862 for(a = 0; a < aList.Count(); a++)
1864 if(pHdlAndIndex[a].mpHdl == pOld)
1866 nOldHdl = a;
1867 break;
1872 // build new HdlNum
1873 sal_uIntPtr nNewHdl(nOldHdl);
1875 // do the focus travel
1876 if(bForward)
1878 if(nOldHdl != CONTAINER_ENTRY_NOTFOUND)
1880 if(nOldHdl == aList.Count() - 1)
1882 // end forward run
1883 nNewHdl = CONTAINER_ENTRY_NOTFOUND;
1885 else
1887 // simply the next handle
1888 nNewHdl++;
1891 else
1893 // start forward run at first entry
1894 nNewHdl = 0;
1897 else
1899 if(nOldHdl == CONTAINER_ENTRY_NOTFOUND)
1901 // start backward run at last entry
1902 nNewHdl = aList.Count() - 1;
1905 else
1907 if(nOldHdl == 0)
1909 // end backward run
1910 nNewHdl = CONTAINER_ENTRY_NOTFOUND;
1912 else
1914 // simply the previous handle
1915 nNewHdl--;
1920 // build new HdlNum
1921 sal_uInt32 nNewHdlNum(nNewHdl);
1923 // look for old num in sorted array
1924 if(nNewHdl != CONTAINER_ENTRY_NOTFOUND)
1926 SdrHdl* pNew = pHdlAndIndex[nNewHdl].mpHdl;
1928 for(a = 0; a < aList.Count(); a++)
1930 if((SdrHdl*)aList.GetObject(a) == pNew)
1932 nNewHdlNum = a;
1933 break;
1938 // take care of next handle
1939 if(nOldHdlNum != nNewHdlNum)
1941 mnFocusIndex = nNewHdlNum;
1942 SdrHdl* pNew = GetHdl(mnFocusIndex);
1944 if(pNew)
1946 pNew->Touch();
1950 // free memory again
1951 delete [] pHdlAndIndex;
1955 SdrHdl* SdrHdlList::GetFocusHdl() const
1957 if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex < GetHdlCount())
1958 return GetHdl(mnFocusIndex);
1959 else
1960 return 0L;
1963 void SdrHdlList::SetFocusHdl(SdrHdl* pNew)
1965 if(pNew)
1967 SdrHdl* pActual = GetFocusHdl();
1969 if(!pActual || pActual != pNew)
1971 sal_uIntPtr nNewHdlNum = GetHdlNum(pNew);
1973 if(nNewHdlNum != CONTAINER_ENTRY_NOTFOUND)
1975 mnFocusIndex = nNewHdlNum;
1977 if(pActual)
1979 pActual->Touch();
1982 if(pNew)
1984 pNew->Touch();
1992 void SdrHdlList::ResetFocusHdl()
1994 SdrHdl* pHdl = GetFocusHdl();
1996 mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1998 if(pHdl)
2000 pHdl->Touch();
2004 ////////////////////////////////////////////////////////////////////////////////////////////////////
2006 SdrHdlList::SdrHdlList(SdrMarkView* pV)
2007 : mnFocusIndex(CONTAINER_ENTRY_NOTFOUND),
2008 pView(pV),
2009 aList(1024,32,32)
2011 nHdlSize = 3;
2012 bRotateShear = sal_False;
2013 bMoveOutside = sal_False;
2014 bDistortShear = sal_False;
2017 SdrHdlList::~SdrHdlList()
2019 Clear();
2022 void SdrHdlList::SetHdlSize(sal_uInt16 nSiz)
2024 if(nHdlSize != nSiz)
2026 // remember new value
2027 nHdlSize = nSiz;
2029 // propagate change to IAOs
2030 for(sal_uInt32 i=0; i<GetHdlCount(); i++)
2032 SdrHdl* pHdl = GetHdl(i);
2033 pHdl->Touch();
2038 void SdrHdlList::SetMoveOutside(sal_Bool bOn)
2040 if(bMoveOutside != bOn)
2042 // remember new value
2043 bMoveOutside = bOn;
2045 // propagate change to IAOs
2046 for(sal_uInt32 i=0; i<GetHdlCount(); i++)
2048 SdrHdl* pHdl = GetHdl(i);
2049 pHdl->Touch();
2054 void SdrHdlList::SetRotateShear(sal_Bool bOn)
2056 bRotateShear = bOn;
2059 void SdrHdlList::SetDistortShear(sal_Bool bOn)
2061 bDistortShear = bOn;
2064 SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum)
2066 SdrHdl* pRetval = (SdrHdl*)aList.Remove(nNum);
2068 return pRetval;
2071 void SdrHdlList::RemoveAllByKind(SdrHdlKind eKind)
2073 SdrHdl* p = static_cast<SdrHdl*>(aList.Last());
2074 while (p)
2076 if (p->GetKind() == eKind)
2078 // If removing an item doesn't invalidate the current position,
2079 // then perhaps it's safe to keep calling Prev here. But then I'm
2080 // too lazy to find out & this Container needs to be replaced by
2081 // STL anyways... :-P
2082 aList.Remove(p);
2083 delete p;
2084 p = static_cast<SdrHdl*>(aList.Last()); // start from the back again.
2086 else
2087 p = static_cast<SdrHdl*>(aList.Prev());
2091 void SdrHdlList::Clear()
2093 for (sal_uIntPtr i=0; i<GetHdlCount(); i++)
2095 SdrHdl* pHdl=GetHdl(i);
2096 delete pHdl;
2098 aList.Clear();
2100 bRotateShear=sal_False;
2101 bDistortShear=sal_False;
2104 void SdrHdlList::Sort()
2106 // remember currently focused handle
2107 SdrHdl* pPrev = GetFocusHdl();
2109 ImpSdrHdlListSorter aSort(aList);
2110 aSort.DoSort();
2112 // get now and compare
2113 SdrHdl* pNow = GetFocusHdl();
2115 if(pPrev != pNow)
2118 if(pPrev)
2120 pPrev->Touch();
2123 if(pNow)
2125 pNow->Touch();
2130 sal_uIntPtr SdrHdlList::GetHdlNum(const SdrHdl* pHdl) const
2132 if (pHdl==NULL)
2133 return CONTAINER_ENTRY_NOTFOUND;
2134 sal_uIntPtr nPos=aList.GetPos(pHdl);
2135 return nPos;
2138 void SdrHdlList::AddHdl(SdrHdl* pHdl, sal_Bool bAtBegin)
2140 if (pHdl!=NULL)
2142 if (bAtBegin)
2144 aList.Insert(pHdl,sal_uIntPtr(0));
2146 else
2148 aList.Insert(pHdl,CONTAINER_APPEND);
2150 pHdl->SetHdlList(this);
2154 SdrHdl* SdrHdlList::IsHdlListHit(const Point& rPnt, sal_Bool bBack, sal_Bool bNext, SdrHdl* pHdl0) const
2156 SdrHdl* pRet=NULL;
2157 sal_uIntPtr nAnz=GetHdlCount();
2158 sal_uIntPtr nNum=bBack ? 0 : nAnz;
2159 while ((bBack ? nNum<nAnz : nNum>0) && pRet==NULL)
2161 if (!bBack)
2162 nNum--;
2163 SdrHdl* pHdl=GetHdl(nNum);
2164 if (bNext)
2166 if (pHdl==pHdl0)
2167 bNext=sal_False;
2169 else
2171 if (pHdl->IsHdlHit(rPnt))
2172 pRet=pHdl;
2174 if (bBack)
2175 nNum++;
2177 return pRet;
2180 SdrHdl* SdrHdlList::GetHdl(SdrHdlKind eKind1) const
2182 SdrHdl* pRet=NULL;
2183 for (sal_uIntPtr i=0; i<GetHdlCount() && pRet==NULL; i++)
2185 SdrHdl* pHdl=GetHdl(i);
2186 if (pHdl->GetKind()==eKind1)
2187 pRet=pHdl;
2189 return pRet;
2192 // --------------------------------------------------------------------
2193 // SdrCropHdl
2194 // --------------------------------------------------------------------
2196 SdrCropHdl::SdrCropHdl(const Point& rPnt, SdrHdlKind eNewKind)
2197 : SdrHdl( rPnt, eNewKind )
2201 // --------------------------------------------------------------------
2203 BitmapEx SdrCropHdl::GetHandlesBitmap()
2205 static BitmapEx* pModernBitmap = 0;
2206 if( pModernBitmap == 0 )
2207 pModernBitmap = new BitmapEx(ResId(SIP_SA_CROP_MARKERS, *ImpGetResMgr()));
2208 return *pModernBitmap;
2211 // --------------------------------------------------------------------
2213 BitmapEx SdrCropHdl::GetBitmapForHandle( const BitmapEx& rBitmap, int nSize )
2215 int nPixelSize = 0, nX = 0, nY = 0, nOffset = 0;
2217 if( nSize <= 3 )
2219 nPixelSize = 13;
2220 nOffset = 0;
2222 else if( nSize <=4 )
2224 nPixelSize = 17;
2225 nOffset = 39;
2227 else
2229 nPixelSize = 21;
2230 nOffset = 90;
2233 switch( eKind )
2235 case HDL_UPLFT: nX = 0; nY = 0; break;
2236 case HDL_UPPER: nX = 1; nY = 0; break;
2237 case HDL_UPRGT: nX = 2; nY = 0; break;
2238 case HDL_LEFT: nX = 0; nY = 1; break;
2239 case HDL_RIGHT: nX = 2; nY = 1; break;
2240 case HDL_LWLFT: nX = 0; nY = 2; break;
2241 case HDL_LOWER: nX = 1; nY = 2; break;
2242 case HDL_LWRGT: nX = 2; nY = 2; break;
2243 default: break;
2246 Rectangle aSourceRect( Point( nX * (nPixelSize) + nOffset, nY * (nPixelSize)), Size(nPixelSize, nPixelSize) );
2248 BitmapEx aRetval(rBitmap);
2249 aRetval.Crop(aSourceRect);
2250 return aRetval;
2253 // --------------------------------------------------------------------
2255 void SdrCropHdl::CreateB2dIAObject()
2257 // first throw away old one
2258 GetRidOfIAObject();
2260 SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
2261 SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
2263 if( pPageView && !pView->areMarkHandlesHidden() )
2265 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2266 int nHdlSize = pHdlList->GetHdlSize();
2268 const BitmapEx aHandlesBitmap( GetHandlesBitmap() );
2269 BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
2271 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
2273 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
2275 if(rPageWindow.GetPaintWindow().OutputToWindow())
2277 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
2278 if (xManager.is())
2280 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
2282 ::sdr::overlay::OverlayObject* pOverlayObject = 0L;
2284 // animate focused handles
2285 if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
2287 if( nHdlSize >= 2 )
2288 nHdlSize = 1;
2290 BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
2292 const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
2294 pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBmpEx1, aBmpEx2, nBlinkTime,
2295 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2296 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2297 (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
2298 (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
2300 else
2302 // create centered handle as default
2303 pOverlayObject = new ::sdr::overlay::OverlayBitmapEx(aPosition, aBmpEx1,
2304 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2305 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1);
2308 // OVERLAYMANAGER
2309 if(pOverlayObject)
2311 xManager->add(*pOverlayObject);
2312 maOverlayGroup.append(*pOverlayObject);
2320 // --------------------------------------------------------------------
2322 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */