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