tdf#82840 Add radio buttons for toolbar styles

Add 'Icons Only', 'Text Only', and 'Icons & Text' radio buttons
to the 'Toolbar' tab of the 'Customize' dialog. And remove the
corresponding items from the 'Toolbar' menu button.

Also removed some unused literals and code pieces.

This patch is towards achieving the design and functionality
suggested in the related bug report.

Change-Id: I072b05ae64817e93c0dbd5fb434126b525c2fd48
Reviewed-on: https://gerrit.libreoffice.org/28773
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Muhammet Kara
2016-09-08 11:40:52 +03:00
committed by Samuel Mehrbrodt
parent 51e1f98e5a
commit 58abb0fd30
5 changed files with 163 additions and 82 deletions

View File

@@ -1746,6 +1746,10 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
get(m_pTopLevelListBox, "toplevellist");
get(m_pNewTopLevelButton, "toplevelbutton");
get(m_pModifyTopLevelButton, "menuedit");
get(m_pToolbarStyleLabel, "toolbarstyleft");
get(m_pIconsOnlyRB, "iconsrb");
get(m_pTextOnlyRB, "textrb");
get(m_pIconsAndTextRB, "iconsandtextrb");
get(m_pContents, "contents");
get(m_pContentsLabel, "contentslabel");
get(m_pAddCommandsButton, "add");
@@ -1769,6 +1773,14 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
// This button is applicable only for the toolbar config tab
m_pResetTopLevelButton->Enable( false );
m_pResetTopLevelButton->Hide();
//These radio buttons are applicable only for the toolbar config tab
m_pIconsOnlyRB->Enable( false );
m_pTextOnlyRB->Enable( false );
m_pIconsAndTextRB->Enable( false );
m_pIconsOnlyRB->Hide();
m_pTextOnlyRB->Hide();
m_pIconsAndTextRB->Hide();
m_pToolbarStyleLabel->Hide();
}
SvxConfigPage::~SvxConfigPage()
@@ -1783,6 +1795,10 @@ void SvxConfigPage::dispose()
m_pTopLevelListBox.clear();
m_pNewTopLevelButton.clear();
m_pModifyTopLevelButton.clear();
m_pToolbarStyleLabel.clear();
m_pIconsOnlyRB.clear();
m_pTextOnlyRB.clear();
m_pIconsAndTextRB.clear();
m_pContents.clear();
m_pContentsLabel.clear();
m_pEntries.clear();
@@ -3121,12 +3137,27 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
// The reset button will be used in the toolbar config tab
m_pResetTopLevelButton->Show();
// These radio buttons will be used in the toolbar config tab
m_pIconsOnlyRB->Enable();
m_pTextOnlyRB->Enable();
m_pIconsAndTextRB->Enable();
m_pIconsOnlyRB->Show();
m_pTextOnlyRB->Show();
m_pIconsAndTextRB->Show();
m_pToolbarStyleLabel->Show();
m_pTopLevelListBox->SetSelectHdl(
LINK( this, SvxToolbarConfigPage, SelectToolbar ) );
m_pContentsListBox->SetSelectHdl(
LINK( this, SvxToolbarConfigPage, SelectToolbarEntry ) );
m_pIconsOnlyRB->SetClickHdl (
LINK( this, SvxToolbarConfigPage, StyleChangeHdl ) );
m_pTextOnlyRB->SetClickHdl (
LINK( this, SvxToolbarConfigPage, StyleChangeHdl ) );
m_pIconsAndTextRB->SetClickHdl (
LINK( this, SvxToolbarConfigPage, StyleChangeHdl ) );
m_pNewTopLevelButton->SetClickHdl (
LINK( this, SvxToolbarConfigPage, NewToolbarHdl ) );
@@ -3336,33 +3367,6 @@ IMPL_LINK_TYPED( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton,
}
break;
}
case ID_ICONS_ONLY:
{
pToolbar->SetStyle( 0 );
pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 0 );
m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
break;
}
case ID_TEXT_ONLY:
{
pToolbar->SetStyle( 1 );
pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 1 );
m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
break;
}
case ID_ICONS_AND_TEXT:
{
pToolbar->SetStyle( 2 );
pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 2 );
m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
break;
}
}
}
@@ -3467,18 +3471,6 @@ IMPL_LINK_TYPED( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, vo
}
break;
}
case ID_ICON_ONLY:
{
break;
}
case ID_TEXT_ONLY:
{
break;
}
case ID_ICON_AND_TEXT:
{
break;
}
case ID_CHANGE_SYMBOL:
{
SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry();
@@ -4471,9 +4463,6 @@ void SvxToolbarConfigPage::UpdateButtonStates()
PopupMenu* pPopup = m_pModifyCommandButton->GetPopupMenu();
pPopup->EnableItem( ID_RENAME, false );
pPopup->EnableItem( ID_DEFAULT_COMMAND, false );
pPopup->EnableItem( ID_ICON_ONLY, false );
pPopup->EnableItem( ID_ICON_AND_TEXT, false );
pPopup->EnableItem( ID_TEXT_ONLY, false );
pPopup->EnableItem( ID_CHANGE_SYMBOL, false );
pPopup->EnableItem( ID_RESET_SYMBOL, false );
@@ -4496,9 +4485,6 @@ void SvxToolbarConfigPage::UpdateButtonStates()
else
{
pPopup->EnableItem( ID_RENAME );
pPopup->EnableItem( ID_ICON_ONLY );
pPopup->EnableItem( ID_ICON_AND_TEXT );
pPopup->EnableItem( ID_TEXT_ONLY );
pPopup->EnableItem( ID_CHANGE_SYMBOL );
m_pDeleteCommandButton->Enable();
@@ -4541,6 +4527,9 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, SelectToolbar, ListBox&, void )
m_pAddSeparatorButton->Enable( false );
m_pDeleteCommandButton->Enable( false );
m_pResetTopLevelButton->Enable( false );
m_pIconsOnlyRB->Enable( false );
m_pTextOnlyRB->Enable( false );
m_pIconsAndTextRB->Enable( false );
return;
}
@@ -4550,6 +4539,10 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, SelectToolbar, ListBox&, void )
m_pAddCommandsButton->Enable();
m_pResetTopLevelButton->Enable( !pToolbar->IsRenamable() );
m_pIconsOnlyRB->Enable();
m_pTextOnlyRB->Enable();
m_pIconsAndTextRB->Enable();
PopupMenu* pPopup = m_pModifyTopLevelButton->GetPopupMenu();
pPopup->EnableItem( ID_DELETE, pToolbar->IsDeletable() );
@@ -4559,17 +4552,17 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, SelectToolbar, ListBox&, void )
{
case 0:
{
pPopup->CheckItem( ID_ICONS_ONLY );
m_pIconsOnlyRB->Check();
break;
}
case 1:
{
pPopup->CheckItem( ID_TEXT_ONLY );
m_pTextOnlyRB->Check();
break;
}
case 2:
{
pPopup->CheckItem( ID_ICONS_AND_TEXT );
m_pIconsAndTextRB->Check();
break;
}
}
@@ -4601,6 +4594,38 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, SelectToolbar, ListBox&, void )
UpdateButtonStates();
}
IMPL_LINK_TYPED( SvxToolbarConfigPage, StyleChangeHdl, Button*, pButton, void )
{
sal_Int32 nSelectionPos = m_pTopLevelListBox->GetSelectEntryPos();
SvxConfigEntry* pToolbar =
static_cast<SvxConfigEntry*>(m_pTopLevelListBox->GetEntryData( nSelectionPos ));
ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>( GetSaveInData() );
if (pButton == m_pIconsOnlyRB)
{
pToolbar->SetStyle( 0 );
pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 0 );
m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
}
else if (pButton == m_pTextOnlyRB)
{
pToolbar->SetStyle( 1 );
pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 1 );
m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
}
else if (pButton == m_pIconsAndTextRB)
{
pToolbar->SetStyle( 2 );
pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 2 );
m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
}
}
IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, NewToolbarHdl, Button *, void )
{
OUString prefix = CUI_RES( RID_SVXSTR_NEW_TOOLBAR );

View File

@@ -24,11 +24,6 @@
#define ID_DELETE (44 + CFG_OFFSET)
// There is a gap here
#define ID_ICONS_ONLY (48 + CFG_OFFSET)
#define ID_ICONS_AND_TEXT (49 + CFG_OFFSET)
#define ID_ICON_ONLY (50 + CFG_OFFSET)
#define ID_ICON_AND_TEXT (51 + CFG_OFFSET)
#define ID_TEXT_ONLY (52 + CFG_OFFSET)
#define ID_CHANGE_SYMBOL (53 + CFG_OFFSET)
#define ID_RESET_SYMBOL (54 + CFG_OFFSET)
#define ID_DEFAULT_COMMAND (55 + CFG_OFFSET)

View File

@@ -40,31 +40,6 @@ Menu MODIFY_TOOLBAR
Identifier = ID_DELETE ;
TEXT_DELETE_NODOTS
};
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
Identifier = ID_ICONS_ONLY ;
RadioCheck = TRUE ;
AutoCheck = TRUE ;
Text [ en-US ] = "Icons Only" ;
};
MenuItem
{
Identifier = ID_TEXT_ONLY ;
RadioCheck = TRUE ;
AutoCheck = TRUE ;
Text [ en-US ] = "Text only" ;
};
MenuItem
{
Identifier = ID_ICONS_AND_TEXT ;
RadioCheck = TRUE ;
AutoCheck = TRUE ;
Text [ en-US ] = "Icons & Text" ;
};
};
};
@@ -87,10 +62,6 @@ Menu MODIFY_TOOLBAR_CONTENT
Separator = TRUE ;
};
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
Identifier = ID_CHANGE_SYMBOL ;
Text [ en-US ] = "Change Icon..." ;

