summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2022-11-30 13:09:07 -0500
committerMiklos Vajna <vmiklos@collabora.com>2022-12-13 14:24:56 +0000
commit65fa248f9a9504747a63698746350db139ae53ce (patch)
tree34b2263c4f2713bc654ad17adb99df4331e30fed /sw/inc
parent39c35de607f86d3d512c34e2dbc4622c579ce926 (diff)
tdf#151548 sw content controls: preserve lock
DOCX SdtControls can be locked in two ways: -Content Control cannot be deleted (sdtLocked) -Contents cannot be edited (contentLocked) or both (sdtContentLocked) make CppunitTest_writerfilter_dmapper CPPUNIT_TEST_NAME=testSdtRunRichText make CppunitTest_sw_ooxmlexport4 CPPUNIT_TEST_NAME=testSimpleSdts make CppunitTest_sw_ooxmlexport17 CPPUNIT_TEST_NAME=testDateContentControlExport make CppunitTest_sw_core_unocore CPPUNIT_TEST_NAME=testContentControlDate make CppunitTest_sw_macros_test CPPUNIT_TEST_NAME=testVba make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlExport make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlImport Change-Id: I5a82d9f6b5103a4902f59af66cd8a99addd4e690 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143542 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/formatcontentcontrol.hxx12
-rw-r--r--sw/inc/unoprnms.hxx1
2 files changed, 13 insertions, 0 deletions
diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index 94399d6818e8..e561fa6e23fb 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -179,6 +179,9 @@ class SW_DLLPUBLIC SwContentControl : public sw::BroadcastingModify
/// The id: just remembered.
sal_Int32 m_nId = 0;
+ /// The control and content locks: mostly just remembered.
+ OUString m_aLock;
+
/// Stores a list item index, in case the doc model is not yet updated.
// i.e. temporarily store the selected item until the text is inserted by GotoContentControl.
std::optional<size_t> m_oSelectedListItem;
@@ -359,8 +362,17 @@ public:
sal_Int32 GetId() const { return m_nId; }
+ // At the design level, define how the control should be locked. No effect at implementation lvl
+ void SetLock(bool bLockContent, bool bLockControl);
+ void SetLock(const OUString& rLock) { m_aLock = rLock; }
+
+ // At the design level, get how the control is locked. Does not reflect actual implementation.
+ std::optional<bool> GetLock(bool bControl) const;
+ const OUString& GetLock() const { return m_aLock; }
+
void SetReadWrite(bool bReadWrite) { m_bReadWrite = bReadWrite; }
+ // At the implementation level, define whether the user can directly modify the contents.
bool GetReadWrite() const { return m_bReadWrite; }
SwContentControlType GetType() const;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 199f4847c930..2e7158fac97e 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -917,6 +917,7 @@ inline constexpr OUStringLiteral UNO_NAME_COLOR = u"Color";
inline constexpr OUStringLiteral UNO_NAME_ALIAS = u"Alias";
inline constexpr OUStringLiteral UNO_NAME_TAG = u"Tag";
inline constexpr OUStringLiteral UNO_NAME_ID = u"Id";
+inline constexpr OUStringLiteral UNO_NAME_LOCK = u"Lock";
inline constexpr OUStringLiteral UNO_NAME_DATE_STRING = u"DateString";
#endif