openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Alcock <>
Subject Programmatically (C++) closing frame with chance to save
Date Tue, 28 Oct 2014 14:32:31 GMT
API experts,

I need to close some of the open document windows from within a C++
addon.  Some of the documents may have been modified, so there should
be a chance to save them or even abort the close, just like you get
with the Close command from the UI.  It seems like XCloseable is just
the thing for this, but when I perform xCloseable->close() on either
the XFrame or XModel, the window summarily closes even with a modified
document.  Am I calling it on the wrong object or is this not how the
functionality should be implemented or is something else wrong?  Here
is an incomplete code that approximates what I'm doing:

Reference<XEnumerationAccess> xEnumerationAccess = xDesktop->getComponents();
Reference<XEnumeration> xEnumeration = xEnumerationAccess->createEnumeration();

while (xEnumeration->hasMoreElements() == sal_True) {
    Reference<XComponent> xComponent;
    Any any = xEnumeration->nextElement();
    any >>= xComponent;

    Reference<XModel> xModel(xComponent, UNO_QUERY);
    Reference<XController> xController = xModel->getCurrentController();
    Reference<XFrame> xFrame = xController->getFrame();

    Reference<XCloseable> xCloseableFrame(xFrame, UNO_QUERY);

The frame closes nicely, but no messages about needing to save the
document appear.  Any ideas?  Thanks.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message