Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <cppuhelper/implementationentry.hxx>
30 : : #include <rtl/ustrbuf.hxx>
31 : :
32 : : using namespace ::rtl;
33 : : using namespace ::com::sun::star::uno;
34 : : using namespace ::com::sun::star::lang;
35 : : using namespace ::com::sun::star::registry;
36 : :
37 : : namespace cppu {
38 : :
39 : 0 : sal_Bool component_writeInfoHelper(
40 : : SAL_UNUSED_PARAMETER void *, void * pRegistryKey,
41 : : ImplementationEntry const * entries)
42 : : {
43 : 0 : sal_Bool bRet = sal_False;
44 : : try
45 : : {
46 [ # # ]: 0 : if( pRegistryKey )
47 : : {
48 [ # # ]: 0 : for( sal_Int32 i = 0; entries[i].create ; i ++ )
49 : : {
50 : 0 : OUStringBuffer buf( 124 );
51 [ # # ]: 0 : buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("/") );
52 [ # # ][ # # ]: 0 : buf.append( entries[i].getImplementationName() );
53 [ # # ]: 0 : buf.appendAscii(RTL_CONSTASCII_STRINGPARAM( "/UNO/SERVICES" ) );
54 : : Reference< XRegistryKey > xNewKey(
55 [ # # ][ # # ]: 0 : reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( buf.makeStringAndClear() ) );
56 : :
57 [ # # ]: 0 : Sequence< OUString > seq = entries[i].getSupportedServiceNames();
58 : 0 : const OUString *pArray = seq.getConstArray();
59 [ # # ]: 0 : for ( sal_Int32 nPos = 0 ; nPos < seq.getLength(); nPos ++ )
60 [ # # ][ # # ]: 0 : xNewKey->createKey( pArray[nPos] );
61 [ # # ][ # # ]: 0 : }
62 : 0 : bRet = sal_True;
63 : : }
64 : : }
65 : 0 : catch ( InvalidRegistryException & )
66 : : {
67 : : OSL_FAIL( "### InvalidRegistryException!" );
68 : : }
69 : 0 : return bRet;
70 : : }
71 : :
72 : :
73 : 13666 : void * component_getFactoryHelper(
74 : : char const * pImplName, SAL_UNUSED_PARAMETER void *,
75 : : SAL_UNUSED_PARAMETER void *, ImplementationEntry const * entries)
76 : : {
77 : :
78 : 13666 : void * pRet = 0;
79 : 13666 : Reference< XSingleComponentFactory > xFactory;
80 : :
81 [ + + ]: 141222 : for( sal_Int32 i = 0 ; entries[i].create ; i ++ )
82 : : {
83 [ + - ]: 127556 : OUString implName = entries[i].getImplementationName();
84 [ + + ]: 127556 : if( 0 == implName.compareToAscii( pImplName ) )
85 : : {
86 : 13527 : xFactory = entries[i].createFactory(
87 : 13527 : entries[i].create,
88 : : implName,
89 : 13527 : entries[i].getSupportedServiceNames(),
90 [ + - ][ + - ]: 13527 : entries[i].moduleCounter );
[ + - ][ + - ]
91 : : }
92 : 127556 : }
93 : :
94 [ + + ]: 13666 : if( xFactory.is() )
95 : : {
96 [ + - ]: 13527 : xFactory->acquire();
97 [ + - ]: 13527 : pRet = xFactory.get();
98 : : }
99 : 13666 : return pRet;
100 : : }
101 : :
102 : : }
103 : :
104 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|