summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2020-01-24 17:05:53 +0100
committerMichael Stahl <michael.stahl@cib.de>2020-02-03 12:03:29 +0100
commita5cd4d39f09c3658c2b7cfff4ab6a74449d4f0c0 (patch)
treee32bbba5af0b53556e4c1eb9479b77d7b0a03705
parent916cbda310a43d46a0789fd8b2c8f15fb86b27b4 (diff)
Add ProtectBookmarksAndFields per-document option
Change-Id: I8dac403ddea59026b5f52c132c8accc1bd0ada92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87360 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx1
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx10
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx1
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx18
4 files changed, 27 insertions, 3 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 56ff3ab04234..39ca9a52c87b 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -103,6 +103,7 @@ enum class DocumentSettingId
EMBED_SYSTEM_FONTS,
APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
CONTINUOUS_ENDNOTES,
+ 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 dc77c84f05cf..2b1330201e5b 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -93,7 +93,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbSubtractFlys(false),
mApplyParagraphMarkFormatToNumbering(false),
mbLastBrowseMode( false ),
- mbDisableOffPagePositioning ( false )
+ mbDisableOffPagePositioning ( false ),
+ mbProtectBookmarksAndFields( false )
// COMPATIBILITY FLAGS END
{
@@ -217,8 +218,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::CONTINUOUS_ENDNOTES:
- return mbContinuousEndnotes;
+ case DocumentSettingId::CONTINUOUS_ENDNOTES: return mbContinuousEndnotes;
+ case DocumentSettingId::PROTECT_BOOKMARKS_AND_FIELDS: return mbProtectBookmarksAndFields;
default:
OSL_FAIL("Invalid setting id");
}
@@ -454,6 +455,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
case DocumentSettingId::CONTINUOUS_ENDNOTES:
mbContinuousEndnotes = 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 be639b1f3421..9ed267e70669 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -162,6 +162,7 @@ class DocumentSettingManager :
bool mbDisableOffPagePositioning; // tdf#112443
bool mbEmptyDbFieldHidesPara;
bool mbContinuousEndnotes = false;
+ bool mbProtectBookmarksAndFields;
public:
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 5327dae31000..238c7d8dd7c7 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -140,6 +140,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_DISABLE_OFF_PAGE_POSITIONING,
HANDLE_EMPTY_DB_FIELD_HIDES_PARA,
HANDLE_CONTINUOUS_ENDNOTES,
+ HANDLE_PROTECT_BOOKMARKS_AND_FIELDS,
};
}
@@ -227,6 +228,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ 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("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, 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
@@ -935,6 +937,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(OUString::number(rInfo.mnHandle));
}
@@ -1397,6 +1409,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
<<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::CONTINUOUS_ENDNOTES);
}
break;
+ case HANDLE_PROTECT_BOOKMARKS_AND_FIELDS:
+ {
+ rValue <<= mpDoc->getIDocumentSettingAccess().get(
+ DocumentSettingId::PROTECT_BOOKMARKS_AND_FIELDS);
+ }
+ break;
default:
throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
}