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 : using namespace ::rtl;
36 :
37 0 : uno::Reference < i18n::XBreakIterator > vcl::unohelper::CreateBreakIterator()
38 : {
39 0 : uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
40 0 : return i18n::BreakIterator::create(xContext);
41 : }
42 :
43 0 : uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacterClassification()
44 : {
45 0 : return i18n::CharacterClassification::create( comphelper::getProcessComponentContext() );
46 : }
47 :
48 2173 : ::rtl::OUString vcl::unohelper::CreateLibraryName( const sal_Char* pModName, sal_Bool bSUPD )
49 : {
50 : // create variable library name suffixes
51 2173 : OUString aDLLSuffix = OUString::createFromAscii( SAL_STRINGIFY( DLLPOSTFIX ) );
52 :
53 2173 : OUString aLibName;
54 :
55 : #if defined( WNT)
56 : aLibName = OUString::createFromAscii( pModName );
57 : if ( bSUPD )
58 : {
59 : aLibName += aDLLSuffix;
60 : }
61 : aLibName += rtl::OUString( ".dll" );
62 : #else
63 2173 : aLibName = OUString( "lib" );
64 2173 : aLibName += OUString::createFromAscii( pModName );
65 2173 : if ( bSUPD )
66 : {
67 2173 : aLibName += aDLLSuffix;
68 : }
69 : #ifdef MACOSX
70 : aLibName += OUString( ".dylib" );
71 : #else
72 2173 : aLibName += OUString( ".so" );
73 : #endif
74 : #endif
75 :
76 2173 : return aLibName;
77 : }
78 :
79 0 : void vcl::unohelper::NotifyAccessibleStateEventGlobally( const ::com::sun::star::accessibility::AccessibleEventObject& rEventObject )
80 : {
81 0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > xExtToolkit( Application::GetVCLToolkit(), uno::UNO_QUERY );
82 0 : if ( xExtToolkit.is() )
83 : {
84 : // Only for focus events
85 0 : sal_Int16 nType = ::com::sun::star::accessibility::AccessibleStateType::INVALID;
86 0 : rEventObject.NewValue >>= nType;
87 0 : if ( nType == ::com::sun::star::accessibility::AccessibleStateType::FOCUSED )
88 0 : xExtToolkit->fireFocusGained( rEventObject.Source );
89 : else
90 : {
91 0 : rEventObject.OldValue >>= nType;
92 0 : if ( nType == ::com::sun::star::accessibility::AccessibleStateType::FOCUSED )
93 0 : xExtToolkit->fireFocusLost( rEventObject.Source );
94 : }
95 :
96 0 : }
97 0 : }
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|