have another shot at placing the expander checkitem optimally

reverts 03569dc7d3 "I hate the positioning of the
expander checkitem in hierarchical view". I still hate it, so merge together
the various places where different efforts are made to try and position the
checkitem optimally and provide a single central place to do that.

Change-Id: I047504945fb5bf94e5f451007eb74328b8b56785
This commit is contained in:
Caolán McNamara
2013-10-11 20:15:15 +01:00
parent 9b6b916ef3
commit d61168908c
5 changed files with 11 additions and 5 deletions

View File

@@ -686,6 +686,8 @@ public:
Size GetOutputSizePixel() const; Size GetOutputSizePixel() const;
short GetIndent() const { return nIndent; } short GetIndent() const { return nIndent; }
void SetIndent( short nIndent ); void SetIndent( short nIndent );
// Place the expander checkitem at the optimal indent for hierarchical lists
void SetOptimalImageIndent() { SetIndent(12); }
void SetSpaceBetweenEntries( short nSpace ); void SetSpaceBetweenEntries( short nSpace );
short GetSpaceBetweenEntries() const {return nEntryHeightOffs;} short GetSpaceBetweenEntries() const {return nEntryHeightOffs;}
Point GetEntryPosition( SvTreeListEntry* ) const; Point GetEntryPosition( SvTreeListEntry* ) const;

View File

@@ -464,7 +464,7 @@ CustomAnimationList::CustomAnimationList( ::Window* pParent )
EnableContextMenuHandling(); EnableContextMenuHandling();
SetSelectionMode( MULTIPLE_SELECTION ); SetSelectionMode( MULTIPLE_SELECTION );
SetIndent(16); SetOptimalImageIndent();
SetNodeDefaultImages(); SetNodeDefaultImages();
} }

View File

@@ -1855,7 +1855,7 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable)
LINK(this, SfxCommonTemplateDialog_Impl, ApplyHdl)); LINK(this, SfxCommonTemplateDialog_Impl, ApplyHdl));
((StyleTreeListBox_Impl*)pTreeBox)-> ((StyleTreeListBox_Impl*)pTreeBox)->
SetDropHdl(LINK(this, SfxCommonTemplateDialog_Impl, DropHdl)); SetDropHdl(LINK(this, SfxCommonTemplateDialog_Impl, DropHdl));
pTreeBox->SetIndent(10); pTreeBox->SetOptimalImageIndent();
FillTreeBox(); FillTreeBox();
SelectStyle(aSelectEntry); SelectStyle(aSelectEntry);
pTreeBox->SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString()); pTreeBox->SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString());

View File

@@ -1602,9 +1602,13 @@ void SvImpLBox::SetNodeBmpYOffset( const Image& rBmp )
void SvImpLBox::SetNodeBmpTabDistance() void SvImpLBox::SetNodeBmpTabDistance()
{ {
nNodeBmpTabDistance = -pView->GetIndent(); nNodeBmpTabDistance = -pView->GetIndent();
if( pView->nContextBmpWidthMax )
{
// only if the first dynamic tab is centered (we currently assume that)
Size aSize = GetExpandedNodeBmp().GetSizePixel(); Size aSize = GetExpandedNodeBmp().GetSizePixel();
nNodeBmpTabDistance -= aSize.Width() / 2; nNodeBmpTabDistance -= aSize.Width() / 2;
} }
}
// //
// corrects the cursor when using SingleSelection // corrects the cursor when using SingleSelection

View File

@@ -71,7 +71,7 @@ SwFldDokInfPage::SwFldDokInfPage(Window* pParent, const SfxItemSet& rCoreSet)
m_pTypeTLB->SetSelectionMode(SINGLE_SELECTION); m_pTypeTLB->SetSelectionMode(SINGLE_SELECTION);
m_pTypeTLB->SetStyle(m_pTypeTLB->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); m_pTypeTLB->SetStyle(m_pTypeTLB->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
m_pTypeTLB->SetIndent(10); m_pTypeTLB->SetOptimalImageIndent();
// Don't set font, so that the control's font is adobted! // Don't set font, so that the control's font is adobted!
// Otherwise at wrong font bug to OV. // Otherwise at wrong font bug to OV.
m_pTypeTLB->SetSpaceBetweenEntries(0); m_pTypeTLB->SetSpaceBetweenEntries(0);