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 #include <com/sun/star/util/XStringSubstitution.hpp> 24 #include <com/sun/star/lang/XInitialization.hpp> 25 #include <com/sun/star/lang/XServiceInfo.hpp> 26 #include <com/sun/star/uno/XComponentContext.hpp> 27 #include <com/sun/star/sdbc/XConnection.hpp> 28 #include <cppuhelper/implbase3.hxx> 29 30 namespace connectivity 31 { 32 typedef ::cppu::WeakImplHelper3< ::com::sun::star::util::XStringSubstitution 33 ,::com::sun::star::lang::XServiceInfo 34 ,::com::sun::star::lang::XInitialization > ParameterSubstitution_BASE; 35 class ParameterSubstitution : public ParameterSubstitution_BASE 36 { 37 ::osl::Mutex m_aMutex; 38 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 39 ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XConnection > m_xConnection; 40 41 ParameterSubstitution( const ParameterSubstitution& ); 42 ParameterSubstitution& operator=( const ParameterSubstitution& ); 43 public: 44 45 static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); 46 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); 47 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext); 48 protected: 49 ParameterSubstitution(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); 50 virtual ~ParameterSubstitution(){} 51 52 // XServiceInfo 53 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 54 virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 55 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 56 // XInitialization 57 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 58 59 // XStringSubstitution 60 virtual ::rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& aText, ::sal_Bool bSubstRequired ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); 61 virtual ::rtl::OUString SAL_CALL reSubstituteVariables( const ::rtl::OUString& aText ) throw (::com::sun::star::uno::RuntimeException); 62 virtual ::rtl::OUString SAL_CALL getSubstituteVariableValue( const ::rtl::OUString& variable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); 63 }; 64 // ================================== 65 } // connectivity 66 // ================================== 67