diff options
Diffstat (limited to 'sfx2/source/control')
-rw-r--r-- | sfx2/source/control/templateabstractview.cxx | 47 | ||||
-rw-r--r-- | sfx2/source/control/templatelocalview.cxx | 34 | ||||
-rw-r--r-- | sfx2/source/control/templateremoteview.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/control/templateview.cxx | 5 |
4 files changed, 45 insertions, 52 deletions
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx index 6db997b0a79e..c9ea989a4ac4 100644 --- a/sfx2/source/control/templateabstractview.cxx +++ b/sfx2/source/control/templateabstractview.cxx @@ -175,15 +175,36 @@ void TemplateAbstractView::filterTemplatesByApp (const FILTER_APPLICATION &eApp) } } +void TemplateAbstractView::showOverlay (bool bVisible) +{ + mpItemView->Show(bVisible); + + // Clear items is the overlay is closed. + if (!bVisible) + { + // Check if the folder view needs to be filtered + if (mbFilteredResults) + { + filterItems(ViewFilter_Application(meFilterOption)); + + mbFilteredResults = false; + meFilterOption = FILTER_APP_NONE; + } + + mpItemView->Clear(); + } +} + void TemplateAbstractView::filterTemplatesByKeyword(const OUString &rKeyword) { if (mpItemView->IsVisible()) mpItemView->filterItems(ViewFilter_Keyword(rKeyword)); } -void TemplateAbstractView::setOverlayDblClickHdl(const Link &rLink) +void TemplateAbstractView::setOpenHdl(const Link &rLink) { - mpItemView->setDblClickHdl(rLink); + maOpenHdl = rLink; + mpItemView->setOpenHdl(rLink); } void TemplateAbstractView::setOverlayCloseHdl(const Link &rLink) @@ -351,4 +372,26 @@ IMPL_LINK(TemplateAbstractView, OverlayItemStateHdl, const ThumbnailViewItem*, p return 0; } +void TemplateAbstractView::OnItemDblClicked (ThumbnailViewItem *pItem) +{ + TemplateContainerItem* pContainerItem = dynamic_cast<TemplateContainerItem*>(pItem); + if ( pContainerItem ) + { + // Fill templates + sal_uInt16 nRegionId = pContainerItem->mnId-1; + + mpItemView->setId(nRegionId); + mpItemView->setName(pContainerItem->maTitle); + mpItemView->InsertItems(pContainerItem->maTemplates); + + mpItemView->filterItems(ViewFilter_Application(meFilterOption)); + + showOverlay(true); + } + else + { + maOpenHdl.Call(pItem); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index 16dcc88a0498..16b1b448c2ef 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -134,26 +134,6 @@ std::vector<OUString> TemplateLocalView::getFolderNames() return ret; } -void TemplateLocalView::showOverlay (bool bVisible) -{ - mpItemView->Show(bVisible); - - // Clear items is the overlay is closed. - if (!bVisible) - { - // Check if the folder view needs to be filtered - if (mbFilteredResults) - { - filterItems(ViewFilter_Application(meFilterOption)); - - mbFilteredResults = false; - meFilterOption = FILTER_APP_NONE; - } - - mpItemView->Clear(); - } -} - std::vector<TemplateItemProperties> TemplateLocalView::getFilteredItems(const boost::function<bool (const TemplateItemProperties&) > &rFunc) const { @@ -608,20 +588,6 @@ bool TemplateLocalView::isTemplateNameUnique(const sal_uInt16 nRegionItemId, con return true; } -void TemplateLocalView::OnItemDblClicked (ThumbnailViewItem *pRegionItem) -{ - // Fill templates - sal_uInt16 nRegionId = pRegionItem->mnId-1; - - mpItemView->setId(nRegionId); - mpItemView->setName(mpDocTemplates->GetRegionName(nRegionId)); - mpItemView->InsertItems(static_cast<TemplateContainerItem*>(pRegionItem)->maTemplates); - - mpItemView->filterItems(ViewFilter_Application(meFilterOption)); - - showOverlay(true); -} - static void lcl_updateThumbnails (TemplateContainerItem *pItem) { pItem->maPreview1.Clear(); diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx index 9f840533d855..f89bbab231cc 100644 --- a/sfx2/source/control/templateremoteview.cxx +++ b/sfx2/source/control/templateremoteview.cxx @@ -60,17 +60,6 @@ TemplateRemoteView::~TemplateRemoteView () { } -void TemplateRemoteView::showOverlay (bool bVisible) -{ - mpItemView->Show(bVisible); - - // Clear items is the overlay is closed. - if (!bVisible) - { - mpItemView->Clear(); - } -} - bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefresh) { if (!pItem) diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx index 2efbbda1019c..01f92064dd83 100644 --- a/sfx2/source/control/templateview.cxx +++ b/sfx2/source/control/templateview.cxx @@ -90,11 +90,6 @@ void TemplateView::Resize() ThumbnailView::Resize(); } -void TemplateView::OnItemDblClicked(ThumbnailViewItem *pItem) -{ - maDblClickHdl.Call(pItem); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |