Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / accessibility / AccessibleSvxFindReplaceDialog.cxx
blob9beb6709cfa8ea51882e4523c7b0daabddd6106b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #include <AccessibleSvxFindReplaceDialog.hxx>
20 #include <svx/srchdlg.hxx>
21 #include <toolkit/awt/vclxwindow.hxx>
22 #include <unotools/accessiblerelationsethelper.hxx>
23 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
24 #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
26 using namespace ::com::sun::star;
27 using namespace ::com::sun::star::uno;
29 VCLXAccessibleSvxFindReplaceDialog::VCLXAccessibleSvxFindReplaceDialog(VCLXWindow* pVCLXindow)
30 :VCLXAccessibleComponent( pVCLXindow )
35 VCLXAccessibleSvxFindReplaceDialog::~VCLXAccessibleSvxFindReplaceDialog()
39 void VCLXAccessibleSvxFindReplaceDialog::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
41 VCLXAccessibleComponent::FillAccessibleRelationSet( rRelationSet );
42 Window* pDlg = GetWindow();
43 if ( pDlg )
45 SvxSearchDialog* pSrchDlg = static_cast<SvxSearchDialog*>( pDlg );
46 Window* pDocWin = pSrchDlg->GetDocWin();
47 if ( !pDocWin )
49 return;
51 Reference < css::accessibility::XAccessible > xDocAcc = pDocWin->GetAccessible();
52 if ( !xDocAcc.is() )
54 return;
56 Reference< css::accessibility::XAccessibleGetAccFlowTo > xGetAccFlowTo( xDocAcc, UNO_QUERY );
57 if ( !xGetAccFlowTo.is() )
59 return;
61 Any aAny;
62 aAny <<= ( pSrchDlg->GetSrchFlag() );
64 const sal_Int32 FORFINDREPLACEFLOWTO = 2;
65 uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->getAccFlowTo( aAny, FORFINDREPLACEFLOWTO );
67 sal_Int32 nLen = aAnySeq.getLength();
68 if ( nLen )
70 uno::Sequence< uno::Reference< uno::XInterface > > aSequence( nLen );
71 for ( sal_Int32 i = 0; i < nLen; i++ )
73 uno::Reference < css::accessibility::XAccessible > xAcc;
74 aAnySeq[i] >>= xAcc;
75 aSequence[i] = xAcc;
77 rRelationSet.AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence ) );
82 // XServiceInfo
85 OUString VCLXAccessibleSvxFindReplaceDialog::getImplementationName() throw (RuntimeException, std::exception)
87 return OUString( "VCLXAccessibleSvxFindReplaceDialog" );
92 Sequence< OUString > VCLXAccessibleSvxFindReplaceDialog::getSupportedServiceNames() throw (RuntimeException, std::exception)
94 Sequence< OUString > aNames(1);
95 aNames[0] = OUString( "VCLXAccessibleSvxFindReplaceDialog" );
96 return aNames;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */