summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2021-08-31 12:08:39 +0200
committerLászló Németh <nemeth@numbertext.org>2021-09-01 11:29:08 +0200
commitc082158018148be01476d5bc82c1cd71ea6541df (patch)
treef4cb11058151559e6da2b0211109f0d3454fe134 /sfx2
parent521d91bce3a88dfaf529216f19e133dea7bb5af4 (diff)
tdf#118938 XLSX import/export: fix permission for editing
The password for editing wasn't asked, also wasn't exported in XLSX documents. Now it's exported in Calc using the following steps, also verified before editing: - In File->Save As, choose Excel 2007–365 (.xlsx) format; - enable checkbox "Save with password" and click Save; - in the dialog "Set password", click on "Options" and enable checkbox "Open file read-only", and enter a password for editing (i.e. skip the password for opening). Note: Excel 2016 doesn't ask password for editing, but Office 365 does. Passwords created in Excel haven't been supported, yet. Also passwords with diacritics aren't interoperable. Note: saving the file under a different path is still allowed both in Calc and Excel without asking the password for editing. Change-Id: Ic00d7c5a785e04d270a182a4087ea922d7d92979 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121371 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/viewfrm.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index ada11bea9930..4ba5bc852834 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -352,6 +352,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
StreamMode nOpenMode;
bool bNeedsReload = false;
+ bool bPasswordEntered = false;
if ( !pSh->IsReadOnly() )
{
// Save and reload Readonly
@@ -388,6 +389,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
}
pSh->SetModifyPasswordEntered();
+ bPasswordEntered = true;
}
nOpenMode = pSh->IsOriginallyReadOnlyMedium() ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE;
@@ -439,8 +441,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
aPhysObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
bool bIsWebDAV = aMedObj.isAnyKnownWebDAVScheme();
+ // tdf#118938 Reload the document when the user enters the editing password,
+ // even if the physical name isn't different to the logical name.
if ( ( !bNeedsReload && ( ( aMedObj.GetProtocol() == INetProtocol::File &&
- aMedObj.getFSysPath( FSysStyle::Detect ) != aPhysObj.getFSysPath( FSysStyle::Detect ) &&
+ ( aMedObj.getFSysPath( FSysStyle::Detect ) != aPhysObj.getFSysPath( FSysStyle::Detect )
+ || bPasswordEntered ) &&
!bPhysObjIsYounger )
|| ( bIsWebDAV && !bPhysObjIsYounger )
|| ( pMed->IsRemote() && !bIsWebDAV ) ) )