diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-08 09:39:27 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-08 10:25:55 -0430 |
commit | 1d3ec03fdcf049788e0f3b81d60fecad6f34ee25 (patch) | |
tree | 3597d5e8fd7a8590e4801e8c40ab6dcea67dfaac /sfx2 | |
parent | 5bb9e2f5bb136d8c5844584e3203e8245094d409 (diff) |
Delete currently open remote overlay.
Change-Id: Iaf25b4110b41c3404a141d70342a59ef05d05ceb
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/templateonlineview.hxx | 2 | ||||
-rw-r--r-- | sfx2/inc/templatedlg.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/control/templateonlineview.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 16 |
4 files changed, 38 insertions, 1 deletions
diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx index 36d9f1b38cea..aed70d293f81 100644 --- a/sfx2/inc/sfx2/templateonlineview.hxx +++ b/sfx2/inc/sfx2/templateonlineview.hxx @@ -40,6 +40,8 @@ public: void insertRepository (const OUString &rName, const OUString &rURL); + bool deleteRepository (const sal_uInt16 nRepositoryId); + void syncRepositories () const; void setItemDimensions (long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding); diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index ffbfc31f3eb2..899179192d10 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -76,6 +76,7 @@ private: void OnTemplateProperties (); void OnTemplateDelete (); void OnFolderDelete (); + void OnRepositoryDelete (); void centerTopButtons (); diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx index a3428f411473..9828489249f5 100644 --- a/sfx2/source/control/templateonlineview.cxx +++ b/sfx2/source/control/templateonlineview.cxx @@ -267,6 +267,26 @@ void TemplateOnlineView::insertRepository(const OUString &rName, const OUString mbIsSynced = false; } +bool TemplateOnlineView::deleteRepository(const sal_uInt16 nRepositoryId) +{ + bool bRet = false; + + for (size_t i = 0, n = maRepositories.size(); i < n; ++i) + { + if (maRepositories[i]->mnId == nRepositoryId) + { + delete maRepositories[i]; + + maRepositories.erase(maRepositories.begin() + i); + mbIsSynced = false; + bRet = true; + break; + } + } + + return bRet; +} + void TemplateOnlineView::syncRepositories() const { if (!mbIsSynced) diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index c029fc8a3283..1e80c28b986c 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -340,7 +340,10 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXViewHdl) OnTemplateImport(); break; case TBI_TEMPLATE_FOLDER_DEL: - OnFolderDelete(); + if (mpCurView == maView) + OnFolderDelete(); + else + OnRepositoryDelete(); break; default: break; @@ -870,6 +873,17 @@ void SfxTemplateManagerDlg::OnFolderDelete() } } +void SfxTemplateManagerDlg::OnRepositoryDelete() +{ + if(mpOnlineView->deleteRepository(mpOnlineView->getOverlayRegionId())) + { + // close overlay and switch to local view + switchMainView(true); + + createRepositoryMenu(); + } +} + void SfxTemplateManagerDlg::centerTopButtons() { Point aFirstBtnPos = aButtonAll.GetPosPixel(); |