[PATCH libreoffice-4-0] fdo#60581 Display import templates only when its allowed.

Rafael Dominguez (via Code Review) gerrit at gerrit.libreoffice.org
Sun Apr 7 11:52:27 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3247

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/47/3247/1

fdo#60581 Display import templates only when its allowed.

Change-Id: Iefe4fdd1484389d0bbbccecdca49e4c0061ec81e
---
M sfx2/inc/sfx2/templateabstractview.hxx
M sfx2/inc/sfx2/templatelocalview.hxx
M sfx2/inc/sfx2/templateremoteview.hxx
M sfx2/source/control/templatelocalview.cxx
M sfx2/source/control/templateremoteview.cxx
M sfx2/source/doc/templatedlg.cxx
6 files changed, 19 insertions(+), 0 deletions(-)



diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index 1df856d..e181a00 100644
--- a/sfx2/inc/sfx2/templateabstractview.hxx
+++ b/sfx2/inc/sfx2/templateabstractview.hxx
@@ -97,6 +97,9 @@
     // 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 762dbf5..59d0588 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -57,6 +57,8 @@
 
     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 0a89803..01a582f 100644
--- a/sfx2/inc/sfx2/templateremoteview.hxx
+++ b/sfx2/inc/sfx2/templateremoteview.hxx
@@ -33,6 +33,8 @@
 
     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 dd472f2..571cbec 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -263,6 +263,11 @@
     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 8fd2e87..3fc85a7 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -195,4 +195,9 @@
     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 99d083d..7c13f95 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -639,6 +639,8 @@
     maSelFolders.clear();
     maSelTemplates.clear();
 
+    mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT,mpCurView->isImportAllowed());
+
     mpTemplateBar->Hide();
     mpViewBar->Show();
     mpActionBar->Show();

-- 
To view, visit https://gerrit.libreoffice.org/3247
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefe4fdd1484389d0bbbccecdca49e4c0061ec81e
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Rafael Dominguez <venccsralph at gmail.com>



More information about the LibreOffice mailing list