summaryrefslogtreecommitdiffstats
path: root/sfx2
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-07-14 09:19:57 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-07-15 08:15:16 -0430
commit6c034219f3b0d2576b3261a4e9ba5c4d79b1ed91 (patch)
treebba08cbd51d43ba56e9beba3d6b8ed3ccefd351f /sfx2
parentSwitch main view between local/online repository. (diff)
downloadcore-6c034219f3b0d2576b3261a4e9ba5c4d79b1ed91.tar.gz
core-6c034219f3b0d2576b3261a4e9ba5c4d79b1ed91.zip
Load repositories URLs and names from user settings.
Change-Id: Iad7f62660abc59383d9933b198a57ac317361f38
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/Package_inc.mk1
-rw-r--r--sfx2/inc/sfx2/templateonlineview.hxx11
-rw-r--r--sfx2/inc/sfx2/templateonlineviewitem.hxx26
-rw-r--r--sfx2/source/control/templateonlineview.cxx44
-rw-r--r--sfx2/source/control/templateonlineviewitem.cxx21
6 files changed, 104 insertions, 0 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index c442df8b50a0..26ac64c42286 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -138,6 +138,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/control/templatefolderview \
sfx2/source/control/templatefolderviewitem \
sfx2/source/control/templateonlineview \
+ sfx2/source/control/templateonlineviewitem \
sfx2/source/control/templatesearchview \
sfx2/source/control/thumbnailviewitem \
sfx2/source/control/thumbnailviewacc \
diff --git a/sfx2/Package_inc.mk b/sfx2/Package_inc.mk
index b06adab4e44d..9c0cb5b12b97 100644
--- a/sfx2/Package_inc.mk
+++ b/sfx2/Package_inc.mk
@@ -122,6 +122,7 @@ $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templateview.hxx,sfx2/templa
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templatefolderview.hxx,sfx2/templatefolderview.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templatefolderviewitem.hxx,sfx2/templatefolderviewitem.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templateonlineview.hxx,sfx2/templateonlineview.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templateonlineviewitem.hxx,sfx2/templateonlineviewitem.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/thumbnailview.hxx,sfx2/thumbnailview.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/thumbnailviewitem.hxx,sfx2/thumbnailviewitem.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/titledockwin.hxx,sfx2/titledockwin.hxx))
diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx
index 7345df07c1df..70e898952b9f 100644
--- a/sfx2/inc/sfx2/templateonlineview.hxx
+++ b/sfx2/inc/sfx2/templateonlineview.hxx
@@ -12,6 +12,8 @@
#include <sfx2/thumbnailview.hxx>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+
class TemplateOnlineView : public ThumbnailView
{
public:
@@ -19,6 +21,15 @@ public:
TemplateOnlineView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
virtual ~TemplateOnlineView ();
+
+ // Load repositories from user settings.
+ void Populate ();
+
+private:
+
+ com::sun::star::uno::Sequence< rtl::OUString > maUrls;
+ com::sun::star::uno::Sequence< rtl::OUString > maNames;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
};
#endif // __SFX2_TEMPLATEONLINEVIEW_HXX__
diff --git a/sfx2/inc/sfx2/templateonlineviewitem.hxx b/sfx2/inc/sfx2/templateonlineviewitem.hxx
new file mode 100644
index 000000000000..aa5cdec7ca58
--- /dev/null
+++ b/sfx2/inc/sfx2/templateonlineviewitem.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __SFX2_TEMPLATEONLINEVIEWITEM_HXX__
+#define __SFX2_TEMPLATEONLINEVIEWITEM_HXX__
+
+#include <sfx2/thumbnailviewitem.hxx>
+
+class TemplateOnlineViewItem : public ThumbnailViewItem
+{
+public:
+
+ TemplateOnlineViewItem (ThumbnailView &rView, Window *pParent);
+
+ virtual ~TemplateOnlineViewItem ();
+};
+
+#endif // __SFX2_TEMPLATEONLINEVIEWITEM_HXX__
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx
index cc06e59bc410..8ccc56b387b0 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -9,13 +9,57 @@
#include <sfx2/templateonlineview.hxx>
+#include <comphelper/processfactory.hxx>
+#include <officecfg/Office/Common.hxx>
+#include <sfx2/templateonlineviewitem.hxx>
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/commandenvironment.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+using namespace com::sun::star;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+
TemplateOnlineView::TemplateOnlineView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren)
: ThumbnailView(pParent,nWinStyle,bDisableTransientChildren)
{
+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+ Reference< XInteractionHandler > xGlobalInteractionHandler = Reference< XInteractionHandler >(
+ xFactory->createInstance("com.sun.star.task.InteractionHandler" ), UNO_QUERY );
+
+ m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() );
}
TemplateOnlineView::~TemplateOnlineView ()
{
}
+void TemplateOnlineView::Populate()
+{
+ uno::Reference < uno::XComponentContext > m_context(comphelper::getProcessComponentContext());
+
+ // Load from user settings
+ maUrls = officecfg::Office::Common::Misc::FilePickerPlacesUrls::get(m_context);
+ maNames = officecfg::Office::Common::Misc::FilePickerPlacesNames::get(m_context);
+
+ for (sal_Int32 i = 0; i < maUrls.getLength() && i < maNames.getLength(); ++i)
+ {
+ TemplateOnlineViewItem *pItem = new TemplateOnlineViewItem(*this,this);
+
+ pItem->mnId = i+1;
+ pItem->maTitle = maNames[i];
+
+ mItemList.push_back(pItem);
+ }
+
+ CalculateItemPositions();
+
+ if (IsReallyVisible() && IsUpdateMode())
+ Invalidate();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/templateonlineviewitem.cxx b/sfx2/source/control/templateonlineviewitem.cxx
new file mode 100644
index 000000000000..e874a3dfed41
--- /dev/null
+++ b/sfx2/source/control/templateonlineviewitem.cxx
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sfx2/templateonlineviewitem.hxx>
+
+TemplateOnlineViewItem::TemplateOnlineViewItem (ThumbnailView &rView, Window *pParent)
+ : ThumbnailViewItem(rView,pParent)
+{
+}
+
+TemplateOnlineViewItem::~TemplateOnlineViewItem()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */