summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-07-29 21:28:31 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-07-29 21:29:31 -0430
commit6c0d0bc410b4c5b4c2c559bbe2247d4bbea610c0 (patch)
treebcd0587853f7d1a5dfe39e99e6608a844c6493aa /sfx2
parenta2a041a0a1b1d00229c25e16d07e39b0e32bec86 (diff)
Import templates from a remote repository.
Change-Id: I2a3420903b546cc6ead8dcdc6196b31fc2c1a24a
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/templatefolderview.hxx3
-rw-r--r--sfx2/inc/templatedlg.hxx2
-rw-r--r--sfx2/source/control/templatefolderview.cxx38
-rw-r--r--sfx2/source/doc/templatedlg.cxx38
4 files changed, 81 insertions, 0 deletions
diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index f6cb683af30f..cc7f957d2d72 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -58,6 +58,9 @@ public:
bool moveTemplates (std::set<const ThumbnailViewItem*> &rItems, const sal_uInt16 nTargetItem, bool bCopy);
+ void copyFrom (const sal_uInt16 nRegionItemId, const OUString &rName,
+ const BitmapEx &rThumbnail, const OUString &rPath);
+
void copyFrom (TemplateFolderViewItem *pItem, const rtl::OUString &rPath);
private:
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index 607d39421091..bffc83b09ece 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -89,6 +89,8 @@ private:
void localMoveTo (sal_uInt16 nMenuId);
+ void remoteMoveTo (const sal_uInt16 nMenuId);
+
/**
*
* Move search result templates stored in the filesystem to another folder.
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index c47b2ab59d8c..657e5435865b 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -551,6 +551,44 @@ bool TemplateFolderView::moveTemplates(std::set<const ThumbnailViewItem *> &rIte
return ret;
}
+void TemplateFolderView::copyFrom(const sal_uInt16 nRegionItemId, const OUString &rName,
+ const BitmapEx &rThumbnail, const OUString &rPath)
+{
+ sal_uInt16 nId = 0;
+ sal_uInt16 nRegionId = nRegionItemId - 1;
+
+ if (!mItemList.empty())
+ nId = (mItemList.back())->mnId;
+
+ String aPath(rPath);
+
+ if (mpDocTemplates->CopyFrom(nRegionId,nId,aPath))
+ {
+ TemplateItemProperties aTemplate;
+ aTemplate.nId = nId+1;
+ aTemplate.nRegionId = nRegionId;
+ aTemplate.aName = aPath;
+ aTemplate.aThumbnail = rThumbnail;
+ aTemplate.aPath = mpDocTemplates->GetPath(nRegionId,nId);
+ aTemplate.aType = SvFileInformationManager::GetDescription(INetURLObject(aPath));
+
+ for (size_t i = 0, n = mItemList.size(); i < n; ++i)
+ {
+ if (mItemList[i]->mnId == nRegionItemId)
+ {
+ TemplateFolderViewItem *pItem =
+ static_cast<TemplateFolderViewItem*>(mItemList[i]);
+
+ pItem->maTemplates.push_back(aTemplate);
+
+ lcl_updateThumbnails(pItem);
+ }
+ }
+
+ CalculateItemPositions();
+ }
+}
+
void TemplateFolderView::copyFrom (TemplateFolderViewItem *pItem, const rtl::OUString &rPath)
{
sal_uInt16 nId = 0;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index ea7b009efcfa..fffc400b7cf1 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -552,6 +552,8 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu)
// Check if we are displaying the local or remote templates
if (mpCurView == maView)
localMoveTo(nMenuId);
+ else
+ remoteMoveTo(nMenuId);
}
return 0;
@@ -915,6 +917,42 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId)
}
}
+void SfxTemplateManagerDlg::remoteMoveTo(const 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)
+ {
+ std::set<const ThumbnailViewItem*>::const_iterator aIter;
+ for (aIter = maSelTemplates.begin(); aIter != maSelTemplates.end(); ++aIter)
+ {
+ const TemplateSearchViewItem *pItem =
+ static_cast<const TemplateSearchViewItem*>(*aIter);
+
+ maView->copyFrom(nItemId,pItem->maTitle,pItem->maPreview1,pItem->getPath());
+ }
+ }
+}
+
void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId)
{
sal_uInt16 nItemId = 0;