Resolves: tdf#97731 allow status bar to adapt to its own preferred size

Change-Id: I4390f61a21eef21371ce7399bf746e60234b8db8
This commit is contained in:
Caolán McNamara 2017-02-20 16:51:17 +00:00
parent 3ee1c41ac7
commit 917d5b8b26
3 changed files with 15 additions and 11 deletions

View File

@ -522,7 +522,7 @@ public:
void RowInserted( long nRow, long nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false ); void RowInserted( long nRow, long nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false );
// miscellaneous // miscellaneous
void ReserveControlArea( sal_uInt16 nWidth = USHRT_MAX ); bool ReserveControlArea(sal_uInt16 nWidth = USHRT_MAX);
Rectangle GetControlArea() const; Rectangle GetControlArea() const;
bool ProcessKey( const KeyEvent& rEvt ); bool ProcessKey( const KeyEvent& rEvt );
void Dispatch( sal_uInt16 nId ); void Dispatch( sal_uInt16 nId );

View File

@ -2092,19 +2092,18 @@ sal_uInt16 BrowseBox::GetColumnAtXPosPixel( long nX, bool ) const
return BROWSER_INVALIDID; return BROWSER_INVALIDID;
} }
bool BrowseBox::ReserveControlArea(sal_uInt16 nWidth)
void BrowseBox::ReserveControlArea( sal_uInt16 nWidth )
{ {
if (nWidth != nControlAreaWidth)
if ( nWidth != nControlAreaWidth )
{ {
OSL_ENSURE(nWidth,"Control area of 0 is not allowed, Use USHRT_MAX instead!"); OSL_ENSURE(nWidth,"Control area of 0 is not allowed, Use USHRT_MAX instead!");
nControlAreaWidth = nWidth; nControlAreaWidth = nWidth;
UpdateScrollbars(); UpdateScrollbars();
return true;
} }
return false;
} }
Rectangle BrowseBox::GetControlArea() const Rectangle BrowseBox::GetControlArea() const
{ {
@ -2114,7 +2113,6 @@ Rectangle BrowseBox::GetControlArea() const
aHScroll->GetSizePixel().Height() ) ); aHScroll->GetSizePixel().Height() ) );
} }
void BrowseBox::SetMode( BrowserMode nMode ) void BrowseBox::SetMode( BrowserMode nMode )
{ {

View File

@ -1091,7 +1091,6 @@ namespace svt
return nId; return nId;
} }
void EditBrowseBox::Resize() void EditBrowseBox::Resize()
{ {
BrowseBox::Resize(); BrowseBox::Resize();
@ -1110,15 +1109,22 @@ namespace svt
if (!nX) if (!nX)
nX = USHRT_MAX; nX = USHRT_MAX;
ReserveControlArea((sal_uInt16)nX);
}
bool bChanged = ReserveControlArea(nX);
//tdf#97731 if the reserved area changed size, give the controls a
//chance to adapt to the new size
if (bChanged)
{
nX = (sal_uInt16)aPoint.X();
ArrangeControls(nX, (sal_uInt16)aPoint.Y());
}
}
void EditBrowseBox::ArrangeControls(sal_uInt16&, sal_uInt16) void EditBrowseBox::ArrangeControls(sal_uInt16&, sal_uInt16)
{ {
} }
CellController* EditBrowseBox::GetController(long, sal_uInt16) CellController* EditBrowseBox::GetController(long, sal_uInt16)
{ {
return nullptr; return nullptr;