LibreOffice Module sw (master) 1
edtwin.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 <config_wasm_strip.h>
21
22#include <swtypes.hxx>
23#include <hintids.hxx>
24
25#include <com/sun/star/accessibility/XAccessible.hpp>
26#include <com/sun/star/awt/PopupMenuDirection.hpp>
27#include <com/sun/star/awt/XPopupMenu.hpp>
28#include <com/sun/star/i18n/XBreakIterator.hpp>
29#include <com/sun/star/i18n/ScriptType.hpp>
30#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
31#include <com/sun/star/i18n/UnicodeScript.hpp>
32#include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
33#include <com/sun/star/ui/ContextMenuExecuteEvent.hpp>
34
36#include <comphelper/string.hxx>
37
38#include <vcl/dialoghelper.hxx>
39#include <vcl/inputctx.hxx>
40#include <vcl/help.hxx>
41#include <vcl/weld.hxx>
42#include <vcl/ptrstyle.hxx>
43#include <svl/macitem.hxx>
45#include <basic/sbxvar.hxx>
46#include <svl/ctloptions.hxx>
47#include <basic/sbx.hxx>
48#include <svl/eitem.hxx>
49#include <svl/stritem.hxx>
50#include <sfx2/ipclient.hxx>
51#include <sfx2/viewfrm.hxx>
52#include <sfx2/request.hxx>
53#include <sfx2/bindings.hxx>
54#include <sfx2/dispatch.hxx>
55#include <svl/ptitem.hxx>
56#include <editeng/sizeitem.hxx>
57#include <editeng/langitem.hxx>
58#include <svx/statusitem.hxx>
59#include <svx/svdview.hxx>
60#include <svx/svdhdl.hxx>
61#include <svx/svdoutl.hxx>
62#include <editeng/editeng.hxx>
63#include <editeng/editview.hxx>
64#include <editeng/svxacorr.hxx>
65#include <editeng/flditem.hxx>
66#include <editeng/colritem.hxx>
68#include <unotools/datetime.hxx>
69
70#include <comphelper/lok.hxx>
71#include <sfx2/lokhelper.hxx>
72
73#include <editeng/acorrcfg.hxx>
74#include <bookmark.hxx>
75#include <SwSmartTagMgr.hxx>
76#include <edtdd.hxx>
77#include <edtwin.hxx>
78#include <view.hxx>
79#include <wrtsh.hxx>
81#include <IDocumentUndoRedo.hxx>
82#include <textboxhelper.hxx>
83#include <dcontact.hxx>
84#include <fldbas.hxx>
85#include <swmodule.hxx>
86#include <docsh.hxx>
87#include <viewopt.hxx>
88#include <drawbase.hxx>
89#include <dselect.hxx>
90#include <textsh.hxx>
91#include <shdwcrsr.hxx>
92#include <txatbase.hxx>
93#include <fmtanchr.hxx>
94#include <fmtornt.hxx>
95#include <fmthdft.hxx>
96#include <frmfmt.hxx>
97#include <modcfg.hxx>
98#include <fmtcol.hxx>
99#include <wview.hxx>
100#include <gloslst.hxx>
101#include <inputwin.hxx>
102#include <gloshdl.hxx>
103#include <swundo.hxx>
104#include <drwtxtsh.hxx>
105#include <fchrfmt.hxx>
106#include "romenu.hxx"
107#include <initui.hxx>
108#include <frmatr.hxx>
109#include <extinput.hxx>
110#include <acmplwrd.hxx>
111#include <swcalwrp.hxx>
112#include <swdtflvr.hxx>
113#include <breakit.hxx>
114#include <checkit.hxx>
115#include <pagefrm.hxx>
116
117#include <helpids.h>
118#include <cmdid.h>
119#include <uitool.hxx>
120#include <fmtfollowtextflow.hxx>
122#include <charfmt.hxx>
123#include <numrule.hxx>
124#include <pagedesc.hxx>
125#include <svtools/ruler.hxx>
126#include <formatclipboard.hxx>
127#include <vcl/svapp.hxx>
128#include <wordcountdialog.hxx>
129#include <fmtfld.hxx>
130
131#include <IMark.hxx>
132#include <doc.hxx>
133#include <xmloff/odffields.hxx>
134
135#include <PostItMgr.hxx>
137#include <AnnotationWin.hxx>
138
139#include <algorithm>
140#include <vector>
141
142#include <rootfrm.hxx>
143
147#include <sfx2/event.hxx>
148#include <memory>
149
150#include "../../core/crsr/callnk.hxx"
152#include <ndtxt.hxx>
153#include <cntfrm.hxx>
154#include <txtfrm.hxx>
155#include <strings.hrc>
156#include <textcontentcontrol.hxx>
158
159using namespace sw::mark;
160using namespace ::com::sun::star;
161
165static bool g_bInputLanguageSwitched = false;
166
167// Usually in MouseButtonUp a selection is revoked when the selection is
168// not currently being pulled open. Unfortunately in MouseButtonDown there
169// is being selected at double/triple click. That selection is completely
170// finished in the Handler and thus can't be distinguished in the Up.
171// To resolve this g_bHoldSelection is set in Down and evaluated in Up.
172static bool g_bHoldSelection = false;
173
174bool g_bFrameDrag = false;
175static bool g_bValidCursorPos = false;
176bool g_bModePushed = false;
177bool g_bDDTimerStarted = false;
178bool g_bDDINetAttr = false;
179static SdrHdlKind g_eSdrMoveHdl = SdrHdlKind::User;
180
182
185
186static SfxShell* lcl_GetTextShellFromDispatcher( SwView const & rView );
187
189static bool lcl_goIntoTextBox(SwEditWin& rEditWin, SwWrtShell& rSh)
190{
191 SdrMark* pMark = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0);
192 if (!pMark)
193 return false;
194
195 SdrObject* pSdrObject = pMark->GetMarkedSdrObj();
196 SwFrameFormat* pObjectFormat = ::FindFrameFormat(pSdrObject);
197 if (SwFrameFormat* pTextBoxFormat = SwTextBoxHelper::getOtherTextBoxFormat(pObjectFormat, RES_DRAWFRMFMT))
198 {
199 SdrObject* pTextBox = pTextBoxFormat->FindRealSdrObject();
200 SdrView* pSdrView = rSh.GetDrawView();
201 // Unmark the shape.
202 pSdrView->UnmarkAllObj();
203 // Mark the textbox.
204 rSh.SelectObj(Point(), SW_ALLOW_TEXTBOX, pTextBox);
205 // Clear the DrawFuncPtr.
206 rEditWin.StopInsFrame();
207 return true;
208 }
209 return false;
210}
211
213{
218public:
219 explicit SwAnchorMarker( SdrHdl* pH )
220 : m_pHdl( pH )
221 , m_aHdlPos( pH->GetPos() )
222 , m_aLastPos( pH->GetPos() )
223 , m_bTopRightHandle( pH->GetKind() == SdrHdlKind::Anchor_TR )
224 {}
225 const Point& GetLastPos() const { return m_aLastPos; }
226 void SetLastPos( const Point& rNew ) { m_aLastPos = rNew; }
227 void SetPos( const Point& rNew ) { m_pHdl->SetPos( rNew ); }
228 const Point& GetHdlPos() const { return m_aHdlPos; }
229 SdrHdl* GetHdl() const { return m_pHdl; }
230 void ChgHdl( SdrHdl* pNew )
231 {
232 m_pHdl = pNew;
233 if ( m_pHdl )
234 {
235 m_bTopRightHandle = (m_pHdl->GetKind() == SdrHdlKind::Anchor_TR);
236 }
237 }
239 {
240 Point aHitTestPos( m_pHdl->GetPos() );
241 aHitTestPos = rOut.LogicToPixel( aHitTestPos );
242 if ( m_bTopRightHandle )
243 {
244 aHitTestPos += Point( -1, 1 );
245 }
246 else
247 {
248 aHitTestPos += Point( 1, 1 );
249 }
250 aHitTestPos = rOut.PixelToLogic( aHitTestPos );
251
252 return aHitTestPos;
253 }
254};
255
258{
260 std::vector<std::pair<OUString, sal_uInt16>> m_aHelpStrings;
262 sal_uInt16 nCurArrPos;
263 static constexpr sal_uInt16 nNoPos = std::numeric_limits<sal_uInt16>::max();
264
270 void* nTipId;
273
276
278
279 void Move( QuickHelpData& rCpy );
280 void ClearContent();
281 void Start(SwWrtShell& rSh, bool bRestart);
282 void Stop( SwWrtShell& rSh );
283
284 bool HasContent() const { return !m_aHelpStrings.empty() && nCurArrPos != nNoPos; }
285 const OUString& CurStr() const { return m_aHelpStrings[nCurArrPos].first; }
286 sal_uInt16 CurLen() const { return m_aHelpStrings[nCurArrPos].second; }
287
289 void Next( bool bEndLess )
290 {
291 if( ++nCurArrPos >= m_aHelpStrings.size() )
292 nCurArrPos = (bEndLess && !m_bIsAutoText ) ? 0 : nCurArrPos-1;
293 }
295 void Previous( bool bEndLess )
296 {
297 if( 0 == nCurArrPos-- )
298 nCurArrPos = (bEndLess && !m_bIsAutoText ) ? m_aHelpStrings.size()-1 : 0;
299 }
300
301 // Fills internal structures with hopefully helpful information.
302 void FillStrArr( SwWrtShell const & rSh, const OUString& rWord );
303 void SortAndFilter(const OUString &rOrigWord);
304};
305
309#define HIT_PIX 2 /* hit tolerance in pixel */
310#define MIN_MOVE 4
311
312static bool IsMinMove(const Point &rStartPos, const Point &rLPt)
313{
314 return std::abs(rStartPos.X() - rLPt.X()) > MIN_MOVE ||
315 std::abs(rStartPos.Y() - rLPt.Y()) > MIN_MOVE;
316}
317
324static bool IsDrawObjSelectable( const SwWrtShell& rSh, const Point& rPt )
325{
326 bool bRet = true;
327 SdrObject* pObj;
328 switch( rSh.GetObjCntType( rPt, pObj ))
329 {
330 case OBJCNT_NONE:
331 case OBJCNT_FLY:
332 case OBJCNT_GRF:
333 case OBJCNT_OLE:
334 bRet = false;
335 break;
336 default:; //prevent warning
337 }
338 return bRet;
339}
340
341/*
342 * Switch pointer
343 */
344void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
345{
346 SetQuickHelpText(OUString());
348 if( m_pApplyTempl )
349 {
350 PointerStyle eStyle = PointerStyle::Fill;
351 if ( rSh.IsOverReadOnlyPos( rLPt ) )
352 {
353 m_pUserMarker.reset();
354
355 eStyle = PointerStyle::NotAllowed;
356 }
357 else
358 {
359 SwRect aRect;
360 SwRect* pRect = &aRect;
361 const SwFrameFormat* pFormat = nullptr;
362
363 bool bFrameIsValidTarget = false;
364 if( m_pApplyTempl->m_pFormatClipboard )
365 bFrameIsValidTarget = m_pApplyTempl->m_pFormatClipboard->HasContentForThisType( SelectionType::Frame );
366 else if( !m_pApplyTempl->nColor )
367 bFrameIsValidTarget = ( m_pApplyTempl->eType == SfxStyleFamily::Frame );
368
369 if( bFrameIsValidTarget &&
370 nullptr !=(pFormat = rSh.GetFormatFromObj( rLPt, &pRect )) &&
371 dynamic_cast<const SwFlyFrameFormat*>( pFormat) )
372 {
373 //turn on highlight for frame
374 tools::Rectangle aTmp( pRect->SVRect() );
375
376 if ( !m_pUserMarker )
377 {
378 m_pUserMarker.reset(new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp ));
379 }
380 }
381 else
382 {
383 m_pUserMarker.reset();
384 }
385
386 rSh.SwCursorShell::SetVisibleCursor( rLPt );
387 }
388 SetPointer( eStyle );
389 return;
390 }
391
392 if( !rSh.VisArea().Width() )
393 return;
394
395 CurrShell aCurr(&rSh);
396
397 if ( IsChainMode() )
398 {
399 SwRect aRect;
400 SwChainRet nChainable = rSh.Chainable( aRect, *rSh.GetFlyFrameFormat(), rLPt );
401 PointerStyle eStyle = nChainable != SwChainRet::OK
402 ? PointerStyle::ChainNotAllowed : PointerStyle::Chain;
403 if ( nChainable == SwChainRet::OK )
404 {
405 tools::Rectangle aTmp( aRect.SVRect() );
406
407 if ( !m_pUserMarker )
408 {
409 m_pUserMarker.reset(new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp ));
410 }
411 }
412 else
413 {
414 m_pUserMarker.reset();
415 }
416
417 SetPointer( eStyle );
418 return;
419 }
420
421 bool bExecHyperlinks = m_rView.GetDocShell()->IsReadOnly();
422 if ( !bExecHyperlinks )
423 {
425 if ( ( bSecureOption && nModifier == KEY_MOD1 ) ||
426 ( !bSecureOption && nModifier != KEY_MOD1 ) )
427 bExecHyperlinks = true;
428 }
429
430 const bool bExecSmarttags = nModifier == KEY_MOD1;
431
432 SdrView *pSdrView = rSh.GetDrawView();
433 bool bPrefSdrPointer = false;
434 bool bHitHandle = false;
435 bool bCntAtPos = false;
436 bool bIsDocReadOnly = m_rView.GetDocShell()->IsReadOnly() &&
437 rSh.IsCursorReadonly();
438 m_aActHitType = SdrHitKind::NONE;
439 PointerStyle eStyle = PointerStyle::Text;
440 if ( !pSdrView )
441 bCntAtPos = true;
442 else if ( (bHitHandle = (pSdrView->PickHandle(rLPt) != nullptr)) )
443 {
444 m_aActHitType = SdrHitKind::Object;
445 bPrefSdrPointer = true;
446 }
447 else
448 {
449 const bool bNotInSelObj = !rSh.IsInsideSelectedObj( rLPt );
450 if ( m_rView.GetDrawFuncPtr() && !m_bInsDraw && bNotInSelObj )
451 {
452 m_aActHitType = SdrHitKind::Object;
453 if (IsObjectSelect())
454 eStyle = PointerStyle::Arrow;
455 else
456 bPrefSdrPointer = true;
457 }
458 else
459 {
460 SdrPageView* pPV = nullptr;
461 pSdrView->SetHitTolerancePixel( HIT_PIX );
462 SdrObject* pObj = (bNotInSelObj && bExecHyperlinks) ?
463 pSdrView->PickObj(rLPt, pSdrView->getHitTolLog(), pPV, SdrSearchOptions::PICKMACRO) :
464 nullptr;
465 if (pObj)
466 {
468 aTmp.aPos = rLPt;
469 aTmp.pPageView = pPV;
470 SetPointer( pObj->GetMacroPointer( aTmp ) );
471 return;
472 }
473 else
474 {
475 // dvo: IsObjSelectable() eventually calls SdrView::PickObj, so
476 // apparently this is used to determine whether this is a
477 // drawling layer object or not.
478 if ( rSh.IsObjSelectable( rLPt ) )
479 {
480 if (pSdrView->IsTextEdit())
481 {
482 m_aActHitType = SdrHitKind::NONE;
483 bPrefSdrPointer = true;
484 }
485 else
486 {
487 SdrViewEvent aVEvt;
488 SdrHitKind eHit = pSdrView->PickAnything(rLPt, aVEvt);
489
490 if (eHit == SdrHitKind::UrlField && bExecHyperlinks)
491 {
492 m_aActHitType = SdrHitKind::Object;
493 bPrefSdrPointer = true;
494 }
495 else
496 {
497 // if we're over a selected object, we show an
498 // ARROW by default. We only show a MOVE if 1) the
499 // object is selected, and 2) it may be moved
500 // (i.e., position is not protected).
501 bool bMovable =
502 (!bNotInSelObj) &&
503 (rSh.IsObjSelected() || rSh.IsFrameSelected()) &&
505
506 SdrObject* pSelectableObj = rSh.GetObjAt(rLPt);
507 // Don't update pointer if this is a background image only.
508 if (pSelectableObj->GetLayer() != rSh.GetDoc()->getIDocumentDrawModelAccess().GetHellId())
509 eStyle = bMovable ? PointerStyle::Move : PointerStyle::Arrow;
510 m_aActHitType = SdrHitKind::Object;
511 }
512 }
513 }
514 else
515 {
516 if ( rSh.IsFrameSelected() && !bNotInSelObj )
517 {
518 // dvo: this branch appears to be dead and should be
519 // removed in a future version. Reason: The condition
520 // !bNotInSelObj means that this branch will only be
521 // executed in the cursor points inside a selected
522 // object. However, if this is the case, the previous
523 // if( rSh.IsObjSelectable(rLPt) ) must always be true:
524 // rLPt is inside a selected object, then obviously
525 // rLPt is over a selectable object.
527 eStyle = PointerStyle::NotAllowed;
528 else
529 eStyle = PointerStyle::Move;
530 m_aActHitType = SdrHitKind::Object;
531 }
532 else
533 {
534 if ( m_rView.GetDrawFuncPtr() )
535 bPrefSdrPointer = true;
536 else
537 bCntAtPos = true;
538 }
539 }
540 }
541 }
542 }
543 if ( bPrefSdrPointer )
544 {
545 if (bIsDocReadOnly || (rSh.IsObjSelected() && rSh.IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE))
546 SetPointer( PointerStyle::NotAllowed );
547 else
548 {
549 if (m_rView.GetDrawFuncPtr() && m_rView.GetDrawFuncPtr()->IsInsertForm() && !bHitHandle)
550 SetPointer( PointerStyle::DrawRect );
551 else
552 SetPointer( pSdrView->GetPreferredPointer( rLPt, rSh.GetOut() ) );
553 }
554 }
555 else
556 {
557 if( !rSh.IsPageAtPos( rLPt ) || m_pAnchorMarker )
558 eStyle = PointerStyle::Arrow;
559 else
560 {
561 // Even if we already have something, prefer URLs if possible.
563 if (bCntAtPos || rSh.GetContentAtPos(rLPt, aUrlPos))
564 {
565 SwContentAtPos aSwContentAtPos(
571 if( rSh.GetContentAtPos( rLPt, aSwContentAtPos) )
572 {
573 // Is edit inline input field
574 if (IsAttrAtPos::Field == aSwContentAtPos.eContentAtPos
575 && aSwContentAtPos.pFndTextAttr != nullptr
576 && aSwContentAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD)
577 {
578 const SwField *pCursorField = rSh.CursorInsideInputField() ? rSh.GetCurField( true ) : nullptr;
579 if (!(pCursorField && pCursorField == aSwContentAtPos.pFndTextAttr->GetFormatField().GetField()))
580 eStyle = PointerStyle::RefHand;
581 }
582 else
583 {
584 const bool bClickToFollow = IsAttrAtPos::InetAttr == aSwContentAtPos.eContentAtPos ||
585 IsAttrAtPos::SmartTag == aSwContentAtPos.eContentAtPos;
586 if( !bClickToFollow ||
587 (IsAttrAtPos::InetAttr == aSwContentAtPos.eContentAtPos && bExecHyperlinks) ||
588 (IsAttrAtPos::SmartTag == aSwContentAtPos.eContentAtPos && bExecSmarttags) )
589 eStyle = PointerStyle::RefHand;
590 }
591 }
592 else if (GetView().GetWrtShell().GetViewOptions()->IsShowOutlineContentVisibilityButton())
593 {
594 aSwContentAtPos.eContentAtPos = IsAttrAtPos::Outline;
595 if (rSh.GetContentAtPos(rLPt, aSwContentAtPos))
596 {
597 if (IsAttrAtPos::Outline == aSwContentAtPos.eContentAtPos)
598 {
599 if (nModifier == KEY_MOD1)
600 {
601 eStyle = PointerStyle::RefHand;
602 // set quick help
603 if(aSwContentAtPos.aFnd.pNode && aSwContentAtPos.aFnd.pNode->IsTextNode())
604 {
605 const SwNodes& rNds = GetView().GetWrtShell().GetDoc()->GetNodes();
607 rNds.GetOutLineNds().Seek_Entry(aSwContentAtPos.aFnd.pNode->GetTextNode(), &nPos);
608 SwOutlineNodes::size_type nOutlineNodesCount
611 OUString sQuickHelp(SwResId(STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY));
613 && nPos + 1 < nOutlineNodesCount
615 sQuickHelp += " (" + SwResId(STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY_EXT) + ")";
616 SetQuickHelpText(sQuickHelp);
617 }
618 }
619 }
620 }
621 }
622 }
623 }
624
625 // which kind of text pointer have we to show - horz / vert - ?
626 if( PointerStyle::Text == eStyle && rSh.IsInVerticalText( &rLPt ))
627 eStyle = PointerStyle::TextVertical;
628 else if (rSh.GetViewOptions()->CanHideWhitespace() &&
629 rSh.GetLayout()->IsBetweenPages(rLPt))
630 {
632 eStyle = PointerStyle::ShowWhitespace;
633 else
634 eStyle = PointerStyle::HideWhitespace;
635 }
636
637 if( m_pShadCursor )
638 {
639 if( text::HoriOrientation::LEFT == m_eOrient ) // Arrow to the right
640 eStyle = PointerStyle::AutoScrollE;
641 else // Arrow to the left
642 eStyle = PointerStyle::AutoScrollW;
643 }
644
645 SetPointer( eStyle );
646 }
647}
648
652IMPL_LINK_NOARG(SwEditWin, TimerHandler, Timer *, void)
653{
654 SwWrtShell &rSh = m_rView.GetWrtShell();
655 Point aModPt( m_aMovePos );
656 const SwRect aOldVis( rSh.VisArea() );
657 bool bDone = false;
658
659 if ( !rSh.VisArea().Contains( aModPt ) )
660 {
661 if ( m_bInsDraw )
662 {
663 const int nMaxScroll = 40;
664 m_rView.Scroll( tools::Rectangle(aModPt,Size(1,1)), nMaxScroll, nMaxScroll);
665 bDone = true;
666 }
667 else if ( g_bFrameDrag )
668 {
669 rSh.Drag(&aModPt, false);
670 bDone = true;
671 }
672 if ( !bDone )
673 aModPt = rSh.GetContentPos( aModPt,aModPt.Y() > rSh.VisArea().Bottom() );
674 }
675 if ( !bDone && !(g_bFrameDrag || m_bInsDraw) )
676 {
677 if ( m_xRowColumnSelectionStart )
678 {
679 Point aPos( aModPt );
680 rSh.SelectTableRowCol( *m_xRowColumnSelectionStart, &aPos, m_bIsRowDrag );
681 }
682 else
683 rSh.CallSetCursor( &aModPt, false );
684
685 // It can be that a "jump" over a table cannot be accomplished like
686 // that. So we jump over the table by Up/Down here.
687 const SwRect& rVisArea = rSh.VisArea();
688 if( aOldVis == rVisArea && !rSh.IsStartOfDoc() && !rSh.IsEndOfDoc() )
689 {
690 // take the center point of VisArea to
691 // decide in which direction the user want.
692 if( aModPt.Y() < ( rVisArea.Top() + rVisArea.Height() / 2 ) )
693 rSh.Up( true );
694 else
695 rSh.Down( true );
696 }
697 }
698
699 m_aMovePos += rSh.VisArea().Pos() - aOldVis.Pos();
700 JustifyAreaTimer();
701}
702
704{
705 const tools::Rectangle &rVisArea = GetView().GetVisArea();
706#ifdef UNX
707 const tools::Long coMinLen = 100;
708#else
709 const tools::Long coMinLen = 50;
710#endif
711 tools::Long const nTimeout = 800,
712 nDiff = std::max(
713 std::max( m_aMovePos.Y() - rVisArea.Bottom(), rVisArea.Top() - m_aMovePos.Y() ),
714 std::max( m_aMovePos.X() - rVisArea.Right(), rVisArea.Left() - m_aMovePos.X()));
715 m_aTimer.SetTimeout( std::max( coMinLen, nTimeout - nDiff*2L) );
716}
717
719{
720 m_aMovePos = rPos;
722 if( !m_aTimer.IsActive() )
723 m_aTimer.Start();
724 m_pShadCursor.reset();
725}
726
728{
729 m_aTimer.Stop();
730}
731
735void SwEditWin::InsFrame(sal_uInt16 nCols)
736{
737 StdDrawMode(SdrObjKind::NewFrame, false);
738 m_bInsFrame = true;
739 m_nInsFrameColCount = nCols;
740}
741
742void SwEditWin::StdDrawMode( SdrObjKind eSdrObjectKind, bool bObjSelect )
743{
744 SetSdrDrawMode( eSdrObjectKind );
745
746 if (bObjSelect)
747 m_rView.SetDrawFuncPtr(std::make_unique<DrawSelection>( &m_rView.GetWrtShell(), this, &m_rView ));
748 else
749 m_rView.SetDrawFuncPtr(std::make_unique<SwDrawBase>( &m_rView.GetWrtShell(), this, &m_rView ));
750
752 SetSdrDrawMode( eSdrObjectKind );
753 if (bObjSelect)
754 m_rView.GetDrawFuncPtr()->Activate( SID_OBJECT_SELECT );
755 else
756 m_rView.GetDrawFuncPtr()->Activate( sal::static_int_cast< sal_uInt16 >(eSdrObjectKind) );
757 m_bInsFrame = false;
759}
760
762{
764 {
766 m_rView.SetDrawFuncPtr(nullptr);
767 }
768 m_rView.LeaveDrawCreate(); // leave construction mode
769 m_bInsFrame = false;
771}
772
773bool SwEditWin::IsInputSequenceCheckingRequired( const OUString &rText, const SwPaM& rCursor )
774{
777 return false;
778
779 if ( 0 == rCursor.Start()->GetContentIndex() ) /* first char needs not to be checked */
780 return false;
781
782 SwBreakIt *pBreakIter = SwBreakIt::Get();
783 uno::Reference < i18n::XBreakIterator > xBI = pBreakIter->GetBreakIter();
784 assert(xBI.is());
785 tools::Long nCTLScriptPos = -1;
786
787 if (xBI->getScriptType( rText, 0 ) == i18n::ScriptType::COMPLEX)
788 nCTLScriptPos = 0;
789 else
790 nCTLScriptPos = xBI->nextScript( rText, 0, i18n::ScriptType::COMPLEX );
791
792 return (0 <= nCTLScriptPos && nCTLScriptPos <= rText.getLength());
793}
794
795//return INVALID_HINT if language should not be explicitly overridden, the correct
796//HintId to use for the eBufferLanguage otherwise
797static sal_uInt16 lcl_isNonDefaultLanguage(LanguageType eBufferLanguage, SwView const & rView,
798 const OUString &rInBuffer)
799{
800 sal_uInt16 nWhich = INVALID_HINT;
801
802 //If the option to IgnoreLanguageChange is set, short-circuit this method
803 //which results in the document/paragraph language remaining the same
804 //despite a change to the keyboard/input language
805 SvtSysLocaleOptions aSysLocaleOptions;
806 if(aSysLocaleOptions.IsIgnoreLanguageChange())
807 {
808 return INVALID_HINT;
809 }
810
811 bool bLang = true;
812 if(eBufferLanguage != LANGUAGE_DONTKNOW)
813 {
814 switch( SvtLanguageOptions::GetI18NScriptTypeOfLanguage( eBufferLanguage ))
815 {
816 case i18n::ScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break;
817 case i18n::ScriptType::COMPLEX: nWhich = RES_CHRATR_CTL_LANGUAGE; break;
818 case i18n::ScriptType::LATIN: nWhich = RES_CHRATR_LANGUAGE; break;
819 default: bLang = false;
820 }
821 if(bLang)
822 {
823 SfxItemSet aLangSet(rView.GetPool(), nWhich, nWhich);
824 SwWrtShell& rSh = rView.GetWrtShell();
825 rSh.GetCurAttr(aLangSet);
826 if(SfxItemState::DEFAULT <= aLangSet.GetItemState(nWhich))
827 {
828 LanguageType eLang = static_cast<const SvxLanguageItem&>(aLangSet.Get(nWhich)).GetLanguage();
829 if ( eLang == eBufferLanguage )
830 {
831 // current language attribute equal to language reported from system
832 bLang = false;
833 }
834 else if ( !g_bInputLanguageSwitched && RES_CHRATR_LANGUAGE == nWhich )
835 {
836 // special case: switching between two "LATIN" languages
837 // In case the current keyboard setting might be suitable
838 // for both languages we can't safely assume that the user
839 // wants to use the language reported from the system,
840 // except if we knew that it was explicitly switched (thus
841 // the check for "bInputLangeSwitched").
842
843 // The language reported by the system could be just the
844 // system default language that the user is not even aware
845 // of, because no language selection tool is installed at
846 // all. In this case the OOo language should get preference
847 // as it might have been selected by the user explicitly.
848
849 // Usually this case happens if the OOo language is
850 // different to the system language but the system keyboard
851 // is still suitable for the OOo language (e.g. writing
852 // English texts with a German keyboard).
853
854 // For non-latin keyboards overwriting the attribute is
855 // still valid. We do this for cyrillic and greek ATM. In
856 // future versions of OOo this should be replaced by a
857 // configuration switch that allows to give the preference
858 // to the OOo setting or the system setting explicitly
859 // and/or a better handling of the script type.
860 i18n::UnicodeScript eType = !rInBuffer.isEmpty() ?
861 GetAppCharClass().getScript( rInBuffer, 0 ) :
862 i18n::UnicodeScript_kScriptCount;
863
864 bool bSystemIsNonLatin = false;
865 switch ( eType )
866 {
867 case i18n::UnicodeScript_kGreek:
868 case i18n::UnicodeScript_kCyrillic:
869 // in case other UnicodeScripts require special
870 // keyboards they can be added here
871 bSystemIsNonLatin = true;
872 break;
873 default:
874 break;
875 }
876
877 bool bOOoLangIsNonLatin = MsLangId::isNonLatinWestern( eLang);
878
879 bLang = (bSystemIsNonLatin != bOOoLangIsNonLatin);
880 }
881 }
882 }
883 }
884 return bLang ? nWhich : INVALID_HINT;
885}
886
891{
894
895 if ( m_aInBuffer.isEmpty() )
896 return;
897
899
900 // generate new sequence input checker if not already done
901 if ( !pCheckIt )
902 pCheckIt = new SwCheckIt;
903
904 uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = pCheckIt->xCheck;
905 if ( xISC.is() && IsInputSequenceCheckingRequired( m_aInBuffer, *rSh.GetCursor() ) )
906 {
907
908 // apply (Thai) input sequence checking/correction
909
910 rSh.Push(); // push current cursor to stack
911
912 // get text from the beginning (i.e left side) of current selection
913 // to the start of the paragraph
914 rSh.NormalizePam(); // make point be the first (left) one
915 if (!rSh.GetCursor()->HasMark())
916 rSh.GetCursor()->SetMark();
917 rSh.GetCursor()->GetMark()->SetContent(0);
918
919 const OUString aOldText( rSh.GetCursor()->GetText() );
920 const sal_Int32 nOldLen = aOldText.getLength();
921
922 sal_Int32 nExpandSelection = 0;
923 if (nOldLen > 0)
924 {
925 sal_Int32 nTmpPos = nOldLen;
926 sal_Int16 nCheckMode = SvtCTLOptions::IsCTLSequenceCheckingRestricted() ?
927 i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
928
929 OUString aNewText( aOldText );
931 {
932 for( sal_Int32 k = 0; k < m_aInBuffer.getLength(); ++k)
933 {
934 const sal_Unicode cChar = m_aInBuffer[k];
935 const sal_Int32 nPrevPos =xISC->correctInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode );
936
937 // valid sequence or sequence could be corrected:
938 if (nPrevPos != aNewText.getLength())
939 nTmpPos = nPrevPos + 1;
940 }
941
942 // find position of first character that has changed
943 sal_Int32 nNewLen = aNewText.getLength();
944 const sal_Unicode *pOldText = aOldText.getStr();
945 const sal_Unicode *pNewText = aNewText.getStr();
946 sal_Int32 nChgPos = 0;
947 while ( nChgPos < nOldLen && nChgPos < nNewLen &&
948 pOldText[nChgPos] == pNewText[nChgPos] )
949 ++nChgPos;
950
951 const sal_Int32 nChgLen = nNewLen - nChgPos;
952 if (nChgLen)
953 {
954 m_aInBuffer = aNewText.copy( nChgPos, nChgLen );
955 nExpandSelection = nOldLen - nChgPos;
956 }
957 else
958 m_aInBuffer.clear();
959 }
960 else
961 {
962 for( sal_Int32 k = 0; k < m_aInBuffer.getLength(); ++k )
963 {
964 const sal_Unicode cChar = m_aInBuffer[k];
965 if (xISC->checkInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode ))
966 {
967 // character can be inserted:
968 aNewText += OUStringChar( cChar );
969 ++nTmpPos;
970 }
971 }
972 m_aInBuffer = aNewText.copy( aOldText.getLength() ); // copy new text to be inserted to buffer
973 }
974 }
975
976 // at this point now we will insert the buffer text 'normally' some lines below...
977
979
980 if (m_aInBuffer.isEmpty())
981 return;
982
983 // if text prior to the original selection needs to be changed
984 // as well, we now expand the selection accordingly.
985 SwPaM &rCursor = *rSh.GetCursor();
986 const sal_Int32 nCursorStartPos = rCursor.Start()->GetContentIndex();
987 OSL_ENSURE( nCursorStartPos >= nExpandSelection, "cannot expand selection as specified!!" );
988 if (nExpandSelection && nCursorStartPos >= nExpandSelection)
989 {
990 if (!rCursor.HasMark())
991 rCursor.SetMark();
992 rCursor.Start()->AdjustContent( -nExpandSelection );
993 }
994 }
995
996 uno::Reference< frame::XDispatchRecorder > xRecorder =
998 if ( xRecorder.is() )
999 {
1000 // determine shell
1002 // generate request and record
1003 if (pSfxShell)
1004 {
1007 aReq.Done();
1008 }
1009 }
1010
1012 if (nWhich != INVALID_HINT )
1013 {
1014 SvxLanguageItem aLangItem( m_eBufferLanguage, nWhich );
1015 rSh.SetAttrItem( aLangItem );
1016 }
1017
1018 rSh.Insert( m_aInBuffer );
1020 m_aInBuffer.clear();
1021}
1022
1023#define MOVE_LEFT_SMALL 0
1024#define MOVE_UP_SMALL 1
1025#define MOVE_RIGHT_BIG 2
1026#define MOVE_DOWN_BIG 3
1027#define MOVE_LEFT_BIG 4
1028#define MOVE_UP_BIG 5
1029#define MOVE_RIGHT_SMALL 6
1030#define MOVE_DOWN_SMALL 7
1031
1032// #i121236# Support for shift key in writer
1033#define MOVE_LEFT_HUGE 8
1034#define MOVE_UP_HUGE 9
1035#define MOVE_RIGHT_HUGE 10
1036#define MOVE_DOWN_HUGE 11
1037
1038void SwEditWin::ChangeFly( sal_uInt8 nDir, bool bWeb )
1039{
1041 SwRect aTmp = rSh.GetFlyRect();
1042 if( !aTmp.HasArea() ||
1044 return;
1045
1052 aSet( rSh.GetAttrPool() );
1053 rSh.GetFlyFrameAttr( aSet );
1054 RndStdIds eAnchorId = aSet.Get(RES_ANCHOR).GetAnchorId();
1055 Size aSnap;
1056 bool bHuge(MOVE_LEFT_HUGE == nDir ||
1057 MOVE_UP_HUGE == nDir ||
1058 MOVE_RIGHT_HUGE == nDir ||
1059 MOVE_DOWN_HUGE == nDir);
1060
1061 if(MOVE_LEFT_SMALL == nDir ||
1062 MOVE_UP_SMALL == nDir ||
1063 MOVE_RIGHT_SMALL == nDir ||
1064 MOVE_DOWN_SMALL == nDir )
1065 {
1066 aSnap = PixelToLogic(Size(1,1));
1067 }
1068 else
1069 {
1070 aSnap = rSh.GetViewOptions()->GetSnapSize();
1071 short nDiv = rSh.GetViewOptions()->GetDivisionX();
1072 if ( nDiv > 0 )
1073 aSnap.setWidth( std::max( sal_uLong(1), static_cast<sal_uLong>(aSnap.Width()) / nDiv ) );
1074 nDiv = rSh.GetViewOptions()->GetDivisionY();
1075 if ( nDiv > 0 )
1076 aSnap.setHeight( std::max( sal_uLong(1), static_cast<sal_uLong>(aSnap.Height()) / nDiv ) );
1077 }
1078
1079 if(bHuge)
1080 {
1081 // #i121236# 567twips == 1cm, but just take three times the normal snap
1082 aSnap = Size(aSnap.Width() * 3, aSnap.Height() * 3);
1083 }
1084
1085 SwRect aBoundRect;
1086 Point aRefPoint;
1087 // adjustment for allowing vertical position
1088 // aligned to page for fly frame anchored to paragraph or to character.
1089 {
1090 const SwFormatVertOrient& aVert( aSet.Get(RES_VERT_ORIENT) );
1091 const bool bFollowTextFlow =
1092 aSet.Get(RES_FOLLOW_TEXT_FLOW).GetValue();
1093 const SwFormatAnchor& rFormatAnchor = aSet.Get(RES_ANCHOR);
1094 rSh.CalcBoundRect( aBoundRect, eAnchorId,
1095 text::RelOrientation::FRAME, aVert.GetRelationOrient(),
1096 &rFormatAnchor, bFollowTextFlow,
1097 false, &aRefPoint );
1098 }
1099 tools::Long nLeft = std::min( aTmp.Left() - aBoundRect.Left(), aSnap.Width() );
1100 tools::Long nRight = std::min( aBoundRect.Right() - aTmp.Right(), aSnap.Width() );
1101 tools::Long nUp = std::min( aTmp.Top() - aBoundRect.Top(), aSnap.Height() );
1102 tools::Long nDown = std::min( aBoundRect.Bottom() - aTmp.Bottom(), aSnap.Height() );
1103
1104 switch ( nDir )
1105 {
1106 case MOVE_LEFT_BIG:
1107 case MOVE_LEFT_HUGE:
1108 case MOVE_LEFT_SMALL: aTmp.Left( aTmp.Left() - nLeft );
1109 break;
1110
1111 case MOVE_UP_BIG:
1112 case MOVE_UP_HUGE:
1113 case MOVE_UP_SMALL: aTmp.Top( aTmp.Top() - nUp );
1114 break;
1115
1116 case MOVE_RIGHT_SMALL:
1117 if( aTmp.Width() < aSnap.Width() + MINFLY )
1118 break;
1119 nRight = aSnap.Width();
1120 [[fallthrough]];
1121 case MOVE_RIGHT_HUGE:
1122 case MOVE_RIGHT_BIG: aTmp.Left( aTmp.Left() + nRight );
1123 break;
1124
1125 case MOVE_DOWN_SMALL:
1126 if( aTmp.Height() < aSnap.Height() + MINFLY )
1127 break;
1128 nDown = aSnap.Height();
1129 [[fallthrough]];
1130 case MOVE_DOWN_HUGE:
1131 case MOVE_DOWN_BIG: aTmp.Top( aTmp.Top() + nDown );
1132 break;
1133
1134 default: OSL_ENSURE(true, "ChangeFly: Unknown direction." );
1135 }
1136 bool bSet = false;
1137 if ((RndStdIds::FLY_AS_CHAR == eAnchorId) && ( nDir % 2 ))
1138 {
1139 tools::Long aDiff = aTmp.Top() - aRefPoint.Y();
1140 if( aDiff > 0 )
1141 aDiff = 0;
1142 else if ( aDiff < -aTmp.Height() )
1143 aDiff = -aTmp.Height();
1144 SwFormatVertOrient aVert( aSet.Get(RES_VERT_ORIENT) );
1145 sal_Int16 eNew;
1146 if( bWeb )
1147 {
1148 eNew = aVert.GetVertOrient();
1149 bool bDown = 0 != ( nDir & 0x02 );
1150 switch( eNew )
1151 {
1152 case text::VertOrientation::CHAR_TOP:
1153 if( bDown ) eNew = text::VertOrientation::CENTER;
1154 break;
1155 case text::VertOrientation::CENTER:
1156 eNew = bDown ? text::VertOrientation::TOP : text::VertOrientation::CHAR_TOP;
1157 break;
1158 case text::VertOrientation::TOP:
1159 if( !bDown ) eNew = text::VertOrientation::CENTER;
1160 break;
1161 case text::VertOrientation::LINE_TOP:
1162 if( bDown ) eNew = text::VertOrientation::LINE_CENTER;
1163 break;
1164 case text::VertOrientation::LINE_CENTER:
1165 eNew = bDown ? text::VertOrientation::LINE_BOTTOM : text::VertOrientation::LINE_TOP;
1166 break;
1167 case text::VertOrientation::LINE_BOTTOM:
1168 if( !bDown ) eNew = text::VertOrientation::LINE_CENTER;
1169 break;
1170 default:; //prevent warning
1171 }
1172 }
1173 else
1174 {
1175 aVert.SetPos( aDiff );
1177 }
1178 aVert.SetVertOrient( eNew );
1179 aSet.Put( aVert );
1180 bSet = true;
1181 }
1182 if (bWeb && (RndStdIds::FLY_AT_PARA == eAnchorId)
1183 && ( nDir==MOVE_LEFT_SMALL || nDir==MOVE_RIGHT_BIG ))
1184 {
1185 SwFormatHoriOrient aHori( aSet.Get(RES_HORI_ORIENT) );
1186 sal_Int16 eNew;
1187 eNew = aHori.GetHoriOrient();
1188 switch( eNew )
1189 {
1190 case text::HoriOrientation::RIGHT:
1191 if( nDir==MOVE_LEFT_SMALL )
1192 eNew = text::HoriOrientation::LEFT;
1193 break;
1194 case text::HoriOrientation::LEFT:
1195 if( nDir==MOVE_RIGHT_BIG )
1196 eNew = text::HoriOrientation::RIGHT;
1197 break;
1198 default:; //prevent warning
1199 }
1200 if( eNew != aHori.GetHoriOrient() )
1201 {
1202 aHori.SetHoriOrient( eNew );
1203 aSet.Put( aHori );
1204 bSet = true;
1205 }
1206 }
1207 rSh.StartAllAction();
1208 if( bSet )
1209 rSh.SetFlyFrameAttr( aSet );
1210 bool bSetPos = (RndStdIds::FLY_AS_CHAR != eAnchorId);
1211 if(bSetPos && bWeb)
1212 {
1213 bSetPos = RndStdIds::FLY_AT_PAGE == eAnchorId;
1214 }
1215 if( bSetPos )
1216 rSh.SetFlyPos( aTmp.Pos() );
1217 rSh.EndAllAction();
1218
1219}
1220
1222{
1223 // start undo action in order to get only one
1224 // undo action for this change.
1226 rSh.StartUndo();
1227
1228 tools::Long nX = 0;
1229 tools::Long nY = 0;
1230 const bool bOnePixel(
1231 MOVE_LEFT_SMALL == nDir ||
1232 MOVE_UP_SMALL == nDir ||
1233 MOVE_RIGHT_SMALL == nDir ||
1234 MOVE_DOWN_SMALL == nDir);
1235 const bool bHuge(
1236 MOVE_LEFT_HUGE == nDir ||
1237 MOVE_UP_HUGE == nDir ||
1238 MOVE_RIGHT_HUGE == nDir ||
1239 MOVE_DOWN_HUGE == nDir);
1240 SwMove nAnchorDir = SwMove::UP;
1241 switch(nDir)
1242 {
1243 case MOVE_LEFT_SMALL:
1244 case MOVE_LEFT_HUGE:
1245 case MOVE_LEFT_BIG:
1246 nX = -1;
1247 nAnchorDir = SwMove::LEFT;
1248 break;
1249 case MOVE_UP_SMALL:
1250 case MOVE_UP_HUGE:
1251 case MOVE_UP_BIG:
1252 nY = -1;
1253 break;
1254 case MOVE_RIGHT_SMALL:
1255 case MOVE_RIGHT_HUGE:
1256 case MOVE_RIGHT_BIG:
1257 nX = +1;
1258 nAnchorDir = SwMove::RIGHT;
1259 break;
1260 case MOVE_DOWN_SMALL:
1261 case MOVE_DOWN_HUGE:
1262 case MOVE_DOWN_BIG:
1263 nY = +1;
1264 nAnchorDir = SwMove::DOWN;
1265 break;
1266 }
1267
1268 if(0 != nX || 0 != nY)
1269 {
1271 Size aSnap( rSh.GetViewOptions()->GetSnapSize() );
1272 short nDiv = rSh.GetViewOptions()->GetDivisionX();
1273 if ( nDiv > 0 )
1274 aSnap.setWidth( std::max( sal_uLong(1), static_cast<sal_uLong>(aSnap.Width()) / nDiv ) );
1275 nDiv = rSh.GetViewOptions()->GetDivisionY();
1276 if ( nDiv > 0 )
1277 aSnap.setHeight( std::max( sal_uLong(1), static_cast<sal_uLong>(aSnap.Height()) / nDiv ) );
1278
1279 if(bOnePixel)
1280 {
1281 aSnap = PixelToLogic(Size(1,1));
1282 }
1283 else if(bHuge)
1284 {
1285 // #i121236# 567twips == 1cm, but just take three times the normal snap
1286 aSnap = Size(aSnap.Width() * 3, aSnap.Height() * 3);
1287 }
1288
1289 nX *= aSnap.Width();
1290 nY *= aSnap.Height();
1291
1292 SdrView *pSdrView = rSh.GetDrawView();
1293 const SdrHdlList& rHdlList = pSdrView->GetHdlList();
1294 SdrHdl* pHdl = rHdlList.GetFocusHdl();
1295 rSh.StartAllAction();
1296 if(nullptr == pHdl)
1297 {
1298 // now move the selected draw objects
1299 // if the object's position is not protected
1300 if(!(nProtect&FlyProtectFlags::Pos))
1301 {
1302 // Check if object is anchored as character and move direction
1303 bool bDummy1, bDummy2;
1304 const bool bVertAnchor = rSh.IsFrameVertical( true, bDummy1, bDummy2 );
1305 bool bHoriMove = !bVertAnchor == !( nDir % 2 );
1306 bool bMoveAllowed =
1307 !bHoriMove || (rSh.GetAnchorId() != RndStdIds::FLY_AS_CHAR);
1308 if ( bMoveAllowed )
1309 {
1310 pSdrView->MoveAllMarked(Size(nX, nY));
1311 rSh.SetModified();
1312 }
1313 }
1314 }
1315 else
1316 {
1317 // move handle with index nHandleIndex
1318 if (nX || nY)
1319 {
1320 if( SdrHdlKind::Anchor == pHdl->GetKind() ||
1321 SdrHdlKind::Anchor_TR == pHdl->GetKind() )
1322 {
1323 // anchor move cannot be allowed when position is protected
1324 if(!(nProtect&FlyProtectFlags::Pos))
1325 rSh.MoveAnchor( nAnchorDir );
1326 }
1327 //now resize if size is protected
1328 else if(!(nProtect&FlyProtectFlags::Size))
1329 {
1330 // now move the Handle (nX, nY)
1331 Point aStartPoint(pHdl->GetPos());
1332 Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
1333 const SdrDragStat& rDragStat = pSdrView->GetDragStat();
1334
1335 // start dragging
1336 pSdrView->BegDragObj(aStartPoint, nullptr, pHdl, 0);
1337
1338 if(pSdrView->IsDragObj())
1339 {
1340 bool bWasNoSnap = rDragStat.IsNoSnap();
1341 bool bWasSnapEnabled = pSdrView->IsSnapEnabled();
1342
1343 // switch snapping off
1344 if(!bWasNoSnap)
1345 const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
1346 if(bWasSnapEnabled)
1347 pSdrView->SetSnapEnabled(false);
1348
1349 pSdrView->MovAction(aEndPoint);
1350 pSdrView->EndDragObj();
1351 rSh.SetModified();
1352
1353 // restore snap
1354 if(!bWasNoSnap)
1355 const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
1356 if(bWasSnapEnabled)
1357 pSdrView->SetSnapEnabled(bWasSnapEnabled);
1358 }
1359 }
1360 }
1361 }
1362 rSh.EndAllAction();
1363 }
1364
1365 rSh.EndUndo();
1366}
1367
1372{
1374
1376 {
1378 {
1379 pWindow->KeyInput(rKEvt);
1380 return;
1381 }
1382 }
1383
1384 if( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
1385 m_pApplyTempl && m_pApplyTempl->m_pFormatClipboard )
1386 {
1387 m_pApplyTempl->m_pFormatClipboard->Erase();
1389 m_rView.GetViewFrame().GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
1390 }
1391 else if ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
1392 rSh.IsHeaderFooterEdit( ) )
1393 {
1394 bool bHeader = bool(FrameTypeFlags::HEADER & rSh.GetFrameType(nullptr,false));
1395 if ( bHeader )
1396 rSh.SttPg();
1397 else
1398 rSh.EndPg();
1400 }
1401
1403 if ( m_bLockInput || (pObjSh && pObjSh->GetProgress()) )
1404 // When the progress bar is active or a progress is
1405 // running on a document, no order is being taken
1406 return;
1407
1408 m_pShadCursor.reset();
1409 // Do not reset the timer here, otherwise when flooded with events it would never time out
1410 // if every key event stopped and started it again.
1411 comphelper::ScopeGuard keyInputFlushTimerStop([this]() { m_aKeyInputFlushTimer.Stop(); });
1412
1413 bool bIsDocReadOnly = m_rView.GetDocShell()->IsReadOnly() &&
1414 rSh.IsCursorReadonly();
1415
1416 //if the language changes the buffer must be flushed
1417 LanguageType eNewLanguage = GetInputLanguage();
1418 if(!bIsDocReadOnly && m_eBufferLanguage != eNewLanguage && !m_aInBuffer.isEmpty())
1419 {
1420 FlushInBuffer();
1421 }
1422 m_eBufferLanguage = eNewLanguage;
1423
1424 QuickHelpData aTmpQHD;
1426 {
1427 aTmpQHD.Move( *s_pQuickHlpData );
1428 s_pQuickHlpData->Stop( rSh );
1429 }
1430
1431 // OS:the DrawView also needs a readonly-Flag as well
1432 if ( !bIsDocReadOnly && rSh.GetDrawView() && rSh.GetDrawView()->KeyInput( rKEvt, this ) )
1433 {
1434 rSh.GetView().GetViewFrame().GetBindings().InvalidateAll( false );
1435 rSh.SetModified();
1436 return; // Event evaluated by SdrView
1437 }
1438
1440 {
1441 StopInsFrame();
1442 rSh.Edit();
1443 }
1444
1445 bool bFlushBuffer = false;
1446 bool bNormalChar = false;
1447 bool bAppendSpace = s_pQuickHlpData->m_bAppendSpace;
1449
1450 if ( getenv("SW_DEBUG") && rKEvt.GetKeyCode().GetCode() == KEY_F12 )
1451 {
1452 if( rKEvt.GetKeyCode().IsShift())
1453 {
1455 return;
1456 }
1457 else
1458 {
1460 pLayout->dumpAsXml( );
1461 return;
1462 }
1463 }
1464
1465 KeyEvent aKeyEvent( rKEvt );
1466 // look for vertical mappings
1467 if( !bIsDocReadOnly && !rSh.IsSelFrameMode() && !rSh.IsObjSelected() )
1468 {
1469 sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
1470
1471 if( KEY_UP == nKey || KEY_DOWN == nKey ||
1472 KEY_LEFT == nKey || KEY_RIGHT == nKey )
1473 {
1474 // In general, we want to map the direction keys if we are inside
1475 // some vertical formatted text.
1476 // 1. Exception: For a table cursor in a horizontal table, the
1477 // directions should never be mapped.
1478 // 2. Exception: For a table cursor in a vertical table, the
1479 // directions should always be mapped.
1480 const bool bVertText = rSh.IsInVerticalText();
1481 const bool bTableCursor = rSh.GetTableCursor();
1482 const bool bVertTable = rSh.IsTableVertical();
1483 if( ( bVertText && ( !bTableCursor || bVertTable ) ) ||
1484 ( bTableCursor && bVertTable ) )
1485 {
1486 SvxFrameDirection eDirection = rSh.GetTextDirection();
1487 if (eDirection == SvxFrameDirection::Vertical_LR_BT)
1488 {
1489 // Map from physical to logical, so rotate clockwise.
1490 if (KEY_UP == nKey)
1491 nKey = KEY_RIGHT;
1492 else if (KEY_DOWN == nKey)
1493 nKey = KEY_LEFT;
1494 else if (KEY_LEFT == nKey)
1495 nKey = KEY_UP;
1496 else /* KEY_RIGHT == nKey */
1497 nKey = KEY_DOWN;
1498 }
1499 else
1500 {
1501 // Attempt to integrate cursor travelling for mongolian layout does not work.
1502 // Thus, back to previous mapping of cursor keys to direction keys.
1503 if( KEY_UP == nKey ) nKey = KEY_LEFT;
1504 else if( KEY_DOWN == nKey ) nKey = KEY_RIGHT;
1505 else if( KEY_LEFT == nKey ) nKey = KEY_DOWN;
1506 else /* KEY_RIGHT == nKey */ nKey = KEY_UP;
1507 }
1508 }
1509
1510 if ( rSh.IsInRightToLeftText() )
1511 {
1512 if( KEY_LEFT == nKey ) nKey = KEY_RIGHT;
1513 else if( KEY_RIGHT == nKey ) nKey = KEY_LEFT;
1514 }
1515
1516 aKeyEvent = KeyEvent( rKEvt.GetCharCode(),
1517 vcl::KeyCode( nKey, rKEvt.GetKeyCode().GetModifier() ),
1518 rKEvt.GetRepeat() );
1519 }
1520 }
1521
1522 const vcl::KeyCode& rKeyCode = aKeyEvent.GetKeyCode();
1523 sal_Unicode aCh = aKeyEvent.GetCharCode();
1524
1525 // enable switching to notes anchor with Ctrl - Alt - Page Up/Down
1526 // pressing this inside a note will switch to next/previous note
1527 if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((rKeyCode.GetCode() == KEY_PAGEUP) || (rKeyCode.GetCode() == KEY_PAGEDOWN)))
1528 {
1529 const bool bNext = rKeyCode.GetCode()==KEY_PAGEDOWN;
1530 const SwFieldType* pFieldType = rSh.GetFieldType( 0, SwFieldIds::Postit );
1531 rSh.MoveFieldType( pFieldType, bNext );
1532 return;
1533 }
1534
1535 if (SwTextContentControl* pTextContentControl = rSh.CursorInsideContentControl())
1536 {
1537 // Check if this combination of rKeyCode and pTextContentControl should open a popup.
1538 const SwFormatContentControl& rFormatContentControl = pTextContentControl->GetContentControl();
1539 std::shared_ptr<SwContentControl> pContentControl = rFormatContentControl.GetContentControl();
1540 if (pContentControl->ShouldOpenPopup(rKeyCode))
1541 {
1542 SwShellCursor* pCursor = rSh.GetCursor_();
1543 if (pCursor)
1544 {
1545 VclPtr<SwContentControlButton> pContentControlButton = pCursor->GetContentControlButton();
1546 if (pContentControlButton)
1547 {
1548 pContentControlButton->StartPopup();
1549 return;
1550 }
1551 }
1552 }
1553 }
1554
1555 const SwFrameFormat* pFlyFormat = rSh.GetFlyFrameFormat();
1556
1557 if (pFlyFormat)
1558 {
1559 // See if the fly frame's anchor is in a content control. If so,
1560 // try to interact with it.
1561 const SwFormatAnchor& rFormatAnchor = pFlyFormat->GetAnchor();
1562 SwNode* pAnchorNode = rFormatAnchor.GetAnchorNode();
1563 if (pAnchorNode)
1564 {
1565 SwTextNode* pTextNode = pAnchorNode->GetTextNode();
1566 if (pTextNode)
1567 {
1568 sal_Int32 nContentIdx = rFormatAnchor.GetAnchorContentOffset();
1569 SwTextAttr* pAttr = pTextNode->GetTextAttrAt(
1571 if (pAttr)
1572 {
1573 SwTextContentControl* pTextContentControl
1574 = static_txtattr_cast<SwTextContentControl*>(pAttr);
1575 const SwFormatContentControl& rFormatContentControl
1576 = pTextContentControl->GetContentControl();
1577 std::shared_ptr<SwContentControl> pContentControl
1578 = rFormatContentControl.GetContentControl();
1579 if (pContentControl->IsInteractingCharacter(aCh))
1580 {
1581 rSh.GotoContentControl(rFormatContentControl);
1582 return;
1583 }
1584 }
1585 }
1586 }
1587 }
1588
1589 if( pFlyFormat )
1590 {
1591 SvMacroItemId nEvent;
1592
1593 if( 32 <= aCh &&
1594 0 == (( KEY_MOD1 | KEY_MOD2 ) & rKeyCode.GetModifier() ))
1595 nEvent = SvMacroItemId::SwFrmKeyInputAlpha;
1596 else
1597 nEvent = SvMacroItemId::SwFrmKeyInputNoAlpha;
1598
1599 const SvxMacro* pMacro = pFlyFormat->GetMacro().GetMacroTable().Get( nEvent );
1600 if( pMacro )
1601 {
1602 SbxArrayRef xArgs = new SbxArray;
1603 SbxVariableRef xVar = new SbxVariable;
1604 xVar->PutString( pFlyFormat->GetName() );
1605 xArgs->Put(xVar.get(), 1);
1606
1607 xVar = new SbxVariable;
1608 if( SvMacroItemId::SwFrmKeyInputAlpha == nEvent )
1609 xVar->PutChar( aCh );
1610 else
1611 xVar->PutUShort( rKeyCode.GetModifier() | rKeyCode.GetCode() );
1612 xArgs->Put(xVar.get(), 2);
1613
1614 OUString sRet;
1615 rSh.ExecMacro( *pMacro, &sRet, xArgs.get() );
1616 if( !sRet.isEmpty() && sRet.toInt32()!=0 )
1617 return ;
1618 }
1619 }
1620 SelectionType nLclSelectionType;
1621 //A is converted to 1
1622 if( rKeyCode.GetFullCode() == (KEY_A | KEY_MOD1 |KEY_SHIFT)
1623 && rSh.HasDrawView() &&
1624 (bool(nLclSelectionType = rSh.GetSelectionType()) &&
1625 ((nLclSelectionType & (SelectionType::Frame|SelectionType::Graphic)) ||
1626 ((nLclSelectionType & (SelectionType::DrawObject|SelectionType::DbForm)) &&
1627 rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1))))
1628 {
1629 SdrHdlList& rHdlList = const_cast<SdrHdlList&>(rSh.GetDrawView()->GetHdlList());
1630 SdrHdl* pAnchor = rHdlList.GetHdl(SdrHdlKind::Anchor);
1631 if ( ! pAnchor )
1632 pAnchor = rHdlList.GetHdl(SdrHdlKind::Anchor_TR);
1633 if(pAnchor)
1634 rHdlList.SetFocusHdl(pAnchor);
1635 return;
1636 }
1637
1638 SvxAutoCorrCfg* pACfg = nullptr;
1639 SvxAutoCorrect* pACorr = nullptr;
1640
1641 uno::Reference< frame::XDispatchRecorder > xRecorder =
1643 if ( !xRecorder.is() )
1644 {
1645 pACfg = &SvxAutoCorrCfg::Get();
1646 pACorr = pACfg->GetAutoCorrect();
1647 }
1648
1649 SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
1650
1651 OUString sFormulaEntry;
1652
1653 enum class SwKeyState { CheckKey, InsChar, InsTab,
1654 NoNum, NumOff, NumOrNoNum, NumDown, NumUp,
1655 NumIndentInc, NumIndentDec,
1656
1657 OutlineLvOff,
1658 NextCell, PrevCell, OutlineUp, OutlineDown,
1659 GlossaryExpand, NextPrevGlossary,
1660 AutoFormatByInput,
1661 NextObject, PrevObject,
1662 KeyToView,
1663 LaunchOLEObject, GoIntoFly, GoIntoDrawing,
1664 EnterDrawHandleMode,
1665 CheckDocReadOnlyKeys,
1666 CheckAutoCorrect, EditFormula,
1667 ColLeftBig, ColRightBig,
1668 ColLeftSmall, ColRightSmall,
1669 ColBottomBig,
1670 ColBottomSmall,
1671 CellLeftBig, CellRightBig,
1672 CellLeftSmall, CellRightSmall,
1673 CellTopBig, CellBottomBig,
1674 CellTopSmall, CellBottomSmall,
1675
1676 Fly_Change, Draw_Change,
1677 SpecialInsert,
1678 EnterCharCell,
1679 GotoNextFieldMark,
1680 GotoPrevFieldMark,
1681 End };
1682
1683 SwKeyState eKeyState = bIsDocReadOnly ? SwKeyState::CheckDocReadOnlyKeys : SwKeyState::CheckKey;
1684 SwKeyState eNextKeyState = SwKeyState::End;
1685 sal_uInt8 nDir = 0;
1686
1687 if (m_nKS_NUMDOWN_Count > 0)
1689
1692
1693 while( SwKeyState::End != eKeyState )
1694 {
1695 SwKeyState eFlyState = SwKeyState::KeyToView;
1696
1697 switch( eKeyState )
1698 {
1699 case SwKeyState::CheckKey:
1700 eKeyState = SwKeyState::KeyToView; // default forward to View
1701
1703 !rKeyCode.IsMod2() && '=' == aCh &&
1704 !rSh.IsTableMode() && rSh.GetTableFormat() &&
1705 rSh.IsSttPara() &&
1706 !rSh.HasReadonlySel())
1707 {
1708 // at the beginning of the table's cell a '=' ->
1709 // call EditRow (F2-functionality)
1710 // [Avoid this for LibreOfficeKit, as the separate input window
1711 // steals the focus & things go wrong - the user never gets
1712 // the focus back.]
1713 rSh.Push();
1715 !rSh.IsTableBoxTextFormat() )
1716 {
1717 // is at the beginning of the box
1718 eKeyState = SwKeyState::EditFormula;
1719 if( rSh.HasMark() )
1720 rSh.SwapPam();
1721 else
1722 rSh.SttSelect();
1724 rSh.Pop();
1725 rSh.EndSelect();
1726 sFormulaEntry = "=";
1727 }
1728 else
1730 }
1731 else
1732 {
1733 if( pACorr && aTmpQHD.HasContent() && !rSh.HasSelection() &&
1734 !rSh.HasReadonlySel() && !aTmpQHD.m_bIsAutoText &&
1735 pACorr->GetSwFlags().nAutoCmpltExpandKey ==
1736 (rKeyCode.GetModifier() | rKeyCode.GetCode()) )
1737 {
1738 eKeyState = SwKeyState::GlossaryExpand;
1739 break;
1740 }
1741
1742 switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
1743 {
1744 case KEY_RIGHT | KEY_MOD2:
1745 eKeyState = SwKeyState::ColRightBig;
1746 eFlyState = SwKeyState::Fly_Change;
1747 nDir = MOVE_RIGHT_SMALL;
1748 goto KEYINPUT_CHECKTABLE;
1749
1750 case KEY_LEFT | KEY_MOD2:
1751 eKeyState = SwKeyState::ColRightSmall;
1752 eFlyState = SwKeyState::Fly_Change;
1753 nDir = MOVE_LEFT_SMALL;
1754 goto KEYINPUT_CHECKTABLE;
1755
1756 case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT:
1757 eKeyState = SwKeyState::ColLeftSmall;
1758 goto KEYINPUT_CHECKTABLE;
1759
1760 case KEY_LEFT | KEY_MOD2 | KEY_SHIFT:
1761 eKeyState = SwKeyState::ColLeftBig;
1762 goto KEYINPUT_CHECKTABLE;
1763
1764 case KEY_RIGHT | KEY_MOD2 | KEY_MOD1:
1765 eKeyState = SwKeyState::CellRightBig;
1766 goto KEYINPUT_CHECKTABLE;
1767
1768 case KEY_LEFT | KEY_MOD2 | KEY_MOD1:
1769 eKeyState = SwKeyState::CellRightSmall;
1770 goto KEYINPUT_CHECKTABLE;
1771
1773 eKeyState = SwKeyState::CellLeftSmall;
1774 goto KEYINPUT_CHECKTABLE;
1775
1777 eKeyState = SwKeyState::CellLeftBig;
1778 goto KEYINPUT_CHECKTABLE;
1779
1780 case KEY_UP | KEY_MOD2:
1781 eKeyState = SwKeyState::ColBottomSmall;
1782 eFlyState = SwKeyState::Fly_Change;
1783 nDir = MOVE_UP_SMALL;
1784 goto KEYINPUT_CHECKTABLE;
1785
1786 case KEY_DOWN | KEY_MOD2:
1787 eKeyState = SwKeyState::ColBottomBig;
1788 eFlyState = SwKeyState::Fly_Change;
1789 nDir = MOVE_DOWN_SMALL;
1790 goto KEYINPUT_CHECKTABLE;
1791
1792 case KEY_UP | KEY_MOD2 | KEY_MOD1:
1793 eKeyState = SwKeyState::CellBottomSmall;
1794 goto KEYINPUT_CHECKTABLE;
1795
1796 case KEY_DOWN | KEY_MOD2 | KEY_MOD1:
1797 eKeyState = SwKeyState::CellBottomBig;
1798 goto KEYINPUT_CHECKTABLE;
1799
1800 case KEY_UP | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
1801 eKeyState = SwKeyState::CellTopBig;
1802 goto KEYINPUT_CHECKTABLE;
1803
1805 eKeyState = SwKeyState::CellTopSmall;
1806 goto KEYINPUT_CHECKTABLE;
1807
1808KEYINPUT_CHECKTABLE:
1809 // Resolve bugs 49091, 53190, 93402 and
1810 // https://bz.apache.org/ooo/show_bug.cgi?id=113502
1811 // but provide an option for restoring interactive
1812 // table sizing functionality when needed.
1813 if (
1814 ! (Window::GetIndicatorState() & KeyIndicatorState::CAPSLOCK)
1815 && m_rView.KeyInput( aKeyEvent ) // Keystroke is customized
1816 )
1817 {
1818 bFlushBuffer = true;
1819 bNormalChar = false;
1820 eKeyState = SwKeyState::End;
1821 break ;
1822 }
1823
1824 if( rSh.IsTableMode() || !rSh.GetTableFormat() )
1825 {
1826 if(!pFlyFormat && SwKeyState::KeyToView != eFlyState &&
1829 eKeyState = SwKeyState::Draw_Change;
1830
1831 if( pFlyFormat )
1832 eKeyState = eFlyState;
1833 else if( SwKeyState::Draw_Change != eKeyState)
1834 eKeyState = SwKeyState::EnterCharCell;
1835 }
1836 break;
1837
1838 // huge object move
1839 case KEY_RIGHT | KEY_SHIFT:
1840 case KEY_LEFT | KEY_SHIFT:
1841 case KEY_UP | KEY_SHIFT:
1842 case KEY_DOWN | KEY_SHIFT:
1843 {
1844 const SelectionType nSelectionType = rSh.GetSelectionType();
1845 if ( ( pFlyFormat
1847 || ( ( nSelectionType & (SelectionType::DrawObject|SelectionType::DbForm) )
1848 && rSh.GetDrawView()->AreObjectsMarked() ) )
1849 {
1850 eKeyState = pFlyFormat ? SwKeyState::Fly_Change : SwKeyState::Draw_Change;
1851 if (nSelectionType & SelectionType::DrawObject)
1852 {
1853 // tdf#137964: always move the DrawObject if one is selected
1854 eKeyState = SwKeyState::Draw_Change;
1855 }
1856 switch ( rKeyCode.GetCode() )
1857 {
1858 case KEY_RIGHT: nDir = MOVE_RIGHT_HUGE; break;
1859 case KEY_LEFT: nDir = MOVE_LEFT_HUGE; break;
1860 case KEY_UP: nDir = MOVE_UP_HUGE; break;
1861 case KEY_DOWN: nDir = MOVE_DOWN_HUGE; break;
1862 }
1863 }
1864 break;
1865 }
1866
1867 case KEY_LEFT:
1868 case KEY_LEFT | KEY_MOD1:
1869 {
1870 bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1);
1871 if(!bMod1)
1872 {
1873 eFlyState = SwKeyState::Fly_Change;
1874 nDir = MOVE_LEFT_BIG;
1875 }
1876 goto KEYINPUT_CHECKTABLE_INSDEL;
1877 }
1878 case KEY_RIGHT | KEY_MOD1:
1879 {
1880 goto KEYINPUT_CHECKTABLE_INSDEL;
1881 }
1882 case KEY_UP:
1883 case KEY_UP | KEY_MOD1:
1884 {
1885 bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1);
1886 if(!bMod1)
1887 {
1888 eFlyState = SwKeyState::Fly_Change;
1889 nDir = MOVE_UP_BIG;
1890 }
1891 goto KEYINPUT_CHECKTABLE_INSDEL;
1892 }
1893 case KEY_DOWN:
1894 case KEY_DOWN | KEY_MOD1:
1895 {
1896 bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1);
1897 if(!bMod1)
1898 {
1899 ::sw::mark::IFieldmark* pMark = rSh.GetCurrentFieldmark();
1900 if (auto pDropDown = dynamic_cast<FieldmarkWithDropDownButton*>(pMark))
1901 {
1902 pDropDown->LaunchPopup();
1903 eKeyState = SwKeyState::End;
1904 break;
1905 }
1906 eFlyState = SwKeyState::Fly_Change;
1907 nDir = MOVE_DOWN_BIG;
1908 }
1909 goto KEYINPUT_CHECKTABLE_INSDEL;
1910 }
1911
1912KEYINPUT_CHECKTABLE_INSDEL:
1913 if( rSh.IsTableMode() || !rSh.GetTableFormat() )
1914 {
1915 const SelectionType nSelectionType = rSh.GetSelectionType();
1916
1917 eKeyState = SwKeyState::KeyToView;
1918 if(SwKeyState::KeyToView != eFlyState)
1919 {
1920 if((nSelectionType & (SelectionType::DrawObject|SelectionType::DbForm)) &&
1922 eKeyState = SwKeyState::Draw_Change;
1924 eKeyState = SwKeyState::Fly_Change;
1925 }
1926 }
1927 break;
1928
1929
1930 case KEY_DELETE:
1931 if ( !rSh.HasReadonlySel() || rSh.CursorInsideInputField())
1932 {
1933 if (rSh.IsInFrontOfLabel() && rSh.NumOrNoNum())
1934 eKeyState = SwKeyState::NumOrNoNum;
1935 }
1936 else if (!rSh.IsCursorInParagraphMetadataField())
1937 {
1938 rSh.InfoReadOnlyDialog(false);
1939 eKeyState = SwKeyState::End;
1940 }
1941 break;
1942
1943 case KEY_RETURN:
1944 {
1945 if ( !rSh.HasReadonlySel()
1946 && !rSh.CursorInsideInputField()
1947 && !rSh.CursorInsideContentControl() )
1948 {
1949 const SelectionType nSelectionType = rSh.GetSelectionType();
1950 if(nSelectionType & SelectionType::Ole)
1951 eKeyState = SwKeyState::LaunchOLEObject;
1952 else if(nSelectionType & SelectionType::Frame)
1953 eKeyState = SwKeyState::GoIntoFly;
1954 else if((nSelectionType & SelectionType::DrawObject) &&
1955 !(nSelectionType & SelectionType::DrawObjectEditMode) &&
1957 {
1958 eKeyState = SwKeyState::GoIntoDrawing;
1959 if (lcl_goIntoTextBox(*this, rSh))
1960 eKeyState = SwKeyState::GoIntoFly;
1961 }
1962 else if( aTmpQHD.HasContent() && !rSh.HasSelection() &&
1963 aTmpQHD.m_bIsAutoText )
1964 eKeyState = SwKeyState::GlossaryExpand;
1965
1966 //RETURN and empty paragraph in numbering -> end numbering
1967 else if( m_aInBuffer.isEmpty() &&
1970 !rSh.HasSelection() &&
1971 rSh.IsSttPara() && rSh.IsEndPara() )
1972 {
1973 eKeyState = SwKeyState::NumOff;
1974 eNextKeyState = SwKeyState::OutlineLvOff;
1975 }
1976 //RETURN for new paragraph with AutoFormatting
1977 else if( pACfg && pACfg->IsAutoFormatByInput() &&
1978 !(nSelectionType & (SelectionType::Graphic |
1982 {
1983 eKeyState = SwKeyState::AutoFormatByInput;
1984 }
1985 else
1986 {
1987 eNextKeyState = eKeyState;
1988 eKeyState = SwKeyState::CheckAutoCorrect;
1989 }
1990 }
1991 }
1992 break;
1993 case KEY_RETURN | KEY_MOD2:
1994 {
1995 if ( !rSh.HasReadonlySel()
1996 && !rSh.IsSttPara()
1998 && !rSh.CursorInsideInputField() )
1999 {
2000 eKeyState = SwKeyState::NoNum;
2001 }
2002 else if( rSh.CanSpecialInsert() )
2003 eKeyState = SwKeyState::SpecialInsert;
2004 }
2005 break;
2006 case KEY_BACKSPACE:
2007 case KEY_BACKSPACE | KEY_SHIFT:
2008 if ( !rSh.HasReadonlySel() || rSh.CursorInsideInputField())
2009 {
2010 bool bDone = false;
2011 // try to add comment for code snip:
2012 // Remove the paragraph indent, if the cursor is at the
2013 // beginning of a paragraph, there is no selection
2014 // and no numbering rule found at the current paragraph
2015 // Also try to remove indent, if current paragraph
2016 // has numbering rule, but isn't counted and only
2017 // key <backspace> is hit.
2018 const bool bOnlyBackspaceKey( KEY_BACKSPACE == rKeyCode.GetFullCode() );
2019 if ( rSh.IsSttPara()
2020 && !rSh.HasSelection()
2021 && ( rSh.GetNumRuleAtCurrCursorPos() == nullptr
2022 || ( rSh.IsNoNum() && bOnlyBackspaceKey ) ) )
2023 {
2024 bDone = rSh.TryRemoveIndent();
2025 }
2026
2027 if (bDone)
2028 eKeyState = SwKeyState::End;
2029 else
2030 {
2031 if ( rSh.IsSttPara() && !rSh.IsNoNum() )
2032 {
2033 if (m_nKS_NUMDOWN_Count > 0 &&
2034 0 < rSh.GetNumLevel())
2035 {
2036 eKeyState = SwKeyState::NumUp;
2038 bDone = true;
2039 }
2040 else if (m_nKS_NUMINDENTINC_Count > 0)
2041 {
2042 eKeyState = SwKeyState::NumIndentDec;
2044 bDone = true;
2045 }
2046 }
2047
2048 // If the cursor is in an empty paragraph, which has
2049 // a numbering, but not the outline numbering, and
2050 // there is no selection, the numbering has to be
2051 // deleted on key <Backspace>.
2052 // Otherwise method <SwEditShell::NumOrNoNum(..)>
2053 // should only change the <IsCounted()> state of
2054 // the current paragraph depending of the key.
2055 // On <backspace> it is set to <false>,
2056 // on <shift-backspace> it is set to <true>.
2057 // Thus, assure that method <SwEditShell::NumOrNum(..)>
2058 // is only called for the intended purpose.
2059 if ( !bDone && rSh.IsSttPara() )
2060 {
2061 bool bCallNumOrNoNum( false );
2062 if ( bOnlyBackspaceKey && !rSh.IsNoNum() )
2063 {
2064 bCallNumOrNoNum = true;
2065 }
2066 else if ( !bOnlyBackspaceKey && rSh.IsNoNum() )
2067 {
2068 bCallNumOrNoNum = true;
2069 }
2070 else if ( bOnlyBackspaceKey
2071 && rSh.IsSttPara()
2072 && rSh.IsEndPara()
2073 && !rSh.HasSelection() )
2074 {
2075 const SwNumRule* pCurrNumRule( rSh.GetNumRuleAtCurrCursorPos() );
2076 if ( pCurrNumRule != nullptr
2077 && pCurrNumRule != rSh.GetOutlineNumRule() )
2078 {
2079 bCallNumOrNoNum = true;
2080 }
2081 }
2082 if ( bCallNumOrNoNum
2083 && rSh.NumOrNoNum( !bOnlyBackspaceKey ) )
2084 {
2085 eKeyState = SwKeyState::NumOrNoNum;
2086 }
2087 }
2088 }
2089 }
2090 else if (!rSh.IsCursorInParagraphMetadataField())
2091 {
2092 rSh.InfoReadOnlyDialog(false);
2093 eKeyState = SwKeyState::End;
2094 }
2095 break;
2096
2097 case KEY_RIGHT:
2098 {
2099 eFlyState = SwKeyState::Fly_Change;
2100 nDir = MOVE_RIGHT_BIG;
2101 goto KEYINPUT_CHECKTABLE_INSDEL;
2102 }
2103 case KEY_TAB:
2104 {
2105 // Rich text contentControls accept tabs and fieldmarks and other rich text,
2106 // so first act on cases that are not a content control
2107 SwTextContentControl* pTextContentControl = rSh.CursorInsideContentControl();
2108 if ((rSh.IsFormProtected() && !pTextContentControl) ||
2110 {
2111 eKeyState = SwKeyState::GotoNextFieldMark;
2112 }
2113 else if ( !rSh.IsMultiSelection() && rSh.CursorInsideInputField() )
2114 {
2116 eKeyState = SwKeyState::End;
2117 }
2118 else if( rSh.GetNumRuleAtCurrCursorPos()
2119 && rSh.IsSttOfPara()
2120 && !rSh.HasReadonlySel() )
2121 {
2123 {
2124 eKeyState = SwKeyState::NumDown;
2125 }
2126 else
2127 {
2128 eKeyState = SwKeyState::InsTab;
2129 }
2130 }
2131 else if (rSh.GetSelectionType() &
2137 {
2138 eKeyState = SwKeyState::NextObject;
2139 }
2140 else if ( rSh.GetTableFormat() )
2141 {
2142 if( rSh.HasSelection() || rSh.HasReadonlySel() )
2143 eKeyState = SwKeyState::NextCell;
2144 else
2145 {
2146 eKeyState = SwKeyState::CheckAutoCorrect;
2147 eNextKeyState = SwKeyState::NextCell;
2148 }
2149 }
2150 else if (pTextContentControl)
2151 {
2152 auto pCC = pTextContentControl->GetContentControl().GetContentControl();
2153 if (pCC)
2154 {
2155 switch (pCC->GetType())
2156 {
2158 eKeyState = SwKeyState::InsTab;
2159 break;
2160 default:
2161 eKeyState = SwKeyState::GotoNextFieldMark;
2162 }
2163 }
2164 }
2165 else
2166 {
2167 eKeyState = SwKeyState::InsTab;
2168 if( rSh.IsSttOfPara() && !rSh.HasReadonlySel() )
2169 {
2171 if( pColl &&
2172
2174 && MAXLEVEL-1 > pColl->GetAssignedOutlineStyleLevel() )
2175 eKeyState = SwKeyState::OutlineDown;
2176 }
2177 }
2178 }
2179 break;
2180 case KEY_TAB | KEY_SHIFT:
2181 {
2182 SwTextContentControl* pTextContentControl = rSh.CursorInsideContentControl();
2183 if ((rSh.IsFormProtected() && !pTextContentControl) ||
2185 {
2186 eKeyState = SwKeyState::GotoPrevFieldMark;
2187 }
2188 else if ( !rSh.IsMultiSelection() && rSh.CursorInsideInputField() )
2189 {
2191 eKeyState = SwKeyState::End;
2192 }
2193 else if( rSh.GetNumRuleAtCurrCursorPos()
2194 && rSh.IsSttOfPara()
2195 && !rSh.HasReadonlySel() )
2196 {
2197 eKeyState = SwKeyState::NumUp;
2198 }
2199 else if (rSh.GetSelectionType() &
2205 {
2206 eKeyState = SwKeyState::PrevObject;
2207 }
2208 else if ( rSh.GetTableFormat() )
2209 {
2210 if( rSh.HasSelection() || rSh.HasReadonlySel() )
2211 eKeyState = SwKeyState::PrevCell;
2212 else
2213 {
2214 eKeyState = SwKeyState::CheckAutoCorrect;
2215 eNextKeyState = SwKeyState::PrevCell;
2216 }
2217 }
2218 else if (pTextContentControl)
2219 {
2220 eKeyState = SwKeyState::GotoPrevFieldMark;
2221 }
2222 else
2223 {
2224 eKeyState = SwKeyState::End;
2225 if( rSh.IsSttOfPara() && !rSh.HasReadonlySel() )
2226 {
2228 if( pColl &&
2230 0 < pColl->GetAssignedOutlineStyleLevel())
2231 eKeyState = SwKeyState::OutlineUp;
2232 }
2233 }
2234 }
2235 break;
2236 case KEY_TAB | KEY_MOD1:
2237 case KEY_TAB | KEY_MOD2:
2238 if( !rSh.HasReadonlySel() )
2239 {
2240 if( aTmpQHD.HasContent() && !rSh.HasSelection() )
2241 {
2242 // Next auto-complete suggestion
2243 aTmpQHD.Next( pACorr &&
2244 pACorr->GetSwFlags().bAutoCmpltEndless );
2245 eKeyState = SwKeyState::NextPrevGlossary;
2246 }
2247 else if( rSh.GetTableFormat() )
2248 eKeyState = SwKeyState::InsTab;
2249 else if((rSh.GetSelectionType() &
2253 eKeyState = SwKeyState::EnterDrawHandleMode;
2254 else
2255 {
2256 if ( !rSh.IsMultiSelection()
2258 eKeyState = SwKeyState::NumIndentInc;
2259 }
2260 }
2261 break;
2262
2263 case KEY_TAB | KEY_MOD1 | KEY_SHIFT:
2264 {
2265 if( aTmpQHD.HasContent() && !rSh.HasSelection() &&
2266 !rSh.HasReadonlySel() )
2267 {
2268 // Previous auto-complete suggestion.
2269 aTmpQHD.Previous( pACorr &&
2270 pACorr->GetSwFlags().bAutoCmpltEndless );
2271 eKeyState = SwKeyState::NextPrevGlossary;
2272 }
2276 {
2277 eKeyState = SwKeyState::EnterDrawHandleMode;
2278 }
2279 else
2280 {
2281 if ( !rSh.IsMultiSelection()
2283 eKeyState = SwKeyState::NumIndentDec;
2284 }
2285 }
2286 break;
2287 case KEY_F2 :
2288 if( !rSh.HasReadonlySel() )
2289 {
2290 const SelectionType nSelectionType = rSh.GetSelectionType();
2291 if(nSelectionType & SelectionType::Frame)
2292 eKeyState = SwKeyState::GoIntoFly;
2293 else if(nSelectionType & SelectionType::DrawObject)
2294 {
2295 eKeyState = SwKeyState::GoIntoDrawing;
2296 if (lcl_goIntoTextBox(*this, rSh))
2297 eKeyState = SwKeyState::GoIntoFly;
2298 }
2299 }
2300 break;
2301 }
2302 }
2303 break;
2304 case SwKeyState::CheckDocReadOnlyKeys:
2305 {
2306 eKeyState = SwKeyState::KeyToView;
2307 switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
2308 {
2309 case KEY_TAB:
2310 case KEY_TAB | KEY_SHIFT:
2311 bNormalChar = false;
2312 eKeyState = SwKeyState::End;
2313 if ( rSh.GetSelectionType() &
2319
2320 {
2321 eKeyState = (rKeyCode.GetModifier() & KEY_SHIFT) ?
2322 SwKeyState::PrevObject : SwKeyState::NextObject;
2323 }
2324 else if ( !rSh.IsMultiSelection() && rSh.CursorInsideInputField() )
2325 {
2328 }
2329 else
2330 {
2331 rSh.SelectNextPrevHyperlink( KEY_SHIFT != rKeyCode.GetModifier() );
2332 }
2333 break;
2334 case KEY_RETURN:
2335 {
2336 const SelectionType nSelectionType = rSh.GetSelectionType();
2337 if(nSelectionType & SelectionType::Frame)
2338 eKeyState = SwKeyState::GoIntoFly;
2339 else
2340 {
2342 rSh.GetCurAttr(aSet);
2343 if(SfxItemState::SET == aSet.GetItemState(RES_TXTATR_INETFMT, false))
2344 {
2345 const SfxPoolItem& rItem = aSet.Get(RES_TXTATR_INETFMT);
2346 bNormalChar = false;
2347 eKeyState = SwKeyState::End;
2348 rSh.ClickToINetAttr(static_cast<const SwFormatINetFormat&>(rItem));
2349 }
2350 }
2351 }
2352 break;
2353 }
2354 }
2355 break;
2356
2357 case SwKeyState::EnterCharCell:
2358 {
2359 eKeyState = SwKeyState::KeyToView;
2360 switch ( rKeyCode.GetModifier() | rKeyCode.GetCode() )
2361 {
2362 case KEY_RIGHT | KEY_MOD2:
2363 rSh.Right( SwCursorSkipMode::Chars, false, 1, false );
2364 eKeyState = SwKeyState::End;
2365 FlushInBuffer();
2366 break;
2367 case KEY_LEFT | KEY_MOD2:
2368 rSh.Left( SwCursorSkipMode::Chars, false, 1, false );
2369 eKeyState = SwKeyState::End;
2370 FlushInBuffer();
2371 break;
2372 }
2373 }
2374 break;
2375
2376 case SwKeyState::KeyToView:
2377 {
2378 eKeyState = SwKeyState::End;
2379 bNormalChar =
2380 !rKeyCode.IsMod2() &&
2381 rKeyCode.GetModifier() != KEY_MOD1 &&
2382 rKeyCode.GetModifier() != (KEY_MOD1|KEY_SHIFT) &&
2383 SW_ISPRINTABLE( aCh );
2384
2385 if( bNormalChar && rSh.IsInFrontOfLabel() )
2386 {
2387 rSh.NumOrNoNum();
2388 }
2389
2390 if( !m_aInBuffer.isEmpty() && ( !bNormalChar || bIsDocReadOnly ))
2391 FlushInBuffer();
2392
2393 if (rSh.HasReadonlySel()
2394 && ( rKeyCode.GetFunction() == KeyFuncType::PASTE
2395 || rKeyCode.GetFunction() == KeyFuncType::CUT))
2396 {
2397 rSh.InfoReadOnlyDialog(true);
2398 eKeyState = SwKeyState::End;
2399 }
2400 else if( m_rView.KeyInput( aKeyEvent ) )
2401 {
2402 bFlushBuffer = true;
2403 bNormalChar = false;
2404 }
2405 else
2406 {
2407 // Because Sfx accelerators are only called when they were
2408 // enabled at the last status update, copy has to called
2409 // 'forcefully' by us if necessary.
2410 if( rKeyCode.GetFunction() == KeyFuncType::COPY )
2411 GetView().GetViewFrame().GetBindings().Execute(SID_COPY);
2412
2413 if( !bIsDocReadOnly && bNormalChar )
2414 {
2415 const SelectionType nSelectionType = rSh.GetSelectionType();
2416 const bool bDrawObject = (nSelectionType & SelectionType::DrawObject) &&
2417 !(nSelectionType & SelectionType::DrawObjectEditMode) &&
2419
2420 bool bTextBox = false;
2421 if (bDrawObject && lcl_goIntoTextBox(*this, rSh))
2422 // A draw shape was selected, but it has a TextBox,
2423 // start editing that instead when the normal
2424 // character is pressed.
2425 bTextBox = true;
2426
2427 if (bDrawObject && !bTextBox)
2428 {
2430 if(pObj)
2431 {
2433 if ( auto pSwDrawTextShell = dynamic_cast< SwDrawTextShell *>( m_rView.GetCurShell() ) )
2434 pSwDrawTextShell->Init();
2435 rSh.GetDrawView()->KeyInput( rKEvt, this );
2436 }
2437 }
2438 else if (nSelectionType & SelectionType::Frame || bTextBox)
2439 {
2440 rSh.UnSelectFrame();
2441 rSh.LeaveSelFrameMode();
2442 m_rView.AttrChangedNotify(nullptr);
2444 }
2445 eKeyState = SwKeyState::InsChar;
2446 }
2447 else
2448 {
2449 bNormalChar = false;
2450 Window::KeyInput( aKeyEvent );
2451 }
2452 }
2453 }
2454 break;
2455 case SwKeyState::LaunchOLEObject:
2456 {
2457 rSh.LaunchOLEObj();
2458 eKeyState = SwKeyState::End;
2459 }
2460 break;
2461 case SwKeyState::GoIntoFly:
2462 {
2463 rSh.UnSelectFrame();
2464 rSh.LeaveSelFrameMode();
2465 m_rView.AttrChangedNotify(nullptr);
2467 eKeyState = SwKeyState::End;
2468 }
2469 break;
2470 case SwKeyState::GoIntoDrawing:
2471 {
2472 if (SdrMark* pMark = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0))
2473 {
2474 SdrObject* pObj = pMark->GetMarkedSdrObj();
2475 if(pObj)
2476 {
2478 if (auto pSwDrawTextShell = dynamic_cast< SwDrawTextShell *>( m_rView.GetCurShell() ) )
2479 pSwDrawTextShell->Init();
2480 }
2481 }
2482 eKeyState = SwKeyState::End;
2483 }
2484 break;
2485 case SwKeyState::EnterDrawHandleMode:
2486 {
2487 const SdrHdlList& rHdlList = rSh.GetDrawView()->GetHdlList();
2488 bool bForward(!aKeyEvent.GetKeyCode().IsShift());
2489
2490 const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
2491 eKeyState = SwKeyState::End;
2492 }
2493 break;
2494 case SwKeyState::InsTab:
2495 if( dynamic_cast<const SwWebView*>( &m_rView) != nullptr) // no Tab for WebView
2496 {
2497 // then it should be passed along
2498 Window::KeyInput( aKeyEvent );
2499 eKeyState = SwKeyState::End;
2500 break;
2501 }
2502 aCh = '\t';
2503 [[fallthrough]];
2504 case SwKeyState::InsChar:
2506 {
2507 const SwPosition* pStart = rSh.GetCursor()->Start();
2508 SwTextNode* pTextNode = pStart->GetNode().GetTextNode();
2509 if (pTextNode)
2510 {
2511 sal_Int32 nIndex = pStart->GetContentIndex();
2513 if (pAttr)
2514 {
2515 auto pTextContentControl = static_txtattr_cast<SwTextContentControl*>(pAttr);
2516 const SwFormatContentControl& rFormatContentControl = pTextContentControl->GetContentControl();
2517 std::shared_ptr<SwContentControl> pContentControl = rFormatContentControl.GetContentControl();
2518 if (pContentControl->IsInteractingCharacter(aCh))
2519 {
2520 rSh.GotoContentControl(rFormatContentControl);
2521 eKeyState = SwKeyState::End;
2522 break;
2523 }
2524 }
2525 }
2526 }
2527
2528 if (rSh.GetChar(false)==CH_TXT_ATR_FORMELEMENT)
2529 {
2530 ::sw::mark::ICheckboxFieldmark* pFieldmark =
2531 dynamic_cast< ::sw::mark::ICheckboxFieldmark* >
2532 (rSh.GetCurrentFieldmark());
2533 OSL_ENSURE(pFieldmark,
2534 "Where is my FieldMark??");
2535 if(pFieldmark)
2536 {
2537 pFieldmark->SetChecked(!pFieldmark->IsChecked());
2538 OSL_ENSURE(pFieldmark->IsExpanded(),
2539 "where is the otherpos?");
2540 if (pFieldmark->IsExpanded())
2541 {
2542 rSh.CalcLayout();
2543 }
2544 }
2545 eKeyState = SwKeyState::End;
2546 }
2547 else if ( !rSh.HasReadonlySel()
2548 || rSh.CursorInsideInputField() )
2549 {
2550 const bool bIsNormalChar =
2551 GetAppCharClass().isLetterNumeric( OUString( aCh ), 0 );
2552 if( bAppendSpace && bIsNormalChar &&
2553 (!m_aInBuffer.isEmpty() || !rSh.IsSttPara() || !rSh.IsEndPara() ))
2554 {
2555 // insert a blank ahead of the character. this ends up
2556 // between the expanded text and the new "non-word-separator".
2557 m_aInBuffer += " ";
2558 }
2559
2560 const bool bIsAutoCorrectChar = SvxAutoCorrect::IsAutoCorrectChar( aCh );
2561 if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || rSh.IsNbspRunNext() ) &&
2562 pACfg->IsAutoFormatByInput() &&
2563 (( pACorr->IsAutoCorrFlag( ACFlags::ChgWeightUnderl ) &&
2564 ( '*' == aCh || '_' == aCh ) ) ||
2565 ( pACorr->IsAutoCorrFlag( ACFlags::ChgQuotes ) && ('\"' == aCh ))||
2566 ( pACorr->IsAutoCorrFlag( ACFlags::ChgSglQuotes ) && ( '\'' == aCh))))
2567 {
2568 FlushInBuffer();
2569 rSh.AutoCorrect( *pACorr, aCh );
2570 if( '\"' != aCh && '\'' != aCh ) // only call when "*_"!
2571 rSh.UpdateAttr();
2572 }
2573 else if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || rSh.IsNbspRunNext() ) &&
2574 pACfg->IsAutoFormatByInput() &&
2575 pACorr->IsAutoCorrFlag( ACFlags::CapitalStartSentence | ACFlags::CapitalStartWord |
2576 ACFlags::ChgOrdinalNumber | ACFlags::AddNonBrkSpace |
2577 ACFlags::ChgToEnEmDash | ACFlags::SetINetAttr |
2578 ACFlags::Autocorrect | ACFlags::TransliterateRTL |
2579 ACFlags::SetDOIAttr ) &&
2580 '\"' != aCh && '\'' != aCh && '*' != aCh && '_' != aCh
2581 )
2582 {
2583 FlushInBuffer();
2584 rSh.AutoCorrect( *pACorr, aCh );
2585 }
2586 else
2587 {
2588 OUStringBuffer aBuf(m_aInBuffer);
2590 m_aInBuffer.getLength() + aKeyEvent.GetRepeat() + 1, aCh);
2591 m_aInBuffer = aBuf.makeStringAndClear();
2592 bool delayFlush = Application::AnyInput( VclInputFlags::KEYBOARD );
2593 bFlushBuffer = !delayFlush;
2594 if( delayFlush )
2595 {
2596 // Start the timer, make sure to not restart it.
2597 keyInputFlushTimerStop.dismiss();
2600 }
2601 }
2602 eKeyState = SwKeyState::End;
2603 }
2604 else
2605 {
2606 rSh.InfoReadOnlyDialog(true);
2607 eKeyState = SwKeyState::End;
2608 }
2609 break;
2610
2611 case SwKeyState::CheckAutoCorrect:
2612 {
2613 if( pACorr && pACfg->IsAutoFormatByInput() &&
2614 pACorr->IsAutoCorrFlag( ACFlags::CapitalStartSentence | ACFlags::CapitalStartWord |
2615 ACFlags::ChgOrdinalNumber | ACFlags::TransliterateRTL |
2616 ACFlags::ChgToEnEmDash | ACFlags::SetINetAttr |
2617 ACFlags::Autocorrect | ACFlags::SetDOIAttr ) &&
2618 !rSh.HasReadonlySel() )
2619 {
2620 FlushInBuffer();
2621 rSh.AutoCorrect( *pACorr, u'\0' );
2622 }
2623 eKeyState = eNextKeyState;
2624 }
2625 break;
2626
2627 default:
2628 {
2629 sal_uInt16 nSlotId = 0;
2630 FlushInBuffer();
2631 switch( eKeyState )
2632 {
2633 case SwKeyState::SpecialInsert:
2634 rSh.DoSpecialInsert();
2635 break;
2636
2637 case SwKeyState::NoNum:
2638 rSh.NoNum();
2639 break;
2640
2641 case SwKeyState::NumOff:
2642 // shell change - so record in advance
2643 rSh.DelNumRules();
2644 break;
2645 case SwKeyState::OutlineLvOff: // delete autofmt outlinelevel later
2646 break;
2647
2648 case SwKeyState::NumDown:
2649 rSh.NumUpDown();
2651 break;
2652 case SwKeyState::NumUp:
2653 rSh.NumUpDown( false );
2654 break;
2655
2656 case SwKeyState::NumIndentInc:
2659 break;
2660
2661 case SwKeyState::GotoNextFieldMark:
2662 {
2663 rSh.GotoFormControl(/*bNext=*/true);
2664 }
2665 break;
2666
2667 case SwKeyState::GotoPrevFieldMark:
2668 {
2669 rSh.GotoFormControl(/*bNext=*/false);
2670 }
2671 break;
2672
2673 case SwKeyState::NumIndentDec:
2675 break;
2676
2677 case SwKeyState::OutlineDown:
2678 rSh.OutlineUpDown();
2679 break;
2680 case SwKeyState::OutlineUp:
2681 rSh.OutlineUpDown( -1 );
2682 break;
2683
2684 case SwKeyState::NextCell:
2685 // always 'flush' in tables
2686 rSh.GoNextCell(!rSh.HasReadonlySel());
2687 nSlotId = FN_GOTO_NEXT_CELL;
2688 break;
2689 case SwKeyState::PrevCell:
2690 rSh.GoPrevCell();
2691 nSlotId = FN_GOTO_PREV_CELL;
2692 break;
2693 case SwKeyState::AutoFormatByInput:
2694 rSh.SplitNode( true );
2695 break;
2696
2697 case SwKeyState::NextObject:
2698 case SwKeyState::PrevObject:
2699 if(rSh.GotoObj( SwKeyState::NextObject == eKeyState, GotoObjFlags::Any))
2700 {
2701 if( rSh.IsFrameSelected() &&
2703 {
2705 m_rView.SetDrawFuncPtr(nullptr);
2707 m_rView.AttrChangedNotify(nullptr);
2708 }
2709 rSh.HideCursor();
2710 rSh.EnterSelFrameMode();
2711 }
2712 break;
2713 case SwKeyState::GlossaryExpand:
2714 {
2715 // replace the word or abbreviation with the auto text
2717
2718 OUString sFnd(aTmpQHD.CurStr());
2719 if( aTmpQHD.m_bIsAutoText )
2720 {
2722 OUString sShrtNm;
2723 OUString sGroup;
2724 if(pList->GetShortName( sFnd, sShrtNm, sGroup))
2725 {
2726 rSh.SttSelect();
2727 rSh.ExtendSelection(false, aTmpQHD.CurLen());
2728 SwGlossaryHdl* pGlosHdl = GetView().GetGlosHdl();
2729 pGlosHdl->SetCurGroup(sGroup, true);
2730 pGlosHdl->InsertGlossary( sShrtNm);
2732 }
2733 }
2734 else
2735 {
2736 sFnd = sFnd.copy(aTmpQHD.CurLen());
2737 rSh.Insert( sFnd );
2738 s_pQuickHlpData->m_bAppendSpace = !pACorr ||
2740 }
2741 rSh.EndUndo( SwUndoId::END );
2742 }
2743 break;
2744
2745 case SwKeyState::NextPrevGlossary:
2746 s_pQuickHlpData->Move( aTmpQHD );
2747 s_pQuickHlpData->Start(rSh, false);
2748 break;
2749
2750 case SwKeyState::EditFormula:
2751 {
2752 const sal_uInt16 nId = SwInputChild::GetChildWindowId();
2753
2754 SfxViewFrame& rVFrame = GetView().GetViewFrame();
2755 rVFrame.ToggleChildWindow( nId );
2756 SwInputChild* pChildWin = static_cast<SwInputChild*>(rVFrame.
2757 GetChildWindow( nId ));
2758 if( pChildWin )
2759 pChildWin->SetFormula( sFormulaEntry );
2760 }
2761 break;
2762
2765 case SwKeyState::ColLeftSmall: rSh.SetColRowWidthHeight( TableChgWidthHeightType::ColLeft, pModOpt->GetTableHMove() ); break;
2766 case SwKeyState::ColRightSmall: rSh.SetColRowWidthHeight( TableChgWidthHeightType::ColRight, pModOpt->GetTableHMove() ); break;
2768 case SwKeyState::ColBottomSmall: rSh.SetColRowWidthHeight( TableChgWidthHeightType::RowBottom, pModOpt->GetTableVMove() ); break;
2771 case SwKeyState::CellLeftSmall: rSh.SetColRowWidthHeight( TableChgWidthHeightType::CellLeft, pModOpt->GetTableHMove() ); break;
2772 case SwKeyState::CellRightSmall: rSh.SetColRowWidthHeight( TableChgWidthHeightType::CellRight, pModOpt->GetTableHMove() ); break;
2775 case SwKeyState::CellTopSmall: rSh.SetColRowWidthHeight( TableChgWidthHeightType::CellTop, pModOpt->GetTableVMove() ); break;
2776 case SwKeyState::CellBottomSmall: rSh.SetColRowWidthHeight( TableChgWidthHeightType::CellBottom, pModOpt->GetTableVMove() ); break;
2777
2778 case SwKeyState::Fly_Change:
2779 {
2780 SdrView *pSdrView = rSh.GetDrawView();
2781 const SdrHdlList& rHdlList = pSdrView->GetHdlList();
2782 if(rHdlList.GetFocusHdl())
2783 ChangeDrawing( nDir );
2784 else
2785 ChangeFly( nDir, dynamic_cast<const SwWebView*>( &m_rView) != nullptr );
2786 }
2787 break;
2788 case SwKeyState::Draw_Change :
2789 ChangeDrawing( nDir );
2790 break;
2791 default:
2792 break;
2793 }
2794 if( nSlotId && m_rView.GetViewFrame().GetBindings().GetRecorder().is() )
2795 {
2796 SfxRequest aReq(m_rView.GetViewFrame(), nSlotId);
2797 aReq.Done();
2798 }
2799 eKeyState = SwKeyState::End;
2800 }
2801 }
2802 }
2803
2804 // update the page number in the statusbar
2805 sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
2806 if( KEY_UP == nKey || KEY_DOWN == nKey || KEY_PAGEUP == nKey || KEY_PAGEDOWN == nKey )
2808
2809 // in case the buffered characters are inserted
2810 if( bFlushBuffer && !m_aInBuffer.isEmpty() )
2811 {
2812 FlushInBuffer();
2813
2814 // maybe show Tip-Help
2815 if (bNormalChar)
2816 {
2817 const bool bAutoTextShown
2818 = pACfg && pACfg->IsAutoTextTip() && ShowAutoText(rSh.GetChunkForAutoText());
2819 if (!bAutoTextShown && pACorr && pACorr->GetSwFlags().bAutoCompleteWords)
2820 ShowAutoCorrectQuickHelp(rSh.GetPrevAutoCorrWord(*pACorr), *pACorr);
2821 }
2822 }
2823
2824 // get the word count dialog to update itself
2825 SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetView().GetViewFrame().GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
2826 if( pWrdCnt )
2827 pWrdCnt->UpdateCounts();
2828
2829}
2830
2835{
2836 // Not on all systems a MouseButtonUp is used ahead
2837 // of the modal dialog (like on WINDOWS).
2838 // So reset the statuses here and release the mouse
2839 // for the dialog.
2840 m_bMBPressed = false;
2841 g_bNoInterrupt = false;
2842 EnterArea();
2843 ReleaseMouse();
2844}
2845
2850static bool lcl_urlOverBackground(SwWrtShell& rSh, const Point& rDocPos)
2851{
2852 SwContentAtPos aSwContentAtPos(IsAttrAtPos::InetAttr);
2853 SdrObject* pSelectableObj = rSh.GetObjAt(rDocPos);
2854
2855 return rSh.GetContentAtPos(rDocPos, aSwContentAtPos) && pSelectableObj->GetLayer() == rSh.GetDoc()->getIDocumentDrawModelAccess().GetHellId();
2856}
2857
2858void SwEditWin::MoveCursor( SwWrtShell &rSh, const Point& rDocPos,
2859 const bool bOnlyText, bool bLockView )
2860{
2861 const bool bTmpNoInterrupt = g_bNoInterrupt;
2862 g_bNoInterrupt = false;
2863
2864 int nTmpSetCursor = 0;
2865
2866 if( !rSh.IsViewLocked() && bLockView )
2867 rSh.LockView( true );
2868 else
2869 bLockView = false;
2870
2871 {
2872 // only temporary generate move context because otherwise
2873 // the query to the content form doesn't work!!!
2874 SwMvContext aMvContext( &rSh );
2875 nTmpSetCursor = rSh.CallSetCursor(&rDocPos, bOnlyText);
2876 g_bValidCursorPos = !(CRSR_POSCHG & nTmpSetCursor);
2877 }
2878
2879 // notify the edit window that from now on we do not use the input language
2880 if ( !(CRSR_POSOLD & nTmpSetCursor) )
2881 SetUseInputLanguage( false );
2882
2883 if( bLockView )
2884 rSh.LockView( false );
2885
2886 g_bNoInterrupt = bTmpNoInterrupt;
2887}
2888
2890{
2892 const SwField *pCursorField = rSh.CursorInsideInputField() ? rSh.GetCurField( true ) : nullptr;
2893
2894 // We have to check if a context menu is shown and we have an UI
2895 // active inplace client. In that case we have to ignore the mouse
2896 // button down event. Otherwise we would crash (context menu has been
2897 // opened by inplace client and we would deactivate the inplace client,
2898 // the context menu is closed by VCL asynchronously which in the end
2899 // would work on deleted objects or the context menu has no parent anymore)
2900 SfxInPlaceClient* pIPClient = rSh.GetSfxViewShell()->GetIPClient();
2901 bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
2902
2903 if (bIsOleActive && vcl::IsInPopupMenuExecute())
2904 return;
2905
2906 MouseEvent aMEvt(_rMEvt);
2907
2908 if (m_rView.GetPostItMgr()->IsHit(aMEvt.GetPosPixel()))
2909 return;
2910
2912 {
2914 {
2915 pWindow->MouseButtonDown(aMEvt);
2916 return;
2917 }
2918 }
2919
2921
2922 GrabFocus();
2923 rSh.addCurrentPosition();
2924
2925 //ignore key modifiers for format paintbrush
2926 {
2927 bool bExecFormatPaintbrush = m_pApplyTempl && m_pApplyTempl->m_pFormatClipboard
2928 && m_pApplyTempl->m_pFormatClipboard->HasContent();
2929 if( bExecFormatPaintbrush )
2930 aMEvt = MouseEvent(_rMEvt.GetPosPixel(), _rMEvt.GetClicks(), _rMEvt.GetMode(),
2931 _rMEvt.GetButtons());
2932 }
2933
2934 m_bWasShdwCursor = nullptr != m_pShadCursor;
2935 m_pShadCursor.reset();
2936
2937 const Point aDocPos(PixelToLogic(aMEvt.GetPosPixel()));
2938
2939 FrameControlType eControl;
2940 bool bOverFly = false;
2941 bool bPageAnchored = false;
2942 bool bOverHeaderFooterFly = IsOverHeaderFooterFly( aDocPos, eControl, bOverFly, bPageAnchored );
2943
2944 bool bIsDocReadOnly = m_rView.GetDocShell()->IsReadOnly();
2945 if (bOverHeaderFooterFly && (!bIsDocReadOnly && rSh.GetCurField()))
2946 // We have a field here, that should have priority over header/footer fly.
2947 bOverHeaderFooterFly = false;
2948
2949 // Are we clicking on a blank header/footer area?
2950 if ( IsInHeaderFooter( aDocPos, eControl ) || bOverHeaderFooterFly )
2951 {
2952 const SwPageFrame* pPageFrame = rSh.GetLayout()->GetPageAtPos( aDocPos );
2953
2954 if ( pPageFrame )
2955 {
2956 // Is it active?
2957 bool bActive = true;
2958 const SwPageDesc* pDesc = pPageFrame->GetPageDesc();
2959
2960 const SwFrameFormat* pFormat = pDesc->GetLeftFormat();
2961 if ( pPageFrame->OnRightPage() )
2962 pFormat = pDesc->GetRightFormat();
2963
2964 if ( pFormat )
2965 {
2966 if ( eControl == FrameControlType::Header )
2967 bActive = pFormat->GetHeader().IsActive();
2968 else
2969 bActive = pFormat->GetFooter().IsActive();
2970 }
2971
2972 if ( !bActive )
2973 {
2974 // HeaderFooter menu implies header/footer controls, so only do this with IsUseHeaderFooterMenu enabled.
2975 // But, additionally, when in Hide-Whitespace mode, we don't want those controls.
2977 {
2978 SwPaM aPam(*rSh.GetCurrentShellCursor().GetPoint());
2979 const bool bWasInHeader = aPam.GetPoint()->GetNode().FindHeaderStartNode() != nullptr;
2980 const bool bWasInFooter = aPam.GetPoint()->GetNode().FindFooterStartNode() != nullptr;
2981
2982 // Is the cursor in a part like similar to the one we clicked on? For example,
2983 // if the cursor is in a header and we click on an empty header... don't change anything to
2984 // keep consistent behaviour due to header edit mode (and the same for the footer as well).
2985
2986 // Otherwise, we hide the header/footer control if a separator is shown, and vice versa.
2987 if (!(bWasInHeader && eControl == FrameControlType::Header) &&
2988 !(bWasInFooter && eControl == FrameControlType::Footer))
2989 {
2990 const bool bSeparatorWasVisible = rSh.IsShowHeaderFooterSeparator(eControl);
2991 rSh.SetShowHeaderFooterSeparator(eControl, !bSeparatorWasVisible);
2992
2993 // Repaint everything
2994 Invalidate();
2995
2996 // tdf#84929. If the footer control had not been showing, do not change the cursor position,
2997 // because the user may have scrolled to turn on the separator control and
2998 // if the cursor cannot be positioned on-screen, then the user would need to scroll back again to use the control.
2999 // This should only be done for the footer. The cursor can always be re-positioned near the header. tdf#134023.
3000 if ( eControl == FrameControlType::Footer && !bSeparatorWasVisible
3002 return;
3003 }
3004 }
3005 }
3006 else
3007 {
3008 // Make sure we have the proper Header/Footer separators shown
3009 // as these may be changed if clicking on an empty Header/Footer
3012
3013 if ( !rSh.IsHeaderFooterEdit() )
3015 }
3016 }
3017 }
3018 else
3019 {
3020 if ( rSh.IsHeaderFooterEdit( ) )
3022 else
3023 {
3024 // Make sure that the separators are hidden
3027 }
3028
3029 // Toggle Hide-Whitespace if between pages.
3030 if (rSh.GetViewOptions()->CanHideWhitespace() &&
3031 rSh.GetLayout()->IsBetweenPages(aDocPos))
3032 {
3033 if (_rMEvt.GetClicks() >= 2)
3034 {
3035 SwViewOption aOpt(*rSh.GetViewOptions());
3037 rSh.ApplyViewOptions(aOpt);
3038 }
3039
3040 return;
3041 }
3042 }
3043
3044 if ( IsChainMode() )
3045 {
3046 SetChainMode( false );
3047 SwRect aDummy;
3048 SwFlyFrameFormat *pFormat = static_cast<SwFlyFrameFormat*>(rSh.GetFlyFrameFormat());
3049 if ( rSh.Chainable( aDummy, *pFormat, aDocPos ) == SwChainRet::OK )
3050 rSh.Chain( *pFormat, aDocPos );
3051 UpdatePointer(aDocPos, aMEvt.GetModifier());
3052 return;
3053 }
3054
3055 // After GrabFocus a shell should be pushed. That should actually
3056 // work but in practice ...
3058
3059 bool bCallBase = true;
3060
3062 s_pQuickHlpData->Stop( rSh );
3064
3065 if( rSh.FinishOLEObj() )
3066 return; // end InPlace and the click doesn't count anymore
3067
3068 CurrShell aCurr( &rSh );
3069
3070 SdrView *pSdrView = rSh.GetDrawView();
3071 if ( pSdrView )
3072 {
3073 if (pSdrView->MouseButtonDown(aMEvt, GetOutDev()))
3074 {
3076 return; // SdrView's event evaluated
3077 }
3078 }
3079
3080 m_bIsInMove = false;
3081 m_aStartPos = aMEvt.GetPosPixel();
3082 m_aRszMvHdlPt.setX( 0 );
3083 m_aRszMvHdlPt.setY( 0 );
3084
3085 SwTab nMouseTabCol = SwTab::COL_NONE;
3086 const bool bTmp = !rSh.IsDrawCreate() && !m_pApplyTempl && !rSh.IsInSelect()
3087 && aMEvt.GetClicks() == 1 && MOUSE_LEFT == aMEvt.GetButtons();
3088 if ( bTmp &&
3089 SwTab::COL_NONE != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPos ) ) &&
3090 !rSh.IsObjSelectable( aDocPos ) )
3091 {
3092 // Enhanced table selection
3093 if ( SwTab::SEL_HORI <= nMouseTabCol && SwTab::COLSEL_VERT >= nMouseTabCol )
3094 {
3095 rSh.EnterStdMode();
3096 rSh.SelectTableRowCol( aDocPos );
3097 if( SwTab::SEL_HORI != nMouseTabCol && SwTab::SEL_HORI_RTL != nMouseTabCol)
3098 {
3100 m_bIsRowDrag = SwTab::ROWSEL_HORI == nMouseTabCol||
3101 SwTab::ROWSEL_HORI_RTL == nMouseTabCol ||
3102 SwTab::COLSEL_VERT == nMouseTabCol;
3103 m_bMBPressed = true;
3104 CaptureMouse();
3105 }
3106 return;
3107 }
3108
3109 if ( !rSh.IsTableMode() )
3110 {
3111 // comes from table columns out of the document.
3112 if(SwTab::COL_VERT == nMouseTabCol || SwTab::COL_HORI == nMouseTabCol)
3113 m_rView.SetTabColFromDoc( true );
3114 else
3115 m_rView.SetTabRowFromDoc( true );
3116
3117 m_rView.SetTabColFromDocPos( aDocPos );
3120 rBind.Update();
3121 if (RulerColumnDrag(
3122 aMEvt, (SwTab::COL_VERT == nMouseTabCol || SwTab::ROW_HORI == nMouseTabCol)))
3123 {
3124 m_rView.SetTabColFromDoc( false );
3125 m_rView.SetTabRowFromDoc( false );
3127 rBind.Update();
3128 bCallBase = false;
3129 }
3130 else
3131 {
3132 return;
3133 }
3134 }
3135 }
3136 else if (bTmp &&
3137 rSh.IsNumLabel(aDocPos))
3138 {
3139 SwTextNode* pNodeAtPos = rSh.GetNumRuleNodeAtPos( aDocPos );
3140 m_rView.SetNumRuleNodeFromDoc( pNodeAtPos );
3143 rBind.Update();
3144
3145 if (RulerMarginDrag(aMEvt, SwFEShell::IsVerticalModeAtNdAndPos(*pNodeAtPos, aDocPos)))
3146 {
3147 m_rView.SetNumRuleNodeFromDoc( nullptr );
3149 rBind.Update();
3150 bCallBase = false;
3151 }
3152 else
3153 {
3154 // Make sure the pointer is set to 0, otherwise it may point to
3155 // nowhere after deleting the corresponding text node.
3156 m_rView.SetNumRuleNodeFromDoc( nullptr );
3157 return;
3158 }
3159 }
3160
3161 if ( rSh.IsInSelect() )
3162 rSh.EndSelect();
3163
3164 // query against LEFT because otherwise for example also a right
3165 // click releases the selection.
3166 if (MOUSE_LEFT == aMEvt.GetButtons())
3167 {
3168 bool bOnlyText = false;
3169 m_bMBPressed = true;
3170 g_bNoInterrupt = true;
3172
3173 CaptureMouse();
3174
3175 // reset cursor position if applicable
3176 rSh.ResetCursorStack();
3177
3178 switch (aMEvt.GetModifier() + aMEvt.GetButtons())
3179 {
3180 case MOUSE_LEFT:
3181 case MOUSE_LEFT + KEY_SHIFT:
3182 case MOUSE_LEFT + KEY_MOD2:
3183 if( rSh.IsObjSelected() )
3184 {
3185 SdrHdl* pHdl;
3186 if( !bIsDocReadOnly &&
3187 !m_pAnchorMarker &&
3188 pSdrView &&
3189 nullptr != ( pHdl = pSdrView->PickHandle(aDocPos) ) &&
3190 ( pHdl->GetKind() == SdrHdlKind::Anchor ||
3191 pHdl->GetKind() == SdrHdlKind::Anchor_TR ) )
3192 {
3193 // #i121463# Set selected during drag
3194 pHdl->SetSelected();
3195 m_pAnchorMarker.reset( new SwAnchorMarker( pHdl ) );
3196 UpdatePointer(aDocPos, aMEvt.GetModifier());
3197 return;
3198 }
3199 }
3200 if (EnterDrawMode(aMEvt, aDocPos))
3201 {
3202 g_bNoInterrupt = false;
3203 return;
3204 }
3205 else if ( m_rView.GetDrawFuncPtr() && m_bInsFrame )
3206 {
3207 StopInsFrame();
3208 rSh.Edit();
3209 }
3210
3211 // Without SHIFT because otherwise Toggle doesn't work at selection
3212 if (aMEvt.GetClicks() == 1)
3213 {
3214 if ( rSh.IsSelFrameMode())
3215 {
3216 SdrHdl* pHdl = rSh.GetDrawView()->PickHandle(aDocPos);
3217 bool bHitHandle = pHdl && pHdl->GetKind() != SdrHdlKind::Anchor &&
3218 pHdl->GetKind() != SdrHdlKind::Anchor_TR;
3219
3220 if ((rSh.IsInsideSelectedObj(aDocPos) || bHitHandle)
3221 && (aMEvt.GetModifier() != KEY_SHIFT || bHitHandle))
3222 {
3223 rSh.EnterSelFrameMode( &aDocPos );
3224 if ( !m_pApplyTempl )
3225 {
3226 // only if no position to size was hit.
3227 if (!bHitHandle)
3228 {
3229 StartDDTimer();
3230 SwEditWin::s_nDDStartPosY = aDocPos.Y();
3231 SwEditWin::s_nDDStartPosX = aDocPos.X();
3232 }
3233 g_bFrameDrag = true;
3234 }
3235 g_bNoInterrupt = false;
3236 return;
3237 }
3238 }
3239 }
3240 }
3241
3242 bool bExecHyperlinks = m_rView.GetDocShell()->IsReadOnly();
3243 if ( !bExecHyperlinks )
3244 {
3246 if ((bSecureOption && aMEvt.GetModifier() == KEY_MOD1)
3247 || (!bSecureOption && aMEvt.GetModifier() != KEY_MOD1))
3248 bExecHyperlinks = true;
3249 }
3250
3251 // Enhanced selection
3252 sal_uInt8 nNumberOfClicks = static_cast<sal_uInt8>(aMEvt.GetClicks() % 4);
3253 if (0 == nNumberOfClicks && 0 < aMEvt.GetClicks())
3254 nNumberOfClicks = 4;
3255
3256 bool bExecDrawTextLink = false;
3257
3258 switch (aMEvt.GetModifier() + aMEvt.GetButtons())
3259 {
3260 case MOUSE_LEFT:
3261 case MOUSE_LEFT + KEY_MOD1:
3262 case MOUSE_LEFT + KEY_MOD2:
3263 {
3264
3265 // fdo#79604: first, check if a link has been clicked - do not
3266 // select fly in this case!
3267 if (1 == nNumberOfClicks)
3268 {
3269 UpdatePointer(aDocPos, aMEvt.GetModifier());
3270 SwEditWin::s_nDDStartPosY = aDocPos.Y();
3271 SwEditWin::s_nDDStartPosX = aDocPos.X();
3272
3273 // hit a URL in DrawText object?
3274 if (bExecHyperlinks && pSdrView)
3275 {
3276 SdrViewEvent aVEvt;
3277 pSdrView->PickAnything(aMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
3278
3279 if (aVEvt.meEvent == SdrEventKind::ExecuteUrl)
3280 bExecDrawTextLink = true;
3281 }
3282 }
3283
3284 if (1 == nNumberOfClicks && !bExecDrawTextLink)
3285 {
3286 // only try to select frame, if pointer already was
3287 // switched accordingly
3288 if ( m_aActHitType != SdrHitKind::NONE && !rSh.IsSelFrameMode() &&
3289 !GetView().GetViewFrame().GetDispatcher()->IsLocked())
3290 {
3291 // Test if there is a draw object at that position and if it should be selected.
3292 bool bShould = rSh.ShouldObjectBeSelected(aDocPos);
3293
3294 if(bShould)
3295 {
3296 m_rView.NoRotate();
3297 rSh.HideCursor();
3298
3299 bool bUnLockView = !rSh.IsViewLocked();
3300 rSh.LockView( true );
3301 bool bSelObj
3302 = rSh.SelectObj(aDocPos, aMEvt.IsMod1() ? SW_ENTER_GROUP : 0);
3303 if( bUnLockView )
3304 rSh.LockView( false );
3305
3306 if( bSelObj )
3307 {
3308 // if the frame was deselected in the macro
3309 // the cursor just has to be displayed again
3311 rSh.ShowCursor();
3312 else
3313 {
3314 if (rSh.IsFrameSelected() && m_rView.GetDrawFuncPtr())
3315 {
3317 m_rView.SetDrawFuncPtr(nullptr);
3319 m_rView.AttrChangedNotify(nullptr);
3320 }
3321
3322 rSh.EnterSelFrameMode( &aDocPos );
3323 g_bFrameDrag = true;
3324 UpdatePointer(aDocPos, aMEvt.GetModifier());
3325 }
3326 return;
3327 }
3328 else
3329 bOnlyText = rSh.IsObjSelectable( aDocPos );
3330
3331 if (!m_rView.GetDrawFuncPtr())
3332 rSh.ShowCursor();
3333 }
3334 else
3335 bOnlyText = KEY_MOD1 != aMEvt.GetModifier();
3336 }
3337 else if ( rSh.IsSelFrameMode() &&
3338 (m_aActHitType == SdrHitKind::NONE ||
3339 !rSh.IsInsideSelectedObj( aDocPos )))
3340 {
3341 m_rView.NoRotate();
3342 SdrHdl *pHdl;
3343 if( !bIsDocReadOnly && !m_pAnchorMarker && nullptr !=
3344 ( pHdl = pSdrView->PickHandle(aDocPos) ) &&
3345 ( pHdl->GetKind() == SdrHdlKind::Anchor ||
3346 pHdl->GetKind() == SdrHdlKind::Anchor_TR ) )
3347 {
3348 m_pAnchorMarker.reset( new SwAnchorMarker( pHdl ) );
3349 UpdatePointer(aDocPos, aMEvt.GetModifier());
3350 return;
3351 }
3352 else
3353 {
3354 bool bUnLockView = !rSh.IsViewLocked();
3355 rSh.LockView( true );
3356 sal_uInt8 nFlag = aMEvt.IsShift() ? SW_ADD_SELECT : 0;
3357 if (aMEvt.IsMod1())
3358 nFlag = nFlag | SW_ENTER_GROUP;
3359
3360 if ( rSh.IsSelFrameMode() )
3361 {
3362 rSh.UnSelectFrame();
3363 rSh.LeaveSelFrameMode();
3364 m_rView.AttrChangedNotify(nullptr);
3365 }
3366
3367 bool bSelObj = rSh.SelectObj( aDocPos, nFlag );
3368 if( bUnLockView )
3369 rSh.LockView( false );
3370
3371 if( !bSelObj )
3372 {
3373 // move cursor here so that it is not drawn in the
3374 // frame first; ShowCursor() happens in LeaveSelFrameMode()
3375 g_bValidCursorPos = !(CRSR_POSCHG & rSh.CallSetCursor(&aDocPos, false));
3376 rSh.LeaveSelFrameMode();
3377 m_rView.AttrChangedNotify(nullptr);
3378 bCallBase = false;
3379 }
3380 else
3381 {
3382 rSh.HideCursor();
3383 rSh.EnterSelFrameMode( &aDocPos );
3384 rSh.SelFlyGrabCursor();
3385 rSh.MakeSelVisible();
3386 g_bFrameDrag = true;
3387 if( rSh.IsFrameSelected() &&
3389 {
3391 m_rView.SetDrawFuncPtr(nullptr);
3393 m_rView.AttrChangedNotify(nullptr);
3394 }
3395 UpdatePointer(aDocPos, aMEvt.GetModifier());
3396 return;
3397 }
3398 }
3399 }
3400 }
3401
3402 switch ( nNumberOfClicks )
3403 {
3404 case 1:
3405 break;
3406 case 2:
3407 {
3408 g_bFrameDrag = false;
3409 if (!bIsDocReadOnly && rSh.IsInsideSelectedObj(aDocPos)
3414 {
3415 /* This is no good: on the one hand GetSelectionType is used as flag field
3416 * (take a look into the GetSelectionType method) and on the other hand the
3417 * return value is used in a switch without proper masking (very nice), this must lead to trouble
3418 */
3420 {
3424 {
3426 FN_FORMAT_GRAFIC_DLG, nullptr,
3427 SfxCallMode::RECORD|SfxCallMode::SLOT);
3428 }
3429 return;
3430
3431 // double click on OLE object --> OLE-InPlace
3432 case SelectionType::Ole:
3434 rSh.LaunchOLEObj();
3435 return;
3436
3440 {
3442 FN_FORMAT_FRAME_DLG, nullptr,
3443 SfxCallMode::RECORD|SfxCallMode::SLOT);
3444 }
3445 return;
3446
3449 EnterDrawTextMode(aDocPos);
3450 if ( auto pSwDrawTextShell = dynamic_cast< SwDrawTextShell *>( m_rView.GetCurShell() ) )
3451 pSwDrawTextShell->Init();
3452 return;
3453
3454 default: break;
3455 }
3456 }
3457
3458 // if the cursor position was corrected or if a Fly
3459 // was selected in ReadOnlyMode, no word selection, except when tiled rendering.
3461 return;
3462
3463 SwField *pField;
3464 bool bFootnote = false;
3465
3466 if( !bIsDocReadOnly &&
3467 (nullptr != (pField = rSh.GetCurField(true)) ||
3468 ( bFootnote = rSh.GetCurFootnote() ) ) )
3469 {
3471 if( bFootnote )
3473 else
3474 {
3475 SwFieldTypesEnum nTypeId = pField->GetTypeId();
3476 SfxViewFrame& rVFrame = GetView().GetViewFrame();
3477 switch( nTypeId )
3478 {
3481 {
3482 // if it's a Readonly region, status has to be enabled
3483 sal_uInt16 nSlot = SwFieldTypesEnum::Postit == nTypeId ? FN_POSTIT : FN_JAVAEDIT;
3484 SfxBoolItem aItem(nSlot, true);
3485 rVFrame.GetBindings().SetState(aItem);
3486 rVFrame.GetBindings().Execute(nSlot);
3487 break;
3488 }
3491 break;
3496 break;
3497 default:
3499 }
3500 }
3501 return;
3502 }
3503 // in extended mode double and triple
3504 // click has no effect.
3505 if ( rSh.IsExtMode() || rSh.IsBlockMode() )
3506 return;
3507
3508 // select word, AdditionalMode if applicable
3509 if (KEY_MOD1 == aMEvt.GetModifier() && !rSh.IsAddMode())
3510 {
3511 rSh.EnterAddMode();
3512 rSh.SelWrd( &aDocPos );
3513 rSh.LeaveAddMode();
3514 }
3515 else
3516 {
3517 if (!rSh.SelWrd(&aDocPos) && comphelper::LibreOfficeKit::isActive())
3518 // Double click did not select any word: try to
3519 // select the current cell in case we are in a
3520 // table.
3521 rSh.SelTableBox();
3522 }
3523
3525 if( rSh.GetContentAtPos( aDocPos, aContentAtPos ) &&
3526 aContentAtPos.aFnd.pFieldmark != nullptr)
3527 {
3528 IFieldmark *pFieldBM = const_cast< IFieldmark* > ( aContentAtPos.aFnd.pFieldmark );
3529 if ( pFieldBM->GetFieldname( ) == ODF_FORMDROPDOWN || pFieldBM->GetFieldname( ) == ODF_FORMDATE )
3530 {
3533 GetView().GetViewFrame().GetBindings().Execute(SID_FM_CTL_PROPERTIES);
3534 return;
3535 }
3536 }
3537
3538 // tdf#143158 - handle alphabetical index entries
3539 SwContentAtPos aToxContentAtPos(IsAttrAtPos::ToxMark);
3540 if (rSh.GetContentAtPos(aDocPos, aToxContentAtPos))
3541 {
3542 const OUString sToxText = aToxContentAtPos.sStr;
3543 if (!sToxText.isEmpty() && aToxContentAtPos.pFndTextAttr)
3544 {
3545 const SwTOXType* pTType
3546 = aToxContentAtPos.pFndTextAttr->GetTOXMark().GetTOXType();
3547 if (pTType && pTType->GetType() == TOXTypes::TOX_INDEX)
3548 {
3552 return;
3553 }
3554 }
3555 }
3556
3557 g_bHoldSelection = true;
3558 return;
3559 }
3560 case 3:
3561 case 4:
3562 {
3563 g_bFrameDrag = false;
3564 // in extended mode double and triple
3565 // click has no effect.
3566 if ( rSh.IsExtMode() )
3567 return;
3568
3569 // if the cursor position was corrected or if a Fly
3570 // was selected in ReadOnlyMode, no word selection.
3571 if ( !g_bValidCursorPos || rSh.IsFrameSelected() )
3572 return;
3573
3574 // select line, AdditionalMode if applicable
3575 const bool bMod = KEY_MOD1 == aMEvt.GetModifier() && !rSh.IsAddMode();
3576
3577 if ( bMod )
3578 rSh.EnterAddMode();
3579
3580 // Enhanced selection
3581 if ( 3 == nNumberOfClicks )
3582 rSh.SelSentence( &aDocPos );
3583 else
3584 rSh.SelPara( &aDocPos );
3585
3586 if ( bMod )
3587 rSh.LeaveAddMode();
3588
3589 g_bHoldSelection = true;
3590 return;
3591 }
3592
3593 default:
3594 return;
3595 }
3596
3597 [[fallthrough]];
3598 }
3599 case MOUSE_LEFT + KEY_SHIFT:
3600 case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1:
3601 {
3602 bool bLockView = m_bWasShdwCursor;
3603
3604 switch (aMEvt.GetModifier())
3605 {
3606 case KEY_MOD1 + KEY_SHIFT:
3607 {
3608 if ( !m_bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) )
3609 {
3610 m_rView.NoRotate();
3611 rSh.HideCursor();
3612 if ( rSh.IsSelFrameMode() )
3613 rSh.SelectObj(aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP);
3614 else
3615 { if ( rSh.SelectObj( aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP ) )
3616 {
3617 rSh.EnterSelFrameMode( &aDocPos );
3618 SwEditWin::s_nDDStartPosY = aDocPos.Y();
3619 SwEditWin::s_nDDStartPosX = aDocPos.X();
3620 g_bFrameDrag = true;
3621 return;
3622 }
3623 }
3624 }
3625 else if( rSh.IsSelFrameMode() &&
3626 rSh.GetDrawView()->PickHandle( aDocPos ))
3627 {
3628 g_bFrameDrag = true;
3629 g_bNoInterrupt = false;
3630 return;
3631 }
3632 }
3633 break;
3634 case KEY_MOD1:
3635 if ( !bExecDrawTextLink )
3636 {
3638 {
3639 // ctrl+left-click on outline node frame
3640 SwContentAtPos aContentAtPos(IsAttrAtPos::Outline);
3641 if(rSh.GetContentAtPos(aDocPos, aContentAtPos))
3642 {
3644 if (rSh.GetNodes().GetOutLineNds().Seek_Entry(aContentAtPos.aFnd.pNode, &nPos))
3645 {
3647 return;
3648 }
3649 }
3650 }
3651 if ( !m_bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) && !lcl_urlOverBackground( rSh, aDocPos ) )
3652 {
3653 m_rView.NoRotate();
3654 rSh.HideCursor();
3655 if ( rSh.IsSelFrameMode() )
3656 rSh.SelectObj(aDocPos, SW_ENTER_GROUP);
3657 else
3658 { if ( rSh.SelectObj( aDocPos, SW_ENTER_GROUP ) )
3659 {
3660 rSh.EnterSelFrameMode( &aDocPos );
3661 SwEditWin::s_nDDStartPosY = aDocPos.Y();
3662 SwEditWin::s_nDDStartPosX = aDocPos.X();
3663 g_bFrameDrag = true;
3664 return;
3665 }
3666 }
3667 }
3668 else if( rSh.IsSelFrameMode() &&
3669 rSh.GetDrawView()->PickHandle( aDocPos ))
3670 {
3671 g_bFrameDrag = true;
3672 g_bNoInterrupt = false;
3673 return;
3674 }
3675 else
3676 {
3677 if ( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() )
3678 {
3679 rSh.PushMode();
3680 g_bModePushed = true;
3681
3682 bool bUnLockView = !rSh.IsViewLocked();
3683 rSh.LockView( true );
3684 rSh.EnterAddMode();
3685 if( bUnLockView )
3686 rSh.LockView( false );
3687 }
3688 bCallBase = false;
3689 }
3690 }
3691 break;
3692 case KEY_MOD2:
3693 {
3694 if ( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() )
3695 {
3696 rSh.PushMode();
3697 g_bModePushed = true;
3698 bool bUnLockView = !rSh.IsViewLocked();
3699 rSh.LockView( true );
3700 rSh.EnterBlockMode();
3701 if( bUnLockView )
3702 rSh.LockView( false );
3703 }
3704 bCallBase = false;
3705 }
3706 break;
3707 case KEY_SHIFT:
3708 {
3709 if (nNumberOfClicks == 2)
3710 {
3711 // Left mouse button, shift, double-click: see if we have a graphic and
3712 // dispatch its dialog in this case.
3714 {
3716 FN_FORMAT_GRAFIC_DLG, nullptr,
3717 SfxCallMode::RECORD | SfxCallMode::SLOT);
3718 return;
3719 }
3720 }
3721
3722 if ( !m_bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) )
3723 {
3724 m_rView.NoRotate();
3725 rSh.HideCursor();
3726 if ( rSh.IsSelFrameMode() )
3727 {
3728 rSh.SelectObj(aDocPos, SW_ADD_SELECT);
3729
3730 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
3731 if (rMarkList.GetMark(0) == nullptr)
3732 {
3733 rSh.LeaveSelFrameMode();
3734 m_rView.AttrChangedNotify(nullptr);
3735 g_bFrameDrag = false;
3736 }
3737 }
3738 else
3739 { if ( rSh.SelectObj( aDocPos ) )
3740 {
3741 rSh.EnterSelFrameMode( &aDocPos );
3742 SwEditWin::s_nDDStartPosY = aDocPos.Y();
3743 SwEditWin::s_nDDStartPosX = aDocPos.X();
3744 g_bFrameDrag = true;
3745 return;
3746 }
3747 }
3748 }
3749 else
3750 {
3751 bool bShould = rSh.ShouldObjectBeSelected(aDocPos);
3752 if (bShould)
3753 {
3754 // Left mouse button, shift, non-double-click, not a draw object and
3755 // have an object to select: select it.
3756 rSh.HideCursor();
3757 bool bSelObj = rSh.SelectObj(aDocPos);
3758 if (bSelObj)
3759 {
3760 rSh.EnterSelFrameMode(&aDocPos);
3761 }
3762 return;
3763 }
3764
3765 if ( rSh.IsSelFrameMode() &&
3766 rSh.IsInsideSelectedObj( aDocPos ) )
3767 {
3768 rSh.EnterSelFrameMode( &aDocPos );
3769 SwEditWin::s_nDDStartPosY = aDocPos.Y();
3770 SwEditWin::s_nDDStartPosX = aDocPos.X();
3771 g_bFrameDrag = true;
3772 return;
3773 }
3774 if ( rSh.IsSelFrameMode() )
3775 {
3776 rSh.UnSelectFrame();
3777 rSh.LeaveSelFrameMode();
3778 m_rView.AttrChangedNotify(nullptr);
3779 g_bFrameDrag = false;
3780 }
3781 if ( !rSh.IsExtMode() )
3782 {
3783 // don't start a selection when an
3784 // URL field or a graphic is clicked
3785 bool bSttSelect = rSh.HasSelection() ||
3786 PointerStyle::RefHand != GetPointer();
3787
3788 if( !bSttSelect )
3789 {
3790 bSttSelect = true;
3791 if( bExecHyperlinks )
3792 {
3793 SwContentAtPos aContentAtPos(
3796
3797 if( rSh.GetContentAtPos( aDocPos, aContentAtPos ) )
3798 {
3799 if( !rSh.IsViewLocked() &&
3800 !rSh.IsReadOnlyAvailable() &&
3801 aContentAtPos.IsInProtectSect() )
3802 bLockView = true;
3803
3804 bSttSelect = false;
3805 }
3806 else if( rSh.IsURLGrfAtPos( aDocPos ))
3807 bSttSelect = false;
3808 }
3809 }
3810
3811 if( bSttSelect )
3812 rSh.SttSelect();
3813 }
3814 }
3815 bCallBase = false;
3816 break;
3817 }
3818 default:
3819 if( !rSh.IsViewLocked() )
3820 {
3823 if( rSh.GetContentAtPos( aDocPos, aContentAtPos ) &&
3824 !rSh.IsReadOnlyAvailable() &&
3825 aContentAtPos.IsInProtectSect() )
3826 bLockView = true;
3827 }
3828 }
3829
3830 if ( rSh.IsGCAttr() )
3831 {
3832 rSh.GCAttr();
3833 rSh.ClearGCAttr();
3834 }
3835
3837 bool bEditableFieldClicked = false;
3838
3839 // Are we clicking on a field?
3840 if (rSh.GetContentAtPos(aDocPos, aFieldAtPos))
3841 {
3842 bool bEditableField = (aFieldAtPos.pFndTextAttr != nullptr
3843 && aFieldAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD);
3844
3845 if (!bEditableField)
3846 {
3847 rSh.CallSetCursor(&aDocPos, bOnlyText);
3848 // Unfortunately the cursor may be on field
3849 // position or on position after field depending on which
3850 // half of the field was clicked on.
3851 SwTextAttr const*const pTextField(aFieldAtPos.pFndTextAttr);
3852 if (pTextField &&
3853 rSh.GetCurrentShellCursor().GetPoint()->GetContentIndex() != pTextField->GetStart())
3854 {
3855 assert(rSh.GetCurrentShellCursor().GetPoint()->GetContentIndex() == (pTextField->GetStart() + 1));
3856 rSh.Left( SwCursorSkipMode::Chars, false, 1, false );
3857 }
3858 // don't go into the !bOverSelect block below - it moves
3859 // the cursor
3860 break;
3861 }
3862 else
3863 {
3864 bEditableFieldClicked = true;
3865 }
3866 }
3867
3868 bool bOverSelect = rSh.TestCurrPam( aDocPos );
3869 bool bOverURLGrf = false;
3870 if( !bOverSelect )
3871 bOverURLGrf = bOverSelect = nullptr != rSh.IsURLGrfAtPos( aDocPos );
3872
3873 if ( !bOverSelect || rSh.IsInSelect() )
3874 {
3875 MoveCursor( rSh, aDocPos, bOnlyText, bLockView );
3876 bCallBase = false;
3877 }
3878 if (!bOverURLGrf && !bExecDrawTextLink && !bOnlyText)
3879 {
3880 const SelectionType nSelType = rSh.GetSelectionType();
3881 // Check in general, if an object is selectable at given position.
3882 // Thus, also text fly frames in background become selectable via Ctrl-Click.
3883 if ( ( nSelType & SelectionType::Ole ||
3884 nSelType & SelectionType::Graphic ||
3885 rSh.IsObjSelectable( aDocPos ) ) && !lcl_urlOverBackground( rSh, aDocPos ) )
3886 {
3887 SwMvContext aMvContext( &rSh );
3888 rSh.EnterSelFrameMode();
3889 bCallBase = false;
3890 }
3891 }
3892 if ( !bOverSelect && bEditableFieldClicked && (!pCursorField ||
3893 pCursorField != aFieldAtPos.pFndTextAttr->GetFormatField().GetField()))
3894 {
3895 // select content of Input Field, but exclude CH_TXT_ATR_INPUTFIELDSTART
3896 // and CH_TXT_ATR_INPUTFIELDEND
3897 rSh.SttSelect();
3898 rSh.SelectTextModel( aFieldAtPos.pFndTextAttr->GetStart() + 1,
3899 *(aFieldAtPos.pFndTextAttr->End()) - 1 );
3900 }
3901 // don't reset here any longer so that, in case through MouseMove
3902 // with pressed Ctrl key a multiple-selection should happen,
3903 // the previous selection is not released in Drag.
3904 break;
3905 }
3906 }
3907 }
3908 else if (MOUSE_RIGHT == aMEvt.GetButtons())
3909 {
3911 && aMEvt.GetModifier() == KEY_MOD1)
3912 {
3913 // ctrl+right-click on outline node frame
3914 SwContentAtPos aContentAtPos(IsAttrAtPos::Outline);
3915 if(rSh.GetContentAtPos(aDocPos, aContentAtPos))
3916 {
3918 if (rSh.GetNodes().GetOutLineNds().Seek_Entry(aContentAtPos.aFnd.pNode, &nPos))
3919 {
3921 return;
3922 }
3923 }
3924 }
3925 else if (!aMEvt.GetModifier() && static_cast<sal_uInt8>(aMEvt.GetClicks() % 4) == 1
3926 && !rSh.TestCurrPam(aDocPos))
3927 {
3929
3930 // Are we clicking on a field?
3932 && rSh.GetContentAtPos(aDocPos, aFieldAtPos)
3933 && aFieldAtPos.pFndTextAttr != nullptr
3934 && aFieldAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD
3935 && (!pCursorField || pCursorField != aFieldAtPos.pFndTextAttr->GetFormatField().GetField()))
3936 {
3937 // Move the cursor
3938 MoveCursor( rSh, aDocPos, rSh.IsObjSelectable( aDocPos ), m_bWasShdwCursor );
3939 bCallBase = false;
3940
3941 // select content of Input Field, but exclude CH_TXT_ATR_INPUTFIELDSTART
3942 // and CH_TXT_ATR_INPUTFIELDEND
3943 rSh.SttSelect();
3944 rSh.SelectTextModel( aFieldAtPos.pFndTextAttr->GetStart() + 1,
3945 *(aFieldAtPos.pFndTextAttr->End()) - 1 );
3946 }
3947 }
3948 }
3949
3950 if (bCallBase)
3951 Window::MouseButtonDown(aMEvt);
3952}
3953
3955{
3956 SwWrtShell & rShell = m_rView.GetWrtShell();
3957
3958 SwTab nMouseTabCol;
3959 if ( SwTab::COL_NONE != (nMouseTabCol = rShell.WhichMouseTabCol( rDocPoint ) ) &&
3960 !rShell.IsObjSelectable( rDocPoint ) )
3961 {
3962 PointerStyle nPointer = PointerStyle::Null;
3963 bool bChkTableSel = false;
3964
3965 switch ( nMouseTabCol )
3966 {
3967 case SwTab::COL_VERT :
3968 case SwTab::ROW_HORI :
3969 nPointer = PointerStyle::VSizeBar;
3970 bChkTableSel = true;
3971 break;
3972 case SwTab::ROW_VERT :
3973 case SwTab::COL_HORI :
3974 nPointer = PointerStyle::HSizeBar;
3975 bChkTableSel = true;
3976 break;
3977 // Enhanced table selection
3978 case SwTab::SEL_HORI :
3979 nPointer = PointerStyle::TabSelectSE;
3980 break;
3981 case SwTab::SEL_HORI_RTL :
3982 case SwTab::SEL_VERT :
3983 nPointer = PointerStyle::TabSelectSW;
3984 break;
3985 case SwTab::COLSEL_HORI :
3986 case SwTab::ROWSEL_VERT :
3987 nPointer = PointerStyle::TabSelectS;
3988 break;
3989 case SwTab::ROWSEL_HORI :
3990 nPointer = PointerStyle::TabSelectE;
3991 break;
3993 case SwTab::COLSEL_VERT :
3994 nPointer = PointerStyle::TabSelectW;
3995 break;
3996 default: break; // prevent compiler warning
3997 }
3998
3999 if ( PointerStyle::Null != nPointer &&
4000 // i#35543 - Enhanced table selection is explicitly allowed in table mode
4001 ( !bChkTableSel || !rShell.IsTableMode() ) &&
4003 {
4004 SetPointer( nPointer );
4005 }
4006
4007 return true;
4008 }
4009 else if (rShell.IsNumLabel(rDocPoint, RULER_MOUSE_MARGINWIDTH))
4010 {
4011 // i#42921 - consider vertical mode
4012 SwTextNode* pNodeAtPos = rShell.GetNumRuleNodeAtPos( rDocPoint );
4013 const PointerStyle nPointer =
4014 SwFEShell::IsVerticalModeAtNdAndPos( *pNodeAtPos, rDocPoint )
4015 ? PointerStyle::VSizeBar
4016 : PointerStyle::HSizeBar;
4017 SetPointer( nPointer );
4018
4019 return true;
4020 }
4021 return false;
4022}
4023
4025{
4026 MouseEvent rMEvt(_rMEvt);
4027
4029 {
4031 {
4032 pWindow->MouseMove(rMEvt);
4033 return;
4034 }
4035 }
4036
4037 //ignore key modifiers for format paintbrush
4038 {
4039 bool bExecFormatPaintbrush = m_pApplyTempl && m_pApplyTempl->m_pFormatClipboard
4040 && m_pApplyTempl->m_pFormatClipboard->HasContent();
4041 if( bExecFormatPaintbrush )
4042 rMEvt = MouseEvent( _rMEvt.GetPosPixel(), _rMEvt.GetClicks(),
4043 _rMEvt.GetMode(), _rMEvt.GetButtons() );
4044 }
4045
4046 // as long as an action is running the MouseMove should be disconnected
4047 // otherwise bug 40102 occurs
4049 if( rSh.ActionPend() )
4050 return ;
4051
4053 {
4054 // add/remove outline content hide button
4055 const SwNodes& rNds = rSh.GetDoc()->GetNodes();
4057 SwContentAtPos aSwContentAtPos(IsAttrAtPos::Outline);
4058 if (rSh.GetContentAtPos(PixelToLogic(rMEvt.GetPosPixel()), aSwContentAtPos))
4059 {
4060 // mouse pointer is on an outline paragraph node
4061 if(aSwContentAtPos.aFnd.pNode && aSwContentAtPos.aFnd.pNode->IsTextNode())
4062 {
4063 // Get the outline paragraph frame and compare it to the saved outline frame. If they
4064 // are not the same, remove the fold button from the saved outline frame, if not
4065 // already removed, and then add a fold button to the mouse over outline frame if
4066 // the content is not folded.
4067 SwContentFrame* pContentFrame =
4068 aSwContentAtPos.aFnd.pNode->GetTextNode()->getLayoutFrame(rSh.GetLayout());
4069 if (pContentFrame != m_pSavedOutlineFrame)
4070 {
4072 {
4074 {
4076 if (pTextNode && rNds.GetOutLineNds().Seek_Entry(pTextNode, &nPos) &&
4078 {
4081 }
4082 }
4083 }
4084 m_pSavedOutlineFrame = static_cast<SwTextFrame*>(pContentFrame);
4085 }
4086 // show fold button if outline content is visible
4087 if (rNds.GetOutLineNds().Seek_Entry(aSwContentAtPos.aFnd.pNode->GetTextNode(), &nPos) &&
4090 }
4091 }
4092 else if (m_pSavedOutlineFrame)
4093 {
4094 // The saved frame may not still be in the document, e.g., when an outline paragraph
4095 // is deleted. This causes the call to GetTextNodeFirst to behave badly. Use
4096 // isFrameAreaDefinitionValid to check if the frame is still in the document.
4098 {
4099 // current pointer pos is not over an outline frame
4100 // previous pointer pos was over an outline frame
4101 // remove outline content visibility button if showing
4103 if (pTextNode && rNds.GetOutLineNds().Seek_Entry(pTextNode, &nPos) &&
4105 {
4108 }
4109 }
4110 m_pSavedOutlineFrame = nullptr;
4111 }
4112 }
4113
4114 if( m_pShadCursor && 0 != (rMEvt.GetModifier() + rMEvt.GetButtons() ) )
4115 {
4116 m_pShadCursor.reset();
4117 }
4118
4119 bool bIsDocReadOnly = m_rView.GetDocShell()->IsReadOnly();
4120
4121 CurrShell aCurr( &rSh );
4122
4123 //aPixPt == Point in Pixel, relative to ChildWin
4124 //aDocPt == Point in Twips, document coordinates
4125 const Point aPixPt( rMEvt.GetPosPixel() );
4126 const Point aDocPt( PixelToLogic( aPixPt ) );
4127
4128 if ( IsChainMode() )
4129 {
4130 UpdatePointer( aDocPt, rMEvt.GetModifier() );
4131 return;
4132 }
4133
4134 SdrView *pSdrView = rSh.GetDrawView();
4135
4136 const SwCallMouseEvent aLastCallEvent( m_aSaveCallEvent );
4138
4139 if ( !bIsDocReadOnly && pSdrView && pSdrView->MouseMove(rMEvt,GetOutDev()) )
4140 {
4141 SetPointer( PointerStyle::Text );
4142 return; // evaluate SdrView's event
4143 }
4144
4145 const Point aOldPt( rSh.VisArea().Pos() );
4146 const bool bInsWin = rSh.VisArea().Contains( aDocPt ) || comphelper::LibreOfficeKit::isActive();
4147
4149 {
4150 if (m_pSavedOutlineFrame && !bInsWin)
4151 {
4152 // the mouse pointer has left the building (edit window)
4153 // remove the outline content visibility button if showing
4155 {
4156 const SwNodes& rNds = rSh.GetDoc()->GetNodes();
4159 if (pTextNode && rNds.GetOutLineNds().Seek_Entry(pTextNode, &nPos) &&
4161 {
4164 }
4165 }
4166 m_pSavedOutlineFrame = nullptr;
4167 }
4168 }
4169
4170 if( m_pShadCursor && !bInsWin )
4171 {
4172 m_pShadCursor.reset();
4173 }
4174
4175 if( bInsWin && m_xRowColumnSelectionStart )
4176 {
4177 EnterArea();
4178 Point aPos( aDocPt );
4180 return;
4181 }
4182
4183 // position is necessary for OS/2 because obviously after a MB-Down
4184 // a MB-Move is called immediately.
4185 if( g_bDDTimerStarted )
4186 {
4188 aDD = LogicToPixel( aDD );
4189 tools::Rectangle aRect( aDD.X()-3, aDD.Y()-3, aDD.X()+3, aDD.Y()+3 );
4190 if ( !aRect.Contains( aPixPt ) )
4191 StopDDTimer( &rSh, aDocPt );
4192 }
4193
4195 {
4196 if( m_bInsDraw )
4197 {
4198 m_rView.GetDrawFuncPtr()->MouseMove( rMEvt );
4199 if ( !bInsWin )
4200 {
4201 Point aTmp( aDocPt );
4202 aTmp += rSh.VisArea().Pos() - aOldPt;
4203 LeaveArea( aTmp );
4204 }
4205 else
4206 EnterArea();
4207 return;
4208 }
4209 else if(!rSh.IsFrameSelected() && !rSh.IsObjSelected())
4210 {
4211 SfxBindings &rBnd = rSh.GetView().GetViewFrame().GetBindings();
4212 Point aRelPos = rSh.GetRelativePagePosition(aDocPt);
4213 if(aRelPos.X() >= 0)
4214 {
4215 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &GetView()) != nullptr );
4216 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
4217 const SfxPointItem aTmp1( SID_ATTR_POSITION, aRelPos );
4218 rBnd.SetState( aTmp1 );
4219 }
4220 else
4221 {
4222 rBnd.Invalidate(SID_ATTR_POSITION);
4223 }
4224 rBnd.Invalidate(SID_ATTR_SIZE);
4225 const SvxStatusItem aCell( SID_TABLE_CELL, OUString(), StatusCategory::NONE );
4226 rBnd.SetState( aCell );
4227 }
4228 }
4229
4230 // determine if we only change the mouse pointer and return
4231 if (!bIsDocReadOnly && bInsWin && !m_pApplyTempl && !rSh.IsInSelect() && changeMousePointer(aDocPt))
4232 {
4233 return;
4234 }
4235
4236 bool bDelShadCursor = true;
4237
4238 switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
4239 {
4240 case MOUSE_LEFT:
4241 if( m_pAnchorMarker )
4242 {
4243 // Now we need to refresh the SdrHdl pointer of m_pAnchorMarker.
4244 // This looks a little bit tricky, but it solves the following
4245 // problem: the m_pAnchorMarker contains a pointer to an SdrHdl,
4246 // if the FindAnchorPos-call cause a scrolling of the visible
4247 // area, it's possible that the SdrHdl will be destroyed and a
4248 // new one will initialized at the original position(GetHdlPos).
4249 // So the m_pAnchorMarker has to find the right SdrHdl, if it's
4250 // the old one, it will find it with position aOld, if this one
4251 // is destroyed, it will find a new one at position GetHdlPos().
4252
4253 const Point aOld = m_pAnchorMarker->GetPosForHitTest( *(rSh.GetOut()) );
4254 Point aNew = rSh.FindAnchorPos( aDocPt );
4255 SdrHdl* pHdl;
4256 if( pSdrView && (nullptr!=( pHdl = pSdrView->PickHandle( aOld ) )||
4257 nullptr !=(pHdl = pSdrView->PickHandle( m_pAnchorMarker->GetHdlPos()) ) ) &&
4258 ( pHdl->GetKind() == SdrHdlKind::Anchor ||
4259 pHdl->GetKind() == SdrHdlKind::Anchor_TR ) )
4260 {
4261 m_pAnchorMarker->ChgHdl( pHdl );
4262 if( aNew.X() || aNew.Y() )
4263 {
4264 m_pAnchorMarker->SetPos( aNew );
4265 m_pAnchorMarker->SetLastPos( aDocPt );
4266 }
4267 }
4268 else
4269 {
4270 m_pAnchorMarker.reset();
4271 }
4272 }
4273 if ( m_bInsDraw )
4274 {
4275 if ( !m_bMBPressed )
4276 break;
4277 if ( m_bIsInMove || IsMinMove( m_aStartPos, aPixPt ) )
4278 {
4279 if ( !bInsWin )
4280 LeaveArea( aDocPt );
4281 else
4282 EnterArea();
4283 if ( m_rView.GetDrawFuncPtr() )
4284 {
4285 pSdrView->SetOrtho(false);
4286 m_rView.GetDrawFuncPtr()->MouseMove( rMEvt );
4287 }
4288 m_bIsInMove = true;
4289 }
4290 return;
4291 }
4292
4293 {
4294 SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetView().GetViewFrame().GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
4295 if (pWrdCnt)
4296 pWrdCnt->UpdateCounts();
4297 }
4298 [[fallthrough]];
4299
4300 case MOUSE_LEFT + KEY_SHIFT:
4301 case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1:
4302 if ( !m_bMBPressed )
4303 break;
4304 [[fallthrough]];
4305 case MOUSE_LEFT + KEY_MOD1:
4306 if ( g_bFrameDrag && rSh.IsSelFrameMode() )
4307 {
4308 if( !m_bMBPressed )
4309 break;
4310
4311 if ( m_bIsInMove || IsMinMove( m_aStartPos, aPixPt ) )
4312 {
4313 // event processing for resizing
4314 if (pSdrView && pSdrView->AreObjectsMarked())
4315 {
4316 const Point aSttPt( PixelToLogic( m_aStartPos ) );
4317
4318 // can we start?
4319 if( SdrHdlKind::User == g_eSdrMoveHdl )
4320 {
4321 SdrHdl* pHdl = pSdrView->PickHandle( aSttPt );
4322 g_eSdrMoveHdl = pHdl ? pHdl->GetKind() : SdrHdlKind::Move;
4323 }
4324
4325 const SwFrameFormat *const pFlyFormat(rSh.GetFlyFrameFormat());
4326 const SvxMacro* pMacro = nullptr;
4327
4328 SvMacroItemId nEvent = SdrHdlKind::Move == g_eSdrMoveHdl
4329 ? SvMacroItemId::SwFrmMove
4330 : SvMacroItemId::SwFrmResize;
4331
4332 if (nullptr != pFlyFormat)
4333 pMacro = pFlyFormat->GetMacro().GetMacroTable().Get(nEvent);
4334 if (nullptr != pMacro &&
4335 // or notify only e.g. every 20 Twip?
4336 m_aRszMvHdlPt != aDocPt )
4337 {
4338 m_aRszMvHdlPt = aDocPt;
4339 sal_uInt32 nPos = 0;
4340 SbxArrayRef xArgs = new SbxArray;
4341 SbxVariableRef xVar = new SbxVariable;
4342 xVar->PutString( pFlyFormat->GetName() );
4343 xArgs->Put(xVar.get(), ++nPos);
4344
4345 if( SvMacroItemId::SwFrmResize == nEvent )
4346 {
4347 xVar = new SbxVariable;
4348 xVar->PutUShort( static_cast< sal_uInt16 >(g_eSdrMoveHdl) );
4349 xArgs->Put(xVar.get(), ++nPos);
4350 }
4351
4352 xVar = new SbxVariable;
4353 xVar->PutLong( aDocPt.X() - aSttPt.X() );
4354 xArgs->Put(xVar.get(), ++nPos);
4355 xVar = new SbxVariable;
4356 xVar->PutLong( aDocPt.Y() - aSttPt.Y() );
4357 xArgs->Put(xVar.get(), ++nPos);
4358
4359 OUString sRet;
4360
4361 ReleaseMouse();
4362
4363 rSh.ExecMacro( *pMacro, &sRet, xArgs.get() );
4364
4365 CaptureMouse();
4366
4367 if( !sRet.isEmpty() && sRet.toInt32()!=0 )
4368 return ;
4369 }
4370 }
4371 // event processing for resizing
4372
4373 if( bIsDocReadOnly )
4374 break;
4375
4376 bool bResizeKeepRatio = rSh.GetSelectionType() & SelectionType::Graphic ||
4379 bool bisResize = g_eSdrMoveHdl != SdrHdlKind::Move;
4380
4381 if (pSdrView)
4382 {
4383 // Resize proportionally when media is selected and the user drags on a corner
4384 const Point aSttPt(PixelToLogic(m_aStartPos));
4385 SdrHdl* pHdl = pSdrView->PickHandle(aSttPt);
4386 if (pHdl)
4387 bResizeKeepRatio = bResizeKeepRatio && pHdl->IsCornerHdl();
4388
4389 if (pSdrView->GetDragMode() == SdrDragMode::Crop)
4390 bisResize = false;
4391 if (rMEvt.IsShift())
4392 {
4393 pSdrView->SetAngleSnapEnabled(!bResizeKeepRatio);
4394 if (bisResize)
4395 pSdrView->SetOrtho(!bResizeKeepRatio);
4396 else
4397 pSdrView->SetOrtho(true);
4398 }
4399 else
4400 {
4401 pSdrView->SetAngleSnapEnabled(bResizeKeepRatio);
4402 if (bisResize)
4403 pSdrView->SetOrtho(bResizeKeepRatio);
4404 else
4405 pSdrView->SetOrtho(false);
4406 }
4407 }
4408
4409 rSh.Drag( &aDocPt, rMEvt.IsShift() );
4410 m_bIsInMove = true;
4411 }
4412 else if( bIsDocReadOnly )
4413 break;
4414
4415 if ( !bInsWin )
4416 {
4417 Point aTmp( aDocPt );
4418 aTmp += rSh.VisArea().Pos() - aOldPt;
4419 LeaveArea( aTmp );
4420 }
4421 else if(m_bIsInMove)
4422 EnterArea();
4423 return;
4424 }
4425 if ( !rSh.IsSelFrameMode() && !g_bDDINetAttr &&
4426 (IsMinMove( m_aStartPos,aPixPt ) || m_bIsInMove) &&
4427 (rSh.IsInSelect() || !rSh.TestCurrPam( aDocPt )) )
4428 {
4429 if ( pSdrView )
4430 {
4431 if ( rMEvt.IsShift() )
4432 pSdrView->SetOrtho(true);
4433 else
4434 pSdrView->SetOrtho(false);
4435 }
4436 if ( !bInsWin )
4437 {
4438 Point aTmp( aDocPt );
4439 aTmp += rSh.VisArea().Pos() - aOldPt;
4440 LeaveArea( aTmp );
4441 }
4442 else
4443 {
4444 if( !rMEvt.IsSynthetic() &&
4445 ( MOUSE_LEFT != rMEvt.GetButtons() ||
4446 KEY_MOD1 != rMEvt.GetModifier() ||
4447 !rSh.Is_FnDragEQBeginDrag() ||
4448 rSh.IsAddMode() ) )
4449 {
4450 rSh.Drag( &aDocPt, false );
4451
4452 g_bValidCursorPos = !(CRSR_POSCHG & rSh.CallSetCursor(&aDocPt, false));
4453 EnterArea();
4454 }
4455 }
4456 }
4457 g_bDDINetAttr = false;
4458 break;
4459 case 0:
4460 {
4461 if ( m_pApplyTempl )
4462 {
4463 UpdatePointer(aDocPt); // maybe a frame has to be marked here
4464 break;
4465 }
4466 // change ui if mouse is over SwPostItField
4467 // TODO: do the same thing for redlines IsAttrAtPos::Redline
4468 SwContentAtPos aContentAtPos( IsAttrAtPos::Field);
4469 if (rSh.GetContentAtPos(aDocPt, aContentAtPos, false))
4470 {
4471 const SwField* pField = aContentAtPos.aFnd.pField;
4472 if (pField->Which()== SwFieldIds::Postit)
4473 {
4474 m_rView.GetPostItMgr()->SetShadowState(reinterpret_cast<const SwPostItField*>(pField),false);
4475 }
4476 else
4477 m_rView.GetPostItMgr()->SetShadowState(nullptr,false);
4478 }
4479 else
4480 m_rView.GetPostItMgr()->SetShadowState(nullptr,false);
4481 [[fallthrough]];
4482 }
4483 case KEY_SHIFT:
4484 case KEY_MOD2:
4485 case KEY_MOD1:
4486 if ( !m_bInsDraw )
4487 {
4488 bool bTstShdwCursor = true;
4489
4490 UpdatePointer( aDocPt, rMEvt.GetModifier() );
4491
4492 const SwFrameFormat* pFormat = nullptr;
4493 const SwFormatINetFormat* pINet = nullptr;
4494 SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr );
4495 if( rSh.GetContentAtPos( aDocPt, aContentAtPos ) )
4496 pINet = static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr);
4497
4498 const void* pTmp = pINet;
4499
4500 if( pINet ||
4501 nullptr != ( pTmp = pFormat = rSh.GetFormatFromAnyObj( aDocPt )))
4502 {
4503 bTstShdwCursor = false;
4504 if( pTmp == pINet )
4505 m_aSaveCallEvent.Set( pINet );
4506 else
4507 {
4508 IMapObject* pIMapObj = pFormat->GetIMapObject( aDocPt );
4509 if( pIMapObj )
4510 m_aSaveCallEvent.Set( pFormat, pIMapObj );
4511 else
4513 }
4514
4515 // should be over an InternetField with an
4516 // embedded macro?
4517 if( m_aSaveCallEvent != aLastCallEvent )
4518 {
4519 if( aLastCallEvent.HasEvent() )
4520 rSh.CallEvent( SvMacroItemId::OnMouseOut,
4521 aLastCallEvent, true );
4522 // 0 says that the object doesn't have any table
4523 if( !rSh.CallEvent( SvMacroItemId::OnMouseOver,
4526 }
4527 }
4528 else if( aLastCallEvent.HasEvent() )
4529 {
4530 // cursor was on an object
4531 rSh.CallEvent( SvMacroItemId::OnMouseOut,
4532 aLastCallEvent, true );
4533 }
4534
4535 if( bTstShdwCursor && bInsWin && !bIsDocReadOnly &&
4536 !m_bInsFrame &&
4537 !rSh.GetViewOptions()->getBrowseMode() &&
4538 rSh.GetViewOptions()->IsShadowCursor() &&
4539 !(rMEvt.GetModifier() + rMEvt.GetButtons()) &&
4540 !rSh.HasSelection() && !GetOutDev()->GetConnectMetaFile() )
4541 {
4542 SwRect aRect;
4543
4545 if( rSh.GetShadowCursorPos( aDocPt, eMode, aRect, m_eOrient ))
4546 {
4547 if( !m_pShadCursor )
4548 m_pShadCursor.reset( new SwShadowCursor( *this ) );
4549 if( text::HoriOrientation::RIGHT != m_eOrient && text::HoriOrientation::CENTER != m_eOrient )
4550 m_eOrient = text::HoriOrientation::LEFT;
4551 m_pShadCursor->SetPos( aRect.Pos(), aRect.Height(), static_cast< sal_uInt16 >(m_eOrient) );
4552 bDelShadCursor = false;
4553 }
4554 }
4555 }
4556 break;
4557 case MOUSE_LEFT + KEY_MOD2:
4558 if( rSh.IsBlockMode() && !rMEvt.IsSynthetic() )
4559 {
4560 rSh.Drag( &aDocPt, false );
4561 g_bValidCursorPos = !(CRSR_POSCHG & rSh.CallSetCursor(&aDocPt, false));
4562 EnterArea();
4563 }
4564 break;
4565 }
4566
4567 if( bDelShadCursor && m_pShadCursor )
4568 {
4569 m_pShadCursor.reset();
4570 }
4571 m_bWasShdwCursor = false;
4572}
4573
4578{
4580 {
4582 {
4583 pWindow->MouseButtonUp(rMEvt);
4584 return;
4585 }
4586 }
4587
4588 bool bCallBase = true;
4589
4590 bool bCallShadowCursor = m_bWasShdwCursor;
4591 m_bWasShdwCursor = false;
4592 if( m_pShadCursor )
4593 {
4594 m_pShadCursor.reset();
4595 }
4596
4598
4599 SdrHdlKind eOldSdrMoveHdl = g_eSdrMoveHdl;
4600 g_eSdrMoveHdl = SdrHdlKind::User; // for MoveEvents - reset again
4601
4602 // preventively reset
4603 m_rView.SetTabColFromDoc( false );
4605
4607 CurrShell aCurr( &rSh );
4608 SdrView *pSdrView = rSh.GetDrawView();
4609 if ( pSdrView )
4610 {
4611 // tdf34555: ortho was always reset before being used in EndSdrDrag
4612 // Now, it is reset only if not in Crop mode.
4613 if (pSdrView->GetDragMode() != SdrDragMode::Crop && !rMEvt.IsShift())
4614 pSdrView->SetOrtho(false);
4615
4616 if ( pSdrView->MouseButtonUp( rMEvt,GetOutDev() ) )
4617 {
4619 return; // SdrView's event evaluated
4620 }
4621 }
4622 // only process MouseButtonUp when the Down went to that windows as well.
4623 if ( !m_bMBPressed )
4624 {
4625 // Undo for the watering can is already in CommandHdl
4626 // that's the way it should be!
4627
4628 return;
4629 }
4630
4631 Point aDocPt( PixelToLogic( rMEvt.GetPosPixel() ) );
4632
4633 if ( g_bDDTimerStarted )
4634 {
4635 StopDDTimer( &rSh, aDocPt );
4636 m_bMBPressed = false;
4637 if ( rSh.IsSelFrameMode() )
4638 {
4639 rSh.EndDrag( &aDocPt, false );
4640 g_bFrameDrag = false;
4641 }
4642 g_bNoInterrupt = false;
4643 const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) );
4644 if ((PixelToLogic(m_aStartPos).Y() == (aDocPos.Y())) && (PixelToLogic(m_aStartPos).X() == (aDocPos.X())))//To make sure it was not moved
4645 {
4646 SdrPageView* pPV = nullptr;
4647 SdrObject* pObj = pSdrView ? pSdrView->PickObj(aDocPos, pSdrView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER) : nullptr;
4648 if (pObj)
4649 {
4650 SwFrameFormat* pFormat = GetUserCall(pObj)->GetFormat();
4652 if (!pShapeFormat)
4653 {
4654 pSdrView->UnmarkAllObj();
4655 pSdrView->MarkObj(pObj,pPV);
4656 }
4657 else
4658 {
4659 // If the fly frame is a textbox of a shape, then select the shape instead.
4660 SdrObject* pShape = pShapeFormat->FindSdrObject();
4661 pSdrView->UnmarkAllObj();
4662 pSdrView->MarkObj(pShape, pPV);
4663 }
4664 }
4665 }
4666 ReleaseMouse();
4667 return;
4668 }
4669
4670 if( m_pAnchorMarker )
4671 {
4672 if(m_pAnchorMarker->GetHdl())
4673 {
4674 // #i121463# delete selected after drag
4675 m_pAnchorMarker->GetHdl()->SetSelected(false);
4676 }
4677
4678 Point aPnt( m_pAnchorMarker->GetLastPos() );
4679 m_pAnchorMarker.reset();
4680 if( aPnt.X() || aPnt.Y() )
4681 rSh.FindAnchorPos( aPnt, true );
4682 }
4684 {
4685 if ( m_rView.GetDrawFuncPtr()->MouseButtonUp( rMEvt ) )
4686 {
4687 if (m_rView.GetDrawFuncPtr()) // could have been destroyed in MouseButtonUp
4688 {
4690
4691 if (!m_rView.IsDrawMode())
4692 {
4693 m_rView.SetDrawFuncPtr(nullptr);
4695 rBind.Invalidate( SID_ATTR_SIZE );
4696 rBind.Invalidate( SID_TABLE_CELL );
4697 }
4698 }
4699
4700 if ( rSh.IsObjSelected() )
4701 {
4702 rSh.EnterSelFrameMode();
4703 if (!m_rView.GetDrawFuncPtr())
4704 StdDrawMode( SdrObjKind::NONE, true );
4705 }
4706 else if ( rSh.IsFrameSelected() )
4707 {
4708 rSh.EnterSelFrameMode();
4709 StopInsFrame();
4710 }
4711 else
4712 {
4713 const Point aDocPos( PixelToLogic( m_aStartPos ) );
4714 g_bValidCursorPos = !(CRSR_POSCHG & rSh.CallSetCursor(&aDocPos, false));
4715 rSh.Edit();
4716 }
4717
4718 m_rView.AttrChangedNotify(nullptr);
4719 }
4720 else if (rMEvt.GetButtons() == MOUSE_RIGHT && rSh.IsDrawCreate())
4721 m_rView.GetDrawFuncPtr()->BreakCreate(); // abort drawing
4722
4723 g_bNoInterrupt = false;
4724 if (IsMouseCaptured())
4725 ReleaseMouse();
4726 return;
4727 }
4728 bool bPopMode = false;
4729 switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
4730 {
4731 case MOUSE_LEFT:
4732 if ( m_bInsDraw && rSh.IsDrawCreate() )
4733 {
4735 {
4737 m_rView.AttrChangedNotify(nullptr);
4738 if ( rSh.IsObjSelected() )
4739 rSh.EnterSelFrameMode();
4741 StopInsFrame();
4742 }
4743 bCallBase = false;
4744 break;
4745 }
4746 [[fallthrough]];
4747 case MOUSE_LEFT + KEY_MOD1:
4748 case MOUSE_LEFT + KEY_MOD2:
4749 case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1:
4750 if ( g_bFrameDrag && rSh.IsSelFrameMode() )
4751 {
4752 if ( rMEvt.IsMod1() ) // copy and don't move.
4753 {
4754 // abort drag, use internal Copy instead
4755 tools::Rectangle aRect;
4756 rSh.GetDrawView()->TakeActionRect( aRect );
4757 if (!aRect.IsEmpty())
4758 {
4759 rSh.BreakDrag();
4760 Point aEndPt, aSttPt;
4762 {
4763 aEndPt = aRect.TopLeft();
4764 aSttPt = rSh.GetDrawView()->GetAllMarkedRect().TopLeft();
4765 }
4766 else
4767 {
4768 aEndPt = aRect.Center();
4769 aSttPt = rSh.GetDrawView()->GetAllMarkedRect().Center();
4770 }
4771 if ( aSttPt != aEndPt )
4772 {
4774 rSh.Copy(rSh, aSttPt, aEndPt);
4776 }
4777 }
4778 else {
4779 rSh.EndDrag( &aDocPt, false );
4780 }
4781 }
4782 else
4783 {
4784 {
4785 const SwFrameFormat *const pFlyFormat(rSh.GetFlyFrameFormat());
4786 const SvxMacro* pMacro = nullptr;
4787
4788 SvMacroItemId nEvent = SdrHdlKind::Move == eOldSdrMoveHdl
4789 ? SvMacroItemId::SwFrmMove
4790 : SvMacroItemId::SwFrmResize;
4791
4792 if (nullptr != pFlyFormat)
4793 pMacro = pFlyFormat->GetMacro().GetMacroTable().Get(nEvent);
4794 if (nullptr != pMacro)
4795 {
4796 const Point aSttPt( PixelToLogic( m_aStartPos ) );
4797 m_aRszMvHdlPt = aDocPt;
4798 sal_uInt32 nPos = 0;
4799 SbxArrayRef xArgs = new SbxArray;
4800 SbxVariableRef xVar = new SbxVariable;
4801 xVar->PutString( pFlyFormat->GetName() );
4802 xArgs->Put(xVar.get(), ++nPos);
4803
4804 if( SvMacroItemId::SwFrmResize == nEvent )
4805 {
4806 xVar = new SbxVariable;
4807 xVar->PutUShort( static_cast< sal_uInt16 >(eOldSdrMoveHdl) );
4808 xArgs->Put(xVar.get(), ++nPos);
4809 }
4810
4811 xVar = new SbxVariable;
4812 xVar->PutLong( aDocPt.X() - aSttPt.X() );
4813 xArgs->Put(xVar.get(), ++nPos);
4814 xVar = new SbxVariable;
4815 xVar->PutLong( aDocPt.Y() - aSttPt.Y() );
4816 xArgs->Put(xVar.get(), ++nPos);
4817
4818 xVar = new SbxVariable;
4819 xVar->PutUShort( 1 );
4820 xArgs->Put(xVar.get(), ++nPos);
4821
4822 ReleaseMouse();
4823
4824 rSh.ExecMacro( *pMacro, nullptr, xArgs.get() );
4825
4826 CaptureMouse();
4827 }
4828
4829 if (pFlyFormat)
4830 {
4831 // See if the fly frame's anchor is in a content control. If so,
4832 // interact with it.
4833 const SwFormatAnchor& rFormatAnchor = pFlyFormat->GetAnchor();
4834 SwNode* pAnchorNode = rFormatAnchor.GetAnchorNode();
4835 if (pAnchorNode)
4836 {
4837 SwTextNode* pTextNode = pAnchorNode->GetTextNode();
4838 if (pTextNode)
4839 {
4840 SwTextAttr* pAttr = pTextNode->GetTextAttrAt(
4843 if (pAttr)
4844 {
4845 SwTextContentControl* pTextContentControl
4846 = static_txtattr_cast<SwTextContentControl*>(pAttr);
4847 const SwFormatContentControl& rFormatContentControl
4848 = pTextContentControl->GetContentControl();
4849 rSh.GotoContentControl(rFormatContentControl);
4850 }
4851 }
4852 }
4853 }
4854 }
4855 rSh.EndDrag( &aDocPt, false );
4856 }
4857 g_bFrameDrag = false;
4858 bCallBase = false;
4859 break;
4860 }
4861 bPopMode = true;
4862 [[fallthrough]];
4863 case MOUSE_LEFT + KEY_SHIFT:
4864 if (rSh.IsSelFrameMode())
4865 {
4866
4867 rSh.EndDrag( &aDocPt, false );
4868 g_bFrameDrag = false;
4869 bCallBase = false;
4870 break;
4871 }
4872
4873 if( g_bHoldSelection )
4874 {
4875 // the EndDrag should be called in any case
4876 g_bHoldSelection = false;
4877 rSh.EndDrag( &aDocPt, false );
4878 }
4879 else
4880 {
4881 SwContentAtPos aFieldAtPos ( IsAttrAtPos::Field );
4882 if ( !rSh.IsInSelect() && rSh.TestCurrPam( aDocPt ) &&
4883 !rSh.GetContentAtPos( aDocPt, aFieldAtPos ) )
4884 {
4885 const bool bTmpNoInterrupt = g_bNoInterrupt;
4886 g_bNoInterrupt = false;
4887 { // create only temporary move context because otherwise
4888 // the query to the content form doesn't work!!!
4889 SwMvContext aMvContext( &rSh );
4890 const Point aDocPos( PixelToLogic( m_aStartPos ) );
4891 g_bValidCursorPos = !(CRSR_POSCHG & rSh.CallSetCursor(&aDocPos, false));
4892 }
4893 g_bNoInterrupt = bTmpNoInterrupt;
4894
4895 }
4896 else
4897 {
4898 bool bInSel = rSh.IsInSelect();
4899 rSh.EndDrag( &aDocPt, false );
4900
4901 // Internetfield? --> call link (load doc!!)
4902 if( !bInSel )
4903 {
4905 if( KEY_MOD1 == rMEvt.GetModifier() )
4906 nFilter |= LoadUrlFlags::NewView;
4907
4908 bool bExecHyperlinks = m_rView.GetDocShell()->IsReadOnly();
4909 if ( !bExecHyperlinks )
4910 {
4912 if ( ( bSecureOption && rMEvt.GetModifier() == KEY_MOD1 ) ||
4913 ( !bSecureOption && rMEvt.GetModifier() != KEY_MOD1 ) )
4914 bExecHyperlinks = true;
4915 }
4916
4917 const bool bExecSmarttags = rMEvt.GetModifier() == KEY_MOD1;
4918
4919 if(m_pApplyTempl)
4920 bExecHyperlinks = false;
4921
4922 SwContentAtPos aContentAtPos( IsAttrAtPos::Field |
4926
4927 if( rSh.GetContentAtPos( aDocPt, aContentAtPos ) )
4928 {
4929 // Do it again if we're not on a field/hyperlink to update the cursor accordingly
4930 if ( IsAttrAtPos::Field != aContentAtPos.eContentAtPos
4931 && IsAttrAtPos::InetAttr != aContentAtPos.eContentAtPos )
4932 rSh.GetContentAtPos( aDocPt, aContentAtPos, true );
4933
4934 bool bViewLocked = rSh.IsViewLocked();
4935 if( !bViewLocked && !rSh.IsReadOnlyAvailable() &&
4936 aContentAtPos.IsInProtectSect() )
4937 rSh.LockView( true );
4938
4939 ReleaseMouse();
4940
4941 if( IsAttrAtPos::Field == aContentAtPos.eContentAtPos )
4942 {
4943 bool bAddMode(false);
4944 // AdditionalMode if applicable
4945 if (KEY_MOD1 == rMEvt.GetModifier()
4946 && !rSh.IsAddMode())
4947 {
4948 bAddMode = true;
4949 rSh.EnterAddMode();
4950 }
4951 if ( aContentAtPos.pFndTextAttr != nullptr
4952 && aContentAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD )
4953 {
4954 if (!rSh.IsInSelect())
4955 {
4956 // create only temporary move context because otherwise
4957 // the query to the content form doesn't work!!!
4958 SwMvContext aMvContext( &rSh );
4959 const Point aDocPos( PixelToLogic( m_aStartPos ) );
4960 g_bValidCursorPos = !(CRSR_POSCHG & rSh.CallSetCursor(&aDocPos, false));
4961 }
4962 else
4963 {
4964 g_bValidCursorPos = true;
4965 }
4966 }
4967 else
4968 {
4969 rSh.ClickToField(*aContentAtPos.aFnd.pField, bExecHyperlinks);
4970 // a bit of a mystery what this is good for?
4971 // in this case we assume it's valid since we
4972 // just selected a field
4973 g_bValidCursorPos = true;
4974 }
4975 if (bAddMode)
4976 {
4977 rSh.LeaveAddMode();
4978 }
4979 }
4980 else if (aContentAtPos.eContentAtPos == IsAttrAtPos::ContentControl)
4981 {
4982 auto pTextContentControl
4983 = static_txtattr_cast<const SwTextContentControl*>(
4984 aContentAtPos.pFndTextAttr);
4985 const SwFormatContentControl& rFormatContentControl
4986 = pTextContentControl->GetContentControl();
4987 rSh.GotoContentControl(rFormatContentControl);
4988 }
4989 else if ( IsAttrAtPos::SmartTag == aContentAtPos.eContentAtPos )
4990 {
4991 // execute smarttag menu
4992 if ( bExecSmarttags && SwSmartTagMgr::Get().IsSmartTagsEnabled() )
4993 m_rView.ExecSmartTagPopup( aDocPt );
4994 }
4995 else if ( IsAttrAtPos::FormControl == aContentAtPos.eContentAtPos )
4996 {
4997 OSL_ENSURE( aContentAtPos.aFnd.pFieldmark != nullptr, "where is my field ptr???");
4998 if ( aContentAtPos.aFnd.pFieldmark != nullptr)
4999 {
5000 IFieldmark *fieldBM = const_cast< IFieldmark* > ( aContentAtPos.aFnd.pFieldmark );
5001 if ( fieldBM->GetFieldname( ) == ODF_FORMCHECKBOX )
5002 {
5003 ICheckboxFieldmark& rCheckboxFm = dynamic_cast<ICheckboxFieldmark&>(*fieldBM);
5004 rCheckboxFm.SetChecked(!rCheckboxFm.IsChecked());
5005 rCheckboxFm.Invalidate();
5007 }
5008 }
5009 }
5010 else if ( IsAttrAtPos::InetAttr == aContentAtPos.eContentAtPos )
5011 {
5013 {
5014 OUString val((*static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr)).GetValue());
5015 if (val.startsWith("#"))
5016 bExecHyperlinks = true;
5017 }
5018 if ( bExecHyperlinks && aContentAtPos.aFnd.pAttr )
5019 rSh.ClickToINetAttr( *static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr), nFilter );
5020 }
5021
5022 rSh.LockView( bViewLocked );
5023 bCallShadowCursor = false;
5024 }
5025 else
5026 {
5027 aContentAtPos = SwContentAtPos( IsAttrAtPos::Ftn );
5028 if( !rSh.GetContentAtPos( aDocPt, aContentAtPos, true ) && bExecHyperlinks )
5029 {
5030 SdrViewEvent aVEvt;
5031
5032 if (pSdrView)
5033 pSdrView->PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
5034
5035 if (pSdrView && aVEvt.meEvent == SdrEventKind::ExecuteUrl)
5036 {
5037 // hit URL field
5038 const SvxURLField *pField = aVEvt.mpURLField;
5039 if (pField)
5040 {
5041 const OUString& sURL(pField->GetURL());
5042 const OUString& sTarget(pField->GetTargetFrame());
5043 ::LoadURL(rSh, sURL, nFilter, sTarget);
5044 }
5045 bCallShadowCursor = false;
5046 }
5047 else
5048 {
5049 // hit graphic
5050 ReleaseMouse();
5051 if( rSh.ClickToINetGrf( aDocPt, nFilter ))
5052 bCallShadowCursor = false;
5053 }
5054 }
5055 }
5056
5057 if( bCallShadowCursor &&
5058 rSh.GetViewOptions()->IsShadowCursor() &&
5059 MOUSE_LEFT == (rMEvt.GetModifier() + rMEvt.GetButtons()) &&
5060 !rSh.HasSelection() &&
5061 !GetOutDev()->GetConnectMetaFile() &&
5062 rSh.VisArea().Contains( aDocPt ))
5063 {
5064 SwUndoId nLastUndoId(SwUndoId::EMPTY);
5065 if (rSh.GetLastUndoInfo(nullptr, & nLastUndoId))
5066 {
5067 if (SwUndoId::INS_FROM_SHADOWCRSR == nLastUndoId)
5068 {
5069 rSh.Undo();
5070 }
5071 }
5073 rSh.SetShadowCursorPos( aDocPt, eMode );
5074 }
5075 }
5076 }
5077 bCallBase = false;
5078
5079 }
5080
5081 // reset pushed mode in Down again if applicable
5082 if ( bPopMode && g_bModePushed )
5083 {
5084 rSh.PopMode();
5085 g_bModePushed = false;
5086 bCallBase = false;
5087 }
5088 break;
5089
5090 default:
5091 ReleaseMouse();
5092 return;
5093 }
5094
5095 if( m_pApplyTempl )
5096 {
5097 SelectionType eSelection = rSh.GetSelectionType();
5098 SwFormatClipboard* pFormatClipboard = m_pApplyTempl->m_pFormatClipboard;
5099 if( pFormatClipboard )//apply format paintbrush
5100 {
5101 //get some parameters
5102 SwWrtShell& rWrtShell = m_rView.GetWrtShell();
5103 SfxStyleSheetBasePool* pPool=nullptr;
5104 bool bNoCharacterFormats = false;
5105 bool bNoParagraphFormats = true;
5106 {
5107 SwDocShell* pDocSh = m_rView.GetDocShell();
5108 if(pDocSh)
5109 pPool = pDocSh->GetStyleSheetPool();
5110 if( (rMEvt.GetModifier()&KEY_MOD1) && (rMEvt.GetModifier()&KEY_SHIFT) )
5111 {
5112 bNoCharacterFormats = true;
5113 bNoParagraphFormats = false;
5114 }
5115 else if( rMEvt.GetModifier() & KEY_MOD1 )
5116 bNoParagraphFormats = false;
5117 }
5118 //execute paste
5119 pFormatClipboard->Paste( rWrtShell, pPool, bNoCharacterFormats, bNoParagraphFormats );
5120
5121 //if the clipboard is empty after paste remove the ApplyTemplate
5122 if(!pFormatClipboard->HasContent())
5124
5125 //tdf#38101 remove temporary highlighting
5126 m_pUserMarker.reset();
5127 }
5128 else if( m_pApplyTempl->nColor )
5129 {
5130 sal_uInt16 nId = 0;
5131 switch( m_pApplyTempl->nColor )
5132 {
5133 case SID_ATTR_CHAR_COLOR_EXT:
5135 break;
5136 case SID_ATTR_CHAR_BACK_COLOR:
5137 case SID_ATTR_CHAR_COLOR_BACKGROUND:
5139 break;
5140 }
5141 if( nId && (SelectionType::Text|SelectionType::Table) & eSelection)
5142 {
5143 if( rSh.IsSelection() && !rSh.HasReadonlySel() )
5144 {
5145 m_pApplyTempl->nUndo =
5146 std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
5149 else
5151 rSh.UnSetVisibleCursor();
5152 rSh.EnterStdMode();
5153 rSh.SetVisibleCursor(aDocPt);
5154 bCallBase = false;
5156 }
5157 else if(rMEvt.GetClicks() == 1)
5158 {
5159 // no selection -> so turn off watering can
5161 }
5162 }
5163 }
5164 else
5165 {
5166 OUString aStyleName;
5167 switch ( m_pApplyTempl->eType )
5168 {
5169 case SfxStyleFamily::Para:
5171 & eSelection ) && !rSh.HasReadonlySel() )
5172 {
5173 rSh.SetTextFormatColl( m_pApplyTempl->aColl.pTextColl );
5174 m_pApplyTempl->nUndo =
5175 std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
5176 bCallBase = false;
5177 if ( m_pApplyTempl->aColl.pTextColl )
5178 aStyleName = m_pApplyTempl->aColl.pTextColl->GetName();
5179 }
5180 break;
5181 case SfxStyleFamily::Char:
5183 & eSelection ) && !rSh.HasReadonlySel() )
5184 {
5185 rSh.SetAttrItem( SwFormatCharFormat(m_pApplyTempl->aColl.pCharFormat) );
5186 rSh.UnSetVisibleCursor();
5187 rSh.EnterStdMode();
5188 rSh.SetVisibleCursor(aDocPt);
5189 m_pApplyTempl->nUndo =
5190 std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
5191 bCallBase = false;
5192 if ( m_pApplyTempl->aColl.pCharFormat )
5193 aStyleName = m_pApplyTempl->aColl.pCharFormat->GetName();
5194 }
5195 break;
5196 case SfxStyleFamily::Frame :
5197 {
5198 const SwFrameFormat* pFormat = rSh.GetFormatFromObj( aDocPt );
5199 if(dynamic_cast<const SwFlyFrameFormat*>( pFormat) )
5200 {
5201 rSh.SetFrameFormat( m_pApplyTempl->aColl.pFrameFormat, false, &aDocPt );
5202 m_pApplyTempl->nUndo =
5203 std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
5204 bCallBase = false;
5205 if( m_pApplyTempl->aColl.pFrameFormat )
5206 aStyleName = m_pApplyTempl->aColl.pFrameFormat->GetName();
5207 }
5208 break;
5209 }
5210 case SfxStyleFamily::Page:
5211 // no Undo with page templates
5212 rSh.ChgCurPageDesc( *m_pApplyTempl->aColl.pPageDesc );
5213 if ( m_pApplyTempl->aColl.pPageDesc )
5214 aStyleName = m_pApplyTempl->aColl.pPageDesc->GetName();
5215 m_pApplyTempl->nUndo =
5216 std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
5217 bCallBase = false;
5218 break;
5219 case SfxStyleFamily::Pseudo:
5220 if( !rSh.HasReadonlySel() )
5221 {
5222 rSh.SetCurNumRule( *m_pApplyTempl->aColl.pNumRule,
5223 false,
5224 m_pApplyTempl->aColl.pNumRule->GetDefaultListId() );
5225 bCallBase = false;
5226 m_pApplyTempl->nUndo =
5227 std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount());
5228 if( m_pApplyTempl->aColl.pNumRule )
5229 aStyleName = m_pApplyTempl->aColl.pNumRule->GetName();
5230 }
5231 break;
5232 default: break;
5233 }
5234
5235 uno::Reference< frame::XDispatchRecorder > xRecorder =
5237 if ( !aStyleName.isEmpty() && xRecorder.is() )
5238 {
5240 if ( pSfxShell )
5241 {
5242 SfxRequest aReq(m_rView.GetViewFrame(), SID_STYLE_APPLY);
5243 aReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aStyleName ) );
5244 aReq.AppendItem( SfxUInt16Item( SID_STYLE_FAMILY, static_cast<sal_uInt16>(m_pApplyTempl->eType) ) );
5245 aReq.Done();
5246 }
5247 }
5248 }
5249
5250 }
5251 ReleaseMouse();
5252 // Only processed MouseEvents arrive here; only at these this mode can
5253 // be reset.
5254 m_bMBPressed = false;
5255
5256 // Make this call just to be sure. Selecting has finished surely by now.
5257 // Otherwise the timeout's timer could give problems.
5258 EnterArea();
5259 g_bNoInterrupt = false;
5260
5261 if (bCallBase)
5262 Window::MouseButtonUp(rMEvt);
5263
5264 if (!(pSdrView && rMEvt.GetClicks() == 1 && comphelper::LibreOfficeKit::isActive()))
5265 return;
5266
5267 // When tiled rendering, single click on a shape text starts editing already.
5268 SdrViewEvent aViewEvent;
5269 SdrHitKind eHit = pSdrView->PickAnything(rMEvt, SdrMouseEventKind::BUTTONUP, aViewEvent);
5270 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
5271 if (eHit == SdrHitKind::TextEditObj && rMarkList.GetMarkCount() == 1)
5272 {
5273 if (SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj())
5274 {
5275 EnterDrawTextMode(pObj->GetLogicRect().Center());
5276 if ( auto pSwDrawTextShell = dynamic_cast< SwDrawTextShell *>( m_rView.GetCurShell() ) )
5277 pSwDrawTextShell->Init();
5278 }
5279 }
5280}
5281
5286{
5287 static bool bIdle = false;
5288 m_pApplyTempl.reset();
5290
5291 if(rTempl.m_pFormatClipboard)
5292 {
5293 m_pApplyTempl.reset(new SwApplyTemplate( rTempl ));
5294 m_pApplyTempl->nUndo = rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount();
5295 SetPointer( PointerStyle::Fill );//@todo #i20119# maybe better a new brush pointer here in future
5296 rSh.NoEdit( false );
5297 bIdle = rSh.GetViewOptions()->IsIdle();
5298 rSh.GetViewOptions()->SetIdle( false );
5299 }
5300 else if(rTempl.nColor)
5301 {
5302 m_pApplyTempl.reset(new SwApplyTemplate( rTempl ));
5303 m_pApplyTempl->nUndo = rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount();
5304 SetPointer( PointerStyle::Fill );
5305 rSh.NoEdit( false );
5306 bIdle = rSh.GetViewOptions()->IsIdle();
5307 rSh.GetViewOptions()->SetIdle( false );
5308 }
5309 else if( rTempl.eType != SfxStyleFamily::None )
5310 {
5311 m_pApplyTempl.reset(new SwApplyTemplate( rTempl ));
5312 m_pApplyTempl->nUndo = rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount();
5313 SetPointer( PointerStyle::Fill );
5314 rSh.NoEdit( false );
5315 bIdle = rSh.GetViewOptions()->IsIdle();
5316 rSh.GetViewOptions()->SetIdle( false );
5317 }
5318 else
5319 {
5320 SetPointer( PointerStyle::Text );
5321 rSh.UnSetVisibleCursor();
5322
5323 rSh.GetViewOptions()->SetIdle( bIdle );
5324 if ( !rSh.IsSelFrameMode() )
5325 rSh.Edit();
5326 }
5327
5328 static sal_uInt16 aInva[] =
5329 {
5330 SID_STYLE_WATERCAN,
5331 SID_ATTR_CHAR_COLOR_EXT,
5332 SID_ATTR_CHAR_COLOR_BACKGROUND_EXT,
5333 0
5334 };
5336}
5337
5342 DocWindow(pParent, WinBits(WB_CLIPCHILDREN | WB_DIALOGCONTROL)),
5343 DropTargetHelper( this ),
5344 DragSourceHelper( this ),
5345
5346 m_aTimer("SwEditWin"),
5347 m_aKeyInputFlushTimer("SwEditWin m_aKeyInputFlushTimer"),
5348 m_eBufferLanguage(LANGUAGE_DONTKNOW),
5349 m_aTemplateTimer("SwEditWin m_aTemplateTimer"),
5350 m_pUserMarkerObj( nullptr ),
5351
5352 m_rView( rMyView ),
5353
5354 m_aActHitType(SdrHitKind::NONE),
5355 m_nDropFormat( SotClipboardFormatId::NONE ),
5356 m_nDropAction( 0 ),
5357 m_nDropDestination( SotExchangeDest::NONE ),
5358
5359 m_eBezierMode(SID_BEZIER_INSERT),
5360 m_nInsFrameColCount( 1 ),
5361 m_eDrawMode(SdrObjKind::NONE),
5362
5363 m_bMBPressed(false),
5364 m_bInsDraw(false),
5365 m_bInsFrame(false),
5366 m_bIsInMove(false),
5367 m_bIsInDrag(false),
5368 m_bOldIdle(false),
5369 m_bOldIdleSet(false),
5370 m_bChainMode(false),
5371 m_bWasShdwCursor(false),
5372 m_bLockInput(false),
5373 m_bIsRowDrag(false),
5374 m_bUseInputLanguage(false),
5375 m_bObjectSelect(false),
5376 m_nKS_NUMDOWN_Count(0),
5377 m_nKS_NUMINDENTINC_Count(0),
5378 m_pFrameControlsManager(new SwFrameControlsManager(this))
5379{
5380 set_id("writer_edit");
5383 SetDialogControlFlags( DialogControlFlags::Return | DialogControlFlags::WantFocus );
5384
5387 // initially use the input language
5388 m_bUseInputLanguage = true;
5389
5390 SetMapMode(MapMode(MapUnit::MapTwip));
5391
5392 SetPointer( PointerStyle::Text );
5393 m_aTimer.SetInvokeHandler(LINK(this, SwEditWin, TimerHandler));
5394
5396 m_aKeyInputFlushTimer.SetInvokeHandler(LINK(this, SwEditWin, KeyInputFlushHandler));
5397
5398 // TemplatePointer for colors should be reset without
5399 // selection after single click, but not after double-click (tdf#122442)
5400 m_aTemplateTimer.SetTimeout(GetSettings().GetMouseSettings().GetDoubleClickTime());
5401 m_aTemplateTimer.SetInvokeHandler(LINK(this, SwEditWin, TemplateTimerHdl));
5402
5403 // temporary solution!!! Should set the font of the current
5404 // insert position at every cursor movement!
5405 if( !rMyView.GetDocShell()->IsReadOnly() )
5406 {
5407 vcl::Font aFont;
5408 SetInputContext( InputContext( aFont, InputContextFlags::Text |
5409 InputContextFlags::ExtText ) );
5410 }
5411}
5412
5414{
5415 disposeOnce();
5416}
5417
5419{
5420 m_pShadCursor.reset();
5421
5424 g_bExecuteDrag = false;
5425 m_pApplyTempl.reset();
5426
5427 m_rView.SetDrawFuncPtr(nullptr);
5428
5429 m_pUserMarker.reset();
5430
5431 m_pAnchorMarker.reset();
5432
5433 m_pFrameControlsManager->dispose();
5435
5439}
5440
5445{
5446 if ( m_rView.EnterDrawTextMode(aDocPos) )
5447 {
5448 if (m_rView.GetDrawFuncPtr())
5449 {
5451 m_rView.SetDrawFuncPtr(nullptr);
5453 }
5454 m_rView.NoRotate();
5455 m_rView.AttrChangedNotify(nullptr);
5456 }
5457}
5458
5462bool SwEditWin::EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos)
5463{
5465 SdrView *pSdrView = rSh.GetDrawView();
5466
5467 if ( m_rView.GetDrawFuncPtr() )
5468 {
5469 if (rSh.IsDrawCreate())
5470 return true;
5471
5472 bool bRet = m_rView.GetDrawFuncPtr()->MouseButtonDown( rMEvt );
5473 m_rView.AttrChangedNotify(nullptr);
5474 return bRet;
5475 }
5476
5477 if ( pSdrView && pSdrView->IsTextEdit() )
5478 {
5479 bool bUnLockView = !rSh.IsViewLocked();
5480 rSh.LockView( true );
5481
5482 rSh.EndTextEdit(); // clicked aside, end Edit
5483 rSh.SelectObj( aDocPos );
5484 if ( !rSh.IsObjSelected() && !rSh.IsFrameSelected() )
5485 rSh.LeaveSelFrameMode();
5486 else
5487 {
5488 SwEditWin::s_nDDStartPosY = aDocPos.Y();
5489 SwEditWin::s_nDDStartPosX = aDocPos.X();
5490 g_bFrameDrag = true;
5491 }
5492 if( bUnLockView )
5493 rSh.LockView( false );
5494 m_rView.AttrChangedNotify(nullptr);
5495 return true;
5496 }
5497 return false;
5498}
5499
5501{
5502 return IsObjectSelect();
5503}
5504
5506{
5508 {
5510 }
5511 else
5512 {
5513 m_rView.GotFocus();
5514 Window::GetFocus();
5515#if !ENABLE_WASM_STRIP_ACCESSIBILITY
5517#endif
5518 }
5519}
5520
5522{
5523#if !ENABLE_WASM_STRIP_ACCESSIBILITY
5524 if (m_rView.GetWrtShellPtr())
5526#endif
5527 Window::LoseFocus();
5530}
5531
5533{
5534 if (isDisposed())
5535 {
5536 // If ViewFrame dies shortly, no popup anymore!
5537 Window::Command(rCEvt);
5538 return;
5539 }
5540
5542
5543 // The command event is send to the window after a possible context
5544 // menu from an inplace client has been closed. Now we have the chance
5545 // to deactivate the inplace client without any problem regarding parent
5546 // windows and code on the stack.
5547 SfxInPlaceClient* pIPClient = rSh.GetSfxViewShell()->GetIPClient();
5548 bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
5549 if ( bIsOleActive && ( rCEvt.GetCommand() == CommandEventId::ContextMenu ))
5550 {
5551 rSh.FinishOLEObj();
5552 return;
5553 }
5554
5555 bool bCallBase = true;
5556
5557 switch ( rCEvt.GetCommand() )
5558 {
5559 case CommandEventId::ContextMenu:
5560 {
5561 const sal_uInt16 nId = SwInputChild::GetChildWindowId();
5562 SwInputChild* pChildWin = static_cast<SwInputChild*>(GetView().GetViewFrame().
5563 GetChildWindow( nId ));
5564
5566 return;
5567
5568 Point aDocPos( PixelToLogic( rCEvt.GetMousePosPixel() ) );
5569 if ( !rCEvt.IsMouseEvent() )
5570 aDocPos = rSh.GetCharRect().Center();
5571
5572 // Don't trigger the command on a frame anchored to header/footer is not editing it
5573 FrameControlType eControl;
5574 bool bOverFly = false;
5575 bool bPageAnchored = false;
5576 bool bOverHeaderFooterFly = IsOverHeaderFooterFly( aDocPos, eControl, bOverFly, bPageAnchored );
5577 // !bOverHeaderFooterFly doesn't mean we have a frame to select
5578 if ( !bPageAnchored && rCEvt.IsMouseEvent( ) &&
5579 ( ( rSh.IsHeaderFooterEdit( ) && !bOverHeaderFooterFly && bOverFly ) ||
5580 ( !rSh.IsHeaderFooterEdit( ) && bOverHeaderFooterFly ) ) )
5581 {
5582 return;
5583 }
5584
5585 if((!pChildWin || pChildWin->GetView() != &m_rView) &&
5586 !rSh.IsDrawCreate() && !IsDrawAction())
5587 {
5588 CurrShell aCurr( &rSh );
5589 if (!m_pApplyTempl)
5590 {
5591 if (g_bNoInterrupt)
5592 {
5593 ReleaseMouse();
5594 g_bNoInterrupt = false;
5595 m_bMBPressed = false;
5596 }
5597 if ( rCEvt.IsMouseEvent() )
5598 {
5601 }
5602 const Point aPixPos = LogicToPixel( aDocPos );
5603
5604 if ( m_rView.GetDocShell()->IsReadOnly() )
5605 {
5606 SwReadOnlyPopup aROPopup(aDocPos, m_rView);
5607
5608 ui::ContextMenuExecuteEvent aEvent;
5609 aEvent.SourceWindow = VCLUnoHelper::GetInterface( this );
5610 aEvent.ExecutePosition.X = aPixPos.X();
5611 aEvent.ExecutePosition.Y = aPixPos.Y();
5613 rtl::Reference<VCLXPopupMenu> xMenuInterface = aROPopup.CreateMenuInterface();
5614 if (GetView().TryContextMenuInterception(xMenuInterface, "private:resource/ReadonlyContextMenu", xMenu, aEvent))
5615 {
5616 if (xMenu.is())
5617 {
5618 css::uno::Reference<css::awt::XWindowPeer> xParent(aEvent.SourceWindow, css::uno::UNO_QUERY);
5619 sal_uInt16 nExecId = xMenu->execute(xParent, css::awt::Rectangle(aPixPos.X(), aPixPos.Y(), 1, 1),
5620 css::awt::PopupMenuDirection::EXECUTE_DOWN);
5621 if (!::ExecuteMenuCommand(xMenu, m_rView.GetViewFrame(), nExecId))
5622 aROPopup.Execute(this, nExecId);
5623 }
5624 else
5625 aROPopup.Execute(this, aPixPos);
5626 }
5627 }
5628 else if ( !m_rView.ExecSpellPopup( aDocPos ) )
5629 SfxDispatcher::ExecutePopup(this, &aPixPos);
5630 }
5631 else if (m_pApplyTempl->nUndo < rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount())
5632 {
5633 // Undo until we reach the point when we entered this context.
5634 rSh.Do(SwWrtShell::UNDO);
5635 }
5636 bCallBase = false;
5637 }
5638 }
5639 break;
5640
5641 case CommandEventId::Wheel:
5642 case CommandEventId::StartAutoScroll:
5643 case CommandEventId::AutoScroll:
5645 {
5647 m_pSavedOutlineFrame = nullptr;
5648 }
5649 m_pShadCursor.reset();
5650 bCallBase = !m_rView.HandleWheelCommands( rCEvt );
5651 break;
5652
5653 case CommandEventId::GestureZoom:
5654 {
5656 {
5658 m_pSavedOutlineFrame = nullptr;
5659 }
5660 m_pShadCursor.reset();
5661 bCallBase = !m_rView.HandleGestureZoomCommand(rCEvt);
5662 break;
5663 }
5664
5665 case CommandEventId::GestureLongPress:
5666 case CommandEventId::GestureSwipe: //nothing yet
5667 break;
5668
5669 case CommandEventId::StartExtTextInput:
5670 {
5671 bool bIsDocReadOnly = m_rView.GetDocShell()->IsReadOnly() &&
5672 rSh.IsCursorReadonly();
5673 if(!bIsDocReadOnly)
5674 {
5675 if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
5676 {
5677 bCallBase = false;
5678 rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
5679 }
5680 else
5681 {
5682 if( rSh.HasSelection() )
5683 rSh.DelRight();
5684
5685 bCallBase = false;
5686 LanguageType eInputLanguage = GetInputLanguage();
5687 rSh.CreateExtTextInput(eInputLanguage);
5688 }
5689 }
5690 break;
5691 }
5692 case CommandEventId::EndExtTextInput:
5693 {
5694 bool bIsDocReadOnly = m_rView.GetDocShell()->IsReadOnly() &&
5695 rSh.IsCursorReadonly();
5696 if(!bIsDocReadOnly)
5697 {
5698 if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
5699 {
5700 bCallBase = false;
5701 rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
5702 }
5703 else
5704 {
5705 bCallBase = false;
5706 OUString sRecord = rSh.DeleteExtTextInput();
5707 uno::Reference< frame::XDispatchRecorder > xRecorder =
5709
5710 if ( !sRecord.isEmpty() )
5711 {
5712 // convert quotes in IME text
5713 // works on the last input character, this is especially in Korean text often done
5714 // quotes that are inside of the string are not replaced!
5715 const sal_Unicode aCh = sRecord[sRecord.getLength() - 1];
5717 SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
5718 if(pACorr &&
5719 (( pACorr->IsAutoCorrFlag( ACFlags::ChgQuotes ) && ('\"' == aCh ))||
5720 ( pACorr->IsAutoCorrFlag( ACFlags::ChgSglQuotes ) && ( '\'' == aCh))))
5721 {
5722 rSh.DelLeft();
5723 rSh.AutoCorrect( *pACorr, aCh );
5724 }
5725
5726 if ( xRecorder.is() )
5727 {
5728 // determine Shell
5730 // generate request and record
5731 if (pSfxShell)
5732 {
5734 aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sRecord ) );
5735 aReq.Done();
5736 }
5737 }
5738 }
5739 }
5740 }
5741 }
5742 break;
5743 case CommandEventId::ExtTextInput:
5744 {
5745 bool bIsDocReadOnly = m_rView.GetDocShell()->IsReadOnly() &&
5746 rSh.IsCursorReadonly();
5747 if (!bIsDocReadOnly && !rSh.HasReadonlySel())
5748 {
5750 s_pQuickHlpData->Stop( rSh );
5751
5752 if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
5753 {
5754 bCallBase = false;
5755 rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
5756 }
5757 else
5758 {
5760 if( pData )
5761 {
5762 bCallBase = false;
5763 rSh.SetExtTextInputData( *pData );
5764 }
5765 }
5766 uno::Reference< frame::XDispatchRecorder > xRecorder =
5768 if(!xRecorder.is())
5769 {
5771 if (!rACfg.IsAutoTextTip() || !ShowAutoText(rSh.GetChunkForAutoText()))
5772 {
5773 SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
5774 if (pACorr && pACorr->GetSwFlags().bAutoCompleteWords)
5775 ShowAutoCorrectQuickHelp(rSh.GetPrevAutoCorrWord(*pACorr), *pACorr);
5776 }
5777 }
5778 }
5779
5780 if (rSh.HasReadonlySel())
5781 {
5782 // Inform the user that the request has been ignored.
5783 rSh.InfoReadOnlyDialog(true);
5784 }
5785 }
5786 break;
5787 case CommandEventId::CursorPos:
5788 // will be handled by the base class
5789 break;
5790
5791 case CommandEventId::PasteSelection:
5792 if( !m_rView.GetDocShell()->IsReadOnly() )
5793 {
5794 TransferableDataHelper aDataHelper(
5796 if( !aDataHelper.GetXTransferable().is() )
5797 break;
5798
5799 SotExchangeDest nDropDestination = GetDropDestination( rCEvt.GetMousePosPixel() );
5800 if( nDropDestination == SotExchangeDest::NONE )
5801 break;
5802 SotClipboardFormatId nDropFormat;
5803 sal_uInt8 nEventAction, nDropAction;
5804 SotExchangeActionFlags nActionFlags;
5805 nDropAction = SotExchange::GetExchangeAction(
5806 aDataHelper.GetDataFlavorExVector(),
5807 nDropDestination, EXCHG_IN_ACTION_COPY,
5808 EXCHG_IN_ACTION_COPY, nDropFormat,
5809 nEventAction,
5810 SotClipboardFormatId::NONE, nullptr,
5811 &nActionFlags );
5812 if( EXCHG_INOUT_ACTION_NONE != nDropAction )
5813 {
5814 const Point aDocPt( PixelToLogic( rCEvt.GetMousePosPixel() ) );
5815 SwTransferable::PasteData( aDataHelper, rSh, nDropAction, nActionFlags,
5816 nDropFormat, nDropDestination, false,
5817 false, &aDocPt, EXCHG_IN_ACTION_COPY,
5818 true );
5819 }
5820 }
5821 break;
5822 case CommandEventId::ModKeyChange :
5823 {
5824 const CommandModKeyData* pCommandData = rCEvt.GetModKeyData();
5825 if (!pCommandData->IsDown() && pCommandData->IsMod1() && !pCommandData->IsMod2())
5826 {
5827 sal_uInt16 nSlot = 0;
5828 if(pCommandData->IsLeftShift() && !pCommandData->IsRightShift())
5829 nSlot = SID_ATTR_PARA_LEFT_TO_RIGHT;
5830 else if(!pCommandData->IsLeftShift() && pCommandData->IsRightShift())
5831 nSlot = SID_ATTR_PARA_RIGHT_TO_LEFT;
5832 if(nSlot && SvtCTLOptions::IsCTLFontEnabled())
5834 }
5835 }
5836 break;
5837 case CommandEventId::InputLanguageChange :
5838 // i#42732 - update state of fontname if input language changes
5840 SetUseInputLanguage( true );
5841 break;
5842 case CommandEventId::SelectionChange:
5843 {
5845 rSh.SttCursorMove();
5846 rSh.GoStartSentence();
5847 rSh.GetCursor()->GetPoint()->AdjustContent(sal::static_int_cast<sal_uInt16, sal_uLong>(pData->GetStart()));
5848 rSh.SetMark();
5849 rSh.GetCursor()->GetMark()->AdjustContent(sal::static_int_cast<sal_uInt16, sal_uLong>(pData->GetEnd() - pData->GetStart()));
5850 rSh.EndCursorMove( true );
5851 }
5852 break;
5853 case CommandEventId::PrepareReconversion:
5854 if( rSh.HasSelection() )
5855 {
5856 SwPaM *pCursor = rSh.GetCursor();
5857
5858 if( rSh.IsMultiSelection() )
5859 {
5860 if (pCursor && !pCursor->HasMark() &&
5861 pCursor->GetPoint() == pCursor->GetMark())
5862 {
5863 rSh.GoPrevCursor();
5864 pCursor = rSh.GetCursor();
5865 }
5866
5867 // Cancel all selections other than the last selected one.
5868 while( rSh.GetCursor()->GetNext() != rSh.GetCursor() )
5869 delete rSh.GetCursor()->GetNext();
5870 }
5871
5872 if( pCursor )
5873 {
5874 SwNodeOffset nPosNodeIdx = pCursor->GetPoint()->GetNodeIndex();
5875 const sal_Int32 nPosIdx = pCursor->GetPoint()->GetContentIndex();
5876 SwNodeOffset nMarkNodeIdx = pCursor->GetMark()->GetNodeIndex();
5877 const sal_Int32 nMarkIdx = pCursor->GetMark()->GetContentIndex();
5878
5879 if( !rSh.GetCursor()->HasMark() )
5880 rSh.GetCursor()->SetMark();
5881
5882 rSh.SttCursorMove();
5883
5884 if( nPosNodeIdx < nMarkNodeIdx )
5885 {
5886 rSh.GetCursor()->GetPoint()->Assign(nPosNodeIdx, nPosIdx);
5887 rSh.GetCursor()->GetMark()->Assign(nPosNodeIdx,
5888 rSh.GetCursor()->GetPointContentNode()->Len());
5889 }
5890 else if( nPosNodeIdx == nMarkNodeIdx )
5891 {
5892 rSh.GetCursor()->GetPoint()->Assign(nPosNodeIdx, nPosIdx);
5893 rSh.GetCursor()->GetMark()->Assign(nMarkNodeIdx, nMarkIdx);
5894 }
5895 else
5896 {
5897 rSh.GetCursor()->GetMark()->Assign(nMarkNodeIdx, nMarkIdx);
5898 rSh.GetCursor()->GetPoint()->Assign(nMarkNodeIdx,
5899 rSh.GetCursor()->GetMarkContentNode()->Len());
5900 }
5901
5902 rSh.EndCursorMove( true );
5903 }
5904 }
5905 break;
5906 case CommandEventId::QueryCharPosition:
5907 {
5908 bool bVertical = rSh.IsInVerticalText();
5909 const SwPosition& rPos = *rSh.GetCursor()->GetPoint();
5910 SwDocShell* pDocSh = m_rView.GetDocShell();
5911 SwDoc *pDoc = pDocSh->GetDoc();
5912 SwExtTextInput* pInput = pDoc->GetExtTextInput( rPos.GetNode(), rPos.GetContentIndex() );
5913 if ( pInput )
5914 {
5915 const SwPosition& rStart = *pInput->Start();
5916 const SwPosition& rEnd = *pInput->End();
5917 sal_Int32 nSize = rEnd.GetContentIndex() - rStart.GetContentIndex();
5918 vcl::Window& rWin = rSh.GetView().GetEditWin();
5919 if ( nSize == 0 )
5920 {
5921 // When the composition does not exist, use Caret rect instead.
5922 const SwRect& aCaretRect ( rSh.GetCharRect() );
5923 tools::Rectangle aRect( aCaretRect.Left(), aCaretRect.Top(), aCaretRect.Right(), aCaretRect.Bottom() );
5924 rWin.SetCompositionCharRect( &aRect, 1, bVertical );
5925 }
5926 else
5927 {
5928 std::unique_ptr<tools::Rectangle[]> aRects(new tools::Rectangle[ nSize ]);
5929 int nRectIndex = 0;
5930 for ( sal_Int32 nIndex = rStart.GetContentIndex(); nIndex < rEnd.GetContentIndex(); ++nIndex )
5931 {
5932 const SwPosition aPos( rStart.GetNode(), rStart.GetNode().GetContentNode(), nIndex );
5933 SwRect aRect ( rSh.GetCharRect() );
5934 rSh.GetCharRectAt( aRect, &aPos );
5935 aRects[ nRectIndex ] = tools::Rectangle( aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom() );
5936 ++nRectIndex;
5937 }
5938 rWin.SetCompositionCharRect( aRects.get(), nSize, bVertical );
5939 }
5940 }
5941 bCallBase = false;
5942 }
5943 break;
5944 default:
5945 SAL_WARN("sw.ui", "unknown command.");
5946 break;
5947 }
5948 if (bCallBase)
5949 Window::Command(rCEvt);
5950}
5951
5952/* i#18686 select the object/cursor at the mouse
5953 position of the context menu request */
5955{
5956 const Point aDocPos( PixelToLogic( rMousePos ) );
5957 const bool bIsInsideSelectedObj( rSh.IsInsideSelectedObj( aDocPos ) );
5958 //create a synthetic mouse event out of the coordinates
5959 MouseEvent aMEvt(rMousePos);
5960 SdrView *pSdrView = rSh.GetDrawView();
5961 if ( pSdrView )
5962 {
5963 // no close of insert_draw and reset of
5964 // draw mode, if context menu position is inside a selected object.
5965 if ( !bIsInsideSelectedObj && m_rView.GetDrawFuncPtr() )
5966 {
5967
5969 m_rView.SetDrawFuncPtr(nullptr);
5972 rBind.Invalidate( SID_ATTR_SIZE );
5973 rBind.Invalidate( SID_TABLE_CELL );
5974 }
5975
5976 // if draw text is active and there's a text selection
5977 // at the mouse position then do nothing
5979 {
5980 OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
5981 ESelection aSelection = pOLV->GetSelection();
5982 if(!aSelection.IsZero())
5983 {
5984 SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
5985 bool bVertical = pOutliner->IsVertical();
5986 const EditEngine& rEditEng = pOutliner->GetEditEngine();
5987 Point aEEPos(aDocPos);
5988 const tools::Rectangle& rOutputArea = pOLV->GetOutputArea();
5989 // regard vertical mode
5990 if(bVertical)
5991 {
5992 aEEPos -= rOutputArea.TopRight();
5993 //invert the horizontal direction and exchange X and Y
5994 tools::Long nTemp = -aEEPos.X();
5995 aEEPos.setX( aEEPos.Y() );
5996 aEEPos.setY( nTemp );
5997 }
5998 else
5999 aEEPos -= rOutputArea.TopLeft();
6000
6001 EPosition aDocPosition = rEditEng.FindDocPosition(aEEPos);
6002 ESelection aCompare(aDocPosition.nPara, aDocPosition.nIndex);
6003 // make it a forward selection - otherwise the IsLess/IsGreater do not work :-(
6004 aSelection.Adjust();
6005 if(!(aCompare < aSelection) && !(aCompare > aSelection))
6006 {
6007 return;
6008 }
6009 }
6010
6011 }
6012
6013 if (pSdrView->MouseButtonDown( aMEvt, GetOutDev() ) )
6014 {
6015 pSdrView->MouseButtonUp( aMEvt, GetOutDev() );
6017 return;
6018 }
6019 }
6020 rSh.ResetCursorStack();
6021
6022 if ( EnterDrawMode( aMEvt, aDocPos ) )
6023 {
6024 return;
6025 }
6027 {
6028 StopInsFrame();
6029 rSh.Edit();
6030 }
6031
6032 UpdatePointer( aDocPos );
6033
6034 if( !rSh.IsSelFrameMode() &&
6035 !GetView().GetViewFrame().GetDispatcher()->IsLocked() )
6036 {
6037 // Test if there is a draw object at that position and if it should be selected.
6038 bool bShould = rSh.ShouldObjectBeSelected(aDocPos);
6039
6040 if(bShould)
6041 {
6042 m_rView.NoRotate();
6043 rSh.HideCursor();
6044
6045 bool bUnLockView = !rSh.IsViewLocked();
6046 rSh.LockView( true );
6047 bool bSelObj = rSh.SelectObj( aDocPos );
6048 if( bUnLockView )
6049 rSh.LockView( false );
6050
6051 if( bSelObj )
6052 {
6053 // in case the frame was deselected in the macro
6054 // just the cursor has to be displayed again.
6056 rSh.ShowCursor();
6057 else
6058 {
6059 if (rSh.IsFrameSelected() && m_rView.GetDrawFuncPtr())
6060 {
6062 m_rView.SetDrawFuncPtr(nullptr);
6064 m_rView.AttrChangedNotify(nullptr);
6065 }
6066
6067 rSh.EnterSelFrameMode( &aDocPos );
6068 g_bFrameDrag = true;
6069 UpdatePointer( aDocPos );
6070 return;
6071 }
6072 }
6073
6074 if (!m_rView.GetDrawFuncPtr())
6075 rSh.ShowCursor();
6076 }
6077 }
6078 else if ( rSh.IsSelFrameMode() &&
6079 (m_aActHitType == SdrHitKind::NONE ||
6080 !bIsInsideSelectedObj))
6081 {
6082 m_rView.NoRotate();
6083 bool bUnLockView = !rSh.IsViewLocked();
6084 rSh.LockView( true );
6085
6086 if ( rSh.IsSelFrameMode() )
6087 {
6088 rSh.UnSelectFrame();
6089 rSh.LeaveSelFrameMode();
6090 m_rView.AttrChangedNotify(nullptr);
6091 }
6092
6093 bool bSelObj = rSh.SelectObj( aDocPos, 0/*nFlag*/ );
6094 if( bUnLockView )
6095 rSh.LockView( false );
6096
6097 if( !bSelObj )
6098 {
6099 // move cursor here so that it is not drawn in the
6100 // frame at first; ShowCursor() happens in LeaveSelFrameMode()
6101 g_bValidCursorPos = !(CRSR_POSCHG & rSh.CallSetCursor(&aDocPos, false));
6102 rSh.LeaveSelFrameMode();
6104 m_rView.AttrChangedNotify(nullptr);
6105 }
6106 else
6107 {
6108 rSh.HideCursor();
6109 rSh.EnterSelFrameMode( &aDocPos );
6110 rSh.SelFlyGrabCursor();
6111 rSh.MakeSelVisible();
6112 g_bFrameDrag = true;
6113 if( rSh.IsFrameSelected() &&
6115 {
6117 m_rView.SetDrawFuncPtr(nullptr);
6119 m_rView.AttrChangedNotify(nullptr);
6120 }
6121 UpdatePointer( aDocPos );
6122 }
6123 }
6124 else if ( rSh.IsSelFrameMode() && bIsInsideSelectedObj )
6125 {
6126 // Object at the mouse cursor is already selected - do nothing
6127 return;
6128 }
6129
6130 if ( rSh.IsGCAttr() )
6131 {
6132 rSh.GCAttr();
6133 rSh.ClearGCAttr();
6134 }
6135
6136 bool bOverSelect = rSh.TestCurrPam( aDocPos );
6137 bool bOverURLGrf = false;
6138 if( !bOverSelect )
6139 bOverURLGrf = bOverSelect = nullptr != rSh.IsURLGrfAtPos( aDocPos );
6140
6141 if ( !bOverSelect )
6142 {
6143 // create only temporary move context because otherwise
6144 // the query against the content form doesn't work!!!
6145 SwMvContext aMvContext( &rSh );
6146 rSh.CallSetCursor(&aDocPos, false);
6147 }
6148 if( !bOverURLGrf )
6149 {
6150 const SelectionType nSelType = rSh.GetSelectionType();
6151 if( nSelType == SelectionType::Ole ||
6152 nSelType == SelectionType::Graphic )
6153 {
6154 SwMvContext aMvContext( &rSh );
6155 if( !rSh.IsFrameSelected() )
6156 rSh.GotoNextFly();
6157 rSh.EnterSelFrameMode();
6158 }
6159 }
6160}
6161
6163{
6164 // determine Shell
6165 SfxShell* pShell;
6166 SfxDispatcher* pDispatcher = rView.GetViewFrame().GetDispatcher();
6167 for(sal_uInt16 i = 0; true; ++i )
6168 {
6169 pShell = pDispatcher->GetShell( i );
6170 if( !pShell || dynamic_cast< const SwTextShell *>( pShell ) != nullptr )
6171 break;
6172 }
6173 return pShell;
6174}
6175
6176IMPL_LINK_NOARG(SwEditWin, KeyInputFlushHandler, Timer *, void)
6177{
6178 FlushInBuffer();
6179}
6180
6182{
6184}
6185
6187{
6188 delete s_pQuickHlpData;
6189}
6190/* i#3370 - remove quick help to prevent saving
6191 * of autocorrection suggestions */
6193{
6196}
6197
6198IMPL_LINK_NOARG(SwEditWin, TemplateTimerHdl, Timer *, void)
6199{
6200 SetApplyTemplate(SwApplyTemplate());
6201}
6202
6204{
6205 if ( !m_bChainMode )
6206 StopInsFrame();
6207
6208 m_pUserMarker.reset();
6209
6210 m_bChainMode = bOn;
6211
6212 static sal_uInt16 aInva[] =
6213 {
6215 };
6217}
6218
6219uno::Reference< css::accessibility::XAccessible > SwEditWin::CreateAccessible()
6220{
6221#if !ENABLE_WASM_STRIP_ACCESSIBILITY
6222 SolarMutexGuard aGuard; // this should have happened already!!!
6224 OSL_ENSURE( pSh, "no writer shell, no accessible object" );
6225 uno::Reference<
6226 css::accessibility::XAccessible > xAcc;
6227 if( pSh )
6228 xAcc = pSh->CreateAccessible();
6229
6230 return xAcc;
6231#else
6232 return nullptr;
6233#endif
6234}
6235
6237{
6238 m_aHelpStrings.clear();
6239 m_aHelpStrings.swap( rCpy.m_aHelpStrings );
6240
6242 nCurArrPos = rCpy.nCurArrPos;
6244 m_bIsTip = rCpy.m_bIsTip;
6246}
6247
6249{
6252 nTipId = nullptr;
6253 m_aHelpStrings.clear();
6254 m_bIsTip = true;
6255 m_bIsAutoText = true;
6256}
6257
6258void QuickHelpData::Start(SwWrtShell& rSh, const bool bRestart)
6259{
6260 if (bRestart)
6261 {
6262 nCurArrPos = 0;
6263 }
6264 m_bIsDisplayed = true;
6265
6266 vcl::Window& rWin = rSh.GetView().GetEditWin();
6267 if( m_bIsTip )
6268 {
6269 Point aPt( rWin.OutputToScreenPixel( rWin.LogicToPixel(
6270 rSh.GetCharRect().Pos() )));
6271 aPt.AdjustY( -3 );
6272 nTipId = Help::ShowPopover(&rWin, tools::Rectangle( aPt, Size( 1, 1 )),
6273 CurStr(),
6274 QuickHelpFlags::Left | QuickHelpFlags::Bottom);
6275 }
6276 else
6277 {
6278 OUString sStr(CurStr());
6279 sStr = sStr.copy(CurLen());
6280 sal_uInt16 nL = sStr.getLength();
6281 const ExtTextInputAttr nVal = ExtTextInputAttr::DottedUnderline |
6282 ExtTextInputAttr::Highlight;
6283 const std::vector<ExtTextInputAttr> aAttrs( nL, nVal );
6284 CommandExtTextInputData aCETID( sStr, aAttrs.data(), nL,
6285 0, false );
6286
6287 //fdo#33092. If the current input language is the default
6288 //language that text would appear in if typed, then don't
6289 //force a language on for the ExtTextInput.
6290 LanguageType eInputLanguage = rWin.GetInputLanguage();
6291 if (lcl_isNonDefaultLanguage(eInputLanguage,
6292 rSh.GetView(), sStr) == INVALID_HINT)
6293 {
6294 eInputLanguage = LANGUAGE_DONTKNOW;
6295 }
6296
6297 rSh.CreateExtTextInput(eInputLanguage);
6298 rSh.SetExtTextInputData( aCETID );
6299 }
6300}
6301
6303{
6304 if( !m_bIsTip )
6305 rSh.DeleteExtTextInput( false );
6306 else if( nTipId )
6307 {
6308 vcl::Window& rWin = rSh.GetView().GetEditWin();
6309 Help::HidePopover(&rWin, nTipId);
6310 }
6311 ClearContent();
6312}
6313
6314void QuickHelpData::FillStrArr( SwWrtShell const & rSh, const OUString& rWord )
6315{
6316 enum Capitalization { CASE_LOWER, CASE_UPPER, CASE_SENTENCE, CASE_OTHER };
6317
6318 // Determine word capitalization
6319 const CharClass& rCC = GetAppCharClass();
6320 const OUString sWordLower = rCC.lowercase( rWord );
6321 Capitalization aWordCase = CASE_OTHER;
6322 if ( !rWord.isEmpty() )
6323 {
6324 if ( rWord[0] == sWordLower[0] )
6325 {
6326 if ( rWord == sWordLower )
6327 aWordCase = CASE_LOWER;
6328 }
6329 else
6330 {
6331 // First character is not lower case i.e. assume upper or title case
6332 OUString sWordSentence = sWordLower.replaceAt( 0, 1, rtl::OUStringChar(rWord[0]) );
6333 if ( rWord == sWordSentence )
6334 aWordCase = CASE_SENTENCE;
6335 else
6336 {
6337 if ( rWord == rCC.uppercase( rWord ) )
6338 aWordCase = CASE_UPPER;
6339 }
6340 }
6341 }
6342
6344 rCalendar.LoadDefaultCalendar( rSh.GetCurLang() );
6345
6346 // Add matching calendar month and day names
6347 for ( const auto& aNames : { rCalendar.getMonths(), rCalendar.getDays() } )
6348 {
6349 for ( const auto& rName : aNames )
6350 {
6351 const OUString& rStr( rName.FullName );
6352 // Check string longer than word and case insensitive match
6353 if( rStr.getLength() > rWord.getLength() &&
6354 rCC.lowercase( rStr, 0, rWord.getLength() ) == sWordLower )
6355 {
6356 OUString sStr;
6357
6358 //fdo#61251 if it's an exact match, ensure unchanged replacement
6359 //exists as a candidate
6360 if (rStr.startsWith(rWord))
6361 m_aHelpStrings.emplace_back(rStr, rWord.getLength());
6362 else
6363 sStr = rStr; // to be added if no case conversion is performed below
6364
6365 if ( aWordCase == CASE_LOWER )
6366 sStr = rCC.lowercase(rStr);
6367 else if ( aWordCase == CASE_SENTENCE )
6368 sStr = rCC.lowercase(rStr).replaceAt(0, 1, rtl::OUStringChar(rStr[0]));
6369 else if ( aWordCase == CASE_UPPER )
6370 sStr = rCC.uppercase(rStr);
6371
6372 if (!sStr.isEmpty())
6373 m_aHelpStrings.emplace_back(sStr, rWord.getLength());
6374 }
6375 }
6376 }
6377
6378 // Add matching current date in ISO 8601 format, for example 2016-01-30
6379 OUString rStrToday;
6380
6381 // do not suggest for single years, for example for "2016",
6382 // only for "201" or "2016-..." (to avoid unintentional text
6383 // insertion at line ending, for example typing "30 January 2016")
6384 if (!rWord.isEmpty() && rWord.getLength() != 4 && rWord[0] == '2')
6385 {
6386 rStrToday = utl::toISO8601(DateTime(Date(Date::SYSTEM)).GetUNODateTime());
6387 if (rStrToday.startsWith(rWord))
6388 m_aHelpStrings.emplace_back(rStrToday, rWord.getLength());
6389 }
6390
6391 // Add matching words from AutoCompleteWord list
6393 std::vector<OUString> strings;
6394
6395 if ( !rACList.GetWordsMatching( rWord, strings ) )
6396 return;
6397
6398 for (const OUString & aCompletedString : strings)
6399 {
6400 // when we have a matching current date, avoid to suggest
6401 // other words with the same matching starting characters,
6402 // for example 2016-01-3 instead of 2016-01-30
6403 if (!rStrToday.isEmpty() && aCompletedString.startsWith(rWord))
6404 continue;
6405
6406 OUString sStr;
6407
6408 //fdo#61251 if it's an exact match, ensure unchanged replacement
6409 //exists as a candidate
6410 if (aCompletedString.startsWith(rWord))
6411 m_aHelpStrings.emplace_back(aCompletedString, rWord.getLength());
6412 else
6413 sStr = aCompletedString; // to be added if no case conversion is performed below
6414
6415 if (aWordCase == CASE_LOWER)
6416 sStr = rCC.lowercase(aCompletedString);
6417 else if (aWordCase == CASE_SENTENCE)
6418 sStr = rCC.lowercase(aCompletedString)
6419 .replaceAt(0, 1, rtl::OUStringChar(aCompletedString[0]));
6420 else if (aWordCase == CASE_UPPER)
6421 sStr = rCC.uppercase(aCompletedString);
6422
6423 if (!sStr.isEmpty())
6424 m_aHelpStrings.emplace_back(aCompletedString, rWord.getLength());
6425 }
6426}
6427
6428namespace {
6429
6430class CompareIgnoreCaseAsciiFavorExact
6431{
6432 const OUString &m_rOrigWord;
6433public:
6434 explicit CompareIgnoreCaseAsciiFavorExact(const OUString& rOrigWord)
6435 : m_rOrigWord(rOrigWord)
6436 {
6437 }
6438
6439 bool operator()(const std::pair<OUString, sal_uInt16>& s1,
6440 const std::pair<OUString, sal_uInt16>& s2) const
6441 {
6442 int nRet = s1.first.compareToIgnoreAsciiCase(s2.first);
6443 if (nRet == 0)
6444 {
6445 //fdo#61251 sort stuff that starts with the exact rOrigWord before
6446 //another ignore-case candidate
6447 int n1StartsWithOrig = s1.first.startsWith(m_rOrigWord) ? 0 : 1;
6448 int n2StartsWithOrig = s2.first.startsWith(m_rOrigWord) ? 0 : 1;
6449 return n1StartsWithOrig < n2StartsWithOrig;
6450 }
6451 return nRet < 0;
6452 }
6453};
6454
6455struct EqualIgnoreCaseAscii
6456{
6457 bool operator()(const std::pair<OUString, sal_uInt16>& s1,
6458 const std::pair<OUString, sal_uInt16>& s2) const
6459 {
6460 return s1.first.equalsIgnoreAsciiCase(s2.first);
6461 }
6462};
6463
6464} // anonymous namespace
6465
6466// TODO Implement an i18n aware sort
6467void QuickHelpData::SortAndFilter(const OUString &rOrigWord)
6468{
6469 std::sort( m_aHelpStrings.begin(),
6470 m_aHelpStrings.end(),
6471 CompareIgnoreCaseAsciiFavorExact(rOrigWord) );
6472
6473 const auto& it
6474 = std::unique(m_aHelpStrings.begin(), m_aHelpStrings.end(), EqualIgnoreCaseAscii());
6475 m_aHelpStrings.erase( it, m_aHelpStrings.end() );
6476
6477 nCurArrPos = 0;
6478}
6479
6480// For a given chunk of typed text between 3 and 9 characters long that may start at a word boundary
6481// or in a whitespace and may include whitespaces, SwEditShell::GetChunkForAutoTextcreates a list of
6482// possible candidates for long AutoText names. Let's say, we have typed text "lorem ipsum dr f";
6483// and the cursor is right after the "f". SwEditShell::GetChunkForAutoText would take " dr f",
6484// since it's the longest chunk to the left of the cursor no longer than 9 characters, not starting
6485// in the middle of a word. Then it would create this list from it (in this order, longest first):
6486// " dr f"
6487// " dr f"
6488// "dr f"
6489// It cannot add "r f", because it starts in the middle of the word "dr"; also it cannot give " f",
6490// because it's only 2 characters long.
6491// Now the result of SwEditShell::GetChunkForAutoText is passed here to SwEditWin::ShowAutoText, and
6492// then to SwGlossaryList::HasLongName, where all existing autotext entries' long names are tested
6493// if they start with one of the list elements. The matches are sorted according the position of the
6494// candidate that matched first, then alphabetically inside the group of suggestions for a given
6495// candidate. Say, if we have these AutoText entry long names:
6496// "Dr Frodo"
6497// "Dr Credo"
6498// "Or Bilbo"
6499// "dr foo"
6500// " Dr Fuzz"
6501// " dr Faust"
6502// the resulting list would be:
6503// " Dr Fuzz" -> matches the first (longest) item in the candidates list
6504// " dr Faust" -> matches the second candidate item
6505// "Dr Foo" -> first item of the two matching the third candidate; alphabetically sorted
6506// "Dr Frodo" -> second item of the two matching the third candidate; alphabetically sorted
6507// Each of the resulting suggestions knows the length of the candidate it replaces, so accepting the
6508// first suggestion would replace 6 characters before cursor, while tabbing to and accepting the
6509// last suggestion would replace only 4 characters to the left of cursor.
6510bool SwEditWin::ShowAutoText(const std::vector<OUString>& rChunkCandidates)
6511{
6513 if (!rChunkCandidates.empty())
6514 {
6516 pList->HasLongName(rChunkCandidates, s_pQuickHlpData->m_aHelpStrings);
6517 }
6518
6519 if (!s_pQuickHlpData->m_aHelpStrings.empty())
6520 {
6522 }
6523 return !s_pQuickHlpData->m_aHelpStrings.empty();
6524}
6525
6527 const OUString& rWord, SvxAutoCorrect& rACorr )
6528{
6529 if (rWord.isEmpty())
6530 return;
6533
6534 if( s_pQuickHlpData->m_aHelpStrings.empty() &&
6536 {
6539
6540 // Get the necessary data to show help text.
6541 s_pQuickHlpData->FillStrArr( rSh, rWord );
6542 }
6543
6544 if( !s_pQuickHlpData->m_aHelpStrings.empty() )
6545 {
6547 s_pQuickHlpData->Start(rSh, true);
6548 }
6549}
6550
6551bool SwEditWin::IsInHeaderFooter( const Point &rDocPt, FrameControlType &rControl ) const
6552{
6554 const SwPageFrame* pPageFrame = rSh.GetLayout()->GetPageAtPos( rDocPt );
6555
6556 if ( pPageFrame && pPageFrame->IsOverHeaderFooterArea( rDocPt, rControl ) )
6557 return true;
6558
6560 {
6562 Point aPoint( LogicToPixel( rDocPt ) );
6563
6565 {
6566 SwFrameControlPtr pControl = rMgr.GetControl( FrameControlType::Header, pPageFrame );
6567 if ( pControl && pControl->Contains( aPoint ) )
6568 {
6569 rControl = FrameControlType::Header;
6570 return true;
6571 }
6572 }
6573
6575 {
6576 SwFrameControlPtr pControl = rMgr.GetControl( FrameControlType::Footer, pPageFrame );
6577 if ( pControl && pControl->Contains( aPoint ) )
6578 {
6579 rControl = FrameControlType::Footer;
6580 return true;
6581 }
6582 }
6583 }
6584
6585 return false;
6586}
6587
6588bool SwEditWin::IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& rControl, bool& bOverFly, bool& bPageAnchored ) const
6589{
6590 bool bRet = false;
6591 Point aPt( rDocPos );
6593 SwPaM aPam( *rSh.GetCurrentShellCursor().GetPoint() );
6594 rSh.GetLayout()->GetModelPositionForViewPoint( aPam.GetPoint(), aPt, nullptr, true );
6595
6596 const SwStartNode* pStartFly = aPam.GetPoint()->GetNode().FindFlyStartNode();
6597 if ( pStartFly )
6598 {
6599 bOverFly = true;
6600 SwFrameFormat* pFlyFormat = pStartFly->GetFlyFormat( );
6601 if ( pFlyFormat )
6602 {
6603 const SwNode* pAnchorNode = pFlyFormat->GetAnchor( ).GetAnchorNode( );
6604 if ( pAnchorNode )
6605 {
6606 bool bInHeader = pAnchorNode->FindHeaderStartNode( ) != nullptr;
6607 bool bInFooter = pAnchorNode->FindFooterStartNode( ) != nullptr;
6608
6609 bRet = bInHeader || bInFooter;
6610 if ( bInHeader )
6611 rControl = FrameControlType::Header;
6612 else if ( bInFooter )
6613 rControl = FrameControlType::Footer;
6614 }
6615 else
6616 bPageAnchored = pFlyFormat->GetAnchor( ).GetAnchorId( ) == RndStdIds::FLY_AT_PAGE;
6617 }
6618 }
6619 else
6620 bOverFly = false;
6621 return bRet;
6622}
6623
6625{
6626 if ( bNew || m_bUseInputLanguage )
6627 {
6629 rBind.Invalidate( SID_ATTR_CHAR_FONT );
6630 rBind.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
6631 }
6632 m_bUseInputLanguage = bNew;
6633}
6634
6636{
6638
6639 if (rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit())
6641
6642 OUString sReturn;
6643 if( rSh.HasSelection() && !rSh.IsMultiSelection() && rSh.IsSelOnePara() )
6645 else if( !rSh.HasSelection() )
6646 {
6647 bool bUnLockView = !rSh.IsViewLocked();
6648 rSh.LockView(true);
6649
6650 // store shell state *before* Push
6651 ::std::optional<SwCallLink> aLink(std::in_place, rSh);
6652 rSh.Push();
6653
6654 // disable accessible events for internal-only helper cursor
6655 const bool bSendAccessibleEventOld = rSh.IsSendAccessibleCursorEvents();
6657
6658 // get the sentence around the cursor
6659 rSh.HideCursor();
6660 rSh.GoStartSentence();
6661 rSh.SetMark();
6662 rSh.GoEndSentence();
6664
6666 rSh.SetSendAccessibleCursorEvents(bSendAccessibleEventOld);
6667 rSh.HideCursor();
6668
6669 if (bUnLockView)
6670 rSh.LockView(false);
6671 }
6672
6673 return sReturn;
6674}
6675
6677{
6679
6680 if (rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit())
6682
6683 Selection aSel(0, 0);
6684 if( rSh.HasSelection() )
6685 {
6686 OUString sReturn;
6688 aSel = Selection( 0, sReturn.getLength() );
6689 }
6690 else if (rSh.GetCursor()->GetPoint()->GetNode().GetTextNode())
6691 {
6692 bool bUnLockView = !rSh.IsViewLocked();
6693 rSh.LockView(true);
6694
6695 // Return the position of the visible cursor in the sentence
6696 // around the visible cursor.
6697 TextFrameIndex const nPos(rSh.GetCursorPointAsViewIndex());
6698
6699 // store shell state *before* Push
6700 ::std::optional<SwCallLink> aLink(std::in_place, rSh);
6701 rSh.Push();
6702
6703 // disable accessible events for internal-only helper cursor
6704 const bool bSendAccessibleEventOld = rSh.IsSendAccessibleCursorEvents();
6706
6707 rSh.HideCursor();
6708 rSh.GoStartSentence();
6709 TextFrameIndex const nStartPos(rSh.GetCursorPointAsViewIndex());
6710
6712 rSh.SetSendAccessibleCursorEvents(bSendAccessibleEventOld);
6713 rSh.ShowCursor();
6714
6715 if (bUnLockView)
6716 rSh.LockView(false);
6717
6718 aSel = Selection(sal_Int32(nPos - nStartPos), sal_Int32(nPos - nStartPos));
6719 }
6720
6721 return aSel;
6722}
6723
6725{
6727
6728 if (rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit())
6729 return rSh.GetDrawView()->GetTextEditOutlinerView()->DeleteSurroundingText(rSelection);
6730
6731 if (rSh.HasSelection())
6732 return false;
6733
6734 // rSelection is relative to the start of the sentence, so find that and
6735 // adjust the range by it
6736 rSh.Push();
6737
6738 // disable accessible events for internal-only helper cursor
6739 const bool bSendAccessibleEventOld = rSh.IsSendAccessibleCursorEvents();
6741
6742 rSh.HideCursor();
6743 rSh.GoStartSentence();
6744 TextFrameIndex const nStartPos(rSh.GetCursorPointAsViewIndex());
6745
6747 rSh.SetSendAccessibleCursorEvents(bSendAccessibleEventOld);
6748 rSh.ShowCursor();
6749
6750 if (rSh.SelectTextView(nStartPos + TextFrameIndex(rSelection.Min()), nStartPos + TextFrameIndex(rSelection.Max())))
6751 {
6752 rSh.Delete(false);
6753 return true;
6754 }
6755
6756 return false;
6757}
6758
6760{
6762}
6763
6764void SwEditWin::SetCursorTwipPosition(const Point& rPosition, bool bPoint, bool bClearMark)
6765{
6766 if (SdrView* pSdrView = m_rView.GetWrtShell().GetDrawView())
6767 {
6768 // Editing shape text, then route the call to editeng.
6769 if (pSdrView->GetTextEditObject())
6770 {
6771 EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView();
6772 rEditView.SetCursorLogicPosition(rPosition, bPoint, bClearMark);
6773 return;
6774 }
6775 }
6776
6777 if (m_rView.GetPostItMgr())
6778 {
6780 {
6781 // Editing postit text.
6782 pWin->SetCursorLogicPosition(rPosition, bPoint, bClearMark);
6783 return;
6784 }
6785 }
6786
6787 // Not an SwWrtShell, as that would make SwCursorShell::GetCursor() inaccessible.
6788 SwEditShell& rShell = m_rView.GetWrtShell();
6789
6790 bool bCreateSelection = false;
6791 {
6792 SwMvContext aMvContext(&rShell);
6793 if (bClearMark)
6794 rShell.ClearMark();
6795 else
6796 bCreateSelection = !rShell.HasMark();
6797
6798 if (bCreateSelection)
6800
6801 // If the mark is to be updated, then exchange the point and mark before
6802 // and after, as we can't easily set the mark.
6803 if (!bPoint)
6804 rShell.getShellCursor(/*bBlock=*/false)->Exchange();
6805 rShell.SetCursor(rPosition);
6806 if (!bPoint)
6807 rShell.getShellCursor(/*bBlock=*/false)->Exchange();
6808 }
6809
6810 if (bCreateSelection)
6812}
6813
6814void SwEditWin::SetGraphicTwipPosition(bool bStart, const Point& rPosition)
6815{
6816 if (bStart)
6817 {
6818 MouseEvent aClickEvent(rPosition, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
6819 MouseButtonDown(aClickEvent);
6820 MouseEvent aMoveEvent(Point(rPosition.getX() + MIN_MOVE + 1, rPosition.getY()), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT);
6821 MouseMove(aMoveEvent);
6822 }
6823 else
6824 {
6825 MouseEvent aMoveEvent(Point(rPosition.getX() - MIN_MOVE - 1, rPosition.getY()), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT);
6826 MouseMove(aMoveEvent);
6827 MouseEvent aClickEvent(rPosition, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
6828 MouseButtonUp(aClickEvent);
6829 }
6830}
6831
6833{
6835}
6836
6837void SwEditWin::ToggleOutlineContentVisibility(const size_t nOutlinePos, const bool bSubs)
6838{
6839 // bSubs purpose is to set all sub level outline content to the same visibility as
6840 // nOutlinePos outline content visibility is toggled. It is only applicable when not treating
6841 // sub outline levels as content.
6842 SwWrtShell& rSh = GetView().GetWrtShell();
6843
6844 if (GetView().GetDrawView()->IsTextEdit())
6845 rSh.EndTextEdit();
6846 if (GetView().IsDrawMode())
6848 rSh.EnterStdMode();
6849
6850 if (!bSubs || rSh.GetViewOptions()->IsTreatSubOutlineLevelsAsContent())
6851 {
6852 SwNode* pNode = rSh.GetNodes().GetOutLineNds()[nOutlinePos];
6853 bool bVisible = true;
6856 }
6857 else if (bSubs)
6858 {
6859 // also toggle sub levels to the same content visibility
6860 SwOutlineNodes::size_type nPos = nOutlinePos;
6861 SwOutlineNodes::size_type nOutlineNodesCount
6863 int nLevel = rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos);
6864 bool bVisible = rSh.IsOutlineContentVisible(nOutlinePos);
6865 do
6866 {
6868 rSh.GetNodes().GetOutLineNds()[nPos]->GetTextNode()->SetAttrOutlineContentVisible(!bVisible);
6869 } while (++nPos < nOutlineNodesCount
6871 }
6872
6874 rSh.GotoOutline(nOutlinePos);
6875 rSh.SetModified();
6876 GetView().GetDocShell()->Broadcast(SfxHint(SfxHintId::DocChanged));
6877}
6878
6879/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< SwFrameControl > SwFrameControlPtr
AnyEventRef aEvent
static bool AnyInput(VclInputFlags nType=VCL_INPUT_ANY)
static bool IsHeadlessModeEnabled()
css::uno::Sequence< css::i18n::CalendarItem2 > getDays() const
css::uno::Sequence< css::i18n::CalendarItem2 > getMonths() const
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
css::i18n::UnicodeScript getScript(const OUString &rStr, sal_Int32 nPos) const
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
const CommandModKeyData * GetModKeyData() const
const CommandSelectionChangeData * GetSelectionChangeData() const
const CommandExtTextInputData * GetExtTextInputData() const
bool IsMouseEvent() const
bool IsRightShift() const
bool IsDown() const
bool IsMod2() const
bool IsMod1() const
bool IsLeftShift() const
EPosition FindDocPosition(const Point &rDocPos) const
void SetCursorLogicPosition(const Point &rPosition, bool bPoint, bool bClearMark)
static void * ShowPopover(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rText, QuickHelpFlags nStyle)
static void HidePopover(vcl::Window const *pParent, void *nId)
virtual SdrLayerID GetHellId() const =0
virtual void ClearFieldActivation()=0
virtual tSortedOutlineNodeList::size_type getOutlineNodesCount() const =0
virtual int getOutlineLevel(const tSortedOutlineNodeList::size_type nIdx) const =0
sal_Unicode GetCharCode() const
const vcl::KeyCode & GetKeyCode() const
sal_uInt16 GetRepeat() const
bool IsMod1() const
MouseEventModifiers GetMode() const
bool IsSynthetic() const
sal_uInt16 GetModifier() const
sal_uInt16 GetClicks() const
sal_uInt16 GetButtons() const
const Point & GetPosPixel() const
bool IsShift() const
static bool isNonLatinWestern(LanguageType nLang)
bool Command(const CommandEvent &rCEvt)
OUString GetSurroundingText() const
tools::Rectangle const & GetOutputArea() const
ESelection GetSelection() const
Selection GetSurroundingTextSelection() const
bool DeleteSurroundingText(const Selection &rRange)
GDIMetaFile * GetConnectMetaFile() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
virtual void MovAction(const Point &rPnt) override
virtual void TakeActionRect(tools::Rectangle &rRect) const override
bool IsNoSnap() const
bool EndDragObj(bool bCopy=false)
virtual bool BegDragObj(const Point &rPnt, OutputDevice *pOut, SdrHdl *pHdl, short nMinMov=-3, SdrDragMethod *pForcedMeth=nullptr)
bool IsDragObj() const
void MoveAllMarked(const Size &rSiz, bool bCopy=false)
void SetFocusHdl(SdrHdl *pNew)
SdrHdl * GetFocusHdl() const
SdrHdl * GetHdl(size_t nNum) const
void SetSelected(bool bJa=true)
SdrHdlKind GetKind() const
bool IsCornerHdl() const
void SetPos(const Point &rPnt)
const Point & GetPos() 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
SdrObject * PickObj(const Point &rPnt, short nTol, SdrPageView *&rpPV, SdrSearchOptions nOptions, SdrObject **ppRootObj, bool *pbHitPassDirect=nullptr) const
SdrDragMode GetDragMode() const
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
const tools::Rectangle & GetAllMarkedRect() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
const OutlinerView * GetTextEditOutlinerView() const
virtual bool IsTextEdit() const final override
const SdrOutliner * GetTextEditOutliner() const
const SdrPageView * pPageView
virtual SdrLayerID GetLayer() const
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const
virtual const tools::Rectangle & GetLogicRect() const
void SetHitTolerancePixel(sal_uInt16 nVal)
const SdrDragStat & GetDragStat() const
sal_uInt16 getHitTolLog() const
void SetOrtho(bool bOn)
void SetSnapEnabled(bool bOn)
void SetAngleSnapEnabled(bool bOn)
bool IsSnapEnabled() const
virtual bool MouseButtonDown(const MouseEvent &rMEvt, OutputDevice *pWin) override
bool KeyInput(const KeyEvent &rKEvt, vcl::Window *pWin) override
virtual bool MouseButtonUp(const MouseEvent &rMEvt, OutputDevice *pWin) override
SdrHitKind PickAnything(const MouseEvent &rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent &rVEvt) const
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
tools::Long Min() const
tools::Long Max() const
void SetState(const SfxItemSet &rSet)
void Update(sal_uInt16 nId)
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
void Invalidate(sal_uInt16 nId)
const css::uno::Reference< css::frame::XDispatchRecorder > & GetRecorder() const
void InvalidateAll(bool bWithMsg)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
void ExecutePopup(const OUString &rResName, vcl::Window *pWin=nullptr, const Point *pPos=nullptr)
SfxShell * GetShell(sal_uInt16 nIdx) const
bool IsObjectInPlaceActive() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static void notifyInvalidation(SfxViewShell const *pThisView, tools::Rectangle const *)
SfxProgress * GetProgress() const
bool IsReadOnly() const
void AppendItem(const SfxPoolItem &)
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
void ToggleChildWindow(sal_uInt16)
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
SfxChildWindow * GetChildWindow(sal_uInt16)
virtual SfxObjectShell * GetObjectShell() override
SfxViewFrame & GetViewFrame() const
SfxInPlaceClient * GetIPClient() const
virtual bool KeyInput(const KeyEvent &rKeyEvent)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static sal_uInt8 GetExchangeAction(const DataFlavorExVector &rDataFlavorExVector, SotExchangeDest nDestination, sal_uInt16 nSourceOptions, sal_uInt8 nUserAction, SotClipboardFormatId &rFormat, sal_uInt8 &rDefaultAction, SotClipboardFormatId nOnlyTestFormat=SotClipboardFormatId::NONE, const css::uno::Reference< css::datatransfer::XTransferable > *pxTransferable=nullptr, SotExchangeActionFlags *pActionFlags=nullptr)
static bool IsCTLFontEnabled()
static bool IsCTLSequenceCheckingTypeAndReplace()
static bool IsCTLSequenceChecking()
static bool IsCTLSequenceCheckingRestricted()
bool IsIgnoreLanguageChange() const
bool IsAutoFormatByInput() const
SvxAutoCorrect * GetAutoCorrect()
static SvxAutoCorrCfg & Get()
bool IsAutoTextTip() const
bool IsAutoCorrFlag(ACFlags nFlag) const
static bool IsAutoCorrectChar(sal_Unicode cChar)
SvxSwAutoFormatFlags & GetSwFlags()
const SvxMacroTableDtor & GetMacroTable() const
const SvxMacro * Get(SvMacroItemId nEvent) const
const OUString & GetTargetFrame() const
const OUString & GetURL() const
Point m_aLastPos
Definition: edtwin.cxx:216
bool m_bTopRightHandle
Definition: edtwin.cxx:217
Point m_aHdlPos
Definition: edtwin.cxx:215
SdrHdl * GetHdl() const
Definition: edtwin.cxx:229
void ChgHdl(SdrHdl *pNew)
Definition: edtwin.cxx:230
Point GetPosForHitTest(const OutputDevice &rOut)
Definition: edtwin.cxx:238
void SetLastPos(const Point &rNew)
Definition: edtwin.cxx:226
void SetPos(const Point &rNew)
Definition: edtwin.cxx:227
const Point & GetLastPos() const
Definition: edtwin.cxx:225
SdrHdl * m_pHdl
Definition: edtwin.cxx:214
SwAnchorMarker(SdrHdl *pH)
Definition: edtwin.cxx:219
const Point & GetHdlPos() const
Definition: edtwin.cxx:228
bool GetWordsMatching(std::u16string_view aMatch, std::vector< OUString > &aWords) const
Return all words matching a given prefix.
Definition: acmplwrd.cxx:352
static SwBreakIt * Get()
Definition: breakit.cxx:48
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:63
void LoadDefaultCalendar(LanguageType nLang)
Definition: init.cxx:732
css::uno::Reference< css::i18n::XExtendedInputSequenceChecker > xCheck
Definition: checkit.hxx:33
SwFrameFormat * GetFormat()
Definition: dcontact.hxx:112
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
virtual sal_Int32 Len() const
Definition: node.cxx:1256
void GotoFormControl(bool bNext)
Go to the next (or previous) form control, based first on tabIndex and then paragraph position,...
Definition: crstrvl.cxx:879
bool GoPrevCell()
Definition: trvltbl.cxx:101
bool GetShadowCursorPos(const Point &rPt, SwFillMode eFillMode, SwRect &rRect, sal_Int16 &rOrient)
Definition: crstrvl.cxx:2307
bool GoEndSentence()
Definition: crstrvl1.cxx:73
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2550
bool IsSelOnePara() const
Definition: crsrsh.cxx:1362
void ShowCursor()
Definition: crsrsh.cxx:2710
bool IsReadOnlyAvailable() const
Definition: crsrsh.hxx:494
bool IsInVerticalText(const Point *pPt=nullptr) const
Definition: crsrsh.cxx:3763
bool GoPrevCursor()
go to the previous SSelection
Definition: crsrsh.cxx:1676
void SttCursorMove()
Definition: crsrsh.cxx:301
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:343
void SwapPam()
Definition: crsrsh.cxx:1262
void ClearGCAttr()
Definition: crsrsh.hxx:786
const SwRect & GetCharRect() const
Definition: crsrsh.hxx:536
bool SelTableBox()
Definition: trvltbl.cxx:286
void HideCursor()
Definition: crsrsh.cxx:2731
int SetCursor(const Point &rPt, bool bOnlyText=false, bool bBlock=true)
Definition: crsrsh.cxx:1047
bool IsMultiSelection() const
Definition: crsrsh.hxx:915
virtual SwCursor & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:185
void NormalizePam(bool bPointFirst=true)
Ensure point and mark of the current PaM are in a specific order.
Definition: crsrsh.cxx:1256
bool IsCursorReadonly() const
Definition: crsrsh.cxx:3609
bool IsEndPara() const
Definition: crsrsh.cxx:1400
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
bool SelectTextModel(sal_Int32 nStart, sal_Int32 nEnd)
Definition: crstrvl.cxx:2197
bool ExtendSelection(bool bEnd=true, sal_Int32 nCount=1)
extend current SSelection by n characters
Definition: crsrsh.cxx:2944
bool IsSttPara() const
Definition: crsrsh.cxx:1381
bool IsOverReadOnlyPos(const Point &rPt) const
Definition: crsrsh.cxx:3042
bool IsFormProtected()
Definition: crbm.cxx:281
bool IsSelection() const
Definition: crsrsh.hxx:910
bool CursorInsideInputField() const
Definition: crstrvl.cxx:1094
void UpdateAttr()
Definition: crsrsh.hxx:787
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:1073
bool SetShadowCursorPos(const Point &rPt, SwFillMode eFillMode)
Definition: crstrvl.cxx:2335
bool SetVisibleCursor(const Point &rPt)
Move visible cursor to given position in document.
Definition: crsrsh.cxx:2979
bool HasMark() const
Definition: crsrsh.hxx:908
SAL_DLLPRIVATE SvxFrameDirection GetTextDirection(const Point *pPt=nullptr) const
Definition: crsrsh.cxx:3748
bool IsStartOfDoc() const
Definition: crsrsh.cxx:3070
bool IsPageAtPos(const Point &rPt) const
Definition: crstrvl.cxx:1426
bool TestCurrPam(const Point &rPt, bool bTstHit=false)
Search in the selected area for a Selection that covers the given point.
Definition: crsrsh.cxx:1277
const SwShellTableCursor * GetTableCursor() const
Definition: crsrsh.hxx:670
bool GoStartSentence()
Definition: crstrvl1.cxx:78
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3770
void ClearMark()
Definition: crsrsh.cxx:1225
void SetMark()
Definition: crsrsh.hxx:906
bool IsSendAccessibleCursorEvents() const
Definition: crsrsh.hxx:478
SwTextContentControl * CursorInsideContentControl() const
Definition: crstrvl.cxx:1104
bool IsGCAttr() const
Definition: crsrsh.hxx:785
bool IsEndOfDoc() const
Definition: crsrsh.cxx:3082
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3356
bool MoveSection(SwWhichSection, SwMoveFnCollection const &)
Definition: crsrsh.cxx:1006
void GetCharRectAt(SwRect &rRect, const SwPosition *pPos)
Definition: crsrsh.cxx:1503
::sw::mark::IFieldmark * GetCurrentFieldmark()
Definition: crbm.cxx:286
bool HasReadonlySel(bool isReplace=false) const
Definition: crsrsh.cxx:3662
bool GetContentAtPos(const Point &rPt, SwContentAtPos &rContentAtPos, bool bSetCursor=false, SwRect *pFieldRect=nullptr)
Definition: crstrvl.cxx:1433
bool IsTableMode() const
Definition: crsrsh.hxx:668
bool IsInFrontOfLabel() const
Definition: crsrsh.cxx:1457
bool MoveFieldType(const SwFieldType *pFieldType, const bool bNext, const SwFieldIds nResType=SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields=true)
Definition: crstrvl.cxx:674
void EndCursorMove(const bool bIdleEnd=false)
Definition: crsrsh.cxx:310
bool GoNextCell(bool bAppendLine=true)
set cursor into next/previous cell
Definition: trvltbl.cxx:39
void SetSendAccessibleCursorEvents(bool bEnable)
Definition: crsrsh.hxx:479
sal_Unicode GetChar(bool bEnd=true, tools::Long nOffset=0)
get the nth character of the current SSelection
Definition: crsrsh.cxx:2918
void UnSetVisibleCursor()
Definition: crsrsh.hxx:940
SwCursor * GetNext()
Definition: swcrsr.hxx:219
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1152
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
Definition: doc.hxx:197
void dumpAsXml(xmlTextWriterPtr=nullptr) const
Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by...
Definition: docfmt.cxx:1966
SwExtTextInput * GetExtTextInput(const SwNode &rNd, sal_Int32 nContentPos=-1) const
Definition: extinput.cxx:275
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:169
virtual void Activate(const sal_uInt16 nSlotId)
Definition: drawbase.cxx:432
void BreakCreate()
Definition: drawbase.cxx:469
virtual void Deactivate()
Definition: drawbase.cxx:444
virtual bool MouseButtonDown(const MouseEvent &rMEvt)
Definition: drawbase.cxx:62
virtual bool MouseButtonUp(const MouseEvent &rMEvt)
Definition: drawbase.cxx:239
bool IsInsertForm() const
Definition: drawbase.hxx:50
bool MouseMove(const MouseEvent &rMEvt)
Definition: drawbase.cxx:215
SfxShell subclass that is used while interacting with the editeng-based text of a shape.
Definition: drwtxtsh.hxx:32
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
OUString DeleteExtTextInput(bool bInsText=true)
Definition: editsh.cxx:960
void GCAttr()
Definition: edatmisc.cxx:55
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
bool IsNoNum(bool bChkStart=true) const
Definition: ednumber.cxx:650
void DoSpecialInsert()
Special insert: Insert a new text node just before or after a section or table, if the cursor is posi...
Definition: edsect.cxx:394
bool IsNbspRunNext() const
Definition: editsh.hxx:1011
void SetExtTextInputData(const CommandExtTextInputData &)
Definition: editsh.cxx:995
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
bool Delete(bool isArtificialSelection=false)
Delete content of all ranges.
Definition: eddel.cxx:134
bool IsCursorInParagraphMetadataField() const
Returns true iff the cursor is within a paragraph metadata field.
Definition: edfcol.cxx:2057
static SwAutoCompleteWord & GetAutoCompleteWords()
Interface for access to AutoComplete-list.
Definition: edws.cxx:326
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:98
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
void CreateExtTextInput(LanguageType eInputLanguage)
Interface for TextInputData - (for input of Japanese/Chinese chars.)
Definition: editsh.cxx:953
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:237
void SetTextFormatColl(SwTextFormatColl *, const bool bResetListAttrs=false)
Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTextFormatColl(....
Definition: edfcol.cxx:2202
void NoNum()
Paragraphs without enumeration but with indents.
Definition: ednumber.cxx:126
void SetCurNumRule(const SwNumRule &, const bool bCreateNewList, const OUString &sContinuedListId=OUString(), const bool bResetIndentAttrs=false)
Optional parameter <bResetIndentAttrs> (default value false).
Definition: ednumber.cxx:738
bool NumOrNoNum(bool bDelete=false, bool bChkStart=true)
Switch on/off of numbering via Delete/Backspace.
Definition: ednumber.cxx:632
void ChangeIndentOfAllListLevels(sal_Int32 nDiff)
Remove unused default parameter <nLevel> and <bRelative>.
Definition: ednumber.cxx:310
bool CanSpecialInsert() const
a node can be special-inserted (alt-Enter) whenever lcl_SpecialInsertNode finds a suitable position
Definition: edsect.cxx:386
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
Definition: edfld.cxx:64
sal_uInt8 GetNumLevel() const
Definition: ednumber.cxx:669
void Undo(sal_uInt16 const nCount=1, sal_uInt16 nOffset=0)
Definition: edundo.cxx:105
const SwNumRule * GetOutlineNumRule() const
Definition: ednumber.cxx:117
std::vector< OUString > GetChunkForAutoText()
Definition: edws.cxx:310
const SwNumRule * GetNumRuleAtCurrCursorPos() const
Definition: ednumber.cxx:694
void DelNumRules()
Delete, split enumeration list.
Definition: ednumber.cxx:249
void SetModified()
Definition: edws.cxx:70
bool GetCurFootnote(SwFormatFootnote *pToFillFootnote=nullptr)
Query and set footnote-text/number. Set... to current SSelection!
Definition: edattr.cxx:394
bool OutlineUpDown(short nOffset=1)
Definition: ednumber.cxx:520
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
void NumUpDown(bool bDown=true)
Definition: ednumber.cxx:277
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:238
void GetSelectedText(OUString &rBuf, ParaBreakType nHndlParaBreak=ParaBreakType::ToBlank)
Query text within selection.
Definition: edglss.cxx:249
void EndAllAction()
Definition: edws.cxx:97
LanguageType GetCurLang() const
Definition: edattr.cxx:801
bool IsTableBoxTextFormat() const
Definition: edtab.cxx:371
OUString GetPrevAutoCorrWord(SvxAutoCorrect &rACorr)
Definition: edws.cxx:293
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
bool m_bIsInMove
Definition: edtwin.hxx:113
Color m_aWaterCanTextColor
Definition: edtwin.hxx:67
static tools::Long s_nDDStartPosY
Definition: edtwin.hxx:65
AutoTimer m_aTimer
Definition: edtwin.hxx:76
std::unique_ptr< SdrDropMarkerOverlay > m_pUserMarker
Definition: edtwin.hxx:93
void SetApplyTemplate(const SwApplyTemplate &)
Apply template.
Definition: edtwin.cxx:5285
bool m_bChainMode
Definition: edtwin.hxx:117
void MoveCursor(SwWrtShell &rSh, const Point &rDocPos, const bool bOnlyText, bool bLockView)
Definition: edtwin.cxx:2858
SwView & m_rView
Definition: edtwin.hxx:99
void InsFrame(sal_uInt16 nCols)
Insert mode for frames.
Definition: edtwin.cxx:735
bool m_bIsRowDrag
Definition: edtwin.hxx:120
static tools::Long s_nDDStartPosX
Definition: edtwin.hxx:64
void FlushInBuffer()
Character buffer is inserted into the document.
Definition: edtwin.cxx:890
virtual void dispose() override
Definition: edtwin.cxx:5418
virtual void KeyInput(const KeyEvent &rKEvt) override
KeyEvents.
Definition: edtwin.cxx:1371
OUString m_aInBuffer
Definition: edtwin.hxx:80
void ChangeFly(sal_uInt8 nDir, bool bWeb)
Definition: edtwin.cxx:1038
bool IsInHeaderFooter(const Point &rDocPt, FrameControlType &rControl) const
Returns true if in header/footer area, or in the header/footer control.
Definition: edtwin.cxx:6551
void StopQuickHelp()
Definition: edtwin.cxx:6192
void SelectMenuPosition(SwWrtShell &rSh, const Point &rMousePos)
Definition: edtwin.cxx:5954
virtual ~SwEditWin() override
Definition: edtwin.cxx:5413
LanguageType m_eBufferLanguage
Definition: edtwin.hxx:81
bool IsDrawAction() const
Definition: edtwin.hxx:210
bool IsChainMode() const
Definition: edtwin.hxx:229
bool m_bMBPressed
Definition: edtwin.hxx:110
std::optional< Point > m_xRowColumnSelectionStart
Definition: edtwin.hxx:97
void SetUseInputLanguage(bool bNew)
#i42732# display status of font size/name depending on either the input language or the selection pos...
Definition: edtwin.cxx:6624
bool m_bInsFrame
Definition: edtwin.hxx:112
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Definition: edtwin.cxx:6219
bool IsObjectSelect() const
Definition: edtwin.hxx:214
bool RulerMarginDrag(const MouseEvent &rMEvt, const bool bVerticalMode)
Definition: edtwin3.cxx:96
void SetChainMode(bool bOn)
Definition: edtwin.cxx:6203
SotExchangeDest GetDropDestination(const Point &rPixPnt, SdrObject **ppObj=nullptr)
Definition: edtdd.cxx:259
Timer m_aKeyInputFlushTimer
Definition: edtwin.hxx:78
void UpdatePointer(const Point &, sal_uInt16 nButtons=0)
Definition: edtwin.cxx:344
sal_Int16 m_eOrient
Definition: edtwin.hxx:96
Timer m_aTemplateTimer
Definition: edtwin.hxx:85
static bool IsInputSequenceCheckingRequired(const OUString &rText, const SwPaM &rCursor)
Definition: edtwin.cxx:773
bool IsOverHeaderFooterFly(const Point &rDocPos, FrameControlType &rControl, bool &bOverFly, bool &bPageAnchored) const
Definition: edtwin.cxx:6588
Color m_aWaterCanTextBackColor
Definition: edtwin.hxx:68
static void FinitStaticData()
Definition: edtwin.cxx:6186
bool EnterDrawMode(const MouseEvent &rMEvt, const Point &aDocPos)
Turn on DrawMode.
Definition: edtwin.cxx:5462
void ChangeDrawing(sal_uInt8 nDir)
Definition: edtwin.cxx:1221
bool m_bIsInDrag
Definition: edtwin.hxx:114
void LeaveArea(const Point &)
Definition: edtwin.cxx:718
sal_uInt16 m_nInsFrameColCount
Definition: edtwin.hxx:108
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Button Up.
Definition: edtwin.cxx:4577
const SwView & GetView() const
Definition: edtwin.hxx:246
bool m_bOldIdleSet
Definition: edtwin.hxx:116
bool RulerColumnDrag(const MouseEvent &rMEvt, bool bVerticalMode)
Definition: edtwin3.cxx:85
void JustifyAreaTimer()
Definition: edtwin.cxx:703
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: edtwin.cxx:4024
void EnterDrawTextMode(const Point &aDocPos)
Turn on DrawTextEditMode.
Definition: edtwin.cxx:5444
SdrHitKind m_aActHitType
Definition: edtwin.hxx:101
sal_uInt16 m_nKS_NUMDOWN_Count
Definition: edtwin.hxx:127
SwCallMouseEvent m_aSaveCallEvent
Definition: edtwin.hxx:88
void StdDrawMode(SdrObjKind eSdrObjectKind, bool bObjSelect)
Definition: edtwin.cxx:742
void EnterArea()
Definition: edtwin.cxx:727
void StopInsFrame()
Definition: edtwin.cxx:761
virtual void Command(const CommandEvent &rCEvt) override
Definition: edtwin.cxx:5532
bool changeMousePointer(Point const &rDocPoint)
Definition: edtwin.cxx:3954
static void InitStaticData()
Definition: edtwin.cxx:6181
bool m_bOldIdle
Definition: edtwin.hxx:115
bool m_bInsDraw
Definition: edtwin.hxx:111
void ShowAutoCorrectQuickHelp(const OUString &rWord, SvxAutoCorrect &rACorr)
Definition: edtwin.cxx:6526
std::unique_ptr< SwShadowCursor, o3tl::default_delete< SwShadowCursor > > m_pShadCursor
Definition: edtwin.hxx:95
virtual bool DeleteSurroundingText(const Selection &rSelection) override
Definition: edtwin.cxx:6724
void ResetMouseButtonDownFlags()
MouseEvents.
Definition: edtwin.cxx:2834
void StartDDTimer()
Definition: edtdd.cxx:48
void LogicInvalidate(const tools::Rectangle *pRectangle) override
Definition: edtwin.cxx:6759
virtual void GetFocus() override
Definition: edtwin.cxx:5505
std::unique_ptr< SwAnchorMarker > m_pAnchorMarker
Definition: edtwin.hxx:91
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: edtwin.cxx:2889
static QuickHelpData * s_pQuickHlpData
Definition: edtwin.hxx:62
bool IsDrawSelMode() const
Definition: edtwin.cxx:5500
bool m_bLockInput
Definition: edtwin.hxx:119
SwEditWin(vcl::Window *pParent, SwView &)
Ctor.
Definition: edtwin.cxx:5341
bool m_bUseInputLanguage
#i42732# display status of font size/name depending on either the input language or the selection pos...
Definition: edtwin.hxx:124
virtual void LoseFocus() override
Definition: edtwin.cxx:5521
SwTextFrame * m_pSavedOutlineFrame
Definition: edtwin.hxx:132
bool m_bWasShdwCursor
Definition: edtwin.hxx:118
void StopDDTimer(SwWrtShell *, const Point &)
Definition: edtdd.cxx:56
sal_uInt16 m_nKS_NUMINDENTINC_Count
Definition: edtwin.hxx:128
Point m_aStartPos
Definition: edtwin.hxx:82
Point m_aRszMvHdlPt
Definition: edtwin.hxx:84
Point m_aMovePos
Definition: edtwin.hxx:83
void SetSdrDrawMode(SdrObjKind eSdrObjectKind)
Definition: edtwin.hxx:217
bool ShowAutoText(const std::vector< OUString > &rChunkCandidates)
Definition: edtwin.cxx:6510
virtual Selection GetSurroundingTextSelection() const override
Definition: edtwin.cxx:6676
SwFrameControlsManager & GetFrameControlsManager()
Definition: edtwin.cxx:6832
void ToggleOutlineContentVisibility(const size_t nOutlinePos, const bool bSubs)
Definition: edtwin.cxx:6837
std::unique_ptr< SwFrameControlsManager > m_pFrameControlsManager
Definition: edtwin.hxx:130
void SetCursorTwipPosition(const Point &rPosition, bool bPoint, bool bClearMark)
Allows adjusting the point or mark of the selection to a document coordinate.
Definition: edtwin.cxx:6764
std::unique_ptr< SwApplyTemplate > m_pApplyTempl
Definition: edtwin.hxx:90
void SetGraphicTwipPosition(bool bStart, const Point &rPosition)
Allows starting or ending a graphic move or resize action.
Definition: edtwin.cxx:6814
virtual OUString GetSurroundingText() const override
Definition: edtwin.cxx:6635
SwRect GetFlyRect() const
For moving flys with keyboard.
Definition: fefly1.cxx:1286
bool SetFlyFrameAttr(SfxItemSet &rSet)
Definition: fefly1.cxx:1103
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
void SetFrameFormat(SwFrameFormat *pFormat, bool bKeepOrient=false, Point const *pDocPos=nullptr)
If frame then set frame style.
Definition: fefly1.cxx:1223
SwTextNode * GetNumRuleNodeAtPos(const Point &rPot)
Definition: fetab.cxx:2153
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
Definition: feshview.cxx:2581
bool IsNumLabel(const Point &rPt, int nMaxOffset=-1)
Definition: fetab.cxx:2165
void SetFlyPos(const Point &rAbsPos)
Definition: fefly1.cxx:373
bool GotoNextFly(GotoObjFlags eType=GotoObjFlags::FlyAny)
Independent selecting of flys.
Definition: fesh.hxx:416
RndStdIds GetAnchorId() const
Anchor type of selected object, RndStdIds::UNKNOWN if ambiguous or in case of frame selection.
Definition: feshview.cxx:2209
bool ShouldObjectBeSelected(const Point &rPt)
Test if there is a draw object at that position and if it should be selected.
Definition: feshview.cxx:1293
const SwFrameFormat * SelFlyGrabCursor()
If a fly is selected, it draws cursor into the first ContentFrame.
Definition: feshview.cxx:802
bool IsFrameSelected() const
Definition: feshview.cxx:1133
Point FindAnchorPos(const Point &rAbsPos, bool bMoveIt=false)
Definition: fefly1.cxx:421
bool GotoObj(bool bNext, GotoObjFlags eType=GotoObjFlags::DrawAny)
Definition: feshview.cxx:1630
const SwFrameFormat * IsURLGrfAtPos(const Point &rPt, OUString *pURL=nullptr, OUString *pTargetFrameName=nullptr, OUString *pURLDescription=nullptr) const
Position is a graphic with URL?
Definition: fefly1.cxx:1509
bool IsTableVertical() const
Definition: fetab.cxx:2497
virtual void MakeSelVisible() override
Show current selection (frame / draw object as required).
Definition: feshview.cxx:2568
bool MoveAnchor(SwMove nDir)
Definition: feshview.cxx:372
FrameTypeFlags GetSelFrameType() const
Definition: feshview.cxx:614
bool IsFrameVertical(const bool bEnvironment, bool &bRightToLeft, bool &bVertL2R) const
Determines whether a frame or its environment is vertically formatted and right-to-left.
Definition: fews.cxx:1270
bool IsObjSelectable(const Point &rPt)
The following two methods return enum SdrHdlKind.
Definition: feshview.cxx:1258
const SwFrameFormat * GetFormatFromObj(const Point &rPt, SwRect **pRectToFill=nullptr) const
Definition: fefly1.cxx:1620
void ToggleHeaderFooterEdit()
Definition: fews.cxx:1319
SdrObject * GetObjAt(const Point &rPt)
Same as IsObjSelectable(), but return the object as well.
Definition: feshview.cxx:1275
void BreakDrag()
Definition: feshview.cxx:793
bool IsDrawCreate() const
Definition: feshview.cxx:2108
SwTab WhichMouseTabCol(const Point &rPt) const
Definition: fetab.cxx:2074
SwChainRet Chain(SwFrameFormat &rSource, const Point &rPt)
Definition: feshview.cxx:2803
void Copy(SwDoc &rClpDoc, const OUString *pNewClpText=nullptr)
Copy and Paste methods for internal clipboard.
Definition: fecopy.cxx:77
static ObjCntType GetObjCntType(const SdrObject &rObj)
Definition: fefly1.cxx:1667
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1061
void EndTextEdit()
Deletes object if required.
Definition: feshview.cxx:1193
const SwFrameFormat * GetFormatFromAnyObj(const Point &rPt) const
Definition: fefly1.cxx:1651
void ChgCurPageDesc(const SwPageDesc &)
PageDescriptor-interface.
Definition: fedesc.cxx:43
bool FinishOLEObj()
Shutdown server.
Definition: feflyole.cxx:88
size_t IsObjSelected() const
Definition: feshview.cxx:1125
void SetColRowWidthHeight(TableChgWidthHeightType eType, sal_uInt16 nDiff)
Definition: fetab.cxx:2322
bool SelectObj(const Point &rSelPt, sal_uInt8 nFlag=0, SdrObject *pObj=nullptr)
If an object has been given, exactly this object is selected (instead of searching over position).
Definition: feshview.cxx:161
void CalcBoundRect(SwRect &_orRect, const RndStdIds _nAnchorId, const sal_Int16 _eHoriRelOrient=css::text::RelOrientation::FRAME, const sal_Int16 _eVertRelOrient=css::text::RelOrientation::FRAME, const SwFormatAnchor *_pToCharContentPos=nullptr, const bool _bFollowTextFlow=false, bool _bMirror=false, Point *_opRef=nullptr, Size *_opPercent=nullptr, const SwFormatFrameSize *pFormatFrameSize=nullptr) const
i#17567 - adjustments to allow negative vertical positions for fly frames anchored to paragraph or to...
Definition: fews.cxx:690
Point GetContentPos(const Point &rPoint, bool bNext) const
Provide information about content situated closes to given Point.
Definition: fews.cxx:84
Point GetRelativePagePosition(const Point &rDocPos)
Convert document position into position relative to the current page.
Definition: feshview.cxx:3222
static bool IsVerticalModeAtNdAndPos(const SwTextNode &_rTextNode, const Point &_rDocPos)
Definition: fetab.cxx:2183
SwChainRet Chainable(SwRect &rRect, const SwFrameFormat &rSource, const Point &rPt) const
For Chain always connect Fly specified by format with that hit by point.
Definition: feshview.cxx:2764
bool IsInsideSelectedObj(const Point &rPt)
returns enum values
Definition: feshview.cxx:1243
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
Definition: fefly1.cxx:1270
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:247
Base class of all fields.
Definition: fldbas.hxx:296
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:270
SwFieldIds Which() const
ResId.
Definition: fldbas.cxx:263
FlyAnchors.
Definition: fmtanchr.hxx:37
sal_Int32 GetAnchorContentOffset() const
Definition: atrfrm.cxx:1631
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
SwNode * GetAnchorNode() const
Definition: atrfrm.cxx:1614
This class acts as data container and execution class for the format paintbrush feature in writer.
void Paste(SwWrtShell &rWrtShell, SfxStyleSheetBasePool *pPool, bool bNoCharacterFormats, bool bNoParagraphFormats)
Paste the stored text and paragraph attributes on the current selection and current paragraph.
bool HasContent() const
Test if the object contains text or paragraph attribute.
SfxPoolItem subclass that wraps an SwContentControl.
const std::shared_ptr< SwContentControl > & GetContentControl() const
const SwField * GetField() const
Definition: fmtfld.hxx:131
bool IsActive() const
Definition: fmthdft.hxx:89
bool IsActive() const
Definition: fmthdft.hxx:58
Defines the horizontal position of a fly frame.
Definition: fmtornt.hxx:73
void SetHoriOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:96
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:94
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:58
void SetVertOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:59
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:63
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:57
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
const OUString & GetName() const
Definition: format.hxx:131
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
const SvxMacroItem & GetMacro(bool=true) const
Definition: frmatr.hxx:116
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:171
A container for the Header/Footer, PageBreak, and Outline Content Visibility controls.
void RemoveControlsByType(FrameControlType eType, const SwFrame *pFrame)
void SetOutlineContentVisibilityButton(const SwContentFrame *pContentFrame)
SwFrameControlPtr GetControl(FrameControlType eType, const SwFrame *pFrame)
Style of a layout element.
Definition: frmfmt.hxx:72
IMapObject * GetIMapObject(const Point &rPoint, const SwFlyFrame *pFly=nullptr) const
Definition: atrfrm.cxx:3539
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:153
bool OnRightPage() const
Definition: frame.hxx:739
bool InsertGlossary(const OUString &rName)
Definition: gloshdl.cxx:512
void SetCurGroup(const OUString &aGrp, bool bApi=false, bool bAlwaysCreateNew=false)
Definition: gloshdl.cxx:95
void HasLongName(const std::vector< OUString > &rBeginCandidates, std::vector< std::pair< OUString, sal_uInt16 > > &rLongNames)
Definition: gloslst.cxx:374
bool GetShortName(std::u16string_view rLongName, OUString &rShortName, OUString &rGroupName)
Definition: gloslst.cxx:105
const SwView * GetView() const
Definition: inputwin.hxx:204
void SetFormula(const OUString &rFormula)
Definition: inputwin.hxx:202
sal_uInt16 GetTableVMove() const
Definition: modcfg.hxx:233
sal_uInt16 GetTableHMove() const
Definition: modcfg.hxx:229
Class for automated call of Start- and EndCursorMove().
Definition: editsh.hxx:1048
Base class of the Writer document model elements.
Definition: node.hxx:98
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:738
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
const SwStartNode * FindFooterStartNode() const
Definition: node.hxx:226
const SwStartNode * FindHeaderStartNode() const
Definition: node.hxx:224
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:220
bool IsTextNode() const
Definition: node.hxx:190
SwContentNode * GetContentNode()
Definition: node.hxx:666
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:236
bool IsOutlineRule() const
Definition: numrule.hxx:241
bool Seek_Entry(SwNode *rP, size_type *pnPos) const
Definition: ndnum.cxx:32
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:643
void Exchange()
Definition: pam.hxx:242
SwContentNode * GetPointContentNode() const
Definition: pam.hxx:279
const SwPosition * End() const
Definition: pam.hxx:263
SwContentNode * GetMarkContentNode() const
Definition: pam.hxx:280
OUString GetText() const
Definition: pam.cxx:1305
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:251
SwFrameFormat * GetRightFormat(bool const bFirst=false)
Layout uses the following methods to obtain a format in order to be able to create a page.
Definition: pagedesc.cxx:389
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
Definition: pagedesc.cxx:382
A page of the document layout.
Definition: pagefrm.hxx:60
bool IsOverHeaderFooterArea(const Point &rPt, FrameControlType &rControl) const
If in header or footer area, it also indicates the exact area in rControl.
Definition: pagechg.cxx:2500
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:147
void GrabFocusOnActiveSidebarWin()
Definition: PostItMgr.cxx:2383
void SetShadowState(const SwPostItField *pField, bool bCursor=true)
Definition: PostItMgr.cxx:1875
void SetActiveSidebarWin(sw::annotation::SwAnnotationWin *p)
Definition: PostItMgr.cxx:2200
vcl::Window * IsHitSidebarWindow(const Point &rPointLogic)
Get the matching window that is responsible for handling mouse events of rPointLogic,...
Definition: PostItMgr.cxx:1978
sw::annotation::SwAnnotationWin * GetActiveSidebarWin()
Definition: PostItMgr.hxx:237
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2372
bool IsHit(const Point &aPointPixel)
Definition: PostItMgr.cxx:1949
rtl::Reference< VCLXPopupMenu > CreateMenuInterface()
Definition: romenu.hxx:74
void Execute(vcl::Window *pWin, const Point &rPPos)
Definition: romenu.cxx:223
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
bool HasArea() const
Definition: swrect.hxx:300
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
void Right(const tools::Long nRight)
Definition: swrect.hxx:202
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
void Pos(const Point &rNew)
Definition: swrect.hxx:171
bool Contains(const Point &rPOINT) const
Definition: swrect.hxx:356
Point Center() const
Definition: swrect.hxx:338
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
void Width(tools::Long nNew)
Definition: swrect.hxx:189
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
bool IsBetweenPages(const Point &rPt) const
Point rPt: The point to test.
Definition: findfrm.cxx:700
const SwPageFrame * GetPageAtPos(const Point &rPt, const Size *pSize=nullptr, bool bExtend=false) const
Point rPt: The point that should be used to find the page Size pSize: If given, we return the (first)...
Definition: findfrm.cxx:658
void dumpAsXml(xmlTextWriterPtr writer=nullptr) const override
Definition: wsfrm.cxx:4797
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Primary passes the call to the first page.
Definition: trvlfrm.cxx:425
const VclPtr< SwContentControlButton > & GetContentControlButton() const
Definition: viscrs.cxx:841
Represents the current text cursor of one opened edit window.
Definition: viscrs.hxx:140
static SwSmartTagMgr & Get()
Starts a section of nodes in the document model.
Definition: node.hxx:348
const SwTOXType * GetTOXType() const
Definition: tox.hxx:576
TOXTypes GetType() const
Definition: tox.hxx:693
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
const sal_Int32 * End() const
Definition: txatbase.hxx:156
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
const SwFormatContentControl & GetContentControl() const
Definition: txatbase.hxx:220
sal_uInt16 Which() const
Definition: txatbase.hxx:116
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:199
const SwTOXMark & GetTOXMark() const
Definition: txatbase.hxx:232
static SwFrameFormat * getOtherTextBoxFormat(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
If we have an associated TextFrame, then return that.
SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:122
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:678
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:472
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
void GetAttrOutlineContentVisible(bool &bOutlineContentVisibleAttr)
GetAttrOutlineContentVisible.
Definition: ndtxt.cxx:4183
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Default) const
get the innermost text attribute covering position nIndex.
Definition: ndtxt.cxx:1804
void SetAttrOutlineContentVisible(bool bVisible)
Definition: ndtxt.cxx:4191
static bool PasteData(TransferableDataHelper &rData, SwWrtShell &rSh, sal_uInt8 nAction, SotExchangeActionFlags nActionFlags, SotClipboardFormatId nFormat, SotExchangeDest nDestination, bool bIsPasteFormat, bool bIsDefault, const Point *pDDPos=nullptr, sal_Int8 nDropAction=0, bool bPasteSelection=false, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA, bool bIgnoreComments=false, SwPasteContext *pContext=nullptr, PasteTableType nPaste=PasteTableType::PASTE_DEFAULT)
Definition: swdtflvr.cxx:1706
void SetIdle(bool b) const
Definition: viewopt.hxx:339
bool IsHideWhitespaceMode() const
Definition: viewopt.hxx:647
void SetHideWhitespaceMode(bool bMode)
Definition: viewopt.hxx:648
bool IsShadowCursor() const
Definition: viewopt.hxx:785
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:177
SwFillMode GetShdwCursorFillMode() const
Definition: viewopt.hxx:802
short GetDivisionY() const
Definition: viewopt.hxx:610
bool IsTreatSubOutlineLevelsAsContent() const
Definition: viewopt.cxx:182
bool IsIdle() const
Definition: viewopt.hxx:332
const Size & GetSnapSize() const
Definition: viewopt.hxx:530
bool getBrowseMode() const
Definition: viewopt.hxx:636
bool CanHideWhitespace() const
The rules that allow for hiding whitespace.
Definition: viewopt.hxx:651
short GetDivisionX() const
Definition: viewopt.hxx:608
bool IsUseHeaderFooterMenu() const
Definition: viewopt.hxx:473
bool IsViewLocked() const
Definition: viewsh.hxx:490
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:365
bool IsHeaderFooterEdit() const
Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags.
Definition: viewsh.hxx:589
bool HasDrawView() const
Definition: vnew.cxx:371
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
const SwNodes & GetNodes() const
Definition: viewsh.cxx:2181
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2821
bool ActionPend() const
Definition: viewsh.hxx:225
void InvalidateAccessibleFocus()
Definition: viewsh.cxx:2593
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
const SwRect & VisArea() const
Definition: viewsh.cxx:642
css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
Definition: viewsh.cxx:2559
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:568
bool IsShowHeaderFooterSeparator(FrameControlType eControl)
Definition: viewsh.hxx:590
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:470
void LockView(bool b)
Definition: viewsh.hxx:491
const IDocumentOutlineNodes * getIDocumentOutlineNodesAccess() const
Definition: viewsh.cxx:2844
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
SdrView * GetDrawView()
Definition: vnew.cxx:386
Definition: view.hxx:146
SfxShell * GetCurShell()
Definition: view.hxx:586
void SetTabColFromDocPos(const Point &rPt)
Definition: view.hxx:453
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
void SetNumRuleNodeFromDoc(SwTextNode *pNumRuleNode)
Definition: view.hxx:459
bool HandleWheelCommands(const CommandEvent &)
Definition: viewport.cxx:1190
void NoRotate()
Definition: viewdraw.cxx:439
void GotFocus() const
Definition: view.cxx:167
bool ExecSpellPopup(const Point &rPt)
! End of extra code for context menu modifying extensions
Definition: viewling.cxx:627
bool HandleGestureZoomCommand(const CommandEvent &)
Definition: viewport.cxx:1231
void SelectShellForDrop()
Definition: edtdd.cxx:196
const tools::Rectangle & GetVisArea() const
Definition: view.hxx:436
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:650
void StopShellTimer()
Definition: view.cxx:1836
void SetSelDrawSlot()
Definition: viewdraw.cxx:646
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:424
SwDrawBase * GetDrawFuncPtr() const
Definition: view.hxx:537
SwGlossaryHdl * GetGlosHdl()
Definition: view.cxx:1691
SwEditWin & GetEditWin()
Definition: view.hxx:426
void ExecSmartTagPopup(const Point &rPt)
Function: ExecSmartTagPopup.
Definition: viewling.cxx:816
void SetDrawFuncPtr(std::unique_ptr< SwDrawBase > pFuncPtr)
Definition: viewdraw.cxx:641
SwDocShell * GetDocShell()
Definition: view.cxx:1193
void SetTabRowFromDoc(bool b)
Definition: view.hxx:456
bool IsDrawMode() const
Definition: view.hxx:550
void InvalidateRulerPos()
Definition: viewport.cxx:107
void LeaveDrawCreate()
Definition: view.hxx:549
bool EnterDrawTextMode(const Point &aDocPos)
Definition: viewdraw.cxx:463
void SetTabColFromDoc(bool b)
Definition: view.hxx:454
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void EnterBlockMode()
Definition: select.cxx:660
void ClickToField(const SwField &rField, bool bExecHyperlinks)
Definition: wrtsh2.cxx:342
bool IsSelFrameMode() const
Definition: wrtsh.hxx:177
bool Down(bool bSelect, sal_uInt16 nCount=1, bool bBasicCall=false)
Definition: move.cxx:159
bool EndPg(bool bSelect=false)
Definition: move.cxx:388
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:711
bool ClickToINetGrf(const Point &rDocPt, LoadUrlFlags nFilter)
Definition: wrtsh2.cxx:536
bool Right(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:127
bool IsSttOfPara() const
Definition: wrtsh.hxx:196
void EndSelect()
Definition: select.cxx:434
void LeaveSelFrameMode()
Definition: select.cxx:729
bool DelLeft()
Definition: delete.cxx:136
bool IsOutlineContentVisible(const size_t nPos)
Definition: wrtsh1.cxx:2330
void addCurrentPosition()
Definition: wrtsh1.cxx:1869
bool GetAttrOutlineContentVisible(const size_t nPos) const
Definition: wrtsh1.cxx:2637
void PopMode()
Definition: select.cxx:293
void PushMode()
Definition: select.cxx:288
bool TryRemoveIndent()
Definition: delete.cxx:62
void LeaveAddMode()
Definition: select.cxx:650
bool Left(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:110
void SelectNextPrevHyperlink(bool bNext)
Definition: select.cxx:943
bool Is_FnDragEQBeginDrag() const
Definition: wrtsh.hxx:671
void Insert(const OUString &)
Definition: wrtsh1.cxx:226
bool GotoContentControl(const SwFormatContentControl &rContentControl, bool bOnlyRefresh=false)
Definition: wrtsh3.cxx:96
sal_uInt16 CallEvent(SvMacroItemId nEvent, const SwCallMouseEvent &rCallEvent, bool bCheckPtr=false)
Definition: wrtsh3.cxx:328
void ResetCursorStack()
Definition: wrtsh.hxx:651
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1723
void EnterStdMode()
Definition: select.cxx:560
void SelPara(const Point *)
Definition: select.cxx:108
tools::Long CallSetCursor(const Point *pPt, bool bProp)
Definition: wrtsh.hxx:123
void SelSentence(const Point *)
Definition: select.cxx:92
void SplitNode(bool bAutoFormat=false)
Definition: wrtsh1.cxx:1317
bool SttPg(bool bSelect=false)
Definition: move.cxx:382
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:2122
void Do(DoType eDoType, sal_uInt16 nCnt=1, sal_uInt16 nOffset=0)
Definition: wrtundo.cxx:33
void ExecMacro(const SvxMacro &rMacro, OUString *pRet=nullptr, SbxArray *pArgs=nullptr)
Definition: wrtsh3.cxx:319
void NoEdit(bool bHideCursor=true)
Definition: wrtsh1.cxx:182
bool IsBlockMode() const
Definition: wrtsh.hxx:168
bool IsInSelect() const
Definition: wrtsh.hxx:144
bool Up(bool bSelect, sal_uInt16 nCount=1, bool bBasicCall=false)
Definition: move.cxx:145
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow) override
Definition: wrtsh1.cxx:2221
virtual void InfoReadOnlyDialog(bool bAsync) const override
Selected area has readonly content.
Definition: wrtsh1.cxx:2666
void EndDrag(const Point *pPt, bool bProp)
Definition: wrtsh.hxx:125
void Drag(const Point *pPt, bool bProp)
Definition: wrtsh.hxx:124
void GotoOutline(SwOutlineNodes::size_type nIdx)
Definition: move.cxx:655
bool DelRight(bool isReplaceHeuristic=false)
Definition: delete.cxx:285
void AutoCorrect(SvxAutoCorrect &rACorr, sal_Unicode cChar)
Definition: wrtsh1.cxx:1955
bool HasSelection() const
Definition: wrtsh.hxx:147
void Edit()
Definition: wrtsh1.cxx:188
bool IsAddMode() const
Definition: wrtsh.hxx:163
void SttSelect()
Definition: select.cxx:394
void UnSelectFrame()
Definition: select.cxx:332
void InvalidateOutlineContentVisibility()
Definition: wrtsh1.cxx:2543
bool SelWrd(const Point *=nullptr)
Definition: select.cxx:74
void LaunchOLEObj(sal_Int32 nVerb=css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY)
Definition: wrtsh1.cxx:654
bool SelectTableRowCol(const Point &rPt, const Point *pEnd=nullptr, bool bRowDrag=false)
Definition: select.cxx:829
bool IsExtMode() const
Definition: wrtsh.hxx:158
void EnterAddMode()
Definition: select.cxx:635
void ClickToINetAttr(const SwFormatINetFormat &rItem, LoadUrlFlags nFilter=LoadUrlFlags::NONE)
Definition: wrtsh2.cxx:506
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2047
const SwView & GetView() const
Definition: wrtsh.hxx:443
bool IsActive() const
void Stop()
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
static TransferableDataHelper CreateFromPrimarySelection()
const DataFlavorExVector & GetDataFlavorExVector() const
css::uno::Reference< css::datatransfer::XTransferable > GetXTransferable() const
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
bool isDisposed() const
Fieldmark with a drop down button (e.g. this button opens the date picker for a date field)
virtual void SetChecked(bool checked)=0
virtual bool IsChecked() const =0
constexpr Point Center() const
bool Contains(const Point &rPOINT) const
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr tools::Long Right() const
constexpr Point TopRight() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
T * get() const
virtual void SetPointer(PointerStyle) override
bool IsMod1() const
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
KeyFuncType GetFunction() const
bool IsShift() const
bool IsMod2() const
sal_uInt16 GetFullCode() const
Point OutputToScreenPixel(const Point &rPos) const
virtual void dispose() override
void SetInputContext(const InputContext &rInputContext)
bool IsMouseCaptured() const
Point LogicToPixel(const Point &rLogicPt) const
LanguageType GetInputLanguage() const
void GrabFocus()
void set_id(const OUString &rID)
bool HasFocus() const
void SetMapMode()
const AllSettings & GetSettings() const
void SetCompositionCharRect(const tools::Rectangle *pRect, tools::Long nCompositionLength, bool bVertical=false)
::OutputDevice const * GetOutDev() const
void ReleaseMouse()
Point PixelToLogic(const Point &rDevicePt) const
void CaptureMouse()
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
void SetQuickHelpText(const OUString &rHelpText)
void SetDialogControlFlags(DialogControlFlags nFlags)
PointerStyle GetPointer() const
void EnableChildTransparentMode(bool bEnable=true)
void SetHelpId(const OUString &)
#define FN_GOTO_NEXT_CELL
Definition: cmdid.h:424
#define FN_EDIT_AUTH_ENTRY_DLG
Definition: cmdid.h:139
#define FN_JAVAEDIT
Definition: cmdid.h:294
#define FN_EDIT_FOOTNOTE
Definition: cmdid.h:115
#define FN_GOTO_PREV_CELL
Definition: cmdid.h:425
#define FN_FORMAT_FRAME_DLG
Definition: cmdid.h:353
#define FN_POSTIT
Definition: cmdid.h:233
#define FN_GOTO_PREV_INPUTFLD
Definition: cmdid.h:109
#define FN_FRAME_UNCHAIN
Definition: cmdid.h:487
#define FN_STAT_PAGE
Definition: cmdid.h:864
#define FN_EDIT_IDX_ENTRY_DLG
Definition: cmdid.h:82
#define FN_FORMAT_GRAFIC_DLG
Definition: cmdid.h:354
#define FN_FRAME_CHAIN
Definition: cmdid.h:486
#define FN_INSERT_STRING
Definition: cmdid.h:235
#define FN_EDIT_FIELD
Definition: cmdid.h:77
#define FN_GOTO_NEXT_INPUTFLD
Definition: cmdid.h:108
#define FN_UPDATE_INPUTFIELDS
Definition: cmdid.h:104
ExtTextInputAttr
const int CRSR_POSCHG
Definition: crsrsh.hxx:131
const int CRSR_POSOLD
Definition: crsrsh.hxx:130
SwFillMode
Definition: crstate.hxx:29
SwFrameFormat * FindFrameFormat(SdrObject *pObj)
The Get reverse way: seeks the format to the specified object.
Definition: dcontact.cxx:121
SwContact * GetUserCall(const SdrObject *pObj)
Returns the UserCall if applicable from the group object.
Definition: dcontact.cxx:172
float u
bool g_bExecuteDrag
Definition: edtdd.cxx:46
static sal_uInt16 lcl_isNonDefaultLanguage(LanguageType eBufferLanguage, SwView const &rView, const OUString &rInBuffer)
Definition: edtwin.cxx:797
#define MOVE_LEFT_HUGE
Definition: edtwin.cxx:1033
#define MOVE_DOWN_SMALL
Definition: edtwin.cxx:1030
static bool IsDrawObjSelectable(const SwWrtShell &rSh, const Point &rPt)
For MouseButtonDown - determine whether a DrawObject a NO SwgFrame was hit! Shift/Ctrl should only re...
Definition: edtwin.cxx:324
static bool IsMinMove(const Point &rStartPos, const Point &rLPt)
Definition: edtwin.cxx:312
static bool g_bHoldSelection
Definition: edtwin.cxx:172
#define MOVE_DOWN_HUGE
Definition: edtwin.cxx:1036
bool g_bDDTimerStarted
Definition: edtwin.cxx:177
#define MOVE_UP_BIG
Definition: edtwin.cxx:1028
#define MOVE_LEFT_BIG
Definition: edtwin.cxx:1027
static bool lcl_goIntoTextBox(SwEditWin &rEditWin, SwWrtShell &rSh)
Check if the selected shape has a TextBox: if so, go into that instead.
Definition: edtwin.cxx:189
#define MOVE_UP_SMALL
Definition: edtwin.cxx:1024
bool g_bModePushed
Definition: edtwin.cxx:176
static bool lcl_urlOverBackground(SwWrtShell &rSh, const Point &rDocPos)
Determines if the current position has a clickable url over a background frame.
Definition: edtwin.cxx:2850
#define MOVE_RIGHT_BIG
Definition: edtwin.cxx:1025
#define MOVE_LEFT_SMALL
Definition: edtwin.cxx:1023
#define MIN_MOVE
Definition: edtwin.cxx:310
#define HIT_PIX
Avoid minimal movement shiver.
Definition: edtwin.cxx:309
bool g_bDDINetAttr
Definition: edtwin.cxx:178
static SdrHdlKind g_eSdrMoveHdl
Definition: edtwin.cxx:179
bool g_bFrameDrag
Definition: edtwin.cxx:174
#define MOVE_RIGHT_HUGE
Definition: edtwin.cxx:1035
#define MOVE_RIGHT_SMALL
Definition: edtwin.cxx:1029
#define MOVE_UP_HUGE
Definition: edtwin.cxx:1034
IMPL_LINK_NOARG(SwEditWin, TimerHandler, Timer *, void)
Increase timer for selection.
Definition: edtwin.cxx:652
#define MOVE_DOWN_BIG
Definition: edtwin.cxx:1026
static SfxShell * lcl_GetTextShellFromDispatcher(SwView const &rView)
Definition: edtwin.cxx:6162
static bool g_bValidCursorPos
Definition: edtwin.cxx:175
static bool g_bInputLanguageSwitched
Globals.
Definition: edtwin.cxx:165
#define MOUSE_LEFT
SvMacroItemId
#define MOUSE_RIGHT
#define EXCHG_INOUT_ACTION_NONE
SotExchangeActionFlags
#define EXCHG_IN_ACTION_COPY
SotExchangeDest
@ OBJCNT_FLY
Definition: fesh.hxx:124
@ OBJCNT_NONE
Definition: fesh.hxx:123
@ OBJCNT_GRF
Definition: fesh.hxx:125
@ OBJCNT_OLE
Definition: fesh.hxx:126
SwTab
Definition: fesh.hxx:182
@ ROW_VERT
@ ROWSEL_HORI_RTL
@ SEL_HORI
@ SEL_VERT
@ COL_NONE
@ COL_HORI
@ COLSEL_VERT
@ COLSEL_HORI
@ SEL_HORI_RTL
@ ROWSEL_VERT
@ COL_VERT
@ ROWSEL_HORI
@ ROW_HORI
#define SW_ENTER_GROUP
Definition: fesh.hxx:167
SwMove
Definition: fesh.hxx:173
#define SW_ADD_SELECT
Definition: fesh.hxx:166
#define SW_ALLOW_TEXTBOX
Allow SwFEShell::SelectObj() to select the TextBox of a shape.
Definition: fesh.hxx:170
FlyProtectFlags
values can be combined via logical or
Definition: fesh.hxx:106
@ Parent
Check only parents.
SwFieldTypesEnum
List of FieldTypes at UI.
Definition: fldbas.hxx:98
FieldUnit
SwChainRet
Definition: flyenum.hxx:34
DocumentType eType
SotClipboardFormatId
SvxFrameDirection
SelectionType
constexpr OUStringLiteral HID_EDIT_WIN
Definition: helpids.h:25
#define CH_TXT_ATR_FORMELEMENT
Definition: hintids.hxx:181
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SwFormatCol > RES_COL(115)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(106)
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr sal_uInt16 INVALID_HINT(HINT_END)
constexpr TypedWhichId< SwFormatFollowTextFlow > RES_FOLLOW_TEXT_FLOW(130)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
SwCheckIt * pCheckIt
Definition: init.cxx:447
SwCalendarWrapper & s_getCalendarWrapper()
Definition: init.cxx:453
CharClass & GetAppCharClass()
Definition: init.cxx:721
SwGlossaryList * GetGlossaryList()
Definition: initui.cxx:174
static bool bFootnote
Definition: insfnote.cxx:33
sal_Int32 nIndex
Mode eMode
constexpr sal_uInt16 KEY_RETURN
constexpr sal_uInt16 KEY_F2
constexpr sal_uInt16 KEY_MOD2
constexpr sal_uInt16 KEY_ESCAPE
constexpr sal_uInt16 KEY_MOD1
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_A
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DELETE
constexpr sal_uInt16 KEY_F12
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_PAGEUP
constexpr sal_uInt16 KEY_SHIFT
constexpr sal_uInt16 KEY_BACKSPACE
#define LANGUAGE_DONTKNOW
sal_uInt16 nPos
#define SAL_WARN(area, stream)
aBuf
std::unique_ptr< sal_Int32[]> pData
sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
bool IsOptionSet(EOption eOption)
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:365
SfxDispatcher * GetDispatcher()
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill='\0')
int i
bool ChangeIndentOnTabAtFirstPosOfFirstListItem()
configuration, if at first position of the first list item the <TAB>-key increased the indent of the ...
Definition: number.cxx:1489
bool NumDownChangesIndent(const SwWrtShell &rShell)
Decides if increasing ("downing") the numbering level will change the amount of indentation or not.
Definition: number.cxx:1494
@ Parent
EXPAND : (Start < nIndex <= End)
long Long
OUString toISO8601(const css::util::DateTime &rDateTime)
bool IsInPopupMenuExecute()
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
constexpr OUStringLiteral ODF_FORMCHECKBOX
constexpr OUStringLiteral ODF_FORMDATE
constexpr OUStringLiteral ODF_FORMDROPDOWN
sal_Int16 nId
bool GoCurrSection(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1288
SwMoveFnCollection const & fnSectionEnd
Definition: paminit.cxx:52
SwMoveFnCollection const & fnSectionStart
Definition: paminit.cxx:51
#define Y
PointerStyle
constexpr auto RULER_MOUSE_MARGINWIDTH
sal_uIntPtr sal_uLong
sal_Int32 nIndex
sal_Int32 nPara
bool IsZero() const
void Adjust()
Assists with auto-completion of AutoComplete words and AutoText names.
Definition: edtwin.cxx:258
static constexpr sal_uInt16 nNoPos
Definition: edtwin.cxx:263
bool m_bIsDisplayed
Help string is currently displayed.
Definition: edtwin.cxx:275
void * nTipId
Tip ID when a help string is displayed as a tip.
Definition: edtwin.cxx:270
sal_uInt16 CurLen() const
Definition: edtwin.cxx:286
bool m_bIsTip
Display help string as a tip rather than inline.
Definition: edtwin.cxx:268
std::vector< std::pair< OUString, sal_uInt16 > > m_aHelpStrings
Strings that at least partially match an input word, and match length.
Definition: edtwin.cxx:260
bool HasContent() const
Definition: edtwin.cxx:284
void Next(bool bEndLess)
Next help string.
Definition: edtwin.cxx:289
void ClearContent()
Definition: edtwin.cxx:6248
const OUString & CurStr() const
Definition: edtwin.cxx:285
void FillStrArr(SwWrtShell const &rSh, const OUString &rWord)
Definition: edtwin.cxx:6314
bool m_bAppendSpace
Append a space character to the displayed help string (if appropriate).
Definition: edtwin.cxx:272
void Move(QuickHelpData &rCpy)
Definition: edtwin.cxx:6236
void Stop(SwWrtShell &rSh)
Definition: edtwin.cxx:6302
void Start(SwWrtShell &rSh, bool bRestart)
Definition: edtwin.cxx:6258
void SortAndFilter(const OUString &rOrigWord)
Definition: edtwin.cxx:6467
sal_uInt16 nCurArrPos
Index of the current help string.
Definition: edtwin.cxx:262
void Previous(bool bEndLess)
Previous help string.
Definition: edtwin.cxx:295
bool m_bIsAutoText
Help data stores AutoText names rather than AutoComplete words.
Definition: edtwin.cxx:266
const SvxURLField * mpURLField
SdrEventKind meEvent
sal_uInt16 nAutoCmpltExpandKey
SfxStyleFamily eType
Definition: view.hxx:117
sal_uInt16 nColor
Definition: view.hxx:118
SwFormatClipboard * m_pFormatClipboard
Definition: view.hxx:119
bool HasEvent() const
Definition: swevent.hxx:117
void Set(SwCallEventObjectType eTyp, const SwFrameFormat *pFormat)
Definition: swevent.hxx:87
union SwContentAtPos::@21 aFnd
SwContentNode * pNode
Definition: crsrsh.hxx:109
bool IsInProtectSect() const
is the node in a protected section?
Definition: crstrvl.cxx:2129
const SfxPoolItem * pAttr
Definition: crsrsh.hxx:107
OUString sStr
Definition: crsrsh.hxx:114
const SwField * pField
Definition: crsrsh.hxx:106
const SwTextAttr * pFndTextAttr
Definition: crsrsh.hxx:115
IsAttrAtPos eContentAtPos
Definition: crsrsh.hxx:112
const sw::mark::IFieldmark * pFieldmark
Definition: crsrsh.hxx:110
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:267
SwNodeOffset GetNodeIndex() const
Definition: pam.hxx:78
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:262
SdrHdlKind
SdrHitKind
SdrObjKind
@ EVENT_OBJECT_URLITEM
Definition: swevent.hxx:50
RndStdIds
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
bool g_bNoInterrupt
Definition: swmodule.cxx:115
#define SW_MOD()
Definition: swmodule.hxx:254
constexpr bool SW_ISPRINTABLE(sal_Unicode c)
Definition: swtypes.hxx:171
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
FrameControlType
Definition: swtypes.hxx:246
#define MINFLY
Definition: swtypes.hxx:61
SwUndoId
Definition: swundo.hxx:30
@ INS_FROM_SHADOWCRSR
@ UI_DRAG_AND_COPY
LoadUrlFlags
Definition: swurl.hxx:27
bool bVisible
@ TOX_INDEX
Definition: toxe.hxx:41
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
bool ExecuteMenuCommand(const css::uno::Reference< css::awt::XPopupMenu > &rMenu, const SfxViewFrame &rViewFrame, sal_uInt16 nId)
Definition: uitool.cxx:883
void ApplyCharBackground(Color const &rBackgroundColor, model::ComplexColor const &rComplexColor, SwWrtShell &rShell)
Apply character background on the shell.
Definition: uitool.cxx:197
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:756
sal_Int64 WinBits
WinBits const WB_DIALOGCONTROL
WinBits const WB_CLIPCHILDREN
void LoadURL(SwViewShell &rVSh, const OUString &rURL, LoadUrlFlags nFilter, const OUString &rTargetFrameName)
Definition: wrtsh2.cxx:555