diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-12-21 15:37:49 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-01-08 15:29:52 +0100 |
commit | 8a2bfe697bf71c8a2ca3c6ba1ef5e6324d4163aa (patch) | |
tree | bb1de8da97d066cbed5d47ca9af75b6cccf1de7b /sfx2/source | |
parent | 94874973769fee81f8ab35b2aeb0dc22812a2b48 (diff) |
Templates Manager: merged the Double Click Handling into TemplateAbstractView
Change-Id: Iafc1650d57d29fbc24921498f18da6c0e510b37a
Diffstat (limited to 'sfx2/source')
-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 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 4 |
5 files changed, 47 insertions, 54 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: */ diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 48a7cff69ee8..cfb979e2ec9c 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -154,7 +154,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) maView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVFolderStateHdl)); maView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); - maView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); + maView->setOpenHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); maView->setOverlayCloseHdl(LINK(this,SfxTemplateManagerDlg,CloseOverlayHdl)); // Set online view position and dimensions @@ -165,7 +165,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) TEMPLATE_ITEM_PADDING); mpOnlineView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); - mpOnlineView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); + mpOnlineView->setOpenHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); mpOnlineView->setOverlayCloseHdl(LINK(this,SfxTemplateManagerDlg,CloseOverlayHdl)); mpSearchView->setItemMaxTextLength(TEMPLATE_ITEM_MAX_TEXT_LENGTH); |