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

Rafael Dominguez rdominguez at kemper.freedesktop.org
Fri Jun 22 02:04:34 PDT 2012


 sfx2/inc/sfx2/templatefolderview.hxx       |    5 +
 sfx2/inc/sfx2/thumbnailview.hxx            |    3 
 sfx2/inc/templatedlg.hxx                   |   17 ++++
 sfx2/source/control/templatefolderview.cxx |    8 ++
 sfx2/source/control/thumbnailview.cxx      |   19 +++++
 sfx2/source/doc/templatedlg.cxx            |  107 +++++++++++++++++++++++++++++
 6 files changed, 159 insertions(+)

New commits:
commit 9fbe211689e63887178f547dcd0ed0786f527976
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jun 21 23:21:23 2012 -0430

    Trap folder and template state changes in manager dialog.
    
    Change-Id: I1e0cb27f31023a7037c20d07bfe830ee1b107d45

diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index e987535..d2e0359 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -14,6 +14,7 @@
 #include <vcl/button.hxx>
 
 class TemplateFolderView;
+class ThumbnailViewItem;
 class ToolBox;
 
 class SfxTemplateManagerDlg : public ModalDialog
@@ -40,6 +41,9 @@ private:
     DECL_LINK(TBXActionHdl, void*);
     DECL_LINK(TBXTemplateHdl, void*);
 
+    DECL_LINK(TVFolderStateHdl, const ThumbnailViewItem*);
+    DECL_LINK(TVTemplateStateHdl, const ThumbnailViewItem*);
+
     void OnTemplateCreate ();
     void OnTemplateImport ();
     void OnTemplateSearch ();
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index f630fcb..f04532b 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -71,6 +71,9 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
     maView->SetColCount(MAX_COLUMN_COUNT);
     maView->SetLineCount(MAX_LINE_COUNT);
 
+    maView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl));
+    maView->setTemplateStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl));
+
     aButtonAll.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewAllHdl));
     aButtonDocs.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewDocsHdl));
     aButtonPresents.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewPresentsHdl));
@@ -191,6 +194,16 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXTemplateHdl)
     return 0;
 }
 
+IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pItem)
+{
+    return 0;
+}
+
+IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, pItem)
+{
+    return 0;
+}
+
 void SfxTemplateManagerDlg::OnTemplateCreate ()
 {
 }
commit d9bb62afa64bd503cbbf98c6dac2d1b4b5b82777
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jun 21 23:17:32 2012 -0430

    Add callback handler for templates state change in a folderview.
    
    Change-Id: I9cf82a466fbbce52f177bbe729317433ea6663b0

diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index 7923ebf..6433777 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -42,6 +42,8 @@ public:
 
     void filterTemplatesByApp (const FILTER_APPLICATION &eApp);
 
+    void setTemplateStateHdl (const Link &aLink) { maTemplateStateHdl = aLink; }
+
 private:
 
     virtual void OnSelectionMode (bool bMode);
@@ -56,6 +58,7 @@ private:
     FILTER_APPLICATION meFilterOption;
     SfxDocumentTemplates *mpDocTemplates;
     TemplateView *mpItemView;
+    Link maTemplateStateHdl;
 };
 
 #endif // TEMPLATEFOLDERVIEW_HXX
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index 868448a..ac2fa43 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -371,6 +371,7 @@ void TemplateFolderView::OnItemDblClicked (ThumbnailViewItem *pRegionItem)
 
 IMPL_LINK(TemplateFolderView, TVTemplateStateHdl, const ThumbnailViewItem*, pItem)
 {
+    maTemplateStateHdl.Call((void*)pItem);
     return 0;
 }
 
commit b1089e3ac52e588065d0f9e8105582d7ee433d49
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jun 21 23:06:18 2012 -0430

    Track templateview items that change their state in folderview.
    
    Change-Id: Ic9209afe698ff68f97b8d5918bd4d429659553c2

diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index 1203883..7923ebf 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -48,6 +48,8 @@ private:
 
     virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem);
 
