summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2021-09-17 19:13:15 +0530
committerMiklos Vajna <vmiklos@collabora.com>2021-10-22 17:49:20 +0200
commitc4b934128965cbd461f1c61255fe0c5d25cc29d6 (patch)
tree04e4015769ed37bf876e3e7eec12bb863070cd97 /include
parentLOK: unify freemium APIs and uno command restriction APIs (diff)
downloadcore-c4b934128965cbd461f1c61255fe0c5d25cc29d6.tar.gz
core-c4b934128965cbd461f1c61255fe0c5d25cc29d6.zip
LOK: maintain blocked command list per view
Conflicts: include/LibreOfficeKit/LibreOfficeKitEnums.h include/sfx2/viewsh.hxx libreofficekit/source/gtk/lokdocview.cxx sfx2/source/view/viewsh.cxx Change-Id: I7c621accd84f49447ab3e08a4bb662a9b91b834a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124049 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h7
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx9
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitEnums.h9
-rw-r--r--include/comphelper/lok.hxx7
-rw-r--r--include/sfx2/lokhelper.hxx2
-rw-r--r--include/sfx2/viewsh.hxx14
6 files changed, 17 insertions, 31 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 72beeb613246..29ffeff44bbb 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);
-
/// @see lok::Document::renderSearchResult
bool (*renderSearchResult) (LibreOfficeKitDocument* pThis,
const char* pSearchResult,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 114438445350..bde89ec4240c 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -787,14 +787,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);
}
/**
* Render input search result to a bitmap buffer.
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 497a5eacc804..006713447aed 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -780,6 +780,11 @@ typedef enum
LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR = 52,
/**
+ * When a user tries to use command which is restricted for that user
+ */
+ LOK_COMMAND_BLOCKED = 53,
+
+ /**
* The position of the cell cursor jumped to.
*
* Payload format: "x, y, width, height, column, row", where the first
@@ -789,7 +794,7 @@ typedef enum
*
* Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
*/
- LOK_CALLBACK_SC_FOLLOW_JUMP = 53,
+ LOK_CALLBACK_SC_FOLLOW_JUMP = 54,
}
LibreOfficeKitCallbackType;
@@ -924,6 +929,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";
case LOK_CALLBACK_SC_FOLLOW_JUMP:
return "LOK_CALLBACK_SC_FOLLOW_JUMP";
}
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 1ea5b23f017d..54d461dc8cbc 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);
}
#endif // INCLUDED_COMPHELPER_LOK_HXX
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index f37d70f30abf..9de82ce9049c 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -64,7 +64,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 29cf9b756ad7..4dd1783fabe9 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;
@@ -166,8 +167,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;
@@ -394,13 +394,9 @@ public:
virtual tools::Rectangle getLOKVisibleArea() const { return tools::Rectangle(); }
- // 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; }
+ // Blocked Command view settings
+ void setBlockedCommandList(const char* bolckedCommandList);
+ bool isBlockedCommand(OUString command);
};