diff options
author | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2018-04-12 21:53:29 +0300 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-04-17 09:59:42 +0200 |
commit | 66ed9797ba8f61994a187dfcc189f375dcd0cdcc (patch) | |
tree | 19dadc10a843b9d4b906b116b6c888af5b8e0c19 | |
parent | 3564b46992fc30e212011c19043a2553178ccbca (diff) |
Simplify calls to Menu::CheckItem
in cui, dbaccess, vcl, sc, sd
Change-Id: I328d81cf6cd5a7e31fb21a758e4b2670e7df1b91
Reviewed-on: https://gerrit.libreoffice.org/52797
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r-- | cui/source/customize/SvxToolbarConfigPage.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WTypeSelect.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TEditControl.cxx | 2 | ||||
-rw-r--r-- | include/vcl/menu.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/navipi/content.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationDialog.cxx | 32 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationList.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationmanager.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 5 |
12 files changed, 46 insertions, 40 deletions
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx index dfa1e000d7c7..b07b84d73f67 100644 --- a/cui/source/customize/SvxToolbarConfigPage.cxx +++ b/cui/source/customize/SvxToolbarConfigPage.cxx @@ -825,17 +825,17 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectToolbar, ListBox&, void ) { case 0: { - pGearMenu->CheckItem( pGearMenu->GetItemId("gear_iconOnly") ); + pGearMenu->CheckItem( "gear_iconOnly" ); break; } case 1: { - pGearMenu->CheckItem( pGearMenu->GetItemId("gear_textOnly") ); + pGearMenu->CheckItem( "gear_textOnly" ); break; } case 2: { - pGearMenu->CheckItem( pGearMenu->GetItemId("gear_iconAndText") ); + pGearMenu->CheckItem( "gear_iconAndText" ); break; } } diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index 1ac0fe566412..42f25cb2cf12 100644 --- a/dbaccess/source/ui/misc/WTypeSelect.cxx +++ b/dbaccess/source/ui/misc/WTypeSelect.cxx @@ -445,7 +445,7 @@ bool OWizTypeSelectList::PreNotify( NotifyEvent& rEvt ) } if (bCheckOk) - aContextMenu->CheckItem(aContextMenu->GetItemId("primarykey")); + aContextMenu->CheckItem("primarykey"); if (aContextMenu->Execute(this, ptWhere)) { diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 94a6897bde6d..39f1c0a5866e 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1958,10 +1958,10 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt) { VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/queryfuncmenu.ui", ""); VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu")); - aContextMenu->CheckItem(aContextMenu->GetItemId("functions"), m_bVisibleRow[BROW_FUNCTION_ROW]); - aContextMenu->CheckItem(aContextMenu->GetItemId("tablename"), m_bVisibleRow[BROW_TABLE_ROW]); - aContextMenu->CheckItem(aContextMenu->GetItemId("alias"), m_bVisibleRow[BROW_COLUMNALIAS_ROW]); - aContextMenu->CheckItem(aContextMenu->GetItemId("distinct"), static_cast<OQueryController&>(getDesignView()->getController()).isDistinct()); + aContextMenu->CheckItem("functions", m_bVisibleRow[BROW_FUNCTION_ROW]); + aContextMenu->CheckItem("tablename", m_bVisibleRow[BROW_TABLE_ROW]); + aContextMenu->CheckItem("alias", m_bVisibleRow[BROW_COLUMNALIAS_ROW]); + aContextMenu->CheckItem("distinct", static_cast<OQueryController&>(getDesignView()->getController()).isDistinct()); aContextMenu->Execute(this, aMenuPos); diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index f68fc597d516..841ab7ba8161 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -1368,7 +1368,7 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt) aContextMenu->EnableItem(aContextMenu->GetItemId("delete"), IsDeleteAllowed(nRow)); aContextMenu->EnableItem(aContextMenu->GetItemId("primarykey"), IsPrimaryKeyAllowed(nRow)); aContextMenu->EnableItem(aContextMenu->GetItemId("insert"), IsInsertNewAllowed(nRow)); - aContextMenu->CheckItem(aContextMenu->GetItemId("primarykey"), IsRowSelected(GetCurRow()) && IsPrimaryKey()); + aContextMenu->CheckItem("primarykey", IsRowSelected(GetCurRow()) && IsPrimaryKey()); // remove all the disable entries aContextMenu->RemoveDisabledEntries(true, true); diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 06a2e38680c6..b55a5338a91d 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -277,6 +277,7 @@ public: vcl::KeyCode GetAccelKey( sal_uInt16 nItemId ) const; void CheckItem( sal_uInt16 nItemId, bool bCheck = true ); + void CheckItem( const OString &rIdent, bool bCheck = true ); bool IsItemChecked( sal_uInt16 nItemId ) const; virtual void SelectItem(sal_uInt16 nItemId) = 0; diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 9ef08f34ee91..34df68b39cd9 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -609,13 +609,13 @@ void ScContentTree::Command( const CommandEvent& rCEvt ) switch (pParentWindow->GetDropMode()) { case 0: - aDropMenu->CheckItem(aDropMenu->GetItemId("hyperlink")); + aDropMenu->CheckItem("hyperlink"); break; case 1: - aDropMenu->CheckItem(aDropMenu->GetItemId("link")); + aDropMenu->CheckItem("link"); break; case 2: - aDropMenu->CheckItem(aDropMenu->GetItemId("copy")); + aDropMenu->CheckItem("copy"); break; } diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 90851ec16417..dc7a07ecc42d 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -372,13 +372,13 @@ IMPL_LINK(ScNavigatorDlg, ToolBoxDropdownClickHdl, ToolBox *, pToolBox, void) switch (GetDropMode()) { case 0: - aPop->CheckItem(aPop->GetItemId("hyperlink")); + aPop->CheckItem("hyperlink"); break; case 1: - aPop->CheckItem(aPop->GetItemId("link")); + aPop->CheckItem("link"); break; case 2: - aPop->CheckItem(aPop->GetItemId("copy")); + aPop->CheckItem("copy"); break; } diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 457ab8c8ba9e..72df60f6dab4 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -637,13 +637,13 @@ void RotationPropertyBox::updateMenu() bool bDirection = nValue >= 0; nValue = (nValue < 0 ? -nValue : nValue); - mpMenu->CheckItem(mpMenu->GetItemId("90"), nValue == 90); - mpMenu->CheckItem(mpMenu->GetItemId("180"), nValue == 180); - mpMenu->CheckItem(mpMenu->GetItemId("360"), nValue == 360); - mpMenu->CheckItem(mpMenu->GetItemId("720"), nValue == 720); + mpMenu->CheckItem("90", nValue == 90); + mpMenu->CheckItem("180", nValue == 180); + mpMenu->CheckItem("360", nValue == 360); + mpMenu->CheckItem("720", nValue == 720); - mpMenu->CheckItem(mpMenu->GetItemId("closewise"), bDirection); - mpMenu->CheckItem(mpMenu->GetItemId("counterclock"), !bDirection); + mpMenu->CheckItem("closewise", bDirection); + mpMenu->CheckItem("counterclock", !bDirection); } IMPL_LINK_NOARG(RotationPropertyBox, implModifyHdl, Edit&, void) @@ -754,14 +754,14 @@ void ScalePropertyBox::updateMenu() { sal_Int64 nValue = mpMetric->GetValue(); - mpMenu->CheckItem(mpMenu->GetItemId("25"), nValue == 25); - mpMenu->CheckItem(mpMenu->GetItemId("50"), nValue == 50); - mpMenu->CheckItem(mpMenu->GetItemId("150"), nValue == 150); - mpMenu->CheckItem(mpMenu->GetItemId("400"), nValue == 400); + mpMenu->CheckItem("25", nValue == 25); + mpMenu->CheckItem("50", nValue == 50); + mpMenu->CheckItem("150", nValue == 150); + mpMenu->CheckItem("400", nValue == 400); - mpMenu->CheckItem(mpMenu->GetItemId("hori"), mnDirection == 1); - mpMenu->CheckItem(mpMenu->GetItemId("vert"), mnDirection == 2); - mpMenu->CheckItem(mpMenu->GetItemId("both"), mnDirection == 3); + mpMenu->CheckItem("hori", mnDirection == 1); + mpMenu->CheckItem("vert", mnDirection == 2); + mpMenu->CheckItem("both", mnDirection == 3); } IMPL_LINK_NOARG(ScalePropertyBox, implModifyHdl, Edit&, void) @@ -928,9 +928,9 @@ FontStylePropertyBox::~FontStylePropertyBox() void FontStylePropertyBox::update() { // update menu - mpMenu->CheckItem(mpMenu->GetItemId("bold"), mfFontWeight == awt::FontWeight::BOLD); - mpMenu->CheckItem(mpMenu->GetItemId("italic"), meFontSlant == awt::FontSlant_ITALIC); - mpMenu->CheckItem(mpMenu->GetItemId("underline"), mnFontUnderline != awt::FontUnderline::NONE ); + mpMenu->CheckItem("bold", mfFontWeight == awt::FontWeight::BOLD); + mpMenu->CheckItem("italic", meFontSlant == awt::FontSlant_ITALIC); + mpMenu->CheckItem("underline", mnFontUnderline != awt::FontUnderline::NONE ); // update sample edit vcl::Font aFont( mpEdit->GetFont() ); diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 5008b9f631ea..59de6e7e1811 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -904,9 +904,9 @@ VclPtr<PopupMenu> CustomAnimationList::CreateContextMenu() pEntry = static_cast< CustomAnimationListEntry* >(NextSelected( pEntry )); } - mxMenu->CheckItem(mxMenu->GetItemId("onclick"), nNodeType == EffectNodeType::ON_CLICK); - mxMenu->CheckItem(mxMenu->GetItemId("withprev"), nNodeType == EffectNodeType::WITH_PREVIOUS); - mxMenu->CheckItem(mxMenu->GetItemId("afterprev"), nNodeType == EffectNodeType::AFTER_PREVIOUS); + mxMenu->CheckItem("onclick", nNodeType == EffectNodeType::ON_CLICK); + mxMenu->CheckItem("withprev", nNodeType == EffectNodeType::WITH_PREVIOUS); + mxMenu->CheckItem("afterprev", nNodeType == EffectNodeType::AFTER_PREVIOUS); mxMenu->EnableItem(mxMenu->GetItemId("options"), nEntries == 1); mxMenu->EnableItem(mxMenu->GetItemId("timing"), nEntries == 1); diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index bdf41e19a65b..dfd97e4a057a 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -1122,25 +1122,25 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( const Reference< XAnno if ( aSet.GetItemState( EE_CHAR_WEIGHT ) == SfxItemState::SET ) { if( aSet.Get( EE_CHAR_WEIGHT ).GetWeight() == WEIGHT_BOLD ) - pMenu->CheckItem(pMenu->GetItemId("bold")); + pMenu->CheckItem("bold"); } if ( aSet.GetItemState( EE_CHAR_ITALIC ) == SfxItemState::SET ) { if( aSet.Get( EE_CHAR_ITALIC ).GetPosture() != ITALIC_NONE ) - pMenu->CheckItem(pMenu->GetItemId("italic")); + pMenu->CheckItem("italic"); } if ( aSet.GetItemState( EE_CHAR_UNDERLINE ) == SfxItemState::SET ) { if( aSet.Get( EE_CHAR_UNDERLINE ).GetLineStyle() != LINESTYLE_NONE ) - pMenu->CheckItem(pMenu->GetItemId("underline")); + pMenu->CheckItem("underline"); } if ( aSet.GetItemState( EE_CHAR_STRIKEOUT ) == SfxItemState::SET ) { if( aSet.Get( EE_CHAR_STRIKEOUT ).GetStrikeout() != STRIKEOUT_NONE ) - pMenu->CheckItem(pMenu->GetItemId("strike")); + pMenu->CheckItem("strike"); } TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pAnnotationWindow ) ); pMenu->EnableItem(pMenu->GetItemId("paste"), aDataHelper.GetFormatCount() != 0); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index aade2af55ce0..b3c78d89978e 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -1930,7 +1930,7 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void) VclPtr<PopupMenu> pMenu(aBuilder.get_menu("menu")); // Adding button to display if in Pen mode - pMenu->CheckItem(pMenu->GetItemId("pen"), mbUsePen); + pMenu->CheckItem("pen", mbUsePen); const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); pMenu->EnableItem(pMenu->GetItemId("next"), mpSlideController->getNextSlideIndex() != -1); @@ -1996,7 +1996,7 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void) PopupMenu* pBlankMenu = pMenu->GetPopupMenu(pMenu->GetItemId("screen")); if( pBlankMenu ) { - pBlankMenu->CheckItem((mpShowWindow->GetBlankColor() == COL_WHITE) ? pBlankMenu->GetItemId("white") : pBlankMenu->GetItemId("black")); + pBlankMenu->CheckItem((mpShowWindow->GetBlankColor() == COL_WHITE) ? "white" : "black"); } } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 6c6c4715047e..aea9e2dbab7b 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -905,6 +905,11 @@ void Menu::CheckItem( sal_uInt16 nItemId, bool bCheck ) ImplCallEventListeners( bCheck ? VclEventId::MenuItemChecked : VclEventId::MenuItemUnchecked, nPos ); } +void Menu::CheckItem( const OString &rIdent , bool bCheck ) +{ + CheckItem( GetItemId( rIdent ), bCheck ); +} + bool Menu::IsItemChecked( sal_uInt16 nItemId ) const { size_t nPos; |