1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleTextHelper.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
34 #include "AccessibleTextHelper.hxx"
35 #include "DrawViewWrapper.hxx"
37 #include <vcl/svapp.hxx>
38 #include <vos/mutex.hxx>
40 #include <svx/AccessibleTextHelper.hxx>
41 #include <svx/unoshtxt.hxx>
42 #include <toolkit/helper/vclunohelper.hxx>
43 #include <vcl/window.hxx>
45 #include <com/sun/star/accessibility/AccessibleRole.hpp>
47 using namespace ::com::sun::star
;
48 using namespace ::com::sun::star::accessibility
;
50 using ::com::sun::star::uno::Reference
;
51 using ::com::sun::star::uno::Sequence
;
52 using ::rtl::OUString
;
57 AccessibleTextHelper::AccessibleTextHelper(
58 DrawViewWrapper
* pDrawViewWrapper
) :
59 impl::AccessibleTextHelper_Base( m_aMutex
),
61 m_pDrawViewWrapper( pDrawViewWrapper
)
64 AccessibleTextHelper::~AccessibleTextHelper()
70 // ____ XInitialization ____
71 void SAL_CALL
AccessibleTextHelper::initialize( const Sequence
< uno::Any
>& aArguments
)
72 throw (uno::Exception
,
73 uno::RuntimeException
)
76 Reference
< XAccessible
> xEventSource
;
77 Reference
< awt::XWindow
> xWindow
;
79 if( aArguments
.getLength() >= 3 )
81 aArguments
[0] >>= aCID
;
82 aArguments
[1] >>= xEventSource
;
83 aArguments
[2] >>= xWindow
;
85 OSL_ENSURE( aCID
.getLength() > 0, "Empty CID" );
86 OSL_ENSURE( xEventSource
.is(), "Empty Event Source" );
87 OSL_ENSURE( xWindow
.is(), "Empty Window" );
88 if( !xEventSource
.is() || aCID
.getLength() == 0 )
92 ::vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
97 Window
* pWindow( VCLUnoHelper::GetWindow( xWindow
));
100 SdrView
* pView
= m_pDrawViewWrapper
;
103 SdrObject
* pTextObj
= m_pDrawViewWrapper
->getNamedSdrObject( aCID
);
106 SvxEditSource
* pEditSource
= new SvxTextEditSource( *pTextObj
, 0, *pView
, *pWindow
);
107 m_pTextHelper
= new ::accessibility::AccessibleTextHelper(
108 ::std::auto_ptr
< SvxEditSource
>( pEditSource
));
110 m_pTextHelper
->SetEventSource( xEventSource
);
115 OSL_ENSURE( m_pTextHelper
, "Couldn't create text helper" );
119 // ____ XAccessibleContext ____
120 ::sal_Int32 SAL_CALL
AccessibleTextHelper::getAccessibleChildCount()
121 throw (uno::RuntimeException
)
126 ::vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
127 return m_pTextHelper
->GetChildCount();
133 Reference
< XAccessible
> SAL_CALL
AccessibleTextHelper::getAccessibleChild( ::sal_Int32 i
)
134 throw (lang::IndexOutOfBoundsException
,
135 uno::RuntimeException
)
140 ::vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
141 return m_pTextHelper
->GetChild( i
);
144 return Reference
< XAccessible
>();
147 Reference
< XAccessible
> SAL_CALL
AccessibleTextHelper::getAccessibleParent()
148 throw (uno::RuntimeException
)
150 OSL_ENSURE( false, "Not implemented in this helper" );
151 return Reference
< XAccessible
>();
154 ::sal_Int32 SAL_CALL
AccessibleTextHelper::getAccessibleIndexInParent()
155 throw (uno::RuntimeException
)
157 OSL_ENSURE( false, "Not implemented in this helper" );
161 ::sal_Int16 SAL_CALL
AccessibleTextHelper::getAccessibleRole()
162 throw (uno::RuntimeException
)
164 OSL_ENSURE( false, "Not implemented in this helper" );
165 return AccessibleRole::UNKNOWN
;
168 OUString SAL_CALL
AccessibleTextHelper::getAccessibleDescription()
169 throw (uno::RuntimeException
)
171 OSL_ENSURE( false, "Not implemented in this helper" );
175 OUString SAL_CALL
AccessibleTextHelper::getAccessibleName()
176 throw (uno::RuntimeException
)
178 OSL_ENSURE( false, "Not implemented in this helper" );
182 Reference
< XAccessibleRelationSet
> SAL_CALL
AccessibleTextHelper::getAccessibleRelationSet()
183 throw (uno::RuntimeException
)
185 OSL_ENSURE( false, "Not implemented in this helper" );
186 return Reference
< XAccessibleRelationSet
>();
189 Reference
< XAccessibleStateSet
> SAL_CALL
AccessibleTextHelper::getAccessibleStateSet()
190 throw (uno::RuntimeException
)
192 OSL_ENSURE( false, "Not implemented in this helper" );
193 return Reference
< XAccessibleStateSet
>();
196 lang::Locale SAL_CALL
AccessibleTextHelper::getLocale()
197 throw (IllegalAccessibleComponentStateException
,
198 uno::RuntimeException
)
200 OSL_ENSURE( false, "Not implemented in this helper" );
201 return lang::Locale();