merge the formfield patch from ooo-build
[ooovba.git] / uui / source / interactionhandler.cxx
blobdd8a875ff079c2d008418adca0e4d526c06c8d87
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::star;
36 UUIInteractionHandler::UUIInteractionHandler(
37 uno::Reference< 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 (uno::RuntimeException)
53 return rtl::OUString::createFromAscii(m_aImplementationName);
56 sal_Bool SAL_CALL
57 UUIInteractionHandler::supportsService(rtl::OUString const & rServiceName)
58 throw (uno::RuntimeException)
60 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 uno::Sequence< rtl::OUString > SAL_CALL
69 UUIInteractionHandler::getSupportedServiceNames()
70 throw (uno::RuntimeException)
72 return getSupportedServiceNames_static();
75 void SAL_CALL
76 UUIInteractionHandler::initialize(
77 uno::Sequence< uno::Any > const & rArguments)
78 throw (uno::Exception)
80 delete m_pImpl;
81 m_pImpl = new UUIInteractionHelper(m_xServiceFactory, rArguments);
84 void SAL_CALL
85 UUIInteractionHandler::handle(
86 uno::Reference< task::XInteractionRequest > const & rRequest)
87 throw (uno::RuntimeException)
89 try
91 m_pImpl->handleRequest(rRequest);
93 catch (uno::RuntimeException const & ex)
95 throw uno::RuntimeException(ex.Message, *this);
99 ::sal_Bool SAL_CALL UUIInteractionHandler::handleInteractionRequest(
100 const uno::Reference< task::XInteractionRequest >& _Request ) throw ( uno::RuntimeException )
104 return m_pImpl->handleRequest( _Request );
106 catch (uno::RuntimeException const & ex)
108 throw uno::RuntimeException( ex.Message, *this );
110 return sal_False;
113 char const UUIInteractionHandler::m_aImplementationName[]
114 = "com.sun.star.comp.uui.UUIInteractionHandler";
116 uno::Sequence< rtl::OUString >
117 UUIInteractionHandler::getSupportedServiceNames_static()
119 uno::Sequence< rtl::OUString > aNames(3);
120 aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
121 "com.sun.star.task.InteractionHandler"));
122 // added to indicate support for configuration.backend.MergeRecoveryRequest
123 aNames[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
124 "com.sun.star.configuration.backend.InteractionHandler"));
125 aNames[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
126 "com.sun.star.uui.InteractionHandler"));
127 // for backwards compatibility
128 return aNames;
131 uno::Reference< uno::XInterface > SAL_CALL
132 UUIInteractionHandler::createInstance(
133 uno::Reference< lang::XMultiServiceFactory > const &
134 rServiceFactory)
135 SAL_THROW((uno::Exception))
139 return *new UUIInteractionHandler(rServiceFactory);
141 catch (std::bad_alloc const &)
143 throw uno::RuntimeException(
144 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),