34 #include <strings.hrc>
37 #include <com/sun/star/i18n/BreakIterator.hpp>
38 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
39 #include <com/sun/star/i18n/WordType.hpp>
40 #include <com/sun/star/datatransfer/XTransferable.hpp>
41 #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
43 #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
44 #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
45 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
47 #include <com/sun/star/i18n/InputSequenceChecker.hpp>
48 #include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
49 #include <com/sun/star/i18n/ScriptType.hpp>
51 #include <com/sun/star/uno/Any.hxx>
64 #include <officecfg/Office/Common.hxx>
69 #include <string_view>
80 #define EDIT_ALIGN_LEFT 1
81 #define EDIT_ALIGN_CENTER 2
82 #define EDIT_ALIGN_RIGHT 3
84 #define EDIT_DEL_LEFT 1
85 #define EDIT_DEL_RIGHT 2
87 #define EDIT_DELMODE_SIMPLE 11
88 #define EDIT_DELMODE_RESTOFWORD 12
89 #define EDIT_DELMODE_RESTOFCONTENT 13
105 bStarterOfDD =
false;
106 bDroppedInMe =
false;
108 bIsStringSupported =
false;
115 std::unique_ptr<ExtTextInputAttr[]>
122 Impl_IMEInfos(sal_Int32 nPos,
const OUString& rOldTextAfterStartPos);
129 : aOldTextAfterStartPos(rOldTextAfterStartPos),
133 bWasCursorOverwrite(false)
183 if (rKey ==
"width-chars")
185 else if (rKey ==
"max-width-chars")
187 else if (rKey ==
"max-length")
189 sal_Int32 nTextLen = rValue.toInt32();
192 else if (rKey ==
"editable")
196 else if (rKey ==
"overwrite-mode")
200 else if (rKey ==
"visibility")
206 else if (rKey ==
"placeholder-text")
208 else if (rKey ==
"shadow-type")
241 uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL(
mxDnDListener, uno::UNO_QUERY );
246 uno::Reference< datatransfer::dnd::XDropTargetListener> xDTL(
mxDnDListener, uno::UNO_QUERY );
300 && ((nStyle &
WB_BORDER) && !(nStyle & WB_NOBORDER));
332 uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL(
mxDnDListener, uno::UNO_QUERY );
336 xDGR->addDragGestureListener( xDGL );
337 uno::Reference< datatransfer::dnd::XDropTargetListener> xDTL(
mxDnDListener, uno::UNO_QUERY );
340 GetDropTarget()->setDefaultActions( datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE );
358 return ((cCharCode >= 32) && (cCharCode != 127) &&
434 cEchoChar =
u'\x2022';
435 OUStringBuffer aText;
437 return aText.makeStringAndClear();
473 const sal_Int32 nLen = aText.getLength();
476 std::unique_ptr<tools::Long[]> pDXBuffer;
484 pDX = pDXBuffer.get();
494 bool bVisCursor = pCursor && pCursor->
IsVisible();
504 if (!
IsEnabled() || bPaintPlaceholderText)
515 rRenderContext.
Pop();
529 if (bPaintPlaceholderText)
535 rRenderContext.
DrawText(aPos, aText, 0, nLen);
540 rRenderContext.
Push();
547 for(sal_Int32
i = 0;
i < nLen; ++
i)
553 bool bHighlight =
false;
554 if (
i >= aTmpSel.
Min() &&
i < aTmpSel.
Max())
565 aHighlightClipRegion.
Union(aRect);
567 aNormalClipRegion.
Union(aRect);
590 rRenderContext.
DrawText(aPos, aText, 0, nLen);
596 rRenderContext.
DrawText(aPos, aText, 0, nLen);
601 for(
int n = 0;
n < 2;
n++)
611 aRegion = aNormalClipRegion;
617 aRegion = aHighlightClipRegion;
625 while (nIndex < mpIMEInfos->nLen &&
mpIMEInfos->pAttribs[nIndex] == nAttr)
660 rRenderContext.
DrawText(aPos, aText, 0, nLen);
667 rRenderContext.
Pop();
676 const sal_Int32 nTextLen =
ImplGetText().getLength();
679 if ( !rSelection.
Len() &&
689 if ( !aSelection.
Len() )
696 i18n::Boundary aBoundary = xBI->getWordBoundary(
maText.toString(), aSelection.
Min(),
698 auto startPos = aBoundary.startPos;
699 if ( startPos == aSelection.
Min() )
701 aBoundary = xBI->previousWord(
maText.toString(), aSelection.
Min(),
703 startPos = std::max(aBoundary.startPos, sal_Int32(0));
705 aSelection.
Min() = startPos;
709 aSelection.
Min() = 0;
714 aSelection.
Min() = xBI->previousCharacters(
maText.toString(), aSelection.
Min(),
722 i18n::Boundary aBoundary = xBI->nextWord(
maText.toString(), aSelection.
Max(),
724 aSelection.
Max() = aBoundary.startPos;
728 aSelection.
Max() = nTextLen;
733 aSelection.
Max() = xBI->nextCharacters(
maText.toString(), aSelection.
Max(),
739 const auto nSelectionMin = aSelection.
Min();
740 maText.remove( nSelectionMin, aSelection.
Len() );
749 OUString aValidString = rString.replaceAll(
"\n",
"").replaceAll(
"\r",
"");
750 aValidString = aValidString.replace(
'\t',
' ');
777 bool bWasTruncated =
false;
781 rStr = rStr.copy( 0, nErasePos );
782 bWasTruncated =
true;
784 return bWasTruncated;
796 auto nSelectionLen = aSelection.
Len();
803 if ( aSelection.
Len() )
809 if (bIsUserInput && !rStr.isEmpty())
811 SAL_WARN_IF( rStr.getLength() != 1,
"vcl",
"unexpected string length. User input is expected to provide 1 char only!" );
816 bool bIsInputSequenceChecking = rStr.getLength() == 1 &&
817 officecfg::Office::Common::I18N::CTL::CTLFont::get() &&
818 officecfg::Office::Common::I18N::CTL::CTLSequenceChecking::get() &&
819 aSelection.
Min() > 0 &&
820 xBI.is() && i18n::ScriptType::COMPLEX == xBI->getScriptType( rStr, 0 );
822 if (bIsInputSequenceChecking)
828 sal_Int32 nTmpPos = aSelection.
Min();
829 sal_Int16 nCheckMode = officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingRestricted::get()?
830 i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
834 const OUString aOldText(
maText.getStr(), nTmpPos);
835 OUString aTmpText( aOldText );
836 if (officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingTypeAndReplace::get())
838 xISC->correctInputSequence( aTmpText, nTmpPos - 1, cChar, nCheckMode );
841 sal_Int32 nOldLen = aOldText.getLength();
842 sal_Int32 nTmpLen = aTmpText.getLength();
845 sal_Int32 nChgPos = 0;
846 while ( nChgPos < nOldLen && nChgPos < nTmpLen &&
847 pOldTxt[nChgPos] == pTmpTxt[nChgPos] )
850 const OUString aChgText( aTmpText.copy( nChgPos ) );
853 maText.remove( nChgPos, nTmpPos - nChgPos );
855 if (!aChgText.isEmpty())
858 aSelection.
Min() = nChgPos;
866 if (!xISC->checkInputSequence( aOldText, nTmpPos - 1, cChar, nCheckMode ))
875 if ( !aNewText.isEmpty() )
876 maText.insert( aSelection.
Min(), aNewText );
900 ( std::u16string_view(rText) == std::u16string_view(
maText.getStr(),
maText.getLength())
901 && (!pNewSelection || (*pNewSelection ==
maSelection)) ) )
937 case WindowType::COMBOBOX:
938 case WindowType::PATTERNBOX:
939 case WindowType::NUMERICBOX:
940 case WindowType::METRICBOX:
941 case WindowType::CURRENCYBOX:
942 case WindowType::DATEBOX:
943 case WindowType::TIMEBOX:
944 case WindowType::LONGCURRENCYBOX:
948 case WindowType::MULTILINEEDIT:
955 case WindowType::EDIT:
956 case WindowType::PATTERNFIELD:
957 case WindowType::METRICFIELD:
958 case WindowType::CURRENCYFIELD:
959 case WindowType::DATEFIELD:
960 case WindowType::TIMEFIELD:
961 case WindowType::SPINFIELD:
962 case WindowType::FORMATTEDFIELD:
990 rRenderContext.
Erase(aRect);
1011 if (pBorder ==
this)
1016 if (pBorder ==
this)
1035 aClipRgn.
Move(xNew - aBounds.Left(), 0);
1039 aClipRgn.
Move(aBorderOffs.X(), aBorderOffs.Y());
1045 aClipRgn.
Move(aBorderOffs.X(), aBorderOffs.Y());
1072 std::unique_ptr<tools::Long[]> pDXBuffer;
1075 if( !aText.isEmpty() )
1079 pDXBuffer.reset(
new tools::Long[2*(aText.getLength()+1)]);
1080 pDX = pDXBuffer.get();
1088 nTextPos = pDX[ 2*aText.getLength()-1 ];
1098 if ( (nCursorPosX < 0) || (nCursorPosX >= aOutSize.
Width()) )
1102 if ( nCursorPosX < 0 )
1124 if ( nCursorPosX == aOutSize.
Width() )
1135 pCursor->
SetPos(
Point( nCursorPosX, nCursorPosY ) );
1136 pCursor->
SetSize(
Size( nCursorWidth, nTextHeight ) );
1154 if (nTextWidth < nOutWidth)
1165 if( nTextWidth < nOutWidth )
1170 if( nTextWidth < nOutWidth )
1179 mnXOffset = (nOutWidth - nTextWidth) / 2;
1196 std::unique_ptr<tools::Long[]> pDXBuffer;
1200 pDXBuffer.reset(
new tools::Long[2*(aText.getLength()+1)]);
1201 pDX = pDXBuffer.get();
1206 for (sal_Int32
i = 0;
i < aText.getLength(); aText.iterateCodePoints(&
i))
1208 if( (pDX[2*
i] >= nX && pDX[2*
i+1] <= nX) ||
1209 (pDX[2*
i+1] >= nX && pDX[2*
i] <= nX))
1212 if( pDX[2*
i] < pDX[2*
i+1] )
1214 if( nX > (pDX[2*
i]+pDX[2*
i+1])/2 )
1215 aText.iterateCodePoints(&nIndex);
1219 if( nX < (pDX[2*
i]+pDX[2*
i+1])/2 )
1220 aText.iterateCodePoints(&nIndex);
1228 sal_Int32 nFinalIndex = 0;
1231 if (!aText.isEmpty())
1233 aText.iterateCodePoints(&i);
1235 while (i < aText.getLength())
1239 if( nNewDiff < nDiff )
1247 aText.iterateCodePoints(&i);
1249 if (nIndex == nFinalIndex && std::abs( pDX[2*nIndex+1] - nX ) < nDiff)
1259 aSelection.
Max() = nChar;
1261 aSelection.
Min() = aSelection.
Max();
1269 css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(
GetPrimarySelection());
1274 void Edit::ImplCopy( uno::Reference< datatransfer::clipboard::XClipboard >
const & rxClipboard )
1279 void Edit::ImplPaste( uno::Reference< datatransfer::clipboard::XClipboard >
const & rxClipboard )
1281 if ( !rxClipboard.is() )
1284 uno::Reference< datatransfer::XTransferable > xDataObj;
1289 xDataObj = rxClipboard->getContents();
1291 catch(
const css::uno::Exception& )
1295 if ( !xDataObj.is() )
1298 datatransfer::DataFlavor aFlavor;
1313 catch(
const css::uno::Exception& )
1328 aSelection.Justify();
1342 i18n::Boundary aBoundary = xBI->getWordBoundary(
maText.toString(), aSelection.Max(),
1347 else if ( !rMEvt.
IsShift() &&
HasFocus() && aSelection.IsInside( nCharPos ) )
1349 else if ( rMEvt.
IsLeft() )
1370 css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(Window::GetPrimarySelection());
1461 if ( nCode ==
KEY_A )
1473 if ( !aChars.isEmpty() )
1487 case css::awt::Key::SELECT_ALL:
1498 case css::awt::Key::MOVE_WORD_FORWARD:
1499 case css::awt::Key::SELECT_WORD_FORWARD:
1500 case css::awt::Key::MOVE_WORD_BACKWARD:
1501 case css::awt::Key::SELECT_WORD_BACKWARD:
1502 case css::awt::Key::MOVE_TO_BEGIN_OF_LINE:
1503 case css::awt::Key::MOVE_TO_END_OF_LINE:
1504 case css::awt::Key::SELECT_TO_BEGIN_OF_LINE:
1505 case css::awt::Key::SELECT_TO_END_OF_LINE:
1506 case css::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
1507 case css::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
1508 case css::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
1509 case css::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
1510 case css::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
1511 case css::awt::Key::MOVE_TO_END_OF_DOCUMENT:
1512 case css::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
1513 case css::awt::Key::SELECT_TO_END_OF_DOCUMENT:
1523 bool bGoLeft = (nCode ==
KEY_LEFT);
1525 bool bGoHome = (nCode ==
KEY_HOME);
1526 bool bGoEnd = (nCode ==
KEY_END);
1530 case css::awt::Key::MOVE_WORD_FORWARD:
1531 bGoRight = bWord =
true;
break;
1532 case css::awt::Key::SELECT_WORD_FORWARD:
1533 bGoRight = bSelect = bWord =
true;
break;
1534 case css::awt::Key::MOVE_WORD_BACKWARD:
1535 bGoLeft = bWord =
true;
break;
1536 case css::awt::Key::SELECT_WORD_BACKWARD:
1537 bGoLeft = bSelect = bWord =
true;
break;
1538 case css::awt::Key::SELECT_TO_BEGIN_OF_LINE:
1539 case css::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
1540 case css::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
1543 case css::awt::Key::MOVE_TO_BEGIN_OF_LINE:
1544 case css::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
1545 case css::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
1546 bGoHome =
true;
break;
1547 case css::awt::Key::SELECT_TO_END_OF_LINE:
1548 case css::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
1549 case css::awt::Key::SELECT_TO_END_OF_DOCUMENT:
1552 case css::awt::Key::MOVE_TO_END_OF_LINE:
1553 case css::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
1554 case css::awt::Key::MOVE_TO_END_OF_DOCUMENT:
1555 bGoEnd =
true;
break;
1561 if ( bGoLeft && aSel.
Max() )
1565 i18n::Boundary aBoundary = xBI->getWordBoundary(
maText.toString(), aSel.
Max(),
1567 if ( aBoundary.startPos == aSel.
Max() )
1568 aBoundary = xBI->previousWord(
maText.toString(), aSel.
Max(),
1570 aSel.
Max() = aBoundary.startPos;
1575 aSel.
Max() = xBI->previousCharacters(
maText.toString(), aSel.
Max(),
1579 else if ( bGoRight && ( aSel.
Max() <
maText.getLength() ) )
1583 i18n::Boundary aBoundary = xBI->nextWord(
maText.toString(), aSel.
Max(),
1585 aSel.
Max() = aBoundary.startPos;
1590 aSel.
Max() = xBI->nextCharacters(
maText.toString(), aSel.
Max(),
1625 case css::awt::Key::DELETE_WORD_BACKWARD:
1626 case css::awt::Key::DELETE_WORD_FORWARD:
1627 case css::awt::Key::DELETE_TO_BEGIN_OF_LINE:
1628 case css::awt::Key::DELETE_TO_END_OF_LINE:
1640 case css::awt::Key::DELETE_WORD_BACKWARD:
1644 case css::awt::Key::DELETE_WORD_FORWARD:
1648 case css::awt::Key::DELETE_TO_BEGIN_OF_LINE:
1652 case css::awt::Key::DELETE_TO_END_OF_LINE:
1658 sal_Int32 nOldLen =
maText.getLength();
1660 if (
maText.getLength() != nOldLen )
1760 if ( bBorder || bBackground )
1812 ((nOffY+nTextHeight) > aSize.
Height()) ||
1813 ((nOffX+nTextWidth) > aSize.
Width()) )
1816 if ( nTextHeight > aSize.
Height() )
1821 pDev->
DrawText( aTextRect, aText, nTextStyle );
1840 if (pBorder == pInvalWin || !pBorder ||
1843 pInvalWin = pBorder;
1927 bool bEnableCut =
true;
1928 bool bEnableCopy =
true;
1929 bool bEnableDelete =
true;
1930 bool bEnablePaste =
true;
1931 bool bEnableSpecialChar =
true;
1936 bEnableCopy =
false;
1937 bEnableDelete =
false;
1943 bEnablePaste =
false;
1944 bEnableDelete =
false;
1945 bEnableSpecialChar =
false;
1951 uno::Reference< datatransfer::clipboard::XClipboard > xClipboard =
GetClipboard();
1953 if ( xClipboard.is() )
1955 uno::Reference< datatransfer::XTransferable > xDataObj;
1958 xDataObj = xClipboard->getContents();
1960 if ( xDataObj.is() )
1962 datatransfer::DataFlavor aFlavor;
1964 bData = xDataObj->isDataFlavorSupported( aFlavor );
1967 bEnablePaste = bData;
1978 != std::u16string_view(
maText.getStr(),
maText.getLength()));
1992 sal_uInt16
n = pPopup->
Execute(
this, aPos );
1995 if (sCommand ==
"undo")
2000 else if (sCommand ==
"cut")
2005 else if (sCommand ==
"copy")
2009 else if (sCommand ==
"paste")
2014 else if (sCommand ==
"delete")
2019 else if (sCommand ==
"selectall")
2029 if (!aChars.isEmpty())
2048 bool bInsertMode = !
mpIMEInfos->bWasCursorOverwrite;
2073 const sal_Int32 nOldIMETextLen =
mpIMEInfos->nLen;
2074 const sal_Int32 nNewIMETextLen = pData->
GetText().getLength();
2075 if ( ( nOldIMETextLen > nNewIMETextLen ) &&
2076 ( nNewIMETextLen < mpIMEInfos->aOldTextAfterStartPos.getLength() ) )
2079 const sal_Int32 nRestore = nOldIMETextLen - nNewIMETextLen;
2082 else if ( ( nOldIMETextLen < nNewIMETextLen ) &&
2083 ( nOldIMETextLen <
mpIMEInfos->aOldTextAfterStartPos.getLength() ) )
2085 const sal_Int32 nOverwrite = ( nNewIMETextLen >
mpIMEInfos->aOldTextAfterStartPos.getLength()
2086 ?
mpIMEInfos->aOldTextAfterStartPos.getLength() : nNewIMETextLen ) - nOldIMETextLen;
2135 std::unique_ptr<tools::Long[]> pDXBuffer;
2138 if( !aText.isEmpty() )
2142 pDXBuffer.reset(
new tools::Long[2*(aText.getLength()+1)]);
2143 pDX = pDXBuffer.get();
2156 aRects[
nIndex ] = aRect;
2195 sal_uInt16 nOldAlign =
mnAlign;
2271 mpDDInfo->aCursor.SetWindow(
this );
2289 : sForbiddenChars(rForbiddenChars)
2299 OUString sTemp(rText);
2310 const OUString sOrig =
GetText();
2314 sal_Int32 nDiff = sOrig.getLength() - sNew.getLength();
2432 if ( aNew.
Min() < 0 )
2434 if ( aNew.
Max() < 0 )
2447 bool bCaret =
false, bSelection =
false;
2452 if (nGap != 0 || oGap != 0)
2514 return OUString(
maText.getStr() + aSelection.
Min(), aSelection.
Len() );
2531 css::uno::Reference<css::datatransfer::clipboard::XClipboard> aClipboard(
GetClipboard());
2538 css::uno::Reference<css::datatransfer::clipboard::XClipboard> aClipboard(
GetClipboard());
2548 const OUString aText(
maText.toString() );
2580 return maText.toString();
2660 aControlValue, aBound, aContent))
2694 return nCharWidth ? nOutWidth/nCharWidth : 0;
2746 Point aMousePos( rDGE.DragOriginX, rDGE.DragOriginY );
2748 if ( (nCharPos < aSel.
Min()) || (nCharPos >= aSel.
Max()) )
2761 sal_Int8 nActions = datatransfer::dnd::DNDConstants::ACTION_COPY;
2763 nActions |= datatransfer::dnd::DNDConstants::ACTION_MOVE;
2764 rDGE.DragSource->startDrag( rDGE, nActions, 0 , 0 , pDataObj,
mxDnDListener );
2774 if (rDSDE.DropSuccess && (rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE) &&
mpDDInfo)
2795 void Edit::drop(
const css::datatransfer::dnd::DropTargetDropEvent& rDTDE )
2799 bool bChanges =
false;
2816 uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable;
2817 if ( xDataObj.is() )
2819 datatransfer::DataFlavor aFlavor;
2821 if ( xDataObj->isDataFlavorSupported( aFlavor ) )
2838 rDTDE.Context->dropComplete( bChanges );
2848 const Sequence< css::datatransfer::DataFlavor >& rFlavors( rDTDE.SupportedDataFlavors );
2849 mpDDInfo->bIsStringSupported = std::any_of(rFlavors.begin(), rFlavors.end(),
2850 [](
const css::datatransfer::DataFlavor& rFlavor) {
2852 const OUString aMimetype = rFlavor.MimeType.getToken( 0,
';', nIndex );
2853 return aMimetype ==
"text/plain";
2868 Point aMousePos( rDTDE.LocationX, rDTDE.LocationY );
2870 sal_Int32 nPrevDropPos =
mpDDInfo->nDropPos;
2889 rDTDE.Context->rejectDrag();
2899 rDTDE.Context->acceptDrag( rDTDE.DropAction );
2907 return maText.toString();
static bool toBool(std::string_view rValue)
SAL_DLLPRIVATE void ImplPaintBorder(vcl::RenderContext const &rRenderContext)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
virtual Size CalcMinimumSize() const
vcl::Region GetClipRegion() const
const Color & GetTextColor() const
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
The child windows are invalidated, too.
bool IsControlBackground() const
virtual void EnableRTL(bool bEnable=true) override
GetFocusFlags GetGetFocusFlags() const
bool ImplCallEventListenersAndHandler(VclEventId nEvent, std::function< void()> const &callHandler)
this calls both our event listeners, and a specified handler
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard, const vcl::ILibreOfficeKitNotifier *pNotifier=nullptr)
copies a given string to a given clipboard
sal_Int32 mnMaxWidthChars
SAL_DLLPRIVATE void ImplInsertText(const OUString &rStr, const Selection *pNewSelection=nullptr, bool bIsUserInput=false)
bool GetContextMenuShortcuts() const
bool IsInside(tools::Long nIs) const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Link< Edit &, void > maModifyHdl
virtual void dragExit(const css::datatransfer::dnd::DropTargetEvent &dte) override
virtual OUString GetSelected() const
void SetPos(const Point &rNewPos)
void setWidth(tools::Long nWidth)
FncGetSpecialChars GetGetSpecialCharsFunction()
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion) const
Query the native control's actual drawing region (including adornment)
virtual void MouseButtonDown(const MouseEvent &rMEvt)
void Move(tools::Long nHorzMove, tools::Long nVertMove)
const Color & GetHighlightTextColor() const
std::unique_ptr< ContentProperties > pData
Edit * GetSubEdit() const
#define EDIT_DELMODE_RESTOFWORD
SAL_DLLPRIVATE void ImplDrawFrame(OutputDevice *pDev, tools::Rectangle &rRect)
draws a frame around the give rectangle, onto the given device
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard()
bool mbForceControlBackground
virtual OUString filter(const OUString &rText)
virtual FactoryFunction GetUITestFactory() const override
constexpr::Color COL_RED(0x80, 0x00, 0x00)
void Union(const tools::Rectangle &rRegion)
SelectionOptions GetSelectionOptions() const
virtual Size CalcMinimumSizeForText(const OUString &rString) const
SAL_DLLPRIVATE void ImplClearLayoutData() const
static FncGetSpecialChars pImplFncGetSpecialChars
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
Gets the application's settings.
constexpr sal_uInt16 KEY_A
virtual void StateChanged(StateChangedType nStateChange) override
SAL_DLLPRIVATE void ImplGrabFocus(GetFocusFlags nFlags)
OUString maPlaceholderText
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual Size GetSizePixel() const
virtual void SetSizePixel(const Size &rNewSize)
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
void CompatStateChanged(StateChangedType nStateChange)
void SetEchoChar(sal_Unicode c)
SAL_DLLPRIVATE OUString ImplGetText() const
sal_uInt16 GetCode() const
css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > mxDnDListener
vcl::Region GetPaintRegion() const
void SetLayoutMode(ComplexTextLayoutFlags nTextLayoutMode)
DataChangedEventType GetType() const
void IntersectClipRegion(const tools::Rectangle &rRect)
virtual void DumpAsPropertyTree(tools::JsonWriter &rJsonWriter) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
The invalidated area is updated immediately.
virtual bool DeleteSurroundingText(const Selection &rSelection) override
SAL_DLLPRIVATE void ImplCopy(css::uno::Reference< css::datatransfer::clipboard::XClipboard > const &rxClipboard)
void SetPlaceholderText(const OUString &rStr)
virtual bool set_property(const OString &rKey, const OUString &rValue) override
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
const Color & GetControlBackground() const
virtual void drop(const css::datatransfer::dnd::DropTargetDropEvent &dtde) override
SAL_DLLPRIVATE void ImplShowCursor(bool bOnlyIfVisible=true)
static void ShowTruncationWarning(weld::Widget *pParent)
tools::Rectangle GetBoundRect() const
void SetType(WindowType nType)
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
const vcl::Font & GetFieldFont() const
#define EDIT_DELMODE_SIMPLE
const Color & GetFieldTextColor() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
const Color & GetHighlightColor() const
constexpr sal_uInt16 KEY_END
bool IsInsertMode() const
weld::Window * GetFrameWeld() const
sal_uInt16 GetClicks() const
virtual OUString GetSurroundingText() const override
Size CalcOutputSize(const Size &rWinSz) const
virtual void FillLayoutData() const override
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
std::unique_ptr< ExtTextInputAttr[]> pAttribs
Creates a hierarchy of vcl::Windows (widgets) from a .ui file for dialogs, sidebar, etc.
const vcl::Font & GetFont() const
A helper class that calls Application::ReleaseSolarMutex() in its constructor and restores the mutex ...
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetPrimarySelection()
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
bool IsMouseEvent() const
SAL_DLLPRIVATE void ImplSetSelection(const Selection &rSelection, bool bPaint=true)
css::uno::Reference< css::i18n::XBreakIterator > mxBreakIterator
AllSettingsFlags GetFlags() const
const CommandExtTextInputData * GetExtTextInputData() const
SAL_DLLPRIVATE css::uno::Reference< css::i18n::XBreakIterator > const & ImplGetBreakIterator()
virtual void SetModifyFlag()
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
virtual void Draw(OutputDevice *pDev, const Point &rPos, DrawFlags nFlags) override
SAL_DLLPRIVATE bool ImplHandleKeyEvent(const KeyEvent &rKEvt)
sal_uLong GetStart() const
virtual void dragDropEnd(const css::datatransfer::dnd::DragSourceDropEvent &dsde) override
virtual const Selection & GetSelection() const
void SetBorderStyle(WindowBorderStyle nBorderStyle)
sal_uInt16 GetModifier() const
void SetUnderline(FontLineStyle)
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
void SetStyle(sal_uInt16 nStyle)
virtual void dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent &dtdee) override
WinBits const WB_NOHIDESELECTION
bool IsCursorOverwrite() const
SAL_DLLPRIVATE void ImplSetCursorPos(sal_Int32 nChar, bool bSelect)
css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer()
virtual void DeleteSelected()
virtual void SetSelection(const Selection &rSelection)
SAL_DLLPRIVATE void ImplHideDDCursor()
void DrawRect(const tools::Rectangle &rRect)
std::unique_ptr< Impl_IMEInfos > mpIMEInfos
const LanguageTag & GetLanguageTag() const
constexpr OUStringLiteral aData
#define SAL_N_ELEMENTS(arr)
virtual void Tracking(const TrackingEvent &rTEvt) override
SAL_DLLPRIVATE bool ImplUseNativeBorder(vcl::RenderContext const &rRenderContext, WinBits nStyle)
static OUString GetUIRootDir()
SAL_DLLPRIVATE void ImplDelete(const Selection &rSelection, sal_uInt8 nDirection, sal_uInt8 nMode)
ImplSVData * ImplGetSVData()
Size CalcWindowSize(const Size &rOutSz) const
const OUString & GetText() const
VclPtr< PopupMenu > CreatePopupMenu()
const Color & GetDisableColor() const
#define EDIT_ALIGN_CENTER
bool IsRTLEnabled() const
SAL_DLLPRIVATE sal_Int32 ImplGetCharPos(const Point &rWindowPos) const
void SetInputContext(const InputContext &rInputContext)
virtual Size GetOptimalSize() const override
SAL_DLLPRIVATE void ImplShowDDCursor()
static bool IsCharInput(const KeyEvent &rKEvt)
MouseMiddleButtonAction GetMiddleButtonAction() const
virtual void GetFocus() override
bool IsNativeWidgetEnabled() const
virtual void StateChanged(StateChangedType nType) override
SAL_DLLPRIVATE void ImplInvalidateOrRepaint()
constexpr sal_uInt16 KEY_HOME
SAL_DLLPRIVATE void ImplRepaint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRectangle)
virtual void SetReadOnly(bool bReadOnly=true)
SAL_DLLPRIVATE void ImplCopyToSelectionClipboard()
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
Size GetOutputSize() const
std::unique_ptr< VclBuilder > mpUIBuilder
virtual Selection GetSurroundingTextSelection() const override
static SAL_DLLPRIVATE WinBits ImplInitStyle(WinBits nStyle)
virtual OUString GetText() const override
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
SAL_DLLPRIVATE void ImplPaste(css::uno::Reference< css::datatransfer::clipboard::XClipboard > const &rxClipboard)
bool IsUpdateMode() const
tools::Long Width() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
const Color & GetFieldColor() const
SAL_DLLPRIVATE tools::Long ImplGetExtraYOffset() const
CommandEventId GetCommand() const
bool GetHideDisabledMenuItems() const
void SetTextColor(const Color &rColor)
bool HasPaintEvent() const
virtual void Resize() override
static bool GetLayoutRTL()
std::unique_ptr< WindowImpl > mpWindowImpl
void CopyAttribs(const ExtTextInputAttr *pA, sal_Int32 nL)
void Intersect(const tools::Rectangle &rRegion)
vcl::Cursor * GetCursor() const
SAL_DLLPRIVATE tools::Long ImplGetExtraXOffset() const
SAL_DLLPRIVATE void filterText()
void SetSubEdit(Edit *pEdit)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
void SetSize(const Size &rNewSize)
const AllSettings & GetSettings() const
Size GetOutputSizePixel() const
Sets up the buffer to have settings matching the window, and restores the original state in the dtor...
void ApplyControlForeground(vcl::RenderContext &rRenderContext, const Color &rDefaultColor)
virtual bool set_property(const OString &rKey, const OUString &rValue)
KeyFuncType GetFunction() const
Point ScreenToOutputPixel(const Point &rPos) const
virtual void KeyInput(const KeyEvent &rKEvt) override
vcl::Window * GetParent() const
bool IsTrackingEnded() const
void SetStyle(WinBits nStyle)
void SetCursorRect(const tools::Rectangle *pRect=nullptr, tools::Long nExtTextInputWidth=0)
constexpr sal_uInt16 KEY_RETURN
WinBits const WB_NOBORDER
vcl::Window * GetWindow(GetWindowType nType) const
constexpr sal_uInt16 KEY_RIGHT
const Point & GetMousePosPixel() const
void GetCaretPositions(const OUString &, tools::Long *pCaretXArray, sal_Int32 nIndex, sal_Int32 nLen, const SalLayoutGlyphs *pGlyphs=nullptr) const
Point LogicToPixel(const Point &rLogicPt) const
OUString aOldTextAfterStartPos
constexpr sal_uInt16 KEY_S
SAL_DLLPRIVATE tools::Long ImplGetTextYPosition() const
virtual void KeyInput(const KeyEvent &rKEvt)
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
virtual Size CalcSize(sal_Int32 nChars) const
SAL_DLLPRIVATE void ImplClearBackground(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRectangle, tools::Long nXStart, tools::Long nXEnd)
void SetPointer(PointerStyle)
SalFrame * ImplGetFrame() const
std::unique_ptr< DDInfo, o3tl::default_delete< DDInfo > > mpDDInfo
const CommandSelectionChangeData * GetSelectionChangeData() const
const vcl::KeyCode & GetKeyCode() const
static SAL_DLLPRIVATE void ImplInvalidateOutermostBorder(vcl::Window *pWin)
css::uno::Reference< css::i18n::XExtendedInputSequenceChecker > mxISC
Link< Edit &, void > maAutocompleteHdl
void SetWidthInChars(sal_Int32 nWidthInChars)
bool IsCursorVisible() const
virtual void Resize() override
OUString(* FncGetSpecialChars)(weld::Widget *pWin, const vcl::Font &rFont)
#define SAL_WARN_IF(condition, area, stream)
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
virtual void dragOver(const css::datatransfer::dnd::DropTargetDragEvent &dtde) override
void SetCursor(vcl::Cursor *pCursor)
void SetFont(const vcl::Font &rNewFont)
std::unique_ptr< vcl::ImplControlData > mpControlData
Link< Edit &, bool > maActivateHdl
void SetInsertMode(bool bInsert)
WinBits const WB_READONLY
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Impl_IMEInfos(sal_Int32 nPos, const OUString &rOldTextAfterStartPos)
SAL_DLLPRIVATE void ImplAlign()
vcl::Font GetDrawPixelFont(::OutputDevice const *pDev) const
sal_Unicode GetCharCode() const
void setMaxWidthChars(sal_Int32 nWidth)
sal_Int32 GetCursorPos() const
tools::Long AdjustWidth(tools::Long n)
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
tools::Long Height() const
Reference< XComponentContext > getProcessComponentContext()
const MouseSettings & GetMouseSettings() const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
tools::Long GetDrawPixel(::OutputDevice const *pDev, tools::Long nPixels) const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
const Point & GetPosPixel() const
double getLength(const B2DPolygon &rCandidate)
void set(reference_type *pBody)
tools::Long AdjustHeight(tools::Long n)
constexpr sal_uInt16 KEY_BACKSPACE
void SetCompositionCharRect(const tools::Rectangle *pRect, tools::Long nCompositionLength, bool bVertical=false)
TextFilter(const OUString &rForbiddenChars=OUString(" "))
void SetGetSpecialCharsFunction(FncGetSpecialChars fn)
void setHeight(tools::Long nHeight)
SAL_DLLPRIVATE void ImplInitEditData()
WindowType GetType() const
#define EDIT_DELMODE_RESTOFCONTENT
bool IsPaintTransparent() const
SAL_DLLPRIVATE bool ImplTruncateToMaxLen(OUString &, sal_Int32 nSelectionLen) const
virtual void SetMaxTextLen(sal_Int32 nMaxLen)
SAL_DLLPRIVATE void ImplAlignAndPaint()
OUString VclResId(const char *pId)
tools::Long getMin() const
void ApplyControlFont(vcl::RenderContext &rRenderContext, const vcl::Font &rDefaultFont)
constexpr sal_uInt16 KEY_DELETE
virtual void LoseFocus() override
constexpr sal_uInt16 KEY_LEFT
Point OutputToScreenPixel(const Point &rPos) const
virtual bool IsReadOnly() const
virtual void SetText(const OUString &rStr) override
SAL_DLLPRIVATE css::uno::Reference< css::i18n::XExtendedInputSequenceChecker > const & ImplGetInputSequenceChecker()
constexpr sal_uInt16 KEY_INSERT
virtual void Command(const CommandEvent &rCEvt)
const MouseEvent & GetMouseEvent() const
bool IsReallyVisible() const
SAL_DLLPRIVATE ControlType ImplGetNativeControlType() const
void Push(PushFlags nFlags=PushFlags::ALL)
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly...
WinBits const WB_NOTABSTOP
SAL_DLLPRIVATE void ImplSetText(const OUString &rStr, const Selection *pNewSelection)
void setMin(tools::Long nMin)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
sal_Int32 GetMaxVisChars() const
static SAL_DLLPRIVATE OUString ImplGetValidString(const OUString &rString)
bool mbClickedInSelection
virtual void dragGestureRecognized(const css::datatransfer::dnd::DragGestureEvent &dge) override
TextFilter * mpFilterText
virtual void DataChanged(const DataChangedEvent &rDCEvt)
virtual void Command(const CommandEvent &rCEvt) override
virtual void ReplaceSelected(const OUString &rStr)
void setMax(tools::Long nMax)
static bool GetFormatDataFlavor(SotClipboardFormatId nFormat, css::datatransfer::DataFlavor &rFlavor)
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill= '\0')
const ExtTextInputAttr * GetTextAttr() const