sw/inc/IDocumentSettingAccess.hxx             |    1 +
 sw/source/core/doc/DocumentSettingManager.cxx |   10 +++++++---
 sw/source/core/inc/DocumentSettingManager.hxx |    1 +
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 ++++++++++++++++++
 4 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit a5cd4d39f09c3658c2b7cfff4ab6a74449d4f0c0
Author:     Katarina Behrens <katarina.behr...@cib.de>
AuthorDate: Fri Jan 24 17:05:53 2020 +0100
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Mon Feb 3 12:03:29 2020 +0100

    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.st...@cib.de>

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));
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to