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 #ifndef _PROVPROX_HXX 25 #define _PROVPROX_HXX 26 27 #include <osl/mutex.hxx> 28 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 29 #include <com/sun/star/lang/XTypeProvider.hpp> 30 #include <com/sun/star/lang/XServiceInfo.hpp> 31 #include <com/sun/star/ucb/XContentProviderFactory.hpp> 32 #include <com/sun/star/ucb/XContentProvider.hpp> 33 #include <com/sun/star/ucb/XParameterizedContentProvider.hpp> 34 #include <com/sun/star/ucb/XContentProviderSupplier.hpp> 35 #include <cppuhelper/weak.hxx> 36 #include <ucbhelper/macros.hxx> 37 38 //========================================================================= 39 40 #define PROVIDER_FACTORY_SERVICE_NAME \ 41 "com.sun.star.ucb.ContentProviderProxyFactory" 42 #define PROVIDER_PROXY_SERVICE_NAME \ 43 "com.sun.star.ucb.ContentProviderProxy" 44 45 //============================================================================ 46 // 47 // class UcbContentProviderProxyFactory. 48 // 49 //============================================================================ 50 51 class UcbContentProviderProxyFactory : 52 public cppu::OWeakObject, 53 public com::sun::star::lang::XTypeProvider, 54 public com::sun::star::lang::XServiceInfo, 55 public com::sun::star::ucb::XContentProviderFactory 56 { 57 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > 58 m_xSMgr; 59 60 public: 61 UcbContentProviderProxyFactory( 62 const com::sun::star::uno::Reference< 63 com::sun::star::lang::XMultiServiceFactory >& rxSMgr ); 64 virtual ~UcbContentProviderProxyFactory(); 65 66 // XInterface 67 XINTERFACE_DECL() 68 69 // XTypeProvider 70 XTYPEPROVIDER_DECL() 71 72 // XServiceInfo 73 XSERVICEINFO_DECL() 74 75 // XContentProviderFactory 76 virtual ::com::sun::star::uno::Reference< 77 ::com::sun::star::ucb::XContentProvider > SAL_CALL 78 createContentProvider( const ::rtl::OUString& Service ); 79 }; 80 81 //============================================================================ 82 // 83 // class UcbContentProviderProxy. 84 // 85 //============================================================================ 86 87 class UcbContentProviderProxy : 88 public cppu::OWeakObject, 89 public com::sun::star::lang::XTypeProvider, 90 public com::sun::star::lang::XServiceInfo, 91 public com::sun::star::ucb::XContentProviderSupplier, 92 public com::sun::star::ucb::XContentProvider, 93 public com::sun::star::ucb::XParameterizedContentProvider 94 { 95 ::osl::Mutex m_aMutex; 96 ::rtl::OUString m_aService; 97 ::rtl::OUString m_aTemplate; 98 ::rtl::OUString m_aArguments; 99 sal_Bool m_bReplace; 100 sal_Bool m_bRegister; 101 102 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > 103 m_xSMgr; 104 com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider > 105 m_xProvider; 106 com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider > 107 m_xTargetProvider; 108 109 public: 110 UcbContentProviderProxy( 111 const com::sun::star::uno::Reference< 112 com::sun::star::lang::XMultiServiceFactory >& rxSMgr, 113 const ::rtl::OUString& Service ); 114 virtual ~UcbContentProviderProxy(); 115 116 // XInterface 117 XINTERFACE_DECL() 118 119 // XTypeProvider 120 XTYPEPROVIDER_DECL() 121 122 // XServiceInfo 123 XSERVICEINFO_NOFACTORY_DECL() 124 125 // XContentProviderSupplier 126 virtual ::com::sun::star::uno::Reference< 127 ::com::sun::star::ucb::XContentProvider > SAL_CALL 128 getContentProvider(); 129 130 // XContentProvider 131 virtual ::com::sun::star::uno::Reference< 132 ::com::sun::star::ucb::XContent > SAL_CALL 133 queryContent( const ::com::sun::star::uno::Reference< 134 ::com::sun::star::ucb::XContentIdentifier >& Identifier ); 135 virtual sal_Int32 SAL_CALL 136 compareContentIds( const ::com::sun::star::uno::Reference< 137 ::com::sun::star::ucb::XContentIdentifier >& Id1, 138 const ::com::sun::star::uno::Reference< 139 ::com::sun::star::ucb::XContentIdentifier >& Id2 ); 140 141 // XParameterizedContentProvider 142 virtual ::com::sun::star::uno::Reference< 143 ::com::sun::star::ucb::XContentProvider > SAL_CALL 144 registerInstance( const ::rtl::OUString& Template, 145 const ::rtl::OUString& Arguments, 146 sal_Bool ReplaceExisting ); 147 virtual ::com::sun::star::uno::Reference< 148 ::com::sun::star::ucb::XContentProvider > SAL_CALL 149 deregisterInstance( const ::rtl::OUString& Template, 150 const ::rtl::OUString& Arguments ); 151 }; 152 153 #endif /* !_PROVPROX_HXX */ 154