[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - include/sfx2 sfx2/source
Akshay Deep
akshaydeepiitr at gmail.com
Fri Jun 10 01:18:48 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 | 2 +-
sfx2/source/doc/doc.src | 4 ++++
sfx2/source/doc/templatedlg.cxx | 4 ++--
10 files changed, 34 insertions(+), 8 deletions(-)
New commits:
commit 6c782fe1568d1b3a5f968b3696ba1bf8ad6d914c
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date: Wed Jun 8 05:22:13 2016 +0530
GSoC: 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
Reviewed-on: https://gerrit.libreoffice.org/26040
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Akshay Deep <akshaydeepiitr at gmail.com>
Conflicts:
sfx2/source/control/templateabstractview.cxx
sfx2/source/doc/doc.src
Change-Id: I0bfd5e78120f13338f88c1b0617df3a057cce02f
Reviewed-on: https://gerrit.libreoffice.org/26139
Reviewed-by: Akshay Deep <akshaydeepiitr at gmail.com>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx
index a5d4a75..b211b57 100644
--- a/include/sfx2/templateabstractview.hxx
+++ b/include/sfx2/templateabstractview.hxx
@@ -76,7 +76,7 @@ public:
void insertItem (const TemplateItemProperties &rTemplate);
// 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 f342645..9d72af7 100644
--- a/include/sfx2/templatelocalview.hxx
+++ b/include/sfx2/templatelocalview.hxx
@@ -92,7 +92,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 4e57585..6c7fcae 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -130,7 +130,7 @@ void TemplateAbstractView::insertItem(const TemplateItemProperties &rTemplate)
Invalidate();
}
-void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected)
+void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected, bool bShowCategoryInTooltip)
{
mItemList.clear();
@@ -149,7 +149,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 b1e0242..83d0e47b 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 ea4bc30..1f516c2 100644
--- a/sfx2/source/doc/doc.hrc
+++ b/sfx2/source/doc/doc.hrc
@@ -125,8 +125,8 @@
#define STR_CREATE_ERROR (RID_SFX_DOC_START+103)
#define STR_ERROR_SAVEAS (RID_SFX_DOC_START+105)
#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 eb8a5ae..9b7c0a5 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_AUTOMATICVERSION
{
Text [ en-US ] = "Automatically saved version" ;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index ab0da91..23b9458 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -251,6 +251,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