diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-12-03 17:40:24 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-12-03 17:43:44 +0100 |
commit | 37cc33e27188a5686e15751c5bb39b422909f201 (patch) | |
tree | c9afbe157288f69ec2eed5350add5a75d01ced35 /sfx2 | |
parent | c52ac92afe4c529ce4fd78734cdf7ff5dafc4089 (diff) |
Delay potentially expensive first-time template initialization
...from first start of soffice to first click on Templates button. At least in
an --enable-dbgutil build (no idea whether it's substantially faster for a
"product" build) with lots of templates (--enable-extra-templates, --enable-sun-
templates) the UI still becomes unacceptabliy unrepsonsive when you clik on the
Templates button for the first time, though.
Change-Id: I226acaf26e20022b825478f47bb6a1f791c7c145
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/backingwindow.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.hxx | 3 |
2 files changed, 18 insertions, 3 deletions
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index f121c2139475..0e6a8bd935b2 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -90,6 +90,7 @@ static bool cmpSelectionItems (const ThumbnailViewItem *pItem1, const ThumbnailV BackingWindow::BackingWindow( vcl::Window* i_pParent ) : Window( i_pParent ), mxDesktop( Desktop::create(comphelper::getProcessComponentContext()) ), + mbLocalViewInitialized(false), mbIsSaveMode( false ), mbInitControls( false ), mnHideExternalLinks( 0 ), @@ -259,10 +260,7 @@ void BackingWindow::initControls() //initialize Template view mpLocalView->SetStyle( mpLocalView->GetStyle() | WB_VSCROLL); - mpLocalView->Populate(); - mpLocalView->showRootRegion(); mpLocalView->Hide(); - mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); mpTemplateButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED ); @@ -315,6 +313,17 @@ void BackingWindow::initControls() set_height_request(mpAllButtonsBox->GetOptimalSize().Height()); } +void BackingWindow::initializeLocalView() +{ + if (!mbLocalViewInitialized) + { + mbLocalViewInitialized = true; + mpLocalView->Populate(); + mpLocalView->showRootRegion(); + mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); + } +} + void BackingWindow::setupButton( PushButton* pButton ) { // the buttons should have a bit bigger font @@ -552,6 +561,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) else if( pButton == mpTemplateButton ) { mpAllRecentThumbnails->Hide(); + initializeLocalView(); mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); mpLocalView->Show(); mpLocalView->reload(); @@ -562,6 +572,8 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton ) { + initializeLocalView(); + OString sId = pButton->GetCurItemIdent(); if( sId == "filter_writer" ) diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index 3c966267e2bf..aa6e498a281d 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -87,6 +87,7 @@ class BackingWindow RecentDocsView* mpAllRecentThumbnails; TemplateDefaultView* mpLocalView; + bool mbLocalViewInitialized; std::vector<vcl::Window*> maDndWindows; @@ -119,6 +120,8 @@ class BackingWindow void initControls(); + void initializeLocalView(); + public: BackingWindow( vcl::Window* pParent ); virtual ~BackingWindow(); |