[Libreoffice-commits] core.git: sw/source

Eilidh McAdam eilidh.mcadam at itomig.de
Fri Dec 19 08:57:20 PST 2014


 sw/source/filter/ww8/docxattributeoutput.cxx |   16 +++++++++++++---
 sw/source/filter/ww8/ww8atr.cxx              |    2 +-
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit a072b3533f44730565f42b45cfd9f77f44f506a9
Author: Eilidh McAdam <eilidh.mcadam at itomig.de>
Date:   Tue Dec 9 19:53:56 2014 +0000

    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 at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4386d5b..87c193b 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 4b7907f..be73977 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
             {


More information about the Libreoffice-commits mailing list