LibreOffice Module vcl (master) 1
vclmedit.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 <memory>
22#include <vcl/commandevent.hxx>
23#include <vcl/builder.hxx>
24#include <vcl/decoview.hxx>
25#include <vcl/event.hxx>
26#include <vcl/menu.hxx>
27#include <vcl/specialchars.hxx>
28#include <vcl/timer.hxx>
29#include <vcl/vclevent.hxx>
30#include <vcl/xtextedt.hxx>
31#include <vcl/textview.hxx>
32#include <vcl/ptrstyle.hxx>
33
34#include <svl/undo.hxx>
35#include <svl/lstner.hxx>
37
38#include <vcl/settings.hxx>
41#include <vcl/weld.hxx>
42#include <osl/diagnose.h>
43#include <tools/json_writer.hxx>
44
46{
47private:
49
54
57
58protected:
59 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
60 void ImpUpdateScrollBarVis( WinBits nWinStyle );
61 void ImpInitScrollBars();
64 DECL_LINK( ScrollHdl, ScrollBar*, void );
65
66public:
68 virtual ~ImpVclMEdit() override;
69
70 void SetModified( bool bMod );
71
72 void SetReadOnly( bool bRdOnly );
73 bool IsReadOnly() const;
74
75 void SetMaxTextLen(sal_Int32 nLen);
76 sal_Int32 GetMaxTextLen() const;
77
78 void SetMaxTextWidth(tools::Long nMaxWidth);
79
80 void InsertText( const OUString& rStr );
81 OUString GetSelected() const;
82 OUString GetSelected( LineEnd aSeparator ) const;
83
84 void SetSelection( const Selection& rSelection );
85 const Selection& GetSelection() const;
86
87 void Cut();
88 void Copy();
89 void Paste();
90
91 void SetText( const OUString& rStr );
92 OUString GetText() const;
93 OUString GetText( LineEnd aSeparator ) const;
94 OUString GetTextLines( LineEnd aSeparator ) const;
95
96 void Resize();
97 void GetFocus();
98
99 bool HandleCommand( const CommandEvent& rCEvt );
100
101 void Enable( bool bEnable );
102
103 Size CalcMinimumSize() const;
104 Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
105 void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
106
107 void SetAlign( WinBits nWinStyle );
108
109 void InitFromStyle( WinBits nWinStyle );
110
114};
115
117 : pVclMultiLineEdit(pEdt)
118 , mpTextWindow(VclPtr<TextWindow>::Create(pEdt))
119 , mpHScrollBar(VclPtr<ScrollBar>::Create(pVclMultiLineEdit, WB_HSCROLL|WB_DRAG))
120 , mpVScrollBar(VclPtr<ScrollBar>::Create(pVclMultiLineEdit, WB_VSCROLL|WB_DRAG))
121 , mpScrollBox(VclPtr<ScrollBarBox>::Create(pVclMultiLineEdit, WB_SIZEABLE))
122 , mnTextWidth(0)
123{
124 mpVScrollBar->SetScrollHdl( LINK( this, ImpVclMEdit, ScrollHdl ) );
125 mpHScrollBar->SetScrollHdl( LINK( this, ImpVclMEdit, ScrollHdl ) );
127 InitFromStyle( nWinStyle );
129}
130
132{
133 const bool bHaveVScroll = mpVScrollBar->IsVisible();
134 const bool bHaveHScroll = mpHScrollBar->IsVisible();
135 const bool bHaveScrollBox = mpScrollBox->IsVisible();
136
137 bool bNeedVScroll = ( nWinStyle & WB_VSCROLL ) == WB_VSCROLL;
138 const bool bNeedHScroll = ( nWinStyle & WB_HSCROLL ) == WB_HSCROLL;
139
140 const bool bAutoVScroll = ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL;
141 if ( !bNeedVScroll && bAutoVScroll )
142 {
143 TextEngine& rEngine( *mpTextWindow->GetTextEngine() );
144 tools::Long nOverallTextHeight(0);
145 for ( sal_uInt32 i=0; i<rEngine.GetParagraphCount(); ++i )
146 nOverallTextHeight += rEngine.GetTextHeight( i );
147 if ( nOverallTextHeight > mpTextWindow->GetOutputSizePixel().Height() )
148 bNeedVScroll = true;
149 }
150
151 const bool bNeedScrollBox = bNeedVScroll && bNeedHScroll;
152
153 bool bScrollbarsChanged = false;
154 if ( bHaveVScroll != bNeedVScroll )
155 {
156 mpVScrollBar->Show(bNeedVScroll);
157 bScrollbarsChanged = true;
158 }
159
160 if ( bHaveHScroll != bNeedHScroll )
161 {
162 mpHScrollBar->Show(bNeedHScroll);
163 bScrollbarsChanged = true;
164 }
165
166 if ( bHaveScrollBox != bNeedScrollBox )
167 {
168 mpScrollBox->Show(bNeedScrollBox);
169 }
170
171 if ( bScrollbarsChanged )
172 {
174 Resize();
175 }
176}
177
179{
180 ImpUpdateScrollBarVis( nWinStyle );
181 SetAlign( nWinStyle );
182
183 if ( nWinStyle & WB_NOHIDESELECTION )
185 else
187
188 if ( nWinStyle & WB_READONLY )
190 else
192
193 if ( nWinStyle & WB_IGNORETAB )
194 {
195 mpTextWindow->SetIgnoreTab( true );
196 }
197 else
198 {
199 mpTextWindow->SetIgnoreTab( false );
200 // #103667# VclMultiLineEdit has the flag, but focusable window also needs this flag
201 WinBits nStyle = mpTextWindow->GetStyle();
202 nStyle |= WB_NODIALOGCONTROL;
203 mpTextWindow->SetStyle( nStyle );
204 }
205}
206
208{
215}
216
218{
219 const tools::Long nTextHeight = mpTextWindow->GetTextEngine()->GetTextHeight();
220 mpVScrollBar->SetRange( Range( 0, nTextHeight-1 ) );
221
223}
224
226{
227 static const sal_Unicode sampleChar = { 'x' };
228
230
231 Size aCharBox;
232 aCharBox.setWidth( mpTextWindow->GetTextWidth( OUString(sampleChar) ) );
233 aCharBox.setHeight( mpTextWindow->GetTextHeight() );
235
236 mpHScrollBar->SetVisibleSize( aOutSz.Width() );
237 mpHScrollBar->SetPageSize( aOutSz.Width() * 8 / 10 );
238 mpHScrollBar->SetLineSize( aCharBox.Width()*10 );
240
242 mpVScrollBar->SetPageSize( aOutSz.Height() * 8 / 10 );
243 mpVScrollBar->SetLineSize( aCharBox.Height() );
245}
246
248{
252 else
254
255}
256
257IMPL_LINK( ImpVclMEdit, ScrollHdl, ScrollBar*, pCurScrollBar, void )
258{
259 tools::Long nDiffX = 0, nDiffY = 0;
260
261 if ( pCurScrollBar == mpVScrollBar )
262 nDiffY = mpTextWindow->GetTextView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
263 else if ( pCurScrollBar == mpHScrollBar )
264 nDiffX = mpTextWindow->GetTextView()->GetStartDocPos().X() - pCurScrollBar->GetThumbPos();
265
266 mpTextWindow->GetTextView()->Scroll( nDiffX, nDiffY );
267 // mpTextWindow->GetTextView()->ShowCursor( false, true );
268}
269
271{
272 bool bRTL = AllSettings::GetLayoutRTL();
274
275 if ( nWinStyle & WB_CENTER )
277 else if ( nWinStyle & WB_RIGHT )
279 else if ( nWinStyle & WB_LEFT )
281}
282
284{
286}
287
288void ImpVclMEdit::SetReadOnly( bool bRdOnly )
289{
290 mpTextWindow->GetTextView()->SetReadOnly( bRdOnly );
291 // TODO: Adjust color?
292}
293
295{
297}
298
299void ImpVclMEdit::SetMaxTextLen(sal_Int32 nLen)
300{
302}
303
305{
307}
308
309void ImpVclMEdit::InsertText( const OUString& rStr )
310{
312}
313
315{
317}
318
319OUString ImpVclMEdit::GetSelected( LineEnd aSeparator ) const
320{
321 return mpTextWindow->GetTextView()->GetSelected( aSeparator );
322}
323
325{
327}
328
330{
331 int nIteration = 1;
332 do
333 {
334 WinBits nWinStyle( pVclMultiLineEdit->GetStyle() );
335 if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL )
336 ImpUpdateScrollBarVis( nWinStyle );
337
339 Size aEditSize = aSz;
341 nSBWidth = pVclMultiLineEdit->CalcZoom( nSBWidth );
342
343 if (mpHScrollBar->IsVisible())
344 aSz.AdjustHeight( -(nSBWidth+1) );
345 if (mpVScrollBar->IsVisible())
346 aSz.AdjustWidth( -(nSBWidth+1) );
347
348 if (!mpHScrollBar->IsVisible())
350 else
351 mpHScrollBar->setPosSizePixel( 0, aEditSize.Height()-nSBWidth, aSz.Width(), nSBWidth );
352
353 Point aTextWindowPos;
354 if (mpVScrollBar->IsVisible())
355 {
357 {
358 mpVScrollBar->setPosSizePixel( 0, 0, nSBWidth, aSz.Height() );
359 aTextWindowPos.AdjustX(nSBWidth );
360 }
361 else
362 mpVScrollBar->setPosSizePixel( aEditSize.Width()-nSBWidth, 0, nSBWidth, aSz.Height() );
363 }
364
365 if (mpScrollBox->IsVisible())
366 mpScrollBox->setPosSizePixel( aSz.Width(), aSz.Height(), nSBWidth, nSBWidth );
367
368 Size aTextWindowSize( aSz );
369 if ( aTextWindowSize.Width() < 0 )
370 aTextWindowSize.setWidth( 0 );
371 if ( aTextWindowSize.Height() < 0 )
372 aTextWindowSize.setHeight( 0 );
373
374 Size aOldTextWindowSize( mpTextWindow->GetSizePixel() );
375 mpTextWindow->SetPosSizePixel( aTextWindowPos, aTextWindowSize );
376 if ( aOldTextWindowSize == aTextWindowSize )
377 break;
378
379 // Changing the text window size might effectively have changed the need for
380 // scrollbars, so do another iteration.
381 ++nIteration;
382 OSL_ENSURE( nIteration < 3, "ImpVclMEdit::Resize: isn't this expected to terminate with the second iteration?" );
383
384 } while ( nIteration <= 3 ); // artificial break after four iterations
385
387}
388
390{
392}
393
395{
398}
399
401{
403}
404
406{
409}
410
411void ImpVclMEdit::SetText( const OUString& rStr )
412{
413 bool bWasModified = mpTextWindow->GetTextEngine()->IsModified();
415 if ( !bWasModified )
417
419
420 WinBits nWinStyle( pVclMultiLineEdit->GetStyle() );
421 if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL )
422 ImpUpdateScrollBarVis( nWinStyle );
423}
424
425OUString ImpVclMEdit::GetText() const
426{
428}
429
430OUString ImpVclMEdit::GetText( LineEnd aSeparator ) const
431{
432 return mpTextWindow->GetTextEngine()->GetText( aSeparator );
433}
434
435OUString ImpVclMEdit::GetTextLines( LineEnd aSeparator ) const
436{
437 return mpTextWindow->GetTextEngine()->GetTextLines( aSeparator );
438}
439
441{
442 const TextHint* pTextHint = dynamic_cast<const TextHint*>(&rHint);
443 if ( !pTextHint )
444 return;
445
446 switch (pTextHint->GetId())
447 {
448 case SfxHintId::TextViewScrolled:
449 if (mpHScrollBar->IsVisible())
451 if (mpVScrollBar->IsVisible())
453 break;
454
455 case SfxHintId::TextHeightChanged:
457 {
460 if ( nTextHeight < nOutHeight )
462 }
464 break;
465
466 case SfxHintId::TextFormatted:
467 if (mpHScrollBar->IsVisible())
468 {
470 if ( nWidth != mnTextWidth )
471 {
472 mnTextWidth = nWidth;
475 }
476 }
477 break;
478
479 case SfxHintId::TextModified:
482 break;
483
484 case SfxHintId::TextViewSelectionChanged:
486 break;
487
488 case SfxHintId::TextViewCaretChanged:
490 break;
491
492 default: break;
493 }
494}
495
496void ImpVclMEdit::SetSelection( const Selection& rSelection )
497{
498 OUString aText = mpTextWindow->GetTextEngine()->GetText();
499
500 Selection aNewSelection( rSelection );
501 if ( aNewSelection.Min() < 0 )
502 aNewSelection.Min() = 0;
503 else if ( aNewSelection.Min() > aText.getLength() )
504 aNewSelection.Min() = aText.getLength();
505 if ( aNewSelection.Max() < 0 )
506 aNewSelection.Max() = 0;
507 else if ( aNewSelection.Max() > aText.getLength() )
508 aNewSelection.Max() = aText.getLength();
509
510 tools::Long nEnd = std::max( aNewSelection.Min(), aNewSelection.Max() );
511 TextSelection aTextSel;
512 sal_uInt32 nPara = 0;
513 sal_Int32 nChar = 0;
514 tools::Long x = 0;
515 while ( x <= nEnd )
516 {
517 if ( x == aNewSelection.Min() )
518 aTextSel.GetStart() = TextPaM( nPara, nChar );
519 if ( x == aNewSelection.Max() )
520 aTextSel.GetEnd() = TextPaM( nPara, nChar );
521
522 if ( ( x < aText.getLength() ) && ( aText[ x ] == '\n' ) )
523 {
524 nPara++;
525 nChar = 0;
526 }
527 else
528 nChar++;
529 x++;
530 }
531 mpTextWindow->GetTextView()->SetSelection( aTextSel );
532}
533
535{
538 aTextSel.Justify();
539 // flatten selection => every line-break a character
540
541 ExtTextEngine* pExtTextEngine = mpTextWindow->GetTextEngine();
542 // paragraphs before
543 for ( sal_uInt32 n = 0; n < aTextSel.GetStart().GetPara(); ++n )
544 {
545 maSelection.Min() += pExtTextEngine->GetTextLen( n );
546 maSelection.Min()++;
547 }
548
549 // first paragraph with selection
551 maSelection.Min() += aTextSel.GetStart().GetIndex();
552
553 for ( sal_uInt32 n = aTextSel.GetStart().GetPara(); n < aTextSel.GetEnd().GetPara(); ++n )
554 {
555 maSelection.Max() += pExtTextEngine->GetTextLen( n );
556 maSelection.Max()++;
557 }
558
559 maSelection.Max() += aTextSel.GetEnd().GetIndex();
560
561 return maSelection;
562}
563
565{
568
569 if (mpHScrollBar->IsVisible())
571 if (mpVScrollBar->IsVisible())
573
574 return aSz;
575}
576
577Size ImpVclMEdit::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
578{
579 static const sal_Unicode sampleChar = 'X';
580
581 Size aSz;
582 Size aCharSz;
583 aCharSz.setWidth( mpTextWindow->GetTextWidth( OUString(sampleChar) ) );
585
586 if ( nLines )
587 aSz.setHeight( nLines*aCharSz.Height() );
588 else
590
591 if ( nColumns )
592 aSz.setWidth( nColumns*aCharSz.Width() );
593 else
595
596 if (mpHScrollBar->IsVisible())
598 if (mpVScrollBar->IsVisible())
600
601 return aSz;
602}
603
604void ImpVclMEdit::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const
605{
606 static const sal_Unicode sampleChar = { 'x' };
608 Size aCharSz( mpTextWindow->GetTextWidth( OUString(sampleChar) ), mpTextWindow->GetTextHeight() );
609 rnCols = static_cast<sal_uInt16>(aOutSz.Width()/aCharSz.Width());
610 rnLines = static_cast<sal_uInt16>(aOutSz.Height()/aCharSz.Height());
611}
612
613void ImpVclMEdit::Enable( bool bEnable )
614{
615 mpTextWindow->Enable( bEnable );
616 if (mpHScrollBar->IsVisible())
617 mpHScrollBar->Enable( bEnable );
618 if (mpVScrollBar->IsVisible())
619 mpVScrollBar->Enable( bEnable );
620}
621
623{
624 bool bDone = false;
625 CommandEventId nCommand = rCEvt.GetCommand();
626 if (nCommand == CommandEventId::Wheel ||
628 nCommand == CommandEventId::AutoScroll ||
629 nCommand == CommandEventId::GesturePan)
630 {
631 ScrollBar* pHScrollBar = mpHScrollBar->IsVisible() ? mpHScrollBar.get() : nullptr;
632 ScrollBar* pVScrollBar = mpVScrollBar->IsVisible() ? mpVScrollBar.get() : nullptr;
633 mpTextWindow->HandleScrollCommand(rCEvt, pHScrollBar, pVScrollBar);
634 bDone = true;
635 }
636 return bDone;
637}
638
640 : Window(pParent)
641 , mxParent(pParent)
642{
643 mbInMBDown = false;
644 mbFocusSelectionHide = false;
645 mbIgnoreTab = false;
646 mbActivePopup = false;
647 mbSelectOnTab = true;
648
650
652 mpExtTextEngine->SetMaxTextLen(EDIT_NOLIMIT);
653 if( pParent->GetStyle() & WB_BORDER )
654 mpExtTextEngine->SetLeftMargin( 2 );
655 mpExtTextEngine->SetLocale( GetSettings().GetLanguageTag().getLocale() );
656 mpExtTextView.reset(new TextView( mpExtTextEngine.get(), this ));
657 mpExtTextEngine->InsertView( mpExtTextView.get() );
658 mpExtTextEngine->EnableUndo( true );
659 mpExtTextView->ShowCursor();
660
661 Color aBackgroundColor = GetSettings().GetStyleSettings().GetWorkspaceColor();
662 SetBackground( aBackgroundColor );
663 pParent->SetBackground( aBackgroundColor );
664}
665
667{
668 disposeOnce();
669}
670
672{
673 mxParent.clear();
674 mpExtTextView.reset();
675 mpExtTextEngine.reset();
676 Window::dispose();
677}
678
680{
681 mpExtTextView->MouseMove( rMEvt );
682 Window::MouseMove( rMEvt );
683}
684
686{
687 mbInMBDown = true; // so that GetFocus does not select everything
688 mpExtTextView->MouseButtonDown( rMEvt );
689 GrabFocus();
690 mbInMBDown = false;
691}
692
694{
695 mpExtTextView->MouseButtonUp( rMEvt );
696}
697
698void TextWindow::KeyInput( const KeyEvent& rKEvent )
699{
700 bool bDone = false;
701 sal_uInt16 nCode = rKEvent.GetKeyCode().GetCode();
702 if ( nCode == css::awt::Key::SELECT_ALL ||
703 ( (nCode == KEY_A) && rKEvent.GetKeyCode().IsMod1() && !rKEvent.GetKeyCode().IsMod2() )
704 )
705 {
707 bDone = true;
708 }
709 else if ( (nCode == KEY_S) && rKEvent.GetKeyCode().IsShift() && rKEvent.GetKeyCode().IsMod1() )
710 {
712 {
713 // to maintain the selection
714 mbActivePopup = true;
715 OUString aChars = vcl::GetGetSpecialCharsFunction()(GetFrameWeld(), GetFont());
716 if (!aChars.isEmpty())
717 {
718 mpExtTextView->InsertText( aChars );
719 mpExtTextView->GetTextEngine()->SetModified( true );
720 }
721 mbActivePopup = false;
722 bDone = true;
723 }
724 }
725 else if ( nCode == KEY_TAB )
726 {
727 if (!mbIgnoreTab)
728 {
729 if (!rKEvent.GetKeyCode().IsMod1())
730 bDone = mpExtTextView->KeyInput(rKEvent);
731 else
732 {
733 // tdf#107625 make ctrl+tab act like tab when MultiLine Edit normally accepts tab as an input char
734 vcl::KeyCode aKeyCode(rKEvent.GetKeyCode().GetCode(), rKEvent.GetKeyCode().GetModifier() & ~KEY_MOD1);
735 KeyEvent aKEventWithoutMod1(rKEvent.GetCharCode(), aKeyCode, rKEvent.GetRepeat());
736 Window::KeyInput(aKEventWithoutMod1);
737 bDone = true;
738 }
739 }
740 }
741 else
742 {
743 bDone = mpExtTextView->KeyInput( rKEvent );
744 }
745
746 if ( !bDone )
747 Window::KeyInput( rKEvent );
748}
749
750void TextWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
751{
752 mpExtTextView->Paint(rRenderContext, rRect);
753}
754
756{
757}
758
760{
762 {
764 bool bEnableCut = true;
765 bool bEnableCopy = true;
766 bool bEnableDelete = true;
767 bool bEnablePaste = true;
768 bool bEnableSpecialChar = true;
769 bool bEnableUndo = true;
770
771 if ( !mpExtTextView->HasSelection() )
772 {
773 bEnableCut = false;
774 bEnableCopy = false;
775 bEnableDelete = false;
776 }
777 if ( mpExtTextView->IsReadOnly() )
778 {
779 bEnableCut = false;
780 bEnablePaste = false;
781 bEnableDelete = false;
782 bEnableSpecialChar = false;
783 }
784 if ( !mpExtTextView->GetTextEngine()->HasUndoManager() || !mpExtTextView->GetTextEngine()->GetUndoManager().GetUndoActionCount() )
785 {
786 bEnableUndo = false;
787 }
788 pPopup->EnableItem(pPopup->GetItemId(u"cut"), bEnableCut);
789 pPopup->EnableItem(pPopup->GetItemId(u"copy"), bEnableCopy);
790 pPopup->EnableItem(pPopup->GetItemId(u"delete"), bEnableDelete);
791 pPopup->EnableItem(pPopup->GetItemId(u"paste"), bEnablePaste);
792 pPopup->EnableItem(pPopup->GetItemId(u"specialchar"), bEnableSpecialChar);
793 pPopup->EnableItem(pPopup->GetItemId(u"undo"), bEnableUndo);
794 pPopup->ShowItem(pPopup->GetItemId(u"specialchar"), !vcl::GetGetSpecialCharsFunction());
795
796 mbActivePopup = true;
797 Point aPos = rCEvt.GetMousePosPixel();
798 if ( !rCEvt.IsMouseEvent() )
799 {
800 // Sometime do show Menu centered in the selection !!!
801 Size aSize = GetOutputSizePixel();
802 aPos = Point( aSize.Width()/2, aSize.Height()/2 );
803 }
804 sal_uInt16 n = pPopup->Execute( this, aPos );
805 OUString sCommand = pPopup->GetItemIdent(n);
806 if (sCommand == "undo")
807 {
808 mpExtTextView->Undo();
809 mpExtTextEngine->SetModified( true );
810 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
811 }
812 else if (sCommand == "cut")
813 {
814 mpExtTextView->Cut();
815 mpExtTextEngine->SetModified( true );
816 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
817 }
818 else if (sCommand == "copy")
819 {
820 mpExtTextView->Copy();
821 }
822 else if (sCommand == "paste")
823 {
824 mpExtTextView->Paste();
825 mpExtTextEngine->SetModified( true );
826 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
827 }
828 else if (sCommand == "delete")
829 {
830 mpExtTextView->DeleteSelected();
831 mpExtTextEngine->SetModified( true );
832 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
833 }
834 else if (sCommand == "selectall")
835 {
837 }
838 else if (sCommand == "specialchar")
839 {
840 OUString aChars = vcl::GetGetSpecialCharsFunction()(GetFrameWeld(), GetFont());
841 if (!aChars.isEmpty())
842 {
843 mpExtTextView->InsertText( aChars );
844 mpExtTextEngine->SetModified( true );
845 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
846 }
847 }
848 pPopup.clear();
849 mbActivePopup = false;
850 }
851 else
852 {
853 mpExtTextView->Command( rCEvt );
854 }
855 Window::Command( rCEvt );
856}
857
859{
860 Window::GetFocus();
861 if ( mbActivePopup )
862 return;
863
864 bool bGotoCursor = !mpExtTextView->IsReadOnly();
866 {
867 // select everything, but do not scroll
868 bool bAutoScroll = mpExtTextView->IsAutoScroll();
869 mpExtTextView->SetAutoScroll( false );
871 mpExtTextView->SetAutoScroll( bAutoScroll );
872 bGotoCursor = false;
873 }
874 mpExtTextView->SetPaintSelection( true );
875 mpExtTextView->ShowCursor( bGotoCursor );
876}
877
879{
880 Window::LoseFocus();
881
883 mpExtTextView->SetPaintSelection( false );
884}
885
887 : Edit( pParent, nWinStyle )
888{
890 pImpVclMEdit.reset(new ImpVclMEdit( this, nWinStyle ));
891 ImplInitSettings( true );
892
893 SetCompoundControl( true );
894 SetStyle( ImplInitStyle( nWinStyle ) );
895}
896
898{
899 disposeOnce();
900}
901
903{
904 pImpVclMEdit.reset();
906}
907
909{
910 if ( !(nStyle & WB_NOTABSTOP) )
911 nStyle |= WB_TABSTOP;
912
913 if ( !(nStyle & WB_NOGROUP) )
914 nStyle |= WB_GROUP;
915
916 if ( !(nStyle & WB_IGNORETAB ))
917 nStyle |= WB_NODIALOGCONTROL;
918
919 return nStyle;
920}
921
923{
924 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
925
926 // The Font has to be adjusted, as the TextEngine does not take care of
927 // TextColor/Background
928
929 Color aTextColor = rStyleSettings.GetFieldTextColor();
931 aTextColor = GetControlForeground();
932
933 if (!IsEnabled())
934 aTextColor = rStyleSettings.GetDisableColor();
935
936 vcl::Font aFont = rStyleSettings.GetFieldFont();
938 ApplyControlFont(rRenderContext, aFont);
939
940 vcl::Font theFont = rRenderContext.GetFont();
941 theFont.SetColor(aTextColor);
942 if (IsPaintTransparent())
944 else
945 theFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor());
946
947 pImpVclMEdit->GetTextWindow()->SetFont(theFont);
948 // FIXME: next call causes infinite invalidation loop, rethink how to properly fix this situation
949 // pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(theFont);
950 pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
951
952 if (IsPaintTransparent())
953 {
954 pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true);
955 pImpVclMEdit->GetTextWindow()->SetBackground();
956 pImpVclMEdit->GetTextWindow()->SetControlBackground();
957 rRenderContext.SetBackground();
959 }
960 else
961 {
963 pImpVclMEdit->GetTextWindow()->SetBackground(GetControlBackground());
964 else
965 pImpVclMEdit->GetTextWindow()->SetBackground(rStyleSettings.GetFieldColor());
966 // also adjust for VclMultiLineEdit as the TextComponent might hide Scrollbars
967 rRenderContext.SetBackground(pImpVclMEdit->GetTextWindow()->GetBackground());
968 }
969}
970
972{
973 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
974
975 // The Font has to be adjusted, as the TextEngine does not take care of
976 // TextColor/Background
977
978 Color aTextColor = rStyleSettings.GetFieldTextColor();
980 aTextColor = GetControlForeground();
981 if (!IsEnabled())
982 aTextColor = rStyleSettings.GetDisableColor();
983
984 vcl::Font aFont = rStyleSettings.GetFieldFont();
986 ApplyControlFont(*GetOutDev(), aFont);
987
988 vcl::Font TheFont = GetFont();
989 TheFont.SetColor(aTextColor);
990 if (IsPaintTransparent())
992 else
993 TheFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor());
994 pImpVclMEdit->GetTextWindow()->SetFont(TheFont);
995 pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(TheFont);
996 pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
997
998 if (!bBackground)
999 return;
1000
1001 if (IsPaintTransparent())
1002 {
1003 pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true);
1004 pImpVclMEdit->GetTextWindow()->SetBackground();
1005 pImpVclMEdit->GetTextWindow()->SetControlBackground();
1006 SetBackground();
1008 }
1009 else
1010 {
1011 if (IsControlBackground())
1012 pImpVclMEdit->GetTextWindow()->SetBackground(GetControlBackground());
1013 else
1014 pImpVclMEdit->GetTextWindow()->SetBackground(rStyleSettings.GetFieldColor());
1015 // also adjust for VclMultiLineEdit as the TextComponent might hide Scrollbars
1016 SetBackground(pImpVclMEdit->GetTextWindow()->GetBackground());
1017 }
1018}
1019
1021{
1022 aModifyHdlLink.Call( *this );
1023
1025}
1026
1028{
1030}
1031
1033{
1035}
1036
1038{
1039 pImpVclMEdit->SetModified( true );
1040}
1041
1042void VclMultiLineEdit::SetReadOnly( bool bReadOnly )
1043{
1044 pImpVclMEdit->SetReadOnly( bReadOnly );
1046
1047 // #94921# ReadOnly can be overwritten in InitFromStyle() when WB not set.
1048 WinBits nStyle = GetStyle();
1049 if ( bReadOnly )
1050 nStyle |= WB_READONLY;
1051 else
1052 nStyle &= ~WB_READONLY;
1053 SetStyle( nStyle );
1054}
1055
1057{
1058 if (!pImpVclMEdit) // might be called from within the dtor, when pImpVclMEdit == NULL is a valid state
1059 return true;
1060
1061 return pImpVclMEdit->IsReadOnly();
1062}
1063
1064void VclMultiLineEdit::SetMaxTextLen(sal_Int32 nMaxLen)
1065{
1066 pImpVclMEdit->SetMaxTextLen(nMaxLen);
1067}
1068
1070{
1071 pImpVclMEdit->SetMaxTextWidth(nMaxWidth );
1072}
1073
1075{
1076 return pImpVclMEdit->GetMaxTextLen();
1077}
1078
1079void VclMultiLineEdit::ReplaceSelected( const OUString& rStr )
1080{
1081 pImpVclMEdit->InsertText( rStr );
1082}
1083
1085{
1086 pImpVclMEdit->InsertText( OUString() );
1087}
1088
1090{
1091 return pImpVclMEdit->GetSelected();
1092}
1093
1094OUString VclMultiLineEdit::GetSelected( LineEnd aSeparator ) const
1095{
1096 return pImpVclMEdit->GetSelected( aSeparator );
1097}
1098
1100{
1101 pImpVclMEdit->Cut();
1102}
1103
1105{
1106 pImpVclMEdit->Copy();
1107}
1108
1110{
1111 pImpVclMEdit->Paste();
1112}
1113
1114void VclMultiLineEdit::SetText( const OUString& rStr )
1115{
1116 pImpVclMEdit->SetText( rStr );
1117}
1118
1120{
1121 return pImpVclMEdit ? pImpVclMEdit->GetText() : OUString();
1122}
1123
1124OUString VclMultiLineEdit::GetText( LineEnd aSeparator ) const
1125{
1126 return pImpVclMEdit ? pImpVclMEdit->GetText( aSeparator ) : OUString();
1127}
1128
1129OUString VclMultiLineEdit::GetTextLines( LineEnd aSeparator ) const
1130{
1131 return pImpVclMEdit ? pImpVclMEdit->GetTextLines( aSeparator ) : OUString();
1132}
1133
1135{
1136 pImpVclMEdit->Resize();
1137}
1138
1140{
1141 if ( !pImpVclMEdit ) // might be called from within the dtor, when pImpVclMEdit == NULL is a valid state
1142 return;
1143
1144 pImpVclMEdit->GetFocus();
1145}
1146
1148{
1149 pImpVclMEdit->SetSelection( rSelection );
1150}
1151
1153{
1154 return pImpVclMEdit->GetSelection();
1155}
1156
1158{
1159 Size aSz = pImpVclMEdit->CalcMinimumSize();
1160
1161 sal_Int32 nLeft, nTop, nRight, nBottom;
1162 static_cast<vcl::Window*>(const_cast<VclMultiLineEdit *>(this))->GetBorder( nLeft, nTop, nRight, nBottom );
1163 aSz.AdjustWidth(nLeft+nRight );
1164 aSz.AdjustHeight(nTop+nBottom );
1165
1166 return aSz;
1167}
1168
1170{
1171 Size aSz = rPrefSize;
1172 sal_Int32 nLeft, nTop, nRight, nBottom;
1173 static_cast<vcl::Window*>(const_cast<VclMultiLineEdit *>(this))->GetBorder( nLeft, nTop, nRight, nBottom );
1174
1175 // center vertically for whole lines
1176
1177 tools::Long nHeight = aSz.Height() - nTop - nBottom;
1178 tools::Long nLineHeight = pImpVclMEdit->CalcBlockSize( 1, 1 ).Height();
1179 tools::Long nLines = nHeight / nLineHeight;
1180 if ( nLines < 1 )
1181 nLines = 1;
1182
1183 aSz.setHeight( nLines * nLineHeight );
1184 aSz.AdjustHeight(nTop+nBottom );
1185
1186 return aSz;
1187}
1188
1189Size VclMultiLineEdit::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
1190{
1191 Size aSz = pImpVclMEdit->CalcBlockSize( nColumns, nLines );
1192
1193 sal_Int32 nLeft, nTop, nRight, nBottom;
1194 static_cast<vcl::Window*>(const_cast<VclMultiLineEdit *>(this))->GetBorder( nLeft, nTop, nRight, nBottom );
1195 aSz.AdjustWidth(nLeft+nRight );
1196 aSz.AdjustHeight(nTop+nBottom );
1197 return aSz;
1198}
1199
1200void VclMultiLineEdit::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const
1201{
1202 pImpVclMEdit->GetMaxVisColumnsAndLines( rnCols, rnLines );
1203}
1204
1206{
1208 {
1209 pImpVclMEdit->Enable( IsEnabled() );
1210 ImplInitSettings( false );
1211 }
1212 else if( nType == StateChangedType::ReadOnly )
1213 {
1214 pImpVclMEdit->SetReadOnly( IsReadOnly() );
1215 }
1216 else if ( nType == StateChangedType::Zoom )
1217 {
1218 pImpVclMEdit->GetTextWindow()->SetZoom( GetZoom() );
1219 ImplInitSettings( false );
1220 Resize();
1221 }
1223 {
1224 ImplInitSettings( false );
1225 Resize();
1226 Invalidate();
1227 }
1229 {
1230 ImplInitSettings( false );
1231 Invalidate();
1232 }
1234 {
1235 ImplInitSettings( true );
1236 Invalidate();
1237 }
1238 else if ( nType == StateChangedType::Style )
1239 {
1240 pImpVclMEdit->InitFromStyle( GetStyle() );
1242 }
1243 else if ( nType == StateChangedType::InitShow )
1244 {
1245 if( IsPaintTransparent() )
1246 {
1247 pImpVclMEdit->GetTextWindow()->SetPaintTransparent( true );
1248 pImpVclMEdit->GetTextWindow()->SetBackground();
1249 pImpVclMEdit->GetTextWindow()->SetControlBackground();
1250 SetBackground();
1252 }
1253 }
1254
1256}
1257
1259{
1260 if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1261 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
1262 {
1263 ImplInitSettings( true );
1264 Resize();
1265 Invalidate();
1266 }
1267 else
1268 Control::DataChanged( rDCEvt );
1269}
1270
1272{
1273 ImplInitSettings(true);
1274
1275 Point aPos = pDev->LogicToPixel( rPos );
1276 Size aSize = GetSizePixel();
1277
1278 vcl::Font aFont = pImpVclMEdit->GetTextWindow()->GetDrawPixelFont(pDev);
1279 aFont.SetTransparent( true );
1280
1281 pDev->Push();
1282 pDev->SetMapMode();
1283 pDev->SetFont( aFont );
1284 pDev->SetTextFillColor();
1285
1286 // Border/Background
1287 pDev->SetLineColor();
1288 pDev->SetFillColor();
1289 bool bBorder = (GetStyle() & WB_BORDER);
1290 bool bBackground = IsControlBackground();
1291 if ( bBorder || bBackground )
1292 {
1293 tools::Rectangle aRect( aPos, aSize );
1294 if ( bBorder )
1295 {
1296 DecorationView aDecoView( pDev );
1297 aRect = aDecoView.DrawFrame( aRect, DrawFrameStyle::DoubleIn );
1298 }
1299 if ( bBackground )
1300 {
1302 pDev->DrawRect( aRect );
1303 }
1304 }
1305
1306 pDev->SetSystemTextColor(nFlags, IsEnabled());
1307
1308 OUString aText = GetText();
1309 Size aTextSz( pDev->GetTextWidth( aText ), pDev->GetTextHeight() );
1310 sal_uLong nLines = static_cast<sal_uLong>(aSize.Height() / aTextSz.Height());
1311 if ( !nLines )
1312 nLines = 1;
1313 aTextSz.setHeight( nLines*aTextSz.Height() );
1314 tools::Long nOnePixel = GetDrawPixel( pDev, 1 );
1315 tools::Long nOffX = 3*nOnePixel;
1316 tools::Long nOffY = 2*nOnePixel;
1317
1318 // Clipping?
1319 if ( ( nOffY < 0 ) || ( (nOffY+aTextSz.Height()) > aSize.Height() ) || ( (nOffX+aTextSz.Width()) > aSize.Width() ) )
1320 {
1321 tools::Rectangle aClip( aPos, aSize );
1322 if ( aTextSz.Height() > aSize.Height() )
1323 aClip.AdjustBottom(aTextSz.Height() - aSize.Height() + 1 ); // so that HP-printer does not 'optimize-away'
1324 pDev->IntersectClipRegion( aClip );
1325 }
1326
1327 ExtTextEngine aTE;
1328 aTE.SetText( GetText() );
1329 aTE.SetMaxTextWidth( aSize.Width() );
1330 aTE.SetFont( aFont );
1331 aTE.SetTextAlign( pImpVclMEdit->GetTextWindow()->GetTextEngine()->GetTextAlign() );
1332 aTE.Draw( pDev, Point( aPos.X() + nOffX, aPos.Y() + nOffY ) );
1333
1334 pDev->Pop();
1335}
1336
1338{
1339 bool bDone = false;
1340 if( rNEvt.GetType() == NotifyEventType::COMMAND )
1341 {
1342 bDone = pImpVclMEdit->HandleCommand( *rNEvt.GetCommandEvent() );
1343 }
1344 return bDone || Edit::EventNotify( rNEvt );
1345}
1346
1348{
1349 bool bDone = false;
1350
1351 if( ( rNEvt.GetType() == NotifyEventType::KEYINPUT ) && ( !GetTextView()->IsCursorEnabled() ) )
1352 {
1353 const KeyEvent& rKEvent = *rNEvt.GetKeyEvent();
1354 if ( !rKEvent.GetKeyCode().IsShift() && ( rKEvent.GetKeyCode().GetGroup() == KEYGROUP_CURSOR ) )
1355 {
1356 bDone = true;
1357 TextSelection aSel = pImpVclMEdit->GetTextWindow()->GetTextView()->GetSelection();
1358 if ( aSel.HasRange() )
1359 {
1360 aSel.GetStart() = aSel.GetEnd();
1361 pImpVclMEdit->GetTextWindow()->GetTextView()->SetSelection( aSel );
1362 }
1363 else
1364 {
1365 switch ( rKEvent.GetKeyCode().GetCode() )
1366 {
1367 case KEY_UP:
1368 {
1369 if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
1370 pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::LineUp );
1371 }
1372 break;
1373 case KEY_DOWN:
1374 {
1375 if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
1376 pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::LineDown );
1377 }
1378 break;
1379 case KEY_PAGEUP :
1380 {
1381 if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
1382 pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::PageUp );
1383 }
1384 break;
1385 case KEY_PAGEDOWN:
1386 {
1387 if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
1388 pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::PageDown );
1389 }
1390 break;
1391 case KEY_LEFT:
1392 {
1393 if ( pImpVclMEdit->GetHScrollBar().IsVisible() )
1394 pImpVclMEdit->GetHScrollBar().DoScrollAction( ScrollType::LineUp );
1395 }
1396 break;
1397 case KEY_RIGHT:
1398 {
1399 if ( pImpVclMEdit->GetHScrollBar().IsVisible() )
1400 pImpVclMEdit->GetHScrollBar().DoScrollAction( ScrollType::LineDown );
1401 }
1402 break;
1403 case KEY_HOME:
1404 {
1405 if ( rKEvent.GetKeyCode().IsMod1() )
1406 pImpVclMEdit->GetTextWindow()->GetTextView()->
1407 SetSelection( TextSelection( TextPaM( 0, 0 ) ) );
1408 }
1409 break;
1410 case KEY_END:
1411 {
1412 if ( rKEvent.GetKeyCode().IsMod1() )
1413 pImpVclMEdit->GetTextWindow()->GetTextView()->
1415 }
1416 break;
1417 default:
1418 {
1419 bDone = false;
1420 }
1421 }
1422 }
1423 }
1424 }
1425
1426 return bDone || Edit::PreNotify( rNEvt );
1427}
1428
1429// Internals for derived classes, e.g. TextComponent
1430
1432{
1433 return pImpVclMEdit->GetTextWindow()->GetTextEngine();
1434}
1435
1437{
1438 return pImpVclMEdit->GetTextWindow()->GetTextView();
1439}
1440
1442{
1443 return pImpVclMEdit->GetVScrollBar();
1444}
1445
1447{
1448 pImpVclMEdit->GetTextWindow()->SetAutoFocusHide( bHide );
1449}
1450
1452{
1453 pImpVclMEdit->GetTextWindow()->DisableSelectionOnFocus();
1454}
1455
1457{
1458 GetTextView()->EnableCursor( bEnable );
1459}
1460
1462{
1463 TextView* pTextView = GetTextView();
1464 const TextSelection& rTextSelection = pTextView->GetSelection();
1465 TextPaM aPaM(rTextSelection.GetEnd());
1466 return aPaM != pTextView->CursorUp(aPaM);
1467}
1468
1470{
1471 TextView* pTextView = GetTextView();
1472 const TextSelection& rTextSelection = pTextView->GetSelection();
1473 TextPaM aPaM(rTextSelection.GetEnd());
1474 return aPaM != pTextView->CursorDown(aPaM);
1475}
1476
1478{
1479 return pImpVclMEdit->GetTextWindow();
1480}
1481
1483{
1485}
1486
1487bool VclMultiLineEdit::set_property(const OUString &rKey, const OUString &rValue)
1488{
1489 if (rKey == "cursor-visible")
1490 EnableCursor(toBool(rValue));
1491 else if (rKey == "accepts-tab")
1492 pImpVclMEdit->GetTextWindow()->SetIgnoreTab(!toBool(rValue));
1493 else
1494 return Edit::set_property(rKey, rValue);
1495 return true;
1496}
1497
1499{
1500 Edit::DumpAsPropertyTree(rJsonWriter);
1501
1502 rJsonWriter.put("cursor", pImpVclMEdit->GetTextWindow()->GetTextView()->IsCursorEnabled());
1503}
1504
1505/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SystemTextColorFlags
unotools::WeakReference< AnimationNode > mxParent
static bool toBool(std::string_view rValue)
Definition: builder.cxx:92
const StyleSettings & GetStyleSettings() const
static bool GetLayoutRTL()
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
bool IsMouseEvent() const
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: ctrl.cxx:225
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:256
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: ctrl.cxx:293
DataChangedEventType GetType() const
Definition: event.hxx:362
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
void DrawFrame(const tools::Rectangle &rRect, const Color &rLeftTopColor, const Color &rRightBottomColor)
Definition: decoview.cxx:811
Definition: edit.hxx:56
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: edit.cxx:225
virtual bool set_property(const OUString &rKey, const OUString &rValue) override
Definition: edit.cxx:183
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: edit.cxx:1906
virtual void DumpAsPropertyTree(tools::JsonWriter &rJsonWriter) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: edit.cxx:2924
virtual void SetReadOnly(bool bReadOnly=true)
Definition: edit.cxx:2355
VclPtr< PopupMenu > CreatePopupMenu()
Definition: edit.cxx:2705
void ImpSetHScrollBarThumbPos()
Definition: vclmedit.cxx:247
void GetFocus()
Definition: vclmedit.cxx:389
void ImpUpdateScrollBarVis(WinBits nWinStyle)
Definition: vclmedit.cxx:131
Size CalcBlockSize(sal_uInt16 nColumns, sal_uInt16 nLines) const
Definition: vclmedit.cxx:577
bool IsReadOnly() const
Definition: vclmedit.cxx:294
virtual ~ImpVclMEdit() override
Definition: vclmedit.cxx:207
Selection maSelection
Definition: vclmedit.cxx:56
void Copy()
Definition: vclmedit.cxx:400
void ImpSetScrollBarRanges()
Definition: vclmedit.cxx:217
void SetText(const OUString &rStr)
Definition: vclmedit.cxx:411
ImpVclMEdit(VclMultiLineEdit *pVclMultiLineEdit, WinBits nWinStyle)
Definition: vclmedit.cxx:116
OUString GetText() const
Definition: vclmedit.cxx:425
DECL_LINK(ScrollHdl, ScrollBar *, void)
tools::Long mnTextWidth
Definition: vclmedit.cxx:55
void SetReadOnly(bool bRdOnly)
Definition: vclmedit.cxx:288
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: vclmedit.cxx:440
void SetMaxTextWidth(tools::Long nMaxWidth)
Definition: vclmedit.cxx:324
OUString GetSelected() const
Definition: vclmedit.cxx:314
VclPtr< ScrollBar > mpVScrollBar
Definition: vclmedit.cxx:52
VclPtr< ScrollBar > mpHScrollBar
Definition: vclmedit.cxx:51
ScrollBar & GetHScrollBar()
Definition: vclmedit.cxx:112
OUString GetTextLines(LineEnd aSeparator) const
Definition: vclmedit.cxx:435
void Cut()
Definition: vclmedit.cxx:394
Size CalcMinimumSize() const
Definition: vclmedit.cxx:564
void GetMaxVisColumnsAndLines(sal_uInt16 &rnCols, sal_uInt16 &rnLines) const
Definition: vclmedit.cxx:604
void InsertText(const OUString &rStr)
Definition: vclmedit.cxx:309
TextWindow * GetTextWindow()
Definition: vclmedit.cxx:111
bool HandleCommand(const CommandEvent &rCEvt)
Definition: vclmedit.cxx:622
void SetModified(bool bMod)
Definition: vclmedit.cxx:283
void Enable(bool bEnable)
Definition: vclmedit.cxx:613
const Selection & GetSelection() const
Definition: vclmedit.cxx:534
void InitFromStyle(WinBits nWinStyle)
Definition: vclmedit.cxx:178
ScrollBar & GetVScrollBar()
Definition: vclmedit.cxx:113
void SetSelection(const Selection &rSelection)
Definition: vclmedit.cxx:496
VclPtr< ScrollBarBox > mpScrollBox
Definition: vclmedit.cxx:53
sal_Int32 GetMaxTextLen() const
Definition: vclmedit.cxx:304
VclPtr< VclMultiLineEdit > pVclMultiLineEdit
Definition: vclmedit.cxx:48
void Resize()
Definition: vclmedit.cxx:329
void SetMaxTextLen(sal_Int32 nLen)
Definition: vclmedit.cxx:299
VclPtr< TextWindow > mpTextWindow
Definition: vclmedit.cxx:50
void SetAlign(WinBits nWinStyle)
Definition: vclmedit.cxx:270
void ImpInitScrollBars()
Definition: vclmedit.cxx:225
void Paste()
Definition: vclmedit.cxx:405
sal_Unicode GetCharCode() const
Definition: event.hxx:56
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:57
sal_uInt16 GetRepeat() const
Definition: event.hxx:58
void ShowItem(sal_uInt16 nItemId, bool bVisible=true)
Definition: menu.cxx:964
sal_uInt16 GetItemId(sal_uInt16 nPos) const
Definition: menu.cxx:641
OUString GetItemIdent(sal_uInt16 nItemId) const
Definition: menu.cxx:683
void EnableItem(sal_uInt16 nItemId, bool bEnable=true)
Definition: menu.cxx:919
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
const KeyEvent * GetKeyEvent() const
Definition: event.hxx:316
const CommandEvent * GetCommandEvent() const
Definition: event.hxx:332
NotifyEventType GetType() const
Definition: event.hxx:308
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
const vcl::Font & GetFont() const
Definition: outdev.hxx:529
void SetFont(const vcl::Font &rNewFont)
Definition: outdev/font.cxx:56
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:50
virtual void SetSystemTextColor(SystemTextColorFlags nFlags, bool bEnabled)
Definition: text.cxx:2479
void SetLineColor()
Definition: line.cxx:37
void SetMapMode()
Definition: map.cxx:597
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Definition: text.cxx:886
void SetFillColor()
Definition: fill.cxx:29
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:879
void SetTextFillColor()
Definition: text.cxx:734
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:32
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:897
void SetBackground()
Definition: background.cxx:27
void Pop()
Definition: stack.cxx:91
const AllSettings & GetSettings() const
Definition: outdev.hxx:288
void IntersectClipRegion(const tools::Rectangle &rRect)
constexpr tools::Long Y() const
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
sal_uInt16 Execute(vcl::Window *pWindow, const Point &rPopupPos)
Definition: menu.cxx:2771
void SetThumbPos(tools::Long nThumbPos) override
Definition: scrbar.cxx:1362
void SetRange(const Range &rRange) override
Definition: scrbar.cxx:1338
void SetScrollHdl(const Link< ScrollBar *, void > &rLink)
Definition: scrbar.hxx:130
void SetVisibleSize(tools::Long nNewSize) override
Definition: scrbar.cxx:1376
void SetLineSize(tools::Long nNewSize) override
Definition: scrbar.hxx:118
void SetPageSize(tools::Long nNewSize) override
Definition: scrbar.hxx:120
tools::Long GetVisibleSize() const override
Definition: scrbar.hxx:123
tools::Long Min() const
tools::Long Max() const
SfxHintId GetId() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
sal_Int32 GetScrollBarSize() const
const Color & GetFieldTextColor() const
const Color & GetFieldColor() const
const vcl::Font & GetFieldFont() const
const Color & GetWorkspaceColor() const
const Color & GetDisableColor() const
void SetRightToLeft(bool bR2L)
Definition: texteng.cxx:2682
OUString GetTextLines(LineEnd aSeparator=LINEEND_LF) const
Definition: texteng.cxx:258
sal_Int32 GetTextLen() const
Definition: texteng.cxx:284
tools::Long GetTextHeight() const
Definition: texteng.cxx:1099
tools::Long CalcTextWidth(sal_uInt32 nPara)
Definition: texteng.cxx:1119
void SetModified(bool bModified)
Definition: texteng.hxx:268
void Draw(OutputDevice *pDev, const Point &rPos)
Definition: texteng.cxx:2641
void SetMaxTextLen(sal_Int32 nLen)
Definition: texteng.cxx:210
void SetTextAlign(TxtAlign eAlign)
Definition: texteng.cxx:2507
bool IsModified() const
Definition: texteng.hxx:269
sal_Int32 GetMaxTextLen() const
Definition: texteng.hxx:234
void SetMaxTextWidth(tools::Long nWidth)
Definition: texteng.cxx:215
bool IsRightToLeft() const
Definition: texteng.hxx:254
OUString GetText(LineEnd aSeparator=LINEEND_LF) const
Definition: texteng.cxx:253
sal_uInt32 GetParagraphCount() const
Definition: texteng.cxx:1267
void SetText(const OUString &rStr)
Definition: texteng.cxx:427
void SetFont(const vcl::Font &rFont)
Definition: texteng.cxx:167
sal_uInt32 GetPara() const
Definition: textdata.hxx:45
sal_Int32 GetIndex() const
Definition: textdata.hxx:48
void Justify()
Definition: textdata.cxx:45
const TextPaM & GetStart() const
Definition: textdata.hxx:90
const TextPaM & GetEnd() const
Definition: textdata.hxx:93
bool HasRange() const
Definition: textdata.hxx:98
void SetSelection(const TextSelection &rNewSel)
Definition: textview.cxx:227
void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll)
Definition: textview.cxx:825
bool IsReadOnly() const
Definition: textview.cxx:2034
void SetReadOnly(bool bReadOnly)
Definition: textview.cxx:982
void EnableCursor(bool bEnable)
Definition: textview.cxx:2024
void Paste()
Definition: textview.cxx:957
OUString GetSelected() const
Definition: textview.cxx:963
void Cut()
Definition: textview.cxx:878
void Copy()
Definition: textview.cxx:908
TextPaM CursorDown(const TextPaM &rPaM)
Definition: textview.cxx:1331
const TextSelection & GetSelection() const
Definition: textview.cxx:232
void InsertText(const OUString &rNew)
Definition: textview.cxx:1117
const Point & GetStartDocPos() const
Definition: textview.cxx:2030
TextPaM CursorUp(const TextPaM &rPaM)
Definition: textview.cxx:1295
bool mbSelectOnTab
Definition: vclmedit.hxx:48
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: vclmedit.cxx:671
virtual void LoseFocus() override
Definition: vclmedit.cxx:878
TextView * GetTextView() const
Definition: vclmedit.hxx:56
std::unique_ptr< TextView > mpExtTextView
Definition: vclmedit.hxx:42
std::unique_ptr< ExtTextEngine > mpExtTextEngine
Definition: vclmedit.hxx:41
void SetIgnoreTab(bool bIgnore)
Definition: vclmedit.hxx:73
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: vclmedit.cxx:750
bool mbInMBDown
Definition: vclmedit.hxx:44
bool mbIgnoreTab
Definition: vclmedit.hxx:46
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: vclmedit.cxx:685
ExtTextEngine * GetTextEngine() const
Definition: vclmedit.hxx:55
virtual void KeyInput(const KeyEvent &rKEvent) override
Definition: vclmedit.cxx:698
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: vclmedit.cxx:693
virtual void Resize() override
Definition: vclmedit.cxx:755
void SetAutoFocusHide(bool bAutoHide)
Definition: vclmedit.hxx:71
bool mbFocusSelectionHide
Definition: vclmedit.hxx:45
bool mbActivePopup
Definition: vclmedit.hxx:47
VclPtr< Edit > mxParent
Definition: vclmedit.hxx:40
virtual ~TextWindow() override
Definition: vclmedit.cxx:666
virtual void GetFocus() override
Definition: vclmedit.cxx:858
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: vclmedit.cxx:679
virtual void Command(const CommandEvent &rCEvt) override
Definition: vclmedit.cxx:759
TextWindow(Edit *pParent)
Definition: vclmedit.cxx:639
Size CalcAdjustedSize(const Size &rPrefSize) const
Definition: vclmedit.cxx:1169
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: vclmedit.cxx:922
virtual void DumpAsPropertyTree(tools::JsonWriter &) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: vclmedit.cxx:1498
ScrollBar & GetVScrollBar() const
Definition: vclmedit.cxx:1441
Size CalcBlockSize(sal_uInt16 nColumns, sal_uInt16 nLines) const
Definition: vclmedit.cxx:1189
void GetMaxVisColumnsAndLines(sal_uInt16 &rnCols, sal_uInt16 &rnLines) const
Definition: vclmedit.cxx:1200
void DisableSelectionOnFocus()
Definition: vclmedit.cxx:1451
virtual ~VclMultiLineEdit() override
Definition: vclmedit.cxx:897
virtual OUString GetSelected() const override
Definition: vclmedit.cxx:1089
bool CanDown() const
Definition: vclmedit.cxx:1469
virtual sal_Int32 GetMaxTextLen() const override
Definition: vclmedit.cxx:1074
VclMultiLineEdit(vcl::Window *pParent, WinBits nWinStyle)
Definition: vclmedit.cxx:886
void EnableCursor(bool bEnable)
Definition: vclmedit.cxx:1456
virtual const Selection & GetSelection() const override
Definition: vclmedit.cxx:1152
virtual void SetSelection(const Selection &rSelection) override
Definition: vclmedit.cxx:1147
static WinBits ImplInitStyle(WinBits nStyle)
Definition: vclmedit.cxx:908
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: vclmedit.cxx:902
ExtTextEngine * GetTextEngine() const
Definition: vclmedit.cxx:1431
OUString GetText() const override
Definition: vclmedit.cxx:1119
void SetMaxTextWidth(tools::Long nMaxWidth)
Definition: vclmedit.cxx:1069
virtual void Cut() override
Definition: vclmedit.cxx:1099
void EnableFocusSelectionHide(bool bHide)
Definition: vclmedit.cxx:1446
Link< Edit &, void > aModifyHdlLink
Definition: vclmedit.hxx:85
virtual void Paste() override
Definition: vclmedit.cxx:1109
virtual void SetText(const OUString &rStr) override
Definition: vclmedit.cxx:1114
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: vclmedit.cxx:1337
virtual bool IsReadOnly() const override
Definition: vclmedit.cxx:1056
virtual void Resize() override
Definition: vclmedit.cxx:1134
virtual void SetReadOnly(bool bReadOnly=true) override
Definition: vclmedit.cxx:1042
virtual void DeleteSelected() override
Definition: vclmedit.cxx:1084
virtual void SetMaxTextLen(sal_Int32 nMaxLen) override
Definition: vclmedit.cxx:1064
void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: vclmedit.cxx:1258
virtual void SetModifyFlag() override
Definition: vclmedit.cxx:1037
bool CanUp() const
Definition: vclmedit.cxx:1461
void StateChanged(StateChangedType nType) override
Definition: vclmedit.cxx:1205
void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
Definition: vclmedit.cxx:1271
virtual void GetFocus() override
Definition: vclmedit.cxx:1139
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: vclmedit.cxx:1347
OUString GetTextLines(LineEnd aSeparator) const
Definition: vclmedit.cxx:1129
std::unique_ptr< ImpVclMEdit > pImpVclMEdit
Definition: vclmedit.hxx:83
virtual void Modify() override
Definition: vclmedit.cxx:1020
virtual Size CalcMinimumSize() const override
Definition: vclmedit.cxx:1157
virtual FactoryFunction GetUITestFactory() const override
Definition: vclmedit.cxx:1482
TextWindow * GetTextWindow()
Definition: vclmedit.cxx:1477
void ImplInitSettings()
Definition: ctrl.cxx:423
virtual void Copy() override
Definition: vclmedit.cxx:1104
TextView * GetTextView() const
Definition: vclmedit.cxx:1436
virtual bool set_property(const OUString &rKey, const OUString &rValue) override
Definition: vclmedit.cxx:1487
virtual void ReplaceSelected(const OUString &rStr) override
Definition: vclmedit.cxx:1079
void SelectionChanged()
Definition: vclmedit.cxx:1027
void disposeAndClear()
Definition: vclptr.hxx:200
void clear()
Definition: vclptr.hxx:190
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
void put(std::u16string_view pPropName, const OUString &rPropValue)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
void SetTransparent(bool bTransparent)
Definition: font/font.cxx:125
void SetFillColor(const Color &)
Definition: font/font.cxx:115
void SetColor(const Color &)
Definition: font/font.cxx:107
sal_uInt16 GetGroup() const
Definition: keycod.hxx:62
bool IsMod1() const
Definition: keycod.hxx:56
sal_uInt16 GetCode() const
Definition: keycod.hxx:49
sal_uInt16 GetModifier() const
Definition: keycod.hxx:52
bool IsShift() const
Definition: keycod.hxx:54
bool IsMod2() const
Definition: keycod.hxx:58
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Definition: window3.cxx:66
void SetStyle(WinBits nStyle)
Definition: window.cxx:1962
bool IsReallyVisible() const
Definition: window2.cxx:1133
bool HandleScrollCommand(const CommandEvent &rCmd, Scrollable *pHScrl, Scrollable *pVScrl)
Definition: window2.cxx:644
bool IsPaintTransparent() const
Definition: window2.cxx:1063
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: window.cxx:2424
tools::Long CalcZoom(tools::Long n) const
Definition: window2.cxx:426
const Color & GetControlForeground() const
Definition: window2.cxx:1098
void GrabFocus()
Definition: window.cxx:2976
void SetControlBackground()
Definition: window2.cxx:526
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: window3.cxx:65
void Enable(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2433
bool IsControlForeground() const
Definition: window2.cxx:1103
WinBits GetStyle() const
Definition: window2.cxx:979
const Fraction & GetZoom() const
Definition: window2.cxx:1236
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2187
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
Definition: window.cxx:2666
const vcl::Font & GetFont() const
Definition: window3.cxx:58
tools::Long GetDrawPixel(::OutputDevice const *pDev, tools::Long nPixels) const
Definition: window2.cxx:592
virtual Size GetSizePixel() const
Definition: window.cxx:2402
Size GetOutputSizePixel() const
Definition: window3.cxx:89
bool IsControlBackground() const
Definition: window2.cxx:1113
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
const Color & GetControlBackground() const
Definition: window2.cxx:1108
virtual void SetPointer(PointerStyle)
Definition: mouse.cxx:486
bool IsVisible() const
Definition: window2.cxx:1128
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
weld::Window * GetFrameWeld() const
Definition: window2.cxx:884
void ApplyControlFont(vcl::RenderContext &rRenderContext, const vcl::Font &rDefaultFont)
Definition: window2.cxx:478
void SetType(WindowType nType)
Definition: window2.cxx:994
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1294
bool IsEnabled() const
Definition: window2.cxx:1148
void SetCompoundControl(bool bCompound)
Definition: window2.cxx:973
void SetBackground()
Definition: window3.cxx:100
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
CommandEventId
float u
float x
ESelection aNewSelection(GetSelection())
#define EDIT_NOLIMIT
Definition: edit.hxx:51
bool bReadOnly
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
sal_Int64 n
constexpr sal_uInt16 KEY_MOD1
Definition: keycodes.hxx:31
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
constexpr sal_uInt16 KEY_PAGEDOWN
Definition: keycodes.hxx:117
constexpr sal_uInt16 KEY_TAB
Definition: keycodes.hxx:121
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
constexpr sal_uInt16 KEY_S
Definition: keycodes.hxx:74
constexpr sal_uInt16 KEY_A
Definition: keycodes.hxx:56
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
constexpr sal_uInt16 KEY_PAGEUP
Definition: keycodes.hxx:116
constexpr sal_uInt16 KEY_END
Definition: keycodes.hxx:115
constexpr sal_uInt16 KEYGROUP_CURSOR
Definition: keycodes.hxx:40
LineEnd
const LanguageTag & getLocale()
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
long Long
FncGetSpecialChars GetGetSpecialCharsFunction()
Definition: edit.cxx:2699
QPRO_FUNC_TYPE nType
sal_uIntPtr sal_uLong
#define TEXT_INDEX_ALL
Definition: textdata.hxx:33
#define TEXT_PARA_ALL
Definition: textdata.hxx:32
sal_uInt16 sal_Unicode
@ EditSelectionChanged
IMPL_LINK(ImpVclMEdit, ScrollHdl, ScrollBar *, pCurScrollBar, void)
Definition: vclmedit.cxx:257
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WinBits const WB_CENTER
Definition: wintypes.hxx:147
WinBits const WB_DRAG
Definition: wintypes.hxx:152
WinBits const WB_SIZEABLE
Definition: wintypes.hxx:117
WinBits const WB_NOTABSTOP
Definition: wintypes.hxx:141
WinBits const WB_AUTOVSCROLL
Definition: wintypes.hxx:163
WinBits const WB_GROUP
Definition: wintypes.hxx:142
WinBits const WB_IGNORETAB
Definition: wintypes.hxx:198
WinBits const WB_RIGHT
Definition: wintypes.hxx:148
WinBits const WB_BORDER
Definition: wintypes.hxx:115
WinBits const WB_NOGROUP
Definition: wintypes.hxx:143
WinBits const WB_VSCROLL
Definition: wintypes.hxx:178
WinBits const WB_NODIALOGCONTROL
Definition: wintypes.hxx:114
WinBits const WB_TABSTOP
Definition: wintypes.hxx:140
WinBits const WB_READONLY
Definition: wintypes.hxx:194
WinBits const WB_LEFT
Definition: wintypes.hxx:146
WinBits const WB_NOHIDESELECTION
Definition: wintypes.hxx:195
WinBits const WB_HSCROLL
Definition: wintypes.hxx:177