cui/source/options/optinet2.cxx                            |    4 
 cui/source/options/securityoptions.cxx                     |   39 +
 cui/source/options/securityoptions.hxx                     |   20 
 cui/uiconfig/ui/securityoptionsdialog.ui                   |  406 ++++++++-----
 include/unotools/securityoptions.hxx                       |    4 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   36 +
 sc/source/filter/xml/xmlexprt.cxx                          |   10 
 sfx2/source/doc/objcont.cxx                                |    3 
 sfx2/source/doc/objserv.cxx                                |   10 
 sfx2/source/doc/objstor.cxx                                |    3 
 sw/source/filter/ww8/docxattributeoutput.cxx               |   12 
 sw/source/filter/ww8/docxtableexport.cxx                   |    6 
 unotools/source/config/securityoptions.cxx                 |   36 +
 xmloff/source/draw/sdxmlexp.cxx                            |    3 
 xmloff/source/text/XMLRedlineExport.cxx                    |    6 
 xmloff/source/text/txtflde.cxx                             |    3 
 16 files changed, 443 insertions(+), 158 deletions(-)

New commits:
commit ae2b52659ff563ead15c22ceeb406071b40564dc
Author:     Aron Budea <aron.bu...@collabora.com>
AuthorDate: Wed Jul 10 15:37:27 2024 +0200
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Wed Jul 10 15:38:50 2024 +0200

    Related tdf#157484 hide new checkboxes in 7.6
    
    Change-Id: I51a654f5198b08f7e8f1c7f35f79067d04967481

diff --git a/cui/uiconfig/ui/securityoptionsdialog.ui 
b/cui/uiconfig/ui/securityoptionsdialog.ui
index 6de08c6a461e..51aefd543a1b 100644
--- a/cui/uiconfig/ui/securityoptionsdialog.ui
+++ b/cui/uiconfig/ui/securityoptionsdialog.ui
@@ -415,7 +415,7 @@
                     <child>
                       <object class="GtkCheckButton" id="redlineinfo">
                         <property name="label" translatable="yes" 
context="securityoptionsdialog|redlineinfo">Keep track changes 
information</property>
-                        <property name="visible">True</property>
+                        <property name="visible">False</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="margin-start">20</property>
@@ -431,7 +431,7 @@
                     <child>
                       <object class="GtkCheckButton" id="docproperties">
                         <property name="label" translatable="yes" 
context="securityoptionsdialog|docproperties">Keep document user 
informations</property>
-                        <property name="visible">True</property>
+                        <property name="visible">False</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="margin-start">20</property>
@@ -447,7 +447,7 @@
                     <child>
                       <object class="GtkCheckButton" id="noteauthor">
                         <property name="label" translatable="yes" 
context="securityoptionsdialog|noteauthor">Keep author name and date of 
notes</property>
-                        <property name="visible">True</property>
+                        <property name="visible">False</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="margin-start">20</property>
@@ -463,7 +463,7 @@
                     <child>
                       <object class="GtkCheckButton" id="documentversion">
                         <property name="label" translatable="yes" 
context="securityoptionsdialog|documentversion">Keep document version 
information</property>
-                        <property name="visible">True</property>
+                        <property name="visible">False</property>
                         <property name="can-focus">True</property>
                         <property name="receives-default">False</property>
                         <property name="margin-start">20</property>
commit fb6a5085a810d54686ad7ef82cf2cca625106def
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Wed Oct 18 13:52:16 2023 +0200
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Wed Jul 10 11:39:35 2024 +0200

    tdf#156336 - sc ods: fix can't remove Calc comment metadata
    
    Remove Calc comment metadata (author, date) during ods export
    if the Remove personal information option is enable.
    
    Change-Id: I814aabb734cff4160dccf1913a33aa270c2edbf6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158116
    Tested-by: Jenkins
    Tested-by: Gabor Kelemen <kelem...@ubuntu.com>
    Reviewed-by: Gabor Kelemen <kelem...@ubuntu.com>
    (cherry picked from commit 87e1a77a9aadb883386816dc4ebc3dad64c81892)

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index d6afd59f5dc3..c016a7e2d379 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3693,16 +3693,22 @@ void ScXMLExport::exportAnnotationMeta( const 
uno::Reference < drawing::XShape >
     if (xCurrentShape.get()!=xShape.get())
         return;
 
+    bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
+        SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo) && 
!SvtSecurityOptions::IsOptionSet(
+            SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo);
+
     const OUString& sAuthor(pNote->GetAuthor());
     if (!sAuthor.isEmpty())
     {
         SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC,
                                             XML_CREATOR, true,
                                             false );
-        Characters(sAuthor);
+        Characters( bRemovePersonalInfo
+            ? "Author" + OUString::number(SvXMLExport::GetInfoID(sAuthor))
+            : sAuthor );
     }
 
