Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include "iahndl.hxx"
21 : : #include "interactionhandler.hxx"
22 : :
23 : : using namespace com::sun::star;
24 : :
25 : 421 : UUIInteractionHandler::UUIInteractionHandler(
26 : : uno::Reference< lang::XMultiServiceFactory > const &
27 : : rServiceFactory)
28 : : SAL_THROW(())
29 : : : m_xServiceFactory(rServiceFactory),
30 [ + - ][ + - ]: 421 : m_pImpl(new UUIInteractionHelper(m_xServiceFactory))
31 : : {
32 : 421 : }
33 : :
34 : 421 : UUIInteractionHandler::~UUIInteractionHandler()
35 : : {
36 [ + - ][ + - ]: 421 : delete m_pImpl;
37 [ - + ]: 842 : }
38 : :
39 : 0 : rtl::OUString SAL_CALL UUIInteractionHandler::getImplementationName()
40 : : throw (uno::RuntimeException)
41 : : {
42 : 0 : return rtl::OUString::createFromAscii(m_aImplementationName);
43 : : }
44 : :
45 : : sal_Bool SAL_CALL
46 : 0 : UUIInteractionHandler::supportsService(rtl::OUString const & rServiceName)
47 : : throw (uno::RuntimeException)
48 : : {
49 : : uno::Sequence< rtl::OUString >
50 [ # # ]: 0 : aNames(getSupportedServiceNames_static());
51 [ # # ]: 0 : for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
52 [ # # ][ # # ]: 0 : if (aNames[i] == rServiceName)
53 : 0 : return true;
54 [ # # ]: 0 : return false;
55 : : }
56 : :
57 : : uno::Sequence< rtl::OUString > SAL_CALL
58 : 0 : UUIInteractionHandler::getSupportedServiceNames()
59 : : throw (uno::RuntimeException)
60 : : {
61 : 0 : return getSupportedServiceNames_static();
62 : : }
63 : :
64 : : void SAL_CALL
65 : 0 : UUIInteractionHandler::initialize(
66 : : uno::Sequence< uno::Any > const & rArguments)
67 : : throw (uno::Exception)
68 : : {
69 [ # # ]: 0 : delete m_pImpl;
70 [ # # ]: 0 : m_pImpl = new UUIInteractionHelper(m_xServiceFactory, rArguments);
71 : 0 : }
72 : :
73 : : void SAL_CALL
74 : 0 : UUIInteractionHandler::handle(
75 : : uno::Reference< task::XInteractionRequest > const & rRequest)
76 : : throw (uno::RuntimeException)
77 : : {
78 : : try
79 : : {
80 [ # # ]: 0 : m_pImpl->handleRequest(rRequest);
81 : : }
82 [ # # ]: 0 : catch (uno::RuntimeException const & ex)
83 : : {
84 [ # # # # ]: 0 : throw uno::RuntimeException(ex.Message, *this);
85 : : }
86 : 0 : }
87 : :
88 : 0 : ::sal_Bool SAL_CALL UUIInteractionHandler::handleInteractionRequest(
89 : : const uno::Reference< task::XInteractionRequest >& _Request ) throw ( uno::RuntimeException )
90 : : {
91 : : try
92 : : {
93 [ # # ]: 0 : return m_pImpl->handleRequest( _Request );
94 : : }
95 [ # # ]: 0 : catch (uno::RuntimeException const & ex)
96 : : {
97 [ # # # # ]: 0 : throw uno::RuntimeException( ex.Message, *this );
98 : : }
99 : : }
100 : :
101 : : char const UUIInteractionHandler::m_aImplementationName[]
102 : : = "com.sun.star.comp.uui.UUIInteractionHandler";
103 : :
104 : : uno::Sequence< rtl::OUString >
105 : 15 : UUIInteractionHandler::getSupportedServiceNames_static()
106 : : {
107 : 15 : uno::Sequence< rtl::OUString > aNames(3);
108 [ + - ]: 15 : aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
109 [ + - ]: 30 : "com.sun.star.task.InteractionHandler"));
110 : : // added to indicate support for configuration.backend.MergeRecoveryRequest
111 [ + - ]: 15 : aNames[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
112 [ + - ]: 30 : "com.sun.star.configuration.backend.InteractionHandler"));
113 [ + - ]: 15 : aNames[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
114 [ + - ]: 30 : "com.sun.star.uui.InteractionHandler"));
115 : : // for backwards compatibility
116 : 15 : return aNames;
117 : : }
118 : :
119 : : uno::Reference< uno::XInterface > SAL_CALL
120 : 421 : UUIInteractionHandler::createInstance(
121 : : uno::Reference< lang::XMultiServiceFactory > const &
122 : : rServiceFactory)
123 : : SAL_THROW((uno::Exception))
124 : : {
125 : : try
126 : : {
127 [ + - ][ + - ]: 421 : return *new UUIInteractionHandler(rServiceFactory);
128 : : }
129 [ # # ]: 0 : catch (std::bad_alloc const &)
130 : : {
131 : : throw uno::RuntimeException(
132 : : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
133 [ # # # # : 0 : 0);
# # ]
134 : : }
135 : : }
136 : :
137 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|