1*cdf0e10cSrcweir/************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir#ifndef __com_sun_star_uri_XUriReferenceFactory_idl__ 29*cdf0e10cSrcweir#define __com_sun_star_uri_XUriReferenceFactory_idl__ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl> 32*cdf0e10cSrcweir#include <com/sun/star/uri/RelativeUriExcessParentSegments.idl> 33*cdf0e10cSrcweir#include <com/sun/star/uri/XUriReference.idl> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweirmodule com { module sun { module star { module uri { 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir/** 38*cdf0e10cSrcweir creates URI references. 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir <p>See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a> for a 41*cdf0e10cSrcweir description of URI references and related terms.</p> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir @since OOo 2.0 44*cdf0e10cSrcweir */ 45*cdf0e10cSrcweirpublished interface XUriReferenceFactory: com::sun::star::uno::XInterface { 46*cdf0e10cSrcweir /** 47*cdf0e10cSrcweir parses the textual representation of a URI reference. 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir @param uriReference 50*cdf0e10cSrcweir the textual representation of a URI reference. 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir @returns 53*cdf0e10cSrcweir an object that supports 54*cdf0e10cSrcweir <type scope="com::sun::star::uri">XUriReference</type> (and possibly also 55*cdf0e10cSrcweir additional, scheme-specific interfaces), if the given input can be parsed 56*cdf0e10cSrcweir into a URI reference; otherwise, <NULL/> is returned. 57*cdf0e10cSrcweir */ 58*cdf0e10cSrcweir XUriReference parse([in] string uriReference); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir /** 61*cdf0e10cSrcweir resolves a relative URI reference to absolute form. 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir @param baseUriReference 64*cdf0e10cSrcweir the base URI reference. If the given <code>uriReference</code> is a 65*cdf0e10cSrcweir same-document reference, <code>baseUriReference</code> is used as a 66*cdf0e10cSrcweir reference to the current document. 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir @param uriReference 69*cdf0e10cSrcweir any URI reference. Backwards-compatible relative URI references starting 70*cdf0e10cSrcweir with a scheme component (see RFC 2396, Section 5.2, 71*cdf0e10cSrcweir step 3) are not supported; instead, they are interpreted as absolute 72*cdf0e10cSrcweir URI references. 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir @param processSpecialBaseSegments 75*cdf0e10cSrcweir if <TRUE/>, special segments (“<code>.</code>” and 76*cdf0e10cSrcweir “<code>..</code>”) within the path of the base URI (except 77*cdf0e10cSrcweir for the last, cut-off segment) are processed as suggested by 78*cdf0e10cSrcweir RFC 2396. If <FALSE/>, special segments within the path of the base 79*cdf0e10cSrcweir URI are treated like ordinary segments. 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir @param excessParentSegments 82*cdf0e10cSrcweir details how excess special parent segments 83*cdf0e10cSrcweir (“<code>..</code>”) are handled. 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir @returns 86*cdf0e10cSrcweir a fresh object that supports 87*cdf0e10cSrcweir <type scope="com::sun::star::uri">XUriReference</type> (and possibly also 88*cdf0e10cSrcweir additional, scheme-specific interfaces), if the given 89*cdf0e10cSrcweir <code>uriReference</code> is either already absolute, or can be resolved 90*cdf0e10cSrcweir to an absolute URI reference, relative to the given 91*cdf0e10cSrcweir <code>baseUriReference</code>; otherwise, <NULL/> is returned. 92*cdf0e10cSrcweir Especially, if <code>baseUriReference</code> is <NULL/>, or is not an 93*cdf0e10cSrcweir absolute, hierarchical URI reference, or if <code>uriReference</code> is 94*cdf0e10cSrcweir <NULL/>, then <NULL/> is always returned. 95*cdf0e10cSrcweir */ 96*cdf0e10cSrcweir XUriReference makeAbsolute( 97*cdf0e10cSrcweir [in] XUriReference baseUriReference, [in] XUriReference uriReference, 98*cdf0e10cSrcweir [in] boolean processSpecialBaseSegments, 99*cdf0e10cSrcweir [in] RelativeUriExcessParentSegments excessParentSegments); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir /** 102*cdf0e10cSrcweir changes an absolute URI refrence to relative form. 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir @param baseUriReference 105*cdf0e10cSrcweir the base URI reference. 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir @param uriReference 108*cdf0e10cSrcweir any URI reference. 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir @param preferAuthorityOverRelativePath 111*cdf0e10cSrcweir controls how a relative URI reference is generated when both 112*cdf0e10cSrcweir <code>baseUriReference</code> (e.g., 113*cdf0e10cSrcweir “<code>scheme://auth/a/b</code>”) and 114*cdf0e10cSrcweir <code>uriReference</code> (e.g., 115*cdf0e10cSrcweir “<code>scheme://auth//c/d</code>”) have the same scheme and 116*cdf0e10cSrcweir authority components, and the path component of <code>uriReference</code> 117*cdf0e10cSrcweir starts with “<code>//</code>”. If <TRUE/>, the generated 118*cdf0e10cSrcweir relative URI reference includes an authority component (e.g., 119*cdf0e10cSrcweir “<code>//auth//c/d</code>”); if <FALSE/>, the generated 120*cdf0e10cSrcweir relative URI reference has a relative path (e.g., 121*cdf0e10cSrcweir “<code>..//c/d</code>”). 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir @param preferAbsoluteOverRelativePath 124*cdf0e10cSrcweir controls how a relative URI reference is generated when both 125*cdf0e10cSrcweir <code>baseUriReference</code> (e.g., 126*cdf0e10cSrcweir “<code>scheme://auth/a/b</code>”) and 127*cdf0e10cSrcweir <code>uriReference</code> (e.g., 128*cdf0e10cSrcweir “<code>scheme://auth/c/d</code>”) have the same scheme and 129*cdf0e10cSrcweir authority components (if present), but share no common path segments. If 130*cdf0e10cSrcweir <TRUE/>, the generated relative URI reference has an absolute path (e.g., 131*cdf0e10cSrcweir “<code>/c/d</code>”); if <FALSE/>, the generated relative URI 132*cdf0e10cSrcweir reference has a relative path (e.g., “<code>../c/d</code>”). 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir @param encodeRetainedSpecialSegments 135*cdf0e10cSrcweir if <TRUE/>, special segments (“<code>.</code>” and 136*cdf0e10cSrcweir “<code>..</code>”) that are already present in the path 137*cdf0e10cSrcweir component of the given <code>uriReference</code> and which end up in a 138*cdf0e10cSrcweir relative path returned from this method, are encoded (as 139*cdf0e10cSrcweir “<code>%2E</code>” and “<code>%2E%2E</code>”, 140*cdf0e10cSrcweir respectively). 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir @returns 143*cdf0e10cSrcweir a fresh object that supports 144*cdf0e10cSrcweir <type scope="com::sun::star::uri">XUriReference</type>, if the given 145*cdf0e10cSrcweir <code>uriReference</code> is either already relative, or is not 146*cdf0e10cSrcweir hierarchical, or is of a different scheme than the given 147*cdf0e10cSrcweir <code>baseUriReference</code>, or can be changed to a relative URI 148*cdf0e10cSrcweir reference, relative to the given <code>baseUriReference</code>; 149*cdf0e10cSrcweir otherwise, <NULL/> is returned. Especially, if 150*cdf0e10cSrcweir <code>baseUriReference</code> is <NULL/>, or is not an absolute, 151*cdf0e10cSrcweir hierarchical URI reference, or if <code>uriReference</code> is <NULL/>, 152*cdf0e10cSrcweir then <NULL/> is always returned. 153*cdf0e10cSrcweir */ 154*cdf0e10cSrcweir XUriReference makeRelative( 155*cdf0e10cSrcweir [in] XUriReference baseUriReference, [in] XUriReference uriReference, 156*cdf0e10cSrcweir [in] boolean preferAuthorityOverRelativePath, 157*cdf0e10cSrcweir [in] boolean preferAbsoluteOverRelativePath, 158*cdf0e10cSrcweir [in] boolean encodeRetainedSpecialSegments); 159*cdf0e10cSrcweir}; 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir}; }; }; }; 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir#endif 164