-    const OUString& aDate(pNote->GetDate());
+    const OUString& aDate(bRemovePersonalInfo ? OUString("1970-01-01") : 
pNote->GetDate()); // Epoch time
     if (pDoc)
     {
         SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
commit 98db4b1f420464fb702313bd339fa63839080164
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Wed Oct 18 11:05:50 2023 +0200
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Wed Jul 10 11:38:31 2024 +0200

    tdf#157484 UI: Add UI controls for personal information to be kept
    
    or removed upon save.
    
    With the new options button we can keep the security infos upon save
    such as (even if we set the remove personal infos):
    
    - RedLine Info
    - Document User Info
    - Author and date of notes
    - Document version infos
    
    Also on the infobar, if we have a warning, clicking on the infobar button
    the security option dialog will open where we can set/modify these options.
    
    follow-up of: 1f440348eb0892fd2c9597806d87b5fe9d60d49a
    (tdf#157482 UI: Turn Security Warnings popup windows into infobars)
    
    Change-Id: I8d5d944d76dbdd31653401246113de097ca6d57b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158112
    Tested-by: Jenkins
    Tested-by: Gabor Kelemen <kelem...@ubuntu.com>
    Reviewed-by: Gabor Kelemen <kelem...@ubuntu.com>
    (cherry picked from commit 9f9e195dbabe07244622924bf609ab4676f16993)

diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 95d0ec18346b..700470b4ae01 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -798,6 +798,10 @@ bool SvxSecurityTabPage::FillItemSet( SfxItemSet* )
         CheckAndSave( SvtSecurityOptions::EOption::DocWarnPrint, 
m_xSecOptDlg->IsPrintDocsChecked(), bModified );
         CheckAndSave( SvtSecurityOptions::EOption::DocWarnCreatePdf, 
m_xSecOptDlg->IsCreatePdfChecked(), bModified );
         CheckAndSave( SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, 
m_xSecOptDlg->IsRemovePersInfoChecked(), bModified );
+        CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo, 
m_xSecOptDlg->IsRemoveRedlineInfoChecked(), bModified );
+        CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo, 
m_xSecOptDlg->IsRemoveDocUserInfoChecked(), bModified );
+        CheckAndSave( 
SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo, 
m_xSecOptDlg->IsRemoveNoteAuthorInfoChecked(), bModified );
+        CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo, 
m_xSecOptDlg->IsRemoveDocVersionInfoChecked(), bModified );
         CheckAndSave( SvtSecurityOptions::EOption::DocWarnRecommendPassword, 
m_xSecOptDlg->IsRecommPasswdChecked(), bModified );
         CheckAndSave( SvtSecurityOptions::EOption::CtrlClickHyperlink, 
m_xSecOptDlg->IsCtrlHyperlinkChecked(), bModified );
         CheckAndSave( SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, 
m_xSecOptDlg->IsBlockUntrustedRefererLinksChecked(), bModified );
diff --git a/cui/source/options/securityoptions.cxx 
b/cui/source/options/securityoptions.cxx
index 4b00176ab490..d583f626183e 100644
--- a/cui/source/options/securityoptions.cxx
+++ b/cui/source/options/securityoptions.cxx
@@ -54,6 +54,25 @@ SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* 
pParent)
     , m_xCtrlHyperlinkImg(m_xBuilder->weld_widget("lockctrlclick"))
     , 
m_xBlockUntrustedRefererLinksCB(m_xBuilder->weld_check_button("blockuntrusted"))
     , 
m_xBlockUntrustedRefererLinksImg(m_xBuilder->weld_widget("lockblockuntrusted"))
+    , m_xRedlineinfoCB(m_xBuilder->weld_check_button("redlineinfo"))
+    , m_xRedlineinfoImg(m_xBuilder->weld_widget("lockredlineinfo"))
+    , m_xDocPropertiesCB(m_xBuilder->weld_check_button("docproperties"))
+    , m_xDocPropertiesImg(m_xBuilder->weld_widget("lockdocproperties"))
+    , m_xNoteAuthorCB(m_xBuilder->weld_check_button("noteauthor"))
+    , m_xNoteAuthorImg(m_xBuilder->weld_widget("locknoteauthor"))
+    , m_xDocumentVersionCB(m_xBuilder->weld_check_button("documentversion"))
+    , m_xDocumentVersionImg(m_xBuilder->weld_widget("lockdocumentversion"))
+{
+    m_xRemovePersInfoCB->connect_toggled(LINK(this, SecurityOptionsDialog, 
ShowPersonalInfosToggle));
+    init();
+}
+
+IMPL_LINK_NOARG(SecurityOptionsDialog, ShowPersonalInfosToggle, 
weld::Toggleable&, void)
+{
+    changeKeepSecurityInfosEnabled();
+}
+
+void SecurityOptionsDialog::init()
 {
     enableAndSet(SvtSecurityOptions::EOption::DocWarnSaveOrSend, 
*m_xSaveOrSendDocsCB,
         *m_xSaveOrSendDocsImg);
@@ -65,12 +84,32 @@ SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* 
pParent)
         *m_xCreatePdfImg);
     enableAndSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, 
*m_xRemovePersInfoCB,
         *m_xRemovePersInfoImg);
+    enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo, 
*m_xRedlineinfoCB,
+        *m_xRedlineinfoImg);
+    enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo, 
*m_xDocPropertiesCB,
+        *m_xDocPropertiesImg);
+    enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo, 
*m_xNoteAuthorCB,
+        *m_xNoteAuthorImg);
+    enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo, 
*m_xDocumentVersionCB,
+        *m_xDocumentVersionImg);
     enableAndSet(SvtSecurityOptions::EOption::DocWarnRecommendPassword, 
*m_xRecommPasswdCB,
         *m_xRecommPasswdImg);
     enableAndSet(SvtSecurityOptions::EOption::CtrlClickHyperlink, 
*m_xCtrlHyperlinkCB,
         *m_xCtrlHyperlinkImg);
     enableAndSet(SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, 
*m_xBlockUntrustedRefererLinksCB,
         *m_xBlockUntrustedRefererLinksImg);
