diff options
Diffstat (limited to 'UnoControls/source/base/registercontrols.cxx')
-rw-r--r-- | UnoControls/source/base/registercontrols.cxx | 266 |
1 files changed, 133 insertions, 133 deletions
diff --git a/UnoControls/source/base/registercontrols.cxx b/UnoControls/source/base/registercontrols.cxx index e8f58b8fa7f2..694250ff457b 100644 --- a/UnoControls/source/base/registercontrols.cxx +++ b/UnoControls/source/base/registercontrols.cxx @@ -27,7 +27,7 @@ ************************************************************************/ //______________________________________________________________________________________________________________ -// includes of other projects +// includes of other projects //______________________________________________________________________________________________________________ #include <cppuhelper/factory.hxx> @@ -39,7 +39,7 @@ #include <stdio.h> //______________________________________________________________________________________________________________ -// includes of my own project +// includes of my own project //______________________________________________________________________________________________________________ //============================================================================= @@ -52,7 +52,7 @@ //============================================================================= //______________________________________________________________________________________________________________ -// defines +// defines //______________________________________________________________________________________________________________ // If you will debug macros of this file ... you must define follow constant! @@ -61,169 +61,169 @@ //#define AS_DBG_SWITCH //______________________________________________________________________________________________________________ -// namespaces +// namespaces //______________________________________________________________________________________________________________ -using namespace ::rtl ; -using namespace ::cppu ; -using namespace ::unocontrols ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::container ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::registry ; +using namespace ::rtl ; +using namespace ::cppu ; +using namespace ::unocontrols ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::container ; +using namespace ::com::sun::star::lang ; +using namespace ::com::sun::star::registry ; //______________________________________________________________________________________________________________ -// macros +// macros //______________________________________________________________________________________________________________ //****************************************************************************************************************************** // See AS_DBG_SWITCH below !!! #ifdef AS_DBG_SWITCH - #define AS_DBG_OUT(OUTPUT) printf( OUTPUT ); + #define AS_DBG_OUT(OUTPUT) printf( OUTPUT ); #else #define AS_DBG_OUT(OUTPUT) #endif //****************************************************************************************************************************** -#define CREATEINSTANCE(CLASS) \ +#define CREATEINSTANCE(CLASS) \ \ - static Reference< XInterface > SAL_CALL CLASS##_createInstance ( const Reference< XMultiServiceFactory >& rServiceManager ) throw ( Exception ) \ - { \ - AS_DBG_OUT ( "\tCREATEINSTANCE():\tOK\n" ) \ - return Reference< XInterface >( *(OWeakObject*)(new CLASS( rServiceManager )) ); \ + static Reference< XInterface > SAL_CALL CLASS##_createInstance ( const Reference< XMultiServiceFactory >& rServiceManager ) throw ( Exception ) \ + { \ + AS_DBG_OUT ( "\tCREATEINSTANCE():\tOK\n" ) \ + return Reference< XInterface >( *(OWeakObject*)(new CLASS( rServiceManager )) ); \ } //****************************************************************************************************************************** -#define COMPONENT_INFO(CLASS) \ +#define COMPONENT_INFO(CLASS) \ \ - AS_DBG_OUT ( "\tCOMPONENT_INFO():\t[start]\n" ) \ - try \ - { \ - /* Set default result of follow operations !!! */ \ - bReturn = sal_False ; \ + AS_DBG_OUT ( "\tCOMPONENT_INFO():\t[start]\n" ) \ + try \ + { \ + /* Set default result of follow operations !!! */ \ + bReturn = sal_False ; \ \ - /* Do the follow only, if given key is valid ! */ \ - if ( xKey.is () ) \ - { \ - AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\txkey is valid ...\n" ) \ - /* Build new keyname */ \ - sKeyName = OUString::createFromAscii( "/" ) ; \ - sKeyName += CLASS::impl_getStaticImplementationName() ; \ - sKeyName += OUString::createFromAscii( "/UNO/SERVICES" ); \ + /* Do the follow only, if given key is valid ! */ \ + if ( xKey.is () ) \ + { \ + AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\txkey is valid ...\n" ) \ + /* Build new keyname */ \ + sKeyName = OUString::createFromAscii( "/" ) ; \ + sKeyName += CLASS::impl_getStaticImplementationName() ; \ + sKeyName += OUString::createFromAscii( "/UNO/SERVICES" ); \ \ - /* Create new key with new name. */ \ - xNewKey = xKey->createKey( sKeyName ); \ + /* Create new key with new name. */ \ + xNewKey = xKey->createKey( sKeyName ); \ \ - /* If this new key valid ... */ \ - if ( xNewKey.is () ) \ - { \ - AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\txNewkey is valid ...\n" ) \ - /* Get information about supported services. */ \ - seqServiceNames = CLASS::impl_getStaticSupportedServiceNames() ; \ - pArray = seqServiceNames.getArray() ; \ - nLength = seqServiceNames.getLength() ; \ - nCounter = 0 ; \ + /* If this new key valid ... */ \ + if ( xNewKey.is () ) \ + { \ + AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\txNewkey is valid ...\n" ) \ + /* Get information about supported services. */ \ + seqServiceNames = CLASS::impl_getStaticSupportedServiceNames() ; \ + pArray = seqServiceNames.getArray() ; \ + nLength = seqServiceNames.getLength() ; \ + nCounter = 0 ; \ \ - AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\tloop ..." ) \ - /* Then set this information on this key. */ \ - for ( nCounter = 0; nCounter < nLength; ++nCounter ) \ - { \ - xNewKey->createKey( pArray [nCounter] ); \ - } \ - AS_DBG_OUT ( " OK\n" ) \ + AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\tloop ..." ) \ + /* Then set this information on this key. */ \ + for ( nCounter = 0; nCounter < nLength; ++nCounter ) \ + { \ + xNewKey->createKey( pArray [nCounter] ); \ + } \ + AS_DBG_OUT ( " OK\n" ) \ \ - /* Result of this operations = OK. */ \ - bReturn = sal_True ; \ - } \ - AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\t... leave xNewKey\n" ) \ - } \ - AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\t... leave xKey\n" ) \ - } \ - catch( InvalidRegistryException& ) \ - { \ - AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\tInvalidRegistryException detected!!!\n" ) \ - bReturn = sal_False ; \ - } \ + /* Result of this operations = OK. */ \ + bReturn = sal_True ; \ + } \ + AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\t... leave xNewKey\n" ) \ + } \ + AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\t... leave xKey\n" ) \ + } \ + catch( InvalidRegistryException& ) \ + { \ + AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\tInvalidRegistryException detected!!!\n" ) \ + bReturn = sal_False ; \ + } \ AS_DBG_OUT ( "\tCOMPONENT_INFO():\t[end]\n" ) //****************************************************************************************************************************** -#define CREATEFACTORY_ONEINSTANCE(CLASS) \ +#define CREATEFACTORY_ONEINSTANCE(CLASS) \ \ - AS_DBG_OUT ( "\tCREATEFACTORY_ONEINSTANCE():\t[start]\n" ) \ - /* Create right factory ... */ \ - xFactory = Reference< XSingleServiceFactory > \ - ( \ - cppu::createOneInstanceFactory ( xServiceManager , \ - CLASS::impl_getStaticImplementationName () , \ - CLASS##_createInstance , \ - CLASS::impl_getStaticSupportedServiceNames () ) \ - ) ; \ + AS_DBG_OUT ( "\tCREATEFACTORY_ONEINSTANCE():\t[start]\n" ) \ + /* Create right factory ... */ \ + xFactory = Reference< XSingleServiceFactory > \ + ( \ + cppu::createOneInstanceFactory ( xServiceManager , \ + CLASS::impl_getStaticImplementationName () , \ + CLASS##_createInstance , \ + CLASS::impl_getStaticSupportedServiceNames () ) \ + ) ; \ AS_DBG_OUT ( "\tCREATEFACTORY_ONEINSTANCE():\t[end]\n" ) //****************************************************************************************************************************** -#define CREATEFACTORY_SINGLE(CLASS) \ +#define CREATEFACTORY_SINGLE(CLASS) \ \ - AS_DBG_OUT ( "\tCREATEFACTORY_SINGLE():\t[start]\n" ) \ - /* Create right factory ... */ \ - xFactory = Reference< XSingleServiceFactory > \ - ( \ - cppu::createSingleFactory ( xServiceManager , \ - CLASS::impl_getStaticImplementationName () , \ - CLASS##_createInstance , \ - CLASS::impl_getStaticSupportedServiceNames () ) \ - ) ; \ + AS_DBG_OUT ( "\tCREATEFACTORY_SINGLE():\t[start]\n" ) \ + /* Create right factory ... */ \ + xFactory = Reference< XSingleServiceFactory > \ + ( \ + cppu::createSingleFactory ( xServiceManager , \ + CLASS::impl_getStaticImplementationName () , \ + CLASS##_createInstance , \ + CLASS::impl_getStaticSupportedServiceNames () ) \ + ) ; \ AS_DBG_OUT ( "\tCREATEFACTORY_SINGLE():\t[end]\n" ) //****************************************************************************************************************************** -#define IF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE(CLASS) \ +#define IF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE(CLASS) \ \ - if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \ - { \ - AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE():\timplementationname found\n" ) \ - CREATEFACTORY_ONEINSTANCE ( CLASS ) \ + if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \ + { \ + AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE():\timplementationname found\n" ) \ + CREATEFACTORY_ONEINSTANCE ( CLASS ) \ } //****************************************************************************************************************************** -#define IF_NAME_CREATECOMPONENTFACTORY_SINGLE(CLASS) \ +#define IF_NAME_CREATECOMPONENTFACTORY_SINGLE(CLASS) \ \ - if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \ - { \ - AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_SINGLE():\timplementationname found\n" ) \ - CREATEFACTORY_SINGLE ( CLASS ) \ + if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \ + { \ + AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_SINGLE():\timplementationname found\n" ) \ + CREATEFACTORY_SINGLE ( CLASS ) \ } //______________________________________________________________________________________________________________ -// declare functions to create a new instance of service +// declare functions to create a new instance of service //______________________________________________________________________________________________________________ //============================================================================= // Add new macro line to use new services. // -// !!! ATTENTION !!! -// Write no ";" at end of line! (see macro) +// !!! ATTENTION !!! +// Write no ";" at end of line! (see macro) //============================================================================= -CREATEINSTANCE ( FrameControl ) -CREATEINSTANCE ( ProgressBar ) -CREATEINSTANCE ( ProgressMonitor ) -CREATEINSTANCE ( StatusIndicator ) +CREATEINSTANCE ( FrameControl ) +CREATEINSTANCE ( ProgressBar ) +CREATEINSTANCE ( ProgressMonitor ) +CREATEINSTANCE ( StatusIndicator ) //============================================================================= //______________________________________________________________________________________________________________ -// return environment +// return environment //______________________________________________________________________________________________________________ -extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName , - uno_Environment** /*ppEnvironment*/ ) +extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName , + uno_Environment** /*ppEnvironment*/ ) { *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; } //______________________________________________________________________________________________________________ -// write component info to registry +// write component info to registry //______________________________________________________________________________________________________________ -extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/ , - void* pRegistryKey ) +extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/ , + void* pRegistryKey ) { AS_DBG_OUT ( "component_writeInfo():\t[start]\n" ) @@ -236,24 +236,24 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/ // Define variables for following macros! // bReturn is set automaticly. - Reference< XRegistryKey > xKey( reinterpret_cast< XRegistryKey* >( pRegistryKey ) ) ; - Reference< XRegistryKey > xNewKey ; - Sequence< OUString > seqServiceNames ; - const OUString* pArray ; - sal_Int32 nLength ; - sal_Int32 nCounter ; - OUString sKeyName ; + Reference< XRegistryKey > xKey( reinterpret_cast< XRegistryKey* >( pRegistryKey ) ) ; + Reference< XRegistryKey > xNewKey ; + Sequence< OUString > seqServiceNames ; + const OUString* pArray ; + sal_Int32 nLength ; + sal_Int32 nCounter ; + OUString sKeyName ; //============================================================================= // Add new macro line to register new services. // - // !!! ATTENTION !!! - // Write no ";" at end of line! (see macro) + // !!! ATTENTION !!! + // Write no ";" at end of line! (see macro) //============================================================================= - COMPONENT_INFO ( FrameControl ) - COMPONENT_INFO ( ProgressBar ) - COMPONENT_INFO ( ProgressMonitor ) - COMPONENT_INFO ( StatusIndicator ) + COMPONENT_INFO ( FrameControl ) + COMPONENT_INFO ( ProgressBar ) + COMPONENT_INFO ( ProgressMonitor ) + COMPONENT_INFO ( StatusIndicator ) //============================================================================= AS_DBG_OUT ( "component_writeInfo():\t\t... leave pRegistryKey scope\n" ) @@ -266,42 +266,42 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/ } //______________________________________________________________________________________________________________ -// create right component factory +// create right component factory //______________________________________________________________________________________________________________ -extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplementationName , - void* pServiceManager , - void* /*pRegistryKey*/ ) +extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplementationName , + void* pServiceManager , + void* /*pRegistryKey*/ ) { AS_DBG_OUT( "component_getFactory():\t[start]\n" ) // Set default return value for this operation - if it failed. void* pReturn = NULL ; - if ( - ( pImplementationName != NULL ) && - ( pServiceManager != NULL ) + if ( + ( pImplementationName != NULL ) && + ( pServiceManager != NULL ) ) { AS_DBG_OUT( "component_getFactory():\t\t... enter scope - pointer are valid\n" ) // Define variables which are used in following macros. - Reference< XSingleServiceFactory > xFactory ; - Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; + Reference< XSingleServiceFactory > xFactory ; + Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; //============================================================================= // Add new macro line to handle new service. // - // !!! ATTENTION !!! - // Write no ";" at end of line and dont forget "else" ! (see macro) + // !!! ATTENTION !!! + // Write no ";" at end of line and dont forget "else" ! (see macro) //============================================================================= - IF_NAME_CREATECOMPONENTFACTORY_SINGLE( FrameControl ) + IF_NAME_CREATECOMPONENTFACTORY_SINGLE( FrameControl ) else - IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressBar ) + IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressBar ) else - IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressMonitor ) + IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressMonitor ) else - IF_NAME_CREATECOMPONENTFACTORY_SINGLE( StatusIndicator ) + IF_NAME_CREATECOMPONENTFACTORY_SINGLE( StatusIndicator ) //============================================================================= // Factory is valid - service was found. |