From 6f1b7138d148828ad3f5d3f9214f02aaab770902 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 28 Nov 2003 16:54:54 +0000 Subject: #112923# place ole and ooo objects in separate libraries --- embeddedobj/source/commonembedding/makefile.mk | 6 +- embeddedobj/source/commonembedding/register.cxx | 8 +- embeddedobj/source/general/makefile.mk | 6 +- embeddedobj/source/inc/xcreator.hxx | 8 +- embeddedobj/source/msole/makefile.mk | 6 +- embeddedobj/source/msole/oleregister.cxx | 139 ++++++++++++++++++++++++ 6 files changed, 157 insertions(+), 16 deletions(-) create mode 100644 embeddedobj/source/msole/oleregister.cxx (limited to 'embeddedobj/source') diff --git a/embeddedobj/source/commonembedding/makefile.mk b/embeddedobj/source/commonembedding/makefile.mk index a1ef1c1d70b3..07e2c2908aec 100644 --- a/embeddedobj/source/commonembedding/makefile.mk +++ b/embeddedobj/source/commonembedding/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: mav $ $Date: 2003-11-28 17:25:22 $ +# last change: $Author: mav $ $Date: 2003-11-28 17:54:16 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -76,6 +76,7 @@ USE_DEFFILE=NO # --- Files -------------------------------------------------------- SLOFILES = \ + $(SLO)$/register.obj\ $(SLO)$/xfactory.obj\ $(SLO)$/miscobj.obj\ $(SLO)$/persistence.obj\ @@ -84,6 +85,7 @@ SLOFILES = \ EXCEPTIONSFILES= \ + $(SLO)$/register.obj\ $(SLO)$/xfactory.obj\ $(SLO)$/miscobj.obj\ $(SLO)$/persistence.obj\ diff --git a/embeddedobj/source/commonembedding/register.cxx b/embeddedobj/source/commonembedding/register.cxx index 4b087183d65d..764316d0ec4e 100644 --- a/embeddedobj/source/commonembedding/register.cxx +++ b/embeddedobj/source/commonembedding/register.cxx @@ -2,9 +2,9 @@ * * $RCSfile: register.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mav $ $Date: 2003-11-28 17:47:54 $ + * last change: $Author: mav $ $Date: 2003-11-28 17:54:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -132,7 +132,7 @@ sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryK OOoEmbeddedObjectFactory::impl_staticGetImplementationName() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); - uno::Sequence< ::rtl::OUString > &rServices = OOoEmbeddedObjectFactory::impl_staticGetSupportedServiceNames(); + uno::Sequence< ::rtl::OUString > rServices = OOoEmbeddedObjectFactory::impl_staticGetSupportedServiceNames(); for( sal_Int32 ind = 0; ind < rServices.getLength(); ind++ ) xNewKey->createKey( rServices.getConstArray()[ind] ); @@ -141,7 +141,7 @@ sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryK UNOEmbeddedObjectCreator::impl_staticGetImplementationName() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); - uno::Sequence< ::rtl::OUString > &rServices = UNOEmbeddedObjectCreator::impl_staticGetSupportedServiceNames(); + rServices = UNOEmbeddedObjectCreator::impl_staticGetSupportedServiceNames(); for( sal_Int32 ind = 0; ind < rServices.getLength(); ind++ ) xNewKey->createKey( rServices.getConstArray()[ind] ); diff --git a/embeddedobj/source/general/makefile.mk b/embeddedobj/source/general/makefile.mk index 020a22eeaae6..ab0bf60fc9cc 100644 --- a/embeddedobj/source/general/makefile.mk +++ b/embeddedobj/source/general/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: mav $ $Date: 2003-11-28 17:25:22 $ +# last change: $Author: mav $ $Date: 2003-11-28 17:54:17 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -77,7 +77,6 @@ USE_DEFFILE=NO SLOFILES = \ $(SLO)$/xcreator.obj\ - $(SLO)$/register.obj\ $(SLO)$/convert.obj\ $(SLO)$/closepreventer.obj\ $(SLO)$/docholder.obj\ @@ -86,7 +85,6 @@ SLOFILES = \ EXCEPTIONSFILES= \ $(SLO)$/xcreator.obj\ - $(SLO)$/register.obj\ $(SLO)$/convert.obj\ $(SLO)$/closepreventer.obj\ $(SLO)$/docholder.obj\ diff --git a/embeddedobj/source/inc/xcreator.hxx b/embeddedobj/source/inc/xcreator.hxx index fb856334d08e..9c0e556dad3b 100644 --- a/embeddedobj/source/inc/xcreator.hxx +++ b/embeddedobj/source/inc/xcreator.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xcreator.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mav $ $Date: 2003-11-28 17:48:19 $ + * last change: $Author: mav $ $Date: 2003-11-28 17:54:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,8 +59,8 @@ * ************************************************************************/ -#ifndef __XFACTORY_HXX_ -#define __XFACTORY_HXX_ +#ifndef __XCREATOR_HXX_ +#define __XCREATOR_HXX_ #ifndef _COM_SUN_STAR_EMBED_XEMBEDOBJECTCREATOR_HPP_ #include diff --git a/embeddedobj/source/msole/makefile.mk b/embeddedobj/source/msole/makefile.mk index e525cdf20aa7..6b849ec4a342 100644 --- a/embeddedobj/source/msole/makefile.mk +++ b/embeddedobj/source/msole/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: mav $ $Date: 2003-11-28 17:25:23 $ +# last change: $Author: mav $ $Date: 2003-11-28 17:54:18 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -77,6 +77,7 @@ INCPRE+=$(ATL_INCLUDE) # --- Files -------------------------------------------------------- SLOFILES = \ + $(SLO)$/oleregister.obj\ $(SLO)$/xolefactory.obj\ $(SLO)$/olecomponent.obj\ $(SLO)$/olepersist.obj\ @@ -88,6 +89,7 @@ SLOFILES = \ EXCEPTIONSFILES= \ + $(SLO)$/oleregister.obj\ $(SLO)$/xolefactory.obj\ $(SLO)$/olecomponent.obj\ $(SLO)$/olepersist.obj\ diff --git a/embeddedobj/source/msole/oleregister.cxx b/embeddedobj/source/msole/oleregister.cxx new file mode 100644 index 000000000000..22f8dddfa5f3 --- /dev/null +++ b/embeddedobj/source/msole/oleregister.cxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * $RCSfile: oleregister.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mav $ $Date: 2003-11-28 17:54:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_REGISTRY_INVALIDREGISTRYEXCEPTION_HPP_ +#include +#endif + +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include +#endif + +#include "xolefactory.hxx" + +using namespace ::com::sun::star; + + +extern "C" { + +void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) +{ + void * pRet = 0; + + ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) ); + uno::Reference< lang::XSingleServiceFactory > xFactory; + + if ( pServiceManager && aImplName.equals( OleEmbeddedObjectFactory::impl_staticGetImplementationName() ) ) + { + xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ), + OleEmbeddedObjectFactory::impl_staticGetImplementationName(), + OleEmbeddedObjectFactory::impl_staticCreateSelfInstance, + OleEmbeddedObjectFactory::impl_staticGetSupportedServiceNames() ); + } + + if ( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; +} + +sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) +{ + if (pRegistryKey) + { + try + { + uno::Reference< registry::XRegistryKey > xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) ); + + uno::Reference< registry::XRegistryKey > xNewKey; + + xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + + OleEmbeddedObjectFactory::impl_staticGetImplementationName() + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); + + uno::Sequence< ::rtl::OUString > rServices = OleEmbeddedObjectFactory::impl_staticGetSupportedServiceNames(); + for( sal_Int32 ind = 0; ind < rServices.getLength(); ind++ ) + xNewKey->createKey( rServices.getConstArray()[ind] ); + + return sal_True; + } + catch (registry::InvalidRegistryException &) + { + OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + } + } + return sal_False; +} + +} // extern "C" + -- cgit