tdf#143971 Removes pop-up dialog for read-only documents
No longer does the user get a pop-up dialog when opening
documents that are read-only, asking whether they want to be
notified when the document becomes editable. The change
removes some of the functionality introduced in commit
95eb088802562b75f8b299908160145c7e88d763 "tdf#47065 Add new
file open UI options and implement a new thread".
Change-Id: Ic25e8e293e7224fb5086249a9d4814914fa961d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125340
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/framework/source/interaction/quietinteraction.cxx b/framework/source/interaction/quietinteraction.cxx
index feeecf7..e9dc218 100644
--- a/framework/source/interaction/quietinteraction.cxx
+++ b/framework/source/interaction/quietinteraction.cxx
@@ -24,7 +24,6 @@
#include <com/sun/star/document/XInteractionFilterSelect.hpp>
#include <com/sun/star/document/XInteractionFilterOptions.hpp>
#include <com/sun/star/document/FilterOptionsRequest.hpp>
#include <com/sun/star/document/ReadOnlyOpenRequest.hpp>
#include <com/sun/star/task/ErrorCodeRequest.hpp>
#include <com/sun/star/document/LockedDocumentRequest.hpp>
@@ -77,7 +76,6 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI
css::task::ErrorCodeRequest aErrorCodeRequest;
css::document::LockedDocumentRequest aLockedDocumentRequest;
css::document::FilterOptionsRequest aFilterOptionsRequest;
css::document::ReadOnlyOpenRequest aReadOnlyOpenRequest;
if( aRequest >>= aErrorCodeRequest )
{
@@ -110,19 +108,6 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI
}
}
else
if (aRequest >>= aReadOnlyOpenRequest)
{
// allow unit tests to run on read-only SRCDIR
if (xApprove.is())
{
xApprove->select();
}
else if (xAbort.is())
{
xAbort->select();
}
}
else
if (xAbort.is())
xAbort->select();
}
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 6f1dc60..3eb0025 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2214,7 +2214,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/document,\
NoSuchFilterRequest \
OwnLockOnDocumentRequest \
PrinterIndependentLayout \
ReadOnlyOpenRequest \
RedlineDisplayType \
ReloadEditableRequest \
UndoContextNotClosedException \
diff --git a/offapi/com/sun/star/document/ReadOnlyOpenRequest.idl b/offapi/com/sun/star/document/ReadOnlyOpenRequest.idl
deleted file mode 100644
index 49a82b7..0000000
--- a/offapi/com/sun/star/document/ReadOnlyOpenRequest.idl
+++ /dev/null
@@ -1,51 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_document_ReadOnlyOpenRequest_idl__
#define __com_sun_star_document_ReadOnlyOpenRequest_idl__
#include <com/sun/star/uno/Exception.idl>
module com
{
module sun
{
module star
{
module document
{
/** Is used for interaction handle to query user decision regarding whether to open
a document read-only and whether to notify the user when the document becomes
editable.
@since LibreOffice 7.2
*/
published exception ReadOnlyOpenRequest : ::com::sun::star::uno::Exception
{
/** The URL of the document that is open but was made editable.
*/
string DocumentURL;
};
};
};
};
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/offapi/type_reference/offapi.idl b/offapi/type_reference/offapi.idl
index 6c4b9dd..b6fe108 100644
--- a/offapi/type_reference/offapi.idl
+++ b/offapi/type_reference/offapi.idl
@@ -4782,9 +4782,6 @@ module com {
const short HIGH_RESOLUTION = 3;
const short LOW_RESOLUTION = 2;
};
published exception ReadOnlyOpenRequest: ::com::sun::star::uno::Exception {
string DocumentURL;
};
published constants RedlineDisplayType {
const short INSERTED = 1;
const short INSERTED_AND_REMOVED = 2;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 4c67702..588e349 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -38,7 +38,6 @@
#include <com/sun/star/document/LockFileIgnoreRequest.hpp>
#include <com/sun/star/document/LockFileCorruptRequest.hpp>
#include <com/sun/star/document/ChangedByOthersRequest.hpp>
#include <com/sun/star/document/ReadOnlyOpenRequest.hpp>
#include <com/sun/star/document/ReloadEditableRequest.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -1178,42 +1177,6 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog(const LockFileEntr
return nResult;
}
bool SfxMedium::ShowReadOnlyOpenDialog()
{
uno::Reference<task::XInteractionHandler> xHandler = GetInteractionHandler();
if (xHandler.is())
{
OUString aDocumentURL
= GetURLObject().GetLastName(INetURLObject::DecodeMechanism::WithCharset);
::rtl::Reference<::ucbhelper::InteractionRequest> xInteractionRequestImpl
= new ::ucbhelper::InteractionRequest(uno::makeAny(document::ReadOnlyOpenRequest(
OUString(), uno::Reference<uno::XInterface>(), aDocumentURL)));
if (xInteractionRequestImpl != nullptr)
{
uno::Sequence<uno::Reference<task::XInteractionContinuation>> aContinuations{
new ::ucbhelper::InteractionAbort(xInteractionRequestImpl.get()),
new ::ucbhelper::InteractionApprove(xInteractionRequestImpl.get())
};
xInteractionRequestImpl->setContinuations(aContinuations);
xHandler->handle(xInteractionRequestImpl);
::rtl::Reference<::ucbhelper::InteractionContinuation> xSelected
= xInteractionRequestImpl->getSelection();
if (uno::Reference<task::XInteractionAbort>(xSelected.get(), uno::UNO_QUERY).is())
{
SetError(ERRCODE_ABORT);
return false;
}
else if (!uno::Reference<task::XInteractionApprove>(xSelected.get(), uno::UNO_QUERY)
.is())
// user selected "Notify"
pImpl->m_bNotifyWhenEditable = true;
return true;
}
}
return false;
}
bool SfxMedium::ShowLockFileProblemDialog(MessageDlg nWhichDlg)
{
// system file locking is not active, ask user whether he wants to open the document without any locking
@@ -3019,11 +2982,7 @@ void SfxMedium::Init_Impl()
if (item.getFileStatus(stat) == osl::FileBase::E_None
&& stat.isValid(osl_FileStatus_Mask_Attributes))
{
if ((stat.getAttributes() & osl_File_Attribute_ReadOnly) != 0
#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
&& ShowReadOnlyOpenDialog()
#endif
)
if ((stat.getAttributes() & osl_File_Attribute_ReadOnly) != 0)
{
pImpl->m_bOriginallyReadOnly = true;
}
diff --git a/uui/Library_uui.mk b/uui/Library_uui.mk
index 4f664ac..105c32d 100644
--- a/uui/Library_uui.mk
+++ b/uui/Library_uui.mk
@@ -62,7 +62,6 @@ $(eval $(call gb_Library_add_exception_objects,uui,\
uui/source/openlocked \
uui/source/passwordcontainer \
uui/source/passworddlg \
uui/source/readonlyopen \
uui/source/reloadeditable \
uui/source/requeststringresolver \
uui/source/secmacrowarnings \
diff --git a/uui/inc/strings.hrc b/uui/inc/strings.hrc
index 8eaa68c..e5af346 100644
--- a/uui/inc/strings.hrc
+++ b/uui/inc/strings.hrc
@@ -84,9 +84,4 @@
#define STR_RELOADEDITABLE_MSG NC_("STR_RELOADEDITABLE_MSG", "Document file '$(ARG1)' is now editable \n\nReload this document for editing?")
#define STR_RELOADEDITABLE_BTN NC_("STR_RELOADEDITABLE_BTN", "~Reload")
#define STR_READONLYOPEN_TITLE NC_("STR_READONLYOPEN_TITLE", "Document is read-only")
#define STR_READONLYOPEN_MSG NC_("STR_READONLYOPEN_MSG", "Document file '$(ARG1)' is read-only.\n\nOpen read-only or select Notify to open read-only and get notified when the document becomes editable.")
#define STR_READONLYOPEN_BTN NC_("STR_READONLYOPEN_BTN", "Open ~Read-Only")
#define STR_READONLYOPEN_NOTIFY_BTN NC_("STR_READONLYOPEN_NOTIFY_BTN", "~Notify")
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
index 47b15dc..64af096 100644
--- a/uui/source/iahndl-locking.cxx
+++ b/uui/source/iahndl-locking.cxx
@@ -23,7 +23,6 @@
#include <com/sun/star/document/LockFileIgnoreRequest.hpp>
#include <com/sun/star/document/LockFileCorruptRequest.hpp>
#include <com/sun/star/document/OwnLockOnDocumentRequest.hpp>
#include <com/sun/star/document/ReadOnlyOpenRequest.hpp>
#include <com/sun/star/document/ReloadEditableRequest.hpp>
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <com/sun/star/task/XInteractionDisapprove.hpp>
@@ -43,7 +42,6 @@
#include "filechanged.hxx"
#include "lockfailed.hxx"
#include "lockcorrupt.hxx"
#include "readonlyopen.hxx"
#include "reloadeditable.hxx"
#include "iahndl.hxx"
@@ -57,35 +55,6 @@ using namespace com::sun::star;
namespace {
void handleReadOnlyOpenRequest_(
weld::Window* pParent, const OUString& aDocumentURL,
uno::Sequence<uno::Reference<task::XInteractionContinuation>> const& rContinuations)
{
uno::Reference<task::XInteractionApprove> xApprove;
uno::Reference<task::XInteractionAbort> xAbort;
getContinuations(rContinuations, &xApprove, &xAbort);
if (!xApprove.is() || !xAbort.is())
return;
SolarMutexGuard aGuard;
std::locale aResLocale = Translate::Create("uui");
OUString aMessage;
std::vector<OUString> aArguments { aDocumentURL };
aMessage = Translate::get(STR_READONLYOPEN_MSG, aResLocale);
aMessage = UUIInteractionHelper::replaceMessageWithArguments(aMessage, aArguments);
ReadOnlyOpenQueryBox aDialog(pParent, aResLocale, aMessage);
int nResult = aDialog.run();
if (nResult == RET_YES)
xApprove->select();
else if (nResult != RET_RETRY)
xAbort->select();
}
void handleReloadEditableRequest_(
weld::Window* pParent, const OUString& aDocumentURL,
uno::Sequence<uno::Reference<task::XInteractionContinuation>> const& rContinuations)
@@ -354,24 +323,6 @@ UUIInteractionHelper::handleLockFileProblemRequest(
return false;
}
bool UUIInteractionHelper::handleReadOnlyOpenRequest(
uno::Reference<task::XInteractionRequest> const& rRequest)
{
uno::Any aAnyRequest(rRequest->getRequest());
document::ReadOnlyOpenRequest aReadOnlyOpenRequest;
if (aAnyRequest >>= aReadOnlyOpenRequest)
{
uno::Reference<awt::XWindow> xParent = getParentXWindow();
handleReadOnlyOpenRequest_(Application::GetFrameWeld(xParent),
aReadOnlyOpenRequest.DocumentURL,
rRequest->getContinuations());
return true;
}
return false;
}
bool UUIInteractionHelper::handleReloadEditableRequest(
uno::Reference<task::XInteractionRequest> const& rRequest)
{
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index e365986..251a642 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -810,9 +810,6 @@ UUIInteractionHelper::handleRequest_impl(
if ( handleReloadEditableRequest( rRequest ) )
return true;
if ( handleReadOnlyOpenRequest( rRequest ) )
return true;
task::DocumentMacroConfirmationRequest aMacroConfirmRequest;
if (aAnyRequest >>= aMacroConfirmRequest)
{
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index 7906864..df2bdd0 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -233,9 +233,6 @@ private:
bool handleReloadEditableRequest(
css::uno::Reference<css::task::XInteractionRequest> const& rRequest);
bool
handleReadOnlyOpenRequest(css::uno::Reference<css::task::XInteractionRequest> const& rRequest);
bool handleCustomRequest(
const css::uno::Reference< css::task::XInteractionRequest >& i_rRequest,
const OUString& i_rServiceName
diff --git a/uui/source/readonlyopen.cxx b/uui/source/readonlyopen.cxx
deleted file mode 100644
index 72a3b98..0000000
--- a/uui/source/readonlyopen.cxx
+++ /dev/null
@@ -1,38 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <strings.hrc>
#include "readonlyopen.hxx"
#include <officecfg/Office/Common.hxx>
#include <unotools/resmgr.hxx>
#include <vcl/stdtext.hxx>
#include <vcl/svapp.hxx>
ReadOnlyOpenQueryBox::ReadOnlyOpenQueryBox(weld::Window* pParent, const std::locale& rResLocale,
const OUString& rMessage)
: m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question,
VclButtonsType::NONE, rMessage))
{
m_xQueryBox->set_title(Translate::get(STR_READONLYOPEN_TITLE, rResLocale));
m_xQueryBox->add_button(Translate::get(STR_READONLYOPEN_BTN, rResLocale), RET_YES);
m_xQueryBox->add_button(Translate::get(STR_READONLYOPEN_NOTIFY_BTN, rResLocale), RET_RETRY);
m_xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/uui/source/readonlyopen.hxx b/uui/source/readonlyopen.hxx
deleted file mode 100644
index 08063d1..0000000
--- a/uui/source/readonlyopen.hxx
+++ /dev/null
@@ -1,35 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <vcl/weld.hxx>
class ReadOnlyOpenQueryBox
{
private:
std::unique_ptr<weld::MessageDialog> m_xQueryBox;
public:
ReadOnlyOpenQueryBox(weld::Window* pParent, const std::locale& rResLocale,
const OUString& rMessage);
int run() { return m_xQueryBox->run(); }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */