sfx2/source/doc/objserv.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 73ac60c4c3a209d23642ac4d0e8c4ac6dba22d86
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Wed Jun 28 14:18:53 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Jun 28 22:53:43 2023 +0200

    tdf#148416 saveas: preserve loadreadonly with password
    
    If a document is set to load readonly,
    and that setting is password protected,
    then at least suggest using a password on save-as.
    
    Change-Id: I788da43733470e56af988e7c4b9f2cae01573e50
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153726
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index f321cbfc74a7..caa1b800f41e 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1027,7 +1027,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
 
                 const SfxStringItem* pOldPasswordItem = 
SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_PASSWORD, 
false);
                 const SfxUnoAnyItem* pOldEncryptionDataItem = 
SfxItemSet::GetItem<SfxUnoAnyItem>(GetMedium()->GetItemSet(), 
SID_ENCRYPTIONDATA, false);
-                const bool bPreselectPassword = pOldPasswordItem || 
pOldEncryptionDataItem;
+                const bool bPreselectPassword
+                    = pOldPasswordItem || pOldEncryptionDataItem
+                      || (IsLoadReadonly()
+                          && (GetModifyPasswordHash() || 
GetModifyPasswordInfo().hasElements()));
 
                 uno::Sequence< beans::PropertyValue > aDispatchArgs;
                 if ( rReq.GetArgs() )

Reply via email to