summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorGökay Şatır <gokaysatir@gmail.com>2024-03-06 15:36:44 +0300
committerMiklos Vajna <vmiklos@collabora.com>2024-03-19 16:53:37 +0100
commitd50d40b12cf3077dd83e7d3da33e6f3a15e44e14 (patch)
tree95b24ad435664b5b88a1d8de3a137a505b045cfd /desktop
parent02c67183f14fffb3578fa8713b865a568dc6b648 (diff)
Allow enabling comment editing in readonly view mode.
Online side can set this property to allow comment editing. This is the infra. Implementation will be in another commit. Change-Id: I3a6f1ad6818c2c6587d98896c3d6d913d51a2295 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164988 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx3
-rw-r--r--desktop/source/lib/init.cxx15
2 files changed, 17 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 1239af480598..1a0c2fed27b1 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -3677,9 +3677,10 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(70), offsetof(struct _LibreOfficeKitDocumentClass, getA11yFocusedParagraph));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(71), offsetof(struct _LibreOfficeKitDocumentClass, getA11yCaretPosition));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(72), offsetof(struct _LibreOfficeKitDocumentClass, setViewReadOnly));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(73), offsetof(struct _LibreOfficeKitDocumentClass, setAllowChangeComments));
// As above
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(73), sizeof(struct _LibreOfficeKitDocumentClass));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(74), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 90bddb4fb899..8550b9d91b1b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1293,6 +1293,8 @@ static void doc_setViewTimezone(LibreOfficeKitDocument* pThis, int nId, const ch
static void doc_setViewReadOnly(LibreOfficeKitDocument* pThis, int nId, const bool readonly);
+static void doc_setAllowChangeComments(LibreOfficeKitDocument* pThis, int nId, const bool allow);
+
static void doc_setAccessibilityState(LibreOfficeKitDocument* pThis, int nId, bool bEnabled);
static char* doc_getA11yFocusedParagraph(LibreOfficeKitDocument* pThis);
@@ -1493,6 +1495,8 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference <css::lang::XComponent> xC
m_pDocumentClass->setViewReadOnly = doc_setViewReadOnly;
+ m_pDocumentClass->setAllowChangeComments = doc_setAllowChangeComments;
+
gDocumentClass = m_pDocumentClass;
}
pClass = m_pDocumentClass.get();
@@ -7210,6 +7214,17 @@ static void doc_setViewReadOnly(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* pTh
SfxViewShell::Current()->SetLokReadOnlyView(readOnly);
}
+static void doc_setAllowChangeComments(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* pThis, int nId, const bool allow)
+{
+ comphelper::ProfileZone aZone("doc_setAllowChangeComments");
+
+ SolarMutexGuard aGuard;
+ SetLastExceptionMsg();
+
+ doc_setView(pThis, nId);
+ SfxViewShell::Current()->SetAllowChangeComments(allow);
+}
+
static void doc_setAccessibilityState(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* pThis, int nId, bool nEnabled)
{
SolarMutexGuard aGuard;