+
+    if 
(!SvtSecurityOptions::IsReadOnly(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo))
+        changeKeepSecurityInfosEnabled();
+}
+
+void SecurityOptionsDialog::changeKeepSecurityInfosEnabled()
+{
+    bool bEnable = m_xRemovePersInfoCB->get_active();
+    m_xRedlineinfoCB->set_sensitive(bEnable);
+    m_xDocPropertiesCB->set_sensitive(bEnable);
+    m_xNoteAuthorCB->set_sensitive(bEnable);
+    m_xDocumentVersionCB->set_sensitive(bEnable);
 }
 
 }
diff --git a/cui/source/options/securityoptions.hxx 
b/cui/source/options/securityoptions.hxx
index dc05f5bb8150..7884ccfbd30e 100644
--- a/cui/source/options/securityoptions.hxx
+++ b/cui/source/options/securityoptions.hxx
@@ -22,7 +22,6 @@
 
 namespace svx
 {
-
     class SecurityOptionsDialog : public weld::GenericDialogController
     {
     private:
@@ -44,17 +43,36 @@ namespace svx
         std::unique_ptr<weld::CheckButton> m_xBlockUntrustedRefererLinksCB;
         std::unique_ptr<weld::Widget> m_xBlockUntrustedRefererLinksImg;
 
+        std::unique_ptr<weld::CheckButton> m_xRedlineinfoCB;
+        std::unique_ptr<weld::Widget> m_xRedlineinfoImg;
+        std::unique_ptr<weld::CheckButton> m_xDocPropertiesCB;
+        std::unique_ptr<weld::Widget> m_xDocPropertiesImg;
+        std::unique_ptr<weld::CheckButton> m_xNoteAuthorCB;
+        std::unique_ptr<weld::Widget> m_xNoteAuthorImg;
+        std::unique_ptr<weld::CheckButton> m_xDocumentVersionCB;
+        std::unique_ptr<weld::Widget> m_xDocumentVersionImg;
+
     public:
         SecurityOptionsDialog(weld::Window* pParent);
 
+        void init();
+
         bool IsSaveOrSendDocsChecked() const { return 
m_xSaveOrSendDocsCB->get_active(); }
         bool IsSignDocsChecked() const { return m_xSignDocsCB->get_active(); }
         bool IsPrintDocsChecked() const { return m_xPrintDocsCB->get_active(); 
}
         bool IsCreatePdfChecked() const { return m_xCreatePdfCB->get_active(); 
}
         bool IsRemovePersInfoChecked() const { return 
m_xRemovePersInfoCB->get_active(); }
+        bool IsRemoveRedlineInfoChecked() const { return 
m_xRedlineinfoCB->get_active(); }
+        bool IsRemoveDocUserInfoChecked() const { return 
m_xDocPropertiesCB->get_active(); }
+        bool IsRemoveNoteAuthorInfoChecked() const { return 
m_xNoteAuthorCB->get_active(); }
+        bool IsRemoveDocVersionInfoChecked() const { return 
m_xDocumentVersionCB->get_active(); }
         bool IsRecommPasswdChecked() const { return 
m_xRecommPasswdCB->get_active(); }
         bool IsCtrlHyperlinkChecked() const { return 
m_xCtrlHyperlinkCB->get_active(); }
         bool IsBlockUntrustedRefererLinksChecked() const { return 
m_xBlockUntrustedRefererLinksCB->get_active(); }
+
+        DECL_LINK(ShowPersonalInfosToggle, weld::Toggleable&, void);
+
+        void changeKeepSecurityInfosEnabled();
     };
 }
 
diff --git a/cui/uiconfig/ui/securityoptionsdialog.ui 
b/cui/uiconfig/ui/securityoptionsdialog.ui
index 5ff6c85ec0e4..6de08c6a461e 100644
--- a/cui/uiconfig/ui/securityoptionsdialog.ui
+++ b/cui/uiconfig/ui/securityoptionsdialog.ui
@@ -1,33 +1,33 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.36.0 -->
+<!-- Generated with glade 3.38.2 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkDialog" id="SecurityOptionsDialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">6</property>
+    <property name="can-focus">False</property>
+    <property name="border-width">6</property>
     <property name="title" translatable="yes" 
context="securityoptionsdialog|SecurityOptionsDialog">Security Options and 
Warnings</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
-    <property name="default_width">0</property>
-    <property name="default_height">0</property>
-    <property name="type_hint">dialog</property>
+    <property name="default-width">0</property>
+    <property name="default-height">0</property>
+    <property name="type-hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
-        <property name="can_focus">False</property>
+        <property name="can-focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
+            <property name="can-focus">False</property>
+            <property name="layout-style">end</property>
             <child>
               <object class="GtkButton" id="ok">
                 <property name="label" translatable="yes" 
context="stock">_OK</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
+                <property name="can-focus">True</property>
+                <property name="can-default">True</property>
+                <property name="has-default">True</property>
+                <property name="receives-default">True</property>
                 <property name="use-underline">True</property>
               </object>
               <packing>
@@ -40,8 +40,8 @@
               <object class="GtkButton" id="cancel">
                 <property name="label" translatable="yes" 
context="stock">_Cancel</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">True</property>
                 <property name="use-underline">True</property>
               </object>
               <packing>
@@ -54,8 +54,8 @@
               <object class="GtkButton" id="help">
                 <property name="label" translatable="yes" 
context="stock">_Help</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">True</property>
                 <property name="use-underline">True</property>
               </object>
               <packing>
