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