include/svx/svxcommands.h | 1 + include/svx/svxids.hrc | 4 +++- sc/sdi/cellsh.sdi | 1 + sc/source/ui/src/popup.src | 6 ++++++ sc/source/ui/view/cellsh.cxx | 24 +++++++++++++++++++++++- sc/source/ui/view/cellsh1.cxx | 1 + svx/sdi/svx.sdi | 23 +++++++++++++++++++++++ 7 files changed, 58 insertions(+), 2 deletions(-)
New commits: commit d2ef03ce0b9295034f9078bc04acbf4cfc939ef6 Author: Ravindra_Vidhate <ravindra.vidh...@synerzip.com> Date: Tue May 12 14:17:06 2015 +0530 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/15713 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/svx/svxcommands.h b/include/svx/svxcommands.h index 6516bc8..df3ddee 100644 --- a/include/svx/svxcommands.h +++ b/include/svx/svxcommands.h @@ -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" diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 274cf9a..ed45af0 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -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 diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 7aca440..6da3c75 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -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; ] diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src index 16b88c3..7090d0d 100644 --- a/sc/source/ui/src/popup.src +++ b/sc/source/ui/src/popup.src @@ -150,6 +150,12 @@ Menu RID_POPUP_CELLS }; 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 ; Text [ en-US ] = "D~elete Comment" ; diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index c0eac46..b8627ba 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -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; } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 7bb562b..237028e 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -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 )); diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 6c45438..9d9f769 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -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 ()
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits