lok: add broken package interaction handler
in case of repair don't use template flag to not make file readonly so we can overwrite it and upload to storage updated version Conflicts: desktop/source/lib/lokinteractionhandler.cxx desktop/source/lib/lokinteractionhandler.hxx sfx2/source/doc/sfxbasemodel.cxx Change-Id: Ia460009fc3b77582dde06dd6f94a85aef3aee11b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157493 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
committed by
Miklos Vajna
parent
6ce4d0091f
commit
e2ee3dd61a
@@ -22,6 +22,7 @@
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
|
||||
#include <com/sun/star/document/BrokenPackageRequest.hpp>
|
||||
#include <com/sun/star/task/XInteractionAbort.hpp>
|
||||
#include <com/sun/star/task/XInteractionApprove.hpp>
|
||||
#include <com/sun/star/task/XInteractionPassword2.hpp>
|
||||
@@ -350,6 +351,23 @@ 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::handleFilterOptionsRequest(const uno::Reference<task::XInteractionRequest>& xRequest)
|
||||
{
|
||||
document::FilterOptionsRequest aFilterOptionsRequest;
|
||||
@@ -389,6 +407,9 @@ sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest(
|
||||
if (handleMacroConfirmationRequest(xRequest))
|
||||
return true;
|
||||
|
||||
if (handlePackageReparationRequest(xRequest))
|
||||
return true;
|
||||
|
||||
// TODO: perform more interactions 'for real' like the above
|
||||
selectApproved(rContinuations);
|
||||
|
||||
|
@@ -77,6 +77,7 @@ private:
|
||||
static bool handleMacroConfirmationRequest(const css::uno::Reference<css::task::XInteractionRequest>& xRequest);
|
||||
|
||||
static bool handleFilterOptionsRequest(const ::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& Request);
|
||||
static bool handlePackageReparationRequest(const css::uno::Reference<css::task::XInteractionRequest>& xRequest);
|
||||
|
||||
public:
|
||||
void SetPassword(char const* pPassword);
|
||||
|
@@ -1980,9 +1980,11 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
|
||||
xHandler->handle( aRequest.GetRequest() );
|
||||
if( aRequest.isApproved() )
|
||||
{
|
||||
// lok: we want to overwrite file in jail, so don't use template flag
|
||||
bool bIsLOK = comphelper::LibreOfficeKit::isActive();
|
||||
// broken package: try second loading and allow repair
|
||||
pMedium->GetItemSet().Put( SfxBoolItem( SID_REPAIRPACKAGE, true ) );
|
||||
pMedium->GetItemSet().Put( SfxBoolItem( SID_TEMPLATE, true ) );
|
||||
pMedium->GetItemSet().Put( SfxBoolItem( SID_TEMPLATE, !bIsLOK ) );
|
||||
pMedium->GetItemSet().Put( SfxStringItem( SID_DOCINFO_TITLE, aDocName ) );
|
||||
|
||||
// the error must be reset and the storage must be reopened in new mode
|
||||
|
@@ -936,7 +936,7 @@ executeMessageBox(
|
||||
SolarMutexGuard aGuard;
|
||||
|
||||
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eMessageType,
|
||||
eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : VclButtonsType::Ok, rMessage));
|
||||
eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : VclButtonsType::Ok, rMessage, GetpApp()));
|
||||
xBox->set_title(rTitle);
|
||||
|
||||
short nMessResult = xBox->run();
|
||||
|
Reference in New Issue
Block a user