1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
31 #include "AccessibleTextHelper.hxx"
32 #include "DrawViewWrapper.hxx"
34 #include <vcl/svapp.hxx>
35 #include <vos/mutex.hxx>
37 #include <svx/AccessibleTextHelper.hxx>
38 #include <svx/unoshtxt.hxx>
39 #include <toolkit/helper/vclunohelper.hxx>
40 #include <vcl/window.hxx>
42 #include <com/sun/star/accessibility/AccessibleRole.hpp>
44 using namespace ::com::sun::star
;
45 using namespace ::com::sun::star::accessibility
;
47 using ::com::sun::star::uno::Reference
;
48 using ::com::sun::star::uno::Sequence
;
49 using ::rtl::OUString
;
54 AccessibleTextHelper::AccessibleTextHelper(
55 DrawViewWrapper
* pDrawViewWrapper
) :
56 impl::AccessibleTextHelper_Base( m_aMutex
),
58 m_pDrawViewWrapper( pDrawViewWrapper
)
61 AccessibleTextHelper::~AccessibleTextHelper()
67 // ____ XInitialization ____
68 void SAL_CALL
AccessibleTextHelper::initialize( const Sequence
< uno::Any
>& aArguments
)
69 throw (uno::Exception
,
70 uno::RuntimeException
)
73 Reference
< XAccessible
> xEventSource
;
74 Reference
< awt::XWindow
> xWindow
;
76 if( aArguments
.getLength() >= 3 )
78 aArguments
[0] >>= aCID
;
79 aArguments
[1] >>= xEventSource
;
80 aArguments
[2] >>= xWindow
;
82 OSL_ENSURE( aCID
.getLength() > 0, "Empty CID" );
83 OSL_ENSURE( xEventSource
.is(), "Empty Event Source" );
84 OSL_ENSURE( xWindow
.is(), "Empty Window" );
85 if( !xEventSource
.is() || aCID
.getLength() == 0 )
89 ::vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
94 Window
* pWindow( VCLUnoHelper::GetWindow( xWindow
));
97 SdrView
* pView
= m_pDrawViewWrapper
;
100 SdrObject
* pTextObj
= m_pDrawViewWrapper
->getNamedSdrObject( aCID
);
103 SvxEditSource
* pEditSource
= new SvxTextEditSource( *pTextObj
, 0, *pView
, *pWindow
);
104 m_pTextHelper
= new ::accessibility::AccessibleTextHelper(
105 ::std::auto_ptr
< SvxEditSource
>( pEditSource
));
107 m_pTextHelper
->SetEventSource( xEventSource
);
112 OSL_ENSURE( m_pTextHelper
, "Couldn't create text helper" );
116 // ____ XAccessibleContext ____
117 ::sal_Int32 SAL_CALL
AccessibleTextHelper::getAccessibleChildCount()
118 throw (uno::RuntimeException
)
123 ::vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
124 return m_pTextHelper
->GetChildCount();
130 Reference
< XAccessible
> SAL_CALL
AccessibleTextHelper::getAccessibleChild( ::sal_Int32 i
)
131 throw (lang::IndexOutOfBoundsException
,
132 uno::RuntimeException
)
137 ::vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
138 return m_pTextHelper
->GetChild( i
);
141 return Reference
< XAccessible
>();
144 Reference
< XAccessible
> SAL_CALL
AccessibleTextHelper::getAccessibleParent()
145 throw (uno::RuntimeException
)
147 OSL_ENSURE( false, "Not implemented in this helper" );
148 return Reference
< XAccessible
>();
151 ::sal_Int32 SAL_CALL
AccessibleTextHelper::getAccessibleIndexInParent()
152 throw (uno::RuntimeException
)
154 OSL_ENSURE( false, "Not implemented in this helper" );
158 ::sal_Int16 SAL_CALL
AccessibleTextHelper::getAccessibleRole()
159 throw (uno::RuntimeException
)
161 OSL_ENSURE( false, "Not implemented in this helper" );
162 return AccessibleRole::UNKNOWN
;
165 OUString SAL_CALL
AccessibleTextHelper::getAccessibleDescription()
166 throw (uno::RuntimeException
)
168 OSL_ENSURE( false, "Not implemented in this helper" );
172 OUString SAL_CALL
AccessibleTextHelper::getAccessibleName()
173 throw (uno::RuntimeException
)
175 OSL_ENSURE( false, "Not implemented in this helper" );
179 Reference
< XAccessibleRelationSet
> SAL_CALL
AccessibleTextHelper::getAccessibleRelationSet()
180 throw (uno::RuntimeException
)
182 OSL_ENSURE( false, "Not implemented in this helper" );
183 return Reference
< XAccessibleRelationSet
>();
186 Reference
< XAccessibleStateSet
> SAL_CALL
AccessibleTextHelper::getAccessibleStateSet()
187 throw (uno::RuntimeException
)
189 OSL_ENSURE( false, "Not implemented in this helper" );
190 return Reference
< XAccessibleStateSet
>();
193 lang::Locale SAL_CALL
AccessibleTextHelper::getLocale()
194 throw (IllegalAccessibleComponentStateException
,
195 uno::RuntimeException
)
197 OSL_ENSURE( false, "Not implemented in this helper" );
198 return lang::Locale();