LibreOffice Module svx (master)  1
svdmrkv.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 
21 #include <svx/svdmrkv.hxx>
22 #include <svx/svdview.hxx>
23 #include <svx/svdpagv.hxx>
24 #include <svx/svdpage.hxx>
25 #include <svx/svdotable.hxx>
26 
27 #include <osl/thread.h>
28 #include <svx/svdoole2.hxx>
29 #include <svx/xgrad.hxx>
30 #include <svx/xfillit0.hxx>
31 #include <svx/xflgrit.hxx>
32 #include "gradtrns.hxx"
33 #include <svx/xflftrit.hxx>
34 #include <svx/dialmgr.hxx>
35 #include <svx/strings.hrc>
36 #include <svx/svdundo.hxx>
37 #include <svx/svdopath.hxx>
38 #include <svx/scene3d.hxx>
39 #include <svx/svdovirt.hxx>
44 #include <svx/sdrpaintwindow.hxx>
45 #include <svx/sdrpagewindow.hxx>
46 #include <svx/sdrhittesthelper.hxx>
47 #include <vcl/uitest/logger.hxx>
49 
50 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
51 #include <comphelper/lok.hxx>
52 #include <sfx2/lokhelper.hxx>
53 #include <sfx2/lokcharthelper.hxx>
54 #include <sfx2/viewsh.hxx>
55 
56 #include <array>
57 
58 #include <com/sun/star/view/XSelectionSupplier.hpp>
59 
60 #include <boost/property_tree/json_parser.hpp>
61 
62 using namespace com::sun::star;
63 
64 // Migrate Marking of Objects, Points and GluePoints
65 
67 {
68  // The OverlayObjects
70 
71  // The remembered second position in logical coordinates
73 
74  // A flag to remember if the action is for unmarking.
75  bool mbUnmarking : 1;
76 
77 public:
78  ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, bool bUnmarking);
79 
80  // The OverlayObjects are cleared using the destructor of OverlayObjectList.
81  // That destructor calls clear() at the list which removes all objects from the
82  // OverlayManager and deletes them.
83 
84  void SetSecondPosition(const basegfx::B2DPoint& rNewPosition);
85  bool IsUnmarking() const { return mbUnmarking; }
86 };
87 
88 ImplMarkingOverlay::ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, bool bUnmarking)
89 : maSecondPosition(rStartPos),
90  mbUnmarking(bUnmarking)
91 {
93  return; // We do client-side object manipulation with the Kit API
94 
95  for(sal_uInt32 a(0); a < rView.PaintWindowCount(); a++)
96  {
97  SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
98  const rtl::Reference< sdr::overlay::OverlayManager >& xTargetOverlay = pCandidate->GetOverlayManager();
99 
100  if (xTargetOverlay.is())
101  {
102  std::unique_ptr<sdr::overlay::OverlayRollingRectangleStriped> pNew(new sdr::overlay::OverlayRollingRectangleStriped(
103  rStartPos, rStartPos, false));
104  xTargetOverlay->add(*pNew);
105  maObjects.append(std::move(pNew));
106  }
107  }
108 }
109 
111 {
112  if(rNewPosition != maSecondPosition)
113  {
114  // apply to OverlayObjects
115  for(sal_uInt32 a(0); a < maObjects.count(); a++)
116  {
118  rCandidate.setSecondPosition(rNewPosition);
119  }
120 
121  // remember new position
122  maSecondPosition = rNewPosition;
123  }
124 }
125 
126 
127 // MarkView
128 
129 
131 {
135  mbDesignMode=false;
136  mpMarkedObj=nullptr;
137  mpMarkedPV=nullptr;
138  mbForceFrameHandles=false;
139  mbPlusHdlAlways=false;
141  mbInsPolyPoint=false;
142  mbMarkedObjRectDirty=false;
144  mbMarkHandlesHidden = false;
145  mbMrkPntDirty=false;
146 
147  // Migrate selections
148  BrkMarkObj();
149  BrkMarkPoints();
151 }
152 
154  SdrModel& rSdrModel,
155  OutputDevice* pOut)
156 : SdrSnapView(rSdrModel, pOut),
157  mpMarkObjOverlay(nullptr),
158  mpMarkPointsOverlay(nullptr),
159  mpMarkGluePointsOverlay(nullptr),
160  maHdlList(this)
161 {
162  ImpClearVars();
163  StartListening(rSdrModel);
164 }
165 
167 {
168  // Migrate selections
169  BrkMarkObj();
170  BrkMarkPoints();
172 }
173 
175 {
176  if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
177  {
178  const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
179  SdrHintKind eKind=pSdrHint->GetKind();
181  {
184  }
185  }
186  SdrSnapView::Notify(rBC,rHint);
187 }
188 
190 {
195  // Example: Obj is selected and maMarkedObjectList is sorted.
196  // In another View 2, the ObjOrder is changed (e. g. MovToTop())
197  // Then we need to re-sort MarkList.
200  mbMrkPntDirty=true;
201  UndirtyMrkPnt();
202  SdrView* pV=static_cast<SdrView*>(this);
203  if (pV!=nullptr && !pV->IsDragObj() && !pV->IsInsObjPoint()) {
204  AdjustMarkHdl();
205  }
206 
208  {
209  //TODO: Is MarkedObjRect valid at this point?
210  tools::Rectangle aSelection(GetMarkedObjRect());
211  OString sSelection;
212  if (aSelection.IsEmpty())
213  sSelection = "EMPTY";
214  else
215  {
216  sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
217  if (nTotalPaintWindows == 1)
218  {
219  const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
220  if (pWin && pWin->IsChart())
221  {
222  const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
223  if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
224  {
225  Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
226  Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
227  aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
228  }
229  }
230  }
231 
232  // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
233  if (mpMarkedPV)
234  {
235  if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
236  {
237  if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
238  aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
239  }
240  }
241 
242  sSelection = aSelection.toString();
243  }
244 
245  if(SfxViewShell* pViewShell = GetSfxViewShell())
246  SfxLokHelper::notifyInvalidation(pViewShell, sSelection);
247  }
248 }
249 
250 
252 {
254 }
255 
256 void SdrMarkView::MovAction(const Point& rPnt)
257 {
259 
260  if(IsMarkObj())
261  {
262  MovMarkObj(rPnt);
263  }
264  else if(IsMarkPoints())
265  {
266  MovMarkPoints(rPnt);
267  }
268  else if(IsMarkGluePoints())
269  {
270  MovMarkGluePoints(rPnt);
271  }
272 }
273 
275 {
276  if(IsMarkObj())
277  {
278  EndMarkObj();
279  }
280  else if(IsMarkPoints())
281  {
282  EndMarkPoints();
283  }
284  else if(IsMarkGluePoints())
285  {
287  }
288 
290 }
291 
293 {
295  BrkMarkObj();
296  BrkMarkPoints();
298 }
299 
301 {
303  BrkMarkObj();
304  BrkMarkPoints();
306 }
307 
309 {
310  if(IsMarkObj() || IsMarkPoints() || IsMarkGluePoints())
311  {
313  }
314  else
315  {
317  }
318 }
319 
320 
322 {
323  UnmarkAllObj();
325 }
326 
328 {
329  bool bMrkChg(false);
330 
331  SdrPageView* pPageView = GetSdrPageView();
332  if (pPageView)
333  {
334  // break all creation actions when hiding page (#75081#)
335  BrkAction();
336 
337  // Discard all selections on this page
338  bMrkChg = GetMarkedObjectListWriteAccess().DeletePageView(*pPageView);
339  }
340 
342 
343  if(bMrkChg)
344  {
346  AdjustMarkHdl();
347  }
348 }
349 
350 
351 void SdrMarkView::BegMarkObj(const Point& rPnt, bool bUnmark)
352 {
353  BrkAction();
354 
355  DBG_ASSERT(nullptr == mpMarkObjOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkObjOverlay (!)");
356 
357  basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
358  mpMarkObjOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
359 
360  maDragStat.Reset(rPnt);
363 }
364 
365 void SdrMarkView::MovMarkObj(const Point& rPnt)
366 {
367  if(IsMarkObj() && maDragStat.CheckMinMoved(rPnt))
368  {
369  maDragStat.NextMove(rPnt);
370  DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
371  basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
373  }
374 }
375 
377 {
378  bool bRetval(false);
379 
380  if(IsMarkObj())
381  {
382  if(maDragStat.IsMinMoved())
383  {
385  aRect.Justify();
387  bRetval = true;
388  }
389 
390  // cleanup
391  BrkMarkObj();
392  }
393 
394  return bRetval;
395 }
396 
398 {
399  if(IsMarkObj())
400  {
401  DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
402  delete mpMarkObjOverlay;
403  mpMarkObjOverlay = nullptr;
404  }
405 }
406 
407 
408 bool SdrMarkView::BegMarkPoints(const Point& rPnt, bool bUnmark)
409 {
410  if(HasMarkablePoints())
411  {
412  BrkAction();
413 
414  DBG_ASSERT(nullptr == mpMarkPointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkPointsOverlay (!)");
415  basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
416  mpMarkPointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
417 
418  maDragStat.Reset(rPnt);
421 
422  return true;
423  }
424 
425  return false;
426 }
427 
428 void SdrMarkView::MovMarkPoints(const Point& rPnt)
429 {
430  if(IsMarkPoints() && maDragStat.CheckMinMoved(rPnt))
431  {
432  maDragStat.NextMove(rPnt);
433 
434  DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
435  basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
437  }
438 }
439 
441 {
442  bool bRetval(false);
443 
444  if(IsMarkPoints())
445  {
446  if(maDragStat.IsMinMoved())
447  {
449  aRect.Justify();
451 
452  bRetval = true;
453  }
454 
455  // cleanup
456  BrkMarkPoints();
457  }
458 
459  return bRetval;
460 }
461 
463 {
464  if(IsMarkPoints())
465  {
466  DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
467  delete mpMarkPointsOverlay;
468  mpMarkPointsOverlay = nullptr;
469  }
470 }
471 
472 
473 bool SdrMarkView::BegMarkGluePoints(const Point& rPnt, bool bUnmark)
474 {
476  {
477  BrkAction();
478 
479  DBG_ASSERT(nullptr == mpMarkGluePointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkGluePointsOverlay (!)");
480 
481  basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
482  mpMarkGluePointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
483  maDragStat.Reset(rPnt);
486 
487  return true;
488  }
489 
490  return false;
491 }
492 
493 void SdrMarkView::MovMarkGluePoints(const Point& rPnt)
494 {
496  {
497  maDragStat.NextMove(rPnt);
498 
499  DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
500  basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
502  }
503 }
504 
506 {
507  if(IsMarkGluePoints())
508  {
509  if(maDragStat.IsMinMoved())
510  {
512  aRect.Justify();
514  }
515 
516  // cleanup
518  }
519 }
520 
522 {
523  if(IsMarkGluePoints())
524  {
525  DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
527  mpMarkGluePointsOverlay = nullptr;
528  }
529 }
530 
532 {
533  SdrPageView* pPV = GetSdrPageView();
534  if (!pPV)
535  return false;
536 
537  SdrObjList* pOL=pPV->GetObjList();
538  const size_t nObjCount = pOL->GetObjCount();
539  for (size_t nObjNum=0; nObjNum<nObjCount; ++nObjNum) {
540  SdrObject* pObj=pOL->GetObj(nObjNum);
541  if (IsObjMarkable(pObj,pPV) && --n<0)
542  return true;
543  }
544 
545  return false;
546 }
547 
549 {
551  {
552  mbMarkHandlesHidden = true;
553  AdjustMarkHdl();
554  }
555 }
556 
558 {
560  {
561  mbMarkHandlesHidden = false;
562  AdjustMarkHdl();
563  }
564 }
565 
567 {
568  const size_t nMarkCount=GetMarkedObjectCount();
569  bool bFrmHdl=nMarkCount>static_cast<size_t>(mnFrameHandlesLimit) || mbForceFrameHandles;
570  bool bStdDrag=meDragMode==SdrDragMode::Move;
571  if (nMarkCount==1 && bStdDrag && bFrmHdl)
572  {
573  const SdrObject* pObj=GetMarkedObjectByIndex(0);
575  {
576  sal_uInt16 nIdent=pObj->GetObjIdentifier();
577  if (nIdent==OBJ_LINE || nIdent==OBJ_EDGE || nIdent==OBJ_CAPTION || nIdent==OBJ_MEASURE || nIdent==OBJ_CUSTOMSHAPE || nIdent==OBJ_TABLE )
578  {
579  bFrmHdl=false;
580  }
581  }
582  }
583  if (!bStdDrag && !bFrmHdl) {
584  // all other drag modes only with FrameHandles
585  bFrmHdl=true;
587  // when rotating, use ObjOwn drag, if there's at least 1 PolyObj
588  for (size_t nMarkNum=0; nMarkNum<nMarkCount && bFrmHdl; ++nMarkNum) {
589  const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
590  const SdrObject* pObj=pM->GetMarkedSdrObj();
591  bFrmHdl=!pObj->IsPolyObj();
592  }
593  }
594  }
595  if (!bFrmHdl) {
596  // FrameHandles, if at least 1 Obj can't do SpecialDrag
597  for (size_t nMarkNum=0; nMarkNum<nMarkCount && !bFrmHdl; ++nMarkNum) {
598  const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
599  const SdrObject* pObj=pM->GetMarkedSdrObj();
600  bFrmHdl=!pObj->hasSpecialDrag();
601  }
602  }
603 
604  // no FrameHdl for crop
605  if(bFrmHdl && SdrDragMode::Crop == meDragMode)
606  {
607  bFrmHdl = false;
608  }
609 
610  return bFrmHdl;
611 }
612 
613 namespace
614 {
615 OUString lcl_getDragMethodServiceName( const OUString& rCID )
616 {
617  OUString aRet;
618 
619  sal_Int32 nIndexStart = rCID.indexOf( "DragMethod=" );
620  if( nIndexStart != -1 )
621  {
622  nIndexStart = rCID.indexOf( '=', nIndexStart );
623  if( nIndexStart != -1 )
624  {
625  nIndexStart++;
626  sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
627  if( nNextSlash != -1 )
628  {
629  sal_Int32 nIndexEnd = nNextSlash;
630  sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
631  if( nNextColon < nNextSlash )
632  nIndexEnd = nNextColon;
633  aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
634  }
635  }
636  }
637  return aRet;
638 }
639 
640 OUString lcl_getDragParameterString( const OUString& rCID )
641 {
642  OUString aRet;
643 
644  sal_Int32 nIndexStart = rCID.indexOf( "DragParameter=" );
645  if( nIndexStart != -1 )
646  {
647  nIndexStart = rCID.indexOf( '=', nIndexStart );
648  if( nIndexStart != -1 )
649  {
650  nIndexStart++;
651  sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
652  if( nNextSlash != -1 )
653  {
654  sal_Int32 nIndexEnd = nNextSlash;
655  sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
656  if( nNextColon < nNextSlash )
657  nIndexEnd = nNextColon;
658  aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
659  }
660  }
661  }
662  return aRet;
663 }
664 } // anonymous namespace
665 
667 {
668  // remember old focus handle values to search for it again
669  const SdrHdl* pSaveOldFocusHdl = maHdlList.GetFocusHdl();
670  bool bSaveOldFocus(false);
671  sal_uInt32 nSavePolyNum(0), nSavePointNum(0);
672  SdrHdlKind eSaveKind(SdrHdlKind::Move);
673  SdrObject* pSaveObj = nullptr;
674 
675  if(pSaveOldFocusHdl
676  && pSaveOldFocusHdl->GetObj()
677  && dynamic_cast<const SdrPathObj*>(pSaveOldFocusHdl->GetObj()) != nullptr
678  && (pSaveOldFocusHdl->GetKind() == SdrHdlKind::Poly || pSaveOldFocusHdl->GetKind() == SdrHdlKind::BezierWeight))
679  {
680  bSaveOldFocus = true;
681  nSavePolyNum = pSaveOldFocusHdl->GetPolyNum();
682  nSavePointNum = pSaveOldFocusHdl->GetPointNum();
683  pSaveObj = pSaveOldFocusHdl->GetObj();
684  eSaveKind = pSaveOldFocusHdl->GetKind();
685  }
686 
687  // delete/clear all handles. This will always be done, even with areMarkHandlesHidden()
688  maHdlList.Clear();
691  mpMarkedObj=nullptr;
692  mpMarkedPV=nullptr;
693 
694  // are handles enabled at all? Create only then
696  return;
697 
698  // There can be multiple mark views, but we're only interested in the one that has a window associated.
700 
701  const size_t nMarkCount=GetMarkedObjectCount();
702  bool bStdDrag=meDragMode==SdrDragMode::Move;
703  bool bSingleTextObjMark=false;
704  bool bLimitedRotation(false);
705 
706  if (nMarkCount==1)
707  {
709 
710  if(nullptr != mpMarkedObj)
711  {
712  bSingleTextObjMark =
713  dynamic_cast<const SdrTextObj*>( mpMarkedObj) != nullptr &&
714  static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame();
715 
716  // RotGrfFlyFrame: we may have limited rotation
717  bLimitedRotation = SdrDragMode::Rotate == meDragMode && mpMarkedObj->HasLimitedRotation();
718  }
719  }
720 
721  bool bFrmHdl=ImpIsFrameHandles();
722 
723  if (nMarkCount>0)
724  {
726 
727  for (size_t nMarkNum=0; nMarkNum<nMarkCount && (mpMarkedPV!=nullptr || !bFrmHdl); ++nMarkNum)
728  {
729  const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
730 
731  if (mpMarkedPV!=pM->GetPageView())
732  {
733  mpMarkedPV=nullptr;
734  }
735  }
736  }
737 
738  SfxViewShell* pViewShell = GetSfxViewShell();
739 
740  // check if text edit or ole is active and handles need to be suppressed. This may be the case
741  // when a single object is selected
742  // Using a strict return statement is okay here; no handles means *no* handles.
743  if(mpMarkedObj)
744  {
745  // formerly #i33755#: If TextEdit is active the EditEngine will directly paint
746  // to the window, so suppress Overlay and handles completely; a text frame for
747  // the active text edit will be painted by the repaint mechanism in
748  // SdrObjEditView::ImpPaintOutlinerView in this case. This needs to be reworked
749  // in the future
750  // Also formerly #122142#: Pretty much the same for SdrCaptionObj's in calc.
751  if(static_cast<SdrView*>(this)->IsTextEdit())
752  {
753  const SdrTextObj* pSdrTextObj = dynamic_cast< const SdrTextObj* >(mpMarkedObj);
754 
755  if (pSdrTextObj && pSdrTextObj->IsInEditMode())
756  {
757  if (!bTiledRendering)
758  return;
759  }
760  }
761 
762  // formerly #i118524#: if inplace activated OLE is selected, suppress handles
763  const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(mpMarkedObj);
764 
765  if(pSdrOle2Obj && (pSdrOle2Obj->isInplaceActive() || pSdrOle2Obj->isUiActive()))
766  {
767  return;
768  }
769  }
770 
772 
773  if (bTiledRendering && pViewShell)
774  {
775  tools::Rectangle aSelection(aRect);
776  bool bIsChart = false;
777 
778  if (!aRect.IsEmpty())
779  {
780  sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
781  if (nTotalPaintWindows == 1)
782  {
783  const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
784  if (pWin && pWin->IsChart())
785  {
786  bIsChart = true;
787  const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
788  if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
789  {
790  Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
791  Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
792  aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
793  }
794  }
795  }
796  }
797 
798  if (!aSelection.IsEmpty())
799  {
800  // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
801  if (mpMarkedPV)
802  {
803  if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
804  {
805  if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
806  aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
807  }
808  }
809 
810  // hide the text selection too
811  pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "");
812  }
813 
814  {
815  OString sSelectionText;
816  boost::property_tree::ptree aTableJsonTree;
817  bool bTableSelection = false;
818 
820  {
821  auto& rTableObject = dynamic_cast<sdr::table::SdrTableObj&>(*mpMarkedObj);
822  bTableSelection = rTableObject.createTableEdgesJson(aTableJsonTree);
823  }
824  if (GetMarkedObjectCount())
825  {
826  SdrMark* pM = GetSdrMarkByIndex(0);
827  SdrObject* pO = pM->GetMarkedSdrObj();
828  long nRotAngle = pO->GetRotateAngle();
829  // true if we are dealing with a RotGrfFlyFrame
830  // (SwVirtFlyDrawObj with a SwGrfNode)
831  bool bWriterGraphic = pO->HasLimitedRotation();
832 
833  if (bWriterGraphic)
834  {
835  nRotAngle *= 10;
836  }
837 
838  OStringBuffer aExtraInfo;
839 
840  aExtraInfo.append("{\"id\":\"");
841  aExtraInfo.append(OString::number(reinterpret_cast<sal_IntPtr>(pO)));
842  aExtraInfo.append("\",\"type\":");
843  aExtraInfo.append(OString::number(pO->GetObjIdentifier()));
844 
845  if (bWriterGraphic)
846  {
847  aExtraInfo.append(", \"isWriterGraphic\": true");
848  }
849  else if (bIsChart)
850  {
851  LokChartHelper aChartHelper(pViewShell);
852  css::uno::Reference<css::frame::XController>& xChartController = aChartHelper.GetXController();
853  css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier( xChartController, uno::UNO_QUERY);
854  if (xSelectionSupplier.is())
855  {
856  uno::Any aSel = xSelectionSupplier->getSelection();
857  OUString aValue;
858  if (aSel >>= aValue)
859  {
860  OString aObjectCID(aValue.getStr(), aValue.getLength(), osl_getThreadTextEncoding());
861  const std::vector<OString> aProps{"Draggable", "Resizable", "Rotatable"};
862  for (const auto& rProp: aProps)
863  {
864  sal_Int32 nPos = aObjectCID.indexOf(rProp);
865  if (nPos == -1) continue;
866  nPos += rProp.getLength() + 1; // '='
867  if (aExtraInfo.getLength() > 2) // != "{ "
868  aExtraInfo.append(", ");
869  aExtraInfo.append("\"is");
870  aExtraInfo.append(rProp);
871  aExtraInfo.append("\": ");
872  aExtraInfo.append(OString::boolean(aObjectCID[nPos] == '1'));
873  }
874 
875  OUString sDragMethod = lcl_getDragMethodServiceName(aValue);
876  if (sDragMethod == "PieSegmentDragging")
877  {
878  // old initial offset inside the CID returned by xSelectionSupplier->getSelection()
879  // after a pie segment dragging; using SdrObject::GetName for getting a CID with the updated offset
880  aValue = pO->GetName();
881  OUString sDragParameters = lcl_getDragParameterString(aValue);
882  if (!sDragParameters.isEmpty())
883  {
884  aExtraInfo.append(", \"dragInfo\": { ");
885  aExtraInfo.append("\"dragMethod\": \"");
886  aExtraInfo.append(sDragMethod.toUtf8());
887  aExtraInfo.append("\"");
888 
889  OUString sParam;
890  sal_Int32 nStartIndex = 0;
891  std::array<int, 5> aDragParameters;
892  for (auto& rParam : aDragParameters)
893  {
894  sParam = sDragParameters.getToken(0, ',', nStartIndex);
895  if (sParam.isEmpty())
896  break;
897  rParam = sParam.toInt32();
898  }
899 
900  // initial offset in %
901  if (aDragParameters[0] < 0)
902  aDragParameters[0] = 0;
903  else if (aDragParameters[0] > 100)
904  aDragParameters[0] = 100;
905 
906  aExtraInfo.append(", \"initialOffset\": ");
907  aExtraInfo.append(OString::number(aDragParameters[0]));
908 
909  // drag direction constraint
910  Point aMinPos(aDragParameters[1], aDragParameters[2]);
911  Point aMaxPos(aDragParameters[3], aDragParameters[4]);
912  Point aDragDirection = aMaxPos - aMinPos;
913  aDragDirection = OutputDevice::LogicToLogic(aDragDirection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
914 
915  aExtraInfo.append(", \"dragDirection\": [");
916  aExtraInfo.append(aDragDirection.toString());
917  aExtraInfo.append("]");
918 
919  // polygon approximating the pie segment or donut segment
920  if (pO->GetObjIdentifier() == OBJ_PATHFILL)
921  {
922  const basegfx::B2DPolyPolygon aPolyPolygon(pO->TakeXorPoly());
923  if (aPolyPolygon.count() == 1)
924  {
925  const basegfx::B2DPolygon aPolygon = aPolyPolygon.getB2DPolygon(0);
926  if (sal_uInt32 nPolySize = aPolygon.count())
927  {
928  const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
929  const vcl::Window* pViewShellWindow = pViewShell->GetEditWindowForActiveOLEObj();
930  if (pWin && pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
931  {
932  // in the following code escaping sequences used inside raw literal strings
933  // are for making them understandable by the JSON parser
934 
935  Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
936  Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
937  OString sPolygonElem("<polygon points=\\\"");
938  for (sal_uInt32 nIndex = 0; nIndex < nPolySize; ++nIndex)
939  {
940  const basegfx::B2DPoint aB2Point = aPolygon.getB2DPoint(nIndex);
941  Point aPoint(aB2Point.getX(), aB2Point.getY());
942  aPoint.Move(aLogicOffset.getX(), aLogicOffset.getY());
943  if (nIndex > 0)
944  sPolygonElem += " ";
945  sPolygonElem += aPoint.toString();
946  }
947  sPolygonElem += R"elem(\" style=\"stroke: none; fill: rgb(114,159,207); fill-opacity: 0.8\"/>)elem";
948 
949  aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
950 
951  OString sSVGElem = R"elem(<svg version=\"1.2\" width=\")elem" +
952  OString::number(aSelection.GetWidth() / 100.0) +
953  R"elem(mm\" height=\")elem" +
954  OString::number(aSelection.GetHeight() / 100.0) +
955  R"elem(mm\" viewBox=\")elem" +
956  aSelection.toString() +
957  R"elem(\" preserveAspectRatio=\"xMidYMid\" xmlns=\"http://www.w3.org/2000/svg\">)elem";
958 
959  aExtraInfo.append(", \"svg\": \"");
960  aExtraInfo.append(sSVGElem);
961  aExtraInfo.append("\\n ");
962  aExtraInfo.append(sPolygonElem);
963  aExtraInfo.append("\\n</svg>");
964  aExtraInfo.append("\""); // svg
965  }
966  }
967  }
968  }
969  aExtraInfo.append("}"); // dragInfo
970  }
971  }
972  }
973  }
974  }
975  aExtraInfo.append("}");
976 
977  sSelectionText = aSelection.toString() +
978  ", " + OString::number(nRotAngle);
979  if (!aExtraInfo.isEmpty())
980  {
981  sSelectionText += ", " + aExtraInfo.makeStringAndClear();
982  }
983  }
984 
985  if (sSelectionText.isEmpty())
986  sSelectionText = "EMPTY";
987 
988  if (bTableSelection)
989  {
990  boost::property_tree::ptree aTableRectangle;
991  aTableRectangle.put("x", aSelection.Left());
992  aTableRectangle.put("y", aSelection.Top());
993  aTableRectangle.put("width", aSelection.GetWidth());
994  aTableRectangle.put("height", aSelection.GetHeight());
995  aTableJsonTree.push_back(std::make_pair("rectangle", aTableRectangle));
996 
997  std::stringstream aStream;
998  boost::property_tree::write_json(aStream, aTableJsonTree);
999  pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, aStream.str().c_str());
1000  }
1001  else
1002  {
1003  pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, "{}");
1004  }
1005 
1006  if (pOtherShell)
1007  {
1008  // Another shell wants to know about our existing
1009  // selection.
1010  if (pViewShell != pOtherShell)
1011  SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelectionText);
1012  }
1013  else
1014  {
1015  // We have a new selection, so both pViewShell and the
1016  // other views want to know about it.
1017  pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelectionText.getStr());
1018  SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelectionText);
1019  }
1020  }
1021  }
1022 
1023  if (bFrmHdl)
1024  {
1025  if(!aRect.IsEmpty())
1026  {
1027  // otherwise nothing is found
1028  const size_t nSiz0(maHdlList.GetHdlCount());
1029 
1030  if( bSingleTextObjMark )
1031  {
1033  }
1034  else
1035  {
1036  const bool bWdt0(aRect.Left() == aRect.Right());
1037  const bool bHgt0(aRect.Top() == aRect.Bottom());
1038 
1039  if (bWdt0 && bHgt0)
1040  {
1041  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.TopLeft(), SdrHdlKind::UpperLeft));
1042  }
1043  else if (!bStdDrag && (bWdt0 || bHgt0))
1044  {
1045  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.TopLeft(), SdrHdlKind::UpperLeft));
1046  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.BottomRight(), SdrHdlKind::LowerRight));
1047  }
1048  else
1049  {
1050  if (!bWdt0 && !bHgt0)
1051  {
1052  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.TopLeft(), SdrHdlKind::UpperLeft));
1053  }
1054 
1055  if (!bLimitedRotation && !bHgt0)
1056  {
1057  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.TopCenter(), SdrHdlKind::Upper));
1058  }
1059 
1060  if (!bWdt0 && !bHgt0)
1061  {
1062  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.TopRight(), SdrHdlKind::UpperRight));
1063  }
1064 
1065  if (!bLimitedRotation && !bWdt0)
1066  {
1067  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.LeftCenter(), SdrHdlKind::Left ));
1068  }
1069 
1070  if (!bLimitedRotation && !bWdt0)
1071  {
1072  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.RightCenter(), SdrHdlKind::Right));
1073  }
1074 
1075  if (!bWdt0 && !bHgt0)
1076  {
1077  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.BottomLeft(), SdrHdlKind::LowerLeft));
1078  }
1079 
1080  if (!bLimitedRotation && !bHgt0)
1081  {
1082  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.BottomCenter(), SdrHdlKind::Lower));
1083  }
1084 
1085  if (!bWdt0 && !bHgt0)
1086  {
1087  maHdlList.AddHdl(std::make_unique<SdrHdl>(aRect.BottomRight(), SdrHdlKind::LowerRight));
1088  }
1089  }
1090  }
1091 
1092  const size_t nSiz1(maHdlList.GetHdlCount());
1093 
1094  // moved setting the missing parameters at SdrHdl here from the
1095  // single loop above (bSingleTextObjMark), this was missing all
1096  // the time. Setting SdrObject is now required to correctly get
1097  // the View-Dependent evtl. GridOffset adapted
1098  for (size_t i=nSiz0; i<nSiz1; ++i)
1099  {
1100  SdrHdl* pHdl=maHdlList.GetHdl(i);
1101  pHdl->SetObj(mpMarkedObj);
1102  pHdl->SetPageView(mpMarkedPV);
1103  pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
1104  }
1105  }
1106  }
1107  else
1108  {
1109  bool bDone(false);
1110 
1111  // moved crop handling to non-frame part and the handle creation to SdrGrafObj
1112  if(1 == nMarkCount && mpMarkedObj && SdrDragMode::Crop == meDragMode)
1113  {
1114  // Default addCropHandles from SdrObject does nothing. When pMarkedObj is SdrGrafObj, previous
1115  // behaviour occurs (code in svx/source/svdraw/svdograf.cxx). When pMarkedObj is SwVirtFlyDrawObj
1116  // writer takes the responsibility of adding handles (code in sw/source/core/draw/dflyobj.cxx)
1117  const size_t nSiz0(maHdlList.GetHdlCount());
1119  const size_t nSiz1(maHdlList.GetHdlCount());
1120 
1121  // Was missing: Set infos at SdrCropHdl
1122  for (size_t i=nSiz0; i<nSiz1; ++i)
1123  {
1124  SdrHdl* pHdl=maHdlList.GetHdl(i);
1125  pHdl->SetObj(mpMarkedObj);
1126  pHdl->SetPageView(mpMarkedPV);
1127  pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
1128  }
1129 
1130  bDone = true;
1131  }
1132 
1133  if(!bDone)
1134  {
1135  for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
1136  {
1137  const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
1138  SdrObject* pObj=pM->GetMarkedSdrObj();
1139  SdrPageView* pPV=pM->GetPageView();
1140  const size_t nSiz0=maHdlList.GetHdlCount();
1141  pObj->AddToHdlList(maHdlList);
1142  const size_t nSiz1=maHdlList.GetHdlCount();
1143  bool bPoly=pObj->IsPolyObj();
1144  const SdrUShortCont& rMrkPnts = pM->GetMarkedPoints();
1145  for (size_t i=nSiz0; i<nSiz1; ++i)
1146  {
1147  SdrHdl* pHdl=maHdlList.GetHdl(i);
1148  pHdl->SetObj(pObj);
1149  pHdl->SetPageView(pPV);
1150  pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
1151 
1152  if (bPoly)
1153  {
1154  bool bSelected= rMrkPnts.find( sal_uInt16(i-nSiz0) ) != rMrkPnts.end();
1155  pHdl->SetSelected(bSelected);
1156  if (mbPlusHdlAlways || bSelected)
1157  {
1158  SdrHdlList plusList(nullptr);
1159  pObj->AddToPlusHdlList(plusList, *pHdl);
1160  sal_uInt32 nPlusHdlCnt=plusList.GetHdlCount();
1161  for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusHdlCnt; nPlusNum++)
1162  {
1163  SdrHdl* pPlusHdl=plusList.GetHdl(nPlusNum);
1164  pPlusHdl->SetObj(pObj);
1165  pPlusHdl->SetPageView(pPV);
1166  pPlusHdl->SetPlusHdl(true);
1167  }
1168  plusList.MoveTo(maHdlList);
1169  }
1170  }
1171  }
1172  }
1173  }
1174  }
1175 
1176  // GluePoint handles
1177  for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
1178  {
1179  const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
1180  SdrObject* pObj=pM->GetMarkedSdrObj();
1181  const SdrGluePointList* pGPL=pObj->GetGluePointList();
1182  if (!pGPL)
1183  continue;
1184 
1185  SdrPageView* pPV=pM->GetPageView();
1186  const SdrUShortCont& rMrkGlue=pM->GetMarkedGluePoints();
1187  for (sal_uInt16 nId : rMrkGlue)
1188  {
1189  //nNum changed to nNumGP because already used in for loop
1190  sal_uInt16 nNumGP=pGPL->FindGluePoint(nId);
1191  if (nNumGP!=SDRGLUEPOINT_NOTFOUND)
1192  {
1193  const SdrGluePoint& rGP=(*pGPL)[nNumGP];
1194  Point aPos(rGP.GetAbsolutePos(*pObj));
1195  std::unique_ptr<SdrHdl> pGlueHdl(new SdrHdl(aPos,SdrHdlKind::Glue));
1196  pGlueHdl->SetObj(pObj);
1197  pGlueHdl->SetPageView(pPV);
1198  pGlueHdl->SetObjHdlNum(nId);
1199  maHdlList.AddHdl(std::move(pGlueHdl));
1200  }
1201  }
1202  }
1203 
1204  // rotation point/axis of reflection
1205  if(!bLimitedRotation)
1206  {
1208  }
1209 
1210  // sort handles
1211  maHdlList.Sort();
1212 
1213  // add custom handles (used by other apps, e.g. AnchorPos)
1214  AddCustomHdl();
1215 
1216  // try to restore focus handle index from remembered values
1217  if(bSaveOldFocus)
1218  {
1219  for(size_t a = 0; a < maHdlList.GetHdlCount(); ++a)
1220  {
1221  SdrHdl* pCandidate = maHdlList.GetHdl(a);
1222 
1223  if(pCandidate->GetObj()
1224  && pCandidate->GetObj() == pSaveObj
1225  && pCandidate->GetKind() == eSaveKind
1226  && pCandidate->GetPolyNum() == nSavePolyNum
1227  && pCandidate->GetPointNum() == nSavePointNum)
1228  {
1229  maHdlList.SetFocusHdl(pCandidate);
1230  break;
1231  }
1232  }
1233  }
1234 }
1235 
1237 {
1238  // add custom handles (used by other apps, e.g. AnchorPos)
1239 }
1240 
1242 {
1243  SdrDragMode eMode0=meDragMode;
1244  meDragMode=eMode;
1246  if (meDragMode!=eMode0) {
1247  ForceRefToMarked();
1248  SetMarkHandles(nullptr);
1249  {
1251  }
1252  }
1253 }
1254 
1256 {
1257  switch(eMode)
1258  {
1259  case SdrDragMode::Rotate:
1260  {
1261  // add rotation center
1262  maHdlList.AddHdl(std::make_unique<SdrHdl>(maRef1, SdrHdlKind::Ref1));
1263  break;
1264  }
1265  case SdrDragMode::Mirror:
1266  {
1267  // add axis of reflection
1268  std::unique_ptr<SdrHdl> pHdl3(new SdrHdl(maRef2, SdrHdlKind::Ref2));
1269  std::unique_ptr<SdrHdl> pHdl2(new SdrHdl(maRef1, SdrHdlKind::Ref1));
1270  std::unique_ptr<SdrHdl> pHdl1(new SdrHdlLine(*pHdl2, *pHdl3, SdrHdlKind::MirrorAxis));
1271 
1272  pHdl1->SetObjHdlNum(1); // for sorting
1273  pHdl2->SetObjHdlNum(2); // for sorting
1274  pHdl3->SetObjHdlNum(3); // for sorting
1275 
1276  maHdlList.AddHdl(std::move(pHdl1)); // line comes first, so it is the last in HitTest
1277  maHdlList.AddHdl(std::move(pHdl2));
1278  maHdlList.AddHdl(std::move(pHdl3));
1279 
1280  break;
1281  }
1283  {
1284  // add interactive transparency handle
1285  const size_t nMarkCount = GetMarkedObjectCount();
1286  if(nMarkCount == 1)
1287  {
1288  SdrObject* pObj = GetMarkedObjectByIndex(0);
1289  SdrModel* pModel = GetModel();
1290  const SfxItemSet& rSet = pObj->GetMergedItemSet();
1291 
1292  if(SfxItemState::SET != rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, false))
1293  {
1294  // add this item, it's not yet there
1296  XGradient aGrad = aNewItem.GetGradientValue();
1297 
1298  aNewItem.SetEnabled(true);
1299  aGrad.SetStartIntens(100);
1300  aGrad.SetEndIntens(100);
1301  aNewItem.SetGradientValue(aGrad);
1302 
1303  // add undo to allow user to take back this step
1304  if( pModel->IsUndoEnabled() )
1305  {
1306  pModel->BegUndo(SvxResId(SIP_XA_FILLTRANSPARENCE));
1307  pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
1308  pModel->EndUndo();
1309  }
1310 
1311  SfxItemSet aNewSet(pModel->GetItemPool());
1312  aNewSet.Put(aNewItem);
1313  pObj->SetMergedItemSetAndBroadcast(aNewSet);
1314  }
1315 
1316  // set values and transform to vector set
1317  GradTransVector aGradTransVector;
1318  GradTransGradient aGradTransGradient;
1319 
1320  aGradTransGradient.aGradient = rSet.Get(XATTR_FILLFLOATTRANSPARENCE).GetGradientValue();
1321  GradTransformer::GradToVec(aGradTransGradient, aGradTransVector, pObj);
1322 
1323  // build handles
1324  const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
1325  const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
1326  std::unique_ptr<SdrHdlColor> pColHdl1(new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, SDR_HANDLE_COLOR_SIZE_NORMAL, true));
1327  std::unique_ptr<SdrHdlColor> pColHdl2(new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, SDR_HANDLE_COLOR_SIZE_NORMAL, true));
1328  std::unique_ptr<SdrHdlGradient> pGradHdl(new SdrHdlGradient(aTmpPos1, aTmpPos2, false));
1329  DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Could not get all necessary handles!");
1330 
1331  // link them
1332  pGradHdl->SetColorHandles(pColHdl1.get(), pColHdl2.get());
1333  pGradHdl->SetObj(pObj);
1334  pColHdl1->SetColorChangeHdl(LINK(pGradHdl.get(), SdrHdlGradient, ColorChangeHdl));
1335  pColHdl2->SetColorChangeHdl(LINK(pGradHdl.get(), SdrHdlGradient, ColorChangeHdl));
1336 
1337  // insert them
1338  maHdlList.AddHdl(std::move(pColHdl1));
1339  maHdlList.AddHdl(std::move(pColHdl2));
1340  maHdlList.AddHdl(std::move(pGradHdl));
1341  }
1342  break;
1343  }
1344  case SdrDragMode::Gradient:
1345  {
1346  // add interactive gradient handle
1347  const size_t nMarkCount = GetMarkedObjectCount();
1348  if(nMarkCount == 1)
1349  {
1350  SdrObject* pObj = GetMarkedObjectByIndex(0);
1351  const SfxItemSet& rSet = pObj->GetMergedItemSet();
1352  drawing::FillStyle eFillStyle = rSet.Get(XATTR_FILLSTYLE).GetValue();
1353 
1354  if(eFillStyle == drawing::FillStyle_GRADIENT)
1355  {
1356  // set values and transform to vector set
1357  GradTransVector aGradTransVector;
1358  GradTransGradient aGradTransGradient;
1359  Size aHdlSize(15, 15);
1360 
1361  aGradTransGradient.aGradient = rSet.Get(XATTR_FILLGRADIENT).GetGradientValue();
1362  GradTransformer::GradToVec(aGradTransGradient, aGradTransVector, pObj);
1363 
1364  // build handles
1365  const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
1366  const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
1367  std::unique_ptr<SdrHdlColor> pColHdl1(new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, aHdlSize, false));
1368  std::unique_ptr<SdrHdlColor> pColHdl2(new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, aHdlSize, false));
1369  std::unique_ptr<SdrHdlGradient> pGradHdl(new SdrHdlGradient(aTmpPos1, aTmpPos2, true));
1370  DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Could not get all necessary handles!");
1371 
1372  // link them
1373  pGradHdl->SetColorHandles(pColHdl1.get(), pColHdl2.get());
1374  pGradHdl->SetObj(pObj);
1375  pColHdl1->SetColorChangeHdl(LINK(pGradHdl.get(), SdrHdlGradient, ColorChangeHdl));
1376  pColHdl2->SetColorChangeHdl(LINK(pGradHdl.get(), SdrHdlGradient, ColorChangeHdl));
1377 
1378  // insert them
1379  maHdlList.AddHdl(std::move(pColHdl1));
1380  maHdlList.AddHdl(std::move(pColHdl2));
1381  maHdlList.AddHdl(std::move(pGradHdl));
1382  }
1383  }
1384  break;
1385  }
1386  case SdrDragMode::Crop:
1387  {
1388  // TODO
1389  break;
1390  }
1391  default: break;
1392  }
1393 }
1394 
1397 {
1398  if(maHdlList.GetHdlCount())
1399  {
1400  SdrHdl* pMouseOverHdl = nullptr;
1401  if( !rMEvt.IsLeaveWindow() && pWin )
1402  {
1403  Point aMDPos( pWin->PixelToLogic( rMEvt.GetPosPixel() ) );
1404  pMouseOverHdl = PickHandle(aMDPos);
1405  }
1406 
1407  // notify last mouse over handle that he lost the mouse
1408  const size_t nHdlCount = maHdlList.GetHdlCount();
1409 
1410  for(size_t nHdl = 0; nHdl < nHdlCount; ++nHdl)
1411  {
1412  SdrHdl* pCurrentHdl = GetHdl(nHdl);
1413  if( pCurrentHdl->mbMouseOver )
1414  {
1415  if( pCurrentHdl != pMouseOverHdl )
1416  {
1417  pCurrentHdl->mbMouseOver = false;
1418  pCurrentHdl->onMouseLeave();
1419  }
1420  break;
1421  }
1422  }
1423 
1424  // notify current mouse over handle
1425  if( pMouseOverHdl )
1426  {
1427  pMouseOverHdl->mbMouseOver = true;
1428  pMouseOverHdl->onMouseEnter(rMEvt);
1429  }
1430  }
1431  return SdrSnapView::MouseMove(rMEvt, pWin);
1432 }
1433 
1435 {
1436  if (maHdlList.GetHdlCount())
1437  {
1438  const size_t nHdlCount = maHdlList.GetHdlCount();
1439 
1440  for (size_t nHdl = 0; nHdl < nHdlCount; ++nHdl)
1441  {
1442  SdrHdl* pCurrentHdl = GetHdl(nHdl);
1443  if (pCurrentHdl->mbMouseOver)
1444  {
1445  pCurrentHdl->onHelpRequest();
1446  return true;
1447  }
1448  }
1449  }
1450  return SdrSnapView::RequestHelp(rHEvt);
1451 }
1452 
1454 {
1455  switch(meDragMode)
1456  {
1457  case SdrDragMode::Rotate:
1458  {
1460  maRef1 = aR.Center();
1461 
1462  break;
1463  }
1464 
1465  case SdrDragMode::Mirror:
1466  {
1467  // first calculate the length of the axis of reflection
1468  long nOutMin=0;
1469  long nOutMax=0;
1470  long nMinLen=0;
1471  long nObjDst=0;
1472  long nOutHgt=0;
1474  if (pOut!=nullptr) {
1475  // minimum length: 50 pixels
1476  nMinLen=pOut->PixelToLogic(Size(0,50)).Height();
1477  // 20 pixels distance to the Obj for the reference point
1478  nObjDst=pOut->PixelToLogic(Size(0,20)).Height();
1479  // MinY/MaxY
1480  // margin = minimum length = 10 pixels
1481  long nDst=pOut->PixelToLogic(Size(0,10)).Height();
1482  nOutMin=-pOut->GetMapMode().GetOrigin().Y();
1483  nOutMax=pOut->GetOutputSize().Height()-1+nOutMin;
1484  nOutMin+=nDst;
1485  nOutMax-=nDst;
1486  // absolute minimum length, however, is 10 pixels
1487  if (nOutMax-nOutMin<nDst) {
1488  nOutMin+=nOutMax+1;
1489  nOutMin/=2;
1490  nOutMin-=(nDst+1)/2;
1491  nOutMax=nOutMin+nDst;
1492  }
1493  nOutHgt=nOutMax-nOutMin;
1494  // otherwise minimum length = 1/4 OutHgt
1495  long nTemp=nOutHgt/4;
1496  if (nTemp>nMinLen) nMinLen=nTemp;
1497  }
1498 
1500  Point aCenter(aR.Center());
1501  long nMarkHgt=aR.GetHeight()-1;
1502  long nHgt=nMarkHgt+nObjDst*2; // 20 pixels overlapping above and below
1503  if (nHgt<nMinLen) nHgt=nMinLen; // minimum length 50 pixels or 1/4 OutHgt, respectively
1504 
1505  long nY1=aCenter.Y()-(nHgt+1)/2;
1506  long nY2=nY1+nHgt;
1507 
1508  if (pOut!=nullptr && nMinLen>nOutHgt) nMinLen=nOutHgt; // TODO: maybe shorten this a little
1509 
1510  if (pOut!=nullptr) { // now move completely into the visible area
1511  if (nY1<nOutMin) {
1512  nY1=nOutMin;
1513  if (nY2<nY1+nMinLen) nY2=nY1+nMinLen;
1514  }
1515  if (nY2>nOutMax) {
1516  nY2=nOutMax;
1517  if (nY1>nY2-nMinLen) nY1=nY2-nMinLen;
1518  }
1519  }
1520 
1521  maRef1.setX(aCenter.X() );
1522  maRef1.setY(nY1 );
1523  maRef2.setX(aCenter.X() );
1524  maRef2.setY(nY2 );
1525 
1526  break;
1527  }
1528 
1530  case SdrDragMode::Gradient:
1531  case SdrDragMode::Crop:
1532  {
1534  maRef1 = aRect.TopLeft();
1535  maRef2 = aRect.BottomRight();
1536  break;
1537  }
1538  default: break;
1539  }
1540 }
1541 
1542 void SdrMarkView::SetRef1(const Point& rPt)
1543 {
1545  {
1546  maRef1 = rPt;
1548  if(pH)
1549  pH->SetPos(rPt);
1550  }
1551 }
1552 
1553 void SdrMarkView::SetRef2(const Point& rPt)
1554 {
1556  {
1557  maRef2 = rPt;
1559  if(pH)
1560  pH->SetPos(rPt);
1561  }
1562 }
1563 
1565 {
1566  return SfxViewShell::Current();
1567 }
1568 
1570 {
1571  for (size_t nm=GetMarkedObjectCount(); nm>0;) {
1572  --nm;
1573  SdrMark* pM = GetSdrMarkByIndex(nm);
1574  SdrObject* pObj = pM->GetMarkedSdrObj();
1575  SdrPageView* pPV = pM->GetPageView();
1576  bool bRaus = !pObj || !pPV->IsObjMarkable(pObj);
1577  if (bRaus)
1578  {
1580  }
1581  else
1582  {
1583  if (!IsGluePointEditMode()) { // selected glue points only in GlueEditMode
1584  SdrUShortCont& rPts = pM->GetMarkedGluePoints();
1585  rPts.clear();
1586  }
1587  }
1588  }
1589 
1590  // at least reset the remembered BoundRect to prevent handle
1591  // generation if bForceFrameHandles is TRUE.
1592  mbMarkedObjRectDirty = true;
1593 }
1594 
1596 {
1597  SdrPageView* pPV = GetSdrPageView();
1598 
1599  if(pPV)
1600  {
1601  pPV->SetHasMarkedObj(GetMarkedObjectList().TakeSnapRect(pPV, pPV->MarkSnap()));
1603  }
1604 }
1605 
1607 {
1608  if (bOn!=mbForceFrameHandles) {
1609  bool bOld=ImpIsFrameHandles();
1610  mbForceFrameHandles=bOn;
1611  bool bNew=ImpIsFrameHandles();
1612  if (bNew!=bOld) {
1613  AdjustMarkHdl();
1615  }
1616  }
1617 }
1618 
1620 {
1621  if (eMode!=meEditMode) {
1623  bool bEdge0=static_cast<SdrCreateView*>(this)->IsEdgeTool();
1625  meEditMode=eMode;
1627  bool bEdge1=static_cast<SdrCreateView*>(this)->IsEdgeTool();
1628  // avoid flickering when switching between GlueEdit and EdgeTool
1629  if (bGlue1 && !bGlue0) ImpSetGlueVisible2(bGlue1);
1630  if (bEdge1!=bEdge0) ImpSetGlueVisible3(bEdge1);
1631  if (!bGlue1 && bGlue0) ImpSetGlueVisible2(bGlue1);
1632  if (bGlue0 && !bGlue1) UnmarkAllGluePoints();
1633  }
1634 }
1635 
1636 
1637 bool SdrMarkView::IsObjMarkable(SdrObject const * pObj, SdrPageView const * pPV) const
1638 {
1639  if (pObj)
1640  {
1641  if (pObj->IsMarkProtect() ||
1642  (!mbDesignMode && pObj->IsUnoObj()))
1643  {
1644  // object not selectable or
1645  // SdrUnoObj not in DesignMode
1646  return false;
1647  }
1648  }
1649  return pPV==nullptr || pPV->IsObjMarkable(pObj);
1650 }
1651 
1652 bool SdrMarkView::IsMarkedObjHit(const Point& rPnt, short nTol) const
1653 {
1654  bool bRet=false;
1655  nTol=ImpGetHitTolLogic(nTol,nullptr);
1656  for (size_t nm=0; nm<GetMarkedObjectCount() && !bRet; ++nm) {
1657  SdrMark* pM=GetSdrMarkByIndex(nm);
1658  bRet = nullptr != CheckSingleSdrObjectHit(rPnt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),SdrSearchOptions::NONE,nullptr);
1659  }
1660  return bRet;
1661 }
1662 
1663 SdrHdl* SdrMarkView::PickHandle(const Point& rPnt) const
1664 {
1665  if (mbSomeObjChgdFlag) { // recalculate handles, if necessary
1667  }
1668  return maHdlList.IsHdlListHit(rPnt);
1669 }
1670 
1671 bool SdrMarkView::MarkObj(const Point& rPnt, short nTol, bool bToggle, bool bDeep)
1672 {
1673  SdrPageView* pPV;
1674  nTol=ImpGetHitTolLogic(nTol,nullptr);
1676  if (bDeep) nOptions=nOptions|SdrSearchOptions::DEEP;
1677  SdrObject* pObj = PickObj(rPnt, static_cast<sal_uInt16>(nTol), pPV, nOptions);
1678  if (pObj) {
1679  bool bUnmark=bToggle && IsObjMarked(pObj);
1680  MarkObj(pObj,pPV,bUnmark);
1681  }
1682  return pObj != nullptr;
1683 }
1684 
1686 {
1687  SdrPageView* pPageView = GetSdrPageView();
1688 
1689  if(!pPageView)
1690  {
1691  return false;
1692  }
1693 
1695  const size_t nMarkCount=GetMarkedObjectCount();
1696  size_t nChgMarkNum = SAL_MAX_SIZE; // number of the MarkEntry we want to replace
1697  size_t nSearchObjNum = bPrev ? 0 : SAL_MAX_SIZE;
1698  if (nMarkCount!=0) {
1699  nChgMarkNum=bPrev ? 0 : nMarkCount-1;
1700  SdrMark* pM=GetSdrMarkByIndex(nChgMarkNum);
1701  OSL_ASSERT(pM!=nullptr);
1702  if (pM->GetMarkedSdrObj() != nullptr)
1703  nSearchObjNum = pM->GetMarkedSdrObj()->GetNavigationPosition();
1704  }
1705 
1706  SdrObject* pMarkObj=nullptr;
1707  SdrObjList* pSearchObjList=pPageView->GetObjList();
1708  const size_t nObjCount = pSearchObjList->GetObjCount();
1709  if (nObjCount!=0) {
1710  if (nSearchObjNum>nObjCount) nSearchObjNum=nObjCount;
1711  while (pMarkObj==nullptr && ((!bPrev && nSearchObjNum>0) || (bPrev && nSearchObjNum<nObjCount)))
1712  {
1713  if (!bPrev)
1714  nSearchObjNum--;
1715  SdrObject* pSearchObj = pSearchObjList->GetObjectForNavigationPosition(nSearchObjNum);
1716  if (IsObjMarkable(pSearchObj,pPageView))
1717  {
1718  if (TryToFindMarkedObject(pSearchObj)==SAL_MAX_SIZE)
1719  {
1720  pMarkObj=pSearchObj;
1721  }
1722  }
1723  if (bPrev) nSearchObjNum++;
1724  }
1725  }
1726 
1727  if(!pMarkObj)
1728  {
1729  return false;
1730  }
1731 
1732  if (nChgMarkNum!=SAL_MAX_SIZE)
1733  {
1735  }
1736  MarkObj(pMarkObj,pPageView); // also calls MarkListHasChanged(), AdjustMarkHdl()
1737  return true;
1738 }
1739 
1740 bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev)
1741 {
1743  nTol=ImpGetHitTolLogic(nTol,nullptr);
1744  SdrMark* pTopMarkHit=nullptr;
1745  SdrMark* pBtmMarkHit=nullptr;
1746  size_t nTopMarkHit=0;
1747  size_t nBtmMarkHit=0;
1748  // find topmost of the selected objects that is hit by rPnt
1749  const size_t nMarkCount=GetMarkedObjectCount();
1750  for (size_t nm=nMarkCount; nm>0 && pTopMarkHit==nullptr;) {
1751  --nm;
1752  SdrMark* pM=GetSdrMarkByIndex(nm);
1753  if(CheckSingleSdrObjectHit(rPnt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),SdrSearchOptions::NONE,nullptr))
1754  {
1755  pTopMarkHit=pM;
1756  nTopMarkHit=nm;
1757  }
1758  }
1759  // nothing found, in this case, just select an object
1760  if (pTopMarkHit==nullptr) return MarkObj(rPnt,sal_uInt16(nTol));
1761 
1762  SdrObject* pTopObjHit=pTopMarkHit->GetMarkedSdrObj();
1763  SdrObjList* pObjList=pTopObjHit->getParentSdrObjListFromSdrObject();
1764  SdrPageView* pPV=pTopMarkHit->GetPageView();
1765  // find lowermost of the selected objects that is hit by rPnt
1766  // and is placed on the same PageView as pTopMarkHit
1767  for (size_t nm=0; nm<nMarkCount && pBtmMarkHit==nullptr; ++nm) {
1768  SdrMark* pM=GetSdrMarkByIndex(nm);
1769  SdrPageView* pPV2=pM->GetPageView();
1770  if (pPV2==pPV && CheckSingleSdrObjectHit(rPnt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pPV2,SdrSearchOptions::NONE,nullptr))
1771  {
1772  pBtmMarkHit=pM;
1773  nBtmMarkHit=nm;
1774  }
1775  }
1776  if (pBtmMarkHit==nullptr) { pBtmMarkHit=pTopMarkHit; nBtmMarkHit=nTopMarkHit; }
1777  SdrObject* pBtmObjHit=pBtmMarkHit->GetMarkedSdrObj();
1778  const size_t nObjCount = pObjList->GetObjCount();
1779 
1780  size_t nSearchBeg(0);
1781  E3dScene* pScene(nullptr);
1782  SdrObject* pObjHit(bPrev ? pBtmObjHit : pTopObjHit);
1783  bool bRemap =
1784  nullptr != dynamic_cast< const E3dCompoundObject* >(pObjHit);
1785  if (bRemap)
1786  {
1787  pScene = dynamic_cast< E3dScene* >(pObjHit->getParentSdrObjectFromSdrObject());
1788  bRemap = nullptr != pScene;
1789  }
1790 
1791  if(bPrev)
1792  {
1793  sal_uInt32 nOrdNumBtm(pBtmObjHit->GetOrdNum());
1794 
1795  if(bRemap)
1796  {
1797  nOrdNumBtm = pScene->RemapOrdNum(nOrdNumBtm);
1798  }
1799 
1800  nSearchBeg = nOrdNumBtm + 1;
1801  }
1802  else
1803  {
1804  sal_uInt32 nOrdNumTop(pTopObjHit->GetOrdNum());
1805 
1806  if(bRemap)
1807  {
1808  nOrdNumTop = pScene->RemapOrdNum(nOrdNumTop);
1809  }
1810 
1811  nSearchBeg = nOrdNumTop;
1812  }
1813 
1814  size_t no=nSearchBeg;
1815  SdrObject* pFndObj=nullptr;
1816  while (pFndObj==nullptr && ((!bPrev && no>0) || (bPrev && no<nObjCount))) {
1817  if (!bPrev) no--;
1818  SdrObject* pObj;
1819 
1820  if(bRemap)
1821  {
1822  pObj = pObjList->GetObj(pScene->RemapOrdNum(no));
1823  }
1824  else
1825  {
1826  pObj = pObjList->GetObj(no);
1827  }
1828 
1829  if (CheckSingleSdrObjectHit(rPnt,sal_uInt16(nTol),pObj,pPV,SdrSearchOptions::TESTMARKABLE,nullptr))
1830  {
1831  if (TryToFindMarkedObject(pObj)==SAL_MAX_SIZE) {
1832  pFndObj=pObj;
1833  } else {
1834  // TODO: for performance reasons set on to Top or Btm, if necessary
1835  }
1836  }
1837  if (bPrev) no++;
1838  }
1839  if (pFndObj!=nullptr)
1840  {
1841  GetMarkedObjectListWriteAccess().DeleteMark(bPrev?nBtmMarkHit:nTopMarkHit);
1844  AdjustMarkHdl();
1845  }
1846  return pFndObj!=nullptr;
1847 }
1848 
1849 void SdrMarkView::MarkObj(const tools::Rectangle& rRect, bool bUnmark)
1850 {
1851  bool bFnd=false;
1852  tools::Rectangle aR(rRect);
1853  SdrObjList* pObjList;
1854  BrkAction();
1855  SdrPageView* pPV = GetSdrPageView();
1856 
1857  if(pPV)
1858  {
1859  pObjList=pPV->GetObjList();
1860  tools::Rectangle aFrm1(aR);
1861  const size_t nObjCount = pObjList->GetObjCount();
1862  for (size_t nO=0; nO<nObjCount; ++nO) {
1863  SdrObject* pObj=pObjList->GetObj(nO);
1864  tools::Rectangle aRect(pObj->GetCurrentBoundRect());
1865  if (aFrm1.IsInside(aRect)) {
1866  if (!bUnmark) {
1867  if (IsObjMarkable(pObj,pPV))
1868  {
1870  bFnd=true;
1871  }
1872  } else {
1873  const size_t nPos=TryToFindMarkedObject(pObj);
1874  if (nPos!=SAL_MAX_SIZE)
1875  {
1877  bFnd=true;
1878  }
1879  }
1880  }
1881  }
1882  }
1883  if (bFnd) {
1886  AdjustMarkHdl();
1887  }
1888 }
1889 
1890 namespace {
1891 
1892 void collectUIInformation(const SdrObject* pObj)
1893 {
1894  EventDescription aDescription;
1895  aDescription.aAction = "SELECT";
1896  aDescription.aParent = "MainWindow";
1897  aDescription.aKeyWord = "CurrentApp";
1898 
1899  if (!pObj->GetName().isEmpty())
1900  aDescription.aParameters = {{"OBJECT", pObj->GetName()}};
1901  else
1902  aDescription.aParameters = {{"OBJECT", "Unnamed_Obj_" + OUString::number(pObj->GetOrdNum())}};
1903 
1904  UITestLogger::getInstance().logEvent(aDescription);
1905 }
1906 
1907 }
1908 
1909 void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark, bool bImpNoSetMarkHdl)
1910 {
1911  if (pObj!=nullptr && pPV!=nullptr && IsObjMarkable(pObj, pPV)) {
1912  BrkAction();
1913  if (!bUnmark)
1914  {
1916  collectUIInformation(pObj);
1917  }
1918  else
1919  {
1920  const size_t nPos=TryToFindMarkedObject(pObj);
1921  if (nPos!=SAL_MAX_SIZE)
1922  {
1924  }
1925  }
1926  if (!bImpNoSetMarkHdl) {
1928  AdjustMarkHdl();
1929  }
1930  }
1931 }
1932 
1933 bool SdrMarkView::IsObjMarked(SdrObject const * pObj) const
1934 {
1935  return TryToFindMarkedObject(pObj)!=SAL_MAX_SIZE;
1936 }
1937 
1939 {
1940  return maHdlList.GetHdlSize()*2+1;
1941 }
1942 
1944 {
1945  if (nSiz<3) nSiz=3;
1946  nSiz/=2;
1947  if (nSiz!=maHdlList.GetHdlSize()) {
1948  maHdlList.SetHdlSize(nSiz);
1949  }
1950 }
1951 
1953  basegfx::B2DVector& rOffset,
1954  const SdrObject* pObj,
1955  const SdrPageView* pPV) const
1956 {
1957  if(nullptr == pObj || nullptr == pPV)
1958  {
1959  return false;
1960  }
1961 
1962  const OutputDevice* pOutputDevice(GetFirstOutputDevice());
1963 
1964  if(nullptr == pOutputDevice)
1965  {
1966  return false;
1967  }
1968 
1969  const SdrPageWindow* pSdrPageWindow(pPV->FindPageWindow(*pOutputDevice));
1970 
1971  if(nullptr == pSdrPageWindow)
1972  {
1973  return false;
1974  }
1975 
1976  const sdr::contact::ObjectContact& rObjectContact(pSdrPageWindow->GetObjectContact());
1977 
1978  if(!rObjectContact.supportsGridOffsets())
1979  {
1980  return false;
1981  }
1982 
1984  const_cast<sdr::contact::ObjectContact&>(rObjectContact)));
1985 
1986  rObjectContact.calculateGridOffsetForViewOjectContact(rOffset, rVOC);
1987 
1988  return !rOffset.equalZero();
1989 }
1990 
1992  basegfx::B2DVector& rOffset,
1993  const basegfx::B2DPoint& rPoint,
1994  const SdrPageView* pPV) const
1995 {
1996  if(nullptr == pPV)
1997  {
1998  return false;
1999  }
2000 
2001  const OutputDevice* pOutputDevice(GetFirstOutputDevice());
2002 
2003  if(nullptr == pOutputDevice)
2004  {
2005  return false;
2006  }
2007 
2008  const SdrPageWindow* pSdrPageWindow(pPV->FindPageWindow(*pOutputDevice));
2009 
2010  if(nullptr == pSdrPageWindow)
2011  {
2012  return false;
2013  }
2014 
2015  const sdr::contact::ObjectContact& rObjectContact(pSdrPageWindow->GetObjectContact());
2016 
2017  if(!rObjectContact.supportsGridOffsets())
2018  {
2019  return false;
2020  }
2021 
2022  rObjectContact.calculateGridOffsetForB2DRange(rOffset, basegfx::B2DRange(rPoint));
2023 
2024  return !rOffset.equalZero();
2025 }
2026 
2027 SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay) const
2028 {
2029  if(((nOptions & SdrSearchOptions::IMPISMASTER) && pObj->IsNotVisibleAsMaster()) || (!pObj->IsVisible()))
2030  {
2031  return nullptr;
2032  }
2033 
2034  const bool bCheckIfMarkable(nOptions & SdrSearchOptions::TESTMARKABLE);
2035  const bool bDeep(nOptions & SdrSearchOptions::DEEP);
2036  const bool bOLE(dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr);
2037  const bool bTXT(dynamic_cast<const SdrTextObj*>( pObj) != nullptr && static_cast<SdrTextObj*>(pObj)->IsTextFrame());
2038  SdrObject* pRet=nullptr;
2039  tools::Rectangle aRect(pObj->GetCurrentBoundRect());
2040 
2041  // add possible GridOffset to up-to-now view-independent BoundRect data
2042  basegfx::B2DVector aGridOffset(0.0, 0.0);
2043  if(getPossibleGridOffsetForSdrObject(aGridOffset, pObj, pPV))
2044  {
2045  aRect += Point(
2046  basegfx::fround(aGridOffset.getX()),
2047  basegfx::fround(aGridOffset.getY()));
2048  }
2049 
2050  sal_uInt16 nTol2(nTol);
2051 
2052  // double tolerance for OLE, text frames and objects in
2053  // active text edit
2054  if(bOLE || bTXT || pObj==static_cast<const SdrObjEditView*>(this)->GetTextEditObject())
2055  {
2056  nTol2*=2;
2057  }
2058 
2059  aRect.AdjustLeft( -nTol2 ); // add 1 tolerance for all objects
2060  aRect.AdjustTop( -nTol2 );
2061  aRect.AdjustRight(nTol2 );
2062  aRect.AdjustBottom(nTol2 );
2063 
2064  if (aRect.IsInside(rPnt))
2065  {
2066  if (!bCheckIfMarkable || IsObjMarkable(pObj,pPV))
2067  {
2068  SdrObjList* pOL=pObj->GetSubList();
2069 
2070  if (pOL!=nullptr && pOL->GetObjCount()!=0)
2071  {
2072  SdrObject* pTmpObj;
2073  // adjustment hit point for virtual objects
2074  Point aPnt( rPnt );
2075 
2076  if ( dynamic_cast<const SdrVirtObj*>( pObj) != nullptr )
2077  {
2078  Point aOffset = static_cast<SdrVirtObj*>(pObj)->GetOffset();
2079  aPnt.Move( -aOffset.X(), -aOffset.Y() );
2080  }
2081 
2082  pRet=CheckSingleSdrObjectHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj);
2083  }
2084  else
2085  {
2086  if(!pMVisLay || pMVisLay->IsSet(pObj->GetLayer()))
2087  {
2088  pRet = SdrObjectPrimitiveHit(*pObj, rPnt, nTol2, *pPV, &pPV->GetVisibleLayers(), false);
2089  }
2090  }
2091  }
2092  }
2093 
2094  if (!bDeep && pRet!=nullptr)
2095  {
2096  pRet=pObj;
2097  }
2098 
2099  return pRet;
2100 }
2101 
2102 SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList const * pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay, SdrObject*& rpRootObj) const
2103 {
2104  return (*this).CheckSingleSdrObjectHit(rPnt,nTol,pOL,pPV,nOptions,pMVisLay,rpRootObj,nullptr);
2105 }
2106 SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList const * pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay, SdrObject*& rpRootObj,const SdrMarkList * pMarkList) const
2107 {
2108  SdrObject* pRet=nullptr;
2109  rpRootObj=nullptr;
2110  if (pOL!=nullptr)
2111  {
2112  const bool bRemap(
2113  nullptr != pOL->getSdrObjectFromSdrObjList()
2114  && nullptr != dynamic_cast< const E3dScene* >(pOL->getSdrObjectFromSdrObjList()));
2115  const E3dScene* pRemapScene(bRemap ? static_cast< E3dScene* >(pOL->getSdrObjectFromSdrObjList()) : nullptr);
2116  const size_t nObjCount(pOL->GetObjCount());
2117  size_t nObjNum(nObjCount);
2118 
2119  while (pRet==nullptr && nObjNum>0)
2120  {
2121  nObjNum--;
2122  SdrObject* pObj;
2123 
2124  if(bRemap)
2125  {
2126  pObj = pOL->GetObj(pRemapScene->RemapOrdNum(nObjNum));
2127  }
2128  else
2129  {
2130  pObj = pOL->GetObj(nObjNum);
2131  }
2132  if (nOptions & SdrSearchOptions::BEFOREMARK)
2133  {
2134  if (pMarkList!=nullptr)
2135  {
2136  if ((*pMarkList).FindObject(pObj)!=SAL_MAX_SIZE)
2137  {
2138  return nullptr;
2139  }
2140  }
2141  }
2142  pRet=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay);
2143  if (pRet!=nullptr) rpRootObj=pObj;
2144  }
2145  }
2146  return pRet;
2147 }
2148 
2149 SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions) const
2150 {
2151  return PickObj(rPnt, nTol, rpPV, nOptions, nullptr);
2152 }
2153 
2154 SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions, SdrObject** ppRootObj, bool* pbHitPassDirect) const
2155 { // TODO: lacks a Pass2,Pass3
2157  if (ppRootObj!=nullptr) *ppRootObj=nullptr;
2158  if (pbHitPassDirect!=nullptr) *pbHitPassDirect=true;
2159  SdrObject* pRet = nullptr;
2160  rpPV=nullptr;
2161  bool bMarked(nOptions & SdrSearchOptions::MARKED);
2162  bool bMasters=!bMarked && bool(nOptions & SdrSearchOptions::ALSOONMASTER);
2163  // nOptions & SdrSearchOptions::NEXT: n.i.
2164  // nOptions & SdrSearchOptions::PASS2BOUND: n.i.
2165  // nOptions & SdrSearchOptions::PASS3NEAREST// n.i.
2166  if (nTol<0) nTol=ImpGetHitTolLogic(nTol,nullptr);
2167  SdrObject* pObj=nullptr;
2168  SdrObject* pHitObj=nullptr;
2169  SdrPageView* pPV=nullptr;
2170  if (static_cast<const SdrObjEditView*>(this)->IsTextEditFrameHit(rPnt)) {
2171  pObj=static_cast<const SdrObjEditView*>(this)->GetTextEditObject();
2172  pHitObj=pObj;
2173  pPV=static_cast<const SdrObjEditView*>(this)->GetTextEditPageView();
2174  }
2175  if (bMarked) {
2176  const size_t nMrkCnt=GetMarkedObjectCount();
2177  size_t nMrkNum=nMrkCnt;
2178  while (pHitObj==nullptr && nMrkNum>0) {
2179  nMrkNum--;
2180  SdrMark* pM=GetSdrMarkByIndex(nMrkNum);
2181  pObj=pM->GetMarkedSdrObj();
2182  pPV=pM->GetPageView();
2183  pHitObj=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,nullptr);
2184  }
2185  }
2186  else
2187  {
2188  pPV = GetSdrPageView();
2189 
2190  if(pPV)
2191  {
2192  SdrPage* pPage=pPV->GetPage();
2193  sal_uInt16 nPgCount=1;
2194 
2195  if(bMasters && pPage->TRG_HasMasterPage())
2196  {
2197  nPgCount++;
2198  }
2199  bool bWholePage(nOptions & SdrSearchOptions::WHOLEPAGE);
2200  bool bExtraPassForWholePage=bWholePage && pPage!=pPV->GetObjList();
2201  if (bExtraPassForWholePage) nPgCount++; // First search in AktObjList, then on the entire page
2202  sal_uInt16 nPgNum=nPgCount;
2203  while (pHitObj==nullptr && nPgNum>0) {
2204  SdrSearchOptions nTmpOptions=nOptions;
2205  nPgNum--;
2206  const SdrLayerIDSet* pMVisLay=nullptr;
2207  SdrObjList* pObjList=nullptr;
2208  if (pbHitPassDirect!=nullptr) *pbHitPassDirect = true;
2209  if (nPgNum>=nPgCount-1 || (bExtraPassForWholePage && nPgNum>=nPgCount-2))
2210  {
2211  pObjList=pPV->GetObjList();
2212  if (bExtraPassForWholePage && nPgNum==nPgCount-2) {
2213  pObjList=pPage;
2214  if (pbHitPassDirect!=nullptr) *pbHitPassDirect = false;
2215  }
2216  }
2217  else
2218  {
2219  // otherwise MasterPage
2220  SdrPage& rMasterPage = pPage->TRG_GetMasterPage();
2221  pMVisLay = &pPage->TRG_GetMasterPageVisibleLayers();
2222  pObjList = &rMasterPage;
2223 
2224  if (pbHitPassDirect!=nullptr) *pbHitPassDirect = false;
2225  nTmpOptions=nTmpOptions | SdrSearchOptions::IMPISMASTER;
2226  }
2227  pHitObj=CheckSingleSdrObjectHit(rPnt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj,&(GetMarkedObjectList()));
2228  }
2229  }
2230  }
2231  if (pHitObj!=nullptr) {
2232  if (ppRootObj!=nullptr) *ppRootObj=pObj;
2233  if (nOptions & SdrSearchOptions::DEEP) pObj=pHitObj;
2234  if (nOptions & SdrSearchOptions::TESTTEXTEDIT) {
2235  if (!pObj->HasTextEdit() || pPV->GetLockedLayers().IsSet(pObj->GetLayer())) {
2236  pObj=nullptr;
2237  }
2238  }
2239  if (pObj!=nullptr && (nOptions & SdrSearchOptions::TESTMACRO)) {
2240  SdrObjMacroHitRec aHitRec;
2241  aHitRec.aPos=rPnt;
2242  aHitRec.nTol=nTol;
2243  aHitRec.pVisiLayer=&pPV->GetVisibleLayers();
2244  aHitRec.pPageView=pPV;
2245  if (!pObj->HasMacro() || !pObj->IsMacroHit(aHitRec)) pObj=nullptr;
2246  }
2247  if (pObj!=nullptr) {
2248  pRet=pObj;
2249  rpPV=pPV;
2250  }
2251  }
2252  return pRet;
2253 }
2254 
2255 bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions) const
2256 {
2258  const bool bBoundCheckOn2ndPass(nOptions & SdrSearchOptions::PASS2BOUND);
2259  rpObj=nullptr;
2260  rpPV=nullptr;
2261  const size_t nMarkCount=GetMarkedObjectCount();
2262  for (size_t nMarkNum=nMarkCount; nMarkNum>0;) {
2263  --nMarkNum;
2264  SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
2265  SdrPageView* pPV=pM->GetPageView();
2266  SdrObject* pObj=pM->GetMarkedSdrObj();
2268  rpObj=pObj;
2269  rpPV=pPV;
2270  return true;
2271  }
2272  }
2273  if (bBoundCheckOn2ndPass) {
2274  for (size_t nMarkNum=nMarkCount; nMarkNum>0;) {
2275  --nMarkNum;
2276  SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
2277  SdrPageView* pPV=pM->GetPageView();
2278  SdrObject* pObj=pM->GetMarkedSdrObj();
2279  tools::Rectangle aRect(pObj->GetCurrentBoundRect());
2280  aRect.AdjustLeft( -mnHitTolLog );
2281  aRect.AdjustTop( -mnHitTolLog );
2282  aRect.AdjustRight(mnHitTolLog );
2283  aRect.AdjustBottom(mnHitTolLog );
2284  if (aRect.IsInside(rPnt)) {
2285  rpObj=pObj;
2286  rpPV=pPV;
2287  return true;
2288  }
2289  }
2290  }
2291  return false;
2292 }
2293 
2294 
2296 {
2297  if (GetMarkedObjectCount()!=0) {
2298  BrkAction();
2299  if (pPV!=nullptr)
2300  {
2302  }
2303  else
2304  {
2306  }
2307  mpMarkedObj=nullptr;
2308  mpMarkedPV=nullptr;
2310  AdjustMarkHdl();
2311  }
2312 }
2313 
2315 {
2316  BrkAction();
2317 
2318  if(!pPV)
2319  {
2320  pPV = GetSdrPageView();
2321  }
2322 
2323  // #i69171# pPV may still be NULL if there is no SDrPageView (!), e.g. when inserting
2324  // other files
2325  if(pPV)
2326  {
2327  const bool bMarkChg(GetMarkedObjectListWriteAccess().InsertPageView(*pPV));
2328 
2329  if(bMarkChg)
2330  {
2332  }
2333  }
2334 
2335  if(GetMarkedObjectCount())
2336  {
2337  AdjustMarkHdl();
2338  }
2339 }
2340 
2342 {
2343  CheckMarked();
2344  SetMarkRects();
2345  SetMarkHandles(pOtherShell);
2346 }
2347 
2348 // BoundRect in model coordinates, no GridOffset added
2350 {
2351  tools::Rectangle aRect;
2352  for (size_t nm=0; nm<GetMarkedObjectCount(); ++nm) {
2353  SdrMark* pM=GetSdrMarkByIndex(nm);
2354  SdrObject* pO=pM->GetMarkedSdrObj();
2356  if (aRect.IsEmpty()) aRect=aR1;
2357  else aRect.Union(aR1);
2358  }
2359  return aRect;
2360 }
2361 
2362 // ObjRect in model coordinates, no GridOffset added
2364 {
2365  if (mbMarkedObjRectDirty) {
2366  const_cast<SdrMarkView*>(this)->mbMarkedObjRectDirty=false;
2367  tools::Rectangle aRect;
2368  for (size_t nm=0; nm<GetMarkedObjectCount(); ++nm) {
2369  SdrMark* pM=GetSdrMarkByIndex(nm);
2370  SdrObject* pO = pM->GetMarkedSdrObj();
2371  if (!pO)
2372  continue;
2373  tools::Rectangle aR1(pO->GetSnapRect());
2374  if (aRect.IsEmpty()) aRect=aR1;
2375  else aRect.Union(aR1);
2376  }
2377  const_cast<SdrMarkView*>(this)->maMarkedObjRect=aRect;
2378  }
2379  return maMarkedObjRect;
2380 }
2381 
2382 
2383 OUString SdrMarkView::ImpGetDescriptionString(const char* pStrCacheID, ImpGetDescriptionOptions nOpt) const
2384 {
2385  OUString sStr = SvxResId(pStrCacheID);
2386  const sal_Int32 nPos = sStr.indexOf("%1");
2387 
2388  if(nPos != -1)
2389  {
2391  {
2392  sStr = sStr.replaceAt(nPos, 2, GetDescriptionOfMarkedPoints());
2393  }
2394  else if(nOpt == ImpGetDescriptionOptions::GLUEPOINTS)
2395  {
2396  sStr = sStr.replaceAt(nPos, 2, GetDescriptionOfMarkedGluePoints());
2397  }
2398  else
2399  {
2400  sStr = sStr.replaceAt(nPos, 2, GetDescriptionOfMarkedObjects());
2401  }
2402  }
2403 
2404  return sStr.replaceFirst("%2", "0");
2405 }
2406 
2407 
2409 {
2410  // We enter only the first group found (in only one PageView), because
2411  // PageView::EnterGroup calls an AdjustMarkHdl.
2412  // TODO: I'll have to prevent that via a flag.
2413  SdrPageView* pPV = GetSdrPageView();
2414 
2415  if(pPV)
2416  {
2417  bool bEnter=false;
2418  for (size_t nm = GetMarkedObjectCount(); nm > 0 && !bEnter;)
2419  {
2420  --nm;
2421  SdrMark* pM=GetSdrMarkByIndex(nm);
2422  if (pM->GetPageView()==pPV) {
2423  SdrObject* pObj=pM->GetMarkedSdrObj();
2424  if (pObj->IsGroupObject()) {
2425  if (pPV->EnterGroup(pObj)) {
2426  bEnter=true;
2427  }
2428  }
2429  }
2430  }
2431  }
2432 }
2433 
2434 
2436 {
2438  maSdrViewSelection.SetEdgesOfMarkedNodesDirty();
2439 
2440  mbMarkedObjRectDirty=true;
2442  bool bOneEdgeMarked=false;
2443  if (GetMarkedObjectCount()==1) {
2444  const SdrObject* pObj=GetMarkedObjectByIndex(0);
2445  if (pObj->GetObjInventor()==SdrInventor::Default) {
2446  sal_uInt16 nIdent=pObj->GetObjIdentifier();
2447  bOneEdgeMarked=nIdent==OBJ_EDGE;
2448  }
2449  }
2450  ImpSetGlueVisible4(bOneEdgeMarked);
2451 }
2452 
2453 
2455 {
2457 }
2458 
2460 {
2461  if ( mbDesignMode != bOn )
2462  {
2463  mbDesignMode = bOn;
2464  SdrPageView* pPageView = GetSdrPageView();
2465  if ( pPageView )
2466  pPageView->SetDesignMode( bOn );
2467  }
2468 }
2469 
2470 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 mnMinMovLog
Definition: svdpntv.hxx:157
Point TopLeft() const
void EndMarkGluePoints()
Definition: svdmrkv.cxx:505
SdrPage & TRG_GetMasterPage() const
Definition: svdpage.cxx:1573
virtual bool HasTextEdit() const
Definition: svdobj.cxx:1687
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
Definition: svdmrkv.cxx:2295
OutDevType GetOutDevType() const
virtual void HideSdrPage()
Definition: svdpntv.cxx:384
void SetEditMode(SdrViewEditMode eMode)
Definition: svdmrkv.cxx:1619
const SdrUShortCont & GetMarkedGluePoints() const
Definition: svdmark.hxx:115
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
The Xor-Polygon is required by the View to drag the object.
Definition: svdobj.cxx:1066
bool IsMacroHit(const SdrObjMacroHitRec &rRec) const
Definition: svdobj.cxx:1798
void SetMinMove(sal_uInt16 nDist)
Definition: svddrag.hxx:111
long GetWidth() const
sal_Int32 nIndex
void Reset()
Definition: svddrag.cxx:36
const tools::Rectangle & MarkSnap() const
Definition: svdpagv.hxx:186
void BrkMarkGluePoints()
Definition: svdmrkv.cxx:521
virtual bool IsTextEdit() const
Definition: svdpntv.cxx:308
bool IsNotVisibleAsMaster() const
Definition: svdobj.hxx:882
SdrHintKind GetKind() const
Definition: svdmodel.hxx:124
sal_uInt32 GetPolyNum() const
Definition: svdhdl.hxx:219
long GetHeight() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
Definition: svdobj.cxx:853
XGradient aGradient
Definition: gradtrns.hxx:40
Universal Network Object packed into SvDraw object.
Definition: svdobj.hxx:146
void SetPos(const Point &rPnt)
Definition: svdhdl.cxx:341
virtual void SetMarkHandles(SfxViewShell *pOtherShell)
Definition: svdmrkv.cxx:666
void SortMarkedObjects() const
Definition: svdmrkv.hxx:250
void SetDesignMode(bool bOn=true)
Definition: svdmrkv.cxx:2459
void UndirtyMrkPnt() const
Definition: svdmrkv1.cxx:286
bool mbMarkHandlesHidden
Definition: svdmrkv.hxx:125
bool UnmarkAllGluePoints()
Definition: svdmrkv.hxx:382
bool mbInsPolyPoint
Definition: svdmrkv.hxx:119
const SdrUShortCont & GetMarkedPoints() const
Definition: svdmark.hxx:110
basegfx::B2DPoint maPositionB
Definition: gradtrns.hxx:32
rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const
virtual void ModelHasChanged()
Definition: svdpntv.cxx:265
void SetSecondPosition(const basegfx::B2DPoint &rNewPosition)
Definition: svdmrkv.cxx:110
sdr::overlay::OverlayObjectList maObjects
Definition: svdmrkv.cxx:69
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
media shape
Definition: svdobj.hxx:148
sal_uInt16 mnFrameHandlesLimit
Definition: svdmrkv.hxx:110
ImplMarkingOverlay * mpMarkObjOverlay
Definition: svdmrkv.hxx:93
bool IsObjMarkable(SdrObject const *pObj, SdrPageView const *pPV) const
Definition: svdmrkv.cxx:1637
virtual bool IsPolyObj() const
Definition: svdobj.cxx:1659
long Height() const
const Point & GetStart() const
Definition: svddrag.hxx:92
Point BottomLeft() const
SdrView & GetView()
Definition: svdpagv.hxx:135
SdrHdlKind
Definition: svdhdl.hxx:52
bool isInplaceActive() const
Definition: svdoole2.cxx:768
long AdjustLeft(long nHorzMoveDelta)
bool AreObjectsMarked() const
Definition: svdmrkv.hxx:251
SdrSearchOptions
Definition: svdmrkv.hxx:33
bool CheckMinMoved(const Point &rPnt)
Definition: svddrag.cxx:86
bool ImpIsFrameHandles() const
Definition: svdmrkv.cxx:566
sdr::ViewSelection maSdrViewSelection
Definition: svdmrkv.hxx:104
void FlushComeBackTimer() const
Definition: svdpntv.cxx:256
bool IsTextFrame() const
Definition: svdotext.hxx:343
virtual ~SdrMarkView() override
Definition: svdmrkv.cxx:166
ImplMarkingOverlay * mpMarkPointsOverlay
Definition: svdmrkv.hxx:94
bool IsInsObjPoint() const
Definition: svddrgv.hxx:126
bool isUiActive() const
Definition: svdoole2.cxx:773
double getX() const
SdrViewEditMode
Definition: svdmrkv.hxx:72
#define XATTR_FILLGRADIENT
Definition: xdef.hxx:109
SdrHintKind
Definition: svdmodel.hxx:93
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:766
virtual void BckAction() override
Definition: svdmrkv.cxx:292
size_t GetObjCount() const
Definition: svdpage.cxx:760
sal_uInt32 GetPointNum() const
Definition: svdhdl.hxx:222
bool IsInEditMode() const
Definition: svdotext.hxx:323
void SetSelected(bool bJa=true)
Definition: svdhdl.cxx:353
virtual void addCropHandles(SdrHdlList &rTarget) const
Definition: svdobj.cxx:1192
bool mbPlusHdlAlways
Definition: svdmrkv.hxx:118
sal_Int16 nId
virtual bool hasSpecialDrag() const
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdobj.cxx:1268
SdrObject * GetObjectForNavigationPosition(const sal_uInt32 nNavigationPosition) const
Return the object for the given navigation position.
Definition: svdpage.cxx:894
#define XATTR_FILLFLOATTRANSPARENCE
Definition: xdef.hxx:118
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: svdpntv.cxx:205
OUString const & GetDescriptionOfMarkedGluePoints() const
Definition: svdmrkv.hxx:254
ViewObjectContact & GetViewObjectContact(ObjectContact &rObjectContact)
Definition: viewcontact.cxx:71
const MapMode & GetMapMode() const
OUString const & GetDescriptionOfMarkedPoints() const
Definition: svdmrkv.hxx:253
double getY() const
SdrObject * GetObj() const
Definition: svdhdl.hxx:203
SdrDragStat maDragStat
Definition: svdpntv.hxx:147
SdrPageView * GetSdrPageViewOfMarkedByIndex(size_t nNum) const
Definition: svdmrkv.hxx:246
OLE object.
Definition: svdobj.hxx:138
void append(std::unique_ptr< OverlayObject > pOverlayObject)
std::set< sal_uInt16 > SdrUShortCont
Definition: svdmark.hxx:36
void SetUnsorted()
Definition: svdmark.hxx:175
void Clear()
Definition: svdmark.cxx:200
virtual void AddToHdlList(SdrHdlList &rHdlList) const
Definition: svdobj.cxx:1168
bool HasMarkableGluePoints() const
Definition: svdmrkv1.cxx:350
virtual void BrkAction() override
Definition: svdmrkv.cxx:300
size_t TryToFindMarkedObject(const SdrObject *pObj) const
Definition: svdmrkv.hxx:245
void ImpSetGlueVisible4(bool bOn)
Definition: svdpntv.hxx:247
static void notifyOtherViews(SfxViewShell *pThisView, int nType, const OString &rKey, const OString &rPayload)
bool MarkGluePoints(const tools::Rectangle *pRect, bool bUnmark)
Definition: svdmrkv1.cxx:390
bool mbDesignMode
Definition: svdmrkv.hxx:116
void DeleteMark(size_t nNum)
Definition: svdmark.cxx:315
virtual SdrObjList * GetSubList() const
Definition: svdobj.cxx:646
void BegUndo()
Definition: svdmodel.cxx:411
SfxHintId GetId() const
object that represents a SdrPage
Definition: svdobj.hxx:143
virtual void AddToPlusHdlList(SdrHdlList &rHdlList, SdrHdl &rHdl) const
Definition: svdobj.cxx:1188
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:244
bool BegMarkPoints(const Point &rPnt, bool bUnmark=false)
Definition: svdmrkv.cxx:408
const tools::Rectangle & GetMarkedObjRect() const
Definition: svdmrkv.cxx:2363
void Move(long nHorzMoveDelta, long nVertMoveDelta)
Point RightCenter() const
virtual const tools::Rectangle & GetSnapRect() const
Definition: svdobj.cxx:1596
virtual void BrkAction() override
Definition: svdsnpv.cxx:237
virtual bool MouseMove(const MouseEvent &rMEvt, OutputDevice *pWin) override
handle mouse over effects for handles
Definition: svdmrkv.cxx:1396
bool IsVisible() const
Definition: svdobj.hxx:804
void EnterMarkedGroup()
Definition: svdmrkv.cxx:2408
virtual void MarkListHasChanged()
Definition: svdmrkv.cxx:2435
bool IsEmpty() const
SdrPageWindow * FindPageWindow(SdrPaintWindow &rPaintWindow) const
Definition: svdpagv.cxx:41
static UITestLogger & getInstance()
SdrMarkView(SdrModel &rSdrModel, OutputDevice *pOut)
Definition: svdmrkv.cxx:153
void logEvent(const EventDescription &rDescription)
sal_uInt16 mnHitTolLog
Definition: svdpntv.hxx:156
long Right() const
void SetNameDirty()
Definition: svdmark.hxx:195
bool IsUnmarking() const
Definition: svdmrkv.cxx:85
static void notifyInvalidation(SfxViewShell const *pThisView, const OString &rPayload)
connector object
Definition: svdobj.hxx:139
sal_uInt16 ImpGetHitTolLogic(short nHitTol, const OutputDevice *pOut) const
Definition: svdpntv.cxx:327
bool IsAncestorOf(const vcl::Window &rWindow) const
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
OUTDEV_WINDOW
virtual void TakeActionRect(tools::Rectangle &rRect) const override
Definition: svdsnpv.cxx:244
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdmodel.cxx:545
Point BottomCenter() const
SdrHdl * GetHdl(size_t nHdlNum) const
Definition: svdmrkv.hxx:343
virtual bool MouseMove(const MouseEvent &, OutputDevice *)
Definition: svdpntv.hxx:461
static SfxViewShell * Current()
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
oslFileHandle & pOut
SdrObject * SdrObjectPrimitiveHit(const SdrObject &rObject, const Point &rPnt, sal_uInt16 nTol, const SdrPageView &rSdrPageView, const SdrLayerIDSet *pVisiLayer, bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer *pHitContainer)
void MovMarkObj(const Point &rPnt)
Definition: svdmrkv.cxx:365
void Clear()
Definition: svdhdl.cxx:2249
virtual bool RequestHelp(const HelpEvent &)
Definition: svdpntv.hxx:462
long Top() const
OutputDevice * GetFirstOutputDevice() const
Definition: svdpntv.cxx:87
bool IsMarkGluePoints() const
Definition: svdmrkv.hxx:398
sal_uInt16 GetHdlSize() const
Definition: svdhdl.hxx:465
bool BegMarkGluePoints(const Point &rPnt, bool bUnmark=false)
Definition: svdmrkv.cxx:473
Point LeftCenter() const
void showMarkHandles()
Definition: svdmrkv.cxx:557
Point maRef1
Definition: svdmrkv.hxx:101
virtual SdrObject * CheckSingleSdrObjectHit(const Point &rPnt, sal_uInt16 nTol, SdrObject *pObj, SdrPageView *pPV, SdrSearchOptions nOptions, const SdrLayerIDSet *pMVisLay) const
Definition: svdmrkv.cxx:2027
void AddDragModeHdl(SdrDragMode eMode)
Definition: svdmrkv.cxx:1255
void SetDistortShear(bool bOn)
Definition: svdhdl.cxx:2229
B2IRange fround(const B2DRange &rRange)
virtual void Move(const Size &rSiz) override
Definition: svdovirt.cxx:327
Point maRef2
Definition: svdmrkv.hxx:102
bool TakeBoundRect(SdrPageView const *pPageView, tools::Rectangle &rRect) const
Definition: svdmark.cxx:587
virtual bool HasLimitedRotation() const
Definition: svdobj.cxx:967
bool mbMarkedObjRectDirty
Definition: svdmrkv.hxx:120
bool IsMinMoved() const
Definition: svddrag.hxx:108
sal_uInt32 PaintWindowCount() const
Definition: svdpntv.hxx:228
SdrHdl * IsHdlListHit(const Point &rPnt) const
Definition: svdhdl.cxx:2301
bool PickMarkedObj(const Point &rPnt, SdrObject *&rpObj, SdrPageView *&rpPV, SdrSearchOptions nOptions) const
Definition: svdmrkv.cxx:2255
void Sort()
Definition: svdhdl.cxx:2257
SdrObjList * GetObjList() const
Return current List.
Definition: svdpagv.hxx:174
SdrObject * GetMarkedSdrObj() const
Definition: svdmark.hxx:68
void SetMoveOutside(bool bOn)
Definition: svdmrkv.cxx:2454
Point BottomRight() const
Everything a View needs to know about a selected object.
Definition: svdmark.hxx:44
void MarkAllObj(SdrPageView *pPV=nullptr)
Definition: svdmrkv.cxx:2314
virtual void ClearPageView()
Definition: svdpntv.cxx:356
bool mbMrkPntDirty
Definition: svdmrkv.hxx:121
SdrObject * PickObj(const Point &rPnt, short nTol, SdrPageView *&rpPV, SdrSearchOptions nOptions, SdrObject **ppRootObj, bool *pbHitPassDirect=nullptr) const
Definition: svdmrkv.cxx:2154
bool getPossibleGridOffsetForPosition(basegfx::B2DVector &rOffset, const basegfx::B2DPoint &rPoint, const SdrPageView *pPV) const
Definition: svdmrkv.cxx:1991
SdrDragMode meDragMode
Definition: svdmrkv.hxx:112
const SdrLayerIDSet & GetVisibleLayers() const
Definition: svdpagv.hxx:215
void ImpSetGlueVisible3(bool bOn)
Definition: svdpntv.hxx:246
object group
Definition: svdobj.hxx:119
virtual const SdrGluePointList * GetGluePointList() const
Definition: svdobj.cxx:2197
sal_uInt32 RemapOrdNum(sal_uInt32 nOrdNum) const
Definition: scene3d.cxx:243
void SetObj(SdrObject *pNewObj)
Definition: svdhdl.cxx:377
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
bool IsLeaveWindow() const
int i
uno_Any a
#define SDRGLUEPOINT_NOTFOUND
Definition: svdglue.hxx:116
void MoveTo(SdrHdlList &rOther)
Definition: svdhdl.cxx:2328
const tools::Rectangle & MarkBound() const
Definition: svdpagv.hxx:185
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
Definition: svdmodel.cxx:576
virtual sal_uInt16 GetObjIdentifier() const
Definition: svdobj.cxx:557
void SetObjHdlNum(sal_uInt32 nNum)
Definition: svdhdl.hxx:215
virtual void MovAction(const Point &rPnt) override
Definition: svdmrkv.cxx:256
basegfx::B2DPoint maPositionA
Definition: gradtrns.hxx:31
bool IsMarkObj() const
Definition: svdmrkv.hxx:203
size_t GetMarkedObjectCount() const
Definition: svdmrkv.hxx:249
virtual void EndAction() override
Definition: svdmrkv.cxx:274
const SdrLayerIDSet & TRG_GetMasterPageVisibleLayers() const
Definition: svdpage.cxx:1579
bool MarkableObjectsExceed(int n) const
Definition: svdmrkv.cxx:531
bool IsMarkedObjHit(const Point &rPnt, short nTol=-2) const
Definition: svdmrkv.cxx:1652
OUString const & GetDescriptionOfMarkedObjects() const
Definition: svdmrkv.hxx:252
void ForceRefToMarked()
Definition: svdmrkv.cxx:1453
void hideMarkHandles()
Definition: svdmrkv.cxx:548
virtual bool IsAction() const override
Definition: svdmrkv.cxx:251
virtual void onHelpRequest()
is called when help is requested for the area of this handle
Definition: svdhdl.cxx:1065
const SdrMarkList & GetMarkedObjectList() const
Definition: svdmrkv.hxx:243
Size GetOutputSize() const
SdrPageView * GetPageView() const
Definition: svdmark.hxx:70
void SetHasMarkedObj(bool bOn)
Definition: svdpagv.hxx:183
virtual bool IsAction() const override
Definition: svdsnpv.cxx:203
void ImpSetGlueVisible2(bool bOn)
Definition: svdpntv.hxx:245
bool mbMouseOver
Definition: svdhdl.hxx:165
bool IsGluePointEditMode() const
Definition: svdmrkv.hxx:224
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1923
void MovMarkGluePoints(const Point &rPnt)
Definition: svdmrkv.cxx:493
SdrHdl * PickHandle(const Point &rPnt) const
Definition: svdmrkv.cxx:1663
long Bottom() const
void setSecondPosition(const basegfx::B2DPoint &rNew)
sal_uInt32 GetOrdNum() const
The order number (aka ZOrder, aka z-index) determines whether a SdrObject is located above or below a...
Definition: svdobj.cxx:795
void BrkMarkObj()
Definition: svdmrkv.cxx:397
#define SDR_HANDLE_COLOR_SIZE_NORMAL
Definition: svdhdl.hxx:252
virtual bool HasMacro() const
Definition: svdobj.cxx:1756
void SetMoveOutside(bool bOn)
Definition: svdhdl.cxx:2208
bool IsGroupObject() const
Definition: svdobj.cxx:641
void NextMove(const Point &rPnt)
Definition: svddrag.cxx:66
virtual void calculateGridOffsetForB2DRange(basegfx::B2DVector &rTarget, const basegfx::B2DRange &rB2DRange) const
void BegMarkObj(const Point &rPnt, bool bUnmark=false)
Definition: svdmrkv.cxx:351
bool IsInside(const Point &rPOINT) const
void NextPoint()
Definition: svddrag.cxx:73
bool mbSomeObjChgdFlag
Definition: svdpntv.hxx:174
SdrPageView * mpMarkedPV
Definition: svdmrkv.hxx:99
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void SetHdlSize(sal_uInt16 nSiz)
Definition: svdhdl.cxx:2192
#define XATTR_FILLSTYLE
Definition: xdef.hxx:107
bool TRG_HasMasterPage() const
Definition: svdpage.hxx:485
tools::Rectangle GetMarkedObjBoundRect() const
Definition: svdmrkv.cxx:2349
const SdrLayerIDSet * pVisiLayer
Definition: svdobj.hxx:192
Abstract DrawObject.
Definition: svdobj.hxx:312
Point GetOffsetPixelFrom(const vcl::Window &rWindow) const
virtual SfxViewShell * GetSfxViewShell() const
Get access to the view shell owning this draw view, if any.
Definition: svdmrkv.cxx:1564
bool getPossibleGridOffsetForSdrObject(basegfx::B2DVector &rOffset, const SdrObject *pObj, const SdrPageView *pPV) const
Definition: svdmrkv.cxx:1952
bool MarkNextObj(bool bPrev=false)
Definition: svdmrkv.cxx:1685
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
Definition: svdmodel.cxx:1960
Point GetAbsolutePos(const SdrObject &rObj) const
Definition: svdglue.cxx:47
OUString GetName() const
Definition: svdobj.cxx:697
virtual bool IsChart() const
virtual void AddCustomHdl()
Definition: svdmrkv.cxx:1236
virtual SdrInventor GetObjInventor() const
Definition: svdobj.cxx:552
sal_uInt16 FindGluePoint(sal_uInt16 nId) const
Definition: svdglue.cxx:331
void MovMarkPoints(const Point &rPnt)
Definition: svdmrkv.cxx:428
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:576
SdrObject * mpMarkedObj
Definition: svdmrkv.hxx:98
bool IsMarkProtect() const
Definition: svdobj.hxx:806
virtual void ClearPageView() override
Definition: svdmrkv.cxx:321
Point PixelToLogic(const Point &rDevicePt) const
void EndUndo()
Definition: svdmodel.cxx:482
const SdrLayerIDSet & GetLockedLayers() const
Definition: svdpagv.hxx:219
void SetStartIntens(sal_uInt16 nNewIntens)
Definition: xgrad.hxx:62
SdrHdl * GetFocusHdl() const
Definition: svdhdl.cxx:2131
void SetRef1(const Point &rPt)
Definition: svdmrkv.cxx:1542
bool IsSet(SdrLayerID a) const
Definition: svdsob.hxx:66
SdrViewEditMode meEditMode
Definition: svdmrkv.hxx:113
size_t GetHdlCount() const
Definition: svdhdl.hxx:461
SdrHdl * GetHdl(size_t nNum) const
Definition: svdhdl.hxx:462
SdrViewEditMode meEditMode0
Definition: svdmrkv.hxx:114
bool IsUnoObj() const
Definition: svdobj.hxx:796
bool IsMarkPoints() const
Definition: svdmrkv.hxx:352
void SetMarkRects()
Definition: svdmrkv.cxx:1595
bool mbMarkedPointsRectsDirty
Definition: svdmrkv.hxx:122
OverlayObject & getOverlayObject(sal_uInt32 nIndex) const
bool EndMarkObj()
Definition: svdmrkv.cxx:376
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: svdmrkv.cxx:174
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool equalZero() const
basegfx::B2DPoint maSecondPosition
tools::Rectangle & Union(const tools::Rectangle &rRect)
SdrDragMode
Definition: svdtypes.hxx:34
SdrPage * GetPage() const
Definition: svdpagv.hxx:171
OUString ImpGetDescriptionString(const char *pStrCacheID, ImpGetDescriptionOptions nOpt=ImpGetDescriptionOptions::NONE) const
Definition: svdmrkv.cxx:2383
static void notifyOtherView(SfxViewShell *pThisView, SfxViewShell const *pOtherView, int nType, const OString &rKey, const OString &rPayload)
ImplMarkingOverlay(const SdrPaintView &rView, const basegfx::B2DPoint &rStartPos, bool bUnmarking)
Definition: svdmrkv.cxx:88
virtual void MovAction(const Point &rPnt) override
Definition: svdsnpv.cxx:208
virtual void TakeActionRect(tools::Rectangle &rRect) const override
Definition: svdmrkv.cxx:308
SVX_DLLPRIVATE void ImpClearVars()
Definition: svdmrkv.cxx:130
void SetPageView(SdrPageView *pNewPV)
Definition: svdhdl.hxx:201
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1883
virtual void BckAction() override
Definition: svdsnpv.cxx:230
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
Definition: svdmrkv.cxx:2341
void SetFocusHdl(SdrHdl *pNew)
Definition: svdhdl.cxx:2139
virtual void EndAction() override
Definition: svdsnpv.cxx:219
void SetDesignMode(bool _bDesignMode) const
Sets all elements in the view which support a design and an alive mode into the given mode...
Definition: svdpagv.cxx:338
void SetDragMode(SdrDragMode eMode)
Definition: svdmrkv.cxx:1241
FIXME: The virtual object is not yet fully implemented and tested.
Definition: svdovirt.hxx:30
virtual long GetRotateAngle() const
Definition: svdobj.cxx:1639
sal_uInt32 GetNavigationPosition() const
Definition: svdobj.cxx:832
bool EndMarkPoints()
Definition: svdmrkv.cxx:440
bool areMarkHandlesHidden() const
Definition: svdmrkv.hxx:268
const Point & GetPosPixel() const
SdrObject * GetMarkedObjectByIndex(size_t nNum) const
Definition: svdmrkv.hxx:248
const Point & GetOrigin() const
void SetFrameHandles(bool bOn)
Definition: svdmrkv.cxx:1606
const Point & GetNow() const
Definition: svddrag.hxx:95
long Left() const
SdrObject * getParentSdrObjectFromSdrObject() const
Definition: svdobj.cxx:651
ImpGetDescriptionOptions
options for ImpGetDescriptionString()
Definition: svdmrkv.hxx:79
virtual bool MarkPoints(const tools::Rectangle *pRect, bool bUnmark)
Definition: svdmrkv1.cxx:185
void BrkMarkPoints()
Definition: svdmrkv.cxx:462
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:310
bool EnterGroup(SdrObject *pObj)
Entering (editing) an object group After that, we have direct access to all member objects of the gro...
Definition: svdpagv.cxx:714
void SetPlusHdl(bool bOn)
Definition: svdhdl.hxx:224
sal_uInt16 GetMarkHdlSizePixel() const
Definition: svdmrkv.cxx:1938
virtual void ModelHasChanged() override
Definition: svdmrkv.cxx:189
bool IsDragObj() const
Definition: svddrgv.hxx:106
SdrHdlList maHdlList
Definition: svdmrkv.hxx:103
virtual void onMouseEnter(const MouseEvent &rMEvt)
is called when the mouse enters the area of this handle.
Definition: svdhdl.cxx:1061
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:314
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
Definition: svdmrkv.cxx:1671
sal_uInt16 nTol
Definition: svdobj.hxx:194
basegfx::B2DPoint maSecondPosition
Definition: svdmrkv.cxx:72
SdrMark * GetSdrMarkByIndex(size_t nNum) const
Definition: svdmrkv.hxx:247
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
ImplMarkingOverlay * mpMarkGluePointsOverlay
Definition: svdmrkv.hxx:95
SdrObjList * getParentSdrObjListFromSdrObject() const
Definition: svdobj.cxx:298
tools::Rectangle maMarkedObjRect
Definition: svdmrkv.hxx:106
std::map< OUString, OUString > aParameters
virtual void onMouseLeave()
is called when the mouse leaves the area of this handle.
Definition: svdhdl.cxx:1069
virtual std::unique_ptr< SdrUndoAction > CreateUndoAttrObject(SdrObject &rObject, bool bStyleSheet1=false, bool bSaveText=false)
Definition: svdundo.cxx:1649
rtl::OString toString() const
void InsertEntry(const SdrMark &rMark, bool bChkSort=true)
Definition: svdmark.cxx:259
void SetMarkHdlSizePixel(sal_uInt16 nSiz)
Definition: svdmrkv.cxx:1943
virtual void HideSdrPage() override
Definition: svdmrkv.cxx:327
static void GradToVec(GradTransGradient const &rG, GradTransVector &rV, const SdrObject *pObj)
Definition: gradtrns.cxx:30
css::uno::Reference< css::frame::XController > & GetXController()
SdrMarkList & GetMarkedObjectListWriteAccess()
Definition: svdmrkv.hxx:239
SdrModel * GetModel() const
Definition: svdpntv.hxx:271
void SetRef2(const Point &rPt)
Definition: svdmrkv.cxx:1553
virtual SdrObject * getSdrObjectFromSdrObjList() const
Definition: svdpage.cxx:145
void CheckMarked()
Definition: svdmrkv.cxx:1569
bool mbForceFrameHandles
Definition: svdmrkv.hxx:117
Point TopRight() const
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
Definition: svdpntv.cxx:71
virtual vcl::Window * GetEditWindowForActiveOLEObj() const override
open Bezier-curve
Definition: svdobj.hxx:128
const SdrPageView * pPageView
Definition: svdobj.hxx:193
void SetRotateShear(bool bOn)
Definition: svdhdl.cxx:2224
bool IsObjMarkable(SdrObject const *pObj) const
At least one member must be visible for the Group object and it must not be locked.
Definition: svdpagv.cxx:579
Point Center() const
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2294
sal_uInt16 nPos
Point TopCenter() const
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
virtual bool HasMarkablePoints() const
Definition: svdmrkv1.cxx:28
sal_uInt32 count() const
bool DeletePageView(const SdrPageView &rPV)
Definition: svdmark.cxx:371
bool createTableEdgesJson(boost::property_tree::ptree &rJsonRoot)
Definition: svdotable.cxx:2460
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
bool IsObjMarked(SdrObject const *pObj) const
Definition: svdmrkv.cxx:1933
virtual bool RequestHelp(const HelpEvent &rHEvt) override
Definition: svdmrkv.cxx:1434