Kaydet (Commit) 3e787999 authored tarafından Prashant Pandey's avatar Prashant Pandey Kaydeden (comit) Tor Lillqvist

Show hidden toolbar items when window size is decreased

When the Window size is reduced, the '>>' symbol thus appearing
must also show the items, that are provided by the toolbar but
are not shown because they are unchecked in Tools->Customize.

Change-Id: I062bee4447126bff4ae7ad6650be3b847acc0794
Reviewed-on: https://gerrit.libreoffice.org/5296Reviewed-by: 's avatarTor Lillqvist <tml@iki.fi>
Tested-by: 's avatarTor Lillqvist <tml@iki.fi>
üst a783c7ce
...@@ -112,6 +112,9 @@ struct ImplToolItem ...@@ -112,6 +112,9 @@ struct ImplToolItem
// returns sal_True if the toolbar item is currently clipped, which can happen for docked toolbars // returns sal_True if the toolbar item is currently clipped, which can happen for docked toolbars
sal_Bool IsClipped() const; sal_Bool IsClipped() const;
// returns sal_True if the toolbar item is currently hidden i.e. they are unchecked in the toolbar Customize menu
sal_Bool IsItemHidden() const;
private: private:
void init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, sal_Bool bEmptyBtn); void init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, sal_Bool bEmptyBtn);
}; };
......
...@@ -364,6 +364,13 @@ sal_Bool ImplToolItem::IsClipped() const ...@@ -364,6 +364,13 @@ sal_Bool ImplToolItem::IsClipped() const
return ( meType == TOOLBOXITEM_BUTTON && mbVisible && maRect.IsEmpty() ); return ( meType == TOOLBOXITEM_BUTTON && mbVisible && maRect.IsEmpty() );
} }
// -----------------------------------------------------------------------
sal_Bool ImplToolItem::IsItemHidden() const
{
return ( meType == TOOLBOXITEM_BUTTON && !mbVisible );
}
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -2097,6 +2104,8 @@ void ToolBox::UpdateCustomMenu() ...@@ -2097,6 +2104,8 @@ void ToolBox::UpdateCustomMenu()
// add menu items, starting from the end and inserting at pos 0 // add menu items, starting from the end and inserting at pos 0
if ( !mpData->m_aItems.empty() ) if ( !mpData->m_aItems.empty() )
{ {
// nStartPos will hold the number of clipped items appended from first loop
sal_uInt16 nSepPos = 0;
for ( std::vector< ImplToolItem >::reverse_iterator it(mpData->m_aItems.rbegin()); for ( std::vector< ImplToolItem >::reverse_iterator it(mpData->m_aItems.rbegin());
it != mpData->m_aItems.rend(); ++it) it != mpData->m_aItems.rend(); ++it)
{ {
...@@ -2105,6 +2114,23 @@ void ToolBox::UpdateCustomMenu() ...@@ -2105,6 +2114,23 @@ void ToolBox::UpdateCustomMenu()
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START; sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
pMenu->InsertItem( id, it->maText, it->maImage, 0, OString(), 0 ); pMenu->InsertItem( id, it->maText, it->maImage, 0, OString(), 0 );
pMenu->EnableItem( id, it->mbEnabled ); pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem ( id, it->meState == STATE_CHECK );
nSepPos++;
}
}
// add a seperator below the inserted clipped-items
pMenu->InsertSeparator( OString(), nSepPos );
// now append the items that are explicitly disabled
for ( std::vector< ImplToolItem >::reverse_iterator it(mpData->m_aItems.rbegin());
it != mpData->m_aItems.rend(); ++it)
{
if( it->IsItemHidden() )
{
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
pMenu->InsertItem( id, it->maText, it->maImage, 0, OString(), nSepPos+1 );
pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem( id, it->meState == STATE_CHECK ); pMenu->CheckItem( id, it->meState == STATE_CHECK );
} }
} }
......
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