@@ -69,46 +69,46 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="pack_type">end</property>
+            <property name="pack-type">end</property>
             <property name="position">0</property>
           </packing>
         </child>
         <child>
           <object class="GtkBox" id="box1">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="orientation">vertical</property>
             <property name="spacing">12</property>
             <child>
               <object class="GtkFrame" id="frame1">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="hexpand">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
+                <property name="label-xalign">0</property>
+                <property name="shadow-type">none</property>
                 <child>
-                  <!-- n-columns=1 n-rows=1 -->
+                  <!-- n-columns=1 n-rows=2 -->
                   <object class="GtkGrid" id="grid1">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
+                    <property name="can-focus">False</property>
                     <property name="margin-start">12</property>
                     <property name="margin-top">6</property>
+                    <property name="row-spacing">6</property>
                     <child>
-                      <!-- n-columns=1 n-rows=1 -->
+                      <!-- n-columns=4 n-rows=2 -->
                       <object class="GtkGrid" id="grid2">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="row_spacing">6</property>
-                        <property name="column_spacing">12</property>
+                        <property name="can-focus">False</property>
+                        <property name="row-spacing">6</property>
+                        <property name="column-spacing">12</property>
                         <child>
                           <object class="GtkCheckButton" id="savesenddocs">
                             <property name="label" translatable="yes" 
context="securityoptionsdialog|savesenddocs">_When saving or sending</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="can-focus">True</property>
+                            <property name="receives-default">False</property>
+                            <property name="use-underline">True</property>
+                            <property name="draw-indicator">True</property>
                             <child internal-child="accessible">
                               <object class="AtkObject" 
id="savesenddocs-atkobject">
                                 <property 
name="AtkObject::accessible-description" translatable="yes" 
context="extended_tip|savesenddocs">Select to see a warning dialog when you try 
to save or send a document that contains recorded changes, versions, or 
comments.</property>
@@ -116,18 +116,18 @@
                             </child>
                           </object>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">0</property>
+                            <property name="left-attach">1</property>
+                            <property name="top-attach">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkCheckButton" id="whensigning">
                             <property name="label" translatable="yes" 
context="securityoptionsdialog|whensigning">When _signing</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="can-focus">True</property>
+                            <property name="receives-default">False</property>
+                            <property name="use-underline">True</property>
+                            <property name="draw-indicator">True</property>
                             <child internal-child="accessible">
                               <object class="AtkObject" 
id="whensigning-atkobject">
                                 <property 
name="AtkObject::accessible-description" translatable="yes" 
context="extended_tip|whensigning">Select to see a warning dialog when you try 
to sign a document that contains recorded changes, versions, fields, references 
to other sources (for example linked sections or linked pictures), or 
comments.</property>
@@ -135,18 +135,18 @@
                             </child>
                           </object>
                           <packing>
-                            <property name="left_attach">3</property>
-                            <property name="top_attach">0</property>
+                            <property name="left-attach">3</property>
+                            <property name="top-attach">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkCheckButton" id="whenprinting">
                             <property name="label" translatable="yes" 
context="securityoptionsdialog|whenprinting">When _printing</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="can-focus">True</property>
+                            <property name="receives-default">False</property>
+                            <property name="use-underline">True</property>
+                            <property name="draw-indicator">True</property>
                             <child internal-child="accessible">
                               <object class="AtkObject" 
id="whenprinting-atkobject">
                                 <property 
name="AtkObject::accessible-description" translatable="yes" 
context="extended_tip|whenprinting">Select to see a warning dialog when you try 
to print a document that contains recorded changes or comments.</property>
@@ -154,18 +154,18 @@
                             </child>
                           </object>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">1</property>
+                            <property name="left-attach">1</property>
+                            <property name="top-attach">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkCheckButton" id="whenpdf">
                             <property name="label" translatable="yes" 
context="securityoptionsdialog|whenpdf">When creating PDF _files</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="can-focus">True</property>
+                            <property name="receives-default">False</property>
+                            <property name="use-underline">True</property>
+                            <property name="draw-indicator">True</property>
                             <child internal-child="accessible">
                               <object class="AtkObject" id="whenpdf-atkobject">
                                 <property 
name="AtkObject::accessible-description" translatable="yes" 
context="extended_tip|whenpdf">Select to see a warning dialog when you try to 
export a document to PDF format that displays recorded changes in Writer, or 
that displays comments.</property>
@@ -173,79 +173,79 @@
                             </child>
                           </object>
                           <packing>
-                            <property name="left_attach">3</property>
-                            <property name="top_attach">1</property>
+                            <property name="left-attach">3</property>
+                            <property name="top-attach">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkImage" id="lockwhenprinting">
-                            <property name="can_focus">False</property>
-                            <property name="no_show_all">True</property>
+                            <property name="can-focus">False</property>
+                            <property name="no-show-all">True</property>
                             <property name="halign">center</property>
                             <property name="valign">center</property>
-                            <property name="icon_name">res/lock.png</property>
+                            <property name="icon-name">res/lock.png</property>
                           </object>
                           <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
+                            <property name="left-attach">0</property>
+                            <property name="top-attach">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkImage" id="locksavesenddocs">
-                            <property name="can_focus">False</property>
-                            <property name="no_show_all">True</property>
+                            <property name="can-focus">False</property>
+                            <property name="no-show-all">True</property>
                             <property name="halign">center</property>
                             <property name="valign">center</property>
-                            <property name="icon_name">res/lock.png</property>
+                            <property name="icon-name">res/lock.png</property>
                           </object>
                           <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
