diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-01-31 17:11:09 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2020-03-25 20:46:52 +0100 |
commit | 79cb138c393f94dfe8fe42887a5cfc5e20fe61e3 (patch) | |
tree | 6ca3011c7a692fbf42e33fc122d24433e8ec1bba | |
parent | 8085c78902dd31133f1285740ef5fadde2834e27 (diff) |
sw: split into 2 settings ProtectBookmarks and ProtectFields
On second thought, let's have 2 settings because there might be some
use-case for protecting one but not the other.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87777
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
(cherry picked from commit 249b10c22f4a35672a7388d34b2ded1b76054dac)
Change-Id: If8442b64adeeed80b25c8b69f607f2d4993786e4
-rw-r--r-- | sw/inc/IDocumentSettingAccess.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentSettingManager.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentSettingManager.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/uno/SwXDocumentSettings.cxx | 30 |
4 files changed, 37 insertions, 12 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index b2da919d29a3..903cd725745d 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -98,7 +98,8 @@ enum class DocumentSettingId EMBED_FONTS, EMBED_SYSTEM_FONTS, APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, - PROTECT_BOOKMARKS_AND_FIELDS, + PROTECT_BOOKMARKS, + PROTECT_FIELDS, }; /** Provides access to settings of a document diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index be39e0c3b8a9..38e4694c84d5 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -89,7 +89,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mApplyParagraphMarkFormatToNumbering(false), mbLastBrowseMode( false ), mbDisableOffPagePositioning ( false ), - mbProtectBookmarksAndFields( false ) + mbProtectBookmarks(false), + mbProtectFields(false) // COMPATIBILITY FLAGS END { @@ -209,7 +210,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING: return mApplyParagraphMarkFormatToNumbering; case DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING: return mbDisableOffPagePositioning; case DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA: return mbEmptyDbFieldHidesPara; - case DocumentSettingId::PROTECT_BOOKMARKS_AND_FIELDS: return mbProtectBookmarksAndFields; + case DocumentSettingId::PROTECT_BOOKMARKS: return mbProtectBookmarks; + case DocumentSettingId::PROTECT_FIELDS: return mbProtectFields; default: OSL_FAIL("Invalid setting id"); } @@ -430,8 +432,11 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo case DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA: mbEmptyDbFieldHidesPara = value; break; - case DocumentSettingId::PROTECT_BOOKMARKS_AND_FIELDS: - mbProtectBookmarksAndFields = value; + case DocumentSettingId::PROTECT_BOOKMARKS: + mbProtectBookmarks = value; + break; + case DocumentSettingId::PROTECT_FIELDS: + mbProtectFields = value; break; default: OSL_FAIL("Invalid setting id"); diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index f93d540165a9..351bd20c437a 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -156,7 +156,8 @@ class DocumentSettingManager : bool mbLastBrowseMode : 1; bool mbDisableOffPagePositioning; // tdf#112443 bool mbEmptyDbFieldHidesPara; - bool mbProtectBookmarksAndFields; + bool mbProtectBookmarks; + bool mbProtectFields; public: diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index f84c7535aa46..84522152d2fe 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -137,7 +137,8 @@ enum SwDocumentSettingsPropertyHandles HANDLE_SUBTRACT_FLYS, HANDLE_DISABLE_OFF_PAGE_POSITIONING, HANDLE_EMPTY_DB_FIELD_HIDES_PARA, - HANDLE_PROTECT_BOOKMARKS_AND_FIELDS, + HANDLE_PROTECT_BOOKMARKS, + HANDLE_PROTECT_FIELDS, }; static MasterPropertySetInfo * lcl_createSettingsInfo() @@ -217,7 +218,8 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0}, { OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0}, { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 }, - { OUString("ProtectBookmarksAndFields"), HANDLE_PROTECT_BOOKMARKS_AND_FIELDS, cppu::UnoType<bool>::get(), 0 }, + { OUString("ProtectBookmarks"), HANDLE_PROTECT_BOOKMARKS, cppu::UnoType<bool>::get(), 0 }, + { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 }, /* * As OS said, we don't have a view when we need to set this, so I have to * find another solution before adding them to this property set - MTG @@ -892,12 +894,22 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } } break; - case HANDLE_PROTECT_BOOKMARKS_AND_FIELDS: + case HANDLE_PROTECT_BOOKMARKS: { bool bTmp; if (rValue >>= bTmp) { - mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_BOOKMARKS_AND_FIELDS, + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_BOOKMARKS, + bTmp); + } + } + break; + case HANDLE_PROTECT_FIELDS: + { + bool bTmp; + if (rValue >>= bTmp) + { + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FIELDS, bTmp); } } @@ -1334,10 +1346,16 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA); } break; - case HANDLE_PROTECT_BOOKMARKS_AND_FIELDS: + case HANDLE_PROTECT_BOOKMARKS: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( + DocumentSettingId::PROTECT_BOOKMARKS); + } + break; + case HANDLE_PROTECT_FIELDS: { rValue <<= mpDoc->getIDocumentSettingAccess().get( - DocumentSettingId::PROTECT_BOOKMARKS_AND_FIELDS); + DocumentSettingId::PROTECT_FIELDS); } break; default: |