include/sfx2/recentdocsview.hxx | 2 ++ include/sfx2/thumbnailview.hxx | 2 +- sfx2/source/control/recentdocsview.cxx | 27 +++++++++++++++++++++++++++ sfx2/source/dialog/backingcomp.cxx | 26 ++++++++++++++++++++++++++ sfx2/source/dialog/backingwindow.cxx | 5 ++++- 5 files changed, 60 insertions(+), 2 deletions(-)
New commits: commit ff86ddf59884ab3bd08e6bf33adabf8ca79967df Author: Zolnai Tamás <[email protected]> Date: Thu Jan 23 13:34:48 2014 +0100 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 diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx index 63a067d..1706935 100644 --- a/include/sfx2/recentdocsview.hxx +++ b/include/sfx2/recentdocsview.hxx @@ -56,6 +56,8 @@ public: int mnFileTypes; + virtual void Clear(); + DECL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, LoadRecentFile* ); protected: diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx index ccd25dc..e21b87b 100644 --- a/include/sfx2/thumbnailview.hxx +++ b/include/sfx2/thumbnailview.hxx @@ -192,7 +192,7 @@ public: void RemoveItem( sal_uInt16 nItemId ); - void Clear(); + virtual void Clear(); // Change current thumbnail item list with new one (invalidates all pointers to a thumbnail item) void updateItems(const std::vector<ThumbnailViewItem *> &items); diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index e815b97..12a9b7e 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -53,14 +53,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 &) @@ -184,6 +176,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 ) @@ -303,6 +310,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 diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx index 023d426..f6dd7f0 100644 --- a/sfx2/source/dialog/backingcomp.cxx +++ b/sfx2/source/dialog/backingcomp.cxx @@ -850,7 +850,19 @@ void SAL_CALL BackingComp::dispatch( const css::util::URL& aURL, const css::uno: Window* pWindow = VCLUnoHelper::GetWindow(m_xWindow); BackingWindow* pBack = dynamic_cast<BackingWindow*>(pWindow ); if( pBack ) + { pBack->clearRecentFileList(); + + // Recalculate minimum width + css::uno::Reference< css::awt::XWindow > xParentWindow = m_xFrame->getContainerWindow(); + WorkWindow* pParent = (WorkWindow*)VCLUnoHelper::GetWindow(xParentWindow); + if( pParent ) + { + pParent->SetMinOutputSizePixel( Size( + pBack->get_width_request(), + pParent->GetMinOutputSizePixel().Height()) ); + } + } } } diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index b02f3e3..a8114d6 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -550,5 +550,6 @@ Size BackingWindow::GetOptimalSize() const void BackingWindow::clearRecentFileList() { mpAllRecentThumbnails->Clear(); + set_width_request(mpAllRecentThumbnails->get_width_request() + mpAllButtonsBox->GetOptimalSize().Width()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab:*/ commit b010e8911cb2c72c57b76ff44892db67b30f2b5b Author: Zolnai Tamás <[email protected]> Date: Fri Jan 17 20:10:06 2014 +0100 fdo#65826 and fdo#73605: set a minimum size to start center This minimum size calculated like this: width: sidebar optimal width + width of text appearing in the thumbnail view when no recent document is available. height: menu width + optimal width of GtkBox containing buttons. Change-Id: Ic1fd6e33a1ec93e61318af02c09ee88909a76cf4 Reviewed-on: https://gerrit.libreoffice.org/7505 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 78733fe..e815b97 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -53,6 +53,14 @@ 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 &) diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx index 4a14498..023d426 100644 --- a/sfx2/source/dialog/backingcomp.cxx +++ b/sfx2/source/dialog/backingcomp.cxx @@ -490,6 +490,20 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f if( pBack ) pBack->setOwningFrame( m_xFrame ); + // Set a minimum size for Start Center + if( pParent && pBack ) + { + long nMenuHeight = 0; + Window* pMenu = pParent->GetWindow(WINDOW_NEXT); + if( pMenu ) + nMenuHeight = pMenu->GetSizePixel().Height(); + + pParent->SetMinOutputSizePixel( + Size( + pBack->get_width_request(), + pBack->get_height_request() + nMenuHeight)); + } + /* } SAFE */ } diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 60ce65f..b02f3e3 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -258,6 +258,9 @@ void BackingWindow::initControls() mpThinBox2->SetBackground(aButtonsText); Resize(); + + set_width_request(mpAllRecentThumbnails->get_width_request() + mpAllButtonsBox->GetOptimalSize().Width()); + set_height_request(mpAllButtonsBox->GetOptimalSize().Height()); } void BackingWindow::setupButton( PushButton* pButton ) @@ -548,5 +551,4 @@ void BackingWindow::clearRecentFileList() { mpAllRecentThumbnails->Clear(); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab:*/
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
