LibreOffice Module sd (master) 1
fudraw.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#include <sal/config.h>
21
22#include <vcl/svapp.hxx>
23#include <vcl/ptrstyle.hxx>
24#include <editeng/flditem.hxx>
25#include <svx/svdogrp.hxx>
26#include <tools/urlobj.hxx>
27#include <vcl/help.hxx>
28#include <svx/bmpmask.hxx>
29#include <svx/svdotext.hxx>
30#include <svx/ImageMapInfo.hxx>
31#include <sfx2/dispatch.hxx>
32#include <sfx2/bindings.hxx>
33#include <sfx2/sfxhelp.hxx>
34#include <svx/svdpagv.hxx>
35#include <vcl/imapobj.hxx>
36#include <svx/svxids.hrc>
37#include <svx/obj3d.hxx>
38#include <svx/scene3d.hxx>
39#include <sfx2/viewfrm.hxx>
40
41#include <strings.hrc>
42
43
44#include <sdmod.hxx>
45#include <fudraw.hxx>
46#include <ViewShell.hxx>
47#include <FrameView.hxx>
48#include <View.hxx>
49#include <Window.hxx>
50#include <drawdoc.hxx>
51#include <DrawDocShell.hxx>
52#include <sdresid.hxx>
53#include <fusel.hxx>
54#include <vcl/weld.hxx>
56
57using namespace ::com::sun::star;
58
59namespace sd {
60
61
66 SdDrawDocument* pDoc, SfxRequest& rReq)
67 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
68 , aNewPointer(PointerStyle::Arrow)
69 , aOldPointer(PointerStyle::Arrow)
70 , bMBDown(false)
71 , bDragHelpLine(false)
72 , nHelpLine(0)
73 , bPermanent(false)
74{
75}
76
78{
80}
81
82
86void FuDraw::DoModifiers(const MouseEvent& rMEvt, bool bSnapModPressed)
87{
88 FrameView* pFrameView = mpViewShell->GetFrameView();
89 bool bGridSnap = pFrameView->IsGridSnap();
90 bGridSnap = (bSnapModPressed != bGridSnap);
91
92 if (mpView->IsGridSnap() != bGridSnap)
93 mpView->SetGridSnap(bGridSnap);
94
95 bool bBordSnap = pFrameView->IsBordSnap();
96 bBordSnap = (bSnapModPressed != bBordSnap);
97
98 if (mpView->IsBordSnap() != bBordSnap)
99 mpView->SetBordSnap(bBordSnap);
100
101 bool bHlplSnap = pFrameView->IsHlplSnap();
102 bHlplSnap = (bSnapModPressed != bHlplSnap);
103
104 if (mpView->IsHlplSnap() != bHlplSnap)
105 mpView->SetHlplSnap(bHlplSnap);
106
107 bool bOFrmSnap = pFrameView->IsOFrmSnap();
108 bOFrmSnap = (bSnapModPressed != bOFrmSnap);
109
110 if (mpView->IsOFrmSnap() != bOFrmSnap)
111 mpView->SetOFrmSnap(bOFrmSnap);
112
113 bool bOPntSnap = pFrameView->IsOPntSnap();
114 bOPntSnap = (bSnapModPressed != bOPntSnap);
115
116 if (mpView->IsOPntSnap() != bOPntSnap)
117 mpView->SetOPntSnap(bOPntSnap);
118
119 bool bOConSnap = pFrameView->IsOConSnap();
120 bOConSnap = (bSnapModPressed != bOConSnap);
121
122 if (mpView->IsOConSnap() != bOConSnap)
123 mpView->SetOConSnap(bOConSnap);
124
125 bool bAngleSnap = rMEvt.IsShift() == !pFrameView->IsAngleSnapEnabled();
126
127 if (mpView->IsAngleSnapEnabled() != bAngleSnap)
128 mpView->SetAngleSnapEnabled(bAngleSnap);
129
130 bool bCenter = rMEvt.IsMod2();
131
132 if ( mpView->IsCreate1stPointAsCenter() != bCenter ||
133 mpView->IsResizeAtCenter() != bCenter )
134 {
136 mpView->SetResizeAtCenter(bCenter);
137 }
138}
139
140
142{
143 // remember button state for creation of own MouseEvents
145
146 bool bReturn = false;
147 bDragHelpLine = false;
148 aMDPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
149
150 if ( rMEvt.IsLeft() )
151 {
152 FrameView* pFrameView = mpViewShell->GetFrameView();
153
154 bool bOrtho = false;
155
156 bool bRestricted = true;
157
158 if (mpView->IsDragObj())
159 {
160 // object is dragged (move, resize,...)
161 const SdrHdl* pHdl = mpView->GetDragStat().GetHdl();
162
163 if (!pHdl || (!pHdl->IsCornerHdl() && !pHdl->IsVertexHdl()))
164 {
165 // Move
166 bRestricted = false;
167 }
168 }
169
170 // #i33136#
171 if(bRestricted && doConstructOrthogonal())
172 {
173 // Restrict movement:
174 // rectangle->square, ellipse->circle, etc.
175 bOrtho = !rMEvt.IsShift();
176 }
177 else
178 {
179 bOrtho = rMEvt.IsShift() != pFrameView->IsOrtho();
180 }
181 if (!mpView->IsSnapEnabled())
182 mpView->SetSnapEnabled(true);
183
184 bool bSnapModPressed = rMEvt.IsMod1();
185 if (mpView->IsOrtho() != bOrtho)
186 mpView->SetOrtho(bOrtho);
187
188 DoModifiers(rMEvt, bSnapModPressed);
189
190 SdrPageView* pPV = nullptr;
191 sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
192
193 // look only for HelpLines when they are visible (!)
194 bool bHelpLine(false);
195 if(mpView->IsHlplVisible())
196 bHelpLine = mpView->PickHelpLine(aMDPos, nHitLog, *mpWindow->GetOutDev(), nHelpLine, pPV);
197 bool bHitHdl = (mpView->PickHandle(aMDPos) != nullptr);
198
199 if ( bHelpLine
200 && !mpView->IsCreateObj()
201 && ((mpView->GetEditMode() == SdrViewEditMode::Edit && !bHitHdl) || (rMEvt.IsShift() && bSnapModPressed)) )
202 {
203 mpWindow->CaptureMouse();
206 bReturn = true;
207 }
208 }
209 ForcePointer(&rMEvt);
210
211 return bReturn;
212}
213
215{
216 FrameView* pFrameView = mpViewShell->GetFrameView();
217 Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
218
219 bool bOrtho = false;
220 bool bRestricted = true;
221
222 if (mpView->IsDragObj())
223 {
224 // object is dragged (move, resize, ...)
225 const SdrHdl* pHdl = mpView->GetDragStat().GetHdl();
226
227 if (!pHdl || (!pHdl->IsCornerHdl() && !pHdl->IsVertexHdl()))
228 {
229 // Move
230 bRestricted = false;
231 }
232 }
233
234 if (mpView->IsAction())
235 {
236 // #i33136# and fdo#88339
237 if(bRestricted && doConstructOrthogonal())
238 {
239 // Scale proportionally by default:
240 // rectangle->square, ellipse->circle, images, etc.
241 bOrtho = !rMEvt.IsShift();
242 }
243 else
244 {
245 bOrtho = rMEvt.IsShift() != pFrameView->IsOrtho();
246 }
247
248 bool bSnapModPressed = rMEvt.IsMod2();
249 mpView->SetDragWithCopy(rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
250
251 if (mpView->IsOrtho() != bOrtho)
252 mpView->SetOrtho(bOrtho);
253 DoModifiers(rMEvt, bSnapModPressed);
254
255
256 if ( mpView->IsDragHelpLine() )
257 mpView->MovDragHelpLine(aPos);
258 }
259
260 bool bReturn = mpView->MouseMove(rMEvt, mpWindow->GetOutDev());
261
262 if (mpView->IsAction())
263 {
264 // Because the flag set back if necessary in MouseMove
265 if (mpView->IsOrtho() != bOrtho)
266 mpView->SetOrtho(bOrtho);
267 }
268
269 ForcePointer(&rMEvt);
270
271 return bReturn;
272}
273
275{
276 if (mpView && mpView->IsDragHelpLine())
278
279 if ( bDragHelpLine )
280 {
281 ::tools::Rectangle aOutputArea(Point(0,0), mpWindow->GetOutputSizePixel());
282
283 if (mpView && !aOutputArea.Contains(rMEvt.GetPosPixel()))
285
286 mpWindow->ReleaseMouse();
287 }
288
289 if (mpView)
290 {
291 FrameView* pFrameView = mpViewShell->GetFrameView();
292 mpView->SetOrtho( pFrameView->IsOrtho() );
294 mpView->SetSnapEnabled(true);
297 mpView->SetDragWithCopy(pFrameView->IsDragWithCopy());
298 mpView->SetGridSnap(pFrameView->IsGridSnap());
299 mpView->SetBordSnap(pFrameView->IsBordSnap());
300 mpView->SetHlplSnap(pFrameView->IsHlplSnap());
301 mpView->SetOFrmSnap(pFrameView->IsOFrmSnap());
302 mpView->SetOPntSnap(pFrameView->IsOPntSnap());
303 mpView->SetOConSnap(pFrameView->IsOConSnap());
304 }
305
306 bIsInDragMode = false;
307 ForcePointer(&rMEvt);
309
310 return false;
311}
312
317bool FuDraw::KeyInput(const KeyEvent& rKEvt)
318{
319 bool bReturn = false;
320
321 switch ( rKEvt.GetKeyCode().GetCode() )
322 {
323 case KEY_ESCAPE:
324 {
325 bReturn = FuDraw::cancel();
326 }
327 break;
328
329 case KEY_DELETE:
330 case KEY_BACKSPACE:
331 {
332 if (!mpDocSh->IsReadOnly())
333 {
334 if (mpView->IsPresObjSelected(false, true, false, true))
335 {
336 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(),
337 VclMessageType::Info, VclButtonsType::Ok,
338 SdResId(STR_ACTION_NOTPOSSIBLE)));
339 xInfoBox->run();
340 }
341 else
342 {
343 // wait-mousepointer while deleting object
345 // delete object
347 }
348 }
349 bReturn = true;
350 }
351 break;
352
353 case KEY_TAB:
354 {
355 vcl::KeyCode aCode = rKEvt.GetKeyCode();
356
357 if ( !aCode.IsMod1() && !aCode.IsMod2() )
358 {
359 // Moved next line which was a bugfix itself into
360 // the scope which really does the object selection travel
361 // and thus is allowed to call SelectionHasChanged().
362
363 // Switch to FuSelect.
365 SID_OBJECT_SELECT,
366 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
367
368 // changeover to the next object
369 if(!mpView->MarkNextObj( !aCode.IsShift() ))
370 {
371 //If there is only one object, don't do the UnmarkAllObj() & MarkNextObj().
373 {
374 // No next object: go over open end and get first from
375 // the other side
377 mpView->MarkNextObj(!aCode.IsShift());
378 }
379 }
380
383
384 bReturn = true;
385 }
386 }
387 break;
388
389 case KEY_END:
390 {
391 vcl::KeyCode aCode = rKEvt.GetKeyCode();
392
393 if ( aCode.IsMod1() )
394 {
395 // mark last object
398
401
402 bReturn = true;
403 }
404 }
405 break;
406
407 case KEY_HOME:
408 {
409 vcl::KeyCode aCode = rKEvt.GetKeyCode();
410
411 if ( aCode.IsMod1() )
412 {
413 // mark first object
415 mpView->MarkNextObj(true);
416
419
420 bReturn = true;
421 }
422 }
423 break;
424
425 default:
426 break;
427 }
428
429 if (!bReturn)
430 {
431 bReturn = FuPoor::KeyInput(rKEvt);
432 }
433 else
434 {
435 mpWindow->ReleaseMouse();
436 }
437
438 return bReturn;
439}
440
442{
444 ForcePointer();
445}
446
451{
452 Point aPnt;
453 sal_uInt16 nModifier = 0;
454 bool bLeftDown = false;
455 bool bDefPointer = true;
456
457 if (pMEvt)
458 {
459 aPnt = mpWindow->PixelToLogic(pMEvt->GetPosPixel());
460 nModifier = pMEvt->GetModifier();
461 bLeftDown = pMEvt->IsLeft();
462 }
463 else
464 {
465 aPnt = mpWindow->PixelToLogic(mpWindow->GetPointerPosPixel());
466 }
467
468 if (mpView->IsDragObj())
469 {
470 if (SD_MOD()->GetWaterCan() && !mpView->PickHandle(aPnt))
471 {
472 // water can mode
473 bDefPointer = false;
474 mpWindow->SetPointer(PointerStyle::Fill);
475 }
476 }
477 else
478 {
479 SdrHdl* pHdl = mpView->PickHandle(aPnt);
480
481 if (SD_MOD()->GetWaterCan() && !pHdl)
482 {
483 // water can mode
484 bDefPointer = false;
485 mpWindow->SetPointer(PointerStyle::Fill);
486 }
487 else if (!pHdl &&
488 mpViewShell->GetViewFrame()->HasChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()))
489 {
490 // pipette mode
491 SfxChildWindow* pWnd = mpViewShell->GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId());
492 SvxBmpMask* pMask = pWnd ? static_cast<SvxBmpMask*>(pWnd->GetWindow()) : nullptr;
493 if (pMask && pMask->IsEyedropping())
494 {
495 bDefPointer = false;
496 mpWindow->SetPointer(PointerStyle::RefHand);
497 }
498 }
499 else if (!mpView->IsAction())
500 {
501 SdrObject* pObj = nullptr;
502 SdrPageView* pPV = nullptr;
503 SdrViewEvent aVEvt;
504 SdrHitKind eHit = SdrHitKind::NONE;
505 SdrDragMode eDragMode = mpView->GetDragMode();
506
507 if (pMEvt)
508 {
509 eHit = mpView->PickAnything(*pMEvt, SdrMouseEventKind::MOVE, aVEvt);
510 }
511
512 if ((eDragMode == SdrDragMode::Rotate) && (eHit == SdrHitKind::MarkedObject))
513 {
514 // The goal of this request is show always the rotation arrow for 3D-objects at rotation mode
515 // Independent of the settings at Tools->Options->Draw "Objects always moveable"
516 // 2D-objects acquit in another way. Otherwise, the rotation of 3d-objects around any axes
517 // wouldn't be possible per default.
518 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
519 SdrObject* pObject = rMarkList.GetMark(0)->GetMarkedSdrObj();
520 if (DynCastE3dObject(pObject) && (rMarkList.GetMarkCount() == 1))
521 {
522 mpWindow->SetPointer(PointerStyle::Rotate);
523 bDefPointer = false; // Otherwise it'll be called Joe's routine and the mousepointer will reconfigurate again
524 }
525 }
526
527 if (eHit == SdrHitKind::NONE)
528 {
529 // found nothing -> look after at the masterpage
530 pObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER);
531 }
532 else if (eHit == SdrHitKind::UnmarkedObject)
533 {
534 pObj = aVEvt.mpObj;
535 }
536 else if (eHit == SdrHitKind::TextEditObj && dynamic_cast< const FuSelection *>( this ) != nullptr)
537 {
538 SdrObjKind nSdrObjKind = aVEvt.mpObj->GetObjIdentifier();
539
540 if ( nSdrObjKind != SdrObjKind::Text &&
541 nSdrObjKind != SdrObjKind::TitleText &&
542 nSdrObjKind != SdrObjKind::OutlineText &&
543 aVEvt.mpObj->IsEmptyPresObj() )
544 {
545 pObj = nullptr;
546 bDefPointer = false;
547 mpWindow->SetPointer(PointerStyle::Arrow);
548 }
549 }
550
551 if (pObj && pMEvt && !pMEvt->IsMod2()
552 && dynamic_cast<const FuSelection*>(this) != nullptr)
553 {
554 // test for ImageMap
555 bDefPointer = !SetPointer(pObj, aPnt);
556
557 if (bDefPointer
558 && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr
559 || DynCastE3dScene(pObj)))
560 {
561 // take a glance into the group
562 pObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV,
563 SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP);
564 if (pObj)
565 bDefPointer = !SetPointer(pObj, aPnt);
566 }
567 }
568 }
569 }
570
571 if (bDefPointer)
572 {
574 aPnt, mpWindow->GetOutDev(), nModifier, bLeftDown));
575 }
576}
577
583bool FuDraw::SetPointer(const SdrObject* pObj, const Point& rPos)
584{
585 bool bImageMapInfo = SvxIMapInfo::GetIMapInfo(pObj) != nullptr;
586
587 if (!bImageMapInfo)
588 return false;
589
590 const SdrLayerIDSet* pVisiLayer = &mpView->GetSdrPageView()->GetVisibleLayers();
591 double fHitLog(mpWindow->PixelToLogic(Size(HITPIX, 0)).Width());
592 ::tools::Long n2HitLog(fHitLog * 2);
593 Point aHitPosR(rPos);
594 Point aHitPosL(rPos);
595 Point aHitPosT(rPos);
596 Point aHitPosB(rPos);
597
598 aHitPosR.AdjustX(n2HitLog);
599 aHitPosL.AdjustX(-n2HitLog);
600 aHitPosT.AdjustY(n2HitLog);
601 aHitPosB.AdjustY(-n2HitLog);
602
603 if (!pObj->IsClosedObj()
604 || (SdrObjectPrimitiveHit(*pObj, aHitPosR, {fHitLog, fHitLog}, *mpView->GetSdrPageView(), pVisiLayer,
605 false)
606 && SdrObjectPrimitiveHit(*pObj, aHitPosL, {fHitLog, fHitLog}, *mpView->GetSdrPageView(),
607 pVisiLayer, false)
608 && SdrObjectPrimitiveHit(*pObj, aHitPosT, {fHitLog, fHitLog}, *mpView->GetSdrPageView(),
609 pVisiLayer, false)
610 && SdrObjectPrimitiveHit(*pObj, aHitPosB, {fHitLog, fHitLog}, *mpView->GetSdrPageView(),
611 pVisiLayer, false)))
612 {
613 // hit inside the object (without margin) or open object
614 if (SvxIMapInfo::GetHitIMapObject(pObj, rPos))
615 {
616 mpWindow->SetPointer(PointerStyle::RefHand);
617 return true;
618 }
619 }
620
621 return false;
622}
623
628{
629 sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
630
631 if ( mpView->AreObjectsMarked() )
632 {
633 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
634
635 if (rMarkList.GetMarkCount() == 1)
636 {
637 SdrMark* pMark = rMarkList.GetMark(0);
638 SdrObject* pObj = pMark->GetMarkedSdrObj();
639
640 SdrInventor nInv = pObj->GetObjInventor();
641 SdrObjKind nSdrObjKind = pObj->GetObjIdentifier();
642
643 if (nInv == SdrInventor::Default && nSdrObjKind == SdrObjKind::OLE2)
644 {
645 // activate OLE-object
646 SfxInt16Item aItem(SID_OBJECT, 0);
648 GetDispatcher()->ExecuteList(SID_OBJECT,
649 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
650 { &aItem });
651 }
652 else if (nInv == SdrInventor::Default && nSdrObjKind == SdrObjKind::Graphic && pObj->IsEmptyPresObj() )
653 {
655 GetDispatcher()->Execute( SID_INSERT_GRAPHIC,
656 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
657 }
658 else if ( ( DynCastSdrTextObj( pObj ) != nullptr || dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr ) &&
659 !SD_MOD()->GetWaterCan() &&
662 {
663 SfxUInt16Item aItem(SID_TEXTEDIT, 2);
665 SID_TEXTEDIT,
666 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
667 { &aItem });
668 }
669 else if (nInv == SdrInventor::Default && nSdrObjKind == SdrObjKind::Group)
670 {
671 // hit group -> select subobject
672 mpView->UnMarkAll();
673 mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift(), true);
674 }
675 }
676 }
677 else
678 mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
679}
680
682{
683 bool bReturn = false;
684
686 {
687 SdrViewEvent aVEvt;
688
689 MouseEvent aMEvt(mpWindow->GetPointerPosPixel(), 1, MouseEventModifiers::NONE, MOUSE_LEFT);
690
691 SdrHitKind eHit = mpView->PickAnything(aMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
692
693 SdrObject* pObj = aVEvt.mpObj;
694
695 if (eHit != SdrHitKind::NONE && pObj != nullptr)
696 {
697 Point aPosPixel = rHEvt.GetMousePosPixel();
698
699 bReturn = SetHelpText(pObj, aPosPixel, aVEvt);
700
701 if (!bReturn && (dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr || DynCastE3dScene(pObj)))
702 {
703 // take a glance into the group
704 SdrPageView* pPV = nullptr;
705
706 Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(aPosPixel)));
707
708 pObj = mpView->PickObj(aPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP);
709 if (pObj)
710 bReturn = SetHelpText(pObj, aPosPixel, aVEvt);
711 }
712 }
713 }
714
715 if (!bReturn)
716 {
717 bReturn = FuPoor::RequestHelp(rHEvt);
718 }
719
720 if (!bReturn)
721 bReturn = mpView->RequestHelp(rHEvt);
722
723 return bReturn;
724}
725
726bool FuDraw::SetHelpText(const SdrObject* pObj, const Point& rPosPixel, const SdrViewEvent& rVEvt)
727{
728 OUString aHelpText;
729 Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(rPosPixel)));
730 IMapObject* pIMapObj = SvxIMapInfo::GetHitIMapObject(pObj, aPos);
731
732 if (!rVEvt.mpURLField && !pIMapObj)
733 return false;
734
735 OUString aURL;
736 if (rVEvt.mpURLField)
739 else if (pIMapObj)
740 {
741 aURL = pIMapObj->GetAltText() +
742 " (" +
743 INetURLObject::decode(pIMapObj->GetURL(),
745 ")";
746 }
747 else
748 return false;
749
750 aHelpText = SfxHelp::GetURLHelpText(aURL);
751
752 if (aHelpText.isEmpty())
753 return false;
754
755 ::tools::Rectangle aLogicPix = mpWindow->LogicToPixel(pObj->GetLogicRect());
756 ::tools::Rectangle aScreenRect(mpWindow->OutputToScreenPixel(aLogicPix.TopLeft()),
757 mpWindow->OutputToScreenPixel(aLogicPix.BottomRight()));
758
760 Help::ShowBalloon( static_cast<vcl::Window*>(mpWindow), rPosPixel, aScreenRect, aHelpText);
761 else if (Help::IsQuickHelpEnabled())
762 Help::ShowQuickHelp( static_cast<vcl::Window*>(mpWindow), aScreenRect, aHelpText);
763
764 return true;
765}
766
774{
775 bool bReturn = false;
776
777 if ( mpView->IsAction() )
778 {
779 mpView->BrkAction();
780 bReturn = true;
781 }
782 else if ( mpView->IsTextEdit() )
783 {
785 bReturn = true;
786
788 rBindings.Invalidate( SID_DEC_INDENT );
789 rBindings.Invalidate( SID_INC_INDENT );
790 rBindings.Invalidate( SID_PARASPACE_INCREASE );
791 rBindings.Invalidate( SID_PARASPACE_DECREASE );
792 }
793 else if ( mpView->AreObjectsMarked() )
794 {
795 const SdrHdlList& rHdlList = mpView->GetHdlList();
796 SdrHdl* pHdl = rHdlList.GetFocusHdl();
797
798 if(pHdl)
799 {
800 const_cast<SdrHdlList&>(rHdlList).ResetFocusHdl();
801 }
802 else
803 {
804 mpView->UnmarkAll();
805 }
806
807 // Switch to FuSelect.
809 SID_OBJECT_SELECT,
810 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
811
812 bReturn = true;
813 }
814
815 return bReturn;
816}
817
818} // end of namespace sd
819
820/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
const Point & GetMousePosPixel() const
static bool IsQuickHelpEnabled()
static bool IsBalloonHelpEnabled()
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
static void ShowBalloon(vcl::Window *pParent, const Point &rScreenPos, const tools::Rectangle &, const OUString &rHelpText)
const OUString & GetAltText() const
const OUString & GetURL() const
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
const vcl::KeyCode & GetKeyCode() const
bool IsMod1() const
bool IsMod2() const
sal_uInt16 GetModifier() const
sal_uInt16 GetButtons() const
const Point & GetPosPixel() const
bool IsLeft() const
bool IsShift() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
bool IsCreateObj() const
void SetCreate1stPointAsCenter(bool bOn)
virtual void BrkAction() override
bool IsCreate1stPointAsCenter() const
virtual bool IsAction() const override
const SdrHdl * GetHdl() const
bool IsDragWithCopy() const
void SetDragWithCopy(bool bOn)
bool IsResizeAtCenter() const
void SetResizeAtCenter(bool bOn)
bool IsDragObj() const
SdrHdl * GetFocusHdl() const
bool IsVertexHdl() const
bool IsCornerHdl() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
SdrHdl * PickHandle(const Point &rPnt) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
const SdrHdlList & GetHdlList() const
void UnMarkAll(SdrPageView const *pPV=nullptr)
SdrObject * PickObj(const Point &rPnt, short nTol, SdrPageView *&rpPV, SdrSearchOptions nOptions, SdrObject **ppRootObj, bool *pbHitPassDirect=nullptr) const
SdrViewEditMode GetEditMode() const
SdrDragMode GetDragMode() const
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
bool HasMultipleMarkableObjects() const
virtual bool RequestHelp(const HelpEvent &rHEvt) override
const tools::Rectangle & GetAllMarkedRect() const
bool MarkNextObj(bool bPrev=false)
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
virtual bool IsTextEdit() const final override
bool IsClosedObj() const
virtual SdrInventor GetObjInventor() const
bool IsEmptyPresObj() const
virtual SdrObjKind GetObjIdentifier() const
virtual const tools::Rectangle & GetLogicRect() const
const SdrLayerIDSet & GetVisibleLayers() const
void DeleteHelpLine(sal_uInt16 nNum)
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin)
bool IsHlplVisible() const
const SdrDragStat & GetDragStat() const
SdrPageView * GetSdrPageView() const
sal_uInt16 getHitTolLog() const
void MovDragHelpLine(const Point &rPnt)
void SetOFrmSnap(bool bOn)
bool EndDragHelpLine()
void SetOPntSnap(bool bOn)
void SetHlplSnap(bool bOn)
bool IsOrtho() const
void SetBordSnap(bool bOn)
void SetGridSnap(bool bOn)
void SetOrtho(bool bOn)
void SetSnapEnabled(bool bOn)
bool IsHlplSnap() const
void SetAngleSnapEnabled(bool bOn)
bool IsAngleSnapEnabled() const
bool IsSnapEnabled() const
bool PickHelpLine(const Point &rPnt, short nTol, const OutputDevice &rOut, sal_uInt16 &rnHelpLineNum, SdrPageView *&rpPV) const
bool IsOFrmSnap() const
bool IsGridSnap() const
bool IsOPntSnap() const
bool BegDragHelpLine(sal_uInt16 nHelpLineNum, SdrPageView *pPV)
bool IsOConSnap() const
bool IsDragHelpLine() const
bool IsBordSnap() const
void SetOConSnap(bool bOn)
virtual void DeleteMarked()
SdrHitKind PickAnything(const MouseEvent &rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent &rVEvt) const
void UnmarkAll()
PointerStyle GetPreferredPointer(const Point &rMousePos, const OutputDevice *pOut, sal_uInt16 nModifier=0, bool bLeftDown=false) const
virtual bool MouseMove(const MouseEvent &rMEvt, OutputDevice *pWin) override
void Invalidate(sal_uInt16 nId)
vcl::Window * GetWindow() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
static OUString GetURLHelpText(std::u16string_view)
bool IsReadOnly() const
SfxBindings & GetBindings()
bool HasChildWindow(sal_uInt16)
SfxDispatcher * GetDispatcher()
SfxChildWindow * GetChildWindow(sal_uInt16)
bool IsEyedropping() const
static SvxIMapInfo * GetIMapInfo(const SdrObject *pObject)
static IMapObject * GetHitIMapObject(const SdrObject *pObj, const Point &rWinPoint, const OutputDevice *pCmpWnd=nullptr)
const OUString & GetURL() const
View for MDIFrame.
Definition: FrameView.hxx:36
bool IsDoubleClickTextEdit() const
Definition: FrameView.hxx:127
virtual bool KeyInput(const KeyEvent &rKEvt) override
Process keyboard input.
Definition: fudraw.cxx:317
sal_uInt16 nHelpLine
Definition: fudraw.hxx:75
bool SetPointer(const SdrObject *pObj, const Point &rPos)
Set cursor to pointer when in clickable area of an ImageMap.
Definition: fudraw.cxx:583
virtual ~FuDraw() override
Definition: fudraw.cxx:77
void DoModifiers(const MouseEvent &rMEvt, bool bSnapModPressed)
Code shared by MouseButtonDown and MouseMove.
Definition: fudraw.cxx:86
bool SetHelpText(const SdrObject *pObj, const Point &rPos, const SdrViewEvent &rVEvt)
Definition: fudraw.cxx:726
virtual bool cancel() override
is called when the current function should be aborted.
Definition: fudraw.cxx:773
virtual bool RequestHelp(const HelpEvent &rHEvt) override
Definition: fudraw.cxx:681
virtual void Activate() override
activates the function
Definition: fudraw.cxx:441
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: fudraw.cxx:214
FuDraw(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Base-class for all drawmodul-specific functions.
Definition: fudraw.cxx:65
virtual void DoubleClick(const MouseEvent &rMEvt)
Response of doubleclick.
Definition: fudraw.cxx:627
virtual void ForcePointer(const MouseEvent *pMEvt=nullptr)
Toggle mouse-pointer.
Definition: fudraw.cxx:450
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: fudraw.cxx:274
bool bDragHelpLine
Definition: fudraw.hxx:74
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: fudraw.cxx:141
Base class for all functions.
Definition: fupoor.hxx:48
virtual bool doConstructOrthogonal() const
Decide if the object to be created should be created orthogonal.
Definition: fupoor.cxx:1082
virtual bool MouseButtonUp(const MouseEvent &rMEvt)
Definition: fupoor.cxx:965
virtual bool RequestHelp(const HelpEvent &rHEvt)
Definition: fupoor.cxx:989
virtual bool KeyInput(const KeyEvent &rKEvt)
handle keyboard events
Definition: fupoor.cxx:175
virtual void Activate()
activates the function
Definition: fupoor.cxx:98
VclPtr< ::sd::Window > mpWindow
Definition: fupoor.hxx:146
Point aMDPos
position of MouseButtonDown
Definition: fupoor.hxx:159
ViewShell * mpViewShell
Definition: fupoor.hxx:145
void SetMouseButtonCode(sal_uInt16 nNew)
Definition: fupoor.hxx:57
bool bIsInDragMode
Definition: fupoor.hxx:158
DrawDocShell * mpDocSh
Definition: fupoor.hxx:147
::sd::View * mpView
Definition: fupoor.hxx:144
static const int HITPIX
Definition: fupoor.hxx:50
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
FrameView * GetFrameView()
Definition: ViewShell.hxx:221
SD_DLLPUBLIC weld::Window * GetFrameWeld() const
Definition: viewshel.cxx:1582
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
bool IsPresObjSelected(bool bOnPage=true, bool bOnMasterPage=true, bool bCheckPresObjListOnly=false, bool bCheckLayoutOnly=false) const
Is a presentation object selected?
Definition: sdview.cxx:523
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
ends current text editing
Definition: sdview.cxx:772
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
bool Contains(const Point &rPOINT) const
constexpr Point TopLeft() const
constexpr Point BottomRight() const
bool IsMod1() const
sal_uInt16 GetCode() const
bool IsShift() const
bool IsMod2() const
URL aURL
EmbeddedObjectRef * pObject
#define MOUSE_LEFT
constexpr sal_uInt16 KEY_ESCAPE
constexpr sal_uInt16 KEY_HOME
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_DELETE
constexpr sal_uInt16 KEY_BACKSPACE
constexpr sal_uInt16 KEY_END
SfxDispatcher * GetDispatcher()
long Long
PointerStyle
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
#define SD_MOD()
Definition: sdmod.hxx:184
SVXCORE_DLLPUBLIC SdrObject * SdrObjectPrimitiveHit(const SdrObject &rObject, const Point &rPnt, const basegfx::B2DVector &rHitTolerance, const SdrPageView &rSdrPageView, const SdrLayerIDSet *pVisiLayer, bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer *pHitContainer=nullptr)
SdrObject * mpObj
const SvxURLField * mpURLField
SdrHitKind
SdrInventor
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
SVXCORE_DLLPUBLIC E3dObject * DynCastE3dObject(SdrObject *)
SVXCORE_DLLPUBLIC E3dScene * DynCastE3dScene(SdrObject *)
SdrObjKind
SdrDragMode