Update ooo320-m1
[ooovba.git] / shell / source / backends / kdebe / kdebackend.cxx
blobecf1715d0e87d77c630e58502ee3dbf46d4aca1f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: kdebackend.cxx,v $
10 * $Revision: 1.7 $
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 "kdebackend.hxx"
35 #include "kdecommonlayer.hxx"
36 #include "kdeinetlayer.hxx"
37 #include "kdevcllayer.hxx"
38 #include "kdepathslayer.hxx"
40 //------------------------------------------------------------------------------
42 KDEBackend* KDEBackend::mInstance= 0;
44 KDEBackend* KDEBackend::createInstance(const uno::Reference<uno::XComponentContext>& xContext)
46 if (mInstance == 0)
48 mInstance = new KDEBackend (xContext);
51 return mInstance;
54 //------------------------------------------------------------------------------
56 KDEBackend::KDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
57 throw (backend::BackendAccessException)
58 : BackendBase(mMutex), m_xContext(xContext)
62 //------------------------------------------------------------------------------
64 KDEBackend::~KDEBackend(void)
68 //------------------------------------------------------------------------------
70 uno::Reference<backend::XLayer> SAL_CALL KDEBackend::getLayer(
71 const rtl::OUString& aComponent, const rtl::OUString& /* aTimestamp */)
72 throw (backend::BackendAccessException, lang::IllegalArgumentException)
74 uno::Reference<backend::XLayer> xLayer;
76 if( aComponent.equalsAscii("org.openoffice.Office.Common" ) )
78 xLayer = new KDECommonLayer(m_xContext);
80 else if( aComponent.equalsAscii("org.openoffice.Inet" ) )
82 xLayer = new KDEInetLayer(m_xContext);
84 else if( aComponent.equalsAscii("org.openoffice.VCL" ) )
86 xLayer = new KDEVCLLayer(m_xContext);
88 else if( aComponent.equalsAscii("org.openoffice.Office.Paths" ) )
90 xLayer = new KDEPathsLayer(m_xContext);
93 return xLayer;
96 //------------------------------------------------------------------------------
98 uno::Reference<backend::XUpdatableLayer> SAL_CALL
99 KDEBackend::getUpdatableLayer(const rtl::OUString& /* aComponent */)
100 throw (backend::BackendAccessException,lang::NoSupportException,
101 lang::IllegalArgumentException)
103 throw lang::NoSupportException( rtl::OUString(
104 RTL_CONSTASCII_USTRINGPARAM("KDEBackend: No Update Operation allowed, Read Only access") ),
105 *this) ;
108 //------------------------------------------------------------------------------
110 rtl::OUString SAL_CALL KDEBackend::getBackendName(void)
112 return rtl::OUString(
113 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.backend.KDEBackend") );
116 //------------------------------------------------------------------------------
118 rtl::OUString SAL_CALL KDEBackend::getImplementationName(void)
119 throw (uno::RuntimeException)
121 return getBackendName() ;
124 //------------------------------------------------------------------------------
126 uno::Sequence<rtl::OUString> SAL_CALL KDEBackend::getBackendServiceNames(void)
128 uno::Sequence<rtl::OUString> aServices(1) ;
129 aServices[0] = rtl::OUString(
130 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.KDEBackend")) ;
132 return aServices ;
135 //------------------------------------------------------------------------------
137 sal_Bool SAL_CALL KDEBackend::supportsService(const rtl::OUString& aServiceName)
138 throw (uno::RuntimeException)
140 uno::Sequence< rtl::OUString > const svc = getBackendServiceNames();
142 for(sal_Int32 i = 0; i < svc.getLength(); ++i )
143 if(svc[i] == aServiceName)
144 return true;
146 return false;
149 //------------------------------------------------------------------------------
151 uno::Sequence<rtl::OUString>
152 SAL_CALL KDEBackend::getSupportedServiceNames(void)
153 throw (uno::RuntimeException)
155 return getBackendServiceNames() ;
158 // ---------------------------------------------------------------------------------------