[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - include/vcl toolkit/source vcl/source
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 13 20:04:13 UTC 2020
include/vcl/button.hxx | 2 +-
toolkit/source/awt/vclxwindows.cxx | 21 +++++++++++++--------
vcl/source/control/button.cxx | 4 ++--
3 files changed, 16 insertions(+), 11 deletions(-)
New commits:
commit ae6d48c94da8d29fa0f34f801f99131fe6206f83
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Mon May 11 08:45:19 2020 +0200
Commit: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Wed May 13 22:03:41 2020 +0200
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 at posteo.de>
(cherry picked from commit 2539f1d142e0077dfeec36ef349a1f5443f1c94b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93798
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index b0b2884c9ad0..f37b714faf9f 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -350,7 +350,7 @@ public:
static Image GetRadioImage( const AllSettings& rSettings, DrawButtonFlags nFlags );
- Size CalcMinimumSize() const;
+ Size CalcMinimumSize( long nMaxWidth = 0 ) const;
virtual Size GetOptimalSize() const override;
void SetToggleHdl( const Link<RadioButton&,void>& rLink ) { maToggleHdl = rLink; }
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)
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index f3fedd972a68..a4ae36cffe15 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2814,7 +2814,7 @@ void RadioButton::ImplSetMinimumNWFSize()
Pop();
}
-Size RadioButton::CalcMinimumSize() const
+Size RadioButton::CalcMinimumSize(long nMaxWidth) const
{
Size aSize;
if ( !maImage )
@@ -2838,7 +2838,7 @@ Size RadioButton::CalcMinimumSize() const
{
bool bTopImage = (GetStyle() & WB_TOP) != 0;
- Size aTextSize = GetTextRect( tools::Rectangle( Point(), Size( 0x7fffffff, 0x7fffffff ) ),
+ Size aTextSize = GetTextRect( tools::Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ),
aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize();
aSize.AdjustWidth(2 ); // for focus rect
More information about the Libreoffice-commits
mailing list