[Libreoffice-commits] .: Branch 'feature/template-dialog' - sfx2/inc sfx2/source

Rafael Dominguez rdominguez at kemper.freedesktop.org
Mon Jun 18 21:20:19 PDT 2012


 sfx2/inc/sfx2/templatefolderview.hxx       |    5 +++++
 sfx2/inc/templatedlg.hxx                   |    2 ++
 sfx2/source/control/templatefolderview.cxx |   17 ++++++++++++++---
 sfx2/source/doc/templatedlg.cxx            |    6 ++++++
 4 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit 114dde47903b7c174eca934690c1372d4be52330
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jun 18 23:40:59 2012 -0430

    Close overlay when clicking outside.
    
    Change-Id: Iee39a99e89881aeaeaca93adfcfce9b51eeaec78

diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index a6aec17..b5b967f 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -25,6 +25,11 @@ public:
     // Fill view with template folders thumbnails
     void Populate ();
 
+    // Check if the overlay is visible or not.
+    bool isOverlayVisible () const;
+
+    void showOverlay (bool bVisible);
+
 private:
 
     virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem);
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index bb13fe0..ee98e2e 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -31,6 +31,8 @@ public:
 
 private:
 
+    virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
     DECL_LINK(OnClickSelectionMode, ImageButton*);
 
 private:
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index 8106cb3..c2165f5 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -189,11 +189,22 @@ void TemplateFolderView::Populate ()
         Invalidate();
 }
 
-void TemplateFolderView::OnItemDblClicked (ThumbnailViewItem *pRegionItem)
+bool TemplateFolderView::isOverlayVisible () const
+{
+    return mpItemView->IsVisible();
+}
+
+void TemplateFolderView::showOverlay (bool bVisible)
 {
-    // Clear previous items
-    mpItemView->Clear();
+    mpItemView->Show(bVisible);
 
+    // Clear items is the overlay is closed.
+    if (!bVisible)
+        mpItemView->Clear();
+}
+
+void TemplateFolderView::OnItemDblClicked (ThumbnailViewItem *pRegionItem)
+{
     // Fill templates
     sal_uInt16 nRegionId = pRegionItem->mnId-1;
     const SfxDocumentTemplates* pTemplates = mpMgr->GetTemplates();
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index a7d5c32..6fab400 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -69,6 +69,12 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewDrawsHdl)
     return 0;
 }
 
+void SfxTemplateManagerDlg::MouseButtonDown( const MouseEvent& rMEvt )
+{
+    if (!maView->GetActiveClipRegion().IsInside(rMEvt.GetPosPixel()) && maView->isOverlayVisible())
+        maView->showOverlay(false);
+}
+
 IMPL_LINK (SfxTemplateManagerDlg, OnClickSelectionMode, ImageButton*, pButton)
 {
     maView->setSelectionMode(pButton->GetState() == STATE_CHECK);


More information about the Libreoffice-commits mailing list