From 49696cc78fefa6d7f1c27a722b576c8d749c20d6 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 30 Mar 2019 15:33:41 +0300 Subject: Some refactor of lockfile classes to minimize interface Change-Id: Icc67c31d6a2351b6504429e25067c25353233f5f Reviewed-on: https://gerrit.libreoffice.org/69947 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- include/svl/documentlockfile.hxx | 5 +---- include/svl/lockfilecommon.hxx | 11 ++++------ include/svl/msodocumentlockfile.hxx | 44 +++++++------------------------------ 3 files changed, 13 insertions(+), 47 deletions(-) (limited to 'include') diff --git a/include/svl/documentlockfile.hxx b/include/svl/documentlockfile.hxx index 79bb087c8362..e38a9af1646a 100644 --- a/include/svl/documentlockfile.hxx +++ b/include/svl/documentlockfile.hxx @@ -33,10 +33,7 @@ namespace svt { class SVL_DLLPUBLIC GenDocumentLockFile : public LockFileCommon { public: - /// Specify the lockfile URL directly - GenDocumentLockFile( const OUString& aURL ); - /// Let the object generate and own URL based on the original file's URL and a prefix - GenDocumentLockFile( const OUString& aOrigURL, const OUString& aPrefix ); + GenDocumentLockFile(const OUString& aLockFileURL); virtual ~GenDocumentLockFile() override; bool CreateOwnLockFile(); diff --git a/include/svl/lockfilecommon.hxx b/include/svl/lockfilecommon.hxx index 97210d010279..77349c48a4a4 100644 --- a/include/svl/lockfilecommon.hxx +++ b/include/svl/lockfilecommon.hxx @@ -47,19 +47,16 @@ private: protected: ::osl::Mutex m_aMutex; + /// This method generates the URL of the lock file based on the document URL and the specified prefix. + static OUString GenerateOwnLockFileURL(const OUString& aOrigURL, const OUString& aPrefix); + public: - /// Specify the lockfile URL directly - LockFileCommon( const OUString& aURL ); - /// Let the object generate and own URL based on the original file's URL and a prefix - LockFileCommon( const OUString& aOrigURL, const OUString& aPrefix ); + LockFileCommon(const OUString& aLockFileURL); virtual ~LockFileCommon(); const OUString& GetURL() const; void SetURL(const OUString& aURL); - /// This method generates the URL of the lock file based on the document URL and the specified prefix. - virtual OUString GenerateURL( const OUString& aOrigURL, const OUString& aPrefix ); - static void ParseList( const css::uno::Sequence< sal_Int8 >& aBuffer, std::vector< LockFileEntry > &rOutput ); static LockFileEntry ParseEntry( const css::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); static OUString ParseName( const css::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); diff --git a/include/svl/msodocumentlockfile.hxx b/include/svl/msodocumentlockfile.hxx index cd0db0ffb6d9..322972fefe25 100644 --- a/include/svl/msodocumentlockfile.hxx +++ b/include/svl/msodocumentlockfile.hxx @@ -11,38 +11,10 @@ #define INCLUDED_SVL_MSODOCUMENTLOCKFILE_HXX #include -#include #include #include -namespace com -{ -namespace sun -{ -namespace star -{ -namespace io -{ -class XInputStream; -} -} -} -} -namespace com -{ -namespace sun -{ -namespace star -{ -namespace io -{ -class XOutputStream; -} -} -} -} - #define MSO_WORD_LOCKFILE_SIZE 162 #define MSO_EXCEL_AND_POWERPOINT_LOCKFILE_SIZE 165 #define MSO_USERNAME_MAX_LENGTH 52 @@ -53,11 +25,14 @@ namespace svt class SVL_DLLPUBLIC MSODocumentLockFile : public GenDocumentLockFile { private: - OUString m_sOrigURL; - - static bool isWordFormat(const OUString& aOrigURL); - static bool isExcelFormat(const OUString& aOrigURL); - static bool isPowerPointFormat(const OUString& aOrigURL); + enum class AppType + { + Word, + Excel, + PowerPoint + }; + static AppType getAppType(const OUString& sOrigURL); + AppType m_eAppType; protected: virtual void @@ -70,9 +45,6 @@ public: MSODocumentLockFile(const OUString& aOrigURL); virtual ~MSODocumentLockFile() override; - /// Need to generate different lock file name for MSO. - virtual OUString GenerateURL(const OUString& aOrigURL, const OUString& aPrefix) override; - virtual LockFileEntry GetLockData() override; virtual void RemoveFile() override; -- cgit