desktop/source/lib/init.cxx | 1 include/svx/svxids.hrc | 3 - include/xmloff/txtimp.hxx | 1 include/xmloff/xmltoken.hxx | 2 schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng | 18 +++++++ sw/inc/docufld.hxx | 6 ++ sw/inc/unoprnms.hxx | 2 sw/source/core/fields/docufld.cxx | 28 +++++++++++- sw/source/core/unocore/unofield.cxx | 4 + sw/source/core/unocore/unomap.cxx | 1 sw/source/uibase/docvw/PostItMgr.cxx | 1 sw/source/uibase/uno/unotxdoc.cxx | 1 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 18 files changed, 89 insertions(+), 4 deletions(-)
New commits: commit d2025bdc33cc8d9e2f6c9f90da4574275ed6b0e4 Author: Scott Clarke <[email protected]> AuthorDate: Fri Jun 7 15:28:42 2019 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Thu Jul 25 10:38:36 2019 +0200 tdf#119228 Add storage and serialisation for the Resolved flag Change-Id: I0278588dc533378104e544d05b60583c85271f6a Co-authored-by: Jim MacArthur <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/75858 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 157ca969660e..a1487e3790da 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2137,6 +2137,7 @@ static void doc_iniUnoCommands () OUString(".uno:InsertAnnotation"), OUString(".uno:DeleteAnnotation"), OUString(".uno:ReplyComment"), + OUString(".uno:ResolveComment"), OUString(".uno:InsertRowsBefore"), OUString(".uno:InsertRowsAfter"), OUString(".uno:InsertColumnsBefore"), diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 75616d40e128..bbca92682819 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -980,9 +980,10 @@ class SvxSetItem; #define SID_TABLE_CELL_BACKGROUND_COLOR TypedWhichId<SvxColorItem>( SID_SVX_START + 1189 ) +#define SID_TOGGLE_RESOLVED_NOTES ( SID_SVX_START + 1190 ) // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE ( SID_SVX_START + 1189 + 1 ) +#define SID_SVX_FIRSTFREE ( SID_SVX_START + 1190 + 1 ) // Overflow check for slot IDs #if SID_SVX_FIRSTFREE > SID_SVX_END diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx index 596d09352b82..df20f5dfda0d 100644 --- a/include/xmloff/txtimp.hxx +++ b/include/xmloff/txtimp.hxx @@ -209,6 +209,7 @@ enum XMLTextPElemTokens XML_TOK_TEXT_ANNOTATION, XML_TOK_TEXT_ANNOTATION_END, XML_TOK_TEXT_NAME, + XML_TOK_TEXT_RESOLVED, XML_TOK_TEXT_SCRIPT, XML_TOK_TEXT_TABLE_FORMULA, XML_TOK_TEXT_DROP_DOWN, diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 69ef7e889455..83ebc3395ebb 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -3350,6 +3350,8 @@ namespace xmloff { namespace token { // tdf#115007 XML_TRANSLITERATION_SPELLOUT, + XML_RESOLVED, + XML_TOKEN_END }; diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng index e5a0116bd029..8e78fa6211f9 100644 --- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng +++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng @@ -965,6 +965,24 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. </rng:element> </rng:define> + <rng:define name="office-annotation-attlist" combine="interleave"> + <rng:interleave> + <rng:optional> + <rng:attribute name="office:display"> + <rng:ref name="boolean"/> + </rng:attribute> + </rng:optional> + <rng:optional> + <rng:ref name="common-office-annotation-name-attlist"/> + </rng:optional> + <rng:optional> + <rng:attribute name="loext:resolved"> + <rng:ref name="boolean"/> + </rng:attribute> + </rng:optional> + </rng:interleave> + </rng:define> + <rng:define name="style-style-content"> <rng:choice> <rng:group> diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index bdd7fd68756f..abdfe644a798 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -445,6 +445,7 @@ class SW_DLLPUBLIC SwPostItField : public SwField OUString m_sInitials; ///< Initials of the author. OUString m_sName; ///< Name of the comment. DateTime m_aDateTime; + bool m_bResolved; std::unique_ptr<OutlinerParaObject> mpText; rtl::Reference<SwTextAPIObject> m_xTextObject; sal_uInt32 m_nPostItId; @@ -458,6 +459,7 @@ public: const OUString& rInitials, const OUString& rName, const DateTime& rDate, + const bool bResolved = false, const sal_uInt32 nPostItId = 0); SwPostItField(const SwPostItField&) = delete; @@ -488,6 +490,10 @@ public: const OutlinerParaObject* GetTextObject() const { return mpText.get();} void SetTextObject( std::unique_ptr<OutlinerParaObject> pText ); + void SetResolved(bool bNewState); + void ToggleResolved(); + bool GetResolved() const; + sal_Int32 GetNumberOfParagraphs() const; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index ccde05f87f77..1ae3a69fc618 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -866,6 +866,8 @@ #define UNO_NAME_TABLE_FIRST_ROW_START_COLUMN "FirstRowStartColumn" #define UNO_NAME_TABLE_LAST_ROW_END_COLUMN "LastRowEndColumn" #define UNO_NAME_TABLE_LAST_ROW_START_COLUMN "LastRowStartColumn" + +#define UNO_NAME_RESOLVED "Resolved" #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index f8dcbd0d7e3f..19da42aa5cf8 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1734,13 +1734,16 @@ SwPostItField::SwPostItField( SwPostItFieldType* pT, const OUString& rInitials, const OUString& rName, const DateTime& rDateTime, - const sal_uInt32 nPostItId) + const bool bResolved, + const sal_uInt32 nPostItId +) : SwField( pT ) , m_sText( rText ) , m_sAuthor( rAuthor ) , m_sInitials( rInitials ) , m_sName( rName ) , m_aDateTime( rDateTime ) + , m_bResolved( bResolved ) { m_nPostItId = nPostItId == 0 ? m_nLastPostItId++ : nPostItId; } @@ -1765,10 +1768,25 @@ OUString SwPostItField::GetDescription() const return SwResId(STR_NOTE); } +void SwPostItField::SetResolved(bool bNewState) +{ + m_bResolved = bNewState; +} + +void SwPostItField::ToggleResolved() +{ + m_bResolved = !m_bResolved; +} + +bool SwPostItField::GetResolved() const +{ + return m_bResolved; +} + std::unique_ptr<SwField> SwPostItField::Copy() const { std::unique_ptr<SwPostItField> pRet(new SwPostItField( static_cast<SwPostItFieldType*>(GetTyp()), m_sAuthor, m_sText, m_sInitials, m_sName, - m_aDateTime, m_nPostItId)); + m_aDateTime, m_bResolved, m_nPostItId)); if (mpText) pRet->SetTextObject( std::make_unique<OutlinerParaObject>(*mpText) ); @@ -1836,6 +1854,9 @@ bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const case FIELD_PROP_PAR4: rAny <<= m_sName; break; + case FIELD_PROP_BOOL1: + rAny <<= m_bResolved; + break; case FIELD_PROP_TEXT: { if ( !m_xTextObject.is() ) @@ -1889,6 +1910,9 @@ bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) case FIELD_PROP_PAR4: rAny >>= m_sName; break; + case FIELD_PROP_BOOL1: + rAny >>= m_bResolved; + break; case FIELD_PROP_TEXT: OSL_FAIL("Not implemented!"); break; diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 8764eccdfdee..dbfb80be713b 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1434,7 +1434,9 @@ void SAL_CALL SwXTextField::attach( m_pImpl->m_pProps->sPar2, // content m_pImpl->m_pProps->sPar3, // author's initials m_pImpl->m_pProps->sPar4, // name - aDateTime ); + aDateTime, + m_pImpl->m_pProps->bBool1 // resolvedflag + ); if ( m_pImpl->m_xTextObject.is() ) { pPostItField->SetTextObject( m_pImpl->m_xTextObject->CreateText() ); diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index b1b7ab4b49e8..5bc4c3f5871a 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -933,6 +933,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s {OUString(UNO_NAME_CONTENT), FIELD_PROP_PAR2, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, {OUString(UNO_NAME_INITIALS), FIELD_PROP_PAR3, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, {OUString(UNO_NAME_NAME), FIELD_PROP_PAR4, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, + {OUString(UNO_NAME_RESOLVED), FIELD_PROP_BOOL1, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, {OUString(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DATE_TIME, cppu::UnoType<css::util::DateTime>::get(), PROPERTY_NONE, 0}, {OUString(UNO_NAME_DATE), FIELD_PROP_DATE, cppu::UnoType<css::util::Date>::get(), PROPERTY_NONE, 0}, {OUString(UNO_NAME_TEXT_RANGE), FIELD_PROP_TEXT, cppu::UnoType<css::uno::XInterface>::get(), PropertyAttribute::READONLY, 0}, diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 0b605096e299..3866231bcb0c 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -171,6 +171,7 @@ namespace { aAnnotation.put("parent", pWin->CalcParent()); aAnnotation.put("author", pField->GetPar1().toUtf8().getStr()); aAnnotation.put("text", pField->GetPar2().toUtf8().getStr()); + aAnnotation.put("resolved", pField->GetResolved() ? "true" : "false"); aAnnotation.put("dateTime", utl::toISO8601(pField->GetDateTime().GetUNODateTime())); aAnnotation.put("anchorPos", aSVRect.toString()); aAnnotation.put("textRange", sRects.getStr()); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index c37e3abdc9ec..4fdfc5dadecf 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3370,6 +3370,7 @@ OUString SwXTextDocument::getPostIts() aAnnotation.put("parent", pWin->CalcParent()); aAnnotation.put("author", pField->GetPar1().toUtf8().getStr()); aAnnotation.put("text", pField->GetPar2().toUtf8().getStr()); + aAnnotation.put("resolved", pField->GetResolved() ? "true" : "false"); aAnnotation.put("dateTime", utl::toISO8601(pField->GetDateTime().GetUNODateTime())); aAnnotation.put("anchorPos", aSVRect.toString()); aAnnotation.put("textRange", sRects.getStr()); diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx index 794ddef20ea5..c2537521b37e 100644 --- a/xmloff/inc/txtfldi.hxx +++ b/xmloff/inc/txtfldi.hxx @@ -1101,6 +1101,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 1daa8897649d..a8fea52ebbfc 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3342,6 +3342,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 dd71ec72d3ba..ee5d935576bc 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -1760,6 +1760,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 7bba48a20444..80be0124235d 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( @@ -3468,6 +3470,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 9f57ac3ac08a..3fbe2eaab4ff 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -491,6 +491,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 ce472bc62c7a..82b64bc85642 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -3111,4 +3111,5 @@ reference-language newline creator-initials transliteration-spellout +resolved TOKEN_END_DUMMY _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
