diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/templatedlg.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 69 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.src | 1 |
4 files changed, 52 insertions, 22 deletions
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 75fc4cff0cf3..7d6940cf9428 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -41,6 +41,8 @@ public: ~SfxTemplateManagerDlg (); + void setSaveMode (bool bMode); + void setDocumentModel (const com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel); DECL_LINK(ViewAllHdl, void*); @@ -138,6 +140,7 @@ private: std::set<const ThumbnailViewItem*> maSelTemplates; std::set<const ThumbnailViewItem*> maSelFolders; + bool mbIsSaveMode; ///< Flag that indicates if we are in save mode or not. com::sun::star::uno::Reference< com::sun::star::frame::XModel > m_xModel; com::sun::star::uno::Reference< com::sun::star::frame::XComponentLoader > mxDesktop; }; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 5f6bd77a06f1..6a257432c084 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -805,6 +805,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) { SfxTemplateManagerDlg aDlg(NULL); aDlg.setDocumentModel(GetModel()); + aDlg.setSaveMode(true); aDlg.Execute(); } else diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index a4a39cda5ee1..9e17da435862 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -114,6 +114,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) mpSearchView(new TemplateSearchView(this)), maView(new TemplateLocalView(this,SfxResId(TEMPLATE_VIEW))), mpOnlineView(new TemplateOnlineView(this, WB_VSCROLL,false)), + mbIsSaveMode(false), mxDesktop(comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.frame.Desktop" ),uno::UNO_QUERY ) { maButtonSelMode.SetStyle(maButtonSelMode.GetStyle() | WB_TOGGLE); @@ -271,6 +272,24 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg () delete mpTemplateDefaultMenu; } +void SfxTemplateManagerDlg::setSaveMode(bool bMode) +{ + mbIsSaveMode = bMode; + + if (bMode) + { + mpViewBar->ShowItem(TBI_TEMPLATE_SAVE); + mpViewBar->HideItem(TBI_TEMPLATE_IMPORT); + mpViewBar->HideItem(TBI_TEMPLATE_REPOSITORY); + } + else + { + mpViewBar->HideItem(TBI_TEMPLATE_SAVE); + mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT); + mpViewBar->ShowItem(TBI_TEMPLATE_REPOSITORY); + } +} + void SfxTemplateManagerDlg::setDocumentModel(const uno::Reference<frame::XModel> &rModel) { m_xModel = rModel; @@ -468,7 +487,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt { if (pItem->isSelected()) { - if (maSelFolders.empty()) + if (maSelFolders.empty() && !mbIsSaveMode) { mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT); mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_DEL); @@ -480,7 +499,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt { maSelFolders.erase(pItem); - if (maSelFolders.empty()) + if (maSelFolders.empty() && !mbIsSaveMode) { mpViewBar->HideItem(TBI_TEMPLATE_IMPORT); mpViewBar->HideItem(TBI_TEMPLATE_FOLDER_DEL); @@ -494,17 +513,20 @@ IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, p { if (pItem->isSelected()) { - if (maSelTemplates.empty()) - { - mpViewBar->Show(false); - mpActionBar->Show(false); - mpTemplateBar->Show(); - } - else + if (!mbIsSaveMode) { - mpTemplateBar->HideItem(TBI_TEMPLATE_EDIT); - mpTemplateBar->HideItem(TBI_TEMPLATE_PROPERTIES); - mpTemplateBar->HideItem(TBI_TEMPLATE_DEFAULT); + if (maSelTemplates.empty()) + { + mpViewBar->Show(false); + mpActionBar->Show(false); + mpTemplateBar->Show(); + } + else + { + mpTemplateBar->HideItem(TBI_TEMPLATE_EDIT); + mpTemplateBar->HideItem(TBI_TEMPLATE_PROPERTIES); + mpTemplateBar->HideItem(TBI_TEMPLATE_DEFAULT); + } } maSelTemplates.insert(pItem); @@ -515,17 +537,20 @@ IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, p { maSelTemplates.erase(pItem); - if (maSelTemplates.empty()) + if (!mbIsSaveMode) { - mpTemplateBar->Show(false); - mpViewBar->Show(); - mpActionBar->Show(); - } - else if (maSelTemplates.size() == 1) - { - mpTemplateBar->ShowItem(TBI_TEMPLATE_EDIT); - mpTemplateBar->ShowItem(TBI_TEMPLATE_PROPERTIES); - mpTemplateBar->ShowItem(TBI_TEMPLATE_DEFAULT); + if (maSelTemplates.empty()) + { + mpTemplateBar->Show(false); + mpViewBar->Show(); + mpActionBar->Show(); + } + else if (maSelTemplates.size() == 1) + { + mpTemplateBar->ShowItem(TBI_TEMPLATE_EDIT); + mpTemplateBar->ShowItem(TBI_TEMPLATE_PROPERTIES); + mpTemplateBar->ShowItem(TBI_TEMPLATE_DEFAULT); + } } } } diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index 5b331479e1b2..db28abcafc4d 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -215,6 +215,7 @@ ModelessDialog DLG_TEMPLATE_MANAGER ToolBoxItem { Identifier = TBI_TEMPLATE_SAVE; + Hide = TRUE; Text [ en-US ] = "Save"; }; }; |