Kaydet (Commit) 8ac87296 authored tarafından Jason Hulme's avatar Jason Hulme Kaydeden (comit) Miklos Vajna

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/4169Reviewed-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
Tested-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst 803bd5f1
...@@ -4606,6 +4606,9 @@ IMPL_LINK( SvxToolbarConfigPage, SelectToolbar, ListBox *, pBox ) ...@@ -4606,6 +4606,9 @@ IMPL_LINK( SvxToolbarConfigPage, SelectToolbar, ListBox *, pBox )
SvTreeListEntry* pNewLBEntry = InsertEntryIntoUI( pEntry ); SvTreeListEntry* pNewLBEntry = InsertEntryIntoUI( pEntry );
if(pEntry->IsSeparator())
aContentsListBox->SetCheckButtonInvisible( pNewLBEntry );
if (pEntry->IsBinding()) if (pEntry->IsBinding())
{ {
aContentsListBox->SetCheckButtonState( pNewLBEntry, aContentsListBox->SetCheckButtonState( pNewLBEntry,
......
...@@ -133,6 +133,7 @@ public: ...@@ -133,6 +133,7 @@ public:
class SVT_DLLPUBLIC SvLBoxButton : public SvLBoxItem class SVT_DLLPUBLIC SvLBoxButton : public SvLBoxItem
{ {
bool isVis;
SvLBoxButtonData* pData; SvLBoxButtonData* pData;
SvLBoxButtonKind eKind; SvLBoxButtonKind eKind;
sal_uInt16 nItemFlags; sal_uInt16 nItemFlags;
...@@ -166,6 +167,7 @@ public: ...@@ -166,6 +167,7 @@ public:
void SetStateUnchecked(); void SetStateUnchecked();
void SetStateTristate(); void SetStateTristate();
void SetStateHilighted( sal_Bool bHilight ); void SetStateHilighted( sal_Bool bHilight );
void SetStateInvisible();
SvLBoxButtonKind GetKind() const { return eKind; } SvLBoxButtonKind GetKind() const { return eKind; }
......
...@@ -629,6 +629,7 @@ public: ...@@ -629,6 +629,7 @@ public:
void SetDefaultCollapsedEntryBmp( const Image& rBmp ); void SetDefaultCollapsedEntryBmp( const Image& rBmp );
void SetCheckButtonState( SvTreeListEntry*, SvButtonState ); void SetCheckButtonState( SvTreeListEntry*, SvButtonState );
void SetCheckButtonInvisible( SvTreeListEntry* );
SvButtonState GetCheckButtonState( SvTreeListEntry* ) const; SvButtonState GetCheckButtonState( SvTreeListEntry* ) const;
void SetEntryText(SvTreeListEntry*, const XubString& ); void SetEntryText(SvTreeListEntry*, const XubString& );
......
...@@ -318,6 +318,7 @@ SvLBoxButton::SvLBoxButton( SvTreeListEntry* pEntry, SvLBoxButtonKind eTheKind, ...@@ -318,6 +318,7 @@ SvLBoxButton::SvLBoxButton( SvTreeListEntry* pEntry, SvLBoxButtonKind eTheKind,
nItemFlags = 0; nItemFlags = 0;
SetStateUnchecked(); SetStateUnchecked();
pData = pBData; pData = pBData;
isVis = true;
} }
SvLBoxButton::SvLBoxButton() : SvLBoxItem() SvLBoxButton::SvLBoxButton() : SvLBoxItem()
...@@ -389,11 +390,12 @@ void SvLBoxButton::Paint( ...@@ -389,11 +390,12 @@ void SvLBoxButton::Paint(
else if ( IsStateTristate() ) else if ( IsStateTristate() )
aControlValue.setTristateVal( BUTTONVALUE_MIXED ); aControlValue.setTristateVal( BUTTONVALUE_MIXED );
bNativeOK = rDev.DrawNativeControl( eCtrlType, PART_ENTIRE_CONTROL, if( isVis)
bNativeOK = rDev.DrawNativeControl( eCtrlType, PART_ENTIRE_CONTROL,
aCtrlRegion, nState, aControlValue, OUString() ); aCtrlRegion, nState, aControlValue, OUString() );
} }
if( !bNativeOK) if( !bNativeOK && isVis )
rDev.DrawImage( rPos, pData->aBmps[nIndex + nBaseOffs] ,nStyle); rDev.DrawImage( rPos, pData->aBmps[nIndex + nBaseOffs] ,nStyle);
} }
...@@ -459,6 +461,11 @@ bool SvLBoxButton::CheckModification() const ...@@ -459,6 +461,11 @@ bool SvLBoxButton::CheckModification() const
return eKind == SvLBoxButtonKind_enabledCheckbox; return eKind == SvLBoxButtonKind_enabledCheckbox;
} }
void SvLBoxButton::SetStateInvisible()
{
isVis = false;
}
// *************************************************************** // ***************************************************************
// class SvLBoxContextBmp // class SvLBoxContextBmp
// *************************************************************** // ***************************************************************
......
...@@ -2012,6 +2012,17 @@ void SvTreeListBox::SetCheckButtonState( SvTreeListEntry* pEntry, SvButtonState ...@@ -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 SvButtonState SvTreeListBox::GetCheckButtonState( SvTreeListEntry* pEntry ) const
{ {
DBG_CHKTHIS(SvTreeListBox,0); DBG_CHKTHIS(SvTreeListBox,0);
......
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