Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <algorithm>
31 : :
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>
37 : :
38 : : #include <vcl/virdev.hxx>
39 : : #include <tools/poly.hxx>
40 : : #include <vcl/bmpacc.hxx>
41 : :
42 : : #include <svx/sxekitm.hxx>
43 : : #include "svx/svdstr.hrc"
44 : : #include "svx/svdglob.hxx"
45 : :
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>
52 : :
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>
68 : :
69 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
70 : : // #i15222#
71 : : // Due to the resource problems in Win95/98 with bitmap resources I
72 : : // will change this handle bitmap providing class. Old version was splitting
73 : : // and preparing all small handle bitmaps in device bitmap format, now this will
74 : : // be done on the fly. Thus, there is only one big bitmap in memory. With
75 : : // three source bitmaps, this will be 3 system bitmap resources instead of hundreds.
76 : : // The price for that needs to be evaluated. Maybe we will need another change here
77 : : // if this is too expensive.
78 : : class SdrHdlBitmapSet
79 : : {
80 : : // the bitmap holding all information
81 : : BitmapEx maMarkersBitmap;
82 : :
83 : : // the cropped Bitmaps for reusage
84 : : ::std::vector< BitmapEx > maRealMarkers;
85 : :
86 : : // helpers
87 : : BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle);
88 : :
89 : : public:
90 : : SdrHdlBitmapSet(sal_uInt16 nResId);
91 : : ~SdrHdlBitmapSet();
92 : :
93 : : const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd=0);
94 : : };
95 : :
96 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
97 : : #define KIND_COUNT (14)
98 : : #define INDEX_COUNT (6)
99 : : #define INDIVIDUAL_COUNT (4)
100 : :
101 : 6 : SdrHdlBitmapSet::SdrHdlBitmapSet(sal_uInt16 nResId)
102 : 6 : : maMarkersBitmap(ResId(nResId, *ImpGetResMgr())),
103 : : // 14 kinds (BitmapMarkerKind) use index [0..5], 4 extra
104 [ + - ][ + - ]: 6 : maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT)
105 : : {
106 : 6 : }
107 : :
108 : 6 : SdrHdlBitmapSet::~SdrHdlBitmapSet()
109 : : {
110 : 6 : }
111 : :
112 : 6008 : BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle)
113 : : {
114 : 6008 : BitmapEx& rTargetBitmap = maRealMarkers[nIndex];
115 : :
116 [ + + ]: 6008 : if(rTargetBitmap.IsEmpty())
117 : : {
118 : 6 : rTargetBitmap = maMarkersBitmap;
119 : 6 : rTargetBitmap.Crop(rRectangle);
120 : : }
121 : :
122 : 6008 : return rTargetBitmap;
123 : : }
124 : :
125 : : // change getting of bitmap to use the big resource bitmap
126 : 6008 : const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
127 : : {
128 : : // fill in size and source position in maMarkersBitmap
129 : 6008 : const sal_uInt16 nYPos(nInd * 11);
130 : :
131 [ + + - - : 6008 : switch(eKindOfMarker)
- - - - -
- - - - -
- - - -
- ]
132 : : {
133 : : default:
134 : : {
135 : : OSL_FAIL( "Unknown kind of marker." );
136 : : // no break here, return Rect_9x9 as default
137 : : }
138 : : case Rect_9x9:
139 : : {
140 [ + - ][ + - ]: 16 : return impGetOrCreateTargetBitmap((1 * INDEX_COUNT) + nInd, Rectangle(Point(7, nYPos), Size(9, 9)));
141 : : }
142 : :
143 : : case Rect_7x7:
144 : : {
145 [ + - ][ + - ]: 5992 : return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, Rectangle(Point(0, nYPos), Size(7, 7)));
146 : : }
147 : :
148 : : case Rect_11x11:
149 : : {
150 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((2 * INDEX_COUNT) + nInd, Rectangle(Point(16, nYPos), Size(11, 11)));
151 : : }
152 : :
153 : : case Rect_13x13:
154 : : {
155 : 0 : const sal_uInt16 nIndex((3 * INDEX_COUNT) + nInd);
156 : :
157 [ # # # # : 0 : switch(nInd)
# # ]
158 : : {
159 : : case 0:
160 : : {
161 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 66), Size(13, 13)));
162 : : }
163 : : case 1:
164 : : {
165 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 66), Size(13, 13)));
166 : : }
167 : : case 2:
168 : : {
169 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 79), Size(13, 13)));
170 : : }
171 : : case 3:
172 : : {
173 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 79), Size(13, 13)));
174 : : }
175 : : case 4:
176 : : {
177 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 79), Size(13, 13)));
178 : : }
179 : : default: // case 5:
180 : : {
181 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 66), Size(13, 13)));
182 : : }
183 : : }
184 : : }
185 : :
186 : : case Circ_7x7:
187 : : {
188 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((4 * INDEX_COUNT) + nInd, Rectangle(Point(27, nYPos), Size(7, 7)));
189 : : }
190 : :
191 : : case Circ_9x9:
192 : : case Customshape1:
193 : : {
194 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((5 * INDEX_COUNT) + nInd, Rectangle(Point(34, nYPos), Size(9, 9)));
195 : : }
196 : :
197 : : case Circ_11x11:
198 : : {
199 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((6 * INDEX_COUNT) + nInd, Rectangle(Point(43, nYPos), Size(11, 11)));
200 : : }
201 : :
202 : : case Elli_7x9:
203 : : {
204 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((7 * INDEX_COUNT) + nInd, Rectangle(Point(54, nYPos), Size(7, 9)));
205 : : }
206 : :
207 : : case Elli_9x11:
208 : : {
209 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((8 * INDEX_COUNT) + nInd, Rectangle(Point(61, nYPos), Size(9, 11)));
210 : : }
211 : :
212 : : case Elli_9x7:
213 : : {
214 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((9 * INDEX_COUNT) + nInd, Rectangle(Point(70, nYPos), Size(9, 7)));
215 : : }
216 : :
217 : : case Elli_11x9:
218 : : {
219 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((10 * INDEX_COUNT) + nInd, Rectangle(Point(79, nYPos), Size(11, 9)));
220 : : }
221 : :
222 : : case RectPlus_7x7:
223 : : {
224 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((11 * INDEX_COUNT) + nInd, Rectangle(Point(90, nYPos), Size(7, 7)));
225 : : }
226 : :
227 : : case RectPlus_9x9:
228 : : {
229 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((12 * INDEX_COUNT) + nInd, Rectangle(Point(97, nYPos), Size(9, 9)));
230 : : }
231 : :
232 : : case RectPlus_11x11:
233 : : {
234 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((13 * INDEX_COUNT) + nInd, Rectangle(Point(106, nYPos), Size(11, 11)));
235 : : }
236 : :
237 : : case Crosshair:
238 : : {
239 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 0, Rectangle(Point(0, 68), Size(15, 15)));
240 : : }
241 : :
242 : : case Glue:
243 : : {
244 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 76), Size(9, 9)));
245 : : }
246 : :
247 : : case Glue_Deselected:
248 : : {
249 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 67), Size(9, 9)));
250 : : }
251 : :
252 : : case Anchor: // AnchorTR for SW
253 : : case AnchorTR:
254 : : {
255 [ # # ][ # # ]: 0 : return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, Rectangle(Point(24, 67), Size(24, 24)));
256 : : }
257 : :
258 : : // add AnchorPressed to be able to animate anchor control
259 : : case AnchorPressed:
260 : : case AnchorPressedTR:
261 : : {
262 [ # # ][ # # ]: 6008 : return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(48, 67), Size(24, 24)));
263 : : }
264 : : }
265 : : }
266 : :
267 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
268 : :
269 : 0 : 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 : 0 : mbMouseOver(false)
284 : : {
285 : 0 : }
286 : :
287 : 7603 : 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 : 7603 : mbMouseOver(false)
303 : : {
304 : 7603 : }
305 : :
306 : 7603 : SdrHdl::~SdrHdl()
307 : : {
308 [ + - ]: 7603 : GetRidOfIAObject();
309 [ - + ]: 15206 : }
310 : :
311 : 1022 : void SdrHdl::Set1PixMore(sal_Bool bJa)
312 : : {
313 [ + + ]: 1022 : if(b1PixMore != bJa)
314 : : {
315 : 172 : b1PixMore = bJa;
316 : :
317 : : // create new display
318 : 172 : Touch();
319 : : }
320 : 1022 : }
321 : :
322 : 0 : void SdrHdl::SetMoveOutside( bool bMoveOutside )
323 : : {
324 [ # # ]: 0 : if(mbMoveOutside != bMoveOutside)
325 : : {
326 : 0 : mbMoveOutside = bMoveOutside;
327 : :
328 : : // create new display
329 : 0 : Touch();
330 : : }
331 : 0 : }
332 : :
333 : 381 : void SdrHdl::SetDrehWink(long n)
334 : : {
335 [ - + ]: 381 : if(nDrehWink != n)
336 : : {
337 : 0 : nDrehWink = n;
338 : :
339 : : // create new display
340 : 0 : Touch();
341 : : }
342 : 381 : }
343 : :
344 : 0 : void SdrHdl::SetPos(const Point& rPnt)
345 : : {
346 [ # # ]: 0 : if(aPos != rPnt)
347 : : {
348 : : // remember new position
349 : 0 : aPos = rPnt;
350 : :
351 : : // create new display
352 : 0 : Touch();
353 : : }
354 : 0 : }
355 : :
356 : 1022 : void SdrHdl::SetSelected(sal_Bool bJa)
357 : : {
358 [ - + ]: 1022 : if(bSelect != bJa)
359 : : {
360 : : // remember new value
361 : 0 : bSelect = bJa;
362 : :
363 : : // create new display
364 : 0 : Touch();
365 : : }
366 : 1022 : }
367 : :
368 : 7603 : void SdrHdl::SetHdlList(SdrHdlList* pList)
369 : : {
370 [ + - ]: 7603 : if(pHdlList != pList)
371 : : {
372 : : // rememver list
373 : 7603 : pHdlList = pList;
374 : :
375 : : // now its possible to create graphic representation
376 : 7603 : Touch();
377 : : }
378 : 7603 : }
379 : :
380 : 1784 : void SdrHdl::SetObj(SdrObject* pNewObj)
381 : : {
382 [ + + ]: 1784 : if(pObj != pNewObj)
383 : : {
384 : : // remember new object
385 : 1403 : pObj = pNewObj;
386 : :
387 : : // graphic representation may have changed
388 : 1403 : Touch();
389 : : }
390 : 1784 : }
391 : :
392 : 9178 : void SdrHdl::Touch()
393 : : {
394 : : // force update of graphic representation
395 : 9178 : CreateB2dIAObject();
396 : 9178 : }
397 : :
398 : 16781 : void SdrHdl::GetRidOfIAObject()
399 : : {
400 : :
401 : : // OVERLAYMANAGER
402 : 16781 : maOverlayGroup.clear();
403 : 16781 : }
404 : :
405 : 9178 : void SdrHdl::CreateB2dIAObject()
406 : : {
407 : : // first throw away old one
408 : 9178 : GetRidOfIAObject();
409 : :
410 [ + - ][ + - ]: 9178 : if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
[ + + ][ + + ]
411 : : {
412 : 8625 : BitmapColorIndex eColIndex = LightGreen;
413 : 8625 : BitmapMarkerKind eKindOfMarker = Rect_7x7;
414 : :
415 : 8625 : sal_Bool bRot = pHdlList->IsRotateShear();
416 [ + + ]: 8625 : if(pObj)
417 [ - + ]: 1403 : eColIndex = (bSelect) ? Cyan : LightCyan;
418 [ - + ]: 8625 : if(bRot)
419 : : {
420 : : // red rotation handles
421 [ # # ][ # # ]: 0 : if(pObj && bSelect)
422 : 0 : eColIndex = Red;
423 : : else
424 : 0 : eColIndex = LightRed;
425 : : }
426 : :
427 [ - + + + : 8625 : switch(eKind)
+ - + - -
- - - - -
- ]
428 : : {
429 : : case HDL_MOVE:
430 : : {
431 [ # # ]: 0 : eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
432 : 0 : break;
433 : : }
434 : : case HDL_UPLFT:
435 : : case HDL_UPRGT:
436 : : case HDL_LWLFT:
437 : : case HDL_LWRGT:
438 : : {
439 : : // corner handles
440 [ - + ]: 3280 : if(bRot)
441 : : {
442 : 0 : eKindOfMarker = Circ_7x7;
443 : : }
444 : : else
445 : : {
446 : 3280 : eKindOfMarker = Rect_7x7;
447 : : }
448 : 3280 : break;
449 : : }
450 : : case HDL_UPPER:
451 : : case HDL_LOWER:
452 : : {
453 : : // Upper/Lower handles
454 [ - + ]: 1640 : if(bRot)
455 : : {
456 : 0 : eKindOfMarker = Elli_9x7;
457 : : }
458 : : else
459 : : {
460 : 1640 : eKindOfMarker = Rect_7x7;
461 : : }
462 : 1640 : break;
463 : : }
464 : : case HDL_LEFT:
465 : : case HDL_RIGHT:
466 : : {
467 : : // Left/Right handles
468 [ - + ]: 1640 : if(bRot)
469 : : {
470 : 0 : eKindOfMarker = Elli_7x9;
471 : : }
472 : : else
473 : : {
474 : 1640 : eKindOfMarker = Rect_7x7;
475 : : }
476 : 1640 : break;
477 : : }
478 : : case HDL_POLY:
479 : : {
480 [ - + ]: 2044 : if(bRot)
481 : : {
482 [ # # ]: 0 : eKindOfMarker = (b1PixMore) ? Circ_9x9 : Circ_7x7;
483 : : }
484 : : else
485 : : {
486 [ + + ]: 2044 : eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
487 : : }
488 : 2044 : break;
489 : : }
490 : : case HDL_BWGT: // weight at poly
491 : : {
492 : 0 : eKindOfMarker = Circ_7x7;
493 : 0 : break;
494 : : }
495 : : case HDL_CIRC:
496 : : {
497 : 21 : eKindOfMarker = Rect_11x11;
498 : 21 : break;
499 : : }
500 : : case HDL_REF1:
501 : : case HDL_REF2:
502 : : {
503 : 0 : eKindOfMarker = Crosshair;
504 : 0 : break;
505 : : }
506 : : case HDL_GLUE:
507 : : {
508 : 0 : eKindOfMarker = Glue;
509 : 0 : break;
510 : : }
511 : : case HDL_GLUE_DESELECTED:
512 : : {
513 : 0 : eKindOfMarker = Glue_Deselected;
514 : 0 : break;
515 : : }
516 : : case HDL_ANCHOR:
517 : : {
518 : 0 : eKindOfMarker = Anchor;
519 : 0 : break;
520 : : }
521 : : case HDL_USER:
522 : : {
523 : 0 : break;
524 : : }
525 : : // top right anchor for SW
526 : : case HDL_ANCHOR_TR:
527 : : {
528 : 0 : eKindOfMarker = AnchorTR;
529 : 0 : break;
530 : : }
531 : :
532 : : // for SJ and the CustomShapeHandles:
533 : : case HDL_CUSTOMSHAPE1:
534 : : {
535 : 0 : eKindOfMarker = Customshape1;
536 : 0 : eColIndex = Yellow;
537 : 0 : break;
538 : : }
539 : : default:
540 : 0 : break;
541 : : }
542 : :
543 : 8625 : SdrMarkView* pView = pHdlList->GetView();
544 : 8625 : SdrPageView* pPageView = pView->GetSdrPageView();
545 : :
546 [ + - ]: 8625 : if(pPageView)
547 : : {
548 [ + + ]: 14633 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
549 : : {
550 : : // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
551 : 6008 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
552 : :
553 [ + - ]: 6008 : if(rPageWindow.GetPaintWindow().OutputToWindow())
554 : : {
555 : 6008 : Point aMoveOutsideOffset(0, 0);
556 : :
557 : : // add offset if necessary
558 [ - + ][ - + ]: 6008 : if(pHdlList->IsMoveOutside() || mbMoveOutside)
[ + - ]
559 : : {
560 : 0 : OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
561 [ # # ]: 0 : Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
562 : :
563 [ # # ][ # # ]: 0 : if(eKind == HDL_UPLFT || eKind == HDL_UPPER || eKind == HDL_UPRGT)
[ # # ]
564 : 0 : aMoveOutsideOffset.Y() -= aOffset.Width();
565 [ # # ][ # # ]: 0 : if(eKind == HDL_LWLFT || eKind == HDL_LOWER || eKind == HDL_LWRGT)
[ # # ]
566 : 0 : aMoveOutsideOffset.Y() += aOffset.Height();
567 [ # # ][ # # ]: 0 : if(eKind == HDL_UPLFT || eKind == HDL_LEFT || eKind == HDL_LWLFT)
[ # # ]
568 : 0 : aMoveOutsideOffset.X() -= aOffset.Width();
569 [ # # ][ # # ]: 0 : if(eKind == HDL_UPRGT || eKind == HDL_RIGHT || eKind == HDL_LWRGT)
[ # # ]
570 : 0 : aMoveOutsideOffset.X() += aOffset.Height();
571 : : }
572 : :
573 [ + - ]: 6008 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
574 [ + - ]: 6008 : if (xManager.is())
575 : : {
576 : 6008 : basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
577 : : ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
578 : : aPosition,
579 : : eColIndex,
580 : : eKindOfMarker,
581 [ + - ]: 6008 : aMoveOutsideOffset);
582 : :
583 : : // OVERLAYMANAGER
584 [ + - ]: 6008 : if(pNewOverlayObject)
585 : : {
586 [ + - ]: 6008 : xManager->add(*pNewOverlayObject);
587 [ + - ]: 6008 : maOverlayGroup.append(*pNewOverlayObject);
588 : 6008 : }
589 [ + - ]: 6008 : }
590 : : }
591 : : }
592 : : }
593 : : }
594 : 9178 : }
595 : :
596 : 16 : BitmapMarkerKind SdrHdl::GetNextBigger(BitmapMarkerKind eKnd) const
597 : : {
598 : 16 : BitmapMarkerKind eRetval(eKnd);
599 : :
600 [ + - - - : 16 : switch(eKnd)
- - - - -
- - - ]
601 : : {
602 : 16 : case Rect_7x7: eRetval = Rect_9x9; break;
603 : 0 : case Rect_9x9: eRetval = Rect_11x11; break;
604 : 0 : case Rect_11x11: eRetval = Rect_13x13; break;
605 : :
606 : 0 : case Circ_7x7: eRetval = Circ_9x9; break;
607 : 0 : case Circ_9x9: eRetval = Circ_11x11; break;
608 : :
609 : 0 : case Elli_7x9: eRetval = Elli_9x11; break;
610 : :
611 : 0 : case Elli_9x7: eRetval = Elli_11x9; break;
612 : :
613 : 0 : case RectPlus_7x7: eRetval = RectPlus_9x9; break;
614 : 0 : case RectPlus_9x9: eRetval = RectPlus_11x11; break;
615 : :
616 : : // let anchor blink with its pressed state
617 : 0 : case Anchor: eRetval = AnchorPressed; break;
618 : :
619 : : // same for AnchorTR
620 : 0 : case AnchorTR: eRetval = AnchorPressedTR; break;
621 : : default:
622 : 0 : break;
623 : : }
624 : :
625 : 16 : return eRetval;
626 : : }
627 : :
628 : 6008 : BitmapEx SdrHdl::ImpGetBitmapEx( BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
629 : : {
630 [ + + ][ + - ]: 6008 : static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_MARKERS));
[ + - ][ + - ]
[ + - ][ # # ]
631 : 6008 : return aModernSet.get()->GetBitmapEx(eKindOfMarker, nInd);
632 : : }
633 : :
634 : 6008 : ::sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
635 : : const basegfx::B2DPoint& rPos,
636 : : BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset)
637 : : {
638 : 6008 : ::sdr::overlay::OverlayObject* pRetval = 0L;
639 : :
640 : : // support bigger sizes
641 : 6008 : sal_Bool bForceBiggerSize(sal_False);
642 : :
643 [ + + ]: 6008 : if(pHdlList->GetHdlSize() > 3)
644 : : {
645 : 16 : bForceBiggerSize = sal_True;
646 : : }
647 : :
648 [ + + ]: 6008 : if(bForceBiggerSize)
649 : : {
650 : 16 : eKindOfMarker = GetNextBigger(eKindOfMarker);
651 : : }
652 : :
653 : : // This handle has the focus, visualize it
654 [ + - ][ + - ]: 6008 : if(IsFocusHdl() && pHdlList && pHdlList->GetFocusHdl() == this)
[ - + ][ - + ]
655 : : {
656 : : // create animated handle
657 [ # # ]: 0 : BitmapMarkerKind eNextBigger = GetNextBigger(eKindOfMarker);
658 : :
659 [ # # ]: 0 : if(eNextBigger == eKindOfMarker)
660 : : {
661 : : // this may happen for the not supported getting-bigger types.
662 : : // Choose an alternative here
663 [ # # # # : 0 : switch(eKindOfMarker)
# # # #
# ]
664 : : {
665 : 0 : case Rect_13x13: eNextBigger = Rect_11x11; break;
666 : 0 : case Circ_11x11: eNextBigger = Elli_11x9; break;
667 : 0 : case Elli_9x11: eNextBigger = Elli_11x9; break;
668 : 0 : case Elli_11x9: eNextBigger = Elli_9x11; break;
669 : 0 : case RectPlus_11x11: eNextBigger = Rect_13x13; break;
670 : :
671 : : case Crosshair:
672 : 0 : eNextBigger = Glue;
673 : 0 : break;
674 : :
675 : : case Glue:
676 : 0 : eNextBigger = Crosshair;
677 : 0 : break;
678 : : case Glue_Deselected:
679 : 0 : eNextBigger = Glue;
680 : 0 : break;
681 : : default:
682 : 0 : break;
683 : : }
684 : : }
685 : :
686 : : // create animated handle
687 [ # # ]: 0 : BitmapEx aBmpEx1 = ImpGetBitmapEx( eKindOfMarker, (sal_uInt16)eColIndex );
688 [ # # ]: 0 : BitmapEx aBmpEx2 = ImpGetBitmapEx( eNextBigger, (sal_uInt16)eColIndex );
689 : :
690 : : // #i53216# Use system cursor blink time. Use the unsigned value.
691 [ # # ]: 0 : const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
692 : 0 : const sal_uInt32 nBlinkTime((sal_uInt32)rStyleSettings.GetCursorBlinkTime());
693 : :
694 [ # # ][ # # ]: 0 : if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
695 : : {
696 : : // when anchor is used take upper left as reference point inside the handle
697 [ # # ][ # # ]: 0 : pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime);
698 : : }
699 [ # # ][ # # ]: 0 : else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
700 : : {
701 : : // AnchorTR for SW, take top right as (0,0)
702 : : pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
703 : 0 : (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1), 0,
704 [ # # ][ # # ]: 0 : (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1), 0);
705 : : }
706 : : else
707 : : {
708 : : // create centered handle as default
709 : : pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
710 : 0 : (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
711 : 0 : (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
712 : 0 : (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
713 [ # # ][ # # ]: 0 : (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
714 [ # # ][ # # ]: 0 : }
715 : : }
716 : : else
717 : : {
718 : : // create normal handle: use ImpGetBitmapEx(...) now
719 [ + - ]: 6008 : BitmapEx aBmpEx = ImpGetBitmapEx(eKindOfMarker, (sal_uInt16)eColIndex);
720 : :
721 [ + - ][ - + ]: 6008 : if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
722 : : {
723 : : // upper left as reference point inside the handle for AnchorPressed, too
724 [ # # ][ # # ]: 0 : pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx);
725 : : }
726 [ + - ][ - + ]: 6008 : else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
727 : : {
728 : : // AnchorTR for SW, take top right as (0,0)
729 : : pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
730 [ # # ][ # # ]: 0 : (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1), 0);
731 : : }
732 : : else
733 : : {
734 : 6008 : sal_uInt16 nCenX((sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1L) >> 1);
735 : 6008 : sal_uInt16 nCenY((sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1L) >> 1);
736 : :
737 [ - + ]: 6008 : if(aMoveOutsideOffset.X() > 0)
738 : : {
739 : 0 : nCenX = 0;
740 : : }
741 [ - + ]: 6008 : else if(aMoveOutsideOffset.X() < 0)
742 : : {
743 : 0 : nCenX = (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1);
744 : : }
745 : :
746 [ - + ]: 6008 : if(aMoveOutsideOffset.Y() > 0)
747 : : {
748 : 0 : nCenY = 0;
749 : : }
750 [ - + ]: 6008 : else if(aMoveOutsideOffset.Y() < 0)
751 : : {
752 : 0 : nCenY = (sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1);
753 : : }
754 : :
755 : : // create centered handle as default
756 [ + - ][ + - ]: 6008 : pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, nCenX, nCenY);
757 [ + - ]: 6008 : }
758 : : }
759 : :
760 : 6008 : return pRetval;
761 : : }
762 : :
763 : 0 : bool SdrHdl::IsHdlHit(const Point& rPnt) const
764 : : {
765 : : // OVERLAYMANAGER
766 : 0 : basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y());
767 [ # # ]: 0 : return maOverlayGroup.isHitLogic(aPosition);
768 : : }
769 : :
770 : 0 : Pointer SdrHdl::GetPointer() const
771 : : {
772 : 0 : PointerStyle ePtr=POINTER_MOVE;
773 [ # # ][ # # ]: 0 : const sal_Bool bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT;
774 [ # # ][ # # ]: 0 : const sal_Bool bRot=pHdlList!=NULL && pHdlList->IsRotateShear();
775 [ # # ][ # # ]: 0 : const sal_Bool bDis=pHdlList!=NULL && pHdlList->IsDistortShear();
776 [ # # ][ # # ]: 0 : if (bSize && pHdlList!=NULL && (bRot || bDis)) {
[ # # ][ # # ]
777 [ # # # # ]: 0 : switch (eKind) {
778 : : case HDL_UPLFT: case HDL_UPRGT:
779 [ # # ]: 0 : case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break;
780 : 0 : case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break;
781 : 0 : case HDL_UPPER: case HDL_LOWER: ePtr=POINTER_HSHEAR; break;
782 : : default:
783 : 0 : break;
784 : : }
785 : : } else {
786 : : // When resizing rotated rectangles, rotate the mouse cursor slightly, too
787 [ # # ][ # # ]: 0 : if (bSize && nDrehWink!=0) {
788 : 0 : long nHdlWink=0;
789 [ # # # # : 0 : switch (eKind) {
# # # #
# ]
790 : 0 : case HDL_LWRGT: nHdlWink=31500; break;
791 : 0 : case HDL_LOWER: nHdlWink=27000; break;
792 : 0 : case HDL_LWLFT: nHdlWink=22500; break;
793 : 0 : case HDL_LEFT : nHdlWink=18000; break;
794 : 0 : case HDL_UPLFT: nHdlWink=13500; break;
795 : 0 : case HDL_UPPER: nHdlWink=9000; break;
796 : 0 : case HDL_UPRGT: nHdlWink=4500; break;
797 : 0 : case HDL_RIGHT: nHdlWink=0; break;
798 : : default:
799 : 0 : break;
800 : : }
801 : 0 : nHdlWink+=nDrehWink+2249; // a little bit more (for rounding)
802 [ # # ]: 0 : while (nHdlWink<0) nHdlWink+=36000;
803 [ # # ]: 0 : while (nHdlWink>=36000) nHdlWink-=36000;
804 : 0 : nHdlWink/=4500;
805 [ # # # # : 0 : switch ((sal_uInt8)nHdlWink) {
# # # #
# ]
806 : 0 : case 0: ePtr=POINTER_ESIZE; break;
807 : 0 : case 1: ePtr=POINTER_NESIZE; break;
808 : 0 : case 2: ePtr=POINTER_NSIZE; break;
809 : 0 : case 3: ePtr=POINTER_NWSIZE; break;
810 : 0 : case 4: ePtr=POINTER_WSIZE; break;
811 : 0 : case 5: ePtr=POINTER_SWSIZE; break;
812 : 0 : case 6: ePtr=POINTER_SSIZE; break;
813 : 0 : case 7: ePtr=POINTER_SESIZE; break;
814 : 0 : } // switch
815 : : } else {
816 [ # # # # : 0 : switch (eKind) {
# # # # #
# # # # #
# # # ]
817 : 0 : case HDL_UPLFT: ePtr=POINTER_NWSIZE; break;
818 : 0 : case HDL_UPPER: ePtr=POINTER_NSIZE; break;
819 : 0 : case HDL_UPRGT: ePtr=POINTER_NESIZE; break;
820 : 0 : case HDL_LEFT : ePtr=POINTER_WSIZE; break;
821 : 0 : case HDL_RIGHT: ePtr=POINTER_ESIZE; break;
822 : 0 : case HDL_LWLFT: ePtr=POINTER_SWSIZE; break;
823 : 0 : case HDL_LOWER: ePtr=POINTER_SSIZE; break;
824 : 0 : case HDL_LWRGT: ePtr=POINTER_SESIZE; break;
825 : 0 : case HDL_POLY : ePtr=POINTER_MOVEPOINT; break;
826 : 0 : case HDL_CIRC : ePtr=POINTER_HAND; break;
827 : 0 : case HDL_REF1 : ePtr=POINTER_REFHAND; break;
828 : 0 : case HDL_REF2 : ePtr=POINTER_REFHAND; break;
829 : 0 : case HDL_BWGT : ePtr=POINTER_MOVEBEZIERWEIGHT; break;
830 : 0 : case HDL_GLUE : ePtr=POINTER_MOVEPOINT; break;
831 : 0 : case HDL_GLUE_DESELECTED : ePtr=POINTER_MOVEPOINT; break;
832 : 0 : case HDL_CUSTOMSHAPE1 : ePtr=POINTER_HAND; break;
833 : : default:
834 : 0 : break;
835 : : }
836 : : }
837 : : }
838 : 0 : return Pointer(ePtr);
839 : : }
840 : :
841 : 6008 : sal_Bool SdrHdl::IsFocusHdl() const
842 : : {
843 [ + - - ]: 6008 : switch(eKind)
844 : : {
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:
853 : : {
854 : : // if it's an activated TextEdit, it's moved to extended points
855 [ + - ][ - + ]: 6008 : if(pHdlList && pHdlList->IsMoveOutside())
[ - + ]
856 : 0 : return sal_False;
857 : : else
858 : 6008 : return sal_True;
859 : : }
860 : :
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
869 : :
870 : : // for SJ and the CustomShapeHandles:
871 : : case HDL_CUSTOMSHAPE1:
872 : :
873 : : case HDL_USER:
874 : : {
875 : 0 : return sal_True;
876 : : }
877 : :
878 : : default:
879 : : {
880 : 6008 : return sal_False;
881 : : }
882 : : }
883 : : }
884 : :
885 : 0 : void SdrHdl::onMouseEnter(const MouseEvent& /*rMEvt*/)
886 : : {
887 : 0 : }
888 : :
889 : 0 : void SdrHdl::onMouseLeave()
890 : : {
891 : 0 : }
892 : :
893 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
894 : : // class SdrHdlColor
895 : :
896 : 0 : SdrHdlColor::SdrHdlColor(const Point& rRef, Color aCol, const Size& rSize, sal_Bool bLum)
897 : : : SdrHdl(rRef, HDL_COLR),
898 : : aMarkerSize(rSize),
899 [ # # ]: 0 : bUseLuminance(bLum)
900 : : {
901 [ # # ]: 0 : if(IsUseLuminance())
902 [ # # ]: 0 : aCol = GetLuminance(aCol);
903 : :
904 : : // remember color
905 : 0 : aMarkerColor = aCol;
906 : 0 : }
907 : :
908 : 0 : SdrHdlColor::~SdrHdlColor()
909 : : {
910 [ # # ]: 0 : }
911 : :
912 : 0 : void SdrHdlColor::CreateB2dIAObject()
913 : : {
914 : : // first throw away old one
915 : 0 : GetRidOfIAObject();
916 : :
917 [ # # ]: 0 : if(pHdlList)
918 : : {
919 : 0 : SdrMarkView* pView = pHdlList->GetView();
920 : :
921 [ # # ][ # # ]: 0 : if(pView && !pView->areMarkHandlesHidden())
[ # # ]
922 : : {
923 : 0 : SdrPageView* pPageView = pView->GetSdrPageView();
924 : :
925 [ # # ]: 0 : if(pPageView)
926 : : {
927 [ # # ]: 0 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
928 : : {
929 : 0 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
930 : :
931 [ # # ]: 0 : if(rPageWindow.GetPaintWindow().OutputToWindow())
932 : : {
933 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
934 [ # # ]: 0 : if (xManager.is())
935 : : {
936 [ # # ]: 0 : Bitmap aBmpCol(CreateColorDropper(aMarkerColor));
937 : 0 : basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
938 : : ::sdr::overlay::OverlayObject* pNewOverlayObject = new
939 : : ::sdr::overlay::OverlayBitmapEx(
940 : : aPosition,
941 : : BitmapEx(aBmpCol),
942 [ # # ]: 0 : (sal_uInt16)(aBmpCol.GetSizePixel().Width() - 1) >> 1,
943 [ # # ]: 0 : (sal_uInt16)(aBmpCol.GetSizePixel().Height() - 1) >> 1
944 [ # # ][ # # ]: 0 : );
[ # # # # ]
945 : : DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
946 : :
947 : : // OVERLAYMANAGER
948 [ # # ]: 0 : if(pNewOverlayObject)
949 : : {
950 [ # # ]: 0 : xManager->add(*pNewOverlayObject);
951 [ # # ]: 0 : maOverlayGroup.append(*pNewOverlayObject);
952 [ # # ]: 0 : }
953 [ # # ]: 0 : }
954 : : }
955 : : }
956 : : }
957 : : }
958 : : }
959 : 0 : }
960 : :
961 : 0 : Bitmap SdrHdlColor::CreateColorDropper(Color aCol)
962 : : {
963 : : // get the Bitmap
964 : 0 : Bitmap aRetval(aMarkerSize, 24);
965 [ # # ]: 0 : aRetval.Erase(aCol);
966 : :
967 : : // get write access
968 [ # # ]: 0 : BitmapWriteAccess* pWrite = aRetval.AcquireWriteAccess();
969 : : DBG_ASSERT(pWrite, "Got NO write access to a new Bitmap!");
970 : :
971 [ # # ]: 0 : if(pWrite)
972 : : {
973 : : // draw outer border
974 : 0 : sal_Int32 nWidth = aMarkerSize.Width();
975 : 0 : sal_Int32 nHeight = aMarkerSize.Height();
976 : :
977 [ # # ]: 0 : pWrite->SetLineColor(Color(COL_LIGHTGRAY));
978 [ # # ]: 0 : pWrite->DrawLine(Point(0, 0), Point(0, nHeight - 1));
979 [ # # ]: 0 : pWrite->DrawLine(Point(1, 0), Point(nWidth - 1, 0));
980 [ # # ]: 0 : pWrite->SetLineColor(Color(COL_GRAY));
981 [ # # ]: 0 : pWrite->DrawLine(Point(1, nHeight - 1), Point(nWidth - 1, nHeight - 1));
982 [ # # ]: 0 : pWrite->DrawLine(Point(nWidth - 1, 1), Point(nWidth - 1, nHeight - 2));
983 : :
984 : : // draw lighter UpperLeft
985 : : const Color aLightColor(
986 [ # # ]: 0 : (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetRed() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
987 [ # # ]: 0 : (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetGreen() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
988 [ # # ]: 0 : (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetBlue() + (sal_Int16)0x0040), (sal_Int16)0x00ff)));
989 [ # # ]: 0 : pWrite->SetLineColor(aLightColor);
990 [ # # ]: 0 : pWrite->DrawLine(Point(1, 1), Point(1, nHeight - 2));
991 [ # # ]: 0 : pWrite->DrawLine(Point(2, 1), Point(nWidth - 2, 1));
992 : :
993 : : // draw darker LowerRight
994 : : const Color aDarkColor(
995 [ # # ]: 0 : (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetRed() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
996 [ # # ]: 0 : (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetGreen() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
997 [ # # ]: 0 : (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetBlue() - (sal_Int16)0x0040), (sal_Int16)0x0000)));
998 [ # # ]: 0 : pWrite->SetLineColor(aDarkColor);
999 [ # # ]: 0 : pWrite->DrawLine(Point(2, nHeight - 2), Point(nWidth - 2, nHeight - 2));
1000 [ # # ]: 0 : pWrite->DrawLine(Point(nWidth - 2, 2), Point(nWidth - 2, nHeight - 3));
1001 : :
1002 : : // get rid of write access
1003 [ # # ][ # # ]: 0 : delete pWrite;
1004 : : }
1005 : :
1006 : 0 : return aRetval;
1007 : : }
1008 : :
1009 : 0 : Color SdrHdlColor::GetLuminance(const Color& rCol)
1010 : : {
1011 : 0 : sal_uInt8 aLum = rCol.GetLuminance();
1012 : 0 : Color aRetval(aLum, aLum, aLum);
1013 : 0 : return aRetval;
1014 : : }
1015 : :
1016 : 0 : void SdrHdlColor::CallColorChangeLink()
1017 : : {
1018 : 0 : aColorChangeHdl.Call(this);
1019 : 0 : }
1020 : :
1021 : 0 : void SdrHdlColor::SetColor(Color aNew, sal_Bool bCallLink)
1022 : : {
1023 [ # # ]: 0 : if(IsUseLuminance())
1024 : 0 : aNew = GetLuminance(aNew);
1025 : :
1026 [ # # ]: 0 : if(aMarkerColor != aNew)
1027 : : {
1028 : : // remember new color
1029 : 0 : aMarkerColor = aNew;
1030 : :
1031 : : // create new display
1032 : 0 : Touch();
1033 : :
1034 : : // tell about change
1035 [ # # ]: 0 : if(bCallLink)
1036 : 0 : CallColorChangeLink();
1037 : : }
1038 : 0 : }
1039 : :
1040 : 0 : void SdrHdlColor::SetSize(const Size& rNew)
1041 : : {
1042 [ # # ]: 0 : if(rNew != aMarkerSize)
1043 : : {
1044 : : // remember new size
1045 : 0 : aMarkerSize = rNew;
1046 : :
1047 : : // create new display
1048 : 0 : Touch();
1049 : : }
1050 : 0 : }
1051 : :
1052 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1053 : : // class SdrHdlGradient
1054 : :
1055 : 0 : 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 [ # # ]: 0 : bGradient(bGrad)
1061 : : {
1062 : 0 : }
1063 : :
1064 : 0 : SdrHdlGradient::~SdrHdlGradient()
1065 : : {
1066 [ # # ]: 0 : }
1067 : :
1068 : 0 : void SdrHdlGradient::Set2ndPos(const Point& rPnt)
1069 : : {
1070 [ # # ]: 0 : if(a2ndPos != rPnt)
1071 : : {
1072 : : // remember new position
1073 : 0 : a2ndPos = rPnt;
1074 : :
1075 : : // create new display
1076 : 0 : Touch();
1077 : : }
1078 : 0 : }
1079 : :
1080 : 0 : void SdrHdlGradient::CreateB2dIAObject()
1081 : : {
1082 : : // first throw away old one
1083 : 0 : GetRidOfIAObject();
1084 : :
1085 [ # # ]: 0 : if(pHdlList)
1086 : : {
1087 : 0 : SdrMarkView* pView = pHdlList->GetView();
1088 : :
1089 [ # # ][ # # ]: 0 : if(pView && !pView->areMarkHandlesHidden())
[ # # ]
1090 : : {
1091 : 0 : SdrPageView* pPageView = pView->GetSdrPageView();
1092 : :
1093 [ # # ]: 0 : if(pPageView)
1094 : : {
1095 [ # # ]: 0 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1096 : : {
1097 : 0 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1098 : :
1099 [ # # ]: 0 : if(rPageWindow.GetPaintWindow().OutputToWindow())
1100 : : {
1101 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1102 [ # # ]: 0 : if (xManager.is())
1103 : : {
1104 : : // striped line in between
1105 : 0 : basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
1106 [ # # ]: 0 : double fVecLen = aVec.getLength();
1107 : 0 : double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
1108 : 0 : double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
1109 [ # # ]: 0 : aVec.normalize();
1110 : 0 : basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
1111 : 0 : sal_Int32 nMidX = (sal_Int32)(aPos.X() + aVec.getX() * fLongPercentArrow);
1112 : 0 : sal_Int32 nMidY = (sal_Int32)(aPos.Y() + aVec.getY() * fLongPercentArrow);
1113 : 0 : Point aMidPoint(nMidX, nMidY);
1114 : :
1115 : 0 : basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1116 : 0 : basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
1117 : :
1118 : : ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1119 : : ::sdr::overlay::OverlayLineStriped(
1120 : : aPosition, aMidPos
1121 [ # # ][ # # ]: 0 : );
1122 : : DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1123 : :
1124 [ # # ][ # # ]: 0 : pNewOverlayObject->setBaseColor(IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE));
[ # # ][ # # ]
[ # # # # ]
1125 [ # # ]: 0 : xManager->add(*pNewOverlayObject);
1126 [ # # ]: 0 : maOverlayGroup.append(*pNewOverlayObject);
1127 : :
1128 : : // arrowhead
1129 : 0 : Point aLeft(aMidPoint.X() + (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
1130 : 0 : aMidPoint.Y() + (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
1131 : 0 : Point aRight(aMidPoint.X() - (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
1132 : 0 : aMidPoint.Y() - (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
1133 : :
1134 : 0 : basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
1135 : 0 : basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
1136 : 0 : basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
1137 : :
1138 : : pNewOverlayObject = new
1139 : : ::sdr::overlay::OverlayTriangle(
1140 : : aPositionLeft,
1141 : : aPosition2,
1142 : : aPositionRight,
1143 : 0 : IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)
1144 [ # # ][ # # ]: 0 : );
[ # # ]
1145 : : DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1146 : :
1147 [ # # ]: 0 : xManager->add(*pNewOverlayObject);
1148 [ # # ]: 0 : maOverlayGroup.append(*pNewOverlayObject);
1149 [ # # ]: 0 : }
1150 : : }
1151 : : }
1152 : : }
1153 : : }
1154 : : }
1155 : 0 : }
1156 : :
1157 : 0 : IMPL_LINK(SdrHdlGradient, ColorChangeHdl, SdrHdl*, /*pHdl*/)
1158 : : {
1159 [ # # ]: 0 : if(GetObj())
1160 : 0 : FromIAOToItem(GetObj(), sal_True, sal_True);
1161 : 0 : return 0;
1162 : : }
1163 : :
1164 : 0 : void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, sal_Bool bSetItemOnObject, sal_Bool bUndo)
1165 : : {
1166 : : // from IAO positions and colors to gradient
1167 [ # # ]: 0 : const SfxItemSet& rSet = _pObj->GetMergedItemSet();
1168 : :
1169 : 0 : GradTransformer aGradTransformer;
1170 [ # # ]: 0 : GradTransGradient aOldGradTransGradient;
1171 [ # # ]: 0 : GradTransGradient aGradTransGradient;
1172 : 0 : GradTransVector aGradTransVector;
1173 : :
1174 [ # # ]: 0 : String aString;
1175 : :
1176 : 0 : aGradTransVector.maPositionA = basegfx::B2DPoint(GetPos().X(), GetPos().Y());
1177 : 0 : aGradTransVector.maPositionB = basegfx::B2DPoint(Get2ndPos().X(), Get2ndPos().Y());
1178 [ # # ]: 0 : if(pColHdl1)
1179 : 0 : aGradTransVector.aCol1 = pColHdl1->GetColor();
1180 [ # # ]: 0 : if(pColHdl2)
1181 : 0 : aGradTransVector.aCol2 = pColHdl2->GetColor();
1182 : :
1183 [ # # ]: 0 : if(IsGradient())
1184 [ # # ][ # # ]: 0 : aOldGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
1185 : : else
1186 [ # # ][ # # ]: 0 : aOldGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue();
1187 : :
1188 : : // transform vector data to gradient
1189 [ # # ]: 0 : aGradTransformer.VecToGrad(aGradTransVector, aGradTransGradient, aOldGradTransGradient, _pObj, bMoveSingleHandle, bMoveFirstHandle);
1190 : :
1191 [ # # ]: 0 : if(bSetItemOnObject)
1192 : : {
1193 [ # # ]: 0 : SdrModel* pModel = _pObj->GetModel();
1194 [ # # ]: 0 : SfxItemSet aNewSet(pModel->GetItemPool());
1195 : :
1196 [ # # ]: 0 : if(IsGradient())
1197 : : {
1198 [ # # ][ # # ]: 0 : aString = String();
[ # # ]
1199 [ # # ]: 0 : XFillGradientItem aNewGradItem(aString, aGradTransGradient.aGradient);
1200 [ # # ][ # # ]: 0 : aNewSet.Put(aNewGradItem);
1201 : : }
1202 : : else
1203 : : {
1204 [ # # ][ # # ]: 0 : aString = String();
[ # # ]
1205 [ # # ]: 0 : XFillFloatTransparenceItem aNewTransItem(aString, aGradTransGradient.aGradient);
1206 [ # # ][ # # ]: 0 : aNewSet.Put(aNewTransItem);
1207 : : }
1208 : :
1209 [ # # ][ # # ]: 0 : if(bUndo && pModel->IsUndoEnabled())
[ # # ][ # # ]
1210 : : {
1211 [ # # ][ # # ]: 0 : pModel->BegUndo(SVX_RESSTR(IsGradient() ? SIP_XA_FILLGRADIENT : SIP_XA_FILLTRANSPARENCE));
[ # # ][ # # ]
[ # # ][ # # ]
1212 [ # # ][ # # ]: 0 : pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*_pObj));
[ # # ]
1213 [ # # ]: 0 : pModel->EndUndo();
1214 : : }
1215 : :
1216 [ # # ][ # # ]: 0 : pObj->SetMergedItemSetAndBroadcast(aNewSet);
1217 : : }
1218 : :
1219 : : // back transformation, set values on pIAOHandle
1220 [ # # ]: 0 : aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, _pObj);
1221 : :
1222 [ # # ]: 0 : SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1223 [ # # ]: 0 : Set2ndPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1224 [ # # ]: 0 : if(pColHdl1)
1225 : : {
1226 [ # # ]: 0 : pColHdl1->SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1227 [ # # ]: 0 : pColHdl1->SetColor(aGradTransVector.aCol1);
1228 : : }
1229 [ # # ]: 0 : if(pColHdl2)
1230 : : {
1231 [ # # ]: 0 : pColHdl2->SetPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1232 [ # # ]: 0 : pColHdl2->SetColor(aGradTransVector.aCol2);
1233 [ # # ]: 0 : }
1234 : 0 : }
1235 : :
1236 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1237 : :
1238 [ # # ]: 0 : SdrHdlLine::~SdrHdlLine() {}
1239 : :
1240 : 0 : void SdrHdlLine::CreateB2dIAObject()
1241 : : {
1242 : : // first throw away old one
1243 : 0 : GetRidOfIAObject();
1244 : :
1245 [ # # ]: 0 : if(pHdlList)
1246 : : {
1247 : 0 : SdrMarkView* pView = pHdlList->GetView();
1248 : :
1249 [ # # ][ # # ]: 0 : if(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2)
[ # # ][ # # ]
[ # # ]
1250 : : {
1251 : 0 : SdrPageView* pPageView = pView->GetSdrPageView();
1252 : :
1253 [ # # ]: 0 : if(pPageView)
1254 : : {
1255 [ # # ]: 0 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1256 : : {
1257 : 0 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1258 : :
1259 [ # # ]: 0 : if(rPageWindow.GetPaintWindow().OutputToWindow())
1260 : : {
1261 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1262 [ # # ]: 0 : if (xManager.is())
1263 : : {
1264 : 0 : basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1265 : 0 : basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
1266 : :
1267 : : ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1268 : : ::sdr::overlay::OverlayLineStriped(
1269 : : aPosition1,
1270 : : aPosition2
1271 [ # # ][ # # ]: 0 : );
1272 : : DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1273 : :
1274 : : // OVERLAYMANAGER
1275 [ # # ]: 0 : if(pNewOverlayObject)
1276 : : {
1277 : : // color(?)
1278 [ # # ]: 0 : pNewOverlayObject->setBaseColor(Color(COL_LIGHTRED));
1279 : :
1280 [ # # ]: 0 : xManager->add(*pNewOverlayObject);
1281 [ # # ]: 0 : maOverlayGroup.append(*pNewOverlayObject);
1282 : 0 : }
1283 [ # # ]: 0 : }
1284 : : }
1285 : : }
1286 : : }
1287 : : }
1288 : : }
1289 : 0 : }
1290 : :
1291 : 0 : Pointer SdrHdlLine::GetPointer() const
1292 : : {
1293 : 0 : return Pointer(POINTER_REFHAND);
1294 : : }
1295 : :
1296 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1297 : :
1298 [ # # ]: 0 : SdrHdlBezWgt::~SdrHdlBezWgt() {}
1299 : :
1300 : 0 : void SdrHdlBezWgt::CreateB2dIAObject()
1301 : : {
1302 : : // call parent
1303 : 0 : SdrHdl::CreateB2dIAObject();
1304 : :
1305 : : // create lines
1306 [ # # ]: 0 : if(pHdlList)
1307 : : {
1308 : 0 : SdrMarkView* pView = pHdlList->GetView();
1309 : :
1310 [ # # ][ # # ]: 0 : if(pView && !pView->areMarkHandlesHidden())
[ # # ]
1311 : : {
1312 : 0 : SdrPageView* pPageView = pView->GetSdrPageView();
1313 : :
1314 [ # # ]: 0 : if(pPageView)
1315 : : {
1316 [ # # ]: 0 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1317 : : {
1318 : 0 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1319 : :
1320 [ # # ]: 0 : if(rPageWindow.GetPaintWindow().OutputToWindow())
1321 : : {
1322 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1323 [ # # ]: 0 : if (xManager.is())
1324 : : {
1325 : 0 : basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1326 : 0 : basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
1327 : :
1328 [ # # ]: 0 : if(!aPosition1.equal(aPosition2))
1329 : : {
1330 : : ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1331 : : ::sdr::overlay::OverlayLineStriped(
1332 : : aPosition1,
1333 : : aPosition2
1334 [ # # ][ # # ]: 0 : );
1335 : : DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1336 : :
1337 : : // OVERLAYMANAGER
1338 [ # # ]: 0 : if(pNewOverlayObject)
1339 : : {
1340 : : // line part is not hittable
1341 [ # # ]: 0 : pNewOverlayObject->setHittable(sal_False);
1342 : :
1343 : : // color(?)
1344 [ # # ]: 0 : pNewOverlayObject->setBaseColor(Color(COL_LIGHTBLUE));
1345 : :
1346 [ # # ]: 0 : xManager->add(*pNewOverlayObject);
1347 [ # # ]: 0 : maOverlayGroup.append(*pNewOverlayObject);
1348 : : }
1349 : 0 : }
1350 [ # # ]: 0 : }
1351 : : }
1352 : : }
1353 : : }
1354 : : }
1355 : : }
1356 : 0 : }
1357 : :
1358 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1359 : :
1360 [ # # ]: 0 : E3dVolumeMarker::E3dVolumeMarker(const basegfx::B2DPolyPolygon& rWireframePoly)
1361 : : {
1362 [ # # ]: 0 : aWireframePoly = rWireframePoly;
1363 : 0 : }
1364 : :
1365 : 0 : void E3dVolumeMarker::CreateB2dIAObject()
1366 : : {
1367 : : // create lines
1368 [ # # ]: 0 : if(pHdlList)
1369 : : {
1370 : 0 : SdrMarkView* pView = pHdlList->GetView();
1371 : :
1372 [ # # ][ # # ]: 0 : if(pView && !pView->areMarkHandlesHidden())
[ # # ]
1373 : : {
1374 : 0 : SdrPageView* pPageView = pView->GetSdrPageView();
1375 : :
1376 [ # # ]: 0 : if(pPageView)
1377 : : {
1378 [ # # ]: 0 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1379 : : {
1380 : 0 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1381 : :
1382 [ # # ]: 0 : if(rPageWindow.GetPaintWindow().OutputToWindow())
1383 : : {
1384 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1385 [ # # ][ # # ]: 0 : if (xManager.is() && aWireframePoly.count())
[ # # ][ # # ]
1386 : : {
1387 : : ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1388 [ # # ][ # # ]: 0 : ::sdr::overlay::OverlayPolyPolygonStriped(aWireframePoly);
1389 : : DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1390 : :
1391 : : // OVERLAYMANAGER
1392 [ # # ]: 0 : if(pNewOverlayObject)
1393 : : {
1394 [ # # ]: 0 : pNewOverlayObject->setBaseColor(Color(COL_BLACK));
1395 : :
1396 [ # # ]: 0 : xManager->add(*pNewOverlayObject);
1397 [ # # ]: 0 : maOverlayGroup.append(*pNewOverlayObject);
1398 : : }
1399 [ # # ]: 0 : }
1400 : : }
1401 : : }
1402 : : }
1403 : : }
1404 : : }
1405 : 0 : }
1406 : :
1407 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1408 : :
1409 : 0 : ImpEdgeHdl::~ImpEdgeHdl()
1410 : : {
1411 [ # # ]: 0 : }
1412 : :
1413 : 0 : void ImpEdgeHdl::CreateB2dIAObject()
1414 : : {
1415 [ # # ][ # # ]: 0 : if(nObjHdlNum <= 1 && pObj)
1416 : : {
1417 : : // first throw away old one
1418 : 0 : GetRidOfIAObject();
1419 : :
1420 : 0 : BitmapColorIndex eColIndex = LightCyan;
1421 : 0 : BitmapMarkerKind eKindOfMarker = Rect_7x7;
1422 : :
1423 [ # # ]: 0 : if(pHdlList)
1424 : : {
1425 : 0 : SdrMarkView* pView = pHdlList->GetView();
1426 : :
1427 [ # # ][ # # ]: 0 : if(pView && !pView->areMarkHandlesHidden())
[ # # ]
1428 : : {
1429 : 0 : const SdrEdgeObj* pEdge = (SdrEdgeObj*)pObj;
1430 : :
1431 [ # # ]: 0 : if(pEdge->GetConnectedNode(nObjHdlNum == 0) != NULL)
1432 : 0 : eColIndex = LightRed;
1433 : :
1434 [ # # ]: 0 : if(nPPntNum < 2)
1435 : : {
1436 : : // Handle with plus sign inside
1437 : 0 : eKindOfMarker = Circ_7x7;
1438 : : }
1439 : :
1440 : 0 : SdrPageView* pPageView = pView->GetSdrPageView();
1441 : :
1442 [ # # ]: 0 : if(pPageView)
1443 : : {
1444 [ # # ]: 0 : for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1445 : : {
1446 : 0 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1447 : :
1448 [ # # ]: 0 : if(rPageWindow.GetPaintWindow().OutputToWindow())
1449 : : {
1450 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1451 [ # # ]: 0 : if (xManager.is())
1452 : : {
1453 : 0 : basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1454 : :
1455 : : ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
1456 : : aPosition,
1457 : : eColIndex,
1458 [ # # ]: 0 : eKindOfMarker);
1459 : :
1460 : : // OVERLAYMANAGER
1461 [ # # ]: 0 : if(pNewOverlayObject)
1462 : : {
1463 [ # # ]: 0 : xManager->add(*pNewOverlayObject);
1464 [ # # ]: 0 : maOverlayGroup.append(*pNewOverlayObject);
1465 : 0 : }
1466 [ # # ]: 0 : }
1467 : : }
1468 : : }
1469 : : }
1470 : : }
1471 : 0 : }
1472 : : }
1473 : : else
1474 : : {
1475 : : // call parent
1476 : 0 : SdrHdl::CreateB2dIAObject();
1477 : : }
1478 : 0 : }
1479 : :
1480 : 0 : void ImpEdgeHdl::SetLineCode(SdrEdgeLineCode eCode)
1481 : : {
1482 [ # # ]: 0 : if(eLineCode != eCode)
1483 : : {
1484 : : // remember new value
1485 : 0 : eLineCode = eCode;
1486 : :
1487 : : // create new display
1488 : 0 : Touch();
1489 : : }
1490 : 0 : }
1491 : :
1492 : 0 : Pointer ImpEdgeHdl::GetPointer() const
1493 : : {
1494 [ # # ][ # # ]: 0 : SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
1495 [ # # ]: 0 : if (pEdge==NULL)
1496 : 0 : return SdrHdl::GetPointer();
1497 [ # # ]: 0 : if (nObjHdlNum<=1)
1498 : 0 : return Pointer(POINTER_MOVEPOINT);
1499 [ # # ]: 0 : if (IsHorzDrag())
1500 : 0 : return Pointer(POINTER_ESIZE);
1501 : : else
1502 : 0 : return Pointer(POINTER_SSIZE);
1503 : : }
1504 : :
1505 : 0 : sal_Bool ImpEdgeHdl::IsHorzDrag() const
1506 : : {
1507 [ # # ][ # # ]: 0 : SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
1508 [ # # ]: 0 : if (pEdge==NULL)
1509 : 0 : return sal_False;
1510 [ # # ]: 0 : if (nObjHdlNum<=1)
1511 : 0 : return sal_False;
1512 : :
1513 : 0 : SdrEdgeKind eEdgeKind = ((SdrEdgeKindItem&)(pEdge->GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
1514 : :
1515 : 0 : const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
1516 [ # # ][ # # ]: 0 : if (eEdgeKind==SDREDGE_ORTHOLINES || eEdgeKind==SDREDGE_BEZIER)
1517 : : {
1518 : 0 : return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
1519 : : }
1520 [ # # ]: 0 : else if (eEdgeKind==SDREDGE_THREELINES)
1521 : : {
1522 [ # # ]: 0 : long nWink=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
1523 [ # # ][ # # ]: 0 : if (nWink==0 || nWink==18000)
1524 : 0 : return sal_True;
1525 : : else
1526 : 0 : return sal_False;
1527 : : }
1528 : 0 : return sal_False;
1529 : : }
1530 : :
1531 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1532 : :
1533 : 0 : ImpMeasureHdl::~ImpMeasureHdl()
1534 : : {
1535 [ # # ]: 0 : }
1536 : :
1537 : 0 : void ImpMeasureHdl::CreateB2dIAObject()
1538 : : {
1539 : : // first throw away old one
1540 : 0 : GetRidOfIAObject();
1541 : :
1542 [ # # ]: 0 : if(pHdlList)
1543 : : {
1544 : 0 : SdrMarkView* pView = pHdlList->GetView();
1545 : :
1546 [ # # ][ # # ]: 0 : if(pView && !pView->areMarkHandlesHidden())
[ # # ]
1547 : : {
1548 : 0 : BitmapColorIndex eColIndex = LightCyan;
1549 : 0 : BitmapMarkerKind eKindOfMarker = Rect_9x9;
1550 : :
1551 [ # # ]: 0 : if(nObjHdlNum > 1)
1552 : : {
1553 : 0 : eKindOfMarker = Rect_7x7;
1554 : : }
1555 : :
1556 [ # # ]: 0 : if(bSelect)
1557 : : {
1558 : 0 : eColIndex = Cyan;
1559 : : }
1560 : :
1561 : 0 : SdrPageView* pPageView = pView->GetSdrPageView();
1562 : :
1563 [ # # ]: 0 : if(pPageView)
1564 : : {
1565 [ # # ]: 0 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1566 : : {
1567 : 0 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1568 : :
1569 [ # # ]: 0 : if(rPageWindow.GetPaintWindow().OutputToWindow())
1570 : : {
1571 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1572 [ # # ]: 0 : if (xManager.is())
1573 : : {
1574 : 0 : basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1575 : :
1576 : : ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
1577 : : aPosition,
1578 : : eColIndex,
1579 [ # # ]: 0 : eKindOfMarker);
1580 : :
1581 : : // OVERLAYMANAGER
1582 [ # # ]: 0 : if(pNewOverlayObject)
1583 : : {
1584 [ # # ]: 0 : xManager->add(*pNewOverlayObject);
1585 [ # # ]: 0 : maOverlayGroup.append(*pNewOverlayObject);
1586 : 0 : }
1587 [ # # ]: 0 : }
1588 : : }
1589 : : }
1590 : : }
1591 : : }
1592 : : }
1593 : 0 : }
1594 : :
1595 : 0 : Pointer ImpMeasureHdl::GetPointer() const
1596 : : {
1597 [ # # # # ]: 0 : switch (nObjHdlNum)
1598 : : {
1599 : 0 : case 0: case 1: return Pointer(POINTER_HAND);
1600 : 0 : case 2: case 3: return Pointer(POINTER_MOVEPOINT);
1601 : 0 : case 4: case 5: return SdrHdl::GetPointer(); // will then be rotated appropriately
1602 : : } // switch
1603 : 0 : return Pointer(POINTER_NOTALLOWED);
1604 : : }
1605 : :
1606 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1607 : :
1608 : 0 : ImpTextframeHdl::ImpTextframeHdl(const Rectangle& rRect) :
1609 : : SdrHdl(rRect.TopLeft(),HDL_MOVE),
1610 [ # # ]: 0 : maRect(rRect)
1611 : : {
1612 : 0 : }
1613 : :
1614 : 0 : void ImpTextframeHdl::CreateB2dIAObject()
1615 : : {
1616 : : // first throw away old one
1617 : 0 : GetRidOfIAObject();
1618 : :
1619 [ # # ]: 0 : if(pHdlList)
1620 : : {
1621 : 0 : SdrMarkView* pView = pHdlList->GetView();
1622 : :
1623 [ # # ][ # # ]: 0 : if(pView && !pView->areMarkHandlesHidden())
[ # # ]
1624 : : {
1625 : 0 : SdrPageView* pPageView = pView->GetSdrPageView();
1626 : :
1627 [ # # ]: 0 : if(pPageView)
1628 : : {
1629 [ # # ]: 0 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1630 : : {
1631 : 0 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1632 : :
1633 [ # # ]: 0 : if(rPageWindow.GetPaintWindow().OutputToWindow())
1634 : : {
1635 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
1636 [ # # ]: 0 : if (xManager.is())
1637 : : {
1638 : 0 : const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
1639 : 0 : const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
1640 [ # # ]: 0 : const svtools::ColorConfig aColorConfig;
1641 [ # # ]: 0 : const Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
1642 : :
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 [ # # ][ # # ]: 0 : nDrehWink * -F_PI18000);
1651 [ # # ]: 0 : pNewOverlayObject->setHittable(false);
1652 : :
1653 : : // OVERLAYMANAGER
1654 [ # # ]: 0 : if(pNewOverlayObject)
1655 : : {
1656 [ # # ]: 0 : xManager->add(*pNewOverlayObject);
1657 [ # # ]: 0 : maOverlayGroup.append(*pNewOverlayObject);
1658 [ # # ]: 0 : }
1659 [ # # ]: 0 : }
1660 : : }
1661 : : }
1662 : : }
1663 : : }
1664 : : }
1665 : 0 : }
1666 : :
1667 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1668 : :
1669 : 15804 : static bool ImpSdrHdlListSorter(SdrHdl* const& lhs, SdrHdl* const& rhs)
1670 : : {
1671 : 15804 : SdrHdlKind eKind1=lhs->GetKind();
1672 : 15804 : SdrHdlKind eKind2=rhs->GetKind();
1673 : : // Level 1: first normal handles, then Glue, then User, then Plus handles, then reference point handles
1674 : 15804 : unsigned n1=1;
1675 : 15804 : unsigned n2=1;
1676 [ + + ]: 15804 : if (eKind1!=eKind2)
1677 : : {
1678 [ + - ][ + - ]: 12415 : if (eKind1==HDL_REF1 || eKind1==HDL_REF2 || eKind1==HDL_MIRX) n1=5;
[ - + ]
1679 [ + - ][ - + ]: 12415 : else if (eKind1==HDL_GLUE || eKind1==HDL_GLUE_DESELECTED) n1=2;
1680 [ - + ]: 12415 : else if (eKind1==HDL_USER) n1=3;
1681 [ - + ]: 12415 : else if (eKind1==HDL_SMARTTAG) n1=0;
1682 [ + - ][ + - ]: 12415 : if (eKind2==HDL_REF1 || eKind2==HDL_REF2 || eKind2==HDL_MIRX) n2=5;
[ - + ]
1683 [ + - ][ - + ]: 12415 : else if (eKind2==HDL_GLUE || eKind2==HDL_GLUE_DESELECTED) n2=2;
1684 [ - + ]: 12415 : else if (eKind2==HDL_USER) n2=3;
1685 [ - + ]: 12415 : else if (eKind2==HDL_SMARTTAG) n2=0;
1686 : : }
1687 [ - + ]: 15804 : if (lhs->IsPlusHdl()) n1=4;
1688 [ - + ]: 15804 : if (rhs->IsPlusHdl()) n2=4;
1689 [ + - ]: 15804 : if (n1==n2)
1690 : : {
1691 : : // Level 2: PageView (Pointer)
1692 : 15804 : SdrPageView* pPV1=lhs->GetPageView();
1693 : 15804 : SdrPageView* pPV2=rhs->GetPageView();
1694 [ + - ]: 15804 : if (pPV1==pPV2)
1695 : : {
1696 : : // Level 3: Position (x+y)
1697 : 15804 : SdrObject* pObj1=lhs->GetObj();
1698 : 15804 : SdrObject* pObj2=rhs->GetObj();
1699 [ + + ]: 15804 : if (pObj1==pObj2)
1700 : : {
1701 : 14223 : sal_uInt32 nNum1=lhs->GetObjHdlNum();
1702 : 14223 : sal_uInt32 nNum2=rhs->GetObjHdlNum();
1703 [ + + ]: 14223 : if (nNum1==nNum2)
1704 : : {
1705 [ - + ]: 10878 : if (eKind1==eKind2)
1706 : 0 : return (long)lhs<(long)rhs; // Hack, to always get to the same sorting
1707 : 10878 : return (sal_uInt16)eKind1<(sal_uInt16)eKind2;
1708 : : }
1709 : : else
1710 : 3345 : return nNum1<nNum2;
1711 : : }
1712 : : else
1713 : : {
1714 : 1581 : return (long)pObj1<(long)pObj2;
1715 : : }
1716 : : }
1717 : : else
1718 : : {
1719 : 0 : return (long)pPV1<(long)pPV2;
1720 : : }
1721 : : }
1722 : : else
1723 : : {
1724 : 15804 : return n1<n2;
1725 : : }
1726 : : }
1727 : :
1728 : 25875 : SdrMarkView* SdrHdlList::GetView() const
1729 : : {
1730 : 25875 : return pView;
1731 : : }
1732 : :
1733 : : // Helper struct for re-sorting handles
1734 : : struct ImplHdlAndIndex
1735 : : {
1736 : : SdrHdl* mpHdl;
1737 : : sal_uInt32 mnIndex;
1738 : : };
1739 : :
1740 : : // Helper method for sorting handles taking care of OrdNums, keeping order in
1741 : : // single objects and re-sorting polygon handles intuitively
1742 : 0 : extern "C" int __LOADONCALLAPI ImplSortHdlFunc( const void* pVoid1, const void* pVoid2 )
1743 : : {
1744 : 0 : const ImplHdlAndIndex* p1 = (ImplHdlAndIndex*)pVoid1;
1745 : 0 : const ImplHdlAndIndex* p2 = (ImplHdlAndIndex*)pVoid2;
1746 : :
1747 [ # # ]: 0 : if(p1->mpHdl->GetObj() == p2->mpHdl->GetObj())
1748 : : {
1749 [ # # ][ # # ]: 0 : if(p1->mpHdl->GetObj() && p1->mpHdl->GetObj()->ISA(SdrPathObj))
[ # # ]
1750 : : {
1751 : : // same object and a path object
1752 [ # # ][ # # : 0 : if((p1->mpHdl->GetKind() == HDL_POLY || p1->mpHdl->GetKind() == HDL_BWGT)
# # # # ]
[ # # ]
1753 : 0 : && (p2->mpHdl->GetKind() == HDL_POLY || p2->mpHdl->GetKind() == HDL_BWGT))
1754 : : {
1755 : : // both handles are point or control handles
1756 [ # # ]: 0 : if(p1->mpHdl->GetPolyNum() == p2->mpHdl->GetPolyNum())
1757 : : {
1758 [ # # ]: 0 : if(p1->mpHdl->GetPointNum() < p2->mpHdl->GetPointNum())
1759 : : {
1760 : 0 : return -1;
1761 : : }
1762 : : else
1763 : : {
1764 : 0 : return 1;
1765 : : }
1766 : : }
1767 [ # # ]: 0 : else if(p1->mpHdl->GetPolyNum() < p2->mpHdl->GetPolyNum())
1768 : : {
1769 : 0 : return -1;
1770 : : }
1771 : : else
1772 : : {
1773 : 0 : return 1;
1774 : : }
1775 : : }
1776 : : }
1777 : : }
1778 : : else
1779 : : {
1780 [ # # ]: 0 : if(!p1->mpHdl->GetObj())
1781 : : {
1782 : 0 : return -1;
1783 : : }
1784 [ # # ]: 0 : else if(!p2->mpHdl->GetObj())
1785 : : {
1786 : 0 : return 1;
1787 : : }
1788 : : else
1789 : : {
1790 : : // different objects, use OrdNum for sort
1791 : 0 : const sal_uInt32 nOrdNum1 = p1->mpHdl->GetObj()->GetOrdNum();
1792 : 0 : const sal_uInt32 nOrdNum2 = p2->mpHdl->GetObj()->GetOrdNum();
1793 : :
1794 [ # # ]: 0 : if(nOrdNum1 < nOrdNum2)
1795 : : {
1796 : 0 : return -1;
1797 : : }
1798 : : else
1799 : : {
1800 : 0 : return 1;
1801 : : }
1802 : : }
1803 : : }
1804 : :
1805 : : // fallback to indices
1806 [ # # ]: 0 : if(p1->mnIndex < p2->mnIndex)
1807 : : {
1808 : 0 : return -1;
1809 : : }
1810 : : else
1811 : : {
1812 : 0 : return 1;
1813 : : }
1814 : : }
1815 : :
1816 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1817 : :
1818 : 0 : void SdrHdlList::TravelFocusHdl(sal_Bool bForward)
1819 : : {
1820 : : // security correction
1821 [ # # ][ # # ]: 0 : if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex >= GetHdlCount())
[ # # ]
1822 : 0 : mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1823 : :
1824 [ # # ]: 0 : if(!aList.empty())
1825 : : {
1826 : : // take care of old handle
1827 : 0 : const sal_uIntPtr nOldHdlNum(mnFocusIndex);
1828 : 0 : SdrHdl* pOld = GetHdl(nOldHdlNum);
1829 : :
1830 [ # # ]: 0 : if(pOld)
1831 : : {
1832 : : // switch off old handle
1833 : 0 : mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1834 : 0 : pOld->Touch();
1835 : : }
1836 : :
1837 : : // allocate pointer array for sorted handle list
1838 : 0 : ImplHdlAndIndex* pHdlAndIndex = new ImplHdlAndIndex[aList.size()];
1839 : :
1840 : : // build sorted handle list
1841 : : sal_uInt32 a;
1842 [ # # ]: 0 : for( a = 0; a < aList.size(); a++)
1843 : : {
1844 : 0 : pHdlAndIndex[a].mpHdl = aList[a];
1845 : 0 : pHdlAndIndex[a].mnIndex = a;
1846 : : }
1847 : :
1848 : 0 : qsort(pHdlAndIndex, aList.size(), sizeof(ImplHdlAndIndex), ImplSortHdlFunc);
1849 : :
1850 : : // look for old num in sorted array
1851 : 0 : sal_uIntPtr nOldHdl(nOldHdlNum);
1852 : :
1853 [ # # ]: 0 : if(nOldHdlNum != CONTAINER_ENTRY_NOTFOUND)
1854 : : {
1855 [ # # ]: 0 : for(a = 0; a < aList.size(); a++)
1856 : : {
1857 [ # # ]: 0 : if(pHdlAndIndex[a].mpHdl == pOld)
1858 : : {
1859 : 0 : nOldHdl = a;
1860 : 0 : break;
1861 : : }
1862 : : }
1863 : : }
1864 : :
1865 : : // build new HdlNum
1866 : 0 : sal_uIntPtr nNewHdl(nOldHdl);
1867 : :
1868 : : // do the focus travel
1869 [ # # ]: 0 : if(bForward)
1870 : : {
1871 [ # # ]: 0 : if(nOldHdl != CONTAINER_ENTRY_NOTFOUND)
1872 : : {
1873 [ # # ]: 0 : if(nOldHdl == aList.size() - 1)
1874 : : {
1875 : : // end forward run
1876 : 0 : nNewHdl = CONTAINER_ENTRY_NOTFOUND;
1877 : : }
1878 : : else
1879 : : {
1880 : : // simply the next handle
1881 : 0 : nNewHdl++;
1882 : : }
1883 : : }
1884 : : else
1885 : : {
1886 : : // start forward run at first entry
1887 : 0 : nNewHdl = 0;
1888 : : }
1889 : : }
1890 : : else
1891 : : {
1892 [ # # ]: 0 : if(nOldHdl == CONTAINER_ENTRY_NOTFOUND)
1893 : : {
1894 : : // start backward run at last entry
1895 : 0 : nNewHdl = aList.size() - 1;
1896 : :
1897 : : }
1898 : : else
1899 : : {
1900 [ # # ]: 0 : if(nOldHdl == 0)
1901 : : {
1902 : : // end backward run
1903 : 0 : nNewHdl = CONTAINER_ENTRY_NOTFOUND;
1904 : : }
1905 : : else
1906 : : {
1907 : : // simply the previous handle
1908 : 0 : nNewHdl--;
1909 : : }
1910 : : }
1911 : : }
1912 : :
1913 : : // build new HdlNum
1914 : 0 : sal_uInt32 nNewHdlNum(nNewHdl);
1915 : :
1916 : : // look for old num in sorted array
1917 [ # # ]: 0 : if(nNewHdl != CONTAINER_ENTRY_NOTFOUND)
1918 : : {
1919 : 0 : SdrHdl* pNew = pHdlAndIndex[nNewHdl].mpHdl;
1920 : :
1921 [ # # ]: 0 : for(a = 0; a < aList.size(); a++)
1922 : : {
1923 [ # # ]: 0 : if(aList[a] == pNew)
1924 : : {
1925 : 0 : nNewHdlNum = a;
1926 : 0 : break;
1927 : : }
1928 : : }
1929 : : }
1930 : :
1931 : : // take care of next handle
1932 [ # # ]: 0 : if(nOldHdlNum != nNewHdlNum)
1933 : : {
1934 : 0 : mnFocusIndex = nNewHdlNum;
1935 : 0 : SdrHdl* pNew = GetHdl(mnFocusIndex);
1936 : :
1937 [ # # ]: 0 : if(pNew)
1938 : : {
1939 : 0 : pNew->Touch();
1940 : : }
1941 : : }
1942 : :
1943 : : // free memory again
1944 [ # # ]: 0 : delete [] pHdlAndIndex;
1945 : : }
1946 : 0 : }
1947 : :
1948 : 60446 : SdrHdl* SdrHdlList::GetFocusHdl() const
1949 : : {
1950 [ - + ][ # # ]: 60446 : if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex < GetHdlCount())
[ - + ]
1951 : 0 : return GetHdl(mnFocusIndex);
1952 : : else
1953 : 60446 : return 0L;
1954 : : }
1955 : :
1956 : 0 : void SdrHdlList::SetFocusHdl(SdrHdl* pNew)
1957 : : {
1958 [ # # ]: 0 : if(pNew)
1959 : : {
1960 : 0 : SdrHdl* pActual = GetFocusHdl();
1961 : :
1962 [ # # ][ # # ]: 0 : if(!pActual || pActual != pNew)
1963 : : {
1964 : 0 : sal_uIntPtr nNewHdlNum = GetHdlNum(pNew);
1965 : :
1966 [ # # ]: 0 : if(nNewHdlNum != CONTAINER_ENTRY_NOTFOUND)
1967 : : {
1968 : 0 : mnFocusIndex = nNewHdlNum;
1969 : :
1970 [ # # ]: 0 : if(pActual)
1971 : : {
1972 : 0 : pActual->Touch();
1973 : : }
1974 : :
1975 [ # # ]: 0 : if(pNew)
1976 : : {
1977 : 0 : pNew->Touch();
1978 : : }
1979 : :
1980 : : }
1981 : : }
1982 : : }
1983 : 0 : }
1984 : :
1985 : 132 : void SdrHdlList::ResetFocusHdl()
1986 : : {
1987 : 132 : SdrHdl* pHdl = GetFocusHdl();
1988 : :
1989 : 132 : mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1990 : :
1991 [ - + ]: 132 : if(pHdl)
1992 : : {
1993 : 0 : pHdl->Touch();
1994 : : }
1995 : 132 : }
1996 : :
1997 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1998 : :
1999 : 4699 : SdrHdlList::SdrHdlList(SdrMarkView* pV)
2000 : : : mnFocusIndex(CONTAINER_ENTRY_NOTFOUND),
2001 : : pView(pV),
2002 : 4699 : aList()
2003 : : {
2004 : 4699 : nHdlSize = 3;
2005 : 4699 : bRotateShear = sal_False;
2006 : 4699 : bMoveOutside = sal_False;
2007 : 4699 : bDistortShear = sal_False;
2008 : 4699 : }
2009 : :
2010 : 4508 : SdrHdlList::~SdrHdlList()
2011 : : {
2012 [ + - ]: 4508 : Clear();
2013 : 4508 : }
2014 : :
2015 : 1696 : void SdrHdlList::SetHdlSize(sal_uInt16 nSiz)
2016 : : {
2017 [ + - ]: 1696 : if(nHdlSize != nSiz)
2018 : : {
2019 : : // remember new value
2020 : 1696 : nHdlSize = nSiz;
2021 : :
2022 : : // propagate change to IAOs
2023 [ - + ]: 1696 : for(sal_uInt32 i=0; i<GetHdlCount(); i++)
2024 : : {
2025 : 0 : SdrHdl* pHdl = GetHdl(i);
2026 : 0 : pHdl->Touch();
2027 : : }
2028 : : }
2029 : 1696 : }
2030 : :
2031 : 0 : void SdrHdlList::SetMoveOutside(sal_Bool bOn)
2032 : : {
2033 [ # # ]: 0 : if(bMoveOutside != bOn)
2034 : : {
2035 : : // remember new value
2036 : 0 : bMoveOutside = bOn;
2037 : :
2038 : : // propagate change to IAOs
2039 [ # # ]: 0 : for(sal_uInt32 i=0; i<GetHdlCount(); i++)
2040 : : {
2041 : 0 : SdrHdl* pHdl = GetHdl(i);
2042 : 0 : pHdl->Touch();
2043 : : }
2044 : : }
2045 : 0 : }
2046 : :
2047 : 20058 : void SdrHdlList::SetRotateShear(sal_Bool bOn)
2048 : : {
2049 : 20058 : bRotateShear = bOn;
2050 : 20058 : }
2051 : :
2052 : 20058 : void SdrHdlList::SetDistortShear(sal_Bool bOn)
2053 : : {
2054 : 20058 : bDistortShear = bOn;
2055 : 20058 : }
2056 : :
2057 : 0 : SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum)
2058 : : {
2059 : 0 : SdrHdl* pRetval = aList[nNum];
2060 [ # # ][ # # ]: 0 : aList.erase(aList.begin() + nNum);
2061 : :
2062 : 0 : return pRetval;
2063 : : }
2064 : :
2065 : 0 : void SdrHdlList::RemoveAllByKind(SdrHdlKind eKind)
2066 : : {
2067 [ # # ][ # # ]: 0 : for(std::deque<SdrHdl*>::iterator it = aList.begin(); it != aList.end(); )
2068 : : {
2069 [ # # ]: 0 : SdrHdl* p = *it;
2070 [ # # ]: 0 : if (p->GetKind() == eKind)
2071 : : {
2072 [ # # ][ # # ]: 0 : it = aList.erase( it );
2073 [ # # ][ # # ]: 0 : delete p;
2074 : : }
2075 : : else
2076 [ # # ]: 0 : ++it;
2077 : : }
2078 : 0 : }
2079 : :
2080 : 25349 : void SdrHdlList::Clear()
2081 : : {
2082 [ + + ]: 32952 : for (sal_uIntPtr i=0; i<GetHdlCount(); i++)
2083 : : {
2084 : 7603 : SdrHdl* pHdl=GetHdl(i);
2085 [ + - ]: 7603 : delete pHdl;
2086 : : }
2087 : 25349 : aList.clear();
2088 : :
2089 : 25349 : bRotateShear=sal_False;
2090 : 25349 : bDistortShear=sal_False;
2091 : 25349 : }
2092 : :
2093 : 17124 : void SdrHdlList::Sort()
2094 : : {
2095 : : // remember currently focused handle
2096 : 17124 : SdrHdl* pPrev = GetFocusHdl();
2097 : :
2098 [ + - ]: 17124 : std::sort( aList.begin(), aList.end(), ImpSdrHdlListSorter );
2099 : :
2100 : : // get now and compare
2101 : 17124 : SdrHdl* pNow = GetFocusHdl();
2102 : :
2103 [ - + ]: 17124 : if(pPrev != pNow)
2104 : : {
2105 : :
2106 [ # # ]: 0 : if(pPrev)
2107 : : {
2108 : 0 : pPrev->Touch();
2109 : : }
2110 : :
2111 [ # # ]: 0 : if(pNow)
2112 : : {
2113 : 0 : pNow->Touch();
2114 : : }
2115 : : }
2116 : 17124 : }
2117 : :
2118 : 0 : sal_uIntPtr SdrHdlList::GetHdlNum(const SdrHdl* pHdl) const
2119 : : {
2120 [ # # ]: 0 : if (pHdl==NULL)
2121 : 0 : return CONTAINER_ENTRY_NOTFOUND;
2122 [ # # ]: 0 : std::deque<SdrHdl*>::const_iterator it = std::find( aList.begin(), aList.end(), pHdl);
2123 [ # # ][ # # ]: 0 : if( it == aList.end() )
2124 : 0 : return CONTAINER_ENTRY_NOTFOUND;
2125 [ # # ]: 0 : return it - aList.begin();
2126 : : }
2127 : :
2128 : 7603 : void SdrHdlList::AddHdl(SdrHdl* pHdl, sal_Bool bAtBegin)
2129 : : {
2130 [ + - ]: 7603 : if (pHdl!=NULL)
2131 : : {
2132 [ - + ]: 7603 : if (bAtBegin)
2133 : : {
2134 : 0 : aList.push_front(pHdl);
2135 : : }
2136 : : else
2137 : : {
2138 : 7603 : aList.push_back(pHdl);
2139 : : }
2140 : 7603 : pHdl->SetHdlList(this);
2141 : : }
2142 : 7603 : }
2143 : :
2144 : 1179 : SdrHdl* SdrHdlList::IsHdlListHit(const Point& rPnt, sal_Bool bBack, sal_Bool bNext, SdrHdl* pHdl0) const
2145 : : {
2146 : 1179 : SdrHdl* pRet=NULL;
2147 : 1179 : sal_uIntPtr nAnz=GetHdlCount();
2148 [ + - ]: 1179 : sal_uIntPtr nNum=bBack ? 0 : nAnz;
2149 [ - + ][ # # ]: 1179 : while ((bBack ? nNum<nAnz : nNum>0) && pRet==NULL)
[ - + ][ # # ]
[ - + ]
2150 : : {
2151 [ # # ]: 0 : if (!bBack)
2152 : 0 : nNum--;
2153 : 0 : SdrHdl* pHdl=GetHdl(nNum);
2154 [ # # ]: 0 : if (bNext)
2155 : : {
2156 [ # # ]: 0 : if (pHdl==pHdl0)
2157 : 0 : bNext=sal_False;
2158 : : }
2159 : : else
2160 : : {
2161 [ # # ]: 0 : if (pHdl->IsHdlHit(rPnt))
2162 : 0 : pRet=pHdl;
2163 : : }
2164 [ # # ]: 0 : if (bBack)
2165 : 0 : nNum++;
2166 : : }
2167 : 1179 : return pRet;
2168 : : }
2169 : :
2170 : 0 : SdrHdl* SdrHdlList::GetHdl(SdrHdlKind eKind1) const
2171 : : {
2172 : 0 : SdrHdl* pRet=NULL;
2173 [ # # ][ # # ]: 0 : for (sal_uIntPtr i=0; i<GetHdlCount() && pRet==NULL; i++)
[ # # ]
2174 : : {
2175 : 0 : SdrHdl* pHdl=GetHdl(i);
2176 [ # # ]: 0 : if (pHdl->GetKind()==eKind1)
2177 : 0 : pRet=pHdl;
2178 : : }
2179 : 0 : return pRet;
2180 : : }
2181 : :
2182 : : // --------------------------------------------------------------------
2183 : : // SdrCropHdl
2184 : : // --------------------------------------------------------------------
2185 : :
2186 : 0 : SdrCropHdl::SdrCropHdl(const Point& rPnt, SdrHdlKind eNewKind)
2187 : 0 : : SdrHdl( rPnt, eNewKind )
2188 : : {
2189 : 0 : }
2190 : :
2191 : : // --------------------------------------------------------------------
2192 : :
2193 : 0 : BitmapEx SdrCropHdl::GetHandlesBitmap()
2194 : : {
2195 : : static BitmapEx* pModernBitmap = 0;
2196 [ # # ]: 0 : if( pModernBitmap == 0 )
2197 [ # # ][ # # ]: 0 : pModernBitmap = new BitmapEx(ResId(SIP_SA_CROP_MARKERS, *ImpGetResMgr()));
2198 : 0 : return *pModernBitmap;
2199 : : }
2200 : :
2201 : : // --------------------------------------------------------------------
2202 : :
2203 : 0 : BitmapEx SdrCropHdl::GetBitmapForHandle( const BitmapEx& rBitmap, int nSize )
2204 : : {
2205 : 0 : int nPixelSize = 0, nX = 0, nY = 0, nOffset = 0;
2206 : :
2207 [ # # ]: 0 : if( nSize <= 3 )
2208 : : {
2209 : 0 : nPixelSize = 13;
2210 : 0 : nOffset = 0;
2211 : : }
2212 [ # # ]: 0 : else if( nSize <=4 )
2213 : : {
2214 : 0 : nPixelSize = 17;
2215 : 0 : nOffset = 39;
2216 : : }
2217 : : else
2218 : : {
2219 : 0 : nPixelSize = 21;
2220 : 0 : nOffset = 90;
2221 : : }
2222 : :
2223 [ # # # # : 0 : switch( eKind )
# # # #
# ]
2224 : : {
2225 : 0 : case HDL_UPLFT: nX = 0; nY = 0; break;
2226 : 0 : case HDL_UPPER: nX = 1; nY = 0; break;
2227 : 0 : case HDL_UPRGT: nX = 2; nY = 0; break;
2228 : 0 : case HDL_LEFT: nX = 0; nY = 1; break;
2229 : 0 : case HDL_RIGHT: nX = 2; nY = 1; break;
2230 : 0 : case HDL_LWLFT: nX = 0; nY = 2; break;
2231 : 0 : case HDL_LOWER: nX = 1; nY = 2; break;
2232 : 0 : case HDL_LWRGT: nX = 2; nY = 2; break;
2233 : 0 : default: break;
2234 : : }
2235 : :
2236 [ # # ]: 0 : Rectangle aSourceRect( Point( nX * (nPixelSize) + nOffset, nY * (nPixelSize)), Size(nPixelSize, nPixelSize) );
2237 : :
2238 [ # # ]: 0 : BitmapEx aRetval(rBitmap);
2239 [ # # ]: 0 : aRetval.Crop(aSourceRect);
2240 : 0 : return aRetval;
2241 : : }
2242 : :
2243 : : // --------------------------------------------------------------------
2244 : :
2245 : 0 : void SdrCropHdl::CreateB2dIAObject()
2246 : : {
2247 : : // first throw away old one
2248 : 0 : GetRidOfIAObject();
2249 : :
2250 [ # # ]: 0 : SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
2251 [ # # ]: 0 : SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
2252 : :
2253 [ # # ][ # # ]: 0 : if( pPageView && !pView->areMarkHandlesHidden() )
[ # # ]
2254 : : {
2255 [ # # ]: 0 : const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2256 : 0 : int nHdlSize = pHdlList->GetHdlSize();
2257 : :
2258 [ # # ]: 0 : const BitmapEx aHandlesBitmap( GetHandlesBitmap() );
2259 [ # # ]: 0 : BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
2260 : :
2261 [ # # ]: 0 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
2262 : : {
2263 [ # # ]: 0 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
2264 : :
2265 [ # # ]: 0 : if(rPageWindow.GetPaintWindow().OutputToWindow())
2266 : : {
2267 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager();
2268 [ # # ]: 0 : if (xManager.is())
2269 : : {
2270 : 0 : basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
2271 : :
2272 : 0 : ::sdr::overlay::OverlayObject* pOverlayObject = 0L;
2273 : :
2274 : : // animate focused handles
2275 [ # # ][ # # ]: 0 : if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
[ # # ][ # # ]
[ # # ]
2276 : : {
2277 [ # # ]: 0 : if( nHdlSize >= 2 )
2278 : 0 : nHdlSize = 1;
2279 : :
2280 [ # # ]: 0 : BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
2281 : :
2282 : 0 : const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
2283 : :
2284 : : pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBmpEx1, aBmpEx2, nBlinkTime,
2285 : 0 : (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2286 : 0 : (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2287 : 0 : (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
2288 [ # # ][ # # ]: 0 : (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
[ # # ]
2289 : : }
2290 : : else
2291 : : {
2292 : : // create centered handle as default
2293 : : pOverlayObject = new ::sdr::overlay::OverlayBitmapEx(aPosition, aBmpEx1,
2294 : 0 : (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2295 [ # # ][ # # ]: 0 : (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1);
2296 : : }
2297 : :
2298 : : // OVERLAYMANAGER
2299 [ # # ]: 0 : if(pOverlayObject)
2300 : : {
2301 [ # # ]: 0 : xManager->add(*pOverlayObject);
2302 [ # # ]: 0 : maOverlayGroup.append(*pOverlayObject);
2303 : 0 : }
2304 [ # # ]: 0 : }
2305 : : }
2306 [ # # ][ # # ]: 0 : }
2307 : : }
2308 : 0 : }
2309 : :
2310 : : // --------------------------------------------------------------------
2311 : :
2312 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|