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 "requeststringresolver.hxx"
21 : : #include "iahndl.hxx"
22 : :
23 : : using namespace com::sun;
24 : :
25 : 0 : UUIInteractionRequestStringResolver::UUIInteractionRequestStringResolver(
26 : : star::uno::Reference< star::lang::XMultiServiceFactory > const &
27 : : rServiceFactory)
28 : : SAL_THROW(())
29 : : : m_xServiceFactory(rServiceFactory),
30 [ # # ][ # # ]: 0 : m_pImpl(new UUIInteractionHelper(rServiceFactory))
31 : : {
32 : 0 : }
33 : :
34 : 0 : UUIInteractionRequestStringResolver::~UUIInteractionRequestStringResolver()
35 : : {
36 [ # # ][ # # ]: 0 : delete m_pImpl;
37 [ # # ]: 0 : }
38 : :
39 : : rtl::OUString SAL_CALL
40 : 0 : UUIInteractionRequestStringResolver::getImplementationName()
41 : : throw (star::uno::RuntimeException)
42 : : {
43 : 0 : return rtl::OUString::createFromAscii(m_aImplementationName);
44 : : }
45 : :
46 : : sal_Bool SAL_CALL
47 : 0 : UUIInteractionRequestStringResolver::supportsService(
48 : : rtl::OUString const & rServiceName)
49 : : throw (star::uno::RuntimeException)
50 : : {
51 : : star::uno::Sequence< rtl::OUString >
52 [ # # ]: 0 : aNames(getSupportedServiceNames_static());
53 [ # # ]: 0 : for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
54 [ # # ][ # # ]: 0 : if (aNames[i] == rServiceName)
55 : 0 : return true;
56 [ # # ]: 0 : return false;
57 : : }
58 : :
59 : : star::uno::Sequence< rtl::OUString > SAL_CALL
60 : 0 : UUIInteractionRequestStringResolver::getSupportedServiceNames()
61 : : throw (star::uno::RuntimeException)
62 : : {
63 : 0 : return getSupportedServiceNames_static();
64 : : }
65 : :
66 : : star::beans::Optional< rtl::OUString > SAL_CALL
67 : 0 : UUIInteractionRequestStringResolver::getStringFromInformationalRequest(
68 : : const star::uno::Reference<
69 : : star::task::XInteractionRequest >& Request )
70 : : throw (star::uno::RuntimeException)
71 : : {
72 : : try
73 : : {
74 [ # # ]: 0 : return m_pImpl->getStringFromRequest(Request);
75 : : }
76 [ # # ]: 0 : catch (star::uno::RuntimeException const & ex)
77 : : {
78 [ # # # # ]: 0 : throw star::uno::RuntimeException(ex.Message, *this);
79 : : }
80 : : }
81 : :
82 : : char const UUIInteractionRequestStringResolver::m_aImplementationName[]
83 : : = "com.sun.star.comp.uui.UUIInteractionRequestStringResolver";
84 : :
85 : : star::uno::Sequence< rtl::OUString >
86 : 0 : UUIInteractionRequestStringResolver::getSupportedServiceNames_static()
87 : : {
88 : 0 : star::uno::Sequence< rtl::OUString > aNames(1);
89 [ # # ]: 0 : aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
90 [ # # ]: 0 : "com.sun.star.task.InteractionRequestStringResolver"));
91 : 0 : return aNames;
92 : : }
93 : :
94 : : star::uno::Reference< star::uno::XInterface > SAL_CALL
95 : 0 : UUIInteractionRequestStringResolver::createInstance(
96 : : star::uno::Reference< star::lang::XMultiServiceFactory > const &
97 : : rServiceFactory)
98 : : SAL_THROW((star::uno::Exception))
99 : : {
100 : : try
101 : : {
102 [ # # ][ # # ]: 0 : return *new UUIInteractionRequestStringResolver(rServiceFactory);
103 : : }
104 [ # # ]: 0 : catch (std::bad_alloc const &)
105 : : {
106 : : throw star::uno::RuntimeException(
107 : : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
108 [ # # # # : 0 : 0);
# # ]
109 : : }
110 : : }
111 : :
112 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|