diff options
author | Pranam Lashkari <lpranam@collabora.com> | 2021-09-17 19:13:15 +0530 |
---|---|---|
committer | Pranam Lashkari <lpranam@collabora.com> | 2022-01-12 05:04:37 +0100 |
commit | e4e5ced464744fae7682ed9ef2871e51203aca91 (patch) | |
tree | e504696a09a73fbf69c51b65fbc0c74a1004eade /include | |
parent | 33c9bc0225a92f26770f9ef20b252af47853e7b9 (diff) |
LOK: maintain blocked command list per view
Change-Id: I7c621accd84f49447ab3e08a4bb662a9b91b834a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122253
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128107
Diffstat (limited to 'include')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 7 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 9 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitEnums.h | 7 | ||||
-rw-r--r-- | include/comphelper/lok.hxx | 7 | ||||
-rw-r--r-- | include/sfx2/lokhelper.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/viewsh.hxx | 14 |
6 files changed, 16 insertions, 30 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index f9b9fc8148ba..364ff5cb0669 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -460,14 +460,9 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::setBlockedCommandList void (*setBlockedCommandList) (LibreOfficeKitDocument* pThis, + int nViewId, const char* bolckedCommandList); - /// @see lok::Document::setBlockedCommandView - void (*setBlockedCommandView) (LibreOfficeKitDocument* pThis, - int nViewId, - const char* type, - bool isBlocked); - #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index c7011dd2d06e..6ead8a8d80d8 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -790,14 +790,9 @@ public: mpDoc->pClass->sendFormFieldEvent(mpDoc, pArguments); } - void setBlockedCommandList(const char* bolckedCommandList) + void setBlockedCommandList(int nViewId, const char* bolckedCommandList) { - mpDoc->pClass->setBlockedCommandList(mpDoc, bolckedCommandList); - } - - void setBlockedCommandView(int nViewId, const char* type, bool isBlocked) - { - mpDoc->pClass->setBlockedCommandView(mpDoc, nViewId, type, isBlocked); + mpDoc->pClass->setBlockedCommandList(mpDoc, nViewId, bolckedCommandList); } #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 90a7f23d82b6..2140c833624d 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -778,6 +778,11 @@ typedef enum * color in the payload as a RGB hex string (RRGGBB). */ LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR = 52, + + /** + * When a user tries to use command which is restricted for that user + */ + LOK_COMMAND_BLOCKED = 53, } LibreOfficeKitCallbackType; @@ -912,6 +917,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY"; case LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR: return "LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR"; + case LOK_COMMAND_BLOCKED: + return "LOK_COMMAND_BLOCKED"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx index e48126015ff5..257b59f38165 100644 --- a/include/comphelper/lok.hxx +++ b/include/comphelper/lok.hxx @@ -12,8 +12,6 @@ #include <comphelper/comphelperdllapi.h> #include <rtl/ustring.hxx> -#include <vector> -#include <unordered_set> class LanguageTag; @@ -112,11 +110,6 @@ COMPHELPER_DLLPUBLIC void statusIndicatorSetValue(int percent); COMPHELPER_DLLPUBLIC void statusIndicatorFinish(); COMPHELPER_DLLPUBLIC void setBlockedCommandList(const char* bolckedCommandList); -COMPHELPER_DLLPUBLIC const std::unordered_set<OUString>& getFreemiumDenyList(); -COMPHELPER_DLLPUBLIC bool isCommandFreemiumDenied(const OUString& command); - -COMPHELPER_DLLPUBLIC const std::unordered_set<OUString>& getRestrictedCommandList(); -COMPHELPER_DLLPUBLIC bool isRestrictedCommand(const OUString& command); } } diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 6281bfbdd8be..8d6d8de7ef70 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -63,7 +63,7 @@ public: /// Get viewIds of views of the current DocId. static bool getViewIds(int nDocId, int* pArray, size_t nSize); /// Set View Blocked for some uno commands - static void setBlockedCommandView(int nViewId, const OUString& type, bool isBlocked); + static void setBlockedCommandList(int nViewId, const char* bolckedCommandList); /// Get the document id for a view static int getDocumentIdOfView(int nViewId); /// Get the default language that should be used for views diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 615e798877f9..d5066759e142 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -34,6 +34,7 @@ #include <LibreOfficeKit/LibreOfficeKitTypes.h> #include <editeng/outliner.hxx> #include <functional> +#include <unordered_set> class SfxTabPage; class SfxBaseController; @@ -160,8 +161,7 @@ friend class SfxPrinterController; LanguageTag maLOKLanguageTag; LanguageTag maLOKLocale; LOKDeviceFormFactor maLOKDeviceFormFactor; - bool mbLOKIsFreemiumView; - bool mbLOKIsRestrictedView; + std::unordered_set<OUString> mvLOKBlockedCommandList; /// Used to set the DocId at construction time. See SetCurrentDocId. static ViewShellDocId mnCurrentDocId; @@ -388,13 +388,9 @@ public: virtual tools::Rectangle getLOKVisibleArea() const { return tools::Rectangle(); } - // Fremium view settings - void setFreemiumView(bool isFreemium) { mbLOKIsFreemiumView = isFreemium; } - bool isFreemiumView() { return mbLOKIsFreemiumView; } - - // Restricted view setting - void setRestrictedView(bool isRestricted) { mbLOKIsRestrictedView = isRestricted; } - bool isRestrictedView() { return mbLOKIsRestrictedView; } + // Blocked Command view settings + void setBlockedCommandList(const char* bolckedCommandList); + bool isBlockedCommand(OUString command); }; |