From 82bdf5996cff7061bb90eb373d7879498c3f3d2c Mon Sep 17 00:00:00 2001 From: Scott Clarke Date: Fri, 7 Jun 2019 15:28:42 +0100 Subject: tdf#119228 Add storage and serialisation for the Resolved flag Co-authored-by: Jim MacArthur (cherry picked from commit d2025bdc33cc8d9e2f6c9f90da4574275ed6b0e4) Conflicts: include/svx/svxids.hrc sw/source/core/unocore/unofield.cxx Change-Id: I0278588dc533378104e544d05b60583c85271f6a Reviewed-on: https://gerrit.libreoffice.org/78180 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna --- xmloff/inc/txtfldi.hxx | 1 + xmloff/source/core/xmltoken.cxx | 3 +++ xmloff/source/text/txtflde.cxx | 12 ++++++++++++ xmloff/source/text/txtfldi.cxx | 7 +++++++ xmloff/source/text/txtimp.cxx | 1 + xmloff/source/token/tokens.txt | 1 + 6 files changed, 25 insertions(+) (limited to 'xmloff') diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx index 2448e1b649b3..031c041a1edb 100644 --- a/xmloff/inc/txtfldi.hxx +++ b/xmloff/inc/txtfldi.hxx @@ -1102,6 +1102,7 @@ class XMLAnnotationImportContext : public XMLTextFieldImportContext OUString aName; OUStringBuffer aTextBuffer; OUStringBuffer aDateBuffer; + OUString aResolved; css::uno::Reference < css::beans::XPropertySet > mxField; css::uno::Reference < css::text::XTextCursor > mxCursor; diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index b83298799104..a6a463c795d8 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3341,6 +3341,9 @@ namespace xmloff { namespace token { // tdf#115007 spell out numbers, dates, money amounts and cross references TOKEN( "transliteration-spellout", XML_TRANSLITERATION_SPELLOUT ), + // For recording whether comments/annotations are resolved + TOKEN( "resolved", XML_RESOLVED ), + #if OSL_DEBUG_LEVEL > 0 { 0, nullptr, nullptr, XML_TOKEN_END } #else diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index cb192f8df4fb..412e88663172 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -1745,6 +1745,18 @@ void XMLTextFieldExport::ExportFieldHelper( rPropSet->getPropertyValue(gsPropertyName) >>= aName; if (!aName.isEmpty()) GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, aName); + SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion(); + if(eVersion > SvtSaveOptions::ODFSVER_012) + { + bool b = GetBoolProperty("Resolved", rPropSet); + OUString aResolvedText; + OUStringBuffer aResolvedTextBuffer; + ::sax::Converter::convertBool(aResolvedTextBuffer, b); + aResolvedText = aResolvedTextBuffer.makeStringAndClear(); + + GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_RESOLVED, + aResolvedText); + } SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_OFFICE, XML_ANNOTATION, false, true); diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index b14c45d64b32..93a7272a45a4 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -3306,6 +3306,8 @@ void XMLAnnotationImportContext::ProcessAttribute( { if (nToken == XML_TOK_TEXT_NAME) aName = rValue; + if (nToken == XML_TOK_TEXT_RESOLVED) + aResolved = rValue; } SvXMLImportContextRef XMLAnnotationImportContext::CreateChildContext( @@ -3469,6 +3471,11 @@ void XMLAnnotationImportContext::PrepareField( OUString sInitials( aInitialsBuffer.makeStringAndClear() ); xPropertySet->setPropertyValue("Initials", makeAny(sInitials)); + //import resolved flag + bool bTmp(false); + ::sax::Converter::convertBool(bTmp, aResolved); + xPropertySet->setPropertyValue("Resolved", makeAny(bTmp)); + util::DateTime aDateTime; if (::sax::Converter::parseDateTime(aDateTime, aDateBuffer.makeStringAndClear())) diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 60768588f3ee..dc2fd91c04d4 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -488,6 +488,7 @@ static const SvXMLTokenMapEntry aTextFieldAttrTokenMap[] = XML_TOK_TEXTFIELD_REFERENCE_LANGUAGE }, { XML_NAMESPACE_TEXT, XML_REFERENCE_LANGUAGE, XML_TOK_TEXTFIELD_REFERENCE_LANGUAGE }, + { XML_NAMESPACE_LO_EXT, XML_RESOLVED, XML_TOK_TEXT_RESOLVED }, XML_TOKEN_MAP_END }; diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index d6d832ea5343..9594a6c526ff 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -3110,4 +3110,5 @@ reference-language newline creator-initials transliteration-spellout +resolved TOKEN_END_DUMMY -- cgit v1.2.3