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