Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <unotools/pathoptions.hxx>
22 : #include "sal/types.h"
23 : #include "rtl/ustring.hxx"
24 : #include <cppuhelper/implbase2.hxx>
25 : #include <com/sun/star/frame/XConfigManager.hpp>
26 : #include <com/sun/star/lang/XServiceInfo.hpp>
27 :
28 : using rtl::OUString;
29 :
30 : // -----------------------------------------------------------------------
31 :
32 0 : class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo >
33 : {
34 : SvtPathOptions m_aOptions;
35 :
36 : public:
37 0 : PathService()
38 0 : {}
39 :
40 0 : virtual OUString SAL_CALL getImplementationName()
41 : throw(css::uno::RuntimeException)
42 : {
43 0 : return OUString("com.sun.star.comp.svl.PathService");
44 : }
45 :
46 0 : virtual sal_Bool SAL_CALL supportsService (
47 : const OUString & rName)
48 : throw(css::uno::RuntimeException)
49 : {
50 0 : return (rName.compareToAscii("com.sun.star.config.SpecialConfigManager") == 0);
51 : }
52 :
53 0 : virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
54 : throw(css::uno::RuntimeException)
55 : {
56 0 : css::uno::Sequence< OUString > aRet(1);
57 0 : aRet.getArray()[0] = OUString("com.sun.star.config.SpecialConfigManager");
58 0 : return aRet;
59 : }
60 :
61 0 : virtual OUString SAL_CALL substituteVariables (
62 : const OUString& sText)
63 : throw(css::uno::RuntimeException)
64 : {
65 0 : return m_aOptions.SubstituteVariable( sText );
66 : }
67 :
68 0 : virtual void SAL_CALL addPropertyChangeListener (
69 : const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &)
70 : throw(css::uno::RuntimeException)
71 0 : {}
72 :
73 0 : virtual void SAL_CALL removePropertyChangeListener (
74 : const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &)
75 : throw(css::uno::RuntimeException)
76 0 : {}
77 :
78 0 : virtual void SAL_CALL flush()
79 : throw(css::uno::RuntimeException)
80 0 : {}
81 : };
82 :
83 : // -----------------------------------------------------------------------
84 :
85 0 : css::uno::Reference< css::uno::XInterface > PathService_CreateInstance (
86 : SAL_UNUSED_PARAMETER const css::uno::Reference<
87 : css::lang::XMultiServiceFactory > &)
88 : {
89 : return css::uno::Reference< css::uno::XInterface >(
90 0 : static_cast< cppu::OWeakObject* >(new PathService()));
91 : }
92 :
93 : // -----------------------------------------------------------------------
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|