summaryrefslogtreecommitdiff
path: root/goodies
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2004-06-11 08:50:33 +0000
committerKurt Zenker <kz@openoffice.org>2004-06-11 08:50:33 +0000
commitce215acbcbf00ec07d96c9b578e3cde48481a9a5 (patch)
treea23b089cba3cb6bb370c0a694e5944d231b8bae5 /goodies
parent49add99afea43727b9b85249e0d09c5bfdb35b70 (diff)
INTEGRATION: CWS graphicapi (1.1.2); FILE ADDED
2004/05/25 15:50:33 ka 1.1.2.2: implementations 2004/05/19 09:37:16 ka 1.1.2.1: initial revision
Diffstat (limited to 'goodies')
-rwxr-xr-xgoodies/source/unographic/graphicuno.cxx128
1 files changed, 128 insertions, 0 deletions
diff --git a/goodies/source/unographic/graphicuno.cxx b/goodies/source/unographic/graphicuno.cxx
new file mode 100755
index 000000000000..c526f76637cf
--- /dev/null
+++ b/goodies/source/unographic/graphicuno.cxx
@@ -0,0 +1,128 @@
+#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();
+
+ for( int 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( int 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;
+}
+
+}