[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed Dec 28 12:52:20 PST 2011


 sw/source/filter/ww8/rtfattributeoutput.cxx |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 11b6fd520babd5b0f4fa7242377115f00b6c1c23
Author: Miklos Vajna <vmiklos at frugalware.org>
Date:   Wed Dec 28 21:43:22 2011 +0100

    fdo#35099 fix RTF export of date field
    
    (cherry picked from commit 4b0dd950b8b79df004238f372fe55993d5ac5981)

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 17b2de3..9ade064 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1398,14 +1398,19 @@ void RtfAttributeOutput::WriteField_Impl( const SwField* pFld, ww::eField /*eTyp
 {
     OSL_TRACE("%s", OSL_THIS_FUNC);
 
-    // NEEDSWORK this has beeen tested only with page numbers
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_FIELD);
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " ");
-    m_aRunText.append(m_rExport.OutString(rFldCmd, m_rExport.eCurrentEncoding));
-    m_aRunText.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
+    // If there are no field instructions, don't export it as a field.
+    bool bHasInstructions = rFldCmd.Len() > 0;
+    if (bHasInstructions)
+    {
+        m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_FIELD);
+        m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " ");
+        m_aRunText.append(m_rExport.OutString(rFldCmd, m_rExport.eCurrentEncoding));
+        m_aRunText.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
+    }
     if (pFld)
         m_aRunText.append(m_rExport.OutString(pFld->ExpandField(true), m_rExport.eDefaultEncoding));
-    m_aRunText.append("}}");
+    if (bHasInstructions)
+        m_aRunText.append("}}");
 }
 
 void RtfAttributeOutput::WriteBookmarks_Impl( std::vector< rtl::OUString >& rStarts, std::vector< rtl::OUString >& rEnds )
@@ -2933,9 +2938,11 @@ void RtfAttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDir
     }
 }
 
-void RtfAttributeOutput::WriteExpand( const SwField* /*pFld*/ )
+void RtfAttributeOutput::WriteExpand( const SwField* pFld )
 {
-    OSL_TRACE("TODO: %s", OSL_THIS_FUNC);
+    OSL_TRACE("%s", OSL_THIS_FUNC);
+    String sCmd;
+    m_rExport.OutputField(pFld, ww::eUNKNOWN, sCmd);
 }
 
 void RtfAttributeOutput::RefField( const SwField& /*rFld*/, const String& /*rRef*/ )


More information about the Libreoffice-commits mailing list