OpenOffice API experts,

I've inherited code for an OpenOffice extension in C++ that
purportedly ran with a previous version of OpenOffice who knows how
long ago.  The code is throwing an exception.  It is presently being
built with Visual C++ 2008 and running under Windows 7, although I
doubt that either of those is the problem.  By the time the exception
is caught, it is of type com::sun::star::uno::Exception & with the
message "[context="user"] caught unexpected exception!".  However,
previous to that the debugger sees a
com::sun::star::ucb::InteractiveAugmentedIOException, an 'anonymous
namespace'::NoDescriptionException, a few
com::sun::star::ucb::InteractiveAugmentedIOException's, and a
com::sun::star::lang::WrappedTargetRuntimeException.

The code is below.   I believe that it is preparing to load a graphic
from the extension's installation directory.  Perhaps there is an
alternate way to do that now.  Any and all help would be appreciated.
Thanks.

OUString getPathToExtensionRoot(const char* name) {
    OUString ouName = OUString::createFromAscii(name);
    // localContext seems to be good.  It can be used for other things.
    Reference<XComponentContext> localContext =
        defaultBootstrap_InitialComponentContext();
    Reference<XPackageInformationProvider> xPackageInformationProvider =
        PackageInformationProvider::get(localContext);
    // The following line crashes as does any other call using ->
    // xPackageInfoProvider.is() reports 1
    try {
        OUString path = xPackageInformationProvider->getPackageLocation(ouName);
        return path;
    }
    catch (Exception &ex) {
    }
    return ouName; // just to return something
}

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

Reply via email to