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