diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx index 00d88da23a0c..87cfb1448ac3 100644 --- a/sfx2/inc/sfx2/templatefolderview.hxx +++ b/sfx2/inc/sfx2/templatefolderview.hxx @@ -41,6 +41,8 @@ public: void showOverlay (bool bVisible); + void setOverlayDblClickHdl (const Link &rLink); + void filterTemplatesByApp (const FILTER_APPLICATION &eApp); void sortOverlayItems (const boost::function &rTemplates); + void setDblClickHdl (const Link &rLink) { maDblClickHdl = rLink; } + protected: virtual void MouseButtonDown (const MouseEvent &rMEvt); + virtual void OnItemDblClicked (ThumbnailViewItem *pItem); + private: Image maCloseImg; sal_uInt16 mnRegionId; rtl::OUString maFolderName; SfxDocumentTemplates *mpDocTemplates; + Link maDblClickHdl; }; #endif // TEMPLATEVIEW_HXX diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 84b331509f5c..46c3bcfc2225 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -57,6 +57,8 @@ private: DECL_LINK(MenuSelectHdl, Menu*); + DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*); + void OnTemplateImport (); void OnTemplateSearch (); void OnTemplateEdit (); diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx index f874b720bdcd..68f622b8d177 100644 --- a/sfx2/source/control/templatefolderview.cxx +++ b/sfx2/source/control/templatefolderview.cxx @@ -361,6 +361,11 @@ void TemplateFolderView::showOverlay (bool bVisible) } } +void TemplateFolderView::setOverlayDblClickHdl(const Link &rLink) +{ + mpItemView->setDblClickHdl(rLink); +} + void TemplateFolderView::filterTemplatesByApp (const FILTER_APPLICATION &eApp) { meFilterOption = eApp; diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx index 961029eba72f..22e58db6cd2a 100644 --- a/sfx2/source/control/templateview.cxx +++ b/sfx2/source/control/templateview.cxx @@ -152,6 +152,11 @@ void TemplateView::MouseButtonDown (const MouseEvent &rMEvt) ThumbnailView::MouseButtonDown(rMEvt); } +void TemplateView::OnItemDblClicked(ThumbnailViewItem *pItem) +{ + maDblClickHdl.Call(pItem); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index e39f5ab65cfd..76681778c7eb 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -158,6 +158,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) maView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVFolderStateHdl)); maView->setTemplateStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); + maView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); aButtonAll.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewAllHdl)); aButtonDocs.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewDocsHdl)); @@ -391,6 +392,25 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, Menu*, pMenu) return 0; } +IMPL_LINK(SfxTemplateManagerDlg, OpenTemplateHdl, ThumbnailViewItem*, pItem) +{ + uno::Sequence< PropertyValue > aArgs(1); + aArgs[0].Name = "AsTemplate"; + aArgs[0].Value <<= sal_True; + + TemplateViewItem *pTemplateItem = static_cast(pItem); + + try + { + mxDesktop->loadComponentFromURL(pTemplateItem->getPath(),rtl::OUString("_blank"), 0, aArgs ); + } + catch( const uno::Exception& ) + { + } + + return 0; +} + void SfxTemplateManagerDlg::OnTemplateImport () { sal_Int16 nDialogType =