summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorEilidh McAdam <eilidh.mcadam@itomig.de>2014-12-09 19:53:56 +0000
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-19 16:56:58 +0000
commita072b3533f44730565f42b45cfd9f77f44f506a9 (patch)
tree703c71c4d2e9ad8a33defa168d0e5daf16146f92 /sw
parentc3e32b0fd7fecbacd05786de2cd8a3bff97ce2b6 (diff)
fdo#59886 export fixed date and time fields to docx.
Fixed date and time fields are supported in OOXML by adding the attribute fldLock="true" to the fldChar element. This applies only to the first instance of fldChar in a field (i.e. when fldCharType is "begin"). Change-Id: Ibb84503b942ca20b53fe476e5006d64b2f3112e5 Reviewed-on: https://gerrit.libreoffice.org/13429 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx16
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx2
2 files changed, 14 insertions, 4 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4386d5b64b3e..87c193b7ada4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1443,9 +1443,19 @@ void DocxAttributeOutput::StartField_Impl( FieldInfos& rInfos, bool bWriteRun )
else
{
// Write the field start
- m_pSerializer->startElementNS( XML_w, XML_fldChar,
- FSNS( XML_w, XML_fldCharType ), "begin",
- FSEND );
+ if ( rInfos.pField && rInfos.pField->GetSubType() & FIXEDFLD )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_fldChar,
+ FSNS( XML_w, XML_fldCharType ), "begin",
+ FSNS( XML_w, XML_fldLock ), "true",
+ FSEND );
+ }
+ else
+ {
+ m_pSerializer->startElementNS( XML_w, XML_fldChar,
+ FSNS( XML_w, XML_fldCharType ), "begin",
+ FSEND );
+ }
if ( rInfos.pFieldmark )
WriteFFData( rInfos );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 4b7907f29fd1..be73977dbffc 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2861,7 +2861,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField )
case RES_DATETIMEFLD:
{
OUString sStr;
- if (FIXEDFLD & nSubType || !GetExport().GetNumberFmt(*pFld, sStr))
+ if (!GetExport().GetNumberFmt(*pFld, sStr))
bWriteExpand = true;
else
{