Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / uui / source / requeststringresolver.cxx
blob77df688dbb2c3f8631d11a349d486fbf92120bfb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "requeststringresolver.hxx"
30 #include "iahndl.hxx"
32 using namespace com::sun;
34 UUIInteractionRequestStringResolver::UUIInteractionRequestStringResolver(
35 star::uno::Reference< star::lang::XMultiServiceFactory > const &
36 rServiceFactory)
37 SAL_THROW(())
38 : m_xServiceFactory(rServiceFactory),
39 m_pImpl(new UUIInteractionHelper(rServiceFactory))
43 UUIInteractionRequestStringResolver::~UUIInteractionRequestStringResolver()
45 delete m_pImpl;
48 rtl::OUString SAL_CALL
49 UUIInteractionRequestStringResolver::getImplementationName()
50 throw (star::uno::RuntimeException)
52 return rtl::OUString::createFromAscii(m_aImplementationName);
55 sal_Bool SAL_CALL
56 UUIInteractionRequestStringResolver::supportsService(
57 rtl::OUString const & rServiceName)
58 throw (star::uno::RuntimeException)
60 star::uno::Sequence< rtl::OUString >
61 aNames(getSupportedServiceNames_static());
62 for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
63 if (aNames[i] == rServiceName)
64 return true;
65 return false;
68 star::uno::Sequence< rtl::OUString > SAL_CALL
69 UUIInteractionRequestStringResolver::getSupportedServiceNames()
70 throw (star::uno::RuntimeException)
72 return getSupportedServiceNames_static();
75 star::beans::Optional< rtl::OUString > SAL_CALL
76 UUIInteractionRequestStringResolver::getStringFromInformationalRequest(
77 const star::uno::Reference<
78 star::task::XInteractionRequest >& Request )
79 throw (star::uno::RuntimeException)
81 try
83 return m_pImpl->getStringFromRequest(Request);
85 catch (star::uno::RuntimeException const & ex)
87 throw star::uno::RuntimeException(ex.Message, *this);
91 char const UUIInteractionRequestStringResolver::m_aImplementationName[]
92 = "com.sun.star.comp.uui.UUIInteractionRequestStringResolver";
94 star::uno::Sequence< rtl::OUString >
95 UUIInteractionRequestStringResolver::getSupportedServiceNames_static()
97 star::uno::Sequence< rtl::OUString > aNames(1);
98 aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
99 "com.sun.star.task.InteractionRequestStringResolver"));
100 return aNames;
103 star::uno::Reference< star::uno::XInterface > SAL_CALL
104 UUIInteractionRequestStringResolver::createInstance(
105 star::uno::Reference< star::lang::XMultiServiceFactory > const &
106 rServiceFactory)
107 SAL_THROW((star::uno::Exception))
111 return *new UUIInteractionRequestStringResolver(rServiceFactory);
113 catch (std::bad_alloc const &)
115 throw star::uno::RuntimeException(
116 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */