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 ...@@ -739,6 +739,11 @@ VclPtr<SfxTabPage> CreateSvxMenuConfigPage( vcl::Window *pParent, const SfxItemS
return VclPtr<SvxMenuConfigPage>::Create( pParent, *rSet ); 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 ) VclPtr<SfxTabPage> CreateKeyboardConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
{ {
return VclPtr<SfxAcceleratorConfigPage>::Create( pParent, *rSet ); return VclPtr<SfxAcceleratorConfigPage>::Create( pParent, *rSet );
...@@ -783,6 +788,7 @@ SvxConfigDialog::SvxConfigDialog(vcl::Window * pParent, const SfxItemSet* pInSet ...@@ -783,6 +788,7 @@ SvxConfigDialog::SvxConfigDialog(vcl::Window * pParent, const SfxItemSet* pInSet
: SfxTabDialog(pParent, "CustomizeDialog", : SfxTabDialog(pParent, "CustomizeDialog",
"cui/ui/customizedialog.ui", pInSet) "cui/ui/customizedialog.ui", pInSet)
, m_nMenusPageId(0) , m_nMenusPageId(0)
, m_nContextMenusPageId(0)
, m_nKeyboardPageId(0) , m_nKeyboardPageId(0)
, m_nToolbarsPageId(0) , m_nToolbarsPageId(0)
, m_nEventsPageId(0) , m_nEventsPageId(0)
...@@ -790,6 +796,10 @@ SvxConfigDialog::SvxConfigDialog(vcl::Window * pParent, const SfxItemSet* pInSet ...@@ -790,6 +796,10 @@ SvxConfigDialog::SvxConfigDialog(vcl::Window * pParent, const SfxItemSet* pInSet
InitImageType(); InitImageType();
m_nMenusPageId = AddTabPage("menus", CreateSvxMenuConfigPage, nullptr); 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_nKeyboardPageId = AddTabPage("keyboard", CreateKeyboardConfigPage, nullptr);
m_nToolbarsPageId = AddTabPage("toolbars", CreateSvxToolbarConfigPage, nullptr); m_nToolbarsPageId = AddTabPage("toolbars", CreateSvxToolbarConfigPage, nullptr);
m_nEventsPageId = AddTabPage("events", CreateSvxEventConfigPage, nullptr); m_nEventsPageId = AddTabPage("events", CreateSvxEventConfigPage, nullptr);
...@@ -819,7 +829,7 @@ void SvxConfigDialog::SetFrame(const css::uno::Reference< css::frame::XFrame >& ...@@ -819,7 +829,7 @@ void SvxConfigDialog::SetFrame(const css::uno::Reference< css::frame::XFrame >&
void SvxConfigDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage ) void SvxConfigDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage )
{ {
if (nId == m_nMenusPageId || nId == m_nKeyboardPageId || if (nId == m_nMenusPageId || nId == m_nKeyboardPageId ||
nId == m_nToolbarsPageId) nId == m_nToolbarsPageId || nId == m_nContextMenusPageId)
{ {
rPage.SetFrame(m_xFrame); rPage.SetFrame(m_xFrame);
} }
...@@ -2193,8 +2203,9 @@ bool SvxConfigPage::MoveEntryData( ...@@ -2193,8 +2203,9 @@ bool SvxConfigPage::MoveEntryData(
return false; return false;
} }
SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSet, bool bIsMenuBar)
: SvxConfigPage(pParent, rSet) : SvxConfigPage(pParent, rSet)
, m_bIsMenuBar( bIsMenuBar )
{ {
m_pContentsListBox = VclPtr<SvxMenuEntriesListBox>::Create(m_pEntries, this); m_pContentsListBox = VclPtr<SvxMenuEntriesListBox>::Create(m_pEntries, this);
m_pContentsListBox->set_grid_left_attach(0); m_pContentsListBox->set_grid_left_attach(0);
...@@ -2231,6 +2242,14 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe ...@@ -2231,6 +2242,14 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe
m_pModifyCommandButton->SetSelectHdl( m_pModifyCommandButton->SetSelectHdl(
LINK( this, SvxMenuConfigPage, EntrySelectHdl ) ); 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() SvxMenuConfigPage::~SvxMenuConfigPage()
......
...@@ -192,6 +192,11 @@ String RID_SVXSTR_PRODUCTNAME_TOOLBARS ...@@ -192,6 +192,11 @@ String RID_SVXSTR_PRODUCTNAME_TOOLBARS
Text [ en-US ] = "%PRODUCTNAME %MODULENAME Toolbars" ; Text [ en-US ] = "%PRODUCTNAME %MODULENAME Toolbars" ;
}; };
String RID_SVXSTR_PRODUCTNAME_CONTEXTMENUS
{
Text [ en-US ] = "%PRODUCTNAME %MODULENAME Context Menus" ;
};
String RID_SVXSTR_TOOLBAR String RID_SVXSTR_TOOLBAR
{ {
Text [ en-US ] = "Toolbar" ; Text [ en-US ] = "Toolbar" ;
......
...@@ -59,6 +59,7 @@ class SvxConfigDialog : public SfxTabDialog ...@@ -59,6 +59,7 @@ class SvxConfigDialog : public SfxTabDialog
private: private:
css::uno::Reference< css::frame::XFrame > m_xFrame; css::uno::Reference< css::frame::XFrame > m_xFrame;
sal_uInt16 m_nMenusPageId; sal_uInt16 m_nMenusPageId;
sal_uInt16 m_nContextMenusPageId;
sal_uInt16 m_nKeyboardPageId; sal_uInt16 m_nKeyboardPageId;
sal_uInt16 m_nToolbarsPageId; sal_uInt16 m_nToolbarsPageId;
sal_uInt16 m_nEventsPageId; sal_uInt16 m_nEventsPageId;
...@@ -439,7 +440,7 @@ public: ...@@ -439,7 +440,7 @@ public:
class SvxMenuConfigPage : public SvxConfigPage class SvxMenuConfigPage : public SvxConfigPage
{ {
private: private:
bool m_bIsMenuBar;
DECL_LINK_TYPED( SelectMenu, ListBox&, void ); DECL_LINK_TYPED( SelectMenu, ListBox&, void );
DECL_LINK_TYPED( SelectMenuEntry, SvTreeListBox *, void ); DECL_LINK_TYPED( SelectMenuEntry, SvTreeListBox *, void );
DECL_LINK_TYPED( NewMenuHdl, Button *, void ); DECL_LINK_TYPED( NewMenuHdl, Button *, void );
...@@ -455,7 +456,7 @@ private: ...@@ -455,7 +456,7 @@ private:
void DeleteSelectedTopLevel() override; void DeleteSelectedTopLevel() override;
public: public:
SvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet ); SvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet, bool bIsMenuBar = true );
virtual ~SvxMenuConfigPage(); virtual ~SvxMenuConfigPage();
virtual void dispose() override; virtual void dispose() override;
......
...@@ -238,6 +238,7 @@ ...@@ -238,6 +238,7 @@
#define RID_SVXDLG_CUSTOMIZE (RID_SVX_START + 291) #define RID_SVXDLG_CUSTOMIZE (RID_SVX_START + 291)
#define RID_SVXPAGE_CONFIGGROUPBOX (RID_SVX_START + 304) #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_MENU (RID_SVX_START + 1039)
#define RID_SVXSTR_NEW_TOOLBAR (RID_SVX_START + 1040) #define RID_SVXSTR_NEW_TOOLBAR (RID_SVX_START + 1040)
#define RID_SVXSTR_MOVE_MENU (RID_SVX_START + 1041) #define RID_SVXSTR_MOVE_MENU (RID_SVX_START + 1041)
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.19.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.0"/> <requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="CustomizeDialog"> <object class="GtkDialog" id="CustomizeDialog">
...@@ -106,6 +106,20 @@ ...@@ -106,6 +106,20 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </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"> <child type="tab">
<object class="GtkLabel" id="keyboard"> <object class="GtkLabel" id="keyboard">
<property name="visible">True</property> <property name="visible">True</property>
...@@ -113,7 +127,7 @@ ...@@ -113,7 +127,7 @@
<property name="label" translatable="yes">Keyboard</property> <property name="label" translatable="yes">Keyboard</property>
</object> </object>
<packing> <packing>
<property name="position">1</property> <property name="position">2</property>
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
</packing> </packing>
</child> </child>
...@@ -127,7 +141,7 @@ ...@@ -127,7 +141,7 @@
<property name="label" translatable="yes">Toolbars</property> <property name="label" translatable="yes">Toolbars</property>
</object> </object>
<packing> <packing>
<property name="position">2</property> <property name="position">3</property>
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
</packing> </packing>
</child> </child>
...@@ -141,7 +155,7 @@ ...@@ -141,7 +155,7 @@
<property name="label" translatable="yes">Events</property> <property name="label" translatable="yes">Events</property>
</object> </object>
<packing> <packing>
<property name="position">3</property> <property name="position">4</property>
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
</packing> </packing>
</child> </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