summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2021-09-15 23:39:32 +0530
committerMiklos Vajna <vmiklos@collabora.com>2021-10-22 16:54:20 +0200
commitd05c69a892535b910943fe98fbce42f5cc860aa4 (patch)
tree10dfcfc58a5456627821d3903f7c013a8f585e6c /desktop
parent6c9909dee4b06948ca6932397caa338d77ec7290 (diff)
LOK: unify freemium APIs and uno command restriction APIs
Conflicts: include/LibreOfficeKit/LibreOfficeKit.hxx sfx2/source/control/unoctitm.cxx Change-Id: I3badb038822331ab5cb30df6a66ce9a0640cf340 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124047 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx10
-rw-r--r--desktop/source/lib/init.cxx43
2 files changed, 16 insertions, 37 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 19aa24684cb8..0fa5dc7ae6fe 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -3458,15 +3458,13 @@ 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(66), offsetof(struct _LibreOfficeKitDocumentClass, renderSearchResult));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(62), offsetof(struct _LibreOfficeKitDocumentClass, setBlockedCommandList));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(63), offsetof(struct _LibreOfficeKitDocumentClass, setBlockedCommandView));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(64), offsetof(struct _LibreOfficeKitDocumentClass, renderSearchResult));
// Extending is fine, update this, and add new assert for the offsetof the
// new method
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(67), sizeof(struct _LibreOfficeKitDocumentClass));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(65), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6c6c2ae64f91..62aeabfadd67 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1070,19 +1070,13 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis,
int nType,
int nCharCode,
int nKeyCode);
-static void doc_setFreemiumDenyList(LibreOfficeKitDocument* pThis,
- const char* freemiumDenyList);
+static void doc_setBlockedCommandList(LibreOfficeKitDocument* pThis,
+ const char* bolckedCommandList);
-static void doc_setFreemiumView(LibreOfficeKitDocument* pThis,
+static void doc_setBlockedCommandView(LibreOfficeKitDocument* pThis,
int nViewId,
- bool isFreemium);
-
-static void doc_setRestrictedCommandList(LibreOfficeKitDocument* pThis,
- const char* restrictedCommandList);
-
-static void doc_setRestrictedView(LibreOfficeKitDocument* pThis,
- int nViewId,
- bool isRestricted);
+ const char* type,
+ bool isBlocked);
static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis,
unsigned nWindowId,
@@ -1374,11 +1368,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->sendFormFieldEvent = doc_sendFormFieldEvent;
m_pDocumentClass->renderSearchResult = doc_renderSearchResult;
- 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;
}
@@ -3657,26 +3648,16 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar
}
}
-static void doc_setFreemiumDenyList(LibreOfficeKitDocument* /*pThis*/, const char* freemiumDenyList)
-{
- comphelper::LibreOfficeKit::setFreemiumDenyList(freemiumDenyList);
-}
-
-static void doc_setFreemiumView(LibreOfficeKitDocument* /*pThis*/, 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)