summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/inc/sfx2/templateonlineview.hxx3
-rw-r--r--sfx2/inc/sfx2/templateonlineviewitem.hxx8
-rw-r--r--sfx2/source/control/templateonlineview.cxx7
-rw-r--r--sfx2/source/doc/templatedlg.cxx2
4 files changed, 17 insertions, 3 deletions
diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx
index 36372e83d82b..035456033820 100644
--- a/sfx2/inc/sfx2/templateonlineview.hxx
+++ b/sfx2/inc/sfx2/templateonlineview.hxx
@@ -11,6 +11,7 @@
#define __SFX2_TEMPLATEONLINEVIEW_HXX__
#include <sfx2/templateabstractview.hxx>
+#include <sfx2/templateproperties.hxx>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
@@ -31,7 +32,7 @@ public:
virtual void showOverlay (bool bVisible);
- bool loadRepository (const sal_uInt16 nRepositoryId);
+ bool loadRepository (const sal_uInt16 nRepositoryId, bool bRefresh);
const std::vector<TemplateOnlineViewItem*>& getRepositories () const { return maRepositories; }
diff --git a/sfx2/inc/sfx2/templateonlineviewitem.hxx b/sfx2/inc/sfx2/templateonlineviewitem.hxx
index 1d9f9cd50abc..07996b382946 100644
--- a/sfx2/inc/sfx2/templateonlineviewitem.hxx
+++ b/sfx2/inc/sfx2/templateonlineviewitem.hxx
@@ -11,6 +11,7 @@
#define __SFX2_TEMPLATEONLINEVIEWITEM_HXX__
#include <sfx2/thumbnailviewitem.hxx>
+#include <sfx2/templateproperties.hxx>
class TemplateOnlineViewItem : public ThumbnailViewItem
{
@@ -24,9 +25,16 @@ public:
const rtl::OUString& getURL () const { return maUrl; }
+ void insertTemplate (const TemplateItemProperties &prop) { maTemplates.push_back(prop); }
+
+ void clearTemplates () { maTemplates.clear(); }
+
+ const std::vector<TemplateItemProperties>& getTemplates () const { return maTemplates; }
+
private:
rtl::OUString maUrl;
+ std::vector<TemplateItemProperties> maTemplates;
};
#endif // __SFX2_TEMPLATEONLINEVIEWITEM_HXX__
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx
index 7087b35ff5d8..b8b978fad849 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -113,7 +113,7 @@ void TemplateOnlineView::showOverlay (bool bVisible)
}
}
-bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId)
+bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId, bool bRefresh)
{
TemplateOnlineViewItem *pItem = NULL;
@@ -129,6 +129,9 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId)
if (!pItem)
return false;
+ if (!pItem->getTemplates().empty() && !bRefresh)
+ return true;
+
rtl::OUString aURL = static_cast<TemplateOnlineViewItem*>(pItem)->getURL();
try
@@ -158,6 +161,7 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId)
if ( xResultSet.is() )
{
+ pItem->clearTemplates();
mpItemView->Clear();
uno::Reference< XRow > xRow( xResultSet, UNO_QUERY );
@@ -217,6 +221,7 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId)
aTemplateItem.aType = SvFileInformationManager::GetFileDescription(INetURLObject(sRealURL));
+ pItem->insertTemplate(aTemplateItem);
aItems.push_back(aTemplateItem);
++nIdx;
}
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 765f66436d62..d3eff745ded9 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -590,7 +590,7 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu)
{
sal_uInt16 nRepoId = nMenuId - MNI_REPOSITORY_BASE;
- if (mpOnlineView->loadRepository(nRepoId))
+ if (mpOnlineView->loadRepository(nRepoId,false))
{
switchMainView(false);
mpOnlineView->showOverlay(true);