summaryrefslogtreecommitdiffstats
path: root/desktop/source/lib/lokinteractionhandler.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/lib/lokinteractionhandler.cxx')
-rw-r--r--desktop/source/lib/lokinteractionhandler.cxx64
1 files changed, 55 insertions, 9 deletions
diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx
index 6b94ee907318..0680a9dd97f1 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -22,6 +22,8 @@
#include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <com/sun/star/document/BrokenPackageRequest.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <com/sun/star/task/XInteractionPassword2.hpp>
@@ -45,6 +47,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <sfx2/lokhelper.hxx>
#include <sfx2/viewsh.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <tools/json_writer.hxx>
@@ -52,12 +55,12 @@
using namespace com::sun::star;
LOKInteractionHandler::LOKInteractionHandler(
- const OString& rCommand,
+ OString command,
desktop::LibLibreOffice_Impl *const pLOKit,
desktop::LibLODocument_Impl *const pLOKDocument)
: m_pLOKit(pLOKit)
, m_pLOKDocument(pLOKDocument)
- , m_command(rCommand)
+ , m_command(std::move(command))
, m_usePassword(false)
{
assert(m_pLOKit);
@@ -69,7 +72,7 @@ LOKInteractionHandler::~LOKInteractionHandler()
OUString SAL_CALL LOKInteractionHandler::getImplementationName()
{
- return "com.sun.star.comp.uui.LOKInteractionHandler";
+ return u"com.sun.star.comp.uui.LOKInteractionHandler"_ustr;
}
sal_Bool SAL_CALL LOKInteractionHandler::supportsService(OUString const & rServiceName)
@@ -79,11 +82,11 @@ sal_Bool SAL_CALL LOKInteractionHandler::supportsService(OUString const & rServi
uno::Sequence< OUString > SAL_CALL LOKInteractionHandler::getSupportedServiceNames()
{
- return { "com.sun.star.task.InteractionHandler",
+ return { u"com.sun.star.task.InteractionHandler"_ustr,
// added to indicate support for configuration.backend.MergeRecoveryRequest
- "com.sun.star.configuration.backend.InteractionHandler",
+ u"com.sun.star.configuration.backend.InteractionHandler"_ustr,
// for backwards compatibility
- "com.sun.star.uui.InteractionHandler" };
+ u"com.sun.star.uui.InteractionHandler"_ustr };
}
void SAL_CALL LOKInteractionHandler::initialize(uno::Sequence<uno::Any> const & /*rArguments*/)
@@ -119,9 +122,9 @@ void LOKInteractionHandler::postError(css::task::InteractionClassification class
std::size_t nView = SfxViewShell::Current() ? SfxLokHelper::getView() : 0;
if (m_pLOKDocument && m_pLOKDocument->mpCallbackFlushHandlers.count(nView))
- m_pLOKDocument->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_ERROR, aJson.extractAsOString().getStr());
+ m_pLOKDocument->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_ERROR, aJson.finishAndGetAsOString());
else if (m_pLOKit->mpCallback)
- m_pLOKit->mpCallback(LOK_CALLBACK_ERROR, aJson.extractAsOString().getStr(), m_pLOKit->mpCallbackData);
+ m_pLOKit->mpCallback(LOK_CALLBACK_ERROR, aJson.finishAndGetAsOString().getStr(), m_pLOKit->mpCallbackData);
}
namespace {
@@ -185,7 +188,7 @@ bool LOKInteractionHandler::handleIOException(const css::uno::Sequence<css::uno:
ERRCODE_IO_WRONGVERSION,
};
- postError(aIoException.Classification, "io", aErrorCode[static_cast<int>(aIoException.Code)], "");
+ postError(aIoException.Classification, "io", aErrorCode[static_cast<int>(aIoException.Code)], u""_ustr);
selectApproved(rContinuations);
return true;
@@ -349,6 +352,43 @@ bool LOKInteractionHandler::handleMacroConfirmationRequest(const uno::Reference<
return false;
}
+bool LOKInteractionHandler::handlePackageReparationRequest(const uno::Reference<task::XInteractionRequest>& xRequest)
+{
+ uno::Any const request(xRequest->getRequest());
+
+ document::BrokenPackageRequest aBrokenPackageRequest;
+ if (request >>= aBrokenPackageRequest)
+ {
+ auto xInteraction(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr));
+
+ if (xInteraction.is())
+ xInteraction->handleInteractionRequest(xRequest);
+
+ return true;
+ }
+ return false;
+}
+
+bool LOKInteractionHandler::handleLoadReadOnlyRequest(const uno::Reference<task::XInteractionRequest>& xRequest)
+{
+ uno::Any const request(xRequest->getRequest());
+
+ OUString aFileName;
+ beans::NamedValue aLoadReadOnlyRequest;
+ if ((request >>= aLoadReadOnlyRequest) &&
+ aLoadReadOnlyRequest.Name == "LoadReadOnlyRequest" &&
+ (aLoadReadOnlyRequest.Value >>= aFileName))
+ {
+ auto xInteraction(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr));
+
+ if (xInteraction.is())
+ xInteraction->handleInteractionRequest(xRequest);
+
+ return true;
+ }
+ return false;
+}
+
bool LOKInteractionHandler::handleFilterOptionsRequest(const uno::Reference<task::XInteractionRequest>& xRequest)
{
document::FilterOptionsRequest aFilterOptionsRequest;
@@ -388,6 +428,12 @@ sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest(
if (handleMacroConfirmationRequest(xRequest))
return true;
+ if (handlePackageReparationRequest(xRequest))
+ return true;
+
+ if (handleLoadReadOnlyRequest(xRequest))
+ return true;
+
// TODO: perform more interactions 'for real' like the above
selectApproved(rContinuations);