1*408a4873SAndrew Rist/************************************************************** 2cdf0e10cSrcweir * 3*408a4873SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*408a4873SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*408a4873SAndrew Rist * distributed with this work for additional information 6*408a4873SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*408a4873SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*408a4873SAndrew Rist * "License"); you may not use this file except in compliance 9*408a4873SAndrew Rist * with the License. You may obtain a copy of the License at 10*408a4873SAndrew Rist * 11*408a4873SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*408a4873SAndrew Rist * 13*408a4873SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*408a4873SAndrew Rist * software distributed under the License is distributed on an 15*408a4873SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*408a4873SAndrew Rist * KIND, either express or implied. See the License for the 17*408a4873SAndrew Rist * specific language governing permissions and limitations 18*408a4873SAndrew Rist * under the License. 19*408a4873SAndrew Rist * 20*408a4873SAndrew Rist *************************************************************/ 21*408a4873SAndrew Rist 22*408a4873SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir#ifndef __com_sun_star_uri_XUriReferenceFactory_idl__ 25cdf0e10cSrcweir#define __com_sun_star_uri_XUriReferenceFactory_idl__ 26cdf0e10cSrcweir 27cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl> 28cdf0e10cSrcweir#include <com/sun/star/uri/RelativeUriExcessParentSegments.idl> 29cdf0e10cSrcweir#include <com/sun/star/uri/XUriReference.idl> 30cdf0e10cSrcweir 31cdf0e10cSrcweirmodule com { module sun { module star { module uri { 32cdf0e10cSrcweir 33cdf0e10cSrcweir/** 34cdf0e10cSrcweir creates URI references. 35cdf0e10cSrcweir 36cdf0e10cSrcweir <p>See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a> for a 37cdf0e10cSrcweir description of URI references and related terms.</p> 38cdf0e10cSrcweir 39cdf0e10cSrcweir @since OOo 2.0 40cdf0e10cSrcweir */ 41cdf0e10cSrcweirpublished interface XUriReferenceFactory: com::sun::star::uno::XInterface { 42cdf0e10cSrcweir /** 43cdf0e10cSrcweir parses the textual representation of a URI reference. 44cdf0e10cSrcweir 45cdf0e10cSrcweir @param uriReference 46cdf0e10cSrcweir the textual representation of a URI reference. 47cdf0e10cSrcweir 48cdf0e10cSrcweir @returns 49cdf0e10cSrcweir an object that supports 50cdf0e10cSrcweir <type scope="com::sun::star::uri">XUriReference</type> (and possibly also 51cdf0e10cSrcweir additional, scheme-specific interfaces), if the given input can be parsed 52cdf0e10cSrcweir into a URI reference; otherwise, <NULL/> is returned. 53cdf0e10cSrcweir */ 54cdf0e10cSrcweir XUriReference parse([in] string uriReference); 55cdf0e10cSrcweir 56cdf0e10cSrcweir /** 57cdf0e10cSrcweir resolves a relative URI reference to absolute form. 58cdf0e10cSrcweir 59cdf0e10cSrcweir @param baseUriReference 60cdf0e10cSrcweir the base URI reference. If the given <code>uriReference</code> is a 61cdf0e10cSrcweir same-document reference, <code>baseUriReference</code> is used as a 62cdf0e10cSrcweir reference to the current document. 63cdf0e10cSrcweir 64cdf0e10cSrcweir @param uriReference 65cdf0e10cSrcweir any URI reference. Backwards-compatible relative URI references starting 66cdf0e10cSrcweir with a scheme component (see RFC 2396, Section 5.2, 67cdf0e10cSrcweir step 3) are not supported; instead, they are interpreted as absolute 68cdf0e10cSrcweir URI references. 69cdf0e10cSrcweir 70cdf0e10cSrcweir @param processSpecialBaseSegments 71cdf0e10cSrcweir if <TRUE/>, special segments (“<code>.</code>” and 72cdf0e10cSrcweir “<code>..</code>”) within the path of the base URI (except 73cdf0e10cSrcweir for the last, cut-off segment) are processed as suggested by 74cdf0e10cSrcweir RFC 2396. If <FALSE/>, special segments within the path of the base 75cdf0e10cSrcweir URI are treated like ordinary segments. 76cdf0e10cSrcweir 77cdf0e10cSrcweir @param excessParentSegments 78cdf0e10cSrcweir details how excess special parent segments 79cdf0e10cSrcweir (“<code>..</code>”) are handled. 80cdf0e10cSrcweir 81cdf0e10cSrcweir @returns 82cdf0e10cSrcweir a fresh object that supports 83cdf0e10cSrcweir <type scope="com::sun::star::uri">XUriReference</type> (and possibly also 84cdf0e10cSrcweir additional, scheme-specific interfaces), if the given 85cdf0e10cSrcweir <code>uriReference</code> is either already absolute, or can be resolved 86cdf0e10cSrcweir to an absolute URI reference, relative to the given 87cdf0e10cSrcweir <code>baseUriReference</code>; otherwise, <NULL/> is returned. 88cdf0e10cSrcweir Especially, if <code>baseUriReference</code> is <NULL/>, or is not an 89cdf0e10cSrcweir absolute, hierarchical URI reference, or if <code>uriReference</code> is 90cdf0e10cSrcweir <NULL/>, then <NULL/> is always returned. 91cdf0e10cSrcweir */ 92cdf0e10cSrcweir XUriReference makeAbsolute( 93cdf0e10cSrcweir [in] XUriReference baseUriReference, [in] XUriReference uriReference, 94cdf0e10cSrcweir [in] boolean processSpecialBaseSegments, 95cdf0e10cSrcweir [in] RelativeUriExcessParentSegments excessParentSegments); 96cdf0e10cSrcweir 97cdf0e10cSrcweir /** 98cdf0e10cSrcweir changes an absolute URI refrence to relative form. 99cdf0e10cSrcweir 100cdf0e10cSrcweir @param baseUriReference 101cdf0e10cSrcweir the base URI reference. 102cdf0e10cSrcweir 103cdf0e10cSrcweir @param uriReference 104cdf0e10cSrcweir any URI reference. 105cdf0e10cSrcweir 106cdf0e10cSrcweir @param preferAuthorityOverRelativePath 107cdf0e10cSrcweir controls how a relative URI reference is generated when both 108cdf0e10cSrcweir <code>baseUriReference</code> (e.g., 109cdf0e10cSrcweir “<code>scheme://auth/a/b</code>”) and 110cdf0e10cSrcweir <code>uriReference</code> (e.g., 111cdf0e10cSrcweir “<code>scheme://auth//c/d</code>”) have the same scheme and 112cdf0e10cSrcweir authority components, and the path component of <code>uriReference</code> 113cdf0e10cSrcweir starts with “<code>//</code>”. If <TRUE/>, the generated 114cdf0e10cSrcweir relative URI reference includes an authority component (e.g., 115cdf0e10cSrcweir “<code>//auth//c/d</code>”); if <FALSE/>, the generated 116cdf0e10cSrcweir relative URI reference has a relative path (e.g., 117cdf0e10cSrcweir “<code>..//c/d</code>”). 118cdf0e10cSrcweir 119cdf0e10cSrcweir @param preferAbsoluteOverRelativePath 120cdf0e10cSrcweir controls how a relative URI reference is generated when both 121cdf0e10cSrcweir <code>baseUriReference</code> (e.g., 122cdf0e10cSrcweir “<code>scheme://auth/a/b</code>”) and 123cdf0e10cSrcweir <code>uriReference</code> (e.g., 124cdf0e10cSrcweir “<code>scheme://auth/c/d</code>”) have the same scheme and 125cdf0e10cSrcweir authority components (if present), but share no common path segments. If 126cdf0e10cSrcweir <TRUE/>, the generated relative URI reference has an absolute path (e.g., 127cdf0e10cSrcweir “<code>/c/d</code>”); if <FALSE/>, the generated relative URI 128cdf0e10cSrcweir reference has a relative path (e.g., “<code>../c/d</code>”). 129cdf0e10cSrcweir 130cdf0e10cSrcweir @param encodeRetainedSpecialSegments 131cdf0e10cSrcweir if <TRUE/>, special segments (“<code>.</code>” and 132cdf0e10cSrcweir “<code>..</code>”) that are already present in the path 133cdf0e10cSrcweir component of the given <code>uriReference</code> and which end up in a 134cdf0e10cSrcweir relative path returned from this method, are encoded (as 135cdf0e10cSrcweir “<code>%2E</code>” and “<code>%2E%2E</code>”, 136cdf0e10cSrcweir respectively). 137cdf0e10cSrcweir 138cdf0e10cSrcweir @returns 139cdf0e10cSrcweir a fresh object that supports 140cdf0e10cSrcweir <type scope="com::sun::star::uri">XUriReference</type>, if the given 141cdf0e10cSrcweir <code>uriReference</code> is either already relative, or is not 142cdf0e10cSrcweir hierarchical, or is of a different scheme than the given 143cdf0e10cSrcweir <code>baseUriReference</code>, or can be changed to a relative URI 144cdf0e10cSrcweir reference, relative to the given <code>baseUriReference</code>; 145cdf0e10cSrcweir otherwise, <NULL/> is returned. Especially, if 146cdf0e10cSrcweir <code>baseUriReference</code> is <NULL/>, or is not an absolute, 147cdf0e10cSrcweir hierarchical URI reference, or if <code>uriReference</code> is <NULL/>, 148cdf0e10cSrcweir then <NULL/> is always returned. 149cdf0e10cSrcweir */ 150cdf0e10cSrcweir XUriReference makeRelative( 151cdf0e10cSrcweir [in] XUriReference baseUriReference, [in] XUriReference uriReference, 152cdf0e10cSrcweir [in] boolean preferAuthorityOverRelativePath, 153cdf0e10cSrcweir [in] boolean preferAbsoluteOverRelativePath, 154cdf0e10cSrcweir [in] boolean encodeRetainedSpecialSegments); 155cdf0e10cSrcweir}; 156cdf0e10cSrcweir 157cdf0e10cSrcweir}; }; }; }; 158cdf0e10cSrcweir 159cdf0e10cSrcweir#endif 160