1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#include <cppuhelper/factory.hxx>
#include <uno/mapping.hxx>
#include "provider.hxx"
#include "renderer.hxx"
#include <com/sun/star/registry/XRegistryKey.hpp>
using namespace com::sun::star;
namespace unographic {
// --------------------
// - *_createInstance -
// --------------------
static uno::Reference< uno::XInterface > SAL_CALL GraphicProvider_createInstance( const uno::Reference< lang::XMultiServiceFactory >& rxManager)
{
return SAL_STATIC_CAST( ::cppu::OWeakObject*, new GraphicProvider );
}
// -----------------------------------------------------------------------------
static uno::Reference< uno::XInterface > SAL_CALL GraphicRendererVCL_createInstance( const uno::Reference< lang::XMultiServiceFactory >& rxManager)
{
return SAL_STATIC_CAST( ::cppu::OWeakObject*, new GraphicRendererVCL );
}
// ------------------------------------------
// - component_getImplementationEnvironment -
// ------------------------------------------
extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ppEnv )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
// -----------------------
// - component_writeInfo -
// -----------------------
extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
{
sal_Bool bRet = sal_False;
if( pRegistryKey )
{
try
{
uno::Reference< registry::XRegistryKey > xNewKey;
uno::Sequence< ::rtl::OUString > aServices;
// GraphicProvider
xNewKey = reinterpret_cast< registry::XRegistryKey * >( pRegistryKey )->createKey(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) +
GraphicProvider::getImplementationName_Static() +
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
aServices = GraphicProvider::getSupportedServiceNames_Static();
int i;
for( i = 0; i < aServices.getLength(); i++ )
xNewKey->createKey( aServices.getConstArray()[ i ] );
// GraphicRendererVCL
xNewKey = reinterpret_cast< registry::XRegistryKey * >( pRegistryKey )->createKey(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) +
GraphicRendererVCL::getImplementationName_Static() +
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
aServices = ( GraphicRendererVCL::getSupportedServiceNames_Static() );
for( i = 0; i < aServices.getLength(); i++ )
xNewKey->createKey( aServices.getConstArray()[ i ] );
bRet = true;
}
catch (registry::InvalidRegistryException &)
{
OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
}
}
return bRet;
}
// ------------------------
// - component_getFactory -
// ------------------------
extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
{
void * pRet = 0;
if( pServiceManager && ( 0 == GraphicProvider::getImplementationName_Static().compareToAscii( pImplName ) ) )
{
uno::Reference< lang::XSingleServiceFactory > xFactory( ::cppu::createOneInstanceFactory(
reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
GraphicProvider::getImplementationName_Static(),
GraphicProvider_createInstance,
GraphicProvider::getSupportedServiceNames_Static() ) );
if( xFactory.is())
{
xFactory->acquire();
pRet = xFactory.get();
}
}
else if( pServiceManager && ( 0 == GraphicRendererVCL::getImplementationName_Static().compareToAscii( pImplName ) ) )
{
uno::Reference< lang::XSingleServiceFactory > xFactory( ::cppu::createOneInstanceFactory(
reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
GraphicRendererVCL::getImplementationName_Static(),
GraphicRendererVCL_createInstance,
GraphicRendererVCL::getSupportedServiceNames_Static() ) );
if( xFactory.is())
{
xFactory->acquire();
pRet = xFactory.get();
}
}
return pRet;
}
}
|