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 _UCBHELPER_FILEIDENTIFIERCONVERTER_HXX_
25 #define _UCBHELPER_FILEIDENTIFIERCONVERTER_HXX_
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <com/sun/star/uno/RuntimeException.hpp>
29 #include <sal/types.h>
30 #include "ucbhelper/ucbhelperdllapi.h"
31 
32 namespace com { namespace sun { namespace star { namespace ucb {
33 	class XContentProviderManager;
34 } } } }
35 namespace rtl { class OUString; }
36 
37 namespace ucbhelper {
38 
39 //============================================================================
40 /** Get a 'root' URL for the most 'local' file content provider.
41 
42 	@descr
43 	The result can be used as the rBaseURL parameter of
44 	ucb::getFileURLFromSystemPath().
45 
46 	@param rManager
47 	A content provider manager.  Must not be null.
48 
49 	@returns
50 	either a 'root' URL for the most 'local' file content provider, or an
51 	empty string, if no such URL can meaningfully be constructed.
52  */
53 UCBHELPER_DLLPUBLIC rtl::OUString getLocalFileURL(
54 	com::sun::star::uno::Reference<
55 	        com::sun::star::ucb::XContentProviderManager > const &
56 	    rManager)
57     SAL_THROW((com::sun::star::uno::RuntimeException));
58 
59 //============================================================================
60 /** Using a specific content provider manager, convert a file path in system
61 	dependent notation to a (file) URL.
62 
63 	@param rManager
64 	A content provider manager.  Must not be null.
65 
66 	@param rBaseURL
67 	See the corresponding parameter of
68 	com::sun::star::ucb::XFileIdentifierConverter::getFileURLFromSystemPath().
69 
70 	@param rURL
71 	See the corresponding parameter of
72 	com::sun::star::ucb::XFileIdentifierConverter::getFileURLFromSystemPath().
73 
74 	@returns
75 	a URL, if the content provider registered at the content provider manager
76 	that is responsible for the base URL returns a URL when calling
77 	com::sun::star::ucb::XFileIdentiferConverter::getFileURLFromSystemPath()
78 	on it.  Otherwise, an empty string is returned.
79 
80 	@see
81 	com::sun::star::ucb::XFileIdentiferConverter::getFileURLFromSystemPath().
82  */
83 UCBHELPER_DLLPUBLIC rtl::OUString
84 getFileURLFromSystemPath(
85 	com::sun::star::uno::Reference<
86 	        com::sun::star::ucb::XContentProviderManager > const &
87 	    rManager,
88 	rtl::OUString const & rBaseURL,
89 	rtl::OUString const & rSystemPath)
90     SAL_THROW((com::sun::star::uno::RuntimeException));
91 
92 //============================================================================
93 /** Using a specific content provider manager, convert a (file) URL to a
94 	file path in system dependent notation.
95 
96 	@param rManager
97 	A content provider manager.  Must not be null.
98 
99 	@param rURL
100 	See the corresponding parameter of
101 	com::sun::star::ucb::XFileIdentiferConverter::getSystemPathFromFileURL().
102 
103 	@returns
104 	a system path, if the content provider registered at the content provider
105 	manager that is responsible for the base URL returns a system path when
106 	calling
107 	com::sun::star::ucb::XFileIdentiferConverter::getSystemPathFromFileURL()
108 	on it.  Otherwise, an empty string is returned.
109 
110 	@see
111 	com::sun::star::ucb::XFileIdentiferConverter::getSystemPathFromFileURL().
112  */
113 UCBHELPER_DLLPUBLIC rtl::OUString
114 getSystemPathFromFileURL(
115 	com::sun::star::uno::Reference<
116 	        com::sun::star::ucb::XContentProviderManager > const &
117 	    rManager,
118 	rtl::OUString const & rURL)
119     SAL_THROW((com::sun::star::uno::RuntimeException));
120 
121 }
122 
123 #endif // _UCBHELPER_FILEIDENTIFIERCONVERTER_HXX_
124