update dev300-m58
[ooovba.git] / uui / source / requeststringresolver.cxx
blob8b8be7c62dc865edc22d7a03ae33017aee4fd506
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: requeststringresolver.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "requeststringresolver.hxx"
32 #include "iahndl.hxx"
34 using namespace com::sun;
36 UUIInteractionRequestStringResolver::UUIInteractionRequestStringResolver(
37 star::uno::Reference< star::lang::XMultiServiceFactory > const &
38 rServiceFactory)
39 SAL_THROW(())
40 : m_xServiceFactory(rServiceFactory),
41 m_pImpl(new UUIInteractionHelper(rServiceFactory))
45 UUIInteractionRequestStringResolver::~UUIInteractionRequestStringResolver()
47 delete m_pImpl;
50 rtl::OUString SAL_CALL
51 UUIInteractionRequestStringResolver::getImplementationName()
52 throw (star::uno::RuntimeException)
54 return rtl::OUString::createFromAscii(m_aImplementationName);
57 sal_Bool SAL_CALL
58 UUIInteractionRequestStringResolver::supportsService(
59 rtl::OUString const & rServiceName)
60 throw (star::uno::RuntimeException)
62 star::uno::Sequence< rtl::OUString >
63 aNames(getSupportedServiceNames_static());
64 for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
65 if (aNames[i] == rServiceName)
66 return true;
67 return false;
70 star::uno::Sequence< rtl::OUString > SAL_CALL
71 UUIInteractionRequestStringResolver::getSupportedServiceNames()
72 throw (star::uno::RuntimeException)
74 return getSupportedServiceNames_static();
77 star::beans::Optional< rtl::OUString > SAL_CALL
78 UUIInteractionRequestStringResolver::getStringFromInformationalRequest(
79 const star::uno::Reference<
80 star::task::XInteractionRequest >& Request )
81 throw (star::uno::RuntimeException)
83 try
85 return m_pImpl->getStringFromRequest(Request);
87 catch (star::uno::RuntimeException const & ex)
89 throw star::uno::RuntimeException(ex.Message, *this);
93 char const UUIInteractionRequestStringResolver::m_aImplementationName[]
94 = "com.sun.star.comp.uui.UUIInteractionRequestStringResolver";
96 star::uno::Sequence< rtl::OUString >
97 UUIInteractionRequestStringResolver::getSupportedServiceNames_static()
99 star::uno::Sequence< rtl::OUString > aNames(1);
100 aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
101 "com.sun.star.task.InteractionRequestStringResolver"));
102 return aNames;
105 star::uno::Reference< star::uno::XInterface > SAL_CALL
106 UUIInteractionRequestStringResolver::createInstance(
107 star::uno::Reference< star::lang::XMultiServiceFactory > const &
108 rServiceFactory)
109 SAL_THROW((star::uno::Exception))
113 return *new UUIInteractionRequestStringResolver(rServiceFactory);
115 catch (std::bad_alloc const &)
117 throw star::uno::RuntimeException(
118 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),