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