summaryrefslogtreecommitdiff
path: root/vcl/source/components/factory.cxx
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2006-10-06 08:58:32 +0000
committerKurt Zenker <kz@openoffice.org>2006-10-06 08:58:32 +0000
commite30cb338d0afe76205fd1b637f1dd42b7a1a749b (patch)
tree117d7aba5842f3777a68e8eebd3f3e96f98193dd /vcl/source/components/factory.cxx
parent6fe2c8741a9aa4839cfd3070aaa0b0fd3ebd08de (diff)
INTEGRATION: CWS impresshydra (1.1.2); FILE ADDED
2006/09/04 16:25:04 pl 1.1.2.2: #i67721# display service not win only anymore 2006/07/19 15:54:15 cl 1.1.2.1: #i12719# added support for multi monitor
Diffstat (limited to 'vcl/source/components/factory.cxx')
-rw-r--r--vcl/source/components/factory.cxx156
1 files changed, 156 insertions, 0 deletions
diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx
new file mode 100644
index 000000000000..5e574fc2892a
--- /dev/null
+++ b/vcl/source/components/factory.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: factory.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: kz $ $Date: 2006-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 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
+ *
+ ************************************************************************/
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _OSL_MUTEX_HXX
+#include <osl/mutex.hxx>
+#endif
+#ifndef _RTL_USTRBUF_HXX
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _UNO_DISPATCHER_H_
+#include <uno/dispatcher.h> // declaration of generic uno interface
+#endif
+#ifndef _UNO_MAPPING_HXX_
+#include <uno/mapping.hxx> // mapping stuff
+#endif
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#ifndef _VCL_DLLAPI_H
+#include "dllapi.h"
+#endif
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+
+
+// service implementation
+
+extern Sequence< OUString > SAL_CALL vcl_session_getSupportedServiceNames();
+extern OUString SAL_CALL vcl_session_getImplementationName();
+extern Reference< XInterface > SAL_CALL vcl_session_createInstance( const Reference< XMultiServiceFactory > & );
+
+namespace vcl
+{
+extern Sequence< OUString > SAL_CALL DisplayAccess_getSupportedServiceNames();
+extern OUString SAL_CALL DisplayAccess_getImplementationName();
+extern Reference< XInterface > SAL_CALL DisplayAccess_createInstance( const Reference< XMultiServiceFactory > & );
+}
+
+extern "C" {
+
+ VCL_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char** ppEnvTypeName,
+ uno_Environment** /*ppEnv*/ )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ VCL_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pXUnoKey )
+ {
+ if( pXUnoKey )
+ {
+ try
+ {
+ Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pXUnoKey ) );
+
+ OUStringBuffer aImplName = OUString::createFromAscii( "/" );
+ aImplName.append( vcl_session_getImplementationName() );
+ aImplName.appendAscii( "/UNO/SERVICES/" );
+ aImplName.append( vcl_session_getSupportedServiceNames()[0] );
+ xKey->createKey( aImplName.makeStringAndClear() );
+
+ aImplName = OUString::createFromAscii( "/" );
+ aImplName.append( vcl::DisplayAccess_getImplementationName() );
+ aImplName.appendAscii( "/UNO/SERVICES/" );
+ aImplName.append( vcl::DisplayAccess_getSupportedServiceNames()[0] );
+ xKey->createKey( aImplName.makeStringAndClear() );
+
+ return sal_True;
+ }
+ catch( ::com::sun::star::registry::InvalidRegistryException& )
+ {
+ }
+ }
+ return sal_False;
+ }
+
+ VCL_DLLPUBLIC void* SAL_CALL component_getFactory(
+ const sal_Char* pImplementationName,
+ void* pXUnoSMgr,
+ void* /*pXUnoKey*/
+ )
+ {
+ void* pRet = 0;
+
+ if( pXUnoSMgr )
+ {
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr(
+ reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr )
+ );
+ Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory;
+ if( vcl_session_getImplementationName().equalsAscii( pImplementationName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ xMgr, vcl_session_getImplementationName(), vcl_session_createInstance,
+ vcl_session_getSupportedServiceNames() );
+ }
+ else if( vcl::DisplayAccess_getImplementationName().equalsAscii( pImplementationName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ xMgr, vcl::DisplayAccess_getImplementationName(), vcl::DisplayAccess_createInstance,
+ vcl::DisplayAccess_getSupportedServiceNames() );
+ }
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ return pRet;
+ }
+
+} /* extern "C" */