summaryrefslogtreecommitdiff
path: root/include/svl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-03-30 15:33:41 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-03-30 17:16:42 +0100
commit49696cc78fefa6d7f1c27a722b576c8d749c20d6 (patch)
tree540858c41c9d6c02fdd9f2fbaa30c3257099e232 /include/svl
parent107fd82751c35818152eabd45bdf882972d3c100 (diff)
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'include/svl')
-rw-r--r--include/svl/documentlockfile.hxx5
-rw-r--r--include/svl/lockfilecommon.hxx11
-rw-r--r--include/svl/msodocumentlockfile.hxx44
3 files changed, 13 insertions, 47 deletions
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 <svl/svldllapi.h>
-#include <svl/lockfilecommon.hxx>
#include <svl/documentlockfile.hxx>
#include <com/sun/star/lang/XComponent.hpp>
-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;