From c35d7018cfe0ff3c8229d81058b298e67128ff0e Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 14 Feb 2014 10:28:41 +0100 Subject: DOC export: restore quotation of SEQ field names Commit d738b063134e97c780205f8baf138f291016ded4 (fdo#74431 : Captions' are preserved but remove a space, 2014-02-03) unconditionally removed quotes around SEQ field names, because the DOCX and RTF import leaves those quotes around during import time. However, the DOC import strips them away. So till all this is unified, at least make sure that on export DOC still quotes the field names, as it did since the initial import. Change-Id: I3478f736c2e17824f268f92580767b90d9fdd006 --- sw/source/filter/ww8/docxexport.hxx | 2 ++ sw/source/filter/ww8/rtfexport.hxx | 1 + sw/source/filter/ww8/wrtww8.hxx | 4 ++++ sw/source/filter/ww8/ww8atr.cxx | 6 +++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 99b7ee7542f5..d058302d34a3 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -111,6 +111,8 @@ public: virtual bool SupportsOneColumnBreak() const { return true; } + virtual bool FieldsQuoted() const { return true; } + virtual bool ignoreAttributeForStyles( sal_uInt16 nWhich ) const; /// Guess the script (asian/western). diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx index d801db4b6fbd..21a44159a8c4 100644 --- a/sw/source/filter/ww8/rtfexport.hxx +++ b/sw/source/filter/ww8/rtfexport.hxx @@ -64,6 +64,7 @@ public: virtual bool SupportsOneColumnBreak() const { return false; } + virtual bool FieldsQuoted() const { return true; } /// Guess the script (asian/western). virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich ); diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 55ae63629306..755e36e5217f 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -636,6 +636,9 @@ public: /// Determines if column break with one column should be exported or not. virtual bool SupportsOneColumnBreak() const = 0; + /// Determines if the import filter already quoted fields or not. + virtual bool FieldsQuoted() const = 0; + /// Used to filter out attributes that can be e.g. written to .doc but not to .docx virtual bool ignoreAttributeForStyles( sal_uInt16 /*nWhich*/ ) const { return false; } @@ -961,6 +964,7 @@ public: virtual bool SupportsOneColumnBreak() const { return false; } + virtual bool FieldsQuoted() const { return false; } private: /// Format-dependent part of the actual export. virtual void ExportDocument_Impl(); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 79d9f6aeb406..b7ae6402234a 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2579,7 +2579,11 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) case RES_SETEXPFLD: if (nsSwGetSetExpType::GSE_SEQ == nSubType) { - OUString sStr = FieldString(ww::eSEQ) + pFld->GetTyp()->GetName() + " "; + OUString sStr; + if (GetExport().FieldsQuoted()) + sStr = FieldString(ww::eSEQ) + pFld->GetTyp()->GetName() + " "; + else + sStr = FieldString(ww::eSEQ) + "\"" + pFld->GetTyp()->GetName() +"\" "; GetNumberPara( sStr, *pFld ); GetExport().OutputField(pFld, ww::eSEQ, sStr); } -- cgit