[Libreoffice-commits] core.git: svx/source vcl/source
Caolán McNamara
caolanm at redhat.com
Fri Feb 7 06:24:41 PST 2014
svx/source/tbxctrls/tbcontrl.cxx | 5 ++++-
vcl/source/window/toolbox.cxx | 30 +++++++++++++++++++++++++++++-
2 files changed, 33 insertions(+), 2 deletions(-)
New commits:
commit b6542ea43ac6141486d3d1f29bbab9b053c26b21
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Feb 7 14:21:36 2014 +0000
for ToolBox Optimal Size use contents optimal sizes
Change-Id: I614c4fdb6478d1ca8e092dc742886190ec920b7d
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 0a96bd0..d54ec9d 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -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 ));
}
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index e2799ca..9a54b3f 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -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
More information about the Libreoffice-commits
mailing list