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 FORMS_SOURCE_INC_URLTRANSFORMER_HXX 25 #define FORMS_SOURCE_INC_URLTRANSFORMER_HXX 26 27 /** === begin UNO includes === **/ 28 #include <com/sun/star/util/XURLTransformer.hpp> 29 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 30 #include <com/sun/star/util/URL.hpp> 31 /** === end UNO includes === **/ 32 33 //........................................................................ 34 namespace frm 35 { 36 //........................................................................ 37 38 //==================================================================== 39 //= UrlTransformer 40 //==================================================================== 41 class UrlTransformer 42 { 43 private: 44 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 45 m_xORB; 46 mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > 47 m_xTransformer; 48 mutable bool m_bTriedToCreateTransformer; 49 50 public: 51 UrlTransformer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); 52 53 /** returns an URL object for the given URL string 54 */ 55 ::com::sun::star::util::URL 56 getStrictURL( const ::rtl::OUString& _rURL ) const; 57 58 /** returns an URL object for the given URL ASCII string 59 */ 60 ::com::sun::star::util::URL 61 getStrictURLFromAscii( const sal_Char* _pAsciiURL ) const; 62 63 /** parses a given URL smartly, with a protocol given by ASCII string 64 */ 65 void 66 parseSmartWithAsciiProtocol( ::com::sun::star::util::URL& _rURL, const sal_Char* _pAsciiURL ) const; 67 68 private: 69 /** ensures that we have an URLTransformer instance in <member>m_xTransformer</member> 70 71 @return 72 <TRUE/> if and only if m_xTransformer is not <NULL/> 73 */ 74 bool implEnsureTransformer() const; 75 }; 76 77 //........................................................................ 78 } // namespace frm 79 //........................................................................ 80 81 #endif // FORMS_SOURCE_INC_URLTRANSFORMER_HXX 82 83