10841af79SAndrew Rist /**************************************************************
2*aa5a148eSmseidel  *
30841af79SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
40841af79SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
50841af79SAndrew Rist  * distributed with this work for additional information
60841af79SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
70841af79SAndrew Rist  * to you under the Apache License, Version 2.0 (the
80841af79SAndrew Rist  * "License"); you may not use this file except in compliance
90841af79SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*aa5a148eSmseidel  *
110841af79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*aa5a148eSmseidel  *
130841af79SAndrew Rist  * Unless required by applicable law or agreed to in writing,
140841af79SAndrew Rist  * software distributed under the License is distributed on an
150841af79SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
160841af79SAndrew Rist  * KIND, either express or implied.  See the License for the
170841af79SAndrew Rist  * specific language governing permissions and limitations
180841af79SAndrew Rist  * under the License.
19*aa5a148eSmseidel  *
200841af79SAndrew Rist  *************************************************************/
210841af79SAndrew Rist 
220841af79SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_accessibility.hxx"
26cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibletextcomponent.hxx>
27cdf0e10cSrcweir #include <toolkit/helper/macros.hxx>
28cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
29cdf0e10cSrcweir #include <accessibility/helper/characterattributeshelper.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
32cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
33cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
34cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
35cdf0e10cSrcweir #include <comphelper/sequence.hxx>
36cdf0e10cSrcweir #include <vcl/window.hxx>
37cdf0e10cSrcweir #include <vcl/svapp.hxx>
38cdf0e10cSrcweir #include <vcl/unohelp2.hxx>
39cdf0e10cSrcweir #include <vcl/ctrl.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <memory>
42cdf0e10cSrcweir #include <vector>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir using namespace ::com::sun::star;
45cdf0e10cSrcweir using namespace ::com::sun::star::uno;
46cdf0e10cSrcweir using namespace ::com::sun::star::lang;
47cdf0e10cSrcweir using namespace ::com::sun::star::beans;
48cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
49cdf0e10cSrcweir using namespace ::comphelper;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //	----------------------------------------------------
53cdf0e10cSrcweir //	class VCLXAccessibleTextComponent
54cdf0e10cSrcweir //	----------------------------------------------------
55cdf0e10cSrcweir 
VCLXAccessibleTextComponent(VCLXWindow * pVCLXWindow)56cdf0e10cSrcweir VCLXAccessibleTextComponent::VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow )
57cdf0e10cSrcweir 	:VCLXAccessibleComponent( pVCLXWindow )
58cdf0e10cSrcweir {
59*aa5a148eSmseidel 	if ( GetWindow() )
60cdf0e10cSrcweir 		m_sText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() );
61cdf0e10cSrcweir }
62cdf0e10cSrcweir 
63cdf0e10cSrcweir // -----------------------------------------------------------------------------
64cdf0e10cSrcweir 
~VCLXAccessibleTextComponent()65cdf0e10cSrcweir VCLXAccessibleTextComponent::~VCLXAccessibleTextComponent()
66cdf0e10cSrcweir {
67cdf0e10cSrcweir }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir // -----------------------------------------------------------------------------
70cdf0e10cSrcweir 
SetText(const::rtl::OUString & sText)71cdf0e10cSrcweir void VCLXAccessibleTextComponent::SetText( const ::rtl::OUString& sText )
72cdf0e10cSrcweir {
73cdf0e10cSrcweir 	Any aOldValue, aNewValue;
74*aa5a148eSmseidel 	if ( implInitTextChangedEvent( m_sText, sText, aOldValue, aNewValue ) )
75*aa5a148eSmseidel 	{
76*aa5a148eSmseidel 		m_sText = sText;
77cdf0e10cSrcweir 		NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
78*aa5a148eSmseidel 	}
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir // -----------------------------------------------------------------------------
82cdf0e10cSrcweir 
ProcessWindowEvent(const VclWindowEvent & rVclWindowEvent)83cdf0e10cSrcweir void VCLXAccessibleTextComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
84cdf0e10cSrcweir {
85*aa5a148eSmseidel 	switch ( rVclWindowEvent.GetId() )
86*aa5a148eSmseidel 	{
87*aa5a148eSmseidel 		case VCLEVENT_WINDOW_FRAMETITLECHANGED:
88*aa5a148eSmseidel 		{
89cdf0e10cSrcweir 			VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
90*aa5a148eSmseidel 			SetText( implGetText() );
91*aa5a148eSmseidel 		}
92*aa5a148eSmseidel 		break;
93cdf0e10cSrcweir 		default:
94cdf0e10cSrcweir 			VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
95*aa5a148eSmseidel 	}
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir // -----------------------------------------------------------------------------
99cdf0e10cSrcweir // OCommonAccessibleText
100cdf0e10cSrcweir // -----------------------------------------------------------------------------
101cdf0e10cSrcweir 
implGetText()102cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextComponent::implGetText()
103cdf0e10cSrcweir {
104*aa5a148eSmseidel 	::rtl::OUString aText;
105*aa5a148eSmseidel 	if ( GetWindow() )
106cdf0e10cSrcweir 		aText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() );
107cdf0e10cSrcweir 
108*aa5a148eSmseidel 	return aText;
109cdf0e10cSrcweir }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir // -----------------------------------------------------------------------------
112cdf0e10cSrcweir 
implGetLocale()113cdf0e10cSrcweir lang::Locale VCLXAccessibleTextComponent::implGetLocale()
114cdf0e10cSrcweir {
115cdf0e10cSrcweir 	return Application::GetSettings().GetLocale();
116cdf0e10cSrcweir }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir // -----------------------------------------------------------------------------
119cdf0e10cSrcweir 
implGetSelection(sal_Int32 & nStartIndex,sal_Int32 & nEndIndex)120cdf0e10cSrcweir void VCLXAccessibleTextComponent::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	nStartIndex = 0;
123cdf0e10cSrcweir 	nEndIndex = 0;
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir // -----------------------------------------------------------------------------
127cdf0e10cSrcweir // XComponent
128cdf0e10cSrcweir // -----------------------------------------------------------------------------
129cdf0e10cSrcweir 
disposing()130cdf0e10cSrcweir void VCLXAccessibleTextComponent::disposing()
131cdf0e10cSrcweir {
132cdf0e10cSrcweir 	VCLXAccessibleComponent::disposing();
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	m_sText = ::rtl::OUString();
135cdf0e10cSrcweir }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir // -----------------------------------------------------------------------------
138cdf0e10cSrcweir // XInterface
139cdf0e10cSrcweir // -----------------------------------------------------------------------------
140cdf0e10cSrcweir 
IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextComponent,VCLXAccessibleComponent,VCLXAccessibleTextComponent_BASE)141cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE )
142cdf0e10cSrcweir 
143cdf0e10cSrcweir // -----------------------------------------------------------------------------
144cdf0e10cSrcweir // XTypeProvider
145cdf0e10cSrcweir // -----------------------------------------------------------------------------
146cdf0e10cSrcweir 
147cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE )
148cdf0e10cSrcweir 
149cdf0e10cSrcweir // -----------------------------------------------------------------------------
150cdf0e10cSrcweir // XAccessibleText
151cdf0e10cSrcweir // -----------------------------------------------------------------------------
152cdf0e10cSrcweir 
153cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getCaretPosition() throw (RuntimeException)
154cdf0e10cSrcweir {
155cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	return -1;
158cdf0e10cSrcweir }
159cdf0e10cSrcweir 
160cdf0e10cSrcweir // -----------------------------------------------------------------------------
161cdf0e10cSrcweir 
setCaretPosition(sal_Int32 nIndex)162cdf0e10cSrcweir sal_Bool VCLXAccessibleTextComponent::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
163cdf0e10cSrcweir {
164cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	return setSelection( nIndex, nIndex );
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir // -----------------------------------------------------------------------------
170cdf0e10cSrcweir 
getCharacter(sal_Int32 nIndex)171cdf0e10cSrcweir sal_Unicode VCLXAccessibleTextComponent::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
172cdf0e10cSrcweir {
173cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
174*aa5a148eSmseidel 
175*aa5a148eSmseidel 	return OCommonAccessibleText::getCharacter( nIndex );
176cdf0e10cSrcweir }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir // -----------------------------------------------------------------------------
179cdf0e10cSrcweir 
getCharacterAttributes(sal_Int32 nIndex,const Sequence<::rtl::OUString> & aRequestedAttributes)180cdf0e10cSrcweir Sequence< PropertyValue > VCLXAccessibleTextComponent::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
181cdf0e10cSrcweir {
182cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 	Sequence< PropertyValue > aValues;
185cdf0e10cSrcweir 	::rtl::OUString sText( implGetText() );
186cdf0e10cSrcweir 
187*aa5a148eSmseidel 	if ( !implIsValidIndex( nIndex, sText.getLength() ) )
188*aa5a148eSmseidel 		throw IndexOutOfBoundsException();
189cdf0e10cSrcweir 
190*aa5a148eSmseidel 	if ( GetWindow() )
191*aa5a148eSmseidel 	{
19221075d77SSteve Yin 		Font aFont = GetWindow()->GetControlFont();
19321075d77SSteve Yin 
19421075d77SSteve Yin 		sal_Int32 nBackColor = GetWindow()->GetControlBackground().GetColor();
19521075d77SSteve Yin 		sal_Int32 nColor = GetWindow()->GetControlForeground().GetColor();
19621075d77SSteve Yin 
19721075d77SSteve Yin 		// MT: Code with default font was introduced with the IA2 CWS, but I am not convinced that this is the correct font...
19821075d77SSteve Yin 		// Decide what to do when we have a concrete issue.
19921075d77SSteve Yin 		/*
20021075d77SSteve Yin 		Font aDefaultVCLFont;
20121075d77SSteve Yin 		OutputDevice* pDev = Application::GetDefaultDevice();
20221075d77SSteve Yin 		if ( pDev )
203*aa5a148eSmseidel 		{
20421075d77SSteve Yin 			aDefaultVCLFont = pDev->GetSettings().GetStyleSettings().GetAppFont();
20521075d77SSteve Yin 			if ( !aFont.GetName().Len() )
20621075d77SSteve Yin 			{
20721075d77SSteve Yin 				String aDefaultName = aDefaultVCLFont.GetName();
20821075d77SSteve Yin 				aFont.SetName( aDefaultName );
20921075d77SSteve Yin 			}
21021075d77SSteve Yin 			if ( !aFont.GetHeight() )
21121075d77SSteve Yin 			{
21221075d77SSteve Yin 				aFont.SetHeight( aDefaultVCLFont.GetHeight() );
21321075d77SSteve Yin 			}
21421075d77SSteve Yin 			if ( aFont.GetWeight() == WEIGHT_DONTKNOW )
21521075d77SSteve Yin 			{
21621075d77SSteve Yin 				aFont.SetWeight( aDefaultVCLFont.GetWeight() );
21721075d77SSteve Yin 			}
21821075d77SSteve Yin 
21921075d77SSteve Yin 			//if nColor is -1, it may indicate that the default color black is using.
22021075d77SSteve Yin 			if ( nColor == -1)
22121075d77SSteve Yin 			{
22221075d77SSteve Yin 				nColor = aDefaultVCLFont.GetColor().GetColor();
22321075d77SSteve Yin 			}
22421075d77SSteve Yin 		}
22521075d77SSteve Yin 		*/
22621075d77SSteve Yin 
22721075d77SSteve Yin 		// MT: Adjustment stuff was introduced with the IA2 CWS, but adjustment is not a character attribute...
22821075d77SSteve Yin 		// In case we reintroduce it, use adjustment as extra parameter for the CharacterAttributesHelper...
22921075d77SSteve Yin 		/*
23021075d77SSteve Yin 		WinBits aBits = GetWindow()->GetStyle();
23121075d77SSteve Yin 		sal_Int16 nAdjust = -1;
23221075d77SSteve Yin 		if ( aBits & WB_LEFT )
23321075d77SSteve Yin 		{
23421075d77SSteve Yin 			nAdjust = style::ParagraphAdjust_LEFT;
23521075d77SSteve Yin 		}
23621075d77SSteve Yin 		else if ( aBits & WB_RIGHT )
23721075d77SSteve Yin 		{
23821075d77SSteve Yin 			nAdjust = style::ParagraphAdjust_RIGHT;
23921075d77SSteve Yin 		}
24021075d77SSteve Yin 		else if ( aBits & WB_CENTER )
24121075d77SSteve Yin 		{
24221075d77SSteve Yin 			nAdjust = style::ParagraphAdjust_CENTER;
24321075d77SSteve Yin 		}
24421075d77SSteve Yin 		*/
24521075d77SSteve Yin 
24621075d77SSteve Yin 		::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
247*aa5a148eSmseidel 
248cdf0e10cSrcweir 		aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
249*aa5a148eSmseidel 	}
250cdf0e10cSrcweir 
251*aa5a148eSmseidel 	return aValues;
252cdf0e10cSrcweir }
253cdf0e10cSrcweir 
254cdf0e10cSrcweir // -----------------------------------------------------------------------------
255cdf0e10cSrcweir 
getCharacterBounds(sal_Int32 nIndex)256cdf0e10cSrcweir awt::Rectangle VCLXAccessibleTextComponent::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
257cdf0e10cSrcweir {
258cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
259cdf0e10cSrcweir 
260*aa5a148eSmseidel 	if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
261*aa5a148eSmseidel 		throw IndexOutOfBoundsException();
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 	awt::Rectangle aRect;
264cdf0e10cSrcweir 	Control* pControl = static_cast< Control* >( GetWindow() );
265cdf0e10cSrcweir 	if ( pControl )
266cdf0e10cSrcweir 		aRect = AWTRectangle( pControl->GetCharacterBounds( nIndex ) );
267cdf0e10cSrcweir 
268*aa5a148eSmseidel 	return aRect;
269cdf0e10cSrcweir }
270cdf0e10cSrcweir 
271cdf0e10cSrcweir // -----------------------------------------------------------------------------
272cdf0e10cSrcweir 
getCharacterCount()273cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getCharacterCount() throw (RuntimeException)
274cdf0e10cSrcweir {
275cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
276*aa5a148eSmseidel 
277*aa5a148eSmseidel 	return OCommonAccessibleText::getCharacterCount();
278cdf0e10cSrcweir }
279cdf0e10cSrcweir 
280cdf0e10cSrcweir // -----------------------------------------------------------------------------
281cdf0e10cSrcweir 
getIndexAtPoint(const awt::Point & aPoint)282cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
283cdf0e10cSrcweir {
284cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 	sal_Int32 nIndex = -1;
287cdf0e10cSrcweir 	Control* pControl = static_cast< Control* >( GetWindow() );
288cdf0e10cSrcweir 	if ( pControl )
289cdf0e10cSrcweir 		nIndex = pControl->GetIndexForPoint( VCLPoint( aPoint ) );
290cdf0e10cSrcweir 
291*aa5a148eSmseidel 	return nIndex;
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir // -----------------------------------------------------------------------------
295cdf0e10cSrcweir 
getSelectedText()296cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextComponent::getSelectedText() throw (RuntimeException)
297cdf0e10cSrcweir {
298cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
299*aa5a148eSmseidel 
300*aa5a148eSmseidel 	return OCommonAccessibleText::getSelectedText();
301cdf0e10cSrcweir }
302cdf0e10cSrcweir 
303cdf0e10cSrcweir // -----------------------------------------------------------------------------
304cdf0e10cSrcweir 
getSelectionStart()305cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getSelectionStart() throw (RuntimeException)
306cdf0e10cSrcweir {
307cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
308*aa5a148eSmseidel 
309cdf0e10cSrcweir 	return OCommonAccessibleText::getSelectionStart();
310cdf0e10cSrcweir }
311cdf0e10cSrcweir 
312cdf0e10cSrcweir // -----------------------------------------------------------------------------
313cdf0e10cSrcweir 
getSelectionEnd()314cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getSelectionEnd() throw (RuntimeException)
315cdf0e10cSrcweir {
316cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
317*aa5a148eSmseidel 
318*aa5a148eSmseidel 	return OCommonAccessibleText::getSelectionEnd();
319cdf0e10cSrcweir }
320cdf0e10cSrcweir 
321cdf0e10cSrcweir // -----------------------------------------------------------------------------
322cdf0e10cSrcweir 
setSelection(sal_Int32 nStartIndex,sal_Int32 nEndIndex)323cdf0e10cSrcweir sal_Bool VCLXAccessibleTextComponent::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
324cdf0e10cSrcweir {
325cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
326cdf0e10cSrcweir 
327*aa5a148eSmseidel 	if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
328*aa5a148eSmseidel 		throw IndexOutOfBoundsException();
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 	return sal_False;
331cdf0e10cSrcweir }
332cdf0e10cSrcweir 
333cdf0e10cSrcweir // -----------------------------------------------------------------------------
334cdf0e10cSrcweir 
getText()335cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextComponent::getText() throw (RuntimeException)
336cdf0e10cSrcweir {
337cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
338*aa5a148eSmseidel 
339cdf0e10cSrcweir 	return OCommonAccessibleText::getText();
340cdf0e10cSrcweir }
341cdf0e10cSrcweir 
342cdf0e10cSrcweir // -----------------------------------------------------------------------------
343cdf0e10cSrcweir 
getTextRange(sal_Int32 nStartIndex,sal_Int32 nEndIndex)344cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextComponent::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
345cdf0e10cSrcweir {
346cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
347*aa5a148eSmseidel 
348*aa5a148eSmseidel 	return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
349cdf0e10cSrcweir }
350cdf0e10cSrcweir 
351cdf0e10cSrcweir // -----------------------------------------------------------------------------
352cdf0e10cSrcweir 
getTextAtIndex(sal_Int32 nIndex,sal_Int16 aTextType)353cdf0e10cSrcweir ::com::sun::star::accessibility::TextSegment VCLXAccessibleTextComponent::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
354cdf0e10cSrcweir {
355cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
356*aa5a148eSmseidel 
357cdf0e10cSrcweir 	return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
358cdf0e10cSrcweir }
359cdf0e10cSrcweir 
360cdf0e10cSrcweir // -----------------------------------------------------------------------------
361cdf0e10cSrcweir 
getTextBeforeIndex(sal_Int32 nIndex,sal_Int16 aTextType)362cdf0e10cSrcweir ::com::sun::star::accessibility::TextSegment VCLXAccessibleTextComponent::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
363cdf0e10cSrcweir {
364cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
365*aa5a148eSmseidel 
366cdf0e10cSrcweir 	return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
367cdf0e10cSrcweir }
368cdf0e10cSrcweir 
369cdf0e10cSrcweir // -----------------------------------------------------------------------------
370cdf0e10cSrcweir 
getTextBehindIndex(sal_Int32 nIndex,sal_Int16 aTextType)371cdf0e10cSrcweir ::com::sun::star::accessibility::TextSegment VCLXAccessibleTextComponent::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
372cdf0e10cSrcweir {
373cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
374*aa5a148eSmseidel 
375cdf0e10cSrcweir 	return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
376cdf0e10cSrcweir }
377cdf0e10cSrcweir 
378cdf0e10cSrcweir // -----------------------------------------------------------------------------
379cdf0e10cSrcweir 
copyText(sal_Int32 nStartIndex,sal_Int32 nEndIndex)380cdf0e10cSrcweir sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
381cdf0e10cSrcweir {
382cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
385cdf0e10cSrcweir 
386cdf0e10cSrcweir 	if ( GetWindow() )
387cdf0e10cSrcweir 	{
388cdf0e10cSrcweir 		Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard();
389cdf0e10cSrcweir 		if ( xClipboard.is() )
390cdf0e10cSrcweir 		{
391cdf0e10cSrcweir 			::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 			::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
394cdf0e10cSrcweir 			const sal_uInt32 nRef = Application::ReleaseSolarMutex();
395cdf0e10cSrcweir 			xClipboard->setContents( pDataObj, NULL );
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 			Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
398cdf0e10cSrcweir 			if( xFlushableClipboard.is() )
399cdf0e10cSrcweir 				xFlushableClipboard->flushClipboard();
400*aa5a148eSmseidel 
401cdf0e10cSrcweir 			Application::AcquireSolarMutex( nRef );
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 			bReturn = sal_True;
404cdf0e10cSrcweir 		}
405cdf0e10cSrcweir 	}
406cdf0e10cSrcweir 
407*aa5a148eSmseidel 	return bReturn;
408cdf0e10cSrcweir }
409cdf0e10cSrcweir 
410cdf0e10cSrcweir // -----------------------------------------------------------------------------
411