1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _LAYOUT_UNO_HXX
29 #define _LAYOUT_UNO_HXX
32 #include <com/sun/star/lang/XComponent.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <layout/core/root.hxx>
37 #include <layout/core/factory.hxx>
40 #include <cppuhelper/implbase1.hxx>
41 class UnoBootstrapLayout
: public ::cppu::WeakImplHelper1
< com::sun::star::lang::XMultiServiceFactory
>
42 #else /* !LAYOUT_WEAK */
43 class UnoBootstrapLayout
: public com::sun::star::lang::XMultiServiceFactory
44 #endif /* LAYOUT_WEAK */
47 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> mxMSF
;
48 UnoBootstrapLayout( com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> xMSF
)
51 fprintf( stderr
, "UnoBootstrap Layout\n" );
53 virtual com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
54 createInstance( const rtl::OUString
& aServiceSpecifier
) throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
)
56 if ( aServiceSpecifier
.equalsAscii( "com.sun.star.awt.Layout" ) )
58 fprintf( stderr
, "UnoBootstrapLayout: create service '%s'\n",
59 rtl::OUStringToOString (aServiceSpecifier
, RTL_TEXTENCODING_UTF8
).getStr() );
60 return com::sun::star::uno::Reference
< com::sun::star::lang::XSingleServiceFactory
>( new ::LayoutFactory( this ) );
64 fprintf( stderr
, "UnoBootstrapLayout: create service '%s'\n",
65 rtl::OUStringToOString (aServiceSpecifier
, RTL_TEXTENCODING_UTF8
).getStr() );
68 return mxMSF
->createInstance( aServiceSpecifier
);
70 catch ( const com::sun::star::uno::Exception
&rExc
)
72 rtl::OString
aStr( rtl::OUStringToOString( rExc
.Message
, RTL_TEXTENCODING_ASCII_US
) );
73 fprintf( stderr
, "service construction exception '%s'\n", aStr
.getStr());
78 virtual com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
79 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
)
81 return mxMSF
->createInstanceWithArguments( ServiceSpecifier
, Arguments
);
83 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
84 getAvailableServiceNames() throw (com::sun::star::uno::RuntimeException
)
86 return mxMSF
->getAvailableServiceNames();
91 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
93 return mxMSF
->queryInterface( rType
);
95 virtual void SAL_CALL
acquire() throw()
99 virtual void SAL_CALL
release() throw()
103 #endif /* !LAYOUT_WEAK */
106 #endif /* _LAYOUT_UNO_HXX */