View File

@@ -367,6 +367,11 @@ protected:
VclPtr<PushButton> m_pNewTopLevelButton;
VclPtr<MenuButton> m_pModifyTopLevelButton;
VclPtr<FixedText> m_pToolbarStyleLabel;
VclPtr<RadioButton> m_pIconsOnlyRB;
VclPtr<RadioButton> m_pTextOnlyRB;
VclPtr<RadioButton> m_pIconsAndTextRB;
// the contents section where the contents of the selected
// menu or toolbar are displayed
VclPtr<VclFrame> m_pContents;
@@ -570,6 +575,7 @@ private:
DECL_LINK_TYPED( SelectToolbarEntry, SvTreeListBox*, void );
DECL_LINK_TYPED( ToolbarSelectHdl, MenuButton *, void );
DECL_LINK_TYPED( EntrySelectHdl, MenuButton *, void );
DECL_LINK_TYPED( StyleChangeHdl, Button *, void );
DECL_LINK_TYPED( NewToolbarHdl, Button *, void );
DECL_LINK_TYPED( AddCommandsHdl, Button *, void );
DECL_LINK_TYPED( AddSeparatorHdl, Button *, void );

View File

@@ -61,12 +61,96 @@
<object class="GtkComboBoxText" id="toplevellist">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_right">36</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="toolbarstyleft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="label" translatable="yes">Style</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">toplevellist</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_right">36</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
<child>
<object class="GtkRadioButton" id="iconsandtextrb">
<property name="label" translatable="yes">Icons &amp; Text</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">iconsrb</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="iconsrb">
<property name="label" translatable="yes">Icons</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="textrb">
<property name="label" translatable="yes">Text</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">end</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">iconsrb</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>