diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-01-20 14:37:27 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-01-20 17:44:00 +0200 |
commit | c5a1278fa2bcc193a82d78ee408ea7a913420675 (patch) | |
tree | 6fd22555e61121c4aa19488606b74551c50a22b1 /sw/source/uibase/shells | |
parent | 405a00949cd72784a5cc231e2552dfdbeaa19812 (diff) |
tdf#93837 sw: Convert comment context menu to xml
Change-Id: If449bff057a78802ed0b74d75a3c1a8a23def31a
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 23fc94c27914..7e3a3faf63a6 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -85,6 +85,7 @@ #include <edtwin.hxx> #include <swwait.hxx> #include <docstat.hxx> +#include <SwRewriter.hxx> #include <cmdid.h> #include <globals.hrc> @@ -141,7 +142,7 @@ void SwAnnotationShell::InitInterface_Impl() { GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, RID_TEXT_TOOLBOX); - GetStaticInterface()->RegisterPopupMenu(SW_RES(MN_ANNOTATION_POPUPMENU)); + GetStaticInterface()->RegisterPopupMenu("annotation"); } @@ -1117,6 +1118,8 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq) const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(nSlot); if ( pItem ) pPostItMgr->Delete( pItem->GetValue() ); + else + pPostItMgr->Delete( pPostItMgr->GetActiveSidebarWin()->GetAuthor() ); break; } case FN_HIDE_NOTE: @@ -1129,6 +1132,8 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq) const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(nSlot); if ( pItem ) pPostItMgr->Hide( pItem->GetValue() ); + else + pPostItMgr->Hide( pPostItMgr->GetActiveSidebarWin()->GetAuthor() ); } } } @@ -1144,11 +1149,9 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet) switch( nSlotId ) { case FN_POSTIT: - case FN_DELETE_NOTE_AUTHOR: case FN_DELETE_ALL_NOTES: case FN_FORMAT_ALL_NOTES: case FN_HIDE_NOTE: - case FN_HIDE_NOTE_AUTHOR: case FN_HIDE_ALL_NOTES: case FN_DELETE_COMMENT: { @@ -1159,7 +1162,26 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet) } break; } - + case FN_DELETE_NOTE_AUTHOR: + case FN_HIDE_NOTE_AUTHOR: + { + if( !pPostItMgr + || !pPostItMgr->HasActiveAnnotationWin() ) + { + rSet.DisableItem(nWhich); + } + else + { + OUString aText( nSlotId == FN_DELETE_NOTE_AUTHOR ? + SW_RES( STR_DELETE_NOTE_AUTHOR ) : SW_RES( STR_HIDE_NOTE_AUTHOR ) ); + SwRewriter aRewriter; + aRewriter.AddRule( UndoArg1, pPostItMgr->GetActiveSidebarWin()->GetAuthor() ); + aText = aRewriter.Apply( aText ); + SfxStringItem aItem( nSlotId, aText ); + rSet.Put( aItem ); + } + break; + } case FN_REPLY: { if ( !pPostItMgr || |