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