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 {
49 return OUString::createFromAscii("com.sun.star.comp.svl.PathService");
50 }
51
supportsService(const OUString & rName)52 virtual sal_Bool SAL_CALL supportsService (
53 const OUString & rName)
54 {
55 return (rName.compareToAscii("com.sun.star.config.SpecialConfigManager") == 0);
56 }
57
getSupportedServiceNames()58 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
59 {
60 css::uno::Sequence< OUString > aRet(1);
61 aRet.getArray()[0] = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager");
62 return aRet;
63 }
64
substituteVariables(const OUString & sText)65 virtual OUString SAL_CALL substituteVariables (
66 const OUString& sText)
67 {
68 return m_aOptions.SubstituteVariable( sText );
69 }
70
addPropertyChangeListener(const OUString &,const css::uno::Reference<css::beans::XPropertyChangeListener> &)71 virtual void SAL_CALL addPropertyChangeListener (
72 const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &)
73 {}
74
removePropertyChangeListener(const OUString &,const css::uno::Reference<css::beans::XPropertyChangeListener> &)75 virtual void SAL_CALL removePropertyChangeListener (
76 const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &)
77 {}
78
flush()79 virtual void SAL_CALL flush()
80 {}
81 };
82
83 // -----------------------------------------------------------------------
84
PathService_CreateInstance(const css::uno::Reference<css::lang::XMultiServiceFactory> &)85 css::uno::Reference< css::uno::XInterface > PathService_CreateInstance (
86 const css::uno::Reference< css::lang::XMultiServiceFactory > &)
87 {
88 return css::uno::Reference< css::uno::XInterface >(
89 static_cast< cppu::OWeakObject* >(new PathService()));
90 }
91
92 // -----------------------------------------------------------------------
93