sc/source/filter/xml/xmlexprt.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 87e1a77a9aadb883386816dc4ebc3dad64c81892
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Wed Oct 18 13:52:16 2023 +0200
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Thu Oct 19 14:16:09 2023 +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>

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 2ac992a20930..9acae7b1ec0d 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3714,16 +3714,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();

Reply via email to