diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-11 19:45:16 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-11 19:57:52 -0430 |
commit | a7b9e624ac24f2af02f53930f75ebf36f1cdfa0d (patch) | |
tree | 7c6d4a9fa1c8615000fcd854eea606e6afa0b623 /sfx2 | |
parent | 53c0b9533fb2225da0bed755eca9fe696f191096 (diff) |
Change repository name and update repository menu list.
Change-Id: I9e29795d93481bb0789e4f05fa2605b6407efc8c
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/templateonlineview.hxx | 3 | ||||
-rw-r--r-- | sfx2/inc/templatedlg.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/templateonlineview.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 7 |
4 files changed, 24 insertions, 5 deletions
diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx index aed70d293f81..0d88d0bc3d71 100644 --- a/sfx2/inc/sfx2/templateonlineview.hxx +++ b/sfx2/inc/sfx2/templateonlineview.hxx @@ -34,6 +34,8 @@ public: virtual void showOverlay (bool bVisible); + void setOverlayChangeNameHdl (const Link &rLink); + bool loadRepository (const sal_uInt16 nRepositoryId, bool bRefresh); const std::vector<TemplateOnlineViewItem*>& getRepositories () const { return maRepositories; } @@ -53,6 +55,7 @@ private: private: bool mbIsSynced; + Link maChangeNameHdl; std::vector<TemplateOnlineViewItem*> maRepositories; com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv; }; diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index c50eec24c502..bed10a6f1f0a 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -70,6 +70,8 @@ private: DECL_LINK(SearchUpdateHdl, void*); + DECL_LINK(RepositoryChangeNameHdl, void*); + void OnTemplateImport (); void OnTemplateSearch (); void OnTemplateEdit (); diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx index 9828489249f5..213375286d31 100644 --- a/sfx2/source/control/templateonlineview.cxx +++ b/sfx2/source/control/templateonlineview.cxx @@ -118,6 +118,11 @@ void TemplateOnlineView::showOverlay (bool bVisible) } } +void TemplateOnlineView::setOverlayChangeNameHdl(const Link &rLink) +{ + maChangeNameHdl = rLink; +} + bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId, bool bRefresh) { TemplateOnlineViewItem *pItem = NULL; @@ -319,16 +324,18 @@ void TemplateOnlineView::setItemDimensions(long ItemWidth, long ThumbnailHeight, IMPL_LINK (TemplateOnlineView, ChangeNameHdl, TemplateView*, pView) { - bool bRet = true; - mbIsSynced = false; + bool bRet = false; // check if there isnt another repository with the same name. for (size_t i = 0, n = maRepositories.size(); i < n; ++i) { - if (maRepositories[i]->maTitle == pView->getName()) + if (maRepositories[i]->mnId == pView->getId()) { - bRet = false; - mbIsSynced = true; + maRepositories[i]->maTitle = pView->getName(); + + bRet = true; + mbIsSynced = false; + maChangeNameHdl.Call(this); break; } } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 630353de7156..bc83ecf18adf 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -222,6 +222,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) mpOnlineView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); mpOnlineView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); mpOnlineView->setOverlayCloseHdl(LINK(this,SfxTemplateManagerDlg,CloseOverlayHdl)); + mpOnlineView->setOverlayChangeNameHdl(LINK(this,SfxTemplateManagerDlg,RepositoryChangeNameHdl)); mpSearchView->SetSizePixel(aThumbSize); mpSearchView->setItemMaxTextLength(ITEM_MAX_TEXT_LENGTH); @@ -692,6 +693,12 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, SearchUpdateHdl) return 0; } +IMPL_LINK_NOARG (SfxTemplateManagerDlg, RepositoryChangeNameHdl) +{ + createRepositoryMenu(); + return 0; +} + void SfxTemplateManagerDlg::OnTemplateImport () { sal_Int16 nDialogType = |