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