+                            <property name="left-attach">0</property>
+                            <property name="top-attach">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkImage" id="lockwhensigning">
-                            <property name="can_focus">False</property>
-                            <property name="no_show_all">True</property>
+                            <property name="can-focus">False</property>
+                            <property name="no-show-all">True</property>
                             <property name="halign">center</property>
                             <property name="valign">center</property>
-                            <property name="icon_name">res/lock.png</property>
+                            <property name="icon-name">res/lock.png</property>
                           </object>
                           <packing>
-                            <property name="left_attach">2</property>
-                            <property name="top_attach">0</property>
+                            <property name="left-attach">2</property>
+                            <property name="top-attach">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkImage" id="lockwhenpdf">
-                            <property name="can_focus">False</property>
-                            <property name="no_show_all">True</property>
+                            <property name="can-focus">False</property>
+                            <property name="no-show-all">True</property>
                             <property name="halign">center</property>
                             <property name="valign">center</property>
-                            <property name="icon_name">res/lock.png</property>
+                            <property name="icon-name">res/lock.png</property>
                           </object>
                           <packing>
-                            <property name="left_attach">2</property>
-                            <property name="top_attach">1</property>
+                            <property name="left-attach">2</property>
+                            <property name="top-attach">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label3">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can-focus">False</property>
                         <property name="hexpand">True</property>
                         <property name="label" translatable="yes" 
context="securityoptionsdialog|label3">Warn if document contains recorded 
changes, versions, hidden information or notes:</property>
                         <property name="xalign">0</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">0</property>
                       </packing>
                     </child>
                   </object>
@@ -253,7 +253,7 @@
                 <child type="label">
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="label" translatable="yes" 
context="securityoptionsdialog|label1">Security Warnings</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -270,28 +270,28 @@
             <child>
               <object class="GtkFrame" id="frame2">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="hexpand">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
+                <property name="label-xalign">0</property>
+                <property name="shadow-type">none</property>
                 <child>
-                  <!-- n-columns=1 n-rows=1 -->
+                  <!-- n-columns=2 n-rows=8 -->
                   <object class="GtkGrid" id="grid3">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">12</property>
+                    <property name="can-focus">False</property>
                     <property name="margin-start">12</property>
                     <property name="margin-top">6</property>
+                    <property name="row-spacing">6</property>
+                    <property name="column-spacing">12</property>
                     <child>
                       <object class="GtkCheckButton" id="removepersonal">
                         <property name="label" translatable="yes" 
context="securityoptionsdialog|removepersonal">_Remove personal information on 
saving</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
                         <property name="hexpand">True</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
                         <child internal-child="accessible">
                           <object class="AtkObject" 
id="removepersonal-atkobject">
                             <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|removepersonal">Select to always 
remove user data from the file properties. If this option is not selected, you 
can still remove the personal information for the current document with the 
Reset Properties button on File - Properties - General.</property>
@@ -299,39 +299,64 @@
                         </child>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="password">
-                        <property name="label" translatable="yes" 
context="securityoptionsdialog|password">Recommend password protection on 
sa_ving</property>
+                      <object class="GtkImage" id="lockremovepersonal">
+                        <property name="can-focus">False</property>
+                        <property name="no-show-all">True</property>
+                        <property name="halign">center</property>
+                        <property name="valign">center</property>
+                        <property name="icon-name">res/lock.png</property>
+                      </object>
+                      <packing>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="blockuntrusted">
+                        <property name="label" translatable="yes" 
context="securityoptionsdialog|blockuntrusted">Block any links from documents 
not among the trusted locations (see Macro Security)</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
                         <property name="hexpand">True</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
                         <child internal-child="accessible">
-                          <object class="AtkObject" id="password-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|password">Select to always enable the 
Save with password option in the file save dialogs. Deselect the option to save 
files by default without password.</property>
+                          <object class="AtkObject" 
id="blockuntrusted-atkobject">
+                            <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|blockuntrusted">Blocks the use of 
linked images by documents not in the trusted locations defined on the Trusted 
Sources tab of the Macro Security dialog.</property>
                           </object>
                         </child>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">7</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkImage" id="lockblockuntrusted">
+                        <property name="can-focus">False</property>
+                        <property name="halign">center</property>
+                        <property name="valign">center</property>
+                        <property name="icon-name">res/lock.png</property>
+                      </object>
+                      <packing>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">7</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkCheckButton" id="ctrlclick">
                         <property name="label" translatable="yes" 
context="securityoptionsdialog|ctrlclick">Ctrl-click required _to open 
hyperlinks</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
                         <property name="hexpand">True</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
                         <child internal-child="accessible">
                           <object class="AtkObject" id="ctrlclick-atkobject">
                             <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|ctrlclick">If enabled, you must hold 
down the Ctrl key while clicking a hyperlink to follow that link. If not 
enabled, a click opens the hyperlink.</property>
@@ -339,77 +364,172 @@
                         </child>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">2</property>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">6</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="blockuntrusted">
-                        <property name="label" translatable="yes" 
context="securityoptionsdialog|blockuntrusted">Block any links from documents 
not among the trusted locations (see Macro Security)</property>
+                      <object class="GtkImage" id="lockctrlclick">
+                        <property name="can-focus">False</property>
+                        <property name="halign">center</property>
+                        <property name="valign">center</property>
+                        <property name="icon-name">res/lock.png</property>
+                      </object>
+                      <packing>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">6</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="password">
+                        <property name="label" translatable="yes" 
context="securityoptionsdialog|password">Recommend password protection on 
sa_ving</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
                         <property name="hexpand">True</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
                         <child internal-child="accessible">
