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 : #include <comphelper/processfactory.hxx>
23 :
24 : using namespace com::sun;
25 :
26 0 : UUIInteractionRequestStringResolver::UUIInteractionRequestStringResolver(
27 : star::uno::Reference< star::uno::XComponentContext > const &
28 : rxContext)
29 : SAL_THROW(())
30 0 : : m_pImpl(new UUIInteractionHelper(rxContext))
31 : {
32 0 : }
33 :
34 0 : UUIInteractionRequestStringResolver::~UUIInteractionRequestStringResolver()
35 : {
36 0 : delete m_pImpl;
37 0 : }
38 :
39 : OUString SAL_CALL
40 0 : UUIInteractionRequestStringResolver::getImplementationName()
41 : throw (star::uno::RuntimeException)
42 : {
43 0 : return OUString::createFromAscii(m_aImplementationName);
44 : }
45 :
46 : sal_Bool SAL_CALL
47 0 : UUIInteractionRequestStringResolver::supportsService(
48 : OUString const & rServiceName)
49 : throw (star::uno::RuntimeException)
50 : {
51 : star::uno::Sequence< 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< OUString > SAL_CALL
60 0 : UUIInteractionRequestStringResolver::getSupportedServiceNames()
61 : throw (star::uno::RuntimeException)
62 : {
63 0 : return getSupportedServiceNames_static();
64 : }
65 :
66 : star::beans::Optional< 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< OUString >
86 0 : UUIInteractionRequestStringResolver::getSupportedServiceNames_static()
87 : {
88 0 : star::uno::Sequence< OUString > aNames(1);
89 0 : aNames[0] = "com.sun.star.task.InteractionRequestStringResolver";
90 0 : return aNames;
91 : }
92 :
93 : star::uno::Reference< star::uno::XInterface > SAL_CALL
94 0 : UUIInteractionRequestStringResolver::createInstance(
95 : star::uno::Reference< star::lang::XMultiServiceFactory > const &
96 : rServiceFactory)
97 : SAL_THROW((star::uno::Exception))
98 : {
99 : try
100 : {
101 0 : return *new UUIInteractionRequestStringResolver(comphelper::getComponentContext(rServiceFactory));
102 : }
103 0 : catch (std::bad_alloc const &)
104 : {
105 0 : throw star::uno::RuntimeException("out of memory", 0);
106 : }
107 : }
108 :
109 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|