bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / svdraw / svdhdl.cxx
bloba153bdd8f7a4680647b2fb81e5262ec07296ffb7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <algorithm>
23 #include <svx/svdhdl.hxx>
24 #include <svx/svdpagv.hxx>
25 #include <svx/svdetc.hxx>
26 #include <svx/svdmrkv.hxx>
27 #include <vcl/window.hxx>
29 #include <vcl/virdev.hxx>
30 #include <tools/poly.hxx>
31 #include <vcl/bmpacc.hxx>
33 #include <svx/sxekitm.hxx>
34 #include "svx/svdstr.hrc"
35 #include "svx/svdglob.hxx"
37 #include <svx/svdmodel.hxx>
38 #include "gradtrns.hxx"
39 #include <svx/xflgrit.hxx>
40 #include <svx/svdundo.hxx>
41 #include <svx/dialmgr.hxx>
42 #include <svx/xflftrit.hxx>
44 // #105678#
45 #include <svx/svdopath.hxx>
46 #include <basegfx/vector/b2dvector.hxx>
47 #include <basegfx/polygon/b2dpolygon.hxx>
48 #include <svx/sdr/overlay/overlaymanager.hxx>
49 #include <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
50 #include <svx/sdr/overlay/overlaybitmapex.hxx>
51 #include <svx/sdr/overlay/overlayline.hxx>
52 #include <svx/sdr/overlay/overlaytriangle.hxx>
53 #include <svx/sdr/overlay/overlayhatchrect.hxx>
54 #include <svx/sdrpagewindow.hxx>
55 #include <svx/sdrpaintwindow.hxx>
56 #include <vcl/svapp.hxx>
57 #include <svx/sdr/overlay/overlaypolypolygon.hxx>
58 #include <vcl/lazydelete.hxx>
60 ////////////////////////////////////////////////////////////////////////////////////////////////////
61 // #i15222#
62 // Due to the resource problems in Win95/98 with bitmap resources I
63 // will change this handle bitmap providing class. Old version was splitting
64 // and preparing all small handle bitmaps in device bitmap format, now this will
65 // be done on the fly. Thus, there is only one big bitmap in memory. With
66 // three source bitmaps, this will be 3 system bitmap resources instead of hundreds.
67 // The price for that needs to be evaluated. Maybe we will need another change here
68 // if this is too expensive.
69 class SdrHdlBitmapSet
71 // the bitmap holding all information
72 BitmapEx maMarkersBitmap;
74 // the cropped Bitmaps for reusage
75 ::std::vector< BitmapEx > maRealMarkers;
77 // helpers
78 BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle);
80 public:
81 SdrHdlBitmapSet(sal_uInt16 nResId);
82 ~SdrHdlBitmapSet();
84 const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd=0);
87 ////////////////////////////////////////////////////////////////////////////////////////////////////
88 #define KIND_COUNT (14)
89 #define INDEX_COUNT (6)
90 #define INDIVIDUAL_COUNT (5)
92 SdrHdlBitmapSet::SdrHdlBitmapSet(sal_uInt16 nResId)
93 : maMarkersBitmap(ResId(nResId, *ImpGetResMgr())),
94 // 15 kinds (BitmapMarkerKind) use index [0..5] + 5 extra
95 maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT)
99 SdrHdlBitmapSet::~SdrHdlBitmapSet()
103 BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle)
105 BitmapEx& rTargetBitmap = maRealMarkers[nIndex];
107 if(rTargetBitmap.IsEmpty())
109 rTargetBitmap = maMarkersBitmap;
110 rTargetBitmap.Crop(rRectangle);
113 return rTargetBitmap;
116 // change getting of bitmap to use the big resource bitmap
117 const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
119 // fill in size and source position in maMarkersBitmap
120 const sal_uInt16 nYPos(nInd * 11);
122 switch(eKindOfMarker)
124 default:
126 OSL_FAIL( "Unknown kind of marker." );
127 // no break here, return Rect_9x9 as default
129 case Rect_9x9:
131 return impGetOrCreateTargetBitmap((1 * INDEX_COUNT) + nInd, Rectangle(Point(7, nYPos), Size(9, 9)));
134 case Rect_7x7:
136 return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, Rectangle(Point(0, nYPos), Size(7, 7)));
139 case Rect_11x11:
141 return impGetOrCreateTargetBitmap((2 * INDEX_COUNT) + nInd, Rectangle(Point(16, nYPos), Size(11, 11)));
144 case Rect_13x13:
146 const sal_uInt16 nIndex((3 * INDEX_COUNT) + nInd);
148 switch(nInd)
150 case 0:
152 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 66), Size(13, 13)));
154 case 1:
156 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 66), Size(13, 13)));
158 case 2:
160 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 79), Size(13, 13)));
162 case 3:
164 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 79), Size(13, 13)));
166 case 4:
168 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 79), Size(13, 13)));
170 default: // case 5:
172 return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 66), Size(13, 13)));
177 case Circ_7x7:
179 return impGetOrCreateTargetBitmap((4 * INDEX_COUNT) + nInd, Rectangle(Point(27, nYPos), Size(7, 7)));
182 case Circ_9x9:
183 case Customshape1:
185 return impGetOrCreateTargetBitmap((5 * INDEX_COUNT) + nInd, Rectangle(Point(34, nYPos), Size(9, 9)));
188 case Circ_11x11:
190 return impGetOrCreateTargetBitmap((6 * INDEX_COUNT) + nInd, Rectangle(Point(43, nYPos), Size(11, 11)));
193 case Elli_7x9:
195 return impGetOrCreateTargetBitmap((7 * INDEX_COUNT) + nInd, Rectangle(Point(54, nYPos), Size(7, 9)));
198 case Elli_9x11:
200 return impGetOrCreateTargetBitmap((8 * INDEX_COUNT) + nInd, Rectangle(Point(61, nYPos), Size(9, 11)));
203 case Elli_9x7:
205 return impGetOrCreateTargetBitmap((9 * INDEX_COUNT) + nInd, Rectangle(Point(70, nYPos), Size(9, 7)));
208 case Elli_11x9:
210 return impGetOrCreateTargetBitmap((10 * INDEX_COUNT) + nInd, Rectangle(Point(79, nYPos), Size(11, 9)));
213 case RectPlus_7x7:
215 return impGetOrCreateTargetBitmap((11 * INDEX_COUNT) + nInd, Rectangle(Point(90, nYPos), Size(7, 7)));
218 case RectPlus_9x9:
220 return impGetOrCreateTargetBitmap((12 * INDEX_COUNT) + nInd, Rectangle(Point(97, nYPos), Size(9, 9)));
223 case RectPlus_11x11:
225 return impGetOrCreateTargetBitmap((13 * INDEX_COUNT) + nInd, Rectangle(Point(106, nYPos), Size(11, 11)));
228 case Crosshair:
230 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 0, Rectangle(Point(0, 68), Size(15, 15)));
233 case Glue:
235 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 76), Size(9, 9)));
238 case Glue_Deselected:
240 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, Rectangle(Point(15, 67), Size(9, 9)));
243 case Anchor: // AnchorTR for SW
244 case AnchorTR:
246 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(24, 67), Size(24, 24)));
249 // add AnchorPressed to be able to animate anchor control
250 case AnchorPressed:
251 case AnchorPressedTR:
253 return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 4, Rectangle(Point(48, 67), Size(24, 24)));
258 ////////////////////////////////////////////////////////////////////////////////////////////////////
260 SdrHdl::SdrHdl():
261 pObj(NULL),
262 pPV(NULL),
263 pHdlList(NULL),
264 eKind(HDL_MOVE),
265 nDrehWink(0),
266 nObjHdlNum(0),
267 nPolyNum(0),
268 nPPntNum(0),
269 nSourceHdlNum(0),
270 bSelect(sal_False),
271 b1PixMore(sal_False),
272 bPlusHdl(sal_False),
273 mbMoveOutside(false),
274 mbMouseOver(false)
278 SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind):
279 pObj(NULL),
280 pPV(NULL),
281 pHdlList(NULL),
282 aPos(rPnt),
283 eKind(eNewKind),
284 nDrehWink(0),
285 nObjHdlNum(0),
286 nPolyNum(0),
287 nPPntNum(0),
288 nSourceHdlNum(0),
289 bSelect(sal_False),
290 b1PixMore(sal_False),
291 bPlusHdl(sal_False),
292 mbMoveOutside(false),
293 mbMouseOver(false)
297 SdrHdl::~SdrHdl()
299 GetRidOfIAObject();
302 void SdrHdl::Set1PixMore(sal_Bool bJa)
304 if(b1PixMore != bJa)
306 b1PixMore = bJa;
308 // create new display
309 Touch();
313 void SdrHdl::SetMoveOutside( bool bMoveOutside )
315 if(mbMoveOutside != bMoveOutside)
317 mbMoveOutside = bMoveOutside;
319 // create new display
320 Touch();
324 void SdrHdl::SetDrehWink(long n)
326 if(nDrehWink != n)
328 nDrehWink = n;
330 // create new display
331 Touch();
335 void SdrHdl::SetPos(const Point& rPnt)
337 if(aPos != rPnt)
339 // remember new position
340 aPos = rPnt;
342 // create new display
343 Touch();
347 void SdrHdl::SetSelected(sal_Bool bJa)
349 if(bSelect != bJa)
351 // remember new value
352 bSelect = bJa;
354 // create new display
355 Touch();
359 void SdrHdl::SetHdlList(SdrHdlList* pList)
361 if(pHdlList != pList)
363 // rememver list
364 pHdlList = pList;
366 // now its possible to create graphic representation
367 Touch();
371 void SdrHdl::SetObj(SdrObject* pNewObj)
373 if(pObj != pNewObj)
375 // remember new object
376 pObj = pNewObj;
378 // graphic representation may have changed
379 Touch();
383 void SdrHdl::Touch()
385 // force update of graphic representation
386 CreateB2dIAObject();
389 void SdrHdl::GetRidOfIAObject()
392 // OVERLAYMANAGER
393 maOverlayGroup.clear();
396 void SdrHdl::CreateB2dIAObject()
398 // first throw away old one
399 GetRidOfIAObject();
401 if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
403 BitmapColorIndex eColIndex = LightGreen;
404 BitmapMarkerKind eKindOfMarker = Rect_7x7;
406 sal_Bool bRot = pHdlList->IsRotateShear();
407 if(pObj)
408 eColIndex = (bSelect) ? Cyan : LightCyan;
409 if(bRot)
411 // red rotation handles
412 if(pObj && bSelect)
413 eColIndex = Red;
414 else
415 eColIndex = LightRed;
418 switch(eKind)
420 case HDL_MOVE:
422 eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
423 break;
425 case HDL_UPLFT:
426 case HDL_UPRGT:
427 case HDL_LWLFT:
428 case HDL_LWRGT:
430 // corner handles
431 if(bRot)
433 eKindOfMarker = Circ_7x7;
435 else
437 eKindOfMarker = Rect_7x7;
439 break;
441 case HDL_UPPER:
442 case HDL_LOWER:
444 // Upper/Lower handles
445 if(bRot)
447 eKindOfMarker = Elli_9x7;
449 else
451 eKindOfMarker = Rect_7x7;
453 break;
455 case HDL_LEFT:
456 case HDL_RIGHT:
458 // Left/Right handles
459 if(bRot)
461 eKindOfMarker = Elli_7x9;
463 else
465 eKindOfMarker = Rect_7x7;
467 break;
469 case HDL_POLY:
471 if(bRot)
473 eKindOfMarker = (b1PixMore) ? Circ_9x9 : Circ_7x7;
475 else
477 eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
479 break;
481 case HDL_BWGT: // weight at poly
483 eKindOfMarker = Circ_7x7;
484 break;
486 case HDL_CIRC:
488 eKindOfMarker = Rect_11x11;
489 break;
491 case HDL_REF1:
492 case HDL_REF2:
494 eKindOfMarker = Crosshair;
495 break;
497 case HDL_GLUE:
499 eKindOfMarker = Glue;
500 break;
502 case HDL_GLUE_DESELECTED:
504 eKindOfMarker = Glue_Deselected;
505 break;
507 case HDL_ANCHOR:
509 eKindOfMarker = Anchor;
510 break;
512 case HDL_USER:
514 break;
516 // top right anchor for SW
517 case HDL_ANCHOR_TR:
519 eKindOfMarker = AnchorTR;
520 break;
523 // for SJ and the CustomShapeHandles:
524 case HDL_CUSTOMSHAPE1:
526 eKindOfMarker = Customshape1;
527 eColIndex = Yellow;
528 break;
530 default:
531 break;
534 SdrMarkView* pView = pHdlList->GetView();
535 SdrPageView* pPageView = pView->GetSdrPageView();
537 if(pPageView)
539 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
541 // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
542 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
544 if(rPageWindow.GetPaintWindow().OutputToWindow())
546 Point aMoveOutsideOffset(0, 0);
548 // add offset if necessary
549 if(pHdlList->IsMoveOutside() || mbMoveOutside)
551 OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
552 Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
554 if(eKind == HDL_UPLFT || eKind == HDL_UPPER || eKind == HDL_UPRGT)
555 aMoveOutsideOffset.Y() -= aOffset.Width();
556 if(eKind == HDL_LWLFT || eKind == HDL_LOWER || eKind == HDL_LWRGT)
557 aMoveOutsideOffset.Y() += aOffset.Height();
558 if(eKind == HDL_UPLFT || eKind == HDL_LEFT || eKind == HDL_LWLFT)
559 aMoveOutsideOffset.X() -= aOffset.Width();
560 if(eKind == HDL_UPRGT || eKind == HDL_RIGHT || eKind == HDL_LWRGT)
561 aMoveOutsideOffset.X() += aOffset.Height();
564 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
565 if (xManager.is())
567 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
568 ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
569 aPosition,
570 eColIndex,
571 eKindOfMarker,
572 aMoveOutsideOffset);
574 // OVERLAYMANAGER
575 if(pNewOverlayObject)
577 xManager->add(*pNewOverlayObject);
578 maOverlayGroup.append(*pNewOverlayObject);
587 BitmapMarkerKind SdrHdl::GetNextBigger(BitmapMarkerKind eKnd) const
589 BitmapMarkerKind eRetval(eKnd);
591 switch(eKnd)
593 case Rect_7x7: eRetval = Rect_9x9; break;
594 case Rect_9x9: eRetval = Rect_11x11; break;
595 case Rect_11x11: eRetval = Rect_13x13; break;
597 case Circ_7x7: eRetval = Circ_9x9; break;
598 case Circ_9x9: eRetval = Circ_11x11; break;
600 case Elli_7x9: eRetval = Elli_9x11; break;
602 case Elli_9x7: eRetval = Elli_11x9; break;
604 case RectPlus_7x7: eRetval = RectPlus_9x9; break;
605 case RectPlus_9x9: eRetval = RectPlus_11x11; break;
607 // let anchor blink with its pressed state
608 case Anchor: eRetval = AnchorPressed; break;
610 // same for AnchorTR
611 case AnchorTR: eRetval = AnchorPressedTR; break;
612 default:
613 break;
616 return eRetval;
619 BitmapEx SdrHdl::ImpGetBitmapEx( BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
621 static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_MARKERS));
622 return aModernSet.get()->GetBitmapEx(eKindOfMarker, nInd);
625 ::sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
626 const basegfx::B2DPoint& rPos,
627 BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset)
629 ::sdr::overlay::OverlayObject* pRetval = 0L;
631 // support bigger sizes
632 bool bForceBiggerSize(false);
634 if(pHdlList->GetHdlSize() > 3)
636 bForceBiggerSize = true;
639 if(bForceBiggerSize)
641 eKindOfMarker = GetNextBigger(eKindOfMarker);
644 // This handle has the focus, visualize it
645 if(IsFocusHdl() && pHdlList && pHdlList->GetFocusHdl() == this)
647 // create animated handle
648 BitmapMarkerKind eNextBigger = GetNextBigger(eKindOfMarker);
650 if(eNextBigger == eKindOfMarker)
652 // this may happen for the not supported getting-bigger types.
653 // Choose an alternative here
654 switch(eKindOfMarker)
656 case Rect_13x13: eNextBigger = Rect_11x11; break;
657 case Circ_11x11: eNextBigger = Elli_11x9; break;
658 case Elli_9x11: eNextBigger = Elli_11x9; break;
659 case Elli_11x9: eNextBigger = Elli_9x11; break;
660 case RectPlus_11x11: eNextBigger = Rect_13x13; break;
662 case Crosshair:
663 eNextBigger = Glue;
664 break;
666 case Glue:
667 eNextBigger = Crosshair;
668 break;
669 case Glue_Deselected:
670 eNextBigger = Glue;
671 break;
672 default:
673 break;
677 // create animated handle
678 BitmapEx aBmpEx1 = ImpGetBitmapEx( eKindOfMarker, (sal_uInt16)eColIndex );
679 BitmapEx aBmpEx2 = ImpGetBitmapEx( eNextBigger, (sal_uInt16)eColIndex );
681 // #i53216# Use system cursor blink time. Use the unsigned value.
682 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
683 const sal_uInt32 nBlinkTime((sal_uInt32)rStyleSettings.GetCursorBlinkTime());
685 if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
687 // when anchor is used take upper left as reference point inside the handle
688 pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime);
690 else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
692 // AnchorTR for SW, take top right as (0,0)
693 pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
694 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1), 0,
695 (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1), 0);
697 else
699 // create centered handle as default
700 pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
701 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
702 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
703 (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
704 (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
707 else
709 // create normal handle: use ImpGetBitmapEx(...) now
710 BitmapEx aBmpEx = ImpGetBitmapEx(eKindOfMarker, (sal_uInt16)eColIndex);
712 if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
714 // upper left as reference point inside the handle for AnchorPressed, too
715 pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx);
717 else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
719 // AnchorTR for SW, take top right as (0,0)
720 pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
721 (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1), 0);
723 else
725 sal_uInt16 nCenX((sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1L) >> 1);
726 sal_uInt16 nCenY((sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1L) >> 1);
728 if(aMoveOutsideOffset.X() > 0)
730 nCenX = 0;
732 else if(aMoveOutsideOffset.X() < 0)
734 nCenX = (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1);
737 if(aMoveOutsideOffset.Y() > 0)
739 nCenY = 0;
741 else if(aMoveOutsideOffset.Y() < 0)
743 nCenY = (sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1);
746 // create centered handle as default
747 pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, nCenX, nCenY);
751 return pRetval;
754 bool SdrHdl::IsHdlHit(const Point& rPnt) const
756 // OVERLAYMANAGER
757 basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y());
758 return maOverlayGroup.isHitLogic(aPosition);
761 Pointer SdrHdl::GetPointer() const
763 PointerStyle ePtr=POINTER_MOVE;
764 const bool bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT;
765 const bool bRot=pHdlList!=NULL && pHdlList->IsRotateShear();
766 const bool bDis=pHdlList!=NULL && pHdlList->IsDistortShear();
767 if (bSize && pHdlList!=NULL && (bRot || bDis)) {
768 switch (eKind) {
769 case HDL_UPLFT: case HDL_UPRGT:
770 case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break;
771 case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break;
772 case HDL_UPPER: case HDL_LOWER: ePtr=POINTER_HSHEAR; break;
773 default:
774 break;
776 } else {
777 // When resizing rotated rectangles, rotate the mouse cursor slightly, too
778 if (bSize && nDrehWink!=0) {
779 long nHdlWink=0;
780 switch (eKind) {
781 case HDL_LWRGT: nHdlWink=31500; break;
782 case HDL_LOWER: nHdlWink=27000; break;
783 case HDL_LWLFT: nHdlWink=22500; break;
784 case HDL_LEFT : nHdlWink=18000; break;
785 case HDL_UPLFT: nHdlWink=13500; break;
786 case HDL_UPPER: nHdlWink=9000; break;
787 case HDL_UPRGT: nHdlWink=4500; break;
788 case HDL_RIGHT: nHdlWink=0; break;
789 default:
790 break;
792 nHdlWink+=nDrehWink+2249; // a little bit more (for rounding)
793 while (nHdlWink<0) nHdlWink+=36000;
794 while (nHdlWink>=36000) nHdlWink-=36000;
795 nHdlWink/=4500;
796 switch ((sal_uInt8)nHdlWink) {
797 case 0: ePtr=POINTER_ESIZE; break;
798 case 1: ePtr=POINTER_NESIZE; break;
799 case 2: ePtr=POINTER_NSIZE; break;
800 case 3: ePtr=POINTER_NWSIZE; break;
801 case 4: ePtr=POINTER_WSIZE; break;
802 case 5: ePtr=POINTER_SWSIZE; break;
803 case 6: ePtr=POINTER_SSIZE; break;
804 case 7: ePtr=POINTER_SESIZE; break;
805 } // switch
806 } else {
807 switch (eKind) {
808 case HDL_UPLFT: ePtr=POINTER_NWSIZE; break;
809 case HDL_UPPER: ePtr=POINTER_NSIZE; break;
810 case HDL_UPRGT: ePtr=POINTER_NESIZE; break;
811 case HDL_LEFT : ePtr=POINTER_WSIZE; break;
812 case HDL_RIGHT: ePtr=POINTER_ESIZE; break;
813 case HDL_LWLFT: ePtr=POINTER_SWSIZE; break;
814 case HDL_LOWER: ePtr=POINTER_SSIZE; break;
815 case HDL_LWRGT: ePtr=POINTER_SESIZE; break;
816 case HDL_POLY : ePtr=POINTER_MOVEPOINT; break;
817 case HDL_CIRC : ePtr=POINTER_HAND; break;
818 case HDL_REF1 : ePtr=POINTER_REFHAND; break;
819 case HDL_REF2 : ePtr=POINTER_REFHAND; break;
820 case HDL_BWGT : ePtr=POINTER_MOVEBEZIERWEIGHT; break;
821 case HDL_GLUE : ePtr=POINTER_MOVEPOINT; break;
822 case HDL_GLUE_DESELECTED : ePtr=POINTER_MOVEPOINT; break;
823 case HDL_CUSTOMSHAPE1 : ePtr=POINTER_HAND; break;
824 default:
825 break;
829 return Pointer(ePtr);
832 sal_Bool SdrHdl::IsFocusHdl() const
834 switch(eKind)
836 case HDL_UPLFT:
837 case HDL_UPPER:
838 case HDL_UPRGT:
839 case HDL_LEFT:
840 case HDL_RIGHT:
841 case HDL_LWLFT:
842 case HDL_LOWER:
843 case HDL_LWRGT:
845 // if it's an activated TextEdit, it's moved to extended points
846 if(pHdlList && pHdlList->IsMoveOutside())
847 return sal_False;
848 else
849 return sal_True;
852 case HDL_MOVE: // handle to move object
853 case HDL_POLY: // selected point of polygon or curve
854 case HDL_BWGT: // weight at a curve
855 case HDL_CIRC: // angle of circle segments, corner radius of rectangles
856 case HDL_REF1: // reference point 1, e. g. center of rotation
857 case HDL_REF2: // reference point 2, e. g. endpoint of reflection axis
858 case HDL_GLUE: // glue point
859 case HDL_GLUE_DESELECTED: // deselected glue point, used to be a little blue cross
861 // for SJ and the CustomShapeHandles:
862 case HDL_CUSTOMSHAPE1:
864 case HDL_USER:
866 return sal_True;
869 default:
871 return sal_False;
876 void SdrHdl::onMouseEnter(const MouseEvent& /*rMEvt*/)
880 void SdrHdl::onMouseLeave()
884 ////////////////////////////////////////////////////////////////////////////////////////////////////
885 // class SdrHdlColor
887 SdrHdlColor::SdrHdlColor(const Point& rRef, Color aCol, const Size& rSize, sal_Bool bLum)
888 : SdrHdl(rRef, HDL_COLR),
889 aMarkerSize(rSize),
890 bUseLuminance(bLum)
892 if(IsUseLuminance())
893 aCol = GetLuminance(aCol);
895 // remember color
896 aMarkerColor = aCol;
899 SdrHdlColor::~SdrHdlColor()
903 void SdrHdlColor::CreateB2dIAObject()
905 // first throw away old one
906 GetRidOfIAObject();
908 if(pHdlList)
910 SdrMarkView* pView = pHdlList->GetView();
912 if(pView && !pView->areMarkHandlesHidden())
914 SdrPageView* pPageView = pView->GetSdrPageView();
916 if(pPageView)
918 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
920 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
922 if(rPageWindow.GetPaintWindow().OutputToWindow())
924 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
925 if (xManager.is())
927 Bitmap aBmpCol(CreateColorDropper(aMarkerColor));
928 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
929 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
930 ::sdr::overlay::OverlayBitmapEx(
931 aPosition,
932 BitmapEx(aBmpCol),
933 (sal_uInt16)(aBmpCol.GetSizePixel().Width() - 1) >> 1,
934 (sal_uInt16)(aBmpCol.GetSizePixel().Height() - 1) >> 1
936 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
938 // OVERLAYMANAGER
939 if(pNewOverlayObject)
941 xManager->add(*pNewOverlayObject);
942 maOverlayGroup.append(*pNewOverlayObject);
952 Bitmap SdrHdlColor::CreateColorDropper(Color aCol)
954 // get the Bitmap
955 Bitmap aRetval(aMarkerSize, 24);
956 aRetval.Erase(aCol);
958 // get write access
959 BitmapWriteAccess* pWrite = aRetval.AcquireWriteAccess();
960 DBG_ASSERT(pWrite, "Got NO write access to a new Bitmap!");
962 if(pWrite)
964 // draw outer border
965 sal_Int32 nWidth = aMarkerSize.Width();
966 sal_Int32 nHeight = aMarkerSize.Height();
968 pWrite->SetLineColor(Color(COL_LIGHTGRAY));
969 pWrite->DrawLine(Point(0, 0), Point(0, nHeight - 1));
970 pWrite->DrawLine(Point(1, 0), Point(nWidth - 1, 0));
971 pWrite->SetLineColor(Color(COL_GRAY));
972 pWrite->DrawLine(Point(1, nHeight - 1), Point(nWidth - 1, nHeight - 1));
973 pWrite->DrawLine(Point(nWidth - 1, 1), Point(nWidth - 1, nHeight - 2));
975 // draw lighter UpperLeft
976 const Color aLightColor(
977 (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetRed() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
978 (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetGreen() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
979 (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetBlue() + (sal_Int16)0x0040), (sal_Int16)0x00ff)));
980 pWrite->SetLineColor(aLightColor);
981 pWrite->DrawLine(Point(1, 1), Point(1, nHeight - 2));
982 pWrite->DrawLine(Point(2, 1), Point(nWidth - 2, 1));
984 // draw darker LowerRight
985 const Color aDarkColor(
986 (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetRed() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
987 (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetGreen() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
988 (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetBlue() - (sal_Int16)0x0040), (sal_Int16)0x0000)));
989 pWrite->SetLineColor(aDarkColor);
990 pWrite->DrawLine(Point(2, nHeight - 2), Point(nWidth - 2, nHeight - 2));
991 pWrite->DrawLine(Point(nWidth - 2, 2), Point(nWidth - 2, nHeight - 3));
993 // get rid of write access
994 delete pWrite;
997 return aRetval;
1000 Color SdrHdlColor::GetLuminance(const Color& rCol)
1002 sal_uInt8 aLum = rCol.GetLuminance();
1003 Color aRetval(aLum, aLum, aLum);
1004 return aRetval;
1007 void SdrHdlColor::CallColorChangeLink()
1009 aColorChangeHdl.Call(this);
1012 void SdrHdlColor::SetColor(Color aNew, sal_Bool bCallLink)
1014 if(IsUseLuminance())
1015 aNew = GetLuminance(aNew);
1017 if(aMarkerColor != aNew)
1019 // remember new color
1020 aMarkerColor = aNew;
1022 // create new display
1023 Touch();
1025 // tell about change
1026 if(bCallLink)
1027 CallColorChangeLink();
1031 void SdrHdlColor::SetSize(const Size& rNew)
1033 if(rNew != aMarkerSize)
1035 // remember new size
1036 aMarkerSize = rNew;
1038 // create new display
1039 Touch();
1043 ////////////////////////////////////////////////////////////////////////////////////////////////////
1044 // class SdrHdlGradient
1046 SdrHdlGradient::SdrHdlGradient(const Point& rRef1, const Point& rRef2, sal_Bool bGrad)
1047 : SdrHdl(rRef1, bGrad ? HDL_GRAD : HDL_TRNS),
1048 pColHdl1(NULL),
1049 pColHdl2(NULL),
1050 a2ndPos(rRef2),
1051 bGradient(bGrad)
1055 SdrHdlGradient::~SdrHdlGradient()
1059 void SdrHdlGradient::Set2ndPos(const Point& rPnt)
1061 if(a2ndPos != rPnt)
1063 // remember new position
1064 a2ndPos = rPnt;
1066 // create new display
1067 Touch();
1071 void SdrHdlGradient::CreateB2dIAObject()
1073 // first throw away old one
1074 GetRidOfIAObject();
1076 if(pHdlList)
1078 SdrMarkView* pView = pHdlList->GetView();
1080 if(pView && !pView->areMarkHandlesHidden())
1082 SdrPageView* pPageView = pView->GetSdrPageView();
1084 if(pPageView)
1086 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1088 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1090 if(rPageWindow.GetPaintWindow().OutputToWindow())
1092 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1093 if (xManager.is())
1095 // striped line in between
1096 basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
1097 double fVecLen = aVec.getLength();
1098 double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
1099 double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
1100 aVec.normalize();
1101 basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
1102 sal_Int32 nMidX = (sal_Int32)(aPos.X() + aVec.getX() * fLongPercentArrow);
1103 sal_Int32 nMidY = (sal_Int32)(aPos.Y() + aVec.getY() * fLongPercentArrow);
1104 Point aMidPoint(nMidX, nMidY);
1106 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1107 basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
1109 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1110 ::sdr::overlay::OverlayLineStriped(
1111 aPosition, aMidPos
1113 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1115 pNewOverlayObject->setBaseColor(IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE));
1116 xManager->add(*pNewOverlayObject);
1117 maOverlayGroup.append(*pNewOverlayObject);
1119 // arrowhead
1120 Point aLeft(aMidPoint.X() + (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
1121 aMidPoint.Y() + (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
1122 Point aRight(aMidPoint.X() - (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
1123 aMidPoint.Y() - (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
1125 basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
1126 basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
1127 basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
1129 pNewOverlayObject = new
1130 ::sdr::overlay::OverlayTriangle(
1131 aPositionLeft,
1132 aPosition2,
1133 aPositionRight,
1134 IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)
1136 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1138 xManager->add(*pNewOverlayObject);
1139 maOverlayGroup.append(*pNewOverlayObject);
1148 IMPL_LINK(SdrHdlGradient, ColorChangeHdl, SdrHdl*, /*pHdl*/)
1150 if(GetObj())
1151 FromIAOToItem(GetObj(), sal_True, sal_True);
1152 return 0;
1155 void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, sal_Bool bSetItemOnObject, sal_Bool bUndo)
1157 // from IAO positions and colors to gradient
1158 const SfxItemSet& rSet = _pObj->GetMergedItemSet();
1160 GradTransformer aGradTransformer;
1161 GradTransGradient aOldGradTransGradient;
1162 GradTransGradient aGradTransGradient;
1163 GradTransVector aGradTransVector;
1165 String aString;
1167 aGradTransVector.maPositionA = basegfx::B2DPoint(GetPos().X(), GetPos().Y());
1168 aGradTransVector.maPositionB = basegfx::B2DPoint(Get2ndPos().X(), Get2ndPos().Y());
1169 if(pColHdl1)
1170 aGradTransVector.aCol1 = pColHdl1->GetColor();
1171 if(pColHdl2)
1172 aGradTransVector.aCol2 = pColHdl2->GetColor();
1174 if(IsGradient())
1175 aOldGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
1176 else
1177 aOldGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue();
1179 // transform vector data to gradient
1180 aGradTransformer.VecToGrad(aGradTransVector, aGradTransGradient, aOldGradTransGradient, _pObj, bMoveSingleHandle, bMoveFirstHandle);
1182 if(bSetItemOnObject)
1184 SdrModel* pModel = _pObj->GetModel();
1185 SfxItemSet aNewSet(pModel->GetItemPool());
1187 if(IsGradient())
1189 aString = String();
1190 XFillGradientItem aNewGradItem(aString, aGradTransGradient.aGradient);
1191 aNewSet.Put(aNewGradItem);
1193 else
1195 aString = String();
1196 XFillFloatTransparenceItem aNewTransItem(aString, aGradTransGradient.aGradient);
1197 aNewSet.Put(aNewTransItem);
1200 if(bUndo && pModel->IsUndoEnabled())
1202 pModel->BegUndo(SVX_RESSTR(IsGradient() ? SIP_XA_FILLGRADIENT : SIP_XA_FILLTRANSPARENCE));
1203 pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*_pObj));
1204 pModel->EndUndo();
1207 pObj->SetMergedItemSetAndBroadcast(aNewSet);
1210 // back transformation, set values on pIAOHandle
1211 aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, _pObj);
1213 SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1214 Set2ndPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1215 if(pColHdl1)
1217 pColHdl1->SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1218 pColHdl1->SetColor(aGradTransVector.aCol1);
1220 if(pColHdl2)
1222 pColHdl2->SetPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1223 pColHdl2->SetColor(aGradTransVector.aCol2);
1227 ////////////////////////////////////////////////////////////////////////////////////////////////////
1229 SdrHdlLine::~SdrHdlLine() {}
1231 void SdrHdlLine::CreateB2dIAObject()
1233 // first throw away old one
1234 GetRidOfIAObject();
1236 if(pHdlList)
1238 SdrMarkView* pView = pHdlList->GetView();
1240 if(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2)
1242 SdrPageView* pPageView = pView->GetSdrPageView();
1244 if(pPageView)
1246 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1248 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1250 if(rPageWindow.GetPaintWindow().OutputToWindow())
1252 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1253 if (xManager.is())
1255 basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1256 basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
1258 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1259 ::sdr::overlay::OverlayLineStriped(
1260 aPosition1,
1261 aPosition2
1263 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1265 // OVERLAYMANAGER
1266 if(pNewOverlayObject)
1268 // color(?)
1269 pNewOverlayObject->setBaseColor(Color(COL_LIGHTRED));
1271 xManager->add(*pNewOverlayObject);
1272 maOverlayGroup.append(*pNewOverlayObject);
1282 Pointer SdrHdlLine::GetPointer() const
1284 return Pointer(POINTER_REFHAND);
1287 ////////////////////////////////////////////////////////////////////////////////////////////////////
1289 SdrHdlBezWgt::~SdrHdlBezWgt() {}
1291 void SdrHdlBezWgt::CreateB2dIAObject()
1293 // call parent
1294 SdrHdl::CreateB2dIAObject();
1296 // create lines
1297 if(pHdlList)
1299 SdrMarkView* pView = pHdlList->GetView();
1301 if(pView && !pView->areMarkHandlesHidden())
1303 SdrPageView* pPageView = pView->GetSdrPageView();
1305 if(pPageView)
1307 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1309 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1311 if(rPageWindow.GetPaintWindow().OutputToWindow())
1313 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1314 if (xManager.is())
1316 basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1317 basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
1319 if(!aPosition1.equal(aPosition2))
1321 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1322 ::sdr::overlay::OverlayLineStriped(
1323 aPosition1,
1324 aPosition2
1326 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1328 // OVERLAYMANAGER
1329 if(pNewOverlayObject)
1331 // line part is not hittable
1332 pNewOverlayObject->setHittable(sal_False);
1334 // color(?)
1335 pNewOverlayObject->setBaseColor(Color(COL_LIGHTBLUE));
1337 xManager->add(*pNewOverlayObject);
1338 maOverlayGroup.append(*pNewOverlayObject);
1349 ////////////////////////////////////////////////////////////////////////////////////////////////////
1351 E3dVolumeMarker::E3dVolumeMarker(const basegfx::B2DPolyPolygon& rWireframePoly)
1353 aWireframePoly = rWireframePoly;
1356 void E3dVolumeMarker::CreateB2dIAObject()
1358 // create lines
1359 if(pHdlList)
1361 SdrMarkView* pView = pHdlList->GetView();
1363 if(pView && !pView->areMarkHandlesHidden())
1365 SdrPageView* pPageView = pView->GetSdrPageView();
1367 if(pPageView)
1369 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1371 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1373 if(rPageWindow.GetPaintWindow().OutputToWindow())
1375 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1376 if (xManager.is() && aWireframePoly.count())
1378 ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1379 ::sdr::overlay::OverlayPolyPolygonStriped(aWireframePoly);
1380 DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1382 // OVERLAYMANAGER
1383 if(pNewOverlayObject)
1385 pNewOverlayObject->setBaseColor(Color(COL_BLACK));
1387 xManager->add(*pNewOverlayObject);
1388 maOverlayGroup.append(*pNewOverlayObject);
1398 ////////////////////////////////////////////////////////////////////////////////////////////////////
1400 ImpEdgeHdl::~ImpEdgeHdl()
1404 void ImpEdgeHdl::CreateB2dIAObject()
1406 if(nObjHdlNum <= 1 && pObj)
1408 // first throw away old one
1409 GetRidOfIAObject();
1411 BitmapColorIndex eColIndex = LightCyan;
1412 BitmapMarkerKind eKindOfMarker = Rect_7x7;
1414 if(pHdlList)
1416 SdrMarkView* pView = pHdlList->GetView();
1418 if(pView && !pView->areMarkHandlesHidden())
1420 const SdrEdgeObj* pEdge = (SdrEdgeObj*)pObj;
1422 if(pEdge->GetConnectedNode(nObjHdlNum == 0) != NULL)
1423 eColIndex = LightRed;
1425 if(nPPntNum < 2)
1427 // Handle with plus sign inside
1428 eKindOfMarker = Circ_7x7;
1431 SdrPageView* pPageView = pView->GetSdrPageView();
1433 if(pPageView)
1435 for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1437 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1439 if(rPageWindow.GetPaintWindow().OutputToWindow())
1441 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1442 if (xManager.is())
1444 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1446 ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
1447 aPosition,
1448 eColIndex,
1449 eKindOfMarker);
1451 // OVERLAYMANAGER
1452 if(pNewOverlayObject)
1454 xManager->add(*pNewOverlayObject);
1455 maOverlayGroup.append(*pNewOverlayObject);
1464 else
1466 // call parent
1467 SdrHdl::CreateB2dIAObject();
1471 void ImpEdgeHdl::SetLineCode(SdrEdgeLineCode eCode)
1473 if(eLineCode != eCode)
1475 // remember new value
1476 eLineCode = eCode;
1478 // create new display
1479 Touch();
1483 Pointer ImpEdgeHdl::GetPointer() const
1485 SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
1486 if (pEdge==NULL)
1487 return SdrHdl::GetPointer();
1488 if (nObjHdlNum<=1)
1489 return Pointer(POINTER_MOVEPOINT);
1490 if (IsHorzDrag())
1491 return Pointer(POINTER_ESIZE);
1492 else
1493 return Pointer(POINTER_SSIZE);
1496 sal_Bool ImpEdgeHdl::IsHorzDrag() const
1498 SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
1499 if (pEdge==NULL)
1500 return sal_False;
1501 if (nObjHdlNum<=1)
1502 return sal_False;
1504 SdrEdgeKind eEdgeKind = ((SdrEdgeKindItem&)(pEdge->GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
1506 const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
1507 if (eEdgeKind==SDREDGE_ORTHOLINES || eEdgeKind==SDREDGE_BEZIER)
1509 return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
1511 else if (eEdgeKind==SDREDGE_THREELINES)
1513 long nWink=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
1514 if (nWink==0 || nWink==18000)
1515 return sal_True;
1516 else
1517 return sal_False;
1519 return sal_False;
1522 ////////////////////////////////////////////////////////////////////////////////////////////////////
1524 ImpMeasureHdl::~ImpMeasureHdl()
1528 void ImpMeasureHdl::CreateB2dIAObject()
1530 // first throw away old one
1531 GetRidOfIAObject();
1533 if(pHdlList)
1535 SdrMarkView* pView = pHdlList->GetView();
1537 if(pView && !pView->areMarkHandlesHidden())
1539 BitmapColorIndex eColIndex = LightCyan;
1540 BitmapMarkerKind eKindOfMarker = Rect_9x9;
1542 if(nObjHdlNum > 1)
1544 eKindOfMarker = Rect_7x7;
1547 if(bSelect)
1549 eColIndex = Cyan;
1552 SdrPageView* pPageView = pView->GetSdrPageView();
1554 if(pPageView)
1556 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1558 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1560 if(rPageWindow.GetPaintWindow().OutputToWindow())
1562 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1563 if (xManager.is())
1565 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1567 ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
1568 aPosition,
1569 eColIndex,
1570 eKindOfMarker);
1572 // OVERLAYMANAGER
1573 if(pNewOverlayObject)
1575 xManager->add(*pNewOverlayObject);
1576 maOverlayGroup.append(*pNewOverlayObject);
1586 Pointer ImpMeasureHdl::GetPointer() const
1588 switch (nObjHdlNum)
1590 case 0: case 1: return Pointer(POINTER_HAND);
1591 case 2: case 3: return Pointer(POINTER_MOVEPOINT);
1592 case 4: case 5: return SdrHdl::GetPointer(); // will then be rotated appropriately
1593 } // switch
1594 return Pointer(POINTER_NOTALLOWED);
1597 ////////////////////////////////////////////////////////////////////////////////////////////////////
1599 ImpTextframeHdl::ImpTextframeHdl(const Rectangle& rRect) :
1600 SdrHdl(rRect.TopLeft(),HDL_MOVE),
1601 maRect(rRect)
1605 void ImpTextframeHdl::CreateB2dIAObject()
1607 // first throw away old one
1608 GetRidOfIAObject();
1610 if(pHdlList)
1612 SdrMarkView* pView = pHdlList->GetView();
1614 if(pView && !pView->areMarkHandlesHidden())
1616 SdrPageView* pPageView = pView->GetSdrPageView();
1618 if(pPageView)
1620 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1622 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1624 if(rPageWindow.GetPaintWindow().OutputToWindow())
1626 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1627 if (xManager.is())
1629 const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
1630 const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
1631 const svtools::ColorConfig aColorConfig;
1632 const Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
1634 ::sdr::overlay::OverlayHatchRect* pNewOverlayObject = new ::sdr::overlay::OverlayHatchRect(
1635 aTopLeft,
1636 aBottomRight,
1637 aHatchCol,
1638 3.0,
1639 3.0,
1640 45 * F_PI180,
1641 nDrehWink * -F_PI18000);
1642 pNewOverlayObject->setHittable(false);
1644 // OVERLAYMANAGER
1645 if(pNewOverlayObject)
1647 xManager->add(*pNewOverlayObject);
1648 maOverlayGroup.append(*pNewOverlayObject);
1658 ////////////////////////////////////////////////////////////////////////////////////////////////////
1660 static bool ImpSdrHdlListSorter(SdrHdl* const& lhs, SdrHdl* const& rhs)
1662 SdrHdlKind eKind1=lhs->GetKind();
1663 SdrHdlKind eKind2=rhs->GetKind();
1664 // Level 1: first normal handles, then Glue, then User, then Plus handles, then reference point handles
1665 unsigned n1=1;
1666 unsigned n2=1;
1667 if (eKind1!=eKind2)
1669 if (eKind1==HDL_REF1 || eKind1==HDL_REF2 || eKind1==HDL_MIRX) n1=5;
1670 else if (eKind1==HDL_GLUE || eKind1==HDL_GLUE_DESELECTED) n1=2;
1671 else if (eKind1==HDL_USER) n1=3;
1672 else if (eKind1==HDL_SMARTTAG) n1=0;
1673 if (eKind2==HDL_REF1 || eKind2==HDL_REF2 || eKind2==HDL_MIRX) n2=5;
1674 else if (eKind2==HDL_GLUE || eKind2==HDL_GLUE_DESELECTED) n2=2;
1675 else if (eKind2==HDL_USER) n2=3;
1676 else if (eKind2==HDL_SMARTTAG) n2=0;
1678 if (lhs->IsPlusHdl()) n1=4;
1679 if (rhs->IsPlusHdl()) n2=4;
1680 if (n1==n2)
1682 // Level 2: PageView (Pointer)
1683 SdrPageView* pPV1=lhs->GetPageView();
1684 SdrPageView* pPV2=rhs->GetPageView();
1685 if (pPV1==pPV2)
1687 // Level 3: Position (x+y)
1688 SdrObject* pObj1=lhs->GetObj();
1689 SdrObject* pObj2=rhs->GetObj();
1690 if (pObj1==pObj2)
1692 sal_uInt32 nNum1=lhs->GetObjHdlNum();
1693 sal_uInt32 nNum2=rhs->GetObjHdlNum();
1694 if (nNum1==nNum2)
1696 if (eKind1==eKind2)
1697 return (long)lhs<(long)rhs; // Hack, to always get to the same sorting
1698 return (sal_uInt16)eKind1<(sal_uInt16)eKind2;
1700 else
1701 return nNum1<nNum2;
1703 else
1705 return (long)pObj1<(long)pObj2;
1708 else
1710 return (long)pPV1<(long)pPV2;
1713 else
1715 return n1<n2;
1719 SdrMarkView* SdrHdlList::GetView() const
1721 return pView;
1724 // Helper struct for re-sorting handles
1725 struct ImplHdlAndIndex
1727 SdrHdl* mpHdl;
1728 sal_uInt32 mnIndex;
1731 // Helper method for sorting handles taking care of OrdNums, keeping order in
1732 // single objects and re-sorting polygon handles intuitively
1733 extern "C" int SAL_CALL ImplSortHdlFunc( const void* pVoid1, const void* pVoid2 )
1735 const ImplHdlAndIndex* p1 = (ImplHdlAndIndex*)pVoid1;
1736 const ImplHdlAndIndex* p2 = (ImplHdlAndIndex*)pVoid2;
1738 if(p1->mpHdl->GetObj() == p2->mpHdl->GetObj())
1740 if(p1->mpHdl->GetObj() && p1->mpHdl->GetObj()->ISA(SdrPathObj))
1742 // same object and a path object
1743 if((p1->mpHdl->GetKind() == HDL_POLY || p1->mpHdl->GetKind() == HDL_BWGT)
1744 && (p2->mpHdl->GetKind() == HDL_POLY || p2->mpHdl->GetKind() == HDL_BWGT))
1746 // both handles are point or control handles
1747 if(p1->mpHdl->GetPolyNum() == p2->mpHdl->GetPolyNum())
1749 if(p1->mpHdl->GetPointNum() < p2->mpHdl->GetPointNum())
1751 return -1;
1753 else
1755 return 1;
1758 else if(p1->mpHdl->GetPolyNum() < p2->mpHdl->GetPolyNum())
1760 return -1;
1762 else
1764 return 1;
1769 else
1771 if(!p1->mpHdl->GetObj())
1773 return -1;
1775 else if(!p2->mpHdl->GetObj())
1777 return 1;
1779 else
1781 // different objects, use OrdNum for sort
1782 const sal_uInt32 nOrdNum1 = p1->mpHdl->GetObj()->GetOrdNum();
1783 const sal_uInt32 nOrdNum2 = p2->mpHdl->GetObj()->GetOrdNum();
1785 if(nOrdNum1 < nOrdNum2)
1787 return -1;
1789 else
1791 return 1;
1796 // fallback to indices
1797 if(p1->mnIndex < p2->mnIndex)
1799 return -1;
1801 else
1803 return 1;
1807 ////////////////////////////////////////////////////////////////////////////////////////////////////
1809 void SdrHdlList::TravelFocusHdl(sal_Bool bForward)
1811 // security correction
1812 if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex >= GetHdlCount())
1813 mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1815 if(!aList.empty())
1817 // take care of old handle
1818 const sal_uIntPtr nOldHdlNum(mnFocusIndex);
1819 SdrHdl* pOld = GetHdl(nOldHdlNum);
1821 if(pOld)
1823 // switch off old handle
1824 mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1825 pOld->Touch();
1828 // allocate pointer array for sorted handle list
1829 ImplHdlAndIndex* pHdlAndIndex = new ImplHdlAndIndex[aList.size()];
1831 // build sorted handle list
1832 sal_uInt32 a;
1833 for( a = 0; a < aList.size(); a++)
1835 pHdlAndIndex[a].mpHdl = aList[a];
1836 pHdlAndIndex[a].mnIndex = a;
1839 qsort(pHdlAndIndex, aList.size(), sizeof(ImplHdlAndIndex), ImplSortHdlFunc);
1841 // look for old num in sorted array
1842 sal_uIntPtr nOldHdl(nOldHdlNum);
1844 if(nOldHdlNum != CONTAINER_ENTRY_NOTFOUND)
1846 for(a = 0; a < aList.size(); a++)
1848 if(pHdlAndIndex[a].mpHdl == pOld)
1850 nOldHdl = a;
1851 break;
1856 // build new HdlNum
1857 sal_uIntPtr nNewHdl(nOldHdl);
1859 // do the focus travel
1860 if(bForward)
1862 if(nOldHdl != CONTAINER_ENTRY_NOTFOUND)
1864 if(nOldHdl == aList.size() - 1)
1866 // end forward run
1867 nNewHdl = CONTAINER_ENTRY_NOTFOUND;
1869 else
1871 // simply the next handle
1872 nNewHdl++;
1875 else
1877 // start forward run at first entry
1878 nNewHdl = 0;
1881 else
1883 if(nOldHdl == CONTAINER_ENTRY_NOTFOUND)
1885 // start backward run at last entry
1886 nNewHdl = aList.size() - 1;
1889 else
1891 if(nOldHdl == 0)
1893 // end backward run
1894 nNewHdl = CONTAINER_ENTRY_NOTFOUND;
1896 else
1898 // simply the previous handle
1899 nNewHdl--;
1904 // build new HdlNum
1905 sal_uIntPtr nNewHdlNum(nNewHdl);
1907 // look for old num in sorted array
1908 if(nNewHdl != CONTAINER_ENTRY_NOTFOUND)
1910 SdrHdl* pNew = pHdlAndIndex[nNewHdl].mpHdl;
1912 for(a = 0; a < aList.size(); a++)
1914 if(aList[a] == pNew)
1916 nNewHdlNum = a;
1917 break;
1922 // take care of next handle
1923 if(nOldHdlNum != nNewHdlNum)
1925 mnFocusIndex = nNewHdlNum;
1926 SdrHdl* pNew = GetHdl(mnFocusIndex);
1928 if(pNew)
1930 pNew->Touch();
1934 // free memory again
1935 delete [] pHdlAndIndex;
1939 SdrHdl* SdrHdlList::GetFocusHdl() const
1941 if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex < GetHdlCount())
1942 return GetHdl(mnFocusIndex);
1943 else
1944 return 0L;
1947 void SdrHdlList::SetFocusHdl(SdrHdl* pNew)
1949 if(pNew)
1951 SdrHdl* pActual = GetFocusHdl();
1953 if(!pActual || pActual != pNew)
1955 sal_uIntPtr nNewHdlNum = GetHdlNum(pNew);
1957 if(nNewHdlNum != CONTAINER_ENTRY_NOTFOUND)
1959 mnFocusIndex = nNewHdlNum;
1961 if(pActual)
1963 pActual->Touch();
1966 if(pNew)
1968 pNew->Touch();
1976 void SdrHdlList::ResetFocusHdl()
1978 SdrHdl* pHdl = GetFocusHdl();
1980 mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1982 if(pHdl)
1984 pHdl->Touch();
1988 ////////////////////////////////////////////////////////////////////////////////////////////////////
1990 SdrHdlList::SdrHdlList(SdrMarkView* pV)
1991 : mnFocusIndex(CONTAINER_ENTRY_NOTFOUND),
1992 pView(pV),
1993 aList()
1995 nHdlSize = 3;
1996 bRotateShear = sal_False;
1997 bMoveOutside = sal_False;
1998 bDistortShear = sal_False;
2001 SdrHdlList::~SdrHdlList()
2003 Clear();
2006 void SdrHdlList::SetHdlSize(sal_uInt16 nSiz)
2008 if(nHdlSize != nSiz)
2010 // remember new value
2011 nHdlSize = nSiz;
2013 // propagate change to IAOs
2014 for(sal_uIntPtr i=0; i<GetHdlCount(); i++)
2016 SdrHdl* pHdl = GetHdl(i);
2017 pHdl->Touch();
2022 void SdrHdlList::SetMoveOutside(sal_Bool bOn)
2024 if(bMoveOutside != bOn)
2026 // remember new value
2027 bMoveOutside = bOn;
2029 // propagate change to IAOs
2030 for(sal_uIntPtr i=0; i<GetHdlCount(); i++)
2032 SdrHdl* pHdl = GetHdl(i);
2033 pHdl->Touch();
2038 void SdrHdlList::SetRotateShear(sal_Bool bOn)
2040 bRotateShear = bOn;
2043 void SdrHdlList::SetDistortShear(sal_Bool bOn)
2045 bDistortShear = bOn;
2048 SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum)
2050 SdrHdl* pRetval = aList[nNum];
2051 aList.erase(aList.begin() + nNum);
2053 return pRetval;
2056 void SdrHdlList::RemoveAllByKind(SdrHdlKind eKind)
2058 for(std::deque<SdrHdl*>::iterator it = aList.begin(); it != aList.end(); )
2060 SdrHdl* p = *it;
2061 if (p->GetKind() == eKind)
2063 it = aList.erase( it );
2064 delete p;
2066 else
2067 ++it;
2071 void SdrHdlList::Clear()
2073 for (sal_uIntPtr i=0; i<GetHdlCount(); i++)
2075 SdrHdl* pHdl=GetHdl(i);
2076 delete pHdl;
2078 aList.clear();
2080 bRotateShear=sal_False;
2081 bDistortShear=sal_False;
2084 void SdrHdlList::Sort()
2086 // remember currently focused handle
2087 SdrHdl* pPrev = GetFocusHdl();
2089 std::sort( aList.begin(), aList.end(), ImpSdrHdlListSorter );
2091 // get now and compare
2092 SdrHdl* pNow = GetFocusHdl();
2094 if(pPrev != pNow)
2097 if(pPrev)
2099 pPrev->Touch();
2102 if(pNow)
2104 pNow->Touch();
2109 sal_uIntPtr SdrHdlList::GetHdlNum(const SdrHdl* pHdl) const
2111 if (pHdl==NULL)
2112 return CONTAINER_ENTRY_NOTFOUND;
2113 std::deque<SdrHdl*>::const_iterator it = std::find( aList.begin(), aList.end(), pHdl);
2114 if( it == aList.end() )
2115 return CONTAINER_ENTRY_NOTFOUND;
2116 return it - aList.begin();
2119 void SdrHdlList::AddHdl(SdrHdl* pHdl, sal_Bool bAtBegin)
2121 if (pHdl!=NULL)
2123 if (bAtBegin)
2125 aList.push_front(pHdl);
2127 else
2129 aList.push_back(pHdl);
2131 pHdl->SetHdlList(this);
2135 SdrHdl* SdrHdlList::IsHdlListHit(const Point& rPnt, sal_Bool bBack, sal_Bool bNext, SdrHdl* pHdl0) const
2137 SdrHdl* pRet=NULL;
2138 sal_uIntPtr nAnz=GetHdlCount();
2139 sal_uIntPtr nNum=bBack ? 0 : nAnz;
2140 while ((bBack ? nNum<nAnz : nNum>0) && pRet==NULL)
2142 if (!bBack)
2143 nNum--;
2144 SdrHdl* pHdl=GetHdl(nNum);
2145 if (bNext)
2147 if (pHdl==pHdl0)
2148 bNext=sal_False;
2150 else
2152 if (pHdl->IsHdlHit(rPnt))
2153 pRet=pHdl;
2155 if (bBack)
2156 nNum++;
2158 return pRet;
2161 SdrHdl* SdrHdlList::GetHdl(SdrHdlKind eKind1) const
2163 SdrHdl* pRet=NULL;
2164 for (sal_uIntPtr i=0; i<GetHdlCount() && pRet==NULL; i++)
2166 SdrHdl* pHdl=GetHdl(i);
2167 if (pHdl->GetKind()==eKind1)
2168 pRet=pHdl;
2170 return pRet;
2173 // --------------------------------------------------------------------
2174 // SdrCropHdl
2175 // --------------------------------------------------------------------
2177 SdrCropHdl::SdrCropHdl(const Point& rPnt, SdrHdlKind eNewKind)
2178 : SdrHdl( rPnt, eNewKind )
2182 // --------------------------------------------------------------------
2184 BitmapEx SdrCropHdl::GetHandlesBitmap()
2186 static BitmapEx* pModernBitmap = 0;
2187 if( pModernBitmap == 0 )
2188 pModernBitmap = new BitmapEx(ResId(SIP_SA_CROP_MARKERS, *ImpGetResMgr()));
2189 return *pModernBitmap;
2192 // --------------------------------------------------------------------
2194 BitmapEx SdrCropHdl::GetBitmapForHandle( const BitmapEx& rBitmap, int nSize )
2196 int nPixelSize = 0, nX = 0, nY = 0, nOffset = 0;
2198 if( nSize <= 3 )
2200 nPixelSize = 13;
2201 nOffset = 0;
2203 else if( nSize <=4 )
2205 nPixelSize = 17;
2206 nOffset = 39;
2208 else
2210 nPixelSize = 21;
2211 nOffset = 90;
2214 switch( eKind )
2216 case HDL_UPLFT: nX = 0; nY = 0; break;
2217 case HDL_UPPER: nX = 1; nY = 0; break;
2218 case HDL_UPRGT: nX = 2; nY = 0; break;
2219 case HDL_LEFT: nX = 0; nY = 1; break;
2220 case HDL_RIGHT: nX = 2; nY = 1; break;
2221 case HDL_LWLFT: nX = 0; nY = 2; break;
2222 case HDL_LOWER: nX = 1; nY = 2; break;
2223 case HDL_LWRGT: nX = 2; nY = 2; break;
2224 default: break;
2227 Rectangle aSourceRect( Point( nX * (nPixelSize) + nOffset, nY * (nPixelSize)), Size(nPixelSize, nPixelSize) );
2229 BitmapEx aRetval(rBitmap);
2230 aRetval.Crop(aSourceRect);
2231 return aRetval;
2234 // --------------------------------------------------------------------
2236 void SdrCropHdl::CreateB2dIAObject()
2238 // first throw away old one
2239 GetRidOfIAObject();
2241 SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
2242 SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
2244 if( pPageView && !pView->areMarkHandlesHidden() )
2246 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2247 int nHdlSize = pHdlList->GetHdlSize();
2249 const BitmapEx aHandlesBitmap( GetHandlesBitmap() );
2250 BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
2252 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
2254 const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
2256 if(rPageWindow.GetPaintWindow().OutputToWindow())
2258 rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
2259 if (xManager.is())
2261 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
2263 ::sdr::overlay::OverlayObject* pOverlayObject = 0L;
2265 // animate focused handles
2266 if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
2268 if( nHdlSize >= 2 )
2269 nHdlSize = 1;
2271 BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
2273 const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
2275 pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBmpEx1, aBmpEx2, nBlinkTime,
2276 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2277 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2278 (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
2279 (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
2281 else
2283 // create centered handle as default
2284 pOverlayObject = new ::sdr::overlay::OverlayBitmapEx(aPosition, aBmpEx1,
2285 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2286 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1);
2289 // OVERLAYMANAGER
2290 if(pOverlayObject)
2292 xManager->add(*pOverlayObject);
2293 maOverlayGroup.append(*pOverlayObject);
2301 // --------------------------------------------------------------------
2303 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */