lok: Allow to edit comment by postit id
Change-Id: Ice1d40b7813226fe99c423047392b3416d763dd4 Reviewed-on: https://gerrit.libreoffice.org/33614 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: pranavk <pranavk@collabora.co.uk>
This commit is contained in:
@@ -1938,6 +1938,20 @@ void DesktopLOKTest::testCommentsCallbacks()
|
|||||||
CPPUNIT_ASSERT_EQUAL(std::string("Reply comment"), aView2.m_aCommentCallbackResult.get<std::string>("text"));
|
CPPUNIT_ASSERT_EQUAL(std::string("Reply comment"), aView2.m_aCommentCallbackResult.get<std::string>("text"));
|
||||||
int nCommentId2 = aView1.m_aCommentCallbackResult.get<int>("id");
|
int nCommentId2 = aView1.m_aCommentCallbackResult.get<int>("id");
|
||||||
|
|
||||||
|
// Edit the previously added comment
|
||||||
|
aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\": \"" + OString::number(nCommentId2) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Edited comment\" } }";
|
||||||
|
pDocument->pClass->postUnoCommand(pDocument, ".uno:EditAnnotation", aCommandArgs.getStr(), false);
|
||||||
|
Scheduler::ProcessEventsToIdle();
|
||||||
|
|
||||||
|
// We received a LOK_CALLBACK_COMMENT callback with comment 'Modify' action
|
||||||
|
CPPUNIT_ASSERT_EQUAL(std::string("Modify"), aView1.m_aCommentCallbackResult.get<std::string>("action"));
|
||||||
|
CPPUNIT_ASSERT_EQUAL(std::string("Modify"), aView2.m_aCommentCallbackResult.get<std::string>("action"));
|
||||||
|
// parent is unchanged still
|
||||||
|
CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get<int>("parent"));
|
||||||
|
CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get<int>("parent"));
|
||||||
|
CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView1.m_aCommentCallbackResult.get<std::string>("text"));
|
||||||
|
CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView2.m_aCommentCallbackResult.get<std::string>("text"));
|
||||||
|
|
||||||
// Delete the reply comment just added
|
// Delete the reply comment just added
|
||||||
aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\": \"" + OString::number(nCommentId2) + "\" } }";
|
aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\": \"" + OString::number(nCommentId2) + "\" } }";
|
||||||
pDocument->pClass->postUnoCommand(pDocument, ".uno:DeleteComment", aCommandArgs.getStr(), false);
|
pDocument->pClass->postUnoCommand(pDocument, ".uno:DeleteComment", aCommandArgs.getStr(), false);
|
||||||
|
@@ -4554,7 +4554,7 @@ SfxVoidItem InsertAnnotation SID_INSERT_POSTIT
|
|||||||
]
|
]
|
||||||
|
|
||||||
SfxVoidItem EditAnnotation SID_EDIT_POSTIT
|
SfxVoidItem EditAnnotation SID_EDIT_POSTIT
|
||||||
(SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,SvxPostItDateItem Date SID_ATTR_POSTIT_DATE,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
|
(SvxPostItIdItem Id SID_ATTR_POSTIT_ID,SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,SvxPostItDateItem Date SID_ATTR_POSTIT_DATE,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
|
||||||
[
|
[
|
||||||
AutoUpdate = FALSE,
|
AutoUpdate = FALSE,
|
||||||
FastCall = FALSE,
|
FastCall = FALSE,
|
||||||
|
@@ -45,6 +45,7 @@ class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
|
|||||||
virtual void Delete() override;
|
virtual void Delete() override;
|
||||||
virtual void GotoPos() override;
|
virtual void GotoPos() override;
|
||||||
inline const SwPostItField* GetPostItField() { return mpField; }
|
inline const SwPostItField* GetPostItField() { return mpField; }
|
||||||
|
void UpdateText(const OUString& aText);
|
||||||
|
|
||||||
virtual OUString GetAuthor() override;
|
virtual OUString GetAuthor() override;
|
||||||
virtual Date GetDate() override;
|
virtual Date GetDate() override;
|
||||||
|
@@ -924,6 +924,11 @@ interface BaseText
|
|||||||
ExecMethod = ExecField;
|
ExecMethod = ExecField;
|
||||||
StateMethod = StateField;
|
StateMethod = StateField;
|
||||||
]
|
]
|
||||||
|
SID_EDIT_POSTIT
|
||||||
|
[
|
||||||
|
ExecMethod = ExecField;
|
||||||
|
StateMethod = StateField;
|
||||||
|
]
|
||||||
FN_DELETE_COMMENT
|
FN_DELETE_COMMENT
|
||||||
[
|
[
|
||||||
ExecMethod = ExecField ;
|
ExecMethod = ExecField ;
|
||||||
|
@@ -300,6 +300,13 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText)
|
|||||||
Engine()->GetUndoManager().Clear();
|
Engine()->GetUndoManager().Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SwAnnotationWin::UpdateText(const OUString& aText)
|
||||||
|
{
|
||||||
|
Engine()->Clear();
|
||||||
|
GetOutlinerView()->InsertText(aText);
|
||||||
|
UpdateData();
|
||||||
|
}
|
||||||
|
|
||||||
SvxLanguageItem SwAnnotationWin::GetLanguage()
|
SvxLanguageItem SwAnnotationWin::GetLanguage()
|
||||||
{
|
{
|
||||||
// set initial language for outliner
|
// set initial language for outliner
|
||||||
|
@@ -476,6 +476,22 @@ void SwTextShell::ExecField(SfxRequest &rReq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SID_EDIT_POSTIT:
|
||||||
|
{
|
||||||
|
const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
|
||||||
|
if (pIdItem && pIdItem->GetValue())
|
||||||
|
{
|
||||||
|
const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
|
||||||
|
OUString sText;
|
||||||
|
if ( pTextItem )
|
||||||
|
sText = pTextItem->GetValue();
|
||||||
|
|
||||||
|
sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue());
|
||||||
|
if (pAnnotationWin)
|
||||||
|
pAnnotationWin->UpdateText(sText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case FN_REDLINE_COMMENT:
|
case FN_REDLINE_COMMENT:
|
||||||
{
|
{
|
||||||
/* this code can be used once we want redline comments in the margin, all other stuff can
|
/* this code can be used once we want redline comments in the margin, all other stuff can
|
||||||
|
Reference in New Issue
Block a user