summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2021-09-15 23:39:32 +0530
committerTor Lillqvist <tml@collabora.com>2022-01-10 14:27:49 +0200
commit6c564ea5eb8b43e8c5ee2bcbc20acdabfb5b7f75 (patch)
treeb806e5d935a4d427855a534cf0a96f747b4b2faf /desktop
parent0a0cc4b5547f2de729474e5119d18c9837eadca2 (diff)
LOK: unify freemium APIs and uno command restriction APIs
Signed-off-by: Pranam Lashkari <lpranam@collabora.com> Change-Id: I3badb038822331ab5cb30df6a66ce9a0640cf340 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122162 Tested-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx8
-rw-r--r--desktop/source/lib/init.cxx40
2 files changed, 15 insertions, 33 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 66ff39edd7b3..f5b0916197a8 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -3307,14 +3307,12 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(59), offsetof(struct _LibreOfficeKitDocumentClass, completeFunction));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(60), offsetof(struct _LibreOfficeKitDocumentClass, setWindowTextSelection));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(61), offsetof(struct _LibreOfficeKitDocumentClass, sendFormFieldEvent));
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(62), offsetof(struct _LibreOfficeKitDocumentClass, setFreemiumDenyList));
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(63), offsetof(struct _LibreOfficeKitDocumentClass, setFreemiumView));
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(64), offsetof(struct _LibreOfficeKitDocumentClass, setRestrictedCommandList));
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(65), offsetof(struct _LibreOfficeKitDocumentClass, setRestrictedView));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(62), offsetof(struct _LibreOfficeKitDocumentClass, setBlockedCommandList));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(63), offsetof(struct _LibreOfficeKitDocumentClass, setBlockedCommandView));
// Extending is fine, update this, and add new assert for the offsetof the
// new method
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(66), sizeof(struct _LibreOfficeKitDocumentClass));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(64), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 30ee6bb0f607..2a5831ec0b79 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1084,16 +1084,13 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis,
int nType,
int nCharCode,
int nKeyCode);
-static void doc_setFreemiumDenyList(const char* freemiumDenyList);
+static void doc_setBlockedCommandList(LibreOfficeKitDocument* pThis,
+ const char* bolckedCommandList);
-static void doc_setFreemiumView(int nViewId, bool isFreemium);
-
-static void doc_setRestrictedCommandList(LibreOfficeKitDocument* pThis,
- const char* restrictedCommandList);
-
-static void doc_setRestrictedView(LibreOfficeKitDocument* pThis,
+static void doc_setBlockedCommandView(LibreOfficeKitDocument* pThis,
int nViewId,
- bool isRestricted);
+ const char* type,
+ bool isBlocked);
static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis,
unsigned nWindowId,
@@ -1378,11 +1375,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->sendFormFieldEvent = doc_sendFormFieldEvent;
- m_pDocumentClass->setFreemiumDenyList = doc_setFreemiumDenyList;
- m_pDocumentClass->setFreemiumView = doc_setFreemiumView;
-
- m_pDocumentClass->setRestrictedCommandList = doc_setRestrictedCommandList;
- m_pDocumentClass->setRestrictedView = doc_setRestrictedView;
+ m_pDocumentClass->setBlockedCommandList = doc_setBlockedCommandList;
+ m_pDocumentClass->setBlockedCommandView = doc_setBlockedCommandView;
gDocumentClass = m_pDocumentClass;
}
@@ -3683,26 +3677,16 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar
}
}
-static void doc_setFreemiumDenyList(const char* freemiumDenyList)
-{
- comphelper::LibreOfficeKit::setFreemiumDenyList(freemiumDenyList);
-}
-
-static void doc_setFreemiumView(int nViewId, bool isFreemium)
-{
- SolarMutexGuard aGuard;
- SfxLokHelper::setFreemiumView(nViewId, isFreemium);
-}
-
-static void doc_setRestrictedCommandList(LibreOfficeKitDocument* /*pThis*/, const char* restrictedCommandList)
+static void doc_setBlockedCommandList(LibreOfficeKitDocument* /*pThis*/, const char* bolckedCommandList)
{
- comphelper::LibreOfficeKit::setRestrictedCommandList(restrictedCommandList);
+ comphelper::LibreOfficeKit::setBlockedCommandList(bolckedCommandList);
}
-static void doc_setRestrictedView(LibreOfficeKitDocument* /*pThis*/, int nViewId, bool isRestricted)
+static void doc_setBlockedCommandView(LibreOfficeKitDocument* /*pThis*/, int nViewId, const char* type, bool isBlocked)
{
SolarMutexGuard aGuard;
- SfxLokHelper::setRestrictedView(nViewId, isRestricted);
+ OUString aType(type, strlen(type), RTL_TEXTENCODING_UTF8);
+ SfxLokHelper::setBlockedCommandView(nViewId, aType, isBlocked);
}
static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsigned nWindowId, int nType, const char* pText)