Kaydet (Commit) d2ef03ce authored tarafından Ravindra_Vidhate's avatar Ravindra_Vidhate Kaydeden (comit) Caolán McNamara

tdf#84153: "Edit Comment" in context menu when a cell has a comment

Problem Description :
1. When a cell doesn't has comment, the contextual menu shows menu
item "Insert Comment".

2. Also when the cell has the comment, the contextual menu shows
following menu items
"Insert Comment"
"Delete Comment"
"Show Comment"

In the second case mentioned above, the contextual menu should show
the menu item "Edit Comment" instead of "Insert Comment"

XML difference: None
After RT : None

Solution :
In this patch, a new menu item "Edit Comment" have been added. So at the
time of the display it checks whether cell has comment associated with it.
If comments are present for cell, it will display "Edit Comment" in the
contextual menu otherwise "Insert Comment" will be displayed.

TODO: Writing a UT seems to be tricky for this change.
Need to analyze and will raise the UT in separate CL.

Change-Id: Ie0499d02157c4fd18894c5f203c363f64659f3b3
Reviewed-on: https://gerrit.libreoffice.org/15713Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 2b5915da
......@@ -82,6 +82,7 @@
#define CMD_SID_GRID_USE ".uno:GridUse"
#define CMD_SID_GRID_VISIBLE ".uno:GridVisible"
#define CMD_SID_INSERT_POSTIT ".uno:InsertAnnotation"
#define CMD_SID_EDIT_POSTIT ".uno:InsertAnnotation"
#define CMD_SID_REPLYTO_POSTIT ".uno:ReplyToAnnotation"
#define CMD_SID_RULER ".uno:ShowRuler"
#define CMD_SID_DELETE_POSTIT ".uno:DeleteAnnotation"
......
......@@ -1008,8 +1008,10 @@
#define SID_OBJECT_CROP ( SID_SVX_START + 1147 )
#define SID_EDIT_POSTIT ( SID_SVX_START + 1148 )
// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
#define SID_SVX_FIRSTFREE ( SID_OBJECT_CROP + 1 )
#define SID_SVX_FIRSTFREE (SID_EDIT_POSTIT + 1)
// Overflow check for slot IDs
......
......@@ -192,6 +192,7 @@ interface CellSelection
SID_CHARMAP [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ]
SID_INSERT_POSTIT [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ]
SID_EDIT_POSTIT [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ]
SID_COLLABORATION [ ExecMethod = Execute; ]
SID_TABOP [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
......
......@@ -149,6 +149,12 @@ Menu RID_POPUP_CELLS
Text [ en-US ] = "Insert Co~mment" ;
};
MenuItem
{
Identifier = SID_EDIT_POSTIT ;
HelpId = CMD_SID_EDIT_POSTIT ;
Text [ en-US ] = "Edit Co~mment" ;
};
MenuItem
{
Identifier = SID_DELETE_NOTE ;
HelpId = CMD_SID_DELETE_NOTE ;
......
......@@ -326,7 +326,29 @@ void ScCellShell::GetCellState( SfxItemSet& rSet )
break;
case SID_INSERT_POSTIT:
{
if ( pDocShell && pDocShell->IsDocShared() )
ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
if( rDoc.GetNote(aPos) )
{
bDisable = true;
}
else
{
bDisable = false;
if ( pDocShell && pDocShell->IsDocShared() )
{
bDisable = true;
}
}
}
break;
case SID_EDIT_POSTIT:
{
ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
if( rDoc.GetNote(aPos) )
{
bDisable = false;
}
else
{
bDisable = true;
}
......
......@@ -2173,6 +2173,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
break;
case SID_INSERT_POSTIT:
case SID_EDIT_POSTIT:
if ( pReqArgs )
{
const SvxPostItAuthorItem& rAuthorItem = static_cast<const SvxPostItAuthorItem&>(pReqArgs->Get( SID_ATTR_POSTIT_AUTHOR ));
......
......@@ -6214,6 +6214,29 @@ SfxVoidItem InsertAnnotation SID_INSERT_POSTIT
GroupId = GID_INSERT;
]
SfxVoidItem EditAnnotation SID_EDIT_POSTIT
(SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,SvxPostItDateItem Date SID_ATTR_POSTIT_DATE,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
[
/* flags: */
AutoUpdate = FALSE,
Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = TRUE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
/* config: */
AccelConfig = TRUE,
MenuConfig = TRUE,
StatusBarConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = GID_INSERT;
]
SfxBoolItem ShowAnnotations SID_SHOW_POSTIT
()
......
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