summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-06-21 13:00:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-06-21 13:22:16 +0100
commit0a5c151b62a7abc3fc4abaadb0b50c3047eb5f26 (patch)
treed7dadffc39a0adf969654b66bee291c7e4448e9a
parent98c38b02d8f6549aefdfdb30399e386acea8fd79 (diff)
Resolves: fdo#65635 don't include border gap in height for borderless edits
Change-Id: If778fdeb5bdbd5a5cac33f57ef8d598ddc1408f2
-rw-r--r--include/vcl/edit.hxx2
-rw-r--r--vcl/source/control/edit.cxx16
2 files changed, 12 insertions, 6 deletions
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 488758ab7d4a..11c1ae8c1d6b 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -122,7 +122,7 @@ protected:
SAL_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
SAL_DLLPRIVATE void ImplSetSelection( const Selection& rSelection, sal_Bool bPaint = sal_True );
- SAL_DLLPRIVATE int ImplGetNativeControlType();
+ SAL_DLLPRIVATE int ImplGetNativeControlType() const;
SAL_DLLPRIVATE long ImplGetExtraOffset() const;
static SAL_DLLPRIVATE void ImplInvalidateOutermostBorder( Window* pWin );
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 20c41a91be6a..cfd4d3353541 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1048,10 +1048,10 @@ void Edit::ImplSetText( const OUString& rText, const Selection* pNewSelection )
// -----------------------------------------------------------------------
-int Edit::ImplGetNativeControlType()
+int Edit::ImplGetNativeControlType() const
{
int nCtrl = 0;
- Window *pControl = mbIsSubEdit ? GetParent() : this;
+ const Window *pControl = mbIsSubEdit ? GetParent() : this;
switch( pControl->GetType() )
{
@@ -2877,6 +2877,8 @@ void Edit::SetSubEdit( Edit* pEdit )
Size Edit::CalcMinimumSizeForText(const OUString &rString) const
{
+ int eCtrlType = ImplGetNativeControlType();
+
Size aSize;
if (mnWidthInChars != -1)
{
@@ -2893,8 +2895,12 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const
if (aSize.Width() < aMinSize.Width())
aSize.Width() = aMinSize.Width();
}
- // add some space between text entry and border
- aSize.Height() += 4;
+
+ if (eCtrlType != CTRL_EDITBOX_NOBORDER)
+ {
+ // add some space between text entry and border
+ aSize.Height() += 4;
+ }
aSize = CalcWindowSize( aSize );
@@ -2903,7 +2909,7 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const
Rectangle aRect( Point( 0, 0 ), aSize );
Rectangle aContent, aBound;
if( const_cast<Edit*>(this)->GetNativeControlRegion(
- CTRL_EDITBOX, PART_ENTIRE_CONTROL,
+ eCtrlType, PART_ENTIRE_CONTROL,
aRect, 0, aControlValue, OUString(), aBound, aContent) )
{
if( aBound.GetHeight() > aSize.Height() )