xref: /AOO41X/main/accessibility/source/standard/vclxaccessibletextcomponent.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_accessibility.hxx"
30*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibletextcomponent.hxx>
31*cdf0e10cSrcweir #include <toolkit/helper/macros.hxx>
32*cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
33*cdf0e10cSrcweir #include <accessibility/helper/characterattributeshelper.hxx>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
38*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
39*cdf0e10cSrcweir #include <comphelper/sequence.hxx>
40*cdf0e10cSrcweir #include <vcl/window.hxx>
41*cdf0e10cSrcweir #include <vcl/svapp.hxx>
42*cdf0e10cSrcweir #include <vcl/unohelp2.hxx>
43*cdf0e10cSrcweir #include <vcl/ctrl.hxx>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir #include <memory>
46*cdf0e10cSrcweir #include <vector>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir using namespace ::com::sun::star;
49*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
50*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
51*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
52*cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
53*cdf0e10cSrcweir using namespace ::comphelper;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir //	----------------------------------------------------
57*cdf0e10cSrcweir //	class VCLXAccessibleTextComponent
58*cdf0e10cSrcweir //	----------------------------------------------------
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir VCLXAccessibleTextComponent::VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow )
61*cdf0e10cSrcweir 	:VCLXAccessibleComponent( pVCLXWindow )
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir     if ( GetWindow() )
64*cdf0e10cSrcweir 		m_sText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() );
65*cdf0e10cSrcweir }
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir // -----------------------------------------------------------------------------
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir VCLXAccessibleTextComponent::~VCLXAccessibleTextComponent()
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir }
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir // -----------------------------------------------------------------------------
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir void VCLXAccessibleTextComponent::SetText( const ::rtl::OUString& sText )
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir 	Any aOldValue, aNewValue;
78*cdf0e10cSrcweir     if ( implInitTextChangedEvent( m_sText, sText, aOldValue, aNewValue ) )
79*cdf0e10cSrcweir     {
80*cdf0e10cSrcweir         m_sText = sText;
81*cdf0e10cSrcweir 		NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
82*cdf0e10cSrcweir     }
83*cdf0e10cSrcweir }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir // -----------------------------------------------------------------------------
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir void VCLXAccessibleTextComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir     switch ( rVclWindowEvent.GetId() )
90*cdf0e10cSrcweir     {
91*cdf0e10cSrcweir         case VCLEVENT_WINDOW_FRAMETITLECHANGED:
92*cdf0e10cSrcweir         {
93*cdf0e10cSrcweir 			VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
94*cdf0e10cSrcweir             SetText( implGetText() );
95*cdf0e10cSrcweir         }
96*cdf0e10cSrcweir         break;
97*cdf0e10cSrcweir 		default:
98*cdf0e10cSrcweir 			VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
99*cdf0e10cSrcweir    }
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir // -----------------------------------------------------------------------------
103*cdf0e10cSrcweir // OCommonAccessibleText
104*cdf0e10cSrcweir // -----------------------------------------------------------------------------
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextComponent::implGetText()
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir     ::rtl::OUString aText;
109*cdf0e10cSrcweir     if ( GetWindow() )
110*cdf0e10cSrcweir 		aText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() );
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     return aText;
113*cdf0e10cSrcweir }
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir // -----------------------------------------------------------------------------
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir lang::Locale VCLXAccessibleTextComponent::implGetLocale()
118*cdf0e10cSrcweir {
119*cdf0e10cSrcweir 	return Application::GetSettings().GetLocale();
120*cdf0e10cSrcweir }
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir // -----------------------------------------------------------------------------
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir void VCLXAccessibleTextComponent::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
125*cdf0e10cSrcweir {
126*cdf0e10cSrcweir 	nStartIndex = 0;
127*cdf0e10cSrcweir 	nEndIndex = 0;
128*cdf0e10cSrcweir }
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir // -----------------------------------------------------------------------------
131*cdf0e10cSrcweir // XComponent
132*cdf0e10cSrcweir // -----------------------------------------------------------------------------
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir void VCLXAccessibleTextComponent::disposing()
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir 	VCLXAccessibleComponent::disposing();
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	m_sText = ::rtl::OUString();
139*cdf0e10cSrcweir }
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir // -----------------------------------------------------------------------------
142*cdf0e10cSrcweir // XInterface
143*cdf0e10cSrcweir // -----------------------------------------------------------------------------
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE )
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir // -----------------------------------------------------------------------------
148*cdf0e10cSrcweir // XTypeProvider
149*cdf0e10cSrcweir // -----------------------------------------------------------------------------
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE )
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir // -----------------------------------------------------------------------------
154*cdf0e10cSrcweir // XAccessibleText
155*cdf0e10cSrcweir // -----------------------------------------------------------------------------
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getCaretPosition() throw (RuntimeException)
158*cdf0e10cSrcweir {
159*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	return -1;
162*cdf0e10cSrcweir }
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir // -----------------------------------------------------------------------------
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir sal_Bool VCLXAccessibleTextComponent::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 	return setSelection( nIndex, nIndex );
171*cdf0e10cSrcweir }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir // -----------------------------------------------------------------------------
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir sal_Unicode VCLXAccessibleTextComponent::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
176*cdf0e10cSrcweir {
177*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 	return OCommonAccessibleText::getCharacter( nIndex );
180*cdf0e10cSrcweir }
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir // -----------------------------------------------------------------------------
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir Sequence< PropertyValue > VCLXAccessibleTextComponent::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 	Sequence< PropertyValue > aValues;
189*cdf0e10cSrcweir 	::rtl::OUString sText( implGetText() );
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir     if ( !implIsValidIndex( nIndex, sText.getLength() ) )
192*cdf0e10cSrcweir         throw IndexOutOfBoundsException();
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir     if ( GetWindow() )
195*cdf0e10cSrcweir     {
196*cdf0e10cSrcweir         Font aFont = GetWindow()->GetControlFont();
197*cdf0e10cSrcweir         sal_Int32 nBackColor = GetWindow()->GetControlBackground().GetColor();
198*cdf0e10cSrcweir         sal_Int32 nColor = GetWindow()->GetControlForeground().GetColor();
199*cdf0e10cSrcweir         ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
200*cdf0e10cSrcweir 		aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
201*cdf0e10cSrcweir     }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir     return aValues;
204*cdf0e10cSrcweir }
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir // -----------------------------------------------------------------------------
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir awt::Rectangle VCLXAccessibleTextComponent::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
209*cdf0e10cSrcweir {
210*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir     if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
213*cdf0e10cSrcweir         throw IndexOutOfBoundsException();
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 	awt::Rectangle aRect;
216*cdf0e10cSrcweir 	Control* pControl = static_cast< Control* >( GetWindow() );
217*cdf0e10cSrcweir 	if ( pControl )
218*cdf0e10cSrcweir 		aRect = AWTRectangle( pControl->GetCharacterBounds( nIndex ) );
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir     return aRect;
221*cdf0e10cSrcweir }
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir // -----------------------------------------------------------------------------
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getCharacterCount() throw (RuntimeException)
226*cdf0e10cSrcweir {
227*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 	return OCommonAccessibleText::getCharacterCount();
230*cdf0e10cSrcweir }
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir // -----------------------------------------------------------------------------
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
235*cdf0e10cSrcweir {
236*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 	sal_Int32 nIndex = -1;
239*cdf0e10cSrcweir 	Control* pControl = static_cast< Control* >( GetWindow() );
240*cdf0e10cSrcweir 	if ( pControl )
241*cdf0e10cSrcweir 		nIndex = pControl->GetIndexForPoint( VCLPoint( aPoint ) );
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir     return nIndex;
244*cdf0e10cSrcweir }
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir // -----------------------------------------------------------------------------
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextComponent::getSelectedText() throw (RuntimeException)
249*cdf0e10cSrcweir {
250*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 	return OCommonAccessibleText::getSelectedText();
253*cdf0e10cSrcweir }
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir // -----------------------------------------------------------------------------
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getSelectionStart() throw (RuntimeException)
258*cdf0e10cSrcweir {
259*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 	return OCommonAccessibleText::getSelectionStart();
262*cdf0e10cSrcweir }
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir // -----------------------------------------------------------------------------
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir sal_Int32 VCLXAccessibleTextComponent::getSelectionEnd() throw (RuntimeException)
267*cdf0e10cSrcweir {
268*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 	return OCommonAccessibleText::getSelectionEnd();
271*cdf0e10cSrcweir }
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir // -----------------------------------------------------------------------------
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir sal_Bool VCLXAccessibleTextComponent::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
276*cdf0e10cSrcweir {
277*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir     if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
280*cdf0e10cSrcweir         throw IndexOutOfBoundsException();
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir 	return sal_False;
283*cdf0e10cSrcweir }
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir // -----------------------------------------------------------------------------
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextComponent::getText() throw (RuntimeException)
288*cdf0e10cSrcweir {
289*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 	return OCommonAccessibleText::getText();
292*cdf0e10cSrcweir }
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir // -----------------------------------------------------------------------------
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextComponent::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
297*cdf0e10cSrcweir {
298*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 	return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
301*cdf0e10cSrcweir }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir // -----------------------------------------------------------------------------
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir ::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)
306*cdf0e10cSrcweir {
307*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 	return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
310*cdf0e10cSrcweir }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir // -----------------------------------------------------------------------------
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir ::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)
315*cdf0e10cSrcweir {
316*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir 	return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
319*cdf0e10cSrcweir }
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir // -----------------------------------------------------------------------------
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir ::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)
324*cdf0e10cSrcweir {
325*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 	return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
328*cdf0e10cSrcweir }
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir // -----------------------------------------------------------------------------
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
333*cdf0e10cSrcweir {
334*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 	if ( GetWindow() )
339*cdf0e10cSrcweir 	{
340*cdf0e10cSrcweir 		Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard();
341*cdf0e10cSrcweir 		if ( xClipboard.is() )
342*cdf0e10cSrcweir 		{
343*cdf0e10cSrcweir 			::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir 			::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
346*cdf0e10cSrcweir 			const sal_uInt32 nRef = Application::ReleaseSolarMutex();
347*cdf0e10cSrcweir 			xClipboard->setContents( pDataObj, NULL );
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir 			Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
350*cdf0e10cSrcweir 			if( xFlushableClipboard.is() )
351*cdf0e10cSrcweir 				xFlushableClipboard->flushClipboard();
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 			Application::AcquireSolarMutex( nRef );
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir 			bReturn = sal_True;
356*cdf0e10cSrcweir 		}
357*cdf0e10cSrcweir 	}
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir     return bReturn;
360*cdf0e10cSrcweir }
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir // -----------------------------------------------------------------------------
363