diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-11-11 15:23:58 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2015-11-11 15:43:35 +0200 |
commit | 899453aa8407fca8a93d51f12ad4e335d1beeb62 (patch) | |
tree | 0f595cf8a9e0b93bc83f3661c1b24cf68eab786a | |
parent | 6128c10f550924c2b75f18b6c6220cc1770adba4 (diff) |
tdf#93837 Add context menu customization UI
Depends on env. variable for now. Nothing to
customize yet anyway.
Change-Id: I70edd33b51d931632fac454684d6c22906a727fe
-rw-r--r-- | cui/source/customize/cfg.cxx | 23 | ||||
-rw-r--r-- | cui/source/customize/cfg.src | 5 | ||||
-rw-r--r-- | cui/source/inc/cfg.hxx | 5 | ||||
-rw-r--r-- | cui/source/inc/cuires.hrc | 1 | ||||
-rw-r--r-- | cui/uiconfig/ui/customizedialog.ui | 22 |
5 files changed, 48 insertions, 8 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 6a823400dcfd..ba0829fa0bf1 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -739,6 +739,11 @@ VclPtr<SfxTabPage> CreateSvxMenuConfigPage( vcl::Window *pParent, const SfxItemS return VclPtr<SvxMenuConfigPage>::Create( pParent, *rSet ); } +VclPtr<SfxTabPage> CreateSvxContextMenuConfigPage( vcl::Window *pParent, const SfxItemSet* rSet ) +{ + return VclPtr<SvxMenuConfigPage>::Create( pParent, *rSet, false ); +} + VclPtr<SfxTabPage> CreateKeyboardConfigPage( vcl::Window *pParent, const SfxItemSet* rSet ) { return VclPtr<SfxAcceleratorConfigPage>::Create( pParent, *rSet ); @@ -783,6 +788,7 @@ SvxConfigDialog::SvxConfigDialog(vcl::Window * pParent, const SfxItemSet* pInSet : SfxTabDialog(pParent, "CustomizeDialog", "cui/ui/customizedialog.ui", pInSet) , m_nMenusPageId(0) + , m_nContextMenusPageId(0) , m_nKeyboardPageId(0) , m_nToolbarsPageId(0) , m_nEventsPageId(0) @@ -790,6 +796,10 @@ SvxConfigDialog::SvxConfigDialog(vcl::Window * pParent, const SfxItemSet* pInSet InitImageType(); m_nMenusPageId = AddTabPage("menus", CreateSvxMenuConfigPage, nullptr); + if ( getenv("LO_USE_NEWCONTEXTMENU") ) + m_nContextMenusPageId = AddTabPage("contextmenus", CreateSvxContextMenuConfigPage, nullptr); + else + RemoveTabPage("contextmenus"); m_nKeyboardPageId = AddTabPage("keyboard", CreateKeyboardConfigPage, nullptr); m_nToolbarsPageId = AddTabPage("toolbars", CreateSvxToolbarConfigPage, nullptr); m_nEventsPageId = AddTabPage("events", CreateSvxEventConfigPage, nullptr); @@ -819,7 +829,7 @@ void SvxConfigDialog::SetFrame(const css::uno::Reference< css::frame::XFrame >& void SvxConfigDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage ) { if (nId == m_nMenusPageId || nId == m_nKeyboardPageId || - nId == m_nToolbarsPageId) + nId == m_nToolbarsPageId || nId == m_nContextMenusPageId) { rPage.SetFrame(m_xFrame); } @@ -2193,8 +2203,9 @@ bool SvxConfigPage::MoveEntryData( return false; } -SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) +SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSet, bool bIsMenuBar) : SvxConfigPage(pParent, rSet) + , m_bIsMenuBar( bIsMenuBar ) { m_pContentsListBox = VclPtr<SvxMenuEntriesListBox>::Create(m_pEntries, this); m_pContentsListBox->set_grid_left_attach(0); @@ -2231,6 +2242,14 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe m_pModifyCommandButton->SetSelectHdl( LINK( this, SvxMenuConfigPage, EntrySelectHdl ) ); + + if ( !bIsMenuBar ) + { + m_pTopLevel->set_label( CUI_RES( RID_SVXSTR_PRODUCTNAME_CONTEXTMENUS ) ); + m_pNewTopLevelButton->Hide(); + pMenu->HideItem( pMenu->GetItemId( "move" ) ); + pMenu->HideItem( pMenu->GetItemId( "menuitem3" ) ); + } } SvxMenuConfigPage::~SvxMenuConfigPage() diff --git a/cui/source/customize/cfg.src b/cui/source/customize/cfg.src index fed45bd2b405..0ac1b96317fc 100644 --- a/cui/source/customize/cfg.src +++ b/cui/source/customize/cfg.src @@ -192,6 +192,11 @@ String RID_SVXSTR_PRODUCTNAME_TOOLBARS Text [ en-US ] = "%PRODUCTNAME %MODULENAME Toolbars" ; }; +String RID_SVXSTR_PRODUCTNAME_CONTEXTMENUS +{ + Text [ en-US ] = "%PRODUCTNAME %MODULENAME Context Menus" ; +}; + String RID_SVXSTR_TOOLBAR { Text [ en-US ] = "Toolbar" ; diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index f4bb1df273bd..b4cbaa0ff54f 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -59,6 +59,7 @@ class SvxConfigDialog : public SfxTabDialog private: css::uno::Reference< css::frame::XFrame > m_xFrame; sal_uInt16 m_nMenusPageId; + sal_uInt16 m_nContextMenusPageId; sal_uInt16 m_nKeyboardPageId; sal_uInt16 m_nToolbarsPageId; sal_uInt16 m_nEventsPageId; @@ -439,7 +440,7 @@ public: class SvxMenuConfigPage : public SvxConfigPage { private: - + bool m_bIsMenuBar; DECL_LINK_TYPED( SelectMenu, ListBox&, void ); DECL_LINK_TYPED( SelectMenuEntry, SvTreeListBox *, void ); DECL_LINK_TYPED( NewMenuHdl, Button *, void ); @@ -455,7 +456,7 @@ private: void DeleteSelectedTopLevel() override; public: - SvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet ); + SvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet, bool bIsMenuBar = true ); virtual ~SvxMenuConfigPage(); virtual void dispose() override; diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc index 6f8df14a3011..e99045d584ce 100644 --- a/cui/source/inc/cuires.hrc +++ b/cui/source/inc/cuires.hrc @@ -238,6 +238,7 @@ #define RID_SVXDLG_CUSTOMIZE (RID_SVX_START + 291) #define RID_SVXPAGE_CONFIGGROUPBOX (RID_SVX_START + 304) +#define RID_SVXSTR_PRODUCTNAME_CONTEXTMENUS (RID_SVX_START + 1167) #define RID_SVXSTR_NEW_MENU (RID_SVX_START + 1039) #define RID_SVXSTR_NEW_TOOLBAR (RID_SVX_START + 1040) #define RID_SVXSTR_MOVE_MENU (RID_SVX_START + 1041) diff --git a/cui/uiconfig/ui/customizedialog.ui b/cui/uiconfig/ui/customizedialog.ui index 7d9f6b4ebe2d..a3223dc0e7ad 100644 --- a/cui/uiconfig/ui/customizedialog.ui +++ b/cui/uiconfig/ui/customizedialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.19.0 --> <interface> <requires lib="gtk+" version="3.0"/> <object class="GtkDialog" id="CustomizeDialog"> @@ -107,13 +107,27 @@ <placeholder/> </child> <child type="tab"> + <object class="GtkLabel" id="contextmenus"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Context Menus</property> + </object> + <packing> + <property name="position">1</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> <object class="GtkLabel" id="keyboard"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">Keyboard</property> </object> <packing> - <property name="position">1</property> + <property name="position">2</property> <property name="tab_fill">False</property> </packing> </child> @@ -127,7 +141,7 @@ <property name="label" translatable="yes">Toolbars</property> </object> <packing> - <property name="position">2</property> + <property name="position">3</property> <property name="tab_fill">False</property> </packing> </child> @@ -141,7 +155,7 @@ <property name="label" translatable="yes">Events</property> </object> <packing> - <property name="position">3</property> + <property name="position">4</property> <property name="tab_fill">False</property> </packing> </child> |