diff options
-rw-r--r-- | include/svx/fmresids.hrc | 1 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 1 | ||||
-rw-r--r-- | svx/inc/fmhelp.hrc | 1 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 39 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.src | 24 | ||||
-rw-r--r-- | svx/uiconfig/ui/rowsmenu.ui | 30 |
6 files changed, 47 insertions, 49 deletions
diff --git a/include/svx/fmresids.hrc b/include/svx/fmresids.hrc index 320920e29e87..318cdd6d85c3 100644 --- a/include/svx/fmresids.hrc +++ b/include/svx/fmresids.hrc @@ -63,7 +63,6 @@ // Menu-Id's ----------------------------------------------------------- #define RID_FMEXPLORER_POPUPMENU (RID_FORMS_START + 0) -#define RID_SVXMNU_ROWS (RID_FORMS_START + 1) #define RID_SVXMNU_COLS (RID_FORMS_START + 2) #define RID_SVXMNU_CELL (RID_FORMS_START + 3) #define RID_FMSHELL_CONVERSIONMENU (RID_FORMS_START + 4) diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index 6223380663a1..278100146ffe 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -70,6 +70,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/redlinecontrol \ svx/uiconfig/ui/redlinefilterpage \ svx/uiconfig/ui/redlineviewpage \ + svx/uiconfig/ui/rowsmenu \ svx/uiconfig/ui/rulermenu \ svx/uiconfig/ui/safemodedialog \ svx/uiconfig/ui/savemodifieddialog \ diff --git a/svx/inc/fmhelp.hrc b/svx/inc/fmhelp.hrc index 8cc34fcb29f0..5a1f072407ce 100644 --- a/svx/inc/fmhelp.hrc +++ b/svx/inc/fmhelp.hrc @@ -39,7 +39,6 @@ #define HID_XFORMS_TOOLBOX_ITEM_EDIT "SVX_HID_XFORMS_TOOLBOX_ITEM_EDIT" #define HID_XFORMS_TOOLBOX_ITEM_REMOVE "SVX_HID_XFORMS_TOOLBOX_ITEM_REMOVE" #define HID_XFORMS_MID_INSERT_CONTROL "SVX_HID_XFORMS_MID_INSERT_CONTROL" -#define HID_FM_DELETEROWS "SVX_HID_FM_DELETEROWS" #define HID_FM_INSERTCOL "SVX_HID_FM_INSERTCOL" #define HID_FM_CHANGECOL "SVX_HID_FM_CHANGECOL" #define HID_FM_DELETECOL "SVX_HID_FM_DELETECOL" diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 275b19b96910..c4ee149afe30 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -44,6 +44,7 @@ #include <tools/resid.hxx> #include <tools/diagnose_ex.h> #include <tools/fract.hxx> +#include <vcl/builder.hxx> #include <vcl/menu.hxx> #include <vcl/settings.hxx> @@ -2698,8 +2699,8 @@ void DbGridControl::PreExecuteRowContextMenu(sal_uInt16 /*nRow*/, PopupMenu& rMe // if only a blank row is selected than do not delete bDelete = bDelete && !((m_nOptions & DbGridControlOptions::Insert) && GetSelectRowCount() == 1 && IsRowSelected(GetRowCount() - 1)); - rMenu.EnableItem(SID_FM_DELETEROWS, bDelete); - rMenu.EnableItem(SID_FM_RECORD_SAVE, IsModified()); + rMenu.EnableItem(rMenu.GetItemId("delete"), bDelete); + rMenu.EnableItem(rMenu.GetItemId("save"), IsModified()); // the undo is more difficult bool bCanUndo = IsModified(); @@ -2708,28 +2709,22 @@ void DbGridControl::PreExecuteRowContextMenu(sal_uInt16 /*nRow*/, PopupMenu& rMe nState = m_aMasterStateProvider.Call(DbGridControlNavigationBarState::Undo); bCanUndo &= ( 0 != nState ); - rMenu.EnableItem(SID_FM_RECORD_UNDO, bCanUndo); + rMenu.EnableItem(rMenu.GetItemId("undo"), bCanUndo); } -void DbGridControl::PostExecuteRowContextMenu(sal_uInt16 /*nRow*/, const PopupMenu& /*rMenu*/, sal_uInt16 nExecutionResult) +void DbGridControl::PostExecuteRowContextMenu(sal_uInt16 /*nRow*/, const PopupMenu& rMenu, sal_uInt16 nExecutionResult) { - switch (nExecutionResult) + if (nExecutionResult == rMenu.GetItemId("delete")) { - case SID_FM_DELETEROWS: - // delete asynchronously - if (m_nDeleteEvent) - Application::RemoveUserEvent(m_nDeleteEvent); - m_nDeleteEvent = Application::PostUserEvent(LINK(this,DbGridControl,OnDelete), nullptr, true); - break; - case SID_FM_RECORD_UNDO: - Undo(); - break; - case SID_FM_RECORD_SAVE: - SaveRow(); - break; - default: - break; + // delete asynchronously + if (m_nDeleteEvent) + Application::RemoveUserEvent(m_nDeleteEvent); + m_nDeleteEvent = Application::PostUserEvent(LINK(this,DbGridControl,OnDelete), nullptr, true); } + else if (nExecutionResult == rMenu.GetItemId("undo")) + Undo(); + else if (nExecutionResult == rMenu.GetItemId("save")) + SaveRow(); } void DbGridControl::DataSourcePropertyChanged(const PropertyChangeEvent& evt) @@ -2822,14 +2817,12 @@ void DbGridControl::copyCellText(sal_Int32 _nRow, sal_uInt16 _nColId) void DbGridControl::executeRowContextMenu( long _nRow, const Point& _rPreferredPos ) { - ScopedVclPtrInstance<PopupMenu> aContextMenu( SVX_RES( RID_SVXMNU_ROWS ) ); + VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/rowsmenu.ui", ""); + VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu")); PreExecuteRowContextMenu( (sal_uInt16)_nRow, *aContextMenu.get() ); aContextMenu->RemoveDisabledEntries( true, true ); PostExecuteRowContextMenu( (sal_uInt16)_nRow, *aContextMenu.get(), aContextMenu->Execute( this, _rPreferredPos ) ); - - // TODO: why this weird cast to sal_uInt16? What if we really have more than 65535 lines? - // -> change this to sal_uInt32 } void DbGridControl::Command(const CommandEvent& rEvt) diff --git a/svx/source/fmcomp/gridctrl.src b/svx/source/fmcomp/gridctrl.src index 112f77f6161a..b5365864420e 100644 --- a/svx/source/fmcomp/gridctrl.src +++ b/svx/source/fmcomp/gridctrl.src @@ -22,30 +22,6 @@ #include "fmhelp.hrc" #include <svx/svxcommands.h> -Menu RID_SVXMNU_ROWS -{ - ItemList = - { - MenuItem - { - Identifier = SID_FM_DELETEROWS ; - HelpId = HID_FM_DELETEROWS ; - Text [ en-US ] = "Delete Rows" ; - }; - MenuItem - { - Identifier = SID_FM_RECORD_SAVE ; - HelpId = CMD_SID_FM_RECORD_SAVE ; - Text [ en-US ] = "Save Record" ; - }; - MenuItem - { - Identifier = SID_FM_RECORD_UNDO ; - HelpId = CMD_SID_FM_RECORD_UNDO ; - Text [ en-US ] = "Undo: Data entry" ; - }; - }; -}; Menu RID_SVXMNU_COLS { ItemList = diff --git a/svx/uiconfig/ui/rowsmenu.ui b/svx/uiconfig/ui/rowsmenu.ui new file mode 100644 index 000000000000..210add5c4389 --- /dev/null +++ b/svx/uiconfig/ui/rowsmenu.ui @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.0 --> +<interface> + <requires lib="gtk+" version="3.10"/> + <object class="GtkMenu" id="menu"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuItem" id="delete"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Delete Rows</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="save"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Save Record</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="undo"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Undo: Data entry</property> + </object> + </child> + </object> +</interface> |