diff options
-rw-r--r-- | sfx2/inc/templatedlg.hxx | 16 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 107 |
2 files changed, 91 insertions, 32 deletions
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 23fd9a4d0fc3..607d39421091 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -81,6 +81,22 @@ private: // Exchange view between local/online view. void switchMainView (bool bDisplayLocal); + /** + * + * Move templates stored in the filesystem to another folder. + * + **/ + + void localMoveTo (sal_uInt16 nMenuId); + + /** + * + * Move search result templates stored in the filesystem to another folder. + * + **/ + + void localSearchMoveTo (sal_uInt16 nMenuId); + private: PushButton aButtonAll; diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index a6afee13e08c..6c942b5f6144 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -537,42 +537,17 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu) { sal_uInt16 nMenuId = pMenu->GetCurItemId(); - if (nMenuId == MNI_MOVE_NEW) + if (mpSearchView->IsVisible()) { - InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this); - - int ret = dlg.Execute(); - - if (ret) - { - rtl::OUString aName = dlg.getEntryText(); - - if (!aName.isEmpty()) - { - sal_uInt16 nNewRegionId = maView->createRegion(aName); - - if (nNewRegionId) - { - // Move templates to desired folder if for some reason move fails - // try copying them. - if (!maView->moveTemplates(maSelTemplates,nNewRegionId,false) && - !maView->moveTemplates(maSelTemplates,nNewRegionId,true)) - { - } - } - } - } + // Check if we are searching the local or remote templates + if (mpCurView == maView) + localSearchMoveTo(nMenuId); } else { - // Try to move the template, if isnt possible try to copy it. - - sal_uInt16 nItemId = maView->GetItemId(nMenuId-MNI_MOVE_FOLDER_BASE); - - if (!maView->moveTemplates(maSelTemplates,nItemId,false) && - !maView->moveTemplates(maSelTemplates,nItemId,true)) - { - } + // Check if we are displaying the local or remote templates + if (mpCurView == maView) + localMoveTo(nMenuId); } return 0; @@ -864,6 +839,74 @@ void SfxTemplateManagerDlg::switchMainView(bool bDisplayLocal) } } +void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId) +{ + sal_uInt16 nItemId = 0; + + if (nMenuId == MNI_MOVE_NEW) + { + InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this); + + int ret = dlg.Execute(); + + if (ret) + { + rtl::OUString aName = dlg.getEntryText(); + + if (!aName.isEmpty()) + nItemId = maView->createRegion(aName); + } + } + else + { + nItemId = maView->GetItemId(nMenuId-MNI_MOVE_FOLDER_BASE); + } + + if (nItemId) + { + // Move templates to desired folder if for some reason move fails + // try copying them. + if (!maView->moveTemplates(maSelTemplates,nItemId,false) && + !maView->moveTemplates(maSelTemplates,nItemId,true)) + { + } + } +} + +void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId) +{ + sal_uInt16 nItemId = 0; + + if (nMenuId == MNI_MOVE_NEW) + { + InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this); + + int ret = dlg.Execute(); + + if (ret) + { + rtl::OUString aName = dlg.getEntryText(); + + if (!aName.isEmpty()) + nItemId = maView->createRegion(aName); + } + } + else + { + nItemId = maView->GetItemId(nMenuId-MNI_MOVE_FOLDER_BASE); + } + + if (nItemId) + { + // Move templates to desired folder if for some reason move fails + // try copying them. + if (!maView->moveTemplates(maSelTemplates,nItemId,false) && + !maView->moveTemplates(maSelTemplates,nItemId,true)) + { + } + } +} + void lcl_createTemplate(uno::Reference< com::sun::star::frame::XComponentLoader > xDesktop, const FILTER_APPLICATION eApp) { |