35 #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>
65 #include <officecfg/Office/Common.hxx>
70 #include <string_view>
81 #define EDIT_ALIGN_LEFT 1
82 #define EDIT_ALIGN_CENTER 2
83 #define EDIT_ALIGN_RIGHT 3
85 #define EDIT_DEL_LEFT 1
86 #define EDIT_DEL_RIGHT 2
88 #define EDIT_DELMODE_SIMPLE 11
89 #define EDIT_DELMODE_RESTOFWORD 12
90 #define EDIT_DELMODE_RESTOFCONTENT 13
106 bStarterOfDD =
false;
107 bDroppedInMe =
false;
109 bIsStringSupported =
false;
116 std::unique_ptr<ExtTextInputAttr[]>
123 Impl_IMEInfos(sal_Int32 nPos,
const OUString& rOldTextAfterStartPos);
130 : aOldTextAfterStartPos(rOldTextAfterStartPos),
134 bWasCursorOverwrite(
false)
184 if (rKey ==
"width-chars")
186 else if (rKey ==
"max-width-chars")
188 else if (rKey ==
"max-length")
190 sal_Int32 nTextLen = rValue.toInt32();
193 else if (rKey ==
"editable")
197 else if (rKey ==
"overwrite-mode")
201 else if (rKey ==
"visibility")
207 else if (rKey ==
"placeholder-text")
209 else if (rKey ==
"shadow-type")
242 uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL(
mxDnDListener, uno::UNO_QUERY );
247 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(
maText.getLength());
437 return aText.makeStringAndClear();
473 const sal_Int32 nLen = aText.getLength();
475 sal_Int32 nDXBuffer[256];
476 std::unique_ptr<sal_Int32[]> pDXBuffer;
477 sal_Int32* pDX = nDXBuffer;
483 pDXBuffer.reset(
new sal_Int32[2 * (nLen + 1)]);
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 const OUString sText =
maText.toString();
697 i18n::Boundary aBoundary = xBI->getWordBoundary( sText, aSelection.
Min(),
699 auto startPos = aBoundary.startPos;
700 if ( startPos == aSelection.
Min() )
702 aBoundary = xBI->previousWord( sText, aSelection.
Min(),
704 startPos = std::max(aBoundary.startPos, sal_Int32(0));
706 aSelection.
Min() = startPos;
710 aSelection.
Min() = 0;
715 aSelection.
Min() = xBI->previousCharacters(
maText.toString(), aSelection.
Min(),
723 i18n::Boundary aBoundary = xBI->nextWord(
maText.toString(), aSelection.
Max(),
725 aSelection.
Max() = aBoundary.startPos;
729 aSelection.
Max() = nTextLen;
734 aSelection.
Max() = xBI->nextCharacters(
maText.toString(), aSelection.
Max(),
740 const auto nSelectionMin = aSelection.
Min();
741 maText.remove( nSelectionMin, aSelection.
Len() );
750 OUString aValidString = rString.replaceAll(
"\n",
"").replaceAll(
"\r",
"");
751 aValidString = aValidString.replace(
'\t',
' ');
778 bool bWasTruncated =
false;
782 rStr = rStr.copy( 0, nErasePos );
783 bWasTruncated =
true;
785 return bWasTruncated;
797 auto nSelectionLen = aSelection.
Len();
804 if ( aSelection.
Len() )
810 if (bIsUserInput && !rStr.isEmpty())
812 SAL_WARN_IF( rStr.getLength() != 1,
"vcl",
"unexpected string length. User input is expected to provide 1 char only!" );
817 bool bIsInputSequenceChecking = rStr.getLength() == 1 &&
818 officecfg::Office::Common::I18N::CTL::CTLFont::get() &&
819 officecfg::Office::Common::I18N::CTL::CTLSequenceChecking::get() &&
820 aSelection.
Min() > 0 &&
821 xBI.is() && i18n::ScriptType::COMPLEX == xBI->getScriptType( rStr, 0 );
823 if (bIsInputSequenceChecking)
829 sal_Int32 nTmpPos = aSelection.
Min();
830 sal_Int16 nCheckMode = officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingRestricted::get()?
831 i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
835 const OUString aOldText(
maText.getStr(), nTmpPos);
836 OUString aTmpText( aOldText );
837 if (officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingTypeAndReplace::get())
839 xISC->correctInputSequence( aTmpText, nTmpPos - 1, cChar, nCheckMode );
842 sal_Int32 nOldLen = aOldText.getLength();
843 sal_Int32 nTmpLen = aTmpText.getLength();
846 sal_Int32 nChgPos = 0;
847 while ( nChgPos < nOldLen && nChgPos < nTmpLen &&
848 pOldTxt[nChgPos] == pTmpTxt[nChgPos] )
851 const OUString aChgText( aTmpText.copy( nChgPos ) );
854 maText.remove( nChgPos, nTmpPos - nChgPos );
856 if (!aChgText.isEmpty())
859 aSelection.
Min() = nChgPos;
867 if (!xISC->checkInputSequence( aOldText, nTmpPos - 1, cChar, nCheckMode ))
876 if ( !aNewText.isEmpty() )
877 maText.insert( aSelection.
Min(), aNewText );
901 ( std::u16string_view(rText) == std::u16string_view(
maText.getStr(),
maText.getLength())
902 && (!pNewSelection || (*pNewSelection ==
maSelection)) ) )
938 case WindowType::COMBOBOX:
939 case WindowType::PATTERNBOX:
940 case WindowType::NUMERICBOX:
941 case WindowType::METRICBOX:
942 case WindowType::CURRENCYBOX:
943 case WindowType::DATEBOX:
944 case WindowType::TIMEBOX:
945 case WindowType::LONGCURRENCYBOX:
949 case WindowType::MULTILINEEDIT:
956 case WindowType::EDIT:
957 case WindowType::PATTERNFIELD:
958 case WindowType::METRICFIELD:
959 case WindowType::CURRENCYFIELD:
960 case WindowType::DATEFIELD:
961 case WindowType::TIMEFIELD:
962 case WindowType::SPINFIELD:
963 case WindowType::FORMATTEDFIELD:
991 rRenderContext.
Erase(aRect);
1012 if (pBorder ==
this)
1017 if (pBorder ==
this)
1036 aClipRgn.
Move(xNew - aBounds.Left(), 0);
1040 aClipRgn.
Move(aBorderOffs.X(), aBorderOffs.Y());
1046 aClipRgn.
Move(aBorderOffs.X(), aBorderOffs.Y());
1072 sal_Int32 nDXBuffer[256];
1073 std::unique_ptr<sal_Int32[]> pDXBuffer;
1074 sal_Int32* pDX = nDXBuffer;
1076 if( !aText.isEmpty() )
1080 pDXBuffer.reset(
new sal_Int32[2*(aText.getLength()+1)]);
1081 pDX = pDXBuffer.get();
1089 nTextPos = pDX[ 2*aText.getLength()-1 ];
1099 if ( (nCursorPosX < 0) || (nCursorPosX >= aOutSize.
Width()) )
1103 if ( nCursorPosX < 0 )
1125 if ( nCursorPosX == aOutSize.
Width() )
1136 pCursor->
SetPos(
Point( nCursorPosX, nCursorPosY ) );
1137 pCursor->
SetSize(
Size( nCursorWidth, nTextHeight ) );
1155 if (nTextWidth < nOutWidth)
1166 if( nTextWidth < nOutWidth )
1171 if( nTextWidth < nOutWidth )
1180 mnXOffset = (nOutWidth - nTextWidth) / 2;
1196 sal_Int32 nDXBuffer[256];
1197 std::unique_ptr<sal_Int32[]> pDXBuffer;
1198 sal_Int32* pDX = nDXBuffer;
1201 pDXBuffer.reset(
new sal_Int32[2*(aText.getLength()+1)]);
1202 pDX = pDXBuffer.get();
1207 for (sal_Int32
i = 0;
i < aText.getLength(); aText.iterateCodePoints(&
i))
1209 if( (pDX[2*
i] >= nX && pDX[2*
i+1] <= nX) ||
1210 (pDX[2*
i+1] >= nX && pDX[2*
i] <= nX))
1213 if( pDX[2*
i] < pDX[2*
i+1] )
1215 if( nX > (pDX[2*
i]+pDX[2*
i+1])/2 )
1216 aText.iterateCodePoints(&nIndex);
1220 if( nX < (pDX[2*
i]+pDX[2*
i+1])/2 )
1221 aText.iterateCodePoints(&nIndex);
1229 sal_Int32 nFinalIndex = 0;
1232 if (!aText.isEmpty())
1234 aText.iterateCodePoints(&i);
1236 while (i < aText.getLength())
1240 if( nNewDiff < nDiff )
1248 aText.iterateCodePoints(&i);
1250 if (nIndex == nFinalIndex && std::abs( pDX[2*nIndex+1] - nX ) < nDiff)
1260 aSelection.
Max() = nChar;
1262 aSelection.
Min() = aSelection.
Max();
1275 void Edit::ImplCopy( uno::Reference< datatransfer::clipboard::XClipboard >
const & rxClipboard )
1280 void Edit::ImplPaste( uno::Reference< datatransfer::clipboard::XClipboard >
const & rxClipboard )
1282 if ( !rxClipboard.is() )
1285 uno::Reference< datatransfer::XTransferable > xDataObj;
1290 xDataObj = rxClipboard->getContents();
1292 catch(
const css::uno::Exception& )
1296 if ( !xDataObj.is() )
1299 datatransfer::DataFlavor aFlavor;
1314 catch(
const css::uno::Exception& )
1329 aSelection.Justify();
1343 i18n::Boundary aBoundary = xBI->getWordBoundary(
maText.toString(), aSelection.Max(),
1348 else if ( !rMEvt.
IsShift() &&
HasFocus() && aSelection.Contains( nCharPos ) )
1350 else if ( rMEvt.
IsLeft() )
1462 if ( nCode ==
KEY_A )
1474 if ( !aChars.isEmpty() )
1488 case css::awt::Key::SELECT_ALL:
1499 case css::awt::Key::MOVE_WORD_FORWARD:
1500 case css::awt::Key::SELECT_WORD_FORWARD:
1501 case css::awt::Key::MOVE_WORD_BACKWARD:
1502 case css::awt::Key::SELECT_WORD_BACKWARD:
1503 case css::awt::Key::MOVE_TO_BEGIN_OF_LINE:
1504 case css::awt::Key::MOVE_TO_END_OF_LINE:
1505 case css::awt::Key::SELECT_TO_BEGIN_OF_LINE:
1506 case css::awt::Key::SELECT_TO_END_OF_LINE:
1507 case css::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
1508 case css::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
1509 case css::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
1510 case css::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
1511 case css::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
1512 case css::awt::Key::MOVE_TO_END_OF_DOCUMENT:
1513 case css::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
1514 case css::awt::Key::SELECT_TO_END_OF_DOCUMENT:
1524 bool bGoLeft = (nCode ==
KEY_LEFT);
1526 bool bGoHome = (nCode ==
KEY_HOME);
1527 bool bGoEnd = (nCode ==
KEY_END);
1531 case css::awt::Key::MOVE_WORD_FORWARD:
1532 bGoRight = bWord =
true;
break;
1533 case css::awt::Key::SELECT_WORD_FORWARD:
1534 bGoRight = bSelect = bWord =
true;
break;
1535 case css::awt::Key::MOVE_WORD_BACKWARD:
1536 bGoLeft = bWord =
true;
break;
1537 case css::awt::Key::SELECT_WORD_BACKWARD:
1538 bGoLeft = bSelect = bWord =
true;
break;
1539 case css::awt::Key::SELECT_TO_BEGIN_OF_LINE:
1540 case css::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
1541 case css::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
1544 case css::awt::Key::MOVE_TO_BEGIN_OF_LINE:
1545 case css::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
1546 case css::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
1547 bGoHome =
true;
break;
1548 case css::awt::Key::SELECT_TO_END_OF_LINE:
1549 case css::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
1550 case css::awt::Key::SELECT_TO_END_OF_DOCUMENT:
1553 case css::awt::Key::MOVE_TO_END_OF_LINE:
1554 case css::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
1555 case css::awt::Key::MOVE_TO_END_OF_DOCUMENT:
1556 bGoEnd =
true;
break;
1562 if ( bGoLeft && aSel.
Max() )
1566 const OUString sText =
maText.toString();
1567 i18n::Boundary aBoundary = xBI->getWordBoundary( sText, aSel.
Max(),
1569 if ( aBoundary.startPos == aSel.
Max() )
1570 aBoundary = xBI->previousWord( sText, aSel.
Max(),
1572 aSel.
Max() = aBoundary.startPos;
1577 aSel.
Max() = xBI->previousCharacters(
maText.toString(), aSel.
Max(),
1581 else if ( bGoRight && ( aSel.
Max() <
maText.getLength() ) )
1585 i18n::Boundary aBoundary = xBI->nextWord(
maText.toString(), aSel.
Max(),
1587 aSel.
Max() = aBoundary.startPos;
1592 aSel.
Max() = xBI->nextCharacters(
maText.toString(), aSel.
Max(),
1627 case css::awt::Key::DELETE_WORD_BACKWARD:
1628 case css::awt::Key::DELETE_WORD_FORWARD:
1629 case css::awt::Key::DELETE_TO_BEGIN_OF_LINE:
1630 case css::awt::Key::DELETE_TO_END_OF_LINE:
1642 case css::awt::Key::DELETE_WORD_BACKWARD:
1646 case css::awt::Key::DELETE_WORD_FORWARD:
1650 case css::awt::Key::DELETE_TO_BEGIN_OF_LINE:
1654 case css::awt::Key::DELETE_TO_END_OF_LINE:
1660 sal_Int32 nOldLen =
maText.getLength();
1662 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;
2134 std::vector<sal_Int32> aDX(2*(aText.getLength()+1));
2141 std::vector<tools::Rectangle> aRects(
mpIMEInfos->nLen);
2146 aRects[
nIndex ] = aRect;
2185 sal_uInt16 nOldAlign =
mnAlign;
2261 mpDDInfo->aCursor.SetWindow(
this );
2279 : sForbiddenChars(rForbiddenChars)
2289 OUString sTemp(rText);
2300 const OUString sOrig =
GetText();
2304 sal_Int32 nDiff = sOrig.getLength() - sNew.getLength();
2422 if ( aNew.
Min() < 0 )
2424 if ( aNew.
Max() < 0 )
2437 bool bCaret =
false, bSelection =
false;
2442 if (nGap != 0 || oGap != 0)
2504 return OUString(
maText.getStr() + aSelection.
Min(), aSelection.
Len() );
2521 css::uno::Reference<css::datatransfer::clipboard::XClipboard> aClipboard(
GetClipboard());
2528 css::uno::Reference<css::datatransfer::clipboard::XClipboard> aClipboard(
GetClipboard());
2538 const OUString aText(
maText.toString() );
2570 return maText.toString();
2650 aControlValue, aBound, aContent))
2684 return nOutWidth / fUnitWidth;
2736 Point aMousePos( rDGE.DragOriginX, rDGE.DragOriginY );
2738 if ( (nCharPos < aSel.
Min()) || (nCharPos >= aSel.
Max()) )
2751 sal_Int8 nActions = datatransfer::dnd::DNDConstants::ACTION_COPY;
2753 nActions |= datatransfer::dnd::DNDConstants::ACTION_MOVE;
2754 rDGE.DragSource->startDrag( rDGE, nActions, 0 , 0 , pDataObj,
mxDnDListener );
2764 if (rDSDE.DropSuccess && (rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE) &&
mpDDInfo)
2785 void Edit::drop(
const css::datatransfer::dnd::DropTargetDropEvent& rDTDE )
2789 bool bChanges =
false;
2806 uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable;
2807 if ( xDataObj.is() )
2809 datatransfer::DataFlavor aFlavor;
2811 if ( xDataObj->isDataFlavorSupported( aFlavor ) )
2828 rDTDE.Context->dropComplete( bChanges );
2838 const Sequence< css::datatransfer::DataFlavor >& rFlavors( rDTDE.SupportedDataFlavors );
2839 mpDDInfo->bIsStringSupported = std::any_of(rFlavors.begin(), rFlavors.end(),
2840 [](
const css::datatransfer::DataFlavor& rFlavor) {
2842 const std::u16string_view aMimetype =
o3tl::getToken(rFlavor.MimeType, 0,
';', nIndex );
2843 return aMimetype ==
u"text/plain";
2858 Point aMousePos( rDTDE.LocationX, rDTDE.LocationY );
2860 sal_Int32 nPrevDropPos =
mpDDInfo->nDropPos;
2879 rDTDE.Context->rejectDrag();
2889 rDTDE.Context->acceptDrag( rDTDE.DropAction );
2897 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
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
vcl::Region GetClipRegion() const
const Color & GetTextColor() const
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
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()
virtual void MouseButtonDown(const MouseEvent &rMEvt)
void Move(tools::Long nHorzMove, tools::Long nVertMove)
const Color & GetHighlightTextColor() const
Edit * GetSubEdit() const
#define EDIT_DELMODE_RESTOFWORD
std::optional< vcl::ControlLayoutData > mxLayoutData
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()
SAL_DLLPRIVATE float approximate_char_width() const
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)
std::unique_ptr< sal_Int32[]> pData
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
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
float approximate_digit_width() const
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
bool Contains(tools::Long nIs) 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...
SAL_DLLPRIVATE void CompatStateChanged(StateChangedType nStateChange)
void SetEchoChar(sal_Unicode c)
SAL_DLLPRIVATE OUString ImplGetText() const
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
sal_uInt16 GetCode() const
css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > mxDnDListener
vcl::Region GetPaintRegion() const
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
bool IsRTLEnabled() const
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
constexpr tools::Long Width() const
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 ...
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
void SetLayoutMode(vcl::text::ComplexTextLayoutFlags nTextLayoutMode)
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)
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
OUString VclResId(TranslateId aId)
constexpr OUStringLiteral aData
#define SAL_N_ELEMENTS(arr)
virtual void Tracking(const TrackingEvent &rTEvt) override
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
SAL_DLLPRIVATE sal_Int32 ImplGetCharPos(const Point &rWindowPos) const
void SetInputContext(const InputContext &rInputContext)
virtual Size GetOptimalSize() const override
SAL_DLLPRIVATE void ImplShowDDCursor()
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.
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()
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
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
const AllSettings & GetSettings() const
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
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 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
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
SAL_WARN_UNUSED_RESULT 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
constexpr tools::Long Height() const
virtual void dragOver(const css::datatransfer::dnd::DropTargetDragEvent &dtde) override
void SetCursor(vcl::Cursor *pCursor)
void SetFont(const vcl::Font &rNewFont)
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
::OutputDevice const * GetOutDev() 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)
const Color & GetTextColor() 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 vcl::Font & GetFont() const
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)
Size GetOutputSizePixel() const
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
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.
virtual void SetMaxTextLen(sal_Int32 nMaxLen)
SAL_DLLPRIVATE void ImplAlignAndPaint()
void GetCaretPositions(const OUString &, sal_Int32 *pCaretXArray, sal_Int32 nIndex, sal_Int32 nLen, const SalLayoutGlyphs *pGlyphs=nullptr) const
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
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
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
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly...
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
WinBits const WB_NOTABSTOP
SAL_DLLPRIVATE void ImplSetText(const OUString &rStr, const Selection *pNewSelection)
virtual void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
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)
Reference< XClipboard > GetSystemPrimarySelection()
virtual void Command(const CommandEvent &rCEvt) override
SAL_DLLPRIVATE bool ImplUseNativeBorder(vcl::RenderContext const &rRenderContext, WinBits nStyle) const
virtual void ReplaceSelected(const OUString &rStr)
bool m_bDetectedRangeSegmentation false
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