diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-12 09:58:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-12 09:58:28 +0100 |
commit | 3cee2b2d5823e83fbfa01b2987df2452f75fc777 (patch) | |
tree | bf20816eddac8cd8f95774a37e210a043383bc0c /svx/source/tbxctrls | |
parent | 24ccdd63b7a290a830bd15e552cc25c1981efeb0 (diff) |
convert style menu to .ui
Change-Id: I85683007062c4cc1160ace7b3bf962ee5c021b6e
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 34 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.src | 17 |
2 files changed, 18 insertions, 33 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index e21eb758fbee..e15a571fb1e2 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -169,7 +169,8 @@ private: OUString sDefaultStyle; bool bInSpecialMode; VclPtr<MenuButton> m_pButtons[MAX_STYLES_ENTRIES]; - ScopedVclPtr<PopupMenu> m_pMenu; + VclBuilder m_aBuilder; + VclPtr<PopupMenu> m_pMenu; void ReleaseFocus(); static Color TestColorsVisible(const Color &FontCol, const Color &BackCol); @@ -360,7 +361,8 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent, , aClearFormatKey( rClearFormatKey ) , aMoreKey( rMoreKey ) , bInSpecialMode( bInSpec ) - , m_pMenu( VclPtr<PopupMenu>::Create(SVX_RES( RID_SVX_STYLE_MENU )) ) + , m_aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/stylemenu.ui", "") + , m_pMenu(m_aBuilder.get_menu("menu")) { SetHelpId(HID_STYLE_LISTBOX); m_pMenu->SetSelectHdl( LINK( this, SvxStyleBox_Impl, MenuSelectHdl ) ); @@ -387,6 +389,9 @@ void SvxStyleBox_Impl::dispose() rButton.disposeAndClear(); } + m_pMenu.clear(); + m_aBuilder.disposeBuilder(); + ComboBox::dispose(); } @@ -404,7 +409,7 @@ void SvxStyleBox_Impl::ReleaseFocus() IMPL_LINK( SvxStyleBox_Impl, MenuSelectHdl, Menu*, pMenu, bool) { OUString sEntry = GetSelectEntry(); - sal_uInt16 nMenuId = pMenu->GetCurItemId(); + OString sMenuIdent = pMenu->GetCurItemIdent(); ReleaseFocus(); // It must be after getting entry pos! if (IsInDropDown()) ToggleDropDown(); @@ -414,20 +419,17 @@ IMPL_LINK( SvxStyleBox_Impl, MenuSelectHdl, Menu*, pMenu, bool) aArgs[1].Name = "Family"; aArgs[1].Value <<= sal_Int16( eStyleFamily ); - switch(nMenuId) { - case RID_SVX_UPDATE_STYLE: - { - SfxToolBoxControl::Dispatch( m_xDispatchProvider, - ".uno:StyleUpdateByExample", aArgs ); - break; - } - case RID_SVX_MODIFY_STYLE: - { - SfxToolBoxControl::Dispatch( m_xDispatchProvider, - ".uno:EditStyle", aArgs ); - break; - } + if (sMenuIdent == "update") + { + SfxToolBoxControl::Dispatch( m_xDispatchProvider, + ".uno:StyleUpdateByExample", aArgs ); } + else if (sMenuIdent == "edit") + { + SfxToolBoxControl::Dispatch( m_xDispatchProvider, + ".uno:EditStyle", aArgs ); + } + return false; } diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src index 6b22d064dce0..18bab3e22a08 100644 --- a/svx/source/tbxctrls/tbcontrl.src +++ b/svx/source/tbxctrls/tbcontrl.src @@ -114,23 +114,6 @@ String RID_SVXSTR_MOREBULLETS Text [ en-US ] = "More Bullets..." ; }; -Menu RID_SVX_STYLE_MENU -{ - ItemList = - { - MenuItem - { - Identifier = RID_SVX_UPDATE_STYLE ; - Text [ en-US ] = "Update to Match Selection" ; - }; - MenuItem - { - Identifier = RID_SVX_MODIFY_STYLE ; - Text [ en-US ] = "Edit Style..." ; - }; - }; -}; - String RID_SVXSTR_BY_AUTHOR { Text [ en-US ] = "By author"; |