Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / uui / source / requeststringresolver.cxx
blobde69c56818999084805e9dd2fb50b2cb5cdb531e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "requeststringresolver.hxx"
21 #include "iahndl.hxx"
23 using namespace com::sun;
25 UUIInteractionRequestStringResolver::UUIInteractionRequestStringResolver(
26 star::uno::Reference< star::lang::XMultiServiceFactory > const &
27 rServiceFactory)
28 SAL_THROW(())
29 : m_xServiceFactory(rServiceFactory),
30 m_pImpl(new UUIInteractionHelper(rServiceFactory))
34 UUIInteractionRequestStringResolver::~UUIInteractionRequestStringResolver()
36 delete m_pImpl;
39 rtl::OUString SAL_CALL
40 UUIInteractionRequestStringResolver::getImplementationName()
41 throw (star::uno::RuntimeException)
43 return rtl::OUString::createFromAscii(m_aImplementationName);
46 sal_Bool SAL_CALL
47 UUIInteractionRequestStringResolver::supportsService(
48 rtl::OUString const & rServiceName)
49 throw (star::uno::RuntimeException)
51 star::uno::Sequence< rtl::OUString >
52 aNames(getSupportedServiceNames_static());
53 for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
54 if (aNames[i] == rServiceName)
55 return true;
56 return false;
59 star::uno::Sequence< rtl::OUString > SAL_CALL
60 UUIInteractionRequestStringResolver::getSupportedServiceNames()
61 throw (star::uno::RuntimeException)
63 return getSupportedServiceNames_static();
66 star::beans::Optional< rtl::OUString > SAL_CALL
67 UUIInteractionRequestStringResolver::getStringFromInformationalRequest(
68 const star::uno::Reference<
69 star::task::XInteractionRequest >& Request )
70 throw (star::uno::RuntimeException)
72 try
74 return m_pImpl->getStringFromRequest(Request);
76 catch (star::uno::RuntimeException const & ex)
78 throw star::uno::RuntimeException(ex.Message, *this);
82 char const UUIInteractionRequestStringResolver::m_aImplementationName[]
83 = "com.sun.star.comp.uui.UUIInteractionRequestStringResolver";
85 star::uno::Sequence< rtl::OUString >
86 UUIInteractionRequestStringResolver::getSupportedServiceNames_static()
88 star::uno::Sequence< rtl::OUString > aNames(1);
89 aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
90 "com.sun.star.task.InteractionRequestStringResolver"));
91 return aNames;
94 star::uno::Reference< star::uno::XInterface > SAL_CALL
95 UUIInteractionRequestStringResolver::createInstance(
96 star::uno::Reference< star::lang::XMultiServiceFactory > const &
97 rServiceFactory)
98 SAL_THROW((star::uno::Exception))
102 return *new UUIInteractionRequestStringResolver(rServiceFactory);
104 catch (std::bad_alloc const &)
106 throw star::uno::RuntimeException(
107 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */