merged tag ooo/DEV300_m102
[LibreOffice.git] / uui / source / requeststringresolver.cxx
blob319109bd45dffeb79b8c0ce234579f5cd69db5bf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #include "requeststringresolver.hxx"
29 #include "iahndl.hxx"
31 using namespace com::sun;
33 UUIInteractionRequestStringResolver::UUIInteractionRequestStringResolver(
34 star::uno::Reference< star::lang::XMultiServiceFactory > const &
35 rServiceFactory)
36 SAL_THROW(())
37 : m_xServiceFactory(rServiceFactory),
38 m_pImpl(new UUIInteractionHelper(rServiceFactory))
42 UUIInteractionRequestStringResolver::~UUIInteractionRequestStringResolver()
44 delete m_pImpl;
47 rtl::OUString SAL_CALL
48 UUIInteractionRequestStringResolver::getImplementationName()
49 throw (star::uno::RuntimeException)
51 return rtl::OUString::createFromAscii(m_aImplementationName);
54 sal_Bool SAL_CALL
55 UUIInteractionRequestStringResolver::supportsService(
56 rtl::OUString const & rServiceName)
57 throw (star::uno::RuntimeException)
59 star::uno::Sequence< rtl::OUString >
60 aNames(getSupportedServiceNames_static());
61 for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
62 if (aNames[i] == rServiceName)
63 return true;
64 return false;
67 star::uno::Sequence< rtl::OUString > SAL_CALL
68 UUIInteractionRequestStringResolver::getSupportedServiceNames()
69 throw (star::uno::RuntimeException)
71 return getSupportedServiceNames_static();
74 star::beans::Optional< rtl::OUString > SAL_CALL
75 UUIInteractionRequestStringResolver::getStringFromInformationalRequest(
76 const star::uno::Reference<
77 star::task::XInteractionRequest >& Request )
78 throw (star::uno::RuntimeException)
80 try
82 return m_pImpl->getStringFromRequest(Request);
84 catch (star::uno::RuntimeException const & ex)
86 throw star::uno::RuntimeException(ex.Message, *this);
90 char const UUIInteractionRequestStringResolver::m_aImplementationName[]
91 = "com.sun.star.comp.uui.UUIInteractionRequestStringResolver";
93 star::uno::Sequence< rtl::OUString >
94 UUIInteractionRequestStringResolver::getSupportedServiceNames_static()
96 star::uno::Sequence< rtl::OUString > aNames(1);
97 aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
98 "com.sun.star.task.InteractionRequestStringResolver"));
99 return aNames;
102 star::uno::Reference< star::uno::XInterface > SAL_CALL
103 UUIInteractionRequestStringResolver::createInstance(
104 star::uno::Reference< star::lang::XMultiServiceFactory > const &
105 rServiceFactory)
106 SAL_THROW((star::uno::Exception))
110 return *new UUIInteractionRequestStringResolver(rServiceFactory);
112 catch (std::bad_alloc const &)
114 throw star::uno::RuntimeException(
115 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),