summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2013-03-27 17:03:02 -0430
committerMiklos Vajna <vmiklos@suse.cz>2013-04-08 07:38:11 +0000
commit73c7e4e5a0da6e4326b9dad3d48ddd0b3aa12d61 (patch)
tree1b7ae8419efc371b445dfc62bb43ee06ce60a533
parentb6ec9b44fd7d4f6064f6eb407a75b1fcdb030ebf (diff)
fdo#60581 Display import templates only when its allowed.
Change-Id: Iefe4fdd1484389d0bbbccecdca49e4c0061ec81e Reviewed-on: https://gerrit.libreoffice.org/3247 Reviewed-by: Miklos Vajna <vmiklos@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
-rw-r--r--sfx2/inc/sfx2/templateabstractview.hxx3
-rw-r--r--sfx2/inc/sfx2/templatelocalview.hxx2
-rw-r--r--sfx2/inc/sfx2/templateremoteview.hxx2
-rw-r--r--sfx2/source/control/templatelocalview.cxx5
-rw-r--r--sfx2/source/control/templateremoteview.cxx5
-rw-r--r--sfx2/source/doc/templatedlg.cxx2
6 files changed, 19 insertions, 0 deletions
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index 1df856ddbb57..e181a00a1da4 100644
--- a/sfx2/inc/sfx2/templateabstractview.hxx
+++ b/sfx2/inc/sfx2/templateabstractview.hxx
@@ -97,6 +97,9 @@ public:
// Return if we can have regions inside the current region
virtual bool isNestedRegionAllowed () const = 0;
+ // Return if we can import templates to the current region
+ virtual bool isImportAllowed () const = 0;
+
sal_uInt16 getCurRegionId () const;
const OUString& getCurRegionName () const;
diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx
index 762dbf5d6eb1..59d05887a20b 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -57,6 +57,8 @@ public:
virtual bool isNestedRegionAllowed () const;
+ virtual bool isImportAllowed () const;
+
bool removeRegion (const sal_uInt16 nItemId);
bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId);
diff --git a/sfx2/inc/sfx2/templateremoteview.hxx b/sfx2/inc/sfx2/templateremoteview.hxx
index 0a89803e3e07..01a582fe0698 100644
--- a/sfx2/inc/sfx2/templateremoteview.hxx
+++ b/sfx2/inc/sfx2/templateremoteview.hxx
@@ -33,6 +33,8 @@ public:
virtual bool isNestedRegionAllowed () const;
+ virtual bool isImportAllowed () const;
+
private:
com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index dd472f2dd446..571cbecba153 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -263,6 +263,11 @@ bool TemplateLocalView::isNestedRegionAllowed() const
return !mnCurRegionId;
}
+bool TemplateLocalView::isImportAllowed() const
+{
+ return mnCurRegionId;
+}
+
bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId)
{
sal_uInt16 nRegionId = USHRT_MAX;
diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx
index 8fd2e87660c4..3fc85a75885a 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -195,4 +195,9 @@ bool TemplateRemoteView::isNestedRegionAllowed() const
return true;
}
+bool TemplateRemoteView::isImportAllowed() const
+{
+ return true;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 99d083ddb482..7c13f95a9ac9 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -639,6 +639,8 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, OpenRegionHdl)
maSelFolders.clear();
maSelTemplates.clear();
+ mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT,mpCurView->isImportAllowed());
+
mpTemplateBar->Hide();
mpViewBar->Show();
mpActionBar->Show();