Kaydet (Commit) b38b124b authored tarafından Pallavi Jadhav's avatar Pallavi Jadhav Kaydeden (comit) Miklos Vajna

fdo#81341 : DOCX: EditTime is not geting preserved after RT

	Issue :
	- LO was not able to Import EditTime field in "HH:MM:SS" format.
	- LO was Importing it as "HH:MM" format.
	- In getTime() third parameter is passed as "false" which is bSec.
          Because of which LO was not able to Import EditTime in seconds.

	Implementation :
	- Added code to check value of Seconds > 0.
	- Added code at Export side to write "EDITTIME" field.
	- Added Unit test case at Export side.

Because of which LO was not able to Import EditTime in seconds.

Reviewed on:
	https://gerrit.libreoffice.org/10655

Change-Id: Ic740dc30d79be594dec9a0a05e407a7cb1a5941e
üst 9a733398
......@@ -565,6 +565,23 @@ DECLARE_OOXMLEXPORT_TEST(testFdo81492, "fdo81492.docx")
assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[5]/w:instrText", "ADDIN EN.CITE.DATA");
}
DECLARE_OOXMLEXPORT_TEST(testEditTime, "fdo81341.docx")
{
/* Issue was LO was not able to Import and Export EditTime in seconds format.
* It was supporting Time in "HH:MM" format. But if DOCX conatins Time in seconds,
* then LO was not able to display time in "HH:MM:SS" format.
* While exporting LO was writing plian text instead of field entry.
*/
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
{
//Ensure that EditTime is written inside w:fldChar in "HH:MM:SS" format.
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/w:fldChar", "fldCharType", "begin");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[3]/w:fldChar", "fldCharType", "separate");
assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[4]/w:t", "00:00:05");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[5]/w:fldChar", "fldCharType", "end");
}
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -898,8 +898,10 @@ OUString SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat,
{
lcl_GetLocalDataWrapper( nLang, &pAppLocalData, &pLocalData );
sal_Int32 dur = xDocProps->getEditingDuration();
// If Seconds > 0 then bSec should be TRUE otherwise Seconds
// information will be lost if file has EditTime in Seconds format.
aStr = pLocalData->getTime( Time(dur/3600, (dur%3600)/60, dur%60),
false, false);
(dur%60 > 0 ? true : false), false);
}
else
{
......
......@@ -2822,6 +2822,8 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField )
if( DI_SUB_AUTHOR != (nSubType & DI_SUB_MASK ) &&
GetExport().GetNumberFmt( *pFld, sStr ))
eFld = ww::eSAVEDATE;
else
eFld = ww::eEDITTIME;
break;
case DI_CUSTOM:
eFld = ww::eDOCPROPERTY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment