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