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 || rKEvent.GetKeyCode().IsMod1() )
728 bDone = mpExtTextView->KeyInput( rKEvent );
729 }
730 else
731 {
732 bDone = mpExtTextView->KeyInput( rKEvent );
733 }
734
735 if ( !bDone )
736 Window::KeyInput( rKEvent );
737}
738
739void TextWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
740{
741 mpExtTextView->Paint(rRenderContext, rRect);
742}
743
745{
746}
747
749{
751 {
753 bool bEnableCut = true;
754 bool bEnableCopy = true;
755 bool bEnableDelete = true;
756 bool bEnablePaste = true;
757 bool bEnableSpecialChar = true;
758 bool bEnableUndo = true;
759
760 if ( !mpExtTextView->HasSelection() )
761 {
762 bEnableCut = false;
763 bEnableCopy = false;
764 bEnableDelete = false;
765 }
766 if ( mpExtTextView->IsReadOnly() )
767 {
768 bEnableCut = false;
769 bEnablePaste = false;
770 bEnableDelete = false;
771 bEnableSpecialChar = false;
772 }
773 if ( !mpExtTextView->GetTextEngine()->HasUndoManager() || !mpExtTextView->GetTextEngine()->GetUndoManager().GetUndoActionCount() )
774 {
775 bEnableUndo = false;
776 }
777 pPopup->EnableItem(pPopup->GetItemId("cut"), bEnableCut);
778 pPopup->EnableItem(pPopup->GetItemId("copy"), bEnableCopy);
779 pPopup->EnableItem(pPopup->GetItemId("delete"), bEnableDelete);
780 pPopup->EnableItem(pPopup->GetItemId("paste"), bEnablePaste);
781 pPopup->EnableItem(pPopup->GetItemId("specialchar"), bEnableSpecialChar);
782 pPopup->EnableItem(pPopup->GetItemId("undo"), bEnableUndo);
783 pPopup->ShowItem(pPopup->GetItemId("specialchar"), !vcl::GetGetSpecialCharsFunction());
784
785 mbActivePopup = true;
786 Point aPos = rCEvt.GetMousePosPixel();
787 if ( !rCEvt.IsMouseEvent() )
788 {
789 // Sometime do show Menu centered in the selection !!!
790 Size aSize = GetOutputSizePixel();
791 aPos = Point( aSize.Width()/2, aSize.Height()/2 );
792 }
793 sal_uInt16 n = pPopup->Execute( this, aPos );
794 OString sCommand = pPopup->GetItemIdent(n);
795 if (sCommand == "undo")
796 {
797 mpExtTextView->Undo();
798 mpExtTextEngine->SetModified( true );
799 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
800 }
801 else if (sCommand == "cut")
802 {
803 mpExtTextView->Cut();
804 mpExtTextEngine->SetModified( true );
805 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
806 }
807 else if (sCommand == "copy")
808 {
809 mpExtTextView->Copy();
810 }
811 else if (sCommand == "paste")
812 {
813 mpExtTextView->Paste();
814 mpExtTextEngine->SetModified( true );
815 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
816 }
817 else if (sCommand == "delete")
818 {
819 mpExtTextView->DeleteSelected();
820 mpExtTextEngine->SetModified( true );
821 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
822 }
823 else if (sCommand == "selectall")
824 {
826 }
827 else if (sCommand == "specialchar")
828 {
829 OUString aChars = vcl::GetGetSpecialCharsFunction()(GetFrameWeld(), GetFont());
830 if (!aChars.isEmpty())
831 {
832 mpExtTextView->InsertText( aChars );
833 mpExtTextEngine->SetModified( true );
834 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
835 }
836 }
837 pPopup.clear();
838 mbActivePopup = false;
839 }
840 else
841 {
842 mpExtTextView->Command( rCEvt );
843 }
844 Window::Command( rCEvt );
845}
846
848{
849 Window::GetFocus();
850 if ( mbActivePopup )
851 return;
852
853 bool bGotoCursor = !mpExtTextView->IsReadOnly();
855 {
856 // select everything, but do not scroll
857 bool bAutoScroll = mpExtTextView->IsAutoScroll();
858 mpExtTextView->SetAutoScroll( false );
860 mpExtTextView->SetAutoScroll( bAutoScroll );
861 bGotoCursor = false;
862 }
863 mpExtTextView->SetPaintSelection( true );
864 mpExtTextView->ShowCursor( bGotoCursor );
865}
866
868{
869 Window::LoseFocus();
870
872 mpExtTextView->SetPaintSelection( false );
873}
874
876 : Edit( pParent, nWinStyle )
877{
879 pImpVclMEdit.reset(new ImpVclMEdit( this, nWinStyle ));
880 ImplInitSettings( true );
881
882 SetCompoundControl( true );
883 SetStyle( ImplInitStyle( nWinStyle ) );
884}
885
887{
888 disposeOnce();
889}
890
892{
893 pImpVclMEdit.reset();
895}
896
898{
899 if ( !(nStyle & WB_NOTABSTOP) )
900 nStyle |= WB_TABSTOP;
901
902 if ( !(nStyle & WB_NOGROUP) )
903 nStyle |= WB_GROUP;
904
905 if ( !(nStyle & WB_IGNORETAB ))
906 nStyle |= WB_NODIALOGCONTROL;
907
908 return nStyle;
909}
910
912{
913 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
914
915 // The Font has to be adjusted, as the TextEngine does not take care of
916 // TextColor/Background
917
918 Color aTextColor = rStyleSettings.GetFieldTextColor();
920 aTextColor = GetControlForeground();
921
922 if (!IsEnabled())
923 aTextColor = rStyleSettings.GetDisableColor();
924
925 vcl::Font aFont = rStyleSettings.GetFieldFont();
927 ApplyControlFont(rRenderContext, aFont);
928
929 vcl::Font theFont = rRenderContext.GetFont();
930 theFont.SetColor(aTextColor);
931 if (IsPaintTransparent())
933 else
934 theFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor());
935
936 pImpVclMEdit->GetTextWindow()->SetFont(theFont);
937 // FIXME: next call causes infinite invalidation loop, rethink how to properly fix this situation
938 // pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(theFont);
939 pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
940
941 if (IsPaintTransparent())
942 {
943 pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true);
944 pImpVclMEdit->GetTextWindow()->SetBackground();
945 pImpVclMEdit->GetTextWindow()->SetControlBackground();
946 rRenderContext.SetBackground();
948 }
949 else
950 {
952 pImpVclMEdit->GetTextWindow()->SetBackground(GetControlBackground());
953 else
954 pImpVclMEdit->GetTextWindow()->SetBackground(rStyleSettings.GetFieldColor());
955 // also adjust for VclMultiLineEdit as the TextComponent might hide Scrollbars
956 rRenderContext.SetBackground(pImpVclMEdit->GetTextWindow()->GetBackground());
957 }
958}
959
961{
962 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
963
964 // The Font has to be adjusted, as the TextEngine does not take care of
965 // TextColor/Background
966
967 Color aTextColor = rStyleSettings.GetFieldTextColor();
969 aTextColor = GetControlForeground();
970 if (!IsEnabled())
971 aTextColor = rStyleSettings.GetDisableColor();
972
973 vcl::Font aFont = rStyleSettings.GetFieldFont();
975 ApplyControlFont(*GetOutDev(), aFont);
976
977 vcl::Font TheFont = GetFont();
978 TheFont.SetColor(aTextColor);
979 if (IsPaintTransparent())
981 else
982 TheFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor());
983 pImpVclMEdit->GetTextWindow()->SetFont(TheFont);
984 pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(TheFont);
985 pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
986
987 if (!bBackground)
988 return;
989
990 if (IsPaintTransparent())
991 {
992 pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true);
993 pImpVclMEdit->GetTextWindow()->SetBackground();
994 pImpVclMEdit->GetTextWindow()->SetControlBackground();
997 }
998 else
999 {
1000 if (IsControlBackground())
1001 pImpVclMEdit->GetTextWindow()->SetBackground(GetControlBackground());
1002 else
1003 pImpVclMEdit->GetTextWindow()->SetBackground(rStyleSettings.GetFieldColor());
1004 // also adjust for VclMultiLineEdit as the TextComponent might hide Scrollbars
1005 SetBackground(pImpVclMEdit->GetTextWindow()->GetBackground());
1006 }
1007}
1008
1010{
1011 aModifyHdlLink.Call( *this );
1012
1014}
1015
1017{
1019}
1020
1022{
1024}
1025
1027{
1028 pImpVclMEdit->SetModified( true );
1029}
1030
1031void VclMultiLineEdit::SetReadOnly( bool bReadOnly )
1032{
1033 pImpVclMEdit->SetReadOnly( bReadOnly );
1035
1036 // #94921# ReadOnly can be overwritten in InitFromStyle() when WB not set.
1037 WinBits nStyle = GetStyle();
1038 if ( bReadOnly )
1039 nStyle |= WB_READONLY;
1040 else
1041 nStyle &= ~WB_READONLY;
1042 SetStyle( nStyle );
1043}
1044
1046{
1047 if (!pImpVclMEdit) // might be called from within the dtor, when pImpVclMEdit == NULL is a valid state
1048 return true;
1049
1050 return pImpVclMEdit->IsReadOnly();
1051}
1052
1053void VclMultiLineEdit::SetMaxTextLen(sal_Int32 nMaxLen)
1054{
1055 pImpVclMEdit->SetMaxTextLen(nMaxLen);
1056}
1057
1059{
1060 pImpVclMEdit->SetMaxTextWidth(nMaxWidth );
1061}
1062
1064{
1065 return pImpVclMEdit->GetMaxTextLen();
1066}
1067
1068void VclMultiLineEdit::ReplaceSelected( const OUString& rStr )
1069{
1070 pImpVclMEdit->InsertText( rStr );
1071}
1072
1074{
1075 pImpVclMEdit->InsertText( OUString() );
1076}
1077
1079{
1080 return pImpVclMEdit->GetSelected();
1081}
1082
1083OUString VclMultiLineEdit::GetSelected( LineEnd aSeparator ) const
1084{
1085 return pImpVclMEdit->GetSelected( aSeparator );
1086}
1087
1089{
1090 pImpVclMEdit->Cut();
1091}
1092
1094{
1095 pImpVclMEdit->Copy();
1096}
1097
1099{
1100 pImpVclMEdit->Paste();
1101}
1102
1103void VclMultiLineEdit::SetText( const OUString& rStr )
1104{
1105 pImpVclMEdit->SetText( rStr );
1106}
1107
1109{
1110 return pImpVclMEdit ? pImpVclMEdit->GetText() : OUString();
1111}
1112
1113OUString VclMultiLineEdit::GetText( LineEnd aSeparator ) const
1114{
1115 return pImpVclMEdit ? pImpVclMEdit->GetText( aSeparator ) : OUString();
1116}
1117
1118OUString VclMultiLineEdit::GetTextLines( LineEnd aSeparator ) const
1119{
1120 return pImpVclMEdit ? pImpVclMEdit->GetTextLines( aSeparator ) : OUString();
1121}
1122
1124{
1125 pImpVclMEdit->Resize();
1126}
1127
1129{
1130 if ( !pImpVclMEdit ) // might be called from within the dtor, when pImpVclMEdit == NULL is a valid state
1131 return;
1132
1133 pImpVclMEdit->GetFocus();
1134}
1135
1137{
1138 pImpVclMEdit->SetSelection( rSelection );
1139}
1140
1142{
1143 return pImpVclMEdit->GetSelection();
1144}
1145
1147{
1148 Size aSz = pImpVclMEdit->CalcMinimumSize();
1149
1150 sal_Int32 nLeft, nTop, nRight, nBottom;
1151 static_cast<vcl::Window*>(const_cast<VclMultiLineEdit *>(this))->GetBorder( nLeft, nTop, nRight, nBottom );
1152 aSz.AdjustWidth(nLeft+nRight );
1153 aSz.AdjustHeight(nTop+nBottom );
1154
1155 return aSz;
1156}
1157
1159{
1160 Size aSz = rPrefSize;
1161 sal_Int32 nLeft, nTop, nRight, nBottom;
1162 static_cast<vcl::Window*>(const_cast<VclMultiLineEdit *>(this))->GetBorder( nLeft, nTop, nRight, nBottom );
1163
1164 // center vertically for whole lines
1165
1166 tools::Long nHeight = aSz.Height() - nTop - nBottom;
1167 tools::Long nLineHeight = pImpVclMEdit->CalcBlockSize( 1, 1 ).Height();
1168 tools::Long nLines = nHeight / nLineHeight;
1169 if ( nLines < 1 )
1170 nLines = 1;
1171
1172 aSz.setHeight( nLines * nLineHeight );
1173 aSz.AdjustHeight(nTop+nBottom );
1174
1175 return aSz;
1176}
1177
1178Size VclMultiLineEdit::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
1179{
1180 Size aSz = pImpVclMEdit->CalcBlockSize( nColumns, nLines );
1181
1182 sal_Int32 nLeft, nTop, nRight, nBottom;
1183 static_cast<vcl::Window*>(const_cast<VclMultiLineEdit *>(this))->GetBorder( nLeft, nTop, nRight, nBottom );
1184 aSz.AdjustWidth(nLeft+nRight );
1185 aSz.AdjustHeight(nTop+nBottom );
1186 return aSz;
1187}
1188
1189void VclMultiLineEdit::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const
1190{
1191 pImpVclMEdit->GetMaxVisColumnsAndLines( rnCols, rnLines );
1192}
1193
1195{
1197 {
1198 pImpVclMEdit->Enable( IsEnabled() );
1199 ImplInitSettings( false );
1200 }
1201 else if( nType == StateChangedType::ReadOnly )
1202 {
1203 pImpVclMEdit->SetReadOnly( IsReadOnly() );
1204 }
1205 else if ( nType == StateChangedType::Zoom )
1206 {
1207 pImpVclMEdit->GetTextWindow()->SetZoom( GetZoom() );
1208 ImplInitSettings( false );
1209 Resize();
1210 }
1212 {
1213 ImplInitSettings( false );
1214 Resize();
1215 Invalidate();
1216 }
1218 {
1219 ImplInitSettings( false );
1220 Invalidate();
1221 }
1223 {
1224 ImplInitSettings( true );
1225 Invalidate();
1226 }
1227 else if ( nType == StateChangedType::Style )
1228 {
1229 pImpVclMEdit->InitFromStyle( GetStyle() );
1231 }
1232 else if ( nType == StateChangedType::InitShow )
1233 {
1234 if( IsPaintTransparent() )
1235 {
1236 pImpVclMEdit->GetTextWindow()->SetPaintTransparent( true );
1237 pImpVclMEdit->GetTextWindow()->SetBackground();
1238 pImpVclMEdit->GetTextWindow()->SetControlBackground();
1239 SetBackground();
1241 }
1242 }
1243
1245}
1246
1248{
1249 if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1250 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
1251 {
1252 ImplInitSettings( true );
1253 Resize();
1254 Invalidate();
1255 }
1256 else
1257 Control::DataChanged( rDCEvt );
1258}
1259
1260void VclMultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags )
1261{
1262 ImplInitSettings(true);
1263
1264 Point aPos = pDev->LogicToPixel( rPos );
1265 Size aSize = GetSizePixel();
1266
1267 vcl::Font aFont = pImpVclMEdit->GetTextWindow()->GetDrawPixelFont(pDev);
1268 aFont.SetTransparent( true );
1269
1270 pDev->Push();
1271 pDev->SetMapMode();
1272 pDev->SetFont( aFont );
1273 pDev->SetTextFillColor();
1274
1275 // Border/Background
1276 pDev->SetLineColor();
1277 pDev->SetFillColor();
1278 bool bBorder = (GetStyle() & WB_BORDER);
1279 bool bBackground = IsControlBackground();
1280 if ( bBorder || bBackground )
1281 {
1282 tools::Rectangle aRect( aPos, aSize );
1283 if ( bBorder )
1284 {
1285 DecorationView aDecoView( pDev );
1286 aRect = aDecoView.DrawFrame( aRect, DrawFrameStyle::DoubleIn );
1287 }
1288 if ( bBackground )
1289 {
1291 pDev->DrawRect( aRect );
1292 }
1293 }
1294
1295 pDev->SetSystemTextColor(nFlags, IsEnabled());
1296
1297 OUString aText = GetText();
1298 Size aTextSz( pDev->GetTextWidth( aText ), pDev->GetTextHeight() );
1299 sal_uLong nLines = static_cast<sal_uLong>(aSize.Height() / aTextSz.Height());
1300 if ( !nLines )
1301 nLines = 1;
1302 aTextSz.setHeight( nLines*aTextSz.Height() );
1303 tools::Long nOnePixel = GetDrawPixel( pDev, 1 );
1304 tools::Long nOffX = 3*nOnePixel;
1305 tools::Long nOffY = 2*nOnePixel;
1306
1307 // Clipping?
1308 if ( ( nOffY < 0 ) || ( (nOffY+aTextSz.Height()) > aSize.Height() ) || ( (nOffX+aTextSz.Width()) > aSize.Width() ) )
1309 {
1310 tools::Rectangle aClip( aPos, aSize );
1311 if ( aTextSz.Height() > aSize.Height() )
1312 aClip.AdjustBottom(aTextSz.Height() - aSize.Height() + 1 ); // so that HP-printer does not 'optimize-away'
1313 pDev->IntersectClipRegion( aClip );
1314 }
1315
1316 ExtTextEngine aTE;
1317 aTE.SetText( GetText() );
1318 aTE.SetMaxTextWidth( aSize.Width() );
1319 aTE.SetFont( aFont );
1320 aTE.SetTextAlign( pImpVclMEdit->GetTextWindow()->GetTextEngine()->GetTextAlign() );
1321 aTE.Draw( pDev, Point( aPos.X() + nOffX, aPos.Y() + nOffY ) );
1322
1323 pDev->Pop();
1324}
1325
1327{
1328 bool bDone = false;
1329 if( rNEvt.GetType() == NotifyEventType::COMMAND )
1330 {
1331 bDone = pImpVclMEdit->HandleCommand( *rNEvt.GetCommandEvent() );
1332 }
1333 return bDone || Edit::EventNotify( rNEvt );
1334}
1335
1337{
1338 bool bDone = false;
1339
1340 if( ( rNEvt.GetType() == NotifyEventType::KEYINPUT ) && ( !GetTextView()->IsCursorEnabled() ) )
1341 {
1342 const KeyEvent& rKEvent = *rNEvt.GetKeyEvent();
1343 if ( !rKEvent.GetKeyCode().IsShift() && ( rKEvent.GetKeyCode().GetGroup() == KEYGROUP_CURSOR ) )
1344 {
1345 bDone = true;
1346 TextSelection aSel = pImpVclMEdit->GetTextWindow()->GetTextView()->GetSelection();
1347 if ( aSel.HasRange() )
1348 {
1349 aSel.GetStart() = aSel.GetEnd();
1350 pImpVclMEdit->GetTextWindow()->GetTextView()->SetSelection( aSel );
1351 }
1352 else
1353 {
1354 switch ( rKEvent.GetKeyCode().GetCode() )
1355 {
1356 case KEY_UP:
1357 {
1358 if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
1359 pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::LineUp );
1360 }
1361 break;
1362 case KEY_DOWN:
1363 {
1364 if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
1365 pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::LineDown );
1366 }
1367 break;
1368 case KEY_PAGEUP :
1369 {
1370 if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
1371 pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::PageUp );
1372 }
1373 break;
1374 case KEY_PAGEDOWN:
1375 {
1376 if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
1377 pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::PageDown );
1378 }
1379 break;
1380 case KEY_LEFT:
1381 {
1382 if ( pImpVclMEdit->GetHScrollBar().IsVisible() )
1383 pImpVclMEdit->GetHScrollBar().DoScrollAction( ScrollType::LineUp );
1384 }
1385 break;
1386 case KEY_RIGHT:
1387 {
1388 if ( pImpVclMEdit->GetHScrollBar().IsVisible() )
1389 pImpVclMEdit->GetHScrollBar().DoScrollAction( ScrollType::LineDown );
1390 }
1391 break;
1392 case KEY_HOME:
1393 {
1394 if ( rKEvent.GetKeyCode().IsMod1() )
1395 pImpVclMEdit->GetTextWindow()->GetTextView()->
1396 SetSelection( TextSelection( TextPaM( 0, 0 ) ) );
1397 }
1398 break;
1399 case KEY_END:
1400 {
1401 if ( rKEvent.GetKeyCode().IsMod1() )
1402 pImpVclMEdit->GetTextWindow()->GetTextView()->
1404 }
1405 break;
1406 default:
1407 {
1408 bDone = false;
1409 }
1410 }
1411 }
1412 }
1413 }
1414
1415 return bDone || Edit::PreNotify( rNEvt );
1416}
1417
1418// Internals for derived classes, e.g. TextComponent
1419
1421{
1422 return pImpVclMEdit->GetTextWindow()->GetTextEngine();
1423}
1424
1426{
1427 return pImpVclMEdit->GetTextWindow()->GetTextView();
1428}
1429
1431{
1432 return pImpVclMEdit->GetVScrollBar();
1433}
1434
1436{
1437 pImpVclMEdit->GetTextWindow()->SetAutoFocusHide( bHide );
1438}
1439
1441{
1442 pImpVclMEdit->GetTextWindow()->DisableSelectionOnFocus();
1443}
1444
1446{
1447 GetTextView()->EnableCursor( bEnable );
1448}
1449
1451{
1452 TextView* pTextView = GetTextView();
1453 const TextSelection& rTextSelection = pTextView->GetSelection();
1454 TextPaM aPaM(rTextSelection.GetEnd());
1455 return aPaM != pTextView->CursorUp(aPaM);
1456}
1457
1459{
1460 TextView* pTextView = GetTextView();
1461 const TextSelection& rTextSelection = pTextView->GetSelection();
1462 TextPaM aPaM(rTextSelection.GetEnd());
1463 return aPaM != pTextView->CursorDown(aPaM);
1464}
1465
1467{
1468 return pImpVclMEdit->GetTextWindow();
1469}
1470
1472{
1474}
1475
1476bool VclMultiLineEdit::set_property(const OString &rKey, const OUString &rValue)
1477{
1478 if (rKey == "cursor-visible")
1479 EnableCursor(toBool(rValue));
1480 else if (rKey == "accepts-tab")
1481 pImpVclMEdit->GetTextWindow()->SetIgnoreTab(!toBool(rValue));
1482 else
1483 return Edit::set_property(rKey, rValue);
1484 return true;
1485}
1486
1488{
1489 Edit::DumpAsPropertyTree(rJsonWriter);
1490
1491 rJsonWriter.put("cursor", pImpVclMEdit->GetTextWindow()->GetTextView()->IsCursorEnabled());
1492}
1493
1494/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SystemTextColorFlags
WeakReference< XInterface > mxParent
static bool toBool(std::string_view rValue)
Definition: builder.cxx:91
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:226
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:257
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: ctrl.cxx:294
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 bool set_property(const OString &rKey, const OUString &rValue) override
Definition: edit.cxx:183
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 PreNotify(NotifyEvent &rNEvt) override
Definition: edit.cxx:1918
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:2938
virtual void SetReadOnly(bool bReadOnly=true)
Definition: edit.cxx:2369
VclPtr< PopupMenu > CreatePopupMenu()
Definition: edit.cxx:2719
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
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:57
OString GetItemIdent(sal_uInt16 nItemId) const
Definition: menu.cxx:665
void ShowItem(sal_uInt16 nItemId, bool bVisible=true)
Definition: menu.cxx:939
sal_uInt16 GetItemId(sal_uInt16 nPos) const
Definition: menu.cxx:623
void EnableItem(sal_uInt16 nItemId, bool bEnable=true)
Definition: menu.cxx:894
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:171
const vcl::Font & GetFont() const
Definition: outdev.hxx:530
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:2482
void SetLineColor()
Definition: line.cxx:37
void SetMapMode()
Definition: map.cxx:610
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:892
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:289
void IntersectClipRegion(const tools::Rectangle &rRect)
sal_uInt16 Execute(vcl::Window *pWindow, const Point &rPopupPos)
Definition: menu.cxx:2743
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:2685
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:1102
tools::Long CalcTextWidth(sal_uInt32 nPara)
Definition: texteng.cxx:1122
void SetModified(bool bModified)
Definition: texteng.hxx:268
void Draw(OutputDevice *pDev, const Point &rPos)
Definition: texteng.cxx:2644
void SetMaxTextLen(sal_Int32 nLen)
Definition: texteng.cxx:210
void SetTextAlign(TxtAlign eAlign)
Definition: texteng.cxx:2510
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:1270
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:867
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:739
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:744
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:847
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: vclmedit.cxx:679
virtual void Command(const CommandEvent &rCEvt) override
Definition: vclmedit.cxx:748
TextWindow(Edit *pParent)
Definition: vclmedit.cxx:639
Size CalcAdjustedSize(const Size &rPrefSize) const
Definition: vclmedit.cxx:1158
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: vclmedit.cxx:911
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:1487
ScrollBar & GetVScrollBar() const
Definition: vclmedit.cxx:1430
Size CalcBlockSize(sal_uInt16 nColumns, sal_uInt16 nLines) const
Definition: vclmedit.cxx:1178
void GetMaxVisColumnsAndLines(sal_uInt16 &rnCols, sal_uInt16 &rnLines) const
Definition: vclmedit.cxx:1189
void DisableSelectionOnFocus()
Definition: vclmedit.cxx:1440
virtual ~VclMultiLineEdit() override
Definition: vclmedit.cxx:886
virtual OUString GetSelected() const override
Definition: vclmedit.cxx:1078
bool CanDown() const
Definition: vclmedit.cxx:1458
virtual sal_Int32 GetMaxTextLen() const override
Definition: vclmedit.cxx:1063
VclMultiLineEdit(vcl::Window *pParent, WinBits nWinStyle)
Definition: vclmedit.cxx:875
void EnableCursor(bool bEnable)
Definition: vclmedit.cxx:1445
virtual const Selection & GetSelection() const override
Definition: vclmedit.cxx:1141
virtual void SetSelection(const Selection &rSelection) override
Definition: vclmedit.cxx:1136
static WinBits ImplInitStyle(WinBits nStyle)
Definition: vclmedit.cxx:897
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: vclmedit.cxx:891
ExtTextEngine * GetTextEngine() const
Definition: vclmedit.cxx:1420
OUString GetText() const override
Definition: vclmedit.cxx:1108
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: vclmedit.cxx:1476
void SetMaxTextWidth(tools::Long nMaxWidth)
Definition: vclmedit.cxx:1058
virtual void Cut() override
Definition: vclmedit.cxx:1088
void EnableFocusSelectionHide(bool bHide)
Definition: vclmedit.cxx:1435
Link< Edit &, void > aModifyHdlLink
Definition: vclmedit.hxx:85
virtual void Paste() override
Definition: vclmedit.cxx:1098
virtual void SetText(const OUString &rStr) override
Definition: vclmedit.cxx:1103
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: vclmedit.cxx:1326
virtual bool IsReadOnly() const override
Definition: vclmedit.cxx:1045
virtual void Resize() override
Definition: vclmedit.cxx:1123
virtual void SetReadOnly(bool bReadOnly=true) override
Definition: vclmedit.cxx:1031
virtual void DeleteSelected() override
Definition: vclmedit.cxx:1073
virtual void SetMaxTextLen(sal_Int32 nMaxLen) override
Definition: vclmedit.cxx:1053
void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: vclmedit.cxx:1247
virtual void SetModifyFlag() override
Definition: vclmedit.cxx:1026
bool CanUp() const
Definition: vclmedit.cxx:1450
void StateChanged(StateChangedType nType) override
Definition: vclmedit.cxx:1194
void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
Definition: vclmedit.cxx:1260
virtual void GetFocus() override
Definition: vclmedit.cxx:1128
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: vclmedit.cxx:1336
OUString GetTextLines(LineEnd aSeparator) const
Definition: vclmedit.cxx:1118
std::unique_ptr< ImpVclMEdit > pImpVclMEdit
Definition: vclmedit.hxx:83
virtual void Modify() override
Definition: vclmedit.cxx:1009
virtual Size CalcMinimumSize() const override
Definition: vclmedit.cxx:1146
virtual FactoryFunction GetUITestFactory() const override
Definition: vclmedit.cxx:1471
TextWindow * GetTextWindow()
Definition: vclmedit.cxx:1466
void ImplInitSettings()
Definition: ctrl.cxx:424
virtual void Copy() override
Definition: vclmedit.cxx:1093
TextView * GetTextView() const
Definition: vclmedit.cxx:1425
virtual void ReplaceSelected(const OUString &rStr) override
Definition: vclmedit.cxx:1068
void SelectionChanged()
Definition: vclmedit.cxx:1016
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(const char *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
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:1966
bool IsReallyVisible() const
Definition: window2.cxx:1138
bool HandleScrollCommand(const CommandEvent &rCmd, Scrollable *pHScrl, Scrollable *pVScrl)
Definition: window2.cxx:639
bool IsPaintTransparent() const
Definition: window2.cxx:1068
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: window.cxx:2428
tools::Long CalcZoom(tools::Long n) const
Definition: window2.cxx:421
const Color & GetControlForeground() const
Definition: window2.cxx:1103
void GrabFocus()
Definition: window.cxx:2983
void SetControlBackground()
Definition: window2.cxx:521
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:2437
bool IsControlForeground() const
Definition: window2.cxx:1108
WinBits GetStyle() const
Definition: window2.cxx:984
const Fraction & GetZoom() const
Definition: window2.cxx:1241
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2191
::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:2670
const vcl::Font & GetFont() const
Definition: window3.cxx:58
tools::Long GetDrawPixel(::OutputDevice const *pDev, tools::Long nPixels) const
Definition: window2.cxx:587
virtual Size GetSizePixel() const
Definition: window.cxx:2406
Size GetOutputSizePixel() const
Definition: window3.cxx:89
bool IsControlBackground() const
Definition: window2.cxx:1118
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
const Color & GetControlBackground() const
Definition: window2.cxx:1113
void SetPointer(PointerStyle)
Definition: mouse.cxx:486
bool IsVisible() const
Definition: window2.cxx:1133
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
weld::Window * GetFrameWeld() const
Definition: window2.cxx:879
void ApplyControlFont(vcl::RenderContext &rRenderContext, const vcl::Font &rDefaultFont)
Definition: window2.cxx:473
void SetType(WindowType nType)
Definition: window2.cxx:999
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1299
bool IsEnabled() const
Definition: window2.cxx:1153
void SetCompoundControl(bool bCompound)
Definition: window2.cxx:978
void SetBackground()
Definition: window3.cxx:100
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
CommandEventId
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_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
sal_uInt16 nCode
const LanguageTag & getLocale()
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
long Long
FncGetSpecialChars GetGetSpecialCharsFunction()
Definition: edit.cxx:2713
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