summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashant Pandey <prashant3.yishu@gmail.com>2013-08-07 01:20:01 +0530
committerTor Lillqvist <tml@iki.fi>2013-08-09 12:52:43 +0000
commit3e7879998bde20d5d6540ef989ecfd850be97b08 (patch)
tree8ac796d03d01545f8fc36d24a4e884c3d2c6b4e9
parenta783c7ce72c6dc306dcd39868c9bf41d9dc886e0 (diff)
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/5296 Reviewed-by: Tor Lillqvist <tml@iki.fi> Tested-by: Tor Lillqvist <tml@iki.fi>
-rw-r--r--vcl/inc/toolbox.h3
-rw-r--r--vcl/source/window/toolbox2.cxx26
2 files changed, 29 insertions, 0 deletions
diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index 4a0f6d924934..96e2c5713fdf 100644
--- a/vcl/inc/toolbox.h
+++ b/vcl/inc/toolbox.h
@@ -112,6 +112,9 @@ struct ImplToolItem
// returns sal_True if the toolbar item is currently clipped, which can happen for docked toolbars
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:
void init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, sal_Bool bEmptyBtn);
};
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index d4c7c9f37b83..62544c655d9a 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -365,6 +365,13 @@ sal_Bool ImplToolItem::IsClipped() const
}
// -----------------------------------------------------------------------
+
+sal_Bool ImplToolItem::IsItemHidden() const
+{
+ return ( meType == TOOLBOXITEM_BUTTON && !mbVisible );
+}
+
+// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
const OUString ToolBox::ImplConvertMenuString( const OUString& rStr )
@@ -2097,6 +2104,8 @@ void ToolBox::UpdateCustomMenu()
// add menu items, starting from the end and inserting at pos 0
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());
it != mpData->m_aItems.rend(); ++it)
{
@@ -2105,6 +2114,23 @@ void ToolBox::UpdateCustomMenu()
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
pMenu->InsertItem( id, it->maText, it->maImage, 0, OString(), 0 );
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 );
}
}