summaryrefslogtreecommitdiff
path: root/xmloff/source/text
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-06-18 13:03:17 +0200
committerLászló Németh <nemeth@numbertext.org>2021-07-03 12:54:39 +0200
commitded2452a52d21131347a0dc2e25c8161f20fcfad (patch)
treeab5aa76d91aaffdb0de9e302e8789c91e44f4783 /xmloff/source/text
parent56ae948b08010ed1b61be9857c8c6ae4e97e86b2 (diff)
tdf#142902 DOCX export: remove personal info of comments and changes
If Options → LibreOffice → Security → Security Options and Warnings → Options... → Security Options → Remove personal information on saving" is enabled. Use the same time (Unix epoch) for mandatory time stamps, and replace authors with "Author1", "Author2", ... and creator-initials with "1", "2", "3" etc., also to avoid of joining adjacent redline ranges. Note: to see the work of the unit test in Linux command line: (cd sw && make UITest_writer_tests7 UITEST_TEST_NAME="tdf90401.tdf90401.test_tdf142902_remove_personal_info_in_DOCX" SAL_USE_VCLPLUGIN=gen) Follow-up to commit 12da70f88517bf3c053afe1c504bb70bd27573f2 "tdf#90401 xmloff: remove personal info of comments and changes". Change-Id: Ice996f171f5d82d13ce0ea2e4833696af0aab90c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117444 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'xmloff/source/text')
-rw-r--r--xmloff/source/text/XMLRedlineExport.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index fad527a77b59..aa457bf2ad98 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -43,6 +43,8 @@
#include <xmloff/xmlexp.hxx>
#include <xmloff/xmluconv.hxx>
#include <unotools/securityoptions.hxx>
+#include <tools/date.hxx>
+#include <tools/datetime.hxx>
using namespace ::com::sun::star;
@@ -459,13 +461,13 @@ void XMLRedlineExport::ExportChangeInfo(
aAny >>= aDateTime;
{
OUStringBuffer sBuf;
- ::sax::Converter::convertDateTime(sBuf, aDateTime, nullptr);
+ ::sax::Converter::convertDateTime(sBuf, bRemovePersonalInfo
+ ? util::DateTime(0, 0, 0, 0, 1, 1, 1970, true) // Epoch time
+ : aDateTime, nullptr);
SvXMLElementExport aDateElem( rExport, XML_NAMESPACE_DC,
XML_DATE, true,
false );
- rExport.Characters(bRemovePersonalInfo
- ? "1970-01-01T00:00:00"
- : sBuf.makeStringAndClear());
+ rExport.Characters(sBuf.makeStringAndClear());
}
// comment as <text:p> sequence
@@ -504,10 +506,10 @@ void XMLRedlineExport::ExportChangeInfo(
util::DateTime aDateTime;
rVal.Value >>= aDateTime;
OUStringBuffer sBuf;
- ::sax::Converter::convertDateTime(sBuf, aDateTime, nullptr);
- rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_CHG_DATE_TIME, bRemovePersonalInfo
- ? "1970-01-01T00:00:00"
- : sBuf.makeStringAndClear());
+ ::sax::Converter::convertDateTime(sBuf, bRemovePersonalInfo
+ ? util::DateTime(0, 0, 0, 0, 1, 1, 1970, true) // Epoch time
+ : aDateTime, nullptr);
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_CHG_DATE_TIME, sBuf.makeStringAndClear());
}
else if( rVal.Name == "RedlineType" )
{