1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: uno.hxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef _LAYOUT_UNO_HXX
33 #define _LAYOUT_UNO_HXX
36 #include <com/sun/star/lang/XComponent.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <layout/core/root.hxx>
41 #include <layout/core/factory.hxx>
44 #include <cppuhelper/implbase1.hxx>
45 class UnoBootstrapLayout
: public ::cppu::WeakImplHelper1
< com::sun::star::lang::XMultiServiceFactory
>
46 #else /* !LAYOUT_WEAK */
47 class UnoBootstrapLayout
: public com::sun::star::lang::XMultiServiceFactory
48 #endif /* LAYOUT_WEAK */
51 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> mxMSF
;
52 UnoBootstrapLayout( com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> xMSF
)
55 fprintf( stderr
, "UnoBootstrap Layout\n" );
57 virtual com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
58 createInstance( const rtl::OUString
& aServiceSpecifier
) throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
)
60 if ( aServiceSpecifier
.equalsAscii( "com.sun.star.awt.Layout" ) )
62 fprintf( stderr
, "UnoBootstrapLayout: create service '%s'\n",
63 rtl::OUStringToOString (aServiceSpecifier
, RTL_TEXTENCODING_UTF8
).getStr() );
64 return com::sun::star::uno::Reference
< com::sun::star::lang::XSingleServiceFactory
>( new ::LayoutFactory( this ) );
68 fprintf( stderr
, "UnoBootstrapLayout: create service '%s'\n",
69 rtl::OUStringToOString (aServiceSpecifier
, RTL_TEXTENCODING_UTF8
).getStr() );
72 return mxMSF
->createInstance( aServiceSpecifier
);
74 catch ( const com::sun::star::uno::Exception
&rExc
)
76 rtl::OString
aStr( rtl::OUStringToOString( rExc
.Message
, RTL_TEXTENCODING_ASCII_US
) );
77 fprintf( stderr
, "service construction exception '%s'\n", aStr
.getStr());
82 virtual com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
83 createInstanceWithArguments( const rtl::OUString
& ServiceSpecifier
, const com::sun::star::uno::Sequence
< com::sun::star::uno::Any
>& Arguments
) throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
)
85 return mxMSF
->createInstanceWithArguments( ServiceSpecifier
, Arguments
);
87 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
88 getAvailableServiceNames() throw (com::sun::star::uno::RuntimeException
)
90 return mxMSF
->getAvailableServiceNames();
95 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
97 return mxMSF
->queryInterface( rType
);
99 virtual void SAL_CALL
acquire() throw()
103 virtual void SAL_CALL
release() throw()
107 #endif /* !LAYOUT_WEAK */
110 #endif /* _LAYOUT_UNO_HXX */