summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPallavi Jadhav <pallavi.jadhav@synerzip.com>2014-07-31 10:48:59 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-08-01 13:32:20 +0200
commitb38b124b64b7a1f6529799552f6e89360edd8280 (patch)
tree44351d5a7ff7ed8e2e8461aff82afddfbaed209d
parent9a733398516b7ee08ad5b3887c75f11f0f6bbc27 (diff)
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
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo81341.docxbin0 -> 12678 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx17
-rw-r--r--sw/source/core/fields/docufld.cxx4
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx2
4 files changed, 22 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo81341.docx b/sw/qa/extras/ooxmlexport/data/fdo81341.docx
new file mode 100644
index 000000000000..3c243c0dd1b1
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo81341.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 0df24fbe756e..36ae02ba8a89 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -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();
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index d03730a45bae..c18cb0f8b1db 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -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
{
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index e831bf7d7098..78fe92eaa96e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -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;