summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-07-27 09:10:24 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-07-29 21:29:23 -0430
commit72b48950556820cac8198da467254b25f2e054c4 (patch)
tree1a3fd7b68b8f3385bbef830f1bfc9e5ed19e5b4d /sfx2
parentc180c37c032532df0534856cd1d9791c0e965d49 (diff)
Do different action when moving templates depending on the active view.
Change-Id: I97726bf0d8e26f833fc96274a908e72c6110d86b
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/templatedlg.hxx16
-rw-r--r--sfx2/source/doc/templatedlg.cxx107
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)
{