diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-03-25 13:28:27 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-03-26 19:09:46 +0100 |
commit | 41dc917b9b55b8c0c4307ffc58a1fb7257df2b69 (patch) | |
tree | 52ea7fbb48fd3877c95c4efab76971cc48b27485 /svl | |
parent | cd19a7664a25eda786bb76feefb40ebcbf79a54d (diff) |
Generate MSO lock files when the related MSO compat. option is set
Added a new compatibility option to the Tools -> Load / Save ->
Microsoft.
When this option is set on the UI or or set in the configuration files
LO generates lock files for MSO supported file formats, similar to
the lock files MSO generates itself.
Change-Id: I2f882723841162add01be9d3f7285a5162a60331
Reviewed-on: https://gerrit.libreoffice.org/69678
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/qa/unit/lockfiles/test_lockfiles.cxx | 2 | ||||
-rw-r--r-- | svl/source/misc/lockfilecommon.cxx | 2 | ||||
-rw-r--r-- | svl/source/misc/msodocumentlockfile.cxx | 19 |
3 files changed, 14 insertions, 9 deletions
diff --git a/svl/qa/unit/lockfiles/test_lockfiles.cxx b/svl/qa/unit/lockfiles/test_lockfiles.cxx index 8083c143f461..5f23240f387c 100644 --- a/svl/qa/unit/lockfiles/test_lockfiles.cxx +++ b/svl/qa/unit/lockfiles/test_lockfiles.cxx @@ -88,7 +88,7 @@ OUString readLockFile(const OUString& aSource) OUString GetLockFileName(const svt::GenDocumentLockFile& rLockFile) { - INetURLObject aDocURL = rLockFile.ResolveLinks(INetURLObject(rLockFile.GetURL())); + INetURLObject aDocURL = svt::LockFileCommon::ResolveLinks(INetURLObject(rLockFile.GetURL())); return aDocURL.GetName(); } diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx index 4b279c3c03e6..175220a532eb 100644 --- a/svl/source/misc/lockfilecommon.cxx +++ b/svl/source/misc/lockfilecommon.cxx @@ -94,7 +94,7 @@ OUString LockFileCommon::GenerateURL( const OUString& aOrigURL, const OUString& } -INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL ) const +INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL ) { if ( aDocURL.HasError() ) throw lang::IllegalArgumentException(); diff --git a/svl/source/misc/msodocumentlockfile.cxx b/svl/source/misc/msodocumentlockfile.cxx index 8e2be6a9abe9..ddb5de6c5632 100644 --- a/svl/source/misc/msodocumentlockfile.cxx +++ b/svl/source/misc/msodocumentlockfile.cxx @@ -18,9 +18,9 @@ namespace svt { -bool MSODocumentLockFile::isWordFormat(const OUString& aOrigURL) const +bool MSODocumentLockFile::isWordFormat(const OUString& aOrigURL) { - INetURLObject aDocURL = ResolveLinks(INetURLObject(aOrigURL)); + INetURLObject aDocURL = LockFileCommon::ResolveLinks(INetURLObject(aOrigURL)); return aDocURL.GetFileExtension().compareToIgnoreAsciiCase("DOC") == 0 || aDocURL.GetFileExtension().compareToIgnoreAsciiCase("DOCX") == 0 @@ -28,18 +28,18 @@ bool MSODocumentLockFile::isWordFormat(const OUString& aOrigURL) const || aDocURL.GetFileExtension().compareToIgnoreAsciiCase("ODT") == 0; } -bool MSODocumentLockFile::isExcelFormat(const OUString& aOrigURL) const +bool MSODocumentLockFile::isExcelFormat(const OUString& aOrigURL) { - INetURLObject aDocURL = ResolveLinks(INetURLObject(aOrigURL)); + INetURLObject aDocURL = LockFileCommon::ResolveLinks(INetURLObject(aOrigURL)); return //aDocURL.GetFileExtension().compareToIgnoreAsciiCase("XLS") || // MSO does not create lockfile for XLS aDocURL.GetFileExtension().compareToIgnoreAsciiCase("XLSX") == 0 || aDocURL.GetFileExtension().compareToIgnoreAsciiCase("ODS") == 0; } -bool MSODocumentLockFile::isPowerPointFormat(const OUString& aOrigURL) const +bool MSODocumentLockFile::isPowerPointFormat(const OUString& aOrigURL) { - INetURLObject aDocURL = ResolveLinks(INetURLObject(aOrigURL)); + INetURLObject aDocURL = LockFileCommon::ResolveLinks(INetURLObject(aOrigURL)); return aDocURL.GetFileExtension().compareToIgnoreAsciiCase("PPTX") == 0 || aDocURL.GetFileExtension().compareToIgnoreAsciiCase("PPT") == 0 @@ -56,7 +56,7 @@ MSODocumentLockFile::~MSODocumentLockFile() {} OUString MSODocumentLockFile::GenerateURL(const OUString& aOrigURL, const OUString& aPrefix) { - INetURLObject aDocURL = ResolveLinks(INetURLObject(aOrigURL)); + INetURLObject aDocURL = LockFileCommon::ResolveLinks(INetURLObject(aOrigURL)); OUString aURL = aDocURL.GetPartBeforeLastName(); aURL += aPrefix; @@ -239,6 +239,11 @@ void MSODocumentLockFile::RemoveFile() RemoveFileDirectly(); } +bool MSODocumentLockFile::IsMSOSupportedFileFormat(const OUString& aURL) +{ + return isWordFormat(aURL) || isExcelFormat(aURL) || isPowerPointFormat(aURL); +} + } // namespace svt /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |