42#include <osl/diagnose.h>
91 void SetText(
const OUString& rStr );
101 void Enable(
bool bEnable );
117 : pVclMultiLineEdit(pEdt)
141 if ( !bNeedVScroll && bAutoVScroll )
151 const bool bNeedScrollBox = bNeedVScroll && bNeedHScroll;
153 bool bScrollbarsChanged =
false;
154 if ( bHaveVScroll != bNeedVScroll )
157 bScrollbarsChanged =
true;
160 if ( bHaveHScroll != bNeedHScroll )
163 bScrollbarsChanged =
true;
166 if ( bHaveScrollBox != bNeedScrollBox )
171 if ( bScrollbarsChanged )
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();
266 mpTextWindow->GetTextView()->Scroll( nDiffX, nDiffY );
279 else if ( nWinStyle &
WB_LEFT )
339 Size aEditSize = aSz;
353 Point aTextWindowPos;
359 aTextWindowPos.
AdjustX(nSBWidth );
368 Size aTextWindowSize( aSz );
369 if ( aTextWindowSize.
Width() < 0 )
371 if ( aTextWindowSize.
Height() < 0 )
376 if ( aOldTextWindowSize == aTextWindowSize )
382 OSL_ENSURE( nIteration < 3,
"ImpVclMEdit::Resize: isn't this expected to terminate with the second iteration?" );
384 }
while ( nIteration <= 3 );
446 switch (pTextHint->
GetId())
448 case SfxHintId::TextViewScrolled:
455 case SfxHintId::TextHeightChanged:
460 if ( nTextHeight < nOutHeight )
466 case SfxHintId::TextFormatted:
479 case SfxHintId::TextModified:
484 case SfxHintId::TextViewSelectionChanged:
488 case SfxHintId::TextViewCaretChanged:
512 sal_uInt32 nPara = 0;
522 if ( (
x < aText.getLength() ) && ( aText[
x ] ==
'\n' ) )
543 for ( sal_uInt32
n = 0;
n < aTextSel.
GetStart().GetPara(); ++
n )
609 rnCols =
static_cast<sal_uInt16
>(aOutSz.
Width()/aCharSz.
Width());
610 rnLines =
static_cast<sal_uInt16
>(aOutSz.
Height()/aCharSz.
Height());
682 Window::MouseMove( rMEvt );
702 if ( nCode == css::awt::Key::SELECT_ALL ||
716 if (!aChars.isEmpty())
736 Window::KeyInput(aKEventWithoutMod1);
747 Window::KeyInput( rKEvent );
764 bool bEnableCut =
true;
765 bool bEnableCopy =
true;
766 bool bEnableDelete =
true;
767 bool bEnablePaste =
true;
768 bool bEnableSpecialChar =
true;
769 bool bEnableUndo =
true;
775 bEnableDelete =
false;
780 bEnablePaste =
false;
781 bEnableDelete =
false;
782 bEnableSpecialChar =
false;
784 if ( !
mpExtTextView->GetTextEngine()->HasUndoManager() || !
mpExtTextView->GetTextEngine()->GetUndoManager().GetUndoActionCount() )
804 sal_uInt16
n = pPopup->
Execute(
this, aPos );
806 if (sCommand ==
"undo")
812 else if (sCommand ==
"cut")
818 else if (sCommand ==
"copy")
822 else if (sCommand ==
"paste")
828 else if (sCommand ==
"delete")
834 else if (sCommand ==
"selectall")
838 else if (sCommand ==
"specialchar")
841 if (!aChars.isEmpty())
855 Window::Command( rCEvt );
887 :
Edit( pParent, nWinStyle )
950 pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
954 pImpVclMEdit->GetTextWindow()->SetPaintTransparent(
true);
995 pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(TheFont);
996 pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
1003 pImpVclMEdit->GetTextWindow()->SetPaintTransparent(
true);
1052 nStyle &= ~WB_READONLY;
1161 sal_Int32 nLeft, nTop, nRight, nBottom;
1171 Size aSz = rPrefSize;
1172 sal_Int32 nLeft, nTop, nRight, nBottom;
1193 sal_Int32 nLeft, nTop, nRight, nBottom;
1202 pImpVclMEdit->GetMaxVisColumnsAndLines( rnCols, rnLines );
1247 pImpVclMEdit->GetTextWindow()->SetPaintTransparent(
true );
1291 if ( bBorder || bBackground )
1319 if ( ( nOffY < 0 ) || ( (nOffY+aTextSz.
Height()) > aSize.
Height() ) || ( (nOffX+aTextSz.
Width()) > aSize.
Width() ) )
1332 aTE.
Draw( pDev,
Point( aPos.
X() + nOffX, aPos.
Y() + nOffY ) );
1361 pImpVclMEdit->GetTextWindow()->GetTextView()->SetSelection( aSel );
1448 pImpVclMEdit->GetTextWindow()->SetAutoFocusHide( bHide );
1453 pImpVclMEdit->GetTextWindow()->DisableSelectionOnFocus();
1466 return aPaM != pTextView->
CursorUp(aPaM);
1489 if (rKey ==
"cursor-visible")
1491 else if (rKey ==
"accepts-tab")
1502 rJsonWriter.
put(
"cursor",
pImpVclMEdit->GetTextWindow()->GetTextView()->IsCursorEnabled());
unotools::WeakReference< AnimationNode > mxParent
static bool toBool(std::string_view rValue)
const StyleSettings & GetStyleSettings() const
static bool GetLayoutRTL()
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
bool IsMouseEvent() const
virtual bool EventNotify(NotifyEvent &rNEvt) override
virtual void StateChanged(StateChangedType nStateChange) override
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
void DrawFrame(const tools::Rectangle &rRect, const Color &rLeftTopColor, const Color &rRightBottomColor)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
virtual bool set_property(const OUString &rKey, const OUString &rValue) override
virtual bool PreNotify(NotifyEvent &rNEvt) override
virtual void DumpAsPropertyTree(tools::JsonWriter &rJsonWriter) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
virtual void SetReadOnly(bool bReadOnly=true)
VclPtr< PopupMenu > CreatePopupMenu()
void ImpSetHScrollBarThumbPos()
void ImpUpdateScrollBarVis(WinBits nWinStyle)
Size CalcBlockSize(sal_uInt16 nColumns, sal_uInt16 nLines) const
virtual ~ImpVclMEdit() override
void ImpSetScrollBarRanges()
void SetText(const OUString &rStr)
ImpVclMEdit(VclMultiLineEdit *pVclMultiLineEdit, WinBits nWinStyle)
DECL_LINK(ScrollHdl, ScrollBar *, void)
void SetReadOnly(bool bRdOnly)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
void SetMaxTextWidth(tools::Long nMaxWidth)
OUString GetSelected() const
VclPtr< ScrollBar > mpVScrollBar
VclPtr< ScrollBar > mpHScrollBar
ScrollBar & GetHScrollBar()
OUString GetTextLines(LineEnd aSeparator) const
Size CalcMinimumSize() const
void GetMaxVisColumnsAndLines(sal_uInt16 &rnCols, sal_uInt16 &rnLines) const
void InsertText(const OUString &rStr)
TextWindow * GetTextWindow()
bool HandleCommand(const CommandEvent &rCEvt)
void SetModified(bool bMod)
void Enable(bool bEnable)
const Selection & GetSelection() const
void InitFromStyle(WinBits nWinStyle)
ScrollBar & GetVScrollBar()
void SetSelection(const Selection &rSelection)
VclPtr< ScrollBarBox > mpScrollBox
sal_Int32 GetMaxTextLen() const
VclPtr< VclMultiLineEdit > pVclMultiLineEdit
void SetMaxTextLen(sal_Int32 nLen)
VclPtr< TextWindow > mpTextWindow
void SetAlign(WinBits nWinStyle)
sal_Unicode GetCharCode() const
const vcl::KeyCode & GetKeyCode() const
sal_uInt16 GetRepeat() const
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
const KeyEvent * GetKeyEvent() const
const CommandEvent * GetCommandEvent() const
NotifyEventType GetType() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
const vcl::Font & GetFont() const
void SetFont(const vcl::Font &rNewFont)
void DrawRect(const tools::Rectangle &rRect)
virtual void SetSystemTextColor(SystemTextColorFlags nFlags, bool bEnabled)
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.
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
const AllSettings & GetSettings() const
void IntersectClipRegion(const tools::Rectangle &rRect)
constexpr tools::Long Y() const
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() 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)
OUString GetTextLines(LineEnd aSeparator=LINEEND_LF) const
sal_Int32 GetTextLen() const
tools::Long GetTextHeight() const
tools::Long CalcTextWidth(sal_uInt32 nPara)
void SetModified(bool bModified)
void Draw(OutputDevice *pDev, const Point &rPos)
void SetMaxTextLen(sal_Int32 nLen)
void SetTextAlign(TxtAlign eAlign)
sal_Int32 GetMaxTextLen() const
void SetMaxTextWidth(tools::Long nWidth)
bool IsRightToLeft() const
OUString GetText(LineEnd aSeparator=LINEEND_LF) const
sal_uInt32 GetParagraphCount() const
void SetText(const OUString &rStr)
void SetFont(const vcl::Font &rFont)
sal_uInt32 GetPara() const
sal_Int32 GetIndex() const
const TextPaM & GetStart() const
const TextPaM & GetEnd() const
void SetSelection(const TextSelection &rNewSel)
void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll)
void SetReadOnly(bool bReadOnly)
void EnableCursor(bool bEnable)
OUString GetSelected() const
TextPaM CursorDown(const TextPaM &rPaM)
const TextSelection & GetSelection() const
void InsertText(const OUString &rNew)
const Point & GetStartDocPos() const
TextPaM CursorUp(const TextPaM &rPaM)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
virtual void LoseFocus() override
TextView * GetTextView() const
std::unique_ptr< TextView > mpExtTextView
std::unique_ptr< ExtTextEngine > mpExtTextEngine
void SetIgnoreTab(bool bIgnore)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
ExtTextEngine * GetTextEngine() const
virtual void KeyInput(const KeyEvent &rKEvent) override
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
virtual void Resize() override
void SetAutoFocusHide(bool bAutoHide)
bool mbFocusSelectionHide
virtual ~TextWindow() override
virtual void GetFocus() override
virtual void MouseMove(const MouseEvent &rMEvt) override
virtual void Command(const CommandEvent &rCEvt) override
TextWindow(Edit *pParent)
Size CalcAdjustedSize(const Size &rPrefSize) const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
virtual void DumpAsPropertyTree(tools::JsonWriter &) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
ScrollBar & GetVScrollBar() const
Size CalcBlockSize(sal_uInt16 nColumns, sal_uInt16 nLines) const
void GetMaxVisColumnsAndLines(sal_uInt16 &rnCols, sal_uInt16 &rnLines) const
void DisableSelectionOnFocus()
virtual ~VclMultiLineEdit() override
virtual OUString GetSelected() const override
virtual sal_Int32 GetMaxTextLen() const override
VclMultiLineEdit(vcl::Window *pParent, WinBits nWinStyle)
void EnableCursor(bool bEnable)
virtual const Selection & GetSelection() const override
virtual void SetSelection(const Selection &rSelection) override
static WinBits ImplInitStyle(WinBits nStyle)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
ExtTextEngine * GetTextEngine() const
OUString GetText() const override
void SetMaxTextWidth(tools::Long nMaxWidth)
virtual void Cut() override
void EnableFocusSelectionHide(bool bHide)
Link< Edit &, void > aModifyHdlLink
virtual void Paste() override
virtual void SetText(const OUString &rStr) override
virtual bool EventNotify(NotifyEvent &rNEvt) override
virtual bool IsReadOnly() const override
virtual void Resize() override
virtual void SetReadOnly(bool bReadOnly=true) override
virtual void DeleteSelected() override
virtual void SetMaxTextLen(sal_Int32 nMaxLen) override
void DataChanged(const DataChangedEvent &rDCEvt) override
virtual void SetModifyFlag() override
void StateChanged(StateChangedType nType) override
void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
virtual void GetFocus() override
virtual bool PreNotify(NotifyEvent &rNEvt) override
OUString GetTextLines(LineEnd aSeparator) const
std::unique_ptr< ImpVclMEdit > pImpVclMEdit
virtual void Modify() override
virtual Size CalcMinimumSize() const override
virtual FactoryFunction GetUITestFactory() const override
TextWindow * GetTextWindow()
virtual void Copy() override
TextView * GetTextView() const
virtual bool set_property(const OUString &rKey, const OUString &rValue) override
virtual void ReplaceSelected(const OUString &rStr) override
reference_type * get() const
Get the body.
void SetTransparent(bool bTransparent)
void SetFillColor(const Color &)
void SetColor(const Color &)
sal_uInt16 GetGroup() const
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
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.
void SetStyle(WinBits nStyle)
bool IsReallyVisible() const
bool HandleScrollCommand(const CommandEvent &rCmd, Scrollable *pHScrl, Scrollable *pVScrl)
bool IsPaintTransparent() const
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
tools::Long CalcZoom(tools::Long n) const
const Color & GetControlForeground() const
void SetControlBackground()
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
void Enable(bool bEnable=true, bool bChild=true)
bool IsControlForeground() const
const Fraction & GetZoom() const
const AllSettings & GetSettings() const
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
::OutputDevice const * GetOutDev() const
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
const vcl::Font & GetFont() const
tools::Long GetDrawPixel(::OutputDevice const *pDev, tools::Long nPixels) const
virtual Size GetSizePixel() const
Size GetOutputSizePixel() const
bool IsControlBackground() const
virtual void DataChanged(const DataChangedEvent &rDCEvt)
const Color & GetControlBackground() const
virtual void SetPointer(PointerStyle)
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
weld::Window * GetFrameWeld() const
void ApplyControlFont(vcl::RenderContext &rRenderContext, const vcl::Font &rDefaultFont)
void SetType(WindowType nType)
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
void SetCompoundControl(bool bCompound)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
ESelection aNewSelection(GetSelection())
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
constexpr sal_uInt16 KEY_MOD1
constexpr sal_uInt16 KEY_HOME
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_S
constexpr sal_uInt16 KEY_A
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_PAGEUP
constexpr sal_uInt16 KEY_END
constexpr sal_uInt16 KEYGROUP_CURSOR
#define LINK(Instance, Class, Member)
const LanguageTag & getLocale()
FncGetSpecialChars GetGetSpecialCharsFunction()
IMPL_LINK(ImpVclMEdit, ScrollHdl, ScrollBar *, pCurScrollBar, void)
WinBits const WB_SIZEABLE
WinBits const WB_NOTABSTOP
WinBits const WB_AUTOVSCROLL
WinBits const WB_IGNORETAB
WinBits const WB_NODIALOGCONTROL
WinBits const WB_READONLY
WinBits const WB_NOHIDESELECTION