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