1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_svl.hxx" 30 31 #include <unotools/pathoptions.hxx> 32 #include "sal/types.h" 33 #include "rtl/ustring.hxx" 34 #include <cppuhelper/implbase2.hxx> 35 #include <com/sun/star/frame/XConfigManager.hpp> 36 #include <com/sun/star/lang/XServiceInfo.hpp> 37 38 namespace css = com::sun::star; 39 using rtl::OUString; 40 41 // ----------------------------------------------------------------------- 42 43 class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo > 44 { 45 SvtPathOptions m_aOptions; 46 47 public: 48 PathService() 49 {} 50 51 virtual OUString SAL_CALL getImplementationName() 52 throw(css::uno::RuntimeException) 53 { 54 return OUString::createFromAscii("com.sun.star.comp.svl.PathService"); 55 } 56 57 virtual sal_Bool SAL_CALL supportsService ( 58 const OUString & rName) 59 throw(css::uno::RuntimeException) 60 { 61 return (rName.compareToAscii("com.sun.star.config.SpecialConfigManager") == 0); 62 } 63 64 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 65 throw(css::uno::RuntimeException) 66 { 67 css::uno::Sequence< OUString > aRet(1); 68 aRet.getArray()[0] = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager"); 69 return aRet; 70 } 71 72 virtual OUString SAL_CALL substituteVariables ( 73 const OUString& sText) 74 throw(css::uno::RuntimeException) 75 { 76 return m_aOptions.SubstituteVariable( sText ); 77 } 78 79 virtual void SAL_CALL addPropertyChangeListener ( 80 const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) 81 throw(css::uno::RuntimeException) 82 {} 83 84 virtual void SAL_CALL removePropertyChangeListener ( 85 const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) 86 throw(css::uno::RuntimeException) 87 {} 88 89 virtual void SAL_CALL flush() 90 throw(css::uno::RuntimeException) 91 {} 92 }; 93 94 // ----------------------------------------------------------------------- 95 96 css::uno::Reference< css::uno::XInterface > PathService_CreateInstance ( 97 const css::uno::Reference< css::lang::XMultiServiceFactory > &) 98 { 99 return css::uno::Reference< css::uno::XInterface >( 100 static_cast< cppu::OWeakObject* >(new PathService())); 101 } 102 103 // ----------------------------------------------------------------------- 104