Kaydet (Commit) ce96c595 authored tarafından Pranav Kant's avatar Pranav Kant

SvxPostItIdItem is now string type

Change-Id: Id44bf5dd623749b6e9a46f121f035aa5ce617557
üst a29b0d68
...@@ -1918,7 +1918,7 @@ void DesktopLOKTest::testCommentsCallbacks() ...@@ -1918,7 +1918,7 @@ void DesktopLOKTest::testCommentsCallbacks()
int nCommentId1 = aView1.m_aCommentCallbackResult.get<int>("id"); int nCommentId1 = aView1.m_aCommentCallbackResult.get<int>("id");
// Reply to a comment just added // Reply to a comment just added
aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Reply comment\" } }"; aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Reply comment\" } }";
pDocument->pClass->postUnoCommand(pDocument, ".uno:ReplyComment", aCommandArgs.getStr(), false); pDocument->pClass->postUnoCommand(pDocument, ".uno:ReplyComment", aCommandArgs.getStr(), false);
Scheduler::ProcessEventsToIdle(); Scheduler::ProcessEventsToIdle();
...@@ -1932,7 +1932,7 @@ void DesktopLOKTest::testCommentsCallbacks() ...@@ -1932,7 +1932,7 @@ void DesktopLOKTest::testCommentsCallbacks()
int nCommentId2 = aView1.m_aCommentCallbackResult.get<int>("id"); int nCommentId2 = aView1.m_aCommentCallbackResult.get<int>("id");
// Edit the previously added comment // Edit the previously added comment
aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\": \"" + OString::number(nCommentId2) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Edited comment\" } }"; aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\": \"" + OString::number(nCommentId2) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Edited comment\" } }";
pDocument->pClass->postUnoCommand(pDocument, ".uno:EditAnnotation", aCommandArgs.getStr(), false); pDocument->pClass->postUnoCommand(pDocument, ".uno:EditAnnotation", aCommandArgs.getStr(), false);
Scheduler::ProcessEventsToIdle(); Scheduler::ProcessEventsToIdle();
...@@ -1946,7 +1946,7 @@ void DesktopLOKTest::testCommentsCallbacks() ...@@ -1946,7 +1946,7 @@ void DesktopLOKTest::testCommentsCallbacks()
CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView2.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\": \"string\", \"value\": \"" + OString::number(nCommentId2) + "\" } }";
pDocument->pClass->postUnoCommand(pDocument, ".uno:DeleteComment", aCommandArgs.getStr(), false); pDocument->pClass->postUnoCommand(pDocument, ".uno:DeleteComment", aCommandArgs.getStr(), false);
Scheduler::ProcessEventsToIdle(); Scheduler::ProcessEventsToIdle();
...@@ -1957,7 +1957,7 @@ void DesktopLOKTest::testCommentsCallbacks() ...@@ -1957,7 +1957,7 @@ void DesktopLOKTest::testCommentsCallbacks()
CPPUNIT_ASSERT_EQUAL(nCommentId2, aView2.m_aCommentCallbackResult.get<int>("id")); CPPUNIT_ASSERT_EQUAL(nCommentId2, aView2.m_aCommentCallbackResult.get<int>("id"));
// Reply to nCommentId1 again // Reply to nCommentId1 again
aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Reply comment again\" } }"; aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Reply comment again\" } }";
pDocument->pClass->postUnoCommand(pDocument, ".uno:ReplyComment", aCommandArgs.getStr(), false); pDocument->pClass->postUnoCommand(pDocument, ".uno:ReplyComment", aCommandArgs.getStr(), false);
Scheduler::ProcessEventsToIdle(); Scheduler::ProcessEventsToIdle();
......
...@@ -120,14 +120,14 @@ public: ...@@ -120,14 +120,14 @@ public:
The internal id of a note The internal id of a note
*/ */
class SVX_DLLPUBLIC SvxPostItIdItem: public SfxUInt32Item class SVX_DLLPUBLIC SvxPostItIdItem: public SfxStringItem
{ {
public: public:
static SfxPoolItem* CreateDefault(); static SfxPoolItem* CreateDefault();
SvxPostItIdItem( sal_uInt16 nWhich ); SvxPostItIdItem( sal_uInt16 nWhich );
SvxPostItIdItem( sal_uInt32 rId, sal_uInt16 nWhich ); SvxPostItIdItem( const OUString& rId, sal_uInt16 nWhich );
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
......
...@@ -151,8 +151,8 @@ SvxPostItIdItem::SvxPostItIdItem( sal_uInt16 _nWhich ) ...@@ -151,8 +151,8 @@ SvxPostItIdItem::SvxPostItIdItem( sal_uInt16 _nWhich )
SetWhich( _nWhich ); SetWhich( _nWhich );
} }
SvxPostItIdItem::SvxPostItIdItem( sal_uInt32 rId, sal_uInt16 _nWhich ) : SvxPostItIdItem::SvxPostItIdItem( const OUString& rId, sal_uInt16 _nWhich ) :
SfxUInt32Item( _nWhich, rId ) SfxStringItem( _nWhich, rId )
{ {
} }
......
...@@ -330,9 +330,9 @@ void SwTextShell::ExecField(SfxRequest &rReq) ...@@ -330,9 +330,9 @@ void SwTextShell::ExecField(SfxRequest &rReq)
case FN_DELETE_COMMENT: case FN_DELETE_COMMENT:
{ {
const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID); const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
if (pIdItem && pIdItem->GetValue() && GetView().GetPostItMgr()) if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
{ {
GetView().GetPostItMgr()->Delete(pIdItem->GetValue()); GetView().GetPostItMgr()->Delete(pIdItem->GetValue().toUInt32());
} }
else if ( GetView().GetPostItMgr() && else if ( GetView().GetPostItMgr() &&
GetView().GetPostItMgr()->HasActiveSidebarWin() ) GetView().GetPostItMgr()->HasActiveSidebarWin() )
...@@ -380,16 +380,16 @@ void SwTextShell::ExecField(SfxRequest &rReq) ...@@ -380,16 +380,16 @@ void SwTextShell::ExecField(SfxRequest &rReq)
case FN_REPLY: case FN_REPLY:
{ {
const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID); const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
if (pIdItem && pIdItem->GetValue()) if (pIdItem && !pIdItem->GetValue().isEmpty())
{ {
SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(RES_POSTITFLD, OUString(), false); SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(RES_POSTITFLD, OUString(), false);
SwIterator<SwFormatField,SwFieldType> aIter( *pType ); SwIterator<SwFormatField,SwFieldType> aIter( *pType );
SwFormatField* pSwFormatField = aIter.First(); SwFormatField* pSwFormatField = aIter.First();
while( pSwFormatField ) while( pSwFormatField )
{ {
if ( static_cast<SwPostItField*>(pSwFormatField->GetField())->GetPostItId() == pIdItem->GetValue()) if ( static_cast<SwPostItField*>(pSwFormatField->GetField())->GetPostItId() == pIdItem->GetValue().toUInt32() )
{ {
sw::annotation::SwAnnotationWin* pWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue()); sw::annotation::SwAnnotationWin* pWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
if (pWin) if (pWin)
{ {
const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT); const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
...@@ -479,14 +479,14 @@ void SwTextShell::ExecField(SfxRequest &rReq) ...@@ -479,14 +479,14 @@ void SwTextShell::ExecField(SfxRequest &rReq)
case SID_EDIT_POSTIT: case SID_EDIT_POSTIT:
{ {
const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID); const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
if (pIdItem && pIdItem->GetValue()) if (pIdItem && !pIdItem->GetValue().isEmpty())
{ {
const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT); const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
OUString sText; OUString sText;
if ( pTextItem ) if ( pTextItem )
sText = pTextItem->GetValue(); sText = pTextItem->GetValue();
sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue()); sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
if (pAnnotationWin) if (pAnnotationWin)
pAnnotationWin->UpdateText(sText); pAnnotationWin->UpdateText(sText);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment