[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Akshay Deep akshaydeepiitr at gmail.com
Thu Jun 9 20:54:27 UTC 2016


 include/sfx2/templateabstractview.hxx        |    2 +-
 include/sfx2/templatedefaultview.hxx         |    2 ++
 include/sfx2/templatelocalview.hxx           |    2 +-
 sfx2/source/control/templateabstractview.cxx |   13 +++++++++++--
 sfx2/source/control/templatedefaultview.cxx  |    9 +++++++++
 sfx2/source/control/templatelocalview.cxx    |    3 ++-
 sfx2/source/dialog/backingwindow.cxx         |    1 +
 sfx2/source/doc/doc.hrc                      |    1 +
 sfx2/source/doc/doc.src                      |    4 ++++
 sfx2/source/doc/templatedlg.cxx              |    4 ++--
 10 files changed, 34 insertions(+), 7 deletions(-)

New commits:
commit a7220f6a19556b982bedb52c87d8d345eab85118
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date:   Wed Jun 8 05:22:13 2016 +0530

    Templates: Display titles and category as tooltips
    
    Tooltip text:
    1. Template Manager:
         All Categories: Title + Category
         Category: Title
    2. Start center: Title
    
    Conflicts:
    	sfx2/source/doc/doc.hrc
    
    Conflicts:
    	sfx2/source/doc/templatedlg.cxx
    
    Change-Id: I0bfd5e78120f13338f88c1b0617df3a057cce02f
    Reviewed-on: https://gerrit.libreoffice.org/26040
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Akshay Deep <akshaydeepiitr at gmail.com>

diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx
index 79ec353..68faee3 100644
--- a/include/sfx2/templateabstractview.hxx
+++ b/include/sfx2/templateabstractview.hxx
@@ -74,7 +74,7 @@ public:
     virtual void dispose() override;
 
     // Fill view with new item list
-    void insertItems (const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected = true);
+    void insertItems (const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected = true, bool bShowCategoryInTooltip = false);
 
     // Fill view with template folders thumbnails
     virtual void Populate () { }
diff --git a/include/sfx2/templatedefaultview.hxx b/include/sfx2/templatedefaultview.hxx
index 6d2fcdf..4438536 100644
--- a/include/sfx2/templatedefaultview.hxx
+++ b/include/sfx2/templatedefaultview.hxx
@@ -19,6 +19,8 @@ public:
 
     virtual void reload() override;
 
+    virtual void showAllTemplates () override;
+
     virtual void KeyInput( const KeyEvent& rKEvt ) override;
 
     void createContextMenu();
diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx
index db5c1b6..735e897 100644
--- a/include/sfx2/templatelocalview.hxx
+++ b/include/sfx2/templatelocalview.hxx
@@ -87,7 +87,7 @@ public:
 
     virtual bool renameItem(ThumbnailViewItem* pItem, const OUString& sNewTitle) override;
 
-private:
+protected:
 
     SfxDocumentTemplates *mpDocTemplates;
     std::vector<TemplateContainerItem* > maRegions;
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 536acdf..ac4d086 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -107,7 +107,7 @@ void TemplateAbstractView::dispose()
     ThumbnailView::dispose();
 }
 
-void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected)
+void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected, bool bShowCategoryInTooltip)
 {
     mItemList.clear();
 
@@ -126,7 +126,16 @@ void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties>
         pChild->mnRegionId = pCur->nRegionId;
         pChild->maTitle = pCur->aName;
         pChild->setPath(pCur->aPath);
-        pChild->setHelpText(pCur->aRegionName);
+
+        if(!bShowCategoryInTooltip)
+            pChild->setHelpText(pCur->aName);
+        else
+        {
+            OUString sHelpText = SfxResId(STR_TEMPLATE_TOOLTIP).toString();
+            sHelpText = (sHelpText.replaceFirst("$1", pCur->aName)).replaceFirst("$1", pCur->aRegionName);
+            pChild->setHelpText(sHelpText);
+        }
+
         pChild->maPreview1 = pCur->aThumbnail;
 
         if(IsDefaultTemplate(pCur->aPath))
diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx
index d6ffb63..789ef16 100644
--- a/sfx2/source/control/templatedefaultview.cxx
+++ b/sfx2/source/control/templatedefaultview.cxx
@@ -48,6 +48,15 @@ void TemplateDefaultView::reload()
     set_width_request(mnTextHeight + mnItemMaxSize + 2*mnItemPadding);
 }
 
