diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2013-03-27 16:59:50 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2013-03-28 00:21:14 -0430 |
commit | 57ca68147e6e6df358fcb7a991847513aa0efe9d (patch) | |
tree | e4a85f1c1f49d65616730b4efb529225554d5a91 /sfx2 | |
parent | 6ba185d1fff1f3bb26ae03b21c7d6a3acefd6d2f (diff) |
Display create template folder only when its allowed.
Change-Id: Ie2acd2246694ce792f628a7057df5c30dac5db32
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/templateabstractview.hxx | 3 | ||||
-rw-r--r-- | sfx2/inc/sfx2/templatelocalview.hxx | 2 | ||||
-rw-r--r-- | sfx2/inc/sfx2/templateremoteview.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/templatelocalview.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/control/templateremoteview.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 2 |
6 files changed, 19 insertions, 0 deletions
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx index 16a82e4869fd..2e3914430e6d 100644 --- a/sfx2/inc/sfx2/templateabstractview.hxx +++ b/sfx2/inc/sfx2/templateabstractview.hxx @@ -96,6 +96,9 @@ public: virtual sal_uInt16 createRegion (const OUString &rName) = 0; + // Return if we can have regions inside the current region + virtual bool isNestedRegionAllowed () 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 17eb1403bdd0..297735402aa6 100644 --- a/sfx2/inc/sfx2/templatelocalview.hxx +++ b/sfx2/inc/sfx2/templatelocalview.hxx @@ -55,6 +55,8 @@ public: virtual sal_uInt16 createRegion (const OUString &rName); + virtual bool isNestedRegionAllowed () 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 a2341c42d553..915f422473f1 100644 --- a/sfx2/inc/sfx2/templateremoteview.hxx +++ b/sfx2/inc/sfx2/templateremoteview.hxx @@ -33,6 +33,8 @@ public: virtual sal_uInt16 createRegion (const OUString &rName); + virtual bool isNestedRegionAllowed () 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 69f0c91c779d..611f9085afdb 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -258,6 +258,11 @@ sal_uInt16 TemplateLocalView::createRegion(const OUString &rName) return pItem->mnId; } +bool TemplateLocalView::isNestedRegionAllowed() 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 663ae2b0a53d..67509919835a 100644 --- a/sfx2/source/control/templateremoteview.cxx +++ b/sfx2/source/control/templateremoteview.cxx @@ -169,4 +169,9 @@ sal_uInt16 TemplateRemoteView::createRegion(const OUString &/*rName*/) return 0; } +bool TemplateRemoteView::isNestedRegionAllowed() 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 2dee3e8d2175..d286397bff47 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -643,6 +643,8 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, OpenRegionHdl) maSelFolders.clear(); maSelTemplates.clear(); + mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_NEW,mpCurView->isNestedRegionAllowed()); + mpTemplateBar->Hide(); mpViewBar->Show(); mpActionBar->Show(); |