+    DECL_LINK(TVTemplateStateHdl, const ThumbnailViewItem*);
+
 private:
 
     bool mbFilteredResults;     // Flag keep track if overlay has been filtered so folders can get filtered too afterwards
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index 340e179..868448a 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -243,6 +243,8 @@ TemplateFolderView::TemplateFolderView ( Window* pParent, const ResId& rResId, b
     mpItemView->SetSizePixel(GetOutputSizePixel());
     mpItemView->SetColCount(3);
     mpItemView->SetLineCount(2);
+
+    mpItemView->setItemStateHdl(LINK(this,TemplateFolderView,TVTemplateStateHdl));
 }
 
 TemplateFolderView::~TemplateFolderView()
@@ -367,6 +369,11 @@ void TemplateFolderView::OnItemDblClicked (ThumbnailViewItem *pRegionItem)
     mpItemView->Show();
 }
 
+IMPL_LINK(TemplateFolderView, TVTemplateStateHdl, const ThumbnailViewItem*, pItem)
+{
+    return 0;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 
 
commit ec3d50549340821acfb1c2dcabb55b1c59c03700
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jun 21 22:53:14 2012 -0430

    Add a handler for item states changes to ThumbnailView.
    
    Change-Id: If5f060f59dfdcce6641ed7cfc3cb8200a4475490

diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx
index 613a30e..887b504 100644
--- a/sfx2/inc/sfx2/thumbnailview.hxx
+++ b/sfx2/inc/sfx2/thumbnailview.hxx
@@ -240,6 +240,8 @@ public:
 
     void filterItems (const boost::function<bool (const ThumbnailViewItem*) > &func);
 
+    void setItemStateHdl (const Link &aLink) { maItemStateHdl = aLink; }
+
 protected:
 
     virtual void MouseButtonDown( const MouseEvent& rMEvt );
@@ -338,6 +340,7 @@ protected:
     bool mbSelectionMode;
     Color maColor;
 
+    Link maItemStateHdl;
     ThumbnailItemAttributes *mpItemAttrs;
     drawinglayer::processor2d::BaseProcessor2D *mpProcessor;
     boost::function<bool (const ThumbnailViewItem*) > maFilterFunc;
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 6d04248..cf4b225 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -322,6 +322,9 @@ void ThumbnailView::CalculateItemPositions ()
 
         for ( size_t i = 0; i < nItemCount; i++ )
         {
+            if (mItemList[i]->isVisible())
+                maItemStateHdl.Call(mItemList[i]);
+
             mItemList[i]->show(false);
         }
 
@@ -370,6 +373,9 @@ void ThumbnailView::CalculateItemPositions ()
                     ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny );
                 }
 
+                if (!mItemList[i]->isVisible())
+                    maItemStateHdl.Call(mItemList[i]);
+
                 pItem->show(true);
                 pItem->setDrawArea(Rectangle( Point(x,y), Size(mnItemWidth, mnItemHeight) ));
                 pItem->calculateItemsPosition();
@@ -394,6 +400,9 @@ void ThumbnailView::CalculateItemPositions ()
                     ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny );
                 }
 
+                if (mItemList[i]->isVisible())
+                    maItemStateHdl.Call(mItemList[i]);
+
                 pItem->show(false);
             }
         }
@@ -567,6 +576,9 @@ IMPL_LINK( ThumbnailView,ImplScrollHdl, ScrollBar*, pScrollBar )
 
             if ( (i >= nFirstItem) && (i < nLastItem) )
             {
+                if (!mItemList[i]->isVisible())
+                    maItemStateHdl.Call(mItemList[i]);
+
                 pItem->show(true);
                 pItem->setDrawArea(Rectangle( Point(x,y), Size(mnItemWidth, mnItemHeight) ));
                 pItem->calculateItemsPosition();
@@ -581,6 +593,9 @@ IMPL_LINK( ThumbnailView,ImplScrollHdl, ScrollBar*, pScrollBar )
             }
             else
             {
+                if (mItemList[i]->isVisible())
+                    maItemStateHdl.Call(mItemList[i]);
+
                 pItem->show(false);
             }
         }
@@ -635,6 +650,8 @@ void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt )
 
                         if (!pItem->isHighlighted())
                             DrawItem(pItem);