-                          <object class="AtkObject" 
id="blockuntrusted-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|blockuntrusted">Blocks the use of 
linked images by documents not in the trusted locations defined on the Trusted 
Sources tab of the Macro Security dialog.</property>
+                          <object class="AtkObject" id="password-atkobject">
+                            <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|password">Select to always enable the 
Save with password option in the file save dialogs. Deselect the option to save 
files by default without password.</property>
                           </object>
                         </child>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">3</property>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">5</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkImage" id="lockremovepersonal">
-                        <property name="can_focus">False</property>
-                        <property name="no_show_all">True</property>
+                      <object class="GtkImage" id="lockpassword">
+                        <property name="can-focus">False</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
-                        <property name="icon_name">res/lock.png</property>
+                        <property name="icon-name">res/lock.png</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">5</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkImage" id="lockpassword">
-                        <property name="can_focus">False</property>
+                      <object class="GtkCheckButton" id="redlineinfo">
+                        <property name="label" translatable="yes" 
context="securityoptionsdialog|redlineinfo">Keep track changes 
information</property>
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="margin-start">20</property>
+                        <property name="hexpand">True</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="docproperties">
+                        <property name="label" translatable="yes" 
context="securityoptionsdialog|docproperties">Keep document user 
informations</property>
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="margin-start">20</property>
+                        <property name="hexpand">True</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="noteauthor">
+                        <property name="label" translatable="yes" 
context="securityoptionsdialog|noteauthor">Keep author name and date of 
notes</property>
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="margin-start">20</property>
+                        <property name="hexpand">True</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="documentversion">
+                        <property name="label" translatable="yes" 
context="securityoptionsdialog|documentversion">Keep document version 
information</property>
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="margin-start">20</property>
+                        <property name="hexpand">True</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkImage" id="lockredlineinfo">
+                        <property name="can-focus">False</property>
+                        <property name="no-show-all">True</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
-                        <property name="icon_name">res/lock.png</property>
+                        <property name="margin-start">20</property>
+                        <property name="icon-name">res/lock.png</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">1</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkImage" id="lockctrlclick">
-                        <property name="can_focus">False</property>
+                      <object class="GtkImage" id="lockdocproperties">
+                        <property name="can-focus">False</property>
+                        <property name="no-show-all">True</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
-                        <property name="icon_name">res/lock.png</property>
+                        <property name="margin-start">20</property>
+                        <property name="icon-name">res/lock.png</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">2</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">2</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkImage" id="lockblockuntrusted">
-                        <property name="can_focus">False</property>
+                      <object class="GtkImage" id="locknoteauthor">
+                        <property name="can-focus">False</property>
+                        <property name="no-show-all">True</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
-                        <property name="icon_name">res/lock.png</property>
+                        <property name="margin-start">20</property>
+                        <property name="icon-name">res/lock.png</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">3</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkImage" id="lockdocumentversion">
+                        <property name="can-focus">False</property>
+                        <property name="no-show-all">True</property>
+                        <property name="halign">center</property>
+                        <property name="valign">center</property>
+                        <property name="margin-start">20</property>
+                        <property name="icon-name">res/lock.png</property>
+                      </object>
+                      <packing>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">4</property>
                       </packing>
                     </child>
                   </object>
@@ -417,7 +537,7 @@
                 <child type="label">
                   <object class="GtkLabel" id="label2">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="label" translatable="yes" 
context="securityoptionsdialog|label2">Security Options</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -431,6 +551,9 @@
                 <property name="position">1</property>
               </packing>
             </child>
+            <child>
+              <placeholder/>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -445,9 +568,6 @@
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
-    <child type="titlebar">
-      <placeholder/>
-    </child>
     <child internal-child="accessible">
       <object class="AtkObject" id="SecurityOptionsDialog-atkobject">
         <property name="AtkObject::accessible-description" translatable="yes" 
context="extended_tip|SecurityOptionsDialog">Set security related options and 
warnings about hidden information in documents.</property>
diff --git a/include/unotools/securityoptions.hxx 
b/include/unotools/securityoptions.hxx
index 0cae239c11cb..937d57b15c4a 100644
--- a/include/unotools/securityoptions.hxx
+++ b/include/unotools/securityoptions.hxx
@@ -41,6 +41,10 @@ namespace SvtSecurityOptions
         DocWarnPrint,
         DocWarnCreatePdf,
         DocWarnRemovePersonalInfo,
+        DocWarnKeepRedlineInfo,
+        DocWarnKeepDocUserInfo,
+        DocWarnKeepNoteAuthorDateInfo,
+        DocWarnKeepDocVersionInfo,
         DocWarnRecommendPassword,
         MacroSecLevel,
         MacroTrustedAuthors,
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index ce95381a7f57..76eaa1a7d106 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2432,6 +2432,42 @@
           </info>
           <value>false</value>
         </prop>
