diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-08 21:37:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-11 14:10:30 +0100 |
commit | 1692998399eecb79e7b59456cff805bcb77aece4 (patch) | |
tree | 8cc22c633e88f19c39f5736e87a0934f041729de /sw/source/uibase/ribbar/inputwin.cxx | |
parent | 665a2b477dd4f412b42ffb58a183f7a702cd7645 (diff) |
use strong_int for item ids in vcl::ToolBox
(*) fix bug in SfxToolBoxControl::StateChanged where it was using the slot id
instead of the toolbox item id
(*) I left the logic in SbaTableQueryBrowser alone, but it looks suspicious,
casting slot ids to toolbox ids
Change-Id: Ied229164c27fb4456b0515c6fdcbd1682766a1a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112186
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/ribbar/inputwin.cxx')
-rw-r--r-- | sw/source/uibase/ribbar/inputwin.cxx | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index e4135fd7f6d4..5ba12dec0e76 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -54,8 +54,11 @@ #include <IDocumentContentOperations.hxx> -#define ED_POS 2 -#define ED_FORMULA 3 +constexpr ToolBoxItemId ED_POS(2); +constexpr ToolBoxItemId ED_FORMULA(3); +constexpr ToolBoxItemId FN_FORMULA_CALC(FN_FORMAT + 156); /* select formula */ +constexpr ToolBoxItemId FN_FORMULA_CANCEL(FN_FORMAT + 157); /* don't apply formula */ +constexpr ToolBoxItemId FN_FORMULA_APPLY(FN_FORMAT + 158); /* apply formula */ SFX_IMPL_POS_CHILDWINDOW_WITHID( SwInputChild, FN_EDIT_FORMULA, SFX_OBJECTBAR_OBJECT ) @@ -297,7 +300,7 @@ void SwInputWindow::MenuHdl(std::string_view command) IMPL_LINK_NOARG(SwInputWindow, DropdownClickHdl, ToolBox *, void) { - sal_uInt16 nCurID = GetCurItemId(); + ToolBoxItemId nCurID = GetCurItemId(); EndSelection(); // reset back CurItemId ! if (nCurID == FN_FORMULA_CALC) { @@ -311,21 +314,16 @@ IMPL_LINK_NOARG(SwInputWindow, DropdownClickHdl, ToolBox *, void) void SwInputWindow::Click( ) { - sal_uInt16 nCurID = GetCurItemId(); + ToolBoxItemId nCurID = GetCurItemId(); EndSelection(); // reset back CurItemId ! - switch ( nCurID ) + if ( nCurID == FN_FORMULA_CANCEL ) { - case FN_FORMULA_CANCEL: - { - CancelFormula(); - } - break; - case FN_FORMULA_APPLY: - { - ApplyFormula(); - } - break; - } + CancelFormula(); + } + else if (nCurID == FN_FORMULA_APPLY) + { + ApplyFormula(); + } } void SwInputWindow::ApplyFormula() |