Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


On 02/15/2013 10:35 AM, Noel Grandin wrote:
Then how about this?
Split the logic so we can differentiate the cases.

It would grow more code, but if you absolutely feel like it...  :)

(In which case the "of type XFilePicker3" should arguably be removed from the original two throw expressions.)

Also, we could reduce the compress the EXE size a little by moving all
of this boilerplate into a central utility method somewhere.

Yeah, might be possible to abstract out some common code into one or more functions.

static Reference< XFilePicker3 > createDefault(Reference<
XComponentContext > const & the_context) {
    assert(the_context.is());
    Reference< XInterface > the_instance1;
    try {
      the_instance1 =
the_context->getServiceManager()->createInstanceWithArgumentsAndContext(
                         "com.sun.star.ui.dialogs.FilePicker" ,
                         Sequence<Any>(),
                         the_context),
     } catch (RuntimeException &) {
       throw;
     } catch (Exception & the_exception) {
       throw DeploymentException( "component context fails to supply
service FilePicker of type XFilePicker3: "
                       + the_exception.Message, the_context);
     }
     if (!the_instance1.is()) {
          throw DeploymentException( "component context fails to supply
service FilePicker of type XFilePicker3" ), the_context);
     }
     Reference< XFilePicker3 > the_instance2( the_instance1, UNO_QUERY );
     if (!the_instance2.is()) {
         throw DeploymentException( "component context supplied a
service FilePicker, but the service does not implement interface
XFilePicker3" ), the_context);     }
     return the_instance;
}

Stephan

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.