[Libreoffice-commits] core.git: sw/qa sw/source
Pallavi Jadhav
pallavi.jadhav at synerzip.com
Fri Aug 1 04:33:16 PDT 2014
sw/qa/extras/ooxmlexport/data/fdo81341.docx |binary
sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 17 +++++++++++++++++
sw/source/core/fields/docufld.cxx | 4 +++-
sw/source/filter/ww8/ww8atr.cxx | 2 ++
4 files changed, 22 insertions(+), 1 deletion(-)
New commits:
commit b38b124b64b7a1f6529799552f6e89360edd8280
Author: Pallavi Jadhav <pallavi.jadhav at synerzip.com>
Date: Thu Jul 31 10:48:59 2014 +0530
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
diff --git a/sw/qa/extras/ooxmlexport/data/fdo81341.docx b/sw/qa/extras/ooxmlexport/data/fdo81341.docx
new file mode 100644
index 0000000..3c243c0
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo81341.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 0df24fb..36ae02b 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 d03730a..c18cb0f 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 e831bf7..78fe92e 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;
More information about the Libreoffice-commits
mailing list