+
+                        maItemStateHdl.Call(pItem);
                     }
                     else
                     {
@@ -644,6 +661,8 @@ void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt )
 
                             if (!pItem->isHighlighted())
                                 DrawItem(pItem);
+
+                            maItemStateHdl.Call(pItem);
                         }
 
                         //StartTracking( STARTTRACK_SCROLLREPEAT );
commit 0346baf8bc34d893f4455386a13b46967b3c51b9
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jun 21 22:20:23 2012 -0430

    Create toolbar click handlers and handlers for every action.
    
    Change-Id: I718d77479ed9222ec82914e26fe96bedff892e9c

diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index 4859532..e987535 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -36,6 +36,19 @@ private:
 
     DECL_LINK(OnClickSelectionMode, ImageButton*);
 
+    DECL_LINK(TBXViewHdl, void*);
+    DECL_LINK(TBXActionHdl, void*);
+    DECL_LINK(TBXTemplateHdl, void*);
+
+    void OnTemplateCreate ();
+    void OnTemplateImport ();
+    void OnTemplateSearch ();
+    void OnTemplateAction ();
+    void OnTemplateEdit ();
+    void OnTemplateProperties ();
+    void OnTemplateMove ();
+    void OnTemplateDelete ();
+
 private:
 
     PushButton aButtonAll;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 3d56731..f630fcb 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -57,6 +57,11 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
     mpViewBar->SetButtonType(BUTTON_SYMBOLTEXT);
     mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT);
 
+    // Set toolbox handlers
+    mpViewBar->SetClickHdl(LINK(this,SfxTemplateManagerDlg,TBXViewHdl));
+    mpActionBar->SetClickHdl(LINK(this,SfxTemplateManagerDlg,TBXActionHdl));
+    mpTemplateBar->SetClickHdl(LINK(this,SfxTemplateManagerDlg,TBXTemplateHdl));
+
     // Set view position below toolbox
     Point aViewPos = maView->GetPosPixel();
     aViewPos.setY(aActionPos.Y() + aActionSize.getHeight() + PADDING_TOOLBAR_VIEW);
@@ -129,4 +134,93 @@ IMPL_LINK (SfxTemplateManagerDlg, OnClickSelectionMode, ImageButton*, pButton)
     return 0;
 }
 
+IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXViewHdl)
+{
+    switch(mpViewBar->GetCurItemId())
+    {
+    case TBI_TEMPLATE_CREATE:
+        OnTemplateCreate();
+        break;
+    case TBI_TEMPLATE_IMPORT:
+        OnTemplateImport();
+        break;
+    default:
+        break;
+    }
+
+    return 0;
+}
+
+IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXActionHdl)
+{
+    switch(mpActionBar->GetCurItemId())
+    {
+    case TBI_TEMPLATE_SEARCH:
+        OnTemplateSearch();
+        break;
+    case TBI_TEMPLATE_ACTION:
+        OnTemplateAction();
+        break;
+    default:
+        break;
+    }
+
+    return 0;
+}
+
+IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXTemplateHdl)
+{
+    switch(mpTemplateBar->GetCurItemId())
+    {
+    case TBI_TEMPLATE_EDIT:
+        OnTemplateEdit();
+        break;
+    case TBI_TEMPLATE_PROPERTIES:
+        OnTemplateProperties();
+        break;
+    case TBI_TEMPLATE_MOVE:
+        OnTemplateMove();
+        break;
+    case TBI_TEMPLATE_DELETE:
+        OnTemplateDelete();
+        break;
+    default:
+        break;
+    }
+
+    return 0;
+}
+
+void SfxTemplateManagerDlg::OnTemplateCreate ()
+{
+}
+
+void SfxTemplateManagerDlg::OnTemplateImport ()
+{
+}
+
+void SfxTemplateManagerDlg::OnTemplateSearch ()
+{
+}
+
+void SfxTemplateManagerDlg::OnTemplateAction ()
+{
+}
+
+void SfxTemplateManagerDlg::OnTemplateEdit ()
+{
+}
+
+void SfxTemplateManagerDlg::OnTemplateProperties ()
+{
+}
+
+void SfxTemplateManagerDlg::OnTemplateMove ()
+{
+}
+
+void SfxTemplateManagerDlg::OnTemplateDelete ()
+{
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list