+        <prop oor:name="KeepRedlineInfoOnSaving" oor:type="xs:boolean" 
oor:nillable="false">
+          <info>
+            <desc>
+              Specifies whether to keep track changed information on
+              saving if RemovePersonalInfoOnSaving is true.
+            </desc>
+          </info>
+          <value>false</value>
+        </prop>
+        <prop oor:name="KeepDocUserInfoOnSaving" oor:type="xs:boolean" 
oor:nillable="false">
+          <info>
+            <desc>
+              Specifies whether to keep document user information on
+              saving if RemovePersonalInfoOnSaving is true.
+            </desc>
+          </info>
+          <value>false</value>
+        </prop>
+        <prop oor:name="KeepNoteAuthorDateInfoOnSaving" oor:type="xs:boolean" 
oor:nillable="false">
+          <info>
+            <desc>
+              Specifies whether to keep note author and date information on
+              saving if RemovePersonalInfoOnSaving is true.
+            </desc>
+          </info>
+          <value>false</value>
+        </prop>
+        <prop oor:name="KeepDocVersionInfoOnSaving" oor:type="xs:boolean" 
oor:nillable="false">
+          <info>
+            <desc>
+              Specifies whether to keep document version information on
+              saving if RemovePersonalInfoOnSaving is true.
+            </desc>
+          </info>
+          <value>false</value>
+        </prop>
         <prop oor:name="RecommendPasswordProtection" oor:type="xs:boolean" 
oor:nillable="false">
           <info>
             <desc>Specifies whether to recommend password protection when 
saving
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index fb75f3fdffc3..a0e10b98ad11 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -209,7 +209,8 @@ void SfxObjectShell::UpdateDocInfoForSave()
 
     // clear user data if recommend (see 'Tools - Options - LibreOffice - 
Security')
     if ( SvtSecurityOptions::IsOptionSet(
-            SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) )
+            SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && 
!SvtSecurityOptions::IsOptionSet(
+                SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo))
     {
         xDocProps->resetUserData( OUString() );
     }
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 1964b473f2cc..2167cfca18ce 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -55,6 +55,7 @@
 #include <basic/sberrors.hxx>
 #include <unotools/moduleoptions.hxx>
 #include <unotools/saveopt.hxx>
+#include <unotools/securityoptions.hxx>
 #include <svtools/DocumentToGraphicRenderer.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/svapp.hxx>
@@ -926,6 +927,15 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
             // by default versions should be preserved always except in case 
of an explicit
             // SaveAs via GUI, so the flag must be set accordingly
             pImpl->bPreserveVersions = (nId == SID_SAVEDOC);
+
+            // do not save version infos --> (see 'Tools - Options - 
LibreOffice - Security')
+            if (SvtSecurityOptions::IsOptionSet(
+                SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo) && 
!SvtSecurityOptions::IsOptionSet(
+                    SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo))
+            {
+                pImpl->bPreserveVersions = false;
+            }
+
             try
             {
                 SfxErrorContext aEc( ERRCTX_SFX_SAVEASDOC, GetTitle() ); // ???
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 91e4bb9ff61a..abc3dd38723d 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2609,7 +2609,8 @@ bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs 
)
     }
 
     // copy version list from "old" medium to target medium, so it can be used 
on saving
-    pMediumTmp->TransferVersionList_Impl( *pRetrMedium );
+    if (pImpl->bPreserveVersions)
+        pMediumTmp->TransferVersionList_Impl( *pRetrMedium );
 
     // an interaction handler here can acquire only in case of GUI Saving
     // and should be removed after the saving is done
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8847573ebb80..dd0b7046dfdf 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2192,7 +2192,8 @@ void 
DocxAttributeOutput::DoWriteMoveRangeTagStart(std::u16string_view bookmarkN
     bool bFrom, const SwRedlineData* pRedlineData)
 {
     bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
-        SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo );
+        SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && 
!SvtSecurityOptions::IsOptionSet(
+            SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo);
 
     const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( 
pRedlineData->GetAuthor() ) );
     const DateTime aDateTime = pRedlineData->GetTimeStamp();
@@ -3985,7 +3986,8 @@ void DocxAttributeOutput::Redline( const SwRedlineData* 
pRedlineData)
         return;
 
     bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
-        SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo );
+        SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && 
!SvtSecurityOptions::IsOptionSet(
+            SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo);
 
     OString aId( OString::number( pRedlineData->GetSeqNo() ) );
     const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( 
pRedlineData->GetAuthor() ) );
@@ -4142,7 +4144,8 @@ void DocxAttributeOutput::StartRedline( const 
SwRedlineData * pRedlineData, bool
     OString aId( OString::number( m_nRedlineId++ ) );
 
     bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
-        SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo );
+        SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && 
!SvtSecurityOptions::IsOptionSet(
+            SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo);
 
     const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( 
pRedlineData->GetAuthor() ) );
     OString aAuthor( OUStringToOString( bRemovePersonalInfo
@@ -8294,7 +8297,8 @@ void DocxAttributeOutput::WritePostitFieldReference()
 DocxAttributeOutput::hasProperties DocxAttributeOutput::WritePostitFields()
 {
     bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
-        SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo );
+        SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && 
!SvtSecurityOptions::IsOptionSet(
+            SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo);
 
     hasProperties eResult = hasProperties::no;
     for (auto& [f1, data1] : m_postitFields)
diff --git a/sw/source/filter/ww8/docxtableexport.cxx 
b/sw/source/filter/ww8/docxtableexport.cxx
index b3e2d014222b..5972903ec599 100644
--- a/sw/source/filter/ww8/docxtableexport.cxx
+++ b/sw/source/filter/ww8/docxtableexport.cxx
@@ -628,7 +628,8 @@ void DocxAttributeOutput::TableRowRedline(
     const SwTableLine* pTabLine = pTabBox->GetUpper();
 
     bool bRemovePersonalInfo
-        = 
SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo);
+        = 
SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo)
+          && 
!SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo);
 
     // check table row property "HasTextChangesOnly"
     SwRedlineTable::size_type nPos(0);
