xref: /aoo4110/main/svl/source/uno/pathservice.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svl.hxx"
26 
27 #include <unotools/pathoptions.hxx>
28 #include "sal/types.h"
29 #include "rtl/ustring.hxx"
30 #include <cppuhelper/implbase2.hxx>
31 #include <com/sun/star/frame/XConfigManager.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 
34 namespace css = com::sun::star;
35 using rtl::OUString;
36 
37 // -----------------------------------------------------------------------
38 
39 class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo >
40 {
41 	SvtPathOptions m_aOptions;
42 
43 public:
PathService()44 	PathService()
45 		{}
46 
getImplementationName()47     virtual OUString SAL_CALL getImplementationName()
48 		throw(css::uno::RuntimeException)
49 		{
50 			return OUString::createFromAscii("com.sun.star.comp.svl.PathService");
51 		}
52 
supportsService(const OUString & rName)53     virtual sal_Bool SAL_CALL supportsService (
54 		const OUString & rName)
55 		throw(css::uno::RuntimeException)
56 		{
57 			return (rName.compareToAscii("com.sun.star.config.SpecialConfigManager") == 0);
58 		}
59 
getSupportedServiceNames()60     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
61 		throw(css::uno::RuntimeException)
62 		{
63 			css::uno::Sequence< OUString > aRet(1);
64 			aRet.getArray()[0] = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager");
65 			return aRet;
66 		}
67 
substituteVariables(const OUString & sText)68     virtual OUString SAL_CALL substituteVariables (
69 		const OUString& sText)
70 		throw(css::uno::RuntimeException)
71 		{
72 			return m_aOptions.SubstituteVariable( sText );
73 		}
74 
addPropertyChangeListener(const OUString &,const css::uno::Reference<css::beans::XPropertyChangeListener> &)75     virtual void SAL_CALL addPropertyChangeListener (
76 		const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &)
77 		throw(css::uno::RuntimeException)
78 		{}
79 
removePropertyChangeListener(const OUString &,const css::uno::Reference<css::beans::XPropertyChangeListener> &)80     virtual void SAL_CALL removePropertyChangeListener (
81 		const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &)
82 		throw(css::uno::RuntimeException)
83 		{}
84 
flush()85     virtual void SAL_CALL flush()
86 		throw(css::uno::RuntimeException)
87 		{}
88 };
89 
90 // -----------------------------------------------------------------------
91 
PathService_CreateInstance(const css::uno::Reference<css::lang::XMultiServiceFactory> &)92 css::uno::Reference< css::uno::XInterface > PathService_CreateInstance (
93 	const css::uno::Reference< css::lang::XMultiServiceFactory > &)
94 {
95 	return css::uno::Reference< css::uno::XInterface >(
96 		static_cast< cppu::OWeakObject* >(new PathService()));
97 }
98 
99 // -----------------------------------------------------------------------
100