On Thu, Feb 26, 2015 at 01:54:38PM +0100, Stephan Bergmann wrote:
Ah, right. So better to go via queryInterface as below (or add a
convenient wrapper around it into uno.py say).
import uno
from com.sun.star.uno.TypeClass import INTERFACE
x = uno.getComponentContext()
y = x.queryInterface(uno.Type("com.sun.star.uno.XComponentContext", INTERFACE))
y
pyuno object
(com.sun.star.uno.XComponentContext)0x7f0941697060{,supportedInterfaces={com.sun.star.uno.XComponentContext,com.sun.star.container.XNameContainer,com.sun.star.lang.XTypeProvider,com.sun.star.uno.XWeak,com.sun.star.lang.XComponent}}
z = x.queryInterface(uno.Type("com.sun.star.util.XCloseable", INTERFACE))
z is None
True
Thank you for the discussion. I have adjusted my code to the following,
which seems to work:
from com.sun.star.uno.TypeClass import INTERFACE
# or use: hasattr(document, "queryInterface")
if "queryInterface" in dir(document) and
document.queryInterface(uno.Type("com.sun.star.util.XCloseable", INTERFACE)) :
document.close(True)
else :
document.dispose()
Cheers,
Jens
--
Jens Tröger
http://savage.light-speed.de/
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.