tdf#166379 - Add export config option to remove "Total editing time"
separately from all private info files during save. The new expert config option name is: RemoveEditingTimeOnSaving (There wasn't any UI element added for this expert config option.) Change-Id: Iab69d062d161ef6aee1c3eb87ada1c16f8b4fd41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184789 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
This commit is contained in:
parent
4c14003542
commit
e275a6e6a0
@ -40,6 +40,7 @@ namespace SvtSecurityOptions
|
|||||||
DocWarnSigning,
|
DocWarnSigning,
|
||||||
DocWarnPrint,
|
DocWarnPrint,
|
||||||
DocWarnCreatePdf,
|
DocWarnCreatePdf,
|
||||||
|
DocWarnRemoveEditingTimeInfo,
|
||||||
DocWarnRemovePersonalInfo,
|
DocWarnRemovePersonalInfo,
|
||||||
DocWarnKeepRedlineInfo,
|
DocWarnKeepRedlineInfo,
|
||||||
DocWarnKeepDocUserInfo,
|
DocWarnKeepDocUserInfo,
|
||||||
|
@ -2436,6 +2436,12 @@
|
|||||||
</info>
|
</info>
|
||||||
<value>false</value>
|
<value>false</value>
|
||||||
</prop>
|
</prop>
|
||||||
|
<prop oor:name="RemoveEditingTimeOnSaving" oor:type="xs:boolean" oor:nillable="false">
|
||||||
|
<info>
|
||||||
|
<desc>Specifies whether to remove editing duration on saving.</desc>
|
||||||
|
</info>
|
||||||
|
<value>false</value>
|
||||||
|
</prop>
|
||||||
<prop oor:name="RemovePersonalInfoOnSaving" oor:type="xs:boolean" oor:nillable="false">
|
<prop oor:name="RemovePersonalInfoOnSaving" oor:type="xs:boolean" oor:nillable="false">
|
||||||
<info>
|
<info>
|
||||||
<desc>Specifies whether to remove personal information on
|
<desc>Specifies whether to remove personal information on
|
||||||
|
@ -770,7 +770,7 @@ writeAppProperties( XmlFilterBase& rSelf, const Reference< XDocumentProperties >
|
|||||||
writeElement( pAppProps, XML_Notes, "notes" );
|
writeElement( pAppProps, XML_Notes, "notes" );
|
||||||
#endif /* def OOXTODO */
|
#endif /* def OOXTODO */
|
||||||
// EditingDuration is in seconds, TotalTime is in minutes.
|
// EditingDuration is in seconds, TotalTime is in minutes.
|
||||||
if (!bRemovePersonalInfo)
|
if (!bRemovePersonalInfo && !SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemoveEditingTimeInfo))
|
||||||
writeElement(pAppProps, XML_TotalTime, xProperties->getEditingDuration() / 60);
|
writeElement(pAppProps, XML_TotalTime, xProperties->getEditingDuration() / 60);
|
||||||
#ifdef OOXTODO
|
#ifdef OOXTODO
|
||||||
writeElement( pAppProps, XML_HiddenSlides, "hidden slides" );
|
writeElement( pAppProps, XML_HiddenSlides, "hidden slides" );
|
||||||
|
@ -236,8 +236,18 @@ void SfxObjectShell::UpdateDocInfoForSave()
|
|||||||
::DateTime now( ::DateTime::SYSTEM );
|
::DateTime now( ::DateTime::SYSTEM );
|
||||||
xDocProps->setModificationDate( now.GetUNODateTime() );
|
xDocProps->setModificationDate( now.GetUNODateTime() );
|
||||||
xDocProps->setModifiedBy( aUserName );
|
xDocProps->setModifiedBy( aUserName );
|
||||||
|
if (!SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemoveEditingTimeInfo))
|
||||||
UpdateTime_Impl( xDocProps );
|
UpdateTime_Impl( xDocProps );
|
||||||
}
|
}
|
||||||
|
// reset only editing time to zero if RemoveEditingTimeOnSaving is true
|
||||||
|
if (SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemoveEditingTimeInfo))
|
||||||
|
xDocProps->setEditingDuration(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// reset only editing time to zero if RemoveEditingTimeOnSaving is true
|
||||||
|
if (SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemoveEditingTimeInfo))
|
||||||
|
xDocProps->setEditingDuration(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +129,33 @@ CPPUNIT_TEST_FIXTURE(Test, testPersonalMetaData)
|
|||||||
"/office:document-settings/office:settings/config:config-item-set[2]/"
|
"/office:document-settings/office:settings/config:config-item-set[2]/"
|
||||||
"config:config-item[@config:name='PrinterSetup']",
|
"config:config-item[@config:name='PrinterSetup']",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
// Reset config change
|
||||||
|
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(false, pBatch);
|
||||||
|
pBatch->commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
CPPUNIT_TEST_FIXTURE(Test, testRemoveOnlyEditTimeMetaData)
|
||||||
|
{
|
||||||
|
// 1. Check we have the original edit time info
|
||||||
|
loadAndSave("personalmetadata.odt");
|
||||||
|
xmlDocUniquePtr pXmlDoc = parseExport(u"meta.xml"_ustr);
|
||||||
|
assertXPathContent(pXmlDoc, "/office:document-meta/office:meta/meta:editing-duration",
|
||||||
|
u"PT21M22S");
|
||||||
|
|
||||||
|
// Set config RemoveEditingTimeOnSaving to true
|
||||||
|
auto pBatch(comphelper::ConfigurationChanges::create());
|
||||||
|
officecfg::Office::Common::Security::Scripting::RemoveEditingTimeOnSaving::set(true, pBatch);
|
||||||
|
pBatch->commit();
|
||||||
|
|
||||||
|
// 2. Check edit time info is 0
|
||||||
|
loadAndSave("personalmetadata.odt");
|
||||||
|
pXmlDoc = parseExport(u"meta.xml"_ustr);
|
||||||
|
assertXPathContent(pXmlDoc, "/office:document-meta/office:meta/meta:editing-duration", u"P0D");
|
||||||
|
|
||||||
|
// Reset config change
|
||||||
|
officecfg::Office::Common::Security::Scripting::RemoveEditingTimeOnSaving::set(false, pBatch);
|
||||||
|
pBatch->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
CPPUNIT_TEST_FIXTURE(Test, tdf151100)
|
CPPUNIT_TEST_FIXTURE(Test, tdf151100)
|
||||||
|
@ -810,6 +810,33 @@ CPPUNIT_TEST_FIXTURE(Test, testPersonalMetaData)
|
|||||||
assertXPath(pCoreDoc, "/cp:coreProperties/cp:lastModifiedBy", 1);
|
assertXPath(pCoreDoc, "/cp:coreProperties/cp:lastModifiedBy", 1);
|
||||||
assertXPath(pCoreDoc, "/cp:coreProperties/cp:lastPrinted", 1);
|
assertXPath(pCoreDoc, "/cp:coreProperties/cp:lastPrinted", 1);
|
||||||
assertXPath(pCoreDoc, "/cp:coreProperties/cp:revision", 0);
|
assertXPath(pCoreDoc, "/cp:coreProperties/cp:revision", 0);
|
||||||
|
|
||||||
|
// Reset config change
|
||||||
|
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(false, pBatch);
|
||||||
|
officecfg::Office::Common::Security::Scripting::KeepDocUserInfoOnSaving::set(false, pBatch);
|
||||||
|
pBatch->commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
CPPUNIT_TEST_FIXTURE(Test, testRemoveOnlyEditTimeMetaData)
|
||||||
|
{
|
||||||
|
// 1. Check we have the original edit time info
|
||||||
|
loadAndSave("personalmetadata.docx");
|
||||||
|
xmlDocUniquePtr pAppDoc = parseExport(u"docProps/app.xml"_ustr);
|
||||||
|
assertXPath(pAppDoc, "/extended-properties:Properties/extended-properties:TotalTime", 1);
|
||||||
|
|
||||||
|
// Set config RemoveEditingTimeOnSaving to true
|
||||||
|
auto pBatch(comphelper::ConfigurationChanges::create());
|
||||||
|
officecfg::Office::Common::Security::Scripting::RemoveEditingTimeOnSaving::set(true, pBatch);
|
||||||
|
pBatch->commit();
|
||||||
|
|
||||||
|
// 2. Check edit time info is removed
|
||||||
|
loadAndSave("personalmetadata.docx");
|
||||||
|
pAppDoc = parseExport(u"docProps/app.xml"_ustr);
|
||||||
|
assertXPath(pAppDoc, "/extended-properties:Properties/extended-properties:TotalTime", 0);
|
||||||
|
|
||||||
|
// Reset config change
|
||||||
|
officecfg::Office::Common::Security::Scripting::RemoveEditingTimeOnSaving::set(false, pBatch);
|
||||||
|
pBatch->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_OOXMLEXPORT_TEST(testTdf126533_noPageBitmap, "tdf126533_noPageBitmap.docx")
|
DECLARE_OOXMLEXPORT_TEST(testTdf126533_noPageBitmap, "tdf126533_noPageBitmap.docx")
|
||||||
|
@ -317,6 +317,9 @@ bool IsOptionSet( EOption eOption )
|
|||||||
case SvtSecurityOptions::EOption::DocWarnCreatePdf:
|
case SvtSecurityOptions::EOption::DocWarnCreatePdf:
|
||||||
bSet = officecfg::Office::Common::Security::Scripting::WarnCreatePDF::get();
|
bSet = officecfg::Office::Common::Security::Scripting::WarnCreatePDF::get();
|
||||||
break;
|
break;
|
||||||
|
case SvtSecurityOptions::EOption::DocWarnRemoveEditingTimeInfo:
|
||||||
|
bSet = officecfg::Office::Common::Security::Scripting::RemoveEditingTimeOnSaving::get();
|
||||||
|
break;
|
||||||
case SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo:
|
case SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo:
|
||||||
bSet = officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::get();
|
bSet = officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::get();
|
||||||
break;
|
break;
|
||||||
@ -373,6 +376,9 @@ void SetOption( EOption eOption, bool bValue )
|
|||||||
case SvtSecurityOptions::EOption::DocWarnCreatePdf:
|
case SvtSecurityOptions::EOption::DocWarnCreatePdf:
|
||||||
officecfg::Office::Common::Security::Scripting::WarnCreatePDF::set(bValue, xChanges);
|
officecfg::Office::Common::Security::Scripting::WarnCreatePDF::set(bValue, xChanges);
|
||||||
break;
|
break;
|
||||||
|
case SvtSecurityOptions::EOption::DocWarnRemoveEditingTimeInfo:
|
||||||
|
officecfg::Office::Common::Security::Scripting::RemoveEditingTimeOnSaving::set(bValue, xChanges);
|
||||||
|
break;
|
||||||
case SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo:
|
case SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo:
|
||||||
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(bValue, xChanges);
|
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(bValue, xChanges);
|
||||||
break;
|
break;
|
||||||
|
@ -162,7 +162,7 @@ void SvXMLMetaExport::MExport_()
|
|||||||
|
|
||||||
// editing duration
|
// editing duration
|
||||||
// property is a int32 (seconds)
|
// property is a int32 (seconds)
|
||||||
if (!bRemovePersonalInfo)
|
if (!bRemovePersonalInfo && !SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemoveEditingTimeInfo))
|
||||||
{
|
{
|
||||||
sal_Int32 secs = mxDocProps->getEditingDuration();
|
sal_Int32 secs = mxDocProps->getEditingDuration();
|
||||||
SvXMLElementExport aElem( mrExport,
|
SvXMLElementExport aElem( mrExport,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user