LCOV - code coverage report
Current view: top level - util - NumberFormatsSupplier.hpp (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 22 54.5 %
Date: 2013-07-09 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #ifndef INCLUDED_COM_SUN_STAR_UTIL_NUMBERFORMATSSUPPLIER_HPP
       2             : #define INCLUDED_COM_SUN_STAR_UTIL_NUMBERFORMATSSUPPLIER_HPP
       3             : 
       4             : #include "sal/config.h"
       5             : 
       6             : #include <cassert>
       7             : 
       8             : #include "com/sun/star/lang/Locale.hpp"
       9             : #include "com/sun/star/uno/DeploymentException.hpp"
      10             : #include "com/sun/star/uno/Exception.hpp"
      11             : #include "com/sun/star/uno/RuntimeException.hpp"
      12             : #include "com/sun/star/uno/XComponentContext.hpp"
      13             : #include "com/sun/star/util/XNumberFormatsSupplier.hpp"
      14             : #include "com/sun/star/uno/Any.hxx"
      15             : #include "com/sun/star/uno/Reference.hxx"
      16             : #include "com/sun/star/uno/Sequence.hxx"
      17             : #include "cppu/unotype.hxx"
      18             : #include "rtl/ustring.h"
      19             : #include "rtl/ustring.hxx"
      20             : 
      21             : namespace com { namespace sun { namespace star { namespace util {
      22             : 
      23             : class NumberFormatsSupplier {
      24             : public:
      25         105 :     static ::com::sun::star::uno::Reference< css::util::XNumberFormatsSupplier > createWithLocale(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const css::lang::Locale& Locale) {
      26             :         assert(the_context.is());
      27         105 :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
      28         105 :         the_arguments[0] <<= Locale;
      29         105 :         ::com::sun::star::uno::Reference< css::util::XNumberFormatsSupplier > the_instance;
      30             :         try {
      31         105 :             the_instance = ::com::sun::star::uno::Reference< css::util::XNumberFormatsSupplier >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.util.NumberFormatsSupplier" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
      32           0 :         } catch (const ::com::sun::star::uno::RuntimeException &) {
      33           0 :             throw;
      34           0 :         } catch (const ::com::sun::star::uno::Exception & the_exception) {
      35           0 :             throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.util.NumberFormatsSupplier of type com.sun.star.util.XNumberFormatsSupplier: " ) + the_exception.Message, the_context);
      36             :         }
      37         105 :         if (!the_instance.is()) {
      38           0 :             throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.util.NumberFormatsSupplier of type com.sun.star.util.XNumberFormatsSupplier" ), the_context);
      39             :         }
      40         105 :         return the_instance;
      41             :     }
      42             : 
      43           1 :     static ::com::sun::star::uno::Reference< css::util::XNumberFormatsSupplier > createWithDefaultLocale(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context) {
      44             :         assert(the_context.is());
      45           1 :         ::com::sun::star::uno::Reference< css::util::XNumberFormatsSupplier > the_instance;
      46             :         try {
      47           1 :             the_instance = ::com::sun::star::uno::Reference< css::util::XNumberFormatsSupplier >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.util.NumberFormatsSupplier" ), ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >(), the_context), ::com::sun::star::uno::UNO_QUERY);
      48           0 :         } catch (const ::com::sun::star::uno::RuntimeException &) {
      49           0 :             throw;
      50           0 :         } catch (const ::com::sun::star::uno::Exception & the_exception) {
      51           0 :             throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.util.NumberFormatsSupplier of type com.sun.star.util.XNumberFormatsSupplier: " ) + the_exception.Message, the_context);
      52             :         }
      53           1 :         if (!the_instance.is()) {
      54           0 :             throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.util.NumberFormatsSupplier of type com.sun.star.util.XNumberFormatsSupplier" ), the_context);
      55             :         }
      56           1 :         return the_instance;
      57             :     }
      58             : 
      59             : private:
      60             :     NumberFormatsSupplier(); // not implemented
      61             :     NumberFormatsSupplier(NumberFormatsSupplier &); // not implemented
      62             :     ~NumberFormatsSupplier(); // not implemented
      63             :     void operator =(NumberFormatsSupplier); // not implemented
      64             : };
      65             : 
      66             : } } } }
      67             : 
      68             : #endif // INCLUDED_COM_SUN_STAR_UTIL_NUMBERFORMATSSUPPLIER_HPP

Generated by: LCOV version 1.10