summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Clarke <scott.clarke@codethink.co.uk>2019-08-13 09:54:12 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-08-14 15:26:58 +0200
commit9751b4b4fa00cf5175ccc0f9c52a22b07f73d4aa (patch)
treec3d93e0371e1b4c0747bf8f5cf60181a530aa593
parent88afec70112c95a016e92e26c1d06d7dd002e4e8 (diff)
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. Change-Id: I5ef36718fd7e1dfcc16c077871653a70476e8804 Reviewed-on: https://gerrit.libreoffice.org/77411 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r--sw/inc/fmtfld.hxx3
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx11
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx11
-rw-r--r--xmloff/source/text/txtflde.cxx24
4 files changed, 31 insertions, 18 deletions
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index d9eafeea82a3..f945bbcc0aa2 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 bbb08b24aacd..bedbbedc01a4 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -225,6 +225,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());
@@ -236,7 +237,8 @@ void SwAnnotationWin::SetResolved(bool resolved)
else
mpMetadataResolved->Hide();
- mbResolvedStateUpdated = true;
+ if(IsResolved() != oldState)
+ mbResolvedStateUpdated = true;
UpdateData();
Invalidate();
}
@@ -266,7 +268,7 @@ bool SwAnnotationWin::IsThreadResolved()
void SwAnnotationWin::UpdateData()
{
- if ( mpOutliner->IsModified() || mbResolvedStateUpdated)
+ if ( mpOutliner->IsModified() || mbResolvedStateUpdated )
{
IDocumentUndoRedo & rUndoRedo(
mrView.GetDocShell()->GetDoc()->GetIDocumentUndoRedo());
@@ -288,7 +290,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 5d47f59200ed..9e0fc941984a 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -104,7 +104,7 @@ using namespace sw::annotation;
namespace {
- enum class CommentNotificationType { Add, Remove, Modify };
+ enum class CommentNotificationType { Add, Remove, Modify, Resolve };
bool comp_pos(const std::unique_ptr<SwSidebarItem>& a, const std::unique_ptr<SwSidebarItem>& b)
{
@@ -147,7 +147,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)
{
@@ -399,6 +400,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)
@@ -414,7 +416,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.get(), 0);
+ if(SwFormatFieldHintWhich::CHANGED == pFormatHint->Which())
+ lcl_CommentNotification(mpView, CommentNotificationType::Modify, postItField.get(), 0);
+ else
+ lcl_CommentNotification(mpView, CommentNotificationType::Resolve, postItField.get(), 0);
}
break;
}
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index ee5d935576bc..ca796c95cc58 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1759,18 +1759,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);