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