From 109210e5b71a4e0b6fcaae72be7ef8d7667f3708 Mon Sep 17 00:00:00 2001 From: Rosemary Sebastian Date: Sat, 18 Mar 2017 08:46:27 +0000 Subject: Revert "Revert "Implement export and import of author field in fixed format"" This reverts commit cae16645e17df6a1f87443c00b6abfd26dabd27f. Change-Id: If5b85beb53a0925909d537023879a7d86fa011cf Reviewed-on: https://gerrit.libreoffice.org/35391 Tested-by: Jenkins Reviewed-by: Rosemary Sebastian Tested-by: Rosemary Sebastian --- xmloff/inc/txtfldi.hxx | 4 ++++ xmloff/source/text/txtflde.cxx | 7 +++++-- xmloff/source/text/txtfldi.cxx | 10 ++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'xmloff') diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx index 106545c34503..ed154c72ffe0 100644 --- a/xmloff/inc/txtfldi.hxx +++ b/xmloff/inc/txtfldi.hxx @@ -234,6 +234,10 @@ protected: virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) override; + /// process attribute values + virtual void ProcessAttribute( sal_uInt16 nAttrToken, + const OUString& sAttrValue ) override; + /// prepare XTextField for insertion into document virtual void PrepareField( const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 4692856b96e2..91dba974616d 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -1055,8 +1055,11 @@ void XMLTextFieldExport::ExportFieldHelper( switch (nToken) { case FIELD_ID_AUTHOR: // author field: fixed, field (sub-)type - ProcessBoolean(XML_FIXED, - GetBoolProperty(sPropertyIsFixed, rPropSet), true); + if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed)) + { + GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_FIXED, + (GetBoolProperty(sPropertyIsFixed, rPropSet) ? XML_TRUE : XML_FALSE) ); + } ExportElement(MapAuthorFieldName(rPropSet), sPresentation); break; diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index 4c2bcbf7a20f..e521e19eb982 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -680,6 +680,16 @@ void XMLAuthorFieldImportContext::StartElement( XMLTextFieldImportContext::StartElement(xAttrList); } +void XMLAuthorFieldImportContext::ProcessAttribute(sal_uInt16 nAttrToken, const OUString& sAttrValue) +{ + if(nAttrToken == XML_TOK_TEXTFIELD_FIXED) + { + bool bTmp(false); + if (::sax::Converter::convertBool(bTmp, sAttrValue)) + bFixed = bTmp; + } +} + void XMLAuthorFieldImportContext::PrepareField( const Reference & rPropSet) { -- cgit