<html> <head> <title>Interface XComponent</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="../../../../idl.css"> </head> <body> <div id="adc-idlref"> <a name="_top_"> </a><table class="navimain" border="0" cellpadding="3"> <tr> <td class="navimain"><a href="../module-ix.html" class="navimain">Overview</a></td> <td class="navimain"><a href="module-ix.html" class="navimain">Module</a></td> <td class="navimain"><a href="XComponent-xref.html" class="navimain">Use</a></td> <td class="navimain"><a href="#devmanual" class="navimain">Devguide</a></td> <td class="navimain"><a href="../../../../index-files/index-1.html" class="navimain">Index</a></td> </tr> </table> <table class="navisub" border="0" cellpadding="0"> <tr> <td class="navisub"><a href="#MethodsSummary" class="navisub">Methods' Summary</a></td> <td class="navisub">Attributes' Summary</td> <td class="navisub"><a href="#MethodsDetails" class="navisub">Methods' Details</a></td> <td class="navisub">Attributes' Details</td> </tr> </table> <hr> <table border="0" width="100%" cellpadding="5" cellspacing="3" class="title-table" style="margin-bottom:6pt;"> <tr> <td><p class="namechain"><a href="../../../../module-ix.html" class="namechain">::</a> <a href="../../../module-ix.html" class="namechain">com</a> :: <a href="../../module-ix.html" class="namechain">sun</a> :: <a href="../module-ix.html" class="namechain">star</a> :: <a href="module-ix.html" class="namechain">lang</a> :: </p> </td> </tr> <tr> <td class="title">interface XComponent</td> </tr> <tr> <td/></tr> <tr> <td><dl> <dt><b>Description</b></dt> <dd>allows to exclicitly free resources and break cyclic references. </dd> <dd><p>Actually the real lifetime of an UNO object is controlled by references kept on interfaces of this object. But there are two distinct meanings in keeping a reference to an interface: 1st to own the object and 2nd to know the object. <p>You are only allowed to keep references of interfaces to UNO objects if you are by definition the owner of that object or your reference is very temporary or you have registered an EventListener at that object and release the reference when "disposing" is called.</p> </dd> </dl> <a name="devmanual"> </a><dl> <dt><b>Developers Guide</b></dt> <dd><a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Lifetime_of_UNO_objects">ProUNO - Lifetime of UNO objects</a></dd> <dd><a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Closing_Documents">OfficeDev - Closing Documents</a></dd> <dd><a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/XComponent">WritingUNO - XComponent</a></dd> <dd><a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Core_Interfaces_to_Implement">WritingUNO - Core Interfaces to Implement</a></dd> <dd><a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Using_the_Component_Framework">OfficeDev - Using the Component Framework</a></dd> </dl> </td> </tr> </table> <hr> <a name="MethodsSummary"/><table border="1" width="100%" cellpadding="5" cellspacing="0" class="subtitle"> <tr> <td class="subtitle" colspan="2">Methods' Summary</td> </tr> <tr> <td class="imsum_left"><a href="#dispose">dispose</a></td> <td class="imsum_right">The owner of an object calls this method to explicitly free all resources kept by this object and thus break cyclic references. </td> </tr> <tr> <td class="imsum_left"><a href="#addEventListener">addEventListener</a></td> <td class="imsum_right">adds an event listener to the object. </td> </tr> <tr> <td class="imsum_left"><a href="#removeEventListener">removeEventListener</a></td> <td class="imsum_right">removes an event listener from the listener list. </td> </tr> </table> <a name="MethodsDetails"/><table border="1" width="100%" cellpadding="5" cellspacing="0" class="subtitle"> <tr> <td class="subtitle">Methods' Details</td> </tr> <tr> <td class="imdetail"><a name="dispose" class="membertitle">dispose</a><table border="0" width="96%" cellpadding="5" cellspacing="0" class="table-in-method" bgcolor="#ffffff" align="center"> <tr> <td><table class="table-in-method" border="0"> <tr> <td valign="top" colspan="3">void</td> </tr> <tr> <td valign="top"><b>dispose</b>();</td> </tr> </table> <hr> <dl> <dt><b>Description</b></dt> <dd>The owner of an object calls this method to explicitly free all resources kept by this object and thus break cyclic references. </dd> <dd><p>Only the owner of this object is allowed to call this method. The object should release all resources and references in the easiest possible manner ( for instance no serialization should take place anymore ). </p> <p> The object must notify all registered listeners using the method <a href="XEventListener.html">XEventListener</a>::<a href="XEventListener.html#disposing">disposing</a>. All notfied objects should release there references to this object without calling <a href="XComponent.html">XComponent</a>::<a href="XComponent.html#removeEventListener">removeEventListener</a> (the disposed object will release the listeners eitherway). </p> <p>After this method has been called, the object should behave as passive as possible, thus it should ignore all calls in case it can comply with its specification (for instance addEventListener()). Often the object can't fulfill its specification anymore, in this case it must throw the <a href="DisposedException.html">DisposedException</a> (which is derived from ::com::sun::star::<a href="../uno/module-ix.html">uno</a>::<a href="../uno/RuntimeException.html">RuntimeException</a>) when it gets called.</p> <p>For some objects no real owner can be identified, thus it can be disposed from multiple reference holders. In this case the object should be able to cope with multiple dispose()-calls (which are inevitable in a multithreaded environment). </dd> </dl> </td> </tr> </table> </td> </tr> <tr> <td class="imdetail"><a name="addEventListener" class="membertitle">addEventListener</a><table border="0" width="96%" cellpadding="5" cellspacing="0" class="table-in-method" bgcolor="#ffffff" align="center"> <tr> <td><table class="table-in-method" border="0"> <tr> <td valign="top" colspan="3">void</td> </tr> <tr> <td valign="top"><b>addEventListener</b>(</td> <td valign="top">[in] <a href="XEventListener.html">XEventListener</a></td> <td valign="bottom"> xListener );</td> </tr> </table> <hr> <dl> <dt><b>Description</b></dt> <dd>adds an event listener to the object. </dd> <dd><p>The broadcaster fires the disposing method of this listener if the <a href="XComponent.html">XComponent</a>::<a href="XComponent.html#dispose">dispose</a> method is called.</p> <p>It is suggested to allow multiple registration of the same listener, thus for each time a listener is added, it has to be removed.</p> <p>If this <a href="XComponent.html">XComponent</a> is already disposed when <a href="XComponent.html">XComponent</a>::<a href="XComponent.html#addEventListener">addEventListener</a> is called, the call will not fail with a <a href="DisposedException.html">DisposedException</a>, but the caller will be notified via the <a href="XEventListener.html">XEventListener</a>::<a href="XEventListener.html#disposing">disposing</a> callback. This callback can occur synchronously within the <a href="XComponent.html">XComponent</a>::<a href="XComponent.html#addEventListener">addEventListener</a> call.</p> </dd> <dt><b>See also</b></dt> <dd><a href="XComponent.html">XComponent</a>::<a href="XComponent.html#removeEventListener">removeEventListener</a></dd> </dl> </td> </tr> </table> </td> </tr> <tr> <td class="imdetail"><a name="removeEventListener" class="membertitle">removeEventListener</a><table border="0" width="96%" cellpadding="5" cellspacing="0" class="table-in-method" bgcolor="#ffffff" align="center"> <tr> <td><table class="table-in-method" border="0"> <tr> <td valign="top" colspan="3">void</td> </tr> <tr> <td valign="top"><b>removeEventListener</b>(</td> <td valign="top">[in] <a href="XEventListener.html">XEventListener</a></td> <td valign="bottom"> aListener );</td> </tr> </table> <hr> <dl> <dt><b>Description</b></dt> <dd>removes an event listener from the listener list. </dd> <dd><p>It is a "noop" if the specified listener is not registered.</p> <p>It is suggested to allow multiple registration of the same listener, thus for each time a listener is added, it has to be removed. <p>If this <a href="XComponent.html">XComponent</a> is already disposed when <a href="XComponent.html">XComponent</a>::<a href="XComponent.html#removeEventListener">removeEventListener</a> is called, the call will not fail with a <a href="DisposedException.html">DisposedException</a>, but will rather be ignored silently.</p> </dd> <dt><b>See also</b></dt> <dd><a href="XComponent.html">XComponent</a>::<a href="XComponent.html#addEventListener">addEventListener</a></dd> </dl> </td> </tr> </table> </td> </tr> </table> <a href="#_top_">Top of Page</a><hr size="3"><p class="copyright" align="center">Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.</p> </div> <!-- id="adc-idlref" --> </body> </html>