[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - desktop/source include/svx include/xmloff schema/libreoffice sw/inc sw/source xmloff/inc xmloff/source

Scott Clarke (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 27 15:13:31 UTC 2019


 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/AnnotationWin2.cxx                   |    2 
 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 
 19 files changed, 90 insertions(+), 5 deletions(-)

New commits:
commit 82bdf5996cff7061bb90eb373d7879498c3f3d2c
Author:     Scott Clarke <scott.clarke at codethink.co.uk>
AuthorDate: Fri Jun 7 15:28:42 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Aug 27 17:11:56 2019 +0200

    tdf#119228 Add storage and serialisation for the Resolved flag
    
    Co-authored-by: Jim MacArthur <jim.macarthur at codethink.co.uk>
    (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 <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7f4a323eecd5..5b269e8a2fe1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2289,6 +2289,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 73b760b9d772..c3bc6f19f7a0 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -978,9 +978,10 @@ class SfxStringItem;
 #define SID_TABLE_OPTIMAL_COLUMN_WIDTH                  ( SID_SVX_START + 1187 )
 #define SID_TABLE_OPTIMAL_ROW_HEIGHT                    ( SID_SVX_START + 1188 )
 
+#define SID_TOGGLE_RESOLVED_NOTES                       ( SID_SVX_START + 1189 )
 
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
-#define SID_SVX_FIRSTFREE                               ( SID_TABLE_OPTIMAL_ROW_HEIGHT + 1 )
+#define SID_SVX_FIRSTFREE                               ( SID_TOGGLE_RESOLVED_NOTES + 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 2caeff3ea689..299eb508bebe 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -212,6 +212,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 bebbcb7f08ac..aba87d7d5825 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 19786f82a7e1..8e8fecbf7895 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 70f39e522628..96dbec96ba11 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 818083ccb49b..85dc4d78f1b9 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 e2044622aa1d..c6da204043ba 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1740,13 +1740,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;
 }
@@ -1771,10 +1774,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( o3tl::make_unique<OutlinerParaObject>(*mpText) );
 
@@ -1842,6 +1860,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() )
@@ -1895,6 +1916,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 b68098b83b00..a3df537e185f 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1352,7 +1352,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 ba31f396b3e2..f13ea02d3c74 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -932,6 +932,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 797684d0f4d0..5af53cdcdd44 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -177,6 +177,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()));
             {
                 std::stringstream ss;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 26595fb02e60..d4f98f8f44ec 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3369,6 +3369,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()));
         {
             std::stringstream ss;
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
commit ee8afd397a1056f86322357a8988849c06d15c19
Author:     Jim MacArthur <jim.macarthur at codethink.co.uk>
AuthorDate: Tue Jun 11 13:08:55 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Aug 27 17:11:47 2019 +0200

    AnnotationWin: Fix for GetTopReplyNote
    
    This allows GetTopReplyNote to work when 'this' is already
    the top reply note in a thread.
    
    Change-Id: Ic4cd5d18bdd022bd22bc97a0b0257639ef3f027d
    Reviewed-on: https://gerrit.libreoffice.org/74450
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit fc8a35ab89c5043cb8819ef6a8f7e5373d4e625e)
    Reviewed-on: https://gerrit.libreoffice.org/78179
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index d5309d0cc8d3..a045b7146aa1 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1421,7 +1421,7 @@ void SwAnnotationWin::SetViewState(ViewState bViewState)
 
 SwAnnotationWin* SwAnnotationWin::GetTopReplyNote()
 {
-    SwAnnotationWin* pTopNote = nullptr;
+    SwAnnotationWin* pTopNote = this;
     SwAnnotationWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : nullptr;
     while (pSidebarWin)
     {


More information about the Libreoffice-commits mailing list