[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sfx2/inc sfx2/source

Cédric Bosdonnat cedric.bosdonnat at free.fr
Thu Mar 28 05:12:20 PDT 2013


 sfx2/inc/sfx2/templateabstractview.hxx       |    7 ++++-
 sfx2/inc/sfx2/templatelocalview.hxx          |    6 ----
 sfx2/inc/sfx2/templateremoteview.hxx         |    2 -
 sfx2/inc/sfx2/templateview.hxx               |   12 +++++----
 sfx2/source/control/templateabstractview.cxx |   27 ++++++++++++++++++++--
 sfx2/source/control/templatelocalview.cxx    |   33 ---------------------------
 sfx2/source/control/templateremoteview.cxx   |   11 ---------
 sfx2/source/control/templateview.cxx         |    5 ----
 sfx2/source/doc/templatedlg.cxx              |    4 +--
 9 files changed, 39 insertions(+), 68 deletions(-)

New commits:
commit 14fb3c4cdd879c1c6f6e1571b327d0133df74d8c
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Fri Dec 21 15:37:49 2012 +0100

    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
    Reviewed-on: https://gerrit.libreoffice.org/3087
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

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 @@ public:
 
     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 @@ public:
 
     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 @@ protected:
 
     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 @@ public:
 
     std::vector<OUString> getFolderNames ();
 
-    virtual void showOverlay (bool bVisible);
-
     std::vector<TemplateItemProperties>
         getFilteredItems (const boost::function<bool (const TemplateItemProperties&) > &rFunc) const;
 
@@ -75,10 +73,6 @@ public:
 
 private:
 
-    virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem);
-
-private:
-
     SfxDocumentTemplates *mpDocTemplates;
 };
 
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 @@ public:
 
     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 @@ public:
 
     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 @@ void TemplateAbstractView::filterTemplatesByKeyword(const OUString &rKeyword)
         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 @@ 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 ca8856e..356640f 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -123,26 +123,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
 {
@@ -591,19 +571,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);
-}
 
 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 @@ 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 46ebeaa..a19c8c5 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -94,11 +94,6 @@ void TemplateView::Resize()
     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 @@ 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
@@ -183,7 +183,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);


More information about the Libreoffice-commits mailing list