summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2011-12-28 21:43:22 +0100
committerMiklos Vajna <vmiklos@frugalware.org>2011-12-28 21:43:58 +0100
commit4b0dd950b8b79df004238f372fe55993d5ac5981 (patch)
tree40f379e208304b93a2c05f40b3989ebbfca04ba0
parentf10fc42189b3d3f6dd180234da9777e53e92b7e4 (diff)
fdo#35099 fix RTF export of date field
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 17b2de326cbf..9ade0642992a 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*/ )