Avoid potential negative array index access to cached text.
[LibreOffice.git] / include / svl / msodocumentlockfile.hxx
blob282f427b32aa91fa7d04fe0e765fc75cd7958e04
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_SVL_MSODOCUMENTLOCKFILE_HXX
11 #define INCLUDED_SVL_MSODOCUMENTLOCKFILE_HXX
13 #include <svl/svldllapi.h>
14 #include <svl/documentlockfile.hxx>
16 #define MSO_WORD_LOCKFILE_SIZE 162
17 #define MSO_EXCEL_AND_POWERPOINT_LOCKFILE_SIZE 165
18 #define MSO_USERNAME_MAX_LENGTH 52
20 namespace svt
22 /// Class implementing reading and writing MSO lockfiles.
23 class SVL_DLLPUBLIC MSODocumentLockFile final : public GenDocumentLockFile
25 private:
26 enum class AppType
28 Word,
29 Excel,
30 PowerPoint
32 static AppType getAppType(std::u16string_view sOrigURL);
33 AppType m_eAppType;
35 virtual void
36 WriteEntryToStream(std::unique_lock<std::mutex>& rGuard, const LockFileEntry& aEntry,
37 const css::uno::Reference<css::io::XOutputStream>& xStream) override;
39 virtual css::uno::Reference<css::io::XInputStream>
40 OpenStream(std::unique_lock<std::mutex>& rGuard) override;
42 virtual LockFileEntry GetLockDataImpl(std::unique_lock<std::mutex>& rGuard) override;
44 public:
45 MSODocumentLockFile(std::u16string_view aOrigURL);
46 virtual ~MSODocumentLockFile() override;
48 virtual void RemoveFile() override;
50 static bool IsMSOSupportedFileFormat(std::u16string_view aURL);
54 #endif
56 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */