LibreOffice Module sw (master) 1
viscrs.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_feature_desktop.h>
21
22#include <vcl/weld.hxx>
23#include <vcl/svapp.hxx>
24#include <vcl/settings.hxx>
25#include <viewopt.hxx>
26#include <frmtool.hxx>
27#include <viscrs.hxx>
28#include <crsrsh.hxx>
29#include <doc.hxx>
30#include <swtable.hxx>
31#include <viewimp.hxx>
32#include <dview.hxx>
33#include <rootfrm.hxx>
34#include <txtfrm.hxx>
35#include <ndtxt.hxx>
36#include <txtfld.hxx>
37#include <scriptinfo.hxx>
38#include <view.hxx>
40
43#include <svx/srchdlg.hxx>
46
47#include <memory>
48
49#include <LibreOfficeKit/LibreOfficeKitEnums.h>
50#include <comphelper/lok.hxx>
51#include <sfx2/lokhelper.hxx>
52#include <boost/property_tree/json_parser.hpp>
53#include <comphelper/string.hxx>
54#include <osl/diagnose.h>
55#include <paintfrm.hxx>
56#include <PostItMgr.hxx>
57#include <SwGrammarMarkUp.hxx>
58#include <docsh.hxx>
60#include <o3tl/string_view.hxx>
61#include <tools/json_writer.hxx>
62#include <cellfrm.hxx>
63#include <wrtsh.hxx>
67
68// Here static members are defined. They will get changed on alteration of the
69// MapMode. This is done so that on ShowCursor the same size does not have to be
70// expensively determined again and again.
71
75
76// Starting from here: classes / methods for the non-text-cursor
78 : m_pCursorShell( pCShell )
79 , m_nPageLastTime(0)
80{
81 pCShell->GetWin()->SetCursor( &m_aTextCursor );
83 m_bIsDragCursor = false;
85}
86
88{
91
92 m_pCursorShell->GetWin()->SetCursor( nullptr );
93}
94
96{
97 if( !m_bIsVisible )
98 {
99 m_bIsVisible = true;
100
101 // display at all?
103 SetPosAndShow(nullptr);
104 }
105}
106
108{
109 if( m_bIsVisible )
110 {
111 m_bIsVisible = false;
112
113 if( m_aTextCursor.IsVisible() ) // Shouldn't the flags be in effect?
115 }
116}
117
118namespace
119{
120
121// Build JSON message to be sent to Online
122OString buildHyperlinkJSON(const OUString& sText, const OUString& sLink)
123{
124 boost::property_tree::ptree aTree;
125 aTree.put("text", sText);
126 aTree.put("link", sLink);
127 std::stringstream aStream;
128 boost::property_tree::write_json(aStream, aTree, false);
129
130 return OString(o3tl::trim(aStream.str()));
131}
132
133}
134
136{
137 SwRect aRect;
139 if( 0 > nTmpY )
140 {
141 nTmpY = -nTmpY;
142 m_aTextCursor.SetOrientation( 900_deg10 );
144 Size( m_pCursorShell->m_aCharRect.Height(), nTmpY ) );
145 aRect.Pos().setX(aRect.Pos().getX() + m_pCursorShell->m_aCursorHeight.getX());
147 aRect.Pos().setY(aRect.Pos().getY() + aRect.Width());
148 }
149 else
150 {
153 Size( m_pCursorShell->m_aCharRect.Width(), nTmpY ) );
154 aRect.Pos().setY(aRect.Pos().getY() + m_pCursorShell->m_aCursorHeight.getX());
155 }
156
157 // check if cursor should show the current cursor bidi level
159 const SwCursor* pTmpCursor = m_pCursorShell->GetCursor_();
160
161 if ( pTmpCursor && !m_pCursorShell->IsOverwriteCursor() )
162 {
163 SwNode& rNode = pTmpCursor->GetPoint()->GetNode();
164 if( rNode.IsTextNode() )
165 {
166 const SwTextNode& rTNd = *rNode.GetTextNode();
167 const SwFrame* pFrame = rTNd.getLayoutFrame(m_pCursorShell->GetLayout(), nullptr, nullptr);
168 if ( pFrame )
169 {
170 const SwScriptInfo* pSI = static_cast<const SwTextFrame*>(pFrame)->GetScriptInfo();
171 // cursor level has to be shown
172 if ( pSI && pSI->CountDirChg() > 1 )
173 {
175 ( pTmpCursor->GetCursorBidiLevel() % 2 ) ?
176 CursorDirection::RTL :
177 CursorDirection::LTR );
178 }
179 if ( pFrame->IsRightToLeft() )
180 {
182 if ( pOut )
183 {
184 tools::Long nSize = pOut->GetSettings().GetStyleSettings().GetCursorSize();
185 Size aSize( nSize, nSize );
186 aSize = pOut->PixelToLogic( aSize );
187 aRect.Left( aRect.Left() - aSize.Width() );
188 }
189 }
190 }
191 }
192 }
193
194 if( aRect.Height())
195 {
197
198 // Disable pixel alignment when tiled rendering, so that twip values of
199 // the cursor don't depend on statics.
201 ::SwAlignRect( aRect, static_cast<SwViewShell const *>(m_pCursorShell), m_pCursorShell->GetOut() );
202 }
205 aRect.Width( 0 );
206
207 m_aTextCursor.SetSize( aRect.SSize() );
208
209 m_aTextCursor.SetPos( aRect.Pos() );
210
211 bool bPostItActive = false;
212 SwView* pView = dynamic_cast<SwView*>(m_pCursorShell->GetSfxViewShell());
213 if (pView)
214 {
215 if (SwPostItMgr* pPostItMgr = pView->GetPostItMgr())
216 bPostItActive = pPostItMgr->GetActiveSidebarWin() != nullptr;
217 }
218
219 if (comphelper::LibreOfficeKit::isActive() && !bPostItActive)
220 {
221 // notify about page number change (if that happened)
222 sal_uInt16 nPage, nVirtPage;
223 // bCalcFrame=false is important to avoid calculating the layout when
224 // we're in the middle of doing that already.
225 const_cast<SwCursorShell*>(m_pCursorShell)->GetPageNum(nPage, nVirtPage, /*bAtCursorPos=*/true, /*bCalcFrame=*/false);
226 if (nPage != m_nPageLastTime)
227 {
228 m_nPageLastTime = nPage;
229 OString aPayload = OString::number(nPage - 1);
230 m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr());
231 }
232
233 // This may get called often, so instead of sending data on each update, just notify
234 // that there's been an update, and the other side will pull the data using
235 // getLOKPayload() when it decides to.
236 m_aLastLOKRect = aRect;
237 if (pViewShell)
238 {
239 if (pViewShell == m_pCursorShell->GetSfxViewShell())
240 {
241 SfxLokHelper::notifyUpdatePerViewId(pViewShell, LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);
242 }
243 else
244 {
246 LOK_CALLBACK_INVALIDATE_VIEW_CURSOR);
247 }
248 }
249 else
250 {
252 m_pCursorShell->GetSfxViewShell(), LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);
254 }
255 }
256
258 return;
259
261 const_cast<SwDrawView*>(static_cast<const SwDrawView*>(m_pCursorShell->GetDrawView()))->SetAnimationEnabled(
263
264 sal_uInt16 nStyle = m_bIsDragCursor ? CURSOR_SHADOW : 0;
265 if( nStyle != m_aTextCursor.GetStyle() )
266 {
267 m_aTextCursor.SetStyle( nStyle );
269 }
270
272}
273
274std::optional<OString> SwVisibleCursor::getLOKPayload(int nType, int nViewId) const
275{
276 assert(nType == LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR || nType == LOK_CALLBACK_INVALIDATE_VIEW_CURSOR);
278 {
279 SwRect aRect = m_aLastLOKRect;
280
281 // notify about the cursor position & size
282 tools::Rectangle aSVRect(aRect.Pos().getX(), aRect.Pos().getY(), aRect.Pos().getX() + aRect.SSize().Width(), aRect.Pos().getY() + aRect.SSize().Height());
283 OString sRect = aSVRect.toString();
284
285 if(nType == LOK_CALLBACK_INVALIDATE_VIEW_CURSOR)
286 return SfxLokHelper::makePayloadJSON(m_pCursorShell->GetSfxViewShell(), nViewId, "rectangle", sRect);
287
288 // is cursor at a misspelled word ?
289 bool bIsWrong = false;
290 SwView* pView = dynamic_cast<SwView*>(m_pCursorShell->GetSfxViewShell());
291 if (pView && pView->GetWrtShellPtr())
292 {
293 const SwViewOption* pVOpt = pView->GetWrtShell().GetViewOptions();
294 if(pVOpt && pVOpt->IsOnlineSpell())
295 {
296 SwPaM* pCursor = m_pCursorShell->GetCursor();
297 SwPosition aPos(*pCursor->GetPoint());
298 Point aPt = aRect.Pos();
300 SwTextNode *pNode = nullptr;
301 if (m_pCursorShell->GetLayout()->GetModelPositionForViewPoint(&aPos, aPt, &eTmpState))
302 pNode = aPos.GetNode().GetTextNode();
303 if (pNode && !pNode->IsInProtectSect())
304 {
305 sal_Int32 nBegin = aPos.GetContentIndex();
306 sal_Int32 nLen = 1;
307
308 SwWrongList *pWrong = pNode->GetWrong();
309 if (!pWrong)
310 pWrong = pNode->GetGrammarCheck();
311 if (pWrong)
312 bIsWrong = pWrong->InWrongWord(nBegin,nLen) && !pNode->IsSymbolAt(nBegin);
313 }
314 }
315 }
316
317 OString sHyperlink;
319 bool bIsSelection = m_pCursorShell->IsSelection();
320
321 if (const_cast<SwCursorShell*>(m_pCursorShell)->GetContentAtPos(aRect.Pos(), aContentAtPos))
322 {
323 const SwFormatINetFormat* pItem = static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr);
324 sHyperlink = buildHyperlinkJSON(aContentAtPos.sStr, pItem->GetValue());
325 }
326 else if (bIsSelection)
327 {
329
330 if (pShell)
331 {
334 pShell->GetCurAttr(aSet);
335 if(SfxItemState::SET <= aSet.GetItemState( RES_TXTATR_INETFMT ))
336 {
337 sHyperlink = buildHyperlinkJSON(m_pCursorShell->GetSelText(),
338 aSet.GetItem(RES_TXTATR_INETFMT)->GetValue());
339 }
340 }
341 }
342
343 return SfxLokHelper::makeVisCursorInvalidation(nViewId, sRect, bIsWrong, sHyperlink);
344 }
345 else
346 abort();
347}
348
350{
351 return m_aTextCursor;
352}
353
355 : m_pCursorShell( &rCSh )
356#if HAVE_FEATURE_DESKTOP
357 , m_bShowTextInputFieldOverlay(true)
358 , m_bShowContentControlOverlay(true)
359#endif
360{
361}
362
364{
365 Hide();
367}
368
370{
371 SwRects::swap(rSwap);
372
373#if HAVE_FEATURE_DESKTOP
374 // #i75172# also swap m_pCursorOverlay
375 std::swap(m_pCursorOverlay, rSwap.m_pCursorOverlay);
380#endif
381}
382
384{
385#if HAVE_FEATURE_DESKTOP
386 m_pCursorOverlay.reset();
389#endif
390
391 SwRects::clear();
392}
393
402static SwRect lcl_getLayoutRect(const Point& rPoint, const SwPosition& rPosition)
403{
404 const SwContentNode* pNode = rPosition.GetNode().GetContentNode();
405 std::pair<Point, bool> const tmp(rPoint, true);
406 const SwContentFrame* pFrame = pNode->getLayoutFrame(
408 &rPosition, &tmp);
409 SwRect aRect;
410 pFrame->GetCharRect(aRect, rPosition);
411 return aRect;
412}
413
414void SwShellCursor::FillStartEnd(SwRect& rStart, SwRect& rEnd) const
415{
416 const SwShellCursor* pCursor = GetShell()->getShellCursor(false);
417 rStart = lcl_getLayoutRect(pCursor->GetSttPos(), *pCursor->Start());
418 rEnd = lcl_getLayoutRect(pCursor->GetEndPos(), *pCursor->End());
419}
420
421void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
422{
423 SdrView *const pView = const_cast<SdrView*>(m_pCursorShell->GetDrawView());
424
425 if(!(pView && pView->PaintWindowCount()))
426 return;
427
428 // reset rects
429 SwRects::clear();
430 FillRects();
431
432#if HAVE_FEATURE_DESKTOP
433 // get new rects
434 std::vector< basegfx::B2DRange > aNewRanges;
435 aNewRanges.reserve(size());
436 for(size_type a = 0; a < size(); ++a)
437 {
438 const SwRect aNextRect((*this)[a]);
439 const tools::Rectangle aPntRect(aNextRect.SVRect());
440
441 aNewRanges.emplace_back(
442 aPntRect.Left(), aPntRect.Top(),
443 aPntRect.Right() + 1, aPntRect.Bottom() + 1);
444 }
445
446 if (m_pCursorOverlay)
447 {
448 if(!aNewRanges.empty())
449 {
450 static_cast<sdr::overlay::OverlaySelection*>(m_pCursorOverlay.get())->setRanges(std::move(aNewRanges));
451 }
452 else
453 {
454 m_pCursorOverlay.reset();
455 }
456 }
457 else if(!empty())
458 {
459 SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
460 const rtl::Reference< sdr::overlay::OverlayManager >& xTargetOverlay = pCandidate->GetOverlayManager();
461
462 if (xTargetOverlay.is())
463 {
464 // get the system's highlight color
466
467 // create correct selection
468 m_pCursorOverlay.reset( new sdr::overlay::OverlaySelection(
470 aHighlight,
471 std::move(aNewRanges),
472 true) );
473
474 xTargetOverlay->add(*m_pCursorOverlay);
475 }
476 }
477
480#endif
481
482 // Tiled editing does not expose the draw and writer cursor, it just
483 // talks about "the" cursor at the moment. As long as that's true,
484 // don't say anything about the Writer cursor till a draw object is
485 // being edited.
487 return;
488
489 // If pSelectionRectangles is set, we're just collecting the text selections -> don't emit start/end.
490 if (!empty() && !pSelectionRectangles)
491 {
492 SwRect aStartRect;
493 SwRect aEndRect;
494 FillStartEnd(aStartRect, aEndRect);
495
496 if (aStartRect.HasArea())
497 SfxLokHelper::notifyUpdate(GetShell()->GetSfxViewShell(), LOK_CALLBACK_TEXT_SELECTION_START);
498 if (aEndRect.HasArea())
499 SfxLokHelper::notifyUpdate(GetShell()->GetSfxViewShell(), LOK_CALLBACK_TEXT_SELECTION_END);
500 }
501
502 std::vector<OString> aRect;
503 aRect.reserve(size());
504 for (size_type i = 0; i < size(); ++i)
505 {
506 const SwRect& rRect = (*this)[i];
507 aRect.push_back(rRect.SVRect().toString());
508 }
509 OString sRect = comphelper::string::join("; ", aRect);
510 if (!pSelectionRectangles)
511 {
512 SfxLokHelper::notifyUpdate(GetShell()->GetSfxViewShell(),LOK_CALLBACK_TEXT_SELECTION);
513 SfxLokHelper::notifyOtherViewsUpdatePerViewId(GetShell()->GetSfxViewShell(), LOK_CALLBACK_TEXT_VIEW_SELECTION);
514 }
515 else
516 pSelectionRectangles->push_back(sRect);
517}
518
519std::optional<OString> SwSelPaintRects::getLOKPayload(int nType, int nViewId) const
520{
521 switch( nType )
522 {
523 case LOK_CALLBACK_TEXT_SELECTION_START:
524 case LOK_CALLBACK_TEXT_SELECTION_END:
525 {
526 // The selection may be a complex polygon, emit the logical
527 // start/end cursor rectangle of the selection as separate
528 // events, if there is a real selection.
529 // This can be used to easily show selection handles on the
530 // client side.
531 SwRect aStartRect;
532 SwRect aEndRect;
533 FillStartEnd(aStartRect, aEndRect);
534
535 // no selection rect
536 if (!size())
537 return {};
538
539 if( nType == LOK_CALLBACK_TEXT_SELECTION_START )
540 {
541 if (aStartRect.HasArea())
542 return aStartRect.SVRect().toString();
543 return {};
544 }
545 else // LOK_CALLBACK_TEXT_SELECTION_END
546 {
547 if (aEndRect.HasArea())
548 return aEndRect.SVRect().toString();
549 return {};
550 }
551 }
552 break;
553 case LOK_CALLBACK_TEXT_SELECTION:
554 case LOK_CALLBACK_TEXT_VIEW_SELECTION:
555 {
556 std::vector<OString> aRect;
557 aRect.reserve(size());
558 for (size_type i = 0; i < size(); ++i)
559 {
560 const SwRect& rRect = (*this)[i];
561 aRect.push_back(rRect.SVRect().toString());
562 }
563 OString sRect = comphelper::string::join("; ", aRect);
564 if( nType == LOK_CALLBACK_TEXT_SELECTION )
565 return sRect;
566 else // LOK_CALLBACK_TEXT_VIEW_SELECTION
567 return SfxLokHelper::makePayloadJSON(GetShell()->GetSfxViewShell(), nViewId, "selection", sRect);
568 }
569 break;
570 }
571 abort();
572}
573
575{
576 std::vector< basegfx::B2DRange > aInputFieldRanges;
577
579 {
580 SwTextInputField* pCurTextInputFieldAtCursor =
582 if ( pCurTextInputFieldAtCursor != nullptr )
583 {
584 SwTextNode* pTextNode = pCurTextInputFieldAtCursor->GetpTextNode();
585 std::unique_ptr<SwShellCursor> pCursorForInputTextField(
586 new SwShellCursor( *GetShell(), SwPosition( *pTextNode, pCurTextInputFieldAtCursor->GetStart() ) ) );
587 pCursorForInputTextField->SetMark();
588 pCursorForInputTextField->GetMark()->Assign(*pTextNode, *(pCurTextInputFieldAtCursor->End()) );
589
590 pCursorForInputTextField->FillRects();
591 SwRects* pRects = pCursorForInputTextField.get();
592 for (const SwRect & rNextRect : *pRects)
593 {
594 const tools::Rectangle aPntRect(rNextRect.SVRect());
595
596 aInputFieldRanges.emplace_back(
597 aPntRect.Left(), aPntRect.Top(),
598 aPntRect.Right() + 1, aPntRect.Bottom() + 1);
599 }
600 }
601 }
602
603 if ( !aInputFieldRanges.empty() )
604 {
605 if (m_pTextInputFieldOverlay != nullptr)
606 {
607 m_pTextInputFieldOverlay->setRanges( std::move(aInputFieldRanges) );
608 }
609 else
610 {
611 SdrView* pView = const_cast<SdrView*>(GetShell()->GetDrawView());
612 SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
613 const rtl::Reference<sdr::overlay::OverlayManager>& xTargetOverlay = pCandidate->GetOverlayManager();
614
615 if (xTargetOverlay.is())
616 {
617 // use system's highlight color with decreased luminance as highlight color
619 aHighlight.DecreaseLuminance( 128 );
620
622 aHighlight, std::move(aInputFieldRanges) ) );
623 xTargetOverlay->add( *m_pTextInputFieldOverlay );
624 }
625 }
626 }
627 else
628 {
630 }
631}
632
634{
635 std::vector<basegfx::B2DRange> aContentControlRanges;
636 std::vector<OString> aLOKRectangles;
637 SwRect aLastPortionPaintArea;
638 std::shared_ptr<SwContentControl> pContentControl;
639
641 {
642 const SwPosition* pStart = GetShell()->GetCursor()->Start();
643 SwTextNode* pTextNode = pStart->GetNode().GetTextNode();
644 SwTextContentControl* pCurContentControlAtCursor = nullptr;
645 if (pTextNode)
646 {
647 // GetTextAttrMode::Parent because this way we highlight when the user will type inside the
648 // content control, not outside of it.
649 SwTextAttr* pAttr = pTextNode->GetTextAttrAt(
651 if (pAttr)
652 {
653 pCurContentControlAtCursor = static_txtattr_cast<SwTextContentControl*>(pAttr);
654 }
655 }
656 if (pCurContentControlAtCursor)
657 {
658 auto pCursorForContentControl = std::make_unique<SwShellCursor>(
659 *GetShell(), SwPosition(*pTextNode, pCurContentControlAtCursor->GetStart()));
660 pCursorForContentControl->SetMark();
661 pCursorForContentControl->GetMark()->Assign(
662 *pTextNode, *(pCurContentControlAtCursor->End()));
663
664 pCursorForContentControl->FillRects();
665 SwRects* pRects = pCursorForContentControl.get();
666 for (const auto& rRect : *pRects)
667 {
668 tools::Rectangle aRect(rRect.SVRect());
669
670 aContentControlRanges.emplace_back(aRect.Left(), aRect.Top(), aRect.Right() + 1,
671 aRect.Bottom() + 1);
673 {
674 aLOKRectangles.push_back(aRect.toString());
675 }
676 }
677
678 if (!pRects->empty())
679 {
680 aLastPortionPaintArea = (*pRects)[pRects->size() - 1];
681 }
682 pContentControl = pCurContentControlAtCursor->GetContentControl().GetContentControl();
683 }
684 }
685
686 if (!aContentControlRanges.empty())
687 {
689 {
690 OString aPayload = comphelper::string::join("; ", aLOKRectangles);
691 tools::JsonWriter aJson;
692 aJson.put("action", "show");
693 aJson.put("rectangles", aPayload);
694
695 if (pContentControl && pContentControl->HasListItems())
696 {
697 tools::ScopedJsonWriterArray aItems = aJson.startArray("items");
698 for (const auto& rItem : pContentControl->GetListItems())
699 {
700 aJson.putSimpleValue(rItem.ToString());
701 }
702 }
703
704 if (pContentControl && pContentControl->GetDate())
705 {
706 aJson.put("date", "true");
707 }
708
709 std::unique_ptr<char, o3tl::free_delete> pJson(aJson.extractData());
710 GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CONTENT_CONTROL, pJson.get());
711 }
713 {
714 m_pContentControlOverlay->setRanges(std::move(aContentControlRanges));
715 }
716 else
717 {
718 SdrView* pView = const_cast<SdrView*>(GetShell()->GetDrawView());
719 SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
721 = pCandidate->GetOverlayManager();
722
723 if (xTargetOverlay.is())
724 {
725 // Use the system's highlight color with decreased luminance as highlight color.
727 aHighlight.DecreaseLuminance(128);
728
730 aHighlight, std::move(aContentControlRanges)));
731 xTargetOverlay->add(*m_pContentControlOverlay);
732 }
733 }
734
735 if (pContentControl && pContentControl->HasListItems())
736 {
737 auto pWrtShell = dynamic_cast<const SwWrtShell*>(GetShell());
738 if (pWrtShell)
739 {
740 auto& rEditWin = const_cast<SwEditWin&>(pWrtShell->GetView().GetEditWin());
742 && m_pContentControlButton->GetContentControl() != pContentControl)
743 {
745 }
747 {
749 &rEditWin, pContentControl);
750 }
751 m_pContentControlButton->CalcPosAndSize(aLastPortionPaintArea);
753 }
754 }
755 if (pContentControl && pContentControl->GetDate())
756 {
757 auto pWrtShell = dynamic_cast<const SwWrtShell*>(GetShell());
758 if (pWrtShell)
759 {
760 auto& rEditWin = const_cast<SwEditWin&>(pWrtShell->GetView().GetEditWin());
762 && m_pContentControlButton->GetContentControl() != pContentControl)
763 {
765 }
767 {
769 &rEditWin, pContentControl, pWrtShell->GetDoc()->GetNumberFormatter());
770 }
771 m_pContentControlButton->CalcPosAndSize(aLastPortionPaintArea);
773 }
774 }
775 }
776 else
777 {
779 {
780 tools::JsonWriter aJson;
781 aJson.put("action", "hide");
782 std::unique_ptr<char, o3tl::free_delete> pJson(aJson.extractData());
783 GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CONTENT_CONTROL, pJson.get());
784 }
786
788 {
790 }
791 }
792}
793
795{
797}
798
800{
801 size_type nSz = size();
802 if( !nSz )
803 return;
804
805 SwRegionRects aReg( GetShell()->VisArea() );
806 aReg.assign( begin(), end() );
807 aReg -= rRect;
808 SwRects::erase( begin(), begin() + nSz );
809 SwRects::insert( begin(), aReg.begin(), aReg.end() );
810
811 // If the selection is to the right or at the bottom, outside the
812 // visible area, it is never aligned on one pixel at the right/bottom.
813 // This has to be determined here and if that is the case the
814 // rectangle has to be expanded.
815 if( !(GetShell()->m_bVisPortChgd && 0 != ( nSz = size())) )
816 return;
817
819 iterator it = begin();
820 for( ; nSz--; ++it )
821 {
822 SwRect& rRectIt = *it;
823 if( rRectIt.Right() == GetShell()->m_aOldRBPos.X() )
824 rRectIt.AddRight( s_nPixPtX );
825 if( rRectIt.Bottom() == GetShell()->m_aOldRBPos.Y() )
826 rRectIt.AddBottom( s_nPixPtY );
827 }
828}
829
830// check current MapMode of the shell and set possibly the static members.
831// Optional set the parameters pX, pY
833 tools::Long* pX, tools::Long* pY )
834{
835 const OutputDevice* pOut = rSh.GetWin()->GetOutDev();
836 if ( ! pOut )
837 pOut = rSh.GetOut();
838
839 const MapMode& rMM = pOut->GetMapMode();
840 if (s_pMapMode->GetMapUnit() != rMM.GetMapUnit() ||
841 s_pMapMode->GetScaleX() != rMM.GetScaleX() ||
842 s_pMapMode->GetScaleY() != rMM.GetScaleY())
843 {
844 *s_pMapMode = rMM;
845 Size aTmp( 1, 1 );
846 aTmp = pOut->PixelToLogic( aTmp );
847 s_nPixPtX = aTmp.Width();
848 s_nPixPtY = aTmp.Height();
849 }
850 if( pX )
851 *pX = s_nPixPtX;
852 if( pY )
853 *pY = s_nPixPtY;
854}
855
857 const SwCursorShell& rCShell,
858 const SwPosition &rPos )
859 : SwCursor(rPos,nullptr)
860 , SwSelPaintRects(rCShell)
861 , m_pInitialPoint(SwPaM::GetPoint())
862{}
863
865 const SwCursorShell& rCShell,
866 const SwPosition &rPos,
867 const Point& rPtPos,
868 SwPaM* pRing )
869 : SwCursor(rPos, pRing)
870 , SwSelPaintRects(rCShell)
871 , m_MarkPt(rPtPos)
872 , m_PointPt(rPtPos)
873 , m_pInitialPoint(SwPaM::GetPoint())
874{}
875
877 : SwCursor(rICursor, &rICursor)
878 , SwSelPaintRects(*rICursor.GetShell())
879 , m_MarkPt(rICursor.GetMkPos())
880 , m_PointPt(rICursor.GetPtPos())
881 , m_pInitialPoint(SwPaM::GetPoint())
882{}
883
885{}
886
888{
889 return GetShell()->IsReadOnlyAvailable();
890}
891
893{
896 else
899}
900
902{
903 // calculate the new rectangles
904 if( HasMark() &&
905 GetPoint()->GetNode().IsContentNode() &&
906 GetPoint()->GetNode().GetContentNode()->getLayoutFrame( GetShell()->GetLayout() ) &&
907 (GetMark()->GetNode() == GetPoint()->GetNode() ||
908 (GetMark()->GetNode().IsContentNode() &&
909 GetMark()->GetNode().GetContentNode()->getLayoutFrame( GetShell()->GetLayout() ) ) ))
910 GetShell()->GetLayout()->CalcFrameRects( *this );
911}
912
913void SwShellCursor::Show(SfxViewShell const * pViewShell)
914{
915 std::vector<OString> aSelectionRectangles;
916 for(SwPaM& rPaM : GetRingContainer())
917 {
918 SwShellCursor* pShCursor = dynamic_cast<SwShellCursor*>(&rPaM);
919 if(pShCursor)
920 pShCursor->SwSelPaintRects::Show(&aSelectionRectangles);
921 }
922
924 return;
925
926 std::vector<OString> aRect;
927 for (const OString & rSelectionRectangle : aSelectionRectangles)
928 {
929 if (rSelectionRectangle.isEmpty())
930 continue;
931 aRect.push_back(rSelectionRectangle);
932 }
933 OString sRect = comphelper::string::join("; ", aRect);
934 if (pViewShell)
935 {
936 // Just notify pViewShell about our existing selection.
937 if (pViewShell != GetShell()->GetSfxViewShell())
938 SfxLokHelper::notifyOtherView(GetShell()->GetSfxViewShell(), pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRect);
939 }
940 else
941 {
942 GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
943 SfxLokHelper::notifyOtherViews(GetShell()->GetSfxViewShell(), LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRect);
944 }
945}
946
947// This rectangle gets painted anew, therefore the SSelection in this
948// area is invalid.
950{
951 for(SwPaM& rPaM : GetRingContainer())
952 {
953 SwShellCursor* pShCursor = dynamic_cast<SwShellCursor*>(&rPaM);
954 // skip any non SwShellCursor objects in the ring
955 // see also: SwAutoFormat::DeleteSel()
956 if(pShCursor)
957 pShCursor->SwSelPaintRects::Invalidate(rRect);
958 }
959}
960
962{
963 for(SwPaM& rPaM : GetRingContainer())
964 {
965 SwShellCursor* pShCursor = dynamic_cast<SwShellCursor*>(&rPaM);
966 if(pShCursor)
967 pShCursor->SwSelPaintRects::Hide();
968 }
969}
970
972{
973 return new SwShellCursor( *GetShell(), *GetPoint(), GetPtPos(), pRing );
974}
975
977{
978 short nRet = RET_YES;
980 if( pDlg )
981 {
982 // Terminate old actions. The table-frames get constructed and
983 // a SSelection can be created.
984 std::vector<sal_uInt16> vActionCounts;
985 for(SwViewShell& rShell : const_cast< SwCursorShell* >( GetShell() )->GetRingContainer())
986 {
987 sal_uInt16 nActCnt = 0;
988 while(rShell.ActionPend())
989 {
990 rShell.EndAction();
991 ++nActCnt;
992 }
993 vActionCounts.push_back(nActCnt);
994 }
995 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pDlg->getDialog(), "modules/swriter/ui/asksearchdialog.ui"));
996 std::unique_ptr<weld::MessageDialog> xDialog(xBuilder->weld_message_dialog("AskSearchDialog"));
997 nRet = xDialog->run();
998 auto pActionCount = vActionCounts.begin();
999 for(SwViewShell& rShell : const_cast< SwCursorShell* >( GetShell() )->GetRingContainer())
1000 {
1001 while(*pActionCount)
1002 {
1003 rShell.StartAction();
1004 --(*pActionCount);
1005 }
1006 ++pActionCount;
1007 }
1008 }
1009 else
1010 // otherwise from the Basic, and then switch to RET_YES
1011 nRet = RET_YES;
1012
1013 return nRet;
1014}
1015
1017{
1018 const_cast<SwCursorShell*>(GetShell())->SaveTableBoxContent( pPos );
1019}
1020
1021bool SwShellCursor::UpDown( bool bUp, sal_uInt16 nCnt )
1022{
1023 return SwCursor::UpDown( bUp, nCnt,
1024 &GetPtPos(), GetShell()->GetUpDownX(),
1025 *GetShell()->GetLayout());
1026}
1027
1028// if <true> than the cursor can be set to the position.
1029bool SwShellCursor::IsAtValidPos( bool bPoint ) const
1030{
1031 if( GetShell() && ( GetShell()->IsAllProtect() ||
1032 GetShell()->GetViewOptions()->IsReadonly() ||
1033 ( GetShell()->Imp()->GetDrawView() &&
1034 GetShell()->Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() )))
1035 return true;
1036
1037 return SwCursor::IsAtValidPos( bPoint );
1038}
1039
1041 const SwPosition& rPos )
1042 : SwCursor(rPos,nullptr), SwShellCursor(rCursorSh, rPos), SwTableCursor(rPos)
1043{
1044}
1045
1047 const SwPosition& rMkPos, const Point& rMkPt,
1048 const SwPosition& rPtPos, const Point& rPtPt )
1049 : SwCursor(rPtPos,nullptr), SwShellCursor(rCursorSh, rPtPos), SwTableCursor(rPtPos)
1050{
1051 SetMark();
1052 *GetMark() = rMkPos;
1053 GetMkPos() = rMkPt;
1054 GetPtPos() = rPtPt;
1055}
1056
1058
1060
1062{
1063 return SwShellCursor::Create( pRing );
1064}
1065
1067{
1069}
1070
1072{
1074}
1075
1077{
1078 // Calculate the new rectangles. If the cursor is still "parked" do nothing
1079 if (m_SelectedBoxes.empty() || m_bParked || !GetPoint()->GetNodeIndex())
1080 return;
1081
1082 bool bStart = true;
1084 ? GetShell()->getIDocumentLayoutAccess().GetCurrentLayout()->getFrameArea()
1085 : GetShell()->VisArea() );
1086 SwNodes& rNds = GetDoc().GetNodes();
1087 SwFrame* pEndFrame = nullptr;
1088 for (size_t n = 0; n < m_SelectedBoxes.size(); ++n)
1089 {
1090 const SwStartNode* pSttNd = m_SelectedBoxes[n]->GetSttNd();
1091 const SwTableNode* pSelTableNd = pSttNd->FindTableNode();
1092
1093 SwNodeIndex aIdx( *pSttNd );
1094 SwContentNode* pCNd = rNds.GoNextSection( &aIdx, true, false );
1095
1096 // table in table
1097 // (see also lcl_FindTopLevelTable in unoobj2.cxx for a different
1098 // version to do this)
1099 const SwTableNode* pCurTableNd = pCNd ? pCNd->FindTableNode() : nullptr;
1100 while ( pSelTableNd != pCurTableNd && pCurTableNd )
1101 {
1102 aIdx = pCurTableNd->EndOfSectionIndex();
1103 pCNd = rNds.GoNextSection( &aIdx, true, false );
1104 pCurTableNd = pCNd->FindTableNode();
1105 }
1106
1107 if( !pCNd )
1108 continue;
1109
1110 std::pair<Point, bool> const tmp(GetSttPos(), false);
1111 SwFrame* pFrame = pCNd->getLayoutFrame(GetShell()->GetLayout(), nullptr, &tmp);
1112 while( pFrame && !pFrame->IsCellFrame() )
1113 pFrame = pFrame->GetUpper();
1114
1115 OSL_ENSURE( pFrame, "Node not in a table" );
1116
1117 while ( pFrame )
1118 {
1119 if( aReg.GetOrigin().Overlaps( pFrame->getFrameArea() ) )
1120 {
1121 aReg -= pFrame->getFrameArea();
1122 if (bStart)
1123 {
1124 bStart = false;
1125 m_aStart = SwRect(pFrame->getFrameArea().Left(), pFrame->getFrameArea().Top(), 1, pFrame->getFrameArea().Height());
1126 }
1127 }
1128
1129 pEndFrame = pFrame;
1130 pFrame = pFrame->GetNextCellLeaf();
1131 }
1132 }
1133 if (pEndFrame)
1134 m_aEnd = SwRect(pEndFrame->getFrameArea().Right(), pEndFrame->getFrameArea().Top(), 1, pEndFrame->getFrameArea().Height());
1135 aReg.Invert();
1136 insert( begin(), aReg.begin(), aReg.end() );
1137}
1138
1140{
1141 rStart = m_aStart;
1142 rEnd = m_aEnd;
1143}
1144
1145// Check if the SPoint is within the Table-SSelection.
1146bool SwShellTableCursor::Contains( const Point& rPt ) const
1147{
1148 // Calculate the new rectangles. If the cursor is still "parked" do nothing
1149 if (m_SelectedBoxes.empty() || m_bParked || !GetPoint()->GetNodeIndex())
1150 return false;
1151
1152 SwNodes& rNds = GetDoc().GetNodes();
1153 for (size_t n = 0; n < m_SelectedBoxes.size(); ++n)
1154 {
1155 SwNodeIndex aIdx( *m_SelectedBoxes[n]->GetSttNd() );
1156 SwContentNode* pCNd = rNds.GoNextSection( &aIdx, true, false );
1157 if( !pCNd )
1158 continue;
1159
1160 std::pair<Point, bool> const tmp(GetPtPos(), true);
1161 SwFrame* pFrame = pCNd->getLayoutFrame(GetShell()->GetLayout(), nullptr, &tmp);
1162 while( pFrame && !pFrame->IsCellFrame() )
1163 pFrame = pFrame->GetUpper();
1164 OSL_ENSURE( pFrame, "Node not in a table" );
1165 if( pFrame && pFrame->getFrameArea().Contains( rPt ) )
1166 return true;
1167
1168 for ( SwCellFrame* pCellFrame = static_cast<SwCellFrame*>(pFrame); pCellFrame; pCellFrame = pCellFrame->GetFollowCell() )
1169 {
1170 if( pCellFrame->getFrameArea().Contains( rPt ) )
1171 return true;
1172 }
1173 }
1174 return false;
1175}
1176
1177bool SwShellTableCursor::IsAtValidPos( bool bPoint ) const
1178{
1179 return SwShellCursor::IsAtValidPos( bPoint );
1180}
1181
1182/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
void DecreaseLuminance(sal_uInt8 cLumDec)
virtual const SwRootFrame * GetCurrentLayout() const =0
const Fraction & GetScaleX() const
MapUnit GetMapUnit() const
const Fraction & GetScaleY() const
SdrTextObj * GetTextEditObject() const
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
void SetAnimationEnabled(bool bEnable=true)
sal_uInt32 PaintWindowCount() const
rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
static OString makeVisCursorInvalidation(int nViewId, const OString &rRectangle, bool bMispelledWord=false, const OString &rHyperlink="")
static void notifyUpdatePerViewId(SfxViewShell const *pViewShell, int nType)
static void notifyOtherView(const SfxViewShell *pThisView, SfxViewShell const *pOtherView, int nType, std::string_view rKey, const OString &rPayload)
static void notifyUpdate(SfxViewShell const *pViewShell, int nType)
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
static OString makePayloadJSON(const SfxViewShell *pThisView, int nViewId, std::string_view rKey, const OString &rPayload)
static void notifyOtherViewsUpdatePerViewId(SfxViewShell const *pViewShell, int nType)
SfxItemPool & GetPool() const
static SfxViewShell * Current()
virtual void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:31
SwCellFrame * GetFollowCell() const
Definition: findfrm.cxx:1647
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:58
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1224
static SwTextField * GetTextFieldAtPos(const SwPosition *pPos, ::sw::GetTextAttrMode eMode)
Definition: crstrvl.cxx:894
bool IsReadOnlyAvailable() const
Definition: crsrsh.hxx:490
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:340
Point m_aCursorHeight
height & offset from visible Cursor
Definition: crsrsh.hxx:174
bool IsCursorReadonly() const
Definition: crsrsh.cxx:3301
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:193
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2554
bool IsSelection() const
Definition: crsrsh.hxx:899
bool IsOverwriteCursor() const
Definition: crsrsh.hxx:472
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3048
SwRect m_aCharRect
Char-SRectangle on which the cursor is located.
Definition: crsrsh.hxx:173
virtual bool IsAtValidPos(bool bPoint=true) const
Return <true> if cursor can be set to this position.
Definition: swcrsr.cxx:710
sal_uInt8 GetCursorBidiLevel() const
Definition: swcrsr.hxx:211
bool UpDown(bool bUp, sal_uInt16 nCnt, Point const *pPt, tools::Long nUpDownX, SwRootFrame &rLayout)
Definition: swcrsr.cxx:1984
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
SwNodes & GetNodes()
Definition: doc.hxx:413
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:406
SwDocShell * GetDocShell()
Definition: doc.hxx:1355
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
const std::shared_ptr< SwContentControl > & GetContentControl() const
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SwRect & getFrameArea() const
Definition: frame.hxx:179
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsCellFrame() const
Definition: frame.hxx:1226
bool IsRightToLeft() const
Definition: frame.hxx:987
SwLayoutFrame * GetNextCellLeaf()
Definition: findfrm.cxx:1579
SwLayoutFrame * GetUpper()
Definition: frame.hxx:678
virtual bool GetCharRect(SwRect &, const SwPosition &, SwCursorMoveState *=nullptr, bool bAllowFarAway=true) const
Definition: unusedf.cxx:72
Marks a node in the document model.
Definition: ndindex.hxx:31
Base class of the Writer document model elements.
Definition: node.hxx:84
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:877
bool IsInProtectSect() const
Is node in a protected area?
Definition: node.cxx:429
SwDoc & GetDoc()
Definition: node.hxx:217
bool IsTextNode() const
Definition: node.hxx:665
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:370
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:706
SwContentNode * GetContentNode()
Definition: node.hxx:644
SwContentNode * GoNextSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true) const
Go to next content-node that is not protected or hidden (Both set FALSE ==> GoNext/GoPrevious!...
Definition: nodes.cxx:1952
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:642
const SwPosition * End() const
Definition: pam.hxx:271
SwDoc & GetDoc() const
Definition: pam.hxx:299
const SwPosition * GetPoint() const
Definition: pam.hxx:261
const SwPosition * Start() const
Definition: pam.hxx:266
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
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
void SSize(const Size &rNew)
Definition: swrect.hxx:180
bool Contains(const Point &rPOINT) const
Definition: swrect.hxx:356
void AddBottom(const tools::Long nAdd)
Definition: swrect.cxx:130
void AddRight(const tools::Long nAdd)
Definition: swrect.cxx:127
bool Overlaps(const SwRect &rRect) const
Definition: swrect.hxx:374
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
const SwRect & GetOrigin() const
Definition: swregion.hxx:62
void Invert()
invert current rectangle
Definition: swregion.cxx:126
void CalcFrameRects(SwShellCursor &)
Definition: trvlfrm.cxx:2019
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Primary passes the call to the first page.
Definition: trvlfrm.cxx:425
size_t CountDirChg() const
Definition: scriptinfo.hxx:140
SwSelPaintRects is a base class of SwShellCursor, which stores the overlay for the cursor/selection: ...
Definition: viscrs.hxx:80
const SwCursorShell * GetShell() const
Definition: viscrs.hxx:127
void Show(std::vector< OString > *pSelectionRectangles=nullptr)
Definition: viscrs.cxx:421
void Invalidate(const SwRect &rRect)
Definition: viscrs.cxx:799
std::unique_ptr< sw::overlay::OverlayRangesOutline > m_pTextInputFieldOverlay
Definition: viscrs.hxx:94
void swapContent(SwSelPaintRects &rSwap)
Definition: viscrs.cxx:369
const VclPtr< SwContentControlButton > & GetContentControlButton() const
Definition: viscrs.cxx:794
SwSelPaintRects(const SwCursorShell &rCSh)
Definition: viscrs.cxx:354
std::optional< OString > getLOKPayload(int nType, int nViewId) const
Definition: viscrs.cxx:519
virtual void FillRects()=0
VclPtr< SwContentControlButton > m_pContentControlButton
Definition: viscrs.hxx:97
bool m_bShowTextInputFieldOverlay
Definition: viscrs.hxx:93
static MapMode * s_pMapMode
Definition: viscrs.hxx:85
void HighlightInputField()
Definition: viscrs.cxx:574
std::unique_ptr< sw::overlay::OverlayRangesOutline > m_pContentControlOverlay
Definition: viscrs.hxx:96
static void Get1PixelInLogic(const SwViewShell &rSh, tools::Long *pX=nullptr, tools::Long *pY=nullptr)
Definition: viscrs.cxx:832
virtual void FillStartEnd(SwRect &rStart, SwRect &rEnd) const =0
Fill rStart and rEnd with a rectangle that represents the start and end for selection handles.
const SwCursorShell * m_pCursorShell
Definition: viscrs.hxx:87
void HighlightContentControl()
Definition: viscrs.cxx:633
bool m_bShowContentControlOverlay
Definition: viscrs.hxx:95
static tools::Long s_nPixPtX
Definition: viscrs.hxx:84
virtual ~SwSelPaintRects()
Definition: viscrs.cxx:363
static tools::Long s_nPixPtY
Definition: viscrs.hxx:84
virtual void FillRects() override
Definition: viscrs.cxx:901
const Point & GetEndPos() const
Definition: viscrs.hxx:168
bool UpDown(bool bUp, sal_uInt16 nCnt)
Definition: viscrs.cxx:1021
void Show(SfxViewShell const *pViewShell)
Definition: viscrs.cxx:913
virtual bool IsAtValidPos(bool bPoint=true) const override
Return <true> if cursor can be set to this position.
Definition: viscrs.cxx:1029
Point m_MarkPt
Definition: viscrs.hxx:140
virtual bool IsReadOnlyAvailable() const override
Definition: viscrs.cxx:887
virtual void FillStartEnd(SwRect &rStart, SwRect &rEnd) const override
Definition: viscrs.cxx:414
void Hide()
Definition: viscrs.cxx:961
virtual short MaxReplaceArived() override
Definition: viscrs.cxx:976
virtual void SaveTableBoxContent(const SwPosition *pPos) override
Definition: viscrs.cxx:1016
virtual SwCursor * Create(SwPaM *pRing=nullptr) const override
Definition: viscrs.cxx:971
SwShellCursor(const SwCursorShell &rCursorSh, const SwPosition &rPos)
Definition: viscrs.cxx:856
void Invalidate(const SwRect &rRect)
Definition: viscrs.cxx:949
Point m_PointPt
Definition: viscrs.hxx:141
const SwPosition * m_pInitialPoint
Definition: viscrs.hxx:142
const Point & GetSttPos() const
Definition: viscrs.hxx:166
const Point & GetPtPos() const
Definition: viscrs.hxx:162
virtual ~SwShellCursor() override
Definition: viscrs.cxx:884
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:892
const Point & GetMkPos() const
Definition: viscrs.hxx:164
SwShellTableCursor(const SwCursorShell &rCursorSh, const SwPosition &rPos)
Definition: viscrs.cxx:1040
virtual void FillRects() override
Definition: viscrs.cxx:1076
SwRect m_aEnd
Right edge of the selection end (bottom right cell).
Definition: viscrs.hxx:196
SwRect m_aStart
Left edge of the selection start (top left cell).
Definition: viscrs.hxx:194
virtual SwCursor * Create(SwPaM *pRing=nullptr) const override
Definition: viscrs.cxx:1061
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:1059
virtual ~SwShellTableCursor() override
Definition: viscrs.cxx:1057
virtual bool IsAtValidPos(bool bPoint=true) const override
Return <true> if cursor can be set to this position.
Definition: viscrs.cxx:1177
bool Contains(const Point &rPt) const
Definition: viscrs.cxx:1146
virtual void SaveTableBoxContent(const SwPosition *pPos) override
Definition: viscrs.cxx:1071
virtual void FillStartEnd(SwRect &rStart, SwRect &rEnd) const override
Definition: viscrs.cxx:1139
virtual short MaxReplaceArived() override
Definition: viscrs.cxx:1066
Starts a section of nodes in the document model.
Definition: node.hxx:325
SwSelBoxes m_SelectedBoxes
Definition: swcrsr.hxx:261
bool m_bParked
Definition: swcrsr.hxx:263
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
SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
SwTextNode * GetpTextNode() const
Definition: txtfld.hxx:49
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:165
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:89
SwWrongList * GetWrong()
Definition: txtedt.cxx:2226
bool IsSymbolAt(sal_Int32 nBegin) const
in ndcopy.cxx
Definition: itratr.cxx:856
SwGrammarMarkUp * GetGrammarCheck()
Definition: txtedt.cxx:2254
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:1784
bool IsSelectionInReadonly() const
Definition: viewopt.hxx:466
bool IsOnlineSpell() const
Definition: viewopt.hxx:371
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:347
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:436
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2172
vcl::Window * GetWin() const
Definition: viewsh.hxx:346
const SwRect & VisArea() const
Definition: viewsh.cxx:630
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:454
SdrView * GetDrawView()
Definition: vnew.cxx:373
Definition: view.hxx:146
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:639
static SvxSearchDialog * GetSearchDialog()
Definition: viewsrch.cxx:829
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:414
vcl::Cursor m_aTextCursor
Definition: viscrs.hxx:45
SwRect m_aLastLOKRect
Definition: viscrs.hxx:49
bool m_bIsDragCursor
Definition: viscrs.hxx:52
const vcl::Cursor & GetTextCursor() const
Definition: viscrs.cxx:349
std::optional< OString > getLOKPayload(int nType, int nViewId) const
Definition: viscrs.cxx:274
const SwCursorShell * m_pCursorShell
Definition: viscrs.hxx:44
SwVisibleCursor(const SwCursorShell *pCShell)
Definition: viscrs.cxx:77
bool m_bIsVisible
Definition: viscrs.hxx:51
sal_uInt16 m_nPageLastTime
For LibreOfficeKit only - remember what page we were at the last time.
Definition: viscrs.hxx:48
void Show()
Definition: viscrs.cxx:95
void SetPosAndShow(SfxViewShell const *pViewShell)
Definition: viscrs.cxx:135
bool InWrongWord(sal_Int32 &rChk, sal_Int32 &rLn) const
If a word is incorrectly selected, this method returns begin and length of it.
Definition: wrong.cxx:103
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void disposeAndClear()
static VclPtr< reference_type > Create(Arg &&... arg)
bool empty() const
size_type size() const
ring_container GetRingContainer()
Definition: ring.hxx:240
void put(const char *pPropName, const OUString &rPropValue)
ScopedJsonWriterArray startArray(const char *)
void putSimpleValue(const OUString &rPropValue)
char * extractData()
constexpr tools::Long Top() const
constexpr tools::Long Right() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
rtl::OString toString() const
sal_uInt16 GetStyle() const
bool IsVisible() const
void SetWindow(vcl::Window *pWindow)
void SetStyle(sal_uInt16 nStyle)
void SetPos(const Point &rNewPos)
void SetOrientation(Degree10 nOrientation=0_deg10)
void SetWidth(tools::Long nNewWidth)
void SetSize(const Size &rNewSize)
void SetDirection(CursorDirection nDirection=CursorDirection::NONE)
void SetCursor(vcl::Cursor *pCursor)
::OutputDevice const * GetOutDev() const
@ SetOnlyText
stay with the cursor inside text
#define CURSOR_SHADOW
static SwContentNode * GetContentNode(SwDoc &rDoc, SwPosition &rPos, bool bNext)
Definition: fltshell.cxx:54
void SwAlignRect(SwRect &rRect, const SwViewShell *pSh, const vcl::RenderContext *pRenderContext)
Function <SwAlignRect(..)> is also used outside this file.
Definition: paintfrm.cxx:1127
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
sal_Int64 n
uno_Any a
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
Shell * GetShell()
size
OString join(std::string_view rSeparator, const std::vector< OString > &rSequence)
int i
std::u16string_view trim(std::u16string_view str)
enumrange< T >::Iterator begin(enumrange< T >)
end
@ Parent
EXPAND : (Start < nIndex <= End)
@ Expand
DEFAULT: (Start <= nIndex < End)
long Long
void SwCalcPixStatics(vcl::RenderContext const *pOut)
Set borders alignment statics Adjustment for 'small' twip-to-pixel relations: For 'small' twip-to-pix...
Definition: paintfrm.cxx:382
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:1012
QPRO_FUNC_TYPE nType
union SwContentAtPos::@24 aFnd
const SfxPoolItem * pAttr
Definition: crsrsh.hxx:105
OUString sStr
Definition: crsrsh.hxx:112
Marks a position in the document model.
Definition: pam.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
std::vector< SwRect > SwRects
Definition: swregion.hxx:26
RET_YES
static SwRect lcl_getLayoutRect(const Point &rPoint, const SwPosition &rPosition)
Return a layout rectangle (typically with minimal width) that represents a cursor at rPosition.
Definition: viscrs.cxx:402
oslFileHandle & pOut