summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2020-05-11 08:45:19 +0200
committerAndras Timar <andras.timar@collabora.com>2020-05-15 14:18:02 +0200
commit5d74827f088c9bbcca7f41a59696d62395029f68 (patch)
tree6692dee264bb903b18596b151b667ae005c54d6f /toolkit
parent7a831d5139f30bad2468323a74850810ada136cd (diff)
tdf#132832 calcAdjustedSize: Take max width into account
Actually take into account the preferred width when calculating the size of radio button, checkbox and hyperlink controls. This e.g. makes word wrap work properly when the multiline property is set for a checkbox, radio or hyperlink control and the single line text exceeds the preferred width, rather than keeping the whole text in one line that exceeds the preferred width. Change-Id: Id04668e4e1afe7c10a28468eff05cf04c10ae3c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93947 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> (cherry picked from commit 2539f1d142e0077dfeec36ef349a1f5443f1c94b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93798 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxwindows.cxx21
1 files changed, 13 insertions, 8 deletions
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 5645bf099288..c356aba16ee1 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -941,7 +941,7 @@ css::awt::Size VCLXCheckBox::calcAdjustedSize( const css::awt::Size& rNewSize )
VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
if ( pCheckBox )
{
- Size aMinSz = pCheckBox->CalcMinimumSize();
+ Size aMinSz = pCheckBox->CalcMinimumSize(rNewSize.Width);
if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
aSz.setHeight( aMinSz.Height() );
else
@@ -1290,7 +1290,7 @@ css::awt::Size VCLXRadioButton::calcAdjustedSize( const css::awt::Size& rNewSize
VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
if ( pRadioButton )
{
- Size aMinSz = pRadioButton->CalcMinimumSize();
+ Size aMinSz = pRadioButton->CalcMinimumSize(rNewSize.Width);
if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
aSz.setHeight( aMinSz.Height() );
else
@@ -3023,13 +3023,18 @@ css::awt::Size VCLXFixedHyperlink::getPreferredSize( )
css::awt::Size VCLXFixedHyperlink::calcAdjustedSize( const css::awt::Size& rNewSize )
{
SolarMutexGuard aGuard;
+ Size aSz( VCLUnoHelper::ConvertToVCLSize( rNewSize ));
+ VclPtr< FixedText > pFixedText = GetAs< FixedText >();
+ if (pFixedText)
+ {
+ Size aMinSz = pFixedText->CalcMinimumSize(rNewSize.Width);
+ if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
+ aSz.setHeight( aMinSz.Height() );
+ else
+ aSz = aMinSz;
+ }
- css::awt::Size aSz = rNewSize;
- css::awt::Size aMinSz = getMinimumSize();
- if ( aSz.Height != aMinSz.Height )
- aSz.Height = aMinSz.Height;
-
- return aSz;
+ return VCLUnoHelper::ConvertToAWTSize(aSz);
}
void VCLXFixedHyperlink::setProperty( const OUString& PropertyName, const css::uno::Any& Value)