Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <svx/svdmrkv.hxx>
22 : #include <svx/svdetc.hxx>
23 : #include <svx/svdoedge.hxx>
24 : #include "svx/svdglob.hxx"
25 : #include <svx/svdview.hxx>
26 : #include <svx/svdpagv.hxx>
27 : #include <svx/svdpage.hxx>
28 : #include "svddrgm1.hxx"
29 :
30 : #ifdef DBG_UTIL
31 : #include <svdibrow.hxx>
32 : #endif
33 :
34 : #include <svx/svdoole2.hxx>
35 : #include <svx/xgrad.hxx>
36 : #include <svx/xflgrit.hxx>
37 : #include "gradtrns.hxx"
38 : #include <svx/xflftrit.hxx>
39 : #include <svx/dialmgr.hxx>
40 : #include "svx/svdstr.hrc"
41 : #include <svx/svdundo.hxx>
42 : #include <svx/svdopath.hxx>
43 : #include <svx/scene3d.hxx>
44 : #include <svx/svdovirt.hxx>
45 : #include <svx/sdr/overlay/overlayrollingrectangle.hxx>
46 : #include <svx/sdr/overlay/overlaymanager.hxx>
47 : #include <svx/sdrpaintwindow.hxx>
48 : #include <svx/sdrpagewindow.hxx>
49 : #include <svx/sdrhittesthelper.hxx>
50 : #include <svx/svdocapt.hxx>
51 : #include <svx/svdograf.hxx>
52 :
53 : #include <editeng/editdata.hxx>
54 :
55 :
56 : // Migrate Marking of Objects, Points and GluePoints
57 :
58 : class ImplMarkingOverlay
59 : {
60 : // The OverlayObjects
61 : ::sdr::overlay::OverlayObjectList maObjects;
62 :
63 : // The remembered second position in logical coordinates
64 : basegfx::B2DPoint maSecondPosition;
65 :
66 : // bitfield
67 : // A flag to remember if the action is for unmarking.
68 : bool mbUnmarking : 1;
69 :
70 : public:
71 : ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, bool bUnmarking = false);
72 : ~ImplMarkingOverlay();
73 :
74 : void SetSecondPosition(const basegfx::B2DPoint& rNewPosition);
75 0 : bool IsUnmarking() const { return mbUnmarking; }
76 : };
77 :
78 0 : ImplMarkingOverlay::ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, bool bUnmarking)
79 : : maSecondPosition(rStartPos),
80 0 : mbUnmarking(bUnmarking)
81 : {
82 0 : for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
83 : {
84 0 : SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
85 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager();
86 :
87 0 : if (xTargetOverlay.is())
88 : {
89 : ::sdr::overlay::OverlayRollingRectangleStriped* pNew = new ::sdr::overlay::OverlayRollingRectangleStriped(
90 0 : rStartPos, rStartPos, false);
91 0 : xTargetOverlay->add(*pNew);
92 0 : maObjects.append(*pNew);
93 : }
94 0 : }
95 0 : }
96 :
97 0 : ImplMarkingOverlay::~ImplMarkingOverlay()
98 : {
99 : // The OverlayObjects are cleared using the destructor of OverlayObjectList.
100 : // That destructor calls clear() at the list which removes all objects from the
101 : // OverlayManager and deletes them.
102 0 : }
103 :
104 0 : void ImplMarkingOverlay::SetSecondPosition(const basegfx::B2DPoint& rNewPosition)
105 : {
106 0 : if(rNewPosition != maSecondPosition)
107 : {
108 : // apply to OverlayObjects
109 0 : for(sal_uInt32 a(0L); a < maObjects.count(); a++)
110 : {
111 0 : ::sdr::overlay::OverlayRollingRectangleStriped& rCandidate = (::sdr::overlay::OverlayRollingRectangleStriped&)maObjects.getOverlayObject(a);
112 0 : rCandidate.setSecondPosition(rNewPosition);
113 : }
114 :
115 : // remember new position
116 0 : maSecondPosition = rNewPosition;
117 : }
118 0 : }
119 :
120 :
121 :
122 : // MarkView
123 :
124 :
125 :
126 5800 : void SdrMarkView::ImpClearVars()
127 : {
128 5800 : eDragMode=SDRDRAG_MOVE;
129 5800 : bRefHdlShownOnly=false;
130 5800 : eEditMode=SDREDITMODE_EDIT;
131 5800 : eEditMode0=SDREDITMODE_EDIT;
132 5800 : bDesignMode=false;
133 5800 : pMarkedObj=NULL;
134 5800 : pMarkedPV=NULL;
135 5800 : bForceFrameHandles=false;
136 5800 : bPlusHdlAlways=false;
137 5800 : nFrameHandlesLimit=50;
138 5800 : bInsPolyPoint=false;
139 5800 : mnInsPointNum = 0L;
140 5800 : bMarkedObjRectDirty=false;
141 5800 : bMarkedPointsRectsDirty=false;
142 5800 : mbMarkHandlesHidden = false;
143 5800 : bMrkPntDirty=false;
144 5800 : bMarkHdlWhenTextEdit=false;
145 5800 : bMarkableObjCountDirty=false; // not yet implemented
146 5800 : nMarkableObjCount=0; // not yet implemented
147 :
148 : // Migrate selections
149 5800 : BrkMarkObj();
150 5800 : BrkMarkPoints();
151 5800 : BrkMarkGluePoints();
152 5800 : }
153 :
154 5800 : SdrMarkView::SdrMarkView(SdrModel* pModel1, OutputDevice* pOut)
155 : : SdrSnapView(pModel1,pOut),
156 : mpMarkObjOverlay(0L),
157 : mpMarkPointsOverlay(0L),
158 : mpMarkGluePointsOverlay(0L),
159 : aHdl(this),
160 5800 : mpSdrViewSelection(new sdr::ViewSelection())
161 : {
162 5800 : ImpClearVars();
163 5800 : StartListening(*pModel1);
164 5800 : }
165 :
166 11170 : SdrMarkView::~SdrMarkView()
167 : {
168 : // Migrate selections
169 5585 : BrkMarkObj();
170 5585 : BrkMarkPoints();
171 5585 : BrkMarkGluePoints();
172 5585 : delete mpSdrViewSelection;
173 5585 : }
174 :
175 155962 : void SdrMarkView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
176 : {
177 155962 : SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
178 155962 : if (pSdrHint!=NULL)
179 : {
180 152470 : SdrHintKind eKind=pSdrHint->GetKind();
181 :
182 152470 : if (eKind==HINT_OBJCHG || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED)
183 : {
184 134246 : bMarkedObjRectDirty=true;
185 134246 : bMarkedPointsRectsDirty=true;
186 : }
187 : }
188 155962 : SdrSnapView::Notify(rBC,rHint);
189 155962 : }
190 :
191 3462 : void SdrMarkView::ModelHasChanged()
192 : {
193 3462 : SdrPaintView::ModelHasChanged();
194 3462 : GetMarkedObjectListWriteAccess().SetNameDirty();
195 3462 : bMarkedObjRectDirty=true;
196 3462 : bMarkedPointsRectsDirty=true;
197 : // Example: Obj is selected and maMarkedObjectList is sorted.
198 : // In another View 2, the ObjOrder is changed (e. g. MovToTop())
199 : // Then we need to re-sort MarkList.
200 3462 : GetMarkedObjectListWriteAccess().SetUnsorted();
201 3462 : SortMarkedObjects();
202 3462 : bMrkPntDirty=true;
203 3462 : UndirtyMrkPnt();
204 3462 : SdrView* pV=(SdrView*)this;
205 3462 : if (pV!=NULL && !pV->IsDragObj() && !pV->IsInsObjPoint()) {
206 3462 : AdjustMarkHdl();
207 : }
208 3462 : }
209 :
210 :
211 :
212 1337 : bool SdrMarkView::IsAction() const
213 : {
214 1337 : return SdrSnapView::IsAction() || IsMarkObj() || IsMarkPoints() || IsMarkGluePoints();
215 : }
216 :
217 0 : void SdrMarkView::MovAction(const Point& rPnt)
218 : {
219 0 : SdrSnapView::MovAction(rPnt);
220 :
221 0 : if(IsMarkObj())
222 : {
223 0 : MovMarkObj(rPnt);
224 : }
225 0 : else if(IsMarkPoints())
226 : {
227 0 : MovMarkPoints(rPnt);
228 : }
229 0 : else if(IsMarkGluePoints())
230 : {
231 0 : MovMarkGluePoints(rPnt);
232 : }
233 0 : }
234 :
235 0 : void SdrMarkView::EndAction()
236 : {
237 0 : if(IsMarkObj())
238 : {
239 0 : EndMarkObj();
240 : }
241 0 : else if(IsMarkPoints())
242 : {
243 0 : EndMarkPoints();
244 : }
245 0 : else if(IsMarkGluePoints())
246 : {
247 0 : EndMarkGluePoints();
248 : }
249 :
250 0 : SdrSnapView::EndAction();
251 0 : }
252 :
253 0 : void SdrMarkView::BckAction()
254 : {
255 0 : SdrSnapView::BckAction();
256 0 : BrkMarkObj();
257 0 : BrkMarkPoints();
258 0 : BrkMarkGluePoints();
259 0 : }
260 :
261 3348 : void SdrMarkView::BrkAction()
262 : {
263 3348 : SdrSnapView::BrkAction();
264 3348 : BrkMarkObj();
265 3348 : BrkMarkPoints();
266 3348 : BrkMarkGluePoints();
267 3348 : }
268 :
269 0 : void SdrMarkView::TakeActionRect(Rectangle& rRect) const
270 : {
271 0 : if(IsMarkObj() || IsMarkPoints() || IsMarkGluePoints())
272 : {
273 0 : rRect = Rectangle(aDragStat.GetStart(), aDragStat.GetNow());
274 : }
275 : else
276 : {
277 0 : SdrSnapView::TakeActionRect(rRect);
278 : }
279 0 : }
280 :
281 :
282 :
283 0 : void SdrMarkView::ClearPageView()
284 : {
285 0 : UnmarkAllObj();
286 0 : SdrSnapView::ClearPageView();
287 0 : }
288 :
289 2965 : void SdrMarkView::HideSdrPage()
290 : {
291 2965 : bool bMrkChg(false);
292 :
293 2965 : SdrPageView* pPageView = GetSdrPageView();
294 2965 : if (pPageView)
295 : {
296 : // break all creation actions when hiding page (#75081#)
297 2812 : BrkAction();
298 :
299 : // Discard all selections on this page
300 2812 : bMrkChg = GetMarkedObjectListWriteAccess().DeletePageView(*pPageView);
301 : }
302 :
303 2965 : SdrSnapView::HideSdrPage();
304 :
305 2965 : if(bMrkChg)
306 : {
307 23 : MarkListHasChanged();
308 23 : AdjustMarkHdl();
309 : }
310 2965 : }
311 :
312 :
313 :
314 0 : bool SdrMarkView::BegMarkObj(const Point& rPnt, bool bUnmark)
315 : {
316 0 : BrkAction();
317 :
318 : DBG_ASSERT(0L == mpMarkObjOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkObjOverlay (!)");
319 0 : basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
320 0 : mpMarkObjOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
321 :
322 0 : aDragStat.Reset(rPnt);
323 0 : aDragStat.NextPoint();
324 0 : aDragStat.SetMinMove(nMinMovLog);
325 :
326 0 : return true;
327 : }
328 :
329 0 : void SdrMarkView::MovMarkObj(const Point& rPnt)
330 : {
331 0 : if(IsMarkObj() && aDragStat.CheckMinMoved(rPnt))
332 : {
333 0 : aDragStat.NextMove(rPnt);
334 : DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
335 0 : basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
336 0 : mpMarkObjOverlay->SetSecondPosition(aNewPos);
337 : }
338 0 : }
339 :
340 0 : bool SdrMarkView::EndMarkObj()
341 : {
342 0 : bool bRetval(false);
343 :
344 0 : if(IsMarkObj())
345 : {
346 0 : if(aDragStat.IsMinMoved())
347 : {
348 0 : Rectangle aRect(aDragStat.GetStart(), aDragStat.GetNow());
349 0 : aRect.Justify();
350 0 : MarkObj(aRect, mpMarkObjOverlay->IsUnmarking());
351 0 : bRetval = true;
352 : }
353 :
354 : // cleanup
355 0 : BrkMarkObj();
356 : }
357 :
358 0 : return bRetval;
359 : }
360 :
361 14733 : void SdrMarkView::BrkMarkObj()
362 : {
363 14733 : if(IsMarkObj())
364 : {
365 : DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
366 0 : delete mpMarkObjOverlay;
367 0 : mpMarkObjOverlay = 0L;
368 : }
369 14733 : }
370 :
371 :
372 :
373 0 : bool SdrMarkView::BegMarkPoints(const Point& rPnt, bool bUnmark)
374 : {
375 0 : if(HasMarkablePoints())
376 : {
377 0 : BrkAction();
378 :
379 : DBG_ASSERT(0L == mpMarkPointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkPointsOverlay (!)");
380 0 : basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
381 0 : mpMarkPointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
382 :
383 0 : aDragStat.Reset(rPnt);
384 0 : aDragStat.NextPoint();
385 0 : aDragStat.SetMinMove(nMinMovLog);
386 :
387 0 : return true;
388 : }
389 :
390 0 : return false;
391 : }
392 :
393 0 : void SdrMarkView::MovMarkPoints(const Point& rPnt)
394 : {
395 0 : if(IsMarkPoints() && aDragStat.CheckMinMoved(rPnt))
396 : {
397 0 : aDragStat.NextMove(rPnt);
398 :
399 : DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
400 0 : basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
401 0 : mpMarkPointsOverlay->SetSecondPosition(aNewPos);
402 : }
403 0 : }
404 :
405 0 : bool SdrMarkView::EndMarkPoints()
406 : {
407 0 : bool bRetval(false);
408 :
409 0 : if(IsMarkPoints())
410 : {
411 0 : if(aDragStat.IsMinMoved())
412 : {
413 0 : Rectangle aRect(aDragStat.GetStart(), aDragStat.GetNow());
414 0 : aRect.Justify();
415 0 : MarkPoints(aRect, mpMarkPointsOverlay->IsUnmarking());
416 :
417 0 : bRetval = true;
418 : }
419 :
420 : // cleanup
421 0 : BrkMarkPoints();
422 : }
423 :
424 0 : return bRetval;
425 : }
426 :
427 14733 : void SdrMarkView::BrkMarkPoints()
428 : {
429 14733 : if(IsMarkPoints())
430 : {
431 : DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
432 0 : delete mpMarkPointsOverlay;
433 0 : mpMarkPointsOverlay = 0L;
434 : }
435 14733 : }
436 :
437 :
438 :
439 0 : bool SdrMarkView::BegMarkGluePoints(const Point& rPnt, bool bUnmark)
440 : {
441 0 : if(HasMarkableGluePoints())
442 : {
443 0 : BrkAction();
444 :
445 : DBG_ASSERT(0L == mpMarkGluePointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkGluePointsOverlay (!)");
446 :
447 0 : basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
448 0 : mpMarkGluePointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
449 0 : aDragStat.Reset(rPnt);
450 0 : aDragStat.NextPoint();
451 0 : aDragStat.SetMinMove(nMinMovLog);
452 :
453 0 : return true;
454 : }
455 :
456 0 : return false;
457 : }
458 :
459 0 : void SdrMarkView::MovMarkGluePoints(const Point& rPnt)
460 : {
461 0 : if(IsMarkGluePoints() && aDragStat.CheckMinMoved(rPnt))
462 : {
463 0 : aDragStat.NextMove(rPnt);
464 :
465 : DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
466 0 : basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
467 0 : mpMarkGluePointsOverlay->SetSecondPosition(aNewPos);
468 : }
469 0 : }
470 :
471 0 : bool SdrMarkView::EndMarkGluePoints()
472 : {
473 0 : bool bRetval(false);
474 :
475 0 : if(IsMarkGluePoints())
476 : {
477 0 : if(aDragStat.IsMinMoved())
478 : {
479 0 : Rectangle aRect(aDragStat.GetStart(),aDragStat.GetNow());
480 0 : aRect.Justify();
481 0 : MarkGluePoints(&aRect, mpMarkGluePointsOverlay->IsUnmarking());
482 :
483 0 : bRetval = true;
484 : }
485 :
486 : // cleanup
487 0 : BrkMarkGluePoints();
488 : }
489 :
490 0 : return bRetval;
491 : }
492 :
493 14733 : void SdrMarkView::BrkMarkGluePoints()
494 : {
495 14733 : if(IsMarkGluePoints())
496 : {
497 : DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
498 0 : delete mpMarkGluePointsOverlay;
499 0 : mpMarkGluePointsOverlay = 0L;
500 : }
501 14733 : }
502 :
503 0 : sal_uIntPtr SdrMarkView::GetMarkableObjCount() const
504 : {
505 0 : sal_uIntPtr nCount=0;
506 0 : SdrPageView* pPV = GetSdrPageView();
507 :
508 0 : if(pPV)
509 : {
510 0 : SdrObjList* pOL=pPV->GetObjList();
511 0 : sal_uIntPtr nObjAnz=pOL->GetObjCount();
512 0 : for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
513 0 : SdrObject* pObj=pOL->GetObj(nObjNum);
514 0 : if (IsObjMarkable(pObj,pPV)) {
515 0 : nCount++;
516 : }
517 : }
518 : }
519 0 : return nCount;
520 : }
521 :
522 0 : bool SdrMarkView::HasMarkableObj() const
523 : {
524 0 : sal_uIntPtr nCount=0;
525 :
526 0 : SdrPageView* pPV = GetSdrPageView();
527 0 : if(pPV)
528 : {
529 0 : SdrObjList* pOL=pPV->GetObjList();
530 0 : sal_uIntPtr nObjAnz=pOL->GetObjCount();
531 0 : for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz && nCount==0; nObjNum++) {
532 0 : SdrObject* pObj=pOL->GetObj(nObjNum);
533 0 : if (IsObjMarkable(pObj,pPV)) {
534 0 : nCount++;
535 : }
536 : }
537 : }
538 0 : return nCount!=0;
539 : }
540 :
541 6270 : void SdrMarkView::hideMarkHandles()
542 : {
543 6270 : if(!mbMarkHandlesHidden)
544 : {
545 6270 : mbMarkHandlesHidden = true;
546 6270 : AdjustMarkHdl();
547 : }
548 6270 : }
549 :
550 7822 : void SdrMarkView::showMarkHandles()
551 : {
552 7822 : if(mbMarkHandlesHidden)
553 : {
554 6108 : mbMarkHandlesHidden = false;
555 6108 : AdjustMarkHdl();
556 : }
557 7822 : }
558 :
559 25593 : bool SdrMarkView::ImpIsFrameHandles() const
560 : {
561 25593 : sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
562 25593 : bool bFrmHdl=nMarkAnz>nFrameHandlesLimit || bForceFrameHandles;
563 25593 : bool bStdDrag=eDragMode==SDRDRAG_MOVE;
564 25593 : if (nMarkAnz==1 && bStdDrag && bFrmHdl)
565 : {
566 19 : const SdrObject* pObj=GetMarkedObjectByIndex(0);
567 19 : if (pObj->GetObjInventor()==SdrInventor)
568 : {
569 19 : sal_uInt16 nIdent=pObj->GetObjIdentifier();
570 19 : if (nIdent==OBJ_LINE || nIdent==OBJ_EDGE || nIdent==OBJ_CAPTION || nIdent==OBJ_MEASURE || nIdent==OBJ_CUSTOMSHAPE || nIdent==OBJ_TABLE )
571 : {
572 0 : bFrmHdl=false;
573 : }
574 : }
575 : }
576 25593 : if (!bStdDrag && !bFrmHdl) {
577 : // all other drag modes only with FrameHandles
578 0 : bFrmHdl=true;
579 0 : if (eDragMode==SDRDRAG_ROTATE) {
580 : // when rotating, use ObjOwn drag, if there's at least 1 PolyObj
581 0 : for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && bFrmHdl; nMarkNum++) {
582 0 : const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
583 0 : const SdrObject* pObj=pM->GetMarkedSdrObj();
584 0 : bFrmHdl=!pObj->IsPolyObj();
585 : }
586 : }
587 : }
588 25593 : if (!bFrmHdl) {
589 : // FrameHandles, if at least 1 Obj can't do SpecialDrag
590 5453 : for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bFrmHdl; nMarkNum++) {
591 279 : const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
592 279 : const SdrObject* pObj=pM->GetMarkedSdrObj();
593 279 : bFrmHdl=!pObj->hasSpecialDrag();
594 : }
595 : }
596 :
597 : // no FrameHdl for crop
598 25593 : if(bFrmHdl && SDRDRAG_CROP == eDragMode)
599 : {
600 0 : bFrmHdl = false;
601 : }
602 :
603 25593 : return bFrmHdl;
604 : }
605 :
606 25525 : void SdrMarkView::SetMarkHandles()
607 : {
608 : // remember old focus handle values to search for it again
609 25525 : const SdrHdl* pSaveOldFocusHdl = aHdl.GetFocusHdl();
610 25525 : bool bSaveOldFocus(false);
611 25525 : sal_uInt32 nSavePolyNum(0L), nSavePointNum(0L);
612 25525 : SdrHdlKind eSaveKind(HDL_MOVE);
613 25525 : SdrObject* pSaveObj = NULL;
614 :
615 25525 : if(pSaveOldFocusHdl
616 0 : && pSaveOldFocusHdl->GetObj()
617 0 : && pSaveOldFocusHdl->GetObj()->ISA(SdrPathObj)
618 25525 : && (pSaveOldFocusHdl->GetKind() == HDL_POLY || pSaveOldFocusHdl->GetKind() == HDL_BWGT))
619 : {
620 0 : bSaveOldFocus = true;
621 0 : nSavePolyNum = pSaveOldFocusHdl->GetPolyNum();
622 0 : nSavePointNum = pSaveOldFocusHdl->GetPointNum();
623 0 : pSaveObj = pSaveOldFocusHdl->GetObj();
624 0 : eSaveKind = pSaveOldFocusHdl->GetKind();
625 : }
626 :
627 : // delete/clear all handles. This will always be done, even with areMarkHandlesHidden()
628 25525 : aHdl.Clear();
629 25525 : aHdl.SetRotateShear(eDragMode==SDRDRAG_ROTATE);
630 25525 : aHdl.SetDistortShear(eDragMode==SDRDRAG_SHEAR);
631 25525 : pMarkedObj=NULL;
632 25525 : pMarkedPV=NULL;
633 :
634 : // are handles enabled at all? Create only then
635 25525 : if(!areMarkHandlesHidden())
636 : {
637 18925 : sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
638 18925 : bool bStdDrag=eDragMode==SDRDRAG_MOVE;
639 18925 : bool bSingleTextObjMark=false;
640 :
641 18925 : if (nMarkAnz==1)
642 : {
643 38 : pMarkedObj=GetMarkedObjectByIndex(0);
644 : bSingleTextObjMark =
645 38 : pMarkedObj &&
646 66 : pMarkedObj->ISA(SdrTextObj) &&
647 66 : static_cast<SdrTextObj*>(pMarkedObj)->IsTextFrame();
648 : }
649 :
650 18925 : bool bFrmHdl=ImpIsFrameHandles();
651 :
652 18925 : if (nMarkAnz>0)
653 : {
654 93 : pMarkedPV=GetSdrPageViewOfMarkedByIndex(0);
655 :
656 265 : for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && (pMarkedPV!=NULL || !bFrmHdl); nMarkNum++)
657 : {
658 172 : const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
659 :
660 172 : if (pMarkedPV!=pM->GetPageView())
661 : {
662 0 : pMarkedPV=NULL;
663 : }
664 : }
665 : }
666 :
667 : // apply calc offset to marked object rect
668 : // ( necessary for handles to be displayed in
669 : // correct position )
670 18925 : Point aGridOff = GetGridOffset();
671 :
672 : // check if text edit or ole is active and handles need to be suppressed. This may be the case
673 : // when a single object is selected
674 : // Using a strict return statement is okay here; no handles means *no* handles.
675 18925 : if(pMarkedObj)
676 : {
677 : // formally #i33755#: If TextEdit is active the EditEngine will directly paint
678 : // to the window, so suppress Overlay and handles completely; a text frame for
679 : // the active text edit will be painted by the repaitnt mechanism in
680 : // SdrObjEditView::ImpPaintOutlinerView in this case. This needs to be reworked
681 : // in the future
682 : // Also formally #122142#: Pretty much the same for SdrCaptionObj's in calc.
683 38 : if(((SdrView*)this)->IsTextEdit())
684 : {
685 0 : const SdrTextObj* pSdrTextObj = dynamic_cast< const SdrTextObj* >(pMarkedObj);
686 :
687 0 : if(pSdrTextObj && pSdrTextObj->IsInEditMode())
688 : {
689 0 : return;
690 : }
691 : }
692 :
693 : // formally #i118524#: if inplace activated OLE is selected, suppress handles
694 38 : const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pMarkedObj);
695 :
696 38 : if(pSdrOle2Obj && (pSdrOle2Obj->isInplaceActive() || pSdrOle2Obj->isUiActive()))
697 : {
698 0 : return;
699 : }
700 : }
701 :
702 18925 : if (bFrmHdl)
703 : {
704 16495 : Rectangle aRect(GetMarkedObjRect());
705 :
706 16495 : if(!aRect.IsEmpty())
707 : { // otherwise nothing is found
708 43 : if( bSingleTextObjMark )
709 : {
710 0 : const sal_uIntPtr nSiz0=aHdl.GetHdlCount();
711 0 : pMarkedObj->AddToHdlList(aHdl);
712 0 : const sal_uIntPtr nSiz1=aHdl.GetHdlCount();
713 0 : for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
714 : {
715 0 : SdrHdl* pHdl=aHdl.GetHdl(i);
716 0 : pHdl->SetObj(pMarkedObj);
717 0 : pHdl->SetPos( pHdl->GetPos() + aGridOff );
718 0 : pHdl->SetPageView(pMarkedPV);
719 0 : pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
720 : }
721 : }
722 : else
723 : {
724 43 : bool bWdt0=aRect.Left()==aRect.Right();
725 43 : bool bHgt0=aRect.Top()==aRect.Bottom();
726 43 : if (bWdt0 && bHgt0)
727 : {
728 0 : aHdl.AddHdl(new SdrHdl(aRect.TopLeft(),HDL_UPLFT));
729 : }
730 43 : else if (!bStdDrag && (bWdt0 || bHgt0))
731 : {
732 0 : aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT));
733 0 : aHdl.AddHdl(new SdrHdl(aRect.BottomRight(),HDL_LWRGT));
734 : }
735 : else
736 : {
737 43 : if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT));
738 43 : if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopCenter() ,HDL_UPPER));
739 43 : if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopRight() ,HDL_UPRGT));
740 43 : if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.LeftCenter() ,HDL_LEFT ));
741 43 : if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.RightCenter() ,HDL_RIGHT));
742 43 : if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomLeft() ,HDL_LWLFT));
743 43 : if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomCenter(),HDL_LOWER));
744 43 : if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomRight() ,HDL_LWRGT));
745 : }
746 : }
747 : }
748 : }
749 : else
750 : {
751 2430 : bool bDone(false);
752 :
753 : // moved crop handling to non-frame part and the handle creation to SdrGrafObj
754 2430 : if(1 == nMarkAnz && pMarkedObj && SDRDRAG_CROP == eDragMode)
755 : {
756 0 : const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pMarkedObj);
757 :
758 0 : if(pSdrGrafObj)
759 : {
760 0 : pSdrGrafObj->addCropHandles(aHdl);
761 0 : bDone = true;
762 : }
763 : }
764 :
765 2430 : if(!bDone)
766 : {
767 2526 : for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
768 : {
769 96 : const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
770 96 : SdrObject* pObj=pM->GetMarkedSdrObj();
771 96 : SdrPageView* pPV=pM->GetPageView();
772 96 : const sal_uIntPtr nSiz0=aHdl.GetHdlCount();
773 96 : pObj->AddToHdlList(aHdl);
774 96 : const sal_uIntPtr nSiz1=aHdl.GetHdlCount();
775 96 : bool bPoly=pObj->IsPolyObj();
776 96 : const SdrUShortCont* pMrkPnts=pM->GetMarkedPoints();
777 833 : for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
778 : {
779 737 : SdrHdl* pHdl=aHdl.GetHdl(i);
780 737 : pHdl->SetPos( pHdl->GetPos() + aGridOff );
781 737 : pHdl->SetObj(pObj);
782 737 : pHdl->SetPageView(pPV);
783 737 : pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
784 :
785 737 : if (bPoly)
786 : {
787 : bool bSelected=pMrkPnts!=NULL
788 533 : && pMrkPnts->find( sal_uInt16(i-nSiz0) ) != pMrkPnts->end();
789 533 : pHdl->SetSelected(bSelected);
790 533 : if (bPlusHdlAlways || bSelected)
791 : {
792 0 : sal_uInt32 nPlusAnz=pObj->GetPlusHdlCount(*pHdl);
793 0 : for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusAnz; nPlusNum++)
794 : {
795 0 : SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,nPlusNum);
796 0 : if (pPlusHdl!=NULL)
797 : {
798 0 : pPlusHdl->SetObj(pObj);
799 0 : pPlusHdl->SetPageView(pPV);
800 0 : pPlusHdl->SetPlusHdl(true);
801 0 : aHdl.AddHdl(pPlusHdl);
802 : }
803 : }
804 : }
805 : }
806 : }
807 : }
808 : }
809 : }
810 :
811 : // GluePoint handles
812 19097 : for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
813 : {
814 172 : const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
815 172 : SdrObject* pObj=pM->GetMarkedSdrObj();
816 172 : SdrPageView* pPV=pM->GetPageView();
817 172 : const SdrUShortCont* pMrkGlue=pM->GetMarkedGluePoints();
818 172 : if (pMrkGlue!=NULL)
819 : {
820 0 : const SdrGluePointList* pGPL=pObj->GetGluePointList();
821 0 : if (pGPL!=NULL)
822 : {
823 0 : for(SdrUShortCont::const_iterator it = pMrkGlue->begin(); it != pMrkGlue->end(); ++it)
824 : {
825 0 : sal_uInt16 nId=*it;
826 : //nNum changed to nNumGP because already used in for loop
827 0 : sal_uInt16 nNumGP=pGPL->FindGluePoint(nId);
828 0 : if (nNumGP!=SDRGLUEPOINT_NOTFOUND)
829 : {
830 0 : const SdrGluePoint& rGP=(*pGPL)[nNumGP];
831 0 : Point aPos(rGP.GetAbsolutePos(*pObj));
832 0 : SdrHdl* pGlueHdl=new SdrHdl(aPos,HDL_GLUE);
833 0 : pGlueHdl->SetObj(pObj);
834 0 : pGlueHdl->SetPageView(pPV);
835 0 : pGlueHdl->SetObjHdlNum(nId);
836 0 : aHdl.AddHdl(pGlueHdl);
837 : }
838 : }
839 : }
840 : }
841 : }
842 :
843 : // rotation point/axis of reflection
844 18925 : AddDragModeHdl(eDragMode);
845 :
846 : // sort handles
847 18925 : aHdl.Sort();
848 :
849 : // add custom handles (used by other apps, e.g. AnchorPos)
850 18925 : AddCustomHdl();
851 :
852 : // try to restore focus handle index from remembered values
853 18925 : if(bSaveOldFocus)
854 : {
855 0 : for(sal_uInt32 a(0); a < aHdl.GetHdlCount(); a++)
856 : {
857 0 : SdrHdl* pCandidate = aHdl.GetHdl(a);
858 :
859 0 : if(pCandidate->GetObj()
860 0 : && pCandidate->GetObj() == pSaveObj
861 0 : && pCandidate->GetKind() == eSaveKind
862 0 : && pCandidate->GetPolyNum() == nSavePolyNum
863 0 : && pCandidate->GetPointNum() == nSavePointNum)
864 : {
865 0 : aHdl.SetFocusHdl(pCandidate);
866 0 : break;
867 : }
868 : }
869 : }
870 : }
871 : }
872 :
873 2424 : void SdrMarkView::AddCustomHdl()
874 : {
875 : // add custom handles (used by other apps, e.g. AnchorPos)
876 2424 : }
877 :
878 701 : void SdrMarkView::SetDragMode(SdrDragMode eMode)
879 : {
880 701 : SdrDragMode eMode0=eDragMode;
881 701 : eDragMode=eMode;
882 701 : if (eDragMode==SDRDRAG_RESIZE) eDragMode=SDRDRAG_MOVE;
883 701 : if (eDragMode!=eMode0) {
884 0 : ForceRefToMarked();
885 0 : SetMarkHandles();
886 : {
887 0 : if (AreObjectsMarked()) MarkListHasChanged();
888 : }
889 : }
890 701 : }
891 :
892 18925 : void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
893 : {
894 18925 : switch(eMode)
895 : {
896 : case SDRDRAG_ROTATE:
897 : {
898 : // add rotation center
899 0 : SdrHdl* pHdl = new SdrHdl(aRef1, HDL_REF1);
900 :
901 0 : aHdl.AddHdl(pHdl);
902 :
903 0 : break;
904 : }
905 : case SDRDRAG_MIRROR:
906 : {
907 : // add axis of reflection
908 0 : SdrHdl* pHdl3 = new SdrHdl(aRef2, HDL_REF2);
909 0 : SdrHdl* pHdl2 = new SdrHdl(aRef1, HDL_REF1);
910 0 : SdrHdl* pHdl1 = new SdrHdlLine(*pHdl2, *pHdl3, HDL_MIRX);
911 :
912 0 : pHdl1->SetObjHdlNum(1); // for sorting
913 0 : pHdl2->SetObjHdlNum(2); // for sorting
914 0 : pHdl3->SetObjHdlNum(3); // for sorting
915 :
916 0 : aHdl.AddHdl(pHdl1); // line comes first, so it is the last in HitTest
917 0 : aHdl.AddHdl(pHdl2);
918 0 : aHdl.AddHdl(pHdl3);
919 :
920 0 : break;
921 : }
922 : case SDRDRAG_TRANSPARENCE:
923 : {
924 : // add interactive transparency handle
925 0 : sal_uIntPtr nMarkAnz = GetMarkedObjectCount();
926 0 : if(nMarkAnz == 1)
927 : {
928 0 : SdrObject* pObj = GetMarkedObjectByIndex(0);
929 0 : SdrModel* pModel = GetModel();
930 0 : const SfxItemSet& rSet = pObj->GetMergedItemSet();
931 :
932 0 : if(SFX_ITEM_SET != rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, false))
933 : {
934 : // add this item, it's not yet there
935 : XFillFloatTransparenceItem aNewItem(
936 0 : (const XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE));
937 0 : XGradient aGrad = aNewItem.GetGradientValue();
938 :
939 0 : aNewItem.SetEnabled(true);
940 0 : aGrad.SetStartIntens(100);
941 0 : aGrad.SetEndIntens(100);
942 0 : aNewItem.SetGradientValue(aGrad);
943 :
944 : // add undo to allow user to take back this step
945 0 : if( pModel->IsUndoEnabled() )
946 : {
947 0 : pModel->BegUndo(SVX_RESSTR(SIP_XA_FILLTRANSPARENCE));
948 0 : pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
949 0 : pModel->EndUndo();
950 : }
951 :
952 0 : SfxItemSet aNewSet(pModel->GetItemPool());
953 0 : aNewSet.Put(aNewItem);
954 0 : pObj->SetMergedItemSetAndBroadcast(aNewSet);
955 : }
956 :
957 : // set values and transform to vector set
958 0 : GradTransformer aGradTransformer;
959 0 : GradTransVector aGradTransVector;
960 0 : GradTransGradient aGradTransGradient;
961 :
962 0 : aGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue();
963 0 : aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
964 :
965 : // build handles
966 0 : const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
967 0 : const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
968 0 : SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, SDR_HANDLE_COLOR_SIZE_NORMAL, true);
969 0 : SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, SDR_HANDLE_COLOR_SIZE_NORMAL, true);
970 0 : SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, false);
971 : DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Could not get all necessary handles!");
972 :
973 : // link them
974 0 : pGradHdl->SetColorHandles(pColHdl1, pColHdl2);
975 0 : pGradHdl->SetObj(pObj);
976 0 : pColHdl1->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
977 0 : pColHdl2->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
978 :
979 : // insert them
980 0 : aHdl.AddHdl(pColHdl1);
981 0 : aHdl.AddHdl(pColHdl2);
982 0 : aHdl.AddHdl(pGradHdl);
983 : }
984 0 : break;
985 : }
986 : case SDRDRAG_GRADIENT:
987 : {
988 : // add interactive gradient handle
989 0 : sal_uIntPtr nMarkAnz = GetMarkedObjectCount();
990 0 : if(nMarkAnz == 1)
991 : {
992 0 : SdrObject* pObj = GetMarkedObjectByIndex(0);
993 0 : const SfxItemSet& rSet = pObj->GetMergedItemSet();
994 0 : XFillStyle eFillStyle = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
995 :
996 0 : if(eFillStyle == XFILL_GRADIENT)
997 : {
998 : // set values and transform to vector set
999 0 : GradTransformer aGradTransformer;
1000 0 : GradTransVector aGradTransVector;
1001 0 : GradTransGradient aGradTransGradient;
1002 0 : Size aHdlSize(15, 15);
1003 :
1004 0 : aGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
1005 0 : aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
1006 :
1007 : // build handles
1008 0 : const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
1009 0 : const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
1010 0 : SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, aHdlSize, false);
1011 0 : SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, aHdlSize, false);
1012 0 : SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, true);
1013 : DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Could not get all necessary handles!");
1014 :
1015 : // link them
1016 0 : pGradHdl->SetColorHandles(pColHdl1, pColHdl2);
1017 0 : pGradHdl->SetObj(pObj);
1018 0 : pColHdl1->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
1019 0 : pColHdl2->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
1020 :
1021 : // insert them
1022 0 : aHdl.AddHdl(pColHdl1);
1023 0 : aHdl.AddHdl(pColHdl2);
1024 0 : aHdl.AddHdl(pGradHdl);
1025 : }
1026 : }
1027 0 : break;
1028 : }
1029 : case SDRDRAG_CROP:
1030 : {
1031 : // TODO
1032 0 : break;
1033 : }
1034 18925 : default: break;
1035 : }
1036 18925 : }
1037 :
1038 : /** handle mouse over effects for handles */
1039 0 : bool SdrMarkView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
1040 : {
1041 0 : if(aHdl.GetHdlCount())
1042 : {
1043 0 : SdrHdl* pMouseOverHdl = 0;
1044 0 : if( !rMEvt.IsLeaveWindow() && pWin )
1045 : {
1046 0 : Point aMDPos( pWin->PixelToLogic( rMEvt.GetPosPixel() ) );
1047 0 : pMouseOverHdl = PickHandle(aMDPos);
1048 : }
1049 :
1050 : // notify last mouse over handle that he lost the mouse
1051 0 : const sal_uIntPtr nHdlCount = aHdl.GetHdlCount();
1052 :
1053 0 : for(sal_uIntPtr nHdl = 0; nHdl < nHdlCount; nHdl++ )
1054 : {
1055 0 : SdrHdl* pCurrentHdl = GetHdl(nHdl);
1056 0 : if( pCurrentHdl->mbMouseOver )
1057 : {
1058 0 : if( pCurrentHdl != pMouseOverHdl )
1059 : {
1060 0 : pCurrentHdl->mbMouseOver = false;
1061 0 : pCurrentHdl->onMouseLeave();
1062 : }
1063 0 : break;
1064 : }
1065 : }
1066 :
1067 : // notify current mouse over handle
1068 0 : if( pMouseOverHdl )
1069 : {
1070 0 : pMouseOverHdl->mbMouseOver = true;
1071 0 : pMouseOverHdl->onMouseEnter(rMEvt);
1072 : }
1073 : }
1074 0 : return SdrSnapView::MouseMove(rMEvt, pWin);
1075 : }
1076 :
1077 0 : void SdrMarkView::ForceRefToMarked()
1078 : {
1079 0 : switch(eDragMode)
1080 : {
1081 : case SDRDRAG_ROTATE:
1082 : {
1083 0 : Rectangle aR(GetMarkedObjRect());
1084 0 : aRef1 = aR.Center();
1085 :
1086 0 : break;
1087 : }
1088 :
1089 : case SDRDRAG_MIRROR:
1090 : {
1091 : // first calculate the length of the axis of reflection
1092 0 : long nOutMin=0;
1093 0 : long nOutMax=0;
1094 0 : long nMinLen=0;
1095 0 : long nObjDst=0;
1096 0 : long nOutHgt=0;
1097 0 : OutputDevice* pOut=GetFirstOutputDevice();
1098 0 : if (pOut!=NULL) {
1099 : // minimum length: 50 pixels
1100 0 : nMinLen=pOut->PixelToLogic(Size(0,50)).Height();
1101 : // 20 pixels distance to the Obj for the reference point
1102 0 : nObjDst=pOut->PixelToLogic(Size(0,20)).Height();
1103 : // MinY/MaxY
1104 : // margin = minimum length = 10 pixels
1105 0 : long nDst=pOut->PixelToLogic(Size(0,10)).Height();
1106 0 : nOutMin=-pOut->GetMapMode().GetOrigin().Y();
1107 0 : nOutMax=pOut->GetOutputSize().Height()-1+nOutMin;
1108 0 : nOutMin+=nDst;
1109 0 : nOutMax-=nDst;
1110 : // absolute minimum length, however, is 10 pixels
1111 0 : if (nOutMax-nOutMin<nDst) {
1112 0 : nOutMin+=nOutMax+1;
1113 0 : nOutMin/=2;
1114 0 : nOutMin-=(nDst+1)/2;
1115 0 : nOutMax=nOutMin+nDst;
1116 : }
1117 0 : nOutHgt=nOutMax-nOutMin;
1118 : // otherwise minimum length = 1/4 OutHgt
1119 0 : long nTemp=nOutHgt/4;
1120 0 : if (nTemp>nMinLen) nMinLen=nTemp;
1121 : }
1122 :
1123 0 : Rectangle aR(GetMarkedObjBoundRect());
1124 0 : Point aCenter(aR.Center());
1125 0 : long nMarkHgt=aR.GetHeight()-1;
1126 0 : long nHgt=nMarkHgt+nObjDst*2; // 20 pixels overlapping above and below
1127 0 : if (nHgt<nMinLen) nHgt=nMinLen; // minimum length 50 pixels or 1/4 OutHgt, respectively
1128 :
1129 0 : long nY1=aCenter.Y()-(nHgt+1)/2;
1130 0 : long nY2=nY1+nHgt;
1131 :
1132 0 : if (pOut!=NULL && nMinLen>nOutHgt) nMinLen=nOutHgt; // TODO: maybe shorten this a little
1133 :
1134 0 : if (pOut!=NULL) { // now move completely into the visible area
1135 0 : if (nY1<nOutMin) {
1136 0 : nY1=nOutMin;
1137 0 : if (nY2<nY1+nMinLen) nY2=nY1+nMinLen;
1138 : }
1139 0 : if (nY2>nOutMax) {
1140 0 : nY2=nOutMax;
1141 0 : if (nY1>nY2-nMinLen) nY1=nY2-nMinLen;
1142 : }
1143 : }
1144 :
1145 0 : aRef1.X()=aCenter.X();
1146 0 : aRef1.Y()=nY1;
1147 0 : aRef2.X()=aCenter.X();
1148 0 : aRef2.Y()=nY2;
1149 :
1150 0 : break;
1151 : }
1152 :
1153 : case SDRDRAG_TRANSPARENCE:
1154 : case SDRDRAG_GRADIENT:
1155 : case SDRDRAG_CROP:
1156 : {
1157 0 : Rectangle aRect(GetMarkedObjBoundRect());
1158 0 : aRef1 = aRect.TopLeft();
1159 0 : aRef2 = aRect.BottomRight();
1160 0 : break;
1161 : }
1162 0 : default: break;
1163 : }
1164 0 : }
1165 :
1166 0 : void SdrMarkView::SetRef1(const Point& rPt)
1167 : {
1168 0 : if(eDragMode == SDRDRAG_ROTATE || eDragMode == SDRDRAG_MIRROR)
1169 : {
1170 0 : aRef1 = rPt;
1171 0 : SdrHdl* pH = aHdl.GetHdl(HDL_REF1);
1172 0 : if(pH)
1173 0 : pH->SetPos(rPt);
1174 : }
1175 0 : }
1176 :
1177 0 : void SdrMarkView::SetRef2(const Point& rPt)
1178 : {
1179 0 : if(eDragMode == SDRDRAG_MIRROR)
1180 : {
1181 0 : aRef2 = rPt;
1182 0 : SdrHdl* pH = aHdl.GetHdl(HDL_REF2);
1183 0 : if(pH)
1184 0 : pH->SetPos(rPt);
1185 : }
1186 0 : }
1187 :
1188 29295 : void SdrMarkView::CheckMarked()
1189 : {
1190 58924 : for (sal_uIntPtr nm=GetMarkedObjectCount(); nm>0;) {
1191 334 : nm--;
1192 334 : SdrMark* pM=GetSdrMarkByIndex(nm);
1193 334 : SdrObject* pObj=pM->GetMarkedSdrObj();
1194 334 : SdrPageView* pPV=pM->GetPageView();
1195 334 : SdrLayerID nLay=pObj->GetLayer();
1196 334 : bool bRaus=!pObj->IsInserted(); // Obj deleted?
1197 334 : if (!pObj->Is3DObj()) {
1198 334 : bRaus=bRaus || pObj->GetPage()!=pPV->GetPage(); // Obj suddenly in different Page or Group
1199 : }
1200 668 : bRaus=bRaus || pPV->GetLockedLayers().IsSet(nLay) || // Layer locked?
1201 668 : !pPV->GetVisibleLayers().IsSet(nLay); // Layer invisible?
1202 :
1203 334 : if( !bRaus )
1204 334 : bRaus = !pObj->IsVisible(); // invisible objects can not be selected
1205 :
1206 334 : if (!bRaus) {
1207 : // Grouped objects can now be selected.
1208 : // After EnterGroup the higher-level objects,
1209 : // have to be deselected, though.
1210 334 : const SdrObjList* pOOL=pObj->GetObjList();
1211 334 : const SdrObjList* pVOL=pPV->GetObjList();
1212 668 : while (pOOL!=NULL && pOOL!=pVOL) {
1213 0 : pOOL=pOOL->GetUpList();
1214 : }
1215 334 : bRaus=pOOL!=pVOL;
1216 : }
1217 :
1218 334 : if (bRaus)
1219 : {
1220 0 : GetMarkedObjectListWriteAccess().DeleteMark(nm);
1221 : }
1222 : else
1223 : {
1224 334 : if (!IsGluePointEditMode()) { // selected glue points only in GlueEditMode
1225 334 : SdrUShortCont* pPts=pM->GetMarkedGluePoints();
1226 334 : if (pPts!=NULL) {
1227 0 : pPts->clear();
1228 : }
1229 : }
1230 : }
1231 : }
1232 :
1233 : // at least reset the remembered BoundRect to prevent handle
1234 : // generation if bForceFrameHandles is TRUE.
1235 29295 : bMarkedObjRectDirty = true;
1236 29295 : }
1237 :
1238 25525 : void SdrMarkView::SetMarkRects()
1239 : {
1240 25525 : SdrPageView* pPV = GetSdrPageView();
1241 :
1242 25525 : if(pPV)
1243 : {
1244 20932 : pPV->SetHasMarkedObj(GetSnapRectFromMarkedObjects(pPV, pPV->MarkSnap()));
1245 20932 : GetBoundRectFromMarkedObjects(pPV, pPV->MarkBound());
1246 : }
1247 25525 : }
1248 :
1249 2833 : void SdrMarkView::SetFrameHandles(bool bOn)
1250 : {
1251 2833 : if (bOn!=bForceFrameHandles) {
1252 2203 : bool bOld=ImpIsFrameHandles();
1253 2203 : bForceFrameHandles=bOn;
1254 2203 : bool bNew=ImpIsFrameHandles();
1255 2203 : if (bNew!=bOld) {
1256 2203 : AdjustMarkHdl();
1257 2203 : MarkListHasChanged();
1258 : }
1259 : }
1260 2833 : }
1261 :
1262 205 : void SdrMarkView::SetEditMode(SdrViewEditMode eMode)
1263 : {
1264 205 : if (eMode!=eEditMode) {
1265 0 : bool bGlue0=eEditMode==SDREDITMODE_GLUEPOINTEDIT;
1266 0 : bool bEdge0=((SdrCreateView*)this)->IsEdgeTool();
1267 0 : eEditMode0=eEditMode;
1268 0 : eEditMode=eMode;
1269 0 : bool bGlue1=eEditMode==SDREDITMODE_GLUEPOINTEDIT;
1270 0 : bool bEdge1=((SdrCreateView*)this)->IsEdgeTool();
1271 : // avoid flickering when switching between GlueEdit and EdgeTool
1272 0 : if (bGlue1 && !bGlue0) ImpSetGlueVisible2(bGlue1);
1273 0 : if (bEdge1!=bEdge0) ImpSetGlueVisible3(bEdge1);
1274 0 : if (!bGlue1 && bGlue0) ImpSetGlueVisible2(bGlue1);
1275 0 : if (bGlue0 && !bGlue1) UnmarkAllGluePoints();
1276 : }
1277 205 : }
1278 :
1279 :
1280 :
1281 369 : bool SdrMarkView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
1282 : {
1283 369 : if (pObj)
1284 : {
1285 739 : if (pObj->IsMarkProtect() ||
1286 544 : (!bDesignMode && pObj->IsUnoObj()))
1287 : {
1288 : // object not selectable or
1289 : // SdrUnoObj not in DesignMode
1290 1 : return false;
1291 : }
1292 : }
1293 368 : return pPV==NULL || pPV->IsObjMarkable(pObj);
1294 : }
1295 :
1296 0 : bool SdrMarkView::IsMarkedObjHit(const Point& rPnt, short nTol) const
1297 : {
1298 0 : bool bRet=false;
1299 0 : nTol=ImpGetHitTolLogic(nTol,NULL);
1300 0 : Point aPt(rPnt);
1301 0 : for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount() && !bRet; nm++) {
1302 0 : SdrMark* pM=GetSdrMarkByIndex(nm);
1303 0 : bRet = 0 != CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0);
1304 : }
1305 0 : return bRet;
1306 : }
1307 :
1308 1635 : SdrHdl* SdrMarkView::PickHandle(const Point& rPnt, sal_uIntPtr nOptions, SdrHdl* pHdl0) const
1309 : {
1310 1635 : if (bSomeObjChgdFlag) { // recalculate handles, if necessary
1311 621 : FlushComeBackTimer();
1312 : }
1313 1635 : bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0;
1314 1635 : bool bNext=(nOptions & SDRSEARCH_NEXT) !=0;
1315 1635 : Point aPt(rPnt);
1316 1635 : return aHdl.IsHdlListHit(aPt,bBack,bNext,pHdl0);
1317 : }
1318 :
1319 0 : bool SdrMarkView::MarkObj(const Point& rPnt, short nTol, bool bToggle, bool bDeep)
1320 : {
1321 : SdrObject* pObj;
1322 : SdrPageView* pPV;
1323 0 : nTol=ImpGetHitTolLogic(nTol,NULL);
1324 0 : sal_uIntPtr nOptions=SDRSEARCH_PICKMARKABLE;
1325 0 : if (bDeep) nOptions=nOptions|SDRSEARCH_DEEP;
1326 0 : bool bRet=PickObj(rPnt,(sal_uInt16)nTol,pObj,pPV,nOptions);
1327 0 : if (bRet) {
1328 0 : bool bUnmark=bToggle && IsObjMarked(pObj);
1329 0 : MarkObj(pObj,pPV,bUnmark);
1330 : }
1331 0 : return bRet;
1332 : }
1333 :
1334 0 : bool SdrMarkView::MarkNextObj(bool bPrev)
1335 : {
1336 0 : SdrPageView* pPageView = GetSdrPageView();
1337 :
1338 0 : if(!pPageView)
1339 : {
1340 0 : return false;
1341 : }
1342 :
1343 0 : SortMarkedObjects();
1344 0 : sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
1345 0 : sal_uIntPtr nChgMarkNum = ULONG_MAX; // number of the MarkEntry we want to replace
1346 0 : sal_uIntPtr nSearchObjNum = bPrev ? 0 : ULONG_MAX;
1347 0 : if (nMarkAnz!=0) {
1348 0 : nChgMarkNum=bPrev ? 0 : sal_uIntPtr(nMarkAnz-1);
1349 0 : SdrMark* pM=GetSdrMarkByIndex(nChgMarkNum);
1350 : OSL_ASSERT(pM!=NULL);
1351 0 : if (pM->GetMarkedSdrObj() != NULL)
1352 0 : nSearchObjNum = pM->GetMarkedSdrObj()->GetNavigationPosition();
1353 : }
1354 :
1355 0 : SdrObject* pMarkObj=NULL;
1356 0 : SdrObjList* pSearchObjList=pPageView->GetObjList();
1357 0 : sal_uIntPtr nObjAnz=pSearchObjList->GetObjCount();
1358 0 : if (nObjAnz!=0) {
1359 0 : if (nSearchObjNum>nObjAnz) nSearchObjNum=nObjAnz;
1360 0 : while (pMarkObj==NULL && ((!bPrev && nSearchObjNum>0) || (bPrev && nSearchObjNum<nObjAnz)))
1361 : {
1362 0 : if (!bPrev)
1363 0 : nSearchObjNum--;
1364 0 : SdrObject* pSearchObj = pSearchObjList->GetObjectForNavigationPosition(nSearchObjNum);
1365 0 : if (IsObjMarkable(pSearchObj,pPageView))
1366 : {
1367 0 : if (TryToFindMarkedObject(pSearchObj)==CONTAINER_ENTRY_NOTFOUND)
1368 : {
1369 0 : pMarkObj=pSearchObj;
1370 : }
1371 : }
1372 0 : if (bPrev) nSearchObjNum++;
1373 : }
1374 : }
1375 :
1376 0 : if(!pMarkObj)
1377 : {
1378 0 : return false;
1379 : }
1380 :
1381 0 : if (nChgMarkNum!=ULONG_MAX)
1382 : {
1383 0 : GetMarkedObjectListWriteAccess().DeleteMark(nChgMarkNum);
1384 : }
1385 0 : MarkObj(pMarkObj,pPageView); // also calls MarkListHasChanged(), AdjustMarkHdl()
1386 0 : return true;
1387 : }
1388 :
1389 0 : bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev)
1390 : {
1391 0 : SortMarkedObjects();
1392 0 : nTol=ImpGetHitTolLogic(nTol,NULL);
1393 0 : Point aPt(rPnt);
1394 0 : SdrMark* pTopMarkHit=NULL;
1395 0 : SdrMark* pBtmMarkHit=NULL;
1396 0 : sal_uIntPtr nTopMarkHit=0;
1397 0 : sal_uIntPtr nBtmMarkHit=0;
1398 : // find topmost of the selected objects that is hit by rPnt
1399 0 : sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
1400 0 : sal_uIntPtr nm=0;
1401 0 : for (nm=nMarkAnz; nm>0 && pTopMarkHit==NULL;) {
1402 0 : nm--;
1403 0 : SdrMark* pM=GetSdrMarkByIndex(nm);
1404 0 : if(CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0))
1405 : {
1406 0 : pTopMarkHit=pM;
1407 0 : nTopMarkHit=nm;
1408 : }
1409 : }
1410 : // nothing found, in this case, just select an object
1411 0 : if (pTopMarkHit==NULL) return MarkObj(rPnt,sal_uInt16(nTol),false);
1412 :
1413 0 : SdrObject* pTopObjHit=pTopMarkHit->GetMarkedSdrObj();
1414 0 : SdrObjList* pObjList=pTopObjHit->GetObjList();
1415 0 : SdrPageView* pPV=pTopMarkHit->GetPageView();
1416 : // find lowermost of the selected objects that is hit by rPnt
1417 : // and is placed on the same PageView as pTopMarkHit
1418 0 : for (nm=0; nm<nMarkAnz && pBtmMarkHit==NULL; nm++) {
1419 0 : SdrMark* pM=GetSdrMarkByIndex(nm);
1420 0 : SdrPageView* pPV2=pM->GetPageView();
1421 0 : if (pPV2==pPV && CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pPV2,0,0))
1422 : {
1423 0 : pBtmMarkHit=pM;
1424 0 : nBtmMarkHit=nm;
1425 : }
1426 : }
1427 0 : if (pBtmMarkHit==NULL) { pBtmMarkHit=pTopMarkHit; nBtmMarkHit=nTopMarkHit; }
1428 0 : SdrObject* pBtmObjHit=pBtmMarkHit->GetMarkedSdrObj();
1429 0 : sal_uIntPtr nObjAnz=pObjList->GetObjCount();
1430 :
1431 : sal_uInt32 nSearchBeg;
1432 0 : E3dScene* pScene = NULL;
1433 0 : SdrObject* pObjHit = (bPrev) ? pBtmObjHit : pTopObjHit;
1434 0 : bool bRemap = pObjHit->ISA(E3dCompoundObject)
1435 : ? ((E3dCompoundObject*)pObjHit)->IsAOrdNumRemapCandidate(pScene)
1436 0 : : false;
1437 :
1438 0 : if(bPrev)
1439 : {
1440 0 : sal_uInt32 nOrdNumBtm(pBtmObjHit->GetOrdNum());
1441 :
1442 0 : if(bRemap)
1443 : {
1444 0 : nOrdNumBtm = pScene->RemapOrdNum(nOrdNumBtm);
1445 : }
1446 :
1447 0 : nSearchBeg = nOrdNumBtm + 1;
1448 : }
1449 : else
1450 : {
1451 0 : sal_uInt32 nOrdNumTop(pTopObjHit->GetOrdNum());
1452 :
1453 0 : if(bRemap)
1454 : {
1455 0 : nOrdNumTop = pScene->RemapOrdNum(nOrdNumTop);
1456 : }
1457 :
1458 0 : nSearchBeg = nOrdNumTop;
1459 : }
1460 :
1461 0 : sal_uIntPtr no=nSearchBeg;
1462 0 : SdrObject* pFndObj=NULL;
1463 0 : while (pFndObj==NULL && ((!bPrev && no>0) || (bPrev && no<nObjAnz))) {
1464 0 : if (!bPrev) no--;
1465 : SdrObject* pObj;
1466 :
1467 0 : if(bRemap)
1468 : {
1469 0 : pObj = pObjList->GetObj(pScene->RemapOrdNum(no));
1470 : }
1471 : else
1472 : {
1473 0 : pObj = pObjList->GetObj(no);
1474 : }
1475 :
1476 0 : if (CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pObj,pPV,SDRSEARCH_TESTMARKABLE,0))
1477 : {
1478 0 : if (TryToFindMarkedObject(pObj)==CONTAINER_ENTRY_NOTFOUND) {
1479 0 : pFndObj=pObj;
1480 : } else {
1481 : // TODO: for performance reasons set on to Top or Btm, if necessary
1482 : }
1483 : }
1484 0 : if (bPrev) no++;
1485 : }
1486 0 : if (pFndObj!=NULL)
1487 : {
1488 0 : GetMarkedObjectListWriteAccess().DeleteMark(bPrev?nBtmMarkHit:nTopMarkHit);
1489 0 : GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pFndObj,pPV));
1490 0 : MarkListHasChanged();
1491 0 : AdjustMarkHdl();
1492 : }
1493 0 : return pFndObj!=NULL;
1494 : }
1495 :
1496 0 : bool SdrMarkView::MarkObj(const Rectangle& rRect, bool bUnmark)
1497 : {
1498 0 : bool bFnd=false;
1499 0 : Rectangle aR(rRect);
1500 : SdrObjList* pObjList;
1501 0 : BrkAction();
1502 0 : SdrPageView* pPV = GetSdrPageView();
1503 :
1504 0 : if(pPV)
1505 : {
1506 0 : pObjList=pPV->GetObjList();
1507 0 : Rectangle aFrm1(aR);
1508 0 : sal_uIntPtr nObjAnz=pObjList->GetObjCount();
1509 : SdrObject* pObj;
1510 0 : for (sal_uIntPtr nO=0; nO<nObjAnz; nO++) {
1511 0 : pObj=pObjList->GetObj(nO);
1512 0 : Rectangle aRect(pObj->GetCurrentBoundRect());
1513 0 : if (aFrm1.IsInside(aRect)) {
1514 0 : if (!bUnmark) {
1515 0 : if (IsObjMarkable(pObj,pPV))
1516 : {
1517 0 : GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV));
1518 0 : bFnd=true;
1519 : }
1520 : } else {
1521 0 : sal_uIntPtr nPos=TryToFindMarkedObject(pObj);
1522 0 : if (nPos!=CONTAINER_ENTRY_NOTFOUND)
1523 : {
1524 0 : GetMarkedObjectListWriteAccess().DeleteMark(nPos);
1525 0 : bFnd=true;
1526 : }
1527 : }
1528 : }
1529 : }
1530 : }
1531 0 : if (bFnd) {
1532 0 : SortMarkedObjects();
1533 0 : MarkListHasChanged();
1534 0 : AdjustMarkHdl();
1535 : }
1536 0 : return bFnd;
1537 : }
1538 :
1539 293 : void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark, bool bImpNoSetMarkHdl)
1540 : {
1541 293 : if (pObj!=NULL && pPV!=NULL && IsObjMarkable(pObj, pPV)) {
1542 293 : BrkAction();
1543 293 : if (!bUnmark)
1544 : {
1545 290 : GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV));
1546 : }
1547 : else
1548 : {
1549 3 : sal_uIntPtr nPos=TryToFindMarkedObject(pObj);
1550 3 : if (nPos!=CONTAINER_ENTRY_NOTFOUND)
1551 : {
1552 0 : GetMarkedObjectListWriteAccess().DeleteMark(nPos);
1553 : }
1554 : }
1555 293 : if (!bImpNoSetMarkHdl) {
1556 216 : MarkListHasChanged();
1557 216 : AdjustMarkHdl();
1558 : }
1559 : }
1560 293 : }
1561 :
1562 4 : bool SdrMarkView::IsObjMarked(SdrObject* pObj) const
1563 : {
1564 : // Hack: Because FindObject() is not const,
1565 : // I have to cast myself to non-const.
1566 4 : sal_uIntPtr nPos=((SdrMarkView*)this)->TryToFindMarkedObject(pObj);
1567 4 : return nPos!=CONTAINER_ENTRY_NOTFOUND;
1568 : }
1569 :
1570 4169 : sal_uInt16 SdrMarkView::GetMarkHdlSizePixel() const
1571 : {
1572 4169 : return aHdl.GetHdlSize()*2+1;
1573 : }
1574 :
1575 2768 : void SdrMarkView::SetMarkHdlSizePixel(sal_uInt16 nSiz)
1576 : {
1577 2768 : if (nSiz<3) nSiz=3;
1578 2768 : nSiz/=2;
1579 2768 : if (nSiz!=aHdl.GetHdlSize()) {
1580 2064 : aHdl.SetHdlSize(nSiz);
1581 : }
1582 2768 : }
1583 :
1584 : #define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage is being searched right now */
1585 2226 : SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay) const
1586 : {
1587 2226 : if(((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) || (!pObj->IsVisible()))
1588 : {
1589 200 : return NULL;
1590 : }
1591 :
1592 2026 : const bool bCheckIfMarkable(nOptions & SDRSEARCH_TESTMARKABLE);
1593 2026 : const bool bDeep(nOptions & SDRSEARCH_DEEP);
1594 2026 : const bool bOLE(pObj->ISA(SdrOle2Obj));
1595 2026 : const bool bTXT(pObj->ISA(SdrTextObj) && ((SdrTextObj*)pObj)->IsTextFrame());
1596 2026 : SdrObject* pRet=NULL;
1597 2026 : Rectangle aRect(pObj->GetCurrentBoundRect());
1598 : // hack for calc grid sync
1599 2026 : aRect += pObj->GetGridOffset();
1600 2026 : sal_uInt16 nTol2(nTol);
1601 :
1602 : // double tolerance for OLE, text frames and objects in
1603 : // active text edit
1604 2026 : if(bOLE || bTXT || pObj==((SdrObjEditView*)this)->GetTextEditObject())
1605 : {
1606 533 : nTol2*=2;
1607 : }
1608 :
1609 2026 : aRect.Left ()-=nTol2; // add 1 tolerance for all objects
1610 2026 : aRect.Top ()-=nTol2;
1611 2026 : aRect.Right ()+=nTol2;
1612 2026 : aRect.Bottom()+=nTol2;
1613 :
1614 2026 : if (aRect.IsInside(rPnt))
1615 : {
1616 75 : if ((!bCheckIfMarkable || IsObjMarkable(pObj,pPV)))
1617 : {
1618 42 : SdrObjList* pOL=pObj->GetSubList();
1619 :
1620 42 : if (pOL!=NULL && pOL->GetObjCount()!=0)
1621 : {
1622 : SdrObject* pTmpObj;
1623 : // adjustment hit point for virtual objects
1624 2 : Point aPnt( rPnt );
1625 :
1626 2 : if ( pObj->ISA(SdrVirtObj) )
1627 : {
1628 0 : Point aOffset = static_cast<SdrVirtObj*>(pObj)->GetOffset();
1629 0 : aPnt.Move( -aOffset.X(), -aOffset.Y() );
1630 : }
1631 :
1632 2 : pRet=CheckSingleSdrObjectHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj);
1633 : }
1634 : else
1635 : {
1636 40 : if(!pMVisLay || pMVisLay->IsSet(pObj->GetLayer()))
1637 : {
1638 40 : pRet = SdrObjectPrimitiveHit(*pObj, rPnt, nTol2, *pPV, &pPV->GetVisibleLayers(), false);
1639 : }
1640 : }
1641 : }
1642 : }
1643 :
1644 2026 : if (!bDeep && pRet!=NULL)
1645 : {
1646 3 : pRet=pObj;
1647 : }
1648 :
1649 2026 : return pRet;
1650 : }
1651 :
1652 2 : SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const
1653 : {
1654 2 : return (*this).CheckSingleSdrObjectHit(rPnt,nTol,pOL,pPV,nOptions,pMVisLay,rpRootObj,NULL);
1655 : }
1656 2055 : SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj,const SdrMarkList * pMarkList) const
1657 : {
1658 2055 : bool bBack=(nOptions & SDRSEARCH_BACKWARD)!=0;
1659 2055 : bool bBefMrk=(nOptions & SDRSEARCH_BEFOREMARK)!=0;
1660 2055 : SdrObject* pRet=NULL;
1661 2055 : rpRootObj=NULL;
1662 2055 : if (pOL!=NULL)
1663 : {
1664 2055 : bool bRemap(pOL->GetOwnerObj() && pOL->GetOwnerObj()->ISA(E3dScene));
1665 2055 : E3dScene* pRemapScene = (bRemap ? (E3dScene*)pOL->GetOwnerObj() : 0L);
1666 :
1667 2055 : sal_uIntPtr nObjAnz=pOL->GetObjCount();
1668 2055 : sal_uIntPtr nObjNum=bBack ? 0 : nObjAnz;
1669 6336 : while (pRet==NULL && (bBack ? nObjNum<nObjAnz : nObjNum>0)) {
1670 2226 : if (!bBack) nObjNum--;
1671 : SdrObject* pObj;
1672 :
1673 2226 : if(bRemap)
1674 : {
1675 0 : pObj = pOL->GetObj(pRemapScene->RemapOrdNum(nObjNum));
1676 : }
1677 : else
1678 : {
1679 2226 : pObj = pOL->GetObj(nObjNum);
1680 : }
1681 2226 : if (bBefMrk)
1682 : {
1683 0 : if ((pMarkList)!=NULL)
1684 : {
1685 0 : if ((*pMarkList).FindObject(pObj)!=CONTAINER_ENTRY_NOTFOUND)
1686 : {
1687 0 : return NULL;
1688 : }
1689 : }
1690 : }
1691 2226 : pRet=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay);
1692 2226 : if (pRet!=NULL) rpRootObj=pObj;
1693 2226 : if (bBack) nObjNum++;
1694 : }
1695 : }
1696 2055 : return pRet;
1697 : }
1698 :
1699 1437 : bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions) const
1700 : {
1701 1437 : return PickObj(rPnt,nTol,rpObj,rpPV,nOptions,NULL,NULL,NULL);
1702 : }
1703 :
1704 1849 : bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions, SdrObject** ppRootObj, sal_uIntPtr* pnMarkNum, sal_uInt16* pnPassNum) const
1705 : { // TODO: lacks a Pass2,Pass3
1706 1849 : SortMarkedObjects();
1707 1849 : if (ppRootObj!=NULL) *ppRootObj=NULL;
1708 1849 : if (pnMarkNum!=NULL) *pnMarkNum=CONTAINER_ENTRY_NOTFOUND;
1709 1849 : if (pnPassNum!=NULL) *pnPassNum=0;
1710 1849 : rpObj=NULL;
1711 1849 : rpPV=NULL;
1712 1849 : bool bWholePage=(nOptions & SDRSEARCH_WHOLEPAGE) !=0;
1713 1849 : bool bMarked=(nOptions & SDRSEARCH_MARKED) !=0;
1714 1849 : bool bMasters=!bMarked && (nOptions & SDRSEARCH_ALSOONMASTER) !=0;
1715 1849 : bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0;
1716 : #if OSL_DEBUG_LEVEL > 0
1717 : bool bNext=(nOptions & SDRSEARCH_NEXT) !=0; (void)bNext; // n.i.
1718 : bool bBoundCheckOn2ndPass=(nOptions & SDRSEARCH_PASS2BOUND) !=0; (void)bBoundCheckOn2ndPass;// n.i.
1719 : bool bCheckNearestOn3rdPass=(nOptions & SDRSEARCH_PASS3NEAREST) !=0; (void)bCheckNearestOn3rdPass;// n.i.
1720 : #endif
1721 1849 : if (nTol<0) nTol=ImpGetHitTolLogic(nTol,NULL);
1722 1849 : Point aPt(rPnt);
1723 1849 : SdrObject* pObj=NULL;
1724 1849 : SdrObject* pHitObj=NULL;
1725 1849 : SdrPageView* pPV=NULL;
1726 1849 : if (!bBack && ((SdrObjEditView*)this)->IsTextEditFrameHit(rPnt)) {
1727 0 : pObj=((SdrObjEditView*)this)->GetTextEditObject();
1728 0 : pHitObj=pObj;
1729 0 : pPV=((SdrObjEditView*)this)->GetTextEditPageView();
1730 : }
1731 1849 : if (bMarked) {
1732 206 : sal_uIntPtr nMrkAnz=GetMarkedObjectCount();
1733 206 : sal_uIntPtr nMrkNum=bBack ? 0 : nMrkAnz;
1734 412 : while (pHitObj==NULL && (bBack ? nMrkNum<nMrkAnz : nMrkNum>0)) {
1735 0 : if (!bBack) nMrkNum--;
1736 0 : SdrMark* pM=GetSdrMarkByIndex(nMrkNum);
1737 0 : pObj=pM->GetMarkedSdrObj();
1738 0 : pPV=pM->GetPageView();
1739 0 : pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,nOptions,NULL);
1740 0 : if (bBack) nMrkNum++;
1741 : }
1742 : }
1743 : else
1744 : {
1745 1643 : pPV = GetSdrPageView();
1746 :
1747 1643 : if(pPV)
1748 : {
1749 1643 : SdrPage* pPage=pPV->GetPage();
1750 1643 : sal_uInt16 nPgAnz=1;
1751 :
1752 1643 : if(bMasters && pPage->TRG_HasMasterPage())
1753 : {
1754 410 : nPgAnz++;
1755 : }
1756 :
1757 1643 : bool bExtraPassForWholePage=bWholePage && pPage!=pPV->GetObjList();
1758 1643 : if (bExtraPassForWholePage) nPgAnz++; // First search in AktObjList, then on the entire page
1759 1643 : sal_uInt16 nPgNum=bBack ? 0 : nPgAnz;
1760 5339 : while (pHitObj==NULL && (bBack ? nPgNum<nPgAnz : nPgNum>0)) {
1761 2053 : sal_uIntPtr nTmpOptions=nOptions;
1762 2053 : if (!bBack) nPgNum--;
1763 2053 : const SetOfByte* pMVisLay=NULL;
1764 2053 : SdrObjList* pObjList=NULL;
1765 2053 : if (pnPassNum!=NULL) *pnPassNum&=~(SDRSEARCHPASS_MASTERPAGE|SDRSEARCHPASS_INACTIVELIST);
1766 2053 : if (nPgNum>=nPgAnz-1 || (bExtraPassForWholePage && nPgNum>=nPgAnz-2))
1767 : {
1768 1643 : pObjList=pPV->GetObjList();
1769 3286 : if (bExtraPassForWholePage && nPgNum==nPgAnz-2) {
1770 0 : pObjList=pPage;
1771 0 : if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_INACTIVELIST;
1772 : }
1773 : }
1774 : else
1775 : {
1776 : // otherwise MasterPage
1777 410 : SdrPage& rMasterPage = pPage->TRG_GetMasterPage();
1778 410 : pMVisLay = &pPage->TRG_GetMasterPageVisibleLayers();
1779 410 : pObjList = &rMasterPage;
1780 :
1781 410 : if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_MASTERPAGE;
1782 410 : nTmpOptions=nTmpOptions | SDRSEARCH_IMPISMASTER;
1783 : }
1784 2053 : pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj,&(GetMarkedObjectList()));
1785 2053 : if (bBack) nPgNum++;
1786 : }
1787 : }
1788 : }
1789 1849 : if (pHitObj!=NULL) {
1790 4 : if (ppRootObj!=NULL) *ppRootObj=pObj;
1791 4 : if ((nOptions & SDRSEARCH_DEEP) !=0) pObj=pHitObj;
1792 4 : if ((nOptions & SDRSEARCH_TESTTEXTEDIT) !=0) {
1793 0 : if (!pObj->HasTextEdit() || pPV->GetLockedLayers().IsSet(pObj->GetLayer())) {
1794 0 : pObj=NULL;
1795 : }
1796 : }
1797 4 : if (pObj!=NULL && (nOptions & SDRSEARCH_TESTMACRO) !=0) {
1798 0 : SdrObjMacroHitRec aHitRec;
1799 0 : aHitRec.aPos=aPt;
1800 0 : aHitRec.aDownPos=aPt;
1801 0 : aHitRec.nTol=nTol;
1802 0 : aHitRec.pVisiLayer=&pPV->GetVisibleLayers();
1803 0 : aHitRec.pPageView=pPV;
1804 0 : if (!pObj->HasMacro() || !pObj->IsMacroHit(aHitRec)) pObj=NULL;
1805 : }
1806 4 : if (pObj!=NULL && (nOptions & SDRSEARCH_WITHTEXT) !=0 && pObj->GetOutlinerParaObject()==NULL) pObj=NULL;
1807 4 : if (pObj!=NULL && (nOptions & SDRSEARCH_TESTTEXTAREA) !=0)
1808 : {
1809 0 : if(!SdrObjectPrimitiveHit(*pObj, aPt, 0, *pPV, 0, true))
1810 : {
1811 0 : pObj = 0;
1812 : }
1813 : }
1814 4 : if (pObj!=NULL) {
1815 4 : rpObj=pObj;
1816 4 : rpPV=pPV;
1817 4 : if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_DIRECT;
1818 : }
1819 : }
1820 1849 : return rpObj!=NULL;
1821 : }
1822 :
1823 0 : bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr* pnMarkNum, sal_uIntPtr nOptions) const
1824 : {
1825 0 : SortMarkedObjects();
1826 0 : bool bBoundCheckOn2ndPass=(nOptions & SDRSEARCH_PASS2BOUND) !=0;
1827 0 : bool bCheckNearestOn3rdPass=(nOptions & SDRSEARCH_PASS3NEAREST) !=0;
1828 0 : rpObj=NULL;
1829 0 : rpPV=NULL;
1830 0 : if (pnMarkNum!=NULL) *pnMarkNum=CONTAINER_ENTRY_NOTFOUND;
1831 0 : Point aPt(rPnt);
1832 0 : sal_uInt16 nTol=(sal_uInt16)nHitTolLog;
1833 0 : bool bFnd=false;
1834 0 : sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
1835 : sal_uIntPtr nMarkNum;
1836 0 : for (nMarkNum=nMarkAnz; nMarkNum>0 && !bFnd;) {
1837 0 : nMarkNum--;
1838 0 : SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
1839 0 : SdrPageView* pPV=pM->GetPageView();
1840 0 : SdrObject* pObj=pM->GetMarkedSdrObj();
1841 0 : bFnd = 0 != CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,SDRSEARCH_TESTMARKABLE,0);
1842 0 : if (bFnd) {
1843 0 : rpObj=pObj;
1844 0 : rpPV=pPV;
1845 0 : if (pnMarkNum!=NULL) *pnMarkNum=nMarkNum;
1846 : }
1847 : }
1848 0 : if ((bBoundCheckOn2ndPass || bCheckNearestOn3rdPass) && !bFnd) {
1849 0 : SdrObject* pBestObj=NULL;
1850 0 : SdrPageView* pBestPV=NULL;
1851 0 : sal_uIntPtr nBestMarkNum=0;
1852 0 : sal_uIntPtr nBestDist=ULONG_MAX;
1853 0 : for (nMarkNum=nMarkAnz; nMarkNum>0 && !bFnd;) {
1854 0 : nMarkNum--;
1855 0 : SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
1856 0 : SdrPageView* pPV=pM->GetPageView();
1857 0 : SdrObject* pObj=pM->GetMarkedSdrObj();
1858 0 : Rectangle aRect(pObj->GetCurrentBoundRect());
1859 0 : aRect.Left ()-=nTol;
1860 0 : aRect.Top ()-=nTol;
1861 0 : aRect.Right ()+=nTol;
1862 0 : aRect.Bottom()+=nTol;
1863 0 : if (aRect.IsInside(aPt)) {
1864 0 : bFnd=true;
1865 0 : rpObj=pObj;
1866 0 : rpPV=pPV;
1867 0 : if (pnMarkNum!=NULL) *pnMarkNum=nMarkNum;
1868 0 : } else if (bCheckNearestOn3rdPass) {
1869 0 : sal_uIntPtr nDist=0;
1870 0 : if (aPt.X()<aRect.Left()) nDist+=aRect.Left()-aPt.X();
1871 0 : if (aPt.X()>aRect.Right()) nDist+=aPt.X()-aRect.Right();
1872 0 : if (aPt.Y()<aRect.Top()) nDist+=aRect.Top()-aPt.Y();
1873 0 : if (aPt.Y()>aRect.Bottom()) nDist+=aPt.Y()-aRect.Bottom();
1874 0 : if (nDist<nBestDist) {
1875 0 : pBestObj=pObj;
1876 0 : pBestPV=pPV;
1877 0 : nBestMarkNum=nMarkNum;
1878 : }
1879 : }
1880 : }
1881 0 : if (bCheckNearestOn3rdPass && !bFnd) {
1882 0 : rpObj=pBestObj;
1883 0 : rpPV=pBestPV;
1884 0 : if (pnMarkNum!=NULL) *pnMarkNum=nBestMarkNum;
1885 0 : bFnd=pBestObj!=NULL;
1886 : }
1887 : }
1888 0 : return bFnd;
1889 : }
1890 :
1891 :
1892 1523 : void SdrMarkView::UnmarkAllObj(SdrPageView* pPV)
1893 : {
1894 1523 : if (GetMarkedObjectCount()!=0) {
1895 170 : BrkAction();
1896 170 : if (pPV!=NULL)
1897 : {
1898 6 : GetMarkedObjectListWriteAccess().DeletePageView(*pPV);
1899 : }
1900 : else
1901 : {
1902 164 : GetMarkedObjectListWriteAccess().Clear();
1903 : }
1904 170 : pMarkedObj=NULL;
1905 170 : pMarkedPV=NULL;
1906 170 : MarkListHasChanged();
1907 170 : AdjustMarkHdl();
1908 : }
1909 1523 : }
1910 :
1911 0 : void SdrMarkView::MarkAllObj(SdrPageView* _pPV)
1912 : {
1913 0 : BrkAction();
1914 :
1915 0 : if(!_pPV)
1916 : {
1917 0 : _pPV = GetSdrPageView();
1918 : }
1919 :
1920 : // #i69171# _pPV may still be NULL if there is no SDrPageView (!), e.g. when inserting
1921 : // other files
1922 0 : if(_pPV)
1923 : {
1924 0 : const bool bMarkChg(GetMarkedObjectListWriteAccess().InsertPageView(*_pPV));
1925 :
1926 0 : if(bMarkChg)
1927 : {
1928 0 : MarkListHasChanged();
1929 : }
1930 : }
1931 :
1932 0 : if(GetMarkedObjectCount())
1933 : {
1934 0 : AdjustMarkHdl();
1935 : }
1936 0 : }
1937 :
1938 25525 : void SdrMarkView::AdjustMarkHdl()
1939 : {
1940 25525 : CheckMarked();
1941 25525 : SetMarkRects();
1942 25525 : SetMarkHandles();
1943 25525 : }
1944 :
1945 162 : Rectangle SdrMarkView::GetMarkedObjBoundRect() const
1946 : {
1947 162 : Rectangle aRect;
1948 324 : for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) {
1949 162 : SdrMark* pM=GetSdrMarkByIndex(nm);
1950 162 : SdrObject* pO=pM->GetMarkedSdrObj();
1951 162 : Rectangle aR1(pO->GetCurrentBoundRect());
1952 : // Ensure marked area includes the calc offset
1953 : // ( if applicable ) to sync to grid
1954 162 : aR1 += pO->GetGridOffset();
1955 162 : if (aRect.IsEmpty()) aRect=aR1;
1956 0 : else aRect.Union(aR1);
1957 : }
1958 162 : return aRect;
1959 : }
1960 :
1961 18925 : Point SdrMarkView::GetGridOffset() const
1962 : {
1963 18925 : Point aOffset;
1964 : // calculate the area occupied by the union of each marked object
1965 : // ( synced to grid ) and compare to the same unsynced area to calculate
1966 : // the offset. Hopefully that's the sensible thing to do
1967 18925 : const Rectangle& aGroupSyncedRect = GetMarkedObjRect();
1968 18925 : aOffset = aGroupSyncedRect.TopLeft() - aMarkedObjRectNoOffset.TopLeft();
1969 18925 : return aOffset;
1970 : }
1971 :
1972 35459 : const Rectangle& SdrMarkView::GetMarkedObjRect() const
1973 : {
1974 35459 : if (bMarkedObjRectDirty) {
1975 18927 : ((SdrMarkView*)this)->bMarkedObjRectDirty=false;
1976 18927 : Rectangle aRect;
1977 18927 : Rectangle aRect2;
1978 19100 : for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) {
1979 173 : SdrMark* pM=GetSdrMarkByIndex(nm);
1980 173 : SdrObject* pO=pM->GetMarkedSdrObj();
1981 173 : Rectangle aR1(pO->GetSnapRect());
1982 : // apply calc offset to marked object rect
1983 : // ( necessary for handles to be displayed in
1984 : // correct position )
1985 173 : if (aRect2.IsEmpty()) aRect2=aR1;
1986 79 : else aRect2.Union( aR1 );
1987 173 : aR1 += pO->GetGridOffset();
1988 173 : if (aRect.IsEmpty()) aRect=aR1;
1989 79 : else aRect.Union(aR1);
1990 : }
1991 18927 : ((SdrMarkView*)this)->aMarkedObjRect=aRect;
1992 18927 : ((SdrMarkView*)this)->aMarkedObjRectNoOffset=aRect2;
1993 : }
1994 35459 : return aMarkedObjRect;
1995 : }
1996 :
1997 :
1998 :
1999 1 : void SdrMarkView::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, OUString& rStr, sal_uInt16 nVal, sal_uInt16 nOpt) const
2000 : {
2001 1 : rStr = ImpGetResStr(nStrCacheID);
2002 1 : sal_Int32 nPos = rStr.indexOf("%1");
2003 :
2004 1 : if(nPos != -1)
2005 : {
2006 1 : if(nOpt == IMPSDR_POINTSDESCRIPTION)
2007 : {
2008 0 : rStr = rStr.replaceAt(nPos, 2, GetDescriptionOfMarkedPoints());
2009 : }
2010 1 : else if(nOpt == IMPSDR_GLUEPOINTSDESCRIPTION)
2011 : {
2012 0 : rStr = rStr.replaceAt(nPos, 2, GetDescriptionOfMarkedGluePoints());
2013 : }
2014 : else
2015 : {
2016 1 : rStr = rStr.replaceAt(nPos, 2, GetDescriptionOfMarkedObjects());
2017 : }
2018 : }
2019 :
2020 1 : rStr = rStr.replaceFirst("%2", OUString::number( nVal ));
2021 1 : }
2022 :
2023 :
2024 :
2025 0 : bool SdrMarkView::EnterMarkedGroup()
2026 : {
2027 0 : bool bRet=false;
2028 : // We enter only the first group found (in only one PageView), because
2029 : // PageView::EnterGroup calls an AdjustMarkHdl.
2030 : // TODO: I'll have to prevent that via a flag.
2031 0 : SdrPageView* pPV = GetSdrPageView();
2032 :
2033 0 : if(pPV)
2034 : {
2035 0 : bool bEnter=false;
2036 0 : for (sal_uInt32 nm(GetMarkedObjectCount()); nm > 0 && !bEnter;)
2037 : {
2038 0 : nm--;
2039 0 : SdrMark* pM=GetSdrMarkByIndex(nm);
2040 0 : if (pM->GetPageView()==pPV) {
2041 0 : SdrObject* pObj=pM->GetMarkedSdrObj();
2042 0 : if (pObj->IsGroupObject()) {
2043 0 : if (pPV->EnterGroup(pObj)) {
2044 0 : bRet=true;
2045 0 : bEnter=true;
2046 : }
2047 : }
2048 : }
2049 : }
2050 : }
2051 0 : return bRet;
2052 : }
2053 :
2054 :
2055 :
2056 2628 : void SdrMarkView::MarkListHasChanged()
2057 : {
2058 2628 : GetMarkedObjectListWriteAccess().SetNameDirty();
2059 2628 : SetEdgesOfMarkedNodesDirty();
2060 :
2061 2628 : bMarkedObjRectDirty=true;
2062 2628 : bMarkedPointsRectsDirty=true;
2063 : #ifdef DBG_UTIL
2064 : if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
2065 : #endif
2066 2628 : bool bOneEdgeMarked=false;
2067 2628 : if (GetMarkedObjectCount()==1) {
2068 193 : const SdrObject* pObj=GetMarkedObjectByIndex(0);
2069 193 : if (pObj->GetObjInventor()==SdrInventor) {
2070 193 : sal_uInt16 nIdent=pObj->GetObjIdentifier();
2071 193 : bOneEdgeMarked=nIdent==OBJ_EDGE;
2072 : }
2073 : }
2074 2628 : ImpSetGlueVisible4(bOneEdgeMarked);
2075 2628 : }
2076 :
2077 :
2078 :
2079 0 : void SdrMarkView::SetMoveOutside(bool bOn)
2080 : {
2081 0 : aHdl.SetMoveOutside(bOn);
2082 0 : }
2083 :
2084 6120 : void SdrMarkView::SetDesignMode( bool _bOn )
2085 : {
2086 6120 : if ( bDesignMode != _bOn )
2087 : {
2088 5529 : bDesignMode = _bOn;
2089 5529 : SdrPageView* pPageView = GetSdrPageView();
2090 5529 : if ( pPageView )
2091 14 : pPageView->SetDesignMode( _bOn );
2092 : }
2093 6120 : }
2094 :
2095 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|