Kaydet (Commit) 899453aa authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

tdf#93837 Add context menu customization UI

Depends on env. variable for now. Nothing to
customize yet anyway.

Change-Id: I70edd33b51d931632fac454684d6c22906a727fe
üst 6128c10f
......@@ -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()
......
......@@ -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" ;
......
......@@ -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;
......
......@@ -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)
......
<?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">
......@@ -106,6 +106,20 @@
<child>
<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>
......@@ -113,7 +127,7 @@
<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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment