diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-06-20 13:40:58 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-06-20 14:23:21 +0200 |
commit | dac99f6818e6e68198896e93835760b82df2703e (patch) | |
tree | 234451159ffe71e299083097122d307b6bf3f840 /svl | |
parent | f5946cd499f7d7de40b03f453f5b1c52e31a29fc (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.
Reviewed-on: https://gerrit.libreoffice.org/69678
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 41dc917b9b55b8c0c4307ffc58a1fb7257df2b69)
Change-Id: I2f882723841162add01be9d3f7285a5162a60331
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 30b53745c620..f0a1db6864e0 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 938b36d5cd26..e1afd70ef2e8 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: */ |