Kaydet (Commit) a544f366 authored tarafından Rafael Dominguez's avatar Rafael Dominguez

fdo#60581 Display import templates only when its allowed.

Change-Id: I004b50118b1b261de4807660012b55eeecff41a3
üst 57ca6814
...@@ -99,6 +99,9 @@ public: ...@@ -99,6 +99,9 @@ public:
// Return if we can have regions inside the current region // Return if we can have regions inside the current region
virtual bool isNestedRegionAllowed () const = 0; virtual bool isNestedRegionAllowed () const = 0;
// Return if we can import templates to the current region
virtual bool isImportAllowed () const = 0;
sal_uInt16 getCurRegionId () const; sal_uInt16 getCurRegionId () const;
const OUString& getCurRegionName () const; const OUString& getCurRegionName () const;
......
...@@ -57,6 +57,8 @@ public: ...@@ -57,6 +57,8 @@ public:
virtual bool isNestedRegionAllowed () const; virtual bool isNestedRegionAllowed () const;
virtual bool isImportAllowed () const;
bool removeRegion (const sal_uInt16 nItemId); bool removeRegion (const sal_uInt16 nItemId);
bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId); bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId);
......
...@@ -35,6 +35,8 @@ public: ...@@ -35,6 +35,8 @@ public:
virtual bool isNestedRegionAllowed () const; virtual bool isNestedRegionAllowed () const;
virtual bool isImportAllowed () const;
private: private:
com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv; com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
......
...@@ -263,6 +263,11 @@ bool TemplateLocalView::isNestedRegionAllowed() const ...@@ -263,6 +263,11 @@ bool TemplateLocalView::isNestedRegionAllowed() const
return !mnCurRegionId; return !mnCurRegionId;
} }
bool TemplateLocalView::isImportAllowed() const
{
return mnCurRegionId;
}
bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId) bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId)
{ {
sal_uInt16 nRegionId = USHRT_MAX; sal_uInt16 nRegionId = USHRT_MAX;
......
...@@ -174,4 +174,9 @@ bool TemplateRemoteView::isNestedRegionAllowed() const ...@@ -174,4 +174,9 @@ bool TemplateRemoteView::isNestedRegionAllowed() const
return true; return true;
} }
bool TemplateRemoteView::isImportAllowed() const
{
return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -644,6 +644,7 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, OpenRegionHdl) ...@@ -644,6 +644,7 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, OpenRegionHdl)
maSelTemplates.clear(); maSelTemplates.clear();
mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_NEW,mpCurView->isNestedRegionAllowed()); mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_NEW,mpCurView->isNestedRegionAllowed());
mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT,mpCurView->isImportAllowed());
mpTemplateBar->Hide(); mpTemplateBar->Hide();
mpViewBar->Show(); mpViewBar->Show();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment