diff options
author | László Németh <nemeth@numbertext.org> | 2021-06-18 13:03:17 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-07-03 12:54:39 +0200 |
commit | ded2452a52d21131347a0dc2e25c8161f20fcfad (patch) | |
tree | ab5aa76d91aaffdb0de9e302e8789c91e44f4783 /xmloff | |
parent | 56ae948b08010ed1b61be9857c8c6ae4e97e86b2 (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')
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.cxx | 18 |
2 files changed, 14 insertions, 12 deletions
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index db1542fc511f..cdc6a70e31dd 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2580,12 +2580,12 @@ void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) { // date time - css::util::DateTime aDate( xAnnotation->getDateTime() ); + css::util::DateTime aDate( bRemovePersonalInfo + ? css::util::DateTime(0, 0, 0, 0, 1, 1, 1970, true) // Epoch time + : xAnnotation->getDateTime() ); ::sax::Converter::convertDateTime(sStringBuffer, aDate, nullptr, true); SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, true, false ); - Characters( bRemovePersonalInfo - ? "1970-01-01T00:00::00" - : sStringBuffer.makeStringAndClear() ); + Characters( sStringBuffer.makeStringAndClear() ); } css::uno::Reference < css::text::XText > xText( xAnnotation->getTextRange() ); 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" ) { |