diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-02-19 12:51:39 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-02-19 16:10:44 +0100 |
commit | 91dffd7424a4522440a84fca2262a1701aaf4e8b (patch) | |
tree | 5088b564613121571642d5dd30af1b09c6495ee3 /dbaccess | |
parent | 84a3b4d7635d0a5819e8b376efa4d47e74612739 (diff) |
weld rows menu
Change-Id: I0dd56e2c236b15b057ddd0f2d93019b783d457d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111218
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/inc/helpids.h | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/sbagrid.cxx | 44 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/sbagrid.hxx | 4 |
3 files changed, 20 insertions, 30 deletions
diff --git a/dbaccess/inc/helpids.h b/dbaccess/inc/helpids.h index 1af25532e2c1..459cc26bef6d 100644 --- a/dbaccess/inc/helpids.h +++ b/dbaccess/inc/helpids.h @@ -29,8 +29,6 @@ #define HID_BROWSER_COLUMNFORMAT "DBACCESS_HID_BROWSER_COLUMNFORMAT" #define HID_BROWSER_COLUMNWIDTH "DBACCESS_HID_BROWSER_COLUMNWIDTH" -#define HID_BROWSER_TABLEFORMAT "DBACCESS_HID_BROWSER_TABLEFORMAT" -#define HID_BROWSER_ROWHEIGHT "DBACCESS_HID_BROWSER_ROWHEIGHT" #define HID_CTL_QRYSQLEDIT "DBACCESS_HID_CTL_QRYSQLEDIT" diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index a78921935f6c..093f243ca738 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -666,7 +666,7 @@ CellController* SbaGridControl::GetController(sal_Int32 nRow, sal_uInt16 nCol) return FmGridControl::GetController(nRow, nCol); } -void SbaGridControl::PreExecuteRowContextMenu(PopupMenu& rMenu) +void SbaGridControl::PreExecuteRowContextMenu(weld::Menu& rMenu) { FmGridControl::PreExecuteRowContextMenu(rMenu); @@ -674,18 +674,18 @@ void SbaGridControl::PreExecuteRowContextMenu(PopupMenu& rMenu) if (!IsReadOnlyDB()) { - rMenu.InsertItem(ID_BROWSER_TABLEATTR, DBA_RES(RID_STR_TABLE_FORMAT), MenuItemBits::NONE, OString(), nPos++); - rMenu.SetHelpId(ID_BROWSER_TABLEATTR, HID_BROWSER_TABLEFORMAT); - - rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, DBA_RES(RID_STR_ROW_HEIGHT), MenuItemBits::NONE, OString(), nPos++); - rMenu.SetHelpId(ID_BROWSER_ROWHEIGHT, HID_BROWSER_ROWHEIGHT); - rMenu.InsertSeparator(OString(), nPos++); + rMenu.insert(nPos++, "tableattr", DBA_RES(RID_STR_TABLE_FORMAT), + nullptr, nullptr, nullptr, TRISTATE_INDET); + rMenu.insert(nPos++, "rowheight", DBA_RES(RID_STR_ROW_HEIGHT), + nullptr, nullptr, nullptr, TRISTATE_INDET); + rMenu.insert_separator(nPos++, "separator1"); } if ( GetSelectRowCount() > 0 ) { - rMenu.InsertItem(ID_BROWSER_COPY, DBA_RES(RID_STR_COPY), MenuItemBits::NONE, OString(), nPos++); - rMenu.InsertSeparator(OString(), nPos++); + rMenu.insert(nPos++, "copy", DBA_RES(RID_STR_COPY), + nullptr, nullptr, nullptr, TRISTATE_INDET); + rMenu.insert_separator(nPos++, "separator2"); } } @@ -821,24 +821,16 @@ void SbaGridControl::SetBrowserAttrs() } } -void SbaGridControl::PostExecuteRowContextMenu(const PopupMenu& rMenu, sal_uInt16 nExecutionResult) +void SbaGridControl::PostExecuteRowContextMenu(const OString& rExecutionResult) { - switch (nExecutionResult) - { - case ID_BROWSER_TABLEATTR: - SetBrowserAttrs(); - break; - case ID_BROWSER_ROWHEIGHT: - SetRowHeight(); - break; - case ID_BROWSER_COPY: - CopySelectedRowsToClipboard(); - break; - - default: - FmGridControl::PostExecuteRowContextMenu(rMenu, nExecutionResult); - break; - } + if (rExecutionResult == "tableattr") + SetBrowserAttrs(); + else if (rExecutionResult == "rowheight") + SetRowHeight(); + else if (rExecutionResult == "copy") + CopySelectedRowsToClipboard(); + else + FmGridControl::PostExecuteRowContextMenu(rExecutionResult); } void SbaGridControl::Select() diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx index 76759de963d7..2bef1cfbbcd2 100644 --- a/dbaccess/source/ui/inc/sbagrid.hxx +++ b/dbaccess/source/ui/inc/sbagrid.hxx @@ -252,8 +252,8 @@ namespace dbaui virtual ::svt::CellController* GetController(sal_Int32 nRow, sal_uInt16 nCol) override; // DbGridControl overridables - virtual void PreExecuteRowContextMenu(PopupMenu& rMenu) override; - virtual void PostExecuteRowContextMenu(const PopupMenu& rMenu, sal_uInt16 nExecutionResult) override; + virtual void PreExecuteRowContextMenu(weld::Menu& rMenu) override; + virtual void PostExecuteRowContextMenu(const OString& rExecutionResult) override; // DbGridControl overridables virtual void onRowChange() override; |