update dev300-m58
[ooovba.git] / uui / source / interactionhandler.cxx
blobb0693591d002c456d298bf61e91f6f98601f733d
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: interactionhandler.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 "iahndl.hxx"
32 #include "interactionhandler.hxx"
34 using namespace com::sun;
36 UUIInteractionHandler::UUIInteractionHandler(
37 star::uno::Reference< star::lang::XMultiServiceFactory > const &
38 rServiceFactory)
39 SAL_THROW(())
40 : m_xServiceFactory(rServiceFactory),
41 m_pImpl(new UUIInteractionHelper(m_xServiceFactory))
45 UUIInteractionHandler::~UUIInteractionHandler()
47 delete m_pImpl;
50 rtl::OUString SAL_CALL UUIInteractionHandler::getImplementationName()
51 throw (star::uno::RuntimeException)
53 return rtl::OUString::createFromAscii(m_aImplementationName);
56 sal_Bool SAL_CALL
57 UUIInteractionHandler::supportsService(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 UUIInteractionHandler::getSupportedServiceNames()
70 throw (star::uno::RuntimeException)
72 return getSupportedServiceNames_static();
75 void SAL_CALL
76 UUIInteractionHandler::initialize(
77 star::uno::Sequence< star::uno::Any > const & rArguments)
78 throw (star::uno::Exception)
80 delete m_pImpl;
81 m_pImpl = new UUIInteractionHelper(m_xServiceFactory, rArguments);
84 void SAL_CALL
85 UUIInteractionHandler::handle(
86 star::uno::Reference< star::task::XInteractionRequest > const & rRequest)
87 throw (star::uno::RuntimeException)
89 try
91 m_pImpl->handleRequest(rRequest);
93 catch (star::uno::RuntimeException const & ex)
95 throw star::uno::RuntimeException(ex.Message, *this);
99 char const UUIInteractionHandler::m_aImplementationName[]
100 = "com.sun.star.comp.uui.UUIInteractionHandler";
102 star::uno::Sequence< rtl::OUString >
103 UUIInteractionHandler::getSupportedServiceNames_static()
105 star::uno::Sequence< rtl::OUString > aNames(3);
106 aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
107 "com.sun.star.task.InteractionHandler"));
108 // added to indicate support for configuration.backend.MergeRecoveryRequest
109 aNames[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
110 "com.sun.star.configuration.backend.InteractionHandler"));
111 aNames[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
112 "com.sun.star.uui.InteractionHandler"));
113 // for backwards compatibility
114 return aNames;
117 star::uno::Reference< star::uno::XInterface > SAL_CALL
118 UUIInteractionHandler::createInstance(
119 star::uno::Reference< star::lang::XMultiServiceFactory > const &
120 rServiceFactory)
121 SAL_THROW((star::uno::Exception))
125 return *new UUIInteractionHandler(rServiceFactory);
127 catch (std::bad_alloc const &)
129 throw star::uno::RuntimeException(
130 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),