1*9b8096d0SSteve Yin /**************************************************************
2*9b8096d0SSteve Yin  *
3*9b8096d0SSteve Yin  * Licensed to the Apache Software Foundation (ASF) under one
4*9b8096d0SSteve Yin  * or more contributor license agreements.  See the NOTICE file
5*9b8096d0SSteve Yin  * distributed with this work for additional information
6*9b8096d0SSteve Yin  * regarding copyright ownership.  The ASF licenses this file
7*9b8096d0SSteve Yin  * to you under the Apache License, Version 2.0 (the
8*9b8096d0SSteve Yin  * "License"); you may not use this file except in compliance
9*9b8096d0SSteve Yin  * with the License.  You may obtain a copy of the License at
10*9b8096d0SSteve Yin  *
11*9b8096d0SSteve Yin  *   http://www.apache.org/licenses/LICENSE-2.0
12*9b8096d0SSteve Yin  *
13*9b8096d0SSteve Yin  * Unless required by applicable law or agreed to in writing,
14*9b8096d0SSteve Yin  * software distributed under the License is distributed on an
15*9b8096d0SSteve Yin  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b8096d0SSteve Yin  * KIND, either express or implied.  See the License for the
17*9b8096d0SSteve Yin  * specific language governing permissions and limitations
18*9b8096d0SSteve Yin  * under the License.
19*9b8096d0SSteve Yin  *
20*9b8096d0SSteve Yin  *************************************************************/
21*9b8096d0SSteve Yin 
22*9b8096d0SSteve Yin 
23*9b8096d0SSteve Yin // MARKER(update_precomp.py): autogen include statement, do not remove
24*9b8096d0SSteve Yin #include "precompiled_svx.hxx"
25*9b8096d0SSteve Yin 
26*9b8096d0SSteve Yin #include <svx/AccessibleSvxFindReplaceDialog.hxx>
27*9b8096d0SSteve Yin 
28*9b8096d0SSteve Yin 
29*9b8096d0SSteve Yin #ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
30*9b8096d0SSteve Yin #include "toolkit/awt/vclxwindow.hxx"
31*9b8096d0SSteve Yin #endif
32*9b8096d0SSteve Yin 
33*9b8096d0SSteve Yin #ifndef _SVX_SRCHDLG_HXX
34*9b8096d0SSteve Yin #include <svx/srchdlg.hxx>
35*9b8096d0SSteve Yin #endif
36*9b8096d0SSteve Yin 
37*9b8096d0SSteve Yin #ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
38*9b8096d0SSteve Yin #include <unotools/accessiblerelationsethelper.hxx>
39*9b8096d0SSteve Yin #endif
40*9b8096d0SSteve Yin 
41*9b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
42*9b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
43*9b8096d0SSteve Yin #endif
44*9b8096d0SSteve Yin 
45*9b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_
46*9b8096d0SSteve Yin #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
47*9b8096d0SSteve Yin #endif
48*9b8096d0SSteve Yin 
49*9b8096d0SSteve Yin using namespace ::com::sun::star;
50*9b8096d0SSteve Yin using namespace ::com::sun::star::uno;
51*9b8096d0SSteve Yin 
VCLXAccessibleSvxFindReplaceDialog(VCLXWindow * pVCLXindow)52*9b8096d0SSteve Yin VCLXAccessibleSvxFindReplaceDialog::VCLXAccessibleSvxFindReplaceDialog(VCLXWindow* pVCLXindow)
53*9b8096d0SSteve Yin 	:VCLXAccessibleComponent( pVCLXindow )
54*9b8096d0SSteve Yin {
55*9b8096d0SSteve Yin 
56*9b8096d0SSteve Yin }
57*9b8096d0SSteve Yin 
~VCLXAccessibleSvxFindReplaceDialog()58*9b8096d0SSteve Yin VCLXAccessibleSvxFindReplaceDialog::~VCLXAccessibleSvxFindReplaceDialog()
59*9b8096d0SSteve Yin {
60*9b8096d0SSteve Yin }
61*9b8096d0SSteve Yin 
FillAccessibleRelationSet(utl::AccessibleRelationSetHelper & rRelationSet)62*9b8096d0SSteve Yin void VCLXAccessibleSvxFindReplaceDialog::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
63*9b8096d0SSteve Yin {
64*9b8096d0SSteve Yin 	VCLXAccessibleComponent::FillAccessibleRelationSet( rRelationSet );
65*9b8096d0SSteve Yin 	Window* pDlg = GetWindow();
66*9b8096d0SSteve Yin 	if ( pDlg )
67*9b8096d0SSteve Yin 	{
68*9b8096d0SSteve Yin 		SvxSearchDialog* pSrchDlg = static_cast<SvxSearchDialog*>( pDlg );
69*9b8096d0SSteve Yin 		Window* pDocWin = pSrchDlg->GetDocWin();
70*9b8096d0SSteve Yin 		if ( !pDocWin )
71*9b8096d0SSteve Yin 		{
72*9b8096d0SSteve Yin 			return;
73*9b8096d0SSteve Yin 		}
74*9b8096d0SSteve Yin 		Reference < accessibility::XAccessible > xDocAcc = pDocWin->GetAccessible();
75*9b8096d0SSteve Yin 		if ( !xDocAcc.is() )
76*9b8096d0SSteve Yin 		{
77*9b8096d0SSteve Yin 			return;
78*9b8096d0SSteve Yin 		}
79*9b8096d0SSteve Yin 		Reference< accessibility::XAccessibleGetAccFlowTo > xGetAccFlowTo( xDocAcc, UNO_QUERY );
80*9b8096d0SSteve Yin 		if ( !xGetAccFlowTo.is() )
81*9b8096d0SSteve Yin 		{
82*9b8096d0SSteve Yin 			return;
83*9b8096d0SSteve Yin 		}
84*9b8096d0SSteve Yin 		Any aAny;
85*9b8096d0SSteve Yin 		aAny <<= ( pSrchDlg->GetSrchFlag() );
86*9b8096d0SSteve Yin 
87*9b8096d0SSteve Yin 		const sal_Int32 FORFINDREPLACEFLOWTO = 2;
88*9b8096d0SSteve Yin 		uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->get_AccFlowTo( aAny,  FORFINDREPLACEFLOWTO );
89*9b8096d0SSteve Yin 
90*9b8096d0SSteve Yin 		sal_Int32 nLen = aAnySeq.getLength();
91*9b8096d0SSteve Yin 		if ( nLen )
92*9b8096d0SSteve Yin 		{
93*9b8096d0SSteve Yin 			uno::Sequence< uno::Reference< uno::XInterface > > aSequence( nLen );
94*9b8096d0SSteve Yin 			for ( sal_Int32 i = 0; i < nLen; i++ )
95*9b8096d0SSteve Yin 			{
96*9b8096d0SSteve Yin 				uno::Reference < accessibility::XAccessible > xAcc;
97*9b8096d0SSteve Yin 				aAnySeq[i] >>= xAcc;
98*9b8096d0SSteve Yin 				aSequence[i] = xAcc;
99*9b8096d0SSteve Yin 			}
100*9b8096d0SSteve Yin 			rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence ) );
101*9b8096d0SSteve Yin 		}
102*9b8096d0SSteve Yin 	}
103*9b8096d0SSteve Yin }
104*9b8096d0SSteve Yin // -----------------------------------------------------------------------------
105*9b8096d0SSteve Yin // XServiceInfo
106*9b8096d0SSteve Yin // -----------------------------------------------------------------------------
107*9b8096d0SSteve Yin 
getImplementationName()108*9b8096d0SSteve Yin ::rtl::OUString VCLXAccessibleSvxFindReplaceDialog::getImplementationName() throw (RuntimeException)
109*9b8096d0SSteve Yin {
110*9b8096d0SSteve Yin 	return ::rtl::OUString::createFromAscii( "VCLXAccessibleSvxFindReplaceDialog" );
111*9b8096d0SSteve Yin }
112*9b8096d0SSteve Yin 
113*9b8096d0SSteve Yin // -----------------------------------------------------------------------------
114*9b8096d0SSteve Yin 
getSupportedServiceNames()115*9b8096d0SSteve Yin Sequence< ::rtl::OUString > VCLXAccessibleSvxFindReplaceDialog::getSupportedServiceNames() throw (RuntimeException)
116*9b8096d0SSteve Yin {
117*9b8096d0SSteve Yin 	Sequence< ::rtl::OUString > aNames(1);
118*9b8096d0SSteve Yin 	aNames[0] = ::rtl::OUString::createFromAscii( "VCLXAccessibleSvxFindReplaceDialog" );
119*9b8096d0SSteve Yin 	return aNames;
120*9b8096d0SSteve Yin }
121