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