diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-01-23 13:34:48 +0100 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-01-25 06:47:05 +0100 |
commit | 9808306875fff4b97db6acb1182a153c874f15c5 (patch) | |
tree | 1f9e482cccd147f24c8afefd066b7c8f12c1a4fd /sfx2/source/control | |
parent | 1511047198ce36bcc910732bf8dfc5d40550b927 (diff) |
Related fdo#65826: Set StartCenter's min width to display one column of docs
If there is document to display. Otherwise set minimum to the width
of greating background text.
Updating minimum size is needed only when the list is cleared.
Change-Id: Ic089571fd21d5ab9ded0f4cde7e1aa72fd508d32
Diffstat (limited to 'sfx2/source/control')
-rw-r--r-- | sfx2/source/control/recentdocsview.cxx | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 69b605954e2f..9ed9a96dda0c 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -54,14 +54,6 @@ RecentDocsView::RecentDocsView( Window* pParent ) SetStyle(GetStyle() | WB_VSCROLL); setItemMaxTextLength( mnItemMaxTextLength ); setItemDimensions( mnItemMaxSize, mnItemMaxSize, mnTextHeight, mnItemPadding ); - - // Set prefered width so text lines will not be cut off - Font aOldFont(GetFont()); - Font aNewFont(aOldFont); - aNewFont.SetHeight(20); - SetFont(aNewFont); - set_width_request(std::max(GetTextWidth(maWelcomeLine1),GetTextWidth(maWelcomeLine2))); - SetFont(aOldFont); } extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeRecentDocsView(Window *pParent, VclBuilder::stringmap &) @@ -185,6 +177,21 @@ void RecentDocsView::loadRecentDocs() CalculateItemPositions(); Invalidate(); + + // Set prefered width + if( mFilteredItemList.empty() ) + { + Font aOldFont(GetFont()); + Font aNewFont(aOldFont); + aNewFont.SetHeight(20); + SetFont(aNewFont); + set_width_request(std::max(GetTextWidth(maWelcomeLine1),GetTextWidth(maWelcomeLine2))); + SetFont(aOldFont); + } + else + { + set_width_request(mnItemMaxSize); + } } void RecentDocsView::MouseButtonDown( const MouseEvent& rMEvt ) @@ -304,6 +311,18 @@ long RecentDocsView::GetThumbnailSize() const return mnItemMaxSize; } +void RecentDocsView::Clear() +{ + Font aOldFont(GetFont()); + Font aNewFont(aOldFont); + aNewFont.SetHeight(20); + SetFont(aNewFont); + set_width_request(std::max(GetTextWidth(maWelcomeLine1),GetTextWidth(maWelcomeLine2))); + SetFont(aOldFont); + + ThumbnailView::Clear(); +} + IMPL_STATIC_LINK_NOINSTANCE( RecentDocsView, ExecuteHdl_Impl, LoadRecentFile*, pLoadRecentFile ) { try |