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: macbackend.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_shell.hxx"
34 #include "macbackend.hxx"
35 #include "macbelayer.hxx"
36 #include <com/sun/star/configuration/backend/ComponentChangeEvent.hpp>
37 #include <uno/current_context.hxx>
39 #define MACBE_INET_COMPONENT "org.openoffice.Inet"
40 #define MACBE_PATHS_COMPONENT "org.openoffice.Office.Paths"
42 MacOSXBackend::MacOSXBackend(const uno::Reference
<uno::XComponentContext
>& xContext
)
43 throw (backend::BackendAccessException
) :
44 ::cppu::WeakImplHelper2
< backend::XSingleLayerStratum
, lang::XServiceInfo
> (),
49 //------------------------------------------------------------------------------
51 MacOSXBackend::~MacOSXBackend(void)
55 //------------------------------------------------------------------------------
57 MacOSXBackend
* MacOSXBackend::createInstance(const uno::Reference
<uno::XComponentContext
>& xContext
)
59 return new MacOSXBackend(xContext
);
62 // ---------------------------------------------------------------------------------------
64 uno::Reference
<backend::XLayer
> SAL_CALL
MacOSXBackend::getLayer(const rtl::OUString
& aComponent
, const rtl::OUString
& /*aTimestamp*/)
65 throw (backend::BackendAccessException
, lang::IllegalArgumentException
)
67 if( aComponent
.equalsAscii( MACBE_INET_COMPONENT
) )
69 if( ! m_xSystemLayer
.is() )
70 m_xSystemLayer
= new MacOSXLayer( m_xContext
);
72 return m_xSystemLayer
;
74 else if( aComponent
.equalsAscii( MACBE_PATHS_COMPONENT
) )
76 if( ! m_xPathLayer
.is() )
77 m_xPathLayer
= new MacOSXPathLayer( m_xContext
);
81 return uno::Reference
<backend::XLayer
>();
84 //------------------------------------------------------------------------------
86 uno::Reference
<backend::XUpdatableLayer
> SAL_CALL
87 MacOSXBackend::getUpdatableLayer(const rtl::OUString
& /*aComponent*/)
88 throw (backend::BackendAccessException
,lang::NoSupportException
,
89 lang::IllegalArgumentException
)
91 throw lang::NoSupportException(
92 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
93 "MacOSXBackend: No Update Operation allowed, Read Only access") ),
99 //------------------------------------------------------------------------------
101 rtl::OUString SAL_CALL
MacOSXBackend::getBackendName(void)
103 return rtl::OUString::createFromAscii("com.sun.star.comp.configuration.backend.MacOSXBackend");
106 //------------------------------------------------------------------------------
108 rtl::OUString SAL_CALL
MacOSXBackend::getImplementationName(void)
109 throw (uno::RuntimeException
)
111 return getBackendName();
114 //------------------------------------------------------------------------------
116 uno::Sequence
<rtl::OUString
> SAL_CALL
MacOSXBackend::getBackendServiceNames(void)
118 uno::Sequence
<rtl::OUString
> aServiceNameList(2);
119 aServiceNameList
[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.MacOSXBackend"));
120 aServiceNameList
[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.PlatformBackend"));
122 return aServiceNameList
;
125 //------------------------------------------------------------------------------
127 sal_Bool SAL_CALL
MacOSXBackend::supportsService(const rtl::OUString
& aServiceName
)
128 throw (uno::RuntimeException
)
130 uno::Sequence
< rtl::OUString
> const svc
= getBackendServiceNames();
132 for(sal_Int32 i
= 0; i
< svc
.getLength(); ++i
)
133 if(svc
[i
] == aServiceName
)
139 //------------------------------------------------------------------------------
141 uno::Sequence
<rtl::OUString
> SAL_CALL
MacOSXBackend::getSupportedServiceNames(void)
142 throw (uno::RuntimeException
)
144 return getBackendServiceNames();
147 // ---------------------------------------------------------------------------------------
149 uno::Sequence
<rtl::OUString
> SAL_CALL
MacOSXBackend::getSupportedComponents(void)
151 uno::Sequence
<rtl::OUString
> aSupportedComponentList(2);
152 aSupportedComponentList
[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( MACBE_INET_COMPONENT
) );
153 aSupportedComponentList
[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( MACBE_PATHS_COMPONENT
) );
155 return aSupportedComponentList
;