sw/inc/fmtfld.hxx | 3 +- sw/qa/extras/odfexport/data/resolved-comment.odt |binary sw/qa/extras/odfexport/odfexport.cxx | 14 +++++++++++++ sw/source/uibase/config/viewopt.cxx | 1 sw/source/uibase/docvw/AnnotationWin.cxx | 11 +++++++--- sw/source/uibase/docvw/PostItMgr.cxx | 11 +++++++--- xmloff/source/text/txtflde.cxx | 24 ++++++++++++----------- 7 files changed, 46 insertions(+), 18 deletions(-)
New commits: commit ed0c7235b99d2324d138a220c9a1d0363851230f Author: Scott Clarke <scott.cla...@codethink.co.uk> AuthorDate: Thu Aug 8 13:37:54 2019 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Aug 28 09:08:33 2019 +0200 Set "Resolved Comments" view option on by default The "Resolved Comments" view option now starts switched on by default to match the fact that resolved comments would be visible when a document was first opened anyway. (cherry picked from commit e7638f15fc945e6de73876949538682b854fdc41) Change-Id: Ib9c41c57c826f4282d0d6bf0ebcd485aa71ce1d6 Reviewed-on: https://gerrit.libreoffice.org/78188 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 970816c3e3ce..f1461378f705 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -193,6 +193,7 @@ SwViewOption::SwViewOption() : m_nUIOptions = ViewOptFlags2::Modified | ViewOptFlags2::GrfKeepZoom | + ViewOptFlags2::ResolvedPostits | ViewOptFlags2::AnyRuler; if (!utl::ConfigManager::IsFuzzing() && MeasurementSystem::Metric != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()) commit 24613559e1dc44f6ee8ed170d83b9ed518cff9a1 Author: Scott Clarke <scott.cla...@codethink.co.uk> AuthorDate: Tue Aug 13 09:54:12 2019 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Aug 28 09:08:12 2019 +0200 Change some handling for resolved comments Changed the way the lcl_CommentNotification method is called when a comment is resolved such that resolution is distinct from other changes. Resolved flag is now only stored in the top annotation of a thread when saved as ODT. (cherry picked from commit 9751b4b4fa00cf5175ccc0f9c52a22b07f73d4aa) Conflicts: sw/source/uibase/docvw/PostItMgr.cxx Change-Id: I5ef36718fd7e1dfcc16c077871653a70476e8804 Reviewed-on: https://gerrit.libreoffice.org/78187 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index 6c1b805e952c..076eaa53d4da 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -114,7 +114,8 @@ enum class SwFormatFieldHintWhich REMOVED = 2, FOCUS = 3, CHANGED = 4, - LANGUAGE = 5 + LANGUAGE = 5, + RESOLVED = 6 }; class SW_DLLPUBLIC SwFormatFieldHint : public SfxHint diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 420c350fce26..51b30e542766 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -220,6 +220,7 @@ void SwAnnotationWin::SetPostItText() void SwAnnotationWin::SetResolved(bool resolved) { + bool oldState = IsResolved(); static_cast<SwPostItField*>(mpFormatField->GetField())->SetResolved(resolved); const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions(); mrSidebarItem.bShow = !IsResolved() || (pVOpt->IsResolvedPostIts()); @@ -231,7 +232,8 @@ void SwAnnotationWin::SetResolved(bool resolved) else mpMetadataResolved->Hide(); - mbResolvedStateUpdated = true; + if(IsResolved() != oldState) + mbResolvedStateUpdated = true; UpdateData(); Invalidate(); } @@ -261,7 +263,7 @@ bool SwAnnotationWin::IsThreadResolved() void SwAnnotationWin::UpdateData() { - if ( mpOutliner->IsModified() || mbResolvedStateUpdated) + if ( mpOutliner->IsModified() || mbResolvedStateUpdated ) { IDocumentUndoRedo & rUndoRedo( mrView.GetDocShell()->GetDoc()->GetIDocumentUndoRedo()); @@ -283,7 +285,10 @@ void SwAnnotationWin::UpdateData() // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one) mrMgr.SetLayout(); // #i98686# if we have several views, all notes should update their text - mpFormatField->Broadcast(SwFormatFieldHint( nullptr, SwFormatFieldHintWhich::CHANGED)); + if(mbResolvedStateUpdated) + mpFormatField->Broadcast(SwFormatFieldHint( nullptr, SwFormatFieldHintWhich::RESOLVED)); + else + mpFormatField->Broadcast(SwFormatFieldHint( nullptr, SwFormatFieldHintWhich::CHANGED)); mrView.GetDocShell()->SetModified(); } mpOutliner->ClearModifyFlag(); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 25066fa32d07..95e79f62cb67 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -103,7 +103,7 @@ using namespace sw::annotation; namespace { - enum class CommentNotificationType { Add, Remove, Modify }; + enum class CommentNotificationType { Add, Remove, Modify, Resolve }; bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b) { @@ -146,7 +146,8 @@ namespace { boost::property_tree::ptree aAnnotation; aAnnotation.put("action", (nType == CommentNotificationType::Add ? "Add" : (nType == CommentNotificationType::Remove ? "Remove" : - (nType == CommentNotificationType::Modify ? "Modify" : "???")))); + (nType == CommentNotificationType::Modify ? "Modify" : + (nType == CommentNotificationType::Resolve ? "Resolve" : "???"))))); aAnnotation.put("id", nPostItId); if (nType != CommentNotificationType::Remove && pItem != nullptr) { @@ -410,6 +411,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) break; } case SwFormatFieldHintWhich::CHANGED: + case SwFormatFieldHintWhich::RESOLVED: { SwFormatField* pFormatField = dynamic_cast<SwFormatField*>(&rBC); for (auto const& postItField : mvPostItFields) @@ -425,7 +427,10 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // If LOK has disabled tiled annotations, emit annotation callbacks if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isTiledAnnotations()) { - lcl_CommentNotification(mpView, CommentNotificationType::Modify, postItField, 0); + if(SwFormatFieldHintWhich::CHANGED == pFormatHint->Which()) + lcl_CommentNotification(mpView, CommentNotificationType::Modify, postItField, 0); + else + lcl_CommentNotification(mpView, CommentNotificationType::Resolve, postItField, 0); } break; } diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 412e88663172..0057fa9c2128 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -1744,18 +1744,20 @@ void XMLTextFieldExport::ExportFieldHelper( OUString aName; 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); + 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); commit 5ddf4f95d5c528365a292df64d6d0e8e4ac1906b Author: Scott Clarke <scott.cla...@codethink.co.uk> AuthorDate: Thu Aug 8 13:40:18 2019 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Aug 28 09:07:52 2019 +0200 Add test for resolved comments in odfexport (cherry picked from commit 0fbd3fcebf877ba25343443806e0d75f67c2d7b7) Change-Id: I069d84b1e6b80731c5d13a1f8b06f4ed9df0844a Reviewed-on: https://gerrit.libreoffice.org/78186 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/odfexport/data/resolved-comment.odt b/sw/qa/extras/odfexport/data/resolved-comment.odt new file mode 100644 index 000000000000..e136cac3d825 Binary files /dev/null and b/sw/qa/extras/odfexport/data/resolved-comment.odt differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 43a52110ee51..0bfca2fc0bc8 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -477,6 +477,20 @@ DECLARE_ODFEXPORT_TEST(testSenderInitials, "sender-initials.fodt") } } +#ifndef WNT +DECLARE_ODFEXPORT_TEST(testResolvedComment, "resolved-comment.odt") +{ + // TODO find out why does this break testFdo58949 on Windows. + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPropertySet, "Resolved")); + xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xPropertySet, "Resolved")); +} +#endif + DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt") { // frame style fo:background-color was not imported _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits