1*d1766043SAndrew Rist/************************************************************** 2*d1766043SAndrew Rist * 3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d1766043SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d1766043SAndrew Rist * distributed with this work for additional information 6*d1766043SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance 9*d1766043SAndrew Rist * with the License. You may obtain a copy of the License at 10*d1766043SAndrew Rist * 11*d1766043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*d1766043SAndrew Rist * 13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d1766043SAndrew Rist * software distributed under the License is distributed on an 15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d1766043SAndrew Rist * KIND, either express or implied. See the License for the 17*d1766043SAndrew Rist * specific language governing permissions and limitations 18*d1766043SAndrew Rist * under the License. 19*d1766043SAndrew Rist * 20*d1766043SAndrew Rist *************************************************************/ 21*d1766043SAndrew Rist 22*d1766043SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir#ifndef __com_sun_star_drawing_framework_XResourceId_idl__ 25cdf0e10cSrcweir#define __com_sun_star_drawing_framework_XResourceId_idl__ 26cdf0e10cSrcweir 27cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__ 28cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl> 29cdf0e10cSrcweir#endif 30cdf0e10cSrcweir#ifndef __com_sun_star_drawing_framework_AnchorBindingMode_idl__ 31cdf0e10cSrcweir#include <com/sun/star/drawing/framework/AnchorBindingMode.idl> 32cdf0e10cSrcweir#endif 33cdf0e10cSrcweir#ifndef __com_sun_star_util_URL_idl__ 34cdf0e10cSrcweir#include <com/sun/star/util/URL.idl> 35cdf0e10cSrcweir#endif 36cdf0e10cSrcweir 37cdf0e10cSrcweirmodule com { module sun { module star { module drawing { module framework { 38cdf0e10cSrcweir 39cdf0e10cSrcweir/** A resource id uses a set of URLs to unambiguously specify a resource of 40cdf0e10cSrcweir the drawing framework. 41cdf0e10cSrcweir <p>Resources of the drawing framework are panes, views, tool bars, and 42cdf0e10cSrcweir command groups. One URL describes the type of the actual resource. A 43cdf0e10cSrcweir sequence of URLs (typically one, sometimes two) specifies its anchor, 44cdf0e10cSrcweir the resource it is bound to. The anchor typically is a pane (for 45cdf0e10cSrcweir views), or it is empty (for panes).</p> 46cdf0e10cSrcweir <p>The resource URL may be empty. In this case the anchor is empty, 47cdf0e10cSrcweir too. Such an empty resource id does not describe a resource but rather 48cdf0e10cSrcweir the absence of one. Instead of an empty <type>XResourceId</type> object 49cdf0e10cSrcweir an empty reference can be used in many places.</p> 50cdf0e10cSrcweir <p>The resource URL may have arguments that are passed to the factory 51cdf0e10cSrcweir method on its creation. Arguments are only available through the 52cdf0e10cSrcweir getFullResourceURL(). The getResourceURL() method strips them away.</p> 53cdf0e10cSrcweir*/ 54cdf0e10cSrcweirpublished interface XResourceId 55cdf0e10cSrcweir{ 56cdf0e10cSrcweir /** Return the URL of the resource. Arguments supplied on creation are 57cdf0e10cSrcweir stripped away. Use getFullResourceURL() to access them. 58cdf0e10cSrcweir */ 59cdf0e10cSrcweir string getResourceURL (); 60cdf0e10cSrcweir 61cdf0e10cSrcweir /** Return an URL object of the resource URL that may contain arguments. 62cdf0e10cSrcweir */ 63cdf0e10cSrcweir com::sun::star::util::URL getFullResourceURL (); 64cdf0e10cSrcweir 65cdf0e10cSrcweir /** Return whether there is a non-empty anchor URL. When this method 66cdf0e10cSrcweir returns <FALSE/> then getAnchorURLs() will return an empty list. 67cdf0e10cSrcweir */ 68cdf0e10cSrcweir boolean hasAnchor (); 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** Return a new XResourceId that represents the anchor resource. 71cdf0e10cSrcweir */ 72cdf0e10cSrcweir XResourceId getAnchor (); 73cdf0e10cSrcweir 74cdf0e10cSrcweir /** Return the, possibly empty, list of anchor URLs. The URLs are 75cdf0e10cSrcweir ordered so that the one in position 0 is the direct anchor of the 76cdf0e10cSrcweir resource, while the one in position i+1 is the direct anchor of the 77cdf0e10cSrcweir one in position i. 78cdf0e10cSrcweir */ 79cdf0e10cSrcweir sequence<string> getAnchorURLs (); 80cdf0e10cSrcweir 81cdf0e10cSrcweir /** Return the type prefix of the resource URL. This includes all up to 82cdf0e10cSrcweir and including the second slash. 83cdf0e10cSrcweir */ 84cdf0e10cSrcweir string getResourceTypePrefix (); 85cdf0e10cSrcweir 86cdf0e10cSrcweir /** Compare the called <type>XResourceId</type> object with the given 87cdf0e10cSrcweir one. 88cdf0e10cSrcweir <p>The two resource ids A and B are compared so that if A<B (return 89cdf0e10cSrcweir value is -1) then either A and B are unrelated or A is a direct or 90cdf0e10cSrcweir indirect anchor of B.</p> 91cdf0e10cSrcweir <p>The algorithm for this comparison is quite simple. It uses a 92cdf0e10cSrcweir double lexicographic ordering. On the lower level individual URLs 93cdf0e10cSrcweir are compared via the lexicographic order defined on strings. On the 94cdf0e10cSrcweir higher level two resource ids are compared via a lexicographic order 95cdf0e10cSrcweir defined on the URLS. So when there are two resource ids A1.A2 96cdf0e10cSrcweir (A1 being the anchor of A2) and B1.B2 then A1.A2<B1.B2 when A1<B1 or 97cdf0e10cSrcweir A1==B1 and A2<B2. Resource ids may have different lengths: A1 < 98cdf0e10cSrcweir B1.B2 when A1<B1 or A1==B1 (anchors first then resources linked to them.</p> 99cdf0e10cSrcweir @param xId 100cdf0e10cSrcweir The resource id to which the called resource id is compared. 101cdf0e10cSrcweir @return 102cdf0e10cSrcweir Returns <const>0</const> when the called resource id is 103cdf0e10cSrcweir equivalent to the given resource id. Returns <code>-1</code> or 104cdf0e10cSrcweir <code>+1</code> when the two compared resource ids differ. 105cdf0e10cSrcweir */ 106cdf0e10cSrcweir short compareTo ( 107cdf0e10cSrcweir [in] XResourceId xId); 108cdf0e10cSrcweir 109cdf0e10cSrcweir /** Return whether the anchor of the called resource id object 110cdf0e10cSrcweir represents the same resource as the given object. 111cdf0e10cSrcweir <p>Note that not only the anchor of the given object is taken into 112cdf0e10cSrcweir account. The whole object, including the resource URL, is 113cdf0e10cSrcweir interpreted as anchor resource.</p> 114cdf0e10cSrcweir @param xAnchor 115cdf0e10cSrcweir The resource id of the anchor. 116cdf0e10cSrcweir @param eMode 117cdf0e10cSrcweir This mode specifies how the called resource has to be bound to 118cdf0e10cSrcweir the given anchor in order to have this function return <TRUE/>. 119cdf0e10cSrcweir <p>If eMode is <const>DIRECT</const> then the anchor of the called resource id 120cdf0e10cSrcweir has to be identical to the given anchor. If eMode is 121cdf0e10cSrcweir <const>INDIRECT</const> then the given anchor has to be a part 122cdf0e10cSrcweir of the anchor of the called resource. 123cdf0e10cSrcweir */ 124cdf0e10cSrcweir boolean isBoundTo ( 125cdf0e10cSrcweir [in] XResourceId xId, 126cdf0e10cSrcweir [in] AnchorBindingMode eMode); 127cdf0e10cSrcweir 128cdf0e10cSrcweir /** Return whether the anchor of the called resource id object 129cdf0e10cSrcweir represents the same resource as the given anchor URL. This is a 130cdf0e10cSrcweir convenience variant of the <member>isBoundTo()</member> function 131cdf0e10cSrcweir that can also be seen as an optimization for the case that the 132cdf0e10cSrcweir anchor consists of exactly one URL. 133cdf0e10cSrcweir @param xAnchor 134cdf0e10cSrcweir The resource URL of the anchor. 135cdf0e10cSrcweir @param eMode 136cdf0e10cSrcweir This mode specifies how the called resource has to be bound to 137cdf0e10cSrcweir the given anchor in order to have this function return. See the 138cdf0e10cSrcweir description of <member>isBoundTo()</member> for more 139cdf0e10cSrcweir information. 140cdf0e10cSrcweir */ 141cdf0e10cSrcweir boolean isBoundToURL ( 142cdf0e10cSrcweir [in] string sAnchorURL, 143cdf0e10cSrcweir [in] AnchorBindingMode eMode); 144cdf0e10cSrcweir 145cdf0e10cSrcweir /** Return a copy of the called resource id. The caller becomes the 146cdf0e10cSrcweir owner of the new object. 147cdf0e10cSrcweir */ 148cdf0e10cSrcweir XResourceId clone (); 149cdf0e10cSrcweir}; 150cdf0e10cSrcweir 151cdf0e10cSrcweir}; }; }; }; }; // ::com::sun::star::drawing::framework 152cdf0e10cSrcweir 153cdf0e10cSrcweir#endif 154