Kaydet (Commit) b6542ea4 authored tarafından Caolán McNamara's avatar Caolán McNamara

for ToolBox Optimal Size use contents optimal sizes

Change-Id: I614c4fdb6478d1ca8e092dc742886190ec920b7d
üst c572b6cd
......@@ -805,7 +805,10 @@ SvxFontNameBox_Impl::SvxFontNameBox_Impl( Window* pParent, const Reference< XDis
m_xFrame (_xFrame),
mbEndPreview(false)
{
SetSizePixel(LogicToPixel( aLogicalSize, MAP_APPFONT ));
Size aSize(LogicToPixel(aLogicalSize, MAP_APPFONT));
set_width_request(aSize.Width());
set_height_request(aSize.Height());
SetSizePixel(aSize);
EnableControls_Impl();
GetSubEdit()->AddEventListener( LINK( this, SvxFontNameBox_Impl, CheckAndMarkUnknownFont ));
}
......
......@@ -4854,7 +4854,35 @@ void ToolBox::Resizing( Size& rSize )
Size ToolBox::GetOptimalSize() const
{
return ImplCalcSize( this, mnLines );
// If we have any expandable entries, then force them to their
// optimal sizes, then reset them afterwards
std::map<Window*, Size> aExpandables;
for (size_t i = 0; i < mpData->m_aItems.size(); ++i)
{
if (mpData->m_aItems[i].mbExpand)
{
Window *pWindow = mpData->m_aItems[i].mpWindow;
SAL_WARN_IF(!pWindow, "vcl.layout", "only tabitems with window supported at the moment");
if (!pWindow)
continue;
Size aWinSize(pWindow->GetSizePixel());
aExpandables[pWindow] = aWinSize;
Size aPrefSize(pWindow->get_preferred_size());
aWinSize.Width() = aPrefSize.Width();
pWindow->SetSizePixel(aWinSize);
}
}
Size aSize(ImplCalcSize( this, mnLines ));
for (std::map<Window*, Size>::iterator aI = aExpandables.begin(); aI != aExpandables.end(); ++aI)
{
Window *pWindow = aI->first;
Size aWinSize = aI->second;
pWindow->SetSizePixel(aWinSize);
}
return aSize;
}
Size ToolBox::CalcWindowSizePixel( sal_uInt16 nCalcLines ) const
......
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