@@ -703,7 +704,8 @@ void DocxAttributeOutput::TableCellRedline(
     const SwTableBox* pTabBox = pTableTextNodeInfoInner->getTableBox();
 
     bool bRemovePersonalInfo
-        = 
SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo);
+        = 
SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo)
+          && 
!SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo);
 
     // check table row property "HasTextChangesOnly"
     SwRedlineTable::size_type nChange = pTabBox->GetRedline();
diff --git a/unotools/source/config/securityoptions.cxx 
b/unotools/source/config/securityoptions.cxx
index 850bfeb77f9c..74b083e08cab 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -71,6 +71,18 @@ bool IsReadOnly( EOption eOption )
         case SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo:
             bReadonly = 
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::isReadOnly();
             break;
+        case SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo:
+            bReadonly = 
officecfg::Office::Common::Security::Scripting::KeepRedlineInfoOnSaving::isReadOnly();
+            break;
+        case SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo:
+            bReadonly = 
officecfg::Office::Common::Security::Scripting::KeepDocUserInfoOnSaving::isReadOnly();
+            break;
+        case SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo:
+            bReadonly = 
officecfg::Office::Common::Security::Scripting::KeepNoteAuthorDateInfoOnSaving::isReadOnly();
+            break;
+        case SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo:
+            bReadonly = 
officecfg::Office::Common::Security::Scripting::KeepDocVersionInfoOnSaving::isReadOnly();
+            break;
         case SvtSecurityOptions::EOption::DocWarnRecommendPassword:
             bReadonly = 
officecfg::Office::Common::Security::Scripting::RecommendPasswordProtection::isReadOnly();
             break;
@@ -301,6 +313,18 @@ bool IsOptionSet( EOption eOption )
         case SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo:
             bSet = 
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::get();
             break;
+        case SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo:
+            bSet = 
officecfg::Office::Common::Security::Scripting::KeepRedlineInfoOnSaving::get();
+            break;
+        case SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo:
+            bSet = 
officecfg::Office::Common::Security::Scripting::KeepDocUserInfoOnSaving::get();
+            break;
+        case SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo:
+            bSet = 
officecfg::Office::Common::Security::Scripting::KeepNoteAuthorDateInfoOnSaving::get();
+            break;
+        case SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo:
+            bSet = 
officecfg::Office::Common::Security::Scripting::KeepDocVersionInfoOnSaving::get();
+            break;
         case SvtSecurityOptions::EOption::DocWarnRecommendPassword:
             bSet = 
officecfg::Office::Common::Security::Scripting::RecommendPasswordProtection::get();
             break;
@@ -338,6 +362,18 @@ void SetOption( EOption eOption, bool bValue )
         case SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo:
              
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(bValue,
 xChanges);
             break;
+        case SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo:
+             
officecfg::Office::Common::Security::Scripting::KeepRedlineInfoOnSaving::set(bValue,
 xChanges);
+            break;
+        case SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo:
+             
officecfg::Office::Common::Security::Scripting::KeepDocUserInfoOnSaving::set(bValue,
 xChanges);
+            break;
+        case SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo:
+             
officecfg::Office::Common::Security::Scripting::KeepNoteAuthorDateInfoOnSaving::set(bValue,
 xChanges);
+            break;
+        case SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo:
+             
officecfg::Office::Common::Security::Scripting::KeepDocVersionInfoOnSaving::set(bValue,
 xChanges);
+            break;
         case SvtSecurityOptions::EOption::DocWarnRecommendPassword:
              
officecfg::Office::Common::Security::Scripting::RecommendPasswordProtection::set(bValue,
 xChanges);
             break;
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 6df6ade09d61..761bbdfc6378 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2587,7 +2587,8 @@ void SdXMLExport::exportAnnotations( const 
Reference<XDrawPage>& xDrawPage )
         if( xAnnotationEnumeration.is() && 
xAnnotationEnumeration->hasMoreElements() )
         {
             bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
-                SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo );
+                SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && 
!SvtSecurityOptions::IsOptionSet(
+                    
SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo);
 
             OUStringBuffer sStringBuffer;
             do
diff --git a/xmloff/source/text/XMLRedlineExport.cxx 
b/xmloff/source/text/XMLRedlineExport.cxx
index aa9b364fedb4..81cda828b43f 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -436,7 +436,8 @@ void XMLRedlineExport::ExportChangeInfo(
     const Reference<XPropertySet> & rPropSet)
 {
     bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
-            SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo );
+            SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && 
!SvtSecurityOptions::IsOptionSet(
+                SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo);
 
     SvXMLElementExport aChangeInfo(rExport, XML_NAMESPACE_OFFICE,
                                    XML_CHANGE_INFO, true, true);
@@ -480,7 +481,8 @@ void XMLRedlineExport::ExportChangeInfo(
 {
     OUString sComment;
     bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
-            SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo );
+            SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && 
!SvtSecurityOptions::IsOptionSet(
+                SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo);
 
     SvXMLElementExport aChangeInfo(rExport, XML_NAMESPACE_OFFICE,
                                    XML_CHANGE_INFO, true, true);
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index a6a0936423d8..24be429e87fd 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1719,7 +1719,8 @@ void XMLTextFieldExport::ExportFieldHelper(
                    "Unexpected presentation for annotation field");
 
         bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
-            SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo );
+            SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && 
!SvtSecurityOptions::IsOptionSet(
+                SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo);
 
         // annotation element + content
         OUString aName;

Reply via email to