Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3087
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/87/3087/1
Templates Manager: merged the Double Click Handling into TemplateAbstractView
(cherry picked from commit 8a2bfe697bf71c8a2ca3c6ba1ef5e6324d4163aa)
Conflicts:
sfx2/inc/sfx2/templateview.hxx
sfx2/source/control/templateabstractview.cxx
sfx2/source/control/templatelocalview.cxx
sfx2/source/control/templateview.cxx
Change-Id: Iafc1650d57d29fbc24921498f18da6c0e510b37a
---
M sfx2/inc/sfx2/templateabstractview.hxx
M sfx2/inc/sfx2/templatelocalview.hxx
M sfx2/inc/sfx2/templateremoteview.hxx
M sfx2/inc/sfx2/templateview.hxx
M sfx2/source/control/templateabstractview.cxx
M sfx2/source/control/templatelocalview.cxx
M sfx2/source/control/templateremoteview.cxx
M sfx2/source/control/templateview.cxx
M sfx2/source/doc/templatedlg.cxx
9 files changed, 39 insertions(+), 68 deletions(-)
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index ca51181..a5fef71 100644
--- a/sfx2/inc/sfx2/templateabstractview.hxx
+++ b/sfx2/inc/sfx2/templateabstractview.hxx
@@ -87,7 +87,7 @@
virtual void filterTemplatesByApp (const FILTER_APPLICATION &eApp);
- virtual void showOverlay (bool bVisible) = 0;
+ void showOverlay (bool bVisible);
void setItemDimensions (long ItemWidth, long ThumbnailHeight, long DisplayHeight, int
itemPadding);
@@ -109,7 +109,7 @@
void setOverlayItemStateHdl (const Link &aLink) { maOverlayItemStateHdl = aLink; }
- void setOverlayDblClickHdl (const Link &rLink);
+ void setOpenHdl (const Link &rLink);
void setOverlayCloseHdl (const Link &rLink);
@@ -127,10 +127,13 @@
DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*);
+ virtual void OnItemDblClicked(ThumbnailViewItem *pItem);
+
protected:
TemplateView *mpItemView;
Link maOverlayItemStateHdl;
+ Link maOpenHdl;
bool mbFilteredResults; // Flag keep track if overlay has been filtered so folders can get
filtered too afterwards
FILTER_APPLICATION meFilterOption;
diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx
index 78cf547..432b008 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -39,8 +39,6 @@
std::vector<OUString> getFolderNames ();
- virtual void showOverlay (bool bVisible);
-
std::vector<TemplateItemProperties>
getFilteredItems (const boost::function<bool (const TemplateItemProperties&) > &rFunc)
const;
@@ -72,10 +70,6 @@
bool isTemplateNameUnique (const sal_uInt16 nRegionItemId, const OUString &rName) const;
virtual bool renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
-
-private:
-
- virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem);
private:
diff --git a/sfx2/inc/sfx2/templateremoteview.hxx b/sfx2/inc/sfx2/templateremoteview.hxx
index bd1bf5c..b760f00 100644
--- a/sfx2/inc/sfx2/templateremoteview.hxx
+++ b/sfx2/inc/sfx2/templateremoteview.hxx
@@ -25,8 +25,6 @@
virtual ~TemplateRemoteView ();
- virtual void showOverlay (bool bVisible);
-
bool loadRepository (TemplateRepository* pRepository, bool bRefresh);
private:
diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index e219905..aaa7334 100644
--- a/sfx2/inc/sfx2/templateview.hxx
+++ b/sfx2/inc/sfx2/templateview.hxx
@@ -36,26 +36,28 @@
void InsertItems (const std::vector<TemplateItemProperties> &rTemplates);
- void setDblClickHdl (const Link &rLink) { maDblClickHdl = rLink; }
-
void setCloseHdl (const Link &rLink) { maAllButton.SetClickHdl(rLink); }
void setMasterView(TemplateAbstractView* pMasterView) { mpMasterView = pMasterView; }
virtual bool renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
+
+
+ // FIXME Kept only during the refactoring
+ void setOpenHdl (const Link &rLink) { maOpenHdl = rLink; }
+ virtual void OnItemDblClicked(ThumbnailViewItem *pItem) { maOpenHdl.Call(pItem); }
protected:
virtual void Resize ();
- virtual void OnItemDblClicked (ThumbnailViewItem *pItem);
-
private:
TemplateAbstractView* mpMasterView;
+
+ Link maOpenHdl;
PushButton maAllButton;
FixedText maFTName;
sal_uInt16 mnId;
OUString maName;
- Link maDblClickHdl;
};
#endif // TEMPLATEVIEW_HXX
diff --git a/sfx2/source/control/templateabstractview.cxx
b/sfx2/source/control/templateabstractview.cxx
index 14ab811..43efcbb 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -217,9 +217,10 @@
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)
@@ -395,4 +396,26 @@
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 ca8856e..356640f 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -123,26 +123,6 @@
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
{
@@ -591,19 +571,6 @@
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);
-}
bool TemplateLocalView::renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle)
{
diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx
index 9f84053..f89bbab 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -60,17 +60,6 @@
{
}
-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 46ebeaa..a19c8c5 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -94,11 +94,6 @@
ThumbnailView::Resize();
}
-void TemplateView::OnItemDblClicked(ThumbnailViewItem *pItem)
-{
- maDblClickHdl.Call(pItem);
-}
-
bool TemplateView::renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle)
{
if (mpMasterView)
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index e5e4014..a512c8e 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -172,7 +172,7 @@
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
@@ -183,7 +183,7 @@
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);
--
To view, visit https://gerrit.libreoffice.org/3087
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iafc1650d57d29fbc24921498f18da6c0e510b37a
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Context
- [PATCH libreoffice-4-0] Templates Manager: merged the Double Click Handling into Tem... · Bosdonnat Cedric (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.