diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2020-01-24 17:05:53 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2020-03-25 20:46:52 +0100 |
commit | 8085c78902dd31133f1285740ef5fadde2834e27 (patch) | |
tree | 861ef333feda0c89ef9b9a1b570442fe0a771b46 /sw | |
parent | 9ea80bb272c6bb9f6a29cc7320a7e4d42fa37eda (diff) |
Add ProtectBookmarksAndFields per-document option
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87360
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
(cherry picked from commit a5cd4d39f09c3658c2b7cfff4ab6a74449d4f0c0)
Change-Id: I8dac403ddea59026b5f52c132c8accc1bd0ada92
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/IDocumentSettingAccess.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentSettingManager.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentSettingManager.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uno/SwXDocumentSettings.cxx | 18 |
4 files changed, 26 insertions, 1 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index a66f2367c22f..b2da919d29a3 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -98,6 +98,7 @@ enum class DocumentSettingId EMBED_FONTS, EMBED_SYSTEM_FONTS, APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, + PROTECT_BOOKMARKS_AND_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 c900a985dee2..be39e0c3b8a9 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -88,7 +88,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbSubtractFlys(false), mApplyParagraphMarkFormatToNumbering(false), mbLastBrowseMode( false ), - mbDisableOffPagePositioning ( false ) + mbDisableOffPagePositioning ( false ), + mbProtectBookmarksAndFields( false ) // COMPATIBILITY FLAGS END { @@ -208,6 +209,7 @@ 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; default: OSL_FAIL("Invalid setting id"); } @@ -428,6 +430,9 @@ 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; + break; default: OSL_FAIL("Invalid setting id"); } diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index 1cf9a9d9fea9..f93d540165a9 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -156,6 +156,7 @@ class DocumentSettingManager : bool mbLastBrowseMode : 1; bool mbDisableOffPagePositioning; // tdf#112443 bool mbEmptyDbFieldHidesPara; + bool mbProtectBookmarksAndFields; public: diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 281bee24a542..f84c7535aa46 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -137,6 +137,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_SUBTRACT_FLYS, HANDLE_DISABLE_OFF_PAGE_POSITIONING, HANDLE_EMPTY_DB_FIELD_HIDES_PARA, + HANDLE_PROTECT_BOOKMARKS_AND_FIELDS, }; static MasterPropertySetInfo * lcl_createSettingsInfo() @@ -216,6 +217,7 @@ 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 }, /* * 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 @@ -890,6 +892,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } } break; + case HANDLE_PROTECT_BOOKMARKS_AND_FIELDS: + { + bool bTmp; + if (rValue >>= bTmp) + { + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_BOOKMARKS_AND_FIELDS, + bTmp); + } + } + break; default: throw UnknownPropertyException(); } @@ -1322,6 +1334,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA); } break; + case HANDLE_PROTECT_BOOKMARKS_AND_FIELDS: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( + DocumentSettingId::PROTECT_BOOKMARKS_AND_FIELDS); + } + break; default: throw UnknownPropertyException(); } |