diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-07-27 11:27:00 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-07-27 16:40:12 +0200 |
commit | ca00470722ec7a7a7b190ca36a1f71da06ed6847 (patch) | |
tree | 5e559d4848ab8827916c9ea096d060759cbf5576 /wsd/LOOLWSD.hpp | |
parent | Notebookbar: Aesthetic fixes and make sure mobilewizard rules from mobile do ... (diff) | |
download | online-ca00470722ec7a7a7b190ca36a1f71da06ed6847.tar.gz online-ca00470722ec7a7a7b190ca36a1f71da06ed6847.zip |
allow saving a PDF, add "view_comment" state
This adds a "view_comment" in addition to "view" and "edit" state
into discovery.xml. In case it is enabled, the filters let the
comment commands through to core.
In addition add "Save Comment" menu action to allow saving the
comments, which is enabled when in "read-only" with "view_comment"
mode.
Change-Id: I3ab3dbee93ee2167ae96adea7025fc0b385f8201
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99473
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'wsd/LOOLWSD.hpp')
-rw-r--r-- | wsd/LOOLWSD.hpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp index 6f697f28a8..533c4dfd05 100644 --- a/wsd/LOOLWSD.hpp +++ b/wsd/LOOLWSD.hpp @@ -14,6 +14,7 @@ #include <chrono> #include <map> #include <set> +#include <unordered_set> #include <string> #include <utility> @@ -251,7 +252,8 @@ public: #if !MOBILEAPP static std::unique_ptr<ClipboardCache> SavedClipboards; #endif - static std::set<std::string> EditFileExtensions; + static std::unordered_set<std::string> EditFileExtensions; + static std::unordered_set<std::string> ViewWithCommentsFileExtensions; static unsigned MaxConnections; static unsigned MaxDocuments; static std::string OverrideWatermark; @@ -294,7 +296,7 @@ public: #endif } - /// Return true iff extension is marked as view action in discovery.xml. + /// Return true if extension is marked as view action in discovery.xml. static bool IsViewFileExtension(const std::string& extension) { #if MOBILEAPP @@ -307,6 +309,19 @@ public: #endif } + /// Return true if extension is marked as view_comment action in discovery.xml. + static bool IsViewWithCommentsFileExtension(const std::string& extension) + { +#if MOBILEAPP + (void) extension; + return false; // mark everything editable on mobile +#else + std::string lowerCaseExtension = extension; + std::transform(lowerCaseExtension.begin(), lowerCaseExtension.end(), lowerCaseExtension.begin(), ::tolower); + return ViewWithCommentsFileExtensions.find(lowerCaseExtension) != ViewWithCommentsFileExtensions.end(); +#endif + } + /// Returns the value of the specified application configuration, /// or the default, if one doesn't exist. template<typename T> |