summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2013-03-27 17:03:02 -0430
committerRafael Dominguez <venccsralph@gmail.com>2013-03-28 00:21:14 -0430
commita544f366867cb03ccc3a90703fc437e81fabc7a2 (patch)
tree2d7bb5d7ca42b97c3bb18a6b0f141d3928b33eba
parent57ca68147e6e6df358fcb7a991847513aa0efe9d (diff)
fdo#60581 Display import templates only when its allowed.
Change-Id: I004b50118b1b261de4807660012b55eeecff41a3
-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.cxx1
6 files changed, 18 insertions, 0 deletions
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index 2e3914430e6d..564978e6d04a 100644
--- a/sfx2/inc/sfx2/templateabstractview.hxx
+++ b/sfx2/inc/sfx2/templateabstractview.hxx
@@ -99,6 +99,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 297735402aa6..902b7cfee5cf 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 915f422473f1..bcb2b68fc0a4 100644
--- a/sfx2/inc/sfx2/templateremoteview.hxx
+++ b/sfx2/inc/sfx2/templateremoteview.hxx
@@ -35,6 +35,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 611f9085afdb..a73fa23ce3b9 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 67509919835a..ea97350c8ec9 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -174,4 +174,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 d286397bff47..48ed3fd014a2 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -644,6 +644,7 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, OpenRegionHdl)
maSelTemplates.clear();
mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_NEW,mpCurView->isNestedRegionAllowed());
+ mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT,mpCurView->isImportAllowed());
mpTemplateBar->Hide();
mpViewBar->Show();