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);
    xCloseableFrame->close(sal_True);
    return;
}

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

Keith

---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org

Reply via email to