22#include <toolkit/awt/vclxwindows.hxx>
25#include <com/sun/star/accessibility/AccessibleStateType.hpp>
26#include <com/sun/star/accessibility/AccessibleEventId.hpp>
27#include <com/sun/star/accessibility/AccessibleRole.hpp>
28#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
29#include <com/sun/star/accessibility/AccessibleTextType.hpp>
30#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
59 :ImplInheritanceHelper( pVCLWindow )
67 switch ( rVclWindowEvent.
GetId() )
69 case VclEventId::EditModify:
74 case VclEventId::EditCaretChanged:
80 if (pWindow && pWindow->HasChildPathFocus())
84 Any aOldValue, aNewValue;
85 aOldValue <<= nOldCaretPosition;
87 NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue );
92 case VclEventId::EditSelectionChanged:
95 if (pWindow && pWindow->HasChildPathFocus())
97 NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED,
Any(),
Any() );
109 VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
114 rStateSet |= AccessibleStateType::FOCUSABLE;
115 rStateSet |= AccessibleStateType::SINGLE_LINE;
117 rStateSet |= AccessibleStateType::EDITABLE;
139 OUStringBuffer sTmp(aText.getLength());
141 cEchoChar).makeStringAndClear();
151 awt::Selection aSelection;
156 nStartIndex = aSelection.Min;
157 nEndIndex = aSelection.Max;
166 return "com.sun.star.comp.toolkit.AccessibleEdit";
172 return {
"com.sun.star.awt.AccessibleEdit" };
181 OExternalLockGuard aGuard(
this );
189 throw IndexOutOfBoundsException();
195 OExternalLockGuard aGuard(
this );
204 if ( pEdit && ( pEdit->IsPassword() || pEdit->GetEchoChar() ) )
205 nRole = AccessibleRole::PASSWORD_TEXT;
206 else if ( pEdit && ( pEdit->GetStyle() &
WB_READONLY ) )
207 nRole = AccessibleRole::STATIC;
209 nRole = AccessibleRole::TEXT;
220 OExternalLockGuard aGuard(
this );
229 OExternalLockGuard aGuard(
this );
232 throw IndexOutOfBoundsException();
234 bool bDoAction =
false;
238 pWindow->GrabFocus();
248 OExternalLockGuard aGuard(
this );
251 throw IndexOutOfBoundsException();
259 OExternalLockGuard aGuard(
this );
262 throw IndexOutOfBoundsException();
264 return Reference< XAccessibleKeyBinding >();
291 OExternalLockGuard aGuard(
this );
293 auto aNonConstRange = asNonConstRange(
aProperties);
297 if ( pMulitLineEdit )
299 ExtTextEngine* pTextEngine = pMulitLineEdit->GetTextEngine();
304 for (PropertyValue& aValue : aNonConstRange )
306 if (aValue.Name ==
"CharColor")
316 for (PropertyValue& aValue : aNonConstRange )
318 if (aValue.Name ==
"CharColor")
320 if ( aValue.Value == sal_Int32(-1) )
338 OExternalLockGuard aGuard(
this );
340 awt::Rectangle aBounds( 0, 0, 0, 0 );
344 throw IndexOutOfBoundsException();
356 if ( aBounds.Height < nHeight )
358 aBounds.Y = aRect.
Top();
359 aBounds.Height = nHeight;
363 aBounds.X = aRect.
Right() + 1;
410 OExternalLockGuard aGuard(
this );
412 bool bReturn =
false;
415 if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
416 throw IndexOutOfBoundsException();
420 if ( pVCLXEdit && pEdit && pEdit->IsEnabled() )
422 pVCLXEdit->
setSelection( awt::Selection( nStartIndex, nEndIndex ) );
444 OExternalLockGuard aGuard(
this );
446 if ( aTextType == AccessibleTextType::ATTRIBUTE_RUN )
449 if ( pMulitLineEdit )
451 ExtTextEngine* pTextEngine = pMulitLineEdit->GetTextEngine();
496 OExternalLockGuard aGuard(
this );
498 bool bReturn =
false;
502 Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard();
503 if ( xClipboard.is() )
505 Reference< datatransfer::XTransferable > xDataObj;
508 xDataObj = xClipboard->getContents();
512 datatransfer::DataFlavor aFlavor;
514 if ( xDataObj->isDataFlavorSupported( aFlavor ) )
516 Any aData = xDataObj->getTransferData( aFlavor );
531 return replaceText( nStartIndex, nEndIndex, OUString() );
543 OExternalLockGuard aGuard(
this );
545 bool bReturn =
false;
548 if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
549 throw IndexOutOfBoundsException();
551 sal_Int32 nMinIndex = std::min( nStartIndex, nEndIndex );
552 sal_Int32 nMaxIndex = std::max( nStartIndex, nEndIndex );
557 pVCLXEdit->
setText( sText.replaceAt( nMinIndex, nMaxIndex - nMinIndex, sReplacement ) );
558 sal_Int32
nIndex = nMinIndex + sReplacement.getLength();
569 OExternalLockGuard aGuard(
this );
572 throw IndexOutOfBoundsException();
580 OExternalLockGuard aGuard(
this );
582 bool bReturn =
false;
588 sal_Int32 nSize = sText.getLength();
589 pVCLXEdit->
setSelection( awt::Selection( nSize, nSize ) );
PropertiesInfo aProperties
const StyleSettings & GetStyleSettings() const
static OutputDevice * GetDefaultDevice()
Color GetRGBColor() const
const AllSettings & GetSettings() const
static bool GetFormatDataFlavor(SotClipboardFormatId nFormat, css::datatransfer::DataFlavor &rFlavor)
const Color & GetFieldTextColor() const
const Color & GetColor() const
void GetTextPortionRange(const TextPaM &rPaM, sal_Int32 &nStart, sal_Int32 &nEnd)
const TextAttrib * FindAttrib(const TextPaM &rPaM, sal_uInt16 nWhich) const
virtual OUString SAL_CALL getText() override
virtual sal_Bool SAL_CALL setAttributes(sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::uno::Sequence< css::beans::PropertyValue > &aAttributeSet) override
virtual sal_Bool SAL_CALL setCaretPosition(sal_Int32 nIndex) override
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual sal_Int32 SAL_CALL getCharacterCount() override
virtual sal_Bool SAL_CALL setSelection(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual sal_Int32 SAL_CALL getSelectionStart() override
sal_Int16 implGetAccessibleRole()
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
virtual void implGetSelection(sal_Int32 &nStartIndex, sal_Int32 &nEndIndex) override
virtual sal_Bool SAL_CALL setText(const OUString &sText) override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
virtual sal_Bool SAL_CALL doAccessibleAction(sal_Int32 nIndex) override
virtual sal_Int32 SAL_CALL getIndexAtPoint(const css::awt::Point &aPoint) override
virtual sal_Int32 SAL_CALL getSelectionEnd() override
virtual sal_Bool SAL_CALL pasteText(sal_Int32 nIndex) override
virtual sal_Bool SAL_CALL cutText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual sal_Int32 SAL_CALL getCaretPosition() override
virtual void FillAccessibleStateSet(sal_Int64 &rStateSet) override
virtual OUString SAL_CALL getSelectedText() override
virtual sal_Int32 SAL_CALL getAccessibleActionCount() override
sal_Int32 m_nCaretPosition
virtual OUString implGetText() override
VCLXAccessibleEdit(VCLXWindow *pVCLXindow)
virtual OUString SAL_CALL getAccessibleActionDescription(sal_Int32 nIndex) override
virtual sal_Bool SAL_CALL scrollSubstringTo(sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override
virtual css::awt::Rectangle SAL_CALL getCharacterBounds(sal_Int32 nIndex) override
virtual void ProcessWindowEvent(const VclWindowEvent &rVclWindowEvent) override
virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes(sal_Int32 nIndex, const css::uno::Sequence< OUString > &aRequestedAttributes) override
virtual sal_Bool SAL_CALL replaceText(sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString &sReplacement) override
virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual sal_Bool SAL_CALL copyText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual sal_Bool SAL_CALL deleteText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual sal_Bool SAL_CALL insertText(const OUString &sText, sal_Int32 nIndex) override
virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding(sal_Int32 nIndex) override
virtual sal_Unicode SAL_CALL getCharacter(sal_Int32 nIndex) override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual sal_Int32 SAL_CALL getIndexAtPoint(const css::awt::Point &aPoint) override
virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual sal_Unicode SAL_CALL getCharacter(sal_Int32 nIndex) override
virtual OUString SAL_CALL getSelectedText() override
virtual void ProcessWindowEvent(const VclWindowEvent &rVclWindowEvent) override
virtual sal_Int32 SAL_CALL getSelectionStart() override
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual sal_Int32 SAL_CALL getSelectionEnd() override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes(sal_Int32 nIndex, const css::uno::Sequence< OUString > &aRequestedAttributes) override
virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual sal_Bool SAL_CALL copyText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual OUString SAL_CALL getText() override
virtual sal_Int32 SAL_CALL getCharacterCount() override
void SAL_CALL setText(const OUString &aText) override
void SAL_CALL setSelection(const css::awt::Selection &aSelection) override
css::awt::Selection SAL_CALL getSelection() override
sal_Bool SAL_CALL isEditable() override
css::awt::Rectangle AWTRectangle(const ::tools::Rectangle &rVCLRect)
virtual void SetText(const OUString &rStr) override
VCL_DLLPUBLIC OUString removeMnemonicFromString(OUString const &rStr, sal_Int32 &rMnemonicPos)
constexpr OUStringLiteral aData
double getLength(const B2DPolygon &rCandidate)
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill='\0')
#define TEXTATTR_FONTCOLOR
WinBits const WB_READONLY