xref: /aoo42x/main/udkapi/com/sun/star/uno/XInterface.idl (revision cdf0e10c)
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#ifndef __com_sun_star_uno_XInterface_idl__
28*cdf0e10cSrcweir#define __com_sun_star_uno_XInterface_idl__
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir//=============================================================================
31*cdf0e10cSrcweir
32*cdf0e10cSrcweir module com {  module sun {  module star {  module uno {
33*cdf0e10cSrcweir
34*cdf0e10cSrcweir//=============================================================================
35*cdf0e10cSrcweir
36*cdf0e10cSrcweir// DocMerge from xml: interface com::sun::star::uno::XInterface
37*cdf0e10cSrcweir/** base interface of all UNO interfaces
38*cdf0e10cSrcweir
39*cdf0e10cSrcweir    <p> It provides lifetime control by reference counting and the
40*cdf0e10cSrcweir    possibility of querying for other
41*cdf0e10cSrcweir	interfaces of the same logical object.
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir
44*cdf0e10cSrcweir	<p>
45*cdf0e10cSrcweir	"Logical Object" in this case means that the
46*cdf0e10cSrcweir	interfaces actually can be supported by internal (e.g. aggregated) physical objects.</p>
47*cdf0e10cSrcweir
48*cdf0e10cSrcweir    <p> Deriving from this interface is mandatory for all UNO interfaces.
49*cdf0e10cSrcweir    <p> Each language binding (Java, C++, StarBasic, Python, ... ) may
50*cdf0e10cSrcweir    provide a different mapping of this interface, please look into the language
51*cdf0e10cSrcweir    dependent documention.
52*cdf0e10cSrcweir
53*cdf0e10cSrcweir    <p> The UNO object does not export the state of the reference count (acquire() and
54*cdf0e10cSrcweir        release() do not have return values). In general, also the UNO object itself
55*cdf0e10cSrcweir        should not make any assumption on the concrete value of the reference count
56*cdf0e10cSrcweir        (except on the transition from one to zero ).
57*cdf0e10cSrcweir
58*cdf0e10cSrcweir */
59*cdf0e10cSrcweirpublished interface XInterface
60*cdf0e10cSrcweir{
61*cdf0e10cSrcweir	/** queries for a new interface to an existing UNO object.
62*cdf0e10cSrcweir        <p>
63*cdf0e10cSrcweir        The queryInterface() method is the entry point to obtain other interfaces which
64*cdf0e10cSrcweir        are exported by the object. The caller asks the implementation of the object,
65*cdf0e10cSrcweir        if it supports the interface specified by the type argument. The call may either
66*cdf0e10cSrcweir        return with a interface reference of the requested type or with a void any.
67*cdf0e10cSrcweir
68*cdf0e10cSrcweir        <p>
69*cdf0e10cSrcweir        There are certain specifications, a queryInterface() implementation must not violate.
70*cdf0e10cSrcweir        <p>
71*cdf0e10cSrcweir        1) If queryInterface on a specific object has once returned a valid interface reference
72*cdf0e10cSrcweir          for a given type, it must return a valid reference for any successive queryInterface
73*cdf0e10cSrcweir          calls on this object for the same type.
74*cdf0e10cSrcweir        <p>
75*cdf0e10cSrcweir        2) If queryInterface on a specific object has once returned a null reference
76*cdf0e10cSrcweir        for a given type, it must always return a null reference for the same type.
77*cdf0e10cSrcweir        <p>
78*cdf0e10cSrcweir        3) If queryInterface on a reference A returns reference B, queryInterface on
79*cdf0e10cSrcweir        B for Type A must return interface reference A or calls made on the returned
80*cdf0e10cSrcweir        reference must be equivalent to calls made on reference A.
81*cdf0e10cSrcweir        <p>
82*cdf0e10cSrcweir        4) If queryInterface on a reference A returns reference B, queryInterface on
83*cdf0e10cSrcweir        A and B for XInterface must return the same interface reference (object identity).
84*cdf0e10cSrcweir
85*cdf0e10cSrcweir        <p> The reason for the strong specification is, that a Uno Runtime Environment (URE)
86*cdf0e10cSrcweir        may choose to cache queryInterface() calls.
87*cdf0e10cSrcweir        <p> As mentioned above, certain language bindings may map this function differently also
88*cdf0e10cSrcweir        with different specifications, please visit the language dependent specification for it.
89*cdf0e10cSrcweir        The current C++ binding sticks to the specification state
90*cdf0e10cSrcweir        <p>
91*cdf0e10cSrcweir        The rules mentioned above are basically identical to the rules of QueryInterface in MS COM.
92*cdf0e10cSrcweir
93*cdf0e10cSrcweir        @param aType a UNO interface type, for which an object reference shall be obtained.
94*cdf0e10cSrcweir        @return an interface reference in case the requested interface is supported by the object,
95*cdf0e10cSrcweir                a void any otherwise.
96*cdf0e10cSrcweir	 */
97*cdf0e10cSrcweir	any queryInterface( [in] type aType );
98*cdf0e10cSrcweir
99*cdf0e10cSrcweir	//-------------------------------------------------------------------------
100*cdf0e10cSrcweir	/** increases the reference counter by one.
101*cdf0e10cSrcweir
102*cdf0e10cSrcweir        <p>When you have called acquire() on the
103*cdf0e10cSrcweir        UNO object, it is often said, that you have a reference or a hard reference
104*cdf0e10cSrcweir        to the object.
105*cdf0e10cSrcweir
106*cdf0e10cSrcweir        <p>
107*cdf0e10cSrcweir        It is only allowed to invoke a method on an UNO object, when you keep
108*cdf0e10cSrcweir        a hard reference to it.
109*cdf0e10cSrcweir
110*cdf0e10cSrcweir        <p> Every call to acquire must be followed by a corresponding call to release
111*cdf0e10cSrcweir        some time later, which may eventually lead to the destruction of the object.
112*cdf0e10cSrcweir	 */
113*cdf0e10cSrcweir	[oneway] void acquire();
114*cdf0e10cSrcweir
115*cdf0e10cSrcweir	//-------------------------------------------------------------------------
116*cdf0e10cSrcweir
117*cdf0e10cSrcweir	// DocMerge from xml: method com::sun::star::uno::XInterface::release
118*cdf0e10cSrcweir	/** decreases the reference counter by one.
119*cdf0e10cSrcweir		<p>When the reference counter reaches 0, the object gets deleted.</p>
120*cdf0e10cSrcweir        <p>Calling release() on the object is often called releasing
121*cdf0e10cSrcweir        or clearing the reference to an object.
122*cdf0e10cSrcweir	 */
123*cdf0e10cSrcweir	[oneway] void release();
124*cdf0e10cSrcweir
125*cdf0e10cSrcweir};
126*cdf0e10cSrcweir
127*cdf0e10cSrcweir//=============================================================================
128*cdf0e10cSrcweir
129*cdf0e10cSrcweir}; }; }; };
130*cdf0e10cSrcweir
131*cdf0e10cSrcweir/*=============================================================================
132*cdf0e10cSrcweir
133*cdf0e10cSrcweir=============================================================================*/
134*cdf0e10cSrcweir#endif
135