+void TemplateDefaultView::showAllTemplates()
+{
+    mnCurRegionId = 0;
+    maCurRegionName.clear();
+
+    insertItems(maAllTemplates, false);
+    maOpenRegionHdl.Call(nullptr);
+}
+
 void TemplateDefaultView::KeyInput( const KeyEvent& rKEvt )
 {
     ThumbnailView::KeyInput(rKEvt);
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 533ee6b..de8650c 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -143,7 +143,8 @@ void TemplateLocalView::showAllTemplates()
     mnCurRegionId = 0;
     maCurRegionName.clear();
 
-    insertItems(maAllTemplates, false);
+    insertItems(maAllTemplates, false, true);
+
     maOpenRegionHdl.Call(nullptr);
 }
 
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 3c45106..350dc4a 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -265,6 +265,7 @@ void BackingWindow::initControls()
     mpLocalView->setCreateContextMenuHdl(LINK(this, BackingWindow, CreateContextMenuHdl));
     mpLocalView->setOpenTemplateHdl(LINK(this, BackingWindow, OpenTemplateHdl));
     mpLocalView->setEditTemplateHdl(LINK(this, BackingWindow, EditTemplateHdl));
+    mpLocalView->ShowTooltips( true );
 
     setupButton( mpOpenButton );
     setupButton( mpRemoteButton );
diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc
index 830435d..e938ab6 100644
--- a/sfx2/source/doc/doc.hrc
+++ b/sfx2/source/doc/doc.hrc
@@ -125,6 +125,7 @@
 #define STR_CATEGORY_RENAME                 (RID_SFX_DOC_START+109)
 #define STR_TEMPLATE_SELECTION              (RID_SFX_DOC_START+120)
 #define STR_RESET_DEFAULT                   (RID_SFX_DOC_START+122)
+#define STR_TEMPLATE_TOOLTIP                (RID_SFX_DOC_START+169)
 
 // please update to the last id
 #define ACT_SFX_DOC_END IMG_ACTION_REFRESH
diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src
index ca4a132..2ed6bcd 100644
--- a/sfx2/source/doc/doc.src
+++ b/sfx2/source/doc/doc.src
@@ -84,6 +84,10 @@ String STR_RENAME_TEMPLATE
 {
     Text [ en-US ] = "Enter New Name: " ;
 };
+String STR_TEMPLATE_TOOLTIP
+{
+    Text [ en-US ] = "Title: $1\nCategory: $1" ;
+};
 String STR_TEMPLATE_SELECTION
 {
     Text [ en-US ] = "Select a Template" ;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 67b338c..675a20a 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -250,6 +250,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent)
     mpSearchView->setEditTemplateHdl(LINK(this,SfxTemplateManagerDlg, EditTemplateHdl));
     mpSearchView->setDeleteTemplateHdl(LINK(this,SfxTemplateManagerDlg, DeleteTemplateHdl));
     mpSearchView->setDefaultTemplateHdl(LINK(this,SfxTemplateManagerDlg, DefaultTemplateHdl));
+
+    mpLocalView->ShowTooltips(true);
     mpSearchView->ShowTooltips(true);
 
     mpOKButton->SetClickHdl(LINK(this, SfxTemplateManagerDlg, OkClickHdl));
@@ -737,7 +739,6 @@ IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, ImportClickHdl, Button*, void)
 
     mpLocalView->reload();
     mpLocalView->showAllTemplates();
-    mpLocalView->ShowTooltips(true);
     mpCBApp->SelectEntryPos(0);
     mpCBFolder->SelectEntryPos(0);
     mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);
@@ -1297,7 +1298,6 @@ void SfxTemplateManagerDlg::OnCategoryDelete()
 
     mpLocalView->reload();
     mpLocalView->showAllTemplates();
-    mpLocalView->ShowTooltips(true);
     mpCBApp->SelectEntryPos(0);
     mpCBFolder->SelectEntryPos(0);
     mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER);


More information about the Libreoffice-commits mailing list