diff options
author | Pranam Lashkari <lpranam@collabora.com> | 2021-09-13 23:05:40 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-10-22 12:49:56 +0200 |
commit | 8de04f459611df936c0b315b6d48cb3dbcc1d5fa (patch) | |
tree | d0ba32ac0b7422b28e9db8525c9ca62de110d62a /include | |
parent | 751fa45b1780f275a7b8fdce52a2fd722e87fcb7 (diff) |
LOK: introduce way to restrict uno commands
With this new API we can define which uno commands to restrict their functionality
Conflicts:
desktop/qa/desktop_lib/test_desktop_lib.cxx
include/LibreOfficeKit/LibreOfficeKit.h
include/LibreOfficeKit/LibreOfficeKit.hxx
include/sfx2/viewsh.hxx
Change-Id: I9f3fd659d373e56542c5323922a53564f1cfb27b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124046
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 20 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 27 | ||||
-rw-r--r-- | include/comphelper/lok.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/lokhelper.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/viewsh.hxx | 5 |
5 files changed, 44 insertions, 14 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 79a6b2a3faea..6a94583b8bf3 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -458,11 +458,6 @@ struct _LibreOfficeKitDocumentClass void (*sendFormFieldEvent) (LibreOfficeKitDocument* pThis, const char* pArguments); - /// @see lok::Document::renderSearchResult - bool (*renderSearchResult) (LibreOfficeKitDocument* pThis, - const char* pSearchResult, - unsigned char** pBitmapBuffer, - int* pWidth, int* pHeight, size_t* pByteSize); /// @see lok::Document::setFreemiumDenyList void (*setFreemiumDenyList) (LibreOfficeKitDocument* pThis, const char* freemiumDenyList); @@ -472,6 +467,21 @@ struct _LibreOfficeKitDocumentClass int nViewId, bool isFreemium); + /// @see lok::Document::setRestrictedCommandList + void (*setRestrictedCommandList) (LibreOfficeKitDocument* pThis, + const char* restrictedCommandList); + + /// @see lok::Document::setRestrictedView + void (*setRestrictedView) (LibreOfficeKitDocument* pThis, + int nViewId, + bool isRestricted); + + /// @see lok::Document::renderSearchResult + bool (*renderSearchResult) (LibreOfficeKitDocument* pThis, + const char* pSearchResult, + unsigned char** pBitmapBuffer, + int* pWidth, int* pHeight, size_t* pByteSize); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 778f3a80d3fe..9215ffae6048 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -787,6 +787,24 @@ public: mpDoc->pClass->sendFormFieldEvent(mpDoc, pArguments); } + void setFreemiumDenyList(const char* freemiumDenyList) + { + mpDoc->pClass->setFreemiumDenyList(mpDoc, freemiumDenyList); + } + + void setFreemiumView(int nViewId, bool isFreemium) + { + mpDoc->pClass->setFreemiumView(mpDoc, nViewId, isFreemium); + } + void setRestrictedCommandList(const char* restrictedCommandList) + { + mpDoc->pClass->setRestrictedCommandList(mpDoc, restrictedCommandList); + } + + void setRestrictedView(int nViewId, bool isRestricted) + { + mpDoc->pClass->setRestrictedView(mpDoc, nViewId, isRestricted); + } /** * Render input search result to a bitmap buffer. * @@ -802,15 +820,6 @@ public: { return mpDoc->pClass->renderSearchResult(mpDoc, pSearchResult, pBitmapBuffer, pWidth, pHeight, pByteSize); } - void setFreemiumDenyList(const char* freemiumDenyList) - { - mpDoc->pClass->setFreemiumDenyList(mpDoc, freemiumDenyList); - } - - void setFreemiumView(int nViewId, bool isFreemium) - { - mpDoc->pClass->setFreemiumView(mpDoc, nViewId, isFreemium); - } #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx index d68fabb2e600..847c56012565 100644 --- a/include/comphelper/lok.hxx +++ b/include/comphelper/lok.hxx @@ -113,6 +113,10 @@ COMPHELPER_DLLPUBLIC void statusIndicatorFinish(); COMPHELPER_DLLPUBLIC void setFreemiumDenyList(const char* freemiumDenyList); COMPHELPER_DLLPUBLIC const std::vector<OUString>& getFreemiumDenyList(); COMPHELPER_DLLPUBLIC bool isCommandFreemiumDenied(const OUString& command); + +COMPHELPER_DLLPUBLIC void setRestrictedCommandList(const char* restrictedCommandList); +COMPHELPER_DLLPUBLIC const std::vector<OUString>& getRestrictedCommandList(); +COMPHELPER_DLLPUBLIC bool isRestrictedCommand(const OUString& command); } #endif // INCLUDED_COMPHELPER_LOK_HXX diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index ce5c9f4a63e3..982296600d48 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -65,6 +65,8 @@ public: static bool getViewIds(int nDocId, int* pArray, size_t nSize); /// Set View Freemium static void setFreemiumView(int nViewId, bool isFreemium); + /// Set View Restricted + static void setRestrictedView(int nViewId, bool isRestricted); /// 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 c972d67c7f13..886ca34cdf44 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -167,6 +167,7 @@ friend class SfxPrinterController; LanguageTag maLOKLocale; LOKDeviceFormFactor maLOKDeviceFormFactor; bool mbLOKIsFreemiumView; + bool mbLOKIsRestrictedView; /// Used to set the DocId at construction time. See SetCurrentDocId. static ViewShellDocId mnCurrentDocId; @@ -396,6 +397,10 @@ public: // Freemium view settings void setFreemiumView(bool isFreemium) { mbLOKIsFreemiumView = isFreemium; } bool isFreemiumView() const { return mbLOKIsFreemiumView; } + + // Restricted view setting + void setRestrictedView(bool isRestricted) { mbLOKIsRestrictedView = isRestricted; } + bool isRestrictedView() { return mbLOKIsRestrictedView; } }; |