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 ************************************************************************/
30 #include "interactionhandler.hxx"
32 using namespace com::sun::star
;
34 UUIInteractionHandler::UUIInteractionHandler(
35 uno::Reference
< lang::XMultiServiceFactory
> const &
38 : m_xServiceFactory(rServiceFactory
),
39 m_pImpl(new UUIInteractionHelper(m_xServiceFactory
))
43 UUIInteractionHandler::~UUIInteractionHandler()
48 rtl::OUString SAL_CALL
UUIInteractionHandler::getImplementationName()
49 throw (uno::RuntimeException
)
51 return rtl::OUString::createFromAscii(m_aImplementationName
);
55 UUIInteractionHandler::supportsService(rtl::OUString
const & rServiceName
)
56 throw (uno::RuntimeException
)
58 uno::Sequence
< rtl::OUString
>
59 aNames(getSupportedServiceNames_static());
60 for (sal_Int32 i
= 0; i
< aNames
.getLength(); ++i
)
61 if (aNames
[i
] == rServiceName
)
66 uno::Sequence
< rtl::OUString
> SAL_CALL
67 UUIInteractionHandler::getSupportedServiceNames()
68 throw (uno::RuntimeException
)
70 return getSupportedServiceNames_static();
74 UUIInteractionHandler::initialize(
75 uno::Sequence
< uno::Any
> const & rArguments
)
76 throw (uno::Exception
)
79 m_pImpl
= new UUIInteractionHelper(m_xServiceFactory
, rArguments
);
83 UUIInteractionHandler::handle(
84 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
85 throw (uno::RuntimeException
)
89 m_pImpl
->handleRequest(rRequest
);
91 catch (uno::RuntimeException
const & ex
)
93 throw uno::RuntimeException(ex
.Message
, *this);
97 ::sal_Bool SAL_CALL
UUIInteractionHandler::handleInteractionRequest(
98 const uno::Reference
< task::XInteractionRequest
>& _Request
) throw ( uno::RuntimeException
)
102 return m_pImpl
->handleRequest( _Request
);
104 catch (uno::RuntimeException
const & ex
)
106 throw uno::RuntimeException( ex
.Message
, *this );
110 char const UUIInteractionHandler::m_aImplementationName
[]
111 = "com.sun.star.comp.uui.UUIInteractionHandler";
113 uno::Sequence
< rtl::OUString
>
114 UUIInteractionHandler::getSupportedServiceNames_static()
116 uno::Sequence
< rtl::OUString
> aNames(3);
117 aNames
[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
118 "com.sun.star.task.InteractionHandler"));
119 // added to indicate support for configuration.backend.MergeRecoveryRequest
120 aNames
[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
121 "com.sun.star.configuration.backend.InteractionHandler"));
122 aNames
[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
123 "com.sun.star.uui.InteractionHandler"));
124 // for backwards compatibility
128 uno::Reference
< uno::XInterface
> SAL_CALL
129 UUIInteractionHandler::createInstance(
130 uno::Reference
< lang::XMultiServiceFactory
> const &
132 SAL_THROW((uno::Exception
))
136 return *new UUIInteractionHandler(rServiceFactory
);
138 catch (std::bad_alloc
const &)
140 throw uno::RuntimeException(
141 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */