[Libreoffice-commits] core.git: vcl/inc vcl/source

Prashant Pandey prashant3.yishu at gmail.com
Fri Aug 9 05:53:03 PDT 2013


 vcl/inc/toolbox.h              |    3 +++
 vcl/source/window/toolbox2.cxx |   26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

New commits:
commit 3e7879998bde20d5d6540ef989ecfd850be97b08
Author: Prashant Pandey <prashant3.yishu at gmail.com>
Date:   Wed Aug 7 01:20:01 2013 +0530

    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 at iki.fi>
    Tested-by: Tor Lillqvist <tml at iki.fi>

diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index 4a0f6d9..96e2c57 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 d4c7c9f..62544c6 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 );
             }
         }


More information about the Libreoffice-commits mailing list