Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <vcl/svapp.hxx>
21 : #include <vcl/unohelp.hxx>
22 :
23 : #include <svdata.hxx>
24 :
25 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 : #include <comphelper/processfactory.hxx>
27 :
28 : #include <com/sun/star/i18n/BreakIterator.hpp>
29 : #include <com/sun/star/i18n/CharacterClassification.hpp>
30 : #include <com/sun/star/awt/XExtendedToolkit.hpp>
31 : #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
32 : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
33 :
34 : using namespace ::com::sun::star;
35 :
36 3896 : uno::Reference < i18n::XBreakIterator > vcl::unohelper::CreateBreakIterator()
37 : {
38 3896 : uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
39 3896 : return i18n::BreakIterator::create(xContext);
40 : }
41 :
42 7941 : uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacterClassification()
43 : {
44 7941 : return i18n::CharacterClassification::create( comphelper::getProcessComponentContext() );
45 : }
46 :
47 24 : void vcl::unohelper::NotifyAccessibleStateEventGlobally( const ::com::sun::star::accessibility::AccessibleEventObject& rEventObject )
48 : {
49 24 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > xExtToolkit( Application::GetVCLToolkit(), uno::UNO_QUERY );
50 24 : if ( xExtToolkit.is() )
51 : {
52 : // Only for focus events
53 24 : sal_Int16 nType = ::com::sun::star::accessibility::AccessibleStateType::INVALID;
54 24 : rEventObject.NewValue >>= nType;
55 24 : if ( nType == ::com::sun::star::accessibility::AccessibleStateType::FOCUSED )
56 0 : xExtToolkit->fireFocusGained( rEventObject.Source );
57 : else
58 : {
59 24 : rEventObject.OldValue >>= nType;
60 24 : if ( nType == ::com::sun::star::accessibility::AccessibleStateType::FOCUSED )
61 10 : xExtToolkit->fireFocusLost( rEventObject.Source );
62 : }
63 :
64 24 : }
65 24 : }
66 :
67 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|