Hi there,

I used the css.document.XDocumentEventBroadcaster that is supposed to replace 
"the XEventBroadcaster interface, which should not be used anymore" , but 
http://svn.services.openoffice.org/opengrok/xref/DEV300_m61/offapi/com/sun/star/document/XDocumentEventBroadcaster.idl
has no since tag and a Job that added a listener did nothing, so I changed the 
code to work both with the old and the new interfaces:


    // only listen for documents that can be printed
    uno::Reference< view::XPrintable > xPrintable( xModel, uno::UNO_QUERY );
    if ( xPrintable.is() )
    {
        uno::Reference< document::XDocumentEventBroadcaster > xBroadcaster( 
xModel, uno::UNO_QUERY );
        if ( xBroadcaster.is() )
        {
            uno::Reference< document::XDocumentEventListener > xDocListener( 
static_cast< document::XDocumentEventListener* >( new 
MyUpdateOnPrintListener() ), uno::UNO_QUERY);
            xBroadcaster->addDocumentEventListener( xDocListener );
        }
        else
        {
            uno::Reference< document::XEventBroadcaster > xOldBroadcaster( 
xModel, uno::UNO_QUERY );
            if ( xOldBroadcaster.is() )
            {
                uno::Reference< document::XEventListener > xDocListener( 
static_cast< document::XEventListener* >( new MyUpdateOnPrintListener() ), 
uno::UNO_QUERY);
                xOldBroadcaster->addEventListener( xDocListener );
            }
        }
    }

to my surprise, xBroadcaster.is() evaluates to false for every office document 
(where xPrintable.is() evaluates to true  - that, I guess, is every document 
but OOo Base's ones).
The "should not be used anymore" is rather misleading: or there is a new way 
to get this broadcaster interface from a document, or no office document is 
supporting this right now, so you must stay with the old one.
Is XDocumentEventBroadcaster supported? By which services? since when?

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to