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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_extensions.hxx"
26 #include "pcrcommon.hxx"
27 #ifndef _EXTENSIONS_PROPCTRLR_MODULEPRC_HXX_
28 #include "modulepcr.hxx"
29 #endif
30 #ifndef EXTENSIONS_PROPRESID_HRC
31 #include "propresid.hrc"
32 #endif
33 
34 /** === begin UNO includes === **/
35 #include <com/sun/star/util/MeasureUnit.hpp>
36 /** === end UNO includes === **/
37 #include <rtl/ustrbuf.hxx>
38 #include <tools/urlobj.hxx>
39 
40 //............................................................................
41 namespace pcr
42 {
43 //............................................................................
44 
45     using namespace ::com::sun::star::util;
46 
47     //========================================================================
48     //= HelpIdUrl
49 	//========================================================================
50 	//------------------------------------------------------------------------
51 	rtl::OString HelpIdUrl::getHelpId( const ::rtl::OUString& _rHelpURL )
52     {
53         INetURLObject aHID( _rHelpURL );
54         if ( aHID.GetProtocol() == INET_PROT_HID )
55 	  	    return rtl::OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 );
56         else
57             return rtl::OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 );
58     }
59 
60 	//------------------------------------------------------------------------
61     ::rtl::OUString HelpIdUrl::getHelpURL( const rtl::OString& sHelpId )
62     {
63         ::rtl::OUStringBuffer aBuffer;
64         ::rtl::OUString aTmp( sHelpId, sHelpId.getLength(), RTL_TEXTENCODING_UTF8 );
65         INetURLObject aHID( aTmp );
66         if ( aHID.GetProtocol() == INET_PROT_NOT_VALID )
67             aBuffer.appendAscii( INET_HID_SCHEME );
68         aBuffer.append( aTmp.getStr() );
69         return aBuffer.makeStringAndClear();
70     }
71 //............................................................................
72 } // namespace pcr
73 //............................................................................
74 
75