[Libreoffice-commits] core.git: cui/source include/svtools svtools/source

Jason Hulme jsnhulme at gmail.com
Fri Jun 7 00:43:16 PDT 2013


 cui/source/customize/cfg.cxx          |    3 +++
 include/svtools/svlbitm.hxx           |    2 ++
 include/svtools/treelistbox.hxx       |    1 +
 svtools/source/contnr/svlbitm.cxx     |   11 +++++++++--
 svtools/source/contnr/treelistbox.cxx |   11 +++++++++++
 5 files changed, 26 insertions(+), 2 deletions(-)

New commits:
commit 8ac87296c3f5f67d34336bf1eb75d1a6cc81e1c7
Author: Jason Hulme <jsnhulme at gmail.com>
Date:   Wed Jun 5 12:33:38 2013 -0700

    fdo#63866 Hid useless checkboxes
    
    Added functions to SvTreeListBox and SvLBoxButton to allow entries with hidden checkboxes
    
    Change-Id: Ia5a1deabea6c01aad5e4010612ac453c669258a6
    Reviewed-on: https://gerrit.libreoffice.org/4169
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 5566dce..b2386ce 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -4606,6 +4606,9 @@ IMPL_LINK( SvxToolbarConfigPage, SelectToolbar, ListBox *, pBox )
 
         SvTreeListEntry* pNewLBEntry = InsertEntryIntoUI( pEntry );
 
+        if(pEntry->IsSeparator())
+            aContentsListBox->SetCheckButtonInvisible( pNewLBEntry );
+
         if (pEntry->IsBinding())
         {
             aContentsListBox->SetCheckButtonState( pNewLBEntry,
diff --git a/include/svtools/svlbitm.hxx b/include/svtools/svlbitm.hxx
index 1478483..78a1da0 100644
--- a/include/svtools/svlbitm.hxx
+++ b/include/svtools/svlbitm.hxx
@@ -133,6 +133,7 @@ public:
 
 class SVT_DLLPUBLIC SvLBoxButton : public SvLBoxItem
 {
+    bool    isVis;
     SvLBoxButtonData*   pData;
     SvLBoxButtonKind eKind;
     sal_uInt16 nItemFlags;
@@ -166,6 +167,7 @@ public:
     void            SetStateUnchecked();
     void            SetStateTristate();
     void            SetStateHilighted( sal_Bool bHilight );
+    void            SetStateInvisible();
 
     SvLBoxButtonKind GetKind() const { return eKind; }
 
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index 9c06c58..4c09d74 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -629,6 +629,7 @@ public:
     void            SetDefaultCollapsedEntryBmp( const Image& rBmp );
 
     void            SetCheckButtonState( SvTreeListEntry*, SvButtonState );
+    void            SetCheckButtonInvisible( SvTreeListEntry* );
     SvButtonState   GetCheckButtonState( SvTreeListEntry* ) const;
 
     void            SetEntryText(SvTreeListEntry*, const XubString& );
diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx
index bc34904..ca3b342 100644
--- a/svtools/source/contnr/svlbitm.cxx
+++ b/svtools/source/contnr/svlbitm.cxx
@@ -318,6 +318,7 @@ SvLBoxButton::SvLBoxButton( SvTreeListEntry* pEntry, SvLBoxButtonKind eTheKind,
     nItemFlags = 0;
     SetStateUnchecked();
     pData = pBData;
+    isVis = true;
 }
 
 SvLBoxButton::SvLBoxButton() : SvLBoxItem()
@@ -389,11 +390,12 @@ void SvLBoxButton::Paint(
         else if ( IsStateTristate() )
             aControlValue.setTristateVal( BUTTONVALUE_MIXED );
 
-        bNativeOK = rDev.DrawNativeControl( eCtrlType, PART_ENTIRE_CONTROL,
+        if( isVis)
+            bNativeOK = rDev.DrawNativeControl( eCtrlType, PART_ENTIRE_CONTROL,
                                 aCtrlRegion, nState, aControlValue, OUString() );
     }
 
-    if( !bNativeOK)
+    if( !bNativeOK && isVis )
         rDev.DrawImage( rPos, pData->aBmps[nIndex + nBaseOffs] ,nStyle);
 }
 
@@ -459,6 +461,11 @@ bool SvLBoxButton::CheckModification() const
     return eKind == SvLBoxButtonKind_enabledCheckbox;
 }
 
+void SvLBoxButton::SetStateInvisible()
+{
+    isVis = false;
+}
+
 // ***************************************************************
 // class SvLBoxContextBmp
 // ***************************************************************
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 1d4611d..10c3c65 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -2012,6 +2012,17 @@ void SvTreeListBox::SetCheckButtonState( SvTreeListEntry* pEntry, SvButtonState
     }
 }
 
+void SvTreeListBox::SetCheckButtonInvisible( SvTreeListEntry* pEntry)
+{
+    DBG_CHKTHIS(SvTreeListBox,0);
+    if( nTreeFlags & TREEFLAG_CHKBTN )
+    {
+        SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON));
+        pItem->SetStateInvisible();
+        InvalidateEntry( pEntry );
+    }
+}
+
 SvButtonState SvTreeListBox::GetCheckButtonState( SvTreeListEntry* pEntry ) const
 {
     DBG_CHKTHIS(SvTreeListBox,0);


More information about the Libreoffice-commits mailing list